订单改版

This commit is contained in:
andy 2025-07-23 09:24:48 +08:00
parent be3c8e9e4c
commit dfaa807ff2
10 changed files with 48 additions and 16 deletions

View File

@ -20,4 +20,11 @@ public class HomeOrderSwapBatteryAmountDto {
Integer status;
public HomeOrderSwapBatteryAmountDto() {
}
public HomeOrderSwapBatteryAmountDto(Double amount, Long dataCount) {
this.amount = amount;
this.dataCount = dataCount;
}
}

View File

@ -12,13 +12,14 @@ import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.concurrent.ConcurrentHashMap;
//@Component
@Component
@Order(value = 20)
@Slf4j
public class MqttConnectInit implements ApplicationRunner {

View File

@ -43,7 +43,7 @@ public class MqttSubscribeService {
@Async("taskExecutor")
public void subscribeAdd(String stationCode) {
public void subscribe(String stationCode) {
log.info("\r\n=====>>>MQTT新增站点订阅主题>>>");
// 订阅主题
subscribe(MqttConnectInit.mqttClientMap.get("cloudClient"), stationCode);

View File

@ -13,6 +13,7 @@ import com.evotech.hd.cloud.mqtt.message.dto.newer.req.MqttResponse;
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatusData;
import com.evotech.hd.cloud.service.*;
import com.evotech.hd.cloud.service.rpc.WechatService;
import com.evotech.hd.cloud.utils.ParamServiceUtils;
import com.evotech.hd.cloud.utils.components.SwapOrderBasicFeeComponent;
import com.evotech.hd.common.core.constant.HDConstant;
import com.evotech.hd.common.core.entity.cloud.BatteryStationDc;
@ -31,7 +32,7 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 站端请求电池数据
* 换电完成事件数据
*
* @ClassName:MqttRequestBatteryInfoExchangeProcessorImpl
* @date: 2025年05月19日 17:41
@ -121,7 +122,7 @@ public class MqttEventSwapCompleteExchangeProcessorImpl implements MqttStrategyE
if (order.getStatus() == 3 || order.getStatus() == 5) {
//如果订单是完成. 查询订单详情
OrderDetail orderDetail = orderDetailService.getOne(new LambdaQueryWrapper<OrderDetail>().eq(OrderDetail::getOrderId, order.getPkId()));
orderDetail.setFeeType(HDConstant.OrderConstant.FEE_TYPE_SOC);
orderDetail.setFeeType(ParamServiceUtils.getSettlementType());
orderDetail.setOrderTimeEnd(new Date());
orderDetail.setServiceTimeEnd(new Date());
//copy属性

View File

@ -86,7 +86,7 @@ public class BatteryStationServiceImpl implements BatteryStationService {
//添加监控场所
addStore(bs);
//新增站点, 添加订阅信息
mqttSubscribeService.subscribeAdd(bs.getCode());
mqttSubscribeService.subscribe(bs.getCode());
return new Result<Integer>().success(n);
}
return new Result<Integer>().error("添加换电站出错!");

View File

@ -81,12 +81,12 @@ public class HomeServiceImpl implements HomeService {
//订单数量 or 订单金额
List<HomeOrderSwapBatteryAmountDto> orderAmountlist = orderDao.homeFindAmountData(homeRequestDto);
if(Collections.isNotEmpty(orderAmountlist)){
HomeOrderSwapBatteryAmountDto totalFinishOrder = orderAmountlist.stream().filter(i -> Integer.valueOf(7).equals(i.getStatus())).findFirst().orElse(null);
HomeOrderSwapBatteryAmountDto totalFinishOrder = orderAmountlist.stream().filter(i -> Integer.valueOf(7).equals(i.getStatus())).findFirst().orElse(new HomeOrderSwapBatteryAmountDto(0d,0l));
if(totalFinishOrder != null){
data.setTotalFinishOrderNum(totalFinishOrder.getDataCount());
data.setTotalFinishAmount(totalFinishOrder.getAmount());
}
HomeOrderSwapBatteryAmountDto totalPendingOrder = orderAmountlist.stream().filter(i -> Integer.valueOf(6).equals(i.getStatus())).findFirst().orElse(null);
HomeOrderSwapBatteryAmountDto totalPendingOrder = orderAmountlist.stream().filter(i -> Integer.valueOf(6).equals(i.getStatus())).findFirst().orElse(new HomeOrderSwapBatteryAmountDto(0d,0l));
if(totalPendingOrder != null){
data.setTotalPendingOrderNum(totalPendingOrder.getDataCount());
data.setTotalPendingOrderAmount(totalPendingOrder.getAmount());

View File

@ -53,4 +53,14 @@ public class ParamServiceUtils {
SysParam param= sysParamService.getSysParam("充值金额和赠送金额的结算占比", "settlement_proportion","0.7:0.3","充值金额和赠送金额的结算占比: 充值金额:结算金额 两个比例相加=1");
return param.getParamValue().split(":");
}
/***
* 获取结算方式
* 0.7:0.3
* @return
*/
public static Integer getSettlementType(){
SysParam param= sysParamService.getSysParam("获取结算方式", "settlement_type","2","获取结算方式: 计费方式-ODO--1; 计费方式SOC---2; 计费方式电量---3");
return Integer.valueOf(param.getParamValue());
}
}

View File

@ -13,7 +13,7 @@ public interface WechatPayService {
* @param prePay
* @return
*/
public com.evotech.hd.common.core.Dto.Result<PrepayWithRequestPaymentResponse> xcxPrepay(PrePayVO prePay);
public Result<PrepayWithRequestPaymentResponse> xcxPrepay(PrePayVO prePay);
/***
* 小程序支付回调
@ -26,7 +26,7 @@ public interface WechatPayService {
* 申请退款接口
* @return
*/
public com.evotech.hd.common.core.Dto.Result<String> refunds(RefundVO refundVO);
public Result<String> refunds(RefundVO refundVO);
/***
* 退款回调接口

View File

@ -45,7 +45,7 @@ public class RechargePayExchangeProcessor implements PayExchangeProcessor {
this.entries = JSONUtil.parseObj(Collections.asMap("type",entries.getInt("type"), "wechatUserId", entries.getInt("traderCode"), "orderNo", XCXUtil.payOutTradeNo(1)));
prePay.setAttach(entries.toString());
logger.info("发起 充值 订单支付: 支付请求参数:{}, 订单编号:{}, 订单金额:{}", JSONUtil.toJsonStr(prePay), entries.getStr("orderNo"), String.valueOf(prePay.getTotal()));
return pay(prePay, entries.getStr("orderNo"), 1);
return pay(prePay, entries.getStr("orderNo"), prePay.getTotal());
}
@Override

View File

@ -105,11 +105,11 @@ hbyt:
FwIDAQAB
-----END PUBLIC KEY-----
# 支付回调地址
notify_url: https://api.evo-techina.com/wechat/wechatpay/prepayback/msg
notify_url: http://api.evo-techina.com/wechat/pay/wechatpay/notify
# Native支付回调地址
native_notify_url: https://api.evo-techina.com/wechat/wechatpay/native/nativeback/msg
# 退款回调地址
refund_notify_url: https://api.evo-techina.com/wechat/wechatpay/refundsback/msg
refund_notify_url: http://api.evo-techina.com/wechat/pay/wechatpay/refunds/notify
# token缓存时效小时
token_exp_hour: 2
# 公众号
@ -118,13 +118,26 @@ hbyt:
app-secret: 84a6065165ec82862c5e03a010a6dc6c
token: r7YASMj3S9vCeeyJPpKeFPR9drhFaSDt
encodingAESKey: W3zDuKYFMUlYUXpT4AhRSPkqMS7CgcmnEVQ3enVcTtf
#车辆换电预约成功通知
pre_order_template_id: xmymFQ7DgEHh-rz-6i77-RIcgSzv2RDlEy0E8s0vwFA
#充电开始通知
order_start_template_id: L_AsG7s7DOyyz4dXLb8gIi7h4Sy__ifEAL1Mo8gAw4E
order_swap_end_template_id: wGll5W3NSHXkHjcEprjUbd1shigGOqywGX7A0BVnzUs
order_to_pay_template_id: IE0_RGuN5ufU4GFrCgM9JeUfvlWfbneEuUMDsn0RBQs
order_end_template_id: C5-AGh67aFXChQONqSwxaRrJgFrn_Z25VTlTk0jHSUY
wallet_recharge_template_id: 8JXsn_VkI0S0YZSbT2EKmV_zOxyudo4IsBLeU7V-SFk
#充电结束通知
order_to_pay_template_id2: K6cdaBOkxGJpah0vsz5rq5UBID04mk-eEWp2XM0KyA0
#换电成功提醒
order_swap_end_template_id: wGll5W3NSHXkHjcEprjUbd1shigGOqywGX7A0BVnzUs
#充电待结算通知
order_to_pay_template_id: IE0_RGuN5ufU4GFrCgM9JeUfvlWfbneEuUMDsn0RBQs
#支付成功通知
order_end_template_id: C5-AGh67aFXChQONqSwxaRrJgFrn_Z25VTlTk0jHSUY
#账户充值到账提醒
wallet_recharge_template_id: 8JXsn_VkI0S0YZSbT2EKmV_zOxyudo4IsBLeU7V-SFk
#退款到帐通知
wallet_back_template_id: aO9GDhgIcYnCDCpsVSMB-CeXG3J4JzHlOUV2bhOAvVI
#站端告警模版
alarm_template_id: 8vW_gOzoOMzlJqvtSOF0fLeNm8Z6pttJG63oeFe1gq4
#车辆换电预约已取消通知 (异常取消, 主动取消不发送)
stop_server_template_id: RVrVqa9Y8-AjOCHxp9LWAnYejjphZhLoHJr0pU2nReo
#充电结束待结算
charging_is_completed_template_id: K6cdaBOkxGJpah0vsz5rqxP8JQq-QyWCCTQkadL5G7g