|
@@ -9,7 +9,9 @@ import com.usky.common.core.exception.BusinessException;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.fire.domain.PatrolInspectionArea;
|
|
|
+import com.usky.fire.domain.PatrolInspectionSite;
|
|
|
import com.usky.fire.mapper.PatrolInspectionAreaMapper;
|
|
|
+import com.usky.fire.mapper.PatrolInspectionSiteMapper;
|
|
|
import com.usky.fire.service.BaseCompanyService;
|
|
|
import com.usky.fire.service.PatrolInspectionAreaService;
|
|
|
import com.usky.fire.service.vo.PatrolInspectionAreaVo;
|
|
@@ -42,6 +44,9 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
|
|
|
@Autowired
|
|
|
private RemoteDeptService remoteDeptService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PatrolInspectionSiteMapper patrolInspectionSiteMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 巡查自检-巡检区域-新增
|
|
|
*
|
|
@@ -161,18 +166,29 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
|
|
|
LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(PatrolInspectionArea::getEnable, 1).eq(PatrolInspectionArea::getAreaFid, id);
|
|
|
List<PatrolInspectionArea> patrolInspectionArealist = this.list(queryWrapper);
|
|
|
+ List<Integer> areaIdList = new ArrayList<>();
|
|
|
+ int siteNum = 0;
|
|
|
if (null != patrolInspectionArealist && !patrolInspectionArealist.isEmpty()) {
|
|
|
+ for (int j = 0; j < patrolInspectionArealist.size(); j++) {
|
|
|
+ areaIdList.add(patrolInspectionArealist.get(j).getId());
|
|
|
+ }
|
|
|
+ areaIdList.add(id);
|
|
|
+ siteNum = patrolInspectionSiteMapper.selectSiteCount(areaIdList);
|
|
|
+ }
|
|
|
+ if (siteNum>0){
|
|
|
for (int i = 0; i < patrolInspectionArealist.size(); i++) {
|
|
|
PatrolInspectionArea patrolInspectionAreaz = new PatrolInspectionArea();
|
|
|
patrolInspectionAreaz.setId(patrolInspectionArealist.get(i).getId());
|
|
|
patrolInspectionAreaz.setEnable(0);
|
|
|
this.updateById(patrolInspectionAreaz);
|
|
|
}
|
|
|
+ PatrolInspectionArea patrolInspectionArea = new PatrolInspectionArea();
|
|
|
+ patrolInspectionArea.setId(id);
|
|
|
+ patrolInspectionArea.setEnable(0);
|
|
|
+ this.updateById(patrolInspectionArea);
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("区域下有绑定的点位,请解绑后再删除!");
|
|
|
}
|
|
|
- PatrolInspectionArea patrolInspectionArea = new PatrolInspectionArea();
|
|
|
- patrolInspectionArea.setId(id);
|
|
|
- patrolInspectionArea.setEnable(0);
|
|
|
- this.updateById(patrolInspectionArea);
|
|
|
}
|
|
|
|
|
|
/**
|