Browse Source

fix: 优化单位/个人画像

master
wxc 1 month ago
parent
commit
5d5c801dd2
  1. 22
      src/main/java/com/biutag/supervision/controller/mobileSupervision/TaskProblemController.java
  2. 4
      src/main/java/com/biutag/supervision/controller/rightsComfort/ComfortController.java
  3. 63
      src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfileDepartController.java
  4. 71
      src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfilePoliceController.java
  5. 12
      src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java
  6. 9
      src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java
  7. 43
      src/main/java/com/biutag/supervision/pojo/dto/ProblemReportDto.java
  8. 48
      src/main/java/com/biutag/supervision/pojo/vo/NegativeProfile.java
  9. 39
      src/main/java/com/biutag/supervision/service/SupTaskProblemService.java
  10. 2
      src/main/resources/mapper/ProfileDepartMapper.xml
  11. 3
      src/main/resources/mapper/ProfilePoliceMapper.xml
  12. 2730
      src/main/resources/static/templates/督察通报模板.ftl

22
src/main/java/com/biutag/supervision/controller/mobileSupervision/TaskProblemController.java

@ -14,6 +14,7 @@ import com.biutag.supervision.constants.AppConstants;
import com.biutag.supervision.constants.enums.TaskTypeEnum;
import com.biutag.supervision.mapper.SupPoliceMapper;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.ProblemReportDto;
import com.biutag.supervision.pojo.dto.TaskProblemDto;
import com.biutag.supervision.pojo.dto.TaskProblemUpDto;
import com.biutag.supervision.pojo.entity.SupPolice;
@ -29,9 +30,13 @@ import com.biutag.supervision.service.SupDictProblemTypeService;
import com.biutag.supervision.service.SupPoliceService;
import com.biutag.supervision.service.SupTaskProblemService;
import com.biutag.supervision.util.CommonUtil;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -43,7 +48,7 @@ import java.util.stream.Collectors;
*/
@RequestMapping("task/problem")
@RequiredArgsConstructor
@RestController
@Controller
public class TaskProblemController {
private final SupTaskProblemService taskProblemService;
@ -54,6 +59,7 @@ public class TaskProblemController {
private final SupDictProblemTypeService problemTypeService;
@GetMapping
@ResponseBody
public Result<Page<SupTaskProblem>> page(TaskProblemQueryParam queryParam) {
LambdaQueryWrapper<SupTaskProblem> queryWrapper = new LambdaQueryWrapper<>();
List<String> orgIds =new ArrayList<>();
@ -85,11 +91,13 @@ public class TaskProblemController {
}
@GetMapping("{id}")
@ResponseBody
public Result<SupTaskProblem> get(@PathVariable Integer id) {
return Result.success(taskProblemService.getById(id));
}
@PutMapping("{id}")
@ResponseBody
public Result<Boolean> upProblemState(@PathVariable Integer id){
SupTaskProblem supTaskProblem = taskProblemService.getById(id);
if("1".equals(supTaskProblem.getProblemState())){
@ -102,11 +110,13 @@ public class TaskProblemController {
@PostMapping
@ResponseBody
public Result<Boolean> add(@RequestBody TaskProblemDto dto) {
return Result.success(taskProblemService.save(dto));
}
@PostMapping("/upData")
@ResponseBody
public Result upData(@RequestBody TaskProblemUpDto dto){
SupTaskProblem problem = new SupTaskProblem();
String files = JSON.toJSONString(dto.getFiles());
@ -128,15 +138,21 @@ public class TaskProblemController {
.eq(SupTaskProblem::getId,dto.getId())
);
return Result.success();
}
@DeleteMapping("{id}")
@ResponseBody
public Result<Boolean> del(@PathVariable Integer id){
return Result.success(taskProblemService.removeById(id));
}
@PostMapping("genReport")
public void genReport(@RequestBody ProblemReportDto body, HttpServletResponse response) throws UnsupportedEncodingException {
taskProblemService.genReport(body, response);
String headerValue = "attachment; filename=" + URLEncoder.encode(body.getFileName() + ".docx", "UTF-8");
response.setHeader("Content-Disposition", headerValue);
response.setContentType("application/octet-stream");
}
}

4
src/main/java/com/biutag/supervision/controller/rightsComfort/ComfortController.java

@ -133,6 +133,10 @@ public class ComfortController {
.set(RpcApply::getStep, 3)
.set(RpcApply::getUptTime, LocalDateTime.now()));
} else {
RpcApplyPerson rpcApplyPerson = rpcApplyPersonService.getOne(new LambdaQueryWrapper<RpcApplyPerson>().eq(RpcApplyPerson::getRpcId, rpcApplyApproveDto.getRpcId()));
rpcApplyPersonService.update(new LambdaUpdateWrapper<RpcApplyPerson>()
.eq(RpcApplyPerson::getRpcId, rpcApplyApproveDto.getRpcId())
.set(RpcApplyPerson::getProvideRelief, rpcApplyPerson.getInjurySeverity()));
// 待呈报
rpcApplyService.update(new LambdaUpdateWrapper<RpcApply>().eq(RpcApply::getRpcId, rpcApplyApproveDto.getRpcId())
.set(RpcApply::getRpcStatus, ComfortStatus.to_be_reported.name())

63
src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfileDepartController.java

@ -1,13 +1,12 @@
package com.biutag.supervision.controller.sensitiveperception;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.constants.enums.BusinessTypeEnum;
import com.biutag.supervision.constants.enums.InspectCaseEnum;
import com.biutag.supervision.constants.enums.PersonTypeEnum;
import com.biutag.supervision.constants.enums.ProblemSourcesEnum;
import com.biutag.supervision.constants.enums.*;
import com.biutag.supervision.mapper.ProfileDepartMapper;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.domain.ProfileDepart;
@ -16,6 +15,7 @@ import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.model.DepartNegativeModel;
import com.biutag.supervision.pojo.param.DepartNegativeQueryParam;
import com.biutag.supervision.pojo.vo.NegativeProfile;
import com.biutag.supervision.service.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -47,10 +47,11 @@ public class ProfileDepartController {
private final SupPoliceService policeService;
private final NegativeService negativeService;
private final BusinessDepartService businessDepartService;
private final NegativeScoreService negativeScoreService;
private final NegativeScoreDepartService negativeScoreDepartService;
private final NegativeProblemRelationService negativeProblemRelationService;
private final SupDepartPoliceSizeService departPoliceSizeService;
private final NegativeBlameService blameService;
@GetMapping
public Result<Page<DepartNegativeModel>> list(DepartNegativeQueryParam param) {
@ -74,6 +75,7 @@ public class ProfileDepartController {
endTime = new Date();
}
ProfileDepart profileDepart = new ProfileDepart();
profileDepart.setDays(DateUtil.between(beginTime, endTime, DateUnit.DAY));
SupDepart depart = departService.getById(departId);
profileDepart.getDepartInfo()
.setName(depart.getShortName())
@ -88,6 +90,10 @@ public class ProfileDepartController {
.between(NegativeScoreDepart::getDiscoveryTime, beginTime, endTime));
List<String> negativeIds = list.stream().map(NegativeScoreDepart::getNegativeId).toList();
SupDepartPoliceSize policeSize = departPoliceSizeService.getById(departId);
profileDepart.getDepartInfo().setPoliceSize(policeSize.getPoliceSize());
profileDepart.getDepartInfo().setAuxSize(policeSize.getAuxSize());
if (negativeIds.isEmpty()) {
return Result.success(profileDepart);
}
@ -132,28 +138,32 @@ public class ProfileDepartController {
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(BusinessTypeEnum.get(key)).map(BusinessTypeEnum::getLabel).orElse(key),
businessTypeGroup.get(key).size())).toList();
profileDepart.setBusinessTypeList(businessTypeList);
// 问题涉及方面
List<NegativeProblemRelation> negativeProblemRelations = negativeProblemRelationService.list(new LambdaQueryWrapper<NegativeProblemRelation>().in(NegativeProblemRelation::getNegativeId, negativeIds));
Map<String, List<NegativeProblemRelation>> problemGroup = negativeProblemRelations.stream().collect(Collectors.groupingBy(NegativeProblemRelation::getOneLevelContent));
List<PieItem> problemTypeList = problemGroup.keySet().stream().map(key -> new PieItem(key, problemGroup.get(key).size())).sorted(Comparator.comparing(PieItem::getValue).reversed()).toList();
profileDepart.setProblemTypeList(problemTypeList);
// 个人问题排名
List<BarItem> policeBarList = profileDepartMapper.selectPoliceNegativeCount(departId, beginTime, endTime);
List<NegativeBlame> blames = blameService.list(new LambdaQueryWrapper<NegativeBlame>().in(NegativeBlame::getNegativeId, negativeIds).eq(NegativeBlame::getType, BlameType.personal.name()));
Map<String, List<NegativeBlame>> policeGroup = blames.stream().collect(Collectors.groupingBy(NegativeBlame::getBlameEmpNo));
List<BarItem> policeBarList = policeGroup.keySet().stream().map(key -> {
List<NegativeBlame> list1 = policeGroup.get(key);
String blameName = list1.get(0).getBlameName();
return new BarItem(blameName, BigDecimal.valueOf(list1.size()));
}).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList();
profileDepart.setPoliceBarList(policeBarList);
List<BarItem> problemTypeList = profileDepartMapper.selectProblemType(departId, beginTime, endTime);
int max = problemTypeList.stream().mapToInt(item -> item.getValue().intValue()).max().getAsInt();
List<ProfileDepart.RadarIndicatorItem> problemTypeRadarIndicator = problemTypeList.stream().map(item -> {
ProfileDepart.RadarIndicatorItem radarIndicatorItem = new ProfileDepart.RadarIndicatorItem();
radarIndicatorItem.setMax(max);
radarIndicatorItem.setName(item.getLabel());
return radarIndicatorItem;
}).toList();
profileDepart.setProblemTypeRadarIndicator(problemTypeRadarIndicator);
List<Integer> problemTypeRadarData = problemTypeList.stream().map(item -> item.getValue().intValue()).toList();
profileDepart.setProblemTypeRadarData(problemTypeRadarData);
// 问题涉及领导
Map<String, List<NegativeBlame>> policeLeadGroup = blames.stream().collect(Collectors.groupingBy(NegativeBlame::getLeadEmpNo));
List<BarItem> policeLeadBarList = policeLeadGroup.keySet().stream().map(key -> {
List<NegativeBlame> list1 = policeLeadGroup.get(key);
String name = list1.get(0).getLeadName();
return new BarItem(name, BigDecimal.valueOf(list1.size()));
}).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList();
profileDepart.setPoliceLeadBarList(policeLeadBarList);
// 突出问题排名
List<NegativeProblemRelation> negativeProblemRelations = negativeProblemRelationService.list(new LambdaQueryWrapper<NegativeProblemRelation>().in(NegativeProblemRelation::getNegativeId, negativeIds));
Map<String, List<NegativeProblemRelation>> collect = negativeProblemRelations.stream().collect(Collectors.groupingBy(item -> item.getOneLevelContent() + " / " + item.getTwoLevelContent() + " / " + item.getThreeLevelContent()));
List<BarItem> problemTypeBarList = collect.keySet().stream().map(key -> {
return new BarItem(key, new BigDecimal(collect.get(key).size()));
}).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList();
List<BarItem> problemTypeBarList = collect.keySet().stream().map(key -> new BarItem(key, new BigDecimal(collect.get(key).size()))).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList();
profileDepart.setProblemTypeBarList(problemTypeBarList);
//List<Object> result = negativeScoreService.calculateDepartScore(beginTime, endTime, departId);
@ -161,6 +171,15 @@ public class ProfileDepartController {
profileDepart.setScore(BigDecimal.valueOf(list.stream().mapToDouble(NegativeScoreDepart::getScore).sum()));
// profileDepart.setExpression(result.get(1).toString());
// profileDepart.setRemarks(result.get(2).toString());
List<NegativeProfile> negativeProfiles = negatives.stream().map(item -> {
NegativeProfile negativeProfile = new NegativeProfile();
BeanUtil.copyProperties(item, negativeProfile);
String problemType = negativeProblemRelations.stream().filter(p -> item.getId().equals(p.getNegativeId())).findFirst().map(p -> p.getOneLevelContent() + " / " + p.getTwoLevelContent() + " / " + p.getThreeLevelContent()).orElse("");
negativeProfile.setProblemType(problemType);
negativeProfile.setScore(list.stream().filter(s -> item.getId().equals(s.getNegativeId())).findFirst().map(NegativeScoreDepart::getScore).orElse(null));
return negativeProfile;
}).toList();
profileDepart.setNegatives(negativeProfiles);
return Result.success(profileDepart);
}

71
src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfilePoliceController.java

@ -1,5 +1,7 @@
package com.biutag.supervision.controller.sensitiveperception;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONObject;
@ -12,10 +14,12 @@ import com.biutag.supervision.mapper.ProfilePoliceMapper;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.domain.ProfileDepart;
import com.biutag.supervision.pojo.domain.ProfilePolice;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.model.PoliceNegativeModel;
import com.biutag.supervision.pojo.param.DepartPoliceQueryParam;
import com.biutag.supervision.pojo.vo.NegativeProfile;
import com.biutag.supervision.service.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -76,9 +80,10 @@ public class ProfilePoliceController {
endTime = new Date();
}
ProfilePolice profilePolice = new ProfilePolice();
profilePolice.setDays(DateUtil.between(beginTime, endTime, DateUnit.DAY));
profilePolice.setPoliceInfo(policeService.getByIdCode(idCode));
List<NegativeScorePolice> negatives = negativeScorePoliceService.list(new LambdaQueryWrapper<NegativeScorePolice>()
List<NegativeScorePolice> negativeScorePolices = negativeScorePoliceService.list(new LambdaQueryWrapper<NegativeScorePolice>()
.between(NegativeScorePolice::getDiscoveryTime, beginTime, endTime).eq(NegativeScorePolice::getIdCode, idCode));
int jcj110BusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
@ -104,49 +109,57 @@ public class ProfilePoliceController {
.stream().mapToInt(BusinessPolice::getNumber).sum();
profilePolice.getNegativeInfo()
.setScore(NumberUtil.round(negatives.stream().mapToDouble(NegativeScorePolice::getScore).sum(), 2).doubleValue())
.setScore(NumberUtil.round(negativeScorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum(), 2).doubleValue())
.setJcj110BusinessSize(jcj110BusinessSize)
.setSize(negatives.size())
.setJcj110Size(negatives.stream().filter(item -> BusinessTypeEnum.JCJ_110.getValue().equals(item.getBusinessTypeCode())).count())
.setSize(negativeScorePolices.size())
.setJcj110Size(negativeScorePolices.stream().filter(item -> BusinessTypeEnum.JCJ_110.getValue().equals(item.getBusinessTypeCode())).count())
.setJcj122BusinessSize(jcj122BusinessSize)
.setJcj122Size(negatives.stream().filter(item -> BusinessTypeEnum.JCJ_122.getValue().equals(item.getBusinessTypeCode())).count())
.setJcj122Size(negativeScorePolices.stream().filter(item -> BusinessTypeEnum.JCJ_122.getValue().equals(item.getBusinessTypeCode())).count())
.setZfbaBusinessSize(zfbaBusinessSize)
.setZfbaSize(negatives.stream().filter(item -> BusinessTypeEnum.ZFBA.getValue().equals(item.getBusinessTypeCode())).count());
.setZfbaSize(negativeScorePolices.stream().filter(item -> BusinessTypeEnum.ZFBA.getValue().equals(item.getBusinessTypeCode())).count());
Set<String> negativeIds = negatives.stream().map(NegativeScorePolice::getNegativeId).collect(Collectors.toSet());
List<Negative> list = negatives.isEmpty() ? new ArrayList<>() : negativeService.list(new LambdaQueryWrapper<Negative>()
.in(Negative::getId, negativeIds));
Set<String> negativeIds = negativeScorePolices.stream().map(NegativeScorePolice::getNegativeId).collect(Collectors.toSet());
if (negativeIds.isEmpty()) {
return Result.success(profilePolice);
}
List<Negative> negatives = negativeService.listByIds(negativeIds);
// 问题来源占比
Map<String, List<Negative>> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode));
Map<String, List<Negative>> problemSourcesGroup = negatives.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode));
List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream()
.map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key),
problemSourcesGroup.get(key).size())).toList();
profilePolice.setProblemSourcesList(problemSourcesList);
// 问题类型占比
if (!negativeIds.isEmpty()) {
List<String> blameIds = negativeBlameService.list(new LambdaQueryWrapper<NegativeBlame>()
.in(NegativeBlame::getNegativeId, negativeIds)
.eq(NegativeBlame::getBlameIdCode, idCode))
.stream().map(NegativeBlame::getBlameId).toList();
if (!blameIds.isEmpty()) {
List<NegativeProblemRelation> problemRelations = negativeProblemRelationService.list(new LambdaQueryWrapper<NegativeProblemRelation>()
.in(NegativeProblemRelation::getBlameId, blameIds)
.in(NegativeProblemRelation::getNegativeId, negativeIds));
Map<String, List<NegativeProblemRelation>> groups = problemRelations.stream().collect(Collectors.groupingBy(NegativeProblemRelation::getThreeLevelContent));
List<PieItem> problemTypeList = groups.keySet().stream().map(key -> new PieItem(key, groups.get(key).size())).toList();
profilePolice.setProblemTypeList(problemTypeList);
}
}
List<String> blameIds = negativeBlameService.list(new LambdaQueryWrapper<NegativeBlame>()
.in(NegativeBlame::getNegativeId, negativeIds)
.eq(NegativeBlame::getBlameIdCode, idCode))
.stream().map(NegativeBlame::getBlameId).toList();
List<NegativeProblemRelation> problemRelations = negativeProblemRelationService.list(new LambdaQueryWrapper<NegativeProblemRelation>()
.in(NegativeProblemRelation::getNegativeId, negativeIds));
Map<String, List<NegativeProblemRelation>> groups = problemRelations.stream().collect(Collectors.groupingBy(NegativeProblemRelation::getOneLevelContent));
List<PieItem> problemTypeList = groups.keySet().stream().map(key -> new PieItem(key, groups.get(key).size())).toList();
profilePolice.setProblemTypeList(problemTypeList);
Map<String, List<NegativeProblemRelation>> collect = problemRelations.stream().collect(Collectors.groupingBy(item -> item.getOneLevelContent() + " / " + item.getTwoLevelContent() + " / " + item.getThreeLevelContent()));
List<BarItem> problemTypeBarList = collect.keySet().stream().map(key -> new BarItem(key, new BigDecimal(collect.get(key).size()))).sorted(Comparator.comparing(BarItem::getValue).reversed()).toList();
profilePolice.setProblemTypeBarList(problemTypeBarList);
//List<Object> result = negativeScoreService.calculatePoliceScore(beginTime, endTime, idCode);
profilePolice.setScore(BigDecimal.valueOf(negatives.stream().mapToDouble(NegativeScorePolice::getScore).sum()));
profilePolice.setScore(BigDecimal.valueOf(negativeScorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum()));
// profilePolice.setExpression(result.get(1).toString());
// profilePolice.setRemarks(result.get(2).toString());
// 雷达图
profilePolice.setBusinessTypeRadarIndicator(Arrays.stream(BusinessTypeEnum.values())
.map(item -> new ProfileDepart.RadarIndicatorItem().setName(item.getLabel()).setMax(100)).toList());
// profilePolice.setBusinessTypeScoreRadarData((List<Double>) result.get(3));
// profilePolice.setBusinessTypeWeightRadarData((List<Double>) result.get(4));
List<NegativeProfile> negativeProfiles = negatives.stream().map(item -> {
NegativeProfile negativeProfile = new NegativeProfile();
BeanUtil.copyProperties(item, negativeProfile);
String problemType = problemRelations.stream().filter(p -> item.getId().equals(p.getNegativeId())).findFirst().map(p -> p.getOneLevelContent() + " / " + p.getTwoLevelContent() + " / " + p.getThreeLevelContent()).orElse("");
negativeProfile.setProblemType(problemType);
negativeProfile.setScore(negativeScorePolices.stream().filter(s -> item.getId().equals(s.getNegativeId())).findFirst().map(NegativeScorePolice::getScore).orElse(null));
return negativeProfile;
}).toList();
profilePolice.setNegatives(negativeProfiles);
return Result.success(profilePolice);
}

12
src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java

@ -2,6 +2,8 @@ package com.biutag.supervision.pojo.domain;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.vo.NegativeProfile;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
@ -18,6 +20,7 @@ import java.util.List;
@Getter
public class ProfileDepart {
private Long days;
private BigDecimal score = new BigDecimal(0);
private String expression;
@ -30,17 +33,20 @@ public class ProfileDepart {
private List<PieItem> problemSourcesList = new ArrayList<>();
// 业务类型占比
private List<PieItem> businessTypeList = new ArrayList<>();
// 问题涉及方面
private List<PieItem> problemTypeList = new ArrayList<>();
// 雷达图
private List<RadarIndicatorItem> problemTypeRadarIndicator = new ArrayList<>();
private List<Integer> problemTypeRadarData = new ArrayList<>();
private List<Integer> scoreRadarData = new ArrayList<>();
// 个人问题排名
private List<BarItem> policeBarList = new ArrayList<>();
// 领导问题排名
private List<BarItem> policeLeadBarList = new ArrayList<>();
// 个人问题排名
private List<BarItem> problemTypeBarList = new ArrayList<>();
private List<NegativeProfile> negatives = new ArrayList<>();
@Setter
@Getter
@Accessors(chain = true)

9
src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java

@ -1,7 +1,10 @@
package com.biutag.supervision.pojo.domain;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.entity.SupPolice;
import com.biutag.supervision.pojo.vo.NegativeProfile;
import lombok.Getter;
import lombok.Setter;
@ -17,6 +20,7 @@ import java.util.List;
@Getter
public class ProfilePolice {
private Long days;
private BigDecimal score;
private String expression;
@ -28,8 +32,13 @@ public class ProfilePolice {
private List<PieItem> problemSourcesList = new ArrayList<>();
private List<PieItem> problemTypeList = new ArrayList<>();
// 突出问题排名
private List<BarItem> problemTypeBarList = new ArrayList<>();
// 雷达图
private List<ProfileDepart.RadarIndicatorItem> businessTypeRadarIndicator = new ArrayList<>();
private List<Double> businessTypeScoreRadarData = new ArrayList<>();
private List<Double> businessTypeWeightRadarData = new ArrayList<>();
private List<NegativeProfile> negatives = new ArrayList<>();
}

43
src/main/java/com/biutag/supervision/pojo/dto/ProblemReportDto.java

@ -0,0 +1,43 @@
package com.biutag.supervision.pojo.dto;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
* @author wxc
* @date 2025/10/23
*/
@Setter
@Getter
public class ProblemReportDto {
private String fileName;
private String year;
private String date;
private Content contents1;
private Content contents2;
@Getter
@Setter
public static class Content {
private String title;
private List<ContentItem> list = new ArrayList<>();
}
@Getter
@Setter
public static class ContentItem {
private String index;
private String title;
private String content;
}
}

48
src/main/java/com/biutag/supervision/pojo/vo/NegativeProfile.java

@ -0,0 +1,48 @@
package com.biutag.supervision.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* @author wxc
* @date 2025/10/23
*/
@Setter
@Getter
public class NegativeProfile {
private String id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime discoveryTime;
private String problemSourcesCode;
// 问题来源
private String problemSources;
private String businessTypeCode;
// 业务类别名称
private String businessTypeName;
private String thingDesc;
// 核查情况
private String checkStatus;
// 核查情况
private String checkStatusName;
// 问题核查情况
private String checkStatusDesc;
private String problemType;
private Double score;
}

39
src/main/java/com/biutag/supervision/service/SupTaskProblemService.java

@ -1,7 +1,10 @@
package com.biutag.supervision.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.NumberChineseFormatter;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.common.UserContextHolder;
@ -9,6 +12,7 @@ import com.biutag.supervision.constants.enums.DistributionStateEnum;
import com.biutag.supervision.constants.enums.TaskStatusEnum;
import com.biutag.supervision.constants.enums.TaskTypeEnum;
import com.biutag.supervision.mapper.SupTaskProblemMapper;
import com.biutag.supervision.pojo.dto.ProblemReportDto;
import com.biutag.supervision.pojo.dto.TaskProblemDto;
import com.biutag.supervision.pojo.entity.SupPhoto;
import com.biutag.supervision.pojo.entity.SupTask;
@ -17,13 +21,21 @@ import com.biutag.supervision.pojo.entity.SupTaskSelfexaminationContent;
import com.biutag.supervision.pojo.model.UserAuth;
import com.biutag.supervision.pojo.vo.FileVo;
import com.biutag.supervision.util.JSON;
import freemarker.core.ParseException;
import freemarker.template.*;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Objects;
import static java.lang.System.out;
@RequiredArgsConstructor
@Service
public class SupTaskProblemService extends ServiceImpl<SupTaskProblemMapper, SupTaskProblem> {
@ -104,4 +116,31 @@ public class SupTaskProblemService extends ServiceImpl<SupTaskProblemMapper, Sup
return save;
}
public void genReport(ProblemReportDto body, HttpServletResponse response) {
try {
Configuration configuration = new Configuration(new Version("2.3.28"));
configuration.setDefaultEncoding("UTF-8");
// 设置FreeMarker生成Word文档所需要的模板的路径
configuration.setClassLoaderForTemplateLoading(SupTaskProblemService.class.getClassLoader(), "");
Template template = configuration.getTemplate("static/templates/督察通报模板.ftl", "UTF-8");
// 处理数据
body.setYear(String.valueOf(LocalDateTime.now().getYear()));
body.setDate(DateUtil.format(new Date(), "yyyy年MM月dd日"));
if (CollectionUtil.isNotEmpty(body.getContents2().getList())) {
for (int i = 0; i < body.getContents2().getList().size(); i++) {
// 转中文
body.getContents2().getList().get(i).setIndex(NumberChineseFormatter.format(i + 1, false));
}
}
Writer out = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), StandardCharsets.UTF_8));
template.process(body, out);
out.flush();
out.close();
} catch (IOException | TemplateException e) {
throw new RuntimeException(e);
}
}
}

2
src/main/resources/mapper/ProfileDepartMapper.xml

@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) d
LEFT JOIN negative_score_depart n ON d.depart_id = n.depart_id
LEFT JOIN negative_blame nb ON n.negative_id = nb.blameId
LEFT JOIN negative_blame nb ON n.negative_id = nb.negativeId
WHERE
n.depart_id is not null
AND n.discovery_time BETWEEN #{beginTime} AND #{endTime}

3
src/main/resources/mapper/ProfilePoliceMapper.xml

@ -16,13 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.id depart_id,
d1.short_name parent_depart_name,
count( DISTINCT n.negative_id ) verify_size,
cum(pc.score) score
sum(n.score) score
FROM
sup_police p
LEFT JOIN sup_depart d ON p.org_id = d.id
LEFT JOIN sup_depart d1 ON d.pid = d1.id and d1.level >= 2
LEFT JOIN negative_score_police n ON p.id_code = n.id_code
left join police_score pc on p.id_code = pc.id_code
WHERE
p.del = 0 and
n.id_code is not null

2730
src/main/resources/static/templates/督察通报模板.ftl

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save