提交代码
parent
6d6a08686e
commit
bc2ec1efce
|
@ -1,9 +1,14 @@
|
|||
package com.yanzhu.common.core.domain.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import com.yanzhu.common.utils.StringUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.yanzhu.common.annotation.Excel;
|
||||
|
@ -94,6 +99,21 @@ public class SysRole extends BaseEntity
|
|||
return roleId != null && 1L == roleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断单位管理员
|
||||
* @param roles
|
||||
* @return
|
||||
*/
|
||||
public static boolean roleIsDeptAdmin(List<SysRole> roles)
|
||||
{
|
||||
if(CollectionUtils.isNotEmpty(roles)){
|
||||
List<SysRole> superAdmin = roles.stream().filter(sr -> sr.getRoleId()==2L).collect(Collectors.toList());
|
||||
return StringUtils.isNotEmpty(superAdmin);
|
||||
}else{
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
||||
public String getRoleName()
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.yanzhu.flowable.controller;
|
|||
|
||||
import com.yanzhu.common.core.controller.BaseController;
|
||||
import com.yanzhu.common.core.domain.AjaxResult;
|
||||
import com.yanzhu.common.core.domain.entity.SysRole;
|
||||
import com.yanzhu.common.core.domain.entity.SysUser;
|
||||
import com.yanzhu.common.core.page.TableDataInfo;
|
||||
import com.yanzhu.flowable.service.IFlowBusinessKeyService;
|
||||
|
@ -100,9 +101,13 @@ public class FlowBusinessKeyController extends BaseController {
|
|||
//超管查询所有数据
|
||||
if(!SysUser.isAdmin(super.getUserId())){
|
||||
SysUser sysUser = super.getLoginUser().getUser();
|
||||
flowTaskEntity.setAssigneeId(sysUser.getUserId());
|
||||
flowTaskEntity.setDeptAncestors(sysUser.getDept().getAncestors()+","+sysUser.getDeptId());
|
||||
flowTaskEntity.setRoleIds(sysUser.getRoles().stream().map(role -> role.getRoleId()).collect(Collectors.toList()));
|
||||
if(SysRole.roleIsDeptAdmin(sysUser.getRoles())){
|
||||
flowTaskEntity.setDeptAncestors(sysUser.getDept().getAncestors()+","+sysUser.getDeptId());
|
||||
}else{
|
||||
flowTaskEntity.setAssigneeId(sysUser.getUserId());
|
||||
flowTaskEntity.setDeptAncestors(sysUser.getDept().getAncestors()+","+sysUser.getDeptId());
|
||||
flowTaskEntity.setRoleIds(sysUser.getRoles().stream().map(role -> role.getRoleId()).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
return getDataTable(flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity));
|
||||
}
|
||||
|
|
|
@ -70,9 +70,6 @@ public class FlowDefinitionController extends BaseController {
|
|||
@GetMapping(value = "/list")
|
||||
@ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class)
|
||||
public AjaxResult list(FlowQueryVo flowQueryVo) {
|
||||
if(!SysUser.isAdmin(super.getUserId())){
|
||||
flowQueryVo.setDeptId(Convert.toLong(super.getLoginUser().getUser().getDept().getAncestors().split(",")[2]));
|
||||
}
|
||||
return AjaxResult.success(flowDefinitionService.list(flowQueryVo));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,11 @@ import com.yanzhu.common.core.domain.AjaxResult;
|
|||
import com.yanzhu.project.domain.ProProjectApply;
|
||||
import com.yanzhu.system.domain.flowable.FlowQueryVo;
|
||||
import com.yanzhu.system.domain.FlowProcDefDto;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -43,6 +45,13 @@ public interface IFlowDefinitionService {
|
|||
*/
|
||||
AjaxResult readXml(String deployId) throws IOException;
|
||||
|
||||
/**
|
||||
* 读取流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
public List<FlowElement> readNodes(String deployId);
|
||||
|
||||
/**
|
||||
* 根据流程定义ID启动流程实例
|
||||
*
|
||||
|
|
|
@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.repository.ProcessDefinitionQuery;
|
||||
|
@ -91,6 +92,9 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
public Page<FlowProcDefDto> list(FlowQueryVo flowQueryVo) {
|
||||
Page<FlowProcDefDto> page = new Page<>();
|
||||
PageHelper.startPage(flowQueryVo.getPageNum(), flowQueryVo.getPageSize());
|
||||
if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){
|
||||
flowQueryVo.setDeptId(SecurityUtils.getLoginUser().getUser().getParDeptId());
|
||||
}
|
||||
List<FlowProcDefDto> dataList = flowDeployMapper.selectDeployList(flowQueryVo);
|
||||
// 加载挂表单
|
||||
/**for (FlowProcDefDto procDef : dataList) {
|
||||
|
@ -140,7 +144,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
}
|
||||
}else{
|
||||
// 从部门祖籍列表中获取项目单位信息...
|
||||
Long projectDeptId = Convert.toLong(SecurityUtils.getLoginUser().getUser().getDept().getAncestors().split(",")[2]);
|
||||
Long projectDeptId = Convert.toLong(SecurityUtils.getLoginUser().getUser().getParDeptId());
|
||||
flowDeptVo.setDeptId(projectDeptId);
|
||||
}
|
||||
if(flowDeptVo.getDeptId()!=null){
|
||||
|
@ -189,6 +193,28 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FlowElement> readNodes(String deployId) {
|
||||
List<FlowElement> list = new ArrayList<>();
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
|
||||
//获得图片流
|
||||
DefaultProcessDiagramGenerator diagramGenerator = new DefaultProcessDiagramGenerator();
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
|
||||
Collection<FlowElement> flowElements = bpmnModel.getProcesses().get(0).getFlowElements();
|
||||
if(flowElements.size()>0){
|
||||
for(FlowElement fe:flowElements){
|
||||
list.add(fe);
|
||||
}
|
||||
}
|
||||
//输出为节点描述
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程定义ID启动流程实例
|
||||
*
|
||||
|
|
|
@ -62,7 +62,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
|
|||
|
||||
//设置项目单位信息
|
||||
if(!user.isAdmin()){
|
||||
Long deptId = Convert.toLong(user.getDept().getAncestors().split(",")[2]);
|
||||
Long deptId = Convert.toLong(user.getDept().getAncestors().split(",")[3]);
|
||||
if(deptId != null){
|
||||
SysDept sysDept = sysDeptService.selectDeptById(deptId);
|
||||
user.setParDeptId(sysDept.getDeptId());
|
||||
|
|
|
@ -115,7 +115,7 @@ public class ProProjectInfoController extends BaseController
|
|||
ProProjectInfo proProjectInfo = new ProProjectInfo();
|
||||
//超管查询所有数据
|
||||
if(!SysUser.isAdmin(super.getUserId())){
|
||||
proProjectInfo.setDeptId(Convert.toLong(super.getLoginUser().getUser().getDept().getAncestors().split(",")[2]));
|
||||
proProjectInfo.setDeptId(Convert.toLong(super.getLoginUser().getUser().getParDeptId()));
|
||||
}
|
||||
proProjectInfo.setIsDel(ShiFouEnum.FOU.getCode());
|
||||
List<ProProjectInfo> list = proProjectInfoService.selectProProjectInfoList(proProjectInfo);
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<if test="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and date(fa.createTime) between #{params.beginDate} and #{params.endDate}</if>
|
||||
<!-- 查询条件-项目部门 -->
|
||||
<if test="deptAncestors != null and deptAncestors != ''"> and find_in_set(fa.businessDeptId, #{deptAncestors}) </if>
|
||||
<if test="roleIds !=null and roleIds.size()>0">
|
||||
<if test="assigneeId != null and assigneeId != '' and roleIds !=null and roleIds.size()>0">
|
||||
AND (fa.ASSIGNEE_ = #{assigneeId}
|
||||
OR (
|
||||
fa.ASSIGNEE_ IS NULL
|
||||
|
|
|
@ -16,4 +16,74 @@
|
|||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.yanzhu</groupId>
|
||||
<artifactId>yanzhu-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.yanzhu</groupId>
|
||||
<artifactId>yanzhu-flowable</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.yanzhu</groupId>
|
||||
<artifactId>yanzhu-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.yanzhu</groupId>
|
||||
<artifactId>yanzhu-mapper</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,30 @@
|
|||
package com.yanzhu;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author yanZhu
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class WxYanZhuApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(WxYanZhuApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 研筑临时项目小程序服务启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.yanzhu;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author yanZhu
|
||||
*/
|
||||
public class WxYanzhuServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(WxYanZhuApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.yanzhu.wechat.common;
|
||||
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.yanzhu.common.config.YanZhuConfig;
|
||||
import com.yanzhu.common.constant.CacheConstants;
|
||||
import com.yanzhu.common.constant.Constants;
|
||||
import com.yanzhu.common.core.domain.AjaxResult;
|
||||
import com.yanzhu.common.core.redis.RedisCache;
|
||||
import com.yanzhu.common.utils.sign.Base64;
|
||||
import com.yanzhu.common.utils.uuid.IdUtils;
|
||||
import com.yanzhu.system.service.ISysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 验证码操作处理
|
||||
*
|
||||
* @author yanZhu
|
||||
*/
|
||||
@RestController
|
||||
public class CaptchaController
|
||||
{
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
/**
|
||||
* 生成验证码
|
||||
*/
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||
ajax.put("captchaEnabled", captchaEnabled);
|
||||
if (!captchaEnabled)
|
||||
{
|
||||
return ajax;
|
||||
}
|
||||
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtils.simpleUUID();
|
||||
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
||||
|
||||
String capStr = null, code = null;
|
||||
BufferedImage image = null;
|
||||
|
||||
// 生成验证码
|
||||
String captchaType = YanZhuConfig.getCaptchaType();
|
||||
if ("math".equals(captchaType))
|
||||
{
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
image = captchaProducerMath.createImage(capStr);
|
||||
}
|
||||
else if ("char".equals(captchaType))
|
||||
{
|
||||
capStr = code = captchaProducer.createText();
|
||||
image = captchaProducer.createImage(capStr);
|
||||
}
|
||||
|
||||
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
// 转换流信息写出
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||
try
|
||||
{
|
||||
ImageIO.write(image, "jpg", os);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
package com.yanzhu.wechat.common;
|
||||
|
||||
import com.yanzhu.common.config.YanZhuConfig;
|
||||
import com.yanzhu.common.constant.Constants;
|
||||
import com.yanzhu.common.core.domain.AjaxResult;
|
||||
import com.yanzhu.common.utils.StringUtils;
|
||||
import com.yanzhu.common.utils.file.FileUploadUtils;
|
||||
import com.yanzhu.common.utils.file.FileUtils;
|
||||
import com.yanzhu.framework.config.ServerConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
* @author yanZhu
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxApi/common")
|
||||
public class CommonController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
private static final String FILE_DELIMETER = ",";
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(fileName))
|
||||
{
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
String filePath = YanZhuConfig.getDownloadPath() + fileName;
|
||||
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = YanZhuConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = YanZhuConfig.getUploadPath();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
urls.add(url);
|
||||
fileNames.add(fileName);
|
||||
newFileNames.add(FileUtils.getName(fileName));
|
||||
originalFilenames.add(file.getOriginalFilename());
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@GetMapping("/download/resource")
|
||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(resource))
|
||||
{
|
||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||
}
|
||||
// 本地资源路径
|
||||
String localPath = YanZhuConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,288 @@
|
|||
package com.yanzhu.wechat.controller;
|
||||
|
||||
import com.yanzhu.common.annotation.Log;
|
||||
import com.yanzhu.common.core.controller.BaseController;
|
||||
import com.yanzhu.common.core.domain.AjaxResult;
|
||||
import com.yanzhu.common.core.domain.entity.SysRole;
|
||||
import com.yanzhu.common.core.domain.entity.SysUser;
|
||||
import com.yanzhu.common.core.page.TableDataInfo;
|
||||
import com.yanzhu.common.core.redis.RedisCache;
|
||||
import com.yanzhu.common.enums.BusinessType;
|
||||
import com.yanzhu.common.enums.OperatorType;
|
||||
import com.yanzhu.flowable.domain.FlowTaskDto;
|
||||
import com.yanzhu.flowable.domain.FlowTaskVo;
|
||||
import com.yanzhu.flowable.service.IFlowBusinessKeyService;
|
||||
import com.yanzhu.flowable.service.IFlowDefinitionService;
|
||||
import com.yanzhu.flowable.service.IFlowInstanceService;
|
||||
import com.yanzhu.flowable.service.IFlowTaskService;
|
||||
import com.yanzhu.system.domain.flowable.FlowQueryVo;
|
||||
import com.yanzhu.system.domain.flowable.FlowTaskEntity;
|
||||
import com.yanzhu.wechat.domain.StartProcessInstanceVo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version : V1.0
|
||||
* @ClassName: WxFlowableController
|
||||
* @Description: 工作流任务
|
||||
* @Auther: JiangYuQi
|
||||
* @Date: 2024/02/25 18:03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxApi/flowTask")
|
||||
public class WxFlowableController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private IFlowTaskService flowTaskService;
|
||||
|
||||
@Autowired
|
||||
private IFlowInstanceService flowInstanceService;
|
||||
|
||||
@Autowired
|
||||
private IFlowDefinitionService flowDefinitionService;
|
||||
|
||||
@Autowired
|
||||
private IFlowBusinessKeyService flowBusinessKeyService;
|
||||
|
||||
/**
|
||||
* 启动流程实例
|
||||
* @param startProcessInstanceVo
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "发起流程", businessType = BusinessType.INSERT, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping("/startProcessInstance")
|
||||
public AjaxResult startProcessInstance(@RequestBody @Valid StartProcessInstanceVo startProcessInstanceVo) {
|
||||
return flowDefinitionService.startProcessInstanceById(startProcessInstanceVo.getProcDefId(), startProcessInstanceVo.getProProjectApply());
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的流程实例列表
|
||||
* @param flowQueryVo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/myDefinitionList")
|
||||
public AjaxResult myDefinitionList(FlowQueryVo flowQueryVo) {
|
||||
return AjaxResult.success(flowDefinitionService.list(flowQueryVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询流程节点")
|
||||
@GetMapping("/readNotes/{deployId}")
|
||||
public AjaxResult readNotes(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId) {
|
||||
return success(flowDefinitionService.readNodes(deployId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消申请
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "取消申请", response = FlowTaskDto.class)
|
||||
@Log(title = "取消申请", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping(value = "/stopProcess")
|
||||
public AjaxResult stopProcess(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.stopProcess(flowTaskVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回流程
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "撤回流程", response = FlowTaskDto.class)
|
||||
@Log(title = "撤回流程", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping(value = "/revokeProcess")
|
||||
public AjaxResult revokeProcess(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.revokeProcess(flowTaskVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批任务
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "审批任务")
|
||||
@Log(title = "审批流程", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping(value = "/complete")
|
||||
public AjaxResult complete(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.complete(flowTaskVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 驳回任务
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "驳回任务")
|
||||
@Log(title = "驳回流程", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping(value = "/reject")
|
||||
public AjaxResult taskReject(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.taskReject(flowTaskVo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 退回任务
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "退回任务")
|
||||
@Log(title = "退回流程", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping(value = "/return")
|
||||
public AjaxResult taskReturn(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.taskReturn(flowTaskVo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除流程实例")
|
||||
@Log(title = "删除流程", businessType = BusinessType.DELETE, operatorType = OperatorType.MOBILE)
|
||||
@DeleteMapping(value = "/delete/{instanceId}")
|
||||
public AjaxResult delete(@ApiParam(value = "流程实例ID", required = true) @PathVariable String instanceId,
|
||||
@ApiParam(value = "删除原因") @RequestParam(required = false) String deleteReason) {
|
||||
flowInstanceService.delete(instanceId,deleteReason);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "委派任务")
|
||||
@Log(title = "委派流程", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping(value = "/delegateTask")
|
||||
public AjaxResult delegate(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.delegateTask(flowTaskVo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "转办任务")
|
||||
@Log(title = "转办流程", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping(value = "/assignTask")
|
||||
public AjaxResult assign(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.assignTask(flowTaskVo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有可回退的节点
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取所有可回退的节点")
|
||||
@PostMapping(value = "/returnList")
|
||||
public AjaxResult findReturnTaskList(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.findReturnTaskList(flowTaskVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程Id查询操作日志
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findCommentByProcInsId")
|
||||
public AjaxResult findCommentByProcInsId(String procInsId) {
|
||||
return success(flowBusinessKeyService.selectCommentByProcInsId(procInsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程Id查询表单数据
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findFormDatasByProcInsId")
|
||||
public AjaxResult findFormDatasByProcInsId(String procInsId) {
|
||||
return success(flowBusinessKeyService.selectFormDatasByProcInsId(procInsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询我的代办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/myAwaitFlowTaskList")
|
||||
public TableDataInfo myAwaitFlowTaskList(@RequestBody FlowTaskEntity flowTaskEntity) {
|
||||
startPage();
|
||||
//超管查询所有数据
|
||||
if(!SysUser.isAdmin(super.getUserId())){
|
||||
SysUser sysUser = super.getLoginUser().getUser();
|
||||
if(SysRole.roleIsDeptAdmin(sysUser.getRoles())){
|
||||
flowTaskEntity.setDeptAncestors(sysUser.getDept().getAncestors()+","+sysUser.getDeptId());
|
||||
}else{
|
||||
flowTaskEntity.setAssigneeId(sysUser.getUserId());
|
||||
flowTaskEntity.setDeptAncestors(sysUser.getDept().getAncestors()+","+sysUser.getDeptId());
|
||||
flowTaskEntity.setRoleIds(sysUser.getRoles().stream().map(role -> role.getRoleId()).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
return getDataTable(flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询我的代办任务数量
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/myAwaitFlowTaskListCount")
|
||||
public AjaxResult myAwaitFlowTaskListCount(@RequestBody FlowTaskEntity flowTaskEntity) {
|
||||
//超管查询所有数据
|
||||
if(!SysUser.isAdmin(super.getUserId())){
|
||||
SysUser sysUser = super.getLoginUser().getUser();
|
||||
flowTaskEntity.setAssigneeId(sysUser.getUserId());
|
||||
flowTaskEntity.setDeptAncestors(sysUser.getDept().getAncestors()+","+sysUser.getDeptId());
|
||||
flowTaskEntity.setRoleIds(sysUser.getRoles().stream().map(role -> role.getRoleId()).collect(Collectors.toList()));
|
||||
}
|
||||
List<Map<String, Object>> list = flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity);
|
||||
Map<String,Object> data = new HashMap<>();
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
data.put("todo",list.size());
|
||||
}else{
|
||||
data.put("todo",0);
|
||||
}
|
||||
return success(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据条件查询我的已办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/myFinishedFlowTaskList")
|
||||
public TableDataInfo myFinishedFlowTaskList(FlowTaskEntity flowTaskEntity) {
|
||||
startPage();
|
||||
return getDataTable(flowBusinessKeyService.selectMyFinishedFlowTask(flowTaskEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询所有流任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/allList")
|
||||
public TableDataInfo allList(FlowTaskEntity flowTaskEntity) {
|
||||
startPage();
|
||||
return getDataTable(flowBusinessKeyService.selectAllFlowTaskByParams(flowTaskEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件统计所有流任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryCount")
|
||||
public AjaxResult queryCount(FlowTaskEntity flowTaskEntity) {
|
||||
return success(flowBusinessKeyService.quueryCount(flowTaskEntity));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.yanzhu.wechat.controller;
|
||||
|
||||
import com.yanzhu.common.annotation.RateLimiter;
|
||||
import com.yanzhu.common.constant.Constants;
|
||||
import com.yanzhu.common.core.controller.BaseController;
|
||||
import com.yanzhu.common.core.domain.AjaxResult;
|
||||
import com.yanzhu.common.core.domain.model.LoginBody;
|
||||
import com.yanzhu.common.core.redis.RedisCache;
|
||||
import com.yanzhu.common.enums.LimitType;
|
||||
import com.yanzhu.framework.web.service.SysLoginService;
|
||||
import com.yanzhu.framework.web.service.TokenService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @version : V1.0
|
||||
* @ClassName: LoginController
|
||||
* @Description: 用户登录
|
||||
* @Auther: JiangYuQi
|
||||
* @Date: 2020/7/7 18:03
|
||||
*/
|
||||
@RestController
|
||||
public class WxLoginController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "账号密码登录")
|
||||
@RateLimiter(count = 10, limitType = LimitType.IP)
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),loginBody.getUuid());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
package com.yanzhu.wechat.controller;
|
||||
|
||||
import com.yanzhu.base.domain.BaseAssetsType;
|
||||
import com.yanzhu.base.service.IBaseAssetsTypeService;
|
||||
import com.yanzhu.common.constant.Constants;
|
||||
import com.yanzhu.common.core.controller.BaseController;
|
||||
import com.yanzhu.common.core.domain.AjaxResult;
|
||||
import com.yanzhu.common.core.domain.entity.SysDept;
|
||||
import com.yanzhu.common.core.domain.entity.SysRole;
|
||||
import com.yanzhu.common.core.domain.entity.SysUser;
|
||||
import com.yanzhu.common.core.page.TableDataInfo;
|
||||
import com.yanzhu.common.core.redis.RedisCache;
|
||||
import com.yanzhu.common.utils.DictUtils;
|
||||
import com.yanzhu.common.utils.StringUtils;
|
||||
import com.yanzhu.project.service.IProProjectApplyService;
|
||||
import com.yanzhu.system.service.ISysDeptService;
|
||||
import com.yanzhu.system.service.ISysPostService;
|
||||
import com.yanzhu.system.service.ISysRoleService;
|
||||
import com.yanzhu.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 项目申请Controller
|
||||
*
|
||||
* @author yanZhu
|
||||
* @date 2024-02-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxApi/publics")
|
||||
public class WxPublicsController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private IBaseAssetsTypeService baseAssetsTypeService;
|
||||
|
||||
@Autowired
|
||||
private IProProjectApplyService proProjectApplyService;
|
||||
|
||||
/**
|
||||
* 获取项目申请详细信息
|
||||
*/
|
||||
@GetMapping(value = "/projectApply/{id}")
|
||||
public AjaxResult projectApplyInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(proProjectApplyService.selectProProjectApplyById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物资类型
|
||||
*/
|
||||
@GetMapping("/findAllByCategory/{category}")
|
||||
public AjaxResult findAllByCategory(@PathVariable String category)
|
||||
{
|
||||
SysUser sysUser = super.getLoginUser().getUser();
|
||||
String key = "YANZHU.BASE.ASSETSTYPE.findAllByCategory." + sysUser.getParDeptId() + "." + category;
|
||||
Object object = redisCache.getCacheObject(key);
|
||||
if (object != null) {
|
||||
return success(object);
|
||||
}
|
||||
List<BaseAssetsType> list = baseAssetsTypeService.findAllByCategory(category);
|
||||
redisCache.setCacheObject(key, list, Constants.BASE_DATA_EXPIRATION, TimeUnit.MINUTES);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@GetMapping("/user/list")
|
||||
public TableDataInfo userList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取详细信息
|
||||
*/
|
||||
@GetMapping(value = "/user/info")
|
||||
public AjaxResult userInfo()
|
||||
{
|
||||
return success(super.getLoginUser().getUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@GetMapping("/dept/deptTree")
|
||||
public AjaxResult deptTree(SysDept dept)
|
||||
{
|
||||
return success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询演训类型
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/dict/{key}")
|
||||
public AjaxResult dictValues(@PathVariable("key") String key){
|
||||
return success(DictUtils.getDictCache(key));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.yanzhu.wechat.domain;
|
||||
|
||||
import com.yanzhu.project.domain.ProProjectApply;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @version : V1.0
|
||||
* @ClassName: StartProcessInstanceVo
|
||||
* @Description: 流程启动对象
|
||||
* @Auther: JiangYuQi
|
||||
* @Date: 2020/7/7 18:03
|
||||
*/
|
||||
@Data
|
||||
public class StartProcessInstanceVo {
|
||||
|
||||
/**
|
||||
* 流程实例ID
|
||||
*/
|
||||
@NotBlank(message = "流程实例ID不能为空")
|
||||
private String procDefId;
|
||||
|
||||
/**
|
||||
* 流程关联表单
|
||||
*/
|
||||
@NotNull(message = "流程关联表单不能为空")
|
||||
private ProProjectApply proProjectApply;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.yanzhu.wechat.domain;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
public class WxLoginVo {
|
||||
|
||||
@NotBlank(message = "appId不能为空")
|
||||
private String appId;
|
||||
|
||||
@NotBlank(message = "code不能为空")
|
||||
private String code;
|
||||
|
||||
|
||||
|
||||
/** 画像 */
|
||||
private String avatar;
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
restart.include.json=/com.alibaba.fastjson2.*.jar
|
|
@ -0,0 +1,117 @@
|
|||
# 项目相关配置
|
||||
yanzhu:
|
||||
# 名称
|
||||
name: ProjectName
|
||||
# 版本
|
||||
version: 3.8.7
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 文件路径 示例( Windows配置D:/yanZhu/uploadPath,Linux配置 /home/yanZhu/uploadPath)
|
||||
profile: D:/data/yanzhu
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8089
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /yanZhuProject
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://cd-cynosdbmysql-grp-9rqrhxsm.sql.tencentcdb.com:27981/yanzhu_project?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Sxyanzhu@cf
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: yanzhu
|
||||
login-password: Sxyanzhu@yanzhu+mz
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
|
@ -0,0 +1,117 @@
|
|||
# 项目相关配置
|
||||
yanZhu:
|
||||
# 名称
|
||||
name: ProjectName
|
||||
# 版本
|
||||
version: 3.8.7
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 文件路径 示例( Windows配置D:/yanZhu/uploadPath,Linux配置 /home/yanZhu/uploadPath)
|
||||
profile: /data/yanzhu
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8089
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /yanZhuProject
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://cd-cynosdbmysql-grp-9rqrhxsm.sql.tencentcdb.com:27981/yanzhu_project?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Sxyanzhu@cf
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: yanzhu
|
||||
login-password: Sxyanzhu@yanzhu+mz
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
|
@ -0,0 +1,81 @@
|
|||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.yanzhu: debug
|
||||
org.springframework: warn
|
||||
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
# 密码最大错误次数
|
||||
maxRetryCount: 5
|
||||
# 密码锁定时间(默认10分钟)
|
||||
lockTime: 10
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: druid
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
|
||||
# token配置
|
||||
token:
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 365000
|
||||
|
||||
# MyBatis配置
|
||||
mybatis:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.yanzhu.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: true
|
||||
# 请求前缀
|
||||
pathMapping: /dev-api
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice,/flowable/definition/save
|
||||
# 匹配链接
|
||||
urlPatterns: /*
|
||||
|
||||
# flowable相关表
|
||||
flowable:
|
||||
# true 会对数据库中所有表进行更新操作。如果表不存在,则自动创建(建议开发时使用)
|
||||
database-schema-update: false
|
||||
# 关闭定时任务JOB
|
||||
async-executor-activate: false
|
|
@ -0,0 +1,24 @@
|
|||
Application Version: ${yanzhu.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// _ooOoo_ //
|
||||
// o8888888o //
|
||||
// 88" . "88 //
|
||||
// (| ^_^ |) //
|
||||
// O\ = /O //
|
||||
// ____/`---'\____ //
|
||||
// .' \\| |// `. //
|
||||
// / \\||| : |||// \ //
|
||||
// / _||||| -:- |||||- \ //
|
||||
// | | \\\ - /// | | //
|
||||
// | \_| ''\---/'' | | //
|
||||
// \ .-\__ `-` ___/-. / //
|
||||
// ___`. .' /--.--\ `. . ___ //
|
||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
||||
// `=---=' //
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||
// 佛祖保佑 永不宕机 永无BUG //
|
||||
////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,38 @@
|
|||
#错误消息
|
||||
not.null=* 必须填写
|
||||
user.jcaptcha.error=验证码错误
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=用户不存在/密码错误
|
||||
user.password.not.match=用户不存在/密码错误
|
||||
user.password.retry.limit.count=密码输入错误{0}次
|
||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
||||
user.password.delete=对不起,您的账号已被删除
|
||||
user.blocked=用户已封禁,请联系管理员
|
||||
role.blocked=角色已封禁,请联系管理员
|
||||
login.blocked=很遗憾,访问IP已被列入系统黑名单
|
||||
user.logout.success=退出成功
|
||||
|
||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||
|
||||
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||
user.password.not.valid=* 5-50个字符
|
||||
|
||||
user.email.not.valid=邮箱格式错误
|
||||
user.mobile.phone.number.not.valid=手机号格式错误
|
||||
user.login.success=登录成功
|
||||
user.register.success=注册成功
|
||||
user.notfound=请重新登录
|
||||
user.forcelogout=管理员强制退出,请重新登录
|
||||
user.unknown.error=未知错误,请重新登录
|
||||
|
||||
##文件上传消息
|
||||
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||
|
||||
##权限
|
||||
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
|
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/Users/2y/zhj/logs" />
|
||||
|
||||
<!-- 彩色日志 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
|
||||
<!-- <!– 日志输出格式 –>-->
|
||||
<!-- <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />-->
|
||||
|
||||
<!-- Console 设置默认输出格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||
<!-- <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.yanzhu" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
</configuration>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<!-- 全局参数 -->
|
||||
<settings>
|
||||
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||
<setting name="cacheEnabled" value="true" />
|
||||
<!-- 允许JDBC 支持自动生成主键 -->
|
||||
<setting name="useGeneratedKeys" value="true" />
|
||||
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<setting name="logImpl" value="SLF4J" />
|
||||
<!-- 使用驼峰命名法转换字段 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||
</settings>
|
||||
|
||||
</configuration>
|
Loading…
Reference in New Issue