2016年新版代码

This commit is contained in:
2265829957@qq.com 2025-12-22 09:40:14 +08:00
parent 5be3ade7e8
commit 9ce1d4794c
92 changed files with 3859 additions and 348 deletions

View File

@ -5,6 +5,7 @@ import lombok.Getter;
import lombok.Setter;
import javax.persistence.Transient;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -34,6 +35,7 @@ import java.util.Map;
"ServiceFee",
"ParkFee",
"Payment",
"Pictures",
"SupportOrder",
"OvertimeFee",
"EquipmentInfos"
@ -87,6 +89,9 @@ public class StationInfoXinDianTu extends CommonStationInfo{
@JsonProperty("Payment")
public String payment;
@Transient
@JsonProperty("Pictures")
public String [] pictures;
@Transient
@JsonProperty("SupportOrder")
public Long supportOrder;
@Transient
@ -128,6 +133,7 @@ public class StationInfoXinDianTu extends CommonStationInfo{
", serviceFee='" + serviceFee + '\'' +
", parkFee='" + parkFee + '\'' +
", payment='" + payment + '\'' +
", pictures=" + Arrays.toString(pictures) +
", supportOrder=" + supportOrder +
", incrementExplain='" + incrementExplain + '\'' +
", equipmentInfos=" + equipmentInfos +

File diff suppressed because one or more lines are too long

View File

@ -162,6 +162,13 @@ public class QueryStationsInfoController {
//车位数量
chargingStationDto.setParkNums(xhpcChargingStation.getParkNums());
chargingStationDto.setParkFee(xhpcChargingStation.getParkingInstructions());
String[] split = xhpcChargingStation.getImgId().split(",");
for (int j = 0; j < split.length; j++) {
String s = split[j];
String url="https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com"+s;
split[j] =url;
}
chargingStationDto.setPictures(split);
REDIS.setCacheObject(stationKey, chargingStationDto);
}
}
@ -231,7 +238,8 @@ public class QueryStationsInfoController {
resp.setData(JSONUtil.toJSONString(response));
}
return resp;
}else if("MA25CNM38".equals(operatorId)){
}
else if("MA25CNM38".equals(operatorId)){
Integer pageNo = pageRequest.getPageNo();
PageStationsInfoResponseXinDianTu response = new PageStationsInfoResponseXinDianTu();
response.setPageNo(pageNo);
@ -323,17 +331,14 @@ public class QueryStationsInfoController {
xhpcChargingStationRepository.findOne(example).orElse(null);
if (xhpcChargingStation != null) {
//纬度
chargingStationDto.setLat(new BigDecimal(xhpcChargingStation.getLatitude()).setScale(6,
RoundingMode.HALF_UP).doubleValue());
chargingStationDto.setLat(new BigDecimal(xhpcChargingStation.getLatitude()).setScale(6,RoundingMode.HALF_UP).doubleValue());
//经度
chargingStationDto.setLng(new BigDecimal(xhpcChargingStation.getLongitude()).setScale(6,
RoundingMode.HALF_UP).doubleValue());
chargingStationDto.setLng(new BigDecimal(xhpcChargingStation.getLongitude()).setScale(6, RoundingMode.HALF_UP).doubleValue());
//站点类型
chargingStationDto.setType(xhpcChargingStation.getType());
//运营商id
String operatorIdEvcs = xhpcChargingStation.getOperatorIdEvcs();
chargingStationDto.setOperatorId(operatorIdEvcs == null ? "MA6DFCTD5"
: operatorIdEvcs.length() == 9 ? operatorId : operatorIdEvcs.substring(8, 17));
chargingStationDto.setOperatorId(operatorIdEvcs == null ? "MA6DFCTD5" : operatorIdEvcs.length() == 9 ? operatorId : operatorIdEvcs.substring(8, 17));
//详细地址
chargingStationDto.setAddress(xhpcChargingStation.getAddress());
//充电站省直辖区编码
@ -345,6 +350,14 @@ public class QueryStationsInfoController {
//车位数量
chargingStationDto.setParkNums(xhpcChargingStation.getParkNums());
chargingStationDto.setParkFee(xhpcChargingStation.getParkingInstructions());
String[] split = xhpcChargingStation.getImgId().split(",");
for (int j = 0; j < split.length; j++) {
String s = split[j];
String url="https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com"+s;
split[j] =url;
}
chargingStationDto.setPictures(split);
REDIS.setCacheObject(stationKey, chargingStationDto);
}
}
@ -352,6 +365,7 @@ public class QueryStationsInfoController {
stationInfo.setEquipmentOwnerId(chargingStationDto.getOperatorId());
stationInfo.setStationName(chargingStationDto.getName());
stationInfo.setCountryCode("CN");
stationInfo.setPictures(chargingStationDto.getPictures());
stationInfo.setAreaCode(chargingStationDto.getAreaCode());
stationInfo.setAddress(chargingStationDto.getAddress());
stationInfo.setServiceTel(chargingStationDto.getServiceTel());
@ -481,6 +495,13 @@ public class QueryStationsInfoController {
//车位数量
chargingStationDto.setParkNums(xhpcChargingStation.getParkNums());
chargingStationDto.setParkFee(xhpcChargingStation.getParkingInstructions());
String[] split = xhpcChargingStation.getImgId().split(",");
for (int j = 0; j < split.length; j++) {
String s = split[j];
String url="https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com"+s;
split[j] =url;
}
chargingStationDto.setPictures(split);
REDIS.setCacheObject(stationKey, chargingStationDto);
}
}

View File

@ -44,12 +44,12 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
* 清除5天前数据
* 实时数据没40秒
*/
//@Scheduled(fixedDelay = 1000 * 60)
@Scheduled(fixedDelay = 1000 * 60)
public void runY() throws Exception{
Collection<String> realtimeOrder = REDIS.keys("cdjgpc:realTime:*");
for (String okey : realtimeOrder) {
String orderNo = REDIS.getCacheObject(okey);
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-3), "yyMMdd");
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-7), "yyMMdd");
if(Integer.parseInt(format)>Integer.parseInt(orderNo.substring(16,22))){
REDIS.deleteObject(okey);
}
@ -65,7 +65,7 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
public void runYu() throws Exception{
Collection<String> realtimeOrder = REDIS.keys("orderOutpu:*");
for (String okey : realtimeOrder) {
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-5), "yyMMdd");
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-7), "yyMMdd");
if(Integer.parseInt(format)>Integer.parseInt(okey.substring(28,33))){
REDIS.deleteObject(okey);
}
@ -78,7 +78,7 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
* 设备充电中状态变化推送(我们平台推送成都市平台) --已推送
* 实时数据没40秒
*/
//@Scheduled(fixedDelay = 1000 * 40)
@Scheduled(fixedDelay = 1000 * 40)
public void run() throws Exception{
List<Long> longList =new ArrayList<>();
@ -195,11 +195,11 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
commonRequest.setData(data);
String result = ok(commonRequest, "/notification_connector_charge_status", authSecretTokenOut);
System.out.println("===设备充电中状态变化推送====lord.getOrderNo()========"+lord.getOrderNo());
System.out.println("===设备充电中状态变化推送====result========"+result);
//System.out.println("===设备充电中状态变化推送====lord.getOrderNo()========"+lord.getOrderNo());
//System.out.println("===设备充电中状态变化推送====result========"+result);
JSONObject jsonObject = JSONObject.parseObject(result);
if("0".equals(jsonObject.get("Ret").toString())){
System.out.println("===设备充电中状态变化推送====okey========"+okey);
// System.out.println("===设备充电中状态变化推送====okey========"+okey);
REDIS.deleteObject(okey);
}
}

View File

