Explorar o código

Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

Your Name %!s(int64=3) %!d(string=hai) anos
pai
achega
c3b05fbfb1

+ 10 - 0
java110-bean/src/main/java/com/java110/dto/chargeMachine/ChargeMachineDto.java

@@ -33,6 +33,8 @@ public class ChargeMachineDto extends PageDto implements Serializable {
 
     private String factoryName;
 
+    private String qrCode;
+
 
     public String getHeartbeatTime() {
         return heartbeatTime;
@@ -130,4 +132,12 @@ public class ChargeMachineDto extends PageDto implements Serializable {
     public void setFactoryName(String factoryName) {
         this.factoryName = factoryName;
     }
+
+    public String getQrCode() {
+        return qrCode;
+    }
+
+    public void setQrCode(String qrCode) {
+        this.qrCode = qrCode;
+    }
 }

+ 1 - 1
java110-db/src/main/resources/mapper/common/ChargeMachineOrderAcctV1ServiceDaoImplMapper.xml

@@ -19,7 +19,7 @@
     <select id="getChargeMachineOrderAcctInfo" parameterType="Map" resultType="Map">
         select t.amount,t.cmoa_id,t.cmoa_id cmoaId,t.order_id,t.order_id orderId,t.acct_detail_id,t.acct_detail_id
         acctDetailId,t.acct_id,t.acct_id acctId,t.start_time,t.start_time startTime,t.remark,t.status_cd,t.status_cd
-        statusCd,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.energy
+        statusCd,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.energy,t.create_time createTime
         from charge_machine_order_acct t
         where 1 =1
         <if test="amount !=null and amount != ''">

+ 7 - 2
java110-db/src/main/resources/mapper/common/ChargeMachineOrderV1ServiceDaoImplMapper.xml

@@ -17,17 +17,18 @@
 
     <!-- 查询充电桩订单信息 add by wuxw 2018-07-03 -->
     <select id="getChargeMachineOrderInfo" parameterType="Map" resultType="Map">
-        select t.amount,t.order_id,t.order_id orderId,t.remark,t.status_cd,t.status_cd statusCd,t.port_id,t.port_id
+        select t.order_id,t.order_id orderId,t.remark,t.port_id,t.port_id
         portId,t.person_name,t.person_name personName,t.machine_id,t.machine_id
         machineId,t.acct_detail_id,t.acct_detail_id acctDetailId,t.person_id,t.person_id
         personId,t.charge_hours,t.charge_hours chargeHours,t.start_time,t.start_time startTime,t.end_time,t.end_time
         endTime,t.state,t.person_tel,t.person_tel personTel,t.community_id,t.community_id communityId,t.energy,
         cm.machine_name machineName,cm.machine_code machineCode,cm.duration_price durationPrice,
-        cmp.port_code portCode,cmp.port_name portName,td.`name` stateName
+        cmp.port_code portCode,cmp.port_name portName,td.`name` stateName,SUM(cmoa.amount) amount
         from charge_machine_order t
         left join charge_machine cm on t.machine_id = cm.machine_id and cm.status_cd = '0'
         left join charge_machine_port cmp on t.port_id = cmp.port_id and cmp.status_cd = '0'
         left join t_dict td on td.status_cd = t.state and td.table_name = 'charge_machine_order' and td.table_columns = 'state'
+        left join charge_machine_order_acct cmoa on t.order_id = cmoa.order_id and cmoa.status_cd = '0'
         where 1 =1
         <if test="amount !=null and amount != ''">
             and t.amount= #{amount}
@@ -77,6 +78,10 @@
         <if test="energy !=null and energy != ''">
             and t.energy= #{energy}
         </if>
+        GROUP BY t.order_id,t.remark,t.port_id,t.person_name,t.machine_id,t.acct_detail_id,t.person_id,
+        t.charge_hours,t.start_time,t.end_time,t.state,t.person_tel,t.community_id,t.energy,
+        cm.machine_name ,cm.machine_code ,cm.duration_price ,
+        cmp.port_code ,cmp.port_name ,td.`name`
         order by t.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}

+ 37 - 0
service-common/src/main/java/com/java110/common/cmd/chargeMachine/ListChargeMachineCmd.java

@@ -22,8 +22,11 @@ import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.intf.common.IChargeMachineV1InnerServiceSMO;
+import com.java110.intf.store.ISmallWeChatInnerServiceSMO;
 import com.java110.po.chargeMachine.ChargeMachinePo;
+import com.java110.utils.cache.UrlCache;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
@@ -57,6 +60,9 @@ public class ListChargeMachineCmd extends Cmd {
     @Autowired
     private IChargeMachineV1InnerServiceSMO chargeMachineV1InnerServiceSMOImpl;
 
+    @Autowired
+    private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         super.validatePageInfo(reqJson);
@@ -74,6 +80,7 @@ public class ListChargeMachineCmd extends Cmd {
 
         if (count > 0) {
             chargeMachineDtos = chargeMachineV1InnerServiceSMOImpl.queryChargeMachines(chargeMachineDto);
+            freshQrCodeUrl(chargeMachineDtos);
         } else {
             chargeMachineDtos = new ArrayList<>();
         }
@@ -84,4 +91,34 @@ public class ListChargeMachineCmd extends Cmd {
 
         cmdDataFlowContext.setResponseEntity(responseEntity);
     }
+
+    /**
+     * 充电桩二维码
+     *
+     * @param chargeMachineDtos
+     */
+    private void freshQrCodeUrl(List<ChargeMachineDto> chargeMachineDtos) {
+
+        if (chargeMachineDtos == null || chargeMachineDtos.size() < 1) {
+            return;
+        }
+
+        SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
+        smallWeChatDto.setObjId(chargeMachineDtos.get(0).getCommunityId());
+        smallWeChatDto.setWeChatType(SmallWeChatDto.WECHAT_TYPE_PUBLIC);
+        List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
+        String appId = "";
+        if (smallWeChatDtos != null || smallWeChatDtos.size() > 0) {
+            appId = smallWeChatDtos.get(0).getAppId();
+        }
+        String ownerUrl = UrlCache.getOwnerUrl();
+
+        for (ChargeMachineDto chargeMachineDto : chargeMachineDtos) {
+            chargeMachineDto.setQrCode(ownerUrl + "/#/pages/machine/machineToCharge?machineId="
+                    + chargeMachineDto.getMachineId()
+                    + "&communityId=" + chargeMachineDto.getCommunityId()
+                    + "&wAppId=" + appId
+            );
+        }
+    }
 }