Pārlūkot izejas kodu

优化催办任务

tags/24080901
WendyYang pirms 10 mēnešiem
vecāks
revīzija
a2d2440ac1
2 mainītis faili ar 42 papildinājumiem un 41 dzēšanām
  1. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java
  2. +39
    -38
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java Parādīt failu

@@ -39,9 +39,9 @@ public class MhUnitController {
return mhUnitManage.getMhUnitTree();
}

@GetMapping("/strip/tree")
@ApiOperation("按照领域查询单位树")
public List<MhUnitTreeDTO> getMhUnitStripTree() {
@GetMapping("/wflowModelConfig/tree")
@ApiOperation("流程配置单位树")
public List<MhUnitTreeDTO> treeForWflowModelConfig() {
return mhUnitManage.getMhUnitStripTree();
}



+ 39
- 38
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java Parādīt failu

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.StopWatch;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Sets;
@@ -27,6 +28,7 @@ import com.hz.pm.api.sys.utils.EarlyWarningUtil;
import com.hz.pm.api.todocenter.manage.TodoCenterManage;
import com.hz.pm.api.todocenter.model.req.ToBeProcessedReq;
import com.hz.pm.api.todocenter.model.vo.TodoCenterStatisticsVO;
import com.hz.pm.api.todocenter.model.vo.TodoVO;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.util.LoginUserUtil;
import com.hz.pm.api.workbench.converter.WorkbenchConverter;
@@ -34,6 +36,7 @@ import com.hz.pm.api.workbench.model.vo.WorkbenchVO;
import com.hz.pm.api.workbench.model.vo.WorkbenchVO.WarningStatistics;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.StrPool;
import com.wflow.bean.entity.WflowEarlyWarning;
import com.wflow.enums.WarningNoticeTypeEnum;
@@ -91,14 +94,17 @@ public class WorkbenchManage {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//1.待办中心数据
TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getUserId());
TodoCenterStatisticsVO todoCenterStat = todoCenterManage.todoCenterStatistics(userId);
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq();
toBeProcessedReq.page(1, 5);
toBeProcessedReq.setLoginUserId(userId);
toBeProcessedReq.setUserId(user.getUserId());
statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords()
.stream().map(WorkbenchConverter::convert).collect(Collectors.toList()));
res.setTodoCerter(statisticsVO);
toBeProcessedReq.setUserId(userId);
List<TodoVO> todoList = todoCenterManage.todoProjectList(toBeProcessedReq)
.getRecords().stream()
.map(WorkbenchConverter::convert)
.collect(Collectors.toList());
todoCenterStat.setTodoList(todoList);
res.setTodoCerter(todoCenterStat);
stopWatch.stop();
log.info("待办中心数据 耗时,{} s", stopWatch.getTotalTimeSeconds());
}, ForkJoinPool.commonPool()),
@@ -155,14 +161,14 @@ public class WorkbenchManage {

private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning(UserFullInfoDTO user) {
WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning();
LambdaQueryWrapper<Project> projectWrapper = Wrappers.lambdaQuery(Project.class)
LambdaQueryWrapper<Project> pQuery = Wrappers.lambdaQuery(Project.class)
.select(Project::getProjectName, Project::getProjectCode)
.eq(Project::getNewest, Boolean.TRUE);
EarlyWarningUtil.buildPermissionProjectWrapper(projectWrapper, user);
List<Project> projects = projectService.list(projectWrapper);
Set<String> projectCodeS = Sets.newHashSet();
Map<String, String> projectNameMap = projects.stream()
.filter(p -> projectCodeS.add(p.getProjectCode()))
.collect(Collectors.toMap(Project::getProjectCode, Project::getProjectName));
EarlyWarningUtil.buildPermissionProjectWrapper(pQuery, user);
List<Project> projects = projectService.list(pQuery);
Map<String, String> projectNameMap = CollUtils.listToMap(projects,
Project::getProjectCode, Project::getProjectName, (v1, v2) -> v1);


//4.1
//累积预警统计
@@ -215,9 +221,8 @@ public class WorkbenchManage {
Map<String, WflowEarlyWarningRecords> warningMap = warningRecords.stream()
.filter(w -> projectCodeSet.add(w.getProjectCode()))
.collect(Collectors.toMap(WflowEarlyWarningRecords::getProjectCode, w -> w));
LocalDateTime now = LocalDateTime.now();
if (CollUtil.isNotEmpty(overPage.getRecords())) {
LocalDateTime now = LocalDateTime.now();
List<ProjectEarlyWarningVO> overVos = overPage.getRecords().stream().map(o -> {
ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o, ProjectEarlyWarningVO.class);
//取最新一条预警信息
@@ -244,7 +249,6 @@ public class WorkbenchManage {
}

if (CollUtil.isNotEmpty(adventPage.getRecords())) {
LocalDateTime now = LocalDateTime.now();
List<ProjectEarlyWarningVO> adventVos = adventPage.getRecords().stream().map(o -> {
ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o, ProjectEarlyWarningVO.class);
//取最新一条预警信息
@@ -299,31 +303,29 @@ public class WorkbenchManage {
/**
* 催办
*
* @param recordId
* @return
* @param recordId \
* @return \
*/
public String urging(Long recordId) {
WflowEarlyWarningRecords record = earlyWarningRecordsService.getById(recordId);

VUtils.isTrue(Objects.isNull(record))
.throwMessage("催办失败,id不存在!");
String noticeMethod = record.getNoticeMethod();
Integer noticeType = record.getNoticeType();
String projectCode = record.getProjectCode();
public synchronized String urging(Long recordId) {
WflowEarlyWarningRecords warningRecords = earlyWarningRecordsService.getById(recordId);
Assert.notNull(warningRecords, "催办失败,id不存在!");
String projectCode = warningRecords.getProjectCode();
Project project = projectService.getProjectByCode(projectCode);
String batchEmployees = record.getBatchUserIds();
Integer ruleType = record.getRuleType();
String areaCode = record.getAreaCode();
Assert.notNull(project, "催办失败,项目不存在!");
String batchEmployees = warningRecords.getBatchUserIds();
Integer ruleType = warningRecords.getRuleType();
String areaCode = warningRecords.getAreaCode();
//如果是临期 可以取到 超期的小时数
String path = record.getPath();
LocalDateTime instStart = record.getInstStart();
Integer biz = record.getBiz();
VUtils.isTrue(Objects.isNull(project)).throwMessage("催办失败,项目不存在!");
String path = warningRecords.getPath();
LocalDateTime instStart = warningRecords.getInstStart();
Integer biz = warningRecords.getBiz();
if (StringUtils.isBlank(batchEmployees)) {
//如果批次员工号不存在 就取当前
batchEmployees = record.getWarningUserId();
batchEmployees = warningRecords.getWarningUserId();
}
String noticeContent = record.getNoticeContent();
Assert.notEmpty(batchEmployees, "催办失败,员工为空!");
String[] employees = batchEmployees.split(StrPool.COMMA);
String noticeContent = warningRecords.getNoticeContent();
//查出配置的模板
WflowEarlyWarning config = earlyWarningService.getOne(Wrappers.lambdaQuery(WflowEarlyWarning.class)
.eq(WflowEarlyWarning::getAreaCode, areaCode)
@@ -334,17 +336,16 @@ public class WorkbenchManage {
noticeContent = config.getNoticeContent();
}

VUtils.isTrue(StringUtils.isBlank(batchEmployees))
.throwMessage("催办失败,员工为空!");
String[] employees = batchEmployees.split(StrPool.COMMA);
//算出 当前和他的 小时差 临期
long adventBetween = ChronoUnit.HOURS.between(instStart, LocalDateTime.now());
String noticeMethod = warningRecords.getNoticeMethod();
Integer noticeType = warningRecords.getNoticeType();
for (String employee : employees) {
earlyWarningManage.urging(noticeMethod, noticeContent,
(int) adventBetween, (int) adventBetween,
biz, instStart, Long.valueOf(employee),
project, ruleType, noticeType, path,
batchEmployees, record.getNodeId());
batchEmployees, warningRecords.getNodeId());
}
return "催办成功了" + employees.length + "个人";
}


Notiek ielāde…
Atcelt
Saglabāt