This commit is contained in:
2023-03-18 15:57:07 +08:00
5 changed files with 105 additions and 19 deletions

View File

@@ -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:

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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<String, String> stopChargingSendMsg(WechatSendMsgDTO dto) {
public Map<String, String> 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<String, Object> 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<String, Object> 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);
}
// 调用下面的发送消息接口

View File

@@ -786,12 +786,15 @@
<select id="selectOrderInfoByOrderCode" resultType="com.jsowell.pile.vo.uniapp.SendMessageVO">
SELECT
t1.order_code as orderCode,
t1.pile_sn as pileSn,
t1.connector_code as connectorCode,
t1.charge_start_time as chargeStartTime,
t1.charge_end_time as chargeStopTime,
t1.reason as stopReason,
t1.station_id as stationId,
t2.station_name as stationName,
t3.total_order_amount as orderAmount,
t3.total_used_electricity as chargingDegree,
t4.open_id as openId
FROM
order_basic_info t1