|
@@ -7,7 +7,9 @@ import com.usky.common.core.bean.CommonPage;
|
|
|
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.*;
|
|
|
+import com.usky.fire.domain.PatrolInspectionArea;
|
|
|
+import com.usky.fire.domain.PatrolInspectionPersonnel;
|
|
|
+import com.usky.fire.domain.PatrolInspectionPlanSchedule;
|
|
|
import com.usky.fire.mapper.PatrolInspectionPersonnelMapper;
|
|
|
import com.usky.fire.service.PatrolInspectionAreaService;
|
|
|
import com.usky.fire.service.PatrolInspectionPersonnelService;
|
|
@@ -50,6 +52,14 @@ public class PatrolInspectionPersonnelServiceImpl extends AbstractCrudService<Pa
|
|
|
|
|
|
@Override
|
|
|
public void addPatrolInspectionPersonnel(PatrolInspectionPersonnel patrolInspectionPersonnel) {
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPersonnel> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolInspectionPersonnel::getTenantId, SecurityUtils.getTenantId())
|
|
|
+ .eq(PatrolInspectionPersonnel::getAreaId, patrolInspectionPersonnel.getAreaId())
|
|
|
+ .eq(PatrolInspectionPersonnel::getUserId, patrolInspectionPersonnel.getUserId());
|
|
|
+ int count = this.count(queryWrapper);
|
|
|
+ if (count>0){
|
|
|
+ throw new BusinessException("同区域人员不可重复添加");
|
|
|
+ }
|
|
|
patrolInspectionPersonnel.setCompanyId(0);
|
|
|
patrolInspectionPersonnel.setTenantId(SecurityUtils.getTenantId());
|
|
|
patrolInspectionPersonnel.setCreator(SecurityUtils.getUsername());
|
|
@@ -115,7 +125,7 @@ public class PatrolInspectionPersonnelServiceImpl extends AbstractCrudService<Pa
|
|
|
queryWrapper.orderByDesc(PatrolInspectionPersonnel::getId);
|
|
|
if (pageNum != null && pageNum != 0 && pageSize != null && pageSize != 0) {
|
|
|
Integer startFate = OnlineMethod.getStartFate(pageNum, pageSize);
|
|
|
- queryWrapper.last("limit " + startFate + ","+pageSize);
|
|
|
+ queryWrapper.last("limit " + startFate + "," + pageSize);
|
|
|
}
|
|
|
List<PatrolInspectionPersonnel> list = this.list(queryWrapper);
|
|
|
List<PatrolInspectionPersonnelVo> list1 = new ArrayList<>();
|
|
@@ -132,8 +142,8 @@ public class PatrolInspectionPersonnelServiceImpl extends AbstractCrudService<Pa
|
|
|
patrolInspectionPersonnelVo.setTenantId(list.get(i).getTenantId());
|
|
|
patrolInspectionPersonnelVo.setAreaId(list.get(i).getAreaId());
|
|
|
patrolInspectionPersonnelVo.setUserId(list.get(i).getUserId());
|
|
|
- for (int j = 0; j <userList.size(); j++) {
|
|
|
- if (list.get(i).getUserId().longValue()==userList.get(j).getUserId()){
|
|
|
+ for (int j = 0; j < userList.size(); j++) {
|
|
|
+ if (list.get(i).getUserId().longValue() == userList.get(j).getUserId()) {
|
|
|
patrolInspectionPersonnelVo.setName(userList.get(j).getNickName());
|
|
|
}
|
|
|
}
|
|
@@ -141,7 +151,7 @@ public class PatrolInspectionPersonnelServiceImpl extends AbstractCrudService<Pa
|
|
|
}
|
|
|
}
|
|
|
// List<PatrolInspectionPersonnelVo> list2 = list1.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
|
|
|
- return new CommonPage<>(list1, total, pageSize,pageNum);
|
|
|
+ return new CommonPage<>(list1, total, pageSize, pageNum);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -236,8 +246,8 @@ public class PatrolInspectionPersonnelServiceImpl extends AbstractCrudService<Pa
|
|
|
patrolInspectionPersonnelVo.setTenantId(list.get(i).getTenantId());
|
|
|
patrolInspectionPersonnelVo.setAreaId(list.get(i).getAreaId());
|
|
|
patrolInspectionPersonnelVo.setUserId(list.get(i).getUserId());
|
|
|
- for (int j = 0; j <userList.size(); j++) {
|
|
|
- if (list.get(i).getUserId().longValue()==userList.get(j).getUserId()){
|
|
|
+ for (int j = 0; j < userList.size(); j++) {
|
|
|
+ if (list.get(i).getUserId().longValue() == userList.get(j).getUserId()) {
|
|
|
patrolInspectionPersonnelVo.setName(userList.get(j).getNickName());
|
|
|
}
|
|
|
}
|