Bläddra i källkod

优化充电桩厂家

Your Name 3 år sedan
förälder
incheckning
af24b40f3b

+ 30 - 10
java110-bean/src/main/java/com/java110/dto/chargeMachineFactory/ChargeMachineFactoryDto.java

@@ -1,8 +1,11 @@
 package com.java110.dto.chargeMachineFactory;
 
 import com.java110.dto.PageDto;
+import com.java110.dto.chargeMachineFactorySpec.ChargeMachineFactorySpecDto;
+
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @ClassName FloorDto
@@ -15,38 +18,47 @@ import java.util.Date;
 public class ChargeMachineFactoryDto extends PageDto implements Serializable {
 
     private String factoryId;
-private String factoryName;
-private String remark;
-private String beanImpl;
+    private String factoryName;
+    private String remark;
+    private String beanImpl;
 
 
     private Date createTime;
 
     private String statusCd = "0";
 
+    private List<ChargeMachineFactorySpecDto> specs;
+
 
     public String getFactoryId() {
         return factoryId;
     }
-public void setFactoryId(String factoryId) {
+
+    public void setFactoryId(String factoryId) {
         this.factoryId = factoryId;
     }
-public String getFactoryName() {
+
+    public String getFactoryName() {
         return factoryName;
     }
-public void setFactoryName(String factoryName) {
+
+    public void setFactoryName(String factoryName) {
         this.factoryName = factoryName;
     }
-public String getRemark() {
+
+    public String getRemark() {
         return remark;
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
     }
-public String getBeanImpl() {
+
+    public String getBeanImpl() {
         return beanImpl;
     }
-public void setBeanImpl(String beanImpl) {
+
+    public void setBeanImpl(String beanImpl) {
         this.beanImpl = beanImpl;
     }
 
@@ -66,4 +78,12 @@ public void setBeanImpl(String beanImpl) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public List<ChargeMachineFactorySpecDto> getSpecs() {
+        return specs;
+    }
+
+    public void setSpecs(List<ChargeMachineFactorySpecDto> specs) {
+        this.specs = specs;
+    }
 }

+ 29 - 10
java110-bean/src/main/java/com/java110/dto/chargeMachineFactorySpec/ChargeMachineFactorySpecDto.java

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

+ 77 - 68
java110-db/src/main/resources/mapper/common/ChargeMachineFactorySpecV1ServiceDaoImplMapper.xml

@@ -5,93 +5,102 @@
 <mapper namespace="chargeMachineFactorySpecV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存充电桩厂家参数信息 add by wuxw 2018-07-03 -->
     <insert id="saveChargeMachineFactorySpecInfo" parameterType="Map">
         insert into charge_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>
 
 
-
     <!-- 查询充电桩厂家参数信息 add by wuxw 2018-07-03 -->
     <select id="getChargeMachineFactorySpecInfo" 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 charge_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 charge_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" 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>
 
 
-
-
     <!-- 修改充电桩厂家参数信息 add by wuxw 2018-07-03 -->
     <update id="updateChargeMachineFactorySpecInfo" parameterType="Map">
-        update  charge_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 charge_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="remark !=null and remark != ''">
+            , t.remark= #{remark}
+        </if>
+        where 1=1
+        <if test="specId !=null and specId != ''">
+            and t.spec_id= #{specId}
+        </if>
+        <if test="factoryId !=null and factoryId != ''">
+            and t.factory_id= #{factoryId}
+        </if>
 
     </update>
 
     <!-- 查询充电桩厂家参数数量 add by wuxw 2018-07-03 -->
-     <select id="queryChargeMachineFactorySpecsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from charge_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="queryChargeMachineFactorySpecsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from charge_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" 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>

+ 45 - 1
service-common/src/main/java/com/java110/common/cmd/chargeMachine/ListChargeMachineFactoryCmd.java

@@ -20,7 +20,12 @@ import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.chargeMachineFactorySpec.ChargeMachineFactorySpecDto;
+import com.java110.dto.meterMachineFactory.MeterMachineFactoryDto;
+import com.java110.dto.meterMachineFactorySpec.MeterMachineFactorySpecDto;
+import com.java110.intf.common.IChargeMachineFactorySpecV1InnerServiceSMO;
 import com.java110.intf.common.IChargeMachineFactoryV1InnerServiceSMO;
+import com.java110.intf.common.IChargeMachineSpecV1InnerServiceSMO;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
@@ -52,10 +57,12 @@ public class ListChargeMachineFactoryCmd extends Cmd {
     @Autowired
     private IChargeMachineFactoryV1InnerServiceSMO chargeMachineFactoryV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IChargeMachineFactorySpecV1InnerServiceSMO chargeMachineFactorySpecV1InnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         super.validatePageInfo(reqJson);
-        Assert.hasKeyAndValue(reqJson, "communityId", "查询小区ID");
     }
 
     @Override
@@ -69,6 +76,7 @@ public class ListChargeMachineFactoryCmd extends Cmd {
 
            if (count > 0) {
                chargeMachineFactoryDtos = chargeMachineFactoryV1InnerServiceSMOImpl.queryChargeMachineFactorys(chargeMachineFactoryDto);
+               freshSpecs(chargeMachineFactoryDtos);
            } else {
                chargeMachineFactoryDtos = new ArrayList<>();
            }
@@ -79,4 +87,40 @@ public class ListChargeMachineFactoryCmd extends Cmd {
 
            cmdDataFlowContext.setResponseEntity(responseEntity);
     }
+
+    /**
+     * 刷入配置
+     *
+     * @param chargeMachineFactoryDtos
+     */
+    private void freshSpecs(List<ChargeMachineFactoryDto> chargeMachineFactoryDtos) {
+
+        if (chargeMachineFactoryDtos == null || chargeMachineFactoryDtos.size() < 1) {
+            return;
+        }
+
+        List<String> factoryIds = new ArrayList<>();
+        for (ChargeMachineFactoryDto chargeMachineFactoryDto : chargeMachineFactoryDtos) {
+            factoryIds.add(chargeMachineFactoryDto.getFactoryId());
+        }
+
+        ChargeMachineFactorySpecDto chargeMachineFactorySpecDto = new ChargeMachineFactorySpecDto();
+        chargeMachineFactorySpecDto.setFactoryIds(factoryIds.toArray(new String[factoryIds.size()]));
+
+        List<ChargeMachineFactorySpecDto> machineFactorySpecDtos = chargeMachineFactorySpecV1InnerServiceSMOImpl.queryChargeMachineFactorySpecs(chargeMachineFactorySpecDto);
+
+        if (machineFactorySpecDtos == null || machineFactorySpecDtos.size() < 1) {
+            return;
+        }
+        List<ChargeMachineFactorySpecDto> specs = null;
+        for (ChargeMachineFactoryDto chargeMachineFactoryDto : chargeMachineFactoryDtos) {
+            specs = new ArrayList<>();
+            for (ChargeMachineFactorySpecDto tmpMeterMachineFactorySpecDto : machineFactorySpecDtos) {
+                if (chargeMachineFactoryDto.getFactoryId().equals(tmpMeterMachineFactorySpecDto.getFactoryId())) {
+                    specs.add(tmpMeterMachineFactorySpecDto);
+                }
+            }
+            chargeMachineFactoryDto.setSpecs(specs);
+        }
+    }
 }