From 5067a85bba03e5320c728b0c0ca713242beb8779 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期六, 22 二月 2025 17:06:19 +0800 Subject: [PATCH] 首页统计数量、金额问题、待办展示剩余时间的bug --- flowable/src/main/java/com/ycl/service/impl/ProcessCodingServiceImpl.java | 21 ++++++ business/src/main/java/com/ycl/service/ProcessConfigInfoService.java | 2 business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java | 25 ++++---- business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java | 44 ++++++++++++-- flowable/src/main/java/com/ycl/service/ProcessCodingService.java | 3 + business/src/main/java/com/ycl/service/impl/ProcessConfigInfoServiceImpl.java | 1 flowable/src/main/java/com/ycl/mapper/ProcessCodingMapper.java | 2 business/src/main/java/com/ycl/task/FlowableTask.java | 13 ++-- business/src/main/resources/mapper/ProjectPlanExamineRecordMapper.xml | 2 flowable/src/main/resources/mapper/ProcessCodingMapper.xml | 3 + flowable/src/main/java/com/ycl/domain/entity/ProcessCoding.java | 5 + 11 files changed, 95 insertions(+), 26 deletions(-) diff --git a/business/src/main/java/com/ycl/service/ProcessConfigInfoService.java b/business/src/main/java/com/ycl/service/ProcessConfigInfoService.java index a1171e5..ef7df88 100644 --- a/business/src/main/java/com/ycl/service/ProcessConfigInfoService.java +++ b/business/src/main/java/com/ycl/service/ProcessConfigInfoService.java @@ -1,5 +1,6 @@ package com.ycl.service; +import com.ycl.domain.entity.ProcessCoding; import com.ycl.domain.entity.ProcessConfigInfo; import com.baomidou.mybatisplus.extension.service.IService; import com.ycl.common.base.Result; @@ -45,4 +46,5 @@ * @return */ Result getPage(ProcessConfigInfoQuery query); + } diff --git a/business/src/main/java/com/ycl/service/impl/ProcessConfigInfoServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProcessConfigInfoServiceImpl.java index d16c1be..2a3c314 100644 --- a/business/src/main/java/com/ycl/service/impl/ProcessConfigInfoServiceImpl.java +++ b/business/src/main/java/com/ycl/service/impl/ProcessConfigInfoServiceImpl.java @@ -117,4 +117,5 @@ } return Result.ok().data(page.getRecords()).total(page.getTotal()); } + } diff --git a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java index 4213e49..4bdbcd7 100644 --- a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java +++ b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java @@ -113,7 +113,7 @@ entity.setCreateBy(userId); entity.setUpdateBy(userId); //濡傛灉鏄偍澶囬」鐩�(鏈紑宸ラ」鐩�)涓嶉渶瑕佸鏍� - if(ProjectConstant.COMMIT.equals(entity.getUsedStatus()) && ProjectStatusEnum.PENDDING.getType().equals(entity.getProjectStatus())){ + if (ProjectConstant.COMMIT.equals(entity.getUsedStatus()) && ProjectStatusEnum.PENDDING.getType().equals(entity.getProjectStatus())) { entity.setUsedStatus(ProjectConstant.PASS); } baseMapper.insert(entity); @@ -127,9 +127,9 @@ fileService.saveBatch(fileList); //娣诲姞椤圭洰涓爣鍗曚綅 - saveUnit(entity.getId(),form.getWinUnitList()); + saveUnit(entity.getId(), form.getWinUnitList()); //娣诲姞骞村害鎶曡祫璁″垝 - saveYearPlan(entity.getId(),form.getYearPlanList()); + saveYearPlan(entity.getId(), form.getYearPlanList()); return Result.ok("娣诲姞鎴愬姛").data(entity.getId()); } @@ -437,7 +437,8 @@ city.add(item); } else if (ImportanceTypeEnum.SHEHONG_KEY.getType().equals(item.getImportanceType())) { county.add(item); - } else if (ImportanceTypeEnum.NORMAL.getType().equals(item.getImportanceType())) { + } else // if (ImportanceTypeEnum.NORMAL.getType().equals(item.getImportanceType())) + { normal.add(item); } }); @@ -445,22 +446,22 @@ proPhaseCountVO.add(new IndexProPhaseCountVO("鍌ㄥ瑙勫垝闃舵", reserve.size(), reserve.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) - .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "鍌�")); + .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).toString(), "鍌�")); proPhaseCountVO.add(new IndexProPhaseCountVO("椤圭洰鍓嶆湡闃舵", previous.size(), previous.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) - .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "鏂�")); + .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).toString(), "鏂�")); proPhaseCountVO.add(new IndexProPhaseCountVO("瀹炴柦闃舵", implement.size(), implement.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) - .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "寤�")); + .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).toString(), "寤�")); proPhaseCountVO.add(new IndexProPhaseCountVO("绔e伐鎶曠敤闃舵", finish.size(), finish.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) - .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "绔�")); + .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).toString(), "绔�")); indexCountVO.setProPhaseCountVO(proPhaseCountVO); @@ -468,22 +469,22 @@ impTypeCountVO.add(new IndexImpTypeCountVO("涓�鑸」鐩�", normal.size(), normal.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) - .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "鏅�")); + .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).toString(), "鏅�")); impTypeCountVO.add(new IndexImpTypeCountVO("鍘块噸鐐归」鐩�", county.size(), county.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) - .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "鍘�")); + .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).toString(), "鍘�")); impTypeCountVO.add(new IndexImpTypeCountVO("甯傞噸鐐归」鐩�", city.size(), city.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) - .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "甯�")); + .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).toString(), "甯�")); impTypeCountVO.add(new IndexImpTypeCountVO("鐪侀噸鐐归」鐩�", province.size(), province.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) - .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "鐪�")); + .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).toString(), "鐪�")); indexCountVO.setImpTypeCountVO(impTypeCountVO); return indexCountVO; } diff --git a/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java index bc3f826..6ce896f 100644 --- a/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java +++ b/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java @@ -89,6 +89,7 @@ private final ISysDeptService deptService; private final ProcessLogService processLogService; private final ISysDictTypeService dictTypeService; + private final ProcessConfigInfoService processConfigInfoService; /** * 鍒嗛〉鏌ヨ @@ -406,6 +407,20 @@ if (processLogService.taskIsHangup(task.getId(), task.getProcessInstanceId())) { taskVO.setTaskStatus(TaskStatusEnum.HANGUP); } + + // 璁$畻鍔炵悊鏃堕棿 + ProcessCoding processCoding = processCodingService.getByTaskId(task.getId()); + if (processCoding != null) { + if (StringUtils.isNotBlank(processCoding.getOvertime())) { + Long overtime = getTime(processCoding.getOvertime()); + + long durationTime = ((new Date()).getTime() - processCoding.getStartTaskTime().getTime()) / 1000; + + taskVO.setRemainingTime((overtime - durationTime) / 3600 + "灏忔椂"); + } else { + taskVO.setRemainingTime("-"); + } + } this.distinctVo(taskVO); vos.add(taskVO); } @@ -413,6 +428,23 @@ result.total(vos.size()); } result.put("taskList", vos); + } + + private Long getTime(String timeStr) { + Long time = null; + if (StringUtils.isNotBlank(timeStr)) { + String[] timeArr = timeStr.split("-"); + // 瑙f瀽澶╂暟鍜屽皬鏃舵暟 + int days = Integer.parseInt(timeArr[0]); + int hours = 0; + if (timeArr.length > 1) { + hours = Integer.parseInt(timeArr[1]); + } + time = (days * 24L + hours) * 3600L; +// //鍒�-绉� +// time= (days * 60L) + hours; + } + return time; } @Override @@ -606,7 +638,7 @@ jsonData.setAfterHandlerIds(afterHandlerIds); jsonData.setAfterHandlerType(form.getPeopleType()); // 鍙戝竷杞姙浜嬩欢 - publisher.publishEvent(new TaskLogEvent(this, null,SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), task.getId(), task.getName(),ProcessLogEventTypeEnum.DELEGATE, jsonData)); + publisher.publishEvent(new TaskLogEvent(this, null, SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), task.getId(), task.getName(), ProcessLogEventTypeEnum.DELEGATE, jsonData)); return Result.ok("杞姙鎴愬姛"); } @@ -617,7 +649,7 @@ Task task = taskService.createTaskQuery().taskId(form.getTaskId()).processInstanceId(form.getProcessInsId()).singleResult(); if (Objects.nonNull(task)) { // 娣诲姞璺宠繃鏃ュ織 - publisher.publishEvent(new TaskLogEvent(this, null,SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), form.getTaskId(), task.getName(),ProcessLogEventTypeEnum.JUMP, new JumpData(form.getDesc()))); + publisher.publishEvent(new TaskLogEvent(this, null, SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), form.getTaskId(), task.getName(), ProcessLogEventTypeEnum.JUMP, new JumpData(form.getDesc()))); // 鏌ュ嚭璇ヤ换鍔$粦瀹氱殑琛ㄥ崟 Map<String, Object> data = new HashMap<>(1); @@ -661,7 +693,7 @@ } dataList.add(jsonData); //娣诲姞鐫e姙鏃ュ織 - publisher.publishEvent(new TaskLogEvent(this, processLog.getId(), processLog.getUserId(), form.getProjectId(), form.getProcessInsId(), form.getTaskId(), task.getName(),ProcessLogEventTypeEnum.SUPERVISE, dataList)); + publisher.publishEvent(new TaskLogEvent(this, processLog.getId(), processLog.getUserId(), form.getProjectId(), form.getProcessInsId(), form.getTaskId(), task.getName(), ProcessLogEventTypeEnum.SUPERVISE, dataList)); return Result.ok("鎿嶄綔鎴愬姛"); } @@ -691,7 +723,7 @@ task.getName(), ProcessLogEventTypeEnum.HANGUP, new HangupData(form.getReason()) - )); + )); return Result.ok("鎿嶄綔鎴愬姛"); } @@ -747,11 +779,11 @@ newV.put(task.getTaskDefinitionKey() + "&" + key, form.getVariables().get(key)); //瀛楀吀閲屾湁灏辨斁鍏ユ祦绋嬪彉閲忎腑 if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(dictList) && dictList.contains(key)) { - processVariables.put(key,form.getVariables().get(key)); + processVariables.put(key, form.getVariables().get(key)); } } } - if( !processVariables.isEmpty() ) { + if (!processVariables.isEmpty()) { taskService.setVariables(form.getTaskId(), processVariables); } diff --git a/business/src/main/java/com/ycl/task/FlowableTask.java b/business/src/main/java/com/ycl/task/FlowableTask.java index 94a3ef8..37bc466 100644 --- a/business/src/main/java/com/ycl/task/FlowableTask.java +++ b/business/src/main/java/com/ycl/task/FlowableTask.java @@ -44,6 +44,7 @@ private ProcessLogService processLogService; @Autowired private ProcessLogMapper processLogMapper; + /** * 璧嬬爜浠诲姟 * 涓や釜閫昏緫 鏀归」鐩爜銆佹敼鑺傜偣棰滆壊 @@ -111,17 +112,16 @@ durationTime = subNodeHangupTime(hangupLogMap, task, durationTime); String status = GREEN; // 榛樿鐘舵�佷负缁胯壊 - if (redTime != null && redTime !=0 && durationTime >= redTime) { + if (redTime != null && redTime != 0 && durationTime >= redTime) { status = RED; // 濡傛灉瓒呰繃绾㈣壊鏃堕棿闃堝�硷紝鍒欑姸鎬佷负绾㈣壊 - } else if (yellowTime != null && yellowTime !=0 && durationTime >= yellowTime) { + } else if (yellowTime != null && yellowTime != 0 && durationTime >= yellowTime) { status = YELLOW; // 鍚﹀垯锛屽鏋滆秴杩囬粍鑹叉椂闂撮槇鍊硷紝鍒欑姸鎬佷负榛勮壊 } //澶勭悊鍔炵悊鏈熼檺 String overtimeStatus = NORMAL; - if (overtime != null && overtime !=0 && durationTime >= overtime) { + if (overtime != null && overtime != 0 && durationTime >= overtime) { overtimeStatus = OVERTIME; // 濡傛灉瓒呰繃鍔炵悊鏈熼檺 - } - else if (overtime != null && overtime != 0 && durationTime >= (overtime - 12 * 60 * 60)) { + } else if (overtime != null && overtime != 0 && durationTime >= (overtime - 12 * 60 * 60)) { overtimeStatus = WILLOVERTIME; // 濡傛灉涓存湡(鍥哄畾瓒呮椂鍓�12灏忔椂涓轰复鏈�) } // else if (overtime != null && overtime != 0 && durationDay >= (overtime - 60)) { @@ -130,9 +130,10 @@ map.get(status).add(task.getProcessInstanceId()); processCoding.setStatus(status); processCoding.setOvertimeStatus(overtimeStatus); + processCoding.setStartTaskTime(task.getCreateTime()); list.add(processCoding); } catch (Exception e) { - log.error(e.getMessage(),"璧嬬爜鏃堕棿鏍煎紡鏈夎"); + log.error(e.getMessage(), "璧嬬爜鏃堕棿鏍煎紡鏈夎"); } } //鏇存柊椤圭洰鐮� diff --git a/business/src/main/resources/mapper/ProjectPlanExamineRecordMapper.xml b/business/src/main/resources/mapper/ProjectPlanExamineRecordMapper.xml index 0490ee3..bac2ea6 100644 --- a/business/src/main/resources/mapper/ProjectPlanExamineRecordMapper.xml +++ b/business/src/main/resources/mapper/ProjectPlanExamineRecordMapper.xml @@ -189,7 +189,7 @@ from t_project_plan_examine_record ppe LEFT JOIN t_project_plan_info ppi on ppe.project_plan_info_id = ppi.id LEFT JOIN t_project_plan_record ppr on ppe.project_plan_record_id = ppr.id - INNER JOIN t_project_info pi on ppr.project_info_id = pi.id AND pi.deleted = 0 + Left JOIN t_project_info pi on ppr.project_info_id = pi.id AND pi.deleted = 0 WHERE ppe.department_user_id = #{userId} or manager_user_id = #{userId} </select> diff --git a/flowable/src/main/java/com/ycl/domain/entity/ProcessCoding.java b/flowable/src/main/java/com/ycl/domain/entity/ProcessCoding.java index 72ab5ee..11ecc79 100644 --- a/flowable/src/main/java/com/ycl/domain/entity/ProcessCoding.java +++ b/flowable/src/main/java/com/ycl/domain/entity/ProcessCoding.java @@ -5,6 +5,8 @@ import com.ycl.system.domain.base.AbsEntity; import lombok.Data; +import java.util.Date; + /** * * @@ -52,4 +54,7 @@ @TableField("overtime_status") /** 浠诲姟瓒呮椂鐘舵�� */ private String overtimeStatus; + + @TableField("start_task_time") + private Date startTaskTime; } diff --git a/flowable/src/main/java/com/ycl/mapper/ProcessCodingMapper.java b/flowable/src/main/java/com/ycl/mapper/ProcessCodingMapper.java index 829157c..f5ccb6d 100644 --- a/flowable/src/main/java/com/ycl/mapper/ProcessCodingMapper.java +++ b/flowable/src/main/java/com/ycl/mapper/ProcessCodingMapper.java @@ -36,4 +36,6 @@ * @param list */ void updateBatch(@Param("list") List<ProcessCoding> list); + + List<ProcessCoding> findByTaskId(@Param("taskId") String taskId); } diff --git a/flowable/src/main/java/com/ycl/service/ProcessCodingService.java b/flowable/src/main/java/com/ycl/service/ProcessCodingService.java index a270408..ad24d08 100644 --- a/flowable/src/main/java/com/ycl/service/ProcessCodingService.java +++ b/flowable/src/main/java/com/ycl/service/ProcessCodingService.java @@ -63,4 +63,7 @@ * @return */ Result all(); + + + ProcessCoding getByTaskId(String id); } diff --git a/flowable/src/main/java/com/ycl/service/impl/ProcessCodingServiceImpl.java b/flowable/src/main/java/com/ycl/service/impl/ProcessCodingServiceImpl.java index a40d634..bea89f4 100644 --- a/flowable/src/main/java/com/ycl/service/impl/ProcessCodingServiceImpl.java +++ b/flowable/src/main/java/com/ycl/service/impl/ProcessCodingServiceImpl.java @@ -1,6 +1,8 @@ package com.ycl.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.common.base.Result; import com.ycl.domain.entity.ProcessCoding; @@ -19,7 +21,7 @@ import java.util.stream.Collectors; /** - * 鏈嶅姟瀹炵幇绫� + * 鏈嶅姟瀹炵幇绫� * * @author flq * @since 2025-01-02 @@ -32,6 +34,7 @@ /** * 娣诲姞 + * * @param form * @return */ @@ -44,6 +47,7 @@ /** * 淇敼 + * * @param form * @return */ @@ -60,6 +64,7 @@ /** * 鎵归噺鍒犻櫎 + * * @param ids * @return */ @@ -71,6 +76,7 @@ /** * id鍒犻櫎 + * * @param id * @return */ @@ -82,6 +88,7 @@ /** * 鍒嗛〉鏌ヨ + * * @param query * @return */ @@ -94,6 +101,7 @@ /** * 鏍规嵁id鏌ユ壘 + * * @param id * @return */ @@ -106,6 +114,7 @@ /** * 鍒楄〃 + * * @return */ @Override @@ -116,4 +125,14 @@ .collect(Collectors.toList()); return Result.ok().data(vos); } + + @Override + public ProcessCoding getByTaskId(String taskId) { + + List<ProcessCoding> list = baseMapper.findByTaskId(taskId); + if (list.size() > 0) { + return list.get(0); + } + return null; + } } diff --git a/flowable/src/main/resources/mapper/ProcessCodingMapper.xml b/flowable/src/main/resources/mapper/ProcessCodingMapper.xml index ad0c884..4febc7a 100644 --- a/flowable/src/main/resources/mapper/ProcessCodingMapper.xml +++ b/flowable/src/main/resources/mapper/ProcessCodingMapper.xml @@ -52,6 +52,9 @@ WHERE TPC.deleted = 0 </select> + <select id="findByTaskId" resultType="com.ycl.domain.entity.ProcessCoding"> + SELECT * from t_process_coding where task_id = #{taskId} + </select> <!-- 鑷畾涔夋壒閲忔洿鏂�,浣跨敤鍓嶅垽鏂璴ist鏄惁涓虹┖ 杞崲涓簊ql update t_process_coding -- Gitblit v1.8.0