修改占位费和增加报文解析
This commit is contained in:
parent
f5b70781bd
commit
bb085e8d7a
@ -0,0 +1,15 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* 占位费规则查询
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-06-20 15:18
|
||||
*/
|
||||
public class QeryPlaceholderRequest {
|
||||
|
||||
@JsonProperty("StationIDs")
|
||||
String[] stationIds;
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.xhpc.evcs.api;
|
||||
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Calendar;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
/**
|
||||
* 占位费查询
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-06-20 15:15
|
||||
*/
|
||||
public class QueryPlaceholderRules {
|
||||
|
||||
/**
|
||||
* 用于平台之间认证Token的申请
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/query_placeholder_rules")
|
||||
public CommonResponse qeryPlaceholderRules(@RequestBody CommonRequest<QeryPlaceholderRequest> commonRequest) throws IOException {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
|
||||
QeryPlaceholderRequest request = JSONUtil.readParams(commonRequest.getData(), QeryPlaceholderRequest.class);
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
if (request == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
}else{
|
||||
//获取占位规则信息
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@ -97,7 +97,7 @@
|
||||
<select id="selectUserList" parameterType="com.xhpc.system.api.domain.SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
|
||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader,
|
||||
d.super_type,u.tenant_id,ten.tenant_name tenant_name
|
||||
u.super_type,u.tenant_id,ten.tenant_name tenant_name
|
||||
from
|
||||
sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
|
||||
@ -63,28 +63,28 @@ public class XhpcActivityInternetServiceImpl implements XhpcActivityInternetServ
|
||||
map.put("endTime",xhpcActivityFormulaDomain.getEndTime());
|
||||
mapList.add(map);
|
||||
}
|
||||
String[] split = s.split(",");
|
||||
for (int i = 0; i <split.length ; i++) {
|
||||
Long chargingStationId = Long.valueOf(split[i]);
|
||||
List<Map<String, Object>> xhpcRateTimes = internetMapper.getXhpcRateTimes(chargingStationId);
|
||||
if(mapList.size() ==xhpcRateTimes.size()){
|
||||
for (Map map:mapList) {
|
||||
boolean flag = false;
|
||||
for (Map rateMap:xhpcRateTimes) {
|
||||
if(rateMap.get("startTime").toString().equals(map.get("startTime").toString()) && rateMap.get("endTime").toString().equals(map.get("endTime").toString())){
|
||||
flag =true;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
String chargingStation = internetMapper.getChargingStation(chargingStationId);
|
||||
return R.fail("与"+chargingStation+"场站时间段端不一致");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String chargingStation = internetMapper.getChargingStation(chargingStationId);
|
||||
return R.fail("与"+chargingStation+"场站时间段端不一致");
|
||||
}
|
||||
}
|
||||
// String[] split = s.split(",");
|
||||
// for (int i = 0; i <split.length ; i++) {
|
||||
// Long chargingStationId = Long.valueOf(split[i]);
|
||||
// List<Map<String, Object>> xhpcRateTimes = internetMapper.getXhpcRateTimes(chargingStationId);
|
||||
// if(mapList.size() ==xhpcRateTimes.size()){
|
||||
// for (Map map:mapList) {
|
||||
// boolean flag = false;
|
||||
// for (Map rateMap:xhpcRateTimes) {
|
||||
// if(rateMap.get("startTime").toString().equals(map.get("startTime").toString()) && rateMap.get("endTime").toString().equals(map.get("endTime").toString())){
|
||||
// flag =true;
|
||||
// }
|
||||
// }
|
||||
// if(!flag){
|
||||
// String chargingStation = internetMapper.getChargingStation(chargingStationId);
|
||||
// return R.fail("与"+chargingStation+"场站时间段不一致");
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// String chargingStation = internetMapper.getChargingStation(chargingStationId);
|
||||
// return R.fail("与"+chargingStation+"场站时间段不一致");
|
||||
// }
|
||||
// }
|
||||
|
||||
domain.setStationList(AreaCodeUtil.removeAreaCode(domain.getStationList()));
|
||||
internetMapper.insert(domain);
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
package com.xhpc.card.controller;
|
||||
|
||||
import com.xhpc.card.service.IAnalyzeTheMessageService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-06-23 15:38
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/analyze")
|
||||
@Api(value = "解析报文", tags = "解析报文")
|
||||
public class AnalyzeTheMessage extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IAnalyzeTheMessageService analyzeTheMessageService;
|
||||
|
||||
|
||||
@PostMapping("/content")
|
||||
public R content(@RequestBody Map<String,Object> map){
|
||||
String content = map.get("content").toString();
|
||||
if(content.length()<12){
|
||||
return R.fail("请输入正确的报文");
|
||||
}
|
||||
|
||||
String sb = content.substring(10, 12);
|
||||
switch (sb){
|
||||
case "01":
|
||||
return analyzeTheMessageService.getRegisterLogic(content);
|
||||
case "02":
|
||||
return analyzeTheMessageService.getReplyRegisterLogic(content);
|
||||
case "03":
|
||||
return analyzeTheMessageService.getHBLogic(content);
|
||||
case "04":
|
||||
return analyzeTheMessageService.getReplyHBLogic(content);
|
||||
case "05":
|
||||
return analyzeTheMessageService.getRateModelValidateLogic(content);
|
||||
case "06":
|
||||
return analyzeTheMessageService.getReplyRateModelValidateLogic(content);
|
||||
case "09":
|
||||
return analyzeTheMessageService.getRateModelRequestLogic(content);
|
||||
case "0A":
|
||||
return analyzeTheMessageService.getReplyRateModelRequestLogic(content);
|
||||
|
||||
|
||||
|
||||
default:
|
||||
return R.fail("请输入正确的报文");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String st="6822445E00018083600001000100020C382E352D31330000000000000000000000000000C0C5";
|
||||
|
||||
System.out.println(st.substring(10,12));
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.xhpc.card.service;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-06-23 15:47
|
||||
*/
|
||||
public interface IAnalyzeTheMessageService {
|
||||
|
||||
//充电桩登录认证
|
||||
R getRegisterLogic(String content);
|
||||
|
||||
R getReplyRegisterLogic(String content);
|
||||
|
||||
R getHBLogic(String content);
|
||||
|
||||
R getReplyHBLogic(String content);
|
||||
|
||||
R getRateModelValidateLogic(String content);
|
||||
|
||||
R getReplyRateModelValidateLogic(String content);
|
||||
|
||||
R getRateModelRequestLogic(String content);
|
||||
|
||||
R getReplyRateModelRequestLogic(String content);
|
||||
}
|
||||
@ -0,0 +1,343 @@
|
||||
package com.xhpc.card.service.impl;
|
||||
|
||||
import com.xhpc.card.service.IAnalyzeTheMessageService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.pp.utils.HexUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.xhpc.pp.utils.HexUtils.toBytes;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-06-23 15:48
|
||||
*/
|
||||
@Service
|
||||
public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
|
||||
|
||||
|
||||
@Override
|
||||
public R getRegisterLogic(String content) {
|
||||
|
||||
Map<String,Object> jiexi =new HashMap<>();
|
||||
|
||||
jiexi.put("name","充电桩登录认证(0x01)");
|
||||
jiexi.put("content",content);
|
||||
jiexi.put("response","通信中断后上电复位");
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
int idxStart = 12;
|
||||
Map<String,Object> map =new LinkedHashMap<>();
|
||||
map.put("title","桩编码");
|
||||
map.put("content",content.substring(12,26));
|
||||
list.add(map);
|
||||
|
||||
idxStart = idxStart+14;
|
||||
int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
|
||||
Map<String,Object> map1 =new LinkedHashMap<>();
|
||||
if(bmsVoltageRequest==0){
|
||||
map1.put("title","桩类型");
|
||||
map1.put("content","直流桩");
|
||||
list.add(map1);
|
||||
}else{
|
||||
map1.put("title","桩类型");
|
||||
map1.put("content","交流桩");
|
||||
list.add(map1);
|
||||
}
|
||||
|
||||
idxStart = idxStart+2;
|
||||
int number = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
|
||||
Map<String,Object> map2 =new LinkedHashMap<>();
|
||||
map2.put("title","充电枪数量");
|
||||
map2.put("content",number);
|
||||
list.add(map2);
|
||||
|
||||
idxStart = idxStart+2;
|
||||
int version = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
|
||||
Map<String,Object> map3 =new LinkedHashMap<>();
|
||||
map3.put("title","通讯协议版本");
|
||||
map3.put("content",version/10);
|
||||
list.add(map3);
|
||||
|
||||
idxStart = idxStart+2;
|
||||
Map<String,Object> map4 =new LinkedHashMap<>();
|
||||
map4.put("title","程序版本");
|
||||
map4.put("content",new String(toBytes(content.substring(32, 48))));
|
||||
list.add(map4);
|
||||
|
||||
idxStart = idxStart+16;
|
||||
int svcSrv = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
|
||||
Map<String,Object> map5 =new LinkedHashMap<>();
|
||||
if(svcSrv==0){
|
||||
map5.put("title","网络链接类型");
|
||||
map5.put("content","SIM 卡");
|
||||
list.add(map5);
|
||||
}else if(svcSrv==1){
|
||||
map5.put("title","网络链接类型");
|
||||
map5.put("content","LAN");
|
||||
list.add(map5);
|
||||
}else if(svcSrv==2){
|
||||
map5.put("title","网络链接类型");
|
||||
map5.put("content","WAN");
|
||||
list.add(map5);
|
||||
}else{
|
||||
map5.put("title","网络链接类型");
|
||||
map5.put("content","其 他");
|
||||
list.add(map5);
|
||||
}
|
||||
idxStart = idxStart+2;
|
||||
Map<String,Object> map6 =new LinkedHashMap<>();
|
||||
map6.put("title","Sim 卡");
|
||||
map6.put("content",content.substring(idxStart,20+idxStart));
|
||||
list.add(map6);
|
||||
|
||||
idxStart = idxStart+20;
|
||||
int operator = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
|
||||
Map<String,Object> map7 =new LinkedHashMap<>();
|
||||
if(operator==0){
|
||||
map7.put("title","运营商");
|
||||
map7.put("content","移动");
|
||||
list.add(map7);
|
||||
}else if(svcSrv==2){
|
||||
map7.put("title","运营商");
|
||||
map7.put("content","电信");
|
||||
list.add(map7);
|
||||
}else if(svcSrv==3){
|
||||
map7.put("title","运营商");
|
||||
map7.put("content","联通");
|
||||
list.add(map7);
|
||||
}else{
|
||||
map7.put("title","运营商");
|
||||
map7.put("content","其 他");
|
||||
list.add(map7);
|
||||
}
|
||||
jiexi.put("analysis",list);
|
||||
return R.ok(jiexi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getReplyRegisterLogic(String content) {
|
||||
|
||||
Map<String,Object> jiexi =new HashMap<>();
|
||||
|
||||
jiexi.put("name","充电桩登录认证应答(0x02)");
|
||||
jiexi.put("content",content);
|
||||
jiexi.put("response","应答发送");
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
int idxStart = 12;
|
||||
Map<String,Object> map =new LinkedHashMap<>();
|
||||
map.put("title","桩编码");
|
||||
map.put("content",content.substring(12,26));
|
||||
list.add(map);
|
||||
|
||||
idxStart = idxStart+14;
|
||||
int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
|
||||
Map<String,Object> map1 =new LinkedHashMap<>();
|
||||
if(bmsVoltageRequest==0){
|
||||
map1.put("title","登录结果");
|
||||
map1.put("content","登录成功");
|
||||
list.add(map1);
|
||||
}else{
|
||||
map1.put("title","登录结果");
|
||||
map1.put("content","登录失败");
|
||||
list.add(map1);
|
||||
}
|
||||
jiexi.put("analysis",list);
|
||||
return R.ok(jiexi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getHBLogic(String content) {
|
||||
Map<String,Object> jiexi =new HashMap<>();
|
||||
|
||||
jiexi.put("name","充电桩心跳包(0x03)");
|
||||
jiexi.put("content",content);
|
||||
jiexi.put("response","60 秒周期上送");
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
int idxStart = 12;
|
||||
Map<String,Object> map =new LinkedHashMap<>();
|
||||
map.put("title","桩编码");
|
||||
map.put("content",content.substring(12,26));
|
||||
list.add(map);
|
||||
|
||||
idxStart = idxStart+14;
|
||||
|
||||
Map<String,Object> map1 =new LinkedHashMap<>();
|
||||
map1.put("title","抢号");
|
||||
map1.put("content",content.substring(28,30));
|
||||
list.add(map1);
|
||||
|
||||
idxStart = idxStart+2;
|
||||
|
||||
int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
|
||||
Map<String,Object> map2 =new LinkedHashMap<>();
|
||||
if(bmsVoltageRequest==0){
|
||||
map2.put("title","枪状态");
|
||||
map2.put("content","正常");
|
||||
list.add(map2);
|
||||
}else{
|
||||
map2.put("title","枪状态");
|
||||
map2.put("content","故障");
|
||||
list.add(map2);
|
||||
}
|
||||
jiexi.put("analysis",list);
|
||||
return R.ok(jiexi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getReplyHBLogic(String content) {
|
||||
Map<String,Object> jiexi =new HashMap<>();
|
||||
|
||||
jiexi.put("name","充电桩心跳包应答(0x04)");
|
||||
jiexi.put("content",content);
|
||||
jiexi.put("response","应答发送");
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
int idxStart = 12;
|
||||
Map<String,Object> map =new LinkedHashMap<>();
|
||||
map.put("title","桩编码");
|
||||
map.put("content",content.substring(12,26));
|
||||
list.add(map);
|
||||
|
||||
idxStart = idxStart+14;
|
||||
Map<String,Object> map1 =new LinkedHashMap<>();
|
||||
map1.put("title","抢号");
|
||||
map1.put("content",content.substring(28,30));
|
||||
list.add(map1);
|
||||
|
||||
idxStart = idxStart+2;
|
||||
|
||||
int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
|
||||
Map<String,Object> map2 =new LinkedHashMap<>();
|
||||
map2.put("title","心跳应答");
|
||||
map2.put("content",bmsVoltageRequest);
|
||||
list.add(map2);
|
||||
|
||||
jiexi.put("analysis",list);
|
||||
return R.ok(jiexi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getRateModelValidateLogic(String content) {
|
||||
Map<String,Object> jiexi =new HashMap<>();
|
||||
|
||||
jiexi.put("name","计费模型验证请求(0x05)");
|
||||
jiexi.put("content",content);
|
||||
jiexi.put("response","主动请求,直到成功");
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
int idxStart = 12;
|
||||
Map<String,Object> map =new LinkedHashMap<>();
|
||||
map.put("title","桩编码");
|
||||
map.put("content",content.substring(12,26));
|
||||
list.add(map);
|
||||
|
||||
idxStart = idxStart+14;
|
||||
|
||||
int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map2 =new LinkedHashMap<>();
|
||||
map2.put("title","计费模型编号");
|
||||
map2.put("content",bmsVoltageRequest);
|
||||
list.add(map2);
|
||||
|
||||
jiexi.put("analysis",list);
|
||||
return R.ok(jiexi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getReplyRateModelValidateLogic(String content) {
|
||||
Map<String,Object> jiexi =new HashMap<>();
|
||||
|
||||
jiexi.put("name","计费模型验证请求应答(0x06)");
|
||||
jiexi.put("content",content);
|
||||
jiexi.put("response","应答发送");
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
int idxStart = 12;
|
||||
Map<String,Object> map =new LinkedHashMap<>();
|
||||
map.put("title","桩编码");
|
||||
map.put("content",content.substring(12,26));
|
||||
list.add(map);
|
||||
|
||||
idxStart = idxStart+14;
|
||||
|
||||
int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map1 =new LinkedHashMap<>();
|
||||
map1.put("title","计费模型编号");
|
||||
map1.put("content",bmsVoltageRequest);
|
||||
list.add(map1);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int result = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
|
||||
Map<String,Object> map2 =new LinkedHashMap<>();
|
||||
if(result==0){
|
||||
map2.put("title","验证结果");
|
||||
map2.put("content","桩计费模型与平台一致");
|
||||
list.add(map2);
|
||||
}else{
|
||||
map2.put("title","验证结果");
|
||||
map2.put("content","桩计费模型与平台不一致");
|
||||
list.add(map2);
|
||||
}
|
||||
jiexi.put("analysis",list);
|
||||
return R.ok(jiexi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getRateModelRequestLogic(String content) {
|
||||
Map<String,Object> jiexi =new HashMap<>();
|
||||
|
||||
jiexi.put("name","充电桩计费模型请求(0x09)");
|
||||
jiexi.put("content",content);
|
||||
jiexi.put("response","主动请求,直到成功");
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
int idxStart = 12;
|
||||
Map<String,Object> map =new LinkedHashMap<>();
|
||||
map.put("title","桩编码");
|
||||
map.put("content",content.substring(12,26));
|
||||
list.add(map);
|
||||
|
||||
jiexi.put("analysis",list);
|
||||
return R.ok(jiexi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getReplyRateModelRequestLogic(String content) {
|
||||
Map<String,Object> jiexi =new HashMap<>();
|
||||
|
||||
jiexi.put("name","充电桩计费模型请求应答(0x0A)");
|
||||
jiexi.put("content",content);
|
||||
jiexi.put("response","应答发送");
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
int idxStart = 12;
|
||||
Map<String,Object> map =new LinkedHashMap<>();
|
||||
map.put("title","桩编码");
|
||||
map.put("content",content.substring(12,26));
|
||||
list.add(map);
|
||||
|
||||
idxStart = idxStart+14;
|
||||
|
||||
int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map1 =new LinkedHashMap<>();
|
||||
map1.put("title","计费模型编号");
|
||||
map1.put("content",bmsVoltageRequest);
|
||||
list.add(map1);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int t1= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
|
||||
|
||||
|
||||
Map<String,Object> map2 =new LinkedHashMap<>();
|
||||
if(t1==0){
|
||||
map2.put("title","验证结果");
|
||||
map2.put("content","桩计费模型与平台一致");
|
||||
list.add(map2);
|
||||
}else{
|
||||
map2.put("title","验证结果");
|
||||
map2.put("content","桩计费模型与平台不一致");
|
||||
list.add(map2);
|
||||
}
|
||||
jiexi.put("analysis",list);
|
||||
return R.ok(jiexi);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -112,4 +112,13 @@ public interface PileOrderService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 桩订单实时订单BMS回调接口
|
||||
* @param gunNumber 订单号
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/placeholderOrder/getxhpcPlaceholderOrderTime")
|
||||
R getXhpcPlaceholderOrderTime(@RequestParam(value = "gunNumber") String gunNumber);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -89,6 +89,11 @@ public class PileOrderFallbackFactory implements FallbackFactory<PileOrderServic
|
||||
public R cycStartUp(Long userId, String serialNumber, Integer type, Integer source, BigDecimal money, String phone, String PlateNum) {
|
||||
return R.fail("川逸充启动充电失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getXhpcPlaceholderOrderTime(String gunNumber) {
|
||||
return R.fail("枪状态发送改变失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ public class ConnectionRabbitMQUtil {
|
||||
//定义连接工厂
|
||||
ConnectionFactory factory = new ConnectionFactory();
|
||||
//设置服务地址
|
||||
factory.setHost("47.109.133.116");
|
||||
factory.setHost("120.26.46.180");
|
||||
//端口
|
||||
factory.setPort(5672);
|
||||
//设置账号信息,用户名、密码、vhost
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package com.xhpc.evcs.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电站占位规则信息
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-06-20 15:26
|
||||
*/
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class PlaceholderRules {
|
||||
@JsonProperty("StationID")
|
||||
String stationID;
|
||||
@JsonProperty("EffectStartTime")
|
||||
String effectStartTime;
|
||||
@JsonProperty("EffectEndTime")
|
||||
String effectEndTime;
|
||||
@JsonProperty("Status")
|
||||
Integer status;
|
||||
@JsonProperty("FreeTime")
|
||||
Integer freeTime;
|
||||
@JsonProperty("MaxFee")
|
||||
Integer maxFee;
|
||||
@JsonProperty("PriceInfos")
|
||||
List<PriceInfo> priceInfos;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xhpc.evcs.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 占位费用规则
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-06-20 15:29
|
||||
*/
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class PriceInfo {
|
||||
@JsonProperty("StartTime")
|
||||
String startTime;
|
||||
@JsonProperty("Price")
|
||||
Double price;
|
||||
|
||||
}
|
||||
@ -47,6 +47,8 @@ public class XhpcPlaceholderOrder extends BaseEntity {
|
||||
private String chargingMode;
|
||||
private String driverId;
|
||||
private String plateNum;
|
||||
private Integer type;
|
||||
|
||||
public XhpcPlaceholderOrder() {
|
||||
|
||||
}
|
||||
|
||||
@ -41,7 +41,9 @@ public class BMSCurrentParser {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
BMSCurrentParser bmsCurrentParser = new BMSCurrentParser();
|
||||
System.out.println(bmsCurrentParser.parseBmsCurrent("FD07",-400));
|
||||
System.out.println(bmsCurrentParser.parseBmsCurrent("4A09",-400));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public class XhpcPlaceholderOrderController extends BaseController {
|
||||
Long personnelId,
|
||||
Integer confirmResult) throws IOException {
|
||||
|
||||
xhpcPlaceholderOrderService.export(response,tenantId,chargingStationId,chargingPileId,terminalId, phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult);
|
||||
xhpcPlaceholderOrderService.export(response,tenantId,chargingStationId,chargingPileId,terminalId, phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, 1,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult);
|
||||
}
|
||||
|
||||
|
||||
@ -85,11 +85,9 @@ public class XhpcPlaceholderOrderController extends BaseController {
|
||||
return xhpcPlaceholderOrderService.getById(placeholderOrderId);
|
||||
}
|
||||
|
||||
//定时任务,查询状态
|
||||
//@Scheduled(cron = "0/30 * * * * ? ")
|
||||
public void getxhpcPlaceholderOrderTime() {
|
||||
xhpcPlaceholderOrderService.getTimingPriceTime();
|
||||
@GetMapping("/getxhpcPlaceholderOrderTime")
|
||||
public void getxhpcPlaceholderOrderTime(@RequestParam(value = "gunNumber")String gunNumber) {
|
||||
xhpcPlaceholderOrderService.getTimingPriceTime(gunNumber);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -32,4 +32,7 @@ public interface XhpcPlaceholderOrderMapper {
|
||||
|
||||
List<Map<String,Object>> getXhpcPlaceholderTimeOrder(@Param("placeholderOrderId")Long placeholderOrderId);
|
||||
|
||||
|
||||
List<XhpcPlaceholderTime> getxhpcPlaceholderOrderTasks();
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/**
|
||||
* 消费者
|
||||
* @author yuyang
|
||||
* @date 2021/8/7 16:45
|
||||
*/
|
||||
|
||||
@ -6,7 +6,8 @@ import com.xhpc.common.util.ConnectionRabbitMQUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
/**
|
||||
/**+
|
||||
* 生产者
|
||||
* @author yuyang
|
||||
* @date 2021/8/7 16:37
|
||||
*/
|
||||
|
||||
@ -16,11 +16,14 @@ public interface IXhpcPlaceholderOrderService {
|
||||
|
||||
int insertXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder );
|
||||
|
||||
void getTimingPriceTime();
|
||||
void getTimingPriceTime(String gunNumber);
|
||||
|
||||
List<Map<String,Object>> getListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult);
|
||||
|
||||
void export(HttpServletResponse response, String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult) throws IOException;
|
||||
|
||||
R getById(Long placeholderOrderId);
|
||||
|
||||
void getxhpcPlaceholderOrderTasks();
|
||||
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@ import com.xhpc.order.domain.XhpcRealTimeOrder;
|
||||
import com.xhpc.order.mapper.XhpcChargeOrderMapper;
|
||||
import com.xhpc.order.mapper.XhpcInternetUserMapper;
|
||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||
import com.xhpc.order.service.IXhpcPlaceholderOrderService;
|
||||
import com.xhpc.order.service.IXhpcRealTimeOrderService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.slf4j.Logger;
|
||||
@ -45,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
@ -81,6 +83,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
private UserTypeService userTypeService;
|
||||
@Autowired
|
||||
private IXhpcRealTimeOrderService xhpcRealTimeOrderService;
|
||||
@Resource
|
||||
private IXhpcPlaceholderOrderService xhpcPlaceholderOrderService;
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(40);
|
||||
|
||||
@ -425,6 +429,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
try{
|
||||
xhpcChargeOrder.setRateModelId(Long.valueOf(r1.getData().toString()));
|
||||
xhpcChargeOrderMapper.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
//占位订单
|
||||
xhpcPlaceholderOrderService.getTimingPriceTime(terminalSerialNumber);
|
||||
//插一帧实时数据
|
||||
extracted(xhpcChargeOrder);
|
||||
}catch (Exception e){
|
||||
@ -791,6 +797,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
Long rateModelId = Long.valueOf(r1.getData().toString());
|
||||
xhpcChargeOrder.setRateModelId(rateModelId);
|
||||
xhpcChargeOrderMapper.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
//占位订单
|
||||
xhpcPlaceholderOrderService.getTimingPriceTime(connectorId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("update order[{}] failed.", orderNo);
|
||||
@ -916,8 +924,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
}
|
||||
}
|
||||
BigDecimal a = new BigDecimal(5);
|
||||
if (userMessage == null || userMessage.get("balance") == null || a.compareTo(new BigDecimal(userMessage.get(
|
||||
"balance").toString())) == 1) {
|
||||
if (userMessage == null || userMessage.get("balance") == null || a.compareTo(new BigDecimal(userMessage.get("balance").toString())) == 1) {
|
||||
return R.fail(1100, "金额小于5元,不能充电,请充值后再进行充电");
|
||||
}
|
||||
//充电用户是否存在异常的订单
|
||||
@ -1039,6 +1046,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
}
|
||||
}
|
||||
map.put("soc",number);
|
||||
//占位订单
|
||||
xhpcPlaceholderOrderService.getTimingPriceTime(serialNumber);
|
||||
return R.ok(map);
|
||||
}catch (Exception e){
|
||||
//数据回滚
|
||||
@ -1261,6 +1270,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
xhpcChargeOrderMapper.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
//插一帧实时数据
|
||||
extracted(xhpcChargeOrder);
|
||||
xhpcPlaceholderOrderService.getTimingPriceTime(serialNumber);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
logger.error("update order[{}] failed.", orderNo);
|
||||
@ -1659,6 +1669,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
//川逸充订单号,防止推送状态
|
||||
cacheMap1.put("cycOrder",xhpcChargeOrder.getInternetSerialNumber());
|
||||
REDIS.setCacheMap(gun, cacheMap1);
|
||||
|
||||
xhpcPlaceholderOrderService.getTimingPriceTime(serialNumber);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("update order[{}] failed.", orderNo);
|
||||
@ -1898,6 +1910,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
xhpcChargeOrderMapper.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
//插一帧实时数据
|
||||
extracted(xhpcChargeOrder);
|
||||
xhpcPlaceholderOrderService.getTimingPriceTime(terminalSerialNumber);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
logger.error("update order[{}] failed.", orderNo);
|
||||
|
||||
@ -54,25 +54,21 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTimingPriceTime() {
|
||||
String gunkey = "placeholderOrder:*";
|
||||
Collection<String> orderKeys = REDIS.keys(gunkey);
|
||||
for (String okey : orderKeys) {
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap(okey);
|
||||
if (cacheGun != null) {
|
||||
try {
|
||||
if ("1".equals(cacheGun.get("status").toString())) {
|
||||
//占位费订单结束且删除缓存
|
||||
String serialNumber = cacheGun.get("serialNumber").toString();
|
||||
//查询订单
|
||||
XhpcPlaceholderOrder xhpcPlaceholderOrder = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderSerialNumber(serialNumber);
|
||||
|
||||
if (xhpcPlaceholderOrder.getConfirmResult() == -2 || xhpcPlaceholderOrder.getConfirmResult() == -1) {
|
||||
public void getTimingPriceTime(String gunNumber) {
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap("gun:"+gunNumber);
|
||||
if (cacheGun != null) {
|
||||
try {
|
||||
if (cacheGun.get("previousOrder") !=null && !"".equals(cacheGun.get("previousOrder").toString())) {
|
||||
String serialNumber = cacheGun.get("previousOrder").toString();
|
||||
//查询订单
|
||||
XhpcPlaceholderOrder xhpcPlaceholderOrder = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderSerialNumber(serialNumber);
|
||||
if(xhpcPlaceholderOrder !=null){
|
||||
if (xhpcPlaceholderOrder.getType() == 0 ) {
|
||||
//删除占位费时间段收费表
|
||||
xhpcPlaceholderOrderMapper.deleteByPlaceholderOrderIdInt(xhpcPlaceholderOrder.getPlaceholderOrderId());
|
||||
//结算订单,查询该时间段价格
|
||||
DateTime endTime = DateUtil.parse(cacheGun.get("endTime").toString());
|
||||
DateTime startTime = DateUtil.parse(cacheGun.get("startTime").toString());
|
||||
DateTime startTime = DateUtil.parse(DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss");
|
||||
DateTime endTime = DateUtil.parse(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
String start = DateUtil.formatTime(startTime);
|
||||
String end = DateUtil.formatTime(endTime);
|
||||
@ -274,7 +270,6 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
|
||||
|
||||
if (freeTime - i1 > 0) {
|
||||
freeTime = freeTime - i1;
|
||||
;
|
||||
i1 = 0;
|
||||
} else {
|
||||
i1 = i1 - freeTime;
|
||||
@ -301,6 +296,7 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
|
||||
} else {
|
||||
xhpcPlaceholderOrder.setOvertimePrice(new BigDecimal("0.0"));
|
||||
}
|
||||
|
||||
String orderKey = "notificationPlaceholderOrderInfo:" + xhpcPlaceholderOrder.getSerialNumber();
|
||||
Map<String, Object> cacheOrder = new HashMap<>();
|
||||
cacheOrder.put("OvertimeBillCode", xhpcPlaceholderOrder.getPlaceholderOrderNumber());
|
||||
@ -308,31 +304,29 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
|
||||
cacheOrder.put("OvertimeBillStatus", 3);
|
||||
cacheOrder.put("ConnectorId", xhpcPlaceholderOrder.getTerminalNumber());
|
||||
cacheOrder.put("BillEquipment", 1);
|
||||
cacheOrder.put("StartTime", cacheGun.get("startTime").toString());
|
||||
cacheOrder.put("EndTime", cacheGun.get("endTime").toString());
|
||||
cacheOrder.put("StartTime", DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
cacheOrder.put("EndTime", DateUtil.format(xhpcPlaceholderOrder.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
cacheOrder.put("TotalTimeSpan", xhpcPlaceholderOrder.getTotalTimeSpan());
|
||||
cacheOrder.put("OvertimePrice", xhpcPlaceholderOrder.getOvertimePrice());
|
||||
cacheOrder.put("TotalMoney", xhpcPlaceholderOrder.getTotalMoney());
|
||||
|
||||
Map<String, Object> overtimeDetails = new HashMap<>();
|
||||
overtimeDetails.put("DetailStartTime", cacheGun.get("startTime").toString());
|
||||
overtimeDetails.put("DetailEndTime", cacheGun.get("endTime").toString());
|
||||
overtimeDetails.put("DetailStartTime", DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
overtimeDetails.put("DetailEndTime", DateUtil.format(xhpcPlaceholderOrder.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
overtimeDetails.put("DetailMoney", xhpcPlaceholderOrder.getTotalMoney());
|
||||
overtimeDetails.put("OvertimePrice", xhpcPlaceholderOrder.getOvertimePrice());
|
||||
cacheOrder.put("OvertimeDetails", overtimeDetails);
|
||||
REDIS.setCacheMap(orderKey, cacheOrder);
|
||||
xhpcPlaceholderOrder.setType(1);
|
||||
|
||||
Map<String, Object> cacheGunYu =new HashMap<>();
|
||||
//cacheGunYu.put("previousOrder","");
|
||||
REDIS.setCacheMap(gunNumber, cacheGun);
|
||||
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
|
||||
REDIS.deleteObject(okey);
|
||||
} else if (xhpcPlaceholderOrder.getConfirmResult() == 0) {
|
||||
REDIS.deleteObject(okey);
|
||||
} else if (xhpcPlaceholderOrder.getConfirmResult() == 1) {
|
||||
REDIS.deleteObject(okey);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
@ -477,5 +471,12 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getxhpcPlaceholderOrderTasks() {
|
||||
//定时任务相同桩号,前一个订单已结束,本次订单响应结束
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1604,7 +1604,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
}
|
||||
//查询该场站是否有占位费
|
||||
Map<String, Object> xhpcPlaceholderMap = xhpcRealTimeOrderMapper.getXhpcPlaceholder(xhpcHistoryOrder.getChargingStationId());
|
||||
|
||||
System.out.println("===============生成占位费订单=============================");
|
||||
if(xhpcPlaceholderMap !=null){
|
||||
//占位订单生成
|
||||
XhpcPlaceholderOrder placeholderOrder = new XhpcPlaceholderOrder();
|
||||
@ -1636,6 +1636,11 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
placeholderOrder.setPlateNum(xhpcChargeOrder.getPlateNum());
|
||||
placeholderOrderService.insertXhpcPlaceholderOrder(placeholderOrder);
|
||||
logger.info("<<<<<<<<<<<<<<getPlaceholderOrderId>>>>>>>>>>>>>>>>"+placeholderOrder.getPlaceholderOrderId());
|
||||
|
||||
String gunkey ="gun:"+xhpcHistoryOrder.getSerialNumber().substring(0,16);
|
||||
Map<String, Object> cacheGun =new HashMap<>();
|
||||
cacheGun.put("previousOrder",xhpcHistoryOrder.getSerialNumber());
|
||||
REDIS.setCacheMap(gunkey, cacheGun);
|
||||
// String gunkey = "placeholderOrder:"+substring+":"+xhpcHistoryOrder.getSerialNumber();
|
||||
// Map<String, Object> cacheGun =new HashMap<>();
|
||||
// cacheGun.put("source",xhpcHistoryOrder.getSource());
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.xhpc.order.tasks;
|
||||
|
||||
import com.xhpc.order.service.IXhpcPlaceholderOrderService;
|
||||
import com.xhpc.order.service.IXhpcRealTimeOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -22,6 +24,9 @@ public class ScheduledTasks {
|
||||
|
||||
@Resource
|
||||
IXhpcRealTimeOrderService xhpcRealTimeOrderService;
|
||||
@Resource
|
||||
IXhpcPlaceholderOrderService xhpcPlaceholderOrderService;
|
||||
|
||||
|
||||
//实时电流定时任务,每天下午2点,清除一个月半之前的数据
|
||||
@GetMapping("/orderCurrent")
|
||||
@ -63,4 +68,12 @@ public class ScheduledTasks {
|
||||
public void realTimeOrderBms(){
|
||||
xhpcRealTimeOrderService.realTimeOrderBms();
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务相同桩号,前一个订单已结束,本次订单响应结束
|
||||
*/
|
||||
@Scheduled(cron = "0 0/10 * * * ? ")
|
||||
public void getxhpcPlaceholderOrderTasks() {
|
||||
xhpcPlaceholderOrderService.getxhpcPlaceholderOrderTasks();
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
<result column="charging_mode" property="chargingMode"/>
|
||||
<result column="driver_id" property="driverId"/>
|
||||
<result column="plate_num" property="plateNum"/>
|
||||
<result column="type" property="type"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
@ -291,6 +292,9 @@
|
||||
<if test="totalMoney != null">
|
||||
total_money = #{totalMoney},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type},
|
||||
</if>
|
||||
</set>
|
||||
where placeholder_order_id = #{placeholderOrderId}
|
||||
</update>
|
||||
@ -365,6 +369,9 @@
|
||||
left join xhpc_community_personnel as cop on cop.community_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=2
|
||||
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=3
|
||||
where ho.del_flag=0
|
||||
<if test="type !=null">
|
||||
and ho.type =#{type}
|
||||
</if>
|
||||
<if test="chargingStationId !=null">
|
||||
and ho.charging_station_id=#{chargingStationId}
|
||||
</if>
|
||||
@ -447,9 +454,9 @@
|
||||
<if test="tenantId !=null and '' !=tenantId">
|
||||
and ho.tenant_id=#{tenantId}
|
||||
</if>
|
||||
<if test="isNotNull==1">
|
||||
and ho.total_price >=0
|
||||
</if>
|
||||
<!-- <if test="isNotNull==1">-->
|
||||
<!-- and ho.total_price >=0-->
|
||||
<!-- </if>-->
|
||||
order by ho.create_time desc
|
||||
</select>
|
||||
|
||||
@ -513,17 +520,17 @@
|
||||
when ho.charging_mode="App" then "App"
|
||||
when ho.charging_mode="刷卡" then "刷卡"
|
||||
else "vin码"
|
||||
end chargingModeName
|
||||
end chargingModeName
|
||||
from xhpc_placeholder_order ho
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
||||
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
|
||||
left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null and ho.source=1
|
||||
left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null and ho.source=0
|
||||
left join xhpc_community_personnel as cop on cop.community_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=2
|
||||
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=3
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
||||
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
|
||||
left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null and ho.source=1
|
||||
left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null and ho.source=0
|
||||
left join xhpc_community_personnel as cop on cop.community_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=2
|
||||
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=3
|
||||
where ho.placeholder_order_id=#{placeholderOrderId}
|
||||
</select>
|
||||
|
||||
@ -629,4 +636,14 @@
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="getxhpcPlaceholderOrderTasks" resultMap="xhpcPlaceholderOrderMap">
|
||||
select
|
||||
start_time as startTime,
|
||||
replace(end_time, '00:00:00', '23:59:59') as endTime,
|
||||
price as price
|
||||
from xhpc_placeholder_order
|
||||
where type =0
|
||||
order by create_time asc limit 100
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -241,7 +241,7 @@ public class BmsReqChargerOutputDataLogic implements ServiceLogic {
|
||||
// System.out.println("===================subtract========================="+subtract);
|
||||
|
||||
|
||||
String bmsData = "800C"; // 从BMS获取的实际数据
|
||||
String bmsData = "4A09"; // 从BMS获取的实际数据
|
||||
double current = BMSCurrentParser.parseBmsCurrent(bmsData,400);
|
||||
System.out.println("BMS电流需求: " + current + " A");
|
||||
|
||||
|
||||
@ -134,18 +134,6 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
cacheGun.put("orderkey","order:"+orderNo);
|
||||
final String orderstarttime = DateUtil.format(Calendar.getInstance().getTime(), NORM_DATETIME_FORMAT);
|
||||
cacheGun.put("pileStartTime", orderstarttime);
|
||||
|
||||
// String key = "placeholderOrder:"+terminalId+":*";
|
||||
// Collection<String> orderKeys = REDIS.keys(key);
|
||||
// for (String okey : orderKeys) {
|
||||
// Map<String, Object> cacheGunYu = REDIS.getCacheMap(okey);
|
||||
// if(cacheGunYu !=null && "0".equals(cacheGunYu.get("status").toString()) && !okey.equals("placeholderOrder:"+terminalId+":"+orderNo)){
|
||||
// cacheGunYu.put("status",1);
|
||||
// cacheGunYu.put("endTime",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
||||
// REDIS.setCacheMap(okey, cacheGunYu);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
List<CacheRealtimeData> realtimeDataList = (List<CacheRealtimeData>) cacheOrder.get("realtimeDataList");
|
||||
@ -310,20 +298,10 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
public void run() {
|
||||
REDIS.setCacheObject("cdjgpc:realTime:"+orderNo,orderNo);
|
||||
//插枪状态发生变化进行判断是否收停车费
|
||||
// String vehicleGunStatus = pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())];
|
||||
// if("否".equals(vehicleGunStatus)){
|
||||
// String gunkey = "placeholderOrder:"+terminalId+":*";
|
||||
// Collection<String> orderKeys = REDIS.keys(gunkey);
|
||||
// for (String okey : orderKeys) {
|
||||
// Map<String, Object> cacheGun = REDIS.getCacheMap(okey);
|
||||
// if(cacheGun !=null && "0".equals(cacheGun.get("status").toString())){
|
||||
// cacheGun.put("status",1);
|
||||
// cacheGun.put("endTime",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
||||
// REDIS.setCacheMap(okey, cacheGun);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
String vehicleGunStatus = pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())];
|
||||
if("否".equals(vehicleGunStatus)){
|
||||
pileOrderService.getXhpcPlaceholderOrderTime(terminalId);
|
||||
}
|
||||
}
|
||||
});
|
||||
return new ServiceResult(false);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 262 KiB |
@ -11,7 +11,7 @@
|
||||
|
||||
<artifactId>xhpc-wxma</artifactId>
|
||||
<description>
|
||||
小程序服务
|
||||
小程序服务
|
||||
</description>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
@ -122,4 +122,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user