mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 19:45:09 +08:00
update 预约充电记录
This commit is contained in:
@@ -2,6 +2,7 @@ package com.jsowell.pile.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.jsowell.pile.domain.PileMemberRelation;
|
||||
import com.jsowell.pile.vo.uniapp.customer.MemberVO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
@@ -71,4 +72,6 @@ public interface PileMemberRelationMapper
|
||||
|
||||
|
||||
int deleteRelationByIds(List<Integer> ids);
|
||||
|
||||
List<MemberVO> selectMemberList(String pileSn);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.pile.domain.PileMemberRelation;
|
||||
import com.jsowell.pile.vo.uniapp.customer.MemberVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -78,4 +79,5 @@ public interface PileMemberRelationService
|
||||
*/
|
||||
List<PileMemberRelation> selectPileMemberRelationByPileSn(String pileSn);
|
||||
|
||||
List<MemberVO> selectMemberList(String pileSn);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ public interface PileReservationInfoService {
|
||||
|
||||
List<PileReservationInfo> getReservationsByMemberIdAndPileSn(String memberId, String pileSn);
|
||||
|
||||
PileReservationInfo selectByPileConnectorCode(String pileConnectorCode);
|
||||
|
||||
/**
|
||||
* 启动预约
|
||||
* @param dto
|
||||
|
||||
@@ -14,10 +14,7 @@ import com.jsowell.common.enums.lianlian.LianLianPileStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.*;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileConnectorInfo;
|
||||
import com.jsowell.pile.domain.PileModelInfo;
|
||||
import com.jsowell.pile.domain.PileSimInfo;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.mapper.PileBasicInfoMapper;
|
||||
import com.jsowell.pile.service.*;
|
||||
@@ -28,9 +25,11 @@ import com.jsowell.pile.thirdparty.EquipmentInfo;
|
||||
import com.jsowell.pile.thirdparty.ZDLConnectorInfo;
|
||||
import com.jsowell.pile.thirdparty.ZDLEquipmentInfo;
|
||||
import com.jsowell.pile.util.UserUtils;
|
||||
import com.jsowell.pile.vo.PileReservationInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.GroundLockInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.MemberVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PersonalPileInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PileConnectorDetailVO;
|
||||
import com.jsowell.pile.vo.web.*;
|
||||
@@ -44,6 +43,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -93,6 +94,9 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileMemberRelationService pileMemberRelationService;
|
||||
|
||||
/**
|
||||
* 查询设备管理
|
||||
*
|
||||
@@ -1226,7 +1230,20 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
// 创建订单
|
||||
orderBasicInfoService.createReservationOrder(chargingStartupResult);
|
||||
|
||||
// 小程序通知
|
||||
wxAppletRemoteService.reservationStartupResultSendMsg(chargingStartupResult);
|
||||
// 查预约信息
|
||||
String pileConnectorCode = chargingStartupResult.getPileSn() + chargingStartupResult.getConnectorCode();
|
||||
PileReservationInfo pileReservationInfo = pileReservationInfoService.selectByPileConnectorCode(pileConnectorCode);
|
||||
|
||||
LocalDateTime[] localDateTimes = DateUtils.convertStartAndEndTime(pileReservationInfo.getStartTime().toString(), pileReservationInfo.getEndTime().toString());
|
||||
// 发小程序通知消息
|
||||
String startTime = DateUtils.formatDateTime(localDateTimes[0]);
|
||||
String endTime = DateUtils.formatDateTime(localDateTimes[1]);
|
||||
String startUpResult = chargingStartupResult.getStartupResult();
|
||||
String failReason = chargingStartupResult.getFailReason();
|
||||
// 根据pileSn 查询使用者列表
|
||||
List<MemberVO> memberVOS = pileMemberRelationService.selectMemberList(chargingStartupResult.getPileSn());
|
||||
for (MemberVO memberVO : memberVOS) {
|
||||
wxAppletRemoteService.reservationStartupResultSendMsg(memberVO.getOpenId(), startTime, endTime, startUpResult, failReason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.jsowell.pile.domain.PileMemberRelation;
|
||||
import com.jsowell.pile.mapper.PileMemberRelationMapper;
|
||||
import com.jsowell.pile.service.PileConnectorInfoService;
|
||||
import com.jsowell.pile.service.PileMemberRelationService;
|
||||
import com.jsowell.pile.vo.uniapp.customer.MemberVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -118,4 +119,8 @@ public class PileMemberRelationServiceImpl implements PileMemberRelationService
|
||||
return selectPileMemberRelationList(pileMemberRelation);
|
||||
}
|
||||
|
||||
public List<MemberVO> selectMemberList(String pileSn) {
|
||||
return pileMemberRelationMapper.selectMemberList(pileSn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.Date;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
@@ -127,6 +126,7 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
return pileReservationInfoMapper.findByMemberIdAndPileSn(memberId, pileSn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileReservationInfo selectByPileConnectorCode(String pileConnectorCode) {
|
||||
return pileReservationInfoMapper.selectByPileConnectorCode(pileConnectorCode);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ public class MemberVO {
|
||||
*/
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 微信openId
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 会员所属一级运营商
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,8 @@ public class AppletTemplateMessageSendDTO implements Serializable {
|
||||
|
||||
private StopChargingMessage stopChargingMessage;
|
||||
|
||||
private StartUpResultMessage startUpResultMessage;
|
||||
|
||||
@Data
|
||||
public static class StartChargingMessage {
|
||||
|
||||
@@ -100,4 +102,33 @@ public class AppletTemplateMessageSendDTO implements Serializable {
|
||||
*/
|
||||
private String chargingTime;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class StartUpResultMessage {
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
* time2
|
||||
*/
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 预计结束时间
|
||||
* time3
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 启动结果
|
||||
* phrase20
|
||||
*/
|
||||
private String startUpResult;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
* thing21
|
||||
*/
|
||||
private String failReason;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public class WxAppletRemoteService {
|
||||
// 枪口编号
|
||||
startChargingMessage.setPileConnectorCode(sendMessageVO.getPileSn() + "桩" + sendMessageVO.getConnectorCode() + "枪口");
|
||||
|
||||
return uniAppSendMsg(msgInfo);
|
||||
return uniAppSendMsg(msgInfo); // 开始充电
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,23 +269,25 @@ public class WxAppletRemoteService {
|
||||
Date chargeStopTime = DateUtils.parseDate(sendMessageVO.getChargeStopTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
|
||||
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);
|
||||
return uniAppSendMsg(msgInfo); // 停止充电
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约充电结果小程序服务通知
|
||||
*/
|
||||
public Map<String, String> reservationStartupResultSendMsg(ReservationChargingStartupResult chargingStartupResult) {
|
||||
public Map<String, String> reservationStartupResultSendMsg(String openId, String startTime, String endTime, String startUpResult, String failReason) {
|
||||
AppletTemplateMessageSendDTO msgInfo = new AppletTemplateMessageSendDTO();
|
||||
return uniAppSendMsg(msgInfo);
|
||||
msgInfo.setType("2"); // 2-结束充电推送消息
|
||||
msgInfo.setTouser(openId);
|
||||
// 封装对象并调用发送消息的方法
|
||||
AppletTemplateMessageSendDTO.StartUpResultMessage startUpResultMessage = new AppletTemplateMessageSendDTO.StartUpResultMessage();
|
||||
startUpResultMessage.setStartTime(startTime);
|
||||
startUpResultMessage.setEndTime(endTime);
|
||||
startUpResultMessage.setStartUpResult(startUpResult);
|
||||
startUpResultMessage.setFailReason(failReason);
|
||||
msgInfo.setStartUpResultMessage(startUpResultMessage);
|
||||
return uniAppSendMsg(msgInfo); // 预约充电结果
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,7 +303,6 @@ public class WxAppletRemoteService {
|
||||
// 开始充电
|
||||
String templateId = startChargingTmpId;
|
||||
dto.setTemplate_id(templateId);
|
||||
// dto.setPage("跳转的页面");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("thing5", ImmutableMap.of("value", dto.getStartChargingMessage().getStationName())); // 充电站名称
|
||||
map.put("time2", ImmutableMap.of("value", dto.getStartChargingMessage().getStartTime())); // 开始时间
|
||||
@@ -313,15 +314,23 @@ public class WxAppletRemoteService {
|
||||
// 结束充电
|
||||
String templateId = stopChargingTmpId;
|
||||
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("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);
|
||||
} else if (StringUtils.equals("3", type)) {
|
||||
// 结束充电
|
||||
String templateId = stopChargingTmpId;
|
||||
dto.setTemplate_id(templateId);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("time2", ImmutableMap.of("value", dto.getStartUpResultMessage().getStartTime())); // 开始时间
|
||||
map.put("time3", ImmutableMap.of("value", dto.getStartUpResultMessage().getEndTime())); // 结束时间
|
||||
map.put("phrase20", ImmutableMap.of("value", dto.getStartUpResultMessage().getStartUpResult())); // 启动结果
|
||||
map.put("thing21", ImmutableMap.of("value", dto.getStartUpResultMessage().getFailReason())); // 失败原因
|
||||
|
||||
}
|
||||
// 调用下面的发送消息接口
|
||||
return uniformMessageSend(dto);
|
||||
|
||||
Reference in New Issue
Block a user