Browse Source

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

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

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

@ -62,12 +62,19 @@ public class DfSuperviseWayService extends BaseService<DfSuperviseWayMapper, DfS
DfSuperviseWay enable = getEnableWay();
if (ObjectUtil.isNotNull(id)) {
// 修改校验是否启用一条
DfSuperviseWayDto wayDto = getDetailById(id);
DfSuperviseWay wayDto = this.getById(id);
if (wayDto.getId().equals(enable.getId()) && updateStatus.equals(SuperviseWayStatus.STOP.getValue())) {
throw new DfException("需启用一项管理办法");
} else {
enable.setStatus(SuperviseWayStatus.STOP.getValue());
this.updateById(enable);
// 如果当前启用的监督检查办法不是正在修改的办法
if (!wayDto.getId().equals(enable.getId())) {
wayDto.setStatus(updateStatus);
this.updateById(wayDto);
if(updateStatus.equals(SuperviseWayStatus.ENABLE.getValue())){
enable.setStatus(SuperviseWayStatus.STOP.getValue());
this.updateById(enable);
}
}
}
}else{
// 若新增没有启用的则设为默认启用的,否则为禁用

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

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

Loading…
Cancel
Save