|
@ -55,20 +55,25 @@ public class SzSuperviseWayService extends BaseService<SzSuperviseWayMapper, SzS |
|
|
return BeanCopyUtils.copy(superviseWay, SzSuperviseWayDto.class); |
|
|
return BeanCopyUtils.copy(superviseWay, SzSuperviseWayDto.class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 校验状态 |
|
|
|
|
|
*/ |
|
|
|
|
|
private void checkWayStatus(SzSuperviseWay way, String id, String updateStatus){ |
|
|
private void checkWayStatus(SzSuperviseWay way, String id, String updateStatus){ |
|
|
SzSuperviseWay enable = getEnableWay(); |
|
|
SzSuperviseWay enable = getEnableWay(); |
|
|
if (ObjectUtil.isNotNull(id)) { |
|
|
if (ObjectUtil.isNotNull(id)) { |
|
|
// 修改校验是否启用一条
|
|
|
// 修改校验是否启用一条
|
|
|
SzSuperviseWayDto wayDto = getDetailById(id); |
|
|
SzSuperviseWay wayDto = this.getById(id); |
|
|
if (wayDto.getId().equals(enable.getId()) && updateStatus.equals(SuperviseWayStatus.STOP.getValue())) { |
|
|
if (wayDto.getId().equals(enable.getId()) && updateStatus.equals(SuperviseWayStatus.STOP.getValue())) { |
|
|
throw new DfException("需启用一项管理办法"); |
|
|
throw new DfException("需启用一项管理办法"); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
// 如果当前启用的监督检查办法不是正在修改的办法
|
|
|
|
|
|
if (!wayDto.getId().equals(enable.getId())) { |
|
|
|
|
|
wayDto.setStatus(updateStatus); |
|
|
|
|
|
this.updateById(wayDto); |
|
|
|
|
|
if(updateStatus.equals(SuperviseWayStatus.ENABLE.getValue())){ |
|
|
enable.setStatus(SuperviseWayStatus.STOP.getValue()); |
|
|
enable.setStatus(SuperviseWayStatus.STOP.getValue()); |
|
|
this.updateById(enable); |
|
|
this.updateById(enable); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
}else{ |
|
|
}else{ |
|
|
// 若新增没有启用的则设为默认启用的,否则为禁用
|
|
|
// 若新增没有启用的则设为默认启用的,否则为禁用
|
|
|
way.setStatus(enable == null ? SuperviseWayStatus.ENABLE.getValue() : SuperviseWayStatus.STOP.getValue()); |
|
|
way.setStatus(enable == null ? SuperviseWayStatus.ENABLE.getValue() : SuperviseWayStatus.STOP.getValue()); |
|
|