Showing
4 changed files
with
42 additions
and
34 deletions
| ... | ... | @@ -18,7 +18,8 @@ import java.util.Date; |
| 18 | 18 | @Table(name = "t_auto_hfca_ixzvok_sfikan") |
| 19 | 19 | public class AbImprovement extends BaseCorpModel { |
| 20 | 20 | |
| 21 | - public static final String DWCJ = "dwcj"; | |
| 21 | + public static final String DWXX = "dwxx"; | |
| 22 | + public static final String SQBM = "sqbm"; | |
| 22 | 23 | public static final String SQRQ = "sqrq"; |
| 23 | 24 | |
| 24 | 25 | /* |
| ... | ... | @@ -27,9 +28,9 @@ public class AbImprovement extends BaseCorpModel { |
| 27 | 28 | private String lcslmc; |
| 28 | 29 | |
| 29 | 30 | /* |
| 30 | - * 单位车间 | |
| 31 | + * 单位信息-组织架构 | |
| 31 | 32 | */ |
| 32 | - private String dwcj; | |
| 33 | + private String dwxx; | |
| 33 | 34 | |
| 34 | 35 | /* |
| 35 | 36 | * 申请人 |
| ... | ... | @@ -37,7 +38,7 @@ public class AbImprovement extends BaseCorpModel { |
| 37 | 38 | private String sqr; |
| 38 | 39 | |
| 39 | 40 | /* |
| 40 | - * 申请部门 | |
| 41 | + * 申请部门-组织架构 | |
| 41 | 42 | */ |
| 42 | 43 | private String sqbm; |
| 43 | 44 | |
| ... | ... | @@ -67,9 +68,12 @@ public class AbImprovement extends BaseCorpModel { |
| 67 | 68 | private Double tdrs; |
| 68 | 69 | |
| 69 | 70 | /**********非持久化字段*********/ |
| 70 | - //单位车间名称 | |
| 71 | + //单位名称 | |
| 71 | 72 | @Transient |
| 72 | - private String dwcjName; | |
| 73 | + private String dwxxName; | |
| 74 | + //申请部门名称 | |
| 75 | + @Transient | |
| 76 | + private String sqbmName; | |
| 73 | 77 | //目标值 |
| 74 | 78 | @Transient |
| 75 | 79 | private Double mb; | ... | ... |
| ... | ... | @@ -19,7 +19,7 @@ import java.util.Date; |
| 19 | 19 | @Table(name = "t_auto_hfca_ixzvok_dwmonj") |
| 20 | 20 | public class AbImprovementTarget extends BaseCorpModel { |
| 21 | 21 | |
| 22 | - public static final String DWCJ = "dwcj"; | |
| 22 | + public static final String DWXX = "dwxx"; | |
| 23 | 23 | public static final String YEAR = "year"; |
| 24 | 24 | |
| 25 | 25 | /* |
| ... | ... | @@ -30,9 +30,9 @@ public class AbImprovementTarget extends BaseCorpModel { |
| 30 | 30 | private Date year; |
| 31 | 31 | |
| 32 | 32 | /* |
| 33 | - * 单位车间 | |
| 33 | + * 单位-组织架构 | |
| 34 | 34 | */ |
| 35 | - private String dwcj; | |
| 35 | + private String dwxx; | |
| 36 | 36 | |
| 37 | 37 | /* |
| 38 | 38 | * 目标值 | ... | ... |
| 1 | 1 | package com.qgutech.qgyun.apaas.sync.cps.service; |
| 2 | 2 | |
| 3 | +import com.qgutech.qgyun.apaas.sync.org.model.UcOrg; | |
| 4 | +import com.qgutech.qgyun.apaas.sync.org.service.UcOrgService; | |
| 3 | 5 | import com.qgutech.qgyun.apaas.sync.utils.DateDealUtils; |
| 4 | 6 | import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl; |
| 5 | 7 | import com.qgutech.qgyun.apaas.sync.base.BoErrorCode; |
| ... | ... | @@ -34,7 +36,7 @@ public class AbImprovementService extends BaseServiceImpl<AbImprovement> { |
| 34 | 36 | private AbImprovementTargetService abImprovementTargetService; |
| 35 | 37 | |
| 36 | 38 | @Resource |
| 37 | - private WorkshopService workshopService; | |
| 39 | + private UcOrgService ucOrgService; | |
| 38 | 40 | |
| 39 | 41 | @Transactional(readOnly = true) |
| 40 | 42 | public AbImprovement getById(String id) { |
| ... | ... | @@ -109,11 +111,11 @@ public class AbImprovementService extends BaseServiceImpl<AbImprovement> { |
| 109 | 111 | return new ArrayList<>(0); |
| 110 | 112 | } |
| 111 | 113 | |
| 112 | - // 4. 按单位车间(dwcj存Workshop主键id)分组,汇总节约价值(qnjyjz为空按0计入,避免丢失单位) | |
| 114 | + // 4. 按单位分组,汇总节约价值(qnjyjz为空按0计入,避免丢失单位) | |
| 113 | 115 | Map<String, Double> dwcjSummaryMap = abImprovementList.stream() |
| 114 | - .filter(item -> item.getDwcj() != null) | |
| 116 | + .filter(item -> item.getDwxx() != null) | |
| 115 | 117 | .collect(Collectors.groupingBy( |
| 116 | - AbImprovement::getDwcj, | |
| 118 | + AbImprovement::getDwxx, | |
| 117 | 119 | Collectors.summingDouble(item -> item.getQnjyjz() == null ? 0.0D : item.getQnjyjz()) |
| 118 | 120 | )); |
| 119 | 121 | |
| ... | ... | @@ -124,37 +126,37 @@ public class AbImprovementService extends BaseServiceImpl<AbImprovement> { |
| 124 | 126 | // 5. 查询该年份的AB类目标信息 |
| 125 | 127 | List<AbImprovementTarget> targetList = abImprovementTargetService.listByYear(queryYear); |
| 126 | 128 | |
| 127 | - // 构建目标值映射Map:dwcj -> mb | |
| 129 | + // 构建目标值映射Map:dwxx -> mb | |
| 128 | 130 | Map<String, Double> targetMap = new HashMap<>(); |
| 129 | 131 | if (CollectionUtils.isNotEmpty(targetList)) { |
| 130 | 132 | targetMap = targetList.stream() |
| 131 | - .filter(item -> item.getDwcj() != null && item.getMb() != null) | |
| 133 | + .filter(item -> item.getDwxx() != null && item.getMb() != null) | |
| 132 | 134 | .collect(Collectors.toMap( |
| 133 | - AbImprovementTarget::getDwcj, | |
| 135 | + AbImprovementTarget::getDwxx, | |
| 134 | 136 | AbImprovementTarget::getMb, |
| 135 | 137 | (v1, v2) -> v1 |
| 136 | 138 | )); |
| 137 | 139 | } |
| 138 | 140 | |
| 139 | - // 6. 根据分组得到的单位车间id集合,查询单位车间详细信息 | |
| 140 | - Set<String> dwcjIds = dwcjSummaryMap.keySet(); | |
| 141 | - Map<String, Workshop> workshopMap = workshopService.mapByIds(dwcjIds); | |
| 141 | + // 6. 根据分组得到的单位id集合,查询单位详细信息 | |
| 142 | + Set<String> dwIds = dwcjSummaryMap.keySet(); | |
| 143 | + Map<String, UcOrg> ucOrgMap = ucOrgService.mapByIds(dwIds); | |
| 142 | 144 | |
| 143 | - // 7. 组装汇总结果(每个单位车间一条记录) | |
| 145 | + // 7. 组装汇总结果(每个单位一条记录) | |
| 144 | 146 | Map<String, Double> finalTargetMap = targetMap; |
| 145 | 147 | List<AbImprovementSummaryDTO> resultList = dwcjSummaryMap.entrySet().stream() |
| 146 | 148 | .map(entry -> { |
| 147 | - String dwcj = entry.getKey(); | |
| 149 | + String dwId = entry.getKey(); | |
| 148 | 150 | AbImprovementSummaryDTO dto = new AbImprovementSummaryDTO(); |
| 149 | - dto.setDwcj(dwcj); | |
| 151 | + dto.setDwcj(dwId); | |
| 150 | 152 | dto.setYear(queryYear); |
| 151 | 153 | dto.setTotalQnjyjz(entry.getValue()); |
| 152 | - dto.setMb(finalTargetMap.get(dwcj)); | |
| 153 | - // 设置单位车间名称、编号 | |
| 154 | - Workshop workshop = workshopMap.get(dwcj); | |
| 155 | - if (workshop != null) { | |
| 156 | - dto.setDwcjName(workshop.getDwmc()); | |
| 157 | - dto.setDwcjCode(workshop.getDwbh()); | |
| 154 | + dto.setMb(finalTargetMap.get(dwId)); | |
| 155 | + // 设置单位车间名称、编号-即部门名称、部门编号 | |
| 156 | + UcOrg ucOrg = ucOrgMap.get(dwId); | |
| 157 | + if (ucOrg != null) { | |
| 158 | + dto.setDwcjName(ucOrg.getName()); | |
| 159 | + dto.setDwcjCode(ucOrg.getCode()); | |
| 158 | 160 | } |
| 159 | 161 | // 计算完成率 |
| 160 | 162 | if (dto.getMb() != null && dto.getMb() > 0) { | ... | ... |
| ... | ... | @@ -6,6 +6,7 @@ import com.qgutech.qgyun.apaas.sync.constant.Constant; |
| 6 | 6 | import com.qgutech.qgyun.apaas.sync.cps.dto.ProcessConfirmExecDetailDTO; |
| 7 | 7 | import com.qgutech.qgyun.apaas.sync.cps.dto.ProcessConfirmExecSummaryDTO; |
| 8 | 8 | import com.qgutech.qgyun.apaas.sync.cps.enums.GcqrZtEnum; |
| 9 | +import com.qgutech.qgyun.apaas.sync.cps.enums.PjoExecZtEnum; | |
| 9 | 10 | import com.qgutech.qgyun.apaas.sync.cps.enums.RylbEnum; |
| 10 | 11 | import com.qgutech.qgyun.apaas.sync.cps.enums.WzxyysEnum; |
| 11 | 12 | import com.qgutech.qgyun.apaas.sync.cps.mapper.ProcessConfirmExecMapper; |
| ... | ... | @@ -197,7 +198,7 @@ public class ProcessConfirmExecService extends BaseServiceImpl<ProcessConfirmExe |
| 197 | 198 | // 计算该单位总数、已执行数、执行率 |
| 198 | 199 | int totalCount = dwExecList.size(); |
| 199 | 200 | int executedCount = (int) dwExecList.stream() |
| 200 | - .filter(item -> Boolean.TRUE.equals(item.getSfyzx())) | |
| 201 | + .filter(item -> PjoExecZtEnum.YIZHIXING.getCode().equals(item.getZt())) | |
| 201 | 202 | .count(); |
| 202 | 203 | double execRate = totalCount > 0 ? round2((double) executedCount / totalCount * 100) : 0.0; |
| 203 | 204 | dto.setTotalCount(totalCount); |
| ... | ... | @@ -211,7 +212,8 @@ public class ProcessConfirmExecService extends BaseServiceImpl<ProcessConfirmExe |
| 211 | 212 | return problems == null ? 0 : problems.size(); |
| 212 | 213 | }) |
| 213 | 214 | .sum(); |
| 214 | - double problemRate = totalCount > 0 ? round2((double) problemCount / totalCount * 100) : 0.0; | |
| 215 | + //问题发现率=问题数/已执行数 | |
| 216 | + double problemRate = executedCount > 0 ? round2((double) problemCount / executedCount * 100) : 0.0; | |
| 215 | 217 | dto.setProblemCount(problemCount); |
| 216 | 218 | dto.setProblemRate(problemRate); |
| 217 | 219 | |
| ... | ... | @@ -224,7 +226,7 @@ public class ProcessConfirmExecService extends BaseServiceImpl<ProcessConfirmExe |
| 224 | 226 | List<ProcessConfirmExec> rylbExecList = rylbExecMap.get(rylbEnum.getCode()); |
| 225 | 227 | int rylbTotal = rylbExecList == null ? 0 : rylbExecList.size(); |
| 226 | 228 | int rylbExecuted = rylbExecList == null ? 0 : (int) rylbExecList.stream() |
| 227 | - .filter(item -> Boolean.TRUE.equals(item.getSfyzx())) | |
| 229 | + .filter(item -> PjoExecZtEnum.YIZHIXING.getCode().equals(item.getZt())) | |
| 228 | 230 | .count(); |
| 229 | 231 | double rylbExecRate = rylbTotal > 0 ? round2((double) rylbExecuted / rylbTotal * 100) : 0.0; |
| 230 | 232 | int rylbProblemCount = rylbExecList == null ? 0 : rylbExecList.stream() |
| ... | ... | @@ -233,7 +235,7 @@ public class ProcessConfirmExecService extends BaseServiceImpl<ProcessConfirmExe |
| 233 | 235 | return problems == null ? 0 : problems.size(); |
| 234 | 236 | }) |
| 235 | 237 | .sum(); |
| 236 | - double rylbProblemRate = rylbTotal > 0 ? round2((double) rylbProblemCount / rylbTotal * 100) : 0.0; | |
| 238 | + double rylbProblemRate = rylbExecuted > 0 ? round2((double) rylbProblemCount / rylbExecuted * 100) : 0.0; | |
| 237 | 239 | rylbStats.add(new ProcessConfirmExecSummaryDTO.RylbStat( |
| 238 | 240 | rylbEnum.getCode(), rylbEnum.getDesc(), |
| 239 | 241 | rylbTotal, rylbExecuted, rylbExecRate, |
| ... | ... | @@ -246,7 +248,7 @@ public class ProcessConfirmExecService extends BaseServiceImpl<ProcessConfirmExe |
| 246 | 248 | List<ProcessConfirmExec> rylbExecList = rylbEntry.getValue(); |
| 247 | 249 | int rylbTotal = rylbExecList.size(); |
| 248 | 250 | int rylbExecuted = (int) rylbExecList.stream() |
| 249 | - .filter(item -> Boolean.TRUE.equals(item.getSfyzx())) | |
| 251 | + .filter(item -> PjoExecZtEnum.YIZHIXING.getCode().equals(item.getZt())) | |
| 250 | 252 | .count(); |
| 251 | 253 | double rylbExecRate = rylbTotal > 0 ? round2((double) rylbExecuted / rylbTotal * 100) : 0.0; |
| 252 | 254 | int rylbProblemCount = rylbExecList.stream() |
| ... | ... | @@ -255,7 +257,7 @@ public class ProcessConfirmExecService extends BaseServiceImpl<ProcessConfirmExe |
| 255 | 257 | return problems == null ? 0 : problems.size(); |
| 256 | 258 | }) |
| 257 | 259 | .sum(); |
| 258 | - double rylbProblemRate = rylbTotal > 0 ? round2((double) rylbProblemCount / rylbTotal * 100) : 0.0; | |
| 260 | + double rylbProblemRate = rylbExecuted > 0 ? round2((double) rylbProblemCount / rylbExecuted * 100) : 0.0; | |
| 259 | 261 | String desc = StringUtils.isBlank(code) ? "未设置" : code; |
| 260 | 262 | rylbStats.add(new ProcessConfirmExecSummaryDTO.RylbStat( |
| 261 | 263 | code, desc, rylbTotal, rylbExecuted, rylbExecRate, | ... | ... |