Sfoglia il codice sorgente

优化巡检代码

java110 5 anni fa
parent
commit
2920715f19

+ 28 - 0
java110-bean/src/main/java/com/java110/dto/inspectionPoint/InspectionDto.java

@@ -30,6 +30,10 @@ public class InspectionDto extends PageDto implements Serializable {
     private String relationship; //1 查询关联的巡检点 0 还未关联巡检点
     private String inspectionPlanId;
 
+    private String pointObjType;
+    private String pointObjId;
+    private String pointObjName;
+
 
     private Date createTime;
 
@@ -165,4 +169,28 @@ public class InspectionDto extends PageDto implements Serializable {
     public void setInspectionPlanId(String inspectionPlanId) {
         this.inspectionPlanId = inspectionPlanId;
     }
+
+    public String getPointObjType() {
+        return pointObjType;
+    }
+
+    public void setPointObjType(String pointObjType) {
+        this.pointObjType = pointObjType;
+    }
+
+    public String getPointObjId() {
+        return pointObjId;
+    }
+
+    public void setPointObjId(String pointObjId) {
+        this.pointObjId = pointObjId;
+    }
+
+    public String getPointObjName() {
+        return pointObjName;
+    }
+
+    public void setPointObjName(String pointObjName) {
+        this.pointObjName = pointObjName;
+    }
 }

+ 28 - 8
java110-bean/src/main/java/com/java110/po/inspection/InspectionPointPo.java

@@ -14,8 +14,10 @@ public class InspectionPointPo implements Serializable {
 
     private String inspectionId;
     private String inspectionName;
-    private String machineId;
     private String communityId;
+    private String pointObjType;
+    private String pointObjId;
+    private String pointObjName;
     private String remark;
 
     public String getInspectionId() {
@@ -34,13 +36,6 @@ public class InspectionPointPo implements Serializable {
         this.inspectionName = inspectionName;
     }
 
-    public String getMachineId() {
-        return machineId;
-    }
-
-    public void setMachineId(String machineId) {
-        this.machineId = machineId;
-    }
 
     public String getCommunityId() {
         return communityId;
@@ -57,4 +52,29 @@ public class InspectionPointPo implements Serializable {
     public void setRemark(String remark) {
         this.remark = remark;
     }
+
+
+    public String getPointObjType() {
+        return pointObjType;
+    }
+
+    public void setPointObjType(String pointObjType) {
+        this.pointObjType = pointObjType;
+    }
+
+    public String getPointObjId() {
+        return pointObjId;
+    }
+
+    public void setPointObjId(String pointObjId) {
+        this.pointObjId = pointObjId;
+    }
+
+    public String getPointObjName() {
+        return pointObjName;
+    }
+
+    public void setPointObjName(String pointObjName) {
+        this.pointObjName = pointObjName;
+    }
 }

+ 27 - 1
java110-bean/src/main/java/com/java110/vo/api/inspectionPoint/ApiInspectionPointDataVo.java

@@ -1,7 +1,6 @@
 package com.java110.vo.api.inspectionPoint;
 
 import java.io.Serializable;
-import java.util.Date;
 
 public class ApiInspectionPointDataVo implements Serializable {
 
@@ -15,6 +14,9 @@ public class ApiInspectionPointDataVo implements Serializable {
     private String locationTypeName;
     private String locationObjId;
     private String locationObjName;
+    private String pointObjType;
+    private String pointObjId;
+    private String pointObjName;
     private String machineId;
     private String communityId;
 
@@ -113,4 +115,28 @@ public class ApiInspectionPointDataVo implements Serializable {
     public void setInspectionRouteId(String inspectionRouteId) {
         this.inspectionRouteId = inspectionRouteId;
     }
+
+    public String getPointObjType() {
+        return pointObjType;
+    }
+
+    public void setPointObjType(String pointObjType) {
+        this.pointObjType = pointObjType;
+    }
+
+    public String getPointObjId() {
+        return pointObjId;
+    }
+
+    public void setPointObjId(String pointObjId) {
+        this.pointObjId = pointObjId;
+    }
+
+    public String getPointObjName() {
+        return pointObjName;
+    }
+
+    public void setPointObjName(String pointObjName) {
+        this.pointObjName = pointObjName;
+    }
 }

+ 38 - 46
java110-db/src/main/resources/mapper/community/InspectionServiceDaoImplMapper.xml

@@ -4,28 +4,27 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="inspectionServiceDaoImpl">
 
-    <!-- 保存巡检点信息 add by wuxw 2018-07-03 -->
+    <!-- 保存巡检点信息 add by wuxw 2018-07-03
+
+    -->
     <insert id="saveBusinessInspectionInfo" parameterType="Map">
         insert into business_inspection_point
-        (inspection_id,machine_id,operate,remark,inspection_name,community_id,b_id)
+        (inspection_id,operate,remark,inspection_name,community_id,b_id,point_obj_type,point_obj_id,point_obj_name)
         values
-        (#{inspectionId},#{machineId},#{operate},#{remark},#{inspectionName},#{communityId},#{bId})
+        (#{inspectionId},#{operate},#{remark},#{inspectionName},#{communityId},#{bId},#{pointObjType},#{pointObjId},#{pointObjName})
     </insert>
 
 
     <!-- 查询巡检点信息(Business) add by wuxw 2018-07-03 -->
     <select id="getBusinessInspectionInfo" parameterType="Map" resultType="Map">
-        select t.inspection_id,t.inspection_id inspectionId,t.machine_id,t.machine_id
-        machineId,t.operate,t.remark,t.inspection_name,t.inspection_name inspectionName,t.community_id,t.community_id
-        communityId,t.b_id,t.b_id bId
+        select t.inspection_id,t.inspection_id inspectionId,t.operate,t.remark,t.inspection_name,t.inspection_name inspectionName,
+        t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.point_obj_type,t.point_obj_id,t.point_obj_name,
+        t.point_obj_type pointObjType,t.point_obj_id pointObjId,t.point_obj_name pointObjName
         from business_inspection_point t
         where 1 =1
         <if test="inspectionId !=null and inspectionId != ''">
             and t.inspection_id= #{inspectionId}
         </if>
-        <if test="machineId !=null and machineId != ''">
-            and t.machine_id= #{machineId}
-        </if>
         <if test="operate !=null and operate != ''">
             and t.operate= #{operate}
         </if>
@@ -49,15 +48,15 @@
     <insert id="saveInspectionInfoInstance" parameterType="Map">
         insert into
         inspection_point(
-        inspection_id,machine_id,remark,status_cd,inspection_name,community_id,b_id
-        ) select t.inspection_id,t.machine_id,t.remark,'0',t.inspection_name,t.community_id,t.b_id from
+        inspection_id,remark,status_cd,inspection_name,community_id,b_id,
+        point_obj_type,point_obj_id,point_obj_name
+        ) select t.inspection_id,t.remark,'0',t.inspection_name,t.community_id,t.b_id,
+        t.point_obj_type,t.point_obj_id,t.point_obj_name
+        from
         business_inspection_point t where 1=1
         <if test="inspectionId !=null and inspectionId != ''">
             and t.inspection_id= #{inspectionId}
         </if>
-        <if test="machineId !=null and machineId != ''">
-            and t.machine_id= #{machineId}
-        </if>
         and t.operate= 'ADD'
         <if test="remark !=null and remark != ''">
             and t.remark= #{remark}
@@ -78,16 +77,12 @@
     <!-- 查询巡检点信息 add by wuxw 2018-07-03 -->
     <select id="getInspectionInfo" parameterType="Map" resultType="Map">
         select
-        t.inspection_id,t.inspection_id inspectionId,t.machine_id,
-        t.machine_id machineId,t.remark,t.status_cd,t.status_cd statusCd,
+        t.inspection_id,t.inspection_id inspectionId,t.remark,t.status_cd,t.status_cd statusCd,
         t.inspection_name,t.inspection_name inspectionName,t.community_id,
         t.community_id communityId,t.b_id,t.b_id bId,
-        m.machine_code machineCode,m.machine_name machineName,location_type_cd locationTypeCd,location_obj_id
-        locationObjId,m.machine_id machineId,
-        d.name locationTypeName
+        t.point_obj_type,t.point_obj_id,t.point_obj_name,
+        t.point_obj_type pointObjType,t.point_obj_id pointObjId,t.point_obj_name pointObjName
         from inspection_point t
-        left join machine m on t.machine_id = m.machine_id and m.status_cd = 0
-        left join t_dict d on d.status_cd = m.location_type_cd
         <if test="inspectionRouteId != null  and  inspectionRouteId != ''">
             left join inspection_route_point_rel c on t.inspection_id = c.inspection_id
             and c.status_cd = '0'
@@ -97,8 +92,8 @@
         <if test="inspectionId !=null and inspectionId != ''">
             and t.inspection_id= #{inspectionId}
         </if>
-        <if test="machineCode !=null and machineCode != ''">
-            and m.machine_code= #{machineCode}
+        <if test="pointObjType !=null and pointObjType != ''">
+            and t.point_obj_type= #{pointObjType}
         </if>
         <if test="remark !=null and remark != ''">
             and t.remark= #{remark}
@@ -130,8 +125,14 @@
         <if test="newBId != null and newBId != ''">
             ,t.b_id = #{newBId}
         </if>
-        <if test="machineId !=null and machineId != ''">
-            , t.machine_id= #{machineId}
+        <if test="pointObjType !=null and pointObjType != ''">
+            , t.point_obj_type= #{pointObjType}
+        </if>
+        <if test="pointObjId !=null and pointObjId != ''">
+            , t.point_obj_id= #{pointObjId}
+        </if>
+        <if test="pointObjName !=null and pointObjName != ''">
+            , t.point_obj_name= #{pointObjName}
         </if>
         <if test="remark !=null and remark != ''">
             , t.remark= #{remark}
@@ -149,15 +150,12 @@
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
-
     </update>
 
     <!-- 查询巡检点数量 add by wuxw 2018-07-03 -->
     <select id="queryInspectionsCount" parameterType="Map" resultType="Map">
         select count(1) count
         from inspection_point t
-        left join machine m on t.machine_id = m.machine_id and m.status_cd = 0
-        left join t_dict d on d.status_cd = m.location_type_cd
         <if test="inspectionRouteId != null  and  inspectionRouteId != ''">
             left join inspection_route_point_rel c on t.inspection_id = c.inspection_id
             and c.status_cd = '0'
@@ -167,8 +165,8 @@
         <if test="inspectionId !=null and inspectionId != ''">
             and t.inspection_id= #{inspectionId}
         </if>
-        <if test="machineCode !=null and machineCode != ''">
-            and m.machine_code= #{machineCode}
+        <if test="pointObjType !=null and pointObjType != ''">
+            and t.point_obj_type= #{pointObjType}
         </if>
         <if test="remark !=null and remark != ''">
             and t.remark= #{remark}
@@ -193,16 +191,13 @@
     <!-- 查询巡检点信息 add by wuxw 2018-07-03 -->
     <select id="getInspectionRelationShipInfo" parameterType="Map" resultType="Map">
         select
-        t.inspection_id,t.inspection_id inspectionId,t.machine_id,
-        t.machine_id machineId,t.remark,t.status_cd,t.status_cd statusCd,
+        t.inspection_id,t.inspection_id inspectionId,t.remark,t.status_cd,t.status_cd statusCd,
         t.inspection_name,t.inspection_name inspectionName,t.community_id,
         t.community_id communityId,t.b_id,t.b_id bId,
-        m.machine_code machineCode,m.machine_name machineName,location_type_cd locationTypeCd,location_obj_id
-        locationObjId,m.machine_id machineId,
+        t.point_obj_type,t.point_obj_id,t.point_obj_name,
+        t.point_obj_type pointObjType,t.point_obj_id pointObjId,t.point_obj_name pointObjName
         d.name locationTypeName
         from inspection_point t
-        inner join machine m on t.machine_id = m.machine_id and m.status_cd = 0
-        INNER JOIN t_dict d ON d.status_cd = m.location_type_cd and d.table_name = 'machine' and d.table_columns = 'location_type_cd'
         left join inspection_route_point_rel c on t.inspection_id = c.inspection_id and c.status_cd = '0' and c.inspection_route_id = #{inspectionRouteId}
         where 1 =1
 
@@ -215,8 +210,8 @@
         <if test="inspectionId !=null and inspectionId != ''">
             and t.inspection_id= #{inspectionId}
         </if>
-        <if test="machineCode !=null and machineCode != ''">
-            and m.machine_code= #{machineCode}
+        <if test="pointObjType !=null and pointObjType != ''">
+            and t.point_obj_type= #{pointObjType}
         </if>
         <if test="remark !=null and remark != ''">
             and t.remark= #{remark}
@@ -243,12 +238,9 @@
     <select id="queryInspectionsRelationShipCount" parameterType="Map" resultType="Map">
         select count(1) count
         from inspection_point t
-        inner join machine m on t.machine_id = m.machine_id and m.status_cd = 0
-        INNER JOIN t_dict d ON d.status_cd = m.location_type_cd and d.table_name = 'machine' and d.table_columns = 'location_type_cd'
-        left join inspection_route_point_rel c on t.inspection_id = c.inspection_id
-        and c.status_cd = '0'
-        and c.inspection_route_id = #{inspectionRouteId}
+        left join inspection_route_point_rel c on t.inspection_id = c.inspection_id and c.status_cd = '0' and c.inspection_route_id = #{inspectionRouteId}
         where 1 =1
+
         <if test="relationship != null  and  relationship == 1">
             and c.inspection_id is not null
         </if>
@@ -258,8 +250,8 @@
         <if test="inspectionId !=null and inspectionId != ''">
             and t.inspection_id= #{inspectionId}
         </if>
-        <if test="machineId !=null and machineId != ''">
-            and t.machine_id= #{machineId}
+        <if test="pointObjType !=null and pointObjType != ''">
+            and t.point_obj_type= #{pointObjType}
         </if>
         <if test="remark !=null and remark != ''">
             and t.remark= #{remark}
@@ -268,7 +260,7 @@
             and t.status_cd= #{statusCd}
         </if>
         <if test="inspectionName !=null and inspectionName != ''">
-            and t.inspection_name= #{inspectionName}
+            and t.inspection_name like concat('%',#{inspectionName},'%')
         </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}

+ 1 - 1
service-api/src/main/java/com/java110/api/listener/inspectionPoint/ListInspectionPointsListener.java

@@ -105,7 +105,7 @@ public class ListInspectionPointsListener extends AbstractServiceApiListener {
         if (count > 0) {
             inspectionPoints = BeanConvertUtil.covertBeanList(inspectionPointInnerServiceSMOImpl.getInspectionRelationShip(inspectionPointDto), ApiInspectionPointDataVo.class);
             // 刷新 位置信息
-            refreshMachines(inspectionPoints);
+            //refreshMachines(inspectionPoints);
         } else {
             inspectionPoints = new ArrayList<>();
         }

+ 8 - 4
service-community/src/main/java/com/java110/community/listener/inspectionPoint/AbstractInspectionBusinessServiceDataFlowListener.java

@@ -2,11 +2,11 @@ package com.java110.community.listener.inspectionPoint;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.community.dao.IInspectionServiceDao;
+import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.entity.center.Business;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.constant.StatusConstant;
 import com.java110.utils.exception.ListenerExecuteException;
-import com.java110.entity.center.Business;
-import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -38,11 +38,13 @@ public abstract class AbstractInspectionBusinessServiceDataFlowListener extends
     protected void flushBusinessInspectionInfo(Map businessInspectionInfo, String statusCd) {
         businessInspectionInfo.put("newBId", businessInspectionInfo.get("b_id"));
         businessInspectionInfo.put("inspectionId", businessInspectionInfo.get("inspection_id"));
-        businessInspectionInfo.put("machineId", businessInspectionInfo.get("machine_id"));
         businessInspectionInfo.put("operate", businessInspectionInfo.get("operate"));
         businessInspectionInfo.put("remark", businessInspectionInfo.get("remark"));
         businessInspectionInfo.put("inspectionName", businessInspectionInfo.get("inspection_name"));
         businessInspectionInfo.put("communityId", businessInspectionInfo.get("community_id"));
+        businessInspectionInfo.put("pointObjType", businessInspectionInfo.get("point_obj_type"));
+        businessInspectionInfo.put("pointObjId", businessInspectionInfo.get("point_obj_id"));
+        businessInspectionInfo.put("pointObjName", businessInspectionInfo.get("point_obj_name"));
         businessInspectionInfo.remove("bId");
         businessInspectionInfo.put("statusCd", statusCd);
     }
@@ -65,12 +67,14 @@ public abstract class AbstractInspectionBusinessServiceDataFlowListener extends
         Map currentInspectionInfo = currentInspectionInfos.get(0);
         currentInspectionInfo.put("bId", business.getbId());
         currentInspectionInfo.put("inspectionId", currentInspectionInfo.get("inspection_id"));
-        currentInspectionInfo.put("machineId", currentInspectionInfo.get("machine_id"));
         currentInspectionInfo.put("operate", currentInspectionInfo.get("operate"));
         currentInspectionInfo.put("remark", currentInspectionInfo.get("remark"));
         currentInspectionInfo.put("inspectionName", currentInspectionInfo.get("inspection_name"));
         currentInspectionInfo.put("communityId", currentInspectionInfo.get("community_id"));
         currentInspectionInfo.put("operate", StatusConstant.OPERATE_DEL);
+        currentInspectionInfo.put("pointObjType", currentInspectionInfo.get("point_obj_type"));
+        currentInspectionInfo.put("pointObjId", currentInspectionInfo.get("point_obj_id"));
+        currentInspectionInfo.put("pointObjName", currentInspectionInfo.get("point_obj_name"));
         getInspectionServiceDaoImpl().saveBusinessInspectionInfo(currentInspectionInfo);
 
         for (Object key : currentInspectionInfo.keySet()) {