@ -1,11 +1,14 @@
package com.xhpc.evcs.cdjgpc.notification;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.xhpc.common.api.ChargingStationService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.data.redis.CacheOrderData;
import com.xhpc.common.dto.XhpcRateTimeDto;
import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.dto.ChargeOrderInfo;
import com.xhpc.evcs.dto.ChargeOrderInfoResponse;
import com.xhpc.evcs.dto.CommonRequest;
import com.xhpc.evcs.dto.DTOJsonHelper;
import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
import com.xhpc.evcs.notification.CoreDispatcher;
@ -19,11 +22,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.Duration;
import java.time.Instant;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.*;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
@ -39,11 +41,13 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
@Autowired
private AuthSecretTokenRepository authSecretTokenRepository;
@Autowired
private ChargingStationService chargingStationService;
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
//9099开放定时任务 9009不开放
//@Scheduled(fixedRate = 1000 * 15)
@Scheduled(fixedRate = 1000 * 15)
public void run() throws JsonProcessingException {
Collection<String> orderKeys = REDIS.keys("order:*");
@ -56,7 +60,7 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
}
Date otime = DateUtil.orderNo2Date(orderNo);
if (Duration.between(otime.toInstant(), now).toHours() > 24 * 3) {
if (Duration.between(otime.toInstant(), now).toHours() > 24 * 14) {
REDIS.deleteObject(okey);
REDIS.deleteObject(okey.replace("order", "pushOrder"));
logger.info("clear cache..{}", okey);
@ -79,11 +83,13 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
}
}
if (authSecretToken.getOperatorId3irdpty().equals(operatorId3rdptyEvcs)) {
// final List<XhpcStatisticsTimeInterval> statisticsTimeIntervals =
// xhpcStatisticsTimeIntervalRepository.findAllByHistoryOrderId(horder.getHistoryOrderId());
// horder.setXhpcStatisticsTimeIntervalList(statisticsTimeIntervals); //似乎并不需要
ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(horder);
chargeOrderInfo.setChargeModel(null);
if(new BigDecimal(0).compareTo(horder.getTotalPrice())<0){
chargeOrderInfo = calculateEmYu(horder,chargeOrderInfo);
}
logger.info("==========开始推送====推送返回值============calculateEmYu=====");
final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretToken);
if (pushResp != null) {
horder.setConfirmResult(pushResp.getConfirmResult());
@ -101,12 +107,689 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
}
}
public ChargeOrderInfoResponse notify(ChargeOrderInfo chargeOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
public ChargeOrderInfo calculateEmYu(XhpcHistoryOrder horder,ChargeOrderInfo chargeOrderInfo) {
logger.info("====111======开始推送====推送返回值============calculateEmYu=====");
String startTime = chargeOrderInfo.getStartTime();
String endTime = chargeOrderInfo.getEndTime();
DateTime parse = cn.hutool.core.date.DateUtil.parse(startTime, "yyyy-MM-dd");
DateTime parse1 = cn.hutool.core.date.DateUtil.parse(endTime, "yyyy-MM-dd");
long betweenDay = cn.hutool.core.date.DateUtil.between(parse,parse1, DateUnit.DAY);
if(betweenDay==0){
logger.info("=====22=====开始推送====推送返回值============calculateEmYu=====");
//没有跨天
Stack<ChargeDetails> stack = extracted(horder, chargeOrderInfo);
ChargeDetails[] cda = new ChargeDetails[stack.size()];
chargeOrderInfo.setChargeDetails(stack.toArray(cda));
}else{
logger.info("=====333=====开始推送====推送返回值============calculateEmYu=====");
Date endTime1 = horder.getEndTime();
horder.setEndTime(cn.hutool.core.date.DateUtil.parse(startTime.substring(0,10)+" 23:59:59"));
Stack<ChargeDetails> stack =extracted(horder, chargeOrderInfo);
horder.setStartTime(cn.hutool.core.date.DateUtil.parse(endTime.substring(0,10)+" 00:00:00"));
horder.setEndTime(endTime1);
Stack<ChargeDetails> stack1 =extracted(horder, chargeOrderInfo);
Stack<ChargeDetails> mergedStack = new Stack<>();
// 先添加stack2的所有元素保持原顺序
for (ChargeDetails detail : stack) {
mergedStack.push(detail);
}
// 再添加stack1的所有元素保持原顺序
for (ChargeDetails detail : stack1) {
mergedStack.push(detail);
}
ChargeDetails[] cda = new ChargeDetails[mergedStack.size()];
chargeOrderInfo.setChargeDetails(mergedStack.toArray(cda));
}
return chargeOrderInfo;
}
private Stack<ChargeDetails> extracted(XhpcHistoryOrder horder, ChargeOrderInfo chargeOrderInfo) {
Stack<ChargeDetails> chargeDetailsStack =new Stack<>();
R r = chargingStationService.getXhpcRateTimeOrder(horder.getRateModelId(), cn.hutool.core.date.DateUtil.formatTime(horder.getStartTime()), cn.hutool.core.date.DateUtil.formatTime(horder.getEndTime()),horder.getSerialNumber());
logger.info("=====444=====开始推送====推送返回值============calculateEmYu=====");
if(r.getCode()==200){
logger.info("=====5555=====开始推送====推送返回值============calculateEmYu=====");
Map<String, Object> cacheMapYu = REDIS.getCacheMap("Yu"+horder.getSerialNumber());
List<XhpcRateTimeDto> xhpcRateTimes = (List<XhpcRateTimeDto>)cacheMapYu.get(horder.getSerialNumber());
Map<String, Object> cacheMap = REDIS.getCacheMap("order:"+ horder.getSerialNumber());
CacheOrderData cacheOrderData = (CacheOrderData)cacheMap.get("orderData");
BigDecimal bigDecimal = new BigDecimal(10000);
int t1=0;
int t12 =2;
int t13 =3;
BigDecimal bigDecimal1 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal);
int t2 =0;
int t22 =2;
int t23 =3;
BigDecimal bigDecimal2 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal);
int t3 =0;
int t32 =2;
int t33 =3;
BigDecimal bigDecimal3 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal);
int t4 =0;
int t43 =3;
int t42 =2;
BigDecimal bigDecimal4 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal);
for (XhpcRateTimeDto xpcRateTime:xhpcRateTimes) {
String rateValue = xpcRateTime.getRateValue();
if("00".equals(rateValue)){
t1=t1+1;
} else if ("01".equals(rateValue)) {
t2=t2+1;
}else if ("02".equals(rateValue)) {
t3=t3+1;
}else if ("03".equals(rateValue)) {
t4=t4+1;
}
}
BigDecimal decimalYu = new BigDecimal((horder.getEndTime().getTime() - horder.getStartTime().getTime())).divide(new BigDecimal(60000),4,BigDecimal.ROUND_HALF_UP);
BigDecimal divideYu = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(new BigDecimal(10000),4,BigDecimal.ROUND_HALF_UP);
logger.info("=====66666=====开始推送====推送返回值============decimalYu====="+decimalYu+"=========divideYu========="+divideYu);
//每分钟多少度电
BigDecimal quantity =new BigDecimal(0);
if(decimalYu.compareTo(new BigDecimal(0))!=0){
quantity = decimalYu.divide(divideYu,4,BigDecimal.ROUND_HALF_UP);
}
for (XhpcRateTimeDto xpcRateTime:xhpcRateTimes) {
ChargeDetails chargeDetails = new ChargeDetails();
String rateValue = xpcRateTime.getRateValue();
String rateStartTime = cn.hutool.core.date.DateUtil.format(xpcRateTime.getStartTime(), "HH:mm:ss");
String orderStartTime = cn.hutool.core.date.DateUtil.format(horder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
rateStartTime = orderStartTime.substring(0,10)+" "+rateStartTime;
String rateEndTime = cn.hutool.core.date.DateUtil.format(xpcRateTime.getEndTime(), "HH:mm:ss");
String orderEndTime = cn.hutool.core.date.DateUtil.format(horder.getEndTime(), "yyyy-MM-dd HH:mm:ss");
rateEndTime = orderStartTime.substring(0,10)+" "+rateEndTime;
DateTime startTime1 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime endTime1 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
if("00".equals(rateValue)){
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t1==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t1==2){
if(t12==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
//剩余电量
bigDecimal1 = bigDecimal1.subtract(multiply);
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else{
BigDecimal multiply1 = bigDecimal1.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal1.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal1.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t12 = t12-1;
}else if(t1==3){
if(t13==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
//剩余电量
bigDecimal1 = bigDecimal1.subtract(multiply);
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t13==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal1 = bigDecimal1.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal1.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal1.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal1.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t13 = t13-1;
}
} else if ("01".equals(rateValue)) {
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t2==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t2==2){
if(t22==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal2 = bigDecimal2.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal2.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal2.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal2.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t22 = t22-1;
}else if(t2==3){
if(t23==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal2 = bigDecimal2.subtract(multiply);
}else if(t23==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal2 = bigDecimal2.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal2.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal2.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal2.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t23 = t23-1;
}
}else if ("02".equals(rateValue)) {
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t3==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t3==2){
if(t32==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal3 = bigDecimal3.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal3.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal3.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal3.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t32 = t32-1;
}else if(t3==3){
if(t33==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal3 = bigDecimal3.subtract(multiply);
}else if(t33==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal3 = bigDecimal3.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal3.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal3.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal3.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t33 = t33-1;
}
}else if ("03".equals(rateValue)) {
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t4==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t4==2){
if(t42==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal4 = bigDecimal4.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal4.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal4.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal4.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t42 = t42-1;
}else if(t4==3){
if(t43==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal4 = bigDecimal4.subtract(multiply);
}else if(t43==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal4 = bigDecimal4.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal4.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal4.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal4.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t43 = t43-1;
}
}
}
}
logger.info("=====8888=====开始推送====推送返回值============calculateEmYu=====");
//REDIS.deleteObject("Yu"+horder.getSerialNumber());
return chargeDetailsStack;
}
public ChargeOrderInfoResponse notify(ChargeOrderInfo chargeOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
logger.info("====111======开始推送====推送返回值============calculateEmYu=====");
String data = JSONUtil.toJSONString(chargeOrderInfo);
CommonRequest<ChargeOrderInfo> commonRequest = new CommonRequest<>();
commonRequest.setData(data);
String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut);
System.out.println("=======推送充电订单信息结果============"+responseBody);
return DTOJsonHelper.parseResponseData(responseBody,
ChargeOrderInfoResponse.class, authSecretTokenOut);
}

View File

@ -67,7 +67,7 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher {
*/
//9099开放定时任务 9009不开放
@GetMapping("/infoTask")
// @Scheduled(fixedRate = 1000 * 30)
@Scheduled(fixedRate = 1000 * 30)
public void run() throws IOException {
AuthSecretToken authSecretTokenOut =
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
@ -75,7 +75,7 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher {
// maybe对接第三方
if (authSecretTokenOut != null) {
final List<XhpcHistoryOrder> notYetPushOrder =
xhpcHistoryOrderRepository.findTop1000ByHistoryOrderIdGreaterThanEqualOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder());
xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanEqualOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder());
for (XhpcHistoryOrder xhpcHistoryOrder : notYetPushOrder) {
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(xhpcHistoryOrder.getChargingStationId(),

View File

@ -31,7 +31,7 @@ public class CDNotificationStationFeeTask extends CoreDispatcher {
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationFeeTask.class);
//9099开放定时任务 9009不开放
//@Scheduled(fixedDelay = 1000 * 60)
@Scheduled(fixedDelay = 1000 * 60)
public void run() throws IOException {
AuthSecretToken authSecretTokenOut =

View File

@ -32,7 +32,7 @@ public class CDNotificationStationInfoTask extends CoreDispatcher {
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationInfoTask.class);
//9099开放定时任务 9009不开放
//@Scheduled(cron = "0 20 0 1/1 * ? ")
@Scheduled(cron = "0 20 0 1/1 * ? ")
public void run() throws IOException {
try{
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =

View File

@ -11,6 +11,7 @@ import org.springframework.data.repository.query.Param;
import org.springframework.data.repository.query.QueryByExampleExecutor;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
@Repository
@ -27,8 +28,12 @@ public interface XhpcHistoryOrderRepository extends JpaRepository<XhpcHistoryOrd
List<XhpcHistoryOrder> findByConfirmResultAndSource(int confirmResult, int source);
List<XhpcHistoryOrder> findByCreateTimeGreaterThanAndConfirmResultAndSource(Date createTime, int confirmResult, int source);
List<XhpcHistoryOrder> findTop1000ByHistoryOrderIdGreaterThanEqualOrderByHistoryOrderIdAsc(Long hisOrderId);
List<XhpcHistoryOrder> findTop100ByHistoryOrderIdGreaterThanEqualOrderByHistoryOrderIdAsc(Long hisOrderId);
@Query("select ho from XhpcHistoryOrder ho join EtPushFailedOrder fo on ho.historyOrderId = fo.id where fo.operatorId3rdpty = ?1")
List<XhpcHistoryOrder> findJoinPushFailedOrders(@Param("operatorId3irdpty")String operatorId3irdpty, Pageable pageable);

View File

@ -1,14 +1,17 @@
package com.xhpc.evcs.notification;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.xhpc.common.api.ChargingStationService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.data.redis.CacheOrderData;
import com.xhpc.common.dto.XhpcRateTimeDto;
import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.dto.ChargeOrderInfo;
import com.xhpc.evcs.dto.ChargeOrderInfoResponse;
import com.xhpc.evcs.dto.CommonRequest;
import com.xhpc.evcs.dto.DTOJsonHelper;
import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
import com.xhpc.evcs.utils.DateUtil;
import com.xhpc.evcs.utils.JSONUtil;
import com.xhpc.order.domain.XhpcHistoryOrder;
import org.slf4j.Logger;
@ -17,15 +20,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.Duration;
import java.time.Instant;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
@ -42,16 +41,20 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
@Autowired
private AuthSecretTokenRepository authSecretTokenRepository;
@Autowired
private ChargingStationService chargingStationService;
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
//推送不开放
//推送不开放(第三方推送)
//9099开放定时任务 9009不开放
@GetMapping("/infoTask")
//@Scheduled(cron = "0/15 * * * * ? ")
@Scheduled(cron = "0/15 * * * * ? ")
public void run() throws JsonProcessingException {
List<AuthSecretToken> authSecretTokenList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
List<XhpcHistoryOrder> xhpcHistoryOrderList =xhpcHistoryOrderRepository.findByConfirmResultAndSource(-1, 1);
String formatYu = cn.hutool.core.date.DateUtil.format(DateUtil.offsetDay(new Date(),-90), "yyyy-MM-dd HH:mm:ss");
List<XhpcHistoryOrder> xhpcHistoryOrderList =xhpcHistoryOrderRepository.findByCreateTimeGreaterThanAndConfirmResultAndSource(DateUtil.parse(formatYu),-1, 1);
for (XhpcHistoryOrder horder : xhpcHistoryOrderList) {
if("765367656".equals(horder.getInternetSerialNumber().substring(0, 9))){
continue;
@ -67,6 +70,11 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
}
if (authSecretToken.getOperatorId3irdpty().equals(operatorId3rdptyEvcs)) {
ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(horder);
if(new BigDecimal(0).compareTo(horder.getTotalPrice())<0){
chargeOrderInfo = calculateEmYu(horder,chargeOrderInfo);
}
final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretToken);
if (pushResp != null) {
horder.setConfirmResult(pushResp.getConfirmResult());
@ -83,9 +91,681 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
}
}
public ChargeOrderInfo calculateEmYu(XhpcHistoryOrder horder,ChargeOrderInfo chargeOrderInfo) {
String startTime = chargeOrderInfo.getStartTime();
String endTime = chargeOrderInfo.getEndTime();
DateTime parse = cn.hutool.core.date.DateUtil.parse(startTime, "yyyy-MM-dd");
DateTime parse1 = cn.hutool.core.date.DateUtil.parse(endTime, "yyyy-MM-dd");
long betweenDay = cn.hutool.core.date.DateUtil.between(parse,parse1, DateUnit.DAY);
if(betweenDay==0){
//没有跨天
Stack<ChargeDetails> stack = extracted(horder, chargeOrderInfo);
ChargeDetails[] cda = new ChargeDetails[stack.size()];
chargeOrderInfo.setChargeDetails(stack.toArray(cda));
}else{
Date endTime1 = horder.getEndTime();
horder.setEndTime(cn.hutool.core.date.DateUtil.parse(startTime.substring(0,10)+" 23:59:59"));
Stack<ChargeDetails> stack =extracted(horder, chargeOrderInfo);
horder.setStartTime(cn.hutool.core.date.DateUtil.parse(endTime.substring(0,10)+" 00:00:00"));
horder.setEndTime(endTime1);
Stack<ChargeDetails> stack1 =extracted(horder, chargeOrderInfo);
Stack<ChargeDetails> mergedStack = new Stack<>();
// 先添加stack2的所有元素保持原顺序
for (ChargeDetails detail : stack) {
mergedStack.push(detail);
}
// 再添加stack1的所有元素保持原顺序
for (ChargeDetails detail : stack1) {
mergedStack.push(detail);
}
ChargeDetails[] cda = new ChargeDetails[mergedStack.size()];
chargeOrderInfo.setChargeDetails(mergedStack.toArray(cda));
}
return chargeOrderInfo;
}
private Stack<ChargeDetails> extracted(XhpcHistoryOrder horder, ChargeOrderInfo chargeOrderInfo) {
Stack<ChargeDetails> chargeDetailsStack =new Stack<>();
R r = chargingStationService.getXhpcRateTimeOrder(horder.getRateModelId(), cn.hutool.core.date.DateUtil.formatTime(horder.getStartTime()), cn.hutool.core.date.DateUtil.formatTime(horder.getEndTime()),horder.getSerialNumber());
if(r.getCode()==200){
Map<String, Object> cacheMapYu = REDIS.getCacheMap("Yu"+horder.getSerialNumber());
List<XhpcRateTimeDto> xhpcRateTimes = (List<XhpcRateTimeDto>)cacheMapYu.get(horder.getSerialNumber());
Map<String, Object> cacheMap = REDIS.getCacheMap("order:"+ horder.getSerialNumber());
CacheOrderData cacheOrderData = (CacheOrderData)cacheMap.get("orderData");
BigDecimal bigDecimal = new BigDecimal(10000);
int t1=0;
int t12 =2;
int t13 =3;
BigDecimal bigDecimal1 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal);
int t2 =0;
int t22 =2;
int t23 =3;
BigDecimal bigDecimal2 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal);
int t3 =0;
int t32 =2;
int t33 =3;
BigDecimal bigDecimal3 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal);
int t4 =0;
int t43 =3;
int t42 =2;
BigDecimal bigDecimal4 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal);
for (XhpcRateTimeDto xpcRateTime:xhpcRateTimes) {
String rateValue = xpcRateTime.getRateValue();
if("00".equals(rateValue)){
t1=t1+1;
} else if ("01".equals(rateValue)) {
t2=t2+1;
}else if ("02".equals(rateValue)) {
t3=t3+1;
}else if ("03".equals(rateValue)) {
t4=t4+1;
}
}
BigDecimal decimalYu = new BigDecimal((horder.getEndTime().getTime() - horder.getStartTime().getTime())).divide(new BigDecimal(60000),4,BigDecimal.ROUND_HALF_UP);
BigDecimal divideYu = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(new BigDecimal(10000),4,BigDecimal.ROUND_HALF_UP);
logger.info("=====66666=====开始推送====推送返回值============decimalYu====="+decimalYu+"=========divideYu========="+divideYu);
//每分钟多少度电
BigDecimal quantity =new BigDecimal(0);
if(decimalYu.compareTo(new BigDecimal(0))!=0){
quantity = decimalYu.divide(divideYu,4,BigDecimal.ROUND_HALF_UP);
}
for (XhpcRateTimeDto xpcRateTime:xhpcRateTimes) {
ChargeDetails chargeDetails = new ChargeDetails();
String rateValue = xpcRateTime.getRateValue();
String rateStartTime = cn.hutool.core.date.DateUtil.format(xpcRateTime.getStartTime(), "HH:mm:ss");
String orderStartTime = cn.hutool.core.date.DateUtil.format(horder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
rateStartTime = orderStartTime.substring(0,10)+" "+rateStartTime;
String rateEndTime = cn.hutool.core.date.DateUtil.format(xpcRateTime.getEndTime(), "HH:mm:ss");
String orderEndTime = cn.hutool.core.date.DateUtil.format(horder.getEndTime(), "yyyy-MM-dd HH:mm:ss");
rateEndTime = orderStartTime.substring(0,10)+" "+rateEndTime;
DateTime startTime1 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime endTime1 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
if("00".equals(rateValue)){
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t1==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t1==2){
if(t12==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
//剩余电量
bigDecimal1 = bigDecimal1.subtract(multiply);
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else{
BigDecimal multiply1 = bigDecimal1.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal1.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal1.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t12 = t12-1;
}else if(t1==3){
if(t13==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
//剩余电量
bigDecimal1 = bigDecimal1.subtract(multiply);
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t13==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal1 = bigDecimal1.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal1.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal1.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal1.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t13 = t13-1;
}
} else if ("01".equals(rateValue)) {
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t2==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t2==2){
if(t22==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal2 = bigDecimal2.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal2.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal2.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal2.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t22 = t22-1;
}else if(t2==3){
if(t23==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal2 = bigDecimal2.subtract(multiply);
}else if(t23==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal2 = bigDecimal2.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal2.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal2.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal2.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t23 = t23-1;
}
}else if ("02".equals(rateValue)) {
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t3==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t3==2){
if(t32==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal3 = bigDecimal3.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal3.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal3.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal3.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t32 = t32-1;
}else if(t3==3){
if(t33==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal3 = bigDecimal3.subtract(multiply);
}else if(t33==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal3 = bigDecimal3.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal3.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal3.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal3.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t33 = t33-1;
}
}else if ("03".equals(rateValue)) {
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t4==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t4==2){
if(t42==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal4 = bigDecimal4.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal4.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal4.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal4.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t42 = t42-1;
}else if(t4==3){
if(t43==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal4 = bigDecimal4.subtract(multiply);
}else if(t43==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal4 = bigDecimal4.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal4.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal4.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal4.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t43 = t43-1;
}
}
}
}
//REDIS.deleteObject("Yu"+horder.getSerialNumber());
return chargeDetailsStack;
}
public ChargeOrderInfoResponse notify(ChargeOrderInfo chargeOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
String data = JSONUtil.toJSONString(chargeOrderInfo);
logger.info("=====99999=====开始推送====推送返回值============data====="+data);
CommonRequest<ChargeOrderInfo> commonRequest = new CommonRequest<>();
commonRequest.setData(data);
String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut);
@ -94,4 +774,8 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
ChargeOrderInfoResponse.class, authSecretTokenOut);
}
public static void main(String[] args) {
}
}

View File

@ -187,11 +187,11 @@ public class TokenController extends BaseController
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("code", random);
paramMap.put("phone", phone);
paramMap.put("content", "小华充电】您的验证码是:" + random + "有效期为5分钟。如非本人操作可不用理会。");
paramMap.put("content", "翔桦充电】您的验证码是:" + random + "有效期为5分钟。如非本人操作可不用理会。");
com.aliyun.dysmsapi20170525.Client client = createClient();
com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest()
.setSignName("小华充电")
.setSignName("翔桦充电")
.setTemplateCode("SMS_226786362")
.setTemplateParam("{\"code\":\""+random+"\"}")
.setPhoneNumbers(phone);

View File

@ -57,7 +57,7 @@ public class XhpcTenantTask {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", domain.getContactNumber());
paramMap.put("tenantName", domain.getTenantName());
paramMap.put("content", "小华充电】尊敬的租户,您申请的租户(租户名称: " + domain.getTenantName() + ")还有15天到期请联系业务人员进行续费。");
paramMap.put("content", "翔桦充电】尊敬的租户,您申请的租户(租户名称: " + domain.getTenantName() + ")还有15天到期请联系业务人员进行续费。");
smsService.sendNotice(paramMap);
}
}

View File

@ -4,6 +4,7 @@ package com.xhpc.activity.controller;
import com.xhpc.activity.domain.XhpcClearingCheckoutDomain;
import com.xhpc.activity.service.XhpcClearingCheckoutService;
import com.xhpc.activity.vo.ClearingReceiptVo;
import com.xhpc.common.core.annotation.NoRepeatSubmit;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.exception.CustomException;
import com.xhpc.common.core.utils.StringUtils;
@ -81,6 +82,7 @@ public class XhpcClearingCheckoutController extends BaseController {
@GetMapping("/temp")
public R getTmpCheckoutData(HttpServletRequest request) {
LoginUser loginUser = logUserUtils.getLogUser(request);
@ -95,6 +97,7 @@ public class XhpcClearingCheckoutController extends BaseController {
@Log(title = "清分管理-新增提现申请", businessType = BusinessType.INSERT)
@PostMapping("/")
@NoRepeatSubmit(lockTime = 5)
public R insertDomain(HttpServletRequest request, @RequestBody XhpcClearingCheckoutDomain domain) {
LoginUser loginUser = logUserUtils.getLogUser(request);

View File

@ -312,7 +312,7 @@ public class XhpcClearingHistoryOrderDomain implements Serializable {
*/
private Date checkTime;
private String accountPhone;
private String stationName;

View File

@ -2,6 +2,7 @@ package com.xhpc.activity.service;
import com.xhpc.activity.domain.XhpcClearingCheckoutDomain;
import com.xhpc.activity.vo.ClearingReceiptVo;
import com.xhpc.common.core.domain.R;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ -16,7 +17,7 @@ public interface XhpcClearingCheckoutService {
XhpcClearingCheckoutDomain getDomainByPk(Long checkoutId);
Map<String, Object> getTmpCheckoutData(Long operatorId);
R getTmpCheckoutData(Long operatorId);
boolean insertDomain(XhpcClearingCheckoutDomain domain);

View File

@ -344,7 +344,7 @@ public class WorkOrderServiceImpl implements WorkOrderService {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("orderNo", orderId);
paramMap.put("phone", phoneList);
paramMap.put("content", "小华充电】您好,您有新的工单(工单号:" + orderId + ")待处理,请及时登陆后台查看并处理,谢谢。");
paramMap.put("content", "翔桦充电】您好,您有新的工单(工单号:" + orderId + ")待处理,请及时登陆后台查看并处理,谢谢。");
R r = smsService.sendNotice(paramMap);
XhpcWorkOrderPushMessageDomain messageDomain = new XhpcWorkOrderPushMessageDomain();

View File

@ -129,7 +129,7 @@ public class XhpcClearingBankServiceImpl implements XhpcClearingBankService {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", phone);
paramMap.put("code", random);
paramMap.put("content", "小华充电】您的动态码为:" + random + ",您正在进行提现到银行账户操作,如非本人操作,请忽略本短信!");
paramMap.put("content", "翔桦充电】您的动态码为:" + random + ",您正在进行提现到银行账户操作,如非本人操作,请忽略本短信!");
smsService.sendNotice(paramMap);
String key = "opcash:" + phone;

View File

@ -17,6 +17,7 @@ import com.xhpc.activity.task.AsyncService;
import com.xhpc.activity.utils.DownloadUtil;
import com.xhpc.activity.vo.CheckoutBankVo;
import com.xhpc.activity.vo.ClearingReceiptVo;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.exception.CustomException;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.utils.StringUtils;
@ -42,6 +43,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -110,7 +112,7 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
}
@Override
public Map<String, Object> getTmpCheckoutData(Long operatorId) {
public R getTmpCheckoutData(Long operatorId) {
XhpcClearingBankDomain bankDomain = bankMapper.selectOneByOperatorId(operatorId.toString());
if (bankDomain == null) {
throw new CustomException("请先输入一个有效的提现账户");
@ -141,7 +143,7 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
resultMap.put("receivedServiceAmount", receivedServiceAmount);
resultMap.put("receivedAmount", powerAmount.add(receivedServiceAmount).compareTo(BigDecimal.ZERO) >= 0 ? powerAmount.add(receivedServiceAmount) : BigDecimal.ZERO);
resultMap.put("clearingBankId", bankDomain.getClearingBankId());
return resultMap;
return R.ok(resultMap);
}
@ -163,6 +165,14 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
} else {
bankDomain = bankMapper.selectByPrimaryKey(domain.getClearingBankId());
}
//提交申请提现后需要等待10分钟
String keys = "tixian:" + bankDomain.getContactPhone();
if(redisService.getCacheObject(keys)==null){
redisService.setCacheObject(keys, bankDomain.getContactPhone(), 600L, TimeUnit.SECONDS);
}else{
throw new CustomException("已申请提现,系统在计算中请等待");
}
String key = "opcash:" + bankDomain.getContactPhone();
String redisCode = redisService.getCacheObject(key);

View File

@ -140,10 +140,7 @@
ifnull(sum(ho.act_power_price + ho.act_service_price), 0) as 'totalPrice',
ho.start_time as 'startTime',
ho.end_time as 'endTime',
inu.phone as internetUserPhone,
apu.phone as appUserPhone,
cop.account as communityAccount,
cup.account as customersAccount,
ho.phone as phone,
CASE WHEN cc.STATUS = 1 THEN '提现中'
WHEN cc.STATUS = 6 THEN '已提现'
ELSE
@ -167,16 +164,12 @@
from xhpc_clearing_history_order ho
left join xhpc_charging_station ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_clearing_checkout cc on ho.clearing_checkout_id=cc.clearing_checkout_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.del_flag=0
<if test="params.tenantId!=null and params.tenantId!=''">
and ct.tenant_id=#{params.tenantId}
and ho.tenant_id=#{params.tenantId}
</if>
<if test="params.operatorId!=null and params.operatorId!=''">
and ct.operator_id=#{params.operatorId}
and ho.operator_id=#{params.operatorId}
</if>
<if test="params.orderNo!=null and params.orderNo!=''">
and ho.serial_number like concat('%',#{params.orderNo},'%')
@ -197,7 +190,7 @@
and ct.name =concat('%', #{params.stationName}, '%')
</if>
<if test="params.stationId!=null and params.stationId!=''">
and ct.charging_station_id =#{params.stationId}
and ho.charging_station_id =#{params.stationId}
</if>
<if test="params.startTime!=null and params.startTime!=''">
and ho.end_time <![CDATA[ >= ]]> #{params.startTime}

View File

@ -74,7 +74,7 @@
ho.meter_value_start_evcs, ho.operator_id3rdpty_evcs, ho.start_time, ho.end_time, ho.stop_reason_evcs,
ho.total_power, ho.user_name_evcs, ho.phone, ho.evcs_order_no, ho.confirm_Result, ho.rate_model_id,
ho.charging_mode, ho.internet_degree_commission, ho.`source`, ho.tenant_id, ho.activity_power_price_total,
ho.activity_service_price_total, ho.activity_total_price
ho.activity_service_price_total,ho.phone,ho.activity_total_price
</sql>

View File

@ -2445,10 +2445,9 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
list.add(map001);
idxStart = idxStart+2;
int t3 = HexUtils.reverseHexInt(content.substring(idxStart, 16 + idxStart));
Map<String,Object> map3 =new LinkedHashMap<>();
map3.put("title","逻辑卡号(平台卡序列号,类似于桩号)");
map3.put("content",t3);
map3.put("content",content.substring(idxStart, 16 + idxStart));
list.add(map3);
idxStart = idxStart+16;
@ -2463,16 +2462,16 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
Map<String,Object> map6 =new LinkedHashMap<>();
map6.put("title","鉴权成功标志");
if(t6==0){
map6.put("content","成功");
}else{
map6.put("content","失败");
}else{
map6.put("content","成功");
}
list.add(map6);
idxStart = idxStart+2;
int t7= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
Map<String,Object> map7 =new LinkedHashMap<>();
map7.put("title","鉴权成功标志");
map7.put("title","失败原因");
if(t7==0){
map7.put("content","成功");
}else if(t7==1){
@ -2955,7 +2954,7 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
Map<String,Object> map211 =new LinkedHashMap<>();
map211.put("title","消费金额");
map211.put("content",new BigDecimal(t211).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN)+"");
list.add(map21);
list.add(map211);
// idxStart = idxStart+8;
// Map<String,Object> map221 =new LinkedHashMap<>();
@ -2994,27 +2993,18 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
Map<String,Object> map27 =new LinkedHashMap<>();
map27.put("title","交易日期、时间");
map27.put("content", DateUtil.format(CP56Time2a.cp56toDate(content.substring(idxStart, 14 + idxStart)), NORM_DATETIME_FORMATTER));
list.add(map3);
list.add(map27);
idxStart = idxStart+14;
int t28= HexUtils.reverseHexInt(content.substring(idxStart, 2+ idxStart));
Map<String,Object> map28=new LinkedHashMap<>();
map28.put("title","交易标识");
if(t28==1){
map28.put("content","app 启动");
}else if(t26==2){
map28.put("content","卡启动");
}else if(t26==4){
map28.put("content","离线卡启动");
}else{
map28.put("content","vin 码启动充电");
}
map28.put("title","停止原因");
map28.put("content",translate(content.substring(idxStart, 2 + idxStart)));
list.add(map28);
idxStart = idxStart+2;
Map<String,Object> map29 =new LinkedHashMap<>();
map29.put("title","停止原因");
map29.put("content",translate(content.substring(idxStart, 2 + idxStart)));
map29.put("title","物理卡号");
map29.put("content", content.substring(idxStart, 16 + idxStart));
list.add(map29);

View File

@ -9,7 +9,6 @@ import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.domain.XhpcChargingStation;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.annotation.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -241,4 +239,10 @@ public class XhpcChargingStationController extends BaseController {
xhpcChargingStationService.getchargingMethodList();
}
@GetMapping("/getXhpcRateTimeOrder")
public R getXhpcRateTimeOrder(Long rateModelId,String startTime, String endTime,String serialNumber){
return xhpcChargingStationService.getXhpcRateTimeOrder(rateModelId,startTime,endTime,serialNumber);
}
}

View File

@ -5,6 +5,7 @@ import com.xhpc.common.domain.XhpcChargingStation;
import com.xhpc.common.domain.XhpcRate;
import com.xhpc.common.domain.XhpcRateModel;
import com.xhpc.common.domain.XhpcRateTime;
import com.xhpc.common.dto.XhpcRateTimeDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -283,4 +284,6 @@ public interface XhpcChargingStationMapper {
List<Map<String,Object>> getchargingMethodList();
List<XhpcRateTimeDto> getReatTimeList(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("rateModelId")Long rateModelId);
}

View File

@ -260,4 +260,6 @@ public interface IXhpcChargingStationService {
void getchargingMethodList();
R getXhpcRateTimeOrder(Long rateModelId,String startTime, String endTime,String serialNumber);
}

View File

@ -2,8 +2,6 @@ package com.xhpc.charging.station.service;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.xhpc.charging.station.dto.XhpcActivityDiscountDto;
import com.xhpc.charging.station.mapper.XhpcChargingStationMapper;
import com.xhpc.charging.station.mapper.XhpcChargingStationPushStatusMapper;
@ -11,7 +9,7 @@ import com.xhpc.common.api.PowerPileService;
import com.xhpc.common.api.TenantService;
import com.xhpc.common.api.dto.XhpcChargingStationDto;
import com.xhpc.common.api.dto.XhpcRateDto;
import com.xhpc.common.api.dto.XhpcRateTimeDto;
import com.xhpc.common.api.dto.XhpcRateTimeDtoYang;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.DateUtils;
import com.xhpc.common.core.utils.SecurityUtils;
@ -23,7 +21,6 @@ import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.common.util.Utilitys;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.slf4j.Logger;
@ -37,7 +34,6 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -409,10 +405,10 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
}
}
}
List<XhpcRateTimeDto> xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList();
List<XhpcRateTimeDtoYang> xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList();
for (int i = 0; i < xhpcRateTimeList.size(); i++) {
XhpcRateTimeDto xhpcRateTime = xhpcRateTimeList.get(i);
XhpcRateTimeDtoYang xhpcRateTime = xhpcRateTimeList.get(i);
String start = xhpcRateTime.getStartTime();
String end = xhpcRateTime.getEndTime();
String id = xhpcRateTime.getId();
@ -443,11 +439,11 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
}
//判断是否有重叠
for (int i = 0; i < xhpcRateTimeList.size(); i++) {
XhpcRateTimeDto xhpcRateTimeOne = xhpcRateTimeList.get(i);
XhpcRateTimeDtoYang xhpcRateTimeOne = xhpcRateTimeList.get(i);
Date startOne = DateUtil.parse(xhpcRateTimeOne.getStartTime());
Date endOne = DateUtil.parse(xhpcRateTimeOne.getEndTime());
for (int j = i + 1; j < xhpcRateTimeList.size(); j++) {
XhpcRateTimeDto xhpcRateTimeTwo = xhpcRateTimeList.get(j);
XhpcRateTimeDtoYang xhpcRateTimeTwo = xhpcRateTimeList.get(j);
Date startTwo = DateUtil.parse(xhpcRateTimeTwo.getStartTime());
Date endTwo = DateUtil.parse(xhpcRateTimeTwo.getEndTime());
if (DateUtil.compare(startOne, endTwo) < 0 && DateUtil.compare(startTwo, endOne) < 0) {
@ -526,11 +522,11 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
//存费率时段从Map中获取费率id
//每个时间段都要存
//返回计费模型 24:00 转成 00:00
XhpcRateTimeDto[] xhpcRateTimeDtosArr = new XhpcRateTimeDto[xhpcRateTimeList.size()];
XhpcRateTimeDtoYang[] xhpcRateTimeDtosArr = new XhpcRateTimeDtoYang[xhpcRateTimeList.size()];
xhpcRateTimeList.toArray(xhpcRateTimeDtosArr);
XhpcRateTimeDto[] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr);
XhpcRateTimeDtoYang[] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr);
//排序好的费率时段
List<XhpcRateTimeDto> list = Arrays.asList(xhpcRateTimeDtos);
List<XhpcRateTimeDtoYang> list = Arrays.asList(xhpcRateTimeDtos);
//默认时段费率Id
Long defaultPeriodId = null;
if (xhpcChargingStationDto.getDefaultPeriodId() != null) {
@ -545,7 +541,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
}
int sort = 1;
for (int k = 0; k < list.size(); k++) {
XhpcRateTimeDto xhpcRateTimeDto = list.get(k);
XhpcRateTimeDtoYang xhpcRateTimeDto = list.get(k);
String startTime = xhpcRateTimeDto.getStartTime();
String endTime = xhpcRateTimeDto.getEndTime();
String rateValues = xhpcRateTimeDto.getId();
@ -1130,10 +1126,10 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
if (xhpcChargingStationDto.getXhpcRateTimeList() == null && xhpcChargingStationDto.getXhpcRateTimeList().size() == 0) {
return AjaxResult.error(1001, "费率时段不能为空");
}
List<XhpcRateTimeDto> xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList();
List<XhpcRateTimeDtoYang> xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList();
for (int i = 0; i < xhpcRateTimeList.size(); i++) {
XhpcRateTimeDto xhpcRateTime = xhpcRateTimeList.get(i);
XhpcRateTimeDtoYang xhpcRateTime = xhpcRateTimeList.get(i);
String start = xhpcRateTime.getStartTime();
String end = xhpcRateTime.getEndTime();
//检查格式,正则验证 [0-2][0-9][0-6][0][0]{2}
@ -1158,11 +1154,11 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
}
//判断是否有重叠
for (int i = 0; i < xhpcRateTimeList.size(); i++) {
XhpcRateTimeDto xhpcRateTimeOne = xhpcRateTimeList.get(i);
XhpcRateTimeDtoYang xhpcRateTimeOne = xhpcRateTimeList.get(i);
Date startOne = DateUtil.parse(xhpcRateTimeOne.getStartTime());
Date endOne = DateUtil.parse(xhpcRateTimeOne.getEndTime());
for (int j = i + 1; j < xhpcRateTimeList.size(); j++) {
XhpcRateTimeDto xhpcRateTimeTwo = xhpcRateTimeList.get(j);
XhpcRateTimeDtoYang xhpcRateTimeTwo = xhpcRateTimeList.get(j);
Date startTwo = DateUtil.parse(xhpcRateTimeTwo.getStartTime());
Date endTwo = DateUtil.parse(xhpcRateTimeTwo.getEndTime());
if (DateUtil.compare(startOne, endTwo) < 0 && DateUtil.compare(startTwo, endOne) < 0) {
@ -1222,11 +1218,11 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
//存费率时段从Map中获取费率id
//每个时间段都要存
//返回计费模型 24:00 转成 00:00
XhpcRateTimeDto[] xhpcRateTimeDtosArr = new XhpcRateTimeDto[xhpcRateTimeList.size()];
XhpcRateTimeDtoYang[] xhpcRateTimeDtosArr = new XhpcRateTimeDtoYang[xhpcRateTimeList.size()];
xhpcRateTimeList.toArray(xhpcRateTimeDtosArr);
XhpcRateTimeDto[] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr);
XhpcRateTimeDtoYang[] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr);
//排序好的费率时段
List<XhpcRateTimeDto> list = Arrays.asList(xhpcRateTimeDtos);
List<XhpcRateTimeDtoYang> list = Arrays.asList(xhpcRateTimeDtos);
//默认时段费率Id
Long defaultPeriodId = null;
if (xhpcChargingStationDto.getDefaultPeriodId() != null) {
@ -1241,7 +1237,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
}
int sort = 1;
for (int k = 0; k < list.size(); k++) {
XhpcRateTimeDto xhpcRateTimeDto = list.get(k);
XhpcRateTimeDtoYang xhpcRateTimeDto = list.get(k);
String startTime = xhpcRateTimeDto.getStartTime();
String endTime = xhpcRateTimeDto.getEndTime();
String rateValues = xhpcRateTimeDto.getId();
@ -1393,14 +1389,14 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
return AjaxResult.success();
}
public static XhpcRateTimeDto[] bubbleSort(XhpcRateTimeDto[] args) {
public static XhpcRateTimeDtoYang[] bubbleSort(XhpcRateTimeDtoYang[] args) {
//冒泡排序算法
for (int i = 0; i < args.length - 1; i++) {
for (int j = i + 1; j < args.length; j++) {
String start = args[i].getEndTime();
String end = args[j].getStartTime();
if (DateUtil.parse(start).getTime() > DateUtil.parse(end).getTime()) {
XhpcRateTimeDto temp = args[i];
XhpcRateTimeDtoYang temp = args[i];
args[i] = args[j];
args[j] = temp;
}
@ -1641,4 +1637,14 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
}
}
}
@Override
public R getXhpcRateTimeOrder(Long rateModelId, String startTime, String endTime,String serialNumber) {
List<com.xhpc.common.dto.XhpcRateTimeDto> reatTimeList = xhpcChargingStationMapper.getReatTimeList(startTime, endTime, rateModelId);
Map<String, Object> cacheOrder =new HashMap<>();
cacheOrder.put(serialNumber,reatTimeList);
redisService.setCacheMap("Yu"+serialNumber,cacheOrder);
return R.ok();
}
}

View File

@ -4,9 +4,7 @@ import cn.hutool.core.date.DateUtil;
import com.xhpc.charging.station.dto.XhpcPlaceholderDto;
import com.xhpc.charging.station.dto.XhpcPlaceholderTimeDto;
import com.xhpc.charging.station.mapper.XhpcPlaceholderMapper;
import com.xhpc.common.api.dto.XhpcRateTimeDto;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.domain.XhpcPlaceholderTime;
import com.xhpc.common.security.service.TokenService;
@ -150,7 +148,7 @@ public class XhpcPlaceholderServiceImpl extends BaseService implements IXhpcPlac
addXhpcPlaceholderTime("00:00:00",start,price,placeholderId,chargingStationId);
}
addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId);
if(!endTime.equals("24:00:00")) {
if(!("24:00:00").equals(xhpcPlaceholderTimeDto.getEndTime())) {
if(rateValue ==null || "".equals(rateValue)){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.fail("1004", "请填写默认时间段费率");
@ -190,7 +188,7 @@ public class XhpcPlaceholderServiceImpl extends BaseService implements IXhpcPlac
}
//并把本条数据也添加上
addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId);
if (!end.equals("24:00:00")) {
if (!("24:00:00").equals(xhpcPlaceholderTimeDto.getEndTime())) {
if(rateValue ==null || "".equals(rateValue)){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.fail("1004","请填写默认时间段费率");

View File

@ -5,11 +5,9 @@ import com.xhpc.charging.station.mapper.XhpcTimingChargingModelMapper;
import com.xhpc.common.api.PowerPileService;
import com.xhpc.common.api.SmsService;
import com.xhpc.common.api.dto.XhpcRateDto;
import com.xhpc.common.api.dto.XhpcRateTimeDto;
import com.xhpc.common.api.dto.XhpcRateTimeDtoYang;
import com.xhpc.common.api.dto.XhpcTimingChargingModelDto;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.data.redis.CacheRateModel;
import com.xhpc.common.domain.*;
@ -110,9 +108,9 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
}
}
}
List<XhpcRateTimeDto> xhpcRateTimeList = xhpcTimingChargingModelDto.getXhpcRateTimeList();
List<XhpcRateTimeDtoYang> xhpcRateTimeList = xhpcTimingChargingModelDto.getXhpcRateTimeList();
for (int i = 0; i < xhpcRateTimeList.size(); i++) {
XhpcRateTimeDto xhpcRateTime = xhpcRateTimeList.get(i);
XhpcRateTimeDtoYang xhpcRateTime = xhpcRateTimeList.get(i);
String start = xhpcRateTime.getStartTime();
String end = xhpcRateTime.getEndTime();
String id = xhpcRateTime.getId();
@ -143,11 +141,11 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
}
//判断是否有重叠
for (int i = 0; i < xhpcRateTimeList.size(); i++) {
XhpcRateTimeDto xhpcRateTimeOne = xhpcRateTimeList.get(i);
XhpcRateTimeDtoYang xhpcRateTimeOne = xhpcRateTimeList.get(i);
Date startOne = DateUtil.parse(xhpcRateTimeOne.getStartTime());
Date endOne = DateUtil.parse(xhpcRateTimeOne.getEndTime());
for (int j = i + 1; j < xhpcRateTimeList.size(); j++) {
XhpcRateTimeDto xhpcRateTimeTwo = xhpcRateTimeList.get(j);
XhpcRateTimeDtoYang xhpcRateTimeTwo = xhpcRateTimeList.get(j);
Date startTwo = DateUtil.parse(xhpcRateTimeTwo.getStartTime());
Date endTwo = DateUtil.parse(xhpcRateTimeTwo.getEndTime());
if (DateUtil.compare(startOne, endTwo) < 0 && DateUtil.compare(startTwo, endOne) < 0) {
@ -236,11 +234,11 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
//返回计费模型 24:00 转成 00:00
XhpcRateTimeDto[] xhpcRateTimeDtosArr = new XhpcRateTimeDto[xhpcRateTimeList.size()];
XhpcRateTimeDtoYang[] xhpcRateTimeDtosArr = new XhpcRateTimeDtoYang[xhpcRateTimeList.size()];
xhpcRateTimeList.toArray(xhpcRateTimeDtosArr);
XhpcRateTimeDto[] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr);
XhpcRateTimeDtoYang[] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr);
//排序好的费率时段
List<XhpcRateTimeDto> list = Arrays.asList(xhpcRateTimeDtos);
List<XhpcRateTimeDtoYang> list = Arrays.asList(xhpcRateTimeDtos);
//默认时段费率Id
Long defaultPeriodId = null;
if (xhpcTimingChargingModelDto.getDefaultPeriodId() != null) {
@ -253,7 +251,7 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
tfPricesSeq[k]=rateValue;
}
for (int k = 0; k < list.size(); k++) {
XhpcRateTimeDto xhpcRateTimeDto = list.get(k);
XhpcRateTimeDtoYang xhpcRateTimeDto = list.get(k);
String startTime = xhpcRateTimeDto.getStartTime();
String endTime = xhpcRateTimeDto.getEndTime();
String rateValues = xhpcRateTimeDto.getId();
@ -600,14 +598,14 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
return R.ok();
}
public static XhpcRateTimeDto[] bubbleSort(XhpcRateTimeDto[] args) {
public static XhpcRateTimeDtoYang[] bubbleSort(XhpcRateTimeDtoYang[] args) {
//冒泡排序算法
for (int i = 0; i < args.length - 1; i++) {
for (int j = i + 1; j < args.length; j++) {
String start = args[i].getEndTime();
String end = args[j].getStartTime();
if (DateUtil.parse(start).getTime() > DateUtil.parse(end).getTime()) {
XhpcRateTimeDto temp = args[i];
XhpcRateTimeDtoYang temp = args[i];
args[i] = args[j];
args[j] = temp;
}

View File

@ -37,22 +37,22 @@ oss:
secret-key: 5kFEaIFE7eeODxKQwD5mvTRF48MK6w
bucket-name: xhpc-bucket1
#二维码Logo图片获取位置
imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\logo.png"
#imgPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/logo.png"
#imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\logo.png"
imgPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/logo.png"
#imgPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/logo.png"
#生成的二维码存放位置:
destPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs"
#destPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs"
#destPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs"
destPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs"
#destPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs"
#生成的最终完整图片的存放位置:
fullImgDestPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs\\"
#fullImgDestPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs/"
#fullImgDestPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs\\"
fullImgDestPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs/"
#fullImgDestPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs/"
#底图图片存放位置:
bottomImg: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\BottomImg.png"
#bottomImg: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/BottomImg.png"
#bottomImg: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\BottomImg.png"
bottomImg: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/BottomImg.png"
#bottomImg: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/BottomImg.png"
#生成的二维码zip包位置
zipLocation: "D:\\Enterprise_Resources\\QrZip"
#zipLocation: "/www/wwwroot/scxhua.cn/dist"
#zipLocation: "D:\\Enterprise_Resources\\QrZip"
zipLocation: "/www/wwwroot/scxhua.cn/dist"
#zipLocation: "/www/wwwroot/xhpc.scxhua.com/dist"

View File

@ -79,6 +79,24 @@
<result property="barrierGateId" column="barrier_gate_id" />
</resultMap>
<resultMap id="XhpcRateTimeResultMap" type="com.xhpc.common.dto.XhpcRateTimeDto">
<result property="rateTimeId" column="rate_time_id"/>
<result property="chargingStationId" column="charging_station_id"/>
<result property="rateId" column="rate_id"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="powerFee" column="power_fee"/>
<result property="serviceFee" column="service_fee"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="rateModelId" column="rate_model_id"/>
<result property="sort" column="sort"/>
<result property="type" column="type"/>
<result property="rateValue" column="rate_value"/>
<result property="policyCode" column="policy_code"/>
<result property="policyName" column="policy_name"/>
</resultMap>
<sql id="selectXhpcChargingStationVo">
select charging_station_id,
name,
@ -1506,4 +1524,28 @@
charging_method as chargingNethod
from xhpc_charging_station where del_flag=0 and charging_method is not null
</select>
<select id="getReatTimeList" resultMap="XhpcRateTimeResultMap">
select
xrt.*,
xr.power_fee as power_fee,
xr.service_fee as service_fee
from xhpc_rate_time as xrt
left join xhpc_rate xr on xr.rate_id = xrt.rate_id
WHERE
xrt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{startTime}
)
<if test="endTime !='' and endTime !=null and endTime !='00:00:00' ">
<if test="endTime !='24:00:00' ">
or xrt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{endTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{endTime}
)
or xrt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &gt;= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') &lt;= #{endTime}
)
</if>
</if>
and xrt.rate_model_id = #{rateModelId}
</select>
</mapper>

View File

@ -33,4 +33,8 @@ public interface ChargingStationService {
@PostMapping("/requirementInfo/addNotificationTask")
R addNotificationTask(@RequestParam("taskName") String taskName,@RequestParam("taskCode") String taskCode,@RequestParam("demandDate") String demandDate,@RequestParam("stationID") String stationID,@RequestParam("operatorID") String operatorID,@RequestParam("equipmentOwnerID") String equipmentOwnerID,@RequestParam("eleNo") String eleNo,@RequestParam("list") String list,@RequestParam("deliveryTime") String deliveryTime);
@GetMapping("/station/getXhpcRateTimeOrder")
R getXhpcRateTimeOrder(@RequestParam(value = "rateModelId")Long rateModelId,@RequestParam(value = "startTime") String startTime,@RequestParam(value = "endTime") String endTime,@RequestParam(value = "serialNumber") String serialNumber);
}

View File

@ -1,5 +1,6 @@
package com.xhpc.common.api.dto;
import java.util.Arrays;
import java.util.Set;
public class ChargingStationDto {
@ -18,6 +19,8 @@ public class ChargingStationDto {
private String serviceTel;
private String parkFee;
private Integer parkNums;
private String [] pictures;
/**
* 装机总功率单位kw
*/
@ -182,6 +185,14 @@ public class ChargingStationDto {
this.parkFee = parkFee;
}
public String[] getPictures() {
return pictures;
}
public void setPictures(String[] pictures) {
this.pictures = pictures;
}
@Override
public String toString() {
return "ChargingStationDto{" +
@ -199,6 +210,7 @@ public class ChargingStationDto {
", serviceTel='" + serviceTel + '\'' +
", parkFee='" + parkFee + '\'' +
", parkNums=" + parkNums +
", pictures=" + Arrays.toString(pictures) +
", installedTotalPower=" + installedTotalPower +
", runningTotalPower=" + runningTotalPower +
'}';

View File

@ -10,7 +10,7 @@ public class XhpcChargingStationDto extends XhpcChargingStation {
List<XhpcRateDto> xhpcRateList;
//费率时段
List<XhpcRateTimeDto> xhpcRateTimeList;
List<XhpcRateTimeDtoYang> xhpcRateTimeList;
//默认时段费率
String defaultPeriodId;
@ -25,12 +25,12 @@ public class XhpcChargingStationDto extends XhpcChargingStation {
this.xhpcRateList = xhpcRateList;
}
public List<XhpcRateTimeDto> getXhpcRateTimeList() {
public List<XhpcRateTimeDtoYang> getXhpcRateTimeList() {
return xhpcRateTimeList;
}
public void setXhpcRateTimeList(List<XhpcRateTimeDto> xhpcRateTimeList) {
public void setXhpcRateTimeList(List<XhpcRateTimeDtoYang> xhpcRateTimeList) {
this.xhpcRateTimeList = xhpcRateTimeList;
}

View File

@ -1,12 +1,10 @@
package com.xhpc.common.api.dto;
import java.util.Date;
/**
* 费率时段
* @author yuyang
* @Date 2025-12-18 11:00
*/
public class XhpcRateTimeDto {
public class XhpcRateTimeDtoYang {
/** 启始时间 */
private String startTime;
@ -45,5 +43,4 @@ public class XhpcRateTimeDto {
this.id = id;
}
}

View File

@ -16,7 +16,7 @@ public class XhpcTimingChargingModelDto extends XhpcTimingChargingModel {
List<XhpcRateDto> xhpcRateList;
//费率时段
List<XhpcRateTimeDto> xhpcRateTimeList;
List<XhpcRateTimeDtoYang> xhpcRateTimeList;
//默认时段费率
String defaultPeriodId;

View File

@ -50,6 +50,11 @@ public class ChargingStationServiceFactory implements FallbackFactory<ChargingSt
public R addNotificationTask(String taskName, String taskCode, String demandDate, String stationID, String operatorID, String equipmentOwnerID, String eleNo, String list, String deliveryTime) {
return R.fail(500,"调控任务接口失败:" + cause.getMessage());
}
@Override
public R getXhpcRateTimeOrder(Long rateModelId, String startTime, String endTime,String serialNumber) {
return R.fail(3886,"查询该充电订单时段失败");
}
};
}
}

View File

@ -0,0 +1,75 @@
package com.xhpc.common.dto;
import lombok.Data;
import javax.persistence.Column;
import java.math.BigDecimal;
import java.util.Date;
/**
* 费率时段 xhpc_rate_time
*
* @author yuyang
* @date 2021-07-20
*/
@Data
public class XhpcRateTimeDto {
/** 费率时段id */
@Column(name = "rate_time_id")
private Long rateTimeId;
/** 电站id */
@Column(name = "charging_station_id")
private Long chargingStationId;
/** 费率id */
@Column(name = "rate_id")
private Long rateId;
/** 启始时间 */
@Column(name = "start_time")
private Date startTime;
/** 结束时间 */
@Column(name = "end_time")
private Date endTime;
@Column(name = "power_fee")
private BigDecimal powerFee;
@Column(name = "service_fee")
private BigDecimal serviceFee;
/** 状态0正常 1停用 */
@Column(name = "status")
private Integer status;
/** 状态0正常 1停用 */
@Column(name = "del_flag")
private Integer delFlag;
/** 计费模型id */
@Column(name = "rate_model_id")
private Long rateModelId;
/** 时间排序有小到大 */
@Column(name = "sort")
private Integer sort;
/** 1 设置时间段 2默认时间段 */
@Column(name = "type")
private Integer type;
/** 费率类型 00: 尖费率 01: 峰费率 02: 平费率 03: 谷费率 */
@Column(name = "rate_value")
private String rateValue;
@Column(name = "policy_code")
private String policyCode;
@Column(name = "policy_name")
private String policyName;
}

View File

@ -57,11 +57,14 @@ public class XhpcPlaceholderOrder extends BaseEntity {
private BigDecimal actPrice;
private Integer actStatus;
private Integer appealStatus;
private Integer actSettlement;
private String appealUserResult;
private String appealResult;
private Date appealTime;
private Date appealProcessTime;
private BigDecimal appealRefundMoney;
private BigDecimal appealRechargeMoney;
private String imgId;
public XhpcPlaceholderOrder() {
}

View File

@ -12,7 +12,7 @@ public class AliyunTemplate {
/**
* 阿里云短信签名
*/
public static final String SIGNATURE_NAME = "小华充电";
public static final String SIGNATURE_NAME = "翔桦充电";
/**
* 阿里云短信签名
@ -71,7 +71,7 @@ public class AliyunTemplate {
*/
public static final String OPERATOR_ORDER_REFUND = "SMS_462691150";
public static final String OPERATOR_PLACEHOLDER_ORDER = "SMS_493685173";
public static final String OPERATOR_PLACEHOLDER_ORDER = "SMS_499210343";
public static final String OPERATOR_PLACEHOLDER_ORDER_MONEY = "SMS_493935178";
public static final String OPERATOR_PLACEHOLDER_ORDER_MONEY = "SMS_500560014";
}

View File

@ -64,9 +64,10 @@ public class AliyunTemplateKeyWord {
* 退款订单异常
*/
public static final String OPERATOR_ORDER_REFUND ="尊敬的管理员,用户退款订单";
//免费
public static final String OPERATOR_PLACEHOLDER_ORDER ="尊敬的用户,你的爱车已停止充电";
public static final String OPERATOR_PLACEHOLDER_ORDER ="尊敬的用户,你的爱车已停止充电";
public static final String OPERATOR_PLACEHOLDER_ORDER_MONEY ="尊敬的用户你好,你的爱车已停止充电";
//收费
public static final String OPERATOR_PLACEHOLDER_ORDER_MONEY ="尊敬的用户你好,你的爱车已停止充电";
public static final String OPERATOR_CODE= "您的验证码是";
}

View File

@ -37,7 +37,7 @@ public class XhpcSmsController extends BaseController {
String signatureName = null;
String templateId = null;
signatureName = "小华充电";
signatureName = "翔桦充电";
templateId = "SMS_226786362";
if(phone !=null || "".equals(phone)){
if(!UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){

View File

@ -302,7 +302,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", "18123374652");
paramMap.put("number", "45634654");
paramMap.put("content", "小华充电订单异常】尊敬的管理员用户退款订单741258963有问题请速速查看。");
paramMap.put("content", "翔桦充电订单异常】尊敬的管理员用户退款订单741258963有问题请速速查看。");
String templateParam = JSONUtil.toJsonStr(paramMap);
sendSmsRequest.setTemplateParam(templateParam);
SendSmsResponse sendSmsResponse = client.sendSms(sendSmsRequest);
@ -314,7 +314,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
//存放后面需要使用的返回值
HashMap<String, String> valueParam = new HashMap<>();
valueParam.put("statusCode", statusCode);
valueParam.put("templateContent", "小华充电订单异常】尊敬的管理员用户退款订单324324324有问题请速速查看。");
valueParam.put("templateContent", "翔桦充电订单异常】尊敬的管理员用户退款订单324324324有问题请速速查看。");
valueParam.put("jsonResult", jsonResult);
System.out.println("====valueParam======"+valueParam.toString());

View File

@ -42,7 +42,7 @@ public class SmsUtil {
com.aliyun.dysmsapi20170525.Client client = SmsUtil.createClient(accessKeyId, accessKeySecret);
SendSmsRequest sendSmsRequest = new SendSmsRequest()
.setPhoneNumbers("18123374652")
.setSignName("小华充电订单异常")
.setSignName("翔桦充电订单异常")
.setTemplateCode("SMS_462691150")
.setTemplateParam("尊敬的管理员用户退款订单458765465461有问题请速速查看。");
// 复制代码运行请自行打印 API 的返回值

View File

@ -128,13 +128,6 @@
<version>${alipay.sdk.message}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-ooxml</artifactId>-->
<!-- <version>3.9</version>-->
<!-- </dependency>-->
</dependencies>
<build>

View File

@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -365,6 +366,36 @@ public class XhpcPileOrderController extends BaseController {
keysMap.put("identical","0");
}
number++;
try{
if(number==9 || number==20){
Integer source = xhpcChargeOrder.getSource();
//当number=920时判断一次用户金额与当前下发余额是否相等不相等停止充电
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
Object amountObj = redisService.getCacheObject("YE"+xhpcChargeOrder.getSerialNumber());
boolean stop =true;
if(amountObj !=null ){
BigDecimal balance1 =new BigDecimal(amountObj.toString());
if(cacheMap.get("initBalance") !=null){
BigDecimal bigDecimal = new BigDecimal(cacheMap.get("initBalance").toString()).divide(new BigDecimal(10000)).setScale(2, BigDecimal.ROUND_CEILING);
if(balance1.compareTo(bigDecimal)!=0){
stop =false;
}
}
}
if(!stop){
String substring = orderNo.substring(0, 14);
xhpcChargeOrder.setRemark("获取用户金额失败");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
powerPileService.stopCharging(orderNo, substring,orderNo.substring(0, 16), "0C");
System.out.println("=============获取用户金额失败====平台下发停止充电=========="+xhpcChargeOrder.getSerialNumber());
return R.fail(500,"充电桩校验故障");
}
}
}
}catch (Exception e){
}
}
keysMap.put("orderNo",cacheRealtimeData.getOrderNo());
@ -1130,4 +1161,32 @@ public R pileStartUpBy3rd(@RequestParam(value = "internetSerialNumber") String i
}
@GetMapping("/getUserMoney")
public void getUserMoney(Integer number,String serialNumber,Integer source,Long userId ){
if(number==9 || number==20){
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+serialNumber);
//当number=920时判断一次用户金额与当前下发余额是否相等不相等停止充电
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
String keyUser =serialNumber+":"+userId;
Object amountObj = redisService.getCacheObject(keyUser);
boolean stop =true;
if(amountObj !=null ){
BigDecimal balance1 =new BigDecimal(amountObj.toString());
if(cacheMap.get("initBalance") !=null){
BigDecimal bigDecimal = new BigDecimal(cacheMap.get("initBalance").toString()).divide(new BigDecimal(10000)).setScale(2, BigDecimal.ROUND_CEILING);
if(balance1.compareTo(bigDecimal)!=0){
stop =false;
}
}
}else{
//停止充电
}
if(!stop){
System.out.println("=============获取用户金额失败====平台下发停止充电==========");
}
}
}
}
}

View File

@ -8,6 +8,8 @@ import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.domain.XhpcStatisticsStation;
@ -23,7 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
@ -1218,6 +1222,12 @@ public class XhpcHistoryOrderController extends BaseController {
}
@PostMapping("/file/upload")
public R fileUpload(HttpServletRequest request, HttpServletResponse response, MultipartFile file, int type, String startTime, String endTime) throws Exception {
if (file ==null || type < 1){
return R.fail("文件或者对账类型为空");
}
return xhpcHistoryOrderService.fileUpload(request,response,"000000", file, type, startTime, endTime);
}
}

View File

@ -44,7 +44,7 @@ public class XhpcPileRegularInspectController extends BaseController {
//校时效价定时任务
@GetMapping("/getTimingPriceTime")
@Scheduled(cron = "0 0/3 * * * ?")
@Scheduled(cron = "0 0/1 * * * ?")
public void getTimingPriceTime()
{
xhpcPileRegularInspectService.getTimingPriceTime();

View File

@ -5,12 +5,16 @@ import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.order.service.IXhpcPlaceholderOrderService;
import com.xhpc.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.Scope;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -46,7 +50,7 @@ public class XhpcPlaceholderOrderController extends BaseController {
}
@GetMapping("/getAbnormalListPage")
public TableDataInfo getAbnormalListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, @RequestParam("status")Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, @RequestParam("userId") Long userId, Integer type,
public TableDataInfo getAbnormalListPage(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)
{
@ -106,8 +110,14 @@ public class XhpcPlaceholderOrderController extends BaseController {
xhpcPlaceholderOrderService.getAbnormal();
}
//查询标记为状态 type=3,手动处理的订单
@Scheduled(cron = "0 0/5 * * * ? ")
public void getType() {
xhpcPlaceholderOrderService.getType();
}
//查询异常订单枪状态
@Scheduled(cron = "0 0/1 * * * ? ")
// @Scheduled(cron = "0 0/1 * * * ? ")
public void getAbnormalTime() {
xhpcPlaceholderOrderService.getAbnormalTime();
}
@ -233,6 +243,7 @@ public class XhpcPlaceholderOrderController extends BaseController {
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
//C端机构用户
@PostMapping("/applyPlaceholderOrderProcess")
public R applyPlaceholderOrderProcess(HttpServletRequest request,@RequestBody Map<String, Object> map) {
if (map != null) {
@ -249,16 +260,64 @@ public class XhpcPlaceholderOrderController extends BaseController {
}
String appealResult = map.get("appealResult").toString();
String imgId = "";
if(map.get("imgId") !=null){
imgId = map.get("imgId").toString();
}
return xhpcPlaceholderOrderService.applyPlaceholderOrderProcess(request,placeholderOrderId,actPrice,refundType,appealResult);
return xhpcPlaceholderOrderService.applyPlaceholderOrderProcess(request,placeholderOrderId,actPrice,refundType,appealResult,imgId);
}
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
//流量方
@PostMapping("/applyPlaceholderOrderInternetProcess")
public R applyPlaceholderOrderInternetProcess(HttpServletRequest request,@RequestBody Map<String, Object> map) {
if (map != null) {
Long placeholderOrderId = Long.parseLong(map.get("placeholderOrderId").toString());
String refundType = map.get("refundType").toString();
BigDecimal actPrice =new BigDecimal(0);
if(!"reject".equals(refundType)){
if("full".equals(refundType)){
actPrice = new BigDecimal(map.get("totalMoney").toString());
}else if("partial".equals(refundType)){
actPrice = new BigDecimal(map.get("refundAmount").toString());
}
}
String appealResult = map.get("appealResult").toString();
String ingId = "";
if(map.get("ingId") !=null){
ingId = map.get("ingId").toString();
}
return xhpcPlaceholderOrderService.applyPlaceholderOrderInternetProcess(request,placeholderOrderId,actPrice,refundType,appealResult,ingId);
}
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
@GetMapping("/appealPlaceholderOrderListPC")
public TableDataInfo appealPlaceholderOrderListPC(HttpServletRequest request,String tenantId,Long operatorId,String name, Integer type, String serialNumber, Long chargingStationId){
List<Map<String, Object>> listPage =xhpcPlaceholderOrderService.appealPlaceholderOrderListPC(request,tenantId,operatorId,name, type, serialNumber, chargingStationId);
return getDataTable(listPage);
}
@Log(title = "上传对账单(文件方式)", businessType = BusinessType.INSERT)
@PostMapping("/file/upload")
public R fileUpload(HttpServletRequest request, HttpServletResponse response, MultipartFile file, int type, String startTime, String endTime) throws Exception {
if (file ==null || type < 1){
return R.fail("文件或者对账类型为空");
}
return xhpcPlaceholderOrderService.fileUpload(request,response,"000000", file, type, startTime, endTime);
}
@GetMapping("/deviceMessageList")
public TableDataInfo deviceMessageList(@RequestParam String serialNumber)
{
List<Map<String,Object>> list = xhpcPlaceholderOrderService.deviceMessageList(serialNumber);
return getDataTable(list);
}
}

View File

@ -0,0 +1,47 @@
package com.xhpc.order.domain;
import com.xhpc.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* 历史订单收费明细
*
* @author yuyang
* @Date 2025-12-17 11:47
*/
@Data
public class XhpcHistoryOrderChargeDetails extends BaseEntity {
private Long historyOrderChargeDetailsId;
private Long historyOrdersId;
private String detailStartTime;
private String detailEndTime;
private Double elecPrice;
private Double sevicePrice;
private Double detailPower;
private Double detailElecMoney;
private Double detailSeviceMoney;
private String startTime;
private String endTime;
private Double totalPower;
private Double totalElecMoney;
private Double totalSeviceMoney;
private Double totalMoney;
private Integer status;
}

View File

@ -0,0 +1,28 @@
package com.xhpc.order.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* 占位费Excel错误集
*
* @author yuyang
* @Date 2025-10-21 15:45
*/
@Data
public class FeeDifferenceDto {
private String orderId;
private BigDecimal excelFee; // Excel中的金额
private BigDecimal dbFee; // 数据库中的金额
private String differenceReason; // 差异原因
public FeeDifferenceDto() {}
public FeeDifferenceDto(String orderId, BigDecimal excelFee, BigDecimal dbFee, String differenceReason) {
this.orderId = orderId;
this.excelFee = excelFee;
this.dbFee = dbFee;
this.differenceReason = differenceReason;
}
}

View File

@ -0,0 +1,53 @@
package com.xhpc.order.dto;
import lombok.Data;
/**
* @author yuyang
* @Date 2025-11-12 16:26
*/
@Data
public class MergedOrderDto {
// XhpcHistoryOrderYuDto 字段
private String internetSerialNumber;
private String chargingDegree;
private String totalPrice;
private String powerPriceTotal;
private String servicePriceTotal;
// XhpcHistoryOrderDto 字段
private String serialNumber;
private String chargingStationName;
private String pileSerialNumber;
private String terminalName;
private String operatorName;
private String power;
private String startSoc;
private String endSoc;
private String activityPowerPriceTotal;
private String activityServicePriceTotal;
private String activityTotalPrice;
private String promotionDiscount;
private String actPrice;
private String internetCommission;
private String internetSvcCommission;
private String internetDegreeCommission;
private String platformCommission;
private String platformSvcCommisssion;
private String operationCommission;
private String operationSvcCommission;
private String actPowerPrice;
private String actServicePrice;
private String actSumPrice;
private String chargingTime;
private String startTime;
private String endTime;
private String updateTime;
private String chargingModeName;
private String stopReasonEvcs;
private String stopReasonEvcsStr;
private String sourceName;
// 差异信息
private String difference;
}

View File

@ -0,0 +1,27 @@
package com.xhpc.order.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* 占位费Excel类型
*
* @author yuyang
* @Date 2025-10-21 15:44
*/
@Data
public class PositionFeeDto {
private String orderId;
private BigDecimal feeAmount;
private Integer userStatus;
private BigDecimal refundMoney;
public PositionFeeDto() {}
public PositionFeeDto(String orderId, BigDecimal feeAmount) {
this.orderId = orderId;
this.feeAmount = feeAmount;
}
}

View File

@ -0,0 +1,50 @@
package com.xhpc.order.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author yuyang
* @Date 2025-11-12 15:16
*/
@Data
public class XhpcHistoryOrderDto {
private String serialNumber;
private String internetSerialNumber;
private String chargingStationName;
private String pileSerialNumber;
private String terminalName;
private String operatorName;
private String power;
private String startSoc;
private String endSoc;
private String chargingDegree;
private String powerPriceTotal;
private String servicePriceTotal;
private String totalPrice;
private String activityPowerPriceTotal;
private String activityServicePriceTotal;
private String activityTotalPrice;
private String promotionDiscount;
private String actPrice;
private String internetCommission;
private String internetSvcCommission;
private String internetDegreeCommission;
private String platformCommission;
private String platformSvcCommisssion;
private String operationCommission;
private String operationSvcCommission;
private String actPowerPrice;
private String actServicePrice;
private String actSumPrice;
private String chargingTime;
private String startTime;
private String endTime;
private String updateTime;
private String chargingModeName;
private String stopReasonEvcs;
private String stopReasonEvcsStr;
private String sourceName;
}

View File

@ -0,0 +1,32 @@
package com.xhpc.order.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author yuyang
* @Date 2025-11-12 15:08
*/
@Data
public class XhpcHistoryOrderYuDto {
private String internetSerialNumber;
private String chargingDegree;
private String totalPrice;
private String powerPriceTotal;
private String servicePriceTotal;
public XhpcHistoryOrderYuDto(String internetSerialNumber, String chargingDegree, String totalPrice, String powerPriceTotal, String servicePriceTotal) {
this.internetSerialNumber = internetSerialNumber;
this.chargingDegree = chargingDegree;
this.totalPrice = totalPrice;
this.powerPriceTotal = powerPriceTotal;
this.servicePriceTotal = servicePriceTotal;
}
}

View File

@ -0,0 +1,71 @@
package com.xhpc.order.dto;
import lombok.Data;
import javax.persistence.Column;
import java.math.BigDecimal;
import java.util.Date;
/**
* 费率时段
*
* @author yuyang
* @Date 2025-12-18 10:05
*/
@Data
public class XhpcRateTimeYuDto {
/** 费率时段id */
@Column(name = "rate_time_id")
private Long rateTimeId;
/** 电站id */
@Column(name = "charging_station_id")
private Long chargingStationId;
/** 费率id */
@Column(name = "rate_id")
private Long rateId;
/** 启始时间 */
@Column(name = "start_time")
private Date startTime;
/** 结束时间 */
@Column(name = "end_time")
private Date endTime;
@Column(name = "power_fee")
private BigDecimal powerFee;
@Column(name = "service_fee")
private BigDecimal serviceFee;
/** 状态0正常 1停用 */
@Column(name = "status")
private Integer status;
/** 状态0正常 1停用 */
@Column(name = "del_flag")
private Integer delFlag;
/** 计费模型id */
@Column(name = "rate_model_id")
private Long rateModelId;
/** 时间排序有小到大 */
@Column(name = "sort")
private Integer sort;
/** 1 设置时间段 2默认时间段 */
@Column(name = "type")
private Integer type;
/** 费率类型 00: 尖费率 01: 峰费率 02: 平费率 03: 谷费率 */
@Column(name = "rate_value")
private String rateValue;
@Column(name = "policy_code")
private String policyCode;
@Column(name = "policy_name")
private String policyName;
}

View File

@ -19,7 +19,7 @@ public interface XhpcChargingStationPowerMapper {
List<Map<String,Object>> getXhpcRealTimeOrderList(@Param("chargingStationId") Long chargingStationId,@Param("terminalId") Long terminalId,@Param("sterTime")String sterTime,@Param("endTime")String endTime,@Param("number")Integer number,@Param("subTime")String subTime);
//查询是否已统计
int duplicateStatistics(@Param("chargingStationId") Long chargingStationId,@Param("terminalId") Long terminalId,@Param("number")Integer number,@Param("subTime")String subTime);
int duplicateStatistics(@Param("chargingStationId") Long chargingStationId,@Param("terminalId") Long terminalId,@Param("number")Integer number,@Param("subTime")String subTime,@Param("createTime")String createTime);
//获取终端
List<Map<String,Object>> getXhpcTerminals(@Param("chargingStationId") Long chargingStationId);

View File

@ -1,8 +1,7 @@
package com.xhpc.order.mapper;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
import com.xhpc.order.dto.XhpcWorkHistoryOrderDto;
import com.xhpc.order.dto.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -157,4 +156,10 @@ public interface XhpcHistoryOrderMapper {
int updateChengDuPush(Long historyOrderId);
Map<String, Object> getXhpcRateTimeFee(@Param("date") String date, @Param("rateModelId") Long rateModelId);
List<XhpcHistoryOrderDto> getFileUpload(@Param("mapLst")List<XhpcHistoryOrderYuDto> mapLst);
List<Map<String, Object>> getXhpcHistoryOrderChargeDetailsList(@Param("historyOrderId")Long historyOrderId);
}

View File

@ -4,6 +4,7 @@ import com.xhpc.common.domain.XhpcPlaceholderTime;
import com.xhpc.evcs.domain.PlaceholderRules;
import com.xhpc.evcs.domain.PriceInfo;
import com.xhpc.order.domain.XhpcPlaceholderOrder;
import com.xhpc.order.dto.PositionFeeDto;
import com.xhpc.order.dto.XhpcPlaceholderTimeOrderDto;
import org.apache.ibatis.annotations.Param;
@ -97,4 +98,21 @@ public interface XhpcPlaceholderOrderMapper {
List<Map<String, Object>> appealPlaceholderOrderListPC(@Param("operatorId")Long operatorId,@Param("name") String name, @Param("type") Integer type, @Param("serialNumber") String serialNumber, @Param("chargingStationId") Long chargingStationId,@Param("logOperatorId")Long logOperatorId,@Param("number")Integer number,@Param("tenantId") String tenantId);
List<PositionFeeDto> getPlaceholderOrderExcelList(@Param("mapLst")List<PositionFeeDto> mapLst,@Param("userId") Long userId);
List<PositionFeeDto> getPlaceholderOrderUserExcelList(@Param("mapLst")List<PositionFeeDto> mapLst);
int updatePlaceholderOrderRechargeMoney(@Param("rechargeMoney")BigDecimal rechargeMoney,@Param("placeholderOrderNumber") String placeholderOrderNumber);
int updatePlaceholderOrderRechargeUserMoney(@Param("rechargeMoney")BigDecimal rechargeMoney,@Param("placeholderOrderNumber") String placeholderOrderNumber);
List<Map<String,Object>> deviceMessageList(@Param("chargeOrderNo") String chargeOrderNo ,@Param("gunNumber") String gunNumber);
List<Map<String,Object>> getType();
Map<String,Object> getXhpcPlaceholderOrderType(@Param("chargeOrderNo") String chargeOrderNo ,@Param("gunNumber") String gunNumber);
}

View File

@ -3,10 +3,7 @@ package com.xhpc.order.mapper;
import com.xhpc.common.domain.XhpcBarrierGateRecord;
import com.xhpc.common.domain.XhpcChargingPile;
import com.xhpc.order.domain.*;
import com.xhpc.order.dto.RateTime;
import com.xhpc.order.dto.XhpcActivityDiscountDto;
import com.xhpc.order.dto.XhpcActivityFormulaDomainDto;
import com.xhpc.order.dto.XhpcActivityInternetDomainDto;
import com.xhpc.order.dto.*;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
@ -217,4 +214,9 @@ public interface XhpcRealTimeOrderMapper {
//查询该场站是否有占位费设置
Map<String, Object> getXhpcPlaceholder(@Param("chargingStationId")Long chargingStationId);
List<XhpcRateTimeYuDto> getReatTimeList(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("rateModelId")Long rateModelId);
int insertXhpcHistoryOrderChargeDetails(XhpcHistoryOrderChargeDetails xhpcHistoryOrderChargeDetails);
}

View File

@ -1,9 +1,11 @@
package com.xhpc.order.service;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
import com.xhpc.order.dto.XhpcWorkHistoryOrderDto;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -156,4 +158,8 @@ public interface IXhpcHistoryOrderService {
AjaxResult cancelOrders(Long historyOrderId);
Map<String, Object> getXhpcRateTimeFee(Long rateModelId);
R fileUpload(HttpServletRequest request, HttpServletResponse response, String tenantId, MultipartFile file, int type, String startTime, String endTime) throws Exception;
}

View File

@ -4,6 +4,7 @@ import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcPlaceholderOrder;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -34,6 +35,8 @@ public interface IXhpcPlaceholderOrderService {
void getAbnormal();
void getType();
void getAbnormalTime();
R getPlaceholderIDs(String [] stationIDs);
@ -113,8 +116,17 @@ public interface IXhpcPlaceholderOrderService {
R applyPlaceholderOrder(HttpServletRequest request,Long placeholderOrderId,String appealUserResult);
R applyPlaceholderOrderProcess(HttpServletRequest request,Long placeholderOrderId,BigDecimal actPrice,String refundType,String appealResult);
R applyPlaceholderOrderProcess(HttpServletRequest request,Long placeholderOrderId,BigDecimal actPrice,String refundType,String appealResult,String imgId);
R applyPlaceholderOrderInternetProcess(HttpServletRequest request,Long placeholderOrderId,BigDecimal actPrice,String refundType,String appealResult,String imgId);
List<Map<String,Object>> appealPlaceholderOrderListPC(HttpServletRequest request,String tenantId,Long operatorId,String name, Integer type, String serialNumber, Long chargingStationId);
R fileUpload(HttpServletRequest request, HttpServletResponse response, String tenantId, MultipartFile file, int type, String startTime, String endTime) throws Exception;
List<Map<String,Object>> deviceMessageList(String chargeOrderNo);
}

View File

@ -196,4 +196,6 @@ public interface IXhpcRealTimeOrderService {
//充电车辆BMS报文定时任务每天下午4点30,清除一个月半之前的数据
void realTimeOrderBms();
void deleteOrderCacheDate();
}

View File

@ -280,6 +280,17 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息");
}
}
//内部使用判断
if(xhpcTerminal.getChargingStationId()==16L){
if("BE".equals(userMessage.get("userTypeName").toString())){
if(!"39".equals(userMessage.get("customersId").toString())){
return AjaxResult.error(1102, "内部使用,请登录相应账号");
}
}else{
return AjaxResult.error(1102, "内部使用,请登录相应账号");
}
}
//终端状态是否空闲
//是否插枪
Map<String, Object> cacheMap = REDIS.getCacheMap("gun:" + terminalSerialNumber);
@ -423,12 +434,12 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
}
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
//加用户金额缓存
redisService.setCacheObject("YE"+xhpcChargeOrder.getSerialNumber(),new BigDecimal(userMessage.get("balance").toString()));
executorService.execute(new Runnable() {
@Override
public void run() {
R r1 = powerPileService.startCharging(startChargingData);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<充电返回>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getCode() + ">>>>>>>>>>>>>>>>>");
@ -1066,7 +1077,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
}
}
map.put("soc",number);
//加用户金额缓存
redisService.setCacheObject("YE"+xhpcChargeOrder.getSerialNumber(),new BigDecimal(userMessage.get("balance").toString()));
return R.ok(map);
}catch (Exception e){
//数据回滚
@ -1281,7 +1293,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
startUpSuncha(userMessage,xhpcChargeOrder,xhpcTerminal,tenantId,userType,serialNumber,5);
return R.ok();
}
//加用户金额缓存
redisService.setCacheObject("YE"+xhpcChargeOrder.getSerialNumber(),new BigDecimal(userMessage.get("balance").toString()));
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
// executorService.execute(new Runnable() {
@ -1346,8 +1359,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
}else if(qiang==4){
spear = "D";
}
operatorMessage.get("chargingStationName").toString().replace("小华充电","");
String str = operatorMessage.get("chargingStationName").toString().replace("小华充电", "");
operatorMessage.get("chargingStationName").toString().replace("翔桦充电","");
String str = operatorMessage.get("chargingStationName").toString().replace("翔桦充电", "");
if(str.length()>13){
str =str.substring(0,13);
}
@ -1356,7 +1369,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("battery", soc);
paramMap.put("phone", userMessage.get("phone").toString());
paramMap.put("content", "小华充电】尊敬的用户你的车辆已充电达至设定的SOC(" + soc + "%)。");
paramMap.put("content", "翔桦充电】尊敬的用户你的车辆已充电达至设定的SOC(" + soc + "%)。");
smsService.sendNotice(paramMap);
}
}

View File

@ -81,13 +81,14 @@ public class XhpcChargingStationPowerServiceImpl extends BaseService implements
String tenantId = objectMap.get("tenantId").toString();
//查询是否已统计订单编号时间段
String subTime = now.substring(0,10);
String formatYu = cn.hutool.core.date.DateUtil.format(DateUtil.offsetDay(new Date(),-10), "yyyy-MM-dd HH:mm:ss");
List<Map<String, Object>> xhpcTerminals = xhpcChargingStationPowerMapper.getXhpcTerminals(chargingStationId);
for (int j = 0; j < xhpcTerminals.size(); j++) {
Map<String, Object> terminal = xhpcTerminals.get(j);
Long terminalId = Long.valueOf(terminal.get("terminalId").toString());
int determine = xhpcChargingStationPowerMapper.duplicateStatistics(chargingStationId, terminalId,numbrt, subTime);
int determine = xhpcChargingStationPowerMapper.duplicateStatistics(chargingStationId, terminalId,numbrt, subTime,formatYu);
if(determine==0){
List<Map<String, Object>> xhpcRealTimeOrderList = xhpcChargingStationPowerMapper.getXhpcRealTimeOrderList(chargingStationId,terminalId, sterTime, endTime, numbrt,subTime);
if(xhpcRealTimeOrderList !=null && xhpcRealTimeOrderList.size()>0){

View File

@ -19,8 +19,7 @@ import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.domain.XhpcRealTimeOrder;
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
import com.xhpc.order.dto.XhpcWorkHistoryOrderDto;
import com.xhpc.order.dto.*;
import com.xhpc.order.mapper.XhpcHistoryOrderMapper;
import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcHistoryOrderService;
@ -31,6 +30,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
@ -142,11 +142,10 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
public List<Map<String, Object>> list(HttpServletRequest request) {
List<Map<String, Object>> list =new ArrayList<>();
LoginUser loginUser = tokenService.getLoginUser(request);
if(loginUser==null){
startPage();
if(loginUser==null){
return list;
}
Long userid = loginUser.getUserid();
String tenantId = loginUser.getTenantId();
Integer userType = loginUser.getUserType();
@ -460,10 +459,24 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
if(byId.get("stopReasonRvcsName") !=null){
byId.put("stopReasonRvcsName",translate(byId.get("stopReasonRvcsName").toString()));
}
Map<String, Object> rateTime = getRateTime(byId.get("serialNumber").toString(), byId.get("totalPrice").toString(), byId.get("totalPower").toString());
if(rateTime !=null){
byId.putAll(rateTime);
//获取历史订单收费明细
List<Map<String, Object>> list = xhpcHistoryOrderMapper.getXhpcHistoryOrderChargeDetailsList(historyOrderId);
if(list==null || list.isEmpty()){
Map<String, Object> map1 = new HashMap<>();
map1.put("time","00:00:00 至 00:00:00");
map1.put("powerPrice", 0);
map1.put("servicePrice", 0);
map1.put("chargingDegree", 0);
map1.put("actPrice", 0);
list.add(map1);
}
byId.put("list", list);//数据列表
// Map<String, Object> rateTime = getRateTime(byId.get("serialNumber").toString(), byId.get("totalPrice").toString(), byId.get("totalPower").toString());
// if(rateTime !=null){
// byId.putAll(rateTime);
// }
}
return AjaxResult.success(byId);
} catch (Exception e) {
@ -678,6 +691,14 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
return xhpcHistoryOrderMapper.getXhpcRateTimeFee(tiem,rateModelId);
}
@Override
public R fileUpload(HttpServletRequest request, HttpServletResponse response, String tenantId, MultipartFile file, int type, String startTime, String endTime) throws Exception {
return null;
}
/**
* 历史信息费率时段
*/
@ -698,6 +719,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
DateTime parse = DateUtil.parse(DateUtil.format(startTime2, "yyyy-MM-dd"), "yyyy-MM-dd");
DateTime parse1 = DateUtil.parse(DateUtil.format(updateTime2, "yyyy-MM-dd"), "yyyy-MM-dd");
long betweenDay = DateUtil.between(parse, parse1, DateUnit.DAY);
if (betweenDay == 0) {
return getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime2, chargingDegree, list);
} else {
@ -708,6 +730,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
DateTime tomorrow = DateUtil.offsetDay(startTime2, 1);
Date startTime3 = DateUtil.beginOfDay(tomorrow);
Map<String, Object> twentyFour = xhpcHistoryOrderMapper.getXhpcRealTimeOrderTwentyFour(chargeOrder.getChargeOrderId(), format);
if(twentyFour==null){
return getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime2, chargingDegree, list);
}
@ -784,7 +807,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
return map;
}
//每分钟多少度
BigDecimal degree = chargingDegree.divide(decimal, 2, BigDecimal.ROUND_HALF_UP);
BigDecimal degree = chargingDegree.divide(decimal, 3, BigDecimal.ROUND_HALF_UP);
//获取费率时间段
String startTime = DateUtil.formatTime(startTime2);
@ -797,9 +820,9 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
Map<String, Object> map1 = new HashMap<>();
int size = reatTimeList.size();
if (size == 1) {
BigDecimal powerFee = new BigDecimal(reatTimeList.get(0).get("powerFee").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal powerFee = new BigDecimal(reatTimeList.get(0).get("powerFee").toString()).setScale(4, BigDecimal.ROUND_HALF_UP);
//powerPriceTotal = powerFee.multiply(degree).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal servicePrice = new BigDecimal(reatTimeList.get(0).get("serviceFee").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal servicePrice = new BigDecimal(reatTimeList.get(0).get("serviceFee").toString()).setScale(4, BigDecimal.ROUND_HALF_UP);
//servicePriceTotal=servicePrice.multiply(chargingDegree).setScale(2, BigDecimal.ROUND_HALF_UP);
map1.put("time", startTime + "-" + endTime);
map1.put("powerPrice", powerFee);
@ -807,13 +830,13 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
map1.put("chargingDegree", chargeOrder.getChargingDegree());
map1.put("actPrice", totalPrice);
list.add(map1);
powerPriceTotal =powerPriceTotal.add(powerFee.multiply(degree).setScale(2, BigDecimal.ROUND_HALF_UP));
servicePriceTotal =servicePriceTotal.add(servicePrice.multiply(chargingDegree).setScale(2, BigDecimal.ROUND_HALF_UP));
powerPriceTotal =powerPriceTotal.add(powerFee.multiply(degree).setScale(4, BigDecimal.ROUND_HALF_UP));
servicePriceTotal =servicePriceTotal.add(servicePrice.multiply(chargingDegree).setScale(4, BigDecimal.ROUND_HALF_UP));
} else {
for (int i = 0; i < reatTimeList.size(); i++) {
Map<String, Object> objectMap = reatTimeList.get(i);
BigDecimal powerPrice = new BigDecimal(objectMap.get("powerFee").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal servicePrice = new BigDecimal(objectMap.get("serviceFee").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal powerPrice = new BigDecimal(objectMap.get("powerFee").toString()).setScale(4, BigDecimal.ROUND_HALF_UP);
BigDecimal servicePrice = new BigDecimal(objectMap.get("serviceFee").toString()).setScale(4, BigDecimal.ROUND_HALF_UP);
String startTime1 = objectMap.get("startTime").toString();
String endTime1 = objectMap.get("endTime").toString();
if("00:00:00".equals(endTime1)){
@ -848,7 +871,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
Map<String, Object> map = new HashMap<>();
BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime()) / 60000).multiply(degree);
BigDecimal multiply = powerPrice.add(servicePrice).multiply(v).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply = powerPrice.add(servicePrice).multiply(v).setScale(4, BigDecimal.ROUND_HALF_UP);
map.put("time", startTime + "-" + endTime);
map.put("powerPrice", powerPrice);
map.put("servicePrice", servicePrice);
@ -944,7 +967,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
long time = DateUtil.parse(endTime).getTime();
long time1= DateUtil.parse(startTime).getTime();
BigDecimal multiply = new BigDecimal(time-time1).divide(new BigDecimal(60000),4, BigDecimal.ROUND_HALF_UP).multiply(degree).setScale(4,BigDecimal.ROUND_HALF_UP);
BigDecimal bigDecimal = multiply.multiply(powerPrice).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal bigDecimal = multiply.multiply(powerPrice).setScale(4, BigDecimal.ROUND_HALF_UP);
return bigDecimal;
}

View File

@ -208,8 +208,10 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
List<Map<String, Object>> pileSerialNumber = xhpcPileRegularInspectMapper.getPileSerialNumber();
for (int i = 0; i < pileSerialNumber.size(); i++) {
Map<String, Object> map = pileSerialNumber.get(i);
System.out.println("============校时效价定时任务执行===================="+map.get("serialNumber").toString());
powerPileService.configTimeNRateModel(map.get("serialNumber").toString());
}
System.out.println("============校时效价定时任务成功====================");
}
}
}catch (Exception e){
@ -255,7 +257,11 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
public static void main(String[] args) {
String times = DateUtil.formatTime(new Date());
String [] time =times.split(":");
System.out.println("==777===:"+time[0]);
System.out.println("==888===:"+time[1]);
if("00".equals(time[1]) ||"11".equals(time[1])||"12".equals(time[1])||"13".equals(time[1])||"14".equals(time[1])){
System.out.println("==222===:"+time[1]);
}
for (int i = 0; i <time.length ; i++) {
System.out.println("=====:"+time[i]);
}

View File

@ -13,29 +13,35 @@ import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.domain.XhpcPlaceholderTime;
import com.xhpc.common.enums.StopReasonEnum;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.evcs.domain.PlaceholderRules;
import com.xhpc.evcs.domain.PriceInfo;
import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcPlaceholderOrder;
import com.xhpc.order.dto.FeeDifferenceDto;
import com.xhpc.order.dto.PositionFeeDto;
import com.xhpc.order.dto.XhpcPlaceholderTimeOrderDto;
import com.xhpc.order.mapper.XhpcPlaceholderOrderMapper;
import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcPlaceholderOrderService;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
@ -452,7 +458,7 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
}
} else {
startPage();
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
return list;
@ -490,7 +496,7 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
}
} else {
startPage();
list = xhpcPlaceholderOrderMapper.getAbnormalListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
list = xhpcPlaceholderOrderMapper.getAbnormalListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, null, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
return list;
@ -531,29 +537,34 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
} else {
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, null, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
// 通过工具类创建writer默认创建xls格式
BigExcelWriter writer = ExcelUtil.getBigWriter("placeholderOrder_" + System.currentTimeMillis() + ".xlsx");
writer.addHeaderAlias("placeholderOrderId", "占位费订单ID");
// writer.addHeaderAlias("placeholderOrderId", "占位费订单ID");
writer.addHeaderAlias("serialNumber", "充电订单号");
writer.addHeaderAlias("internetSerialNumber", "流量方订单号");
writer.addHeaderAlias("placeholderOrderNumber", "占位费订单号");
writer.addHeaderAlias("operatorName", "运营商名称");
writer.addHeaderAlias("chargingStationName", "电站名称");
writer.addHeaderAlias("pileSerialNumber", "桩编号");
writer.addHeaderAlias("terminalName", "终端名称");
// writer.addHeaderAlias("operatorId", "运营商ID");
writer.addHeaderAlias("operatorName", "运营商名称");
writer.addHeaderAlias("chargingModeName", "订单来源");
writer.addHeaderAlias("freeTime", "免费时长(分钟)");
writer.addHeaderAlias("maxFee", "最大占位费(元)");
writer.addHeaderAlias("totalTimeSpan", "占位总时长(分钟)");
writer.addHeaderAlias("totalMoney", "占位总费用(元)");
writer.addHeaderAlias("totalTimeSpan", "占位总时长(分钟)");
writer.addHeaderAlias("totalMoney", "流量方占位费(元)");
writer.addHeaderAlias("rechargeMoney", "流量方占位已支付(元)");
writer.addHeaderAlias("refundMoney", "流量方占位未支付(元)");
writer.addHeaderAlias("confirmResultName", "流量方推送状态");
// writer.addHeaderAlias("sourceName", "用户类型");
writer.addHeaderAlias("startTime", "开始占位时间");
writer.addHeaderAlias("endTime", "结束占位时间");
writer.addHeaderAlias("chargingModeName", "订单来源");
writer.addHeaderAlias("sourceName", "用户类型");
writer.addHeaderAlias("confirmResultName", "推送状态");
writer.addHeaderAlias("actPrice", "平台用户占位费(元)");
writer.addHeaderAlias("appealRechargeMoney", "平台用户已支付(元)");
writer.addHeaderAlias("appealRefundMoney", "平台用户未支付(元)");
// writer.addHeaderAlias("plateNum", "电站名称");
// writer.addHeaderAlias("disputeOrderStatus", "桩编号");
@ -829,6 +840,44 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
xhpcPlaceholderOrderMapper.getAbnormal();
}
@Override
public void getType() {
//查询type=3的数据
List<Map<String, Object>> mapList = xhpcPlaceholderOrderMapper.getType();
for (int i = 0; i < mapList.size(); i++) {
Map<String, Object> map = mapList.get(i);
int source = Integer.parseInt(map.get("source").toString());
String serialNumber = map.get("serialNumber").toString();
Long placeholderOrderId = Long.parseLong(map.get("placeholderOrderId").toString());
if(source==0){
//查询最后拔枪的时间
Map<String, Object> mapTime = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderType(serialNumber, serialNumber.substring(0, 16));
if (mapTime!=null && mapTime.get("createTime") !=null){
getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),mapTime.get("createTime").toString());
}
}else if(source==1){
String internetSerialNumber = map.get("internetSerialNumber").toString();
if("MA25CNM38".equals(internetSerialNumber.substring(0,9))){
//修改新电途订单
XhpcPlaceholderOrder xhpcPlaceholderOrder = new XhpcPlaceholderOrder();
xhpcPlaceholderOrder.setPlaceholderOrderId(placeholderOrderId);
xhpcPlaceholderOrder.setEndTime(DateUtil.parse(map.get("startTime").toString(),"yyyy-MM-dd HH:mm:ss"));
xhpcPlaceholderOrder.setTotalTimeSpan(0);
xhpcPlaceholderOrder.setOvertimePrice(new BigDecimal(0));
xhpcPlaceholderOrder.setTotalMoney(new BigDecimal(0));
xhpcPlaceholderOrder.setType(0);
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
}else{
//查询最后拔枪的时间
Map<String, Object> mapTime = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderType(serialNumber, serialNumber.substring(0, 16));
if (mapTime!=null && mapTime.get("createTime") !=null){
getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),mapTime.get("createTime").toString());
}
}
}
}
}
@Override
public void getAbnormalTime() {
List<Map<String, Object>> mapList = xhpcPlaceholderOrderMapper.getAbnormalTimeList();
@ -1278,6 +1327,9 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
writer.addHeaderAlias("xiaoJuMoney", "小桔总费用");
writer.addHeaderAlias("cheWeiJiaMoney", "车为家总费用");
writer.addHeaderAlias("sourceName", "用户类型");
writer.addHeaderAlias("CDuanMoney", "C端用户");
writer.addHeaderAlias("sheQuMoney", "社区用户");
writer.addHeaderAlias("BDuanMoney", "B端用户");
// 默认的未添加alias的属性也会写出如果想只写出加了别名的字段可以调用此方法排除之
writer.setOnlyAlias(true);
// 一次性写出内容使用默认样式强制输出标题
@ -1353,7 +1405,7 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
writer.addHeaderAlias("refundMoney", "新电途用户已支付费用");
writer.addHeaderAlias("xiaoJuMoney", "小桔总费用");
writer.addHeaderAlias("cheWeiJiaMoney", "车为家总费用");
writer.addHeaderAlias("actPrice", "C端用户总");
writer.addHeaderAlias("actPrice", "C端用户总");
// 默认的未添加alias的属性也会写出如果想只写出加了别名的字段可以调用此方法排除之
writer.setOnlyAlias(true);
// 一次性写出内容使用默认样式强制输出标题
@ -1434,6 +1486,7 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
writer.addHeaderAlias("CDuanMoney", "C端用户总用");
writer.addHeaderAlias("sheQuMoney", "社区总费用");
writer.addHeaderAlias("BDuanMoney", "B端总费用");
writer.addHeaderAlias("actPrice", "C端用户总费用");
// 默认的未添加alias的属性也会写出如果想只写出加了别名的字段可以调用此方法排除之
writer.setOnlyAlias(true);
// 一次性写出内容使用默认样式强制输出标题
@ -1482,17 +1535,19 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
}
@Override
public R applyPlaceholderOrderProcess(HttpServletRequest request, Long placeholderOrderId, BigDecimal actPrice,String refundType,String appealResult) {
public R applyPlaceholderOrderProcess(HttpServletRequest request, Long placeholderOrderId, BigDecimal actPrice,String refundType,String appealResult,String imgId) {
XhpcPlaceholderOrder placeholderOrder = xhpcPlaceholderOrderMapper.getByPlaceholderOrderId(placeholderOrderId);
XhpcPlaceholderOrder xhpcPlaceholderOrder = new XhpcPlaceholderOrder();
xhpcPlaceholderOrder.setPlaceholderOrderId(placeholderOrderId);
xhpcPlaceholderOrder.setAppealResult(appealResult);
xhpcPlaceholderOrder.setAppealProcessTime(new Date());
xhpcPlaceholderOrder.setImgId(imgId);
BigDecimal subtractYu=new BigDecimal(0);
if(!"reject".equals(refundType)){
//申述成功用户进行充值金额
xhpcPlaceholderOrder.setAppealStatus(2);
xhpcPlaceholderOrder.setActStatus(2);
if(placeholderOrder.getActPrice().compareTo(actPrice)==1){
//剩余金额
subtractYu = actPrice;
@ -1528,6 +1583,7 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
return R.ok();
}
}else{
//申述失败
xhpcPlaceholderOrder.setAppealStatus(3);
int i = xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
@ -1538,6 +1594,34 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
return R.fail("申述失败,请稍后再申述");
}
@Override
public R applyPlaceholderOrderInternetProcess(HttpServletRequest request, Long placeholderOrderId, BigDecimal actPrice,String refundType,String appealResult,String imgId) {
XhpcPlaceholderOrder placeholderOrder = xhpcPlaceholderOrderMapper.getByPlaceholderOrderId(placeholderOrderId);
XhpcPlaceholderOrder xhpcPlaceholderOrder = new XhpcPlaceholderOrder();
xhpcPlaceholderOrder.setPlaceholderOrderId(placeholderOrderId);
xhpcPlaceholderOrder.setAppealResult(appealResult);
xhpcPlaceholderOrder.setAppealProcessTime(new Date());
if(!"reject".equals(refundType)){
//第三方处理退款
xhpcPlaceholderOrder.setUserStatus(1);
if(placeholderOrder.getTotalMoney().compareTo(actPrice)==1){
xhpcPlaceholderOrder.setRechargeMoney(placeholderOrder.getTotalMoney().subtract(actPrice));
}else {
xhpcPlaceholderOrder.setRechargeMoney(new BigDecimal(0));
}
xhpcPlaceholderOrder.setRefundMoney(actPrice);
xhpcPlaceholderOrder.setImgId(imgId);
int i = xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
if(i>0){
return R.ok();
}
}else{
return R.ok();
}
return R.fail("申述失败,请稍后再申述");
}
@Override
public List<Map<String, Object>> appealPlaceholderOrderListPC(HttpServletRequest request, String tenantId, Long operatorId, String name, Integer type, String serialNumber, Long chargingStationId) {
LoginUser loginUser = tokenService.getLoginUser(request);
@ -1552,6 +1636,7 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
startPage();
return xhpcPlaceholderOrderMapper.appealPlaceholderOrderListPC(operatorId,name, type, serialNumber, chargingStationId,userId,2,tenantId);
}else{
startPage();
if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){
list= xhpcPlaceholderOrderMapper.appealPlaceholderOrderListPC(operatorId,name, type, serialNumber, chargingStationId,userId,0,loginUser.getTenantId());
}else{
@ -1571,10 +1656,142 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
}
}
}
return list;
}
@Override
public R fileUpload(HttpServletRequest request, HttpServletResponse response, String tenantId, MultipartFile file, int type, String startTime, String endTime) throws Exception {
// 创建OSSClient实例
List<PositionFeeDto> positionFees = new ArrayList<>();
try (InputStream inputStream = file.getInputStream();
Workbook workbook = new XSSFWorkbook(inputStream)) {
Sheet sheet = workbook.getSheetAt(0); // 获取第一个sheet
// 跳过表头从第二行开始读取
for (int i = 2; i <= sheet.getLastRowNum()-1; i++) {
Row row = sheet.getRow(i);
if (row == null) continue;
// 读取订单IDA列
Cell orderIdCell = row.getCell(0);
// 读取金额B列
Cell feeCell = row.getCell(2);
if (orderIdCell != null && feeCell != null) {
String orderId = getCellStringValue(orderIdCell);
BigDecimal feeAmount = getCellNumericValue(feeCell);
if (orderId != null && !orderId.trim().isEmpty() && feeAmount != null) {
positionFees.add(new PositionFeeDto(orderId.trim(), feeAmount));
}
}
}
}
if(positionFees.size()>0){
List<PositionFeeDto> placeholderOrderExcelList =new ArrayList<>();
if(type==0){
placeholderOrderExcelList = xhpcPlaceholderOrderMapper.getPlaceholderOrderUserExcelList(positionFees);
}else{
placeholderOrderExcelList = xhpcPlaceholderOrderMapper.getPlaceholderOrderExcelList(positionFees, Long.valueOf(type));
}
List<FeeDifferenceDto> feeDifferenceDtos = compareWithDatabase(positionFees, placeholderOrderExcelList,type);
if (feeDifferenceDtos.isEmpty()) {
return R.ok(new ArrayList<>(),"对账完成,无差异");
} else {
return R.ok(feeDifferenceDtos, "发现" + feeDifferenceDtos.size() + "条差异记录");
}
}else{
return R.fail("Excel 为空");
}
}
@Override
public List<Map<String, Object>> deviceMessageList(String chargeOrderNo) {
startPage();
return xhpcPlaceholderOrderMapper.deviceMessageList(chargeOrderNo,chargeOrderNo.substring(0,16));
}
public List<FeeDifferenceDto> compareWithDatabase(List<PositionFeeDto> excelData,
List<PositionFeeDto> dbData,Integer type) {
List<FeeDifferenceDto> differences = new ArrayList<>();
// 将数据库数据转换为Map便于查找
Map<String, BigDecimal> dbFeeMap = new HashMap<>();
for (PositionFeeDto dbFee : dbData) {
dbFeeMap.put(dbFee.getOrderId(), dbFee.getFeeAmount());
}
Map<String, Integer> dbFeeMapStatus = new HashMap<>();
for (PositionFeeDto dbFee : dbData) {
dbFeeMapStatus.put(dbFee.getOrderId(), dbFee.getUserStatus());
}
// 比较每个Excel中的数据
for (PositionFeeDto excelFee : excelData) {
String orderId = excelFee.getOrderId();
BigDecimal excelAmount = excelFee.getFeeAmount();
BigDecimal dbAmount = dbFeeMap.get(orderId);
if (dbAmount == null) {
// 数据库中没有该订单
differences.add(new FeeDifferenceDto(orderId, excelAmount, null, "数据库中没有该订单"));
} else if (excelAmount.compareTo(dbAmount) != 0) {
// 金额不一致
differences.add(new FeeDifferenceDto(orderId, excelAmount, dbAmount,
"金额不一致: Excel=" + excelAmount + ", DB=" + dbAmount));
}else if(excelAmount.compareTo(dbAmount) == 0){
//是否已对账
if(dbFeeMapStatus.get(orderId)!=null){
Integer userStatus = dbFeeMapStatus.get(orderId);
if(userStatus==0){
if(type==0){
xhpcPlaceholderOrderMapper.updatePlaceholderOrderRechargeUserMoney(excelAmount,orderId);
}else{
xhpcPlaceholderOrderMapper.updatePlaceholderOrderRechargeMoney(excelAmount,orderId);
}
}else if(userStatus==1){
differences.add(new FeeDifferenceDto(orderId, excelAmount, null,"该订单已退款=" + excelFee.getRefundMoney() ));
}else{
differences.add(new FeeDifferenceDto(orderId, excelAmount, null,"该订单已对账"));
}
}else{
differences.add(new FeeDifferenceDto(orderId, excelAmount, null,"该订单需要技术人员进行核对"));
}
}
}
return differences;
}
/**
* 获取单元格字符串值
*/
private String getCellStringValue(Cell cell) {
if (cell == null) return null;
return cell.getStringCellValue();
}
/**
* 获取单元格数值
*/
private BigDecimal getCellNumericValue(Cell cell) {
if (cell == null) return null;
try {
return BigDecimal.valueOf(cell.getNumericCellValue());
} catch (Exception e) {
return null;
}
}
public static void main(String[] args) {
System.out.println("80836000100006022509051657454064".substring(0,16));
System.out.println("MA25CNM38251212065315246240".substring(0,9));
}
}

View File

@ -9,7 +9,6 @@ import com.alibaba.fastjson.JSONObject;
import com.xhpc.common.api.*;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.HttpUtils;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
@ -48,6 +47,7 @@ import java.util.concurrent.TimeUnit;
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
import static com.xhpc.common.data.redis.StaticBeanUtil.*;
import static org.bouncycastle.asn1.x500.style.RFC4519Style.serialNumber;
/**
* @author yuyang
@ -1399,11 +1399,14 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
// 另起线程处理业务上传redis数据
BigDecimal finalActPrice = actPrice;
String keyUser =xhpcChargeOrder.getSerialNumber();
redisService.deleteObject("YE"+xhpcChargeOrder.getSerialNumber());
executorService.execute(new Runnable() {
@Override
public void run() {
try{
logger.info("<<<<<<<<<<<<<<<<进行入短信发送>>>>>>>>>>>>>>>>>");
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
if(userMessage !=null && userMessage.get("phone") != null){
if("1".equals(xhpcChargingPile.get("type").toString())){
@ -1447,7 +1450,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
paramMap.put("sumMoney", balance.toString());
paramMap.put("phone", phone);
paramMap.put("content", "小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + balance + "元,充电费用明细,请查询翔桦充电小程序,谢谢。");
paramMap.put("content", "翔桦充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + balance + "元,充电费用明细,请查询翔桦充电小程序,谢谢。");
smsService.sendNotice(paramMap);
redisService.setCacheObject(phone+":"+balance.toString(), balance.toString(), 300L, TimeUnit.SECONDS);
}
@ -1467,7 +1470,6 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1);
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
try{
//双枪修改逻辑查询是否是双枪
if(xhpcChargeOrder.getSunchaStatus()!=0){
String userType =UserTypeUtil.USER;
@ -1673,15 +1675,11 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
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());
// cacheGun.put("placeholderOrderId",placeholderOrder.getPlaceholderOrderId());
// cacheGun.put("status",0);
// cacheGun.put("serialNumber",xhpcHistoryOrder.getSerialNumber());
// cacheGun.put("internetSerialNumber",xhpcHistoryOrder.getInternetSerialNumber());
// cacheGun.put("startTime",DateUtil.format(xhpcHistoryOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
//REDIS.setCacheMap(gunkey, cacheGun);
if(xhpcHistoryOrder.getTotalPrice().compareTo(new BigDecimal(0))>0){
//生成历史订单收费明细
installXhpcHistoryOrderChargeDetails(xhpcHistoryOrder);
}
}
}catch (Exception e){
e.printStackTrace();
@ -2073,7 +2071,21 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
}
@Override
public void deleteOrderCacheDate() {
String time = monthTime();
Collection<String> keys = redisService.keys("Yu80836000*");
String st1 = DateUtil.format(DateUtil.offsetDay(new Date(),-15), "yyMMdd");
int order1 =Integer.parseInt(st1);
for (String order : keys) {
String st2 = order.substring(18, 24);
int order2 =Integer.parseInt(st2);
if(order1>order2){
redisService.deleteObject(order);
}
}
}
//获今天之后一个月半后时间
@ -2157,7 +2169,6 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
return new BigDecimal(realTimeOrderTime+endTimeChargingDegree-startTimeChargingDegree).setScale(2,BigDecimal.ROUND_HALF_UP);
}
//判斷活动时间电费服务费公式是否和场站一致
private Map<String,Object> getRateOrActivityFormul(String serialNumber,Long internetUserId,Date startTime,Date endTime,Long chargingStationId,String tenantId,Long rateModelId){
Map<String,Object> map =new HashMap<>();
@ -2337,6 +2348,647 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
return orderNo;
}
//生成历史订单明细集合
private void installXhpcHistoryOrderChargeDetails(XhpcHistoryOrder horder){
List<XhpcRateTimeYuDto> xhpcRateTimes = xhpcRealTimeOrderMapper.getReatTimeList(DateUtil.formatTime(horder.getStartTime()), DateUtil.formatTime(horder.getEndTime()), horder.getRateModelId());
Stack<XhpcHistoryOrderChargeDetails> chargeDetailsStack =new Stack<>();
Map<String, Object> cacheMap = REDIS.getCacheMap("order:"+ horder.getSerialNumber());
CacheOrderData cacheOrderData = (CacheOrderData)cacheMap.get("orderData");
BigDecimal bigDecimal = new BigDecimal(10000);
int t1=0;
int t12 =2;
int t13 =3;
BigDecimal bigDecimal1 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal);
int t2 =0;
int t22 =2;
int t23 =3;
BigDecimal bigDecimal2 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal);
int t3 =0;
int t32 =2;
int t33 =3;
BigDecimal bigDecimal3 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal);
int t4 =0;
int t43 =3;
int t42 =2;
BigDecimal bigDecimal4 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal);
for (XhpcRateTimeYuDto xpcRateTime:xhpcRateTimes) {
String rateValue = xpcRateTime.getRateValue();
if("00".equals(rateValue)){
t1=t1+1;
} else if ("01".equals(rateValue)) {
t2=t2+1;
}else if ("02".equals(rateValue)) {
t3=t3+1;
}else if ("03".equals(rateValue)) {
t4=t4+1;
}
}
BigDecimal decimalYu = new BigDecimal((horder.getEndTime().getTime() - horder.getStartTime().getTime())).divide(new BigDecimal(60000),4,BigDecimal.ROUND_HALF_UP);
BigDecimal divideYu = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(new BigDecimal(10000),4,BigDecimal.ROUND_HALF_UP);
//每分钟多少度电
BigDecimal quantity =new BigDecimal(0);
if(decimalYu.compareTo(new BigDecimal(0))!=0){
quantity = decimalYu.divide(divideYu,4,BigDecimal.ROUND_HALF_UP);
}
for (XhpcRateTimeYuDto xpcRateTime:xhpcRateTimes) {
XhpcHistoryOrderChargeDetails chargeDetails = new XhpcHistoryOrderChargeDetails();
String rateValue = xpcRateTime.getRateValue();
String rateStartTime = cn.hutool.core.date.DateUtil.format(xpcRateTime.getStartTime(), "HH:mm:ss");
String orderStartTime = cn.hutool.core.date.DateUtil.format(horder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
rateStartTime = orderStartTime.substring(0,10)+" "+rateStartTime;
String rateEndTime = cn.hutool.core.date.DateUtil.format(xpcRateTime.getEndTime(), "HH:mm:ss");
String orderEndTime = cn.hutool.core.date.DateUtil.format(horder.getEndTime(), "yyyy-MM-dd HH:mm:ss");
rateEndTime = orderStartTime.substring(0,10)+" "+rateEndTime;
DateTime startTime1 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime endTime1 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
if("00".equals(rateValue)){
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t1==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t1==2){
if(t12==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
//剩余电量
bigDecimal1 = bigDecimal1.subtract(multiply);
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else{
BigDecimal multiply1 = bigDecimal1.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal1.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal1.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t12 = t12-1;
}else if(t1==3){
if(t13==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
//剩余电量
bigDecimal1 = bigDecimal1.subtract(multiply);
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t13==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal1 = bigDecimal1.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal1.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal1.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal1.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t13 = t13-1;
}
} else if ("01".equals(rateValue)) {
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t2==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t2==2){
if(t22==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal2 = bigDecimal2.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal2.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal2.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal2.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t22 = t22-1;
}else if(t2==3){
if(t23==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal2 = bigDecimal2.subtract(multiply);
}else if(t23==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal2 = bigDecimal2.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal2.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal2.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal2.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t23 = t23-1;
}
}else if ("02".equals(rateValue)) {
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t3==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t3==2){
if(t32==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal3 = bigDecimal3.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal3.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal3.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal3.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t32 = t32-1;
}else if(t3==3){
if(t33==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal3 = bigDecimal3.subtract(multiply);
}else if(t33==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal3 = bigDecimal3.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal3.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal3.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal3.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t33 = t33-1;
}
}else if ("03".equals(rateValue)) {
boolean judgeStart =false;
boolean judgeEnd =false;
if(horder.getStartTime().getTime()-startTime1.getTime()>0){
chargeDetails.setDetailStartTime(orderStartTime);
judgeStart =true;
}else{
chargeDetails.setDetailStartTime(rateStartTime);
}
if(horder.getEndTime().getTime()-endTime1.getTime()>0){
chargeDetails.setDetailEndTime(rateEndTime);
}else{
chargeDetails.setDetailEndTime(orderEndTime);
judgeEnd =true;
}
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
if(t4==1){
BigDecimal divide = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal);
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(divide.doubleValue());
chargeDetailsStack.push(chargeDetails);
}else if(t4==2){
if(t42==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal4 = bigDecimal4.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal4.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal4.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal4.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t42 = t42-1;
}else if(t4==3){
if(t43==3){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal4 = bigDecimal4.subtract(multiply);
}else if(t43==2){
if(judgeStart){
rateStartTime = orderStartTime;
}
if(judgeEnd){
rateEndTime = orderEndTime;
}
DateTime parse2 = cn.hutool.core.date.DateUtil.parse(rateStartTime, "yyyy-MM-dd HH:mm:ss");
DateTime parse3 = cn.hutool.core.date.DateUtil.parse(rateEndTime, "yyyy-MM-dd HH:mm:ss");
long betweenDay4 = cn.hutool.core.date.DateUtil.between(parse3,parse2, DateUnit.MINUTE);
//获得电量
BigDecimal multiply = quantity.multiply(new BigDecimal(betweenDay4));
BigDecimal multiply1 = multiply.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = multiply.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(multiply.doubleValue());
chargeDetailsStack.push(chargeDetails);
//剩余电量
bigDecimal4 = bigDecimal4.subtract(multiply);
}else{
BigDecimal multiply1 = bigDecimal4.multiply(xpcRateTime.getPowerFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal multiply2 = bigDecimal4.multiply(xpcRateTime.getServiceFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
chargeDetails.setElecPrice(xpcRateTime.getPowerFee().doubleValue());
chargeDetails.setSevicePrice(xpcRateTime.getServiceFee().doubleValue());
chargeDetails.setDetailElecMoney(multiply1.doubleValue());
chargeDetails.setDetailSeviceMoney(multiply2.doubleValue());
chargeDetails.setDetailPower(bigDecimal4.doubleValue());
chargeDetailsStack.push(chargeDetails);
}
t43 = t43-1;
}
}
}
//写入数据库
for (int i = 0; i <chargeDetailsStack.size() ; i++) {
XhpcHistoryOrderChargeDetails xhpcHistoryOrderChargeDetails = chargeDetailsStack.get(i);
xhpcHistoryOrderChargeDetails.setHistoryOrdersId(horder.getHistoryOrderId());
xhpcHistoryOrderChargeDetails.setStartTime(DateUtil.format(horder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
xhpcHistoryOrderChargeDetails.setEndTime(DateUtil.format(horder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
xhpcHistoryOrderChargeDetails.setTotalPower(horder.getTotalPower());
xhpcHistoryOrderChargeDetails.setTotalElecMoney(horder.getPowerPriceTotal().doubleValue());
xhpcHistoryOrderChargeDetails.setTotalSeviceMoney(horder.getServicePriceTotal().doubleValue());
xhpcHistoryOrderChargeDetails.setTotalMoney(horder.getTotalPrice().doubleValue());
xhpcRealTimeOrderMapper.insertXhpcHistoryOrderChargeDetails(xhpcHistoryOrderChargeDetails);
}
}
public static void main(String[] args) {
// WxMessageSend("ot6ul4nlSC5ZZOC4rTLS5hedFTGk","69_G2hFrelhCsfOPuFB6OPP5I8j_DKdP-N6QF-shvpUFT2mQ-KjonSxbS_mrP5P9nYyat9OsJLZAcbYA4g5rWdn0i6whxueiU3hWfguoeqSnick1zAGvu7SKa50_VkKPAcAGABGR","黄金东二路","80","76.6");
@ -2349,6 +3001,18 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
DateTime dateTime = DateUtil.offset(parse, DateField.MILLISECOND,10000);
String format = DateUtil.format(dateTime, "yyyy-MM-dd HH:mm:ss");
System.out.println("format====:"+format);
String formatYu = DateUtil.format(DateUtil.offsetDay(new Date(),-15), "yyMMdd");
System.out.println("formatYu====:"+formatYu);
String st ="Yu80836000010002012512220705512852";
System.out.println("formatYu====:"+st.substring(18,24));
}

View File

@ -1203,8 +1203,8 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
//1 近30天 2上个月 3本月 4.近12月
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
Long logUserId = SecurityUtils.getUserId();
SysUser sysUser = loginUser.getSysUser();
Long logUserId = sysUser.getUserId();
//今日订单量
//今天时间格式 yyyy-mm-dd
Date date = new Date();

View File

@ -72,8 +72,21 @@ public class ScheduledTasks {
/**
* 定时任务相同桩号前一个订单已结束本次订单响应结束
*/
@Scheduled(cron = "0 0/10 * * * ? ")
// @Scheduled(cron = "0 0/10 * * * ? ")
public void getxhpcPlaceholderOrderTasks() {
xhpcPlaceholderOrderService.getxhpcPlaceholderOrderTasks();
}
//定时清理推送订单数据保留
@Scheduled(cron = "0 0 11 * * ? ")
public void deleteOrderCacheDate(){
xhpcRealTimeOrderService.deleteOrderCacheDate();
}
}

View File

@ -53,7 +53,7 @@
<select id="duplicateStatistics" resultType="int">
select count(*) from xhpc_charging_station_power
where `status`=#{number} and charging_station_id=#{chargingStationId} and terminal_id =#{terminalId} and create_time like concat(#{subTime}, '%')
where `status`=#{number} and charging_station_id=#{chargingStationId} and terminal_id =#{terminalId} and create_time like concat(#{subTime}, '%') and create_time &gt;= #{createTime}
</select>
<select id="getXhpcTerminals" resultType="map">

View File

@ -61,6 +61,7 @@
<result column="activity_id" jdbcType="VARCHAR" property="activityId"/>
<result column="parking_voucher" jdbcType="INTEGER" property="parkingVoucher"/>
</resultMap>
<sql id="Base_Column_List">
history_order_id, charging_station_id, charge_order_id, user_id, terminal_id, serial_number,
internet_serial_number, power_price_total, service_price_total, total_price, promotion_discount,
@ -1048,6 +1049,13 @@
ho.stop_reason_evcs as stopReasonEvcs,
cop.account as communityAccount,
cup.account as customersAccount,
-- CASE
-- WHEN xpo.source IN (0, 2, 3) THEN xpo.act_price
-- WHEN xpo.source = 1 AND xpo.user_id = 3 THEN xpo.recharge_money
-- WHEN xpo.source = 1 AND xpo.user_id IN (1, 2, 4, 7) THEN xpo.total_money
-- ELSE 0
-- END AS placeholderTotalMoney,
case when co.source=0 then "C端用户"
when co.source=1 then "流量方用户"
when co.source=2 then "社区用户"
@ -1078,6 +1086,7 @@
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_charge_order co on co.charge_order_id = ho.charge_order_id
-- left join xhpc_placeholder_order xpo on xpo.history_order_id = ho.history_order_id
<if test="number==1">
inner join (
select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where xau.phone LIKE concat('%',#{phone}, '%')
@ -1764,4 +1773,110 @@
limit 1
</select>
<select id="getFileUpload" resultType="com.xhpc.order.dto.XhpcHistoryOrderYuDto">
select
ho.history_order_id as historyOrderId,
co.charge_order_id as chargeOrderId,
ho.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.power as power,
cp.type as type,
ho.type as orderType,
ho.start_soc as startSoc,
ho.end_soc as endSoc,
ho.vin_normal as vinCode,
ho.internet_serial_number as internetSerialNumber,
ho.evcs_order_no as evcsOrderNo,
ho.total_price as totalPrice,
ho.act_price as actPrice,
ho.confirm_Result as confirmResult,
co.charging_time as chargingTime,
ho.total_power as chargingDegree,
ho.start_time as startTime,
ho.end_time as endTime,
co.update_time as updateTime,
co.source as source,
co.Plate_num as plateNum,
dispute_order_status as disputeOrderStatus,
co.driver_id as internetUserPhone,
inu.name as internetName,
apu.phone as appUserPhone,
ho.power_price_total as powerPriceTotal,
ho.service_price_total as servicePriceTotal,
ho.promotion_discount as promotionDiscount,
ho.activity_power_price_total as activityPowerPriceTotal,
ho.activity_service_price_total as activityServicePriceTotal,
ho.activity_total_price as activityTotalPrice,
ho.act_power_price as actPowerPrice,
ho.act_service_price as actServicePrice,
(ho.act_power_price+ho.act_service_price) as actSumPrice,
ho.internet_commission as internetCommission,
ho.internet_svc_commission as internetSvcCommission,
ho.internet_degree_commission as internetDegreeCommission,
ho.platform_commission as platformCommission,
ho.platform_svc_commisssion as platformSvcCommisssion,
ho.operation_commission as operationCommission,
ho.operation_svc_commission as operationSvcCommission,
ho.stop_reason_evcs as stopReasonEvcs,
cop.account as communityAccount,
cup.account as customersAccount,
case when co.source=0 then "C端用户"
when co.source=1 then "流量方用户"
when co.source=2 then "社区用户"
else "B端客户!"
end sourceName,
case when ho.parking_voucher=1 then '否'
else '是'
end as 'barrierGateRecordName',
case when ho.charging_mode="1" then "快电"
when ho.charging_mode="2" then "恒大"
when ho.charging_mode="3" then "新电途"
when ho.charging_mode="4" then "小桔"
when ho.charging_mode="7" then "车为家"
when ho.charging_mode="微信" then "微信"
when ho.charging_mode="支付宝" then "支付宝"
when ho.charging_mode="App" then "App"
when ho.charging_mode="刷卡" then "刷卡"
else "vin码"
end chargingModeName
from xhpc_history_order as 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_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 et_dispute_orders as ed on ed.start_charge_seq = ho.internet_serial_number and ed.dispute_order_status !=2
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_charge_order co on co.charge_order_id = ho.charge_order_id
where ho.status =0 and ho.del_flag=0
<if test="mapLst != null and mapLst.size > 0">
and ho.internet_serial_number in
<foreach collection="mapLst" item="id" open="(" separator="," close=")">
#{id.internetSerialNumber}
</foreach>
</if>
order by ho.end_time desc
</select>
<select id="getXhpcHistoryOrderChargeDetailsList" resultType="map">
select
concat(detail_start_time," 至 ",detail_end_time) as time,
elec_price as powerPrice,
sevice_price as servicePrice,
detail_power as chargingDegree,
detail_elec_money as detailElecMoney,
detail_sevice_money as detailSeviceMoney
from xhpc_history_order_charge_details
where history_order_id=#{historyOrderId} and del_flag=0
order by create_time asc
</select>
</mapper>

View File

@ -161,10 +161,7 @@
</select>
<select id="getPileSerialNumber" resultType="map">
select
xcp.serial_number serialNumber,
xcp.charging_station_id chargingStationId,
xcs.rate_model_id rateModelId
select xcp.serial_number serialNumber, xcp.charging_station_id chargingStationId, xcs.rate_model_id rateModelId
from xhpc_charging_pile xcp
join xhpc_charging_station xcs on xcs.charging_station_id = xcp.charging_station_id and xcs.del_flag =0
where xcp.del_flag =0

View File

@ -56,6 +56,7 @@
<result column="appeal_time" property="appealTime"/>
<result column="appeal_process_time" property="appealProcessTime"/>
<result column="appeal_refund_money" property="appealRefundMoney"/>
<result column="img_id" property="imgId"/>
</resultMap>
<insert id="insertXhpcPlaceholderOrder" parameterType="com.xhpc.order.domain.XhpcPlaceholderOrder"
@ -340,7 +341,19 @@
appeal_process_time = #{appealProcessTime},
</if>
<if test="appealRefundMoney !=null">
appeal_refund_money =#{appealRefundMoney}
appeal_refund_money =#{appealRefundMoney},
</if>
<if test="userStatus !=null">
user_status =#{userStatus},
</if>
<if test="rechargeMoney !=null">
recharge_money =#{rechargeMoney},
</if>
<if test="refundMoney !=null">
refund_money =#{refundMoney},
</if>
<if test="imgId !=null">
img_id =#{imgId},
</if>
</set>
where placeholder_order_id = #{placeholderOrderId}
@ -360,6 +373,8 @@
ho.internet_serial_number as internetSerialNumber,
ho.start_time as startTime,
ho.end_time as endTime,
ho.recharge_money as rechargeMoney,
ho.refund_money as refundMoney,
ho.source as source,
TIMESTAMPDIFF(MINUTE, IFNULL(ho.start_time, NOW()), NOW()) minutes,
case when ho.source=0 then "C端用户"
@ -397,6 +412,10 @@
cop.account as communityAccount,
cup.account as customersAccount,
ho.driver_id as internetUserPhone,
ho.user_status as userStatus,
ho.act_price as actPrice,
ho.appeal_recharge_money as appealRechargeMoney,
ho.appeal_refund_money as appealRefundMoney,
ho.plate_num as plateNum,
case when ho.charging_mode="1" then "快电"
when ho.charging_mode="2" then "恒大"
@ -565,6 +584,7 @@
when ho.charging_mode="2" then "恒大"
when ho.charging_mode="3" then "新电途"
when ho.charging_mode="4" then "小桔"
when ho.charging_mode="7" then "车为家"
when ho.charging_mode="微信" then "微信"
when ho.charging_mode="支付宝" then "支付宝"
when ho.charging_mode="App" then "App"
@ -905,7 +925,7 @@
ifnull(xho.total_price,0) as totalPrice,
xpo.serial_number as serialNumber,
xho.tenant_id as tenantId,
DATE_FORMAT( xho.start_time, "%Y-%m-%d %H:%i:%s" ) startTime,
DATE_FORMAT( xpo.start_time, "%Y-%m-%d %H:%i:%s" ) startTime,
xho.source as source,
xpo.placeholder_order_id as placeholderOrderId
from xhpc_placeholder_order xpo
@ -922,7 +942,8 @@
</select>
<select id="getXhpcDeviceMessage" resultType="map">
SELECT create_time
SELECT
date_format(create_time, '%Y-%m-%d %H:%i:%s') as createTime
FROM xhpc_device_message
WHERE gun_number = #{chargeOrderNo}
AND create_time &gt;=#{createTime}
@ -939,30 +960,30 @@
<select id="getSumSourceList" resultType="map">
select
SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END) AS "kudaiDianMoney",
SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END) AS "henDaMoney",
SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END) AS "xinDianTuMoney",
format(ifnull(sum(ss.refund_money),0), 2) refundMoney,
format(ifnull(sum(ss.recharge_money),0),2) rechargeMoney,
SUM(CASE WHEN ss.charging_mode = 4 THEN total_money ELSE 0 END) AS "xiaoJuMoney",
SUM(CASE WHEN ss.charging_mode = 7 THEN total_money ELSE 0 END) AS "cheWeiJiaMoney",
SUM(CASE WHEN ss.charging_mode = 'C端用户' THEN act_price ELSE 0 END) AS "CDuanMoney",
SUM(CASE WHEN ss.charging_mode = '社区用户' THEN act_price ELSE 0 END) AS "sheQuMoney",
SUM(CASE WHEN ss.charging_mode = 'B端用户' THEN act_price ELSE 0 END) AS "BDuanMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END),0) AS "kudaiDianMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END),0) AS "henDaMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END),0) AS "xinDianTuMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 1 THEN refund_money ELSE 0 END),0) "kudaiDianRefundMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 1 THEN recharge_money ELSE 0 END),0) "kudaiDianRechargeMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 3 THEN refund_money ELSE 0 END),0) "xinDianTuRefundMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 3 THEN recharge_money ELSE 0 END),0) "xinDianTuRechargeMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 4 THEN total_money ELSE 0 END),0) AS "xiaoJuMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 7 THEN total_money ELSE 0 END),0) AS "cheWeiJiaMoney",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN act_price ELSE 0 END),0) AS "actPrice",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_recharge_money ELSE 0 END),0) AS "appealRechargeMoney",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_refund_money ELSE 0 END),0) AS "appealRefundMoney",
case
when ss.charging_mode=1 then "快电"
when ss.charging_mode=2 then "恒大"
when ss.charging_mode=3 then "新电途"
when ss.charging_mode=4 then "小桔"
when ss.charging_mode=7 then "车为家"
when ss.charging_mode='社区用户' then "社区用户"
when ss.charging_mode='B端用户' then "B端用户"
else "C端用户"
else "平台用户"
end sourceName
from xhpc_placeholder_order as ss
left join xhpc_charging_station cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_operator xo on cs.operator_id = xo.operator_id
where ss.del_flag=0 and (ss.status=3 or ss.status=9 or ss.status=10) and ss.type=1
where ss.del_flag=0 and ss.type=1
<if test="startTime !=null and startTime !=''">
and ss.start_time &gt;= #{startTime}
</if>
@ -996,25 +1017,37 @@
<if test="number==2">
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{sysUserId})
</if>
group by ss.charging_mode
group by
CASE
WHEN ss.charging_mode = 1 THEN '快电'
WHEN ss.charging_mode = 2 THEN '恒大'
WHEN ss.charging_mode = 3 THEN '新电途'
WHEN ss.charging_mode = 4 THEN '小桔'
WHEN ss.charging_mode = 7 THEN '车为家'
ELSE '平台用户'
END
</select>
<select id="getDateIntervalPage" resultType="map">
select
DATE(ss.create_time) AS createTime,
SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END) AS "kudaiDianMoney",
SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END) AS "henDaMoney",
SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END) AS "xinDianTuMoney",
format(ifnull(sum(ss.refund_money),0), 2) refundMoney,
format(ifnull(sum(ss.recharge_money),0),2) rechargeMoney,
SUM(CASE WHEN ss.charging_mode = 4 THEN total_money ELSE 0 END) AS "xiaoJuMoney",
SUM(CASE WHEN ss.charging_mode = 7 THEN total_money ELSE 0 END) AS "cheWeiJiaMoney",
SUM(CASE WHEN ss.source = 0 THEN act_price ELSE 0 END) AS "actPrice"
ifnull(SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END,0) AS "kudaiDianMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END),0) AS "henDaMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END),0) AS "xinDianTuMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 1 THEN refund_money ELSE 0 END),0) "kudaiDianRefundMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 1 THEN recharge_money ELSE 0 END),0) "kudaiDianRechargeMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 3 THEN refund_money ELSE 0 END),0) "xinDianTuRefundMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 3 THEN recharge_money ELSE 0 END),0) "xinDianTuRechargeMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 4 THEN total_money ELSE 0 END),0) AS "xiaoJuMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 7 THEN total_money ELSE 0 END),0) AS "cheWeiJiaMoney",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN act_price ELSE 0 END),0) AS "actPrice",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_recharge_money ELSE 0 END),0) AS "appealRechargeMoney",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_refund_money ELSE 0 END),0) AS "appealRefundMoney"
from xhpc_placeholder_order ss
left join xhpc_charging_station cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_operator xo on cs.operator_id = xo.operator_id
where ss.del_flag=0 and (ss.status=3 or ss.status=9 or ss.status=10) and ss.type=1
where ss.del_flag=0 and ss.type=1
<if test="chargingStationIds !=null and chargingStationIds.size()>0">
and ss.charging_station_id in
<foreach collection="chargingStationIds" open="(" item="chargingStationId" separator="," close=")" >
@ -1048,20 +1081,24 @@
<select id="getStationIntervalPage" resultType="map">
select
SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END) AS "kudaiDianMoney",
SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END) AS "henDaMoney",
SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END) AS "xinDianTuMoney",
format(ifnull(sum(ss.refund_money),0), 2) refundMoney,
format(ifnull(sum(ss.recharge_money),0),2) rechargeMoney,
SUM(CASE WHEN ss.charging_mode = 4 THEN total_money ELSE 0 END) AS "xiaoJuMoney",
SUM(CASE WHEN ss.charging_mode = 7 THEN total_money ELSE 0 END) AS "cheWeiJiaMoney",
SUM(CASE WHEN ss.source = 0 THEN act_price ELSE 0 END) AS "actPrice",
ifnull(SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END),0) AS "kudaiDianMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END),0) AS "henDaMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END),0) AS "xinDianTuMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 1 THEN refund_money ELSE 0 END),0) "kudaiDianRefundMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 1 THEN recharge_money ELSE 0 END),0) "kudaiDianRechargeMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 3 THEN refund_money ELSE 0 END),0) "xinDianTuRefundMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 3 THEN recharge_money ELSE 0 END),0) "xinDianTuRechargeMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 4 THEN total_money ELSE 0 END),0) AS "xiaoJuMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 7 THEN total_money ELSE 0 END),0) AS "cheWeiJiaMoney",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN act_price ELSE 0 END),0) AS "actPrice",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_recharge_money ELSE 0 END),0) AS "appealRechargeMoney",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_refund_money ELSE 0 END),0) AS "appealRefundMoney",
cs.name as chargingStationName,
xo.name operatorName
from xhpc_placeholder_order as ss
left join xhpc_charging_station cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_operator xo on cs.operator_id = xo.operator_id
where ss.del_flag=0 and (ss.status=3 or ss.status=9 or ss.status=10) and ss.type=1
where ss.del_flag=0 and ss.type=1
<if test="startTime !=null and startTime !=''">
and ss.start_time &gt;= #{startTime}
</if>
@ -1105,6 +1142,7 @@
ct.name as stationName,
ter.name as terminalName,
ho.appeal_refund_money as appealRefundMoney,
ho.img_id as imgId,
ho.start_time as placeholderStartTime,
ho.end_time as placeholderEndTime,
ho.total_time_span as placeholderTotalTimeSpen,
@ -1118,6 +1156,10 @@
ho.appeal_result as appealResult,
ho.appeal_user_result as appealUserResult,
ho.appeal_time as appealTime,
CASE
WHEN ho.create_time > DATE_SUB(NOW(), INTERVAL 14 DAY) THEN 1
ELSE 0
END AS canAppeal,
ho.appeal_process_time as appealProcessTime
from xhpc_placeholder_order ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
@ -1146,6 +1188,7 @@
when ho.appeal_status=2 then "申述成功"
else "申述失败"
end appealStatusText,
ho.img_id as imgId,
ho.appeal_result as appealResult,
ho.appeal_user_result as appealUserResult,
ho.appeal_time as appealTime,
@ -1178,4 +1221,114 @@
</if>
order by ho.create_time desc
</select>
<select id="getPlaceholderOrderExcelList" resultType="com.xhpc.order.dto.PositionFeeDto">
SELECT
placeholder_order_number as orderId,
total_money as feeAmount,
ifnull(user_status,0) as userStatus,
refund_money as refundMoney
FROM xhpc_placeholder_order
WHERE source =1 and user_id=#{userId}
<if test="mapLst != null and mapLst.size > 0">
and placeholder_order_number in
<foreach collection="mapLst" item="id" open="(" separator="," close=")">
#{id.orderId}
</foreach>
</if>
</select>
<select id="getPlaceholderOrderUserExcelList" resultType="com.xhpc.order.dto.PositionFeeDto">
SELECT
placeholder_order_number as orderId,
total_money as feeAmount,
user_status as userStatus,
refund_money as refundMoney
FROM xhpc_placeholder_order
WHERE source !=1
<if test="mapLst != null and mapLst.size > 0">
and placeholder_order_number in
<foreach collection="mapLst" item="id" open="(" separator="," close=")">
#{id.orderId}
</foreach>
</if>
</select>
<update id="updatePlaceholderOrderRechargeMoney">
update xhpc_placeholder_order set recharge_money=#{rechargeMoney},user_status=2 where placeholder_order_number=#{placeholderOrderNumber}
</update>
<update id="updatePlaceholderOrderRechargeUserMoney">
update xhpc_placeholder_order set appeal_recharge_money=#{rechargeMoney},act_settlement=2 where placeholder_order_number=#{placeholderOrderNumber}
</update>
<select id="deviceMessageList" resultType="map">
SELECT
device_message_id as deviceMessageId,
create_time as createTime,
charge_order_no as chargeOrderNo,
gun_status as gunStatus,
gun_number AS gunNumber,
remark,
CASE
WHEN gun_status = 0 THEN '未插枪'
WHEN gun_status = 1 THEN '已插枪'
ELSE '已插枪'
END gunStatusName
FROM `xhpc_device_message`
WHERE `device_message_id` >= (
SELECT `device_message_id`
FROM `xhpc_device_message`
WHERE `remark` = '充电交易结算记录'
AND `charge_order_no` = #{chargeOrderNo}
ORDER BY `device_message_id` ASC
LIMIT 1
)
AND `device_message_id` &lt;= (
SELECT MIN(`device_message_id`)
FROM `xhpc_device_message`
WHERE `gun_status` = 0
AND `gun_number` = #{gunNumber}
AND `device_message_id` &gt;= (
SELECT `device_message_id`
FROM `xhpc_device_message`
WHERE `remark` = '充电交易结算记录'
AND `charge_order_no` = #{chargeOrderNo}
ORDER BY `device_message_id` ASC
LIMIT 1
)
)
and (`charge_order_no` = #{chargeOrderNo} or `gun_number` = #{gunNumber})
ORDER BY `device_message_id` ASC
</select>
<select id="getType" resultType="map">
select placeholder_order_id as placeholderOrderId,
source,
internet_serial_number as internetSerialNumber,
serial_number AS serialNumber,
DATE_FORMAT(start_time,'%Y-%m-%d %H:%i:%s') as startTime
from xhpc_placeholder_order
where (type =3 or type=2) and TIMESTAMPDIFF(MINUTE, IFNULL(start_time, NOW()), NOW()) &gt; 360
LIMIT 20
</select>
<select id="getXhpcPlaceholderOrderType" resultType="map">
SELECT DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') as createTime
FROM `xhpc_device_message`
WHERE `gun_status` = 0
AND `gun_number` = #{gunNumber}
AND `device_message_id` &gt;= (
SELECT `device_message_id`
FROM `xhpc_device_message`
WHERE `remark` = '充电交易结算记录'
AND `charge_order_no` = #{chargeOrderNo}
ORDER BY `device_message_id` ASC
LIMIT 1
)
ORDER BY `device_message_id` ASC LIMIT 1
</select>
</mapper>

View File

@ -37,6 +37,24 @@
<result column="terminal_id" property="terminalId"/>
</resultMap>
<resultMap id="XhpcRateTimeResultMapYu" type="com.xhpc.order.dto.XhpcRateTimeYuDto">
<result property="rateTimeId" column="rate_time_id"/>
<result property="chargingStationId" column="charging_station_id"/>
<result property="rateId" column="rate_id"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="powerFee" column="power_fee"/>
<result property="serviceFee" column="service_fee"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="rateModelId" column="rate_model_id"/>
<result property="sort" column="sort"/>
<result property="type" column="type"/>
<result property="rateValue" column="rate_value"/>
<result property="policyCode" column="policy_code"/>
<result property="policyName" column="policy_name"/>
</resultMap>
<insert id="insertXhpcRealTimeOrder" parameterType="com.xhpc.order.domain.XhpcRealTimeOrder" useGeneratedKeys="true"
keyProperty="realTimeOrderId">
insert into xhpc_real_time_order
@ -1233,9 +1251,6 @@
<if test="null != tenantId ">
tenant_id,
</if>
<if test="null != tenantId ">
tenant_id,
</if>
<if test="null != serialNumber and '' != serialNumber">
serial_number,
</if>
@ -1318,5 +1333,156 @@
from xhpc_placeholder where del_flag =0 and status =1 and NOW() &gt;= start_time AND NOW() &lt;= end_time and charging_station_id =#{chargingStationId}
</select>
<select id="getReatTimeList" resultMap="XhpcRateTimeResultMapYu">
select
xrt.*,
xr.power_fee as power_fee,
xr.service_fee as service_fee
from xhpc_rate_time as xrt
left join xhpc_rate xr on xr.rate_id = xrt.rate_id
WHERE
xrt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{startTime}
)
<if test="endTime !='' and endTime !=null and endTime !='00:00:00' ">
<if test="endTime !='24:00:00' ">
or xrt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{endTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{endTime}
)
or xrt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &gt;= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') &lt;= #{endTime}
)
</if>
</if>
and xrt.rate_model_id = #{rateModelId}
</select>
<insert id="insertXhpcHistoryOrderChargeDetails">
insert into xhpc_history_order_charge_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != historyOrdersId ">
history_order_id,
</if>
<if test="null != detailStartTime ">
detail_start_time,
</if>
<if test="null != detailEndTime ">
detail_end_time,
</if>
<if test="null != elecPrice ">
elec_price,
</if>
<if test="null != sevicePrice ">
sevice_price,
</if>
<if test="null != detailPower ">
detail_power,
</if>
<if test="null != detailElecMoney ">
detail_elec_money,
</if>
<if test="null != detailSeviceMoney ">
detail_sevice_money,
</if>
<if test="null != startTime ">
start_time,
</if>
<if test="null != endTime ">
end_time,
</if>
<if test="null != totalPower ">
total_power,
</if>
<if test="null != totalElecMoney ">
total_elec_money,
</if>
<if test="null != totalSeviceMoney ">
total_sevice_money,
</if>
<if test="null != totalMoney ">
total_money,
</if>
<if test="null != status ">
status,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy ">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy ">
update_by,
</if>
<if test="null != remark ">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != historyOrdersId ">
#{historyOrdersId},
</if>
<if test="null != detailStartTime ">
#{detailStartTime},
</if>
<if test="null != detailEndTime ">
#{detailEndTime},
</if>
<if test="null != elecPrice ">
#{elecPrice},
</if>
<if test="null != sevicePrice ">
#{sevicePrice},
</if>
<if test="null != detailPower ">
#{detailPower},
</if>
<if test="null != detailElecMoney ">
#{detailElecMoney},
</if>
<if test="null != detailSeviceMoney ">
#{detailSeviceMoney},
</if>
<if test="null != startTime ">
#{startTime},
</if>
<if test="null != endTime ">
#{endTime},
</if>
<if test="null != totalPower ">
#{totalPower},
</if>
<if test="null != totalElecMoney ">
#{totalElecMoney},
</if>
<if test="null != totalSeviceMoney ">
#{totalSeviceMoney},
</if>
<if test="null != totalMoney ">
#{totalMoney},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy ">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy ">
#{updateBy},
</if>
<if test="null != remark ">
#{remark},
</if>
</trim>
</insert>
</mapper>

