diff --git a/src/main/java/com/biutag/supervision/constants/enums/FlowNodeEnum.java b/src/main/java/com/biutag/supervision/constants/enums/FlowNodeEnum.java index b8b61c9..8bbe13c 100644 --- a/src/main/java/com/biutag/supervision/constants/enums/FlowNodeEnum.java +++ b/src/main/java/com/biutag/supervision/constants/enums/FlowNodeEnum.java @@ -16,8 +16,8 @@ public enum FlowNodeEnum { VERIFY("verify"), SECOND_APPROVE("second_approve"), FIRST_APPROVE("first_approve"), - SECOND_EXTENSION_APPROVE("first_approve"), - FIRST_EXTENSION_APPROVE("first_approve"), + SECOND_EXTENSION_APPROVE("second_extension_approve"), + FIRST_EXTENSION_APPROVE("first_extension_approve"), COMPLETED("completed"); private String key; diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java index 7a945c3..99a44f0 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java @@ -154,14 +154,13 @@ public class ProfileDepartController { radarIndicatorItem.setName(item.getLabel()); return radarIndicatorItem; }).toList(); - List problemTypeRadarData = problemTypeBarList.stream().map(BarItem::getValue).toList(); + profileDepart.setProblemTypeRadarIndicator(problemTypeRadarIndicator); - profileDepart.setProblemTypeRadarData(problemTypeRadarData); - // 突出问题排名 - profileDepart.setProblemTypeBarList(profileDepartMapper.selectThirdProblemType(departId, beginTime, endTime)); + List result = negativeScoreService.calculateDepartScore(beginTime, endTime, departId); profileDepart.setScore((BigDecimal) result.get(0)); profileDepart.setExpression(result.get(1).toString()); + profileDepart.setRemarks(result.get(2).toString()); return Result.success(profileDepart); } diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java index 1d9a0b8..bbc48f3 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java @@ -44,7 +44,6 @@ import java.util.stream.Collectors; @RestController public class ProfilePoliceController { - private final ScoreService profilePoliceService; private final ProfilePoliceMapper profilePoliceMapper; private final SupPoliceService policeService; @@ -155,6 +154,8 @@ public class ProfilePoliceController { List result = negativeScoreService.calculatePoliceScore(beginTime, endTime, idCode); profilePolice.setScore((BigDecimal) result.get(0)); profilePolice.setExpression(result.get(1).toString()); + + return Result.success(profilePolice); } diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ScoreController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ScoreController.java new file mode 100644 index 0000000..0bd5ef2 --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ScoreController.java @@ -0,0 +1,77 @@ +package com.biutag.supervision.controller.sensitivePerception; + +import com.biutag.supervision.mapper.DepartScoreMapper; +import com.biutag.supervision.mapper.PoliceScoreMapper; +import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.entity.DepartScore; +import com.biutag.supervision.pojo.entity.PoliceScore; +import com.biutag.supervision.pojo.entity.SupDepart; +import com.biutag.supervision.pojo.entity.SupPolice; +import com.biutag.supervision.service.NegativeScoreService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Date; +import java.util.List; + +/** + * @author wxc + * @date 2024/11/13 + */ +@Slf4j +@RequestMapping("score") +@RequiredArgsConstructor +@RestController +public class ScoreController { + + private final PoliceScoreMapper policeScoreMapper; + + private final DepartScoreMapper departScoreMapper; + + private final NegativeScoreService negativeScoreService; + + @RequestMapping("police") + public Result updatePoliceScore() { + List supPolices = policeScoreMapper.listPolice(); + Date endTime = new Date(); + LocalDateTime localDateTime = LocalDateTime.of(2024, 1, 1, 0, 0, 0); + Date beginTime = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + supPolices.forEach(item -> { + List result = negativeScoreService.calculatePoliceScore(beginTime, endTime, item.getIdCode()); + PoliceScore score = new PoliceScore(); + score.setIdCode(item.getIdCode()); + score.setScore((Double) result.get(0)); + score.setExpression((String) result.get(1)); + score.setBeginTime(beginTime); + score.setEndTime(endTime); + score.setCreateTime(new Date()); + policeScoreMapper.insert(score); + }); + return Result.success("success"); + } + + @RequestMapping("depart") + public Result updateDepartScore() { + List supDeparts = departScoreMapper.listDepart(); + Date endTime = new Date(); + LocalDateTime localDateTime = LocalDateTime.of(2024, 1, 1, 0, 0, 0); + Date beginTime = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + supDeparts.forEach(item -> { + List result = negativeScoreService.calculateDepartScore(beginTime, endTime, item.getId()); + DepartScore score = new DepartScore(); + score.setDepartId(item.getId()); + score.setScore((Double) result.get(0)); + score.setExpression((String) result.get(1)); + score.setBeginTime(beginTime); + score.setEndTime(endTime); + score.setCreateTime(new Date()); + departScoreMapper.insert(score); + }); + return Result.success("success"); + } + +} diff --git a/src/main/java/com/biutag/supervision/flow/action/ApplyExtensionAction.java b/src/main/java/com/biutag/supervision/flow/action/ApplyExtensionAction.java index 8c391b7..0df69bd 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ApplyExtensionAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/ApplyExtensionAction.java @@ -5,14 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.biutag.supervision.common.UserContextHolder; import com.biutag.supervision.constants.AppConstants; +import com.biutag.supervision.constants.enums.FlowActionEnum; +import com.biutag.supervision.constants.enums.FlowNodeEnum; import com.biutag.supervision.constants.enums.RoleCodeEnum; import com.biutag.supervision.constants.enums.WorkStatusEnum; import com.biutag.supervision.pojo.dto.ActionDto; import com.biutag.supervision.pojo.dto.flow.ExtensionApplyData; -import com.biutag.supervision.pojo.entity.Negative; -import com.biutag.supervision.pojo.entity.NegativeExtensionApply; -import com.biutag.supervision.pojo.entity.NegativeWork; -import com.biutag.supervision.pojo.entity.SupDepart; +import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.service.NegativeExtensionApplyService; import com.biutag.supervision.service.NegativeService; @@ -76,16 +75,19 @@ public class ApplyExtensionAction implements Action { String roleCode; String departId; String departName; + String flowKey; // 是否是二级机构办理 if (negative.getIsSecondHandle()) { roleCode = RoleCodeEnum.FIRST_ADMIN.getCode(); departId = AppConstants.ROOT_DEPART_ID; departName = AppConstants.ROOT_DEPART_NAME; + flowKey = FlowNodeEnum.FIRST_EXTENSION_APPROVE.getKey(); } else { roleCode = RoleCodeEnum.SECOND_ADMIN.getCode(); SupDepart parentDepart = departService.getParentDepart(currentWork.getDepartId()); departId = parentDepart.getId(); departName = parentDepart.getShortName(); + flowKey = actionDto.getNextFlowKey(); } workService.remove(new LambdaQueryWrapper() .eq(NegativeWork::getNegativeId, actionDto.getNegativeId()) @@ -98,7 +100,7 @@ public class ApplyExtensionAction implements Action { .setDepartId(departId) .setDepartName(departName) .setProblemSourcesCode(negative.getProblemSourcesCode()) - .setFlowKey(actionDto.getNextFlowKey()) + .setFlowKey(flowKey) .setCreateTime(LocalDateTime.now()) .setUpdateTime(LocalDateTime.now()) .setStatus(WorkStatusEnum.todo.name()); diff --git a/src/main/java/com/biutag/supervision/mapper/DepartScoreMapper.java b/src/main/java/com/biutag/supervision/mapper/DepartScoreMapper.java new file mode 100644 index 0000000..856f3ce --- /dev/null +++ b/src/main/java/com/biutag/supervision/mapper/DepartScoreMapper.java @@ -0,0 +1,16 @@ +package com.biutag.supervision.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.entity.DepartScore; +import com.biutag.supervision.pojo.entity.SupDepart; +import com.biutag.supervision.pojo.entity.SupPolice; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface DepartScoreMapper extends BaseMapper { + + @Select("select d.id from sup_depart d left join negative_score_depart sd on d.id = sd.depart_id where sd.depart_id is not null GROUP BY d.id") + List listDepart(); + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java index 37715d9..83c1f06 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java @@ -19,9 +19,9 @@ public interface NegativeBlameMapper extends BaseMapper { @Select("select count(DISTINCT n.id) from negative n left join negative_blame nb on n.id = nb.negativeId left join negative_problem_relation pr on pr.negativeId = n.id and pr.blameId = nb.blameId where n.checkStatus in ('1', '2') and n.discoveryTime BETWEEN #{beginTime} and #{endTime} and nb.blameIdCode = #{idCode} and pr.twoLevelCode = #{twoLevelCode}") int selectCountByTrue(String idCode, String twoLevelCode, LocalDateTime beginTime, LocalDateTime endTime); - @Select("select DISTINCT nb.* from negative_blame nb left join negative n on nb.negativeId = n.id left join negative_score_police sp on " + - "sp.negative_id = nb.negativeId and sp.id_code = nb.blameIdCode left join negative_problem_relation pr on pr.negativeId = nb.negativeId and pr.blameId = nb.blameId " + - "where n.checkStatus in ('1', '2') and n.processing_status = 'completed' and sp.negative_id is null and pr.threeLevelCode is not null") + @Select("select DISTINCT nb.* from negative_blame nb left join negative n on nb.negativeId = n.id " + + "left join negative_problem_relation pr on pr.negativeId = nb.negativeId and pr.blameId = nb.blameId " + + "where n.checkStatus in ('1', '2') and n.processing_status = 'completed' and pr.threeLevelCode is not null") List selectVerifyTrue(); } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/mapper/PoliceScoreMapper.java b/src/main/java/com/biutag/supervision/mapper/PoliceScoreMapper.java new file mode 100644 index 0000000..bd5c57e --- /dev/null +++ b/src/main/java/com/biutag/supervision/mapper/PoliceScoreMapper.java @@ -0,0 +1,15 @@ +package com.biutag.supervision.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.entity.PoliceScore; +import com.biutag.supervision.pojo.entity.SupPolice; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface PoliceScoreMapper extends BaseMapper { + + @Select("select p.id_code from sup_police p left join negative_score_police sp on p.id_code = sp.id_code where sp.id_code is not null GROUP BY p.id_code") + List listPolice(); + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java b/src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java index be49439..f7998f2 100644 --- a/src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java +++ b/src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java @@ -22,6 +22,8 @@ public class ProfileDepart { private String expression; + private String remarks; + private DepartInfo departInfo = new DepartInfo(); private NegativeInfo negativeInfo = new NegativeInfo(); private List problemSourcesList = new ArrayList<>(); @@ -29,8 +31,9 @@ public class ProfileDepart { private List policeBarList = new ArrayList<>(); // 雷达图 private List problemTypeRadarIndicator = new ArrayList<>(); - private List problemTypeRadarData = new ArrayList<>(); - private List problemTypeBarList = new ArrayList<>(); + private List scoreRadarData = new ArrayList<>(); + private List scoreTypeBarList = new ArrayList<>(); + private List weightTypeBarList = new ArrayList<>(); @Setter @Getter diff --git a/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java b/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java index c9bf8a3..09c0dca 100644 --- a/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java +++ b/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java @@ -21,6 +21,8 @@ public class ProfilePolice { private String expression; + private String remarks; + private SupPolice policeInfo = new SupPolice(); private NegativeInfo negativeInfo = new NegativeInfo(); private List problemSourcesList = new ArrayList<>(); diff --git a/src/main/java/com/biutag/supervision/pojo/entity/DepartScore.java b/src/main/java/com/biutag/supervision/pojo/entity/DepartScore.java new file mode 100644 index 0000000..ea4e503 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/entity/DepartScore.java @@ -0,0 +1,32 @@ +package com.biutag.supervision.pojo.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Getter; +import lombok.Setter; + +import java.util.Date; + +@Setter +@Getter +public class DepartScore { + + // + @TableId(value = "depart_id") + private String departId; + + // + @TableField("score") + private Double score; + + // + @TableField("expression") + private String expression; + + private Date createTime; + + private Date beginTime; + + private Date endTime; + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/PoliceScore.java b/src/main/java/com/biutag/supervision/pojo/entity/PoliceScore.java new file mode 100644 index 0000000..f425bd1 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/entity/PoliceScore.java @@ -0,0 +1,32 @@ +package com.biutag.supervision.pojo.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Getter; +import lombok.Setter; + +import java.util.Date; + +@Setter +@Getter +public class PoliceScore { + + // + @TableId(value = "id_code") + private String idCode; + + // + @TableField("score") + private Double score; + + // + @TableField("expression") + private String expression; + + private Date createTime; + + private Date beginTime; + + private Date endTime; + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/service/DepartScoreService.java b/src/main/java/com/biutag/supervision/service/DepartScoreService.java new file mode 100644 index 0000000..879c38e --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/DepartScoreService.java @@ -0,0 +1,11 @@ +package com.biutag.supervision.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.pojo.entity.DepartScore; +import com.biutag.supervision.mapper.DepartScoreMapper; +import org.springframework.stereotype.Service; + +@Service +public class DepartScoreService extends ServiceImpl { + +} diff --git a/src/main/java/com/biutag/supervision/service/NegativeScoreService.java b/src/main/java/com/biutag/supervision/service/NegativeScoreService.java index 9178e01..a1899cc 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeScoreService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeScoreService.java @@ -10,6 +10,7 @@ import com.biutag.supervision.mapper.SupDictContentMapper; import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.util.ScoreRule; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -23,6 +24,7 @@ import java.util.stream.Collectors; * @author wxc * @date 2024/11/12 */ +@Slf4j @RequiredArgsConstructor @Service public class NegativeScoreService { @@ -50,6 +52,7 @@ public class NegativeScoreService { flag.set(true); System.out.println("calculateScore-------------------------------------------------"); List negativeBlames = blameMapper.selectVerifyTrue(); + log.info("总共问题条数:{}", negativeBlames.size()); if (negativeBlames.isEmpty()) { flag.set(false); return; @@ -61,9 +64,10 @@ public class NegativeScoreService { Set negativeIds = negativeBlames.stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet()); List problemsAll = problemRelationService.list(negativeIds); List negatives = negativeService.listByIds(negativeIds); + List departs = departService.listByIds(negatives.stream().map(Negative::getInvolveDepartId).collect(Collectors.toSet())); negativeBlames.forEach(blame -> { Negative negative = negatives.stream().filter(item -> item.getId().equals(blame.getNegativeId())).findFirst().get(); - SupDepart depart = departService.getById(negative.getInvolveDepartId()); + SupDepart depart = departs.stream().filter(item -> item.getId().equals(negative.getInvolveDepartId())).findFirst().get(); NegativeScorePolice negativeScorePolice = new NegativeScorePolice() .setNegativeId(blame.getNegativeId()) .setIdCode(blame.getBlameIdCode()) @@ -151,17 +155,17 @@ public class NegativeScoreService { if (sd == 0) { return 0; } - List businessPolices = businessPoliceService.list(beginTime, endTime, businessTypeCode); + List businessDeparts = businessDepartService.list(beginTime, endTime, businessTypeCode); // 总业务量 - int totalBusinessSize = businessPolices.stream().mapToInt(BusinessPolice::getNumber).sum(); + int totalBusinessSize = businessDeparts.stream().mapToInt(BusinessDepart::getNumber).sum(); // 平均问题发生率 double avgRate = totalBusinessSize == 0? 0: NumberUtil.div(businessScorePolice.size(), totalBusinessSize); // 个人问题数 - long personSize = businessScorePolice.stream().filter(item -> police.getIdCode().equals(item.getIdCode())).count(); - // 个人业务量 - long personBusinessSize = businessPolices.stream().filter(item -> police.getName().equals(item.getPoliceName()) && police.getEmpNo().equals(item.getEmpNo())).count(); + long personSize = businessScorePolice.stream().filter(item -> police.getOrgId().equals(item.getIdCode())).count(); + // 单位业务量 + long departBusinessSize = businessDeparts.stream().filter(item -> police.getOrgId().equals(item.getDepartId())).count(); // 个人问题发生率 - double personRate = personBusinessSize == 0? 0: NumberUtil.div(personSize, personBusinessSize); + double personRate = departBusinessSize == 0? 0: NumberUtil.div(personSize, departBusinessSize); return NumberUtil.div(personRate - avgRate, sd); } @@ -222,10 +226,12 @@ public class NegativeScoreService { List scorePolices = negativeScorePoliceService.list(beginTime, endTime, depart.getStatisticsGroupId()); Double totalScore = scorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum(); List expressionArr = new ArrayList<>(); + StringBuilder remarks = new StringBuilder(); double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { List businessScorePolice = scorePolices.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); // 业务涉及人数 int policeSize = businessScorePolice.stream().map(NegativeScorePolice::getIdCode).collect(Collectors.toSet()).size(); + remarks.append(String.format("业务设计人数 %s", policeSize)); // 业务问题数 int businessSize = businessScorePolice.size(); //--------------------------------------------------------- @@ -236,6 +242,7 @@ public class NegativeScoreService { double[] diffNumbers = group.values().stream().mapToDouble(val -> val.size() - avgNumber).toArray(); // 业务标准差 double sd = calculateSd(diffNumbers, policeSize); + log.info("业务标准差为:{}", sd); // 业务差异值 double diff; long personalSize = businessScorePolice.stream().filter(item -> idCode.equals(item.getIdCode())).count(); @@ -244,17 +251,25 @@ public class NegativeScoreService { } else { diff = calculateDiff2(personalSize, avgNumber, sd); } + log.info("业务差异值为:{}", diff); // 业务风险指数 double businessScore = calculateBusinessScore(diff, personalSize); + log.info("业务风险指数:{}", businessScore); // 业务权重 Double score = businessScorePolice.stream().mapToDouble(NegativeScorePolice::getScore).sum(); double businessWeight = calculateBusinessWeight(totalScore, score); expressionArr.add(String.format("(%s * %s)", businessScore, businessWeight)); + remarks.append(String.format("%s:", businessTypeEnum.getLabel())).append("\n"); + remarks.append(String.format("业务涉及人数 %s", policeSize)).append("\n"); + remarks.append(String.format("业务问题数 %s", businessSize)).append("\n"); + remarks.append(String.format("平均问题数 %s", avgNumber)).append("\n"); + remarks.append(String.format("业务标准差 %s", sd)).append("\n"); + remarks.append(String.format("业务差异值 %s", diff)).append("\n"); return NumberUtil.mul(businessScore, businessWeight); }).sum(); BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); String expression = String.join(" + ", expressionArr); - return List.of(score, expression); + return List.of(score, expression, remarks); } /** @@ -270,6 +285,7 @@ public class NegativeScoreService { List scoreDeparts = negativeScoreDepartService.list(beginTime, endTime, depart.getStatisticsGroupId()); Double totalScore = scoreDeparts.stream().mapToDouble(NegativeScoreDepart::getScore).sum(); List expressionArr = new ArrayList<>(); + StringBuilder remarks = new StringBuilder(); double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { List businessScoreDeparts = scoreDeparts.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); // 业务涉及人数 @@ -296,6 +312,12 @@ public class NegativeScoreService { Double score = businessScoreDeparts.stream().mapToDouble(NegativeScoreDepart::getScore).sum(); double businessWeight = calculateBusinessWeight(totalScore, score); expressionArr.add(String.format("(%s * %s)", businessScore, businessWeight)); + remarks.append(String.format("%s:", businessTypeEnum.getLabel())).append("\n"); + remarks.append(String.format("业务涉及人数 %s", departSize)).append("\n"); + remarks.append(String.format("当前部门问题数 %s", personalSize)).append("\n"); + remarks.append(String.format("平均问题数 %s", avgNumber)).append("\n"); + remarks.append(String.format("业务标准差 %s", sd)).append("\n"); + remarks.append(String.format("业务差异值 %s", diff)).append("\n"); return NumberUtil.mul(businessScore, businessWeight); }).sum(); BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); diff --git a/src/main/java/com/biutag/supervision/service/PoliceScoreService.java b/src/main/java/com/biutag/supervision/service/PoliceScoreService.java new file mode 100644 index 0000000..5c218dd --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/PoliceScoreService.java @@ -0,0 +1,17 @@ +package com.biutag.supervision.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.pojo.entity.PoliceScore; +import com.biutag.supervision.mapper.PoliceScoreMapper; +import com.biutag.supervision.pojo.entity.SupPolice; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class PoliceScoreService extends ServiceImpl { + + + +} diff --git a/src/main/resources/mapper/ProfileDepartMapper.xml b/src/main/resources/mapper/ProfileDepartMapper.xml index 367add0..d73ef2f 100644 --- a/src/main/resources/mapper/ProfileDepartMapper.xml +++ b/src/main/resources/mapper/ProfileDepartMapper.xml @@ -8,7 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT d.*, count( DISTINCT nb.blameIdCode ) verify_police_size, - count( n.id ) verify_size + count( n.id ) verify_size, + dc.score FROM ( SELECT @@ -16,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" d1.short_name parent_depart_name, d.short_name depart_name, p.police_size, + p.aux_size FROM sup_depart d @@ -23,13 +25,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN sup_depart_police_size p ON p.depart_id = d.id WHERE d.LEVEL = 3 + and d.statistics_group_id = #{departGroupId} ) d LEFT JOIN negative n ON n.involveDepartId = d.depart_id AND n.checkStatus IN ( '1', '2' ) AND n.discoveryTime BETWEEN #{beginTime} AND #{endTime} LEFT JOIN negative_blame nb ON n.id = nb.negativeId + left join depart_score dc on d.depart_id = dc.depart_id WHERE - d.statistics_group_id = #{departGroupId} + 1 = 1 AND d.short_name like concat('%', #{departName}, '%') @@ -41,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" d.parent_depart_name, d.depart_name ORDER BY - verify_size DESC + score DESC