luodangjia
2024-09-11 71d710e252dccfaf35804c5d0e6a3f00dac9be2b
Merge remote-tracking branch 'origin/master'

# Conflicts:
# ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
77个文件已修改
10个文件已添加
1869 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/FaultMessageFallbackFactory.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/FaultMessageClient.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TFaultMessage.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TVehicleRamp.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SwitchwayGateFallbackFactory.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/SwitchwayGateClient.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/UploadRealTimeMonitoringData.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/vo/SwitchwayGateReq.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/ChargingListQuery.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/ExportUidDto.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingBill.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/query/TOrderInvoiceQuery.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingOrderListVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/BasePage.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TFaultMessageController.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TVehicleRampController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TFaultMessageMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/resources/template/结算汇总.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/CouponController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/ParkingOrderController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/SwitchwayGateController.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/model/SwitchwayGate.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/SwitchwayGateService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/builder/IotBuilder.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/IotConstant.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/SendTagConstant.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java 181 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/configuration/RocketMQEnhanceAutoConfiguration.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/AcquisitionBillingModeMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BillingModeVerifyMessageListener.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BmsAbortMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BmsDemandAndChargerExportationMessageListener.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BmsInformationMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ChargingHandshakeMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ChargingPileReturnsGroundLockDataMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ChargingPileStartsChargingMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ClearOfflineCardReplyMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EndChargeMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/GroundLockRealTimeDataMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/MotorAbortMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/OnlineMessageListener.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ParameterSettingMessageListener.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PlatformRemoteUpdateReplyMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PlatformRestartReplyMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PlatformStartChargingReplyMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PlatformStopChargingReplyMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/QueryOfflineCardReplyMessageListener.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/SetupBillingModelReplyMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/SynchronizeOfflineCardReplyMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TimingSettingMessageListener.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TransactionRecordMessageListener.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/UpdateBalanceReplyMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/UploadRealTimeMonitoringDataMessageListener.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/WorkingParameterSettingReplyMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/EnhanceProduce.java 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/util/RocketMQEnhanceTemplate.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingBillMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingBillService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java 270 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java 210 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ChargingOrderListInfoVO.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingBillMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/utils/WxAbstractPay.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java
@@ -4,6 +4,7 @@
import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.model.TFaultMessage;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
@@ -42,6 +43,12 @@
            public R<SiteNameVO> getAllInfoById(Integer id) {
                return R.fail("通过枪id获取站点、桩、枪的名称失败:" + throwable.getMessage());
            }
            @Override
            public R<TChargingGun> getChargingGunByCode(String code) {
                return R.fail("根据枪编号获取充电枪失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/FaultMessageFallbackFactory.java
New file
@@ -0,0 +1,45 @@
package com.ruoyi.chargingPile.api.factory;
import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient;
import com.ruoyi.chargingPile.api.feignClient.FaultMessageClient;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TFaultMessage;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
 * 充电桩服务降级处理
 *
 * @author ruoyi
 */
@Component
public class FaultMessageFallbackFactory implements FallbackFactory<FaultMessageClient>
{
    private static final Logger log = LoggerFactory.getLogger(FaultMessageFallbackFactory.class);
    @Override
    public FaultMessageClient create(Throwable throwable) {
        log.error("充电枪调用失败:{}", throwable.getMessage());
        return new FaultMessageClient() {
            @Override
            public R<String> createFaultMessage(TFaultMessage faultMessage) {
                return R.fail("添加离线故障记录失败:" + throwable.getMessage());
            }
            @Override
            public R<String> updateFaultMessage(TFaultMessage faultMessage) {
                return R.fail("修改离线故障记录失败:" + throwable.getMessage());
            }
            @Override
            public R<TFaultMessage> getFaultMessageByGunId(Integer gunId) {
                return R.fail("查询枪是否有离线或故障记录失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java
@@ -2,6 +2,7 @@
import com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TFaultMessage;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
@@ -9,6 +10,7 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
 * @author zhibing.pu
@@ -41,5 +43,12 @@
     */
    @PostMapping("/t-charging-gun/getAllInfoById/{id}")
    R<SiteNameVO> getAllInfoById(@PathVariable("id") Integer id);
    /**
     * 根据枪编号获取充电枪
     * @param code
     * @return
     */
    @PostMapping("/t-charging-gun/getChargingGunByCode/{code}")
    R<TChargingGun> getChargingGunByCode(@PathVariable("code") String code);
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/FaultMessageClient.java
New file
@@ -0,0 +1,44 @@
package com.ruoyi.chargingPile.api.feignClient;
import com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory;
import com.ruoyi.chargingPile.api.factory.FaultMessageFallbackFactory;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TFaultMessage;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
 * @author zhibing.pu
 * @Date 2024/8/15 19:36
 */
@FeignClient(contextId = "FaultMessageClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = FaultMessageFallbackFactory.class)
public interface FaultMessageClient {
    /**
     * 添加离线故障记录
     * @param faultMessage
     * @return
     */
    @PostMapping("/t-fault-message/createFaultMessage")
    R<String> createFaultMessage(@RequestBody TFaultMessage faultMessage);
    /**
     * 修改离线故障记录
     * @param faultMessage
     * @return
     */
    @PostMapping("/t-fault-message/updateFaultMessage")
    R<String> updateFaultMessage(@RequestBody TFaultMessage faultMessage);
    /**
     * 查询枪是否有离线或故障记录
     * @param gunId
     * @return
     */
    @PostMapping("/t-fault-message/getFaultMessageByGunId/{gunId}")
    R<TFaultMessage> getFaultMessageByGunId(@PathVariable("gunId") Integer gunId);
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TFaultMessage.java
@@ -1,6 +1,7 @@
package com.ruoyi.chargingPile.api.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.web.domain.BasePojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -45,7 +46,10 @@
    @ApiModelProperty(value = "充电桩id")
    @TableField("charging_pile_id")
    private Integer chargingPileId;
    @ApiModelProperty(value = "充电枪id")
    @TableField("charging_gun_id")
    private Integer chargingGunId;
    @TableField(exist = false)
    private String chargingPileName;
@@ -59,7 +63,12 @@
    private String content;
    @ApiModelProperty(value = "故障时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("down_time")
    private LocalDateTime downTime;
    @ApiModelProperty(value = "结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("end_time")
    private LocalDateTime endTime;
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TVehicleRamp.java
@@ -52,6 +52,8 @@
    @ApiModelProperty(value = "方向(1=入口,2=出口)")
    @TableField("direction")
    private Integer direction;
    @ApiModelProperty(value = "开关动作(open:开、close:关)")
    @TableField(exist = false)
    private String action;
}
ruoyi-api/ruoyi-api-chargingPile/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -4,4 +4,5 @@
com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory
com.ruoyi.chargingPile.api.factory.AccountingStrategyDetailFallbackFactory
com.ruoyi.chargingPile.api.factory.AccountingStrategyFallbackFactory
com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory
com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory
com.ruoyi.chargingPile.api.factory.FaultMessageFallbackFactory
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SwitchwayGateFallbackFactory.java
New file
@@ -0,0 +1,34 @@
package com.ruoyi.integration.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.integration.api.feignClient.SendMessageClient;
import com.ruoyi.integration.api.feignClient.SwitchwayGateClient;
import com.ruoyi.integration.api.model.PlatformStartCharging;
import com.ruoyi.integration.api.model.PlatformStopCharging;
import com.ruoyi.integration.api.vo.SwitchwayGateReq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
 * 充电桩服务降级处理
 *
 * @author ruoyi
 */
@Component
public class SwitchwayGateFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<SwitchwayGateClient> {
    private static final Logger log = LoggerFactory.getLogger(SwitchwayGateFallbackFactory.class);
    @Override
    public SwitchwayGateClient create(Throwable throwable) {
        log.error("调用道闸开关失败:{}", throwable.getMessage());
        return new SwitchwayGateClient() {
            @Override
            public R<Boolean> gateService(SwitchwayGateReq req) {
                return R.fail("道闸开关失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/SwitchwayGateClient.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.integration.api.feignClient;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.integration.api.factory.SwitchwayGateFallbackFactory;
import com.ruoyi.integration.api.vo.SwitchwayGateReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
 * @author zhibing.pu
 * @Date 2024/9/10 11:08
 */
@FeignClient(contextId = "SwitchwayGateClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = SwitchwayGateFallbackFactory.class)
public interface SwitchwayGateClient {
    /**
     * 道闸开关
     * @param req
     * @return
     */
    @PostMapping("/switchwayGate/gateService")
    R<Boolean> gateService(@RequestBody SwitchwayGateReq req);
}
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/UploadRealTimeMonitoringData.java
@@ -35,7 +35,7 @@
    private BigDecimal loss_of_charging_degree; // 计损充电度数,精确到小数点后四位;待机置零,未设置计损比例时等于充电度数
    private BigDecimal paid_amount; // 已充金额,精确到小数点后四位;待机置零(电费+服务费)*计损充电度数
    private Integer hardware_fault; // 硬件故障(1:急停按钮动作故障;2:无可用整流模块;3:出风口温度过高;4:交流防雷故障;5:交直流模块 DC20 通信中断;6:绝缘检测模块 FC08 通信中断;7:电度表通信中断;8:读卡器通信中断;9:RC10 通信中断;10:风扇调速板故障;11:直流熔断器故障;12:高压接触器故障;13:门打开)
    private String createTime; // 格式化时间格式
    private BigDecimal electrovalence_all;// @ApiModelProperty("时段电价")
    private BigDecimal service_charge;//@ApiModelProperty("时段服务费单价")
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/vo/SwitchwayGateReq.java
New file
@@ -0,0 +1,19 @@
package com.ruoyi.integration.api.vo;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/9/10 10:48
 */
@Data
public class SwitchwayGateReq {
    /**
     * 开关动作(open:开、close:关)
     */
    private String action;
    /**
     * 通道编号
     */
    private String channel;
}
ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -3,4 +3,5 @@
com.ruoyi.integration.api.factory.ChargingHandshakeFallbackFactory
com.ruoyi.integration.api.factory.SendMessageFallbackFactory
com.ruoyi.integration.api.factory.PlatformStartChargingReplyFallbackFactory
com.ruoyi.integration.api.factory.PlatformStopChargingReplyFallbackFactory
com.ruoyi.integration.api.factory.PlatformStopChargingReplyFallbackFactory
com.ruoyi.integration.api.factory.SwitchwayGateFallbackFactory
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
@@ -108,6 +108,11 @@
            public R<SettlementTotalVO> settlementTotalR(String time) {
                return R.fail("查询结算汇总表导出列表失败:" + throwable.getMessage());
            }
            @Override
            public R<String> updateChargingOrder(TChargingOrder chargingOrder) {
                return R.fail("修改充电订单失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
@@ -118,4 +118,12 @@
    @GetMapping(value = "/financial/settlement/settlementTotalR")
    public R<SettlementTotalVO> settlementTotalR(String time);
    /**
     * 修改充电订单
     * @param chargingOrder
     * @return
     */
    @PostMapping("/t-charging-order/updateChargingOrder")
    R<String> updateChargingOrder(@RequestBody TChargingOrder chargingOrder);
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/ChargingListQuery.java
@@ -22,6 +22,8 @@
    private Integer type;
    @ApiModelProperty("状态(1未出账 2已出账)")
    private Integer state;
    @ApiModelProperty("状态(1日结 2月结)")
    private Integer orderState;
    @ApiModelProperty("uid 前端忽略")
    private String uid;
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/ExportUidDto.java
New file
@@ -0,0 +1,19 @@
package com.ruoyi.order.api.model;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("充电时段统计DTO")
public class ExportUidDto {
    @ApiModelProperty("uid")
    private String uid;
    @ApiModelProperty("时间")
    private String time;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingBill.java
@@ -55,6 +55,12 @@
    @ApiModelProperty(value = "1未出账2已出账")
    @TableField("status")
    private Integer status;
    @ApiModelProperty(value = "1日结2月结")
    @TableField("orderState")
    private Integer orderState;
    @ApiModelProperty(value = "账户类型 1微信商户 2支付宝商户")
    @TableField("payType")
    private Integer payType;
    @ApiModelProperty(value = "uid")
    @TableField(exist = false)
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java
@@ -159,7 +159,7 @@
    @TableField("refund_code")
    private String refundCode;
    @ApiModelProperty(value = "退款原因")
    @TableField("refund_reason")
    @TableField(exist = false)
    private String refundReason;
    @ApiModelProperty(value = "退款金额")
@@ -192,7 +192,9 @@
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("pay_time")
    private LocalDateTime payTime;
    @ApiModelProperty(value = "实时需求电流")
    @TableField("need_elec")
    private BigDecimal needElec;
    @ApiModelProperty(value = "站点名称")
    @TableField(exist = false)
    private String siteName;
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/query/TOrderInvoiceQuery.java
@@ -25,6 +25,8 @@
    @ApiModelProperty(value = "开票方式(1=人工,2=自动)")
    private Integer invoicingMethod;
    @ApiModelProperty(value = "状态(1=待开票,2=开票中,3=已开票)")
    private Integer status;
    @ApiModelProperty(value = "申请人电话")
    private String userPhone;
@@ -32,7 +34,7 @@
    @ApiModelProperty(value = "申请人姓名")
    private String nickName;
    @ApiModelProperty(value = "公司名称")
    @ApiModelProperty(value = "公司名称(抬头)")
    private String name;
    @ApiModelProperty(value = "用户id 前端忽略")
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java
@@ -14,6 +14,7 @@
public class ChargingBillListVO extends TChargingBill {
    @ApiModelProperty(value = "账单周期")
    private String billWeek;
    @ApiModelProperty(value = "充电时间 秒")
    private Integer chargingSecond;
    @ApiModelProperty(value = "订单数量")
@@ -36,4 +37,6 @@
    private BigDecimal commissionAmount;
    @ApiModelProperty(value = "充电电流 度")
    private BigDecimal chargingCapacity;
    @ApiModelProperty(value = "入账金额")
    private BigDecimal billMoney;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingOrderListVO.java
@@ -14,6 +14,8 @@
public class ChargingOrderListVO  {
    @ApiModelProperty(value = "电站名称")
    private String siteName;
    @ApiModelProperty(value = "订单状态")
    private Integer status;
    @ApiModelProperty(value = "电站id")
    private Integer siteId;
    @ApiModelProperty(value = "充电桩id")
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java
@@ -5,12 +5,14 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.TCompany;
import com.ruoyi.other.api.domain.TCoupon;
import com.ruoyi.other.api.domain.TInvoiceType;
import com.ruoyi.other.api.domain.TUserTag;
import com.ruoyi.other.api.dto.TagListQueryDto;
import com.ruoyi.other.api.dto.UnitListQueryDto;
import com.ruoyi.other.api.factory.OtherFallbackFactory;
import com.ruoyi.other.api.vo.CouponListVOVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@@ -24,8 +26,9 @@
 */
@FeignClient(contextId = "UnitClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = OtherFallbackFactory.class)
public interface OtherClient {
    //单位分页
    @PostMapping(value = "/t-company/unit/page")
    @PostMapping(value = "/t-invoice-type/t-company/unit/page")
    R<Page<TCompany>> queryUnitPage(@RequestBody UnitListQueryDto unitListQueryDto);
    //单位添加修改
    @PostMapping(value = "/t-company/unit/addOrUpdate")
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/BasePage.java
@@ -23,6 +23,9 @@
    private Integer pageSize = 10;
    public Integer getPageCurr() {
        if(null != pageCurr){
            pageCurr = (pageCurr - 1) * pageSize;
        }
        return pageCurr;
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserServiceImpl.java
@@ -149,7 +149,7 @@
            case 2:
                throw new ServiceException("账号被冻结,请联系管理员");
            case 3:
                throw new ServiceException("账号已注销,请重新注册使用");
//                throw new ServiceException("账号已注销,请重新注册使用");
            default:
                break;
        }
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
@@ -7,6 +7,7 @@
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.common.core.utils.WebUtils;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.order.api.model.ExportUidDto;
import com.ruoyi.order.api.feignClient.OrderClient;
import com.ruoyi.order.api.model.TChargingOrder;
import com.ruoyi.order.api.model.TSettlementConfirm;
@@ -247,11 +248,11 @@
    }
    @ApiOperation(value = "下载-已出账", tags = {"管理后台-充电算账单"})
    @GetMapping("/downloadBill")
    public R downloadBill(String uid,HttpServletResponse response)
    @PutMapping("/downloadBill")
    public R downloadBill(@RequestBody ExportUidDto uid, HttpServletResponse response)
    {
        ChargingListQuery chargingListQuery = new ChargingListQuery();
        chargingListQuery.setUid(uid);
        chargingListQuery.setUid(uid.getUid());
        chargingListQuery.setPageCurr(1);
        chargingListQuery.setPageSize(99999);
        ChargingBillVO data = chargingOrderClient.chargingBillListR(chargingListQuery).getData();
@@ -289,7 +290,8 @@
    @ApiOperation(value = "下载", tags = {"管理后台-账户结算账单"})
    @PutMapping("/downloadAccount")
    public R downloadAccount(@RequestBody ChargingListQuery dto,HttpServletResponse response)
    {
    {   dto.setPageCurr(1);
        dto.setPageSize(99999999);
        AccountListVO data = orderClient.accountBillList(dto).getData();
        try {
            response.setCharacterEncoding(Constants.UTF8);
@@ -320,10 +322,12 @@
    }
    @ApiOperation(value = "导出", tags = {"管理后台-结算汇总表"})
    @GetMapping("/downloadSettlementTotal")
    public R downloadSettlementTotal(String time,HttpServletResponse response)
    @PutMapping("/downloadSettlementTotal")
    public R downloadSettlementTotal(@RequestBody ExportUidDto uid,HttpServletResponse response)
    {
        SettlementTotalVO data = chargingOrderClient.settlementTotalR(time).getData();
        SettlementTotalVO data = chargingOrderClient.settlementTotalR(uid.getTime()).getData();
        try {
            response.setCharacterEncoding(Constants.UTF8);
            response.setContentType("application/vnd.ms-excel");
@@ -336,7 +340,7 @@
        try {
            // excel模板封装
            ExcelWriterBuilder excelWriterBuilder = EasyExcelFactory.write(response.getOutputStream());
            InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"运营商名称1-充电桩名称1-结算对账单明细-结算月份1" + ".xlsx");
            InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"结算汇总" + ".xlsx");
            // 自动释放资源
            try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) {
                WriteSheet writeSheet = EasyExcel.writerSheet().build();
@@ -353,10 +357,10 @@
        return R.ok();
    }
    @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"})
    @GetMapping("/downloadSettlement")
    public R downloadSettlement(String uid,HttpServletResponse response)
    @PutMapping("/downloadSettlement")
    public R downloadSettlement(@RequestBody ExportUidDto uid,HttpServletResponse response)
    {
        TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid).getData();
        TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid.getUid()).getData();
        List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData();
        if (!data1.isEmpty()){
            data.setSiteName(data1.get(0).getName());
@@ -405,7 +409,7 @@
    @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"})
    @GetMapping("/download")
    @PutMapping("/download")
    public R download(String uid,HttpServletResponse response)
    {
        ChargingListQuery chargingListQuery = new ChargingListQuery();
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java
@@ -3,10 +3,12 @@
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.io.FileUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.chargingPile.api.dto.TChargingGunDTO;
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.model.TFaultMessage;
import com.ruoyi.chargingPile.api.query.TChargingGunQuery;
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
import com.ruoyi.chargingPile.api.vo.TChargingGunVO;
@@ -210,5 +212,16 @@
        siteNameVO.setSiteName(site.getName());
        return R.ok(siteNameVO);
    }
    /**
     * 根据枪编号获取充电枪
     * @param code
     * @return
     */
    @PostMapping("/getChargingGunByCode/{code}")
    public R<TChargingGun> getChargingGunByCode(@PathVariable("code") String code){
        return R.ok(chargingGunService.getOne(Wrappers.lambdaQuery(TChargingGun.class)
                .eq(TChargingGun::getCode, code)
                .last("LIMIT 1")));
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TFaultMessageController.java
@@ -1,10 +1,13 @@
package com.ruoyi.chargingPile.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.chargingPile.api.dto.TChargingGunDTO;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TFaultMessage;
import com.ruoyi.chargingPile.service.TChargingPileService;
import com.ruoyi.chargingPile.service.TFaultMessageService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.BasePage;
import com.ruoyi.common.core.web.page.PageInfo;
@@ -82,5 +85,40 @@
        faultMessageService.removeById(id);
        return AjaxResult.success();
    }
    /**
     * 添加离线故障记录
     * @param faultMessage
     * @return
     */
    @PostMapping("/createFaultMessage")
    public R<String> createFaultMessage(@RequestBody TFaultMessage faultMessage){
        faultMessageService.save(faultMessage);
        return R.ok();
    }
    /**
     * 修改离线故障记录
     * @param faultMessage
     * @return
     */
    @PostMapping("/updateFaultMessage")
    public R<String> updateFaultMessage(@RequestBody TFaultMessage faultMessage){
        faultMessageService.updateById(faultMessage);
        return R.ok();
    }
    /**
     * 查询枪是否有离线或故障记录
     * @param gunId
     * @return
     */
    @PostMapping("/t-fault-message/getFaultMessageByGunId/{gunId}")
    public R<TFaultMessage> getFaultMessageByGunId(@PathVariable("gunId") Integer gunId){
        return R.ok(faultMessageService.getOne(Wrappers.lambdaQuery(TFaultMessage.class)
                .eq(TFaultMessage::getChargingGunId,gunId)
                .and(e->e.eq(TFaultMessage::getStatus,1).or().eq(TFaultMessage::getStatus,2))
                .isNull(TFaultMessage::getEndTime)
                .orderByDesc(TFaultMessage::getDownTime)
                .last("LIMIT 1")));
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TVehicleRampController.java
@@ -9,11 +9,14 @@
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.log.enums.OperatorType;
import com.ruoyi.integration.api.feignClient.SwitchwayGateClient;
import com.ruoyi.integration.api.vo.SwitchwayGateReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
@@ -31,6 +34,13 @@
public class TVehicleRampController {
    private final TVehicleRampService vehicleRampService;
    @Resource
    private SwitchwayGateClient switchwayGateClient;
    @Autowired
    public TVehicleRampController(TVehicleRampService vehicleRampService) {
@@ -95,8 +105,11 @@
    @ApiOperation(tags = {"后台-车道"},value = "开关闸车道")
    @PostMapping(value = "/openOrDown")
    public AjaxResult<String> openOrDown(@RequestBody TVehicleRamp dto) {
        // TODO 硬件 开关闸车道
        return AjaxResult.success();
        SwitchwayGateReq req = new SwitchwayGateReq();
        req.setAction(dto.getAction());
        req.setChannel(dto.getCarportNum());
        Boolean data = switchwayGateClient.gateService(req).getData();
        return data ? AjaxResult.success() : AjaxResult.error("操作失败");
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java
@@ -50,16 +50,26 @@
        // 查询站点的停车场id
        if(Objects.nonNull(query.getSiteId())){
            Site site = siteMapper.selectById(query.getSiteId());
            List<TParkingLot> tParkingLots = parkingLotMapper.selectList(Wrappers.lambdaQuery(TParkingLot.class)
                    .eq(TParkingLot::getSiteId, site.getId()));
            List<Integer> lotIds = tParkingLots.stream().map(TParkingLot::getId).collect(Collectors.toList());
            query.setLotIds(lotIds);
            if (site!=null){
                List<TParkingLot> tParkingLots = parkingLotMapper.selectList(Wrappers.lambdaQuery(TParkingLot.class)
                        .eq(TParkingLot::getSiteId, site.getId()));
                List<Integer> lotIds = tParkingLots.stream().map(TParkingLot::getId).collect(Collectors.toList());
                query.setLotIds(lotIds);
            }
        }
        PageInfo<TParkingRecordVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize());
        List<TParkingRecordVO> list = this.baseMapper.pageList(query,pageInfo);
        pageInfo.setRecords(list);
        // 查询总数
        TParkingRecordPageInfoVO infoVO = this.baseMapper.getParkingRecordCount(query);
        if (infoVO==null){
            infoVO = new TParkingRecordPageInfoVO();
            infoVO.setTimeoutAmountSum(new BigDecimal("0"));
            infoVO.setOrderCount(0);
            infoVO.setParkingDurationSum(0);
            infoVO.setFeeDurationSum(0);
        }
        infoVO.setParkingRecordVOS(pageInfo);
        return infoVO;
    }
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TFaultMessageMapper.xml
@@ -8,15 +8,17 @@
        <result column="app_user_id" property="appUserId" />
        <result column="site_id" property="siteId" />
        <result column="charging_pile_id" property="chargingPileId" />
        <result column="charging_gun_id" property="chargingGunId" />
        <result column="status" property="status" />
        <result column="down_time" property="downTime" />
        <result column="end_time" property="endTime" />
        <result column="create_time" property="createTime" />
        <result column="del_flag" property="delFlag" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, app_user_id, site_id, charging_pile_id, status, down_time, create_time, del_flag
        id, app_user_id, site_id, charging_pile_id, status, down_time, create_time, del_flag,charging_gun_id,end_time
    </sql>
    
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml
@@ -79,6 +79,7 @@
            </if>
            AND status = 3
        </where>
        group by create_time
        ORDER BY create_time DESC
    </select>
ruoyi-service/ruoyi-chargingPile/src/main/resources/template/结算汇总.xlsx
Binary files differ
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/CouponController.java
@@ -1,10 +1,12 @@
package com.ruoyi.integration.barrierGate.controller;
import com.alibaba.fastjson.JSON;
import com.ruoyi.integration.barrierGate.model.BaseResponse;
import com.ruoyi.integration.barrierGate.model.GetCouponReq;
import com.ruoyi.integration.barrierGate.model.GetCouponResp;
import com.ruoyi.integration.barrierGate.model.UsedCoupon;
import com.ruoyi.integration.barrierGate.server.CouponService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -14,6 +16,7 @@
 * @author zhibing.pu
 * @Date 2024/9/5 11:10
 */
@Slf4j
@RestController
@RequestMapping("/coupon")
public class CouponController {
@@ -31,6 +34,7 @@
    @ResponseBody
    @PostMapping("/getCoupon")
    public BaseResponse<GetCouponResp> getCoupon(@RequestBody GetCouponReq req){
        log.info("停车获取优惠券请求参数:{}" + JSON.toJSONString(req));
        GetCouponResp coupon = couponService.getCoupon(req);
        return BaseResponse.ok(coupon);
    }
@@ -44,6 +48,7 @@
    @ResponseBody
    @PostMapping("/usedCoupon")
    public BaseResponse usedCoupon(@RequestBody UsedCoupon req){
        log.info("停车使用优惠券请求参数:{}" + JSON.toJSONString(req));
        couponService.usedCoupon(req);
        return BaseResponse.ok();
    }
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/ParkingOrderController.java
@@ -1,7 +1,9 @@
package com.ruoyi.integration.barrierGate.controller;
import com.alibaba.fastjson.JSON;
import com.ruoyi.integration.barrierGate.model.*;
import com.ruoyi.integration.barrierGate.server.ParkingOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -10,6 +12,7 @@
 * @author zhibing.pu
 * @Date 2024/9/5 16:14
 */
@Slf4j
@RestController
@RequestMapping("/parkingOrder")
public class ParkingOrderController {
@@ -25,6 +28,7 @@
    @ResponseBody
    @PostMapping("/cloudParkingInOrder")
    public BaseResponse cloudParkingInOrder(@RequestBody CloudParkingOrder order){
        log.info("云停车入场请求参数:{}" + JSON.toJSONString(order));
        parkingOrderService.cloudParkingInOrder(order);
        return BaseResponse.ok();
    }
@@ -37,6 +41,7 @@
    @ResponseBody
    @PostMapping("/cloudParkingOutOrder")
    public BaseResponse cloudParkingOutOrder(@RequestBody CloudParkingOrder order){
        log.info("云停车出场请求参数:{}" + JSON.toJSONString(order));
        parkingOrderService.cloudParkingOutOrder(order);
        return BaseResponse.ok();
    }
@@ -49,6 +54,7 @@
    @ResponseBody
    @PostMapping("/cloudParkingSpace")
    public BaseResponse cloudParkingSpace(@RequestBody CloudParkingSpace parkingSpace){
        log.info("云停车实时车位请求参数:{}" + JSON.toJSONString(parkingSpace));
        parkingOrderService.cloudParkingSpace(parkingSpace);
        return BaseResponse.ok();
    }
@@ -62,6 +68,7 @@
    @ResponseBody
    @PostMapping("/offlineParkingInOrder")
    public BaseResponse offlineParkingInOrder(@RequestBody OfflineParkingOrder order){
        log.info("线下停车场入场请求参数:{}" + JSON.toJSONString(order));
        parkingOrderService.offlineParkingInOrder(order);
        OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse();
        offlineParkingResponse.setCode(0);
@@ -78,6 +85,7 @@
    @ResponseBody
    @PostMapping("/offlineParkingOutOrder")
    public BaseResponse offlineParkingOutOrder(@RequestBody OfflineParkingOrder order){
        log.info("线下停车场出场请求参数:{}" + JSON.toJSONString(order));
        parkingOrderService.offlineParkingOutOrder(order);
        OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse();
        offlineParkingResponse.setCode(0);
@@ -94,6 +102,7 @@
    @ResponseBody
    @PostMapping("/offlineParkingSpace")
    public BaseResponse offlineParkingSpace(@RequestBody OfflineParkingSpace parkingSpace){
        log.info("线下停车场实时车位请求参数:{}" + JSON.toJSONString(parkingSpace));
        parkingOrderService.offlineParkingSpace(parkingSpace);
        return BaseResponse.ok();
    }
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/SwitchwayGateController.java
New file
@@ -0,0 +1,36 @@
package com.ruoyi.integration.barrierGate.controller;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.integration.api.vo.SwitchwayGateReq;
import com.ruoyi.integration.barrierGate.server.SwitchwayGateService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
 * 开关道闸
 * @author zhibing.pu
 * @Date 2024/9/10 9:43
 */
@RestController
@RequestMapping("/switchwayGate")
public class SwitchwayGateController {
    @Resource
    private SwitchwayGateService switchwayGateService;
    /**
     * 开关道闸
     * @param req
     * @return
     */
    @PostMapping("/gateService")
    public R<Boolean> gateService(@RequestBody SwitchwayGateReq req){
        Boolean aBoolean = switchwayGateService.gateService(req);
        return R.ok(aBoolean);
    }
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/model/SwitchwayGate.java
New file
@@ -0,0 +1,50 @@
package com.ruoyi.integration.barrierGate.model;
import com.ruoyi.common.core.utils.MD5Util;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
/**
 * @author zhibing.pu
 * @Date 2024/9/10 9:45
 */
@Slf4j
@Data
@Accessors(chain = true)
public class SwitchwayGate {
    /**
     * 停车场appkey
     */
    private String appkey;
    /**
     * 开关动作(open:开、close:关)
     */
    private String action;
    /**
     * 通道编号
     */
    private String channel;
    /**
     * 当前时间戳
     */
    private String timestamp;
    /**
     * 签名信息:参数升序排序,&拼接所有参数,MD5(参数+&+参数值...+签名密钥)转大写
     */
    private String sign;
    public SwitchwayGate build(String secretkey){
        String str = String.format("action=%s&appkey=%s&channel=%s&timestamp=%s&key=%s", this.getAction(), this.getAppkey(), this.getChannel(), this.getTimestamp(), secretkey);
        log.info("待签名串:{}", str);
        //MD5加密
        String encoder = MD5Util.getMD5(str);
        //将签名结果转大写
        encoder = encoder.toUpperCase();
        log.info("签名结果:{}", encoder);
        this.setSign(encoder);
        return this;
    }
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/SwitchwayGateService.java
New file
@@ -0,0 +1,61 @@
package com.ruoyi.integration.barrierGate.server;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.integration.api.vo.SwitchwayGateReq;
import com.ruoyi.integration.barrierGate.model.SwitchwayGate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
 * @author zhibing.pu
 * @Date 2024/9/10 9:44
 */
@Slf4j
@Service
public class SwitchwayGateService {
    private final String url = "http://8.137.103.127/universal";
    private final String appkey = "886621e841fc44c1ad63a823d";
    private final String secretkey = "7d87c2c36bea4749b30f38f4d";
    /**
     * 开关道闸
     * @param req
     * @return
     */
    public Boolean gateService(SwitchwayGateReq req){
        SwitchwayGate switchwayGate = new SwitchwayGate()
                .setAppkey(appkey)
                .setAction(req.getAction())
                .setChannel(req.getChannel())
                .setTimestamp(System.currentTimeMillis() + "")
                .build(secretkey);
        String body = JSON.toJSONString(switchwayGate);
        String result = HttpUtil.post(url + "/gateService", body);
        JSONObject jsonObject = JSON.parseObject(result);
        Boolean success = jsonObject.getBoolean("success");
        if(!success){
            log.error("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result);
        }
        return success;
    }
//    public static void main(String[] args) {
//        SwitchwayGateService switchwayGateService = new SwitchwayGateService();
//        SwitchwayGateReq req = new SwitchwayGateReq();
//        req.setAction("close");
//        req.setChannel("001");
//        Boolean success = switchwayGateService.gateService(req);
//        if(success){
//            log.info("调用成功");
//        }else{
//            log.info("调用失败");
//        }
//    }
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/builder/IotBuilder.java
@@ -34,7 +34,7 @@
        return IoTDAClient.newBuilder()
                .withCredential(auth)
                // 标准版/企业版:需自行创建Region对象,基础版:请使用IoTDARegion的region对象,如"withRegion(IoTDARegion.CN_NORTH_4)"
                .withRegion(new Region("cn-north-4", IotConstant.URL))
                .withRegion(new Region("cn-south-1", IotConstant.URL))
                .build();
    }
    /**
@@ -50,7 +50,7 @@
                .withSk(config.getSk());
        return IamClient.newBuilder()
                .withCredential(auth)
                .withRegion(IamRegion.valueOf("cn-north-4"))
                .withRegion(IamRegion.valueOf("cn-south-1"))
                .build();
    }
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/IotConstant.java
@@ -14,7 +14,7 @@
    /**
     * URL
     */
    public static final String URL = "https://iotda.cn-north-4.myhuaweicloud.com";
    public static final String URL = "https://94cb3eb5f9.st1.iotda-app.cn-south-1.myhuaweicloud.com";
    /**
     * 创建产品
     */
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/SendTagConstant.java
@@ -35,6 +35,10 @@
     */
    public static final String CHARGING_HANDSHAKE ="charging_handshake";
    /**
     * 参数配置
     */
    public static final String PARAMETER_SETTING ="parameter_setting";
    /**
     * 充电阶段BMS中止
     */
    public static final String BMS_ABORT ="bms_abort";
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java
@@ -1,8 +1,19 @@
package com.ruoyi.integration.iotda.utils.listener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO;
import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient;
import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.integration.api.model.*;
import com.ruoyi.integration.iotda.constant.SendTagConstant;
import com.ruoyi.integration.iotda.enums.ServiceIdMenu;
import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce;
import com.ruoyi.integration.iotda.utils.tools.CP56Time2aConverter;
import com.ruoyi.integration.iotda.utils.tools.MessageUtil;
import com.ruoyi.integration.iotda.utils.tools.StrategyUtil;
import com.ruoyi.integration.rocket.model.*;
import com.ruoyi.integration.rocket.produce.EnhanceProduce;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendResult;
@@ -12,6 +23,9 @@
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * iotda消息监听
@@ -22,7 +36,12 @@
    @Autowired
    private EnhanceProduce enhanceProduce;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private IotMessageProduce iotMessageProduce;
    @Autowired
    private AccountingStrategyDetailClient accountingStrategyDetailClient;
    /**
     * 设备消息监听
     * @param jsonObject
@@ -32,86 +51,194 @@
    @PostMapping(value = "/message")
    public AjaxResult<String> message(@RequestBody JSONObject jsonObject) throws IOException {
        log.info("接收到消息中转:{}",jsonObject);
        JSONObject content = jsonObject.getJSONObject("content");
        JSONObject content = jsonObject.getJSONObject("notify_data").getJSONObject("body").getJSONObject("content");
        JSONObject header = jsonObject.getJSONObject("notify_data").getJSONObject("header");
        String deviceId = header.getString("device_id"); // 设备id
        String nodeId = header.getString("node_id"); // 设备编号
        String productId = header.getString("product_id"); // 产品id
        String service_id = content.getString("service_id");
        log.info("服务id:{}",service_id);
        SendResult sendResult;
        // 设备消息下发
        String result;
        switch (service_id){
            case SendTagConstant.ONLINE:
                sendResult = enhanceProduce.onlineMessage(content);
                OnlineMessage onlineMessage = JSON.parseObject(jsonObject.toJSONString(),OnlineMessage.class);
                sendResult = enhanceProduce.onlineMessage(onlineMessage);
                // 响应硬件
                // 业务处理 登录认证应答
                OnlineReply onlineReply = new OnlineReply();
                onlineReply.setCharging_pile_code(onlineMessage.getCharging_pile_code());
                onlineReply.setOnline_result(0);
                result = iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply));
                log.info("充电桩登录认证-返回结果:{}",result);
                break;
            case SendTagConstant.PING:
                sendResult = enhanceProduce.pingMessage(content);
                PingMessage pingMessage = JSON.parseObject(jsonObject.toJSONString(),PingMessage.class);
                sendResult = enhanceProduce.pingMessage(pingMessage);
                // 响应硬件
                Pong pong = new Pong();
                pong.setCharging_pile_code(pingMessage.getCharging_pile_code());
                pong.setCharging_gun_code(pingMessage.getCharging_gun_code());
                pong.setCharging_gun_status(0);
                result = iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong));
                log.info("充电桩心跳包-返回结果:{}",result);
                break;
            case SendTagConstant.END_CHARGE:
                sendResult = enhanceProduce.endChargeMessage(content);
                EndChargeMessage endChargeMessage = JSON.parseObject(jsonObject.toJSONString(),EndChargeMessage.class);
                sendResult = enhanceProduce.endChargeMessage(endChargeMessage);
                // 响应硬件
                break;
            case SendTagConstant.BILLING_MODE_VERIFY:
                sendResult = enhanceProduce.billingModeVerifyMessage(content);
                BillingModeVerifyMessage billingModeVerifyMessage = JSON.parseObject(jsonObject.toJSONString(),BillingModeVerifyMessage.class);
                sendResult = enhanceProduce.billingModeVerifyMessage(billingModeVerifyMessage);
                // 响应硬件
                BillingModeVerifyReply billingModeVerifyReply = new BillingModeVerifyReply();
                if(billingModeVerifyMessage.getBilling_model_code().equals("0")){
                    // 首次
                    billingModeVerifyReply.setCharging_pile_code(billingModeVerifyMessage.getCharging_pile_code());
                    billingModeVerifyReply.setBilling_model_code("0");
                    billingModeVerifyReply.setBilling_model_result(1);
                }else {
                    // 查询桩使用的模版
                    CheckChargingStrategyDTO dto = new CheckChargingStrategyDTO();
                    dto.setCode(billingModeVerifyMessage.getBilling_model_code());
                    dto.setStrategyDetailId(Integer.valueOf(billingModeVerifyMessage.getBilling_model_code()));
                    Boolean check = accountingStrategyDetailClient.checkChargingStrategy(dto).getData();
                    // 校验计费模版是否准确
                    billingModeVerifyReply.setCharging_pile_code(billingModeVerifyMessage.getCharging_pile_code());
                    billingModeVerifyReply.setBilling_model_code(billingModeVerifyMessage.getBilling_model_code());
                    if(check){
                        billingModeVerifyReply.setBilling_model_result(0);
                    }else {
                        billingModeVerifyReply.setBilling_model_result(1);
                    }
                }
                iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply));
                break;
            case SendTagConstant.ACQUISITION_BILLING_MODE:
                sendResult = enhanceProduce.acquisitionBillingModeMessage(content);
                AcquisitionBillingModeMessage acquisitionBillingModeMessage = JSON.parseObject(jsonObject.toJSONString(),AcquisitionBillingModeMessage.class);
                sendResult = enhanceProduce.acquisitionBillingModeMessage(acquisitionBillingModeMessage);
                // 响应硬件   计费模型请求应答  1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段
                List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(acquisitionBillingModeMessage.getCharging_pile_code()).getData();
                Map<Integer, TAccountingStrategyDetail> strategyPrice = StrategyUtil.getStrategyPrice(accountingStrategyDetails);
                // 价格设置
                AcquisitionBillingModeReply acquisitionBillingModeReply = new AcquisitionBillingModeReply();
                StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply);
                // 时段设置
                StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply);
                iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply));
                break;
            case SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA:
                sendResult = enhanceProduce.uploadRealTimeMonitoringDataMessage(content);
                UploadRealTimeMonitoringDataMessage uploadRealTimeMonitoringDataMessage = JSON.parseObject(jsonObject.toJSONString(),UploadRealTimeMonitoringDataMessage.class);
                sendResult = enhanceProduce.uploadRealTimeMonitoringDataMessage(uploadRealTimeMonitoringDataMessage);
                // 响应硬件
                break;
            case SendTagConstant.CHARGING_HANDSHAKE:
                sendResult = enhanceProduce.chargingHandshakeMessage(content);
                ChargingHandshakeMessage chargingHandshakeMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingHandshakeMessage.class);
                sendResult = enhanceProduce.chargingHandshakeMessage(chargingHandshakeMessage);
                // 响应硬件
                break;
            case SendTagConstant.PARAMETER_SETTING:
                ParameterSettingMessage parameterSettingMessage = JSON.parseObject(jsonObject.toJSONString(),ParameterSettingMessage.class);
                sendResult = enhanceProduce.parameterSettingMessage(parameterSettingMessage);
                break;
            case SendTagConstant.BMS_ABORT:
                sendResult = enhanceProduce.bmsAbortMessage(content);
                BmsAbortMessage bmsAbortMessage = JSON.parseObject(jsonObject.toJSONString(),BmsAbortMessage.class);
                sendResult = enhanceProduce.bmsAbortMessage(bmsAbortMessage);
                // 响应硬件
                break;
            case SendTagConstant.MOTOR_ABORT:
                sendResult = enhanceProduce.motorAbortMessage(content);
                MotorAbortMessage motorAbortMessage = JSON.parseObject(jsonObject.toJSONString(),MotorAbortMessage.class);
                sendResult = enhanceProduce.motorAbortMessage(motorAbortMessage);
                break;
            case SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION:
                sendResult = enhanceProduce.bmsDemandAndChargerExportationMessage(content);
                BmsDemandAndChargerExportationMessage bmsDemandAndChargerExportationMessage = JSON.parseObject(jsonObject.toJSONString(),BmsDemandAndChargerExportationMessage.class);
                sendResult = enhanceProduce.bmsDemandAndChargerExportationMessage(bmsDemandAndChargerExportationMessage);
                // 响应硬件
                break;
            case SendTagConstant.BMS_INFORMATION:
                sendResult = enhanceProduce.bmsInformationMessage(content);
                BmsInformationMessage bmsInformationMessage = JSON.parseObject(jsonObject.toJSONString(),BmsInformationMessage.class);
                sendResult = enhanceProduce.bmsInformationMessage(bmsInformationMessage);
                // 响应硬件
                break;
            case SendTagConstant.CHARGING_PILE_STARTS_CHARGING:
                sendResult = enhanceProduce.chargingPileStartsChargingMessage(content);
                ChargingPileStartsChargingMessage chargingPileStartsChargingMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingPileStartsChargingMessage.class);
                sendResult = enhanceProduce.chargingPileStartsChargingMessage(chargingPileStartsChargingMessage);
                // 响应硬件
                break;
            case SendTagConstant.PLATFORM_START_CHARGING_REPLY:
                sendResult = enhanceProduce.platformStartChargingReplyMessage(content);
                PlatformStartChargingReplyMessage platformStartChargingReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformStartChargingReplyMessage.class);
                sendResult = enhanceProduce.platformStartChargingReplyMessage(platformStartChargingReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.PLATFORM_STOP_CHARGING_REPLY:
                sendResult = enhanceProduce.platformStopChargingReplyMessage(content);
                PlatformStopChargingReplyMessage platformStopChargingReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformStopChargingReplyMessage.class);
                sendResult = enhanceProduce.platformStopChargingReplyMessage(platformStopChargingReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.TRANSACTION_RECORD:
                sendResult = enhanceProduce.transactionRecordMessage(content);
                TransactionRecordMessage transactionRecordMessage = JSON.parseObject(jsonObject.toJSONString(),TransactionRecordMessage.class);
                sendResult = enhanceProduce.transactionRecordMessage(transactionRecordMessage);
                // 响应硬件
                ConfirmTransactionRecord confirmTransactionRecord = new ConfirmTransactionRecord();
                confirmTransactionRecord.setTransaction_serial_number(transactionRecordMessage.getTransaction_serial_number());
                confirmTransactionRecord.setConfirm_result(0);
                iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord));
                break;
            case SendTagConstant.UPDATE_BALANCE_REPLY:
                sendResult = enhanceProduce.updateBalanceReplyMessage(content);
                UpdateBalanceReplyMessage updateBalanceReplyMessage = JSON.parseObject(jsonObject.toJSONString(),UpdateBalanceReplyMessage.class);
                sendResult = enhanceProduce.updateBalanceReplyMessage(updateBalanceReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY:
                sendResult = enhanceProduce.synchronizeOfflineCardReplyMessage(content);
                SynchronizeOfflineCardReplyMessage synchronizeOfflineCardReplyMessage = JSON.parseObject(jsonObject.toJSONString(),SynchronizeOfflineCardReplyMessage.class);
                sendResult = enhanceProduce.synchronizeOfflineCardReplyMessage(synchronizeOfflineCardReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.CLEAR_OFFLINE_CARD_REPLY:
                sendResult = enhanceProduce.clearOfflineCardReplyMessage(content);
                ClearOfflineCardReplyMessage clearOfflineCardReplyMessage = JSON.parseObject(jsonObject.toJSONString(),ClearOfflineCardReplyMessage.class);
                sendResult = enhanceProduce.clearOfflineCardReplyMessage(clearOfflineCardReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.WORKING_PARAMETER_SETTING_REPLY:
                sendResult = enhanceProduce.workingParameterSettingReplyMessage(content);
                WorkingParameterSettingReplyMessage workingParameterSettingReplyMessage = JSON.parseObject(jsonObject.toJSONString(),WorkingParameterSettingReplyMessage.class);
                sendResult = enhanceProduce.workingParameterSettingReplyMessage(workingParameterSettingReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.TIMING_SETTING:
                sendResult = enhanceProduce.timingSettingMessage(content);
                TimingSettingMessage timingSettingMessage = JSON.parseObject(jsonObject.toJSONString(),TimingSettingMessage.class);
                sendResult = enhanceProduce.timingSettingMessage(timingSettingMessage);
                // 响应硬件 对时设置应答
                TimingSettingReply timingSettingReply = new TimingSettingReply();
                timingSettingReply.setCharging_pile_code(timingSettingMessage.getCharging_pile_code());
                timingSettingReply.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date()));
                iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply));
                break;
            case SendTagConstant.SETUP_BILLING_MODEL_REPLY:
                sendResult = enhanceProduce.setupBillingModelReplyMessage(content);
                SetupBillingModelReplyMessage setupBillingModelReplyMessage = JSON.parseObject(jsonObject.toJSONString(),SetupBillingModelReplyMessage.class);
                sendResult = enhanceProduce.setupBillingModelReplyMessage(setupBillingModelReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.GROUND_LOCK_REAL_TIME_DATA:
                sendResult = enhanceProduce.groundLockRealTimeDataMessage(content);
                GroundLockRealTimeDataMessage groundLockRealTimeDataMessage = JSON.parseObject(jsonObject.toJSONString(),GroundLockRealTimeDataMessage.class);
                sendResult = enhanceProduce.groundLockRealTimeDataMessage(groundLockRealTimeDataMessage);
                // 响应硬件
                break;
            case SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA:
                sendResult = enhanceProduce.chargingPileReturnsGroundLockDataMessage(content);
                ChargingPileReturnsGroundLockDataMessage chargingPileReturnsGroundLockDataMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingPileReturnsGroundLockDataMessage.class);
                sendResult = enhanceProduce.chargingPileReturnsGroundLockDataMessage(chargingPileReturnsGroundLockDataMessage);
                // 响应硬件
                break;
            case SendTagConstant.PLATFORM_RESTART_REPLY:
                sendResult = enhanceProduce.platformRestartReplyMessage(content);
                PlatformRestartReplyMessage platformRestartReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformRestartReplyMessage.class);
                sendResult = enhanceProduce.platformRestartReplyMessage(platformRestartReplyMessage);
                // 响应硬件
                break;
            default:
                sendResult = enhanceProduce.platformRemoteUpdateReplyMessage(content);
                PlatformRemoteUpdateReplyMessage platformRemoteUpdateReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformRemoteUpdateReplyMessage.class);
                sendResult = enhanceProduce.platformRemoteUpdateReplyMessage(platformRemoteUpdateReplyMessage);
                // 响应硬件
                break;
        }
        log.info("rocketmq消息下发结果:{}",sendResult);
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/configuration/RocketMQEnhanceAutoConfiguration.java
@@ -29,7 +29,7 @@
    /**
     * 解决RocketMQ Jackson不支持Java时间类型配置
     * 源码参考:{@link org.apache.rocketmq.spring.autoconfigure.MessageConverterConfiguration}
     * 源码参考:{@link org.apache.rocketmq.spring.autoconfigure}
     */
    @Bean
    @Primary
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/AcquisitionBillingModeMessageListener.java
@@ -13,6 +13,7 @@
import com.ruoyi.integration.rocket.model.AcquisitionBillingModeMessage;
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;
@@ -26,9 +27,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_acquisition_billing_mode",
        topic = "charge_acquisition_billing_mode",
        selectorExpression = "acquisition_billing_mode", // 明确指定标签
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class AcquisitionBillingModeMessageListener extends EnhanceMessageHandler<AcquisitionBillingModeMessage> implements RocketMQListener<AcquisitionBillingModeMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BillingModeVerifyMessageListener.java
@@ -14,6 +14,7 @@
import com.ruoyi.integration.rocket.model.BillingModeVerifyMessage;
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;
@@ -23,21 +24,16 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_billing_mode_verify",
        topic = "charge_billing_mode_verify",
        selectorExpression = "billing_mode_verify",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class BillingModeVerifyMessageListener extends EnhanceMessageHandler<BillingModeVerifyMessage> implements RocketMQListener<BillingModeVerifyMessage> {
    @Autowired
    private BillingModeVerifyService billingModeVerifyService;
    @Autowired
    private IotMessageProduce iotMessageProduce;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private AccountingStrategyDetailClient accountingStrategyDetailClient;
    @Override
    protected void handleMessage(BillingModeVerifyMessage message) throws Exception {
@@ -48,28 +44,6 @@
        BeanUtils.copyProperties(message,billingModeVerify);
        billingModeVerifyService.create(billingModeVerify);
        // 业务处理
        BillingModeVerifyReply billingModeVerifyReply = new BillingModeVerifyReply();
        if(message.getBilling_model_code().equals("0")){
            // 首次
            billingModeVerifyReply.setCharging_pile_code(billingModeVerify.getCharging_pile_code());
            billingModeVerifyReply.setBilling_model_code("0");
            billingModeVerifyReply.setBilling_model_result(1);
        }else {
            // 查询桩使用的模版
            CheckChargingStrategyDTO dto = new CheckChargingStrategyDTO();
            dto.setCode(message.getBilling_model_code());
            dto.setStrategyDetailId(Integer.valueOf(message.getBilling_model_code()));
            Boolean check = accountingStrategyDetailClient.checkChargingStrategy(dto).getData();
            // 校验计费模版是否准确
            billingModeVerifyReply.setCharging_pile_code(billingModeVerify.getCharging_pile_code());
            billingModeVerifyReply.setBilling_model_code(message.getBilling_model_code());
            if(check){
                billingModeVerifyReply.setBilling_model_result(0);
            }else {
                billingModeVerifyReply.setBilling_model_result(1);
            }
        }
        iotMessageProduce.sendMessage(billingModeVerifyReply.getCharging_pile_code(), ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply));
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BmsAbortMessageListener.java
@@ -7,6 +7,7 @@
import com.ruoyi.integration.rocket.util.EnhanceMessageHandler;
import com.ruoyi.order.api.feignClient.ChargingOrderClient;
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;
@@ -18,9 +19,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_bms_abort",
        topic = "charge_bms_abort",
        selectorExpression = "bms_abort",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class BmsAbortMessageListener extends EnhanceMessageHandler<BmsAbortMessage> implements RocketMQListener<BmsAbortMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BmsDemandAndChargerExportationMessageListener.java
@@ -5,25 +5,33 @@
import com.ruoyi.integration.mongodb.service.BmsDemandAndChargerExportationService;
import com.ruoyi.integration.rocket.model.BmsDemandAndChargerExportationMessage;
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;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Objects;
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_bms_demand_and_charger_exportation",
        topic = "charge_bms_demand_and_charger_exportation",
        selectorExpression = "bms_demand_and_charger_exportation",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class BmsDemandAndChargerExportationMessageListener extends EnhanceMessageHandler<BmsDemandAndChargerExportationMessage> implements RocketMQListener<BmsDemandAndChargerExportationMessage> {
    @Autowired
    private BmsDemandAndChargerExportationService bmsDemandAndChargerExportationService;
    @Autowired
    private ChargingOrderClient chargingOrderClient;
    @Override
    protected void handleMessage(BmsDemandAndChargerExportationMessage message) throws Exception {
        // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试
@@ -33,6 +41,11 @@
        BeanUtils.copyProperties(message,bmsDemandAndChargerExportation);
        bmsDemandAndChargerExportationService.create(bmsDemandAndChargerExportation);
        // 业务处理
        TChargingOrder chargingOrder = chargingOrderClient.getOrderByCode(message.getTransaction_serial_number()).getData();
        if(Objects.nonNull(chargingOrder)){
            chargingOrder.setNeedElec(message.getBms_current_requirements());
            chargingOrderClient.updateChargingOrder(chargingOrder);
        }
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BmsInformationMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.BmsInformationMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_bms_information",
        topic = "charge_bms_information",
        selectorExpression = "bms_information",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class BmsInformationMessageListener extends EnhanceMessageHandler<BmsInformationMessage> implements RocketMQListener<BmsInformationMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ChargingHandshakeMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.ChargingHandshakeMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_charging_handshake",
        topic = "charge_charging_handshake",
        selectorExpression = "charging_handshake",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class ChargingHandshakeMessageListener extends EnhanceMessageHandler<ChargingHandshakeMessage> implements RocketMQListener<ChargingHandshakeMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ChargingPileReturnsGroundLockDataMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.ChargingPileReturnsGroundLockDataMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_charging_pile_returns_ground_lock_data",
        topic = "charge_charging_pile_returns_ground_lock_data",
        selectorExpression = "charging_pile_returns_ground_lock_data",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class ChargingPileReturnsGroundLockDataMessageListener extends EnhanceMessageHandler<ChargingPileReturnsGroundLockDataMessage> implements RocketMQListener<ChargingPileReturnsGroundLockDataMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ChargingPileStartsChargingMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.ChargingPileStartsChargingMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_charging_pile_starts_charging",
        topic = "charge_charging_pile_starts_charging",
        selectorExpression = "charging_pile_starts_charging",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class ChargingPileStartsChargingMessageListener extends EnhanceMessageHandler<ChargingPileStartsChargingMessage> implements RocketMQListener<ChargingPileStartsChargingMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ClearOfflineCardReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.ClearOfflineCardReplyMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_clear_offline_card_reply",
        topic = "charge_clear_offline_card_reply",
        selectorExpression = "clear_offline_card_reply",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class ClearOfflineCardReplyMessageListener extends EnhanceMessageHandler<ClearOfflineCardReplyMessage> implements RocketMQListener<ClearOfflineCardReplyMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EndChargeMessageListener.java
@@ -13,6 +13,7 @@
import com.ruoyi.integration.rocket.util.EnhanceMessageHandler;
import com.ruoyi.order.api.feignClient.ChargingOrderClient;
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;
@@ -24,9 +25,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_end_charge",
        topic = "charge_end_charge",
        selectorExpression = "end_charge",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class EndChargeMessageListener extends EnhanceMessageHandler<EndChargeMessage> implements RocketMQListener<EndChargeMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/GroundLockRealTimeDataMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.GroundLockRealTimeDataMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_ground_lock_real_time_data",
        topic = "charge_ground_lock_real_time_data",
        selectorExpression = "ground_lock_real_time_data",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class GroundLockRealTimeDataMessageListener extends EnhanceMessageHandler<GroundLockRealTimeDataMessage> implements RocketMQListener<GroundLockRealTimeDataMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/MotorAbortMessageListener.java
@@ -7,6 +7,7 @@
import com.ruoyi.integration.rocket.util.EnhanceMessageHandler;
import com.ruoyi.order.api.feignClient.ChargingOrderClient;
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;
@@ -18,9 +19,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_motor_abort",
        topic = "charge_motor_abort",
        selectorExpression = "motor_abort",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class MotorAbortMessageListener extends EnhanceMessageHandler<MotorAbortMessage> implements RocketMQListener<MotorAbortMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/OnlineMessageListener.java
@@ -10,6 +10,7 @@
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;
@@ -19,19 +20,16 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_online",
        topic = "charge_online",
        selectorExpression = "online", // 明确指定标签
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class OnlineMessageListener extends EnhanceMessageHandler<OnlineMessage> implements RocketMQListener<OnlineMessage> {
    @Autowired
    private OnlineService onlineService;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private IotMessageProduce iotMessageProduce;
    @Override
    protected void handleMessage(OnlineMessage message) throws Exception {
@@ -41,12 +39,7 @@
        Online online = new Online();
        BeanUtils.copyProperties(message,online);
        onlineService.create(online);
        // 业务处理 登录认证应答
        OnlineReply onlineReply = new OnlineReply();
        onlineReply.setCharging_pile_code(message.getCharging_pile_code());
        onlineReply.setOnline_result(0);
        String result = iotMessageProduce.sendMessage(onlineReply.getCharging_pile_code(), ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply));
        log.info("充电桩登录认证-返回结果:{}",result);
        // 业务处理
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ParameterSettingMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.ParameterSettingMessage;
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;
@@ -15,6 +16,7 @@
@Slf4j
@Component
@RocketMQMessageListener(
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java
@@ -11,6 +11,7 @@
import com.ruoyi.integration.rocket.model.PingMessage;
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,19 +21,16 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_ping",
        topic = "charge_ping",
        selectorExpression = "ping",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class PingMessageListener extends EnhanceMessageHandler<PingMessage> implements RocketMQListener<PingMessage> {
    @Autowired
    private PingService pingService;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private IotMessageProduce iotMessageProduce;
    @Override
    protected void handleMessage(PingMessage message) throws Exception {
        // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试
@@ -42,12 +40,6 @@
        BeanUtils.copyProperties(message,ping);
        pingService.create(ping);
        // 业务处理
        Pong pong = new Pong();
        pong.setCharging_pile_code(message.getCharging_pile_code());
        pong.setCharging_gun_code(message.getCharging_gun_code());
        pong.setCharging_gun_status(0);
        String result = iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong));
        log.info("充电桩心跳包-返回结果:{}",result);
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PlatformRemoteUpdateReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.PlatformRemoteUpdateReplyMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_platform_remote_update_reply",
        topic = "charge_platform_remote_update_reply",
        selectorExpression = "platform_remote_update_reply",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class PlatformRemoteUpdateReplyMessageListener extends EnhanceMessageHandler<PlatformRemoteUpdateReplyMessage> implements RocketMQListener<PlatformRemoteUpdateReplyMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PlatformRestartReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.PlatformRestartReplyMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_platform_restart_reply",
        topic = "charge_platform_restart_reply",
        selectorExpression = "platform_restart_reply",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class PlatformRestartReplyMessageListener extends EnhanceMessageHandler<PlatformRestartReplyMessage> implements RocketMQListener<PlatformRestartReplyMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PlatformStartChargingReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.PlatformStartChargingReplyMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_platform_start_charging_reply",
        topic = "charge_platform_start_charging_reply",
        selectorExpression = "platform_start_charging_reply",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class PlatformStartChargingReplyMessageListener extends EnhanceMessageHandler<PlatformStartChargingReplyMessage> implements RocketMQListener<PlatformStartChargingReplyMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PlatformStopChargingReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.PlatformStopChargingReplyMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_platform_stop_charging_reply",
        topic = "charge_platform_stop_charging_reply",
        selectorExpression = "platform_stop_charging_reply",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class PlatformStopChargingReplyMessageListener extends EnhanceMessageHandler<PlatformStopChargingReplyMessage> implements RocketMQListener<PlatformStopChargingReplyMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/QueryOfflineCardReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.QueryOfflineCardReplyMessage;
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;
@@ -15,6 +16,7 @@
@Slf4j
@Component
@RocketMQMessageListener(
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/SetupBillingModelReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.SetupBillingModelReplyMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_setup_billing_model_reply",
        topic = "charge_setup_billing_model_reply",
        selectorExpression = "setup_billing_model_reply",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class SetupBillingModelReplyMessageListener extends EnhanceMessageHandler<SetupBillingModelReplyMessage> implements RocketMQListener<SetupBillingModelReplyMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/SynchronizeOfflineCardReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.SynchronizeOfflineCardReplyMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_synchronize_offline_card_reply",
        topic = "charge_synchronize_offline_card_reply",
        selectorExpression = "synchronize_offline_card_reply",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class SynchronizeOfflineCardReplyMessageListener extends EnhanceMessageHandler<SynchronizeOfflineCardReplyMessage> implements RocketMQListener<SynchronizeOfflineCardReplyMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TimingSettingMessageListener.java
@@ -11,6 +11,7 @@
import com.ruoyi.integration.rocket.model.TimingSettingMessage;
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;
@@ -22,9 +23,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_timing_setting",
        topic = "charge_timing_setting",
        selectorExpression = "timing_setting",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class TimingSettingMessageListener extends EnhanceMessageHandler<TimingSettingMessage> implements RocketMQListener<TimingSettingMessage> {
@@ -43,11 +45,7 @@
        TimingSetting timingSetting = new TimingSetting();
        BeanUtils.copyProperties(message,timingSetting);
        timingSettingService.create(timingSetting);
        // 业务处理  对时设置应答
        TimingSettingReply timingSettingReply = new TimingSettingReply();
        timingSettingReply.setCharging_pile_code(message.getCharging_pile_code());
        timingSettingReply.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date()));
        iotMessageProduce.sendMessage(timingSettingReply.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply));
        // 业务处理
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TransactionRecordMessageListener.java
@@ -10,6 +10,7 @@
import com.ruoyi.integration.rocket.model.TransactionRecordMessage;
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;
@@ -19,9 +20,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_transaction_record",
        topic = "charge_transaction_record",
        selectorExpression = "transaction_record",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class TransactionRecordMessageListener extends EnhanceMessageHandler<TransactionRecordMessage> implements RocketMQListener<TransactionRecordMessage> {
@@ -41,10 +43,6 @@
        BeanUtils.copyProperties(message,transactionRecord);
        transactionRecordService.create(transactionRecord);
        // 业务处理
        ConfirmTransactionRecord confirmTransactionRecord = new ConfirmTransactionRecord();
        confirmTransactionRecord.setTransaction_serial_number(message.getTransaction_serial_number());
        confirmTransactionRecord.setConfirm_result(0);
        iotMessageProduce.sendMessage(confirmTransactionRecord.getTransaction_serial_number(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord));
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/UpdateBalanceReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.UpdateBalanceReplyMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_update_balance_reply",
        topic = "charge_update_balance_reply",
        selectorExpression = "update_balance_reply",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class UpdateBalanceReplyMessageListener extends EnhanceMessageHandler<UpdateBalanceReplyMessage> implements RocketMQListener<UpdateBalanceReplyMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/UploadRealTimeMonitoringDataMessageListener.java
@@ -1,7 +1,11 @@
package com.ruoyi.integration.rocket.listener;
import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient;
import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient;
import com.ruoyi.chargingPile.api.feignClient.FaultMessageClient;
import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TFaultMessage;
import com.ruoyi.integration.api.model.Online;
import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData;
import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService;
@@ -11,6 +15,7 @@
import com.ruoyi.order.api.model.TChargingOrder;
import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery;
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,14 +25,16 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.Objects;
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_upload_real_time_monitoring_data",
        topic = "charge_upload_real_time_monitoring_data",
        selectorExpression = "upload_real_time_monitoring_data",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class UploadRealTimeMonitoringDataMessageListener extends EnhanceMessageHandler<UploadRealTimeMonitoringDataMessage> implements RocketMQListener<UploadRealTimeMonitoringDataMessage> {
@@ -39,6 +46,10 @@
    private ChargingOrderClient chargingOrderClient;
    @Resource
    private AccountingStrategyDetailClient accountingStrategyDetailClient;
    @Resource
    private ChargingGunClient chargingGunClient;
    @Resource
    private FaultMessageClient faultMessageClient;
    @Override
@@ -73,6 +84,33 @@
        BeanUtils.copyProperties(uploadRealTimeMonitoringData, query);
        chargingOrderClient.chargeMonitoring(query);
        TChargingGun chargingGun = chargingGunClient.getChargingGunByCode(message.getCharging_gun_code()).getData();
        if(Objects.nonNull(chargingGun)){
            // 存储状态信息
            TFaultMessage faultMessage = new TFaultMessage();
            if(message.getCharging_gun_status().equals(0) || message.getCharging_gun_status().equals(1)){
                faultMessage.setSiteId(chargingGun.getSiteId());
                faultMessage.setChargingPileId(chargingGun.getChargingPileId());
                faultMessage.setChargingGunId(chargingGun.getId());
                switch (message.getCharging_gun_status()){
                    case 0:
                        faultMessage.setStatus(1);
                        break;
                    case 1:
                        faultMessage.setStatus(2);
                        break;
                }
                faultMessage.setDownTime(LocalDateTime.now());
                faultMessageClient.createFaultMessage(faultMessage);
            }else {
                // 空闲 充电 查询是否该设备之前存在离线记录或者故障记录
                faultMessage = faultMessageClient.getFaultMessageByGunId(chargingGun.getId()).getData();
                if(Objects.nonNull(faultMessage)){
                    faultMessage.setEndTime(LocalDateTime.now());
                    faultMessageClient.updateFaultMessage(faultMessage);
                }
            }
        }
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/WorkingParameterSettingReplyMessageListener.java
@@ -6,6 +6,7 @@
import com.ruoyi.integration.rocket.model.WorkingParameterSettingReplyMessage;
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;
@@ -15,9 +16,10 @@
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "enhance_consumer_group",
        topic = "rocket_enhance",
        selectorExpression = "*",
        messageModel = MessageModel.CLUSTERING,
        consumerGroup = "charge_working_parameter_setting_reply",
        topic = "charge_working_parameter_setting_reply",
        selectorExpression = "working_parameter_setting_reply",
        consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够
)
public class WorkingParameterSettingReplyMessageListener extends EnhanceMessageHandler<WorkingParameterSettingReplyMessage> implements RocketMQListener<WorkingParameterSettingReplyMessage> {
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/EnhanceProduce.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.integration.api.model.ParameterSetting;
import com.ruoyi.integration.iotda.constant.SendTagConstant;
import com.ruoyi.integration.rocket.model.*;
import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate;
@@ -10,8 +11,6 @@
import org.apache.rocketmq.client.producer.SendResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;
@@ -23,304 +22,289 @@
    @Setter(onMethod_ = @Autowired)
    private RocketMQEnhanceTemplate rocketMQEnhanceTemplate;
    private static final String TOPIC = "rocket_enhance";
    private static final String TOPIC = "charge_";
    /**
     * 充电桩登录认证
     */
    public SendResult onlineMessage(JSONObject jsonObject) {
        OnlineMessage message = JSON.parseObject(jsonObject.toJSONString(),OnlineMessage.class);
    public SendResult onlineMessage(OnlineMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.ONLINE);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.ONLINE, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.ONLINE, SendTagConstant.ONLINE, message);
    }
    /**
     * 充电桩心跳包
     */
    public SendResult pingMessage(JSONObject jsonObject) {
        PingMessage message = JSON.parseObject(jsonObject.toJSONString(),PingMessage.class);
    public SendResult pingMessage(PingMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.PING);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PING, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.PING, SendTagConstant.PING, message);
    }
    /**
     * 充电结束
     */
    public SendResult endChargeMessage(JSONObject jsonObject) {
        PingMessage message = JSON.parseObject(jsonObject.toJSONString(),PingMessage.class);
    public SendResult endChargeMessage(EndChargeMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.END_CHARGE);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.END_CHARGE, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.END_CHARGE, SendTagConstant.END_CHARGE, message);
    }
    /**
     * 计费模型验证请求
     */
    public SendResult billingModeVerifyMessage(JSONObject jsonObject) {
        BillingModeVerifyMessage message = JSON.parseObject(jsonObject.toJSONString(),BillingModeVerifyMessage.class);
    public SendResult billingModeVerifyMessage(BillingModeVerifyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.BILLING_MODE_VERIFY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BILLING_MODE_VERIFY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.BILLING_MODE_VERIFY, SendTagConstant.BILLING_MODE_VERIFY, message);
    }
    /**
     * 充电桩计费模型请求
     */
    public SendResult acquisitionBillingModeMessage(JSONObject jsonObject) {
        AcquisitionBillingModeMessage message = JSON.parseObject(jsonObject.toJSONString(),AcquisitionBillingModeMessage.class);
    public SendResult acquisitionBillingModeMessage(AcquisitionBillingModeMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.ACQUISITION_BILLING_MODE);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.ACQUISITION_BILLING_MODE, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.ACQUISITION_BILLING_MODE, SendTagConstant.ACQUISITION_BILLING_MODE, message);
    }
    /**
     * 上传实时监测数据
     */
    public SendResult uploadRealTimeMonitoringDataMessage(JSONObject jsonObject) {
        UploadRealTimeMonitoringDataMessage message = JSON.parseObject(jsonObject.toJSONString(),UploadRealTimeMonitoringDataMessage.class);
    public SendResult uploadRealTimeMonitoringDataMessage(UploadRealTimeMonitoringDataMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA, SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA, message);
    }
    /**
     * 充电握手
     */
    public SendResult chargingHandshakeMessage(JSONObject jsonObject) {
        ChargingHandshakeMessage message = JSON.parseObject(jsonObject.toJSONString(),ChargingHandshakeMessage.class);
    public SendResult chargingHandshakeMessage(ChargingHandshakeMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.CHARGING_HANDSHAKE);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CHARGING_HANDSHAKE, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.CHARGING_HANDSHAKE, SendTagConstant.CHARGING_HANDSHAKE, message);
    }
    /**
     * 参数设置
     */
    public SendResult parameterSettingMessage(ParameterSettingMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.PARAMETER_SETTING);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.PARAMETER_SETTING, SendTagConstant.PARAMETER_SETTING, message);
    }
    /**
     * 充电阶段BMS中止
     */
    public SendResult bmsAbortMessage(JSONObject jsonObject) {
        BmsAbortMessage message = JSON.parseObject(jsonObject.toJSONString(),BmsAbortMessage.class);
    public SendResult bmsAbortMessage(BmsAbortMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.BMS_ABORT);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BMS_ABORT, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.BMS_ABORT, SendTagConstant.BMS_ABORT, message);
    }
    /**
     * 充电阶段充电机中止
     */
    public SendResult motorAbortMessage(JSONObject jsonObject) {
        MotorAbortMessage message = JSON.parseObject(jsonObject.toJSONString(),MotorAbortMessage.class);
    public SendResult motorAbortMessage(MotorAbortMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.MOTOR_ABORT);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.MOTOR_ABORT, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.MOTOR_ABORT, SendTagConstant.MOTOR_ABORT, message);
    }
    /**
     * 充电过程BMS需求、充电机输出
     */
    public SendResult bmsDemandAndChargerExportationMessage(JSONObject jsonObject) {
        BmsDemandAndChargerExportationMessage message = JSON.parseObject(jsonObject.toJSONString(),BmsDemandAndChargerExportationMessage.class);
    public SendResult bmsDemandAndChargerExportationMessage(BmsDemandAndChargerExportationMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION, SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION, message);
    }
    /**
     * 充电过程BMS信息
     */
    public SendResult bmsInformationMessage(JSONObject jsonObject) {
        BmsInformationMessage message = JSON.parseObject(jsonObject.toJSONString(),BmsInformationMessage.class);
    public SendResult bmsInformationMessage(BmsInformationMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.BMS_INFORMATION);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BMS_INFORMATION, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.BMS_INFORMATION, SendTagConstant.BMS_INFORMATION, message);
    }
    /**
     * 充电桩主动申请启动充电
     */
    public SendResult chargingPileStartsChargingMessage(JSONObject jsonObject) {
        ChargingPileStartsChargingMessage message = JSON.parseObject(jsonObject.toJSONString(),ChargingPileStartsChargingMessage.class);
    public SendResult chargingPileStartsChargingMessage(ChargingPileStartsChargingMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.CHARGING_PILE_STARTS_CHARGING);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CHARGING_PILE_STARTS_CHARGING, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.CHARGING_PILE_STARTS_CHARGING, SendTagConstant.CHARGING_PILE_STARTS_CHARGING, message);
    }
    /**
     * 远程启机命令回复
     */
    public SendResult platformStartChargingReplyMessage(JSONObject jsonObject) {
        PlatformStartChargingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformStartChargingReplyMessage.class);
    public SendResult platformStartChargingReplyMessage(PlatformStartChargingReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.PLATFORM_START_CHARGING_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_START_CHARGING_REPLY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.PLATFORM_START_CHARGING_REPLY, SendTagConstant.PLATFORM_START_CHARGING_REPLY, message);
    }
    /**
     * 远程停机命令回复
     */
    public SendResult platformStopChargingReplyMessage(JSONObject jsonObject) {
        PlatformStopChargingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformStopChargingReplyMessage.class);
    public SendResult platformStopChargingReplyMessage(PlatformStopChargingReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.PLATFORM_STOP_CHARGING_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_STOP_CHARGING_REPLY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.PLATFORM_STOP_CHARGING_REPLY, SendTagConstant.PLATFORM_STOP_CHARGING_REPLY, message);
    }
    /**
     * 交易记录
     */
    public SendResult transactionRecordMessage(JSONObject jsonObject) {
        TransactionRecordMessage message = JSON.parseObject(jsonObject.toJSONString(),TransactionRecordMessage.class);
    public SendResult transactionRecordMessage(TransactionRecordMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.TRANSACTION_RECORD);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.TRANSACTION_RECORD, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.TRANSACTION_RECORD, SendTagConstant.TRANSACTION_RECORD, message);
    }
    /**
     * 余额更新应答
     */
    public SendResult updateBalanceReplyMessage(JSONObject jsonObject) {
        UpdateBalanceReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),UpdateBalanceReplyMessage.class);
    public SendResult updateBalanceReplyMessage(UpdateBalanceReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.UPDATE_BALANCE_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.UPDATE_BALANCE_REPLY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.UPDATE_BALANCE_REPLY, SendTagConstant.UPDATE_BALANCE_REPLY, message);
    }
    /**
     * 卡数据同步应答
     */
    public SendResult synchronizeOfflineCardReplyMessage(JSONObject jsonObject) {
        SynchronizeOfflineCardReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),SynchronizeOfflineCardReplyMessage.class);
    public SendResult synchronizeOfflineCardReplyMessage(SynchronizeOfflineCardReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY, SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY, message);
    }
    /**
     * 离线卡数据清除应答
     */
    public SendResult clearOfflineCardReplyMessage(JSONObject jsonObject) {
        ClearOfflineCardReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),ClearOfflineCardReplyMessage.class);
    public SendResult clearOfflineCardReplyMessage(ClearOfflineCardReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.CLEAR_OFFLINE_CARD_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CLEAR_OFFLINE_CARD_REPLY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.CLEAR_OFFLINE_CARD_REPLY, SendTagConstant.CLEAR_OFFLINE_CARD_REPLY, message);
    }
    /**
     * 充电桩工作参数设置应答
     */
    public SendResult workingParameterSettingReplyMessage(JSONObject jsonObject) {
        WorkingParameterSettingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),WorkingParameterSettingReplyMessage.class);
    public SendResult workingParameterSettingReplyMessage(WorkingParameterSettingReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.WORKING_PARAMETER_SETTING_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.WORKING_PARAMETER_SETTING_REPLY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.WORKING_PARAMETER_SETTING_REPLY, SendTagConstant.WORKING_PARAMETER_SETTING_REPLY, message);
    }
    /**
     * 对时设置
     */
    public SendResult timingSettingMessage(JSONObject jsonObject) {
        TimingSettingMessage message = JSON.parseObject(jsonObject.toJSONString(),TimingSettingMessage.class);
    public SendResult timingSettingMessage(TimingSettingMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.TIMING_SETTING);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.TIMING_SETTING, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.TIMING_SETTING, SendTagConstant.TIMING_SETTING, message);
    }
    /**
     * 计费模型应答
     */
    public SendResult setupBillingModelReplyMessage(JSONObject jsonObject) {
        SetupBillingModelReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),SetupBillingModelReplyMessage.class);
    public SendResult setupBillingModelReplyMessage(SetupBillingModelReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.SETUP_BILLING_MODEL_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.SETUP_BILLING_MODEL_REPLY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.SETUP_BILLING_MODEL_REPLY, SendTagConstant.SETUP_BILLING_MODEL_REPLY, message);
    }
    /**
     * 地锁数据上送(充电桩上送)
     */
    public SendResult groundLockRealTimeDataMessage(JSONObject jsonObject) {
        GroundLockRealTimeDataMessage message = JSON.parseObject(jsonObject.toJSONString(),GroundLockRealTimeDataMessage.class);
    public SendResult groundLockRealTimeDataMessage(GroundLockRealTimeDataMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.GROUND_LOCK_REAL_TIME_DATA);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.GROUND_LOCK_REAL_TIME_DATA, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.GROUND_LOCK_REAL_TIME_DATA, SendTagConstant.GROUND_LOCK_REAL_TIME_DATA, message);
    }
    /**
     * 充电桩返回数据(上行)
     */
    public SendResult chargingPileReturnsGroundLockDataMessage(JSONObject jsonObject) {
        ChargingPileReturnsGroundLockDataMessage message = JSON.parseObject(jsonObject.toJSONString(),ChargingPileReturnsGroundLockDataMessage.class);
    public SendResult chargingPileReturnsGroundLockDataMessage(ChargingPileReturnsGroundLockDataMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA, SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA, message);
    }
    /**
     * 远程重启应答
     */
    public SendResult platformRestartReplyMessage(JSONObject jsonObject) {
        PlatformRestartReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformRestartReplyMessage.class);
    public SendResult platformRestartReplyMessage(PlatformRestartReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.PLATFORM_RESTART_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_RESTART_REPLY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.PLATFORM_RESTART_REPLY, SendTagConstant.PLATFORM_RESTART_REPLY, message);
    }
    /**
     * 远程更新应答
     */
    public SendResult platformRemoteUpdateReplyMessage(JSONObject jsonObject) {
        PlatformRemoteUpdateReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformRemoteUpdateReplyMessage.class);
    public SendResult platformRemoteUpdateReplyMessage(PlatformRemoteUpdateReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY, message);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY, SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY, message);
    }
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/util/RocketMQEnhanceTemplate.java
@@ -24,6 +24,9 @@
    private RocketEnhanceProperties rocketEnhanceProperties;
    public RocketMQTemplate getTemplate() {
//        DefaultMQProducer producer = new DefaultMQProducer();
//        producer.setProducerGroup("enhance_consumer_group");
//        template.setProducer(producer);
        return template;
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java
@@ -15,6 +15,7 @@
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.order.api.model.ExportUidDto;
import com.ruoyi.order.api.model.TChargingBill;
import com.ruoyi.order.api.model.TChargingOrder;
import com.ruoyi.order.api.query.TOrderInvoiceQuery;
@@ -71,13 +72,15 @@
    @ApiOperation(value = "列表查询", tags = {"管理后台-账户结算账单"})
    public R<AccountListVO> accountBillList(@RequestBody ChargingListQuery dto) {
        AccountListVO accountListVO = new AccountListVO();
        ChargingBillVO res = chargingBillService.chargingBillList(dto);
        dto.setPageCurr(1);
        dto.setPageSize(99999999);
        ChargingBillVO res1 = chargingBillService.chargingBillList(dto);
        ChargingBillVO res = chargingBillService.chargingBillList1(dto);
        ChargingBillVO res1 = chargingBillService.chargingBillList1(dto);
        List<ChargingBillListVO> records = res1.getList().getRecords();
        accountListVO.setBillCount(records.size());
        accountListVO.setTotalAmount(res1.getPaymentAmount().subtract(res1.getRefundAmount()).subtract(res1.getCommissionAmount()).subtract(res1.getSharingAmount()));
        accountListVO.setTotalAmount(
                res1.getPaymentAmount().subtract(res1.getRefundAmount()==null?BigDecimal.ZERO:res1.getRefundAmount())
                        .subtract(res1.getCommissionAmount()==null?BigDecimal.ZERO:res1.getCommissionAmount())
                        .subtract(res1.getSharingAmount()==null?BigDecimal.ZERO:res1.getSharingAmount()));
        accountListVO.setPaymentAmount(res1.getPaymentAmount());
        accountListVO.setRefundAmount(res1.getRefundAmount());
        accountListVO.setCommissionAmount(res1.getCommissionAmount());
@@ -101,7 +104,7 @@
        return R.ok(null);
    }
    @ApiOperation(value = "导出", tags = {"管理后台-充电算账单"})
    @PostMapping("/export")
    @PutMapping("/export")
    public void export(@RequestBody ChargingListQuery dto)
    {
        ChargingBillVO res = chargingBillService.chargingBillList(dto);
@@ -163,14 +166,84 @@
            }
        }
    }
    @ApiOperation(value = "导出", tags = {"管理后台-账户结算账单"})
    @PutMapping("/exportAccount")
    public void exportAccount(@RequestBody ChargingListQuery dto)
    {
        ChargingBillVO res = chargingBillService.chargingBillList1(dto);
        List<ChargingBillListVO> list = res.getList().getRecords();
        List<TChargingBillExport> tChargingBillExports = new ArrayList<>();
        for (ChargingBillListVO orderInvoiceVO : list) {
            TChargingBillExport tChargingBillExport = new TChargingBillExport();
            tChargingBillExport.setCode(orderInvoiceVO.getCode());
            switch (orderInvoiceVO.getOrderState()){
                case 1:
                    tChargingBillExport.setBillType("日账单");
                    break;
                case 2:
                    tChargingBillExport.setBillType("月账单");
                    break;
            }
            tChargingBillExport.setType(orderInvoiceVO.getType().toString());
            tChargingBillExport.setBillWeek(orderInvoiceVO.getBillWeek());
            tChargingBillExport.setSiteName(orderInvoiceVO.getSiteName());
            tChargingBillExport.setPaymentAmount(orderInvoiceVO.getPaymentAmount());
            tChargingBillExport.setElectrovalence(orderInvoiceVO.getElectrovalence());
            tChargingBillExport.setServiceCharge(orderInvoiceVO.getServiceCharge());
            tChargingBillExport.setChargingCapacity(orderInvoiceVO.getChargingCapacity());
            Integer chargingSecond = orderInvoiceVO.getChargingSecond();
            // 根据秒数 转换为xx小时xx分钟xx秒 如果小时为0不展示 如果分钟为0则不展示
            // 计算小时、分钟和秒
            int hours = chargingSecond / 60 / 60;
            int minutes = chargingSecond /60 % 60;
            int seconds = 0; // 如果没有秒数,则默认是0
            // 构造结果字符串
            StringBuilder result = new StringBuilder();
            if (hours > 0) {
                result.append(hours).append("小时");
            }
            if (minutes > 0) {
                result.append(minutes).append("分钟");
            }
            if (seconds > 0 || result.length() == 0) { // 如果秒数大于0,或者小时和分钟都为0,则显示秒数
                result.append(seconds).append("秒");
            }
            tChargingBillExport.setChargingTime(result.toString());
            tChargingBillExport.setOrderCount(orderInvoiceVO.getOrderCount());
            tChargingBillExport.setBillTime(orderInvoiceVO.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
            tChargingBillExports.add(tChargingBillExport);
        }
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TChargingBillExport.class, tChargingBillExports);
        HttpServletResponse response = WebUtils.response();
        response.setContentType("application/vnd.ms-excel");
        response.setCharacterEncoding("utf-8");
        ServletOutputStream outputStream = null;
        try {
            String fileName = URLEncoder.encode("月账单-"+res.getCategory()+"-"+res.getBillWeek()+"-"+res.getSiteName()+".xls", "utf-8");
            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
            response.setHeader("Pragma", "no-cache");
            response.setHeader("Cache-Control", "no-cache");
            outputStream = response.getOutputStream();
            workbook.write(outputStream);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"})
    @GetMapping("/download")
    public void download(String uid)
    @PutMapping("/download")
    public void download(@RequestBody ExportUidDto uid)
    {
        List<ChargingBillExport> chargingBillExports = new ArrayList<>();
        List<ChargingBillRefundExport> chargingBillRefundExports = new ArrayList<>();
        List<ChargingBillPayExport> chargingBillPayExports = new ArrayList<>();
        TChargingBill byId = chargingBillService.getById(uid);
        TChargingBill byId = chargingBillService.getById(uid.getUid());
        ChargingBillExport chargingBillExport = new ChargingBillExport();
        chargingBillExport.setCode(byId.getCode());
        // todo 确认商户类型
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java
@@ -81,7 +81,7 @@
        return AjaxResult.success(res);
    }
    @ApiOperation(value = "充电时段统计-导出", tags = {"管理后台-财务结算"})
    @PostMapping("/export")
    @PutMapping("/export")
    public void export(@RequestBody ChargingListQuery dto)
    {
        ChargingOrderTimeVO res = chargingOrderService.chargingList(dto);
@@ -118,13 +118,15 @@
    }
    @GetMapping(value = "/settlementTotal")
    @ApiOperation(value = "结算汇总-列表查询", tags = {"管理后台-财务结算"})
    @ApiParam(name = "time", value = "汇报时间2024-01-01 00:00:00")
    @ApiParam(name = "time", value = "汇报时间2024-01")
    public AjaxResult<SettlementTotalVO> settlementTotal(String time) {
        time = time+"-01 00:00:00";
        SettlementTotalVO res = chargingOrderService.settlementTotal(time);
        return AjaxResult.success(res);
    }
    @GetMapping(value = "/settlementTotalR")
    public R<SettlementTotalVO> settlementTotalR( String time) {
    public R<SettlementTotalVO> settlementTotalR(String time) {
        time = time+"-01 00:00:00";
        SettlementTotalVO res = chargingOrderService.settlementTotal(time);
        return R.ok(res);
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -981,4 +981,14 @@
        TChargingOrder chargingOrder = chargingOrderService.getChargingOrderByLicensePlate(query);
        return R.ok(chargingOrder);
    }
    /**
     * 修改充电订单
     * @param chargingOrder
     * @return
     */
    @PostMapping("/updateChargingOrder")
    public R<String> updateChargingOrder(@RequestBody TChargingOrder chargingOrder){
        chargingOrderService.updateById(chargingOrder);
        return R.ok();
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingBillMapper.java
@@ -26,5 +26,10 @@
            @Param("req") ChargingListQuery dto,
            @Param("startTime1")String startTime1,
            @Param("startTime2")String startTime2);
    List<ChargingBillListVO> chargingBillList1(
            @Param("pageInfo") PageInfo<ChargingBillListVO> pageInfo,
            @Param("req") ChargingListQuery dto,
            @Param("startTime1")String startTime1,
            @Param("startTime2")String startTime2);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java
@@ -78,7 +78,7 @@
    List<Map<String, Object>> getYearData(List<Long> chargingOrderIds);
    List<ChargingOrderListVO> chargingList(@Param("pageInfo")PageInfo<ChargingOrderListVO> pageInfo, @Param("req") ChargingListQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2, @Param("endTime1")String endTime1, @Param("endTime2")String endTime2);
    List<ChargingOrderListVO> chargingList1( @Param("req")ChargingListQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2, @Param("endTime1")String endTime1, @Param("endTime2")String endTime2);
    List<ChargingOrderListVO> chargingListNoPage( @Param("req")ChargingListQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2, @Param("endTime1")String endTime1, @Param("endTime2")String endTime2);
    List<Map<String, Object>> getByDate(List<Long> chargingOrderIds);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingBillService.java
@@ -16,5 +16,6 @@
public interface TChargingBillService extends IService<TChargingBill> {
    ChargingBillVO chargingBillList(ChargingListQuery dto);
    ChargingBillVO chargingBillList1(ChargingListQuery dto);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
@@ -61,6 +61,276 @@
    @Resource
    private AppUserCarClient appUserCarClient;
    @Override
    public ChargingBillVO chargingBillList1(ChargingListQuery dto) {
        ChargingBillVO chargingBillVO = new ChargingBillVO();
        String startTime1 = null;
        String startTime2 = null;
        if (StringUtils.hasLength(dto.getStartTime())){
            String[] split = dto.getStartTime().split(" - ");
            startTime1 = split[0];
            startTime2 = split[1];
        }
        PageInfo<ChargingBillListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize());
        List<ChargingBillListVO> list = this.baseMapper.chargingBillList1(pageInfo,dto,startTime1,startTime2);
        BigDecimal paymentAmountTotal = new BigDecimal("0");
        BigDecimal orderAmountTotal = new BigDecimal("0");
        BigDecimal electrovalenceTotal = new BigDecimal("0");
        BigDecimal serviceChargeTotal = new BigDecimal("0");
        BigDecimal commissionAmountTotal = new BigDecimal("0");
        BigDecimal sharingAmountTotal = new BigDecimal("0");
        BigDecimal chargingCapacityTotal = new BigDecimal("0");
        BigDecimal discountTotal = new BigDecimal("0");
        BigDecimal refundAmount = new BigDecimal("0");
        int orderCount = 0;
        for (ChargingBillListVO chargingBillListVO : list) {
            String temp = "";
            String temp1 = "";
            switch (chargingBillListVO.getType()){
                case 1:
                    temp = "全站账单";
                    temp1 = "全站";
                    break;
                case 2:
                    temp = "各个站点账单";
                    temp1 = siteClient.getSiteByIds(Arrays.asList(chargingBillListVO.getSiteId())).getData().get(0).getName();
                    break;
            }
            chargingBillVO.setCategory(temp);
            chargingBillVO.setSiteName(temp1);
            chargingBillVO.setType("月账单");
            chargingBillVO.setCode(chargingBillListVO.getCode());
            LocalDateTime billTime = chargingBillListVO.getBillTime();
            // 将其转化为yyyy-MM格式字符串
            chargingBillVO.setCreateTime(billTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
            // 将billTime减去一个月 转化为yyyy-MM格式字符串
            chargingBillVO.setBillWeek(billTime.minusMonths(1).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM")));
            chargingBillListVO.setUid(chargingBillListVO.getId().toString());
            // 根据账单的出账时间 查询上个月的充电订单
            LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1);
            // 账单周期
            chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM")));
            // 获取 LocalDate 对象
            LocalDate date = localDate.toLocalDate();
            // 获取该月份的第一天
            LocalDate firstDayOfMonth = date.withDayOfMonth(1);
            // 获取该月份的最后一天
            LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth());
            QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>()
                    .between("create_time", firstDayOfMonth, lastDayOfMonth)
                    .eq("status", 5)
                    .eq("recharge_payment_status", 2);
            if (chargingBillListVO.getType() == 2) {
                eq.eq("site_id", chargingBillListVO.getSiteId());
            }
            List<TChargingOrder> tChargingOrders = chargingOrderList.selectList(eq);
            int chargingSecond = 0;
            BigDecimal paymentAmount = new BigDecimal("0");
            BigDecimal orderAmount = new BigDecimal("0");
            BigDecimal electrovalence = new BigDecimal("0");
            BigDecimal serviceCharge = new BigDecimal("0");
            BigDecimal commissionAmount = new BigDecimal("0");
            BigDecimal sharingAmount = new BigDecimal("0");
            BigDecimal chargingCapacity = new BigDecimal("0");
            orderCount+=tChargingOrders.size();
            chargingBillVO.setCategory("");
            chargingBillVO.setExportList(tChargingOrders);
            for (TChargingOrder tChargingOrder : tChargingOrders) {
                List<Site> data = siteClient.getSiteByIds(Arrays.asList(tChargingOrder.getSiteId())).getData();
                if (!data.isEmpty()){
                    chargingBillVO.setSiteName(data.get(0).getName());
                }
                TChargingPile data1 = chargingPileClient.getChargingPileById(tChargingOrder.getChargingPileId()).getData();
                TChargingGun data2 = chargingGunClient.getChargingGunById(tChargingOrder.getChargingGunId()).getData();
                if (data1!=null && data2!=null){
                    tChargingOrder.setTerminalName(data1.getName()+data2.getName());
                    tChargingOrder.setTerminalCode(data2.getCode());
                }
                tChargingOrder.setOrderClassification1("线上订单");
                tChargingOrder.setRechargePaymentType1("预付");
                tChargingOrder.setChargingType("充电桩接口充电服务");
                switch (tChargingOrder.getStatus()){
                    case 1:
                        tChargingOrder.setStatus1("等待中");
                        break;
                    case 2:
                        tChargingOrder.setStatus1("启动中");
                        break;
                    case 3:
                        tChargingOrder.setStatus1("充电中");
                        break;
                    case 4:
                        tChargingOrder.setStatus1("停止中");
                        break;
                    case 5:
                        tChargingOrder.setStatus1("已结束");
                        break;
                    case 0:
                        tChargingOrder.setStatus1("未知");
                        break;
                }
                if (tChargingOrder.getEndMode()!=null){
                    switch (tChargingOrder.getEndMode()){
                        case 1:
                            tChargingOrder.setEndMode1("主动终止");
                            break;
                        case 2:
                            tChargingOrder.setEndMode1("满电终止");
                            break;
                        case 3:
                            tChargingOrder.setEndMode1("费用不足终止");
                            break;
                        case 0:
                            tChargingOrder.setEndMode1("异常终止");
                            break;
                    }
                }
                BigDecimal add = tChargingOrder.getElectrovalence().add(tChargingOrder.getServiceCharge());
                tChargingOrder.setTotalAmount(add.toString());
                tChargingOrder.setDiscount(tChargingOrder.getCouponDiscountAmount().toString());
                UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(tChargingOrder.getCode()).getData();
                if (data5!=null){
                    if (data5.getTime_remaining()!=null){
                        chargingSecond+=data5.getTime_remaining()*60;
                    }
                }
                Integer cumulativeChargingTime = data5.getCumulative_charging_time();
                // 将其转化为xx小时xx分钟xx秒显示 如果是0小时则不展示小时 如果是0分钟则不展示分钟
                if (cumulativeChargingTime!=null){
                    // 计算小时、分钟和秒
                    int hours = cumulativeChargingTime / 60;
                    int minutes = cumulativeChargingTime % 60;
                    int seconds = 0; // 如果没有秒数,则默认是0
                    StringBuilder result = new StringBuilder();
                    if (hours > 0) {
                        result.append(hours).append("小时");
                    }
                    if (minutes > 0) {
                        result.append(minutes).append("分钟");
                    }
                    if (seconds > 0 || result.length() == 0) { // 如果秒数大于0,或者小时和分钟都为0,则显示秒数
                        result.append(seconds).append("秒");
                    }
                    tChargingOrder.setChargingTime(result.toString());
                }
                tChargingOrder.setEndSoc(data5.getSoc().toString());
                TAppUser data3 = appUserClient.getUserById(tChargingOrder.getAppUserId()).getData();
                if (tChargingOrder.getAppUserCarId()!=null){
                    List<TAppUserCar> data4 = appUserCarClient.getCarByIds(Arrays.asList(tChargingOrder.getAppUserCarId())).getData();
                    if (!data4.isEmpty()){
                        tChargingOrder.setLicensePlate(data4.get(0).getLicensePlate());
                        tChargingOrder.setVehicleModel(data4.get(0).getVehicleModel());
                    }
                }
                if (data3!=null)tChargingOrder.setUserName(data3.getName());
                // 累加实收金额 支付金额减去退款金额
                if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){
                    paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()).subtract(tChargingOrder.getRefundAmount());
                    paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()).subtract(tChargingOrder.getRefundAmount());
                }else if (tChargingOrder.getPaymentAmount()!=null){
                    paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount());
                    paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount());
                }
                // 累加订单金额
                if (tChargingOrder.getOrderAmount()!=null){
                    orderAmount = orderAmount.add(tChargingOrder.getOrderAmount());
                    orderAmountTotal = orderAmountTotal.add(tChargingOrder.getOrderAmount());
                }
                // 累加累计电费
                if (tChargingOrder.getElectrovalence()!=null){
                    electrovalence = electrovalence.add(tChargingOrder.getElectrovalence());
                    electrovalenceTotal = electrovalenceTotal.add(tChargingOrder.getElectrovalence());
                }
                if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getRefundStatus() == 2){
                    refundAmount = refundAmount.add(tChargingOrder.getRefundAmount());
                }
                // 累加累计服务费
                if (tChargingOrder.getServiceCharge()!=null){
                    serviceCharge = serviceCharge.add(tChargingOrder.getServiceCharge());
                    serviceChargeTotal = serviceChargeTotal.add(tChargingOrder.getServiceCharge());
                }
                // 累加平台手续费
                if (tChargingOrder.getCommissionAmount()!=null){
                    commissionAmount = commissionAmount.add(tChargingOrder.getCommissionAmount());
                    commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getCommissionAmount());
                }
                // 累加平台分佣
                if (tChargingOrder.getSharingAmount()!=null){
                    sharingAmount = sharingAmount.add(tChargingOrder.getSharingAmount());
                    sharingAmountTotal = sharingAmountTotal.add(tChargingOrder.getSharingAmount());
                }
                // 累加充电度数
                if (tChargingOrder.getChargingCapacity()!=null){
                    chargingCapacity = chargingCapacity.add(tChargingOrder.getChargingCapacity());
                    chargingCapacityTotal = chargingCapacityTotal.add(tChargingOrder.getChargingCapacity());
                }
                // 累加优惠金额
                if (tChargingOrder.getCouponDiscountAmount()!=null){
                    discountTotal = discountTotal.add(tChargingOrder.getCouponDiscountAmount());
                }
                if (tChargingOrder.getVipDiscountAmount()!=null){
                    discountTotal = discountTotal.add(tChargingOrder.getVipDiscountAmount());
                }
            }
            // 将chargingSecond 这是以秒为单位存放的总秒数 将其转化为xx小时xx分钟xx秒
            int hours = chargingSecond / 3600;
            int minutes = (chargingSecond % 3600) / 60;
            int seconds = chargingSecond % 60;
            // 格式化为字符串
            String timeString = String.format("%d小时%d分钟%d秒", hours, minutes, seconds);
            chargingBillVO.setChargingTime(timeString);
            if (chargingBillVO.getPaymentAmount() == null){
                chargingBillVO.setPaymentAmount(BigDecimal.ZERO);
            }
            chargingBillVO.setOrderAmount(chargingBillVO.getPaymentAmount().subtract(chargingBillVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillVO.getRefundAmount())
                    .subtract(chargingBillVO.getCommissionAmount()==null?BigDecimal.ZERO:chargingBillVO.getCommissionAmount())
                    .subtract(chargingBillVO.getSharingAmount()==null?BigDecimal.ZERO:chargingBillVO.getSharingAmount()));
            chargingBillListVO.setPaymentAmount(paymentAmount == null?BigDecimal.ZERO:paymentAmount);
            chargingBillListVO.setOrderAmount(orderAmount == null?BigDecimal.ZERO:orderAmount);
            chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence);
            chargingBillListVO.setServiceCharge(serviceCharge == null?BigDecimal.ZERO:serviceCharge);
            chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount);
            chargingBillListVO.setSharingAmount(sharingAmount == null?BigDecimal.ZERO:sharingAmount);
            chargingBillListVO.setChargingCapacity(chargingCapacity == null?BigDecimal.ZERO:chargingCapacity);
            chargingBillListVO.setBillMoney(chargingBillListVO.getPaymentAmount().subtract(chargingBillListVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillListVO.getRefundAmount())
                    .subtract(chargingBillListVO.getCommissionAmount()==null?BigDecimal.ZERO:chargingBillListVO.getCommissionAmount())
                    .subtract(chargingBillListVO.getSharingAmount()==null?BigDecimal.ZERO:chargingBillListVO.getSharingAmount()));
            switch (chargingBillListVO.getType()){
                case 1:
                    chargingBillListVO.setSiteName("全站");
                    break;
                case 2:
                    Site site = siteClient.getSiteByIds(Arrays.asList(chargingBillListVO.getSiteId())).getData().get(0);
                    if (site!=null){
                        chargingBillListVO.setSiteName(site.getName());
                    }
                    break;
            }
            // 订单数
            chargingBillListVO.setOrderCount(tChargingOrders.size());
            // 充电时间秒
            chargingBillListVO.setChargingSecond(chargingSecond);
        }
        chargingBillVO.setChargingCapacity(chargingCapacityTotal);
        chargingBillVO.setPaymentAmount(paymentAmountTotal);
        chargingBillVO.setOrderAmount(orderAmountTotal);
        chargingBillVO.setElectrovalence(electrovalenceTotal);
        chargingBillVO.setServiceCharge(serviceChargeTotal);
        chargingBillVO.setOrderCount(orderCount);
        chargingBillVO.setCommissionAmount(commissionAmountTotal);
        chargingBillVO.setSharingAmount(sharingAmountTotal);
        chargingBillVO.setDiscount(discountTotal);
        pageInfo.setRecords(list);
        chargingBillVO.setList(pageInfo);
        return chargingBillVO;
    }
    @Override
    public ChargingBillVO chargingBillList(ChargingListQuery dto) {
        ChargingBillVO chargingBillVO = new ChargingBillVO();
        String startTime1 = null;
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -1184,10 +1184,12 @@
            if (!data.isEmpty()) {
                chargingOrderListVO.setSiteName(data.get(0).getName());
            }
            TChargingGun data1 = chargingGunClient.getChargingGunById(chargingOrderListVO.getChargingGunId()).getData();
            TChargingPile data2 = chargingPileClient.getChargingPileById(chargingOrderListVO.getChargingPileId()).getData();
            if (data2 != null && data1 != null) {
                chargingOrderListVO.setTerminalName(data2.getName() + "-" + data1.getName());
            if (chargingOrderListVO.getChargingGunId()!=null && chargingOrderListVO.getChargingPileId()!=null){
                TChargingGun data1 = chargingGunClient.getChargingGunById(chargingOrderListVO.getChargingGunId()).getData();
                TChargingPile data2 = chargingPileClient.getChargingPileById(chargingOrderListVO.getChargingPileId()).getData();
                if (data2 != null && data1 != null) {
                    chargingOrderListVO.setTerminalName(data2.getName() + "-" + data1.getName());
                }
            }
            // 获取充电时间
            UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderListVO.getCode()).getData();
@@ -1198,20 +1200,30 @@
                }
            }
            // 获取开始SOC 结束soc
            List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrderListVO.getCode()).getData();
            if (!data6.isEmpty()){
                // 第一条数据soc为开始 最后一条数据soc为结束soc
                chargingOrderListVO.setStartSoc(data6.get(0).getSoc().toString());
                chargingOrderListVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString());
            if (chargingOrderListVO.getCode()!=null){
                List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrderListVO.getCode()).getData();
                if (!data6.isEmpty()){
                    // 第一条数据soc为开始 最后一条数据soc为结束soc
                    chargingOrderListVO.setStartSoc(data6.get(0).getSoc().toString());
                    chargingOrderListVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString());
                }
            }
            TAppUser data3 = appUserClient.getUserById(chargingOrderListVO.getAppUserId()).getData();
            List<Long> carId = new ArrayList<>();
            if (chargingOrderListVO.getAppUserCarId() != null) {
                carId.add(chargingOrderListVO.getAppUserCarId());
                List<TAppUserCar> data4 = appUserCarClient.getCarByIds(carId).getData();
                if (!data4.isEmpty()) chargingOrderListVO.setLicensePlate(data4.get(0).getLicensePlate());
            if (chargingOrderListVO.getAppUserId()!=null){
                TAppUser data3 = appUserClient.getUserById(chargingOrderListVO.getAppUserId()).getData();
                List<Long> carId = new ArrayList<>();
                if (data3!=null){
                    if (chargingOrderListVO.getAppUserCarId() != null) {
                        carId.add(chargingOrderListVO.getAppUserCarId());
                        if (!carId.isEmpty()){
                            List<TAppUserCar> data4 = appUserCarClient.getCarByIds(carId).getData();
                            if (data4!=null && !data4.isEmpty()) chargingOrderListVO.setLicensePlate(data4.get(0).getLicensePlate());
                        }
                    }
                    if (data3 != null) chargingOrderListVO.setPhone(data3.getPhone());
                }
            }
            if (data3 != null) chargingOrderListVO.setPhone(data3.getPhone());
            List<TChargingOrderAccountingStrategy> list2 = chargingOrderAccountingStrategyService.lambdaQuery()
                    .eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrderListVO.getId()).list();
            // 尖峰平谷充电量 度数