View File

@ -412,6 +412,17 @@ public class AlipayPaymentController {
String s1 =money.multiply(new BigDecimal(100)).toString();
startChargingData.setBalance(Double.valueOf(s1).intValue());
R r = powerPileService.refreshBalance(startChargingData);
//修改订单充电下发的金额
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+serialMumber);
if(cacheMap.get("initBalance") !=null){
cacheMap.put("initBalance",Double.valueOf(money.multiply(new BigDecimal(10000)).toString()).intValue());
redisService.setCacheMap("order:"+serialMumber,cacheMap);
redisService.setCacheObject("YE"+serialMumber,money);
}
logger.info("<<<<<<<<<<<<余额下发>>>>>>>>>"+s1);
logger.info("<<<<<<<<<<<<"+r.getCode()+">>>>>>>>>");
logger.info("<<<<<<<<<<<<"+r.getMsg()+">>>>>>>>>");

View File

@ -552,6 +552,16 @@ public class WxPaymentController {
logger.info("<<<<<<<<<<<<余额下发>>>>>>>>>"+s1);
logger.info("<<<<<<<<<<<<"+r.getCode()+">>>>>>>>>");
logger.info("<<<<<<<<<<<<"+r.getMsg()+">>>>>>>>>");
//修改订单充电下发的金额
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+serialMumber);
if(cacheMap.get("initBalance") !=null){
cacheMap.put("initBalance",Double.valueOf(money.multiply(new BigDecimal(10000)).toString()).intValue());
redisService.setCacheMap("order:"+serialMumber,cacheMap);
redisService.setCacheObject("YE"+serialMumber,money);
}
if(r.getCode() !=200){
//创建定时任务

View File

@ -238,6 +238,9 @@ public class XhpcRefundOrderController extends BaseController {
Map<String, Object> map = list.get(i);
if(map.get("balance") !=null && new BigDecimal(0).compareTo(new BigDecimal(map.get("balance").toString()))==0){
iXhpcRefundOrderService.updateXhpcRefundOrder(Long.valueOf(map.get("refundOrderId").toString()));
}else if(new BigDecimal(0).compareTo(new BigDecimal(map.get("balance").toString()))< 0){
//修改请求数据
iXhpcRefundOrderService.updateXhpcRefundOrderBalance(Long.valueOf(map.get("refundOrderId").toString()),map.get("balance").toString());
}
}
}
@ -248,6 +251,30 @@ public class XhpcRefundOrderController extends BaseController {
}
}
//没在充电中异常订单
//没十分钟查询一下审核失败的订单当用户有金额时且对应不上订单删除生成新的订单
//金额对应的上重新审核
@Scheduled(cron = "0 0/10 * * * ? ")
public void abnormalPaymentOrder(){
logger.info("++++++++++++每5分扫描一次在管理员审核状态中用户金额为0时去掉该记录++++++++++++++++");
try {
List<Map<String, Object>> list = iXhpcRefundOrderService.administratorReview();
if(list !=null && list.size()>0){
for (int i = 0; i <list.size() ; i++) {
Map<String, Object> map = list.get(i);
if(map.get("balance") !=null && new BigDecimal(0).compareTo(new BigDecimal(map.get("balance").toString()))==0){
iXhpcRefundOrderService.updateXhpcRefundOrder(Long.valueOf(map.get("refundOrderId").toString()));
}
}
}
}catch (Exception e){
logger.info("++++++++++++管理员审核异常++++++++++++++++");
e.printStackTrace();
//后期可以增加短信通知
}
}

