Browse Source

fit:

1、维权督办:修复
master
pengwei 2 months ago
parent
commit
4062357e53
  1. 40
      src/main/java/com/biutag/supervision/controller/work/NegativeTaskController.java
  2. 7
      src/main/java/com/biutag/supervision/job/Job.java

40
src/main/java/com/biutag/supervision/controller/work/NegativeTaskController.java

@ -2,6 +2,7 @@ package com.biutag.supervision.controller.work;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
@ -33,16 +34,14 @@ import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@ -69,6 +68,8 @@ public class NegativeTaskController {
@PostMapping("import")
public Result<List<NegativeImportDto>> importExcel(@RequestPart("file") MultipartFile file) throws IOException {
log.info("文件导入中------------------------------");
StopWatch stopWatch = new StopWatch();
stopWatch.start("tagetfin-budget-profit");
String fileNameType = FileUtil.extName(file.getOriginalFilename());
if (!"xls".equals(fileNameType) && !"xlsx".equals(fileNameType)) {
throw new RuntimeException("仅支持 xls/xlsx 格式文件的导入");
@ -77,7 +78,9 @@ public class NegativeTaskController {
List<SupDictData> suspectProblem = dictDataService.listByDictType("suspectProblem");
List<SupDictData> specialSupervision = dictDataService.listByDictType("specialSupervision");
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), NegativeImportDto.class, new ReadListener<NegativeImportDto>() {
//提升导入速度:1、异步 2、缓存读取数据,减少数据请求频率
@Override
public void invoke(NegativeImportDto data, AnalysisContext analysisContext) {
@ -114,7 +117,8 @@ public class NegativeTaskController {
data.setInvolveProblem(involveProblem);
}
if (StrUtil.isNotBlank(data.getReportNumber())){
List<SuperviseReport> reportList = reportService.list(new LambdaQueryWrapper<SuperviseReport>().eq(SuperviseReport::getReportName,data.getReportNumber())).stream().toList();
List<SuperviseReport> reportList = reportService.list(new LambdaQueryWrapper<SuperviseReport>()
.eq(SuperviseReport::getReportName,data.getReportNumber())).stream().toList();
if(CollectionUtil.isNotEmpty(reportList)){
data.setReportId(reportList.get(0).getId());
}
@ -125,18 +129,25 @@ public class NegativeTaskController {
String[] departNames = data.getInvolveDepartName().split("/");
List<SupDepart> departs = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getLevel, DepartLevelEnum.SECOND.getValue())
.eq(SupDepart::getShortName, departNames[0]));
if (!departs.isEmpty()) {
SupDepart depart = departService.getOne(
new LambdaQueryWrapper<SupDepart>()
.eq(SupDepart::getLevel, DepartLevelEnum.SECOND.getValue())
.eq(SupDepart::getShortName, departNames[0]).last("limit 1")
);
if (ObjectUtil.isNotEmpty(depart)) {
if (departNames.length > 1) {
List<SupDepart> threeDeparts = departService.list(new LambdaQueryWrapper<SupDepart>()
.eq(SupDepart::getPid, departs.get(0).getId())
.eq(SupDepart::getShortName, departNames[1]));
if (!threeDeparts.isEmpty()) {
data.setInvolveDepartId(threeDeparts.get(0).getId());
data.setInvolveDepartName(threeDeparts.get(0).getShortName());
SupDepart threeDepart = departService.getOne(new LambdaQueryWrapper<SupDepart>()
.eq(SupDepart::getPid, depart.getId())
.eq(SupDepart::getShortName, departNames[1]).last("limit 1"));
if (ObjectUtil.isNotEmpty(threeDepart)) {
data.setInvolveDepartId(threeDepart.getId());
data.setInvolveDepartName(threeDepart.getShortName());
}
} else {
data.setInvolveDepartId(departs.get(0).getId());
data.setInvolveDepartName(departs.get(0).getShortName());
data.setInvolveDepartId(depart.getId());
data.setInvolveDepartName(depart.getShortName());
}
}
}
@ -153,6 +164,7 @@ public class NegativeTaskController {
ReadSheet sheet = EasyExcel.readSheet("问题信息模板").build();
excelReader.read(sheet);
excelReader.close();
log.debug("耗时监控: {}", stopWatch.shortSummary());
return Result.success(list);
}

7
src/main/java/com/biutag/supervision/job/Job.java

@ -211,7 +211,8 @@ public class Job {
rpcApply.setRpcStatus(ComfortStatus.completed.name());
// 数据来源
rpcApply.setSource("gbase");
rpcApplySuperviseService.save(rpcApply);
rpcApplySuperviseService.saveOrUpdate(rpcApply);
//受害人列表
RpcApplyPerson rpcApplyPerson= new RpcApplyPerson();
@ -242,7 +243,7 @@ public class Job {
}
rpcApplyPerson.setEmpNo(rpcApply.getApplicantEmpNo());
//存储受害人信息
rpcApplyPersonService.save(rpcApplyPerson);
rpcApplyPersonService.saveOrUpdate(rpcApplyPerson);
//存储犯人信息
List<DwdAsjZfbaWfrwfxx> wfrwfxxes = dwdAsjZfbaWfrwfxxMapper.selectList(new LambdaQueryWrapper<DwdAsjZfbaWfrwfxx>().eq(DwdAsjZfbaWfrwfxx::getAjbh,item.getAjbh()));
log.info("违法人员信息数据:{}条", wfrwfxxes.size());
@ -260,7 +261,7 @@ public class Job {
rpcInfringerResult.setGender( x.getXbmc().split("性")[0]);
}
//保存犯人信息
rpcInfringerResultService.save(rpcInfringerResult);
rpcInfringerResultService.saveOrUpdate(rpcInfringerResult);
});
}
});

Loading…
Cancel
Save