@@ -1237,14 +1249,24 @@
                }
            }
            total = total.add(jian).add(feng).add(ping).add(gu);
            chargingOrderListVO.setElectronicProportion(
                    jian.divide(total,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%(尖)/"
                    +feng.divide(total,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%(峰)/"
                    +ping.divide(total,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%(平)/"
                    +gu.divide(total,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%(谷)");
            if (total.compareTo(new BigDecimal("0")) != 0){
                chargingOrderListVO.setElectronicProportion(
                        jian.divide(total,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%(尖)/"
                                +feng.divide(total,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%(峰)/"
                                +ping.divide(total,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%(平)/"
                                +gu.divide(total,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%(谷)");
            }else{
                chargingOrderListVO.setElectronicProportion(
                        "0"+"%(尖)/"+
                        "0"+"%(峰)/"+
                        "0"+"%(平)/"+
                        "0"+"%(谷)");
            }
        }
        // 不分页
        List<ChargingOrderListVO> list1 = this.baseMapper.chargingList1(dto,startTime1,startTime2,endTime1,endTime2);
        PageInfo<ChargingOrderListVO> pageInfo1 = new PageInfo<>(1,999999999);
        List<ChargingOrderListVO> list1 = this.baseMapper.chargingList(pageInfo1,dto,startTime1,startTime2,endTime1,endTime2);
        chargingOrderTimeVO.setExportList(list1);
        chargingOrderTimeVO.setOrderCount(list1.size());
        // 计算充电总度数
@@ -1271,33 +1293,34 @@
        BigDecimal ping = new BigDecimal("0");
        BigDecimal gu = new BigDecimal("0");
        for (ChargingOrderListVO chargingOrderListVO : list1) {
            electronic = electronic.add(chargingOrderListVO.getChargingCapacity());
            paymentAmount = paymentAmount.add(chargingOrderListVO.getPaymentAmount());
            electrovalence = electrovalence.add(chargingOrderListVO.getElectrovalence());
            serviceCharge = serviceCharge.add(chargingOrderListVO.getServiceCharge());
            if (chargingOrderListVO.getChargingCapacity()!=null)electronic = electronic.add(chargingOrderListVO.getChargingCapacity());
            if (chargingOrderListVO.getPaymentAmount()!=null)paymentAmount = paymentAmount.add(chargingOrderListVO.getPaymentAmount());
            if (chargingOrderListVO.getElectrovalence()!=null)electrovalence = electrovalence.add(chargingOrderListVO.getElectrovalence());
            if (chargingOrderListVO.getServiceCharge()!=null)serviceCharge = serviceCharge.add(chargingOrderListVO.getServiceCharge());
            List<TChargingOrderAccountingStrategy> list2 = chargingOrderAccountingStrategyService.lambdaQuery()
                    .eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrderListVO.getId()).list();
            for (TChargingOrderAccountingStrategy temp : list2) {
                switch (temp.getType()){
                    case 1:
                        jian = jian.add(temp.getChargingCapacity());
                        jianElectronic = jianElectronic.add(temp.getChargingCapacity());
                        jianService = jianService.add(temp.getChargingCapacity());
                        if (temp.getChargingCapacity()!=null)jian = jian.add(temp.getChargingCapacity());
                        if (temp.getChargingCapacity()!=null)jianElectronic = jianElectronic.add(temp.getElectrovalence());
                        if (temp.getChargingCapacity()!=null)jianService = jianService.add(temp.getServiceCharge());
                        break;
                    case 2:
                        feng = feng.add(temp.getChargingCapacity());
                        fengElectronic = fengElectronic.add(temp.getChargingCapacity());
                        fengService = fengService.add(temp.getChargingCapacity());
                        if (temp.getChargingCapacity()!=null)feng = feng.add(temp.getChargingCapacity());
                        if (temp.getChargingCapacity()!=null)fengElectronic = fengElectronic.add(temp.getElectrovalence());
                        if (temp.getChargingCapacity()!=null)fengService = fengService.add(temp.getServiceCharge());
                        break;
                    case 3:
                        ping = ping.add(temp.getChargingCapacity());
                        pingElectronic = pingElectronic.add(temp.getChargingCapacity());
                        pingService = pingService.add(temp.getChargingCapacity());
                        if (temp.getChargingCapacity()!=null)ping = ping.add(temp.getChargingCapacity());
                        if (temp.getChargingCapacity()!=null)pingElectronic = pingElectronic.add(temp.getElectrovalence());
                        if (temp.getChargingCapacity()!=null)pingService = pingService.add(temp.getServiceCharge());
                        break;
                    case 4:
                        gu = gu.add(temp.getChargingCapacity());
                        guElectronic = guElectronic.add(temp.getChargingCapacity());
                        guService = guService.add(temp.getChargingCapacity());
                        if (temp.getChargingCapacity()!=null)gu = gu.add(temp.getChargingCapacity());
                        if (temp.getChargingCapacity()!=null)guElectronic = guElectronic.add(temp.getElectrovalence());
                        if (temp.getChargingCapacity()!=null)guService = guService.add(temp.getServiceCharge());
                        break;
                }
            }
@@ -1313,21 +1336,40 @@
        BigDecimal add1 = jianService.add(fengService).add(pingService).add(guService);
        // 计算尖峰平谷充电到账占比
        BigDecimal add2 = jian.add(feng).add(ping).add(gu);
        chargingOrderTimeVO.setCapacityProportion(jianElectronic+"度/"+fengElectronic+"度/"+pingElectronic+"度/"+guElectronic+"度-"
                +jianElectronic.divide(add,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                +fengElectronic.divide(add,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                +pingElectronic.divide(add,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                +guElectronic.divide(add,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%");
        chargingOrderTimeVO.setServiceProportion(jianService+"元/"+fengService+"元/"+pingService+"元/"+guService+"元-"
                +jianService.divide(add1,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                +fengService.divide(add1,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                +pingService.divide(add1,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                +guService.divide(add1,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%");
        chargingOrderTimeVO.setElectronicProportion(jian+"元/"+feng+"元/"+ping+"元/"+gu+"元-"
                +jian.divide(add2,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                +feng.divide(add2,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                +ping.divide(add2,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                +gu.divide(add2,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%");
        if (add.compareTo(new BigDecimal("0"))!=0){
            chargingOrderTimeVO.setCapacityProportion(jianElectronic+"度/"+fengElectronic+"度/"+pingElectronic+"度/"+guElectronic+"度-"
                    +jianElectronic.divide(add,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                    +fengElectronic.divide(add,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                    +pingElectronic.divide(add,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                    +guElectronic.divide(add,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%");
            chargingOrderTimeVO.setServiceProportion(jianService+"元/"+fengService+"元/"+pingService+"元/"+guService+"元-"
                    +jianService.divide(add1,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                    +fengService.divide(add1,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                    +pingService.divide(add1,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                    +guService.divide(add1,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%");
            chargingOrderTimeVO.setElectronicProportion(jian+"元/"+feng+"元/"+ping+"元/"+gu+"元-"
                    +jian.divide(add2,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                    +feng.divide(add2,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                    +ping.divide(add2,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%/"
                    +gu.divide(add2,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%");
        }else{
            chargingOrderTimeVO.setCapacityProportion(jianElectronic+"度/"+fengElectronic+"度/"+pingElectronic+"度/"+guElectronic+"度-"
                    +"0"+"%/"
                    +"0"+"%/"
                    +"0"+"%/"
                    +"0"+"%");
            chargingOrderTimeVO.setServiceProportion(jianService+"元/"+fengService+"元/"+pingService+"元/"+guService+"元-"
                    +"0"+"%/"
                    +"0"+"%/"
                    +"0"+"%/"
                    +"0"+"%");
            chargingOrderTimeVO.setElectronicProportion(jian+"元/"+feng+"元/"+ping+"元/"+gu+"元-"
                    +"0"+"%/"
                    +"0"+"%/"
                    +"0"+"%/"
                    +"0"+"%");
        }
        pageInfo.setRecords(list);
        chargingOrderTimeVO.setList(pageInfo);
        return chargingOrderTimeVO;
    }
@@ -1342,39 +1384,69 @@
        TChargingOrder chargingOrder= this.getById(uid);
        ChargingOrderListInfoVO chargingOrderListInfoVO = new ChargingOrderListInfoVO();
        chargingOrderListInfoVO.setElectrovalence(chargingOrder.getElectrovalence());
        chargingOrderListInfoVO.setServiceCharge(chargingOrder.getServiceCharge());
        if (chargingOrder.getElectrovalence()!=null && chargingOrder.getServiceCharge()!=null){
            chargingOrderListInfoVO.setTotal(chargingOrder.getElectrovalence().add(chargingOrder.getServiceCharge()));
        }else{
            chargingOrderListInfoVO.setTotal(new BigDecimal("0"));
        }
        if (chargingOrderListInfoVO.getTotal().compareTo(new BigDecimal("0"))>0){
            if (chargingOrder.getCouponDiscountAmount()!=null&& chargingOrder.getVipDiscountAmount()!=null&& chargingOrder.getSharingAmount()!=null&& chargingOrder.getCommissionAmount()!=null){
                chargingOrderListInfoVO.setRealTotal(chargingOrderListInfoVO.getTotal().subtract(chargingOrder.getCouponDiscountAmount()).subtract(chargingOrder.getVipDiscountAmount()).subtract(chargingOrder.getSharingAmount()).subtract(chargingOrder.getCommissionAmount()));
            }else{
                chargingOrderListInfoVO.setRealTotal(chargingOrderListInfoVO.getTotal());
            }
        }else{
            chargingOrderListInfoVO.setRealTotal(new BigDecimal("0"));
        }
        chargingOrderListInfoVO.setCode(chargingOrder.getCode());
        List<Site> data = siteClient.getSiteByIds(Arrays.asList(chargingOrder.getSiteId())).getData();
        if (!data.isEmpty()){
            chargingOrderListInfoVO.setSiteName(data.get(0).getName());
            chargingOrderListInfoVO.setSiteAddress(data.get(0).getAddress());
        }
        TChargingGun data1 = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData();
        TChargingPile data2 = chargingPileClient.getChargingPileById(data1.getChargingPileId()).getData();
        if (data1!=null){
            chargingOrderListInfoVO.setGunCode(data1.getCode());
            chargingOrderListInfoVO.setTerminalName(data2.getName()+data1.getName());
        if (chargingOrder.getChargingGunId()!=null){
            TChargingGun data1 = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData();
            if (data1!=null){
                TChargingPile data2 = chargingPileClient.getChargingPileById(data1.getChargingPileId()).getData();
                if (data2!=null){
                    chargingOrderListInfoVO.setGunCode(data1.getCode());
                    chargingOrderListInfoVO.setTerminalName(data2.getName()+data1.getName());
                }
            }
        }
        chargingOrderListInfoVO.setEndMode(chargingOrder.getEndMode());
        // 获取开始SOC 结束soc
        List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData();
        if (!data6.isEmpty()){
            // 第一条数据soc为开始 最后一条数据soc为结束soc
            chargingOrderListInfoVO.setStartSoc(data6.get(0).getSoc().toString());
            chargingOrderListInfoVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString());
            chargingOrderListInfoVO.setChargingCapacity(data6.get(data6.size()-1).getCharging_degree());
            chargingOrderListInfoVO.setChargingSecond(data6.get(data6.size()-1).getCumulative_charging_time()*60+"");
        // 获取开始SOC 结束soc
        if (chargingOrder.getCode()!=null){
            List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData();
            if (data6!=null){
                if (!data6.isEmpty()){
                    // 第一条数据soc为开始 最后一条数据soc为结束soc
                    chargingOrderListInfoVO.setStartSoc(data6.get(0).getSoc().toString());
                    chargingOrderListInfoVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString());
                    chargingOrderListInfoVO.setChargingCapacity(data6.get(data6.size()-1).getCharging_degree());
                    chargingOrderListInfoVO.setChargingSecond(data6.get(data6.size()-1).getCumulative_charging_time()*60+"");
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) {
                        uploadRealTimeMonitoringData.setCreateTime(simpleDateFormat.format(uploadRealTimeMonitoringData.getCreate_time()));
                    }
                }
            }
            chargingOrderListInfoVO.setList(data6);
        }
        if (chargingOrder.getAppUserCarId()!=null){
            List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(chargingOrder.getAppUserCarId())).getData();
            if (!data3.isEmpty())chargingOrderListInfoVO.setLicensePlate(data3.get(0).getLicensePlate());
            if (data3!=null && !data3.isEmpty())chargingOrderListInfoVO.setLicensePlate(data3.get(0).getLicensePlate());
        }
        chargingOrderListInfoVO.setStartTime(chargingOrder.getStartTime());
        chargingOrderListInfoVO.setEndTime(chargingOrder.getEndTime());
        chargingOrderListInfoVO.setId(chargingOrder.getId());
        chargingOrderListInfoVO.setUid(chargingOrder.getId().toString());
        chargingOrderListInfoVO.setList(data6);
        chargingOrderListInfoVO.setCouponDiscountAmount(chargingOrder.getCouponDiscountAmount());
        chargingOrderListInfoVO.setVipDiscountAmount(chargingOrder.getVipDiscountAmount());
        chargingOrderListInfoVO.setSharingAmount(chargingOrder.getSharingAmount());
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ChargingOrderListInfoVO.java
@@ -26,6 +26,8 @@
    private String terminalName;
    @ApiModelProperty(value = "结束原因 (0=异常终止,1=主动终止,2=满电终止,3=费用不足终止)")
    private Integer endMode;
    @ApiModelProperty(value = "状态(-1=启动失败,取消订单,0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)")
    private Integer status;
    @ApiModelProperty(value = "开始soc")
    private String startSoc;
    @ApiModelProperty(value = "结束soc")
@@ -56,6 +58,11 @@
    private BigDecimal electrovalence;
    @ApiModelProperty(value = "累计服务费")
    private BigDecimal serviceCharge;
    @ApiModelProperty(value = "充电费用(电费加服务费)")
    private BigDecimal total;
    @ApiModelProperty(value = "实收(电费加服务费)-优惠券抵扣 -会员抵扣 - 第三方平台分佣 -平台手续费")
    private BigDecimal realTotal;
    @ApiModelProperty(value = "开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime startTime;
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingBillMapper.xml
@@ -13,10 +13,28 @@
            and t1.status = #{req.state}
        </if>
        <if test="startTime1 != null and startTime1!=''">
            and (t1.bill_time between #{startTime1} and #{startTime2})
        </if>
        <if test="req.uid != null and req.uid!=''">
            and t1.id = #{req.uid}
        </if>
        and t1.billType = 1
    </select>
    <select id="chargingBillList1" resultType="com.ruoyi.order.api.vo.ChargingBillListVO">
    select t1.* from t_charging_bill t1
    where 1=1
        <if test="req.type != null ">
            and t1.type = #{req.type}
        </if>
      <if test="req.state != null ">
            and t1.status = #{req.state}
        </if>
        <if test="startTime1 != null and startTime1!=''">
            and (t1.bill_time between #{startTime1} and #{startTime2}
        </if>
        <if test="req.uid != null and req.uid!=''">
            and t1.id = #{req.uid}
        </if>
        and t1.billType = 2
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -36,13 +36,17 @@
        <result column="refund_status" property="refundStatus" />
        <result column="refund_serial_number" property="refundSerialNumber" />
        <result column="refund_time" property="refundTime" />
        <result column="need_elec" property="needElec" />
        <result column="create_time" property="createTime" />
        <result column="del_flag" property="delFlag" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        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
        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
    </sql>
    
@@ -554,7 +558,7 @@
            AND create_time >= #{statisticsQueryDto.startTime}
        </if>
        <if test="statisticsQueryDto.endTime != null">
            AND create_time <= #{statisticsQueryDto.endTime}
            AND create_time &lt;= #{statisticsQueryDto.endTime}
        </if>
        </if>
@@ -617,7 +621,7 @@
            AND create_time >= #{statisticsQueryDto.startTime}
        </if>
        <if test="statisticsQueryDto.endTime != null">
            AND create_time <= #{statisticsQueryDto.endTime}
            AND create_time &lt;= #{statisticsQueryDto.endTime}
        </if>
        </if>
        GROUP BY
@@ -649,7 +653,7 @@
                AND create_time >= #{statisticsQueryDto.startTime}
            </if>
            <if test="statisticsQueryDto.endTime != null">
                AND create_time <= #{statisticsQueryDto.endTime}
                AND create_time &lt;= #{statisticsQueryDto.endTime}
            </if>
        </if>
        GROUP BY
@@ -709,7 +713,7 @@
                    AND co.create_time >= #{statisticsQueryDto.startTime}
                </if>
                <if test="statisticsQueryDto.endTime != null">
                    AND co.create_time <= #{statisticsQueryDto.endTime}
                    AND co.create_time &lt;= #{statisticsQueryDto.endTime}
                </if>
            </if>
        </where>
@@ -800,7 +804,7 @@
            and t1.order_type = #{req.orderType}
        </if>
        <if test="req.status != null ">
            and t1.status = #{status}
            and t1.status = #{req.status}
        </if>
        <if test="req.status != null ">
            and t1.status = #{req.status}
@@ -815,7 +819,7 @@
            and (t1.end_time between #{endTime1} and #{endTime2})
        </if>
    </select>
    <select id="chargingList1" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO">
    <select id="chargingListNoPage" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO">
        select t1.* from t_charging_order t1
        where 1=1
        <if test="null != req.code and req.code!=''">
@@ -837,7 +841,7 @@
            and t1.order_type = #{req.orderType}
        </if>
        <if test="req.status != null ">
            and t1.status = #{status}
            and t1.status = #{req.status}
        </if>
        <if test="req.status != null ">
            and t1.status = #{req.status}
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml
@@ -49,6 +49,9 @@
            <if test="query.invoicingObjectType != null">
                AND toi.invoicing_object_type = #{query.invoicingObjectType}
            </if>
            <if test="query.status != null">
                AND toi.status = #{query.status}
            </if>
            <if test="query.invoiceMaterial != null">
                AND toi.invoice_material = #{query.invoiceMaterial}
            </if>
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
@@ -283,7 +283,7 @@
            payPrice = orderPrice.subtract(coupon.getDiscountAmount());
            discountPrice = coupon.getDiscountAmount();
        }
        exchangeDto.setPayPrice(payPrice);
        exchangeDto.setPayPrice(orderPrice);
        exchangeDto.setDiscountPrice(discountPrice);
        exchangeDto.setVipDiscount(vipDiscount);
        exchangeDto.setUserId(userId);
@@ -293,10 +293,11 @@
            //调起支付
            PaymentOrder paymentOrder = new PaymentOrder();
            paymentOrder.setCode(shopOrder.getCode());
            paymentOrder.setAmount(shopOrder.getPaymentAmount());
            paymentOrder.setAmount(exchangeDto.getOrderPrice());
            paymentOrder.setOpenId(user.getWxOpenid());
            paymentOrder.setDescription("购买商品");
         return    wxPaymentClient.orderPay(paymentOrder);
            R<Map<String, Object>> mapR = wxPaymentClient.orderPay(paymentOrder);
            return    mapR;
        }else {
            //todo 罗 支付宝支付
            return R.ok();
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java
@@ -9,9 +9,11 @@
import com.ruoyi.other.query.InvoiceTypePageList;
import com.ruoyi.other.service.TInvoiceTypeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -38,6 +40,18 @@
        PageInfo<TInvoiceType> pageInfo = invoiceTypeService.pageList(pageList);
        return AjaxResult.success(pageInfo);
    }
    @ResponseBody
    @GetMapping("/pageListR")
    @ApiOperation(value = "获取开票公司和类型列表", tags = {"管理后台-发票管理"})
    public R<List<TInvoiceType>> pageListR( String company){
        List<TInvoiceType> list = new ArrayList<>();
        if (StringUtils.hasLength(company)){
            list = invoiceTypeService.lambdaQuery().eq(TInvoiceType::getInvoicingCompany, company).list();
        }else{
            list = invoiceTypeService.lambdaQuery().list();
        }
        return R.ok(list);
    }
    
    
    @ResponseBody
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java
@@ -118,7 +118,7 @@
            switch (substring){
                //购物订单
                case "GW":
                System.err.println("----收到购物回调");
                    break;
                case "HY":
                    break;
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/utils/WxAbstractPay.java
@@ -69,7 +69,7 @@
     */
    protected String buildBaseParam(WxPaymentInfoModel requestBody, String notifyUrl) {
        // 封装基础数据
        requestBody.setNotify_url(notifyUrl);
//        requestBody.setNotify_url(notifyUrl);
        String reqBody = WxJsonUtils.toJsonString(requestBody);
        return reqBody;
    }