View File

@ -131,4 +131,6 @@ public interface XhpcRefundOrderMapper {
List<Map<String, Object>> administratorReview();
void updateXhpcRefundOrder(@Param("refundOrderId")Long refundOrderId);
void updateXhpcRefundOrderBalance(@Param("refundOrderId")Long refundOrderId,@Param("balance")String balance);
}

View File

@ -131,4 +131,7 @@ public interface IXhpcRefundOrderService {
List<Map<String, Object>> administratorReview();
void updateXhpcRefundOrder(Long refundOrderId);
//修改请求数据
void updateXhpcRefundOrderBalance(Long refundOrderId,String balance);
}

View File

@ -305,4 +305,9 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
xhpcRefundOrderMapper.updateXhpcRefundOrder(refundOrderId);
}
@Override
public void updateXhpcRefundOrderBalance(Long refundOrderId,String balance) {
xhpcRefundOrderMapper.updateXhpcRefundOrder(refundOrderId);
}
}

View File

@ -372,9 +372,8 @@
xau.balance as balance
from xhpc_refund_order xro
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id and xro.source =0
where xro.del_flag = 0 and xro.status !=1 and xro.examine_status !=1
where xro.del_flag = 0 and ((xro.examine_status = 0 AND xro.status =4) or (xro.examine_status = 1 AND (xro.status =0 or xro.status =4)))
AND xro.create_time > DATE_SUB(NOW(), INTERVAL 30 MINUTE)
ORDER BY xro.create_time DESC
</select>
@ -382,5 +381,15 @@
update xhpc_refund_order set del_flag =1 where refund_order_id =#{refundOrderId}
</update>
<update id="updateXhpcRefundOrderBalance">
update xhpc_refund_order
set amount = #{balance},
examine_status = 0,
status = 0,
update_time = NOW()
where refund_order_id = #{refundOrderId}
and del_flag = 0
and examine_status = 1
and status in (0, 4)
</update>
</mapper>

