|
|
|
@ -9,13 +9,15 @@ import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.biutag.supervision.common.UserContextHolder; |
|
|
|
import com.biutag.supervision.common.UserContextHolder; |
|
|
|
import com.biutag.supervision.constants.AppConstants; |
|
|
|
import com.biutag.supervision.constants.AppConstants; |
|
|
|
import com.biutag.supervision.constants.enums.*; |
|
|
|
import com.biutag.supervision.constants.enums.BlameType; |
|
|
|
|
|
|
|
import com.biutag.supervision.constants.enums.InspectCaseEnum; |
|
|
|
|
|
|
|
import com.biutag.supervision.constants.enums.ProblemSourcesEnum; |
|
|
|
|
|
|
|
import com.biutag.supervision.constants.enums.RoleCodeEnum; |
|
|
|
import com.biutag.supervision.mapper.ComplaintCollectionMapper; |
|
|
|
import com.biutag.supervision.mapper.ComplaintCollectionMapper; |
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
import com.biutag.supervision.pojo.domain.Blame; |
|
|
|
import com.biutag.supervision.pojo.domain.Blame; |
|
|
|
@ -92,9 +94,7 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic |
|
|
|
private final ComplaintCollectionResourceService complaintCollectionResourceService; |
|
|
|
private final ComplaintCollectionResourceService complaintCollectionResourceService; |
|
|
|
private final SupDictDataService supDictDataService; |
|
|
|
private final SupDictDataService supDictDataService; |
|
|
|
private final ComplaintCollectionBlameResourceService complaintCollectionBlameResourceService; |
|
|
|
private final ComplaintCollectionBlameResourceService complaintCollectionBlameResourceService; |
|
|
|
private final SupDictDataService dictDataService; |
|
|
|
|
|
|
|
private final NegativeService negativeService; |
|
|
|
private final NegativeService negativeService; |
|
|
|
private final NegativeThingFileService thingFileService; |
|
|
|
|
|
|
|
private final SupDepartService departService; |
|
|
|
private final SupDepartService departService; |
|
|
|
private final SupDepartResourceService supDepartResourceService; |
|
|
|
private final SupDepartResourceService supDepartResourceService; |
|
|
|
private final NegativeBlameService negativeBlameService; |
|
|
|
private final NegativeBlameService negativeBlameService; |
|
|
|
@ -619,76 +619,6 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic |
|
|
|
return res; |
|
|
|
return res; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public VerifyData buildVerifyData(ComplaintCollectionAndBlameAddRequest request) { |
|
|
|
|
|
|
|
VerifyData verifyData = new VerifyData(); |
|
|
|
|
|
|
|
BeanUtil.copyProperties(request, verifyData); |
|
|
|
|
|
|
|
// 责任人
|
|
|
|
|
|
|
|
List<VerifyData.Blame> blameList = new ArrayList<>(); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(request.getBlames())) { |
|
|
|
|
|
|
|
for (ComplaintCollectionAndBlameAddRequest.Blame b : request.getBlames()) { |
|
|
|
|
|
|
|
VerifyData.Blame blame = new VerifyData.Blame(); |
|
|
|
|
|
|
|
BeanUtil.copyProperties(b, blame); |
|
|
|
|
|
|
|
if (cn.hutool.core.util.StrUtil.isNotBlank(b.getIvPersonTypeName())) { |
|
|
|
|
|
|
|
blame.setIvPersonType(b.getIvPersonTypeName()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
blame.setIvPersonType(b.getIvPersonType()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<VerifyData.Problem> problems = new ArrayList<>(); |
|
|
|
|
|
|
|
if (b.getProblems() != null) { |
|
|
|
|
|
|
|
for (ComplaintCollectionAndBlameAddRequest.Problem p : b.getProblems()) { |
|
|
|
|
|
|
|
VerifyData.Problem problem = new VerifyData.Problem(); |
|
|
|
|
|
|
|
cn.hutool.core.bean.BeanUtil.copyProperties(p, problem); |
|
|
|
|
|
|
|
problems.add(problem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
blame.setProblems(problems); |
|
|
|
|
|
|
|
blameList.add(blame); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
verifyData.setBlames(blameList); |
|
|
|
|
|
|
|
// 责任领导
|
|
|
|
|
|
|
|
List<VerifyData.BlameLeader> leaderList = new ArrayList<>(); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(request.getBlameLeaders())) { |
|
|
|
|
|
|
|
for (ComplaintCollectionAndBlameAddRequest.BlameLeader l : request.getBlameLeaders()) { |
|
|
|
|
|
|
|
VerifyData.BlameLeader leader = new VerifyData.BlameLeader(); |
|
|
|
|
|
|
|
BeanUtil.copyProperties(l, leader); |
|
|
|
|
|
|
|
leaderList.add(leader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
verifyData.setBlameLeaders(leaderList); |
|
|
|
|
|
|
|
return verifyData; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private NegativeDto buildNegativeDto(ComplaintCollectionAndBlameAddRequest request) { |
|
|
|
|
|
|
|
Map<String, String> stringStringMap = buildDictLabelMap(SupDictEnum.SFSS_SOURCE_TABLE.getCode()); |
|
|
|
|
|
|
|
NegativeDto dto = new NegativeDto(); |
|
|
|
|
|
|
|
dto.setId(request.getComplaintId()); |
|
|
|
|
|
|
|
dto.setOriginId(request.getOriginId()); |
|
|
|
|
|
|
|
dto.setDiscoveryTime(request.getDiscoveryTime()); |
|
|
|
|
|
|
|
if ("leader_explain".equals(request.getSourceTable())){ |
|
|
|
|
|
|
|
dto.setProblemSourcesCode(request.getSourceTableSubOne()); |
|
|
|
|
|
|
|
dto.setProblemSources(stringStringMap.get(request.getSourceTableSubOne())); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
dto.setProblemSourcesCode(request.getSourceTable()); |
|
|
|
|
|
|
|
dto.setProblemSources(stringStringMap.get(request.getSourceTable())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
dto.setBusinessTypeCode(request.getBusinessTypeCode()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dto.setPoliceTypeName(null); |
|
|
|
|
|
|
|
dto.setPoliceType(null); |
|
|
|
|
|
|
|
dto.setInvolveProblem(request.getInvolveProblem()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dto.setResponderName(request.getResponderName()); |
|
|
|
|
|
|
|
dto.setContactPhone(request.getResponderPhone()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dto.setThingDesc(request.getThingDesc()); |
|
|
|
|
|
|
|
dto.setInvolveDepartName(request.getInvolveDepartName()); |
|
|
|
|
|
|
|
dto.setInvolveDepartId(request.getInvolveDepartId()); |
|
|
|
|
|
|
|
dto.setThingFiles(request.getThingFiles()); |
|
|
|
|
|
|
|
return dto; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 从 ComplaintCollectionAddRequest 构建 NegativeDto,用于同步创建 Negative |
|
|
|
* 从 ComplaintCollectionAddRequest 构建 NegativeDto,用于同步创建 Negative |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -758,54 +688,6 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Negative saveNegative(NegativeDto negativeDto) { |
|
|
|
|
|
|
|
Negative negative = new Negative(); |
|
|
|
|
|
|
|
BeanUtil.copyProperties(negativeDto, negative); |
|
|
|
|
|
|
|
if (StrUtil.isBlank(negativeDto.getOriginId())) { |
|
|
|
|
|
|
|
String originId = negativeService.generateOriginId(negativeDto.getProblemSourcesCode(), negativeDto.getBusinessTypeCode()); |
|
|
|
|
|
|
|
negative.setOriginId(originId); // 如果是空就生成随机的线索源
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(negativeDto.getBusinessTypeCode())) { |
|
|
|
|
|
|
|
SupDictData dictData = dictDataService.get("businessType", negativeDto.getBusinessTypeCode()); |
|
|
|
|
|
|
|
// 业务类型
|
|
|
|
|
|
|
|
negative.setBusinessTypeName(Optional.ofNullable(dictData).map(SupDictData::getDictLabel).orElse(null)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 涉及单位
|
|
|
|
|
|
|
|
SupDepart depart = departService.getById(negative.getInvolveDepartId()); |
|
|
|
|
|
|
|
if (DepartLevelEnum.SECOND.getValue().equals(depart.getLevel())) { |
|
|
|
|
|
|
|
negative.setSecondInvolveDepartId(depart.getId()); |
|
|
|
|
|
|
|
} else if (DepartLevelEnum.THREE.getValue().equals(depart.getLevel())) { |
|
|
|
|
|
|
|
negative.setThreeInvolveDepartId(depart.getId()); |
|
|
|
|
|
|
|
negative.setSecondInvolveDepartId(depart.getPid()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
throw new RuntimeException("涉及单位请选择二级或三级单位"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
|
|
|
|
negative.setCrtTime(now).setUpdTime(now); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(negativeDto.getInvolveProblem())) { |
|
|
|
|
|
|
|
negative.setInvolveProblem(String.join(",", negativeDto.getInvolveProblem())); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
negative.setInvolveProblem(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(negativeDto.getProblems())) { |
|
|
|
|
|
|
|
negative.setProblems(JSON.toJSONString(negativeDto.getProblems())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 直接插入已办结
|
|
|
|
|
|
|
|
negative.setProcessingStatus(ProcessingStatusEnum.completed.name()); |
|
|
|
|
|
|
|
negativeService.save(negative); // 添加一条 negative 数据
|
|
|
|
|
|
|
|
negativeDto.setId(negative.getId()); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(negativeDto.getThingFiles())) { |
|
|
|
|
|
|
|
List<NegativeThingFile> files = negativeDto.getThingFiles().stream().map(item -> { |
|
|
|
|
|
|
|
NegativeThingFile negativeThingFile = new NegativeThingFile(); |
|
|
|
|
|
|
|
BeanUtil.copyProperties(item, negativeThingFile); |
|
|
|
|
|
|
|
negativeThingFile.setNegativeId(negative.getId()); |
|
|
|
|
|
|
|
negativeThingFile.setCreateTime(now); |
|
|
|
|
|
|
|
return negativeThingFile; |
|
|
|
|
|
|
|
}).toList(); |
|
|
|
|
|
|
|
thingFileService.saveBatch(files); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return negative; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 保存附件 |
|
|
|
* 保存附件 |
|
|
|
|