超过7天自动审批开发
This commit is contained in:
@@ -84,6 +84,8 @@ public class ShiroFilterConfiguration {
|
||||
|
||||
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
|
||||
|
||||
// filterChainDefinitionMap.put(restPath + "/autoApproveOverDue7", ANON);
|
||||
|
||||
/* 校验单点登录ticket 不需要认证 */
|
||||
filterChainDefinitionMap.put(restPath + "/login", ANON);
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ swaggerLevel=0
|
||||
|
||||
# \u672C\u5730\u5B58\u50A8\u6587\u4EF6\u7684\u78C1\u76D8\u5730\u5740
|
||||
#uploadFile=D:\\work\\idea\\changan\\
|
||||
#uploadFile=D:\\uploadfile\\tmp\\
|
||||
uploadFile=/data/DeploymentPackage/report_library/uploadfile/
|
||||
uploadFile=D:\\uploadfile\\tmp\\
|
||||
#uploadFile=/data/DeploymentPackage/report_library/uploadfile/
|
||||
# \u672C\u5730\u6587\u4EF6\u8BBF\u95EE\u7684url\u5730\u5740
|
||||
picPath=/api/home/pic/
|
||||
|
||||
@@ -92,11 +92,11 @@ IPANDPORT=http://localhost:7060/
|
||||
|
||||
#redis
|
||||
#Redis\u670D\u52A1\u5668\u5730\u5740
|
||||
spring.redis.host=10.10.10.44
|
||||
spring.redis.host=10.10.10.45
|
||||
## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3
|
||||
spring.redis.port=6379
|
||||
## Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09
|
||||
spring.redis.password=123456
|
||||
spring.redis.password=hzwlsoft.com
|
||||
## \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09
|
||||
spring.redis.timeout=200000ms
|
||||
## \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u9ED8\u8BA4\u503C\u662F8\u3002
|
||||
@@ -111,7 +111,8 @@ spring.redis.jedis.pool.max-wait=2000ms
|
||||
spring.redis.database=2
|
||||
|
||||
# \u4E0A\u4F20\u65B9\u5F0F\uFF1A\u963F\u91CC\u4E91\uFF1Aalioss \u534E\u4E3A\u4E91\uFF1Ahwobs \u672C\u5730\uFF1Alocal
|
||||
uploadType: hwobs
|
||||
#uploadType: hwobs
|
||||
uploadType: local
|
||||
|
||||
# \u672C\u5730\u6587\u4EF6\u5B58\u50A8\u5730\u5740
|
||||
localFilePath=D:\\uploadfile\\
|
||||
|
||||
+6
-1
@@ -179,7 +179,12 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
LogEntity entity = new LogEntity();
|
||||
|
||||
entity.setAccount(UserUtils.getUser().getAccount());
|
||||
if (UserUtils.getUser() == null){
|
||||
entity.setAccount("系统自动操作");
|
||||
} else {
|
||||
entity.setAccount(UserUtils.getUser().getAccount());
|
||||
}
|
||||
// entity.setAccount(UserUtils.getUser().getAccount());
|
||||
entity.setClassName("com.adc.da.report.service.impl.ITtReportManageActServiceImpl");
|
||||
entity.setOperateTime(format.format(new Date()));
|
||||
entity.setMethod("saveOrUpdataReport");
|
||||
|
||||
+17
-13
@@ -40,37 +40,41 @@ public class TaskTodoService {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(
|
||||
"select distinct RES.* from ACT_RU_TASK RES left join ACT_RU_IDENTITYLINK I on I.TASK_ID_ = RES.ID_ inner join ACT_RE_PROCDEF D on RES.PROC_DEF_ID_ = D.ID_ ");
|
||||
sb.append(" WHERE ");
|
||||
sb.append(" WHERE 1 = 1 ");
|
||||
//任务名称
|
||||
if (StrUtil.isNotEmpty(taskCommonQuery.getName())) {
|
||||
sb.append(" RES.NAME_ LIKE #{taskName} and ");
|
||||
sb.append(" and RES.NAME_ LIKE #{taskName} ");
|
||||
nativeTaskQuery = nativeTaskQuery.parameter("taskName", taskCommonQuery.getName());
|
||||
}
|
||||
|
||||
//日期查询
|
||||
if (StrUtil.isNotEmpty(taskCommonQuery.getStartTime())) {
|
||||
sb.append(" RES.CREATE_TIME_ >= #{starttime} and ");
|
||||
sb.append(" and RES.CREATE_TIME_ >= #{starttime} ");
|
||||
nativeTaskQuery = nativeTaskQuery.parameter("starttime", start);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(taskCommonQuery.getEndTime())) {
|
||||
sb.append(" RES.CREATE_TIME_ <= #{endtime} and ");
|
||||
sb.append(" and RES.CREATE_TIME_ <= #{endtime} ");
|
||||
nativeTaskQuery = nativeTaskQuery.parameter("endtime", end);
|
||||
}
|
||||
|
||||
sb.append(
|
||||
" (RES.ASSIGNEE_=#{assignee} or (RES.ASSIGNEE_ is null and I.TYPE_ = 'candidate' and (I.USER_ID_=#{user_id} ))) ");
|
||||
sb.append(
|
||||
" or (RES.ASSIGNEE_ is null and I.TYPE_ = 'candidate' ) ");
|
||||
sb.append(" order by RES.CREATE_TIME_ desc ");
|
||||
// sb.append(" LIMIT #{current},#{size} ");
|
||||
if(StringUtils.isNotBlank(taskCommonQuery.getUserId())){
|
||||
sb.append(
|
||||
" and (RES.ASSIGNEE_=#{assignee} or (RES.ASSIGNEE_ is null and I.TYPE_ = 'candidate' and (I.USER_ID_=#{user_id} ))) ");
|
||||
sb.append(
|
||||
" or (RES.ASSIGNEE_ is null and I.TYPE_ = 'candidate' ) ");
|
||||
|
||||
nativeTaskQuery = nativeTaskQuery.parameter("userd", taskCommonQuery.getUserId())
|
||||
.parameter("assignee", taskCommonQuery.getUserId())
|
||||
.parameter("user_id", taskCommonQuery.getUserId())
|
||||
.parameter("current", taskCommonQuery.getCurrent())
|
||||
.parameter("size", taskCommonQuery.getSize());
|
||||
.parameter("user_id", taskCommonQuery.getUserId());
|
||||
}
|
||||
|
||||
sb.append(" order by RES.CREATE_TIME_ desc ");
|
||||
// sb.append(" LIMIT #{current},#{size} ");
|
||||
// if(StringUtils.isNotBlank(taskCommonQuery.getUserId())){
|
||||
// nativeTaskQuery = nativeTaskQuery.parameter("current", taskCommonQuery.getCurrent())
|
||||
// .parameter("size", taskCommonQuery.getSize());
|
||||
// }
|
||||
|
||||
nativeTaskQuery = nativeTaskQuery.sql(sb.toString());
|
||||
|
||||
return nativeTaskQuery;
|
||||
|
||||
+7
-1
@@ -59,6 +59,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -147,7 +148,12 @@ public class TodoTaskController {
|
||||
// 创建查询对象
|
||||
NativeTaskQuery nativeTaskQuery = taskTodoService.createSql(taskCommonQuery);
|
||||
List<Task> list = nativeTaskQuery.list();
|
||||
List<Task> listPage = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
|
||||
|
||||
List<Task> listPage = list;
|
||||
if (taskCommonQuery.getCurrent() !=0 && taskCommonQuery.getSize() != 0){
|
||||
listPage = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
|
||||
}
|
||||
|
||||
if (list.size() == 0){
|
||||
page.setCount(0L);
|
||||
return Result.success(page);
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.adc.da.wkflow.timer;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.utils.DateUtils;
|
||||
import com.adc.da.wkflow.business_activiti.dto.Page;
|
||||
import com.adc.da.wkflow.business_activiti.dto.TaskCommonQuery;
|
||||
import com.adc.da.wkflow.business_activiti.task.TodoTaskController;
|
||||
import com.adc.da.wkflow.business_main.entity.BusProcessName;
|
||||
import com.adc.da.wkflow.business_main.vo.ApproveDataVO;
|
||||
import com.adc.da.wkflow.enums.FlowTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.rest.form.ProcessDefinitionFormType;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 上传审批超过7天自动审批
|
||||
*/
|
||||
@Component
|
||||
@EnableScheduling
|
||||
@Slf4j
|
||||
//@RestController
|
||||
//@RequestMapping("/${restPath}")
|
||||
public class OverdueAutoApproveTimer {
|
||||
|
||||
@Resource
|
||||
private TodoTaskController todoTaskController;
|
||||
|
||||
/**
|
||||
* 自动审批提交后超过7天未审批的 报告上传 流程
|
||||
*/
|
||||
// @GetMapping("/autoApproveOverDue7")
|
||||
@Scheduled(cron="0 1 0 * * *") //每晚1点执行
|
||||
public void autoApproveOverDue7() throws ParseException {
|
||||
TaskCommonQuery taskCommonQuery = new TaskCommonQuery();
|
||||
taskCommonQuery.setPrcType(FlowTypeEnum.SCBGLC.getValue());
|
||||
ResponseMessage<Page> responseMessage = todoTaskController.todoTaskListByUserId(taskCommonQuery);
|
||||
Page page = responseMessage.getData();
|
||||
List<BusProcessName> todoList = page.getList();
|
||||
|
||||
// 筛选可审批且创建时间 和当前比>7天的数据进行同意审批
|
||||
final int AUTO_APPROVE_DIFF_DAY = 7;
|
||||
for (BusProcessName busProcessName : todoList){
|
||||
try{
|
||||
if (busProcessName.getCreatTime() != null){
|
||||
Date createTime = DateUtils.parseDate(busProcessName.getCreatTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
long diff = DateUtil.betweenDay(createTime, new Date(), false);
|
||||
if (diff < AUTO_APPROVE_DIFF_DAY){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(busProcessName.getTaskDefinitionKey()) && busProcessName.getTaskDefinitionKey().equals("reEdit")){
|
||||
continue;
|
||||
}
|
||||
|
||||
// 进行同意
|
||||
ApproveDataVO approveDataVO = new ApproveDataVO();
|
||||
approveDataVO.setPrcType(FlowTypeEnum.SCBGLC.getValue());
|
||||
approveDataVO.setTaskId(busProcessName.getTaskId());
|
||||
approveDataVO.setReportId(busProcessName.getDataId());
|
||||
approveDataVO.setSubmitJson("{\"flag\":1,\"approvalOpinion\":\"审批超期,系统自动通过\"}");
|
||||
|
||||
this.todoTaskController.completeTaskByUserId(approveDataVO);
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user