Browse Source

fix:监督检查-水闸/堤防-修复问题

master_tdsql
huangrenya 1 year ago
parent
commit
92d6020430
  1. 9
      shuili-system/src/main/java/com/kms/yxgh/df/service/DfSuperviseWayService.java
  2. 13
      shuili-system/src/main/java/com/kms/yxgh/sz/service/SzSuperviseWayService.java

9
shuili-system/src/main/java/com/kms/yxgh/df/service/DfSuperviseWayService.java

@ -62,13 +62,20 @@ public class DfSuperviseWayService extends BaseService<DfSuperviseWayMapper, DfS
DfSuperviseWay enable = getEnableWay(); DfSuperviseWay enable = getEnableWay();
if (ObjectUtil.isNotNull(id)) { if (ObjectUtil.isNotNull(id)) {
// 修改校验是否启用一条 // 修改校验是否启用一条
DfSuperviseWayDto wayDto = getDetailById(id); DfSuperviseWay 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());

13
shuili-system/src/main/java/com/kms/yxgh/sz/service/SzSuperviseWayService.java

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

Loading…
Cancel
Save