View File

@ -45,13 +45,27 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic {
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString()));
String version = (String) cachePile.get("version");
Integer rateModelId = pileRateModelConfigReplyData.getRateModelId();
if (!"0A".equals(version) && !"0B".equals(version)) {
// if (!"0A".equals(version) && !"0B".equals(version)) {
// Long stationRateModelId = cacheStation.getRateModelId();
// if (stationRateModelId.intValue() == rateModelId) {
// cachePile.put("rateModelId", cacheStation.getRateModelId());
// result = OK;
// }
// } else {
// cachePile.put("rateModelId", cacheStation.getRateModelId());
// result = OK;
// }
if ( "0F".equals(version)) {
System.out.println("==========0X57======");
cachePile.put("rateModelId", cacheStation.getRateModelId());
result = OK;
} else if("0C".equals(version)){
Long stationRateModelId = cacheStation.getRateModelId();
if (stationRateModelId.intValue() == rateModelId) {
cachePile.put("rateModelId", cacheStation.getRateModelId());
result = OK;
}
} else {
}else {
cachePile.put("rateModelId", cacheStation.getRateModelId());
result = OK;
}

View File

@ -66,12 +66,22 @@ public class RateModelRequestLogic implements ServiceLogic {
String rateModel = translate(cacheRateModel);
String skey = "pile:".concat(pileNo).concat(".seqhex");
String resultStr;
if (!"0C".equals(version))
// if (!"0C".equals(version))
// resultStr = "685E".concat(seqHex(skey)).concat(svc).concat(pileNo).concat(String.format("%04X",
// stationRateModelId)).concat(rateModel);
// else
// resultStr =
// "6860".concat(seqHex(skey)).concat(svc).concat(pileNo).concat(HexUtils.toHexInt(stationRateModelId)).concat(rateModel);
if ("0F".equals(version)) {
resultStr = "685E".concat(seqHex(skey)).concat(svc).concat(pileNo).concat(String.format("%04X",
stationRateModelId)).concat(rateModel);
else
}else if("0C".equals(version)){
resultStr =
"6860".concat(seqHex(skey)).concat(svc).concat(pileNo).concat(HexUtils.toHexInt(stationRateModelId)).concat(rateModel);
}else{
resultStr = "685E".concat(seqHex(skey)).concat(svc).concat(pileNo).concat(String.format("%04X",
stationRateModelId)).concat(rateModel);
}
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
return resultStr;
}

View File

@ -54,8 +54,17 @@ public class RateModelValidateLogic implements ServiceLogic {
String hexCode = ServiceResult.HEX_00;
Long rateModelId;
String version = (String) cachePile.get("version");
if ("0C".equals(version)) rateModelId = Long.valueOf(rateModelIdStr);
else rateModelId = Long.valueOf(Integer.parseInt(rateModelIdStr, 16));
// if ("0C".equals(version)) rateModelId = Long.valueOf(rateModelIdStr);
// else rateModelId = Long.valueOf(Integer.parseInt(rateModelIdStr, 16));
if("0F".equals(version)){
rateModelId = Long.valueOf(rateModelIdStr);
} else if ("0C".equals(version)){
rateModelId = Long.valueOf(rateModelIdStr);
} else{
rateModelId = Long.valueOf(Integer.parseInt(rateModelIdStr, 16));
}
Long csRateModelId = rateModelId;
if (!charging) {
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString()));
@ -69,13 +78,27 @@ public class RateModelValidateLogic implements ServiceLogic {
String seq = seqHex(skey);
String resultStr;
if (!"0C".equals(version)){
// if (!"0C".equals(version)){
// resultStr = "680E".concat(seq).concat("0006").concat(pileNo).concat(String.format("%04X", csRateModelId)).concat(hexCode);
// resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
// }else{
// resultStr = "6810".concat(seq).concat("0006").concat(pileNo).concat(HexUtils.toHexInt(csRateModelId)).concat(hexCode);
// resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
// }
if ("0F".equals(version)){
System.out.println("==========0X05======");
resultStr = "680E".concat(seq).concat("0006").concat(pileNo).concat(String.format("%04X", csRateModelId)).concat(hexCode);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
}else{
}else if("0C".equals(version)){
resultStr = "6810".concat(seq).concat("0006").concat(pileNo).concat(HexUtils.toHexInt(csRateModelId)).concat(hexCode);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
}else{
resultStr = "680E".concat(seq).concat("0006").concat(pileNo).concat(String.format("%04X", csRateModelId)).concat(hexCode);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
}
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(pileNo);

View File

@ -14,9 +14,11 @@ import com.xhpc.user.mapper.XhpcHistoryOrderMapper;
import com.xhpc.user.pojo.XhpcInvoiceMapHistoryOrder;
import com.xhpc.user.service.XhpcInvoiceService;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZoneId;
@ -132,8 +134,10 @@ public class XhpcInvoiceApiController extends BaseController {
* @since version-1.0
*/
@GetMapping(value = "/user/history-orders")
public AjaxResult findUserHistoryOrders(InvoicedOrdersRequest invoicedOrdersRequest) {
public AjaxResult findUserHistoryOrders(HttpServletRequest request, InvoicedOrdersRequest invoicedOrdersRequest) {
LoginUser loginUser = tokenService.getLoginUser(request);
invoicedOrdersRequest.setTenantId(loginUser.getTenantId());
InvoicedOrderResponse invoicedOrdersResponse = xhpcInvoiceService.findUserHistoryOrders(invoicedOrdersRequest);
return AjaxResult.success(invoicedOrdersResponse);

File diff suppressed because one or more lines are too long

View File

@ -41,4 +41,6 @@ public class InvoicedOrdersRequest {
@JsonProperty("items")
private Integer items;
private String tenantId;
}

View File

@ -352,12 +352,15 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
orderDatasDTO.setOrderId((Long) data.get("historyOrderId"));
orderDatasDTO.setOrderNumber((String) data.get("serialNumber"));
orderDatasDTO.setOrderMoney(new BigDecimal(data.get("actPrice").toString()));
if(data.get("placeholderMoney") !=null && new BigDecimal(data.get("placeholderMoney").toString()).compareTo(new BigDecimal(0))>0){
orderDatasDTO.setTotalMoney(new BigDecimal(data.get("actPrice").toString()).add(new BigDecimal(data.get("placeholderMoney").toString())));
}else{
orderDatasDTO.setTotalMoney(new BigDecimal(data.get("actPrice").toString()));
}
orderDatasDTO.setPlaceholderMoney(new BigDecimal(data.get("placeholderMoney").toString()));
// if(data.get("placeholderMoney") !=null && new BigDecimal(data.get("placeholderMoney").toString()).compareTo(new BigDecimal(0))>0){
// orderDatasDTO.setTotalMoney(new BigDecimal(data.get("actPrice").toString()).add(new BigDecimal(data.get("placeholderMoney").toString())));
// }else{
// orderDatasDTO.setTotalMoney(new BigDecimal(data.get("actPrice").toString()));
// }
// if(data.get("placeholderMoney")!=null){
// orderDatasDTO.setPlaceholderMoney(new BigDecimal(data.get("placeholderMoney").toString()));
// }
//因为数据库中存储的时间类型为datetime所以Mybatis会将其转换为LocalDateTime类型对象我们不能直接得到Date所以我们需要对其进行转换
LocalDateTime createTime = (LocalDateTime) data.get("createTime");
ZoneId zoneId = ZoneId.systemDefault();
@ -1019,6 +1022,11 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
public static void main(String[] args) {
System.out.println("2024-01-02T12:11".length());
System.out.println("2024-01-02T12:11:00".length());
Date currentDate = new Date();
String strTime = DateUtils.parseDateToStr(currentDate);
System.out.println("strTime"+strTime);
}
}

View File

@ -60,6 +60,7 @@
xcp.surplus_money as balance,
xcp.avatar as avatar,
xcp.status,
xcp.community_id as communityId,
xcp.weixin_open_id as weixinOpenId,
xcp.alipay_open_id as alipayOpenId,
xcp.weixin_login as weixinLogin,
@ -104,6 +105,7 @@
xcp.surplus_money as balance,
xcp.avatar as avatar,
xcp.status,
xcp.customers_id as customersId,
xcp.weixin_open_id as weixinOpenId,
xcp.alipay_open_id as alipayOpenId,
xcp.weixin_login as weixinLogin,

View File

@ -117,27 +117,26 @@
<select id="findByCondition" resultType="Map">
SELECT
xho.history_order_id as historyOrderId,
xho.serial_number as serialNumber,
xho.act_price as actPrice,
xho.create_time as createTime,
DATE_FORMAT(xho.create_time,'%Y-%m') AS belongsTime,
xpo.act_price as placeholderMoney
history_order_id as historyOrderId,
serial_number as serialNumber,
act_price as actPrice,
create_time as createTime,
DATE_FORMAT(create_time,'%Y-%m') AS belongsTime
FROM
xhpc_history_order xho
left join xhpc_placeholder_order xpo on xpo.history_order_id =xho.history_order_id and appeal_status !=1
xhpc_history_order
WHERE
xho.user_id = #{invoicedOrdersRequest.userId}
AND xho.source = #{invoicedOrdersRequest.userType}
AND xho.create_time &lt;= #{invoicedOrdersRequest.currentTime}
user_id = #{invoicedOrdersRequest.userId}
AND source = #{invoicedOrdersRequest.userType}
AND create_time &lt;= #{invoicedOrdersRequest.currentTime}
and tenant_id=#{invoicedOrdersRequest.tenantId}
<if test="lockOrderNumberList!=null">
AND xho.history_order_id
AND history_order_id
<foreach collection="lockOrderNumberList" item="historyOrderId" open="not in (" close=")" separator=",">
#{historyOrderId}
</foreach>
</if>
ORDER BY
xho.create_time DESC
create_time DESC
</select>
<select id="findAllOrdersByCondition" resultType="java.lang.Long">
SELECT

View File

@ -191,7 +191,7 @@
WHERE lock_flag = 0
AND del_flag IS NULL
AND history_user_id = #{userId}
AND history_user_type = #{userType};
AND history_user_type = #{userType}
</select>
<select id="getLockedOnesByHistoryOrderId" resultType="com.xhpc.user.pojo.XhpcInvoiceMapHistoryOrder">
SELECT

View File

@ -98,7 +98,7 @@
select
charging_station_id chargingStationId, `name`,operator_id operatorId
from xhpc_charging_station
WHERE del_flag = 0
WHERE 1=1
<if test="operatorId != null and operatorId != ''">
and operator_id = #{operatorId}
</if>