Ver Fonte

巡检模块整体由关联单位改为关联部门

hanzhengyi há 1 ano atrás
pai
commit
37096a41c2

+ 2 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionArea.java

@@ -44,9 +44,9 @@ public class PatrolInspectionArea implements Serializable {
     private Integer areaFid;
 
     /**
-     * 单位ID
+     * 部门ID
      */
-    private String companyId;
+    private Integer deptId;
 
     /**
      * 租户ID

+ 2 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAreaService.java

@@ -31,8 +31,8 @@ public interface PatrolInspectionAreaService extends CrudService<PatrolInspectio
     /**
      * 根据单位ID获取区域ID
      *
-     * @param companyId 单位ID
+     * @param deptId 部门ID
      * @return
      */
-    List<Integer> areaIdList(String companyId);
+    List<Integer> areaIdList(Integer deptId);
 }

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/BscEnterpriseStreetTownServiceImpl.java

@@ -602,7 +602,7 @@ public class BscEnterpriseStreetTownServiceImpl extends AbstractCrudService<BscE
         LambdaQueryWrapper<PatrolInspectionArea> queryWrapper2 = Wrappers.lambdaQuery();
         queryWrapper2.select(PatrolInspectionArea::getAreaFid)
                 .eq(PatrolInspectionArea::getEnable, 1)
