|
|
|
|
@ -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()); |
|
|
|
|
|