|
|
|
|
@ -17,10 +17,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.biutag.supervision.common.UserContextHolder; |
|
|
|
|
import com.biutag.supervision.constants.AppConstants; |
|
|
|
|
import com.biutag.supervision.constants.enums.InspectCaseEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.ProblemSourcesEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.ProcessingStatusEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.RoleCodeEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.*; |
|
|
|
|
import com.biutag.supervision.mapper.ComplaintCollectionMapper; |
|
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
|
import com.biutag.supervision.pojo.domain.Blame; |
|
|
|
|
@ -74,6 +71,7 @@ import java.net.URLEncoder;
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
@ -752,7 +750,6 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
// 反映人信息
|
|
|
|
|
dto.setResponderName(request.getResponderName()); |
|
|
|
|
dto.setContactPhone(request.getResponderPhone()); |
|
|
|
|
|
|
|
|
|
// 案件编号
|
|
|
|
|
// dto.setCaseNumber(request.getCaseNumber());
|
|
|
|
|
|
|
|
|
|
@ -921,14 +918,18 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 迁移历史的除了局长信箱的,所有办结了而且negativeId为空的数据 |
|
|
|
|
* |
|
|
|
|
* @param request |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void moveNegativeTemp(ComplaintCollectionPageRequest request) { |
|
|
|
|
// 1. 查询已办结(status=1)且未迁移(negativeId为空)的数据
|
|
|
|
|
ComplaintCollectionQueryParam queryParam = new ComplaintCollectionQueryParam(); |
|
|
|
|
queryParam.setStatus("1"); // 已办结
|
|
|
|
|
queryParam.setSourceTableList(Set.of("21", "22", "17", "leader_explain")); |
|
|
|
|
// 可空可不空
|
|
|
|
|
queryParam.setOriginId(request.getOriginId()); |
|
|
|
|
List<ComplaintCollection> pendingList = complaintCollectionResourceService.query(queryParam); |
|
|
|
|
@ -1001,8 +1002,13 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
negative.setOriginId(cc.getOriginId()); |
|
|
|
|
negative.setDiscoveryTime(cc.getDiscoveryTime()); |
|
|
|
|
negative.setHappenTime(cc.getHappenTime()); |
|
|
|
|
negative.setBusinessTypeCode(cc.getBusinessTypeCode()); |
|
|
|
|
negative.setBusinessTypeName(cc.getBusinessTypeName()); |
|
|
|
|
if (StrUtil.isBlank(cc.getBusinessTypeCode())){ |
|
|
|
|
negative.setBusinessTypeCode(BusinessTypeEnum.QT.getValue()); |
|
|
|
|
negative.setBusinessTypeName(BusinessTypeEnum.QT.getLabel()); |
|
|
|
|
}else { |
|
|
|
|
negative.setBusinessTypeCode(cc.getBusinessTypeCode()); |
|
|
|
|
negative.setBusinessTypeName(cc.getBusinessTypeName()); |
|
|
|
|
} |
|
|
|
|
negative.setThingDesc(cc.getThingDesc()); |
|
|
|
|
|
|
|
|
|
// 问题来源
|
|
|
|
|
@ -1014,12 +1020,23 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
negative.setProblemSources(sourceDict.get(cc.getSourceTable())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 涉及单位
|
|
|
|
|
negative.setInvolveDepartId(cc.getSecondDepartId()); |
|
|
|
|
negative.setInvolveDepartName(cc.getSecondDepartName()); |
|
|
|
|
// 涉及单位:优先三级,其次二级
|
|
|
|
|
if (StrUtil.isNotBlank(cc.getThirdDepartId())) { |
|
|
|
|
negative.setInvolveDepartId(cc.getThirdDepartId()); |
|
|
|
|
negative.setInvolveDepartName(cc.getThirdDepartName()); |
|
|
|
|
} else { |
|
|
|
|
negative.setInvolveDepartId(cc.getSecondDepartId()); |
|
|
|
|
negative.setInvolveDepartName(cc.getSecondDepartName()); |
|
|
|
|
} |
|
|
|
|
negative.setSecondInvolveDepartId(cc.getSecondDepartId()); |
|
|
|
|
negative.setThreeInvolveDepartId(cc.getThirdDepartId()); |
|
|
|
|
|
|
|
|
|
// 办理单位
|
|
|
|
|
negative.setHandleSecondDepartId(cc.getSecondDepartId()); |
|
|
|
|
negative.setHandleSecondDepartName(cc.getSecondDepartName()); |
|
|
|
|
negative.setHandleThreeDepartId(cc.getThirdDepartId()); |
|
|
|
|
negative.setHandleThreeDepartName(cc.getThirdDepartName()); |
|
|
|
|
|
|
|
|
|
// 反映人信息
|
|
|
|
|
negative.setResponderName(cc.getResponderName()); |
|
|
|
|
negative.setContactPhone(cc.getResponderPhone()); |
|
|
|
|
@ -1040,19 +1057,24 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
negative.setCaseNumber(cc.getCaseNumber()); |
|
|
|
|
|
|
|
|
|
// 状态设置 - 已办结
|
|
|
|
|
negative.setProcessingStatus("completed"); |
|
|
|
|
if ("1".equals(cc.getStatus())){ |
|
|
|
|
negative.setProcessingStatus(ProcessingStatusEnum.completed.name()); |
|
|
|
|
}else { |
|
|
|
|
negative.setProcessingStatus(ProcessingStatusEnum.processing.name()); |
|
|
|
|
} |
|
|
|
|
negative.setStatus("0"); |
|
|
|
|
|
|
|
|
|
// 来源设置
|
|
|
|
|
negative.setSourceType(NegativeSourceTypeEnum.COMPLAINT_REPORT.getCode()); |
|
|
|
|
negative.setSourceTypeDesc(NegativeSourceTypeEnum.COMPLAINT_REPORT.getDesc()); |
|
|
|
|
|
|
|
|
|
// 涉嫌问题
|
|
|
|
|
if (StrUtil.isNotBlank(cc.getInvolveProblem())) { |
|
|
|
|
negative.setInvolveProblem(cc.getInvolveProblem()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 创建信息
|
|
|
|
|
negative.setCrtTime(LocalDateTime.now()); |
|
|
|
|
String userName = "system"; |
|
|
|
|
try { |
|
|
|
|
userName = UserContextHolder.getCurrentUser().getUserName(); |
|
|
|
|
} catch (Exception ignored) {} |
|
|
|
|
negative.setCrtTime(cc.getCreateTime()); |
|
|
|
|
return negative; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1160,8 +1182,8 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
negativeBlame.setLeadHandleResultNameOther(blame.getLeadHandleResultNameOther()); |
|
|
|
|
negativeBlame.setLeadProtectRightsCode(blame.getLeadProtectRightsCode()); |
|
|
|
|
negativeBlame.setLeadProtectRightsName(blame.getLeadProtectRightsName()); |
|
|
|
|
negativeBlame.setLeadMeasuresCode(blame.getLeadResponsibilityTypeCode()); |
|
|
|
|
negativeBlame.setLeadMeasuresName(blame.getLeadResponsibilityTypeName()); |
|
|
|
|
// negativeBlame.setLeadMeasuresCode(blame.getLeadResponsibilityTypeCode());
|
|
|
|
|
// negativeBlame.setLeadMeasuresName(blame.getLeadResponsibilityTypeName());
|
|
|
|
|
|
|
|
|
|
// 创建信息
|
|
|
|
|
negativeBlame.setCrtTime(blame.getCreateTime()); |
|
|
|
|
@ -1181,13 +1203,11 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void addNegativeTemp(ComplaintCollectionPageRequest request) { |
|
|
|
|
// if(StrUtil.isBlank(request.getOriginId())){
|
|
|
|
|
// throw new IllegalArgumentException("下发旧数据必须填写编号");
|
|
|
|
|
// }
|
|
|
|
|
// 1. 查询待下发数据(status=0 且 negativeId为空)
|
|
|
|
|
ComplaintCollectionQueryParam queryParam = new ComplaintCollectionQueryParam(); |
|
|
|
|
queryParam.setStatus("0"); // 初始状态
|
|
|
|
|
queryParam.setHandleMethod("1"); |
|
|
|
|
queryParam.setSourceTableList(Set.of("21", "22", "17", "leader_explain")); |
|
|
|
|
// 也是可填可不填
|
|
|
|
|
queryParam.setOriginId(request.getOriginId()); |
|
|
|
|
List<ComplaintCollection> pendingList = complaintCollectionResourceService.query(queryParam); |
|
|
|
|
@ -1275,7 +1295,13 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 业务类别
|
|
|
|
|
dto.setBusinessTypeCode(cc.getBusinessTypeCode()); |
|
|
|
|
if (StrUtil.isBlank(cc.getBusinessTypeCode())){ |
|
|
|
|
dto.setBusinessTypeCode(BusinessTypeEnum.QT.getValue()); |
|
|
|
|
dto.setBusinessTypeName(BusinessTypeEnum.QT.getLabel()); |
|
|
|
|
}else { |
|
|
|
|
dto.setBusinessTypeCode(cc.getBusinessTypeCode()); |
|
|
|
|
dto.setBusinessTypeName(cc.getBusinessTypeName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 涉及单位用现在的二级单位
|
|
|
|
|
dto.setInvolveDepartId(cc.getSecondDepartId()); |
|
|
|
|
@ -1308,4 +1334,76 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 迁移所有投诉举报局长信箱历史数据到 Negative |
|
|
|
|
* 全部都是只是到negative中 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void migrateMayorMailboxNegative(ComplaintCollectionPageRequest request) { |
|
|
|
|
// 1. 查询局长信箱来源 + status=1(已办结)+ negativeId为空的数据
|
|
|
|
|
ComplaintCollectionQueryParam queryParam = new ComplaintCollectionQueryParam(); |
|
|
|
|
queryParam.setSourceTable(ComplaintCollectionSourceTableEnum.MAYOR_MAILBOX.getCode()); |
|
|
|
|
queryParam.setOriginId(request.getOriginId()); // 可空
|
|
|
|
|
List<ComplaintCollection> pendingList = complaintCollectionResourceService.query(queryParam); |
|
|
|
|
|
|
|
|
|
// 过滤 negativeId 为空的数据
|
|
|
|
|
List<ComplaintCollection> toMigrate = pendingList.stream() |
|
|
|
|
.filter(cc -> StrUtil.isBlank(cc.getNegativeId())) |
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(toMigrate)) { |
|
|
|
|
log.info("【局长信箱迁移】没有需要迁移的已办结数据"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int successCount = 0; |
|
|
|
|
int skipCount = 0; |
|
|
|
|
int failCount = 0; |
|
|
|
|
|
|
|
|
|
for (ComplaintCollection cc : toMigrate) { |
|
|
|
|
try { |
|
|
|
|
// 2. 判重检查
|
|
|
|
|
if (negativeService.exists(cc.getOriginId())) { |
|
|
|
|
log.info("【局长信箱迁移】跳过(Negative已存在): originId={}", cc.getOriginId()); |
|
|
|
|
skipCount++; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 2. 获取字典翻译Map
|
|
|
|
|
Map<String, String> sourceDict = buildDictLabelMap(SupDictEnum.SFSS_SOURCE_TABLE.getCode()); |
|
|
|
|
|
|
|
|
|
// 3. 构建 Negative 对象(复用已有方法)
|
|
|
|
|
Negative negative = buildNegativeFromComplaintCollection(cc, sourceDict); |
|
|
|
|
negativeService.save(negative); |
|
|
|
|
String newNegativeId = negative.getId(); |
|
|
|
|
|
|
|
|
|
// 4. 迁移附件(复用已有的迁移方法)
|
|
|
|
|
migrateFilesToNegative(cc.getId(), newNegativeId); |
|
|
|
|
migrateCheckFilesToNegative(cc.getId(), newNegativeId); |
|
|
|
|
|
|
|
|
|
// 5. 迁移涉及人(复用已有的迁移方法)
|
|
|
|
|
migrateBlamesToNegative(cc.getId(), newNegativeId); |
|
|
|
|
|
|
|
|
|
// 6. 更新 ComplaintCollection.negativeId
|
|
|
|
|
ComplaintCollectionUpdateParam updateParam = new ComplaintCollectionUpdateParam(); |
|
|
|
|
updateParam.setId(cc.getId()); |
|
|
|
|
updateParam.setNegativeId(newNegativeId); |
|
|
|
|
updateParam.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
updateParam.setUpdateBy(UserContextHolder.getCurrentUser().getUserName()); |
|
|
|
|
complaintCollectionResourceService.updateSelectiveById(updateParam); |
|
|
|
|
|
|
|
|
|
log.info("【局长信箱迁移】迁移成功: id={}, originId={}", cc.getId(), cc.getOriginId()); |
|
|
|
|
successCount++; |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("【局长信箱迁移】迁移失败: id={}, originId={}, error={}", cc.getId(), cc.getOriginId(), e.getMessage(), e); |
|
|
|
|
failCount++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.info("【局长信箱迁移】迁移完成: 成功={}, 跳过={}, 失败={}", successCount, skipCount, failCount); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|