-                .in(PatrolInspectionArea::getCompanyId, companyIdList);
+                .in(PatrolInspectionArea::getDeptId, companyIdList);
         List<PatrolInspectionArea> areaList = patrolInspectionAreaService.list(queryWrapper2);
         List<Integer> planSonIdList = new ArrayList<>();
         if (CollectionUtils.isNotEmpty(areaList)) {

+ 18 - 12
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAreaServiceImpl.java

@@ -6,12 +6,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 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.BaseCompany;
 import com.usky.fire.domain.PatrolInspectionArea;
 import com.usky.fire.mapper.PatrolInspectionAreaMapper;
 import com.usky.fire.service.BaseCompanyService;
 import com.usky.fire.service.PatrolInspectionAreaService;
 import com.usky.fire.service.vo.PatrolInspectionAreaVo;
+import com.usky.system.RemoteDeptService;
 import com.usky.system.model.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -35,6 +36,9 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
     @Autowired
     private BaseCompanyService baseCompanyService;
 
+    @Autowired
+    private RemoteDeptService remoteDeptService;
+
     /**
      * 巡查自检-巡检区域-新增
      *
@@ -45,6 +49,7 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
     public void addPatrolInspectionArea(PatrolInspectionAreaVo patrolInspectionAreaVo) {
         LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(PatrolInspectionArea::getEnable, 1)
+                .eq(PatrolInspectionArea::getDeptId, patrolInspectionAreaVo.getDeptId())
                 .eq(PatrolInspectionArea::getAreaName, patrolInspectionAreaVo.getAreaName());
         List<PatrolInspectionArea> list = this.list(queryWrapper);
         if (list.size() > 0) {
@@ -53,7 +58,7 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
         PatrolInspectionArea patrolInspectionArea = new PatrolInspectionArea();
         patrolInspectionArea.setAreaName(patrolInspectionAreaVo.getAreaName());
         patrolInspectionArea.setAreaFid(0);
-        patrolInspectionArea.setCompanyId(patrolInspectionAreaVo.getCompanyId());
+        patrolInspectionArea.setDeptId(patrolInspectionAreaVo.getDeptId());
         patrolInspectionArea.setCreator(SecurityUtils.getUsername());
         patrolInspectionArea.setCreateTime(LocalDateTime.now());
         patrolInspectionArea.setEnable(1);
@@ -72,7 +77,7 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
             PatrolInspectionArea patrolInspectionAreaZ = new PatrolInspectionArea();
             patrolInspectionAreaZ.setAreaName(patrolInspectionAreaVo.getAreaNameArray()[i]);
             patrolInspectionAreaZ.setAreaFid(areaFid);
-            patrolInspectionAreaZ.setCompanyId(patrolInspectionAreaVo.getCompanyId());
+            patrolInspectionAreaZ.setDeptId(patrolInspectionAreaVo.getDeptId());
             patrolInspectionAreaZ.setCreator(SecurityUtils.getUsername());
             patrolInspectionAreaZ.setCreateTime(LocalDateTime.now());
             patrolInspectionAreaZ.setEnable(1);
@@ -98,7 +103,7 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
         if (list2.size() > 0) {
             throw new BusinessException("区域名称不可重复");
         }
-        patrolInspectionArea.setCompanyId(list.get(0).getCompanyId());
+        patrolInspectionArea.setDeptId(list.get(0).getDeptId());
         patrolInspectionArea.setCreator(SecurityUtils.getUsername());
         patrolInspectionArea.setCreateTime(LocalDateTime.now());
         patrolInspectionArea.setEnable(1);
@@ -123,7 +128,8 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
         queryWrapperTwo.select(PatrolInspectionArea::getAreaFid)
                 .eq(PatrolInspectionArea::getAreaFid, patrolInspectionAreaMap.getAreaFid())
                 .eq(PatrolInspectionArea::getAreaName, patrolInspectionArea.getAreaName())
-                .eq(PatrolInspectionArea::getEnable, 1);
+                .eq(PatrolInspectionArea::getEnable, 1)
+                .ne(PatrolInspectionArea::getId,patrolInspectionArea.getId());
         List<PatrolInspectionArea> list1 = this.list(queryWrapperTwo);
         if (list1.size() > 0) {
             throw new BusinessException(patrolInspectionArea.getAreaName() + "重复,区域不可以重复");
@@ -136,7 +142,7 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
         for (int i = 0; i < list.size(); i++) {
             PatrolInspectionArea patrolInspectionAreaSon = new PatrolInspectionArea();
             patrolInspectionAreaSon.setId(list.get(i).getId());
-            patrolInspectionAreaSon.setCompanyId(patrolInspectionArea.getCompanyId());
+            patrolInspectionAreaSon.setDeptId(patrolInspectionArea.getDeptId());
             this.updateById(patrolInspectionAreaSon);
         }
     }
@@ -195,11 +201,11 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
         queryWrapper.orderByDesc(PatrolInspectionArea::getId);
         List<PatrolInspectionArea> list = this.list(queryWrapper);
         if (CollectionUtils.isNotEmpty(list)) {
-            List<BaseCompany> companyList = baseCompanyService.userCompanySelect();
+            List<Map<String, Object>> deptList = remoteDeptService.getDeptList(SecurityUtils.getTenantId());
             for (int i = 0; i < list.size(); i++) {
-                for (int j = 0; j < companyList.size(); j++) {
-                    if (list.get(i).getCompanyId().equals(companyList.get(j).getCompanyId())) {
-                        list.get(i).setCompanyName(companyList.get(j).getCompanyName());
+                for (int j = 0; j < deptList.size(); j++) {
+                    if (list.get(i).getDeptId().equals(deptList.get(j).get("dept_id"))) {
+                        list.get(i).setCompanyName(deptList.get(j).get("dept_name").toString());
                     }
                 }
             }
@@ -232,9 +238,9 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
     }
 
     @Override
-    public List<Integer> areaIdList(String companyId){
+    public List<Integer> areaIdList(Integer deptId){
         LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.eq(PatrolInspectionArea::getCompanyId, companyId)
+        queryWrapper.eq(PatrolInspectionArea::getDeptId, deptId)
                 .eq(PatrolInspectionArea::getEnable, 1);
         List<PatrolInspectionArea> list = this.list(queryWrapper);
         List<Integer> areaIdList = new ArrayList<>();

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPersonnelServiceImpl.java

@@ -194,7 +194,7 @@ public class PatrolInspectionPersonnelServiceImpl extends AbstractCrudService<Pa
                 patrolInspectionAreaVo.setId(patrolInspectionAreaList.get(i).getId());
                 patrolInspectionAreaVo.setAreaName(patrolInspectionAreaList.get(i).getAreaName());
                 patrolInspectionAreaVo.setAreaFid(patrolInspectionAreaList.get(i).getAreaFid());
-                patrolInspectionAreaVo.setCompanyId(patrolInspectionAreaList.get(i).getCompanyId());
+                patrolInspectionAreaVo.setDeptId(patrolInspectionAreaList.get(i).getDeptId());
                 patrolInspectionAreaVo.setTenantId(patrolInspectionAreaList.get(i).getTenantId());
                 patrolInspectionAreaVo.setCreator(patrolInspectionAreaList.get(i).getCreator());
                 patrolInspectionAreaVo.setCreateTime(patrolInspectionAreaList.get(i).getCreateTime());

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanServiceImpl.java

@@ -102,7 +102,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
                 patrolInspectionAreaVo.setId(patrolInspectionAreaList.get(i).getId());
                 patrolInspectionAreaVo.setAreaName(patrolInspectionAreaList.get(i).getAreaName());
                 patrolInspectionAreaVo.setAreaFid(patrolInspectionAreaList.get(i).getAreaFid());
-                patrolInspectionAreaVo.setCompanyId(patrolInspectionAreaList.get(i).getCompanyId());
+                patrolInspectionAreaVo.setDeptId(patrolInspectionAreaList.get(i).getDeptId());
                 patrolInspectionAreaVo.setTenantId(patrolInspectionAreaList.get(i).getTenantId());
                 patrolInspectionAreaVo.setCreator(patrolInspectionAreaList.get(i).getCreator());
                 patrolInspectionAreaVo.setCreateTime(patrolInspectionAreaList.get(i).getCreateTime());

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionSiteServiceImpl.java

@@ -89,7 +89,7 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
                 patrolInspectionAreaVo.setId(patrolInspectionAreaList.get(i).getId());
                 patrolInspectionAreaVo.setAreaName(patrolInspectionAreaList.get(i).getAreaName());
                 patrolInspectionAreaVo.setAreaFid(patrolInspectionAreaList.get(i).getAreaFid());
-                patrolInspectionAreaVo.setCompanyId(patrolInspectionAreaList.get(i).getCompanyId());
+                patrolInspectionAreaVo.setDeptId(patrolInspectionAreaList.get(i).getDeptId());
                 patrolInspectionAreaVo.setTenantId(patrolInspectionAreaList.get(i).getTenantId());
                 patrolInspectionAreaVo.setCreator(patrolInspectionAreaList.get(i).getCreator());
                 patrolInspectionAreaVo.setCreateTime(patrolInspectionAreaList.get(i).getCreateTime());

+ 2 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionAreaVo.java

@@ -50,9 +50,9 @@ public class PatrolInspectionAreaVo implements Serializable {
     private Integer areaFid;
 
     /**
-     * 单位ID
+     * 部门ID
      */
-    private String companyId;
+    private Integer deptId;
 
     /**
      * 租户ID

+ 1 - 1
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAreaMapper.xml

@@ -7,7 +7,7 @@
         <id column="id" property="id" />
         <result column="area_name" property="areaName" />
         <result column="area_fid" property="areaFid" />
-        <result column="company_id" property="companyId" />
+        <result column="dept_id" property="deptId" />
         <result column="tenant_id" property="tenantId" />
         <result column="create_time" property="createTime" />
         <result column="creator" property="creator" />