From d37e3682dbd6d8728243433d334c8e9f170983b2 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期三, 18 九月 2024 16:45:58 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 21 ++-- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserIntegralChangeController.java | 2 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TransactionRecordMessageListener.java | 13 ++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java | 8 + ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/WxPaymentClient.java | 2 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java | 8 - ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserIntegralChange.java | 1 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/util/RocketMQEnhanceTemplate.java | 9 +- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 7 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java | 8 + ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java | 4 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TSettlementConfirmMapper.xml | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java | 68 ++++++++++------ ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java | 4 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 16 +++- ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java | 52 ++++++------ ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingBillMapper.xml | 2 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/OnlineMessageListener.java | 7 - 19 files changed, 136 insertions(+), 101 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserIntegralChange.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserIntegralChange.java index be58de7..abd7964 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserIntegralChange.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserIntegralChange.java @@ -57,6 +57,7 @@ @ApiModelProperty(value = "添加时间") @TableField("create_time") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDateTime createTime; @TableField(exist = false) @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java index a548f5d..382ce1d 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java @@ -186,7 +186,9 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @TableField("refund_time") private LocalDateTime refundTime; - + @ApiModelProperty(value = "总电量") + @TableField("total_electricity") + private BigDecimal totalElectricity;// 总电量 @ApiModelProperty(value = "支付时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") diff --git a/ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/WxPaymentClient.java b/ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/WxPaymentClient.java index 90cb9c9..8f6e6c2 100644 --- a/ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/WxPaymentClient.java +++ b/ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/WxPaymentClient.java @@ -29,7 +29,7 @@ * @return */ @PostMapping("/wx/query/queryOrderInfo") - R<NotifyV3PayDecodeRespBody> queryOrderInfo(String orderId); + R<NotifyV3PayDecodeRespBody> queryOrderInfo(@RequestParam("orderId") String orderId); /** diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserIntegralChangeController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserIntegralChangeController.java index b721c52..496fd0f 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserIntegralChangeController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserIntegralChangeController.java @@ -35,7 +35,7 @@ @ResponseBody @PostMapping("/addAppUserIntegralChange") public R addAppUserIntegralChange(@RequestBody TAppUserIntegralChange appUserIntegralChange){ - String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); + String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); appUserIntegralChange.setCode(code); appUserIntegralChangeService.save(appUserIntegralChange); return R.ok(); diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java index bb2f544..bdefd57 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java @@ -47,7 +47,7 @@ TParkingRecord parkingRecord = new TParkingRecord(); parkingRecord.setLicensePlate(order.getPlate()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); - String code = "TC" + Math.random() * 1000 + sdf.format(new Date()); + String code = "TC" + Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date()); parkingRecord.setCode(code); parkingRecord.setVehicleColor(order.getPlateColor()); TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); @@ -95,7 +95,7 @@ TParkingRecord parkingRecord = new TParkingRecord(); parkingRecord.setLicensePlate(order.getPlatenumber()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); - String code = "TC" + Math.random() * 1000 + sdf.format(new Date()); + String code = "TC" + Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date()); parkingRecord.setCode(code); parkingRecord.setVehicleColor(order.getPlatecolor()); TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java index 7125512..cb36d98 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java @@ -63,7 +63,7 @@ String result; switch (service_id){ case SendTagConstant.ONLINE: - OnlineMessage onlineMessage = JSON.parseObject(jsonObject.toJSONString(),OnlineMessage.class); + OnlineMessage onlineMessage = JSON.parseObject(content.toJSONString(),OnlineMessage.class); sendResult = enhanceProduce.onlineMessage(onlineMessage); // 响应硬件 // 业务处理 登录认证应答 @@ -74,7 +74,7 @@ log.info("充电桩登录认证-返回结果:{}",result); break; case SendTagConstant.PING: - PingMessage pingMessage = JSON.parseObject(jsonObject.toJSONString(),PingMessage.class); + PingMessage pingMessage = JSON.parseObject(content.toJSONString(),PingMessage.class); sendResult = enhanceProduce.pingMessage(pingMessage); // 响应硬件 Pong pong = new Pong(); @@ -85,12 +85,12 @@ log.info("充电桩心跳包-返回结果:{}",result); break; case SendTagConstant.END_CHARGE: - EndChargeMessage endChargeMessage = JSON.parseObject(jsonObject.toJSONString(),EndChargeMessage.class); + EndChargeMessage endChargeMessage = JSON.parseObject(content.toJSONString(),EndChargeMessage.class); sendResult = enhanceProduce.endChargeMessage(endChargeMessage); // 响应硬件 break; case SendTagConstant.BILLING_MODE_VERIFY: - BillingModeVerifyMessage billingModeVerifyMessage = JSON.parseObject(jsonObject.toJSONString(),BillingModeVerifyMessage.class); + BillingModeVerifyMessage billingModeVerifyMessage = JSON.parseObject(content.toJSONString(),BillingModeVerifyMessage.class); sendResult = enhanceProduce.billingModeVerifyMessage(billingModeVerifyMessage); // 响应硬件 BillingModeVerifyReply billingModeVerifyReply = new BillingModeVerifyReply(); @@ -117,7 +117,7 @@ iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply)); break; case SendTagConstant.ACQUISITION_BILLING_MODE: - AcquisitionBillingModeMessage acquisitionBillingModeMessage = JSON.parseObject(jsonObject.toJSONString(),AcquisitionBillingModeMessage.class); + AcquisitionBillingModeMessage acquisitionBillingModeMessage = JSON.parseObject(content.toJSONString(),AcquisitionBillingModeMessage.class); sendResult = enhanceProduce.acquisitionBillingModeMessage(acquisitionBillingModeMessage); // 响应硬件 计费模型请求应答 1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段 List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(acquisitionBillingModeMessage.getCharging_pile_code()).getData(); @@ -130,55 +130,55 @@ iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply)); break; case SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA: - UploadRealTimeMonitoringDataMessage uploadRealTimeMonitoringDataMessage = JSON.parseObject(jsonObject.toJSONString(),UploadRealTimeMonitoringDataMessage.class); + UploadRealTimeMonitoringDataMessage uploadRealTimeMonitoringDataMessage = JSON.parseObject(content.toJSONString(),UploadRealTimeMonitoringDataMessage.class); sendResult = enhanceProduce.uploadRealTimeMonitoringDataMessage(uploadRealTimeMonitoringDataMessage); // 响应硬件 break; case SendTagConstant.CHARGING_HANDSHAKE: - ChargingHandshakeMessage chargingHandshakeMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingHandshakeMessage.class); + ChargingHandshakeMessage chargingHandshakeMessage = JSON.parseObject(content.toJSONString(),ChargingHandshakeMessage.class); sendResult = enhanceProduce.chargingHandshakeMessage(chargingHandshakeMessage); // 响应硬件 break; case SendTagConstant.PARAMETER_SETTING: - ParameterSettingMessage parameterSettingMessage = JSON.parseObject(jsonObject.toJSONString(),ParameterSettingMessage.class); + ParameterSettingMessage parameterSettingMessage = JSON.parseObject(content.toJSONString(),ParameterSettingMessage.class); sendResult = enhanceProduce.parameterSettingMessage(parameterSettingMessage); break; case SendTagConstant.BMS_ABORT: - BmsAbortMessage bmsAbortMessage = JSON.parseObject(jsonObject.toJSONString(),BmsAbortMessage.class); + BmsAbortMessage bmsAbortMessage = JSON.parseObject(content.toJSONString(),BmsAbortMessage.class); sendResult = enhanceProduce.bmsAbortMessage(bmsAbortMessage); // 响应硬件 break; case SendTagConstant.MOTOR_ABORT: - MotorAbortMessage motorAbortMessage = JSON.parseObject(jsonObject.toJSONString(),MotorAbortMessage.class); + MotorAbortMessage motorAbortMessage = JSON.parseObject(content.toJSONString(),MotorAbortMessage.class); sendResult = enhanceProduce.motorAbortMessage(motorAbortMessage); break; case SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION: - BmsDemandAndChargerExportationMessage bmsDemandAndChargerExportationMessage = JSON.parseObject(jsonObject.toJSONString(),BmsDemandAndChargerExportationMessage.class); + BmsDemandAndChargerExportationMessage bmsDemandAndChargerExportationMessage = JSON.parseObject(content.toJSONString(),BmsDemandAndChargerExportationMessage.class); sendResult = enhanceProduce.bmsDemandAndChargerExportationMessage(bmsDemandAndChargerExportationMessage); // 响应硬件 break; case SendTagConstant.BMS_INFORMATION: - BmsInformationMessage bmsInformationMessage = JSON.parseObject(jsonObject.toJSONString(),BmsInformationMessage.class); + BmsInformationMessage bmsInformationMessage = JSON.parseObject(content.toJSONString(),BmsInformationMessage.class); sendResult = enhanceProduce.bmsInformationMessage(bmsInformationMessage); // 响应硬件 break; case SendTagConstant.CHARGING_PILE_STARTS_CHARGING: - ChargingPileStartsChargingMessage chargingPileStartsChargingMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingPileStartsChargingMessage.class); + ChargingPileStartsChargingMessage chargingPileStartsChargingMessage = JSON.parseObject(content.toJSONString(),ChargingPileStartsChargingMessage.class); sendResult = enhanceProduce.chargingPileStartsChargingMessage(chargingPileStartsChargingMessage); // 响应硬件 break; case SendTagConstant.PLATFORM_START_CHARGING_REPLY: - PlatformStartChargingReplyMessage platformStartChargingReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformStartChargingReplyMessage.class); + PlatformStartChargingReplyMessage platformStartChargingReplyMessage = JSON.parseObject(content.toJSONString(),PlatformStartChargingReplyMessage.class); sendResult = enhanceProduce.platformStartChargingReplyMessage(platformStartChargingReplyMessage); // 响应硬件 break; case SendTagConstant.PLATFORM_STOP_CHARGING_REPLY: - PlatformStopChargingReplyMessage platformStopChargingReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformStopChargingReplyMessage.class); + PlatformStopChargingReplyMessage platformStopChargingReplyMessage = JSON.parseObject(content.toJSONString(),PlatformStopChargingReplyMessage.class); sendResult = enhanceProduce.platformStopChargingReplyMessage(platformStopChargingReplyMessage); // 响应硬件 break; case SendTagConstant.TRANSACTION_RECORD: - TransactionRecordMessage transactionRecordMessage = JSON.parseObject(jsonObject.toJSONString(),TransactionRecordMessage.class); + TransactionRecordMessage transactionRecordMessage = JSON.parseObject(content.toJSONString(),TransactionRecordMessage.class); sendResult = enhanceProduce.transactionRecordMessage(transactionRecordMessage); // 响应硬件 ConfirmTransactionRecord confirmTransactionRecord = new ConfirmTransactionRecord(); @@ -187,27 +187,27 @@ iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord)); break; case SendTagConstant.UPDATE_BALANCE_REPLY: - UpdateBalanceReplyMessage updateBalanceReplyMessage = JSON.parseObject(jsonObject.toJSONString(),UpdateBalanceReplyMessage.class); + UpdateBalanceReplyMessage updateBalanceReplyMessage = JSON.parseObject(content.toJSONString(),UpdateBalanceReplyMessage.class); sendResult = enhanceProduce.updateBalanceReplyMessage(updateBalanceReplyMessage); // 响应硬件 break; case SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY: - SynchronizeOfflineCardReplyMessage synchronizeOfflineCardReplyMessage = JSON.parseObject(jsonObject.toJSONString(),SynchronizeOfflineCardReplyMessage.class); + SynchronizeOfflineCardReplyMessage synchronizeOfflineCardReplyMessage = JSON.parseObject(content.toJSONString(),SynchronizeOfflineCardReplyMessage.class); sendResult = enhanceProduce.synchronizeOfflineCardReplyMessage(synchronizeOfflineCardReplyMessage); // 响应硬件 break; case SendTagConstant.CLEAR_OFFLINE_CARD_REPLY: - ClearOfflineCardReplyMessage clearOfflineCardReplyMessage = JSON.parseObject(jsonObject.toJSONString(),ClearOfflineCardReplyMessage.class); + ClearOfflineCardReplyMessage clearOfflineCardReplyMessage = JSON.parseObject(content.toJSONString(),ClearOfflineCardReplyMessage.class); sendResult = enhanceProduce.clearOfflineCardReplyMessage(clearOfflineCardReplyMessage); // 响应硬件 break; case SendTagConstant.WORKING_PARAMETER_SETTING_REPLY: - WorkingParameterSettingReplyMessage workingParameterSettingReplyMessage = JSON.parseObject(jsonObject.toJSONString(),WorkingParameterSettingReplyMessage.class); + WorkingParameterSettingReplyMessage workingParameterSettingReplyMessage = JSON.parseObject(content.toJSONString(),WorkingParameterSettingReplyMessage.class); sendResult = enhanceProduce.workingParameterSettingReplyMessage(workingParameterSettingReplyMessage); // 响应硬件 break; case SendTagConstant.TIMING_SETTING: - TimingSettingMessage timingSettingMessage = JSON.parseObject(jsonObject.toJSONString(),TimingSettingMessage.class); + TimingSettingMessage timingSettingMessage = JSON.parseObject(content.toJSONString(),TimingSettingMessage.class); sendResult = enhanceProduce.timingSettingMessage(timingSettingMessage); // 响应硬件 对时设置应答 TimingSettingReply timingSettingReply = new TimingSettingReply(); @@ -216,27 +216,27 @@ iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply)); break; case SendTagConstant.SETUP_BILLING_MODEL_REPLY: - SetupBillingModelReplyMessage setupBillingModelReplyMessage = JSON.parseObject(jsonObject.toJSONString(),SetupBillingModelReplyMessage.class); + SetupBillingModelReplyMessage setupBillingModelReplyMessage = JSON.parseObject(content.toJSONString(),SetupBillingModelReplyMessage.class); sendResult = enhanceProduce.setupBillingModelReplyMessage(setupBillingModelReplyMessage); // 响应硬件 break; case SendTagConstant.GROUND_LOCK_REAL_TIME_DATA: - GroundLockRealTimeDataMessage groundLockRealTimeDataMessage = JSON.parseObject(jsonObject.toJSONString(),GroundLockRealTimeDataMessage.class); + GroundLockRealTimeDataMessage groundLockRealTimeDataMessage = JSON.parseObject(content.toJSONString(),GroundLockRealTimeDataMessage.class); sendResult = enhanceProduce.groundLockRealTimeDataMessage(groundLockRealTimeDataMessage); // 响应硬件 break; case SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA: - ChargingPileReturnsGroundLockDataMessage chargingPileReturnsGroundLockDataMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingPileReturnsGroundLockDataMessage.class); + ChargingPileReturnsGroundLockDataMessage chargingPileReturnsGroundLockDataMessage = JSON.parseObject(content.toJSONString(),ChargingPileReturnsGroundLockDataMessage.class); sendResult = enhanceProduce.chargingPileReturnsGroundLockDataMessage(chargingPileReturnsGroundLockDataMessage); // 响应硬件 break; case SendTagConstant.PLATFORM_RESTART_REPLY: - PlatformRestartReplyMessage platformRestartReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformRestartReplyMessage.class); + PlatformRestartReplyMessage platformRestartReplyMessage = JSON.parseObject(content.toJSONString(),PlatformRestartReplyMessage.class); sendResult = enhanceProduce.platformRestartReplyMessage(platformRestartReplyMessage); // 响应硬件 break; default: - PlatformRemoteUpdateReplyMessage platformRemoteUpdateReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformRemoteUpdateReplyMessage.class); + PlatformRemoteUpdateReplyMessage platformRemoteUpdateReplyMessage = JSON.parseObject(content.toJSONString(),PlatformRemoteUpdateReplyMessage.class); sendResult = enhanceProduce.platformRemoteUpdateReplyMessage(platformRemoteUpdateReplyMessage); // 响应硬件 break; diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/OnlineMessageListener.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/OnlineMessageListener.java index d5ca13f..496d44a 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/OnlineMessageListener.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/OnlineMessageListener.java @@ -1,16 +1,10 @@ package com.ruoyi.integration.rocket.listener; import com.ruoyi.integration.api.model.Online; -import com.ruoyi.integration.api.model.OnlineReply; -import com.ruoyi.integration.iotda.enums.ServiceIdMenu; -import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; -import com.ruoyi.integration.iotda.utils.tools.MessageUtil; import com.ruoyi.integration.mongodb.service.OnlineService; -import com.ruoyi.integration.rocket.model.OnlineMessage; import com.ruoyi.integration.rocket.model.OnlineMessage; import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; import lombok.extern.slf4j.Slf4j; -import org.apache.rocketmq.spring.annotation.MessageModel; import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; import org.apache.rocketmq.spring.core.RocketMQListener; import org.springframework.beans.BeanUtils; @@ -20,7 +14,6 @@ @Slf4j @Component @RocketMQMessageListener( - messageModel = MessageModel.CLUSTERING, consumerGroup = "charge_online", topic = "charge_online", selectorExpression = "online", // 明确指定标签 diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java index dadb590..3b67a82 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java @@ -1,16 +1,12 @@ package com.ruoyi.integration.rocket.listener; -import com.ruoyi.integration.api.model.Online; import com.ruoyi.integration.api.model.Ping; -import com.ruoyi.integration.api.model.Pong; -import com.ruoyi.integration.iotda.enums.ServiceIdMenu; -import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; -import com.ruoyi.integration.iotda.utils.tools.MessageUtil; -import com.ruoyi.integration.mongodb.service.OnlineService; import com.ruoyi.integration.mongodb.service.PingService; +import com.ruoyi.integration.rocket.model.OnlineMessage; import com.ruoyi.integration.rocket.model.PingMessage; import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; import lombok.extern.slf4j.Slf4j; +import org.apache.rocketmq.client.consumer.listener.MessageListener; import org.apache.rocketmq.spring.annotation.MessageModel; import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; import org.apache.rocketmq.spring.core.RocketMQListener; diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TransactionRecordMessageListener.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TransactionRecordMessageListener.java index f3a26e5..9019abf 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TransactionRecordMessageListener.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TransactionRecordMessageListener.java @@ -9,6 +9,8 @@ import com.ruoyi.integration.mongodb.service.TransactionRecordService; import com.ruoyi.integration.rocket.model.TransactionRecordMessage; import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; +import com.ruoyi.order.api.feignClient.ChargingOrderClient; +import com.ruoyi.order.api.model.TChargingOrder; import lombok.extern.slf4j.Slf4j; import org.apache.rocketmq.spring.annotation.MessageModel; import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; @@ -16,6 +18,8 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; + +import java.util.Objects; @Slf4j @Component @@ -31,9 +35,7 @@ @Autowired private TransactionRecordService transactionRecordService; @Autowired - private IotMessageProduce iotMessageProduce; - @Autowired - private MessageUtil messageUtil; + private ChargingOrderClient chargingOrderClient; @Override protected void handleMessage(TransactionRecordMessage message) throws Exception { // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 @@ -43,6 +45,11 @@ BeanUtils.copyProperties(message,transactionRecord); transactionRecordService.create(transactionRecord); // 业务处理 + TChargingOrder chargingOrder = chargingOrderClient.getOrderByCode(message.getTransaction_serial_number()).getData(); + if(Objects.nonNull(chargingOrder)){ + chargingOrder.setTotalElectricity(message.getTotal_electricity()); + chargingOrderClient.updateChargingOrder(chargingOrder); + } } @Override diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/util/RocketMQEnhanceTemplate.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/util/RocketMQEnhanceTemplate.java index 69773c3..f54f22e 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/util/RocketMQEnhanceTemplate.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/util/RocketMQEnhanceTemplate.java @@ -5,10 +5,12 @@ import com.ruoyi.integration.rocket.configuration.RocketEnhanceProperties; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.rocketmq.client.producer.DefaultMQProducer; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.apache.rocketmq.spring.support.RocketMQHeaders; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; import org.springframework.messaging.Message; import org.springframework.messaging.support.MessageBuilder; import org.springframework.util.StringUtils; @@ -24,9 +26,6 @@ private RocketEnhanceProperties rocketEnhanceProperties; public RocketMQTemplate getTemplate() { -// DefaultMQProducer producer = new DefaultMQProducer(); -// producer.setProducerGroup("enhance_consumer_group"); -// template.setProducer(producer); return template; } @@ -62,7 +61,7 @@ public <T extends BaseMessage> SendResult send(String destination, T message) { // 设置业务键,此处根据公共的参数进行处理 // 更多的其它基础业务处理... - Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build(); + Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.TAGS, message.getKey()).build(); SendResult sendResult = template.syncSend(destination, sendMessage); // 此处为了方便查看给日志转了json,根据选择选择日志记录方式,例如ELK采集 log.info("[{}]同步消息[{}]发送结果[{}]", destination, JSONObject.toJSON(message), JSONObject.toJSON(sendResult)); @@ -77,7 +76,7 @@ } public <T extends BaseMessage> SendResult send(String destination, T message, int delayLevel) { - Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build(); + Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.TAGS, message.getKey()).build(); SendResult sendResult = template.syncSend(destination, sendMessage, 3000, delayLevel); log.info("[{}]延迟等级[{}]消息[{}]发送结果[{}]", destination, delayLevel, JSONObject.toJSON(message), JSONObject.toJSON(sendResult)); return sendResult; diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java index 5bbdf95..1b2dfc4 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java @@ -84,9 +84,9 @@ /** * 发票管理导出 */ - @ApiOperation(value = "发票管理导出") + @ApiOperation(value = "发票管理导出", tags = {"管理后台-发票管理"}) @Log(title = "发票管理导出", businessType = BusinessType.EXPORT) - @PostMapping("/export") + @PutMapping("/export") public void export(@RequestBody TOrderInvoiceQuery query) { List<TOrderInvoiceVO> list = orderInvoiceService.export(query); @@ -94,7 +94,9 @@ for (TOrderInvoiceVO orderInvoiceVO : list) { OrderInvoiceExport orderInvoiceExport = new OrderInvoiceExport(); BeanUtils.copyProperties(orderInvoiceVO,orderInvoiceExport); - orderInvoiceExport.setBillingTime(DateUtils.localDateTimeToString(orderInvoiceVO.getBillingTime())); + if (orderInvoiceVO.getBillingTime()!=null){ + orderInvoiceExport.setBillingTime(DateUtils.localDateTimeToString(orderInvoiceVO.getBillingTime())); + } orderInvoiceExports.add(orderInvoiceExport); } Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), OrderInvoiceExport.class, orderInvoiceExports); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index 85e408c..633923e 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -417,7 +417,7 @@ //构建新的待支付订单 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); TChargingOrder chargingOrder = new TChargingOrder(); - String code = "CD" + Math.random() * 1000 + sdf.format(new Date()); + String code = "CD" + Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date()); chargingOrder.setCode(code); chargingOrder.setOrderType(1); chargingOrder.setOrderClassification(1); @@ -633,7 +633,7 @@ TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); chargingOrderRefund.setChargingOrderId(chargingOrder.getId()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); - chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Math.random() * 1000)); + chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + Double.valueOf(Math.random() * 1000).intValue()); chargingOrderRefund.setRefundAmount(rechargeAmount); chargingOrderRefund.setRefundStatus(1); chargingOrderRefund.setPayType(rechargePaymentType); @@ -844,7 +844,7 @@ } TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); - String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); + String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); appUserIntegralChange.setCode(code); appUserIntegralChange.setAppUserId(appUser.getInviteUserId()); appUserIntegralChange.setChangeType(5); @@ -943,7 +943,7 @@ TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); chargingOrderRefund.setChargingOrderId(chargingOrder.getId()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); - chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Math.random() * 1000)); + chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); chargingOrderRefund.setRefundAmount(refundAmount); chargingOrderRefund.setRefundStatus(1); chargingOrderRefund.setPayType(rechargePaymentType); @@ -1611,7 +1611,7 @@ } TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); - String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); + String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); appUserIntegralChange.setCode(code); appUserIntegralChange.setAppUserId(appUser.getInviteUserId()); appUserIntegralChange.setChangeType(5); @@ -1717,7 +1717,7 @@ chargingOrderRefund.setRefundTime(LocalDateTime.now()); chargingOrderRefund.setCode(tChargingOrder.getCode()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); - chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000)); + chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); chargingOrderRefund.setRefundTitle("后台退款"); chargingOrderRefund.setRefundContent("后台退款"); chargingOrderRefund.setRefundReason("后台退款"); @@ -1934,14 +1934,15 @@ List<TSettlementConfirm> list = tSettlementConfirmMapper.settlementList(pageInfo,dto); for (TSettlementConfirm tSettlementConfirm : list) { tSettlementConfirm.setUid(tSettlementConfirm.getId().toString()); - Partner data = siteClient.getPartnerR(tSettlementConfirm.getPartnerId()).getData(); List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(tSettlementConfirm.getSiteId())).getData(); if (!data1.isEmpty()){ tSettlementConfirm.setSiteName(data1.get(0).getName()); + Partner data = siteClient.getPartnerR(data1.get(0).getPartnerId()).getData(); + if (data!=null){ + tSettlementConfirm.setPartnerName(data.getName()); + } } - if (data!=null){ - tSettlementConfirm.setPartnerName(data.getName()); - } + String format = tSettlementConfirm.getStartTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")); String format1 = tSettlementConfirm.getEndTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")); tSettlementConfirm.setTime(format+"至"+format1); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java index 01df8fb..243c47e 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java @@ -75,7 +75,8 @@ wrapper.eq(TExchangeOrder::getStatus, query.getStatus()); } long count = this.count(wrapper); - List<TExchangeOrder> list = this.list(wrapper.orderByDesc(TExchangeOrder::getCreateTime).last(" limit " + query.getPageCurr() + "," + query.getPageSize())); + Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize(); + List<TExchangeOrder> list = this.list(wrapper.orderByDesc(TExchangeOrder::getCreateTime).last(" limit " + pageCurr + "," + query.getPageSize())); List<MyExchangeOrderList> pageList = new ArrayList<>(); for (TExchangeOrder tExchangeOrder : list) { MyExchangeOrderList exchangeOrderList = new MyExchangeOrderList(); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java index 6ce5163..6202b2e 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java @@ -117,7 +117,7 @@ return AjaxResult.error("不能重复申请开票,请刷新数据后重试"); } SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); - String code = Math.random() * 1000 + sdf.format(new Date()); + String code = Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date()); addOrderInvoice.setAppUserId(userId); addOrderInvoice.setCode(code); addOrderInvoice.setStatus(1); @@ -155,9 +155,10 @@ @Override public List<OrderInvoiceList> getMyOrderInvoiceList(GetOrderInvoiceList query) { Long userId = tokenService.getLoginUserApplet().getUserId(); + Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize(); List<TOrderInvoice> list = this.list(new LambdaQueryWrapper<TOrderInvoice>().eq(TOrderInvoice::getAppUserId, userId) .eq(TOrderInvoice::getStatus, query.getStatus()).orderByDesc(TOrderInvoice::getCreateTime) - .last(" limit " + query.getPageCurr() + ", " + query.getPageSize())); + .last(" limit " + pageCurr + ", " + query.getPageSize())); List<OrderInvoiceList> pageList = new ArrayList<>(); for (TOrderInvoice tOrderInvoice : list) { OrderInvoiceList orderInvoiceList = new OrderInvoiceList(); @@ -247,12 +248,15 @@ @Override public PageInfo<TOrderInvoiceVO> pageList(TOrderInvoiceQuery query) { + List<TAppUser> tAppUsers = new ArrayList<>(); // 查询申请用户 - List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); - if(CollectionUtils.isEmpty(userList)){ - return new PageInfo<>(); + if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){ + tAppUsers = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); + if(CollectionUtils.isEmpty(tAppUsers)){ + return new PageInfo<>(); + } } - query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); + query.setUserIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList())); PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); List<TOrderInvoiceVO> list = this.baseMapper.pageList(query,pageInfo); for (TOrderInvoiceVO tOrderInvoiceVO : list) { @@ -269,14 +273,17 @@ List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); + List<TAppUser> finalTAppUsers = tAppUsers; list.forEach(e->{ e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); - e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); - e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); - e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); - e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); + e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); + e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); + e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); + if (e.getBillingUserId()!=null){ + e.setUserPhone(finalTAppUsers.stream().filter(t->t.getId()!=null).filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); + } }); pageInfo.setRecords(list); @@ -286,39 +293,50 @@ @Override public Map<String, Integer> statusCount(TOrderInvoiceQuery query) { Map<String, Integer> map = new HashMap<>(); - List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); - if(CollectionUtils.isEmpty(userList)){ - map.put("notAccepted",0); - map.put("processing",0); - map.put("finished",0); - return map; + List<TAppUser> tAppUsers = new ArrayList<>(); + + if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){ + tAppUsers = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); + if(CollectionUtils.isEmpty(tAppUsers)){ + map.put("notAccepted",0); + map.put("processing",0); + map.put("finished",0); + return map; + } } - query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); + + query.setUserIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList())); map = this.baseMapper.statusCount(query); return map; } @Override public List<TOrderInvoiceVO> export(TOrderInvoiceQuery query) { + List<TAppUser> tAppUsers = new ArrayList<>(); // 查询申请用户 - List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); - if(CollectionUtils.isEmpty(userList)){ - return new ArrayList<>(); + if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){ + tAppUsers = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); + if(CollectionUtils.isEmpty(tAppUsers)){ + return new ArrayList<TOrderInvoiceVO>(); + } } - query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); + query.setUserIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList())); PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); List<TOrderInvoiceVO> list = this.baseMapper.export(query); List<Long> ids = list.stream().map(TOrderInvoiceVO::getId).collect(Collectors.toList()); List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); + List<TAppUser> finalTAppUsers = tAppUsers; list.forEach(e->{ e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); - e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); - e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); - e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); - e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); + e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); + e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); + e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); + if (e.getBillingUserId()!=null){ + e.setUserPhone(finalTAppUsers.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); + } }); return list; } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java index 529097c..843efa2 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java @@ -201,7 +201,8 @@ wrapper.eq(TShoppingOrder::getStatus, query.getStatus()); } long count = this.count(wrapper); - List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + query.getPageCurr() + ", " + query.getPageSize())); + Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize(); + List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + pageCurr + ", " + query.getPageSize())); List<MyShoppingOrderList> pageList = new ArrayList<>(); for (TShoppingOrder tShoppingOrder : list) { MyShoppingOrderList myShoppingOrderList = new MyShoppingOrderList(); @@ -347,7 +348,7 @@ shoppingOrderRefund.setPayType(shoppingOrder.getPaymentType()); shoppingOrderRefund.setShoppingOrderId(shoppingOrder.getId()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); - shoppingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000)); + shoppingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + Double.valueOf((Math.random() * 1000)).intValue()); shoppingOrderRefund.setRefundAmount(refundAmount); shoppingOrderRefund.setRefundStatus(1); shoppingOrderRefund.setCode(shoppingOrder.getCode()); @@ -447,7 +448,8 @@ @Override public List<MyShoppingOrderList> getNoInvoicedOrder(GetNoInvoicedOrder query) { Long userId = tokenService.getLoginUserApplet().getUserId(); - List<TShoppingOrder> list = this.baseMapper.getNoInvoicedOrder(userId, query.getMonth(), query.getPageCurr(), query.getPageSize()); + Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize(); + List<TShoppingOrder> list = this.baseMapper.getNoInvoicedOrder(userId, query.getMonth(), pageCurr, query.getPageSize()); List<MyShoppingOrderList> pageList = new ArrayList<>(); for (TShoppingOrder tShoppingOrder : list) { MyShoppingOrderList myShoppingOrderList = new MyShoppingOrderList(); diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingBillMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingBillMapper.xml index 7d97874..b5dbf43 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingBillMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingBillMapper.xml @@ -19,6 +19,7 @@ and t1.id = #{req.uid} </if> and t1.billType = 1 + and t1.del_flag = 0 </select> <select id="chargingBillList1" resultType="com.ruoyi.order.api.vo.ChargingBillListVO"> select t1.* from t_charging_bill t1 @@ -36,5 +37,6 @@ and t1.id = #{req.uid} </if> and t1.billType = 2 + and t1.del_flag = 0 </select> </mapper> diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml index a14d4c0..3c00f46 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml @@ -39,6 +39,7 @@ <result column="need_elec" property="needElec" /> <result column="create_time" property="createTime" /> <result column="del_flag" property="delFlag" /> + <result column="total_electricity" property="totalElectricity" /> </resultMap> <!-- 通用查询结果列 --> @@ -46,7 +47,7 @@ id, code, order_type, order_classification, app_user_id, app_user_car_id,site_id, parking_lot_id, charging_pile_id, charging_gun_id, start_time, end_time, status, recharge_amount, recharge_payment_type, recharge_payment_status, recharge_serial_number, order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, refund_code, - refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag,need_elec + refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag,need_elec,total_electricity </sql> @@ -124,7 +125,9 @@ (payment_amount-refund_amount) as final_amount, del_flag FROM - charging_pile_order.t_charging_order UNION ALL + charging_pile_order.t_charging_order + where recharge_payment_status = 2 + UNION ALL SELECT id, `code`, @@ -141,7 +144,9 @@ (payment_amount-refund_amount) as final_amount, del_flag FROM - charging_pile_order.t_shopping_order UNION ALL + charging_pile_order.t_shopping_order + where payment_status = 2 + UNION ALL SELECT id, `code`, @@ -157,8 +162,11 @@ refund_status, (payment_amount-refund_amount) as final_amount, del_flag + FROM - charging_pile_order.t_vip_order UNION ALL + charging_pile_order.t_vip_order + where payment_status = 2 + UNION ALL SELECT id, `code`, diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TSettlementConfirmMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TSettlementConfirmMapper.xml index 5354bd9..cd7c16b 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TSettlementConfirmMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TSettlementConfirmMapper.xml @@ -35,6 +35,6 @@ and (t1.end_time between #{req.startTime} and #{req.endTime} </if> </if> -and t1.delete_flag = 0 +and t1.del_flag = 0 </select> </mapper> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java index 9775212..97901b7 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java @@ -184,7 +184,8 @@ return R.ok(); } - @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品") + @ApiOperation(tags = {"小程序-" + + "兑换商城"},value = "积分兑换商品") @PostMapping(value = "/app/shop") public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { //检查当前用户积分是否够 @@ -304,8 +305,10 @@ } payPrice = orderPrice.subtract(coupon.getDiscountAmount()); discountPrice = coupon.getDiscountAmount(); + }else { + payPrice = orderPrice; } - exchangeDto.setPayPrice(orderPrice); + exchangeDto.setPayPrice(payPrice); exchangeDto.setDiscountPrice(discountPrice); exchangeDto.setVipDiscount(vipDiscount); exchangeDto.setUserId(userId); -- Gitblit v1.7.1