Browse Source

fix: 同步bug

master
buaixuexideshitongxue 1 month ago
parent
commit
f9cc37c4db
  1. 32
      src/main/java/com/biutag/supervision/repository/complaintCollection/ComplaintCollectionResourceService.java
  2. 6
      src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java

32
src/main/java/com/biutag/supervision/repository/complaintCollection/ComplaintCollectionResourceService.java

@ -75,7 +75,29 @@ public class ComplaintCollectionResourceService extends BaseDAO {
* @return
*/
public boolean updateSelectiveById(ComplaintCollectionUpdateParam param) {
// 防御
return doUpdateSelective(param, true);
}
/**
* 更新非空字段用于定时任务自动同步场景
* - updateBy 固定为 "自动同步"
* - updateTime 为当前时间
*
* @param param 更新参数
* @return 是否更新成功
*/
public boolean updateSelectiveByIdForJob(ComplaintCollectionUpdateParam param) {
return doUpdateSelective(param, false);
}
/**
* 通用更新逻辑
*
* @param param 更新参数
* @param useCurrentUser 是否使用当前登录用户作为操作人
* @return 是否更新成功
*/
private boolean doUpdateSelective(ComplaintCollectionUpdateParam param, boolean useCurrentUser) {
String id = param.getId();
if (StrUtil.isBlank(id)) {
throw new RuntimeException("更新id不能为空");
@ -137,7 +159,6 @@ public class ComplaintCollectionResourceService extends BaseDAO {
if (param.getCheckStatusDesc()!=null){
uw.set(ComplaintCollection::getCheckStatusDesc, param.getCheckStatusDesc());
}
// 3) 非 String 字段:!= null 才更新
if (param.getDiscoveryTime() != null) {
uw.set(ComplaintCollection::getDiscoveryTime, param.getDiscoveryTime());
}
@ -177,7 +198,12 @@ public class ComplaintCollectionResourceService extends BaseDAO {
if (param.getBlameSyncStatus()!=null){
uw.set(ComplaintCollection::getBlameSyncStatus, param.getBlameSyncStatus());
}
uw.set(ComplaintCollection::getUpdateBy, UserContextHolder.getCurrentUser().getUserName());
// 操作人:useCurrentUser=true时使用当前登录用户,false时使用"自动同步"
if (useCurrentUser) {
uw.set(ComplaintCollection::getUpdateBy, UserContextHolder.getCurrentUser().getUserName());
} else {
uw.set(ComplaintCollection::getUpdateBy, "自动同步");
}
uw.set(ComplaintCollection::getUpdateTime, LocalDateTime.now());
uw.set(StrUtil.isNotBlank(param.getInitWorkDes()), ComplaintCollection::getInitWorkDes, param.getInitWorkDes());
uw.set(StrUtil.isNotBlank(param.getInitProblemPlan()), ComplaintCollection::getInitProblemPlan, param.getInitProblemPlan());

6
src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java

@ -598,7 +598,7 @@ public class MailBoxCaptureService {
complaintCollectionUpdateParam.setId(cc.getId());
complaintCollectionUpdateParam.setBlameSyncStatus("1");
complaintCollectionUpdateParam.setPublicRecognition(cc.getPublicRecognition());
boolean updated = complaintCollectionResourceService.updateSelectiveById(complaintCollectionUpdateParam);
boolean updated = complaintCollectionResourceService.updateSelectiveByIdForJob(complaintCollectionUpdateParam);
if (!updated) {
throw new RuntimeException("更新blameSyncStatus失败: ccId=" + cc.getId());
}
@ -898,7 +898,7 @@ public class MailBoxCaptureService {
updateParam.setGwf3(initialReviewStatus);
updateParam.setInitWorkDes(extension.getExtensionReason());
updateParam.setInitFile(extension.getInitialVerifyAttachments());
complaintCollectionResourceService.updateSelectiveById(updateParam);
complaintCollectionResourceService.updateSelectiveByIdForJob(updateParam);
}
/**
@ -958,7 +958,7 @@ public class MailBoxCaptureService {
updateParam.setGwf2(String.valueOf(submitCompletionTime));
updateParam.setGwf3(initialReviewStatus);
updateParam.setInitWorkDes("直接办结");
complaintCollectionResourceService.updateSelectiveById(updateParam);
complaintCollectionResourceService.updateSelectiveByIdForJob(updateParam);
log.debug("【延期同步】无延期记录,初核状态计算完成:originId={}, status={}",
originId, initialReviewStatus);

Loading…
Cancel
Save