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