diff --git a/jsowell-admin/src/main/resources/application.yml b/jsowell-admin/src/main/resources/application.yml index 209b2d56e..d8319098b 100644 --- a/jsowell-admin/src/main/resources/application.yml +++ b/jsowell-admin/src/main/resources/application.yml @@ -106,8 +106,8 @@ weixin: appsecret: bbac689f4654b209de4d6944808ec80b redirectUrl: http://www.kuangstudy.com/login/api/wx/callback sendMsg: - startChargingTmpId: BGgZe98QHr0I1S1GrtGps5_rLX6n9cW1AsXhL4YkHHc - stopChargingTmpId: UyBPbADlZfsCj89rh_xvfZGlxTW5J5KURpZtt9CNFrY + startChargingTmpId: BGgZe98QHr0I1S1GrtGps0y3uhvURtQNkbMAzI2D8g8 + stopChargingTmpId: UyBPbADlZfsCj89rh_xvfR2ZP1iwtmPcMFA0sUOJwog #Sim卡信息 xunzhong: diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/SendMessageVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/SendMessageVO.java index 9a7a8a6a0..66bda7c93 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/SendMessageVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/SendMessageVO.java @@ -16,40 +16,60 @@ public class SendMessageVO { /** * 订单号 */ - public String orderCode; + private String orderCode; /** * 站点名称 */ - public String stationName; + private String stationName; /** * 充电开始时间 */ - public String chargeStartTime; + private String chargeStartTime; /** * 站点Id */ - public String stationId; + private String stationId; /** * 订单金额 */ - public String orderAmount; + private String orderAmount; /** * 用户openId */ - public String openId; + private String openId; /** * 充电结束时间 */ - public String chargeStopTime; + private String chargeStopTime; /** * 充电停止原因 */ - public String stopReason; + private String stopReason; + + /** + * 枪口号 + */ + private String pileConnectorCode; + + /** + * 桩编码 + */ + private String pileSn; + + /** + * 枪口号 + */ + private String connectorCode; + + /** + * 充电度数 + */ + private String chargingDegree; } diff --git a/jsowell-pile/src/main/java/com/jsowell/wxpay/dto/AppletTemplateMessageSendDTO.java b/jsowell-pile/src/main/java/com/jsowell/wxpay/dto/AppletTemplateMessageSendDTO.java index 570d2043f..06589b1d9 100644 --- a/jsowell-pile/src/main/java/com/jsowell/wxpay/dto/AppletTemplateMessageSendDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/wxpay/dto/AppletTemplateMessageSendDTO.java @@ -45,6 +45,24 @@ public class AppletTemplateMessageSendDTO implements Serializable { */ private String startTime; + /** + * 订单编号 + * character_string11 + */ + private String orderCode; + + /** + * 收费标准(每度单价) + * thing13 + */ + private String totalPrice; + + /** + * 枪口编号 + * thing7 + */ + private String pileConnectorCode; + } @Data @@ -66,5 +84,20 @@ public class AppletTemplateMessageSendDTO implements Serializable { * thing7 */ private String endReason; + + /** + * 订单编号 + */ + private String orderCode; + + /** + * 充电度数 + */ + private String chargingDegree; + + /** + * 充电时长 + */ + private String chargingTime; } } diff --git a/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java b/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java index f69aa56a2..c27cd82e8 100644 --- a/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java +++ b/jsowell-pile/src/main/java/com/jsowell/wxpay/service/WxAppletRemoteService.java @@ -13,6 +13,8 @@ import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.http.HttpUtils; import com.jsowell.pile.service.IOrderBasicInfoService; +import com.jsowell.pile.service.IPileBillingTemplateService; +import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails; import com.jsowell.pile.vo.uniapp.SendMessageVO; import com.jsowell.wxpay.config.WeixinLoginProperties; import com.jsowell.wxpay.dto.AppletTemplateMessageSendDTO; @@ -24,6 +26,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.io.IOException; +import java.text.ParseException; +import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -45,6 +49,9 @@ public class WxAppletRemoteService { @Autowired private IOrderBasicInfoService orderBasicInfoService; + @Autowired + private IPileBillingTemplateService pileBillingTemplateService; + @Value("${weixin.login.appid}") private String appid; @@ -197,6 +204,15 @@ public class WxAppletRemoteService { startChargingMessage.setStartTime(sendMessageVO.getChargeStartTime()); // 开始时间 } startChargingMessage.setStationName(sendMessageVO.getStationName()); // 站点名称 + + // 订单编号 + startChargingMessage.setOrderCode(sendMessageVO.getOrderCode()); + // 收费标准 + CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(sendMessageVO.getStationId()); + startChargingMessage.setTotalPrice(currentTimePriceDetails.getTotalPrice() + " 元/度"); + // 枪口编号 + startChargingMessage.setPileConnectorCode(sendMessageVO.getPileSn() + "桩" + sendMessageVO.getConnectorCode() + "枪口"); + return uniAppSendMsg(msgInfo); } @@ -206,7 +222,7 @@ public class WxAppletRemoteService { * @param dto * @return */ - public Map stopChargingSendMsg(WechatSendMsgDTO dto) { + public Map stopChargingSendMsg(WechatSendMsgDTO dto) throws ParseException { // 通过订单号查询订单金额 AppletTemplateMessageSendDTO msgInfo = new AppletTemplateMessageSendDTO(); SendMessageVO sendMessageVO = orderBasicInfoService.selectOrderInfoByOrderCode(dto.getOrderCode()); @@ -217,13 +233,21 @@ public class WxAppletRemoteService { AppletTemplateMessageSendDTO.StopChargingMessage stopChargingMessage = new AppletTemplateMessageSendDTO.StopChargingMessage(); msgInfo.setStopChargingMessage(stopChargingMessage); - stopChargingMessage.setChargingAmount(sendMessageVO.getOrderAmount()); - stopChargingMessage.setEndReason(sendMessageVO.getStopReason()); - if (StringUtils.isBlank(sendMessageVO.getChargeStopTime())) { - stopChargingMessage.setEndTime(DateUtils.dateTimeNow("yyyy-MM-dd HH:mm")); - }else { - stopChargingMessage.setEndTime(sendMessageVO.getChargeStopTime()); - } + stopChargingMessage.setChargingAmount(sendMessageVO.getOrderAmount()); // 订单金额 + stopChargingMessage.setEndReason(sendMessageVO.getStopReason()); // 结束原因 + stopChargingMessage.setOrderCode(sendMessageVO.getOrderCode()); // 订单号 + stopChargingMessage.setChargingDegree(sendMessageVO.getChargingDegree()); // 充电度数 + Date chargeStartTime = DateUtils.parseDate(sendMessageVO.getChargeStartTime(), DateUtils.YYYY_MM_DD_HH_MM_SS); + Date chargeStopTime = DateUtils.parseDate(sendMessageVO.getChargeStopTime(), DateUtils.YYYY_MM_DD_HH_MM_SS); + String chargingTime = DateUtils.getDatePoor(chargeStopTime, chargeStartTime); + + stopChargingMessage.setChargingTime(chargingTime); // 充电时长 + + // if (StringUtils.isBlank(sendMessageVO.getChargeStopTime())) { + // stopChargingMessage.setEndTime(DateUtils.dateTimeNow("yyyy-MM-dd HH:mm")); + // }else { + // stopChargingMessage.setEndTime(sendMessageVO.getChargeStopTime()); + // } return uniAppSendMsg(msgInfo); } @@ -244,6 +268,9 @@ public class WxAppletRemoteService { Map map = new HashMap<>(); map.put("thing5", ImmutableMap.of("value", dto.getStartChargingMessage().getStationName())); // 充电站名称 map.put("time2", ImmutableMap.of("value", dto.getStartChargingMessage().getStartTime())); // 开始时间 + map.put("character_string11", ImmutableMap.of("value", dto.getStartChargingMessage().getOrderCode())); // 订单编号 + map.put("thing7", ImmutableMap.of("value", dto.getStartChargingMessage().getPileConnectorCode())); // 充电插座 + map.put("thing13", ImmutableMap.of("value", dto.getStartChargingMessage().getTotalPrice())); // 收费标准 dto.setData(map); } else if (StringUtils.equals("2", type)) { // 结束充电 @@ -251,9 +278,12 @@ public class WxAppletRemoteService { dto.setTemplate_id(templateId); // dto.setPage("跳转的页面"); Map map = new HashMap<>(); + map.put("character_string5", ImmutableMap.of("value", dto.getStopChargingMessage().getOrderCode())); // 充电金额 map.put("amount17", ImmutableMap.of("value", dto.getStopChargingMessage().getChargingAmount())); // 充电金额 - map.put("time3", ImmutableMap.of("value", dto.getStopChargingMessage().getEndTime())); // 结束时间 + // map.put("time3", ImmutableMap.of("value", dto.getStopChargingMessage().getEndTime())); // 结束时间 map.put("thing7", ImmutableMap.of("value", dto.getStopChargingMessage().getEndReason())); // 结束原因 + map.put("thing22", ImmutableMap.of("value", dto.getStopChargingMessage().getChargingTime())); // 充电时长 + map.put("number13", ImmutableMap.of("value", dto.getStopChargingMessage().getChargingDegree())); // 充电度数 dto.setData(map); } // 调用下面的发送消息接口 diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index 9f4f0ccd8..92ecf97bc 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -786,12 +786,15 @@