Procházet zdrojové kódy

优化加入智能水电表厂家

Your Name před 3 roky
rodič
revize
08a80857c0

+ 30 - 10
java110-bean/src/main/java/com/java110/dto/meterMachineFactory/MeterMachineFactoryDto.java

@@ -1,8 +1,11 @@
 package com.java110.dto.meterMachineFactory;
 package com.java110.dto.meterMachineFactory;
 
 
 import com.java110.dto.PageDto;
 import com.java110.dto.PageDto;
+import com.java110.dto.meterMachineFactorySpec.MeterMachineFactorySpecDto;
+
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 /**
 /**
  * @ClassName FloorDto
  * @ClassName FloorDto
@@ -15,9 +18,11 @@ import java.util.Date;
 public class MeterMachineFactoryDto extends PageDto implements Serializable {
 public class MeterMachineFactoryDto extends PageDto implements Serializable {
 
 
     private String factoryId;
     private String factoryId;
-private String factoryName;
-private String remark;
-private String beanImpl;
+    private String factoryName;
+    private String remark;
+    private String beanImpl;
+
+    private List<MeterMachineFactorySpecDto> specs;
 
 
 
 
     private Date createTime;
     private Date createTime;
@@ -28,25 +33,32 @@ private String beanImpl;
     public String getFactoryId() {
     public String getFactoryId() {
         return factoryId;
         return factoryId;
     }
     }
-public void setFactoryId(String factoryId) {
+
+    public void setFactoryId(String factoryId) {
         this.factoryId = factoryId;
         this.factoryId = factoryId;
     }
     }
-public String getFactoryName() {
+
+    public String getFactoryName() {
         return factoryName;
         return factoryName;
     }
     }
-public void setFactoryName(String factoryName) {
+
+    public void setFactoryName(String factoryName) {
         this.factoryName = factoryName;
         this.factoryName = factoryName;
     }
     }
-public String getRemark() {
+
+    public String getRemark() {
         return remark;
         return remark;
     }
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
         this.remark = remark;
     }
     }
-public String getBeanImpl() {
+
+    public String getBeanImpl() {
         return beanImpl;
         return beanImpl;
     }
     }
-public void setBeanImpl(String beanImpl) {
+
+    public void setBeanImpl(String beanImpl) {
         this.beanImpl = beanImpl;
         this.beanImpl = beanImpl;
     }
     }
 
 
@@ -66,4 +78,12 @@ public void setBeanImpl(String beanImpl) {
     public void setStatusCd(String statusCd) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
         this.statusCd = statusCd;
     }
     }
+
+    public List<MeterMachineFactorySpecDto> getSpecs() {
+        return specs;
+    }
+
+    public void setSpecs(List<MeterMachineFactorySpecDto> specs) {
+        this.specs = specs;
+    }
 }
 }

+ 27 - 10
java110-bean/src/main/java/com/java110/dto/meterMachineFactorySpec/MeterMachineFactorySpecDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.meterMachineFactorySpec;
 package com.java110.dto.meterMachineFactorySpec;
 
 
 import com.java110.dto.PageDto;
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 
 
@@ -15,9 +16,10 @@ import java.util.Date;
 public class MeterMachineFactorySpecDto extends PageDto implements Serializable {
 public class MeterMachineFactorySpecDto extends PageDto implements Serializable {
 
 
     private String specId;
     private String specId;
-private String specName;
-private String factoryId;
-private String remark;
+    private String specName;
+    private String factoryId;
+    private String[] factoryIds;
+    private String remark;
 
 
 
 
     private Date createTime;
     private Date createTime;
@@ -28,25 +30,32 @@ private String remark;
     public String getSpecId() {
     public String getSpecId() {
         return specId;
         return specId;
     }
     }
-public void setSpecId(String specId) {
+
+    public void setSpecId(String specId) {
         this.specId = specId;
         this.specId = specId;
     }
     }
-public String getSpecName() {
+
+    public String getSpecName() {
         return specName;
         return specName;
     }
     }
-public void setSpecName(String specName) {
+
+    public void setSpecName(String specName) {
         this.specName = specName;
         this.specName = specName;
     }
     }
-public String getFactoryId() {
+
+    public String getFactoryId() {
         return factoryId;
         return factoryId;
     }
     }
-public void setFactoryId(String factoryId) {
+
+    public void setFactoryId(String factoryId) {
         this.factoryId = factoryId;
         this.factoryId = factoryId;
     }
     }
-public String getRemark() {
+
+    public String getRemark() {
         return remark;
         return remark;
     }
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
         this.remark = remark;
     }
     }
 
 
@@ -66,4 +75,12 @@ public void setRemark(String remark) {
     public void setStatusCd(String statusCd) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
         this.statusCd = statusCd;
     }
     }
+
+    public String[] getFactoryIds() {
+        return factoryIds;
+    }
+
+    public void setFactoryIds(String[] factoryIds) {
+        this.factoryIds = factoryIds;
+    }
 }
 }

+ 76 - 68
java110-db/src/main/resources/mapper/common/MeterMachineFactorySpecV1ServiceDaoImplMapper.xml

@@ -5,93 +5,101 @@
 <mapper namespace="meterMachineFactorySpecV1ServiceDaoImpl">
 <mapper namespace="meterMachineFactorySpecV1ServiceDaoImpl">
 
 
 
 
-
-
-
     <!-- 保存电表厂家参数信息 add by wuxw 2018-07-03 -->
     <!-- 保存电表厂家参数信息 add by wuxw 2018-07-03 -->
     <insert id="saveMeterMachineFactorySpecInfo" parameterType="Map">
     <insert id="saveMeterMachineFactorySpecInfo" parameterType="Map">
         insert into meter_machine_factory_spec(
         insert into meter_machine_factory_spec(
-spec_id,spec_name,factory_id,remark
-) values (
-#{specId},#{specName},#{factoryId},#{remark}
-)
+        spec_id,spec_name,factory_id,remark
+        ) values (
+        #{specId},#{specName},#{factoryId},#{remark}
+        )
     </insert>
     </insert>
 
 
 
 
-
     <!-- 查询电表厂家参数信息 add by wuxw 2018-07-03 -->
     <!-- 查询电表厂家参数信息 add by wuxw 2018-07-03 -->
     <select id="getMeterMachineFactorySpecInfo" parameterType="Map" resultType="Map">
     <select id="getMeterMachineFactorySpecInfo" parameterType="Map" resultType="Map">
-        select  t.spec_id,t.spec_id specId,t.spec_name,t.spec_name specName,t.factory_id,t.factory_id factoryId,t.status_cd,t.status_cd statusCd,t.remark 
-from meter_machine_factory_spec t 
-where 1 =1 
-<if test="specId !=null and specId != ''">
-   and t.spec_id= #{specId}
-</if> 
-<if test="specName !=null and specName != ''">
-   and t.spec_name= #{specName}
-</if> 
-<if test="factoryId !=null and factoryId != ''">
-   and t.factory_id= #{factoryId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.spec_id,t.spec_id specId,t.spec_name,t.spec_name specName,t.factory_id,t.factory_id
+        factoryId,t.status_cd,t.status_cd statusCd,t.remark
+        from meter_machine_factory_spec t
+        where 1 =1
+        <if test="specId !=null and specId != ''">
+            and t.spec_id= #{specId}
+        </if>
+        <if test="specName !=null and specName != ''">
+            and t.spec_name= #{specName}
+        </if>
+        <if test="factoryId !=null and factoryId != ''">
+            and t.factory_id= #{factoryId}
+        </if>
+        <if test="factoryIds !=null">
+            and t.factory_id in
+            <foreach collection="factoryIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
 
     </select>
     </select>
 
 
 
 
-
-
     <!-- 修改电表厂家参数信息 add by wuxw 2018-07-03 -->
     <!-- 修改电表厂家参数信息 add by wuxw 2018-07-03 -->
     <update id="updateMeterMachineFactorySpecInfo" parameterType="Map">
     <update id="updateMeterMachineFactorySpecInfo" parameterType="Map">
-        update  meter_machine_factory_spec t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="specName !=null and specName != ''">
-, t.spec_name= #{specName}
-</if> 
-<if test="factoryId !=null and factoryId != ''">
-, t.factory_id= #{factoryId}
-</if> 
-<if test="remark !=null and remark != ''">
-, t.remark= #{remark}
-</if> 
- where 1=1 <if test="specId !=null and specId != ''">
-and t.spec_id= #{specId}
-</if> 
+        update meter_machine_factory_spec t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="specName !=null and specName != ''">
+            , t.spec_name= #{specName}
+        </if>
+        <if test="factoryId !=null and factoryId != ''">
+            , t.factory_id= #{factoryId}
+        </if>
+        <if test="remark !=null and remark != ''">
+            , t.remark= #{remark}
+        </if>
+        where 1=1
+        <if test="specId !=null and specId != ''">
+            and t.spec_id= #{specId}
+        </if>
 
 
     </update>
     </update>
 
 
     <!-- 查询电表厂家参数数量 add by wuxw 2018-07-03 -->
     <!-- 查询电表厂家参数数量 add by wuxw 2018-07-03 -->
-     <select id="queryMeterMachineFactorySpecsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from meter_machine_factory_spec t 
-where 1 =1 
-<if test="specId !=null and specId != ''">
-   and t.spec_id= #{specId}
-</if> 
-<if test="specName !=null and specName != ''">
-   and t.spec_name= #{specName}
-</if> 
-<if test="factoryId !=null and factoryId != ''">
-   and t.factory_id= #{factoryId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
+    <select id="queryMeterMachineFactorySpecsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from meter_machine_factory_spec t
+        where 1 =1
+        <if test="specId !=null and specId != ''">
+            and t.spec_id= #{specId}
+        </if>
+        <if test="specName !=null and specName != ''">
+            and t.spec_name= #{specName}
+        </if>
+        <if test="factoryId !=null and factoryId != ''">
+            and t.factory_id= #{factoryId}
+        </if>
+        <if test="factoryIds !=null">
+            and t.factory_id in
+            <foreach collection="factoryIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
 
 
 
 
-     </select>
+    </select>
 
 
 </mapper>
 </mapper>

+ 42 - 0
service-common/src/main/java/com/java110/common/cmd/meterMachine/ListMeterMachineFactoryCmd.java

@@ -20,6 +20,8 @@ import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.meterMachineFactorySpec.MeterMachineFactorySpecDto;
+import com.java110.intf.common.IMeterMachineFactorySpecV1InnerServiceSMO;
 import com.java110.intf.common.IMeterMachineFactoryV1InnerServiceSMO;
 import com.java110.intf.common.IMeterMachineFactoryV1InnerServiceSMO;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.BeanConvertUtil;
@@ -53,6 +55,9 @@ public class ListMeterMachineFactoryCmd extends Cmd {
     @Autowired
     @Autowired
     private IMeterMachineFactoryV1InnerServiceSMO meterMachineFactoryV1InnerServiceSMOImpl;
     private IMeterMachineFactoryV1InnerServiceSMO meterMachineFactoryV1InnerServiceSMOImpl;
 
 
+    @Autowired
+    private IMeterMachineFactorySpecV1InnerServiceSMO machineFactorySpecV1InnerServiceSMOImpl;
+
     @Override
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         super.validatePageInfo(reqJson);
         super.validatePageInfo(reqJson);
@@ -69,6 +74,7 @@ public class ListMeterMachineFactoryCmd extends Cmd {
 
 
         if (count > 0) {
         if (count > 0) {
             meterMachineFactoryDtos = meterMachineFactoryV1InnerServiceSMOImpl.queryMeterMachineFactorys(meterMachineFactoryDto);
             meterMachineFactoryDtos = meterMachineFactoryV1InnerServiceSMOImpl.queryMeterMachineFactorys(meterMachineFactoryDto);
+            freshSpecs(meterMachineFactoryDtos);
         } else {
         } else {
             meterMachineFactoryDtos = new ArrayList<>();
             meterMachineFactoryDtos = new ArrayList<>();
         }
         }
@@ -79,4 +85,40 @@ public class ListMeterMachineFactoryCmd extends Cmd {
 
 
         cmdDataFlowContext.setResponseEntity(responseEntity);
         cmdDataFlowContext.setResponseEntity(responseEntity);
     }
     }
+
+    /**
+     * 刷入配置
+     *
+     * @param meterMachineFactoryDtos
+     */
+    private void freshSpecs(List<MeterMachineFactoryDto> meterMachineFactoryDtos) {
+
+        if (meterMachineFactoryDtos == null || meterMachineFactoryDtos.size() < 1) {
+            return;
+        }
+
+        List<String> factoryIds = new ArrayList<>();
+        for (MeterMachineFactoryDto meterMachineFactoryDto : meterMachineFactoryDtos) {
+            factoryIds.add(meterMachineFactoryDto.getFactoryId());
+        }
+
+        MeterMachineFactorySpecDto machineFactorySpecDto = new MeterMachineFactorySpecDto();
+        machineFactorySpecDto.setFactoryIds(factoryIds.toArray(new String[factoryIds.size()]));
+
+        List<MeterMachineFactorySpecDto> machineFactorySpecDtos = machineFactorySpecV1InnerServiceSMOImpl.queryMeterMachineFactorySpecs(machineFactorySpecDto);
+
+        if (machineFactorySpecDtos == null || machineFactorySpecDtos.size() < 1) {
+            return;
+        }
+        List<MeterMachineFactorySpecDto> specs = null;
+        for (MeterMachineFactoryDto meterMachineFactoryDto : meterMachineFactoryDtos) {
+            specs = new ArrayList<>();
+            for (MeterMachineFactorySpecDto tmpMeterMachineFactorySpecDto : machineFactorySpecDtos) {
+                if (meterMachineFactoryDto.getFactoryId().equals(tmpMeterMachineFactorySpecDto.getFactoryId())) {
+                    specs.add(tmpMeterMachineFactorySpecDto);
+                }
+            }
+            meterMachineFactoryDto.setSpecs(specs);
+        }
+    }
 }
 }