Merge branch 'dev' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
Conflicts:
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/util/TCECCJianGuanontroller.java
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "H5手机号登录DTO") |
| | | public class PhoneLoginDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String phoneNumber; |
| | | |
| | | @ApiModelProperty(value = "枪号") |
| | | private String chargePileCode; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.InviteUserClient; |
| | | import com.ruoyi.account.api.feignClient.JianGuanAccountClient; |
| | | import com.ruoyi.account.api.model.TInviteUser; |
| | | import com.ruoyi.account.api.vo.GetInviteUser; |
| | | import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class JianGuanAccountFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<JianGuanAccountClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(JianGuanAccountFallbackFactory.class); |
| | | |
| | | @Override |
| | | public JianGuanAccountClient create(Throwable throwable) { |
| | | log.error("政务云查询数据接口:{}", throwable.getMessage()); |
| | | return new JianGuanAccountClient() { |
| | | @Override |
| | | public R<GovernmentCloudAccountVO> listAll() { |
| | | return R.fail("政务云查询数据接口Account:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.factory.InviteUserFallbackFactory; |
| | | import com.ruoyi.account.api.model.TInviteUser; |
| | | import com.ruoyi.account.api.vo.GetInviteUser; |
| | | import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; |
| | | 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.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 17:54 |
| | | */ |
| | | @FeignClient(contextId = "JianGuanAccountClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = InviteUserFallbackFactory.class) |
| | | public interface JianGuanAccountClient { |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/governmentCloudAccount/listAll") |
| | | R<GovernmentCloudAccountVO> listAll(); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.vo; |
| | | |
| | | import com.ruoyi.account.api.model.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "GovernmentCloudAccountVO对象",description = "Account政务云上传数据VO") |
| | | public class GovernmentCloudAccountVO { |
| | | |
| | | @ApiModelProperty(value = "优惠券") |
| | | private List<TAppCoupon> appCoupons; |
| | | @ApiModelProperty(value = "用户") |
| | | private List<TAppUser> appUsers; |
| | | @ApiModelProperty(value = "用户地址") |
| | | private List<TAppUserAddress> appUserAddresses; |
| | | @ApiModelProperty(value = "用户车辆") |
| | | private List<TAppUserCar> appUserCars; |
| | | @ApiModelProperty(value = "用户积分明细") |
| | | private List<TAppUserIntegralChange> appUserIntegralChanges; |
| | | @ApiModelProperty(value = "用户签到") |
| | | private List<TAppUserSign> appUserSigns; |
| | | @ApiModelProperty(value = "用户标签") |
| | | private List<TAppUserTag> appUserTags; |
| | | @ApiModelProperty(value = "用户会员明细") |
| | | private List<TAppUserVipDetail> appUserVipDetails; |
| | | @ApiModelProperty(value = "邀请用户") |
| | | private List<TInviteUser> inviteUsers; |
| | | @ApiModelProperty(value = "发票") |
| | | private List<TInvoiceInformation> invoiceInformations; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | com.ruoyi.account.api.factory.AppUserAddressFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserVipDetailFallbackFactory |
| | | com.ruoyi.account.api.factory.InviteUserFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserTagFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserTagFallbackFactory |
| | | com.ruoyi.account.api.factory.JianGuanAccountFallbackFactory |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public R<TChargingGun> getChargingGunByFullNumber(String fullNumber) { |
| | | return R.fail("根据枪唯一码查询信息失败:" + throwable.getMessage()); |
| | | } |
| | | @Override |
| | | public R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(List<Integer> siteIds, List<Integer> chargeModels){ |
| | | return R.fail("根据站点ids和充电模式集合查询充电枪集合失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.JianGuanChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.vo.GovernmentCloudChargingPileVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class JianGuanChargingPileFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<JianGuanChargingPileClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(JianGuanChargingPileFallbackFactory.class); |
| | | |
| | | @Override |
| | | public JianGuanChargingPileClient create(Throwable throwable) { |
| | | log.error("政务云查询数据接口:{}", throwable.getMessage()); |
| | | return new JianGuanChargingPileClient() { |
| | | @Override |
| | | public R<GovernmentCloudChargingPileVO> listAll() { |
| | | return R.fail("政务云查询数据接口ChargingPile:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory; |
| | | 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.GetChargingGunByCode; |
| | | 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.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/t-charging-gun/getChargingGunByFullNumber") |
| | | R<TChargingGun> getChargingGunByFullNumber(@RequestParam("fullNumber") String fullNumber); |
| | | |
| | | /** |
| | | * 大屏 根据站点ids和充电模式集合查询充电枪集合 |
| | | */ |
| | | @GetMapping("/t-charging-gun/getGunIdsBySiteIdsAndChargeModels") |
| | | R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(@RequestParam("siteIds") List<Integer> siteIds ,@RequestParam("chargeModels") List<Integer> chargeModels); |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.JianGuanChargingPileFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.vo.GovernmentCloudChargingPileVO; |
| | | 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.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 17:54 |
| | | */ |
| | | @FeignClient(contextId = "JianGuanChargingPileClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = JianGuanChargingPileFallbackFactory.class) |
| | | public interface JianGuanChargingPileClient { |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/governmentCloudChargingPile/listAll") |
| | | R<GovernmentCloudChargingPileVO> listAll(); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_accounting_strategy_detail") |
| | | @ApiModel(value="TAccountingStrategyDetail对象", description="计费策略明细") |
| | | public class TAccountingStrategyDetail implements Serializable { |
| | | public class TAccountingStrategyDetail extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "GovernmentCloudChargingPileVO对象",description = "ChargingPile政务云上传数据VO") |
| | | public class GovernmentCloudChargingPileVO { |
| | | |
| | | @ApiModelProperty(value = "合作商") |
| | | private List<Partner> partners; |
| | | @ApiModelProperty(value = "站点") |
| | | private List<Site> sites; |
| | | @ApiModelProperty(value = "计费策略") |
| | | private List<TAccountingStrategy> accountingStrategies; |
| | | @ApiModelProperty(value = "计费策略明细") |
| | | private List<TAccountingStrategyDetail> accountingStrategyDetails; |
| | | @ApiModelProperty(value = "申请充电桩") |
| | | private List<TApplyChargingPile> applyChargingPiles; |
| | | @ApiModelProperty(value = "车库") |
| | | private List<TCarport> carports; |
| | | @ApiModelProperty(value = "枪") |
| | | private List<TChargingGun> chargingGuns; |
| | | @ApiModelProperty(value = "桩") |
| | | private List<TChargingPile> chargingPiles; |
| | | @ApiModelProperty(value = "站点通知") |
| | | private List<TChargingPileNotification> chargingPileNotifications; |
| | | @ApiModelProperty(value = "故障内容") |
| | | private List<TFaultMessage> faultMessages; |
| | | @ApiModelProperty(value = "监控") |
| | | private List<TMonitoringEquipment> monitoringEquipments; |
| | | @ApiModelProperty(value = "停车场") |
| | | private List<TParkingLot> parkingLots; |
| | | @ApiModelProperty(value = "停车记录") |
| | | private List<TParkingRecord> parkingRecords; |
| | | @ApiModelProperty(value = "合作商站点") |
| | | private List<TPartnerSite> partnerSites; |
| | | @ApiModelProperty(value = "保修") |
| | | private List<TRepair> repairs; |
| | | @ApiModelProperty(value = "站点菜单那") |
| | | private List<TSiteMenu> siteMenus; |
| | | @ApiModelProperty(value = "车道") |
| | | private List<TVehicleRamp> vehicleRamps; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "大屏对外开放区车位使用情况Vo") |
| | | public class LargeScreenGunVo { |
| | | @ApiModelProperty(value = "超级快充") |
| | | private Integer superFast=0; |
| | | @ApiModelProperty(value = "快充") |
| | | private Integer fast=0; |
| | | @ApiModelProperty(value = "快充") |
| | | private Integer v2g=0; |
| | | |
| | | @ApiModelProperty(value = "超级快充 使用") |
| | | private Integer useSuperFast=0; |
| | | @ApiModelProperty(value = "快充") |
| | | private Integer useFast=0; |
| | | @ApiModelProperty(value = "快充") |
| | | private Integer useV2g=0; |
| | | } |
| | |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.FaultMessageFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.PartnerFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.PartnerFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.JianGuanChargingPileFallbackFactory |
| | |
| | | @Data |
| | | @Document(collection = "upload_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UploadRealTimeMonitoringData extends BaseModel { |
| | | public class UploadRealTimeMonitoringData { |
| | | @Id |
| | | private String id; |
| | | private String transaction_serial_number; // 交易流水号 |
| | |
| | | @ApiModelProperty(value = "删除按钮权限 ") |
| | | private Boolean authDelete = true; |
| | | |
| | | private Date create_time=new Date(); |
| | | private Date last_time = new Date(); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public void chargingOrderALICallback(String out_trade_no, String transaction_id, String attach) { |
| | | log.error("充电支付成功回调通知失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void chargingOrderALIH5Callback(String out_trade_no, String transaction_id, String attach) { |
| | | log.error("充电支付宝H5支付成功回调通知失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void chargingOrderStartupFailureWxRefund(String out_refund_no, String refund_id, String tradeState, String success_time) { |
| | | log.error("远程启动失败后退款通知失败:" + throwable.getMessage()); |
| | |
| | | public R tripartitePlatformStopCharge(String startChargeSeq) { |
| | | return R.fail("三方平台请求停止充电失败:" + throwable.getMessage()); |
| | | } |
| | | @Override |
| | | public R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds){ |
| | | return R.fail("获取站点集合中总的充电量失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.feignClient.JianGuanOrderClient; |
| | | import com.ruoyi.order.api.vo.GovernmentCloudOrderVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class JianGuanOrderFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<JianGuanOrderClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(JianGuanOrderClient.class); |
| | | |
| | | @Override |
| | | public JianGuanOrderClient create(Throwable throwable) { |
| | | log.error("政务云查询数据接口:{}", throwable.getMessage()); |
| | | return new JianGuanOrderClient() { |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll() { |
| | | return R.fail("政务云查询数据接口Order:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | void chargingOrderALICallback(@RequestParam("out_trade_no") String out_trade_no, |
| | | @RequestParam("transaction_id") String transaction_id, |
| | | @RequestParam("attach") String attach); |
| | | |
| | | |
| | | /** |
| | | * 充电支付成功回调通知 |
| | | * @param out_trade_no |
| | | * @param transaction_id |
| | | * @param attach |
| | | */ |
| | | @PostMapping("/t-charging-order/chargingOrderALIH5Callback") |
| | | void chargingOrderALIH5Callback(@RequestParam("out_trade_no") String out_trade_no, |
| | | @RequestParam("transaction_id") String transaction_id, |
| | | @RequestParam("attach") String attach); |
| | | |
| | | /** |
| | | * 远程启动失败后退款回调 |
| | | * @param out_refund_no |
| | |
| | | */ |
| | | @PostMapping("/t-charging-order/tripartitePlatformStopCharge") |
| | | R tripartitePlatformStopCharge(@RequestParam("startChargeSeq") String startChargeSeq); |
| | | |
| | | /** |
| | | * 充电桩大屏 获取站点集合中总的充电量 |
| | | */ |
| | | @GetMapping("/t-charging-order/getSumDegreeBySiteIds") |
| | | R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.factory.JianGuanOrderFallbackFactory; |
| | | import com.ruoyi.order.api.vo.GovernmentCloudOrderVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 17:54 |
| | | */ |
| | | @FeignClient(contextId = "JianGuanOrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = JianGuanOrderFallbackFactory.class) |
| | | public interface JianGuanOrderClient { |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/governmentCloudOrder/listAll") |
| | | R<GovernmentCloudOrderVO> listAll(); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Base64; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @Data |
| | | @TableName("t_accounting_strategy_detail_order") |
| | | public class AccountingStrategyDetailOrder { |
| | | public class AccountingStrategyDetailOrder extends BasePojo { |
| | | /** |
| | | * 主键 |
| | | */ |
| | |
| | | import java.io.Serializable; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_charging_order_refund") |
| | | @ApiModel(value="TChargingOrderRefund对象1", description="") |
| | | public class TChargingOrderRefund implements Serializable { |
| | | public class TChargingOrderRefund extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_order_evaluate_tag") |
| | | @ApiModel(value="TOrderEvaluateTag对象", description="") |
| | | public class TOrderEvaluateTag implements Serializable { |
| | | public class TOrderEvaluateTag extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_order_invoice_detail") |
| | | @ApiModel(value="TOrderInvoiceDetail对象", description="") |
| | | public class TOrderInvoiceDetail implements Serializable { |
| | | public class TOrderInvoiceDetail extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | import java.io.Serializable; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_shopping_order_refund") |
| | | @ApiModel(value="TShoppingOrderRefund对象", description="") |
| | | public class TShoppingOrderRefund implements Serializable { |
| | | public class TShoppingOrderRefund extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | import java.io.Serializable; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_vip_order_refund") |
| | | @ApiModel(value="TVipOrderRefund对象", description="") |
| | | public class TVipOrderRefund implements Serializable { |
| | | public class TVipOrderRefund extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.order.api.model.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "GovernmentCloudOrderVO对象",description = "Order政务云上传数据VO") |
| | | public class GovernmentCloudOrderVO { |
| | | |
| | | @ApiModelProperty(value = "计费策略明细") |
| | | private List<AccountingStrategyDetailOrder> accountingStrategyDetailOrders; |
| | | @ApiModelProperty(value = "策略申请") |
| | | private List<AccountingStrategyOrder> accountingStrategyOrders; |
| | | @ApiModelProperty(value = "账单") |
| | | private List<TChargingBill> chargingBills; |
| | | @ApiModelProperty(value = "充电订单") |
| | | private List<TChargingOrder> chargingOrders; |
| | | @ApiModelProperty(value = "充电明细") |
| | | private List<TChargingOrderAccountingStrategy> chargingOrderAccountingStrategies; |
| | | @ApiModelProperty(value = "充电订单退款") |
| | | private List<TChargingOrderRefund> chargingOrderRefunds; |
| | | @ApiModelProperty(value = "积分订单") |
| | | private List<TExchangeOrder> exchangeOrders; |
| | | @ApiModelProperty(value = "赠送会员") |
| | | private List<TGrantVip> grantVips; |
| | | @ApiModelProperty(value = "订单申诉") |
| | | private List<TOrderAppeal> orderAppeals; |
| | | @ApiModelProperty(value = "订单评价") |
| | | private List<TOrderEvaluate> orderEvaluates; |
| | | @ApiModelProperty(value = "订单评价标签") |
| | | private List<TOrderEvaluateTag> orderEvaluateTags; |
| | | @ApiModelProperty(value = "订单开票") |
| | | private List<TOrderInvoice> orderInvoices; |
| | | @ApiModelProperty(value = "订单开票明细") |
| | | private List<TOrderInvoiceDetail> orderInvoiceDetails; |
| | | @ApiModelProperty(value = "结算确认") |
| | | private List<TSettlementConfirm> settlementConfirms; |
| | | @ApiModelProperty(value = "购物订单") |
| | | private List<TShoppingOrder> shoppingOrders; |
| | | @ApiModelProperty(value = "购物订单退款") |
| | | private List<TShoppingOrderRefund> shoppingOrderRefunds; |
| | | @ApiModelProperty(value = "会员订单") |
| | | private List<TVipOrder> vipOrders; |
| | | @ApiModelProperty(value = "会员退款") |
| | | private List<TVipOrderRefund> vipOrderRefunds; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | com.ruoyi.order.api.factory.ChargingOrderAccountingStrategyFallbackFactory |
| | | com.ruoyi.order.api.factory.AccountingStrategyDetailOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.AccountingStrategyOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ShoppingOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ShoppingOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.JianGuanOrderFallbackFactory |
New file |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("t_screen_content") |
| | | @ApiModel("大屏设置对象") |
| | | public class TScreenContent { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @ApiModelProperty("主键ID") |
| | | private Integer id; |
| | | |
| | | @TableField("site_id") |
| | | @ApiModelProperty("站点id") |
| | | private Integer siteId; |
| | | |
| | | @TableField("green_electricity_today") |
| | | @ApiModelProperty("今日绿电消纳值") |
| | | private BigDecimal greenElectricityToday=BigDecimal.ZERO; |
| | | |
| | | @TableField("car_discharge") |
| | | @ApiModelProperty("累计汽车放电量") |
| | | private BigDecimal carDischarge=BigDecimal.ZERO; |
| | | |
| | | @TableField("green_electricity") |
| | | @ApiModelProperty("累计绿电消纳电量") |
| | | private BigDecimal greenElectricity=BigDecimal.ZERO; |
| | | |
| | | @TableField("title") |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | |
| | | @TableField("title_one") |
| | | @ApiModelProperty("标题1") |
| | | private String titleOne; |
| | | |
| | | @TableField("value_one") |
| | | @ApiModelProperty("值1") |
| | | private BigDecimal valueOne; |
| | | |
| | | @TableField("unit_one") |
| | | @ApiModelProperty("计量单位1") |
| | | private String unitOne; |
| | | |
| | | @TableField("title_two") |
| | | @ApiModelProperty("标题2") |
| | | private String titleTwo; |
| | | |
| | | @TableField("value_two") |
| | | @ApiModelProperty("值2") |
| | | private BigDecimal valueTwo; |
| | | |
| | | @TableField("unit_two") |
| | | @ApiModelProperty("计量单位2") |
| | | private String unitTwo; |
| | | |
| | | @TableField("title_three") |
| | | @ApiModelProperty("标题3") |
| | | private String titleThree; |
| | | |
| | | @TableField("value_three") |
| | | @ApiModelProperty("值3") |
| | | private BigDecimal valueThree; |
| | | |
| | | @TableField("unit_three") |
| | | @ApiModelProperty("计量单位3") |
| | | private String unitThree; |
| | | |
| | | @TableField("statistical_deadline") |
| | | @ApiModelProperty("截止统计日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date statisticalDeadline; |
| | | |
| | | @TableField("create_time") |
| | | @ApiModelProperty("创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | @TableField("update_time") |
| | | @ApiModelProperty("更新时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.feignClient.JianGuanOtherClient; |
| | | import com.ruoyi.other.api.vo.GovernmentCloudOtherVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class JianGuanOtherFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<JianGuanOtherClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(JianGuanOtherClient.class); |
| | | |
| | | @Override |
| | | public JianGuanOtherClient create(Throwable throwable) { |
| | | log.error("政务云查询数据接口:{}", throwable.getMessage()); |
| | | return new JianGuanOtherClient() { |
| | | @Override |
| | | public R<GovernmentCloudOtherVO> listAll() { |
| | | return R.fail("政务云查询数据接口Other:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.factory.JianGuanOtherFallbackFactory; |
| | | import com.ruoyi.other.api.vo.GovernmentCloudOtherVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 17:54 |
| | | */ |
| | | @FeignClient(contextId = "JianGuanOtherClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = JianGuanOtherFallbackFactory.class) |
| | | public interface JianGuanOtherClient { |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/governmentCloudOther/listAll") |
| | | R<GovernmentCloudOtherVO> listAll(); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.vo; |
| | | |
| | | import com.ruoyi.other.api.domain.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "GovernmentCloudOtherVO对象",description = "Other政务云上传数据VO") |
| | | public class GovernmentCloudOtherVO { |
| | | |
| | | @ApiModelProperty(value = "合作商") |
| | | private List<Operator> operators; |
| | | @ApiModelProperty(value = "活动") |
| | | private List<TActivity> activities; |
| | | @ApiModelProperty(value = "广告") |
| | | private List<TAdvertising> advertisings; |
| | | @ApiModelProperty(value = "公司") |
| | | private List<TCompany> companies; |
| | | @ApiModelProperty(value = "优惠券") |
| | | private List<TCoupon> coupons; |
| | | @ApiModelProperty(value = "用户信息") |
| | | private List<TEnterpriseUserApplication> enterpriseUserApplications; |
| | | @ApiModelProperty(value = "评价标签") |
| | | private List<TEvaluationTag> evaluationTags; |
| | | @ApiModelProperty(value = "商品") |
| | | private List<TGoods> goods; |
| | | @ApiModelProperty(value = "协议") |
| | | private List<THtml> htmls; |
| | | @ApiModelProperty(value = "积分规则") |
| | | private List<TIntegralRule> integralRules; |
| | | @ApiModelProperty(value = "开票类型") |
| | | private List<TInvoiceType> invoiceTypes; |
| | | @ApiModelProperty(value = "消息") |
| | | private List<TNotice> notices; |
| | | @ApiModelProperty(value = "系统配置") |
| | | private List<TSystemConfiguration> systemConfigurations; |
| | | @ApiModelProperty(value = "用户标签") |
| | | private List<TUserTag> userTags; |
| | | @ApiModelProperty(value = "会员") |
| | | private List<TVip> vips; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | com.ruoyi.other.api.factory.WebSocketFallbackFactory |
| | | com.ruoyi.other.api.factory.UserTagFallbackFactory |
| | | com.ruoyi.other.api.factory.OperatorFallbackFactory |
| | | com.ruoyi.other.api.factory.SystemConfigurationClientFallbackFactory |
| | | com.ruoyi.other.api.factory.SystemConfigurationClientFallbackFactory |
| | | com.ruoyi.other.api.factory.JianGuanOtherFallbackFactory |
New file |
| | |
| | | package com.ruoyi.payment.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.payment.api.feignClient.AppAliPaymentClient; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 充电订单服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class AppAliPaymentFallbackFactory implements FallbackFactory<AppAliPaymentClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(AppAliPaymentFallbackFactory.class); |
| | | |
| | | @Override |
| | | public AppAliPaymentClient create(Throwable throwable) { |
| | | log.error("支付宝App支付调用失败:{}", throwable.getMessage()); |
| | | return new AppAliPaymentClient() { |
| | | |
| | | @Override |
| | | public R<Map<String, String>> payment(AliPaymentReq req) { |
| | | return R.fail("调起支付宝App支付失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<AliQueryOrder> query(String outTradeNo) { |
| | | return R.fail("查询App支付订单失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void close(String outTradeNo) { |
| | | R.fail("关闭App支付订单失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<RefundResp> refund(RefundReq dto) { |
| | | return R.fail("App支付宝退款失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.payment.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.payment.api.feignClient.H5AliPaymentClient; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * 充电订单服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class H5AliPaymentFallbackFactory implements FallbackFactory<H5AliPaymentClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(H5AliPaymentFallbackFactory.class); |
| | | |
| | | @Override |
| | | public H5AliPaymentClient create(Throwable throwable) { |
| | | log.error("支付宝H5支付调用失败:{}", throwable.getMessage()); |
| | | return new H5AliPaymentClient() { |
| | | |
| | | @Override |
| | | public R<String> payment(AliPaymentReq req) { |
| | | return R.fail("调起支付宝H5支付失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<AliQueryOrder> query(String outTradeNo) { |
| | | return R.fail("查询H5支付订单失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void close(String outTradeNo) { |
| | | R.fail("关闭H5支付订单失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<RefundResp> refund(RefundReq dto) { |
| | | return R.fail("H5支付宝退款失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.payment.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.payment.api.factory.AppAliPaymentFallbackFactory; |
| | | import com.ruoyi.payment.api.factory.WxPaymentFallbackFactory; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/24 14:39 |
| | | */ |
| | | @FeignClient(contextId = "AppAliPaymentClient", value = ServiceNameConstants.PAYMENT_SERVICE, fallbackFactory = AppAliPaymentFallbackFactory.class) |
| | | public interface AppAliPaymentClient { |
| | | |
| | | |
| | | /** |
| | | * 调起支付宝小程序支付 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @PostMapping("/aliApp/payment") |
| | | R<Map<String, String>> payment(@RequestBody AliPaymentReq req); |
| | | |
| | | |
| | | /** |
| | | * 查询支付订单 |
| | | * @param outTradeNo |
| | | * @return |
| | | */ |
| | | @PostMapping("/aliApp/query") |
| | | R<AliQueryOrder> query(@RequestParam("outTradeNo") String outTradeNo); |
| | | |
| | | /** |
| | | * 关闭订单 |
| | | * @param outTradeNo |
| | | */ |
| | | @PostMapping("/aliApp/close") |
| | | void close(@RequestParam("outTradeNo") String outTradeNo); |
| | | /** |
| | | * 后台退款 远程调用 |
| | | */ |
| | | @PostMapping("/aliApp/refund") |
| | | public R<RefundResp> refund(@RequestBody RefundReq dto); |
| | | } |
New file |
| | |
| | | package com.ruoyi.payment.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.payment.api.factory.AppAliPaymentFallbackFactory; |
| | | import com.ruoyi.payment.api.factory.H5AliPaymentFallbackFactory; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/24 14:39 |
| | | */ |
| | | @FeignClient(contextId = "H5AliPaymentClient", value = ServiceNameConstants.PAYMENT_SERVICE, fallbackFactory = H5AliPaymentFallbackFactory.class) |
| | | public interface H5AliPaymentClient { |
| | | |
| | | |
| | | /** |
| | | * 调起支付宝小程序支付 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @PostMapping("/aliH5/payment") |
| | | R<String> payment(@RequestBody AliPaymentReq req); |
| | | |
| | | |
| | | /** |
| | | * 查询支付订单 |
| | | * @param outTradeNo |
| | | * @return |
| | | */ |
| | | @PostMapping("/aliH5/query") |
| | | R<AliQueryOrder> query(@RequestParam("outTradeNo") String outTradeNo); |
| | | |
| | | /** |
| | | * 关闭订单 |
| | | * @param outTradeNo |
| | | */ |
| | | @PostMapping("/aliH5/close") |
| | | void close(@RequestParam("outTradeNo") String outTradeNo); |
| | | /** |
| | | * 后台退款 远程调用 |
| | | */ |
| | | @PostMapping("/aliH5/refund") |
| | | public R<RefundResp> refund(@RequestBody RefundReq dto); |
| | | } |
| | |
| | | */ |
| | | private String notifyUrl; |
| | | /** |
| | | * 支付回跳地址 |
| | | */ |
| | | private String returnUrl; |
| | | /** |
| | | * 初始化默认数据 |
| | | */ |
| | | public AliPaymentReq() { |
| | |
| | | com.ruoyi.payment.api.factory.WxPaymentFallbackFactory |
| | | com.ruoyi.payment.api.factory.AliPaymentFallbackFactory |
| | | com.ruoyi.payment.api.factory.AliPaymentFallbackFactory |
| | | com.ruoyi.payment.api.factory.AppAliPaymentFallbackFactory |
| | | com.ruoyi.payment.api.factory.H5AliPaymentFallbackFactory |
New file |
| | |
| | | package com.ruoyi.system.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.feignClient.JianGuanSystemClient; |
| | | import com.ruoyi.system.api.vo.GovernmentCloudSystemVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class JianGuanSystemFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<JianGuanSystemClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(JianGuanSystemClient.class); |
| | | |
| | | @Override |
| | | public JianGuanSystemClient create(Throwable throwable) { |
| | | log.error("政务云查询数据接口:{}", throwable.getMessage()); |
| | | return new JianGuanSystemClient() { |
| | | @Override |
| | | public R<GovernmentCloudSystemVO> listAll() { |
| | | return R.fail("政务云查询数据接口System:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.factory.JianGuanSystemFallbackFactory; |
| | | import com.ruoyi.system.api.vo.GovernmentCloudSystemVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 17:54 |
| | | */ |
| | | @FeignClient(contextId = "JianGuanSystemClient", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = JianGuanSystemFallbackFactory.class) |
| | | public interface JianGuanSystemClient { |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/governmentCloudSystem/listAll") |
| | | R<GovernmentCloudSystemVO> listAll(); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.vo; |
| | | |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.api.domain.SysOperLog; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.expression.spel.ast.Operator; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "GovernmentCloudSystemVO对象",description = "System政务云上传数据VO") |
| | | public class GovernmentCloudSystemVO { |
| | | |
| | | @ApiModelProperty(value = "登录日志") |
| | | private List<SysLoginLog> loginLogs; |
| | | @ApiModelProperty(value = "操作日志") |
| | | private List<SysOperLog> sysOperLogs; |
| | | @ApiModelProperty(value = "角色") |
| | | private List<SysRole> sysRoles; |
| | | @ApiModelProperty(value = "系统用户") |
| | | private List<SysUser> sysUsers; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | com.ruoyi.system.api.factory.SysRoleFallbackFactory |
| | | com.ruoyi.system.api.factory.SysLoginLogFallbackFactory |
| | | com.ruoyi.system.api.factory.SysUserRoleFallbackFactory |
| | | com.ruoyi.system.api.factory.JianGuanSystemFallbackFactory |
New file |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.api.domain.SysOperLog; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.vo.GovernmentCloudSystemVO; |
| | | import com.ruoyi.system.service.ISysLoginLogService; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/governmentCloudSystem") |
| | | public class GovernmentCloudSystemController { |
| | | |
| | | @Autowired |
| | | private ISysLoginLogService sysLoginLogService; |
| | | @Autowired |
| | | private ISysOperLogService sysOperLogService; |
| | | @Autowired |
| | | private ISysRoleService sysRoleService; |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudSystemVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | GovernmentCloudSystemVO governmentCloudAccountVO = new GovernmentCloudSystemVO(); |
| | | List<SysLoginLog> list1 = sysLoginLogService.lambdaQuery().between(SysLoginLog::getCreateTime, start, end).list(); |
| | | List<SysOperLog> list2 = sysOperLogService.lambdaQuery().between(SysOperLog::getOperTime, start, end).list(); |
| | | List<SysRole> list3 = sysRoleService.lambdaQuery().between(SysRole::getCreateTime, start, end).list(); |
| | | List<SysUser> list4 = sysUserService.lambdaQuery().between(SysUser::getCreateTime, start, end).list(); |
| | | governmentCloudAccountVO.setLoginLogs(list1); |
| | | governmentCloudAccountVO.setSysOperLogs(list2); |
| | | governmentCloudAccountVO.setSysRoles(list3); |
| | | governmentCloudAccountVO.setSysUsers(list4); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; |
| | | import com.ruoyi.account.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/governmentCloudAccount") |
| | | public class GovernmentCloudAccountController { |
| | | @Autowired |
| | | private TAppCouponService tAppCouponService; |
| | | @Autowired |
| | | private TAppUserCarService appUserCarService; |
| | | @Autowired |
| | | private TAppUserTagService appUserTagService; |
| | | @Autowired |
| | | private TAppUserService appUserService; |
| | | @Autowired |
| | | private TAppUserAddressService appUserAddressService; |
| | | @Autowired |
| | | private TAppUserIntegralChangeService appUserIntegralChangeService; |
| | | @Autowired |
| | | private TAppUserSignService appUserSignService; |
| | | @Autowired |
| | | private TAppUserVipDetailService appUserVipDetailService; |
| | | @Autowired |
| | | private TInviteUserService inviteUserService; |
| | | @Autowired |
| | | private TInvoiceInformationService invoiceInformationService; |
| | | |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudAccountVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | GovernmentCloudAccountVO governmentCloudAccountVO = new GovernmentCloudAccountVO(); |
| | | List<TAppCoupon> list1 = tAppCouponService.lambdaQuery().between(TAppCoupon::getCreateTime, start, end).list(); |
| | | List<TAppUser> list2 = appUserService.lambdaQuery().between(TAppUser::getCreateTime, start, end).list(); |
| | | List<TAppUserAddress> list3 = appUserAddressService.lambdaQuery().between(TAppUserAddress::getCreateTime, start, end).list(); |
| | | List<TAppUserCar> list4 = appUserCarService.lambdaQuery().between(TAppUserCar::getCreateTime, start, end).list(); |
| | | List<TAppUserIntegralChange> list5 = appUserIntegralChangeService.lambdaQuery().between(TAppUserIntegralChange::getCreateTime, start, end).list(); |
| | | List<TAppUserSign> list6 = appUserSignService.lambdaQuery().between(TAppUserSign::getCreateTime, start, end).list(); |
| | | List<TAppUserTag> list7 = appUserTagService.lambdaQuery().between(TAppUserTag::getCreateTime, start, end).list(); |
| | | List<TAppUserVipDetail> list8 = appUserVipDetailService.lambdaQuery().between(TAppUserVipDetail::getCreateTime, start, end).list(); |
| | | List<TInviteUser> list9 = inviteUserService.lambdaQuery().between(TInviteUser::getCreateTime, start, end).list(); |
| | | List<TInvoiceInformation> list10 = invoiceInformationService.lambdaQuery().between(TInvoiceInformation::getCreateTime, start, end).list(); |
| | | governmentCloudAccountVO.setAppCoupons(list1); |
| | | governmentCloudAccountVO.setAppUsers(list2); |
| | | governmentCloudAccountVO.setAppUserAddresses(list3); |
| | | governmentCloudAccountVO.setAppUserCars(list4); |
| | | governmentCloudAccountVO.setAppUserIntegralChanges(list5); |
| | | governmentCloudAccountVO.setAppUserSigns(list6); |
| | | governmentCloudAccountVO.setAppUserTags(list7); |
| | | governmentCloudAccountVO.setAppUserVipDetails(list8); |
| | | governmentCloudAccountVO.setInviteUsers(list9); |
| | | governmentCloudAccountVO.setInvoiceInformations(list10); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.alipay.api.internal.util.codec.Base64; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.dto.PhoneLoginDTO; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.util.RptUtils; |
| | | import com.ruoyi.account.wx.body.resp.Code2SessionRespBody; |
| | | import com.ruoyi.account.wx.body.resq.Code2SessionResqBody; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.account.wx.pojo.AppletUserDecodeData; |
| | | import com.ruoyi.account.wx.pojo.AppletUserEncrypteData; |
| | | import com.ruoyi.account.wx.tools.WxAppletTools; |
| | | import com.ruoyi.account.wx.tools.WxUtils; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.security.SecureRandom; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | | * H5手机号登录 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-06 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/phone") |
| | | public class PhoneLoginController { |
| | | @Autowired |
| | | private TAppUserService appUserService; |
| | | |
| | | @ApiOperation(value = "H5通过手机号登录",tags = {"H5通过手机号登录"}) |
| | | @PostMapping("/phoneLogin") |
| | | public AjaxResult<Map<String, Object>> phoneLogin(@RequestBody PhoneLoginDTO dto) { |
| | | // 查询手机号是否存在与系统 |
| | | TAppUser appUser = appUserService.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone, dto.getPhoneNumber()) |
| | | .eq(TAppUser::getStatus,1) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(appUser)){ |
| | | appUser = new TAppUser(); |
| | | appUser.setPhone(dto.getPhoneNumber()); |
| | | } |
| | | if(Objects.nonNull(appUser.getStatus())){ |
| | | switch (appUser.getStatus()){ |
| | | case 1: |
| | | break; |
| | | case 2: |
| | | throw new ServiceException("账号被冻结,请联系管理员"); |
| | | case 3: |
| | | appUser = new TAppUser(); |
| | | appUser.setPhone(dto.getPhoneNumber()); |
| | | break; |
| | | } |
| | | } |
| | | appUser.setAvatar(org.springframework.util.StringUtils.hasLength(appUser.getAvatar())?appUser.getAvatar():"http://221.182.45.100:8090/2024-10-26/logo.png"); |
| | | appUser.setName(StringUtils.hasLength(appUser.getName())?appUser.getName(): RptUtils.around(dto.getPhoneNumber(),3,4)); |
| | | appUserService.saveOrUpdate(appUser); |
| | | return AjaxResult.success(appUserService.getUserInfo(appUser)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.vo.GovernmentCloudChargingPileVO; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/governmentCloudChargingPile") |
| | | public class GovernmentCloudChargingPileController { |
| | | @Autowired |
| | | private IPartnerService partnerService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | @Autowired |
| | | private TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | @Autowired |
| | | private TAccountingStrategyService accountingStrategyService; |
| | | @Autowired |
| | | private TApplyChargingPileService applyChargingPileService; |
| | | @Autowired |
| | | private TCarportService carportService; |
| | | @Autowired |
| | | private TChargingGunService chargingGunService; |
| | | @Autowired |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | @Autowired |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private TFaultMessageService faultMessageService; |
| | | @Autowired |
| | | private TMonitoringEquipmentService monitoringEquipmentService; |
| | | @Autowired |
| | | private TParkingLotService parkingLotService; |
| | | @Autowired |
| | | private TParkingRecordService parkingRecordService; |
| | | @Autowired |
| | | private TPartnerSiteService partnerSiteService; |
| | | @Autowired |
| | | private TRepairService repairService; |
| | | @Autowired |
| | | private TSiteMenuService siteMenuService; |
| | | @Autowired |
| | | private TVehicleRampService vehicleRampService; |
| | | |
| | | |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudChargingPileVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | GovernmentCloudChargingPileVO governmentCloudAccountVO = new GovernmentCloudChargingPileVO(); |
| | | List<Partner> list1 = partnerService.lambdaQuery().between(Partner::getCreateTime, start, end).list(); |
| | | List<Site> list2 = siteService.lambdaQuery().between(Site::getCreateTime, start, end).list(); |
| | | List<TAccountingStrategyDetail> list3 = accountingStrategyDetailService.lambdaQuery().between(TAccountingStrategyDetail::getCreateTime, start, end).list(); |
| | | List<TAccountingStrategy> list4 = accountingStrategyService.lambdaQuery().between(TAccountingStrategy::getCreateTime, start, end).list(); |
| | | List<TApplyChargingPile> list5 = applyChargingPileService.lambdaQuery().between(TApplyChargingPile::getCreateTime, start, end).list(); |
| | | List<TCarport> list6 = carportService.lambdaQuery().between(TCarport::getCreateTime, start, end).list(); |
| | | List<TChargingGun> list7 = chargingGunService.lambdaQuery().between(TChargingGun::getCreateTime, start, end).list(); |
| | | List<TChargingPile> list8 = chargingPileService.lambdaQuery().between(TChargingPile::getCreateTime, start, end).list(); |
| | | List<TChargingPileNotification> list9 = chargingPileNotificationService.lambdaQuery().between(TChargingPileNotification::getCreateTime, start, end).list(); |
| | | List<TFaultMessage> list10 = faultMessageService.lambdaQuery().between(TFaultMessage::getCreateTime, start, end).list(); |
| | | List<TMonitoringEquipment> list11 = monitoringEquipmentService.lambdaQuery().between(TMonitoringEquipment::getCreateTime, start, end).list(); |
| | | List<TParkingLot> list12 = parkingLotService.lambdaQuery().between(TParkingLot::getCreateTime, start, end).list(); |
| | | List<TParkingRecord> list13 = parkingRecordService.lambdaQuery().between(TParkingRecord::getCreateTime, start, end).list(); |
| | | // List<TPartnerSite> list14 = invoiceInformationService.lambdaQuery().between(TPartnerSite::getCreateTime, start, end).list(); |
| | | List<TRepair> list15 = repairService.lambdaQuery().between(TRepair::getCreateTime, start, end).list(); |
| | | List<TVehicleRamp> list16 = vehicleRampService.lambdaQuery().between(TVehicleRamp::getCreateTime, start, end).list(); |
| | | // List<TSiteMenu> list17 = siteMenuService.lambdaQuery().between(TSiteMenu::getCreateTime, start, end).list(); |
| | | |
| | | governmentCloudAccountVO.setPartners(list1); |
| | | governmentCloudAccountVO.setSites(list2); |
| | | governmentCloudAccountVO.setAccountingStrategies(list4); |
| | | governmentCloudAccountVO.setAccountingStrategyDetails(list3); |
| | | governmentCloudAccountVO.setApplyChargingPiles(list5); |
| | | governmentCloudAccountVO.setCarports(list6); |
| | | governmentCloudAccountVO.setChargingGuns(list7); |
| | | governmentCloudAccountVO.setChargingPiles(list8); |
| | | governmentCloudAccountVO.setChargingPileNotifications(list9); |
| | | governmentCloudAccountVO.setFaultMessages(list10); |
| | | governmentCloudAccountVO.setMonitoringEquipments(list11); |
| | | governmentCloudAccountVO.setParkingLots(list12); |
| | | governmentCloudAccountVO.setParkingRecords(list13); |
| | | // governmentCloudAccountVO.setPartnerSites(list14); |
| | | governmentCloudAccountVO.setRepairs(list15); |
| | | governmentCloudAccountVO.setVehicleRamps(list16); |
| | | // governmentCloudAccountVO.setSiteMenus(list17); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; |
| | | import com.ruoyi.chargingPile.api.vo.GunStatusStatisticsVO; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.api.vo.*; |
| | | import com.ruoyi.chargingPile.config.FileUploadConfig; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).eq(TChargingGun::getFullNumber, fullNumber)); |
| | | return R.ok(chargingGun); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据枪唯一码查询信息 |
| | | * @return |
| | | */ |
| | | @ApiOperation(tags = {"大屏-对外开放区车位使用情况"},value = "对外开放区车位使用情况") |
| | | @GetMapping("/getLargeScreenGun") |
| | | public R<LargeScreenGunVo> getLargeScreenGun(){ |
| | | LargeScreenGunVo largeScreenGunVo = new LargeScreenGunVo(); |
| | | List<TChargingGun> tChargingGuns = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).in(TChargingGun::getSiteId,26).in(TChargingGun::getChargeMode, 1,2,4)); |
| | | if(tChargingGuns.isEmpty()){ |
| | | return R.ok(largeScreenGunVo); |
| | | } |
| | | List<TChargingGun> supperFast = tChargingGuns.stream().filter(e -> e.getChargeMode() == 1).collect(Collectors.toList()); |
| | | largeScreenGunVo.setSuperFast(supperFast.size()); |
| | | int supperFastSize = supperFast.stream().filter(e -> e.getStatus() != 2).collect(Collectors.toList()).size(); |
| | | largeScreenGunVo.setUseSuperFast(supperFastSize); |
| | | List<TChargingGun> fast = tChargingGuns.stream().filter(e -> e.getChargeMode() == 2).collect(Collectors.toList()); |
| | | largeScreenGunVo.setFast(fast.size()); |
| | | int fastSize = fast.stream().filter(e -> e.getStatus() != 2).collect(Collectors.toList()).size(); |
| | | largeScreenGunVo.setUseFast(fastSize); |
| | | List<TChargingGun> v2g = tChargingGuns.stream().filter(e -> e.getChargeMode() == 4).collect(Collectors.toList()); |
| | | largeScreenGunVo.setV2g(v2g.size()); |
| | | int v2gSize = v2g.stream().filter(e -> e.getStatus() != 2).collect(Collectors.toList()).size(); |
| | | largeScreenGunVo.setUseV2g(v2gSize); |
| | | |
| | | return R.ok(largeScreenGunVo); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 大屏 根据站点ids和充电模式集合查询充电枪集合 没有过滤del_flag |
| | | */ |
| | | @GetMapping("/getGunIdsBySiteIdsAndChargeModels") |
| | | public R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(@RequestParam("siteIds") List<Integer> siteIds ,@RequestParam("chargeModels") List<Integer> chargeModels){ |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>() |
| | | .select(TChargingGun::getId).in(TChargingGun::getSiteId, siteIds) |
| | | .in(TChargingGun::getChargeMode, chargeModels)); |
| | | return R.ok(list.stream().map(TChargingGun::getId).collect(Collectors.toList())); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-chargingPile</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- mqtt --> |
| | | <dependency> |
| | | <groupId>org.springframework.integration</groupId> |
| | | <artifactId>spring-integration-stream</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.integration</groupId> |
| | | <artifactId>spring-integration-mqtt</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-integration</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
New file |
| | |
| | | package com.ruoyi.jianguan.constant; |
| | | |
| | | public class IotConstant { |
| | | public static final int SUCCESS = 1; |
| | | public static final int FAIL = 0; |
| | | /** |
| | | * 华为云iot token |
| | | */ |
| | | public static final String IOT_TOKEN = "iot_token"; |
| | | /** |
| | | * 模式 |
| | | */ |
| | | public static final String PASSWORD = "password"; |
| | | /** |
| | | * URL |
| | | */ |
| | | public static final String URL = "https://94cb3eb5f9.st1.iotda-app.cn-south-1.myhuaweicloud.com"; |
| | | /** |
| | | * 创建产品 |
| | | */ |
| | | public static final String CREATE_PRODUCT = URL+"/v5/iot/{project_id}/products"; |
| | | /** |
| | | * 创建产品 |
| | | */ |
| | | public static final String DELETE_PRODUCT = URL+"/v5/iot/{project_id}/products/{product_id}"; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.controller; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.ruoyi.chargingPile.api.vo.LargeScreenGunVo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.jianguan.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.jianguan.vo.LargeChargingPowerVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Api(tags = "大屏") |
| | | @RestController |
| | | @RequestMapping("/large-screen") |
| | | public class LargeScreenController { |
| | | |
| | | private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | private final UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | public LargeScreenController(UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService) { |
| | | this.uploadRealTimeMonitoringDataService = uploadRealTimeMonitoringDataService; |
| | | } |
| | | |
| | | |
| | | @SneakyThrows |
| | | @ApiOperation(tags = {"大屏-停车场充电功率曲线图"},value = "停车场充电功率曲线图") |
| | | @GetMapping("/getChargingPower") |
| | | public R<List<LargeChargingPowerVo>> getChargingPower(){ |
| | | String sevenDayAgo = LocalDate.now().minusDays(7) + " 00:00:00"; |
| | | String oneDayAgo = LocalDate.now().minusDays(1) + " 23:59:59"; |
| | | Date oneDayAgoTime = format.parse(oneDayAgo); |
| | | Date sevenDayAgoTime = format.parse(sevenDayAgo); |
| | | ArrayList<LargeChargingPowerVo> largeChargingPowerVos = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<UploadRealTimeMonitoringData> rangeTimeData = uploadRealTimeMonitoringDataService.getRangeTimeData(sevenDayAgoTime,oneDayAgoTime ); |
| | | for (int count = 7; count > 0; count--) { |
| | | LargeChargingPowerVo largeChargingPowerVo = new LargeChargingPowerVo(); |
| | | String time = LocalDate.now().minusDays(count).toString(); |
| | | |
| | | List<UploadRealTimeMonitoringData> list = rangeTimeData.stream().filter(e -> simpleDateFormat.format(e.getCreate_time()).contains(time)).collect(Collectors.toList()); |
| | | if(!list.isEmpty()){ |
| | | System.out.println(list); |
| | | BigDecimal powerAverage = list.stream().map(UploadRealTimeMonitoringData::getPower).reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(list.size()), 0, RoundingMode.HALF_UP); |
| | | largeChargingPowerVo.setPower(powerAverage); |
| | | } |
| | | largeChargingPowerVo.setTime(time); |
| | | largeChargingPowerVos.add(largeChargingPowerVo); |
| | | } |
| | | |
| | | return R.ok(largeChargingPowerVos); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.governmentCloud; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.jianguan.mongodb.service.*; |
| | | import com.ruoyi.jianguan.mqtt.config.TopicConstants; |
| | | import com.ruoyi.jianguan.mqtt.util.MqttPushUtil; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | import io.netty.util.concurrent.DefaultThreadFactory; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.*; |
| | | |
| | | /** |
| | | * 定时上传政务云数据 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class UploadDataTaskUtil { |
| | | |
| | | @Autowired |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | @Autowired |
| | | private MqttPushUtil mqttPushUtil; |
| | | |
| | | /** |
| | | * 每天的9点执行的任务 |
| | | */ |
| | | @Scheduled(cron = "0 0 9 * * *") |
| | | // @Scheduled(fixedRate = 60000) |
| | | public void taskDay(){ |
| | | try { |
| | | // 传输mongodb的硬件数据 |
| | | createCustomThreadPool(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建自定义线程池 |
| | | * 特点: |
| | | * 1. 支持定时及周期性任务 |
| | | * 2. 核心线程数固定,但可以不断创建新线程执行后续任务 |
| | | * 3. 适用于需要定时执行或周期性执行的场景 |
| | | */ |
| | | @SneakyThrows |
| | | public void createCustomThreadPool() { |
| | | /* |
| | | 创建自定义线程池 |
| | | 字段: |
| | | 1. corePoolSize:核心线程池数量 |
| | | 2. maximumPoolSize: 最大线程池数量 |
| | | 3. keepAliveTime: 线程空闲时间 |
| | | 4. unit: 时间单位 |
| | | 5. workQueue: 阻塞队列 |
| | | 5. threadFactory: 线程工厂 |
| | | 5. handler: 拒绝策略 |
| | | */ |
| | | ThreadPoolExecutor customthreadPoolExecutor = new ThreadPoolExecutor( |
| | | 5, // 根据CPU核心数设置 |
| | | 10, // 最大应急线程数 |
| | | 30, TimeUnit.SECONDS, // 空闲线程存活时间 |
| | | new ArrayBlockingQueue<>(100), // 有界队列防止内存溢出 |
| | | new DefaultThreadFactory("custom-thread-pool"), // 自定义线程命名 |
| | | new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略 |
| | | ); |
| | | |
| | | try { |
| | | LocalDate localDate = LocalDate.now().minusDays(1); |
| | | String start = localDate + " 00:00:00"; |
| | | String end = localDate + " 23:59:59"; |
| | | Date startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(start); |
| | | Date endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end); |
| | | // 查询所有的mango数据 |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringDataList = uploadRealTimeMonitoringDataService.getRangeTimeData(startTime, endTime); |
| | | customthreadPoolExecutor.execute(() -> { |
| | | if (uploadRealTimeMonitoringDataList != null && uploadRealTimeMonitoringDataList.size() > 0) { |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : uploadRealTimeMonitoringDataList) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("device_code", uploadRealTimeMonitoringData.getCharging_pile_code()); |
| | | jsonObject.put("report_time", System.currentTimeMillis()); |
| | | jsonObject.put("properties", uploadRealTimeMonitoringData); |
| | | mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", uploadRealTimeMonitoringData.getCharging_pile_code()), jsonObject.toJSONString()); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | TimeUnit.MILLISECONDS.sleep(1); |
| | | |
| | | // Future<String> future = customthreadPoolExecutor.submit(() -> { |
| | | // log.info("线程:{},办理业务", Thread.currentThread().getName()); |
| | | // return "业务办理完成"; |
| | | // }); |
| | | // log.info(future.get()); |
| | | } finally { |
| | | gracefulShutdown(customthreadPoolExecutor); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 优雅关闭线程池通用方法 |
| | | * |
| | | * @param pool 需要关闭的线程池 |
| | | */ |
| | | private static void gracefulShutdown(ExecutorService pool) { |
| | | pool.shutdown(); // 拒绝新任务提交 |
| | | try { |
| | | // 等待现有任务完成 |
| | | if (!pool.awaitTermination(60, TimeUnit.SECONDS)) { |
| | | pool.shutdownNow(); // 取消等待中的任务 只等待运行中的任务 |
| | | // 再次等待任务响应中断 |
| | | if (!pool.awaitTermination(60, TimeUnit.SECONDS)) { |
| | | log.error("线程池未完全关闭"); |
| | | } |
| | | } |
| | | } catch (InterruptedException e) { |
| | | // 重新尝试关闭 |
| | | pool.shutdownNow(); |
| | | Thread.currentThread().interrupt(); |
| | | } finally { |
| | | log.info("线程池是否执行完成:{}", pool.isTerminated()); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.err.println(System.currentTimeMillis()); |
| | | } |
| | | |
| | | } |
| | |
| | | @NotNull |
| | | @JsonProperty("Status") |
| | | private Integer status; |
| | | /** |
| | | * 状态 |
| | | * 0:成功 |
| | | * 1:失败 |
| | | */ |
| | | @NotNull |
| | | @JsonProperty("SuccStat") |
| | | private Integer SuccStat; |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.base; |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BaseService<T> { |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param t 实体类 |
| | | * @return 添加结果 1=成功 0=失败 |
| | | */ |
| | | int create(T t); |
| | | |
| | | /** |
| | | * 根据id查询 |
| | | * @param id 实体id |
| | | * @return 实体对象 |
| | | */ |
| | | T findById(String id); |
| | | |
| | | /** |
| | | * 查询列表 |
| | | * @return 实体列表 |
| | | */ |
| | | List<T> findAll(); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface AcquisitionBillingModeReplyService extends BaseService<AcquisitionBillingModeReply> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<AcquisitionBillingModeReply> getRangeTimeData(Date startTime, Date endTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface AcquisitionBillingModeService extends BaseService<AcquisitionBillingMode> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<AcquisitionBillingMode> getRangeTimeData(Date startTime, Date endTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BillingModeVerifyReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface BillingModeVerifyReplyService extends BaseService<BillingModeVerifyReply> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<BillingModeVerifyReply> getRangeTimeData(Date startTime, Date endTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.api.model.BillingModeVerifyReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface BillingModeVerifyService extends BaseService<BillingModeVerify> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<BillingModeVerify> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface BmsAbortService extends BaseService<BmsAbort> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<BmsAbort> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface BmsDemandAndChargerExportationService extends BaseService<BmsDemandAndChargerExportation> { |
| | | |
| | | |
| | | /** |
| | | * 获取bms数据 |
| | | * @param orderCode |
| | | * @return |
| | | */ |
| | | List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode); |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<BmsDemandAndChargerExportation> getRangeTimeData(Date startTime, Date endTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.integration.api.model.BmsInformation; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface BmsInformationService extends BaseService<BmsInformation> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<BmsInformation> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsInformation; |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface ChargingHandshakeService extends BaseService<ChargingHandshake> { |
| | | |
| | | |
| | | ChargingHandshake getDataByOrderCode(String code); |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<ChargingHandshake> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.api.model.ChargingPileReturnsGroundLockData; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface ChargingPileReturnsGroundLockDataService extends BaseService<ChargingPileReturnsGroundLockData> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<ChargingPileReturnsGroundLockData> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingPileReturnsGroundLockData; |
| | | import com.ruoyi.integration.api.model.ChargingPileStartsCharging; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface ChargingPileStartsChargingService extends BaseService<ChargingPileStartsCharging> { |
| | | |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<ChargingPileStartsCharging> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingPileStartsCharging; |
| | | import com.ruoyi.integration.api.model.ClearOfflineCardReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface ClearOfflineCardReplyService extends BaseService<ClearOfflineCardReply> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<ClearOfflineCardReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ClearOfflineCard; |
| | | import com.ruoyi.integration.api.model.ClearOfflineCardReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface ClearOfflineCardService extends BaseService<ClearOfflineCard> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<ClearOfflineCard> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ClearOfflineCard; |
| | | import com.ruoyi.integration.api.model.ConfirmTransactionRecord; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface ConfirmTransactionRecordService extends BaseService<ConfirmTransactionRecord> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<ConfirmTransactionRecord> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ConfirmTransactionRecord; |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface EndChargeService extends BaseService<EndCharge> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<EndCharge> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface ErrorMessageMessageService extends BaseService<ErrorMessageMessage> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<ErrorMessageMessage> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface GroundLockRealTimeDataService extends BaseService<GroundLockRealTimeData> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<GroundLockRealTimeData> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.integration.api.model.MotorAbort; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface MotorAbortService extends BaseService<MotorAbort> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<MotorAbort> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.MotorAbort; |
| | | import com.ruoyi.integration.api.model.OnlineReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | /** |
| | | * 登录认证应答接口 |
| | | */ |
| | | public interface OnlineReplyService extends BaseService<OnlineReply> { |
| | | |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<OnlineReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.OnlineReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | /** |
| | | * 充电桩登录认证接口 |
| | | */ |
| | | public interface OnlineService extends BaseService<Online> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<Online> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.OpenOrCloseGroundLock; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface OpenOrCloseGroundLockService extends BaseService<OpenOrCloseGroundLock> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<OpenOrCloseGroundLock> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.OpenOrCloseGroundLock; |
| | | import com.ruoyi.integration.api.model.ParameterSetting; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface ParameterSettingService extends BaseService<ParameterSetting> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<ParameterSetting> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.Ping; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | public interface PingService extends BaseService<Ping> { |
| | | |
| | | /** |
| | | * 定时删除数据 |
| | | */ |
| | | void delPing(); |
| | | |
| | | |
| | | /** |
| | | * 保存数据 |
| | | * @param ping |
| | | */ |
| | | void save(Ping ping); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.OnlineReply; |
| | | import com.ruoyi.integration.api.model.PlatformConfirmationCharging; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface PlatformConfirmationChargingService extends BaseService<PlatformConfirmationCharging> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<PlatformConfirmationCharging> getRangeTimeData(Date startTime, Date endTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformConfirmationCharging; |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdateReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface PlatformRemoteUpdateReplyService extends BaseService<PlatformRemoteUpdateReply> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<PlatformRemoteUpdateReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdate; |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdateReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface PlatformRemoteUpdateService extends BaseService<PlatformRemoteUpdate> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<PlatformRemoteUpdate> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdate; |
| | | import com.ruoyi.integration.api.model.PlatformRestartReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface PlatformRestartReplyService extends BaseService<PlatformRestartReply> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<PlatformRestartReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformRestart; |
| | | import com.ruoyi.integration.api.model.PlatformRestartReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface PlatformRestartService extends BaseService<PlatformRestart> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<PlatformRestart> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformRestart; |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface PlatformStartChargingReplyService extends BaseService<PlatformStartChargingReply> { |
| | | |
| | | /** |
| | | * 根据订单编号查询远程启机应答数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<PlatformStartChargingReply> getPlatformStartChargingReply(String code); |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<PlatformStartChargingReply> getRangeTimeData(Date startTime, Date endTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface PlatformStartChargingService extends BaseService<PlatformStartCharging> { |
| | | |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<PlatformStartCharging> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface PlatformStopChargingReplyService extends BaseService<PlatformStopChargingReply> { |
| | | |
| | | /** |
| | | * 根据枪编号获取停机应答 |
| | | * @return |
| | | */ |
| | | PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query); |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<PlatformStopChargingReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface PlatformStopChargingService extends BaseService<PlatformStopCharging> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<PlatformStopCharging> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.Pong; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | /** |
| | | * 心跳包应答接口 |
| | | */ |
| | | public interface PongService extends BaseService<Pong> { |
| | | |
| | | void delPong(); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.QrCodeDeliveryReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | /** |
| | | */ |
| | | public interface QrCodeDeliveryReplyService extends BaseService<QrCodeDeliveryReply> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<QrCodeDeliveryReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.QrCodeDeliveryReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | /** |
| | | */ |
| | | public interface QrCodeDeliveryService extends BaseService<QrCodeDelivery> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<QrCodeDelivery> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.QueryOfflineCardReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface QueryOfflineCardReplyService extends BaseService<QueryOfflineCardReply> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<QueryOfflineCardReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.QueryOfflineCard; |
| | | import com.ruoyi.integration.api.model.QueryOfflineCardReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface QueryOfflineCardService extends BaseService<QueryOfflineCard> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<QueryOfflineCard> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.QueryOfflineCard; |
| | | import com.ruoyi.integration.api.model.ReadRealTimeMonitoringData; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface ReadRealTimeMonitoringDataService extends BaseService<ReadRealTimeMonitoringData> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<ReadRealTimeMonitoringData> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ReadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | /** |
| | | */ |
| | | public interface SecurityDetectionService extends BaseService<SecurityDetection> { |
| | | |
| | | |
| | | /** |
| | | * 根据业务流水号查询数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | SecurityDetection getSecurityDetection(String transactionSerialNumber); |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<SecurityDetection> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.integration.api.model.SetupBillingModelReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface SetupBillingModelReplyService extends BaseService<SetupBillingModelReply> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<SetupBillingModelReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SetupBillingModel; |
| | | import com.ruoyi.integration.api.model.SetupBillingModelReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface SetupBillingModelService extends BaseService<SetupBillingModel> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<SetupBillingModel> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SetupBillingModel; |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCardReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface SynchronizeOfflineCardReplyService extends BaseService<SynchronizeOfflineCardReply> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<SynchronizeOfflineCardReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCard; |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCardReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface SynchronizeOfflineCardService extends BaseService<SynchronizeOfflineCard> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<SynchronizeOfflineCard> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCard; |
| | | import com.ruoyi.integration.api.model.TimingSettingReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface TimingSettingReplyService extends BaseService<TimingSettingReply> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<TimingSettingReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.TimingSetting; |
| | | import com.ruoyi.integration.api.model.TimingSettingReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface TimingSettingService extends BaseService<TimingSetting> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<TimingSetting> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.TimingSetting; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface TransactionRecordService extends BaseService<TransactionRecord> { |
| | | |
| | | /** |
| | | * 根据订单流水号查询数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | TransactionRecord findOne(String code); |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<TransactionRecord> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.integration.api.model.UpdateBalanceReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface UpdateBalanceReplyService extends BaseService<UpdateBalanceReply> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<UpdateBalanceReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.UpdateBalance; |
| | | import com.ruoyi.integration.api.model.UpdateBalanceReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface UpdateBalanceService extends BaseService<UpdateBalance> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<UpdateBalance> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import com.ruoyi.integration.api.model.UpdateBalance; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface UploadRealTimeMonitoringDataService extends BaseService<UploadRealTimeMonitoringData> { |
| | | |
| | | /** |
| | | * 根据订单号查询监控数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<UploadRealTimeMonitoringData> getDataByOrderCode(String code); |
| | | UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException; |
| | | |
| | | /** |
| | | * 查询订单最新一条数据 |
| | | * @param transaction_serial_number |
| | | * @return |
| | | */ |
| | | UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number); |
| | | |
| | | void delete(String id); |
| | | |
| | | void updateById(String id); |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<UploadRealTimeMonitoringData> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.WorkingParameterSettingReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface WorkingParameterSettingReplyService extends BaseService<WorkingParameterSettingReply> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<WorkingParameterSettingReply> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.WorkingParameterSetting; |
| | | import com.ruoyi.integration.api.model.WorkingParameterSettingReply; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | public interface WorkingParameterSettingService extends BaseService<WorkingParameterSetting> { |
| | | /** |
| | | * 获取前一日的所有数据数据 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | List<WorkingParameterSetting> getRangeTimeData(Date startTime, Date endTime); |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.AcquisitionBillingModeReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List;import java.util.Date; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class AcquisitionBillingModeReplyServiceImpl implements AcquisitionBillingModeReplyService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(AcquisitionBillingModeReply acquisitionBillingModeReply) { |
| | | mongoTemplate.save(acquisitionBillingModeReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public AcquisitionBillingModeReply findById(String id) { |
| | | return mongoTemplate.findById(id, AcquisitionBillingModeReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<AcquisitionBillingModeReply> findAll() { |
| | | return mongoTemplate.findAll(AcquisitionBillingModeReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<AcquisitionBillingModeReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<AcquisitionBillingModeReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , AcquisitionBillingModeReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.AcquisitionBillingModeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class AcquisitionBillingModeServiceImpl implements AcquisitionBillingModeService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(AcquisitionBillingMode acquisitionBillingMode) { |
| | | mongoTemplate.save(acquisitionBillingMode); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public AcquisitionBillingMode findById(String id) { |
| | | return mongoTemplate.findById(id, AcquisitionBillingMode.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<AcquisitionBillingMode> findAll() { |
| | | return mongoTemplate.findAll(AcquisitionBillingMode.class); |
| | | } |
| | | @Override |
| | | public List<AcquisitionBillingMode> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<AcquisitionBillingMode> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , AcquisitionBillingMode.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.api.model.BillingModeVerifyReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.BillingModeVerifyReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class BillingModeVerifyReplyServiceImpl implements BillingModeVerifyReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(BillingModeVerifyReply billingModeVerifyReply) { |
| | | mongoTemplate.save(billingModeVerifyReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BillingModeVerifyReply findById(String id) { |
| | | return mongoTemplate.findById(id, BillingModeVerifyReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BillingModeVerifyReply> findAll() { |
| | | return mongoTemplate.findAll(BillingModeVerifyReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BillingModeVerifyReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<BillingModeVerifyReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , BillingModeVerifyReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.api.model.BillingModeVerifyReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.BillingModeVerifyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class BillingModeVerifyServiceImpl implements BillingModeVerifyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BillingModeVerify billingModeVerify) { |
| | | mongoTemplate.save(billingModeVerify); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BillingModeVerify findById(String id) { |
| | | return mongoTemplate.findById(id, BillingModeVerify.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BillingModeVerify> findAll() { |
| | | return mongoTemplate.findAll(BillingModeVerify.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BillingModeVerify> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<BillingModeVerify> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , BillingModeVerify.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.BmsAbortService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class BmsAbortServiceImpl implements BmsAbortService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BmsAbort bmsAbort) { |
| | | mongoTemplate.save(bmsAbort); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BmsAbort findById(String id) { |
| | | return mongoTemplate.findById(id, BmsAbort.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsAbort> findAll() { |
| | | return mongoTemplate.findAll(BmsAbort.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsAbort> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<BmsAbort> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , BmsAbort.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.BmsDemandAndChargerExportationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class BmsDemandAndChargerExportationServiceImpl implements BmsDemandAndChargerExportationService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BmsDemandAndChargerExportation bmsDemandAndChargerExportation) { |
| | | mongoTemplate.save(bmsDemandAndChargerExportation); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BmsDemandAndChargerExportation findById(String id) { |
| | | return mongoTemplate.findById(id, BmsDemandAndChargerExportation.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsDemandAndChargerExportation> findAll() { |
| | | return mongoTemplate.findAll(BmsDemandAndChargerExportation.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(orderCode)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(orderCode)); |
| | | } |
| | | List<BmsDemandAndChargerExportation> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , BmsDemandAndChargerExportation.class); |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsDemandAndChargerExportation> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<BmsDemandAndChargerExportation> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , BmsDemandAndChargerExportation.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.api.model.BmsInformation; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.BmsInformationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class BmsInformationServiceImpl implements BmsInformationService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BmsInformation bmsInformation) { |
| | | mongoTemplate.save(bmsInformation); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BmsInformation findById(String id) { |
| | | return mongoTemplate.findById(id, BmsInformation.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsInformation> findAll() { |
| | | return mongoTemplate.findAll(BmsInformation.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsInformation> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<BmsInformation> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , BmsInformation.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.BmsInformation; |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ChargingHandshakeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class ChargingHandshakeServiceImpl implements ChargingHandshakeService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ChargingHandshake chargingHandshake) { |
| | | mongoTemplate.save(chargingHandshake); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingHandshake findById(String id) { |
| | | return mongoTemplate.findById(id, ChargingHandshake.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingHandshake> findAll() { |
| | | return mongoTemplate.findAll(ChargingHandshake.class); |
| | | } |
| | | |
| | | @Override |
| | | public ChargingHandshake getDataByOrderCode(String code) { |
| | | List<ChargingHandshake> charging_gun_code = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number").is(code)), ChargingHandshake.class); |
| | | return charging_gun_code.size() > 0 ? charging_gun_code.get(0) : null; |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingHandshake> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<ChargingHandshake> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , ChargingHandshake.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.api.model.ChargingPileReturnsGroundLockData; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ChargingPileReturnsGroundLockDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class ChargingPileReturnsGroundLockDataServiceImpl implements ChargingPileReturnsGroundLockDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ChargingPileReturnsGroundLockData chargingPileReturnsGroundLockData) { |
| | | mongoTemplate.save(chargingPileReturnsGroundLockData); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingPileReturnsGroundLockData findById(String id) { |
| | | return mongoTemplate.findById(id, ChargingPileReturnsGroundLockData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingPileReturnsGroundLockData> findAll() { |
| | | return mongoTemplate.findAll(ChargingPileReturnsGroundLockData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingPileReturnsGroundLockData> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<ChargingPileReturnsGroundLockData> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , ChargingPileReturnsGroundLockData.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.ChargingPileReturnsGroundLockData; |
| | | import com.ruoyi.integration.api.model.ChargingPileStartsCharging; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ChargingPileStartsChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class ChargingPileStartsChargingServiceImpl implements ChargingPileStartsChargingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ChargingPileStartsCharging chargingPileStartsCharging) { |
| | | mongoTemplate.save(chargingPileStartsCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingPileStartsCharging findById(String id) { |
| | | return mongoTemplate.findById(id, ChargingPileStartsCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingPileStartsCharging> findAll() { |
| | | return mongoTemplate.findAll(ChargingPileStartsCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingPileStartsCharging> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<ChargingPileStartsCharging> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , ChargingPileStartsCharging.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.ChargingPileStartsCharging; |
| | | import com.ruoyi.integration.api.model.ClearOfflineCardReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ClearOfflineCardReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class ClearOfflineCardReplyServiceImpl implements ClearOfflineCardReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ClearOfflineCardReply clearOfflineCardReply) { |
| | | mongoTemplate.save(clearOfflineCardReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ClearOfflineCardReply findById(String id) { |
| | | return mongoTemplate.findById(id, ClearOfflineCardReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClearOfflineCardReply> findAll() { |
| | | return mongoTemplate.findAll(ClearOfflineCardReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClearOfflineCardReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<ClearOfflineCardReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , ClearOfflineCardReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.ClearOfflineCard; |
| | | import com.ruoyi.integration.api.model.ClearOfflineCardReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ClearOfflineCardService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class ClearOfflineCardServiceImpl implements ClearOfflineCardService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ClearOfflineCard clearOfflineCard) { |
| | | mongoTemplate.save(clearOfflineCard); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ClearOfflineCard findById(String id) { |
| | | return mongoTemplate.findById(id, ClearOfflineCard.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClearOfflineCard> findAll() { |
| | | return mongoTemplate.findAll(ClearOfflineCard.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClearOfflineCard> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<ClearOfflineCard> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , ClearOfflineCard.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.ClearOfflineCard; |
| | | import com.ruoyi.integration.api.model.ConfirmTransactionRecord; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ConfirmTransactionRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class ConfirmTransactionRecordServiceImpl implements ConfirmTransactionRecordService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(ConfirmTransactionRecord confirmTransactionRecord) { |
| | | mongoTemplate.save(confirmTransactionRecord); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ConfirmTransactionRecord findById(String id) { |
| | | return mongoTemplate.findById(id, ConfirmTransactionRecord.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ConfirmTransactionRecord> findAll() { |
| | | return mongoTemplate.findAll(ConfirmTransactionRecord.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ConfirmTransactionRecord> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<ConfirmTransactionRecord> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , ConfirmTransactionRecord.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.ConfirmTransactionRecord; |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.EndChargeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | @Service |
| | | public class EndChargeServiceImpl implements EndChargeService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(EndCharge endCharge) { |
| | | mongoTemplate.save(endCharge); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public EndCharge findById(String id) { |
| | | return mongoTemplate.findById(id, EndCharge.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<EndCharge> findAll() { |
| | | return mongoTemplate.findAll(EndCharge.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<EndCharge> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<EndCharge> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , EndCharge.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ErrorMessageMessageService; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | @Service |
| | | public class ErrorMessageMessageServiceImpl implements ErrorMessageMessageService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(ErrorMessageMessage errorMessageMessage) { |
| | | mongoTemplate.save(errorMessageMessage); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ErrorMessageMessage findById(String id) { |
| | | return mongoTemplate.findById(id, ErrorMessageMessage.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ErrorMessageMessage> findAll() { |
| | | return mongoTemplate.findAll(ErrorMessageMessage.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ErrorMessageMessage> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<ErrorMessageMessage> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , ErrorMessageMessage.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.GroundLockRealTimeDataService; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class GroundLockRealTimeDataServiceImpl implements GroundLockRealTimeDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(GroundLockRealTimeData groundLockRealTimeData) { |
| | | mongoTemplate.save(groundLockRealTimeData); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public GroundLockRealTimeData findById(String id) { |
| | | return mongoTemplate.findById(id, GroundLockRealTimeData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<GroundLockRealTimeData> findAll() { |
| | | return mongoTemplate.findAll(GroundLockRealTimeData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<GroundLockRealTimeData> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<GroundLockRealTimeData> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , GroundLockRealTimeData.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.integration.api.model.MotorAbort; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.MotorAbortService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class MotorAbortServiceImpl implements MotorAbortService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(MotorAbort motorAbort) { |
| | | mongoTemplate.save(motorAbort); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public MotorAbort findById(String id) { |
| | | return mongoTemplate.findById(id, MotorAbort.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<MotorAbort> findAll() { |
| | | return mongoTemplate.findAll(MotorAbort.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<MotorAbort> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<MotorAbort> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , MotorAbort.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.MotorAbort; |
| | | import com.ruoyi.integration.api.model.OnlineReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.OnlineReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * 登录认证应答实现类 |
| | | **/ |
| | | @Service |
| | | public class OnlineReplyServiceImpl implements OnlineReplyService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(OnlineReply onlineReply) { |
| | | mongoTemplate.save(onlineReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public OnlineReply findById(String id) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<OnlineReply> findAll() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<OnlineReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<OnlineReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , OnlineReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.OnlineReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.OnlineService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * 充电桩登录认证实现类 |
| | | **/ |
| | | @Service |
| | | public class OnlineServiceImpl implements OnlineService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(Online online) { |
| | | mongoTemplate.save(online); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public Online findById(String id) { |
| | | return mongoTemplate.findById(id, Online.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Online> findAll() { |
| | | return mongoTemplate.findAll(Online.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Online> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<Online> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , Online.class); |
| | | return list; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.OpenOrCloseGroundLock; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.OpenOrCloseGroundLockService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class OpenOrCloseGroundLockServiceImpl implements OpenOrCloseGroundLockService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(OpenOrCloseGroundLock openOrCloseGroundLock) { |
| | | mongoTemplate.save(openOrCloseGroundLock); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public OpenOrCloseGroundLock findById(String id) { |
| | | return mongoTemplate.findById(id, OpenOrCloseGroundLock.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<OpenOrCloseGroundLock> findAll() { |
| | | return mongoTemplate.findAll(OpenOrCloseGroundLock.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<OpenOrCloseGroundLock> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<OpenOrCloseGroundLock> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , OpenOrCloseGroundLock.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.OpenOrCloseGroundLock; |
| | | import com.ruoyi.integration.api.model.ParameterSetting; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ParameterSettingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class ParameterSettingServiceImpl implements ParameterSettingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ParameterSetting parameterSetting) { |
| | | mongoTemplate.save(parameterSetting); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ParameterSetting findById(String id) { |
| | | return mongoTemplate.findById(id, ParameterSetting.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ParameterSetting> findAll() { |
| | | return mongoTemplate.findAll(ParameterSetting.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ParameterSetting> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<ParameterSetting> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , ParameterSetting.class); |
| | | return list; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.Ping; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PingServiceImpl implements PingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(Ping ping) { |
| | | mongoTemplate.save(ping); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public Ping findById(String id) { |
| | | return mongoTemplate.findById(id, Ping.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Ping> findAll() { |
| | | return mongoTemplate.findAll(Ping.class); |
| | | } |
| | | |
| | | @Override |
| | | public void delPing() { |
| | | mongoTemplate.remove(new Query().addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusDays(1))), Ping.class); |
| | | } |
| | | |
| | | @Override |
| | | public void save(Ping ping) { |
| | | Query query = new Query(); |
| | | if (StringUtils.isNotEmpty(ping.getCharging_pile_code())) { |
| | | query.addCriteria(Criteria.where("charging_pile_code").is(ping.getCharging_pile_code())); |
| | | } |
| | | if (StringUtils.isNotEmpty(ping.getCharging_gun_code())){ |
| | | query.addCriteria(Criteria.where("charging_gun_code").is(ping.getCharging_gun_code())); |
| | | } |
| | | List<Ping> pings = mongoTemplate.find(query, Ping.class); |
| | | if(pings.size() > 0){ |
| | | Ping ping1 = pings.get(0); |
| | | ping1.setLast_time(new Date()); |
| | | ping1.setCharging_gun_status(ping.getCharging_gun_status()); |
| | | mongoTemplate.save(ping1); |
| | | }else{ |
| | | mongoTemplate.save(ping); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.ParameterSetting; |
| | | import com.ruoyi.integration.api.model.PlatformConfirmationCharging; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PlatformConfirmationChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PlatformConfirmationChargingServiceImpl implements PlatformConfirmationChargingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformConfirmationCharging platformConfirmationCharging) { |
| | | mongoTemplate.save(platformConfirmationCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformConfirmationCharging findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformConfirmationCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformConfirmationCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformConfirmationCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformConfirmationCharging> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<PlatformConfirmationCharging> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , PlatformConfirmationCharging.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.PlatformConfirmationCharging; |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdateReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PlatformRemoteUpdateReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PlatformRemoteUpdateReplyServiceImpl implements PlatformRemoteUpdateReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformRemoteUpdateReply platformRemoteUpdateReply) { |
| | | mongoTemplate.save(platformRemoteUpdateReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformRemoteUpdateReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformRemoteUpdateReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRemoteUpdateReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformRemoteUpdateReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRemoteUpdateReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<PlatformRemoteUpdateReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , PlatformRemoteUpdateReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdate; |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdateReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PlatformRemoteUpdateService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PlatformRemoteUpdateServiceImpl implements PlatformRemoteUpdateService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformRemoteUpdate platformRemoteUpdate) { |
| | | mongoTemplate.save(platformRemoteUpdate); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformRemoteUpdate findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformRemoteUpdate.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRemoteUpdate> findAll() { |
| | | return mongoTemplate.findAll(PlatformRemoteUpdate.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRemoteUpdate> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<PlatformRemoteUpdate> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , PlatformRemoteUpdate.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdate; |
| | | import com.ruoyi.integration.api.model.PlatformRestartReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PlatformRestartReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PlatformRestartReplyServiceImpl implements PlatformRestartReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(PlatformRestartReply platformRestartReply) { |
| | | mongoTemplate.save(platformRestartReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformRestartReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformRestartReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRestartReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformRestartReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRestartReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<PlatformRestartReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , PlatformRestartReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.PlatformRestart; |
| | | import com.ruoyi.integration.api.model.PlatformRestartReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PlatformRestartService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PlatformRestartServiceImpl implements PlatformRestartService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformRestart platformRestart) { |
| | | mongoTemplate.save(platformRestart); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformRestart findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformRestart.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRestart> findAll() { |
| | | return mongoTemplate.findAll(PlatformRestart.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRestart> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<PlatformRestart> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , PlatformRestart.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.PlatformRestart; |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PlatformStartChargingReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PlatformStartChargingReplyServiceImpl implements PlatformStartChargingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(PlatformStartChargingReply platformStartChargingReply) { |
| | | mongoTemplate.save(platformStartChargingReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStartChargingReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStartChargingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStartChargingReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformStartChargingReply.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据订单编号查询远程启机应答数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PlatformStartChargingReply> getPlatformStartChargingReply(String code) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | List<PlatformStartChargingReply> platformStartChargingReplies = mongoTemplate.find(query, PlatformStartChargingReply.class); |
| | | return platformStartChargingReplies; |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStartChargingReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<PlatformStartChargingReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , PlatformStartChargingReply.class); |
| | | return list; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PlatformStartChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PlatformStartChargingServiceImpl implements PlatformStartChargingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformStartCharging platformStartCharging) { |
| | | mongoTemplate.save(platformStartCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStartCharging findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStartCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStartCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformStartCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStartCharging> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<PlatformStartCharging> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , PlatformStartCharging.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PlatformStopChargingReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PlatformStopChargingReplyServiceImpl implements PlatformStopChargingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformStopChargingReply platformStopChargingReply) { |
| | | mongoTemplate.save(platformStopChargingReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStopChargingReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStopChargingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStopChargingReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformStopChargingReply.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据枪编号获取 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<PlatformStopChargingReply> platformStopChargingReplies = mongoTemplate.find(new Query().addCriteria(Criteria.where("charging_pile_code").is(query.getCharging_pile_code()) |
| | | .and("charging_gun_code").is(query.getCharging_gun_code()).and("create_time").lte(sdf.format(new Date())).gte(query.getEnd_time())), PlatformStopChargingReply.class); |
| | | return platformStopChargingReplies.size() > 0 ? platformStopChargingReplies.get(0) : null; |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStopChargingReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<PlatformStopChargingReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , PlatformStopChargingReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PlatformStopChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PlatformStopChargingServiceImpl implements PlatformStopChargingService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(PlatformStopCharging platformStopCharging) { |
| | | mongoTemplate.save(platformStopCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStopCharging findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStopCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStopCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformStopCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStopCharging> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<PlatformStopCharging> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , PlatformStopCharging.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.Pong; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.PongService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class PongServiceImpl implements PongService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(Pong pong) { |
| | | mongoTemplate.save(pong); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public Pong findById(String id) { |
| | | return mongoTemplate.findById(id, Pong.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Pong> findAll() { |
| | | return mongoTemplate.findAll(Pong.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void delPong() { |
| | | mongoTemplate.remove(new Query().addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusDays(1)))); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.QrCodeDeliveryReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.QrCodeDeliveryReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class QrCodeDeliveryReplyServiceImpl implements QrCodeDeliveryReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(QrCodeDeliveryReply qrCodeDeliveryReply) { |
| | | mongoTemplate.save(qrCodeDeliveryReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public QrCodeDeliveryReply findById(String id) { |
| | | return mongoTemplate.findById(id, QrCodeDeliveryReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QrCodeDeliveryReply> findAll() { |
| | | return mongoTemplate.findAll(QrCodeDeliveryReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QrCodeDeliveryReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<QrCodeDeliveryReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , QrCodeDeliveryReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.QrCodeDeliveryReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.QrCodeDeliveryService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class QrCodeDeliveryServiceImpl implements QrCodeDeliveryService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(QrCodeDelivery qrCodeDelivery) { |
| | | mongoTemplate.save(qrCodeDelivery); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public QrCodeDelivery findById(String id) { |
| | | return mongoTemplate.findById(id, QrCodeDelivery.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QrCodeDelivery> findAll() { |
| | | return mongoTemplate.findAll(QrCodeDelivery.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QrCodeDelivery> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<QrCodeDelivery> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , QrCodeDelivery.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.QueryOfflineCardReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.QueryOfflineCardReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class QueryOfflineCardReplyServiceImpl implements QueryOfflineCardReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(QueryOfflineCardReply queryOfflineCardReply) { |
| | | mongoTemplate.save(queryOfflineCardReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public QueryOfflineCardReply findById(String id) { |
| | | return mongoTemplate.findById(id, QueryOfflineCardReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QueryOfflineCardReply> findAll() { |
| | | return mongoTemplate.findAll(QueryOfflineCardReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QueryOfflineCardReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<QueryOfflineCardReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , QueryOfflineCardReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.QueryOfflineCard; |
| | | import com.ruoyi.integration.api.model.QueryOfflineCardReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.QueryOfflineCardService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class QueryOfflineCardServiceImpl implements QueryOfflineCardService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(QueryOfflineCard queryOfflineCard) { |
| | | mongoTemplate.save(queryOfflineCard); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public QueryOfflineCard findById(String id) { |
| | | return mongoTemplate.findById(id, QueryOfflineCard.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QueryOfflineCard> findAll() { |
| | | return mongoTemplate.findAll(QueryOfflineCard.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QueryOfflineCard> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<QueryOfflineCard> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , QueryOfflineCard.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.QueryOfflineCard; |
| | | import com.ruoyi.integration.api.model.ReadRealTimeMonitoringData; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ReadRealTimeMonitoringDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class ReadRealTimeMonitoringDataServiceImpl implements ReadRealTimeMonitoringDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ReadRealTimeMonitoringData readRealTimeMonitoringData) { |
| | | mongoTemplate.save(readRealTimeMonitoringData); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ReadRealTimeMonitoringData findById(String id) { |
| | | return mongoTemplate.findById(id, ReadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ReadRealTimeMonitoringData> findAll() { |
| | | return mongoTemplate.findAll(ReadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ReadRealTimeMonitoringData> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<ReadRealTimeMonitoringData> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , ReadRealTimeMonitoringData.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.ReadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.SecurityDetectionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class SecurityDetectionServiceImpl implements SecurityDetectionService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(SecurityDetection securityDetection) { |
| | | mongoTemplate.save(securityDetection); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SecurityDetection findById(String id) { |
| | | return mongoTemplate.findById(id, SecurityDetection.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SecurityDetection> findAll() { |
| | | return mongoTemplate.findAll(SecurityDetection.class); |
| | | } |
| | | |
| | | /** |
| | | * 根据业务流水号查询数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | @Override |
| | | public SecurityDetection getSecurityDetection(String transactionSerialNumber) { |
| | | List<SecurityDetection> securityDetectionList = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number") |
| | | .is(transactionSerialNumber)), SecurityDetection.class); |
| | | return securityDetectionList.size() > 0 ? securityDetectionList.get(0) : null; |
| | | } |
| | | |
| | | @Override |
| | | public List<SecurityDetection> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<SecurityDetection> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , SecurityDetection.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.integration.api.model.SetupBillingModelReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.SetupBillingModelReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class SetupBillingModelReplyServiceImpl implements SetupBillingModelReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(SetupBillingModelReply setupBillingModelReply) { |
| | | mongoTemplate.save(setupBillingModelReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SetupBillingModelReply findById(String id) { |
| | | return mongoTemplate.findById(id, SetupBillingModelReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SetupBillingModelReply> findAll() { |
| | | return mongoTemplate.findAll(SetupBillingModelReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SetupBillingModelReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<SetupBillingModelReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , SetupBillingModelReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.SetupBillingModel; |
| | | import com.ruoyi.integration.api.model.SetupBillingModelReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.SetupBillingModelService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class SetupBillingModelServiceImpl implements SetupBillingModelService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(SetupBillingModel setupBillingModel) { |
| | | mongoTemplate.save(setupBillingModel); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SetupBillingModel findById(String id) { |
| | | return mongoTemplate.findById(id, SetupBillingModel.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SetupBillingModel> findAll() { |
| | | return mongoTemplate.findAll(SetupBillingModel.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SetupBillingModel> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<SetupBillingModel> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , SetupBillingModel.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.SetupBillingModel; |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCardReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.SynchronizeOfflineCardReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class SynchronizeOfflineCardReplyServiceImpl implements SynchronizeOfflineCardReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(SynchronizeOfflineCardReply synchronizeOfflineCardReply) { |
| | | mongoTemplate.save(synchronizeOfflineCardReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SynchronizeOfflineCardReply findById(String id) { |
| | | return mongoTemplate.findById(id, SynchronizeOfflineCardReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SynchronizeOfflineCardReply> findAll() { |
| | | return mongoTemplate.findAll(SynchronizeOfflineCardReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SynchronizeOfflineCardReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<SynchronizeOfflineCardReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , SynchronizeOfflineCardReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCard; |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCardReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.SynchronizeOfflineCardService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class SynchronizeOfflineCardServiceImpl implements SynchronizeOfflineCardService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(SynchronizeOfflineCard synchronizeOfflineCard) { |
| | | mongoTemplate.save(synchronizeOfflineCard); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SynchronizeOfflineCard findById(String id) { |
| | | return mongoTemplate.findById(id, SynchronizeOfflineCard.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SynchronizeOfflineCard> findAll() { |
| | | return mongoTemplate.findAll(SynchronizeOfflineCard.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SynchronizeOfflineCard> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<SynchronizeOfflineCard> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , SynchronizeOfflineCard.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCard; |
| | | import com.ruoyi.integration.api.model.TimingSettingReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.TimingSettingReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class TimingSettingReplyServiceImpl implements TimingSettingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(TimingSettingReply timingSettingReply) { |
| | | mongoTemplate.save(timingSettingReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public TimingSettingReply findById(String id) { |
| | | return mongoTemplate.findById(id, TimingSettingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TimingSettingReply> findAll() { |
| | | return mongoTemplate.findAll(TimingSettingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TimingSettingReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<TimingSettingReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , TimingSettingReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.TimingSetting; |
| | | import com.ruoyi.integration.api.model.TimingSettingReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.TimingSettingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class TimingSettingServiceImpl implements TimingSettingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(TimingSetting timingSetting) { |
| | | mongoTemplate.save(timingSetting); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public TimingSetting findById(String id) { |
| | | return mongoTemplate.findById(id, TimingSetting.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TimingSetting> findAll() { |
| | | return mongoTemplate.findAll(TimingSetting.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TimingSetting> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<TimingSetting> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , TimingSetting.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.TimingSetting; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.TransactionRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class TransactionRecordServiceImpl implements TransactionRecordService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(TransactionRecord transactionRecord) { |
| | | mongoTemplate.save(transactionRecord); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public TransactionRecord findById(String id) { |
| | | return mongoTemplate.findById(id, TransactionRecord.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TransactionRecord> findAll() { |
| | | return mongoTemplate.findAll(TransactionRecord.class); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单流水号查询数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public TransactionRecord findOne(String code) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(code)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | } |
| | | List<TransactionRecord> transactionRecords = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , TransactionRecord.class); |
| | | return transactionRecords.size() > 0 ? transactionRecords.get(0) : null; |
| | | } |
| | | |
| | | @Override |
| | | public List<TransactionRecord> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<TransactionRecord> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , TransactionRecord.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.integration.api.model.UpdateBalanceReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.UpdateBalanceReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class UpdateBalanceReplyServiceImpl implements UpdateBalanceReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(UpdateBalanceReply updateBalanceReply) { |
| | | mongoTemplate.save(updateBalanceReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public UpdateBalanceReply findById(String id) { |
| | | return mongoTemplate.findById(id, UpdateBalanceReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<UpdateBalanceReply> findAll() { |
| | | return mongoTemplate.findAll(UpdateBalanceReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<UpdateBalanceReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<UpdateBalanceReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , UpdateBalanceReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.UpdateBalance; |
| | | import com.ruoyi.integration.api.model.UpdateBalanceReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.UpdateBalanceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class UpdateBalanceServiceImpl implements UpdateBalanceService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(UpdateBalance updateBalance) { |
| | | mongoTemplate.save(updateBalance); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public UpdateBalance findById(String id) { |
| | | return mongoTemplate.findById(id, UpdateBalance.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<UpdateBalance> findAll() { |
| | | return mongoTemplate.findAll(UpdateBalance.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<UpdateBalance> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<UpdateBalance> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , UpdateBalance.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.UpdateBalance; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class UploadRealTimeMonitoringDataServiceImpl implements UploadRealTimeMonitoringDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(UploadRealTimeMonitoringData uploadRealTimeMonitoringData) { |
| | | mongoTemplate.save(uploadRealTimeMonitoringData); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringData findById(String id) { |
| | | return mongoTemplate.findById(id, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> findAll() { |
| | | return mongoTemplate.findAll(UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据订单号查询监控数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> getDataByOrderCode(String code) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(code)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | } |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , UploadRealTimeMonitoringData.class); |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException { |
| | | Query query = new Query(); |
| | | // if (!values.isEmpty()){ |
| | | // query.addCriteria(Criteria.where("transaction_serial_number").in(values)); |
| | | // } |
| | | if (mongoChargingOrderQuery.getCode() != null && !mongoChargingOrderQuery.getCode().isEmpty()) { |
| | | query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(),"i")); // "i" 表示不区分大小写 |
| | | } |
| | | if (mongoChargingOrderQuery.getOrderType() !=null){ |
| | | query.addCriteria(Criteria.where("orderType").is(mongoChargingOrderQuery.getOrderType())); |
| | | } |
| | | if (mongoChargingOrderQuery.getSiteId() != null){ |
| | | query.addCriteria(Criteria.where("siteId").is(mongoChargingOrderQuery.getSiteId())); |
| | | } |
| | | if (!mongoChargingOrderQuery.getSiteIds().isEmpty()){ |
| | | query.addCriteria(Criteria.where("siteId").in(mongoChargingOrderQuery.getSiteIds())); |
| | | } |
| | | if (mongoChargingOrderQuery.getChargingPileCode() != null && !mongoChargingOrderQuery.getChargingPileCode().isEmpty()) { |
| | | query.addCriteria(Criteria.where("charging_pile_code").is(mongoChargingOrderQuery.getChargingPileCode())); |
| | | } |
| | | if (mongoChargingOrderQuery.getChargingGunCode() != null && !mongoChargingOrderQuery.getChargingGunCode().isEmpty()){ |
| | | query.addCriteria(Criteria.where("charging_gun_code").is(mongoChargingOrderQuery.getChargingGunCode())); |
| | | } |
| | | if (mongoChargingOrderQuery.getStatus() != null){ |
| | | query.addCriteria(Criteria.where("status").is(mongoChargingOrderQuery.getStatus())); |
| | | } |
| | | |
| | | if (mongoChargingOrderQuery.getCreateTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getCreateTime().split(" - "); |
| | | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date start = dateFormat.parse(split[0]); |
| | | Date end = dateFormat.parse(split[1]); |
| | | query.addCriteria(Criteria.where("create_time").gte(start).lt(end)); |
| | | } |
| | | |
| | | if (mongoChargingOrderQuery.getLastTime() != null && mongoChargingOrderQuery.getLastTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getLastTime().split(" - "); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date start = dateFormat.parse(split[0]); |
| | | Date end = dateFormat.parse(split[1]); |
| | | query.addCriteria(Criteria.where("last_time").gte(start).lt(end)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | long totalElements = mongoTemplate.count(query, UploadRealTimeMonitoringData.class); |
| | | |
| | | // 创建带有排序的 Pageable 对象 |
| | | Pageable pageable = PageRequest.of( |
| | | mongoChargingOrderQuery.getPageCurr()-1, |
| | | mongoChargingOrderQuery.getPageSize(), |
| | | Sort.by(Sort.Direction.DESC, "create_time") |
| | | ); |
| | | |
| | | // 设置分页和排序 |
| | | query.with(pageable); |
| | | |
| | | // 执行查询并获取 Page 对象 |
| | | List<UploadRealTimeMonitoringData> page = mongoTemplate.find(query, UploadRealTimeMonitoringData.class,"upload_real_time_monitoring_data"); |
| | | |
| | | // 设置分页 |
| | | // Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageSize()*(mongoChargingOrderQuery.getPageCurr()-1), mongoChargingOrderQuery.getPageSize()); |
| | | // query.with(pageable); |
| | | // query.with(Sort.by(Sort.Direction.DESC,"create_time")); |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query |
| | | , UploadRealTimeMonitoringData.class); |
| | | |
| | | UploadRealTimeMonitoringPageData uploadRealTimeMonitoringPageData = new UploadRealTimeMonitoringPageData(); |
| | | uploadRealTimeMonitoringPageData.setCount(totalElements); |
| | | uploadRealTimeMonitoringPageData.setRecords(page); |
| | | return uploadRealTimeMonitoringPageData; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number) { |
| | | Query query = new Query(); |
| | | if (StringUtils.isNotEmpty(transaction_serial_number)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(transaction_serial_number)); |
| | | } |
| | | // 按照 createdAt 字段降序排序 |
| | | query.with(Sort.by(Sort.Direction.DESC, "create_time")); |
| | | // 限制结果只返回一条记录 |
| | | query.limit(1); |
| | | return mongoTemplate.findOne(query, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | UploadRealTimeMonitoringData byId = findById(id.toString()); |
| | | mongoTemplate.remove(byId); |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(String id) { |
| | | // 创建查询条件 |
| | | Query query = new Query(Criteria.where("_id").is(id)); |
| | | // 创建更新对象 |
| | | Update update = new Update().set("last_time", new Date()); |
| | | // 执行更新操作 |
| | | mongoTemplate.updateFirst(query, update, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<UploadRealTimeMonitoringData> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , UploadRealTimeMonitoringData.class); |
| | | return list; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.WorkingParameterSettingReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.WorkingParameterSettingReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class WorkingParameterSettingReplyServiceImpl implements WorkingParameterSettingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(WorkingParameterSettingReply workingParameterSettingReply) { |
| | | mongoTemplate.save(workingParameterSettingReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public WorkingParameterSettingReply findById(String id) { |
| | | return mongoTemplate.findById(id, WorkingParameterSettingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<WorkingParameterSettingReply> findAll() { |
| | | return mongoTemplate.findAll(WorkingParameterSettingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<WorkingParameterSettingReply> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<WorkingParameterSettingReply> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , WorkingParameterSettingReply.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.WorkingParameterSetting; |
| | | import com.ruoyi.integration.api.model.WorkingParameterSettingReply; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.WorkingParameterSettingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class WorkingParameterSettingServiceImpl implements WorkingParameterSettingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(WorkingParameterSetting workingParameterSetting) { |
| | | mongoTemplate.save(workingParameterSetting); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public WorkingParameterSetting findById(String id) { |
| | | return mongoTemplate.findById(id, WorkingParameterSetting.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<WorkingParameterSetting> findAll() { |
| | | return mongoTemplate.findAll(WorkingParameterSetting.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<WorkingParameterSetting> getRangeTimeData(Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | // 根据时间范围查询 |
| | | if (Objects.nonNull(startTime) && Objects.nonNull(endTime)) { |
| | | query.addCriteria(Criteria.where("create_time").gte(startTime).lte(endTime)); |
| | | } |
| | | List<WorkingParameterSetting> list = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , WorkingParameterSetting.class); |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mqtt.callback; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.jianguan.mqtt.config.TopicConstants; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.eclipse.paho.client.mqttv3.*; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 消费监听 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class PushCallback implements MqttCallback { |
| | | private static MqttConnectOptions options; |
| | | private static MqttClient client; |
| | | private static final double EARTH_RADIUS = 6378137.0; |
| | | |
| | | |
| | | @Override |
| | | public void connectionLost(Throwable throwable) { |
| | | if (client == null || !client.isConnected()) { |
| | | System.out.println("连接断开,正在重连...."); |
| | | int[] Qos = {0}; |
| | | String[] topic1 = {TopicConstants.CHARGE_PILE_CODE}; |
| | | try { |
| | | client.connect(options); |
| | | client.subscribe(topic1, Qos); |
| | | log.info("连接失败重连成功"); |
| | | } catch (MqttException e) { |
| | | log.info("连接失败重连失败"); |
| | | log.info("connectionLost e:{}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void messageArrived(String topic, MqttMessage message) throws Exception { |
| | | System.err.println("接收消息主题 : " + topic); |
| | | System.err.println("接收消息Qos : " + message.getQos()); |
| | | System.err.println("接收消息内容 : " + new String(message.getPayload())); |
| | | |
| | | String silentMessage = new String(message.getPayload()); |
| | | JSONObject jsonObject = JSONObject.parseObject(silentMessage); |
| | | String messageType = jsonObject.getString("type"); |
| | | if(StringUtils.isEmpty(messageType)){ |
| | | log.warn("接收消息类型为空"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mqtt.client; |
| | | |
| | | |
| | | import com.ruoyi.jianguan.mqtt.callback.PushCallback; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.eclipse.paho.client.mqttv3.IMqttToken; |
| | | import org.eclipse.paho.client.mqttv3.MqttClient; |
| | | import org.eclipse.paho.client.mqttv3.MqttConnectOptions; |
| | | import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class ClientMQTT { |
| | | private final static String HOST = "tcp://127.0.0.1:9882"; |
| | | private final static String USER_NAME = "admin"; |
| | | private final static String PASS_WORD = "mingxingdianli123"; |
| | | private static final String CLIENT_ID = String.valueOf(System.currentTimeMillis()); |
| | | private static final Integer TIME_OUT = 30000; |
| | | private static final Integer KEEP_ALIVE = 30000; |
| | | private MqttClient client; |
| | | private MqttConnectOptions options; |
| | | private void start() { |
| | | try { |
| | | // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存 |
| | | client = new MqttClient(HOST, CLIENT_ID, new MemoryPersistence()); |
| | | // MQTT的连接设置 |
| | | options = new MqttConnectOptions(); |
| | | // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,这里设置为true表示每次连接到服务器都以新的身份连接 |
| | | options.setCleanSession(false); |
| | | // 设置连接的用户名 |
| | | options.setUserName(USER_NAME); |
| | | // 设置连接的密码 |
| | | options.setPassword(PASS_WORD.toCharArray()); |
| | | // 设置超时时间 单位为秒 |
| | | options.setConnectionTimeout(TIME_OUT); |
| | | // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制 |
| | | options.setKeepAliveInterval(KEEP_ALIVE); |
| | | // automaticReconnect 为 true 表示断线自动重连,但仅仅只是重新连接,并不订阅主题;在 connectComplete 回调函数重新订阅 |
| | | options.setAutomaticReconnect(true); |
| | | // 设置回调 |
| | | // 设置回调 |
| | | client.setCallback(new PushCallback()); |
| | | |
| | | IMqttToken iMqttToken = client.connectWithResult(options); |
| | | boolean complete = iMqttToken.isComplete(); |
| | | System.err.println("MQTT连接" + (complete ? "成功" : "失败")); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 连接至mqtt服务器,获取mqtt连接 |
| | | * |
| | | * @return |
| | | */ |
| | | // @Bean |
| | | // public ClientMQTT getMqttPushClient() { |
| | | // //连接至mqtt服务器,获取mqtt连接 |
| | | // this.start(); |
| | | // return this; |
| | | // } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.mqtt.config; |
| | | |
| | | public class TopicConstants { |
| | | |
| | | /** |
| | | * topic 政务云上传数据 |
| | | */ |
| | | public static String CHARGE_PILE_CODE = "/devices/v1/MTM1OTkwNjEzMjc5NzE2MTQ3Mg==/CHARGE_PILE_CODE/sys/properties/report"; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.mqtt.util; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.jianguan.mqtt.callback.PushCallback; |
| | | import com.ruoyi.jianguan.mqtt.client.ClientMQTT; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.eclipse.paho.client.mqttv3.*; |
| | | import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class MqttPushUtil { |
| | | |
| | | // private final static String HOST = "tcp://127.0.0.1:9882"; |
| | | // private final static String CLIENT_ID = "mqttx_3267186711111fdsasdsa"; |
| | | // private final static String USER_NAME = "admin"; |
| | | // private final static String PASS_WORD = "mingxingdianli123"; |
| | | private final static String HOST = "tcp://182.129.202.2:1883"; |
| | | private final static String CLIENT_ID = "mqttx_3267186711111mxcdszyun"; |
| | | private final static String USER_NAME = "mxEmqx"; |
| | | private final static String PASS_WORD = "csDN_wlwpt"; |
| | | private final static Integer TIME_OUT = 30000; |
| | | private final static Integer KEEP_ALIVE = 60000; |
| | | private MqttClient mqttClient; |
| | | |
| | | /** |
| | | * 推送充电桩数据 |
| | | * @param topic |
| | | * @param message |
| | | * @return |
| | | */ |
| | | public R<String> pushChargePileData(String topic, String message){ |
| | | try { |
| | | //发布消息 |
| | | this.publish(topic,message); |
| | | return R.ok("["+topic+"]-推送成功;内容为:["+message+"]"); |
| | | } catch (MqttException e) { |
| | | return R.fail("推送失败:["+e.getMessage()+"]"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 测试订阅消息 |
| | | */ |
| | | // public static void main(String[] args) throws Exception { |
| | | // MqttPushUtil mqttConnect = new MqttPushUtil(); |
| | | // mqttConnect.start(); |
| | | // //订阅消息 |
| | | // mqttConnect.publish("/cmt/IoT/pub/8/6700/status/silent","message11消息"); |
| | | // } |
| | | |
| | | @Bean |
| | | public MqttPushUtil getMqttPushClient() { |
| | | //连接至mqtt服务器,获取mqtt连接 |
| | | this.start(); |
| | | return this; |
| | | } |
| | | /** |
| | | * 初始化mqtt链接 |
| | | * @throws MqttException |
| | | */ |
| | | public void start(){ |
| | | try { |
| | | // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存 |
| | | mqttClient = new MqttClient(HOST, CLIENT_ID + System.currentTimeMillis(), new MemoryPersistence()); |
| | | // MQTT的连接设置 |
| | | MqttConnectOptions options = new MqttConnectOptions(); |
| | | options.setUserName(USER_NAME); |
| | | options.setPassword(PASS_WORD.toCharArray()); |
| | | // 设置超时时间 单位为秒 |
| | | options.setConnectionTimeout(TIME_OUT);///默认:30 |
| | | // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,设置为true表示每次连接到服务器都以新的身份连接 |
| | | options.setCleanSession(false);//默认:true |
| | | // 设置断开后重新连接(设置为true时将启用自动重新连接) |
| | | options.setAutomaticReconnect(true);//默认:false |
| | | // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制 |
| | | options.setKeepAliveInterval(KEEP_ALIVE);//默认:60 |
| | | // 设置回调 |
| | | mqttClient.setCallback(new PushCallback()); |
| | | mqttClient.connect(options); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 自定义mqtt连接 |
| | | * @param host |
| | | * @param clientId |
| | | * @param userName |
| | | * @param passWord |
| | | * @param connectionTimeout |
| | | * @param cleanSession |
| | | * @param automaticReconnect |
| | | * @param keepAliveInterval |
| | | * @param mqttCallback |
| | | * @throws MqttException |
| | | */ |
| | | public void start(String host,String clientId, String userName, String passWord, |
| | | int connectionTimeout, boolean cleanSession,boolean automaticReconnect, |
| | | int keepAliveInterval,MqttCallback mqttCallback) throws MqttException { |
| | | // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存 |
| | | mqttClient = new MqttClient(host, clientId + System.currentTimeMillis(), new MemoryPersistence()); |
| | | // MQTT的连接设置 |
| | | MqttConnectOptions options = new MqttConnectOptions(); |
| | | options.setUserName(userName); |
| | | options.setPassword(passWord.toCharArray()); |
| | | // 设置超时时间 单位为秒 |
| | | options.setConnectionTimeout(connectionTimeout);///默认:30 |
| | | // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,设置为true表示每次连接到服务器都以新的身份连接 |
| | | options.setCleanSession(cleanSession);//默认:true |
| | | // 设置断开后重新连接(设置为true时将启用自动重新连接) |
| | | options.setAutomaticReconnect(automaticReconnect);//默认:false |
| | | // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制 |
| | | options.setKeepAliveInterval(keepAliveInterval);//默认:60 |
| | | // 设置回调 |
| | | mqttClient.setCallback(mqttCallback); |
| | | mqttClient.connect(options); |
| | | } |
| | | |
| | | /** |
| | | * 发布,默认qos为0,非持久化 |
| | | */ |
| | | public void publish(String topic, String message1) throws MqttException { |
| | | publish(0, false, topic, message1); |
| | | } |
| | | |
| | | /** |
| | | * 发布 |
| | | */ |
| | | public void publish(int qos, boolean retained, String topic, String message1) throws MqttException { |
| | | MqttMessage message = new MqttMessage(); |
| | | message.setQos(qos); |
| | | message.setRetained(retained); |
| | | message.setPayload(message1.getBytes()); |
| | | MqttTopic mTopic = mqttClient.getTopic(topic); |
| | | if (null == mTopic) { |
| | | System.err.println("topic not exist"); |
| | | log.error("topic not exist"); |
| | | } |
| | | MqttDeliveryToken token; |
| | | token = mTopic.publish(message); |
| | | token.waitForCompletion(); |
| | | } |
| | | |
| | | /** |
| | | * 订阅某个主题,qos默认为0 |
| | | */ |
| | | public void subscribe(String topic) { |
| | | subscribe(topic, 0); |
| | | } |
| | | |
| | | /** |
| | | * 订阅某个主题 |
| | | */ |
| | | public void subscribe(String topic, int qos) { |
| | | try { |
| | | mqttClient.subscribe(topic, qos); |
| | | } catch (MqttException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.pool; |
| | | |
| | | import io.netty.util.concurrent.DefaultThreadFactory; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.concurrent.*; |
| | | |
| | | /** |
| | | * 线程池使用示例及实践 |
| | | * execute:适用于无返回值的任务执行,如果需要返回值需要自己传入FutureTask,在子线程中抛出异常,在主线程捕捉不到 |
| | | * submit:适用于有返回值的任务执行,不会直接抛出异常,会将异常捕获到FutureTask中,需要通过future.get()获取 |
| | | * |
| | | * @author Devil |
| | | * @version 1.0 |
| | | * @date 2025/4/12 21:42 |
| | | */ |
| | | @Slf4j |
| | | public class ThreadPoolDemo { |
| | | |
| | | /** |
| | | * 创建并演示使用单个线程的线程池 |
| | | * 特点: |
| | | * 1. 保证所有任务顺序执行 |
| | | * 2. 使用无界队列(LinkedBlockingQueue),需注意可能的内存溢出问题 |
| | | * 3. 适用于需要保证任务顺序执行的场景 |
| | | */ |
| | | @SneakyThrows |
| | | public static void createSingleThreadPool() { |
| | | // 创建单线程线程池(实际开发建议使用自定义ThreadPoolExecutor) |
| | | ExecutorService executorService = Executors.newSingleThreadExecutor(); |
| | | |
| | | try { |
| | | log.info("\n================ 普通任务执行 ================"); |
| | | for (int i = 0; i < 10; i++) { |
| | | executorService.execute(() -> log.info("线程:{},办理业务", Thread.currentThread().getName())); |
| | | } |
| | | |
| | | TimeUnit.MILLISECONDS.sleep(2); |
| | | |
| | | log.info("\n================ 带返回值的任务执行 ================"); |
| | | for (int i = 0; i < 10; i++) { |
| | | Future<String> future = executorService.submit(() -> { |
| | | log.info("线程:{},办理业务", Thread.currentThread().getName()); |
| | | return "业务办理完成"; |
| | | }); |
| | | log.info(future.get()); |
| | | } |
| | | } finally { |
| | | // 优雅关闭线程池 |
| | | gracefulShutdown(executorService); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建固定大小的线程池 |
| | | * 特点: |
| | | * 1. 固定核心线程数(=最大线程数) |
| | | * 2. 使用无界队列(LinkedBlockingQueue),需注意系统资源消耗 |
| | | * 3. 适用于已知并发需求的稳定负载场景 |
| | | */ |
| | | @SneakyThrows |
| | | public static void createFixedThreadPool() { |
| | | // 创建固定大小线程池(建议根据CPU核心数设置) |
| | | ExecutorService executorService = Executors.newFixedThreadPool(5); |
| | | |
| | | try { |
| | | log.info("\n================ 普通任务执行 ================"); |
| | | for (int i = 0; i < 10; i++) { |
| | | executorService.execute(() -> log.info("线程:{},办理业务", Thread.currentThread().getName())); |
| | | } |
| | | |
| | | TimeUnit.MILLISECONDS.sleep(1); |
| | | |
| | | log.info("\n================ 带返回值的任务执行 ================"); |
| | | for (int i = 0; i < 10; i++) { |
| | | Future<String> future = executorService.submit(() -> { |
| | | log.info("线程:{},办理业务", Thread.currentThread().getName()); |
| | | return "业务办理完成"; |
| | | }); |
| | | log.info(future.get()); |
| | | } |
| | | } finally { |
| | | gracefulShutdown(executorService); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建可缓存线程池 |
| | | * 特点: |
| | | * 1. 自动回收空闲线程(60秒) |
| | | * 2. 理论上可以创建Integer.MAX_VALUE个线程,需注意线程爆炸问题 |
| | | * 3. 适用于短期异步任务或低负载场景 |
| | | */ |
| | | @SneakyThrows |
| | | public static void createCachedThreadPool() { |
| | | // 创建弹性线程池(慎用,可能产生大量线程) |
| | | ExecutorService executorService = Executors.newCachedThreadPool(); |
| | | |
| | | try { |
| | | log.info("\n================ 普通任务执行 ================"); |
| | | for (int i = 0; i < 10; i++) { |
| | | executorService.execute(() -> log.info("线程:{},办理业务", Thread.currentThread().getName())); |
| | | } |
| | | |
| | | TimeUnit.MILLISECONDS.sleep(1); |
| | | |
| | | log.info("\n================ 带返回值的任务执行 ================"); |
| | | for (int i = 0; i < 10; i++) { |
| | | Future<String> future = executorService.submit(() -> { |
| | | log.info("线程:{},办理业务", Thread.currentThread().getName()); |
| | | return "业务办理完成"; |
| | | }); |
| | | log.info(future.get()); |
| | | } |
| | | } finally { |
| | | gracefulShutdown(executorService); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建定时任务线程池 |
| | | * 特点: |
| | | * 1. 支持定时及周期性任务 |
| | | * 2. 核心线程数固定,但可以不断创建新线程执行后续任务 |
| | | * 3. 适用于需要定时执行或周期性执行的场景 |
| | | */ |
| | | @SneakyThrows |
| | | public static void createScheduledThreadPool() { |
| | | // 创建定时任务线程池 |
| | | ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5); |
| | | |
| | | try { |
| | | log.info("\n================ 延迟任务执行 ================"); |
| | | for (int i = 0; i < 10; i++) { |
| | | scheduledExecutorService.schedule(() -> |
| | | log.info("线程:{},办理延迟业务", Thread.currentThread().getName()), |
| | | 1, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | TimeUnit.SECONDS.sleep(2); |
| | | |
| | | log.info("\n================ 带返回值的延迟任务执行 ================"); |
| | | for (int i = 0; i < 10; i++) { |
| | | ScheduledFuture<String> future = scheduledExecutorService.schedule(() -> { |
| | | log.info("线程:{},办理延迟业务", Thread.currentThread().getName()); |
| | | return "延迟业务办理完成"; |
| | | }, 1, TimeUnit.SECONDS); |
| | | log.info(future.get()); |
| | | } |
| | | } finally { |
| | | gracefulShutdown(scheduledExecutorService); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建自定义线程池 |
| | | * 特点: |
| | | * 1. 支持定时及周期性任务 |
| | | * 2. 核心线程数固定,但可以不断创建新线程执行后续任务 |
| | | * 3. 适用于需要定时执行或周期性执行的场景 |
| | | */ |
| | | @SneakyThrows |
| | | public static void createCustomThreadPool() { |
| | | /* |
| | | 创建自定义线程池 |
| | | 字段: |
| | | 1. corePoolSize:核心线程池数量 |
| | | 2. maximumPoolSize: 最大线程池数量 |
| | | 3. keepAliveTime: 线程空闲时间 |
| | | 4. unit: 时间单位 |
| | | 5. workQueue: 阻塞队列 |
| | | 5. threadFactory: 线程工厂 |
| | | 5. handler: 拒绝策略 |
| | | */ |
| | | ThreadPoolExecutor customthreadPoolExecutor = new ThreadPoolExecutor( |
| | | 5, // 根据CPU核心数设置 |
| | | 10, // 最大应急线程数 |
| | | 30, TimeUnit.SECONDS, // 空闲线程存活时间 |
| | | new ArrayBlockingQueue<>(100), // 有界队列防止内存溢出 |
| | | new DefaultThreadFactory("custom-thread-pool"), // 自定义线程命名 |
| | | new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略 |
| | | ); |
| | | |
| | | try { |
| | | log.info("\n================ 普通任务执行 ================"); |
| | | for (int i = 0; i < 20; i++) { |
| | | customthreadPoolExecutor.execute(() -> log.info("线程:{},办理业务", Thread.currentThread().getName())); |
| | | } |
| | | |
| | | TimeUnit.MILLISECONDS.sleep(1); |
| | | |
| | | log.info("\n================ 带返回值的任务执行 ================"); |
| | | for (int i = 0; i < 10; i++) { |
| | | Future<String> future = customthreadPoolExecutor.submit(() -> { |
| | | log.info("线程:{},办理业务", Thread.currentThread().getName()); |
| | | return "业务办理完成"; |
| | | }); |
| | | log.info(future.get()); |
| | | } |
| | | } finally { |
| | | gracefulShutdown(customthreadPoolExecutor); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 优雅关闭线程池通用方法 |
| | | * |
| | | * @param pool 需要关闭的线程池 |
| | | */ |
| | | private static void gracefulShutdown(ExecutorService pool) { |
| | | pool.shutdown(); // 拒绝新任务提交 |
| | | try { |
| | | // 等待现有任务完成 |
| | | if (!pool.awaitTermination(60, TimeUnit.SECONDS)) { |
| | | pool.shutdownNow(); // 取消等待中的任务 只等待运行中的任务 |
| | | // 再次等待任务响应中断 |
| | | if (!pool.awaitTermination(60, TimeUnit.SECONDS)) { |
| | | log.error("线程池未完全关闭"); |
| | | } |
| | | } |
| | | } catch (InterruptedException e) { |
| | | // 重新尝试关闭 |
| | | pool.shutdownNow(); |
| | | Thread.currentThread().interrupt(); |
| | | } finally { |
| | | log.info("线程池是否执行完成:{}", pool.isTerminated()); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // 测试不同线程池(选择其中一个执行) |
| | | // createSingleThreadPool(); |
| | | // createFixedThreadPool(); |
| | | // createCachedThreadPool(); |
| | | // createScheduledThreadPool(); |
| | | createCustomThreadPool(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电桩计费模型请求 |
| | | **/ |
| | | |
| | | @Data |
| | | public class AcquisitionBillingModeMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | |
| | | } |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 计费模型验证请求 |
| | | **/ |
| | | |
| | | @Data |
| | | public class BillingModeVerifyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号,首次连接到平台时置零 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电阶段BMS中止 |
| | | **/ |
| | | |
| | | @Data |
| | | public class BmsAbortMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer bms_stop_charging_reason; // BMS 中止充电原因(1-2 位——所需求的 SOC 目标值,3-4 位——达到总电压的设定值,5-6 位——达到单体电压设定值,7-8 位——充电机主动中止) |
| | | private Integer bms_aborted_charging_fault_cause; // BMS 中止充电故障原因(1-2 位——绝缘故障,3-4 位——输出连接器过温故障,5-6 位——BMS 元件、输出连接器过温,7-8 位——充电连接器故障,9-10 位——电池组温度过高故障,11-12 位——高压继电器故障,13 位-14 位——检测点 2 电压检测故障,15-16 位——其他故障) |
| | | private Integer bms_aborted_charging_error_cause; // BMS 中止充电错误原因(1-2 位——电流过大,3-4 位——电压异常,5-8 位——预留位) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电过程BMS需求、充电机输出 |
| | | **/ |
| | | |
| | | @Data |
| | | public class BmsDemandAndChargerExportationMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_voltage_requirements; // BMS 电压需求 |
| | | private BigDecimal bms_current_requirements; // BMS 电流需求 |
| | | private Integer bms_charging_mode; // BMS 充电模式(1:恒压充电;2:恒流充电) |
| | | private BigDecimal bms_voltage_measurement_value; // BMS 充电电压测量值 |
| | | private BigDecimal bms_current_measurement_value; // BMS 充电电流测量值 |
| | | private BigDecimal bms_battery_voltage; // 最高电压 BMS 最高单体动力蓄电池电压及组号(1-12 位:最高单体动力蓄电池电压,数据分辨率:0.01 V/位,0 V 偏移量;数据范围:0~24 V;13-16 位:最高单体动力蓄电池电压所在组号,数据分辨率:1/位,0 偏移量;数据范围:0~15) |
| | | private Integer bms_group_number; // 所在组号 BMS 最高单体动力蓄电池电压及组号(1-12 位:最高单体动力蓄电池电压,数据分辨率:0.01 V/位,0 V 偏移量;数据范围:0~24 V;13-16 位:最高单体动力蓄电池电压所在组号,数据分辨率:1/位,0 偏移量;数据范围:0~15) |
| | | private BigDecimal bms_charged_status; // BMS 当前荷电状态 SOC( %) |
| | | private BigDecimal bms_remaining_charging_time; // BMS 估算剩余充电时间 |
| | | private BigDecimal voltage_output_value; // 电桩电压输出值 |
| | | private BigDecimal current_output_value; // 电桩电流输出值 |
| | | private BigDecimal cumulative_charging_time; // 累计充电时间 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电过程BMS信息 |
| | | **/ |
| | | |
| | | @Data |
| | | public class BmsInformationMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer bms_highest_voltage_number; // BMS 最高单体动力蓄电池电压所在编号 |
| | | private String bms_maximum_battery_temperature; // BMS 最高动力蓄电池温度 |
| | | private String maximum_temperature_detection_point_number; // 最高温度检测点编号 |
| | | private String minimum_cell_temperature; // 最低动力蓄电池温度 |
| | | private String lowest_temperature_detection_pointt_number; // 最低动力蓄电池温度检测点编号 |
| | | private Integer bms_battery_voltage; // BMS 单体动力蓄电池电压过高 /过低(0:正常,1:过高,10:过低) |
| | | private Integer bms_battery_charging_status; // BMS 整车动力蓄电池荷电状态SOC 过高/过低(0:正常,1:过高,10:过低) |
| | | private Integer bms_charging_overcurrent; // BMS 动力蓄电池充电过电流(0:正常,1:过流,10:不可信状态) |
| | | private Integer bms_high_battery_temperature; // BMS 动力蓄电池温度过高(0:正常,1:过流,10:不可信状态) |
| | | private Integer bms_battery_insulation_status; // BMS 动力蓄电池绝缘状态(0:正常,1:过流,10:不可信状态) |
| | | private Integer bms_output_connector_connection_status; // BMS 动力蓄电池组输出连接器连接状态(0:正常,1:过流,10:不可信状态) |
| | | private Integer charge_prohibition; // 充电禁止(0:禁止,1:允许) |
| | | private Integer reserve; // 预留位 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电握手 |
| | | **/ |
| | | |
| | | @Data |
| | | public class ChargingHandshakeMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String bms_protocol_version;// BMS 通信协议版本号 |
| | | private Integer bms_battery_type;// BMS 电池类型(1:铅酸电池;2:氢:电池;3:磷酸铁锂电池;4:锰酸锂电池;5:钴酸锂电池;6:三元材料电池;7:聚合物锂离子电池;8:钛酸锂电池;FFH:其他) |
| | | private BigDecimal bms_battery_capacity;// BMS 整车动力蓄电池系统额定容量 |
| | | private BigDecimal bms_total_battery_voltage;// BMS 整车动力蓄电池系统额定总电压 |
| | | private String bms_battery_manufacturer;// BMS 电池生产厂商名称 |
| | | private String bms_battery_serial_number;// BMS 电池组序号 |
| | | private Integer bms_battery_production_year;// BMS 电池组生产日期年 |
| | | private Integer bms_battery_production_month;// BMS 电池组生产日期月 |
| | | private Integer bms_battery_production_day;// BMS 电池组生产日期日 |
| | | private Integer bms_battery_charging_times;// BMS 电池组充电次数 |
| | | private Integer bms_battery_property_rights;// BMS 电池组产权标识 |
| | | private Integer reserved;// 预留位 |
| | | private String vim;// BMS 车辆识别码 |
| | | private Integer bms_software_version;// BMS 软件版本号 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ChargingMessage extends BaseMessage { |
| | | // 充电设备状态message |
| | | private GunStatusMessage gunStatusMessage; |
| | | // 推送充电订单状态/充电订单信息message |
| | | private ChargingOrderMessage orderMessage; |
| | | private AcquisitionBillingModeMessage acquisitionBillingModeMessage; |
| | | private BillingModeVerifyMessage billingModeVerifyMessage; |
| | | private BmsAbortMessage bmsAbortMessage; |
| | | private BmsDemandAndChargerExportationMessage bmsDemandAndChargerExportationMessage; |
| | | private BmsInformationMessage bmsInformationMessage; |
| | | private ChargingHandshakeMessage chargingHandshakeMessage; |
| | | private ChargingMessage chargingMessage; |
| | | private ChargingPileReturnsGroundLockDataMessage chargingPileReturnsGroundLockDataMessage; |
| | | private ChargingPileStartsChargingMessage chargingPileStartsChargingMessage; |
| | | private ClearOfflineCardReplyMessage clearOfflineCardReplyMessage; |
| | | private EndChargeMessage endChargeMessage; |
| | | private ErrorMessageMessage errorMessageMessage; |
| | | private GroundLockRealTimeDataMessage groundLockRealTimeDataMessage; |
| | | private MotorAbortMessage motorAbortMessage; |
| | | private OnlineMessage onlineMessage; |
| | | private ParameterSettingMessage parameterSettingMessage; |
| | | private PingMessage pingMessage; |
| | | private PlatformRemoteUpdateReplyMessage platformRemoteUpdateReplyMessage; |
| | | private PlatformRestartReplyMessage platformRestartReplyMessage; |
| | | private PlatformStartChargingReplyMessage platformStartChargingReplyMessage; |
| | | private PlatformStopChargingReplyMessage platformStopChargingReplyMessage; |
| | | private QrCodeDeliveryMessage qrCodeDeliveryMessage; |
| | | private QrCodeDeliveryReplyMessage qrCodeDeliveryReplyMessage; |
| | | private QueryOfflineCardReplyMessage queryOfflineCardReplyMessage; |
| | | private SecurityDetectionMessage securityDetectionMessage; |
| | | private SetupBillingModelReplyMessage setupBillingModelReplyMessage; |
| | | private SynchronizeOfflineCardReplyMessage synchronizeOfflineCardReplyMessage; |
| | | private TimingSettingMessage timingSettingMessage; |
| | | private TimingSettingReplyMessage timingSettingReplyMessage; |
| | | private TransactionRecordMessage transactionRecordMessage; |
| | | private UpdateBalanceReplyMessage updateBalanceReplyMessage; |
| | | private UploadRealTimeMonitoringDataMessage uploadRealTimeMonitoringDataMessage; |
| | | private WorkingParameterSettingReplyMessage workingParameterSettingReplyMessage; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电桩计费模型请求 |
| | | **/ |
| | | |
| | | @Data |
| | | public class ChargingOrderMessage extends BaseMessage { |
| | | |
| | | private String orderNumber;// 订单编号 |
| | | private String soc;// soc |
| | | |
| | | } |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电桩返回数据(上行) |
| | | **/ |
| | | |
| | | @Data |
| | | public class ChargingPileReturnsGroundLockDataMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer control_state; // 地锁控制返回标志(1:鉴权成功,0:鉴权失败) |
| | | private String reserve; // 预留位 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电桩主动申请启动充电 |
| | | **/ |
| | | |
| | | @Data |
| | | public class ChargingPileStartsChargingMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer start_method; // 启动方式(1:表示通过刷卡启动充电,2:表示通过帐号启动充电(暂不支持),3:表示vin码启动充电) |
| | | private Integer need_password; // 是否需要密码(0:不需要,1:需要) |
| | | private String account; // 账号或者物理卡号 |
| | | private String password; // 输入密码 |
| | | private String vin; // "VIN 码,启动方式为vin码启动充电时上送,其他方式置零( ASCII码),VIN码需要反序上送 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 离线卡数据清除应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class ClearOfflineCardReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | private Integer clear_result1; // 清除标记(0:清除失败,1:清除成功) |
| | | private Integer clear_result2; |
| | | private Integer clear_result3; |
| | | private Integer clear_result4; |
| | | private Integer clear_result5; |
| | | private Integer clear_result6; |
| | | private Integer clear_result7; |
| | | private Integer clear_result8; |
| | | private Integer clear_result9; |
| | | private Integer clear_result10; |
| | | private Integer clear_result11; |
| | | private Integer clear_result12; |
| | | private Integer clear_result13; |
| | | private Integer clear_result14; |
| | | private Integer clear_result15; |
| | | private Integer clear_result16; |
| | | private Integer clear_result17; |
| | | private Integer clear_result18; |
| | | private Integer clear_result19; |
| | | private Integer clear_result20; |
| | | private Integer clear_result21; |
| | | private Integer clear_result22; |
| | | private Integer clear_result23; |
| | | private Integer clear_result24; |
| | | private Integer failure_cause1; // 失败原因(1:卡号格式错误,2:清除成功) |
| | | private Integer failure_cause2; |
| | | private Integer failure_cause3; |
| | | private Integer failure_cause4; |
| | | private Integer failure_cause5; |
| | | private Integer failure_cause6; |
| | | private Integer failure_cause7; |
| | | private Integer failure_cause8; |
| | | private Integer failure_cause9; |
| | | private Integer failure_cause10; |
| | | private Integer failure_cause11; |
| | | private Integer failure_cause12; |
| | | private Integer failure_cause13; |
| | | private Integer failure_cause14; |
| | | private Integer failure_cause15; |
| | | private Integer failure_cause16; |
| | | private Integer failure_cause17; |
| | | private Integer failure_cause18; |
| | | private Integer failure_cause19; |
| | | private Integer failure_cause20; |
| | | private Integer failure_cause21; |
| | | private Integer failure_cause22; |
| | | private Integer failure_cause23; |
| | | private Integer failure_cause24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电结束 |
| | | **/ |
| | | |
| | | @Data |
| | | public class EndChargeMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_battery_charging_status; // BMS 中止荷电状态 SOC |
| | | private BigDecimal bms_minimum_battery_voltage; // BMS 动力蓄电池单体最低电压 |
| | | private BigDecimal bms_maximum_battery_voltage; // BMS 动力蓄电池单体最高电压 |
| | | private BigDecimal bms_minimum_battery_temperature; // BMS 动力蓄电池最低温度 |
| | | private BigDecimal bms_maximum_battery_temperature; // BMS 动力蓄电池最高温度 |
| | | private BigDecimal cumulative_charging_time; // 电桩累计充电时间 |
| | | private BigDecimal output_energy; // 电桩输出能量 |
| | | private String charger_code; // 电桩充电机编号 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 错误报文 |
| | | */ |
| | | @Data |
| | | public class ErrorMessageMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charger_identification_0; // 接收 SPN2560=0x00 的充电机辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer charger_identification_170; // 接收 SPN2560=0xAA 的充电机辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charger_identification_reserve; // 预留位 |
| | | private Integer time_synchronization_and_maximum_output_charger; // 接收充电机的时间同步和充电机最大输出能力报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer charge_preparation; // 接收充电机完成充电准备报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charge_preparation_reserve; // 预留位 |
| | | private Integer charging_status; // 接收充电机充电状态报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer stop_charging; // 接收充电机中止充电报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charge_reserve; // 预留位 |
| | | private Integer charging_statistics; // 接收充电机充电统计报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_other; // BMS 其他 |
| | | private Integer bms_and_vehicle_identification; // 接收 BMS 和车辆的辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_and_vehicle_identification_reserve; // 预留位 |
| | | private Integer battery_charging_parameter; // 接收电池充电参数报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_completes_charging_preparation; // 接收 BMS 完成充电准备报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_completes_charging_preparation_reserve; // 预留位 |
| | | private Integer total_battery_charging_status; // 接收电池充电总状态报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer battery_charging_requirements; // 接收电池充电要求报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_stop_charging; // 接收 BMS 中止充电报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_reserve; // 预留位 |
| | | private Integer bms_charging_statistics; // 接收 BMS 充电统计报文超时0=正常,1=超时,10=不可信状态) |
| | | private String charger_other; // 充电机其他 |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 地锁数据上送(充电桩上送) |
| | | **/ |
| | | |
| | | @Data |
| | | public class GroundLockRealTimeDataMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer parking_lock_status; // 车位锁状态(0:未到位状态,1:升锁到位状态,2:降锁到位状态) |
| | | private Integer parking_status; // 车位状态(0:无车辆,1:停放车辆) |
| | | private Integer ground_locking_capacity; // 地锁电量状态 |
| | | private Integer alarm_status; // 报警状态(0:正常无报警,1:待机状态摇臂破坏,2:摇臂升降异常(未到位)) |
| | | private String reserve; // 预留位 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电桩计费模型请求 |
| | | **/ |
| | | |
| | | @Data |
| | | public class GunStatusMessage extends BaseMessage { |
| | | |
| | | private String fullNumber;// 枪完整编码 |
| | | |
| | | } |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电阶段充电机中止 |
| | | **/ |
| | | |
| | | @Data |
| | | public class MotorAbortMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charger_stops_charging_reason; // 充电机中止充电原因(1-2 位——达到充电机设定的条件中止,3-4 位——人工中止,5-6 位——异常中止) |
| | | private Integer charging_failure_cause; // 充电机中止充电故障原因(1-2 位——充电机过温故障,3-4 位——充电连接器故障,5-6 位——充电机内部过温故障,7-8 位——所需电量不能传送,9-10 位——充电机急停故障,11-12 位——其他故障,13-16 位——预留位) |
| | | private Integer charging_machine_stopped_charging_error_cause; // 充电机中止充电错误原因(1-2 位——电流不匹配,3-4 位——电压异常,5-8 位——预留位) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电桩登录认证 |
| | | **/ |
| | | |
| | | @Data |
| | | public class OnlineMessage extends BaseMessage { |
| | | private String charging_pile_code;// 充电桩编号 |
| | | private Integer charging_pile_type;// 充电桩类型(0 表示直流桩,1 表示交流桩) |
| | | private Integer charging_gun_number;// 充电枪数量 |
| | | private String protocol_version;// 通信协议版本 |
| | | private String program_version;// 程序版本 |
| | | private Integer network_link_type;// 网络链接类型(0:SIM 卡,1:LAN,2:WAN,3:其他) |
| | | private String sim;// Sim 卡 |
| | | private Integer operator;// 运营商(0: 移动,2:电信,3:联通,4:其他) |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 参数配置 |
| | | **/ |
| | | |
| | | @Data |
| | | public class ParameterSettingMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_maximum_charging_voltage; // BMS 单体动力蓄电池最高允许充电电压 |
| | | private BigDecimal bms_maximum_charging_current; // BMS 最高允许充电电流 |
| | | private BigDecimal bms_battery_total_energy; // BMS 动力蓄电池标称总能量 |
| | | private BigDecimal bms_total_charging_voltage; // BMS 最高允许充电总电压 |
| | | private BigDecimal bms_maximum_temperature; // BMS 最高允许温度 |
| | | private BigDecimal bms_battery_charging_status; // BMS 整车动力蓄电池荷电状态 (soc) |
| | | private BigDecimal bms_battery_voltage; // BMS 整车动力蓄电池当前电池 电压 |
| | | private BigDecimal maximum_output_voltage; // 电桩最高输出电压 |
| | | private BigDecimal minimum_output_voltage; // 电桩最低输出电压 |
| | | private BigDecimal maximum_output_current; // 电桩最大输出电流 |
| | | private BigDecimal minimum_output_current; // 电桩最小输出电流 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电桩心跳包 |
| | | **/ |
| | | |
| | | @Data |
| | | public class PingMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private Integer charging_gun_status;// 抢状态(0:正常,1:故障) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 远程更新应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class PlatformRemoteUpdateReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer escalation_state; // 升级状态(0:成功,1:编码错误,2:程序与桩型号不符,3:下载更新文件超时) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 远程重启应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class PlatformRestartReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; // 设置结果(0:失败,1:成功) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 远程启机命令回复 |
| | | **/ |
| | | |
| | | @Data |
| | | public class PlatformStartChargingReplyMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer startup_result; // 启动结果(0:失败,1:成功) |
| | | private Integer failure_cause; // "失败原因(0:无,1:设备编号不匹配,2:枪已在充电,3:设备故障,4:设备离线,5:未插枪桩在收到启充命令后,检测到未插枪则发送 0x33 报文回复充电失败。若在 60 秒(以收到 0x34 时间开始计算)内检测到枪重新连接,则补送 0x33 成功报文;超时或者离线等其他异常,桩不启充、不补发 0x33 报文)" |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 远程停机命令回复 |
| | | **/ |
| | | |
| | | @Data |
| | | public class PlatformStopChargingReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer stop_result; // 停止结果(0:失败,1:成功) |
| | | private Integer failure_cause; // 失败原因(0:无,1:设备编号不匹配,2:枪未处于充电状态,3:其他) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | **/ |
| | | |
| | | @Data |
| | | public class QrCodeDeliveryMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 枪编码 |
| | | private Integer code_format; // "0:第一种前缀+桩编号 1:第二种前缀+桩编号+枪编号" |
| | | private Integer prefix_length; // 二维码前缀长度长度最大不超过200 字节 |
| | | private String code_prefix; // 如:“www.baidu.com?No=” |
| | | private String qr_code; // 二维码内容,如:“www.baidu.com?No=3422000100023301” |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | **/ |
| | | |
| | | @Data |
| | | public class QrCodeDeliveryReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private Integer delivery_result; // 设置结果(0:成功,1:失败) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 离线卡数据查询应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class QueryOfflineCardReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | private Integer query_result1; // 查询结果(0:不存在,1:存在) |
| | | private Integer query_result2; |
| | | private Integer query_result3; |
| | | private Integer query_result4; |
| | | private Integer query_result5; |
| | | private Integer query_result6; |
| | | private Integer query_result7; |
| | | private Integer query_result8; |
| | | private Integer query_result9; |
| | | private Integer query_result10; |
| | | private Integer query_result11; |
| | | private Integer query_result12; |
| | | private Integer query_result13; |
| | | private Integer query_result14; |
| | | private Integer query_result15; |
| | | private Integer query_result16; |
| | | private Integer query_result17; |
| | | private Integer query_result18; |
| | | private Integer query_result19; |
| | | private Integer query_result20; |
| | | private Integer query_result21; |
| | | private Integer query_result22; |
| | | private Integer query_result23; |
| | | private Integer query_result24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | **/ |
| | | |
| | | @Data |
| | | public class SecurityDetectionMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer secure_connection; // 车枪连接(0=未连接,1=连接) |
| | | private Integer nsulation_detection; // 绝缘检测(0=安全,1=不安全) |
| | | private Integer electronic_lock_lock; // 电磁锁状态(0=未锁,1=已锁) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 计费模型应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class SetupBillingModelReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String set_result; //设置结果(0:失败,1:成功) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 卡数据同步应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class SynchronizeOfflineCardReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer save_result; // 保存结果(0:失败,1:成功) |
| | | private Integer failure_cause; // 失败原因(1:卡号格式错误,2:储存空间不足) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 对时设置 |
| | | **/ |
| | | |
| | | @Data |
| | | public class TimingSettingMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 对时设置应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class TimingSettingReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 交易记录 |
| | | **/ |
| | | |
| | | @Data |
| | | public class TransactionRecordMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String start_time;// 开始时间 |
| | | private String end_time;// 结束时间 |
| | | private BigDecimal total_electricity;// 总电量 |
| | | private BigDecimal loss_total_electricity;// 计损总电量 |
| | | private BigDecimal payment_amount;// 消费金额 |
| | | private Integer method;// 交易标识(1:app 启动,2:卡启动,4:离线卡启动,5: vin 码启动充电) |
| | | private String trade_date;// 交易日期、时间 |
| | | private Integer stop_reason;// 停止原因 |
| | | private String physical_card_number;// 物理卡号 |
| | | private String billing_model_code1;// 计费模型编号 |
| | | private BigDecimal spike_charge1;// 尖电量 |
| | | private BigDecimal loss_spike_charge1;// 计损尖电量 |
| | | private BigDecimal spike_amount1;// 尖金额 |
| | | private BigDecimal flat_charge1;// 平电量 |
| | | private BigDecimal loss_flat_charge1;// 计损平电量 |
| | | private BigDecimal flat_amount1;// 平金额 |
| | | private BigDecimal peak_charge1;// 峰电量 |
| | | private BigDecimal loss_peak_charge1;// 计损峰电量 |
| | | private BigDecimal peak_amount1;// 峰金额 |
| | | private BigDecimal valley_charge1;// 谷电量 |
| | | private BigDecimal loss_valley_charge1;// 计损谷电量 |
| | | private BigDecimal valley_amount1;// 谷金额 |
| | | private String billing_model_code2;// 计费模型编号 |
| | | private BigDecimal spike_charge2;// 尖电量 |
| | | private BigDecimal loss_spike_charge2;// 计损尖电量 |
| | | private BigDecimal spike_amount2;// 尖金额 |
| | | private BigDecimal flat_charge2;// 平电量 |
| | | private BigDecimal loss_flat_charge2;// 计损平电量 |
| | | private BigDecimal flat_amount2;// 平金额 |
| | | private BigDecimal peak_charge2;// 峰电量 |
| | | private BigDecimal loss_peak_charge2;// 计损峰电量 |
| | | private BigDecimal peak_amount2;// 峰金额 |
| | | private BigDecimal valley_charge2;// 谷电量 |
| | | private BigDecimal loss_valley_charge2;// 计损谷电量 |
| | | private BigDecimal valley_amount2;// 谷金额 |
| | | private String billing_model_code3;// 计费模型编号 |
| | | private BigDecimal spike_charge3;// 尖电量 |
| | | private BigDecimal loss_spike_charge3;// 计损尖电量 |
| | | private BigDecimal spike_amount3;// 尖金额 |
| | | private BigDecimal flat_charge3;// 平电量 |
| | | private BigDecimal loss_flat_charge3;// 计损平电量 |
| | | private BigDecimal flat_amount3;// 平金额 |
| | | private BigDecimal peak_charge3;// 峰电量 |
| | | private BigDecimal loss_peak_charge3;// 计损峰电量 |
| | | private BigDecimal peak_amount3;// 峰金额 |
| | | private BigDecimal valley_charge3;// 谷电量 |
| | | private BigDecimal loss_valley_charge3;// 计损谷电量 |
| | | private BigDecimal valley_amount3;// 谷金额 |
| | | private String billing_model_code4;// 计费模型编号 |
| | | private BigDecimal spike_charge4;// 尖电量 |
| | | private BigDecimal loss_spike_charge4;// 计损尖电量 |
| | | private BigDecimal spike_amount4;// 尖金额 |
| | | private BigDecimal flat_charge4;// 平电量 |
| | | private BigDecimal loss_flat_charge4;// 计损平电量 |
| | | private BigDecimal flat_amount4;// 平金额 |
| | | private BigDecimal peak_charge4;// 峰电量 |
| | | private BigDecimal loss_peak_charge4;// 计损峰电量 |
| | | private BigDecimal peak_amount4;// 峰金额 |
| | | private BigDecimal valley_charge4;// 谷电量 |
| | | private BigDecimal loss_valley_charge4;// 计损谷电量 |
| | | private BigDecimal valley_amount4;// 谷金额 |
| | | private String billing_model_code5;// 计费模型编号 |
| | | private BigDecimal spike_charge5;// 尖电量 |
| | | private BigDecimal loss_spike_charge5;// 计损尖电量 |
| | | private BigDecimal spike_amount5;// 尖金额 |
| | | private BigDecimal flat_charge5;// 平电量 |
| | | private BigDecimal loss_flat_charge5;// 计损平电量 |
| | | private BigDecimal flat_amount5;// 平金额 |
| | | private BigDecimal peak_charge5;// 峰电量 |
| | | private BigDecimal loss_peak_charge5;// 计损峰电量 |
| | | private BigDecimal peak_amount5;// 峰金额 |
| | | private BigDecimal valley_charge5;// 谷电量 |
| | | private BigDecimal loss_valley_charge5;// 计损谷电量 |
| | | private BigDecimal valley_amount5;// 谷金额 |
| | | private String billing_model_code6;// 计费模型编号 |
| | | private BigDecimal spike_charge6;// 尖电量 |
| | | private BigDecimal loss_spike_charge6;// 计损尖电量 |
| | | private BigDecimal spike_amount6;// 尖金额 |
| | | private BigDecimal flat_charge6;// 平电量 |
| | | private BigDecimal loss_flat_charge6;// 计损平电量 |
| | | private BigDecimal flat_amount6;// 平金额 |
| | | private BigDecimal peak_charge6;// 峰电量 |
| | | private BigDecimal loss_peak_charge6;// 计损峰电量 |
| | | private BigDecimal peak_amount6;// 峰金额 |
| | | private BigDecimal valley_charge6;// 谷电量 |
| | | private BigDecimal loss_valley_charge6;// 计损谷电量 |
| | | private BigDecimal valley_amount6;// 谷金额 |
| | | private String billing_model_code7;// 计费模型编号 |
| | | private BigDecimal spike_charge7;// 尖电量 |
| | | private BigDecimal loss_spike_charge7;// 计损尖电量 |
| | | private BigDecimal spike_amount7;// 尖金额 |
| | | private BigDecimal flat_charge7;// 平电量 |
| | | private BigDecimal loss_flat_charge7;// 计损平电量 |
| | | private BigDecimal flat_amount7;// 平金额 |
| | | private BigDecimal peak_charge7;// 峰电量 |
| | | private BigDecimal loss_peak_charge7;// 计损峰电量 |
| | | private BigDecimal peak_amount7;// 峰金额 |
| | | private BigDecimal valley_charge7;// 谷电量 |
| | | private BigDecimal loss_valley_charge7;// 计损谷电量 |
| | | private BigDecimal valley_amount7;// 谷金额 |
| | | private String billing_model_code8;// 计费模型编号 |
| | | private BigDecimal spike_charge8;// 尖电量 |
| | | private BigDecimal loss_spike_charge8;// 计损尖电量 |
| | | private BigDecimal spike_amount8;// 尖金额 |
| | | private BigDecimal flat_charge8;// 平电量 |
| | | private BigDecimal loss_flat_charge8;// 计损平电量 |
| | | private BigDecimal flat_amount8;// 平金额 |
| | | private BigDecimal peak_charge8;// 峰电量 |
| | | private BigDecimal loss_peak_charge8;// 计损峰电量 |
| | | private BigDecimal peak_amount8;// 峰金额 |
| | | private BigDecimal valley_charge8;// 谷电量 |
| | | private BigDecimal loss_valley_charge8;// 计损谷电量 |
| | | private BigDecimal valley_amount8;// 谷金额 |
| | | private String billing_model_code9;// 计费模型编号 |
| | | private BigDecimal spike_charge9;// 尖电量 |
| | | private BigDecimal loss_spike_charge9;// 计损尖电量 |
| | | private BigDecimal spike_amount9;// 尖金额 |
| | | private BigDecimal flat_charge9;// 平电量 |
| | | private BigDecimal loss_flat_charge9;// 计损平电量 |
| | | private BigDecimal flat_amount9;// 平金额 |
| | | private BigDecimal peak_charge9;// 峰电量 |
| | | private BigDecimal loss_peak_charge9;// 计损峰电量 |
| | | private BigDecimal peak_amount9;// 峰金额 |
| | | private BigDecimal valley_charge9;// 谷电量 |
| | | private BigDecimal loss_valley_charge9;// 计损谷电量 |
| | | private BigDecimal valley_amount9;// 谷金额 |
| | | private String billing_model_code10;// 计费模型编号 |
| | | private BigDecimal spike_charge10;// 尖电量 |
| | | private BigDecimal loss_spike_charge10;// 计损尖电量 |
| | | private BigDecimal spike_amount10;// 尖金额 |
| | | private BigDecimal flat_charge10;// 平电量 |
| | | private BigDecimal loss_flat_charge10;// 计损平电量 |
| | | private BigDecimal flat_amount10;// 平金额 |
| | | private BigDecimal peak_charge10;// 峰电量 |
| | | private BigDecimal loss_peak_charge10;// 计损峰电量 |
| | | private BigDecimal peak_amount10;// 峰金额 |
| | | private BigDecimal valley_charge10;// 谷电量 |
| | | private BigDecimal loss_valley_charge10;// 计损谷电量 |
| | | private BigDecimal valley_amount10;// 谷金额 |
| | | private String billing_model_code11;// 计费模型编号 |
| | | private BigDecimal spike_charge11;// 尖电量 |
| | | private BigDecimal loss_spike_charge11;// 计损尖电量 |
| | | private BigDecimal spike_amount11;// 尖金额 |
| | | private BigDecimal flat_charge11;// 平电量 |
| | | private BigDecimal loss_flat_charge11;// 计损平电量 |
| | | private BigDecimal flat_amount11;// 平金额 |
| | | private BigDecimal peak_charge11;// 峰电量 |
| | | private BigDecimal loss_peak_charge11;// 计损峰电量 |
| | | private BigDecimal peak_amount11;// 峰金额 |
| | | private BigDecimal valley_charge11;// 谷电量 |
| | | private BigDecimal loss_valley_charge11;// 计损谷电量 |
| | | private BigDecimal valley_amount11;// 谷金额 |
| | | private String billing_model_code12;// 计费模型编号 |
| | | private BigDecimal spike_charge12;// 尖电量 |
| | | private BigDecimal loss_spike_charge12;// 计损尖电量 |
| | | private BigDecimal spike_amount12;// 尖金额 |
| | | private BigDecimal flat_charge12;// 平电量 |
| | | private BigDecimal loss_flat_charge12;// 计损平电量 |
| | | private BigDecimal flat_amount12;// 平金额 |
| | | private BigDecimal peak_charge12;// 峰电量 |
| | | private BigDecimal loss_peak_charge12;// 计损峰电量 |
| | | private BigDecimal peak_amount12;// 峰金额 |
| | | private BigDecimal valley_charge12;// 谷电量 |
| | | private BigDecimal loss_valley_charge12;// 计损谷电量 |
| | | private BigDecimal valley_amount12;// 谷金额 |
| | | private String result;//原始字符串 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 余额更新应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class UpdateBalanceReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card_number; //物理卡号 |
| | | private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 上传实时监测数据 |
| | | **/ |
| | | |
| | | @Data |
| | | public class UploadRealTimeMonitoringDataMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charging_gun_status; // 状态(0:离线,1:故障,2:空闲,3:充电) |
| | | private Integer homing_status; // 枪是否归位(0:否,1:是,2:未知) |
| | | private Integer insertion_status; // 是否插枪(0:否,1:是) |
| | | private BigDecimal output_voltage; // 输出电压,精确到小数点后一位;待机置零 |
| | | private BigDecimal output_current; // 输出电流,精确到小数点后一位;待机置零 |
| | | private BigDecimal gun_line_temperature; // 枪线温度,整形,偏移量-50;待机置零 |
| | | private String gun_line_code; // 枪线编码,没有置零 |
| | | private Integer soc; // SOC待机置零;交流桩置零 |
| | | private BigDecimal battery_temperature; // 电池组最高温度,整形,偏移量-50 ºC;待机置零;交流桩置零 |
| | | private Integer cumulative_charging_time; // 累计充电时间,单位:min;待机置零 |
| | | private Integer time_remaining; // 剩余时间,单位:min;待机置零、交流桩置零 |
| | | private BigDecimal charging_degree; // 充电度数,精确到小数点后四位;待机置零 |
| | | 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:门打开) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电桩工作参数设置应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class WorkingParameterSettingReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; //设置结果(0:失败,1:成功) |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.jianguan.rocket.produce; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | |
| | | import com.ruoyi.jianguan.rocket.base.GunStatusMessage; |
| | | import com.ruoyi.jianguan.rocket.base.JianGuanMessage; |
| | | import com.ruoyi.jianguan.rocket.util.EnhanceMessageHandler; |
| | | import com.ruoyi.jianguan.util.ChuanYiChongSuperviseUtil; |
| | | import com.ruoyi.jianguan.util.SendTagConstant; |
| | | import com.ruoyi.jianguan.util.TCECSuperviseUtil; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | |
| | |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private TCECSuperviseUtil tcecSuperviseUtil; |
| | | @Resource |
| | | private ChuanYiChongSuperviseUtil chuanYiChongSuperviseUtil; |
| | | |
| | | private final static String operatorId = "906171535"; |
| | | |
| | |
| | | supEquipChargeStatus.setEndTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| | | supEquipChargeStatus.setTotalPower(chargingOrder2.getElectrovalence()); |
| | | tcecSuperviseUtil.notificationSupEquipChargeStatus(new Operator(), supEquipChargeStatus); |
| | | // 川逸充 |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("StartChargeSeq",chargingOrder2.getCode()); |
| | | jsonObject.put("ConnectorID",chargingGun2.getFullNumber()); |
| | | //状态(0=未知,1=等待中/已插枪,2=启动中,3=充电中,4=停止中,5=已结束) |
| | | int tempStatus = 0; |
| | | switch (chargingOrder2.getStatus()){ |
| | | case 1: |
| | | tempStatus=1; |
| | | |
| | | case 2: |
| | | tempStatus=1; |
| | | jsonObject.put("StartChargeSeqStat",tempStatus); |
| | | LocalDateTime startTime = chargingOrder2.getStartTime(); |
| | | if (startTime!=null){ |
| | | jsonObject.put("StartTime",startTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | }else{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("StartTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | chuanYiChongSuperviseUtil.notificationStationStatus(new Operator(), jsonObject); |
| | | break; |
| | | case 4: |
| | | |
| | | case 5: |
| | | jsonObject.put("StartChargeSeqStat",4); |
| | | int temp = 0; |
| | | //充电枪状态(1=离线,2=空闲,3=占用(未充电),4=占用(充电中),5=占用(已充满),6=占用(预约锁定),7=故障) |
| | | switch (chargingGun2.getStatus()){ |
| | | case 1: |
| | | temp = 0; |
| | | break; |
| | | case 2: |
| | | temp=1; |
| | | break; |
| | | case 3: |
| | | temp=2; |
| | | break; |
| | | case 4: |
| | | temp=3; |
| | | break; |
| | | case 5: |
| | | temp=4; |
| | | break; |
| | | case 6: |
| | | temp=4; |
| | | break; |
| | | case 7: |
| | | temp = 255; |
| | | break; |
| | | } |
| | | jsonObject.put("ConnectorStatus",temp); |
| | | |
| | | jsonObject.put("CurrentA",chargingOrder2.getCurrent()); |
| | | jsonObject.put("VoltageA",chargingOrder2.getVoltage()); |
| | | LocalDateTime startTime2 = chargingOrder2.getStartTime(); |
| | | |
| | | if (startTime2!=null){ |
| | | jsonObject.put("StartTime",startTime2.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | }else{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("StartTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("EndTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | jsonObject.put("TotalPower",chargingOrder2.getElectricity()); |
| | | jsonObject.put("TotalMoney",chargingOrder2.getOrderAmount()); |
| | | chuanYiChongSuperviseUtil.notificationSupEquipChargeStatus(new Operator(), jsonObject); |
| | | break; |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(JianGuanMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
New file |
| | |
| | | package com.ruoyi.jianguan.util; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.JacksonUtils; |
| | | import com.fasterxml.jackson.databind.MapperFeature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.jianguan.model.*; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * 中电联TCEC标准 |
| | | * @author zhibing.pu |
| | | * @Date 2025/1/21 11:48 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class ChuanYiChongSuperviseUtil { |
| | | // 测试环境 |
| | | // private static final String OperatorID = "MA01H3BQ2"; |
| | | // private static final String OperatorSecret = "f1331ef0b37c2d1b"; |
| | | // private static final String SigSecret = "a6fedf0e1b27d6f7"; |
| | | // private static final String DataSecret = "50a61b93919c9604"; |
| | | // private static final String DataSecretIV = "7c8ac6861661d584"; |
| | | // private final static String url = "https://dev-gov-hlht-sc.unievbj.com/evcs/v1.0.0"; |
| | | |
| | | // 正式环境 |
| | | private static final String OperatorID = "906171535"; |
| | | private static final String OperatorSecret = "9jG8qysc5RxdbjvnvdmuRYQg6J82Fwj1"; |
| | | private static final String SigSecret = "RruzbZxnr74tqxe1"; |
| | | private static final String DataSecret = "3QJXn4MSj78zcpW1"; |
| | | private static final String DataSecretIV = "jhqj64V9gX8NHbu1"; |
| | | private final static String url = "https://dataexchange.cdczpt.com/shevcs/v1"; |
| | | |
| | | private final static String query_token = "/query_token"; |
| | | |
| | | |
| | | |
| | | private static final String OurDataSecret = "50a61b93919c9605"; |
| | | private static final String OurDataSecretIV = "7c8ac6861661d585"; |
| | | private static final String OurSigSecret = "a6fedf0e1b27d6f6"; |
| | | private static final String OurOperatorID = "MA01H3BQ3"; |
| | | private static final String OurOperatorSecret = "f1331ef0b37c2d1a"; |
| | | @Autowired |
| | | private RedisService redisService; |
| | | public static final String TOKEN_KEY = "charge_token:"; |
| | | /** |
| | | * 获取token |
| | | */ |
| | | |
| | | /** |
| | | * 推送充电设备接口状态信息 |
| | | */ |
| | | private final static String supervise_notification_station_status = "/supervise_notification_station_status"; |
| | | /** |
| | | *推送充电开始 |
| | | */ |
| | | private final static String supervise_notification_equip_charge_status = "/notification_start_charge_result"; |
| | | /** |
| | | *推送充电结束 |
| | | */ |
| | | private final static String supervise_notification_equip_charge_status_end = "/notification_equip_charge_status"; |
| | | /** |
| | | *推送充电订单信息 |
| | | */ |
| | | private final static String supervise_notification_charge_order_info = "/supervise_notification_charge_order_info"; |
| | | private final static String supervise_notification_operation_stats_info = "/supervise_notification_operation_stats_info"; |
| | | private final static String supervise_notification_realtime_power_info = "/supervise_notification_realtime_power_info"; |
| | | private final static String supervise_notification_station_info = "/supervise_notification_station_info"; |
| | | /** 获取token |
| | | */ |
| | | // public String queryToken(){ |
| | | // String token = redisService.getCacheObject(TOKEN_KEY); |
| | | // if(StringUtils.hasLength(token)){ |
| | | // return token; |
| | | // } |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.put("OperatorID", OperatorID); |
| | | // jsonObject.put("OperatorSecret", OperatorSecret); |
| | | // String params = jsonObject.toJSONString(); |
| | | // // 参数加密 |
| | | // String data = AesEncryption.encrypt(DataSecret, DataSecretIV, params); |
| | | // // 获取签名 |
| | | // String timeStamp = System.currentTimeMillis() + ""; |
| | | // SequenceGenerator generator = new SequenceGenerator(); |
| | | // String nextSequence = generator.getNextSequence(); |
| | | // String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp, data,nextSequence,SigSecret); |
| | | // jsonObject = new JSONObject(); |
| | | // jsonObject.put("OperatorID", OperatorID); |
| | | // jsonObject.put("Data", data); |
| | | // jsonObject.put("TimeStamp", timeStamp); |
| | | // jsonObject.put("Seq", nextSequence); |
| | | // jsonObject.put("Sig", hmacMD5); |
| | | // String result = HttpUtils.sendPost(url+query_token, jsonObject.toJSONString()); |
| | | // String string = JSONObject.parseObject(result).getString("Data"); |
| | | // String decrypt = AesEncryption.decrypt(DataSecret, DataSecretIV, string); |
| | | // JSONObject tokenResult = JSONObject.parseObject(decrypt); |
| | | // token = tokenResult.getString("AccessToken"); |
| | | // Integer TokenAvailableTime = tokenResult.getInteger("TokenAvailableTime"); |
| | | // redisService.setCacheObject(TOKEN_KEY,token, (long) (TokenAvailableTime - 60), TimeUnit.SECONDS); |
| | | // return token; |
| | | // } |
| | | public String queryToken(){ |
| | | HttpRequest post = HttpUtil.createPost(url + query_token); |
| | | JSONObject info = new JSONObject(); |
| | | info.put("OperatorID", "906171535"); |
| | | info.put("OperatorSecret", OperatorSecret); |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | baseRequest.setOperatorID("906171535"); |
| | | baseRequest.setTimeStamp(timeStamp+""); |
| | | baseRequest.setSeq("0001"); |
| | | String jsonString = JacksonUtils.toJson(info); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | String data = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", data,nextSequence,SigSecret); |
| | | baseRequest.setData(data); |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | log.info("获取三方平台授权token请求地址:" + post.getUrl()); |
| | | log.info("获取三方平台授权token请求参数:" + request_json); |
| | | log.info("获取三方平台授权token请求Data:" + jsonString); |
| | | post.body(request_json); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("获取三方平台授权token失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("获取三方平台授权token响应参数:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("获取三方平台授权token失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("获取三方平台授权token响应Data:" + decrypt); |
| | | QueryTokenResult queryTokenResult = JSON.parseObject(decrypt, QueryTokenResult.class); |
| | | String token = queryTokenResult.getAccessToken(); |
| | | // Long tokenAvailableTime = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC) + queryTokenResult.getTokenAvailab |
| | | return token; |
| | | } |
| | | |
| | | /** |
| | | * 川逸充开始充电推送 |
| | | * @param info |
| | | */ |
| | | public NotificationStationStatusResult notificationStationStatus(Operator operator, com.alibaba.fastjson2.JSONObject info) { |
| | | HttpRequest post = HttpUtil.createPost(url+supervise_notification_equip_charge_status); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台充电开始状态失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台设备状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台充电开始状态失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台设备状态Data:" + decrypt); |
| | | NotificationStationStatusResult notificationStationStatusResult = JSON.parseObject(decrypt, NotificationStationStatusResult.class); |
| | | return notificationStationStatusResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推动充电结束状态 |
| | | * @param info |
| | | * @return |
| | | */ |
| | | |
| | | /** |
| | | * 推动充电结束状态 |
| | | * @param info |
| | | * @return |
| | | */ |
| | | public NotificationEquipChargeStatusResult notificationSupEquipChargeStatus(Operator operator, com.alibaba.fastjson2.JSONObject info){ |
| | | HttpRequest post = HttpUtil.createPost(url+supervise_notification_equip_charge_status_end); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送川逸充平台充电结束状态失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送川逸充平台充电结束状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送川逸充平台充电结束状态失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送川逸充充电结束.状态Data:" + decrypt); |
| | | NotificationEquipChargeStatusResult notificationEquipChargeStatusResult = JSON.parseObject(decrypt, NotificationEquipChargeStatusResult.class); |
| | | return notificationEquipChargeStatusResult; |
| | | } |
| | | |
| | | |
| | | // /** |
| | | // * 推送充电订单信息 |
| | | // * @param info |
| | | // * @return |
| | | // */ |
| | | // public NotificationChargeOrderInfoResult notificationChargeOrderInfo(Operator operator, SupChargeOrderInfo info){ |
| | | // HttpRequest post = HttpUtil.createPost(url+supervise_notification_charge_order_info); |
| | | // if (info.getOrderStatus()!=null){ |
| | | // switch (info.getOrderStatus()){ |
| | | // case -1: |
| | | // info.setOrderStatus(7); |
| | | // break; |
| | | // case 0: |
| | | // info.setOrderStatus(7); |
| | | // break; |
| | | // case 1: |
| | | // info.setOrderStatus(1); |
| | | // break; |
| | | // case 2: |
| | | // info.setOrderStatus(1); |
| | | // |
| | | // break; |
| | | // case 3: |
| | | // info.setOrderStatus(2); |
| | | // break; |
| | | // case 4: |
| | | // info.setOrderStatus(3); |
| | | // break; |
| | | // case 5: |
| | | // info.setOrderStatus(4); |
| | | // break; |
| | | // } |
| | | // }else{ |
| | | // info.setOrderStatus(5); |
| | | // } |
| | | // buildBody(post, info, operator); |
| | | // HttpResponse execute = post.execute(); |
| | | // if(200 != execute.getStatus()){ |
| | | // log.error("推送三方平台充电订单信息失败:" + execute.body()); |
| | | // return null; |
| | | // } |
| | | // log.info("推送三方平台充电订单信息响应:" + execute.body()); |
| | | // BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | // Integer Ret = baseResult.getRet(); |
| | | // if(0 != Ret){ |
| | | // log.error("推送三方平台充电订单信息失败:" + baseResult.getMsg()); |
| | | // return null; |
| | | // } |
| | | // //解密参数 |
| | | // String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | // log.info("推送三方平台充电订单信息Data:" + decrypt); |
| | | // NotificationChargeOrderInfoResult notificationChargeOrderInfoResult = JSON.parseObject(decrypt, NotificationChargeOrderInfoResult.class); |
| | | // return notificationChargeOrderInfoResult; |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 构建请求参数和消息头 |
| | | * @param post |
| | | * @param |
| | | */ |
| | | public void buildBody(HttpRequest post, com.alibaba.fastjson2.JSONObject o, Operator operator){ |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | post.header("Authorization", "Bearer " + queryToken()); |
| | | BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | baseRequest.setOperatorID("906171535"); |
| | | baseRequest.setTimeStamp(timeStamp+""); |
| | | baseRequest.setSeq("0001"); |
| | | |
| | | |
| | | String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,o.toJSONString()); |
| | | // String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | |
| | | baseRequest.setData(encrypt); |
| | | baseRequest.setOperator(operator); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", encrypt,nextSequence,SigSecret); |
| | | // String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp, data,nextSequence,OurSigSecret); |
| | | |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | post.body(request_json); |
| | | log.info("推送三方平台请求地址:" + post.getUrl()); |
| | | log.info("推送三方平台请求参数:" + request_json); |
| | | log.info("推送三方平台请求Data:" + o.toJSONString()); |
| | | } |
| | | /** |
| | | * 构建请求参数和消息头 |
| | | * @param |
| | | */ |
| | | // public void buildBodyStatus(HttpRequest post, SupStationPowerInfoResult info, Operator operator){ |
| | | // Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | // post.contentType("application/json;charset=utf-8"); |
| | | // post.header("Authorization", "Bearer " + queryToken()); |
| | | // BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | // baseRequest.setOperatorID("906171535"); |
| | | // baseRequest.setTimeStamp(timeStamp+""); |
| | | // baseRequest.setSeq("0001"); |
| | | // String request_json1 = JacksonUtils.toJson(info); |
| | | // String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,request_json1); |
| | | //// String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | // |
| | | // baseRequest.setData(encrypt); |
| | | // baseRequest.setOperator(operator); |
| | | // SequenceGenerator generator = new SequenceGenerator(); |
| | | // String nextSequence = generator.getNextSequence(); |
| | | // |
| | | // String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", encrypt,nextSequence,SigSecret); |
| | | //// String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp, data,nextSequence,OurSigSecret); |
| | | // |
| | | // baseRequest.setSig(hmacMD5); |
| | | // String request_json = JacksonUtils.toJson(baseRequest); |
| | | // post.body(request_json); |
| | | // log.info("推送三方平台请求地址:" + post.getUrl()); |
| | | // log.info("推送三方平台请求参数:" + request_json); |
| | | // log.info("推送三方平台请求Data:" + request_json1); |
| | | // } |
| | | public static void main(String[] args) { |
| | | // HttpRequest post = HttpUtil.createPost(url + query_token); |
| | | // JSONObject info = new JSONObject(); |
| | | // info.put("OperatorID", "906171535"); |
| | | // info.put("OperatorSecret", OperatorSecret); |
| | | // Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | // post.contentType("application/json;charset=utf-8"); |
| | | // BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | // baseRequest.setOperatorID("906171535"); |
| | | // baseRequest.setTimeStamp(timeStamp+""); |
| | | // baseRequest.setSeq("0001"); |
| | | // String jsonString = JacksonUtils.toJson(info); |
| | | // SequenceGenerator generator = new SequenceGenerator(); |
| | | // String nextSequence = generator.getNextSequence(); |
| | | // String data = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | // String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", data,nextSequence,SigSecret); |
| | | // baseRequest.setData(data); |
| | | // baseRequest.setSig(hmacMD5); |
| | | // String request_json = JacksonUtils.toJson(baseRequest); |
| | | // log.info("获取三方平台授权token请求地址:" + post.getUrl()); |
| | | // log.info("获取三方平台授权token请求参数:" + request_json); |
| | | // log.info("获取三方平台授权token请求Data:" + jsonString); |
| | | // post.body(request_json); |
| | | // HttpResponse execute = post.execute(); |
| | | // if(200 != execute.getStatus()){ |
| | | // log.error("获取三方平台授权token失败:" + execute.body()); |
| | | // } |
| | | // log.info("获取三方平台授权token响应参数:" + execute.body()); |
| | | // BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | // Integer Ret = baseResult.getRet(); |
| | | // if(0 != Ret){ |
| | | // log.error("获取三方平台授权token失败:" + baseResult.getMsg()); |
| | | // } |
| | | // //解密参数 |
| | | // String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | // log.info("获取三方平台授权token响应Data:" + decrypt); |
| | | // QueryTokenResult queryTokenResult = JSON.parseObject(decrypt, QueryTokenResult.class); |
| | | // String token = queryTokenResult.getAccessToken(); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.util; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.JacksonUtils; |
| | | import com.fasterxml.jackson.databind.MapperFeature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.jianguan.model.*; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * 中电联TCEC标准 |
| | | * @author zhibing.pu |
| | | * @Date 2025/1/21 11:48 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class ChuanYiChongUtil { |
| | | // 测试环境 |
| | | // private static final String OperatorID = "MA01H3BQ2"; |
| | | // private static final String OperatorSecret = "f1331ef0b37c2d1b"; |
| | | // private static final String SigSecret = "a6fedf0e1b27d6f7"; |
| | | // private static final String DataSecret = "50a61b93919c9604"; |
| | | // private static final String DataSecretIV = "7c8ac6861661d584"; |
| | | // private final static String url = "https://dev-gov-hlht-sc.unievbj.com/evcs/v1.0.0"; |
| | | |
| | | // 正式环境 |
| | | private static final String OperatorID = "MA6CC2LK7"; |
| | | private static final String OperatorSecret = "9jG8qysc5RxdbjvnvdmuRYQg6J82FwjL"; |
| | | private static final String SigSecret = "RruzbZxnr74tqxeW"; |
| | | private static final String DataSecret = "3QJXn4MSj78zcpWF"; |
| | | private static final String DataSecretIV = "jhqj64V9gX8NHbuf"; |
| | | private final static String url = "https://hlht-dipper-sc.unievbj.com/evcs/v1.0.0"; |
| | | |
| | | private final static String query_token = "/query_token"; |
| | | |
| | | |
| | | |
| | | private static final String OurDataSecret = "50a61b93919c9605"; |
| | | private static final String OurDataSecretIV = "7c8ac6861661d585"; |
| | | private static final String OurSigSecret = "a6fedf0e1b27d6f6"; |
| | | private static final String OurOperatorID = "MA01H3BQ3"; |
| | | private static final String OurOperatorSecret = "f1331ef0b37c2d1a"; |
| | | @Autowired |
| | | private RedisService redisService; |
| | | public static final String TOKEN_KEY = "charge_token:"; |
| | | /** |
| | | * 获取token |
| | | */ |
| | | |
| | | /** |
| | | * 推送充电设备接口状态信息 |
| | | */ |
| | | private final static String supervise_notification_station_status = "/supervise_notification_station_status"; |
| | | /** |
| | | *推送充电状态信息 |
| | | */ |
| | | private final static String supervise_notification_equip_charge_status = "/supervise_notification_equip_charge_status"; |
| | | /** |
| | | *推送充电订单信息 |
| | | */ |
| | | private final static String supervise_notification_charge_order_info = "/supervise_notification_charge_order_info"; |
| | | private final static String supervise_notification_operation_stats_info = "/supervise_notification_operation_stats_info"; |
| | | private final static String supervise_notification_realtime_power_info = "/supervise_notification_realtime_power_info"; |
| | | private final static String supervise_notification_station_info = "/supervise_notification_station_info"; |
| | | /** 获取token |
| | | */ |
| | | // public String queryToken(){ |
| | | // String token = redisService.getCacheObject(TOKEN_KEY); |
| | | // if(StringUtils.hasLength(token)){ |
| | | // return token; |
| | | // } |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.put("OperatorID", OperatorID); |
| | | // jsonObject.put("OperatorSecret", OperatorSecret); |
| | | // String params = jsonObject.toJSONString(); |
| | | // // 参数加密 |
| | | // String data = AesEncryption.encrypt(DataSecret, DataSecretIV, params); |
| | | // // 获取签名 |
| | | // String timeStamp = System.currentTimeMillis() + ""; |
| | | // SequenceGenerator generator = new SequenceGenerator(); |
| | | // String nextSequence = generator.getNextSequence(); |
| | | // String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp, data,nextSequence,SigSecret); |
| | | // jsonObject = new JSONObject(); |
| | | // jsonObject.put("OperatorID", OperatorID); |
| | | // jsonObject.put("Data", data); |
| | | // jsonObject.put("TimeStamp", timeStamp); |
| | | // jsonObject.put("Seq", nextSequence); |
| | | // jsonObject.put("Sig", hmacMD5); |
| | | // String result = HttpUtils.sendPost(url+query_token, jsonObject.toJSONString()); |
| | | // String string = JSONObject.parseObject(result).getString("Data"); |
| | | // String decrypt = AesEncryption.decrypt(DataSecret, DataSecretIV, string); |
| | | // JSONObject tokenResult = JSONObject.parseObject(decrypt); |
| | | // token = tokenResult.getString("AccessToken"); |
| | | // Integer TokenAvailableTime = tokenResult.getInteger("TokenAvailableTime"); |
| | | // redisService.setCacheObject(TOKEN_KEY,token, (long) (TokenAvailableTime - 60), TimeUnit.SECONDS); |
| | | // return token; |
| | | // } |
| | | public String queryToken(){ |
| | | HttpRequest post = HttpUtil.createPost(url + query_token); |
| | | JSONObject info = new JSONObject(); |
| | | info.put("OperatorID", "906171535"); |
| | | info.put("OperatorSecret", OperatorSecret); |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | baseRequest.setOperatorID("906171535"); |
| | | baseRequest.setTimeStamp(timeStamp+""); |
| | | baseRequest.setSeq("0001"); |
| | | String jsonString = JacksonUtils.toJson(info); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | String data = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", data,nextSequence,SigSecret); |
| | | baseRequest.setData(data); |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | log.info("获取三方平台授权token请求地址:" + post.getUrl()); |
| | | log.info("获取三方平台授权token请求参数:" + request_json); |
| | | log.info("获取三方平台授权token请求Data:" + jsonString); |
| | | post.body(request_json); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("获取三方平台授权token失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("获取三方平台授权token响应参数:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("获取三方平台授权token失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("获取三方平台授权token响应Data:" + decrypt); |
| | | QueryTokenResult queryTokenResult = JSON.parseObject(decrypt, QueryTokenResult.class); |
| | | String token = queryTokenResult.getAccessToken(); |
| | | // Long tokenAvailableTime = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC) + queryTokenResult.getTokenAvailab |
| | | return token; |
| | | } |
| | | |
| | | /** |
| | | * 设备状态变化推送 |
| | | * @param info |
| | | */ |
| | | public NotificationStationStatusResult notificationStationStatus(Operator operator, ConnectorStatusInfo info) { |
| | | HttpRequest post = HttpUtil.createPost(url+supervise_notification_station_status); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台设备状态失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台设备状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台设备状态失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台设备状态Data:" + decrypt); |
| | | NotificationStationStatusResult notificationStationStatusResult = JSON.parseObject(decrypt, NotificationStationStatusResult.class); |
| | | return notificationStationStatusResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推动充电状态 |
| | | * @param info |
| | | * @return |
| | | */ |
| | | public NotificationEquipChargeStatusResult notificationSupEquipChargeStatus(Operator operator, SupEquipChargeStatus info){ |
| | | HttpRequest post = HttpUtil.createPost(url+supervise_notification_equip_charge_status); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台充电状态失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台充电状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台充电状态失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台充电状态Data:" + decrypt); |
| | | NotificationEquipChargeStatusResult notificationEquipChargeStatusResult = JSON.parseObject(decrypt, NotificationEquipChargeStatusResult.class); |
| | | return notificationEquipChargeStatusResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送充电订单信息 |
| | | * @param info |
| | | * @return |
| | | */ |
| | | public NotificationChargeOrderInfoResult notificationChargeOrderInfo(Operator operator, SupChargeOrderInfo info){ |
| | | HttpRequest post = HttpUtil.createPost(url+supervise_notification_charge_order_info); |
| | | if (info.getOrderStatus()!=null){ |
| | | switch (info.getOrderStatus()){ |
| | | case -1: |
| | | info.setOrderStatus(7); |
| | | break; |
| | | case 0: |
| | | info.setOrderStatus(7); |
| | | break; |
| | | case 1: |
| | | info.setOrderStatus(1); |
| | | break; |
| | | case 2: |
| | | info.setOrderStatus(1); |
| | | |
| | | break; |
| | | case 3: |
| | | info.setOrderStatus(2); |
| | | break; |
| | | case 4: |
| | | info.setOrderStatus(3); |
| | | break; |
| | | case 5: |
| | | info.setOrderStatus(4); |
| | | break; |
| | | } |
| | | }else{ |
| | | info.setOrderStatus(5); |
| | | } |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台充电订单信息失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台充电订单信息响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台充电订单信息失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台充电订单信息Data:" + decrypt); |
| | | NotificationChargeOrderInfoResult notificationChargeOrderInfoResult = JSON.parseObject(decrypt, NotificationChargeOrderInfoResult.class); |
| | | return notificationChargeOrderInfoResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 构建请求参数和消息头 |
| | | * @param post |
| | | * @param |
| | | */ |
| | | public void buildBody(HttpRequest post, Object o, Operator operator){ |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | post.header("Authorization", "Bearer " + queryToken()); |
| | | BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | baseRequest.setOperatorID("906171535"); |
| | | baseRequest.setTimeStamp(timeStamp+""); |
| | | baseRequest.setSeq("0001"); |
| | | // 使用 Jackson 转换为 JSON |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | objectMapper.enable(MapperFeature.USE_ANNOTATIONS); // 启用注解支持 |
| | | String jsonString = null; |
| | | try { |
| | | jsonString = objectMapper.writeValueAsString(o); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | // String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | |
| | | baseRequest.setData(encrypt); |
| | | baseRequest.setOperator(operator); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", encrypt,nextSequence,SigSecret); |
| | | // String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp, data,nextSequence,OurSigSecret); |
| | | |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | post.body(request_json); |
| | | log.info("推送三方平台请求地址:" + post.getUrl()); |
| | | log.info("推送三方平台请求参数:" + request_json); |
| | | log.info("推送三方平台请求Data:" + jsonString); |
| | | } |
| | | /** |
| | | * 构建请求参数和消息头 |
| | | * @param post |
| | | * @param |
| | | */ |
| | | public void buildBodyStatus(HttpRequest post, SupStationPowerInfoResult info, Operator operator){ |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | post.header("Authorization", "Bearer " + queryToken()); |
| | | BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | baseRequest.setOperatorID("906171535"); |
| | | baseRequest.setTimeStamp(timeStamp+""); |
| | | baseRequest.setSeq("0001"); |
| | | String request_json1 = JacksonUtils.toJson(info); |
| | | String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,request_json1); |
| | | // String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | |
| | | baseRequest.setData(encrypt); |
| | | baseRequest.setOperator(operator); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", encrypt,nextSequence,SigSecret); |
| | | // String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp, data,nextSequence,OurSigSecret); |
| | | |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | post.body(request_json); |
| | | log.info("推送三方平台请求地址:" + post.getUrl()); |
| | | log.info("推送三方平台请求参数:" + request_json); |
| | | log.info("推送三方平台请求Data:" + request_json1); |
| | | } |
| | | public static void main(String[] args) { |
| | | // BaseModel model = new BaseModel(); |
| | | // model.setOperatorID("MA01H3BQ2"); |
| | | // model.setData("AoArdDDcmHcmOMkCLHodTpY1xLtt9yhLqxvKPyfdlmEOBj1LJnQM+Z4JOZllt3Pj9rubfgxJ51zMAfzquQegJzHGAT9Y7JrKFzFe6jGtXo0="); |
| | | // model.setTimeStamp(20250205120800L); |
| | | // model.setSeq("0001"); |
| | | // Operator operator = new Operator(); |
| | | // operator.setName("XinDianTu"); |
| | | // operator.setSigSecret("S94xUpTpOIlLJBk8"); |
| | | // model.setOperator(operator); |
| | | // String key = operator.getSigSecret(); |
| | | // |
| | | // String m = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | // byte[] hmacMd5 = SignUtil.getHMacMD5Bytes(key.getBytes(), m.getBytes()); |
| | | // // 打印计算得到的签名Sig |
| | | // String s = SignUtil.bytesToHexString(hmacMd5); |
| | | // System.err.println(s); |
| | | |
| | | |
| | | // BaseModel model = new BaseModel(); |
| | | // model.setOperatorID("MA25CNM38"); |
| | | // model.setData("xQYYEPiwoc4JENnQsF50qP6Tmnj7uU/AshWn3QbIgrMIk8zvFpy6fWLIiLzQHcLPFCihqH1uzoNhGVNcS8Wvf5gIx9+cWJvYtjwtsjAGMEwNQ6y+rF1jjKnqCNcQbHbhqJ2l76sD54QCFKyenKxymrXri19bDV8hizn3nBw+jcHBtqKHWzjdSHwPDWPIw4rXnrbWLya2PXVgYtVg93WPtliw+0xsqW0BxJamE70/Ilbg4wB5fOAOvXmbLFI+v9jRjpcA7ImhprqPMYkXYAfa2QlICrJEBK7DfpJvRMzKzeT90kOAITqIqFvbfV0ti+greRqToLP6ni4o6w3ID42UmKasIpLTnx+qtR4bVTBTRuDzXvNXDA92RqHaJO21xbSen1eHN/yGfrchBIM0gmav7EpaYAerfU4ubnmJ6xujR6okYepJwBD5DiSIrObfS+GWVPRekvnjvm7BC02NXTrGKA=="); |
| | | // model.setTimeStamp(20250205161426L); |
| | | // model.setSeq("0001"); |
| | | // Operator operator = new Operator(); |
| | | // operator.setOurOperatorId("2921700136"); |
| | | // operator.setOurSigSecret("KBm5J2fbGzyhX023"); |
| | | // model.setOperator(operator); |
| | | // String key = operator.getOurSigSecret(); |
| | | // |
| | | // String m = new StringBuilder(operator.getOurOperatorId()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | // byte[] hmacMd5 = SignUtil.getHMacMD5Bytes(key.getBytes(), m.getBytes()); |
| | | // // 打印计算得到的签名Sig |
| | | // String s = SignUtil.bytesToHexString(hmacMd5); |
| | | // System.err.println(s); |
| | | |
| | | HttpRequest post = HttpUtil.createPost("https://dataexchange.cdczpt.com/shevcs/v1" + query_token); |
| | | JSONObject info = new JSONObject(); |
| | | info.put("OperatorID", "906171535"); |
| | | info.put("OperatorSecret", OperatorSecret); |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | baseRequest.setOperatorID("906171535"); |
| | | baseRequest.setTimeStamp(timeStamp+""); |
| | | baseRequest.setSeq("0001"); |
| | | String jsonString = JacksonUtils.toJson(info); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | String data = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", data,nextSequence,SigSecret); |
| | | baseRequest.setData(data); |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | log.info("获取三方平台授权token请求地址:" + post.getUrl()); |
| | | log.info("获取三方平台授权token请求参数:" + request_json); |
| | | log.info("获取三方平台授权token请求Data:" + jsonString); |
| | | post.body(request_json); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("获取三方平台授权token失败:" + execute.body()); |
| | | } |
| | | log.info("获取三方平台授权token响应参数:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("获取三方平台授权token失败:" + baseResult.getMsg()); |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("获取三方平台授权token响应Data:" + decrypt); |
| | | QueryTokenResult queryTokenResult = JSON.parseObject(decrypt, QueryTokenResult.class); |
| | | String token = queryTokenResult.getAccessToken(); |
| | | // Long tokenAvailableTime = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC) + queryTokenResult.getTokenAvailab |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.jianguan.util; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.api.domain.SysOperLog; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.api.domain.THtml; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TActivity; |
| | | import com.ruoyi.other.api.domain.TAdvertising; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | |
| | | import com.ruoyi.order.api.model.AccountingStrategyDetailOrder; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TSettlementConfirm; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.model.TVipOrderRefund; |
| | | import com.ruoyi.order.api.model.AccountingStrategyOrder; |
| | | import com.ruoyi.order.api.model.TOrderInvoiceDetail; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderRefund; |
| | | import com.ruoyi.order.api.model.TGrantVip; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | | import com.ruoyi.order.api.model.TOrderAppeal; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrderRefund; |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | |
| | | import com.ruoyi.chargingPile.api.model.TVehicleRamp; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TSiteMenu; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.model.TPartnerSite; |
| | | import com.ruoyi.chargingPile.api.model.TApplyChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPileNotification; |
| | | import com.ruoyi.chargingPile.api.model.TMonitoringEquipment; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.model.TCarport; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.account.api.model.TAppUserSign; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.api.model.TInvoiceInformation; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TInviteUser; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | import com.ruoyi.account.api.model.TAppUserTag; |
| | | |
| | | import com.ruoyi.account.api.feignClient.JianGuanAccountClient; |
| | | import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; |
| | | import com.ruoyi.chargingPile.api.feignClient.JianGuanChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.vo.GovernmentCloudChargingPileVO; |
| | | import com.ruoyi.jianguan.service.*; |
| | | import com.ruoyi.order.api.feignClient.JianGuanOrderClient; |
| | | import com.ruoyi.order.api.vo.GovernmentCloudOrderVO; |
| | | import com.ruoyi.other.api.feignClient.JianGuanOtherClient; |
| | | import com.ruoyi.other.api.vo.GovernmentCloudOtherVO; |
| | | import com.ruoyi.system.api.feignClient.JianGuanSystemClient; |
| | | import com.ruoyi.system.api.vo.GovernmentCloudSystemVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | |
| | | @Resource |
| | | private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService; |
| | | private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService; |
| | | @Resource |
| | | private AccountingStrategyOrderService accountingStrategyOrderService; |
| | | private AccountingStrategyOrderService accountingStrategyOrderService; |
| | | |
| | | @Resource |
| | | private GenTableColumnService genTableColumnService; |
| | | private GenTableColumnService genTableColumnService; |
| | | @Resource |
| | | private GenTableService genTableService; |
| | | private GenTableService genTableService; |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | private IPartnerService partnerService; |
| | | @Resource |
| | | private IRegionService regionService; |
| | | private IRegionService regionService; |
| | | @Resource |
| | | private ISiteService siteService; |
| | | private ISiteService siteService; |
| | | @Resource |
| | | private ISysConfigService sysConfigService; |
| | | private ISysConfigService sysConfigService; |
| | | @Resource |
| | | private ISysDeptService deptService; |
| | | private ISysDeptService deptService; |
| | | @Resource |
| | | private ISysDictDataService sysDictDataService; |
| | | private ISysDictDataService sysDictDataService; |
| | | @Resource |
| | | private ISysDictTypeService sysDictTypeService; |
| | | private ISysDictTypeService sysDictTypeService; |
| | | @Resource |
| | | private ISysLoginLogService sysLoginLogService; |
| | | private ISysLoginLogService sysLoginLogService; |
| | | @Resource |
| | | private ISysMenuService sysMenuService; |
| | | private ISysMenuService sysMenuService; |
| | | @Resource |
| | | private ISysNoticeService sysNoticeService; |
| | | private ISysNoticeService sysNoticeService; |
| | | @Resource |
| | | private ISysOperLogService sysOperLogService; |
| | | private ISysOperLogService sysOperLogService; |
| | | @Resource |
| | | private ISysPermissionService sysPermissionService; |
| | | private ISysPermissionService sysPermissionService; |
| | | @Resource |
| | | private ISysPostService sysPostService; |
| | | private ISysPostService sysPostService; |
| | | @Resource |
| | | private ISysRoleService sysRoleService; |
| | | private ISysRoleService sysRoleService; |
| | | @Resource |
| | | private ISysUserOnlineService sysUserOnlineService; |
| | | private ISysUserOnlineService sysUserOnlineService; |
| | | @Resource |
| | | private ISysUserRoleService sysUserRoleService; |
| | | private ISysUserRoleService sysUserRoleService; |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | private ISysUserService sysUserService; |
| | | @Resource |
| | | private OperatorService operatorService; |
| | | private OperatorService operatorService; |
| | | @Resource |
| | | private TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | private TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | @Resource |
| | | private TAccountingStrategyService accountingStrategyService; |
| | | private TAccountingStrategyService accountingStrategyService; |
| | | @Resource |
| | | private TActivityService activityService; |
| | | private TActivityService activityService; |
| | | @Resource |
| | | private TAdvertisingService advertisingService; |
| | | private TAdvertisingService advertisingService; |
| | | @Resource |
| | | private TAppCouponService appCouponService; |
| | | private TAppCouponService appCouponService; |
| | | @Resource |
| | | private TApplyChargingPileService applyChargingPileService; |
| | | private TApplyChargingPileService applyChargingPileService; |
| | | @Resource |
| | | private TAppUserAddressService appUserAddressService; |
| | | private TAppUserAddressService appUserAddressService; |
| | | @Resource |
| | | private TAppUserCarService appUserCarService; |
| | | private TAppUserCarService appUserCarService; |
| | | @Resource |
| | | private TAppUserIntegralChangeService appUserIntegralChangeService; |
| | | private TAppUserIntegralChangeService appUserIntegralChangeService; |
| | | @Resource |
| | | private TAppUserService appUserService; |
| | | private TAppUserService appUserService; |
| | | @Resource |
| | | private TAppUserSignService appUserSignService; |
| | | private TAppUserSignService appUserSignService; |
| | | @Resource |
| | | private TAppUserTagService appUserTagService; |
| | | private TAppUserTagService appUserTagService; |
| | | |
| | | @Resource |
| | | |
| | | private TAppUserVipDetailService appUserVipDetailService; |
| | | private TAppUserVipDetailService appUserVipDetailService; |
| | | @Resource |
| | | |
| | | private TCarportService carportService; |
| | | private TCarportService carportService; |
| | | @Resource |
| | | |
| | | private TChargingBillService chargingBillService; |
| | | private TChargingBillService chargingBillService; |
| | | @Resource |
| | | |
| | | private TChargingGunService chargingGunService; |
| | | private TChargingGunService chargingGunService; |
| | | @Resource |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | @Resource |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | private TChargingOrderService chargingOrderService; |
| | | @Resource |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | private TChargingPileService chargingPileService; |
| | | @Resource |
| | | private TCompanyService companyService; |
| | | private TCompanyService companyService; |
| | | @Resource |
| | | private TCouponService couponService; |
| | | private TCouponService couponService; |
| | | @Resource |
| | | private TEnterpriseUserApplicationService enterpriseUserApplicationService; |
| | | private TEnterpriseUserApplicationService enterpriseUserApplicationService; |
| | | @Resource |
| | | private TEvaluationTagService evaluationTagService; |
| | | private TEvaluationTagService evaluationTagService; |
| | | @Resource |
| | | private TExchangeOrderService exchangeOrderService; |
| | | private TExchangeOrderService exchangeOrderService; |
| | | @Resource |
| | | private TFaultMessageService faultMessageService; |
| | | private TFaultMessageService faultMessageService; |
| | | @Resource |
| | | private TGoodsService goodsService; |
| | | private TGoodsService goodsService; |
| | | @Resource |
| | | private TGrantVipService grantVipService; |
| | | private TGrantVipService grantVipService; |
| | | @Resource |
| | | private THtmlService htmlService; |
| | | private THtmlService htmlService; |
| | | @Resource |
| | | private TIntegralRuleService integralRuleService; |
| | | private TIntegralRuleService integralRuleService; |
| | | @Resource |
| | | private TInviteUserService inviteUserService; |
| | | private TInviteUserService inviteUserService; |
| | | @Resource |
| | | private TInvoiceInformationService tInvoiceInformationService; |
| | | private TInvoiceInformationService tInvoiceInformationService; |
| | | @Resource |
| | | private TInvoiceTypeService invoiceTypeService; |
| | | private TInvoiceTypeService invoiceTypeService; |
| | | @Resource |
| | | private TMonitoringEquipmentService monitoringEquipmentService; |
| | | private TMonitoringEquipmentService monitoringEquipmentService; |
| | | @Resource |
| | | private TNoticeService noticeService; |
| | | private TNoticeService noticeService; |
| | | @Resource |
| | | private TOrderAppealService orderAppealService; |
| | | private TOrderAppealService orderAppealService; |
| | | @Resource |
| | | private TOrderEvaluateService orderEvaluateService; |
| | | private TOrderEvaluateService orderEvaluateService; |
| | | @Resource |
| | | private TOrderEvaluateTagService orderEvaluateTagService; |
| | | private TOrderEvaluateTagService orderEvaluateTagService; |
| | | @Resource |
| | | private TOrderInvoiceDetailService orderInvoiceDetailService; |
| | | private TOrderInvoiceDetailService orderInvoiceDetailService; |
| | | @Resource |
| | | private TOrderInvoiceService orderInvoiceService; |
| | | private TOrderInvoiceService orderInvoiceService; |
| | | @Resource |
| | | private TParkingLotService parkingLotService; |
| | | private TParkingLotService parkingLotService; |
| | | @Resource |
| | | private TParkingRecordService parkingRecordService; |
| | | private TParkingRecordService parkingRecordService; |
| | | @Resource |
| | | private TPartnerSiteService partnerSiteService; |
| | | private TPartnerSiteService partnerSiteService; |
| | | @Resource |
| | | private TRepairService repairService; |
| | | private TRepairService repairService; |
| | | @Resource |
| | | private TRoleSiteService roleSiteService; |
| | | private TRoleSiteService roleSiteService; |
| | | @Resource |
| | | private TSettlementConfirmService settlementConfirmService; |
| | | private TSettlementConfirmService settlementConfirmService; |
| | | @Resource |
| | | private TShoppingOrderRefundService shoppingOrderRefundService; |
| | | private TShoppingOrderRefundService shoppingOrderRefundService; |
| | | @Resource |
| | | private TShoppingOrderService shoppingOrderService; |
| | | private TShoppingOrderService shoppingOrderService; |
| | | @Resource |
| | | private TSiteMenuService siteMenuService; |
| | | private TSiteMenuService siteMenuService; |
| | | @Resource |
| | | private TSystemConfigurationService systemConfigurationService; |
| | | private TSystemConfigurationService systemConfigurationService; |
| | | @Resource |
| | | private TUserSiteService userSiteService; |
| | | private TUserSiteService userSiteService; |
| | | @Resource |
| | | private TUserTagService userTagService; |
| | | private TUserTagService userTagService; |
| | | @Resource |
| | | private TVehicleRampService vehicleRampService; |
| | | private TVehicleRampService vehicleRampService; |
| | | @Resource |
| | | private TVipOrderRefundService vipOrderRefundService; |
| | | private TVipOrderRefundService vipOrderRefundService; |
| | | @Resource |
| | | private TVipOrderService vipOrderService; |
| | | private TVipOrderService vipOrderService; |
| | | @Resource |
| | | private TVipService vipService; |
| | | private TVipService vipService; |
| | | |
| | | |
| | | @Resource |
| | | private JianGuanAccountClient jianGuanAccountClient; |
| | | @Resource |
| | | private JianGuanChargingPileClient jianGuanChargingPileClient; |
| | | @Resource |
| | | private JianGuanOrderClient jianGuanOrderClient; |
| | | @Resource |
| | | private JianGuanOtherClient jianGuanOtherClient; |
| | | @Resource |
| | | private JianGuanSystemClient jianGuanSystemClient; |
| | | |
| | | // 每天早上9点执行的定时任务 |
| | | @Scheduled(cron = "0 0 9 * * ?") |
| | | public void taskMonth() { |
| | | LocalDateTime start = LocalDateTime.now(); |
| | | LocalDateTime end = LocalDateTime.now().minusDays(1); |
| | | // accountingStrategyDetailOrderService |
| | | // accountingStrategyOrderService |
| | | // genTableColumnService |
| | | // genTableService |
| | | // partnerService |
| | | // regionService |
| | | // siteService |
| | | // sysConfigService |
| | | // deptService |
| | | // sysDictDataService |
| | | // sysDictTypeService |
| | | // sysLoginLogService |
| | | // sysMenuService |
| | | // sysNoticeService |
| | | // sysOperLogService |
| | | // sysPermissionService |
| | | // sysPostService |
| | | // sysRoleService |
| | | // sysUserOnlineService |
| | | // sysUserRoleService |
| | | // sysUserService |
| | | // operatorService |
| | | // accountingStrategyDetailService |
| | | // accountingStrategyService |
| | | // activityService |
| | | // advertisingService |
| | | // appCouponService |
| | | // applyChargingPileService |
| | | // appUserAddressService |
| | | // appUserCarService |
| | | // appUserIntegralChangeService |
| | | // appUserService |
| | | // appUserSignService |
| | | // appUserTagService |
| | | // appUserVipDetailService |
| | | // carportService |
| | | // chargingBillService |
| | | // chargingGunService |
| | | // chargingOrderAccountingStrategyService |
| | | // chargingOrderRefundService |
| | | // chargingOrderService |
| | | // chargingPileNotificationService |
| | | // chargingPileService |
| | | // companyService |
| | | // couponService |
| | | // enterpriseUserApplicationService |
| | | // evaluationTagService |
| | | // exchangeOrderService |
| | | // faultMessageService |
| | | // goodsService |
| | | // grantVipService |
| | | // htmlService |
| | | // integralRuleService |
| | | // inviteUserService |
| | | // tInvoiceInformationService |
| | | // invoiceTypeService |
| | | // monitoringEquipmentService |
| | | // noticeService |
| | | // orderAppealService |
| | | // orderEvaluateService |
| | | // orderEvaluateTagService |
| | | // orderInvoiceDetailService |
| | | // orderInvoiceService |
| | | // parkingLotService |
| | | // parkingRecordService |
| | | // partnerSiteService |
| | | // repairService |
| | | // roleSiteService |
| | | // settlementConfirmService |
| | | // shoppingOrderRefundService |
| | | // shoppingOrderService |
| | | // siteMenuService |
| | | // systemConfigurationService |
| | | // userSiteService |
| | | // userTagService |
| | | // vehicleRampService |
| | | // vipOrderRefundService |
| | | // vipOrderService |
| | | // vipService |
| | | // account服务 |
| | | GovernmentCloudAccountVO data = jianGuanAccountClient.listAll().getData(); |
| | | if (data != null) { |
| | | List<TAppCoupon> appCoupons = data.getAppCoupons(); |
| | | if (!appCoupons.isEmpty()) { |
| | | appCouponService.saveBatch(appCoupons); |
| | | } |
| | | List<TAppUser> appUsers = data.getAppUsers(); |
| | | if (!appUsers.isEmpty()) { |
| | | appUserService.saveBatch(appUsers); |
| | | } |
| | | List<TAppUserAddress> appUserAddresses = data.getAppUserAddresses(); |
| | | if (!appUserAddresses.isEmpty()) { |
| | | appUserAddressService.saveBatch(appUserAddresses); |
| | | } |
| | | List<TAppUserCar> appUserCars = data.getAppUserCars(); |
| | | if (!appUserCars.isEmpty()) { |
| | | appUserCarService.saveBatch(appUserCars); |
| | | } |
| | | List<TAppUserIntegralChange> appUserIntegralChanges = data.getAppUserIntegralChanges(); |
| | | if (!appUserIntegralChanges.isEmpty()) { |
| | | appUserIntegralChangeService.saveBatch(appUserIntegralChanges); |
| | | } |
| | | List<TAppUserSign> appUserSigns = data.getAppUserSigns(); |
| | | if (!appUserSigns.isEmpty()) { |
| | | appUserSignService.saveBatch(appUserSigns); |
| | | } |
| | | List<TAppUserTag> appUserTags = data.getAppUserTags(); |
| | | if (!appUserTags.isEmpty()) { |
| | | appUserTagService.saveBatch(appUserTags); |
| | | } |
| | | List<TAppUserVipDetail> appUserVipDetails = data.getAppUserVipDetails(); |
| | | if (!appUserVipDetails.isEmpty()) { |
| | | appUserVipDetailService.saveBatch(appUserVipDetails); |
| | | } |
| | | List<TInviteUser> inviteUsers = data.getInviteUsers(); |
| | | if (!inviteUsers.isEmpty()) { |
| | | inviteUserService.saveBatch(inviteUsers); |
| | | } |
| | | List<TInvoiceInformation> invoiceInformations = data.getInvoiceInformations(); |
| | | if (!invoiceInformations.isEmpty()) { |
| | | tInvoiceInformationService.saveBatch(invoiceInformations); |
| | | } |
| | | } |
| | | // chargingPile服务 |
| | | GovernmentCloudChargingPileVO data1 = jianGuanChargingPileClient.listAll().getData(); |
| | | if (data1 != null) { |
| | | List<Partner> partners = data1.getPartners(); |
| | | if (!partners.isEmpty()) { |
| | | partnerService.saveBatch(partners); |
| | | } |
| | | List<Site> sites = data1.getSites(); |
| | | if (!sites.isEmpty()) { |
| | | siteService.saveBatch(sites); |
| | | } |
| | | List<TAccountingStrategy> accountingStrategies = data1.getAccountingStrategies(); |
| | | if (!accountingStrategies.isEmpty()) { |
| | | accountingStrategyService.saveBatch(accountingStrategies); |
| | | } |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = data1.getAccountingStrategyDetails(); |
| | | if (!accountingStrategyDetails.isEmpty()) { |
| | | accountingStrategyDetailService.saveBatch(accountingStrategyDetails); |
| | | } |
| | | List<TApplyChargingPile> applyChargingPiles = data1.getApplyChargingPiles(); |
| | | if (!applyChargingPiles.isEmpty()) { |
| | | applyChargingPileService.saveBatch(applyChargingPiles); |
| | | } |
| | | List<TCarport> carports = data1.getCarports(); |
| | | if (!carports.isEmpty()) { |
| | | carportService.saveBatch(carports); |
| | | } |
| | | List<TChargingGun> chargingGuns = data1.getChargingGuns(); |
| | | if (!chargingGuns.isEmpty()) { |
| | | chargingGunService.saveBatch(chargingGuns); |
| | | } |
| | | List<TChargingPile> chargingPiles = data1.getChargingPiles(); |
| | | if (!chargingPiles.isEmpty()) { |
| | | chargingPileService.saveBatch(chargingPiles); |
| | | } |
| | | List<TChargingPileNotification> chargingPileNotifications = data1.getChargingPileNotifications(); |
| | | if (!chargingPileNotifications.isEmpty()) { |
| | | chargingPileNotificationService.saveBatch(chargingPileNotifications); |
| | | } |
| | | List<TFaultMessage> faultMessages = data1.getFaultMessages(); |
| | | if (!faultMessages.isEmpty()) { |
| | | faultMessageService.saveBatch(faultMessages); |
| | | } |
| | | List<TMonitoringEquipment> monitoringEquipments = data1.getMonitoringEquipments(); |
| | | if (!monitoringEquipments.isEmpty()) { |
| | | monitoringEquipmentService.saveBatch(monitoringEquipments); |
| | | } |
| | | List<TParkingLot> parkingLots = data1.getParkingLots(); |
| | | if (!parkingLots.isEmpty()) { |
| | | parkingLotService.saveBatch(parkingLots); |
| | | } |
| | | List<TParkingRecord> parkingRecords = data1.getParkingRecords(); |
| | | if (!parkingRecords.isEmpty()) { |
| | | parkingRecordService.saveBatch(parkingRecords); |
| | | } |
| | | // List<TPartnerSite> partnerSites = data1.getPartnerSites(); |
| | | // if (!partnerSites.isEmpty()) { |
| | | // partnerSiteService.saveBatch(partnerSites); |
| | | // } |
| | | List<TRepair> repairs = data1.getRepairs(); |
| | | if (!repairs.isEmpty()) { |
| | | repairService.saveBatch(repairs); |
| | | } |
| | | // List<TSiteMenu> siteMenus = data1.getSiteMenus(); |
| | | // if (!siteMenus.isEmpty()) { |
| | | // siteMenuService.saveBatch(siteMenus); |
| | | // } |
| | | List<TVehicleRamp> vehicleRamps = data1.getVehicleRamps(); |
| | | if (!vehicleRamps.isEmpty()) { |
| | | vehicleRampService.saveBatch(vehicleRamps); |
| | | } |
| | | } |
| | | //order服务 |
| | | GovernmentCloudOrderVO data2 = jianGuanOrderClient.listAll().getData(); |
| | | |
| | | |
| | | if (data2 != null) { |
| | | List<AccountingStrategyDetailOrder> accountingStrategyDetailOrders = data2.getAccountingStrategyDetailOrders(); |
| | | if (!accountingStrategyDetailOrders.isEmpty()) { |
| | | accountingStrategyDetailOrderService.saveBatch(accountingStrategyDetailOrders); |
| | | } |
| | | List<AccountingStrategyOrder> accountingStrategyOrders = data2.getAccountingStrategyOrders(); |
| | | if (!accountingStrategyOrders.isEmpty()) { |
| | | accountingStrategyOrderService.saveBatch(accountingStrategyOrders); |
| | | } |
| | | List<TChargingBill> chargingBills = data2.getChargingBills(); |
| | | if (!chargingBills.isEmpty()) { |
| | | chargingBillService.saveBatch(chargingBills); |
| | | } |
| | | List<TChargingOrder> chargingOrders = data2.getChargingOrders(); |
| | | if (!chargingOrders.isEmpty()) { |
| | | chargingOrderService.saveBatch(chargingOrders); |
| | | } |
| | | List<TChargingOrderAccountingStrategy> chargingOrderAccountingStrategies = data2.getChargingOrderAccountingStrategies(); |
| | | if (!chargingOrderAccountingStrategies.isEmpty()) { |
| | | chargingOrderAccountingStrategyService.saveBatch(chargingOrderAccountingStrategies); |
| | | } |
| | | List<TChargingOrderRefund> chargingOrderRefunds = data2.getChargingOrderRefunds(); |
| | | if (!chargingOrderRefunds.isEmpty()) { |
| | | chargingOrderRefundService.saveBatch(chargingOrderRefunds); |
| | | } |
| | | List<TExchangeOrder> exchangeOrders = data2.getExchangeOrders(); |
| | | if (!exchangeOrders.isEmpty()) { |
| | | exchangeOrderService.saveBatch(exchangeOrders); |
| | | } |
| | | List<TGrantVip> grantVips = data2.getGrantVips(); |
| | | if (!grantVips.isEmpty()) { |
| | | grantVipService.saveBatch(grantVips); |
| | | } |
| | | List<TOrderAppeal> orderAppeals = data2.getOrderAppeals(); |
| | | if (!orderAppeals.isEmpty()) { |
| | | orderAppealService.saveBatch(orderAppeals); |
| | | } |
| | | List<TOrderEvaluate> orderEvaluates = data2.getOrderEvaluates(); |
| | | if (!orderEvaluates.isEmpty()) { |
| | | orderEvaluateService.saveBatch(orderEvaluates); |
| | | } |
| | | List<TOrderEvaluateTag> orderEvaluateTags = data2.getOrderEvaluateTags(); |
| | | if (!orderEvaluateTags.isEmpty()) { |
| | | orderEvaluateTagService.saveBatch(orderEvaluateTags); |
| | | } |
| | | List<TOrderInvoice> orderInvoices = data2.getOrderInvoices(); |
| | | if (!orderInvoices.isEmpty()) { |
| | | orderInvoiceService.saveBatch(orderInvoices); |
| | | } |
| | | List<TOrderInvoiceDetail> orderInvoiceDetails = data2.getOrderInvoiceDetails(); |
| | | if (!orderInvoiceDetails.isEmpty()) { |
| | | orderInvoiceDetailService.saveBatch(orderInvoiceDetails); |
| | | } |
| | | List<TSettlementConfirm> settlementConfirms = data2.getSettlementConfirms(); |
| | | if (!settlementConfirms.isEmpty()) { |
| | | settlementConfirmService.saveBatch(settlementConfirms); |
| | | } |
| | | List<TShoppingOrder> shoppingOrders = data2.getShoppingOrders(); |
| | | if (!shoppingOrders.isEmpty()) { |
| | | shoppingOrderService.saveBatch(shoppingOrders); |
| | | } |
| | | List<TShoppingOrderRefund> shoppingOrderRefunds = data2.getShoppingOrderRefunds(); |
| | | if (!shoppingOrderRefunds.isEmpty()) { |
| | | shoppingOrderRefundService.saveBatch(shoppingOrderRefunds); |
| | | } |
| | | List<TVipOrder> vipOrders = data2.getVipOrders(); |
| | | if (!vipOrders.isEmpty()) { |
| | | vipOrderService.saveBatch(vipOrders); |
| | | } |
| | | List<TVipOrderRefund> vipOrderRefunds = data2.getVipOrderRefunds(); |
| | | if (!vipOrderRefunds.isEmpty()) { |
| | | vipOrderRefundService.saveBatch(vipOrderRefunds); |
| | | } |
| | | } |
| | | // other服务 |
| | | GovernmentCloudOtherVO data3 = jianGuanOtherClient.listAll().getData(); |
| | | if (data3 != null) { |
| | | List<Operator> operators = data3.getOperators(); |
| | | if (!operators.isEmpty()) { |
| | | operatorService.saveOrUpdateBatch(operators); |
| | | } |
| | | List<TActivity> activities = data3.getActivities(); |
| | | if (!activities.isEmpty()) { |
| | | activityService.saveBatch(activities); |
| | | } |
| | | List<TAdvertising> advertisings = data3.getAdvertisings(); |
| | | if (!advertisings.isEmpty()) { |
| | | advertisingService.saveBatch(advertisings); |
| | | } |
| | | List<TCompany> companies = data3.getCompanies(); |
| | | if (!companies.isEmpty()) { |
| | | companyService.saveBatch(companies); |
| | | } |
| | | List<TCoupon> coupons = data3.getCoupons(); |
| | | if (!coupons.isEmpty()) { |
| | | couponService.saveBatch(coupons); |
| | | } |
| | | List<TEnterpriseUserApplication> enterpriseUserApplications = data3.getEnterpriseUserApplications(); |
| | | if (!enterpriseUserApplications.isEmpty()) { |
| | | enterpriseUserApplicationService.saveBatch(enterpriseUserApplications); |
| | | } |
| | | List<TEvaluationTag> evaluationTags = data3.getEvaluationTags(); |
| | | if (!evaluationTags.isEmpty()) { |
| | | evaluationTagService.saveBatch(evaluationTags); |
| | | } |
| | | List<TGoods> goods = data3.getGoods(); |
| | | if (!goods.isEmpty()) { |
| | | goodsService.saveBatch(goods); |
| | | } |
| | | List<THtml> htmls = data3.getHtmls(); |
| | | if (!htmls.isEmpty()) { |
| | | htmlService.saveOrUpdateBatch(htmls); |
| | | } |
| | | List<TIntegralRule> integralRules = data3.getIntegralRules(); |
| | | if (!integralRules.isEmpty()) { |
| | | integralRuleService.saveBatch(integralRules); |
| | | } |
| | | List<TInvoiceType> invoiceTypes = data3.getInvoiceTypes(); |
| | | if (!invoiceTypes.isEmpty()) { |
| | | invoiceTypeService.saveBatch(invoiceTypes); |
| | | } |
| | | List<TNotice> notices = data3.getNotices(); |
| | | if (!notices.isEmpty()) { |
| | | noticeService.saveBatch(notices); |
| | | } |
| | | List<TSystemConfiguration> systemConfigurations = data3.getSystemConfigurations(); |
| | | if (!systemConfigurations.isEmpty()) { |
| | | systemConfigurationService.saveOrUpdateBatch(systemConfigurations); |
| | | } |
| | | List<TUserTag> userTags = data3.getUserTags(); |
| | | if (!userTags.isEmpty()) { |
| | | userTagService.saveBatch(userTags); |
| | | } |
| | | List<TVip> vips = data3.getVips(); |
| | | if (!vips.isEmpty()) { |
| | | vipService.saveBatch(vips); |
| | | } |
| | | } |
| | | GovernmentCloudSystemVO data4 = jianGuanSystemClient.listAll().getData(); |
| | | if (data4 != null) { |
| | | List<SysLoginLog> loginLogs = data4.getLoginLogs(); |
| | | if (!loginLogs.isEmpty()) { |
| | | sysLoginLogService.saveBatch(loginLogs); |
| | | } |
| | | List<SysOperLog> sysOperLogs = data4.getSysOperLogs(); |
| | | if (!sysOperLogs.isEmpty()) { |
| | | sysOperLogService.saveBatch(sysOperLogs); |
| | | } |
| | | List<SysRole> sysRoles = data4.getSysRoles(); |
| | | if (!sysRoles.isEmpty()) { |
| | | sysRoleService.saveBatch(sysRoles); |
| | | } |
| | | List<SysUser> sysUsers = data4.getSysUsers(); |
| | | if (!sysUsers.isEmpty()) { |
| | | sysUserService.saveBatch(sysUsers); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.util; |
| | | |
| | | /** |
| | | * 接口地址枚举 |
| | | * @author zhibing.pu |
| | | * @Date 2025/1/21 14:38 |
| | | */ |
| | | public enum InterfaceUrlEnum { |
| | | QUERY_TOKEN("/query_token", "获取权限token"), |
| | | NOTIFICATION_STATION_STATUS("/notification_stationStatus", "设备状态变化推送"), |
| | | NOTIFICATION_STATION_CHANGE("/notification_station_change", "站点计费策略变更推送"), |
| | | NOTIFICATION_START_CHARGE_RESULT("/notification_start_charge_result", "推送启动充电结果"), |
| | | NOTIFICATION_EQUIP_CHARGE_STATUS("/notification_equip_charge_status", "推送充电状态"), |
| | | NOTIFICATION_STOP_CHARGE_RESULT("/notification_stop_charge_result", "推送停止充电结果"), |
| | | NOTIFICATION_CHARGE_ORDER_INFO("/notification_charge_order_info", "推送充电订单信息"), |
| | | CHECK_CHARGE_ORDERS("/check_charge_orders", "推送订单对账结果信息"), |
| | | ; |
| | | |
| | | private String url; |
| | | private String note; |
| | | |
| | | InterfaceUrlEnum(String url, String note) { |
| | | this.url = url; |
| | | this.note = note; |
| | | } |
| | | |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getNote() { |
| | | return note; |
| | | } |
| | | |
| | | public void setNote(String note) { |
| | | this.note = note; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.nacos.common.utils.JacksonUtils; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.MapperFeature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.chargingPile.api.feignClient.*; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.vo.StartChargeResult; |
| | | import com.ruoyi.jianguan.model.*; |
| | | import com.ruoyi.jianguan.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.AddTripartitePlatformOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import com.ruoyi.other.api.feignClient.OperatorClient; |
| | | import com.ruoyi.other.api.feignClient.SystemConfigurationClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/1/21 17:52 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/evcs/v3.0") |
| | | public class TCECCJianGuanontroller { |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | @Resource |
| | | private OperatorClient operatorClient; |
| | | |
| | | @Resource |
| | | private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | |
| | | @Resource |
| | | private ChargingOrderAccountingStrategyClient chargingOrderAccountingStrategyClient; |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | @Resource |
| | | private TokenUtil tokenUtil; |
| | | |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | |
| | | @Resource |
| | | private ParkingRecordClient parkingRecordClient; |
| | | |
| | | @Resource |
| | | private SystemConfigurationClient systemConfigurationClient; |
| | | @Autowired |
| | | private TCECSuperviseUtil tcecSuperviseUtil; |
| | | private static final String OperatorID = "MA6CC2LK7"; |
| | | private static final String OurDataSecret = "3QJXn4MSj78zcpW1"; |
| | | private static final String OurDataSecretIV = "jhqj64V9gX8NHbu1"; |
| | | private static final String OurSigSecret = "RruzbZxnr74tqxe1"; |
| | | |
| | | |
| | | /** |
| | | * 请求校验 |
| | | * @param baseRequest |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public BaseResult requestCheck(Boolean tokenCheck, BaseRequest baseRequest, HttpServletRequest request){ |
| | | BaseResult baseResult = new BaseResult(); |
| | | baseResult.setRet(0); |
| | | baseResult.setMsg("成功"); |
| | | baseResult.setOperatorID(baseRequest.getOperatorID()); |
| | | Long mapKey = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | baseResult.setTimeStamp(mapKey); |
| | | baseResult.setSeq("0001"); |
| | | |
| | | //校验token和签名 |
| | | String operatorID = baseRequest.getOperatorID(); |
| | | String sig = baseRequest.getSig(); |
| | | Long timeStamp = baseRequest.getTimeStamp(); |
| | | String data = baseRequest.getData(); |
| | | String seq = baseRequest.getSeq(); |
| | | |
| | | if(StringUtils.isEmpty(operatorID) || StringUtils.isEmpty(sig) || StringUtils.isEmpty(data) || StringUtils.isEmpty(seq) || null == timeStamp){ |
| | | baseResult.setRet(4003); |
| | | baseResult.setMsg("参数异常"); |
| | | return baseResult; |
| | | } |
| | | |
| | | R<Operator> r = operatorClient.getOperator(operatorID); |
| | | |
| | | if(200 != r.getCode()){ |
| | | baseResult.setRet(500); |
| | | baseResult.setMsg("系统异常"); |
| | | return baseResult; |
| | | } |
| | | //校验token |
| | | if(tokenCheck){ |
| | | Operator loginUser = tokenUtil.getLoginUser(request); |
| | | if(null == loginUser){ |
| | | baseResult.setRet(4002); |
| | | baseResult.setMsg("身份校验失败,无效的token"); |
| | | return baseResult; |
| | | } |
| | | } |
| | | |
| | | Operator operator = r.getData(); |
| | | baseResult.setOperator(operator); |
| | | baseRequest.setOperator(operator); |
| | | //校验签名 |
| | | String sign = TCECUtil.ourBuildSign(baseRequest); |
| | | if(!sign.equals(sig)){ |
| | | baseResult.setRet(4001); |
| | | baseResult.setMsg("签名校验失败"); |
| | | return baseResult; |
| | | } |
| | | return baseResult; |
| | | } |
| | | public BaseResult requestCheckJianGuan(Boolean tokenCheck, BaseRequest baseRequest, HttpServletRequest request){ |
| | | Operator operator = new Operator(); |
| | | BaseResult baseResult = new BaseResult(); |
| | | baseResult.setRet(0); |
| | | baseResult.setMsg("成功"); |
| | | baseResult.setOperatorID(baseRequest.getOperatorID()); |
| | | operator.setOperatorId(baseRequest.getOperatorID()); |
| | | Long mapKey = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | baseResult.setTimeStamp(mapKey); |
| | | baseResult.setSeq("0001"); |
| | | //校验token和签名 |
| | | String operatorID = baseRequest.getOperatorID(); |
| | | String sig = baseRequest.getSig(); |
| | | Long timeStamp = baseRequest.getTimeStamp(); |
| | | String data = baseRequest.getData(); |
| | | String seq = baseRequest.getSeq(); |
| | | baseResult.setOperator(operator); |
| | | if(StringUtils.isEmpty(operatorID) || StringUtils.isEmpty(sig) || StringUtils.isEmpty(data) || StringUtils.isEmpty(seq) || null == timeStamp){ |
| | | baseResult.setRet(4003); |
| | | baseResult.setMsg("参数异常"); |
| | | return baseResult; |
| | | } |
| | | return baseResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取token |
| | | * @return |
| | | */ |
| | | @PostMapping("/query_token") |
| | | public BaseResult queryToken(@RequestBody BaseRequest baseRequest, HttpServletRequest request){ |
| | | log.info("三方平台获取token请求参数:" + JacksonUtils.toJson(baseRequest)); |
| | | BaseResult baseResult = requestCheckJianGuan(false, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | log.info("三方平台获取token响应Data:"); |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | log.info("三方平台获取token响应参数:" + JacksonUtils.toJson(baseResult)); |
| | | return baseResult; |
| | | } |
| | | QueryTokenResult queryTokenResult = new QueryTokenResult(); |
| | | //生成token |
| | | Operator operator = baseResult.getOperator(); |
| | | Map<String, Object> token = tokenUtil.createToken(operator); |
| | | String access_token = token.get("access_token").toString(); |
| | | Long expires_in = Long.valueOf(token.get("expires_in").toString()); |
| | | |
| | | queryTokenResult.setOperatorID("906171535"); |
| | | queryTokenResult.setSuccStat(0); |
| | | queryTokenResult.setFailReason(0); |
| | | queryTokenResult.setAccessToken(access_token); |
| | | queryTokenResult.setTokenAvailableTime(expires_in * 60); |
| | | //参数加密 |
| | | String jsonString = JacksonUtils.toJson(queryTokenResult); |
| | | log.info("三方平台获取token响应Data:" + jsonString); |
| | | // String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | // baseResult.setData(encrypt); |
| | | String timeStamp = System.currentTimeMillis() + ""; |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | String data = AesEncryption.encrypt(OurDataSecret, OurDataSecretIV,jsonString); |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp, data,nextSequence,OurSigSecret); |
| | | baseResult.setData(data); |
| | | baseResult.setSig(hmacMD5); |
| | | log.info("三方平台获取token响应参数:" + JacksonUtils.toJson(baseResult)); |
| | | return baseResult; |
| | | } |
| | | /** |
| | | * 推送充电状态信息 |
| | | * @param chargingOrder |
| | | * @return |
| | | */ |
| | | // public R pushSuperviseNotificationEquipChargeStatus(TChargingOrder chargingOrder){ |
| | | // SupEquipChargeStatus supEquipChargeStatus = new SupEquipChargeStatus(); |
| | | // supEquipChargeStatus.setOperatorID(operatorId); |
| | | // supEquipChargeStatus.setEquipmentOwnerID(operatorId); |
| | | // supEquipChargeStatus.setStationID(String.valueOf(chargingOrder.getSiteId())); |
| | | // supEquipChargeStatus.setEquipmentID(String.valueOf(chargingOrder.getChargingPileId())); |
| | | // supEquipChargeStatus.setOrderNo(operatorId+chargingOrder.getCode()); |
| | | // switch (chargingOrder.getStatus()){ |
| | | // case 2: |
| | | // supEquipChargeStatus.setConnectorStatus(1); |
| | | // break; |
| | | // case 3: |
| | | // supEquipChargeStatus.setConnectorStatus(2); |
| | | // break; |
| | | // case 4: |
| | | // supEquipChargeStatus.setConnectorStatus(3); |
| | | // break; |
| | | // case 5: |
| | | // supEquipChargeStatus.setConnectorStatus(4); |
| | | // break; |
| | | // } |
| | | // TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | // supEquipChargeStatus.setConnectorID(chargingGun.getFullNumber()); |
| | | // supEquipChargeStatus.setEquipmentClassification(1); |
| | | // supEquipChargeStatus.setPushTimeStamp(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| | | // switch (chargingGun.getStatus()){ |
| | | // case 1: |
| | | // supEquipChargeStatus.setConnectorStatus(0); |
| | | // break; |
| | | // case 2: |
| | | // supEquipChargeStatus.setConnectorStatus(1); |
| | | // break; |
| | | // case 3: |
| | | // supEquipChargeStatus.setConnectorStatus(2); |
| | | // break; |
| | | // case 4: |
| | | // supEquipChargeStatus.setConnectorStatus(3); |
| | | // break; |
| | | // case 5: |
| | | // supEquipChargeStatus.setConnectorStatus(3); |
| | | // break; |
| | | // case 6: |
| | | // supEquipChargeStatus.setConnectorStatus(4); |
| | | // break; |
| | | // case 7: |
| | | // supEquipChargeStatus.setConnectorStatus(255); |
| | | // break; |
| | | // } |
| | | // supEquipChargeStatus.setCurrentA(chargingOrder.getCurrent()); |
| | | // supEquipChargeStatus.setSOC(new BigDecimal(chargingOrder.getEndSoc())); |
| | | // supEquipChargeStatus.setStartTime(chargingOrder.getStartTime() != null ? chargingOrder.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : ""); |
| | | // supEquipChargeStatus.setEndTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| | | // supEquipChargeStatus.setTotalPower(chargingOrder.getElectrovalence()); |
| | | // List<Operator> operators = operatorClient.getAllOperator().getData(); |
| | | // for (Operator operator : operators) { |
| | | // tcecSuperviseUtil.notificationSupEquipChargeStatus(operator, supEquipChargeStatus); |
| | | // } |
| | | // return R.ok(); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | log.info("推送三方平台请求Data:" + request_json1); |
| | | } |
| | | public static void main(String[] args) { |
| | | BaseModel model = new BaseModel(); |
| | | model.setOperatorID("MA01H3BQ2"); |
| | | model.setData("AoArdDDcmHcmOMkCLHodTpY1xLtt9yhLqxvKPyfdlmEOBj1LJnQM+Z4JOZllt3Pj9rubfgxJ51zMAfzquQegJzHGAT9Y7JrKFzFe6jGtXo0="); |
| | | model.setTimeStamp(20250205120800L); |
| | | model.setSeq("0001"); |
| | | Operator operator = new Operator(); |
| | | operator.setName("XinDianTu"); |
| | | operator.setSigSecret("S94xUpTpOIlLJBk8"); |
| | | model.setOperator(operator); |
| | | String key = operator.getSigSecret(); |
| | | |
| | | String m = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | byte[] hmacMd5 = SignUtil.getHMacMD5Bytes(key.getBytes(), m.getBytes()); |
| | | // 打印计算得到的签名Sig |
| | | String s = SignUtil.bytesToHexString(hmacMd5); |
| | | System.err.println(s); |
| | | |
| | | |
| | | // BaseModel model = new BaseModel(); |
| | | // model.setOperatorID("MA25CNM38"); |
| | | // model.setData("xQYYEPiwoc4JENnQsF50qP6Tmnj7uU/AshWn3QbIgrMIk8zvFpy6fWLIiLzQHcLPFCihqH1uzoNhGVNcS8Wvf5gIx9+cWJvYtjwtsjAGMEwNQ6y+rF1jjKnqCNcQbHbhqJ2l76sD54QCFKyenKxymrXri19bDV8hizn3nBw+jcHBtqKHWzjdSHwPDWPIw4rXnrbWLya2PXVgYtVg93WPtliw+0xsqW0BxJamE70/Ilbg4wB5fOAOvXmbLFI+v9jRjpcA7ImhprqPMYkXYAfa2QlICrJEBK7DfpJvRMzKzeT90kOAITqIqFvbfV0ti+greRqToLP6ni4o6w3ID42UmKasIpLTnx+qtR4bVTBTRuDzXvNXDA92RqHaJO21xbSen1eHN/yGfrchBIM0gmav7EpaYAerfU4ubnmJ6xujR6okYepJwBD5DiSIrObfS+GWVPRekvnjvm7BC02NXTrGKA=="); |
| | | // model.setTimeStamp(20250205161426L); |
| | | // model.setSeq("0001"); |
| | | // Operator operator = new Operator(); |
| | | // operator.setOurOperatorId("2921700136"); |
| | | // operator.setOurSigSecret("KBm5J2fbGzyhX023"); |
| | | // model.setOperator(operator); |
| | | // String key = operator.getOurSigSecret(); |
| | | // |
| | | // String m = new StringBuilder(operator.getOurOperatorId()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | // byte[] hmacMd5 = SignUtil.getHMacMD5Bytes(key.getBytes(), m.getBytes()); |
| | | // // 打印计算得到的签名Sig |
| | | // String s = SignUtil.bytesToHexString(hmacMd5); |
| | | // System.err.println(s); |
| | | HttpRequest post = HttpUtil.createPost(url + query_token); |
| | | JSONObject info = new JSONObject(); |
| | | info.put("OperatorID", "906171535"); |
| | | info.put("OperatorSecret", OperatorSecret); |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | baseRequest.setOperatorID("906171535"); |
| | | baseRequest.setTimeStamp(timeStamp+""); |
| | | baseRequest.setSeq("0001"); |
| | | String jsonString = JacksonUtils.toJson(info); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | String data = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", data,nextSequence,SigSecret); |
| | | baseRequest.setData(data); |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | log.info("获取三方平台授权token请求地址:" + post.getUrl()); |
| | | log.info("获取三方平台授权token请求参数:" + request_json); |
| | | log.info("获取三方平台授权token请求Data:" + jsonString); |
| | | post.body(request_json); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("获取三方平台授权token失败:" + execute.body()); |
| | | } |
| | | log.info("获取三方平台授权token响应参数:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("获取三方平台授权token失败:" + baseResult.getMsg()); |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("获取三方平台授权token响应Data:" + decrypt); |
| | | QueryTokenResult queryTokenResult = JSON.parseObject(decrypt, QueryTokenResult.class); |
| | | String token = queryTokenResult.getAccessToken(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.util; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.JacksonUtils; |
| | | import com.ruoyi.common.core.utils.SpringUtils; |
| | | import com.ruoyi.jianguan.model.*; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import com.ruoyi.other.api.feignClient.OperatorClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * 中电联TCEC标准 |
| | | * @author zhibing.pu |
| | | * @Date 2025/1/21 11:48 |
| | | */ |
| | | @Slf4j |
| | | public class TCECUtil { |
| | | |
| | | private static OperatorClient operatorClient = SpringUtils.getBean(OperatorClient.class); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取token |
| | | */ |
| | | public static String queryToken(Operator operator){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.QUERY_TOKEN.getUrl()); |
| | | JSONObject info = new JSONObject(); |
| | | info.put("OperatorID", operator.getOurOperatorId()); |
| | | info.put("OperatorSecret", operator.getOperatorSecret()); |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | BaseRequest baseRequest = new BaseRequest(); |
| | | baseRequest.setOperatorID(operator.getOurOperatorId()); |
| | | baseRequest.setTimeStamp(timeStamp); |
| | | baseRequest.setSeq("0001"); |
| | | String jsonString = JacksonUtils.toJson(info); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | baseRequest.setData(encrypt); |
| | | baseRequest.setOperator(operator); |
| | | baseRequest.setSig(buildSign(baseRequest)); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | log.info("获取三方平台授权token请求地址:" + post.getUrl()); |
| | | log.info("获取三方平台授权token请求参数:" + request_json); |
| | | log.info("获取三方平台授权token请求Data:" + jsonString); |
| | | post.body(request_json); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("获取三方平台授权token失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("获取三方平台授权token响应参数:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("获取三方平台授权token失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | log.info("获取三方平台授权token响应Data:" + decrypt); |
| | | QueryTokenResult queryTokenResult = JSON.parseObject(decrypt, QueryTokenResult.class); |
| | | String token = queryTokenResult.getAccessToken(); |
| | | Long tokenAvailableTime = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC) + queryTokenResult.getTokenAvailableTime(); |
| | | operator.setAccessToken(token); |
| | | operator.setTokenAvailableTime(tokenAvailableTime); |
| | | operatorClient.editOperator(operator); |
| | | return token; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取token |
| | | * @return |
| | | */ |
| | | public static String getToken(Operator operator){ |
| | | if(null != operator.getTokenAvailableTime() && operator.getTokenAvailableTime() > LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)){ |
| | | return operator.getAccessToken(); |
| | | }else{ |
| | | return queryToken(operator); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 设备状态变化推送 |
| | | * @param info |
| | | */ |
| | | public static NotificationStationStatusResult notificationStationStatus(Operator operator, ConnectorStatusInfo info) { |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_STATION_STATUS.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台设备状态失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台设备状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台设备状态失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | log.info("推送三方平台设备状态Data:" + decrypt); |
| | | NotificationStationStatusResult notificationStationStatusResult = JSON.parseObject(decrypt, NotificationStationStatusResult.class); |
| | | return notificationStationStatusResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 推送启动充电结果 |
| | | * @param info |
| | | * @return |
| | | */ |
| | | public static NotificationStartChargeResult notificationStartChargeResult(Operator operator, NotificationStartCharge info){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_START_CHARGE_RESULT.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台启动充电结果失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台启动充电结果响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台启动充电结果失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | log.info("推送三方平台启动充电结果Data:" + decrypt); |
| | | NotificationStartChargeResult notificationStartChargeResult = JSON.parseObject(decrypt, NotificationStartChargeResult.class); |
| | | return notificationStartChargeResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 推动充电状态 |
| | | * @param info |
| | | * @return |
| | | */ |
| | | public static NotificationEquipChargeStatusResult notificationEquipChargeStatus(Operator operator, QueryEquipChargeStatusResult info){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台充电状态失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台充电状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台充电状态失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | log.info("推送三方平台充电状态Data:" + decrypt); |
| | | NotificationEquipChargeStatusResult notificationEquipChargeStatusResult = JSON.parseObject(decrypt, NotificationEquipChargeStatusResult.class); |
| | | return notificationEquipChargeStatusResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送停止充电结果 |
| | | * @param info |
| | | * @return |
| | | */ |
| | | public static NotificationStopCharge notificationStopChargeResult(Operator operator, NotificationStopChargeResult info){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_STOP_CHARGE_RESULT.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台停止充电结果失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台停止充电结果响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台停止充电结果失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | log.info("推送三方平台停止充电结果Data:" + decrypt); |
| | | NotificationStopCharge notificationStopCharge = JSON.parseObject(decrypt, NotificationStopCharge.class); |
| | | return notificationStopCharge; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 推送充电订单信息 |
| | | * @param info |
| | | * @return |
| | | */ |
| | | public static NotificationChargeOrderInfoResult notificationChargeOrderInfo(Operator operator, NotificationChargeOrderInfo info){ |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_CHARGE_ORDER_INFO.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台充电订单信息失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台充电订单信息响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台充电订单信息失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), operator.getDataSecret(), operator.getDataSecretIv()); |
| | | log.info("推送三方平台充电订单信息Data:" + decrypt); |
| | | NotificationChargeOrderInfoResult notificationChargeOrderInfoResult = JSON.parseObject(decrypt, NotificationChargeOrderInfoResult.class); |
| | | return notificationChargeOrderInfoResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 构建请求参数和消息头 |
| | | * @param post |
| | | * @param o |
| | | */ |
| | | public static void buildBody(HttpRequest post, Object o, Operator operator){ |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | post.header("Authorization", "Bearer " + getToken(operator)); |
| | | BaseRequest baseRequest = new BaseRequest(); |
| | | baseRequest.setOperatorID(operator.getOurOperatorId()); |
| | | baseRequest.setTimeStamp(timeStamp); |
| | | baseRequest.setSeq("0001"); |
| | | String jsonString = JacksonUtils.toJson(o); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | baseRequest.setData(encrypt); |
| | | baseRequest.setOperator(operator); |
| | | baseRequest.setSig(buildSign(baseRequest)); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | post.body(request_json); |
| | | log.info("推送三方平台请求地址:" + post.getUrl()); |
| | | log.info("推送三方平台请求参数:" + request_json); |
| | | log.info("推送三方平台请求Data:" + jsonString); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 构建签名字符串 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | public static String buildSign(BaseModel model){ |
| | | Operator operator = model.getOperator(); |
| | | if(null == operator){ |
| | | return ""; |
| | | } |
| | | //签名秘钥SigSecret |
| | | String key = operator.getSigSecret(); |
| | | String sign = ""; |
| | | switch (operator.getName()){ |
| | | case "XinDianTu": |
| | | //进行字符串拼接、计算 |
| | | String m = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | byte[] hmacMd5 = SignUtil.getHMacMD5Bytes(key.getBytes(), m.getBytes()); |
| | | // 打印计算得到的签名Sig |
| | | sign = SignUtil.bytesToHexString(hmacMd5); |
| | | break; |
| | | case "KuaiDian": |
| | | //进行字符串拼接、计算 |
| | | String m1 = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | // 打印计算得到的签名Sig |
| | | sign = SignUtil.hmacSign(m1, key); |
| | | break; |
| | | } |
| | | return sign; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 构建签名字符串 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | public static String ourBuildSign(BaseModel model){ |
| | | Operator operator = model.getOperator(); |
| | | if(null == operator){ |
| | | return ""; |
| | | } |
| | | //签名秘钥SigSecret |
| | | String key = operator.getOurSigSecret(); |
| | | String sign = ""; |
| | | switch (operator.getName()){ |
| | | case "XinDianTu": |
| | | //进行字符串拼接、计算 |
| | | String m = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | byte[] hmacMd5 = SignUtil.getHMacMD5Bytes(key.getBytes(), m.getBytes()); |
| | | // 打印计算得到的签名Sig |
| | | sign = SignUtil.bytesToHexString(hmacMd5); |
| | | break; |
| | | case "KuaiDian": |
| | | //进行字符串拼接、计算 |
| | | String m1 = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | sign = SignUtil.hmacSign(m1, key); |
| | | break; |
| | | } |
| | | return sign; |
| | | } |
| | | public static String ourBuildSignJianGuan(BaseModel model){ |
| | | Operator operator = model.getOperator(); |
| | | if(null == operator){ |
| | | return ""; |
| | | } |
| | | //签名秘钥SigSecret |
| | | String key = operator.getOurSigSecret(); |
| | | String sign = ""; |
| | | //进行字符串拼接、计算 |
| | | String m1 = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | sign = SignUtil.hmacSign(m1, key); |
| | | return sign; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | BaseModel model = new BaseModel(); |
| | | model.setOperatorID("MA25CNM38"); |
| | | model.setData("AoArdDDcmHcmOMkCLHodTpY1xLtt9yhLqxvKPyfdlmEOBj1LJnQM+Z4JOZllt3Pj9rubfgxJ51zMAfzquQegJzHGAT9Y7JrKFzFe6jGtXo0="); |
| | | model.setTimeStamp(20250205120800L); |
| | | model.setSeq("0001"); |
| | | Operator operator = new Operator(); |
| | | operator.setName("XinDianTu"); |
| | | operator.setSigSecret("S94xUpTpOIlLJBk8"); |
| | | model.setOperator(operator); |
| | | String key = operator.getSigSecret(); |
| | | |
| | | String m = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | byte[] hmacMd5 = SignUtil.getHMacMD5Bytes(key.getBytes(), m.getBytes()); |
| | | // 打印计算得到的签名Sig |
| | | String s = SignUtil.bytesToHexString(hmacMd5); |
| | | System.err.println(s); |
| | | |
| | | |
| | | // BaseModel model = new BaseModel(); |
| | | // model.setOperatorID("MA25CNM38"); |
| | | // model.setData("xQYYEPiwoc4JENnQsF50qP6Tmnj7uU/AshWn3QbIgrMIk8zvFpy6fWLIiLzQHcLPFCihqH1uzoNhGVNcS8Wvf5gIx9+cWJvYtjwtsjAGMEwNQ6y+rF1jjKnqCNcQbHbhqJ2l76sD54QCFKyenKxymrXri19bDV8hizn3nBw+jcHBtqKHWzjdSHwPDWPIw4rXnrbWLya2PXVgYtVg93WPtliw+0xsqW0BxJamE70/Ilbg4wB5fOAOvXmbLFI+v9jRjpcA7ImhprqPMYkXYAfa2QlICrJEBK7DfpJvRMzKzeT90kOAITqIqFvbfV0ti+greRqToLP6ni4o6w3ID42UmKasIpLTnx+qtR4bVTBTRuDzXvNXDA92RqHaJO21xbSen1eHN/yGfrchBIM0gmav7EpaYAerfU4ubnmJ6xujR6okYepJwBD5DiSIrObfS+GWVPRekvnjvm7BC02NXTrGKA=="); |
| | | // model.setTimeStamp(20250205161426L); |
| | | // model.setSeq("0001"); |
| | | // Operator operator = new Operator(); |
| | | // operator.setOurOperatorId("2921700136"); |
| | | // operator.setOurSigSecret("KBm5J2fbGzyhX023"); |
| | | // model.setOperator(operator); |
| | | // String key = operator.getOurSigSecret(); |
| | | // |
| | | // String m = new StringBuilder(operator.getOurOperatorId()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); |
| | | // byte[] hmacMd5 = SignUtil.getHMacMD5Bytes(key.getBytes(), m.getBytes()); |
| | | // // 打印计算得到的签名Sig |
| | | // String s = SignUtil.bytesToHexString(hmacMd5); |
| | | // System.err.println(s); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.util; |
| | | |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.exception.auth.NotLoginException; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * token验证处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class TokenUtil { |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | protected static final long MILLIS_SECOND = 1000; |
| | | |
| | | protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; |
| | | |
| | | private final static long expireTime = CacheConstants.EXPIRATION; |
| | | private final static long expireAppletTime = CacheConstants.EXPIRATION_APPLET; |
| | | |
| | | private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY; |
| | | |
| | | private final static Long MILLIS_MINUTE_TEN = CacheConstants.REFRESH_TIME * MILLIS_MINUTE; |
| | | |
| | | /** |
| | | * 创建令牌 |
| | | */ |
| | | public Map<String, Object> createToken(Operator operator) { |
| | | String token = IdUtils.fastUUID(); |
| | | operator.setToken(token); |
| | | refreshToken(operator); |
| | | |
| | | // Jwt存储信息 |
| | | Map<String, Object> claimsMap = new HashMap<String, Object>(); |
| | | claimsMap.put(SecurityConstants.USER_KEY, token); |
| | | claimsMap.put(SecurityConstants.DETAILS_USER_ID, operator.getOperatorId()); |
| | | claimsMap.put(SecurityConstants.USER_TYPE, "system"); |
| | | claimsMap.put(SecurityConstants.DETAILS_USERNAME, operator.getName()); |
| | | |
| | | // 接口返回信息 |
| | | Map<String, Object> rspMap = new HashMap<String, Object>(); |
| | | rspMap.put("access_token", JwtUtils.createToken(claimsMap)); |
| | | rspMap.put("expires_in", expireTime); |
| | | return rspMap; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户身份信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | public Operator getLoginUser() { |
| | | Operator loginUser = getLoginUser(ServletUtils.getRequest()); |
| | | if (loginUser == null) { |
| | | throw new NotLoginException("令牌已过期,请重新登录!"); |
| | | } |
| | | return loginUser; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户身份信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | public Operator getLoginUser(HttpServletRequest request) { |
| | | // 获取请求携带的令牌 |
| | | String token = SecurityUtils.getToken(request); |
| | | return getLoginUser(token); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户身份信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | public Operator getLoginUser(String token) { |
| | | Operator user = null; |
| | | try { |
| | | if (StringUtils.isNotEmpty(token)) { |
| | | String userkey = JwtUtils.getUserKey(token); |
| | | user = redisService.getCacheObject(getTokenKey(userkey)); |
| | | return user; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return user; |
| | | } |
| | | |
| | | /** |
| | | * 设置用户身份信息 |
| | | */ |
| | | public void setLoginUser(Operator operator) { |
| | | if (StringUtils.isNotNull(operator) && StringUtils.isNotEmpty(operator.getToken())) { |
| | | refreshToken(operator); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除用户缓存信息 |
| | | */ |
| | | public void delLoginUser(String token) { |
| | | if (StringUtils.isNotEmpty(token)) { |
| | | String userkey = JwtUtils.getUserKey(token); |
| | | redisService.deleteObject(getTokenKey(userkey)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证令牌有效期,相差不足120分钟,自动刷新缓存 |
| | | * |
| | | * @param operator |
| | | */ |
| | | public void verifyToken(Operator operator) { |
| | | long expireTime = operator.getExpireTime(); |
| | | long currentTime = System.currentTimeMillis(); |
| | | if (expireTime - currentTime <= MILLIS_MINUTE_TEN) { |
| | | refreshToken(operator); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 刷新令牌有效期 |
| | | * |
| | | * @param operator 登录信息 |
| | | */ |
| | | public void refreshToken(Operator operator) { |
| | | operator.setLoginTime(System.currentTimeMillis()); |
| | | operator.setExpireTime(operator.getLoginTime() + expireTime * MILLIS_MINUTE); |
| | | // 根据uuid将loginUser缓存 |
| | | String userKey = getTokenKey(operator.getToken()); |
| | | redisService.setCacheObject(userKey, operator, expireTime, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | |
| | | private String getTokenKey(String token) { |
| | | return ACCESS_TOKEN + token; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel("大屏 停车场充电功率曲线Vo") |
| | | public class LargeChargingPowerVo { |
| | | @ApiModelProperty("时间") |
| | | private String time; |
| | | |
| | | @ApiModelProperty("平均功率") |
| | | private BigDecimal power=BigDecimal.ZERO; |
| | | } |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | # active: dev |
| | | active: prod |
| | | active: dev |
| | | # active: prod |
| | | |
| | | --- |
| | | spring: |
| | |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.export.*; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | 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.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.dto.SettlementConfirmAdd; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.query.SettlementListQuery; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderListVO; |
| | | import com.ruoyi.order.api.vo.SettlementTotalVO; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.export.OrderInvoiceExport; |
| | | import com.ruoyi.order.export.TChargingOrderExport; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.api.vo.SettlementTotalVO; |
| | | import com.ruoyi.order.export.TChargingOrderExport; |
| | | import com.ruoyi.order.service.AccountingStrategyOrderService; |
| | | import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TSettlementConfirmService; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
New file |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.vo.GovernmentCloudChargingPileVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.vo.GovernmentCloudOrderVO; |
| | | import com.ruoyi.order.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/governmentCloudOrder") |
| | | public class GovernmentCloudOrderController { |
| | | @Autowired |
| | | private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService; |
| | | @Autowired |
| | | private AccountingStrategyOrderService accountingStrategyOrderService; |
| | | @Autowired |
| | | private TChargingBillService chargingBillService; |
| | | @Autowired |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | @Autowired |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | | @Autowired |
| | | private TChargingOrderService chargingOrderService; |
| | | @Autowired |
| | | private TExchangeOrderService exchangeOrderService; |
| | | @Autowired |
| | | private TGrantVipService grantVipService; |
| | | @Autowired |
| | | private TOrderAppealService orderAppealService; |
| | | @Autowired |
| | | private TOrderEvaluateService orderEvaluateService; |
| | | @Autowired |
| | | private TOrderEvaluateTagService orderEvaluateTagService; |
| | | @Autowired |
| | | private TOrderInvoiceDetailService orderInvoiceDetailService; |
| | | @Autowired |
| | | private TOrderInvoiceService orderInvoiceService; |
| | | @Autowired |
| | | private TSettlementConfirmService settlementConfirmService; |
| | | @Autowired |
| | | private TShoppingOrderRefundService shoppingOrderRefundService; |
| | | @Autowired |
| | | private TShoppingOrderService shoppingOrderService; |
| | | @Autowired |
| | | private TVipOrderRefundService vipOrderRefundService; |
| | | @Autowired |
| | | private TVipOrderService vipOrderService; |
| | | |
| | | |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudOrderVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<AccountingStrategyDetailOrder> list1 = accountingStrategyDetailOrderService.lambdaQuery().between(AccountingStrategyDetailOrder::getCreateTime, start, end).list(); |
| | | List<AccountingStrategyOrder> list2 = accountingStrategyOrderService.lambdaQuery().between(AccountingStrategyOrder::getCreateTime, start, end).list(); |
| | | List<TChargingBill> list3 = chargingBillService.lambdaQuery().between(TChargingBill::getCreateTime, start, end).list(); |
| | | List<TChargingOrderAccountingStrategy> list4 = chargingOrderAccountingStrategyService.lambdaQuery().between(TChargingOrderAccountingStrategy::getCreateTime, start, end).list(); |
| | | List<TChargingOrderRefund> list5 = chargingOrderRefundService.lambdaQuery().between(TChargingOrderRefund::getCreateTime, start, end).list(); |
| | | List<TChargingOrder> list6 = chargingOrderService.lambdaQuery().between(TChargingOrder::getCreateTime, start, end).list(); |
| | | List<TExchangeOrder> list7 = exchangeOrderService.lambdaQuery().between(TExchangeOrder::getCreateTime, start, end).list(); |
| | | List<TGrantVip> list8 = grantVipService.lambdaQuery().between(TGrantVip::getCreateTime, start, end).list(); |
| | | List<TOrderAppeal> list9 = orderAppealService.lambdaQuery().between(TOrderAppeal::getCreateTime, start, end).list(); |
| | | List<TOrderEvaluate> list10 = orderEvaluateService.lambdaQuery().between(TOrderEvaluate::getCreateTime, start, end).list(); |
| | | List<TOrderEvaluateTag> list11 = orderEvaluateTagService.lambdaQuery().between(TOrderEvaluateTag::getCreateTime, start, end).list(); |
| | | List<TOrderInvoiceDetail> list12 = orderInvoiceDetailService.lambdaQuery().between(TOrderInvoiceDetail::getCreateTime, start, end).list(); |
| | | List<TOrderInvoice> list13 = orderInvoiceService.lambdaQuery().between(TOrderInvoice::getCreateTime, start, end).list(); |
| | | List<TSettlementConfirm> list14 = settlementConfirmService.lambdaQuery().between(TSettlementConfirm::getCreateTime, start, end).list(); |
| | | List<TShoppingOrderRefund> list15 = shoppingOrderRefundService.lambdaQuery().between(TShoppingOrderRefund::getCreateTime, start, end).list(); |
| | | List<TVipOrderRefund> list16 = vipOrderRefundService.lambdaQuery().between(TVipOrderRefund::getCreateTime, start, end).list(); |
| | | List<TVipOrder> list17 = vipOrderService.lambdaQuery().between(TVipOrder::getCreateTime, start, end).list(); |
| | | List<TShoppingOrder> list18 = shoppingOrderService.lambdaQuery().between(TShoppingOrder::getCreateTime, start, end).list(); |
| | | |
| | | governmentCloudAccountVO.setAccountingStrategyDetailOrders(list1); |
| | | governmentCloudAccountVO.setAccountingStrategyOrders(list2); |
| | | governmentCloudAccountVO.setChargingBills(list3); |
| | | governmentCloudAccountVO.setChargingOrderAccountingStrategies(list4); |
| | | governmentCloudAccountVO.setChargingOrderRefunds(list5); |
| | | governmentCloudAccountVO.setChargingOrders(list6); |
| | | governmentCloudAccountVO.setExchangeOrders(list7); |
| | | governmentCloudAccountVO.setGrantVips(list8); |
| | | governmentCloudAccountVO.setOrderAppeals(list9); |
| | | governmentCloudAccountVO.setOrderEvaluates(list10); |
| | | governmentCloudAccountVO.setOrderEvaluateTags(list11); |
| | | governmentCloudAccountVO.setOrderInvoiceDetails(list12); |
| | | governmentCloudAccountVO.setOrderInvoices(list13); |
| | | governmentCloudAccountVO.setSettlementConfirms(list14); |
| | | governmentCloudAccountVO.setShoppingOrderRefunds(list15); |
| | | governmentCloudAccountVO.setShoppingOrders(list18); |
| | | governmentCloudAccountVO.setVipOrders(list17); |
| | | governmentCloudAccountVO.setVipOrderRefunds(list16); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.order.controller; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | import com.ruoyi.order.util.PreviousSixMonths; |
| | | import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import com.ruoyi.order.vo.WatchChargingOrderVo; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | |
| | | @RequestParam("attach") String attach) { |
| | | chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | } |
| | | |
| | | /** |
| | | * 支付宝H5支付成功后的回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingOrderALIH5Callback") |
| | | public void chargingOrderALIH5Callback(@RequestParam("out_trade_no") String out_trade_no, |
| | | @RequestParam("transaction_id") String transaction_id, |
| | | @RequestParam("attach") String attach) { |
| | | chargingOrderService.chargingOrderCallback(3, out_trade_no, transaction_id, attach); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | |
| | | public R addChargingOrderSummaryData(){ |
| | | return chargingOrderService.addChargingOrderSummaryData(); |
| | | } |
| | | |
| | | /** |
| | | * 充电桩数据大屏 新能源汽车电池安全检测次数统计 |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping(value = "/getStatisticsOfBattery") |
| | | @ApiOperation(value = "新能源汽车电池安全检测次数统计", tags = {"充电桩数据大屏"}) |
| | | public R<StatisticsOfBatteryVO> getStatisticsOfBattery(){ |
| | | |
| | | return chargingOrderService.getStatisticsOfBattery(); |
| | | } |
| | | |
| | | /** |
| | | * 充电桩数据大屏 获取站点集合中总的充电量 |
| | | */ |
| | | @GetMapping("/getSumDegreeBySiteIds") |
| | | public R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds){ |
| | | return R.ok(chargingOrderService.getSumDegreeBySiteIds(SiteIds)); |
| | | } |
| | | |
| | | |
| | | @GetMapping(value = "/getOrderIdByUserId") |
| | | @ApiOperation(value = "H5查询当前用户正在充电中的订单id集合", tags = {"H5-首页-用户充电订单信息"}) |
| | | public R<String> getOrderIdByUserId() { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TChargingOrder chargingOrder = chargingOrderService.getOne(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | .eq(TChargingOrder::getAppUserId, userId) |
| | | .in(TChargingOrder::getStatus, Arrays.asList(1,2,3,4)) |
| | | .orderByDesc(TChargingOrder::getCreateTime) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(chargingOrder)){ |
| | | return R.ok(); |
| | | } |
| | | return R.ok(String.valueOf(chargingOrder.getId())); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | |
| | | orderAppealService.save(orderAppeal); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 查询订单申诉详情 |
| | | */ |
| | | @GetMapping(value = "/getDetailByOrderId") |
| | | @ApiOperation(tags = {"H5-通过订单id查询订单申诉"},value = "通过订单id查询订单申诉") |
| | | public R<TOrderAppealVO> getDetailByOrderId(String orderId) { |
| | | TOrderAppeal orderAppeal = orderAppealService.getOne(Wrappers.lambdaQuery(TOrderAppeal.class) |
| | | .eq(TOrderAppeal::getOrderId,orderId) |
| | | .orderByDesc(TOrderAppeal::getCreateTime) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(orderAppeal)){ |
| | | return R.ok(); |
| | | } |
| | | return R.ok(orderAppealService.getDetailById(String.valueOf(orderAppeal.getId()))); |
| | | } |
| | | } |
| | | |
| | |
| | | private Long appUserCouponId; |
| | | @ApiModelProperty("车辆id") |
| | | private Long appUserCarId; |
| | | @ApiModelProperty("支付方式(1=微信,2=支付宝)") |
| | | @ApiModelProperty("支付方式(1=微信,2=支付宝 3=支付宝h5)") |
| | | private Integer paymentType; |
| | | @ApiModelProperty("回跳地址") |
| | | private String returnUrl; |
| | | |
| | | } |
| | |
| | | private List<Map<String, Object>> power; |
| | | @ApiModelProperty("是否可申诉(0=否,1=是)") |
| | | private Integer actionable; |
| | | @ApiModelProperty("H5是否可申诉(0=否,1=是)") |
| | | private Integer isAppeal; |
| | | @ApiModelProperty("充电枪id") |
| | | private Integer chargingGunId; |
| | | } |
| | |
| | | import com.ruoyi.order.api.vo.ChargingOrderListVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.vo.OrderCountByDate; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | Long countNoTag(); |
| | | |
| | | Long countCar(@Param("brands") List<String> brands); |
| | | |
| | | List<OrderCountByDate> countOrdersByDate(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime,@Param("gunIds")List<Integer> gunIds); |
| | | |
| | | BigDecimal getSumDegreeBySiteIds(@Param("siteIds") List<Integer> siteIds); |
| | | } |
| | |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | |
| | | |
| | | |
| | | R addChargingOrderSummaryData(); |
| | | |
| | | /** |
| | | * 大屏-新能源汽车电池安全检测次数统计 |
| | | */ |
| | | R<StatisticsOfBatteryVO> getStatisticsOfBattery(); |
| | | |
| | | BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds); |
| | | } |
| | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.*; |
| | | import com.ruoyi.account.api.model.*; |
| | |
| | | import com.ruoyi.common.core.dto.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | import com.ruoyi.order.util.mongodb.service.TransactionRecordService; |
| | | import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.OrderCountByDate; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.*; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.H5AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | |
| | | |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | @Resource |
| | | private H5AliPaymentClient h5AliPaymentClient; |
| | | |
| | | @Resource |
| | | private AppCouponClient appCouponClient; |
| | |
| | | |
| | | @Resource |
| | | private ITChargingOrderSummaryDataService chargingOrderSummaryDataService; |
| | | @Resource |
| | | private TOrderAppealService orderAppealService; |
| | | |
| | | |
| | | |
| | |
| | | TChargingOrder chargingOrder = this.getById(id); |
| | | MyChargingOrderInfo myChargingOrderInfo = new MyChargingOrderInfo(); |
| | | myChargingOrderInfo.setId(id); |
| | | myChargingOrderInfo.setChargingGunId(chargingOrder.getChargingGunId()); |
| | | myChargingOrderInfo.setCode(chargingOrder.getCode()); |
| | | myChargingOrderInfo.setCreateTime(chargingOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | myChargingOrderInfo.setStatus(chargingOrder.getStatus()); |
| | |
| | | myChargingOrderInfo.setPower(power); |
| | | } |
| | | myChargingOrderInfo.setActionable(myChargingOrderInfo.getEndTime() + 604800000L < System.currentTimeMillis() ? 0 : 1); |
| | | long count = orderAppealService.count(Wrappers.lambdaQuery(TOrderAppeal.class) |
| | | .eq(TOrderAppeal::getOrderId, id)); |
| | | myChargingOrderInfo.setIsAppeal(count>0?0:1); |
| | | return myChargingOrderInfo; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | if(3 == rechargePaymentType){ |
| | | AliQueryOrder data = h5AliPaymentClient.query(tChargingOrder.getCode()).getData(); |
| | | if(null != data){ |
| | | //支付失败,删除无效的订单 |
| | | String tradeStatus = data.getTradeStatus(); |
| | | if(null != tradeStatus && tradeStatus.equals("TRADE_CLOSED")){ |
| | | this.removeById(tChargingOrder.getId()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //检查当前枪是否是正在使用中 |
| | |
| | | if(trade_state.equals("WAIT_BUYER_PAY")){ |
| | | //结束第三方支付,删除订单 |
| | | aliPaymentClient.close(one.getCode()); |
| | | this.removeById(one.getId()); |
| | | } |
| | | } |
| | | } |
| | | if(3 == one.getRechargePaymentType()){ |
| | | AliQueryOrder data = h5AliPaymentClient.query(one.getCode()).getData(); |
| | | if(null != data){ |
| | | String trade_state = data.getTradeStatus(); |
| | | //支付失败,删除无效的订单 |
| | | if(trade_state.equals("TRADE_CLOSED")){ |
| | | this.removeById(one.getId()); |
| | | } |
| | | if(trade_state.equals("WAIT_BUYER_PAY")){ |
| | | //结束第三方支付,删除订单 |
| | | h5AliPaymentClient.close(one.getCode()); |
| | | this.removeById(one.getId()); |
| | | } |
| | | } |
| | |
| | | AliPaymentResp data = aliPaymentClient.payment(req).getData(); |
| | | if(null != data){ |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
| | | if(3 == addChargingOrder.getPaymentType()){ |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(chargingOrder.getCode()); |
| | | req.setTotalAmount(addChargingOrder.getPaymentAmount().toString()); |
| | | req.setSubject("充电充值"); |
| | | req.setBuyerOpenId(appUser.getAliOpenid()); |
| | | req.setBody("充电充值"); |
| | | req.setNotifyUrl("/payment/aliH5/callBack"); |
| | | req.setReturnUrl(addChargingOrder.getReturnUrl()); |
| | | String data = h5AliPaymentClient.payment(req).getData(); |
| | | if(StringUtils.hasLength(data)){ |
| | | return AjaxResult.success("操作成功",data); |
| | | } |
| | | } |
| | | throw new RuntimeException("无效的支付方式"); |
| | |
| | | chargingOrderStartupFailureWxRefund(chargingOrderRefund.getRefundCode(), resp.getTradeNo(), "SUCCESS", null); |
| | | } |
| | | } |
| | | if(3 == rechargePaymentType){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(chargingOrder.getCode()); |
| | | dto.setOutRequestNo(chargingOrderRefund.getCode()); |
| | | dto.setRefundAmount(rechargeAmount.toString()); |
| | | dto.setRefundReason("充电失败,取消充电订单"); |
| | | RefundResp resp = h5AliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | //回退会员折扣次数 |
| | | if(chargingOrder.getVipDiscountAmount().compareTo(BigDecimal.ZERO) > 0){ |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); |
| | | getAppUserVipDetail.setAppUserId(chargingOrder.getAppUserId()); |
| | | getAppUserVipDetail.setVipId(appUser.getVipId()); |
| | | TAppUserVipDetail data = appUserVipDetailClient.getAppUserVipDetail(getAppUserVipDetail).getData(); |
| | | if(null != data){ |
| | | data.setChargeNum(data.getChargeNum() + 1); |
| | | appUserVipDetailClient.updateAppUserVipDetail(data); |
| | | } |
| | | } |
| | | |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | chargingOrderStartupFailureWxRefund(chargingOrderRefund.getRefundCode(), resp.getTradeNo(), "SUCCESS", null); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | chargingOrderStartupFailureWxRefund(chargingOrderRefund.getRefundCode(), resp.getTradeNo(), "SUCCESS", null); |
| | | } |
| | | } |
| | | |
| | | if(3 == rechargePaymentType){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(chargingOrder.getCode()); |
| | | dto.setOutRequestNo(chargingOrderRefund.getCode()); |
| | | dto.setRefundAmount(money.toString()); |
| | | dto.setRefundReason("充电完成退款"); |
| | | RefundResp resp = h5AliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | chargingOrderStartupFailureWxRefund(chargingOrderRefund.getRefundCode(), resp.getTradeNo(), "SUCCESS", null); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | this.chargingOrderStartupFailureWxRefund(chargingOrderRefund.getRefundCode(), resp.getTradeNo(), "SUCCESS", null); |
| | | } |
| | | } |
| | | |
| | | if(3 == rechargePaymentType){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(chargingOrder.getCode()); |
| | | dto.setOutRequestNo(chargingOrderRefund.getRefundCode()); |
| | | dto.setRefundAmount(refundAmount.toString()); |
| | | dto.setRefundReason("充电完成退款"); |
| | | RefundResp resp = h5AliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | this.chargingOrderStartupFailureWxRefund(chargingOrderRefund.getRefundCode(), resp.getTradeNo(), "SUCCESS", null); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | } |
| | | if(3 == tChargingOrder.getRechargePaymentType()){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(tChargingOrder.getCode()); |
| | | dto.setOutRequestNo(tChargingOrder.getCode()); |
| | | dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = h5AliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | chargingOrderRefund.setRefundStatus(2); |
| | | chargingOrderRefund.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | | this.baseMapper.updateById(tChargingOrder); |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | |
| | | } |
| | | } |
| | | } |
| | | if (payOrderQueryDto.getType()==2){ |
| | | TShoppingOrder tChargingOrder = shoppingOrderService.getById(payOrderQueryDto.getOrderId()); |
| | |
| | | shoppingOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | | } |
| | | if(3 == tChargingOrder.getPaymentType()){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(tChargingOrder.getCode()); |
| | | dto.setOutRequestNo(tChargingOrder.getCode()); |
| | | dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = h5AliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | tChargingOrder.setRefundStatus(2); |
| | | tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | | shoppingOrderService.updateById(tChargingOrder); |
| | | shoppingOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | tChargingOrder.setRefundStatus(2); |
| | | tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | | vipOrderService.updateById(tChargingOrder); |
| | | vipOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | | } |
| | | if(3 == tChargingOrder.getPaymentType()){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(tChargingOrder.getCode()); |
| | | dto.setOutRequestNo(tChargingOrder.getCode()); |
| | | dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = h5AliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | tChargingOrder.setRefundStatus(2); |
| | | tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 大屏-新能源汽车电池安全检测次数统计 |
| | | */ |
| | | @Override |
| | | public R<StatisticsOfBatteryVO> getStatisticsOfBattery() { |
| | | StatisticsOfBatteryVO vo = new StatisticsOfBatteryVO(); |
| | | //1.计算累计次数 |
| | | //查询该俩站点的快充和超充的充电枪id集合 site_id 25 26 charge_model 1 2 |
| | | R<List<Integer>> r = chargingGunClient.getGunIdsBySiteIdsAndChargeModels(Arrays.asList(25,26),Arrays.asList(1,2)); |
| | | if (r.getCode()!=200){ |
| | | return R.ok(vo); |
| | | } |
| | | List<Integer> gunIds=r.getData(); |
| | | //统计 |
| | | Long total= 0L; |
| | | if(gunIds!=null && !gunIds.isEmpty()) { |
| | | total = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getDelFlag, 0)//未删除 |
| | | .in(TChargingOrder::getStatus, Arrays.asList(3, 5))//充电中、已结束 |
| | | .in(TChargingOrder::getChargingGunId, gunIds));//符合条件的充电枪 |
| | | } |
| | | vo.setTotal(total.intValue()); |
| | | //2.折线图 |
| | | /* // 计算日期范围:前七天(不含今日)直接查找数据量太大,内存报错 |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDateTime startDate = today.minusDays(7).atStartOfDay(); |
| | | LocalDateTime endDate = today.minusDays(1).atTime(LocalTime.MAX); |
| | | // 查询数据库 |
| | | List<OrderCountByDate> orderCounts = this.baseMapper.countOrdersByDate(startDate, endDate, gunIds);*/ |
| | | |
| | | |
| | | List<LocalDate> dates = new ArrayList<>(); |
| | | List<Integer> counts = new ArrayList<>(); |
| | | LocalDate today = LocalDate.now(); |
| | | // 直接查找数据量太大,内存报错,分每天查找 |
| | | for (int i = 7; i >= 1; i--) {//升序 |
| | | LocalDate day = today.minusDays(i); |
| | | LocalDateTime startOfDay = day.atStartOfDay(); |
| | | LocalDateTime endOfDay = day.atTime(LocalTime.MAX); |
| | | //统计 |
| | | Long count=0L; |
| | | if(gunIds!=null && !gunIds.isEmpty()){ |
| | | count = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getDelFlag,0)//未删除 |
| | | .in(TChargingOrder::getStatus,Arrays.asList(3,5))//充电中、已结束 |
| | | .in(TChargingOrder::getChargingGunId,gunIds)//符合条件的充电枪 站点 超充快充 |
| | | .between(TChargingOrder::getCreateTime,startOfDay,endOfDay));//每天 |
| | | } |
| | | dates.add(day); |
| | | counts.add(count.intValue()); |
| | | } |
| | | vo.setDates(dates); |
| | | vo.setCounts(counts); |
| | | return R.ok(vo); |
| | | } |
| | | @Override |
| | | public BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds) { |
| | | |
| | | return this.baseMapper.getSumDegreeBySiteIds(siteIds); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | public class OrderCountByDate { |
| | | |
| | | private LocalDate date; |
| | | private Long count; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class StatisticsOfBatteryVO { |
| | | @ApiModelProperty("累计检测") |
| | | private Integer total; |
| | | @ApiModelProperty("日期") |
| | | private List<LocalDate> dates; |
| | | @ApiModelProperty("次数") |
| | | private List<Integer> counts; |
| | | } |
| | |
| | | and t1.del_flag = 0 |
| | | ) |
| | | </select> |
| | | <select id="countOrdersByDate" resultType="com.ruoyi.order.vo.OrderCountByDate"> |
| | | SELECT DATE_FORMAT(create_time, '%m/%d') AS `date`, COUNT(*) AS `count` |
| | | FROM t_charging_order |
| | | WHERE |
| | | del_flag = 0 |
| | | and |
| | | status in (3,5) |
| | | |
| | | and charging_gun_id in |
| | | <foreach item="item" index="index" collection="gunIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | and create_time BETWEEN #{startTime} AND #{endTime} |
| | | GROUP BY DATE(create_time, '%m/%d') |
| | | ORDER BY DATE(create_time, '%m/%d') ASC |
| | | </select> |
| | | |
| | | <select id="getSumDegreeBySiteIds" resultType="java.math.BigDecimal"> |
| | | select sum(t2.charging_capacity) from t_charging_order t1 left join t_charging_order_summary_data t2 |
| | | on t1.id =t2. charging_order_id where t1.del_flag=0 |
| | | and t1.site_id in |
| | | <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.vo.GovernmentCloudOrderVO; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.api.vo.GovernmentCloudOtherVO; |
| | | import com.ruoyi.other.service.*; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-08-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/governmentCloudOther") |
| | | public class GovernmentCloudOtherController { |
| | | @Autowired |
| | | private OperatorService operatorService; |
| | | @Autowired |
| | | private TActivityService activityService; |
| | | @Autowired |
| | | private TAdvertisingService advertisingService; |
| | | @Autowired |
| | | private TCompanyService companyService; |
| | | @Autowired |
| | | private TCouponService couponService; |
| | | @Autowired |
| | | private TEnterpriseUserApplicationService enterpriseUserApplicationService; |
| | | @Autowired |
| | | private TEvaluationTagService evaluationTagService; |
| | | @Autowired |
| | | private TGoodsService goodsService; |
| | | @Autowired |
| | | private THtmlService htmlService; |
| | | @Autowired |
| | | private TIntegralRuleService integralRuleService; |
| | | @Autowired |
| | | private TInvoiceTypeService invoiceTypeService; |
| | | @Autowired |
| | | private TNoticeService noticeService; |
| | | @Autowired |
| | | private TRoleSiteService roleSiteService; |
| | | @Autowired |
| | | private TSystemConfigurationService systemConfigurationService; |
| | | @Autowired |
| | | private TUserSiteService userSiteService; |
| | | @Autowired |
| | | private TUserTagService userTagService; |
| | | @Autowired |
| | | private TVipService vipService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudOtherVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | GovernmentCloudOtherVO governmentCloudAccountVO = new GovernmentCloudOtherVO(); |
| | | |
| | | |
| | | List<Operator> list1 = operatorService.lambdaQuery().list(); |
| | | List<TActivity> list2 = activityService.lambdaQuery().between(TActivity::getCreateTime, start, end).list(); |
| | | List<TAdvertising> list3 = advertisingService.lambdaQuery().between(TAdvertising::getCreateTime, start, end).list(); |
| | | List<TCompany> list4 = companyService.lambdaQuery().between(TCompany::getCreateTime, start, end).list(); |
| | | List<TCoupon> list5 = couponService.lambdaQuery().between(TCoupon::getCreateTime, start, end).list(); |
| | | List<TEnterpriseUserApplication> list6 = enterpriseUserApplicationService.lambdaQuery().between(TEnterpriseUserApplication::getCreateTime, start, end).list(); |
| | | List<TEvaluationTag> list7 = evaluationTagService.lambdaQuery().between(TEvaluationTag::getCreateTime, start, end).list(); |
| | | List<TGoods> list8 = goodsService.lambdaQuery().between(TGoods::getCreateTime, start, end).list(); |
| | | List<THtml> list9 = htmlService.lambdaQuery().list(); |
| | | List<TIntegralRule> list10 = integralRuleService.lambdaQuery().list(); |
| | | List<TInvoiceType> list11 = invoiceTypeService.lambdaQuery().between(TInvoiceType::getCreateTime, start, end).list(); |
| | | List<TNotice> list12 = noticeService.lambdaQuery().between(TNotice::getCreateTime, start, end).list(); |
| | | // List<TRoleSite> list13 = roleSiteService.lambdaQuery().between(TRoleSite::getCreateTime, start, end).list(); |
| | | List<TSystemConfiguration> list14 = systemConfigurationService.lambdaQuery().list(); |
| | | // List<TUserSite> list15 = userSiteService.lambdaQuery().between(TUserSite::getCreateTime, start, end).list(); |
| | | List<TUserTag> list16 = userTagService.lambdaQuery().between(TUserTag::getCreateTime, start, end).list(); |
| | | List<TVip> list17 = vipService.lambdaQuery().between(TVip::getCreateTime, start, end).list(); |
| | | governmentCloudAccountVO.setOperators(list1); |
| | | governmentCloudAccountVO.setActivities(list2); |
| | | governmentCloudAccountVO.setAdvertisings(list3); |
| | | governmentCloudAccountVO.setCompanies(list4); |
| | | governmentCloudAccountVO.setCoupons(list5); |
| | | governmentCloudAccountVO.setEnterpriseUserApplications(list6); |
| | | governmentCloudAccountVO.setEvaluationTags(list7); |
| | | governmentCloudAccountVO.setGoods(list8); |
| | | governmentCloudAccountVO.setHtmls(list9); |
| | | governmentCloudAccountVO.setIntegralRules(list10); |
| | | governmentCloudAccountVO.setInvoiceTypes(list11); |
| | | governmentCloudAccountVO.setNotices(list12); |
| | | governmentCloudAccountVO.setSystemConfigurations(list14); |
| | | governmentCloudAccountVO.setUserTags(list16); |
| | | governmentCloudAccountVO.setVips(list17); |
| | | |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.domain.TScreenContent; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.api.dto.NoticeQueryDto; |
| | | import com.ruoyi.other.service.TNoticeService; |
| | | import com.ruoyi.other.service.TScreenContentService; |
| | | import com.ruoyi.other.service.TSystemConfigurationService; |
| | | import com.ruoyi.other.util.EnergyRefreshService; |
| | | import com.ruoyi.other.vo.*; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Arrays; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author huliguo |
| | | * @since 2025/5/23 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t_screen_content") |
| | | public class TScreenContentController { |
| | | |
| | | @Resource |
| | | private TScreenContentService screenContentService; |
| | | @Resource |
| | | private EnergyRefreshService energyRefreshService; |
| | | @Resource |
| | | private TSystemConfigurationService systemConfigurationService; |
| | | |
| | | /** |
| | | * 顶部-累计电量 |
| | | */ |
| | | @ApiOperation(tags = {"顶部-累计电量"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/top") |
| | | public AjaxResult<ScreenTopVO> top(@RequestParam("siteIds") List<Integer> siteIds) { |
| | | return AjaxResult.success(screenContentService.top(siteIds)); |
| | | } |
| | | |
| | | /** |
| | | * 光伏发电和消纳 这里的绿电是调后台大屏内容管理的 |
| | | */ |
| | | @ApiOperation(tags = {"光伏发电和消纳"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/photovoltaicAndConsumption") |
| | | public AjaxResult<PhotovoltaicAndConsumptionVO> photovoltaicAndConsumption() { |
| | | //需调用接口 获取光伏发电量 |
| | | List<Integer> siteIds= Arrays.asList(25,26); |
| | | PhotovoltaicAndConsumptionVO vo = new PhotovoltaicAndConsumptionVO(); |
| | | List<TScreenContent> list = screenContentService.list(new LambdaQueryWrapper<TScreenContent>().in(TScreenContent::getSiteId, siteIds)); |
| | | if(list==null|| list.isEmpty()){ |
| | | return AjaxResult.success(vo); |
| | | } |
| | | vo.setGreenElectricityToday(list.get(0).getGreenElectricityToday()); |
| | | list.remove(0); |
| | | list.forEach(x->{ |
| | | vo.setGreenElectricityToday(vo.getGreenElectricityToday().add(x.getGreenElectricityToday())); |
| | | }); |
| | | |
| | | TSystemConfiguration sysConfig = systemConfigurationService.getOne(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType,4)); |
| | | BigDecimal refreshValueOne = new BigDecimal(sysConfig.getContent()); |
| | | vo.setTodayGenerateElectricity(refreshValueOne); |
| | | vo.setGreenElectricityToday(refreshValueOne.multiply(new BigDecimal("0.94")).setScale(2, RoundingMode.HALF_UP)); |
| | | |
| | | |
| | | return AjaxResult.success(vo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 累计减排数据 |
| | | */ |
| | | @ApiOperation(tags = {"减排数据"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/emissionReduction") |
| | | public AjaxResult<EmissionReductionVO> emissionReduction (@RequestParam("siteIds") List<Integer> siteIds) { |
| | | return AjaxResult.success( screenContentService.emissionReduction(siteIds)); |
| | | } |
| | | /** |
| | | * 光伏发电实时情况 |
| | | */ |
| | | @ApiOperation(tags = {"光伏发电实时情况"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/photovoltaicPowerGeneration") |
| | | public AjaxResult<PhotovoltaicPowerGenerationVO> photovoltaicPowerGeneration (@RequestParam("siteIds") List<Integer> siteIds) { |
| | | return AjaxResult.success( screenContentService.photovoltaicPowerGeneration(siteIds)); |
| | | } |
| | | |
| | | /** |
| | | * 储能放电情况 |
| | | */ |
| | | @ApiOperation(tags = {"储能放电情况"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/energyStorageDischarge") |
| | | public AjaxResult<EnergyStorageDischargeVO> energyStorageDischarge() { |
| | | //需调用接口 获取光伏发电量 |
| | | EnergyStorageDischargeVO vo = new EnergyStorageDischargeVO(); |
| | | //今日放能 10:00-11:59 每1分钟随机增值0.5-1,放满90停止;用第一次放能值为基数(85)开始累加,17:00-21:59 每1分钟随机增值0.5-1,放满90停止。 |
| | | vo.setTodayDischarge(energyRefreshService.getTodayDischarge()); |
| | | //今日储能 00:00-次日7:59 每1分钟随机增长0.5-1,储满115停止,12:00-16:59 每1分钟随机增长0.5-1,增加到115减第一次放能剩余值(如放能值为85,则放能剩余值为90-85)结束; |
| | | vo.setTodayStorage(energyRefreshService.getTodayStorage()); |
| | | return AjaxResult.success(vo); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 停车场共享情况及相关数据 |
| | | */ |
| | | @ApiOperation(tags = {"停车场共享情况及相关数据"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/screen") |
| | | public AjaxResult<TScreenContent> screen(@RequestParam("siteIds") List<Integer> siteIds) { |
| | | List<TScreenContent> list = screenContentService.list(new LambdaQueryWrapper<TScreenContent>().in(TScreenContent::getSiteId, siteIds)); |
| | | TScreenContent tScreenContent = new TScreenContent(); |
| | | if(list==null|| list.isEmpty()){ |
| | | return AjaxResult.success(tScreenContent); |
| | | } |
| | | BeanUtils.copyProperties(list.get(0),tScreenContent); |
| | | list.remove(0); |
| | | list.forEach(x->{ |
| | | tScreenContent.setCarDischarge(tScreenContent.getCarDischarge().add(x.getCarDischarge())); |
| | | tScreenContent.setGreenElectricity(tScreenContent.getGreenElectricity().add(x.getGreenElectricity())); |
| | | tScreenContent.setGreenElectricityToday(tScreenContent.getGreenElectricityToday().add(x.getGreenElectricityToday())); |
| | | tScreenContent.setValueOne(tScreenContent.getValueOne().add(x.getValueOne())); |
| | | tScreenContent.setValueTwo(tScreenContent.getValueTwo().add(x.getValueTwo())); |
| | | tScreenContent.setValueThree(tScreenContent.getValueThree().add(x.getValueThree())); |
| | | if(tScreenContent.getStatisticalDeadline().getTime()<(x.getStatisticalDeadline().getTime())) { |
| | | tScreenContent.setStatisticalDeadline(x.getStatisticalDeadline()); |
| | | } |
| | | }); |
| | | return AjaxResult.success(tScreenContent); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"车位数据传输"},value = "充电桩数据大屏") |
| | | @PostMapping(value = "/carportData") |
| | | public AjaxResult<?> carportData(Integer parkingPlace,Integer remainPlace) { |
| | | screenContentService.carportData(parkingPlace,remainPlace); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"获取车位数据传输"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/getCarportData") |
| | | public AjaxResult<?> getCarportData() { |
| | | HashMap<String,Object> map = screenContentService.getCarportData(); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 数据回显 站点id |
| | | */ |
| | | //todo 鉴权 |
| | | @RequiresPermissions(value = {"/publicAnnouncementManagement"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "查询") |
| | | @GetMapping(value = "/{siteId}") |
| | | public AjaxResult<TScreenContent> detail(@PathVariable("siteId") Integer siteId) { |
| | | TScreenContent one = screenContentService.getOne(new LambdaQueryWrapper<TScreenContent>().eq(TScreenContent::getSiteId, siteId)); |
| | | return AjaxResult.success(one); |
| | | } |
| | | |
| | | /** |
| | | * 新增修改 |
| | | */ |
| | | //todo 鉴权 |
| | | @RequiresPermissions(value = {"",""}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "新增修改") |
| | | @PostMapping(value = "/saveOrUpdate") |
| | | @Log(title = "【大屏管理】新增修改内容", businessType = BusinessType.INSERT) |
| | | public AjaxResult saveOrUpdate(@RequestBody TScreenContent screenContent) { |
| | | screenContentService.saveOrUpdate(screenContent); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.TScreenContent; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author huliguo |
| | | * @since 2025/5/23 |
| | | */ |
| | | @Mapper |
| | | public interface TScreenContentMapper extends BaseMapper<TScreenContent> { |
| | | |
| | | BigDecimal getCarDisCharge(@Param("siteIds") List<Integer> siteIds); |
| | | |
| | | BigDecimal getGreenElectricity(@Param("siteIds") List<Integer> siteIds); |
| | | |
| | | void carportData(@Param("parkingPlace") Integer parkingPlace, @Param("remainPlace") Integer remainPlace); |
| | | |
| | | |
| | | HashMap<String, Object> getCarportData(); |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.domain.TScreenContent; |
| | | import com.ruoyi.other.vo.EmissionReductionVO; |
| | | import com.ruoyi.other.vo.PhotovoltaicPowerGenerationVO; |
| | | import com.ruoyi.other.vo.ScreenTopVO; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author huliguo |
| | | * @since 2025/5/23 |
| | | */ |
| | | public interface TScreenContentService extends IService<TScreenContent> { |
| | | |
| | | EmissionReductionVO emissionReduction(List<Integer> siteIds); |
| | | |
| | | PhotovoltaicPowerGenerationVO photovoltaicPowerGeneration(List<Integer> siteIds); |
| | | |
| | | ScreenTopVO top(List<Integer> siteIds); |
| | | |
| | | void carportData(Integer parkingPlace, Integer remainPlace); |
| | | |
| | | |
| | | HashMap<String, Object> getCarportData(); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.other.api.domain.TScreenContent; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.mapper.TScreenContentMapper; |
| | | import com.ruoyi.other.mapper.TSystemConfigurationMapper; |
| | | import com.ruoyi.other.service.TScreenContentService; |
| | | import com.ruoyi.other.service.TSystemConfigurationService; |
| | | import com.ruoyi.other.vo.EmissionReductionVO; |
| | | import com.ruoyi.other.vo.PhotovoltaicPowerGenerationVO; |
| | | import com.ruoyi.other.vo.ScreenStorageConfigVO; |
| | | import com.ruoyi.other.vo.ScreenTopVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.json.Json; |
| | | import javax.json.JsonObject; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.concurrent.ThreadLocalRandom; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author huliguo |
| | | * @since 2025/5/23 |
| | | */ |
| | | @Service |
| | | public class TScreenContentServiceImpl extends ServiceImpl<TScreenContentMapper, TScreenContent> implements TScreenContentService { |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @Resource |
| | | private TSystemConfigurationMapper systemConfigurationMapper; |
| | | |
| | | @Override |
| | | public EmissionReductionVO emissionReduction(List<Integer> siteIds) { |
| | | ScreenTopVO top = top(Arrays.asList(25, 26)); |
| | | //需调用接口 计算光伏减排 |
| | | EmissionReductionVO vo = new EmissionReductionVO(); |
| | | //获取总电量 计算累计充电二氧化碳减排量 |
| | | BigDecimal charge=top.getCarCharge(); |
| | | //计算累计充电二氧化碳减排量 |
| | | if (charge.compareTo(BigDecimal.ZERO) != 0) { |
| | | // 定义乘数和除数 |
| | | BigDecimal multiplier = new BigDecimal("0.1404"); // 0.1404 |
| | | BigDecimal divisor = new BigDecimal("1000"); // 1000 |
| | | // 计算:charge × 0.1404 ÷ 1000 |
| | | charge = charge |
| | | .multiply(multiplier) // 乘以 0.1404 |
| | | .divide(new BigDecimal("1000"),2, RoundingMode.HALF_DOWN); // 除以 1000,保留6位小数,四舍五入 |
| | | } |
| | | vo.setCharge(charge); |
| | | |
| | | //获取累计储能放电量 |
| | | TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType,3)); |
| | | //解析 |
| | | ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); |
| | | LocalDate today = LocalDate.now(); |
| | | // 判断是否等于今天 |
| | | if (configVO.getLastUpdated().equals(today)) { |
| | | vo.setEnergyStorage(configVO.getStorageDisCharge().multiply(new BigDecimal("0.1404")).divide(new BigDecimal("1000"),2,RoundingMode.DOWN)); |
| | | }else { |
| | | //判断离今天还有几天 |
| | | int count = (int) ChronoUnit.DAYS.between(configVO.getLastUpdated(), today) +1;//包括今天 |
| | | BigDecimal storageDisCharge = configVO.getStorageDisCharge(); |
| | | // 每天生成一个随机值(不超过100)并累加 |
| | | for (int i = 0; i < count; i++) { |
| | | int dailyCharge = ThreadLocalRandom.current().nextInt(0, 101); // 0-100的随机数 |
| | | storageDisCharge = storageDisCharge.add(new BigDecimal(dailyCharge)); |
| | | } |
| | | |
| | | // 更新回对象 |
| | | configVO.setStorageDisCharge(storageDisCharge); |
| | | configVO.setLastUpdated(today); |
| | | String json = JSON.toJSONString(configVO); |
| | | sysConfig.setContent(json); |
| | | |
| | | systemConfigurationMapper.updateById(sysConfig); |
| | | vo.setEnergyStorage(storageDisCharge.multiply(new BigDecimal("0.1404")).divide(new BigDecimal("1000"),2,RoundingMode.DOWN)); |
| | | } |
| | | |
| | | //总数: |
| | | BigDecimal total = vo.getPhotovoltaic().add(vo.getEnergyStorage()).add(vo.getCharge()); |
| | | vo.setTotal(total); |
| | | //计算比率 |
| | | vo.setPhotovoltaicRate(calculateRatio(vo.getPhotovoltaic(),vo.getTotal()).multiply(new BigDecimal("100"))); |
| | | vo.setEnergyStorageRate(calculateRatio(vo.getEnergyStorage(),vo.getTotal()).multiply(new BigDecimal("100"))); |
| | | vo.setChargeRate(calculateRatio(vo.getCharge(),vo.getTotal()).multiply(new BigDecimal("100"))); |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | BigDecimal divide = new BigDecimal("607").multiply(new BigDecimal("0.1404")).divide(new BigDecimal("1000"),2,RoundingMode.DOWN); |
| | | System.out.println(divide); |
| | | } |
| | | |
| | | //百分比计算 |
| | | public static BigDecimal calculateRatio(BigDecimal part, BigDecimal total) { |
| | | if (total.compareTo(BigDecimal.ZERO) == 0) { |
| | | throw new ArithmeticException("分母不能为零"); |
| | | } |
| | | |
| | | return part.divide(total, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | @Override |
| | | public PhotovoltaicPowerGenerationVO photovoltaicPowerGeneration(List<Integer> siteIds) { |
| | | //需调用接口 |
| | | |
| | | //假数据 |
| | | PhotovoltaicPowerGenerationVO vo = new PhotovoltaicPowerGenerationVO(); |
| | | List<LocalDate> dates = new ArrayList<>(); |
| | | List<Integer> values = new ArrayList<>(); |
| | | LocalDate today = LocalDate.now(); |
| | | // 生成每天数据 |
| | | for (int i = 7; i >= 1; i--) {//升序 |
| | | LocalDate day = today.minusDays(i); |
| | | //统计 |
| | | dates.add(day); |
| | | int value = new Random().nextInt(151) + 100; // 100-250 |
| | | |
| | | switch (i){ |
| | | case 1: |
| | | value = 1780; // 50-100 |
| | | break; |
| | | case 2: |
| | | value = 1810; // 50-100 |
| | | break; |
| | | case 3: |
| | | value = 1765; // 50-100 |
| | | break; |
| | | case 4: |
| | | value = 1793; // 50-100 |
| | | break; |
| | | case 5: |
| | | value = 1833; // 50-100 |
| | | break; |
| | | case 6: |
| | | value = 1815; // 50-100 |
| | | break; |
| | | case 7: |
| | | value =1794; // 50-100 |
| | | break; |
| | | |
| | | } |
| | | values.add(value); |
| | | } |
| | | vo.setDates(dates); |
| | | vo.setValues(values); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public ScreenTopVO top(List<Integer> siteIds) { |
| | | ScreenTopVO vo = new ScreenTopVO(); |
| | | |
| | | BigDecimal charge=new BigDecimal("0.00"); |
| | | BigDecimal carCharge=new BigDecimal("0.00"); |
| | | BigDecimal greenElectricity=new BigDecimal("0.00"); |
| | | if (siteIds!=null && !siteIds.isEmpty()){ |
| | | //获取充电量 |
| | | R<BigDecimal> r = chargingOrderClient.getSumDegreeBySiteIds(Arrays.asList(25,26)); |
| | | if (r.getCode()==200){ |
| | | charge=r.getData(); |
| | | } |
| | | //汽车放电量 |
| | | carCharge = this.baseMapper.getCarDisCharge(siteIds); |
| | | |
| | | //累计绿电消纳电量 |
| | | greenElectricity = this.baseMapper.getGreenElectricity(siteIds); |
| | | } |
| | | vo.setCarCharge(charge); |
| | | vo.setCarDisCharge(carCharge); |
| | | vo.setGreenElectricity(greenElectricity); |
| | | |
| | | //获取系统建设日期和累计储能放电量 |
| | | TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType,3)); |
| | | //解析 |
| | | ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); |
| | | //计算储能充电量 |
| | | LocalDate systemCreateTime = configVO.getSystemCreateTime(); |
| | | LocalDate today = LocalDate.now(); |
| | | int days = (int) ChronoUnit.DAYS.between(systemCreateTime, today) +1;//包括今天 |
| | | |
| | | BigDecimal dailyRate = new BigDecimal("100"); |
| | | BigDecimal totalCharge = dailyRate.multiply(BigDecimal.valueOf(days)); |
| | | vo.setStorageCharge(totalCharge); |
| | | |
| | | TSystemConfiguration sysConfig1 = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType,5)); |
| | | vo.setPhotovoltaic(new BigDecimal(sysConfig1.getContent())); |
| | | vo.setGreenElectricity(vo.getPhotovoltaic().multiply(new BigDecimal("0.94")).setScale(2, RoundingMode.HALF_UP)); |
| | | |
| | | //获取储能放电量 |
| | | |
| | | // 判断是否等于今天 |
| | | if (configVO.getLastUpdated().equals(today)) { |
| | | vo.setStorageDisCharge(configVO.getStorageDisCharge()); |
| | | return vo; |
| | | } |
| | | //判断离今天还有几天 |
| | | int count = (int) ChronoUnit.DAYS.between(configVO.getLastUpdated(), today) +1;//包括今天 |
| | | BigDecimal storageDisCharge = configVO.getStorageDisCharge(); |
| | | // 每天生成一个随机值(不超过100)并累加 |
| | | for (int i = 0; i < count; i++) { |
| | | int dailyCharge = ThreadLocalRandom.current().nextInt(0, 101); // 0-100的随机数 |
| | | storageDisCharge = storageDisCharge.add(new BigDecimal(dailyCharge)); |
| | | } |
| | | |
| | | // 更新回对象 |
| | | configVO.setStorageDisCharge(storageDisCharge); |
| | | configVO.setLastUpdated(today); |
| | | String json = JSON.toJSONString(configVO); |
| | | sysConfig.setContent(json); |
| | | |
| | | systemConfigurationMapper.updateById(sysConfig); |
| | | vo.setStorageDisCharge(storageDisCharge); |
| | | |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public void carportData(Integer parkingPlace, Integer remainPlace) { |
| | | this.baseMapper.carportData(parkingPlace,remainPlace); |
| | | } |
| | | |
| | | @Override |
| | | public HashMap<String, Object> getCarportData() { |
| | | HashMap<String, Object> carportData = this.baseMapper.getCarportData(); |
| | | int count = Integer.valueOf(carportData.get("parkingPlace").toString()) - Integer.valueOf(carportData.get("remainPlace").toString()); |
| | | carportData.put("useCarport",count); |
| | | return carportData; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.util; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.mapper.TSystemConfigurationMapper; |
| | | import com.ruoyi.other.vo.ScreenStorageConfigVO; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalTime; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | |
| | | /** |
| | | * 定时任务:储能放电情况 光伏发电情况 |
| | | */ |
| | | @Service |
| | | public class EnergyRefreshService { |
| | | private final Random random = new Random(); |
| | | @Resource |
| | | private TSystemConfigurationMapper systemConfigurationMapper; |
| | | |
| | | // 储能相关参数 |
| | | private final BigDecimal storageMaxMorning = new BigDecimal("115"); // 凌晨到8点储能最大值 |
| | | private final BigDecimal storageMaxAfternoon = new BigDecimal("115"); // 12点后储能最大值 |
| | | private final BigDecimal dischargeMaxMorning = new BigDecimal("90"); // 上午放电最大值 |
| | | private final BigDecimal dischargeMaxAfternoon = new BigDecimal("90"); // 下午放电最大值 |
| | | |
| | | private final double minIncrement = 0.5; // 最小增量(储能/放电共用) |
| | | private final double maxIncrement = 1.0; // 最大增量(储能/放电共用) |
| | | |
| | | |
| | | // 定时任务方法 - 能量刷新 |
| | | @Scheduled(cron = "0 * * * * ?") // 每分钟执行一次(原15分钟改为1分钟) |
| | | public synchronized void refreshValue() { |
| | | LocalTime now = LocalTime.now(); |
| | | // 根据时间段执行不同逻辑 |
| | | if (isInStorageMorning(now)) { // 00:00-7:59 储能阶段 |
| | | handleStoragePhase(storageMaxMorning, BigDecimal.ZERO); |
| | | } else if (isInDischargeMorning(now)) { // 10:00-11:59 上午放电阶段 |
| | | handleDischargePhase(dischargeMaxMorning); |
| | | } else if (isInStorageAfternoon(now)) { // 12:00-16:59 下午储能阶段 |
| | | handleStoragePhase(storageMaxAfternoon, getTodayDischarge()); |
| | | } else if (isInDischargeAfternoon(now)) { // 17:00-21:59 下午放电阶段 |
| | | handleDischargePhase(dischargeMaxAfternoon); |
| | | } |
| | | } |
| | | |
| | | // 储能阶段处理逻辑 |
| | | public void handleStoragePhase(BigDecimal maxValue, BigDecimal dischargeValue) { |
| | | BigDecimal todayStorage=getTodayStorage();//当前储能值 |
| | | BigDecimal availableSpace = maxValue.subtract(todayStorage.subtract(dischargeValue));//115-(储能-放能) 当前可上涨空间 |
| | | |
| | | // 随机增量0.5—1.0 |
| | | BigDecimal increment = randomBigDecimal(minIncrement,maxIncrement); |
| | | BigDecimal newStorage; |
| | | if (availableSpace.compareTo(increment) >= 0 ) { |
| | | //可用空间大于等于当前增量 |
| | | newStorage = todayStorage.add(increment) |
| | | .setScale(2, RoundingMode.HALF_UP); |
| | | }else { |
| | | //可用空间不足当前增量 |
| | | newStorage = maxValue.add(dischargeValue);//115 + 放能 (如:上午放90,下午就只能充90) |
| | | } |
| | | if (newStorage.compareTo(todayStorage)==0){ |
| | | //新增值等于当前储能值 说明已达到最大值,没必要更新了 |
| | | return; |
| | | } |
| | | updateStorageValue(newStorage); |
| | | System.out.printf("储能阶段:当前时间 %s,今日储能:%.2f%n", LocalTime.now(), newStorage); |
| | | } |
| | | // 放电阶段处理逻辑 |
| | | private void handleDischargePhase(BigDecimal maxDischarge) { |
| | | BigDecimal currentDischarge = getTodayDischarge();//当前放电量 |
| | | BigDecimal todayStorage = getTodayStorage();//储能量 |
| | | //今日储能-115,就是耗能(基数),在这个基数上加90 |
| | | BigDecimal baseDischarge = todayStorage.subtract(storageMaxAfternoon); |
| | | BigDecimal newMaxDischarge = baseDischarge.add(maxDischarge);//上限 基数+90 |
| | | |
| | | // 随机增量0.5—1.0 |
| | | BigDecimal increment = randomBigDecimal(minIncrement,maxIncrement); |
| | | BigDecimal newDischarge = currentDischarge.add(increment);//当前值 + 增量 |
| | | if (newDischarge.compareTo(newMaxDischarge) >=0) { |
| | | //超出 用最大值 |
| | | newDischarge = newMaxDischarge; |
| | | } |
| | | |
| | | if (newDischarge.compareTo(currentDischarge)==0){ |
| | | //新增值等于当前值,说明已超出,没必要更新了 |
| | | return; |
| | | } |
| | | updateDischargeValue(newDischarge); |
| | | System.out.printf("放电阶段:当前时间 %s,今日放电:%.2f%n", LocalTime.now(), newDischarge); |
| | | } |
| | | |
| | | // 重置任务(每天凌晨0点) |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void reset() { |
| | | // 初始化今日储能和放电为0 |
| | | updateStorageValue(BigDecimal.ZERO); |
| | | updateDischargeValue(BigDecimal.ZERO); |
| | | System.out.println("每日重置完成:今日储能和放电已清零"); |
| | | } |
| | | |
| | | /** |
| | | * 生成指定范围内的随机 BigDecimal(两位小数) |
| | | * @param min 最小值(包含) |
| | | * @param max 最大值(包含) |
| | | * @return 随机 BigDecimal |
| | | */ |
| | | private BigDecimal randomBigDecimal(double min, double max) { |
| | | // 生成 [0, 1) 随机数 |
| | | double randomValue = random.nextDouble(); |
| | | // 计算范围内的随机值 |
| | | double range = max - min; |
| | | double value = min + (randomValue * range); |
| | | |
| | | // 转换为两位小数的 BigDecimal |
| | | return BigDecimal.valueOf(value).setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | // 更新今日储能值到数据库 |
| | | private void updateStorageValue(BigDecimal value) { |
| | | updateConfigField("todayStorage", value); |
| | | } |
| | | |
| | | // 更新今日放电值到数据库(原逻辑保留) |
| | | private void updateDischargeValue(BigDecimal value) { |
| | | updateConfigField("todayDischarge", value); |
| | | } |
| | | |
| | | // 通用配置更新方法 |
| | | private void updateConfigField(String field, BigDecimal value) { |
| | | TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne( |
| | | new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType, 3) |
| | | ); |
| | | if (sysConfig != null) { |
| | | ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); |
| | | if ("todayStorage".equals(field)) { |
| | | configVO.setTodayStorage(value); |
| | | } else { |
| | | configVO.setTodayDischarge(value); |
| | | } |
| | | sysConfig.setContent(JSON.toJSONString(configVO)); |
| | | systemConfigurationMapper.updateById(sysConfig); |
| | | } |
| | | } |
| | | // 时间段判断方法 |
| | | private boolean isInStorageMorning(LocalTime time) { |
| | | return time.isAfter(LocalTime.of(0, 0)) && time.isBefore(LocalTime.of(8, 0)); |
| | | } |
| | | |
| | | private boolean isInDischargeMorning(LocalTime time) { |
| | | return time.isAfter(LocalTime.of(10, 0)) && time.isBefore(LocalTime.of(12, 0)); |
| | | } |
| | | |
| | | private boolean isInStorageAfternoon(LocalTime time) { |
| | | return time.isAfter(LocalTime.of(12, 0)) && time.isBefore(LocalTime.of(17, 0)); |
| | | } |
| | | |
| | | private boolean isInDischargeAfternoon(LocalTime time) { |
| | | return time.isAfter(LocalTime.of(17, 0)) && time.isBefore(LocalTime.of(22, 0)); |
| | | } |
| | | |
| | | public BigDecimal getTodayStorage() { |
| | | TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne( |
| | | new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType, 3) |
| | | ); |
| | | if (sysConfig != null) { |
| | | ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); |
| | | return configVO.getTodayStorage(); |
| | | } |
| | | return BigDecimal.ZERO; |
| | | } |
| | | |
| | | public BigDecimal getTodayDischarge() { |
| | | TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne( |
| | | new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType, 3) |
| | | ); |
| | | if (sysConfig != null) { |
| | | ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); |
| | | return configVO.getTodayDischarge(); |
| | | } |
| | | return BigDecimal.ZERO; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public static BigDecimal refreshValueOne = new BigDecimal("0"); |
| | | /** |
| | | *光伏发电和消纳 |
| | | */ |
| | | @Scheduled(cron = "0 */1 * * * ?") // 每分钟点执行 |
| | | public void refreshValueOne() { |
| | | // 判断时间是否在6:00到8:59 |
| | | LocalTime now = LocalTime.now(); |
| | | if (now.isAfter(LocalTime.of(6, 0)) && now.isBefore(LocalTime.of(8, 59))) { |
| | | refreshValueOne = refreshValueOne.add(new BigDecimal("0.5")); |
| | | List<TSystemConfiguration> sysConfigs = systemConfigurationMapper.selectList(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .in(TSystemConfiguration::getType,4,5)); |
| | | TSystemConfiguration sysConfig = sysConfigs.stream().filter(e -> e.getType() == 4).findFirst().orElse(null); |
| | | sysConfig.setContent(refreshValueOne.toString()); |
| | | systemConfigurationMapper.updateById(sysConfig); |
| | | |
| | | |
| | | TSystemConfiguration sysConfig1 = sysConfigs.stream().filter(e -> e.getType() == 5).findFirst().orElse(null); |
| | | String string = new BigDecimal(sysConfig1.getContent()).add(new BigDecimal("0.5")).toString(); |
| | | sysConfig1.setContent(string); |
| | | systemConfigurationMapper.updateById(sysConfig1); |
| | | // 在6:00到8:59之间,不执行 |
| | | return; |
| | | } |
| | | // 9:00-16:59每分钟增加随机3 到 3.5 |
| | | if (now.isAfter(LocalTime.of(9, 0)) && now.isBefore(LocalTime.of(16, 59))) { |
| | | refreshValueOne = refreshValueOne.add(new BigDecimal(3 + (3.5 - 3) * random.nextDouble()) |
| | | .setScale(2, RoundingMode.HALF_UP)); |
| | | List<TSystemConfiguration> sysConfigs = systemConfigurationMapper.selectList(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .in(TSystemConfiguration::getType,4,5)); |
| | | |
| | | TSystemConfiguration sysConfig = sysConfigs.stream().filter(e -> e.getType() == 4).findFirst().orElse(null); |
| | | sysConfig.setContent(refreshValueOne.toString()); |
| | | systemConfigurationMapper.updateById(sysConfig); |
| | | |
| | | |
| | | TSystemConfiguration sysConfig1 = sysConfigs.stream().filter(e -> e.getType() == 5).findFirst().orElse(null); |
| | | String string = new BigDecimal(sysConfig1.getContent()).add(new BigDecimal(3 + (3.5 - 3) * random.nextDouble())).toString(); |
| | | sysConfig1.setContent(string); |
| | | systemConfigurationMapper.updateById(sysConfig1); |
| | | return; |
| | | } |
| | | //17:00-18:59 每分钟增加0.5 |
| | | if (now.isAfter(LocalTime.of(17, 0)) && now.isBefore(LocalTime.of(18, 59))) { |
| | | refreshValueOne = refreshValueOne.add(new BigDecimal("0.5")); |
| | | List<TSystemConfiguration> sysConfigs = systemConfigurationMapper.selectList(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .in(TSystemConfiguration::getType,4,5)); |
| | | |
| | | TSystemConfiguration sysConfig = sysConfigs.stream().filter(e -> e.getType() == 4).findFirst().orElse(null); |
| | | sysConfig.setContent(refreshValueOne.toString()); |
| | | systemConfigurationMapper.updateById(sysConfig); |
| | | |
| | | |
| | | TSystemConfiguration sysConfig1 = sysConfigs.stream().filter(e -> e.getType() == 5).findFirst().orElse(null); |
| | | String string = new BigDecimal(sysConfig1.getContent()).add(new BigDecimal("0.5")).toString(); |
| | | sysConfig1.setContent(string); |
| | | systemConfigurationMapper.updateById(sysConfig1); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class EmissionReductionVO { |
| | | @ApiModelProperty("累计光伏发电二氧化碳减排量(吨)") |
| | | private BigDecimal photovoltaic = new BigDecimal("1.39"); |
| | | @ApiModelProperty("累计光伏发电二氧化碳减排量(占比率)") |
| | | private BigDecimal photovoltaicRate ; |
| | | |
| | | @ApiModelProperty("累计储能二氧化碳减排量(吨)") |
| | | private BigDecimal energyStorage ; |
| | | @ApiModelProperty("累计储能二氧化碳减排量(占比率)") |
| | | private BigDecimal energyStorageRate ; |
| | | |
| | | @ApiModelProperty("累计充电二氧化碳减排量(吨)") |
| | | private BigDecimal charge; |
| | | @ApiModelProperty("累计充电二氧化碳减排量(占比率)") |
| | | private BigDecimal chargeRate ; |
| | | |
| | | @ApiModelProperty("总计二氧化碳减排量(吨)") |
| | | private BigDecimal total ; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class EnergyStorageDischargeVO { |
| | | @ApiModelProperty("储能配置") |
| | | private Integer config=115; |
| | | @ApiModelProperty("今日储能") |
| | | private BigDecimal todayStorage; |
| | | @ApiModelProperty("今日放能") |
| | | private BigDecimal todayDischarge; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class PhotovoltaicAndConsumptionVO { |
| | | @ApiModelProperty("光伏面积") |
| | | private Integer area = 3593; |
| | | @ApiModelProperty("装机容量") |
| | | private BigDecimal capacity = new BigDecimal("759.52"); |
| | | @ApiModelProperty("今日已发电") |
| | | private BigDecimal todayGenerateElectricity=new BigDecimal("71.29"); |
| | | |
| | | @ApiModelProperty("今日绿电消纳值") |
| | | private BigDecimal greenElectricityToday=new BigDecimal("0.00"); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PhotovoltaicPowerGenerationVO { |
| | | @ApiModelProperty("日期") |
| | | private List<LocalDate> dates; |
| | | @ApiModelProperty("数据") |
| | | private List<Integer> values; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class ScreenStorageConfigVO { |
| | | /** |
| | | * 系统建设日期 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate systemCreateTime; |
| | | |
| | | /** |
| | | * 储能放电量 随机增长,每日不超过100度 |
| | | */ |
| | | private BigDecimal storageDisCharge; |
| | | |
| | | /** |
| | | * 最后一次更改时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate lastUpdated; |
| | | |
| | | /** |
| | | * 储能放电情况 今日放能 |
| | | */ |
| | | private BigDecimal todayDischarge; |
| | | |
| | | /** |
| | | * 储能放电情况 今日储能 |
| | | */ |
| | | private BigDecimal todayStorage; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ScreenTopVO { |
| | | @ApiModelProperty("汽车充电量") |
| | | private BigDecimal carCharge; |
| | | @ApiModelProperty("汽车放电量") |
| | | private BigDecimal carDisCharge; |
| | | @ApiModelProperty("光伏发电量") |
| | | private BigDecimal photovoltaic; |
| | | @ApiModelProperty("光伏用电量") |
| | | private BigDecimal greenElectricity; |
| | | @ApiModelProperty("储能充电量") |
| | | private BigDecimal storageCharge; |
| | | @ApiModelProperty("储能放电量") |
| | | private BigDecimal storageDisCharge; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.other.mapper.TScreenContentMapper"> |
| | | <update id="carportData"> |
| | | update t_screen_carport |
| | | set |
| | | parking_place = #{parkingPlace}, |
| | | remain_place = #{remainPlace} |
| | | where |
| | | id =1 |
| | | </update> |
| | | |
| | | <select id="getCarDisCharge" resultType="java.math.BigDecimal"> |
| | | select |
| | | sum(car_discharge) |
| | | FROM t_screen_content |
| | | WHERE |
| | | site_id in |
| | | <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | <select id="getGreenElectricity" resultType="java.math.BigDecimal"> |
| | | select |
| | | sum(green_electricity) |
| | | FROM t_screen_content |
| | | WHERE |
| | | site_id in |
| | | <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | <select id="getCarportData" resultType="java.util.HashMap"> |
| | | select |
| | | parking_place as parkingPlace, |
| | | remain_place as remainPlace |
| | | from |
| | | t_screen_carport where id =1 |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.ruoyi.payment.ali.config; |
| | | |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/23 16:08 |
| | | */ |
| | | @Data |
| | | @Component |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "payment.alih5") |
| | | public class AliH5Properties { |
| | | /** |
| | | * appid |
| | | */ |
| | | private String appId; |
| | | /** |
| | | * 加签方式 |
| | | */ |
| | | private String signType; |
| | | /** |
| | | * 开发者私钥,由开发者自己生成 |
| | | */ |
| | | private String privateKey; |
| | | /** |
| | | * 支付宝公钥 |
| | | */ |
| | | private String alipayPublicKey; |
| | | /** |
| | | * 应用公钥证书文件本地路径 |
| | | */ |
| | | private String appCertPath; |
| | | /** |
| | | * 支付宝公钥证书文件本地路径 |
| | | */ |
| | | private String alipayPublicCertPath; |
| | | /** |
| | | * 支付宝根证书文件本地路径 |
| | | */ |
| | | private String rootCertPath; |
| | | /** |
| | | * 回调地址 |
| | | */ |
| | | private String notifyUrl; |
| | | /** |
| | | * V2接口地址 |
| | | */ |
| | | private String v2Path = "https://openapi.alipay.com/gateway.do"; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.payment.ali.v2; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.AlipayConfig; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.domain.AlipayTradeAppPayModel; |
| | | import com.alipay.api.domain.AlipayTradeCloseModel; |
| | | import com.alipay.api.request.AlipayTradeAppPayRequest; |
| | | import com.alipay.api.request.AlipayTradeCloseRequest; |
| | | import com.alipay.api.request.AlipayTradeQueryRequest; |
| | | import com.alipay.api.request.AlipayTradeRefundRequest; |
| | | import com.alipay.api.response.AlipayTradeAppPayResponse; |
| | | import com.alipay.api.response.AlipayTradeCloseResponse; |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.alipay.api.response.AlipayTradeRefundResponse; |
| | | import org.dom4j.Element; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 第三方支付工具类 |
| | | */ |
| | | @Component |
| | | public class AppPayUtil { |
| | | |
| | | private static Logger log = LoggerFactory.getLogger(AppletPayUtil.class); |
| | | |
| | | private String aliAppid = "2021004172608506";//支付宝appid |
| | | |
| | | private String appPrivateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCREjc1/sU4fdzCJrtNBhaxIZb17G/9CoxDRCyHqy15TecDHl3tMt+sTpzIv1mWRUUIDtNvgBUMMv9gPfDbfl/T5Lk3MyM8sQocGBTQRTzcQzNL4fLjBT6LF6F9WSe65wG8OEtaI2IwFlKDbB7No2EkVKjWcAEdYkPu50WP6aEzXGj6CkO3CLRlUm2TXPngun8krVsB8zYkxpVA86mcB5DOXW9/1+XnXQ0i4c4k1XeDx25ycXyJGftDwBdV7Y9VA0GavUAXMZV2afRjObRcfQ554mCj4L52M/y+AC02io/+G2k+cq/yM+zr/bGp1A00gqFWI7HNLHFzoR7RdjCZXSQvAgMBAAECggEAP0r0PaGPCEuZcjeVxlAevF9MTrU+Uuc0NPDcgMCFUYRUgr7P+foVLkcKDme1vWMxcAeP5fi6thzV4HaFzC3Bv1/uExBDkmonYAR9qDRdDjhfe/7zimqyU9sWgOrR87BvyF/DOGtxnktO6rnUYqGic0hgdVZeliRWQTgz2Er1IsPJMEg/mrBDvPXeoSh+cppayYL3d7W8QVP650Eraxim0CfdFdiV0Fb5OMq/X5oPr93TdRbMoE8TMid9i+XlcmKe9pMjwat/CGK8auRpYOm0W3Ml+ybf3q2O+p/TTTSZfBYlLVb7fDdPxmZeDU/9u04k75DQR3taAQnYVvAJp3LwaQKBgQDMhpkAKR7GcI9AxpKDZY59Sg0SR68qrjYJqDtexr177wXZMxqh5a2S08fk3wLk8z5TAyucSg3kuX79wEeTMFlEBHERko/9bIVsT6U+lRY4AiXfQK1phIvRBiODQ9yBRPyEWBqkdZa0PaD4cbx0BMWe1GJE9zgoGNkOmZOa6mDrlQKBgQC1lQNfcbrr0r5coL+vx/BSSoaiHFZ4ijcCxWMPdjtxnKAfxTncq0C2UxzPgtpXYmLPrpsaulYE9nmUZIblbSPQbyTmoBIVx20Izzt/jY3YOJ7UnTgDoC24aq/RV4n/I2q3flnBqmA/+wcLwMEJvnQ+oWYIJ2e5q2XXybiWtXP/swKBgDgqGif2ItJhpKUoIqHcqKV1SWOktdClqIc8YJllQDGhcNy1cPHWjbTNXY5XQ4c12P6Y10gC+g++dMYgIEemNk08XwRxWANC4tzcfkdST5iv1lCZhUV9tZt/8Q6h+xKwrBt3ylExTWJPrj2rlhHSIaa9MgM4VH6GXEzrFaKsDFOFAoGAe33zhEbZxCZYdrCQjSDiTWUH+VpiaKo/TXAmtc5IETVfJRxCBNSnNxiBQJOSoNl1sB7kt6HAfLGP8B8KKyA1ujzMkNiOVCeD/PjLUy1XKZUgWCLwhG68iW5tUmdBn7Zbjp2st2yC9yBnI1QdNN5FOo8T0DnUbk6l/cLf+gc/88cCgYEAjYJFvXDhGKlx1xI/eLPSKNUIab5i3K57A9B8CejFIHxdV4jDf9OGj/kf/WrNcFfBGqgpqNXgtpBmtplPAQmcvNJVVoI0wfXDQHuO0vZ600Rku2Bv/uldObwq/xk46rTHtQjkIzBI25IcRh5gvaoyk+Yq+zkLZosuNyXYwVSxVJs=";//支付宝开发者应用私钥 |
| | | |
| | | private String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkRI3Nf7FOH3cwia7TQYWsSGW9exv/QqMQ0Qsh6steU3nAx5d7TLfrE6cyL9ZlkVFCA7Tb4AVDDL/YD3w235f0+S5NzMjPLEKHBgU0EU83EMzS+Hy4wU+ixehfVknuucBvDhLWiNiMBZSg2wezaNhJFSo1nABHWJD7udFj+mhM1xo+gpDtwi0ZVJtk1z54Lp/JK1bAfM2JMaVQPOpnAeQzl1vf9fl510NIuHOJNV3g8ducnF8iRn7Q8AXVe2PVQNBmr1AFzGVdmn0Yzm0XH0OeeJgo+C+djP8vgAtNoqP/htpPnKv8jPs6/2xqdQNNIKhViOxzSxxc6Ee0XYwmV0kLwIDAQAB";//支付宝应用公钥 |
| | | |
| | | private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkoPidM7vHL/74FhOWARjkMDZN0GktpVEQaYz6qpIjTuKLcQsR74CUv9LoiGD9uquYAI52TdmxzMWbuMEvrdVIT6pWyJuCvScX2U5Zwn9Bk8bE5RmTobUrU3LFudMYIGFU3qUHqnTJFQxLsSUibTtxbov1bpCQNwk3/2RdYOpJHKDjkXzNcjJrkuNcGcuzNW/3+L5CMaVm0dxqxx0dhJ4H0xvpMw2uvdxdLXN/KoYszfps4j61x0KFwkulvD1WHzR1f/ot9NU8FZe+dkNm5cXb9HbwQIbfARyB5bd0EYHSr4fJIUJx1GnjpfT6/traxEoyOcI6diJa4b2hZpR3WvxTQIDAQAB";//支付宝支付公钥 |
| | | |
| | | private String callbackPath = "https://online.daowepark.com:443/activity";//支付回调网关地址 |
| | | |
| | | /** |
| | | * 支付宝支付 |
| | | */ |
| | | public Map<String, String> alipay(String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl) { |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | model.setTimeoutExpress("30m"); |
| | | model.setTotalAmount(new BigDecimal(amount).setScale(2, RoundingMode.HALF_UP).toString());//付款金额 |
| | | model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(callbackPath + notifyUrl); |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | map.put("returnId", passbackParams); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return map; |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public boolean close(String outTradeNo){ |
| | | try { |
| | | // 初始化SDK |
| | | AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig()); |
| | | // 构造请求参数以调用接口 |
| | | AlipayTradeCloseRequest request = new AlipayTradeCloseRequest(); |
| | | AlipayTradeCloseModel model = new AlipayTradeCloseModel(); |
| | | // 设置订单支付时传入的商户订单号 |
| | | model.setOutTradeNo(outTradeNo); |
| | | request.setBizModel(model); |
| | | AlipayTradeCloseResponse response = alipayClient.execute(request); |
| | | log.info("-----关闭支付宝支付订单-----"); |
| | | log.info("请求参数:{}", outTradeNo); |
| | | log.info("返回结果:{}", response.getBody()); |
| | | if(response.isSuccess()){ |
| | | return true; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private AlipayConfig getAlipayConfig() { |
| | | AlipayConfig alipayConfig = new AlipayConfig(); |
| | | alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | alipayConfig.setAppId(aliAppid); |
| | | alipayConfig.setPrivateKey(appPrivateKey); |
| | | alipayConfig.setFormat("json"); |
| | | alipayConfig.setAlipayPublicKey(alipayPublicKey); |
| | | alipayConfig.setCharset("UTF-8"); |
| | | alipayConfig.setSignType("RSA2"); |
| | | return alipayConfig; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付成功后的回调处理逻辑 |
| | | * |
| | | * @param request |
| | | */ |
| | | public Map<String, String> alipayCallback(HttpServletRequest request) { |
| | | //获取支付宝POST过来反馈信息 |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | Map requestParams = request.getParameterMap(); |
| | | for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) { |
| | | String name = (String) iter.next(); |
| | | String[] values = (String[]) requestParams.get(name); |
| | | String valueStr = ""; |
| | | for (int i = 0; i < values.length; i++) { |
| | | valueStr = (i == values.length - 1) ? valueStr + values[i] |
| | | : valueStr + values[i] + "_"; |
| | | } |
| | | //乱码解决,这段代码在出现乱码时使用。 |
| | | //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8"); |
| | | params.put(name, valueStr); |
| | | } |
| | | //切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。 |
| | | Map<String, String> map = new HashMap<>(); |
| | | System.err.println("返回码"+params); |
| | | if (params.get("trade_status").equals("TRADE_SUCCESS")){ |
| | | String out_trade_no = params.get("out_trade_no"); |
| | | String subject = params.get("subject"); |
| | | String total_amount = params.get("total_amount"); |
| | | String trade_no = params.get("trade_no"); |
| | | String passback_params = params.get("passback_params"); |
| | | map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | map.put("subject", subject); |
| | | map.put("total_amount", total_amount); |
| | | map.put("trade_no", trade_no);//支付宝交易号 |
| | | map.put("passback_params", passback_params);//回传参数 |
| | | System.err.println("回调map"); |
| | | return map; |
| | | }else{ |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝查询订单支付状态 |
| | | * |
| | | * @param out_trade_no |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public AlipayTradeQueryResponse queryAliOrder(String out_trade_no) { |
| | | try { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); |
| | | request.setBizContent("{" + |
| | | " \"out_trade_no\":\"" + out_trade_no + "\"" + |
| | | "}"); |
| | | AlipayTradeQueryResponse response = alipayClient.execute(request); |
| | | if (response.isSuccess()) { |
| | | String tradeStatus = response.getTradeStatus();//交易状态:WAIT_BUYER_PAY(交易创建,等待买家付款)、TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、TRADE_SUCCESS(交易支付成功)、TRADE_FINISHED(交易结束,不可退款) |
| | | return response; |
| | | } else { |
| | | return response; |
| | | } |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝扫码收款 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public Object aliScanQRCodePay(String data) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 支付宝退款 |
| | | * |
| | | * @param trade_no 支付宝交易号 |
| | | * @param refund_amount 退款金额 |
| | | * @return |
| | | * @throws AlipayApiException |
| | | */ |
| | | public Map<String, String> aliRefund(String trade_no, String refund_amount) { |
| | | try { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("trade_no", trade_no); |
| | | jsonObject.put("refund_amount", refund_amount); |
| | | request.setBizContent(jsonObject.toJSONString()); |
| | | AlipayTradeRefundResponse response = alipayClient.execute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | String outTradeNo = response.getOutTradeNo(); |
| | | map.put("code", response.getCode());//10000 |
| | | map.put("trade_no", response.getTradeNo());//支付宝交易号 |
| | | map.put("out_trade_no", outTradeNo);//商户订单号 |
| | | map.put("refund_fee", response.getRefundFee()); |
| | | map.put("msg", response.getMsg()); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | map.put("code", response.getCode()); |
| | | map.put("msg", response.getSubMsg()); |
| | | } |
| | | return map; |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static Map<String, String> xmlToMap(Element tmpElement, Map<String, String> respMap) { |
| | | if (tmpElement.isTextOnly()) { |
| | | respMap.put(tmpElement.getName(), tmpElement.getText()); |
| | | return respMap; |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | Iterator<Element> eItor = tmpElement.elementIterator(); |
| | | while (eItor.hasNext()) { |
| | | Element element = eItor.next(); |
| | | xmlToMap(element, respMap); |
| | | } |
| | | return respMap; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.payment.ali.v2; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.*; |
| | | import com.alipay.api.diagnosis.DiagnosisUtils; |
| | | import com.alipay.api.domain.*; |
| | | import com.alipay.api.request.*; |
| | | import com.alipay.api.response.*; |
| | | import com.ruoyi.payment.ali.config.AliH5Properties; |
| | | import com.ruoyi.payment.ali.config.AliProperties; |
| | | import org.dom4j.Document; |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.Element; |
| | | import org.dom4j.io.SAXReader; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.crypto.Mac; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import static com.ruoyi.payment.ali.v2.util.Md5Util.byteArrayToHexString; |
| | | |
| | | |
| | | /** |
| | | * 第三方支付工具类 |
| | | */ |
| | | @Component |
| | | public class H5PayUtil { |
| | | private static Logger log = LoggerFactory.getLogger(AppletPayUtil.class); |
| | | |
| | | @Autowired |
| | | private AliH5Properties aliH5Properties; |
| | | |
| | | private String aliAppid = "2021004172608506";//支付宝appid |
| | | private String appPrivateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCREjc1/sU4fdzCJrtNBhaxIZb17G/9CoxDRCyHqy15TecDHl3tMt+sTpzIv1mWRUUIDtNvgBUMMv9gPfDbfl/T5Lk3MyM8sQocGBTQRTzcQzNL4fLjBT6LF6F9WSe65wG8OEtaI2IwFlKDbB7No2EkVKjWcAEdYkPu50WP6aEzXGj6CkO3CLRlUm2TXPngun8krVsB8zYkxpVA86mcB5DOXW9/1+XnXQ0i4c4k1XeDx25ycXyJGftDwBdV7Y9VA0GavUAXMZV2afRjObRcfQ554mCj4L52M/y+AC02io/+G2k+cq/yM+zr/bGp1A00gqFWI7HNLHFzoR7RdjCZXSQvAgMBAAECggEAP0r0PaGPCEuZcjeVxlAevF9MTrU+Uuc0NPDcgMCFUYRUgr7P+foVLkcKDme1vWMxcAeP5fi6thzV4HaFzC3Bv1/uExBDkmonYAR9qDRdDjhfe/7zimqyU9sWgOrR87BvyF/DOGtxnktO6rnUYqGic0hgdVZeliRWQTgz2Er1IsPJMEg/mrBDvPXeoSh+cppayYL3d7W8QVP650Eraxim0CfdFdiV0Fb5OMq/X5oPr93TdRbMoE8TMid9i+XlcmKe9pMjwat/CGK8auRpYOm0W3Ml+ybf3q2O+p/TTTSZfBYlLVb7fDdPxmZeDU/9u04k75DQR3taAQnYVvAJp3LwaQKBgQDMhpkAKR7GcI9AxpKDZY59Sg0SR68qrjYJqDtexr177wXZMxqh5a2S08fk3wLk8z5TAyucSg3kuX79wEeTMFlEBHERko/9bIVsT6U+lRY4AiXfQK1phIvRBiODQ9yBRPyEWBqkdZa0PaD4cbx0BMWe1GJE9zgoGNkOmZOa6mDrlQKBgQC1lQNfcbrr0r5coL+vx/BSSoaiHFZ4ijcCxWMPdjtxnKAfxTncq0C2UxzPgtpXYmLPrpsaulYE9nmUZIblbSPQbyTmoBIVx20Izzt/jY3YOJ7UnTgDoC24aq/RV4n/I2q3flnBqmA/+wcLwMEJvnQ+oWYIJ2e5q2XXybiWtXP/swKBgDgqGif2ItJhpKUoIqHcqKV1SWOktdClqIc8YJllQDGhcNy1cPHWjbTNXY5XQ4c12P6Y10gC+g++dMYgIEemNk08XwRxWANC4tzcfkdST5iv1lCZhUV9tZt/8Q6h+xKwrBt3ylExTWJPrj2rlhHSIaa9MgM4VH6GXEzrFaKsDFOFAoGAe33zhEbZxCZYdrCQjSDiTWUH+VpiaKo/TXAmtc5IETVfJRxCBNSnNxiBQJOSoNl1sB7kt6HAfLGP8B8KKyA1ujzMkNiOVCeD/PjLUy1XKZUgWCLwhG68iW5tUmdBn7Zbjp2st2yC9yBnI1QdNN5FOo8T0DnUbk6l/cLf+gc/88cCgYEAjYJFvXDhGKlx1xI/eLPSKNUIab5i3K57A9B8CejFIHxdV4jDf9OGj/kf/WrNcFfBGqgpqNXgtpBmtplPAQmcvNJVVoI0wfXDQHuO0vZ600Rku2Bv/uldObwq/xk46rTHtQjkIzBI25IcRh5gvaoyk+Yq+zkLZosuNyXYwVSxVJs=";//支付宝开发者应用私钥 |
| | | private String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkRI3Nf7FOH3cwia7TQYWsSGW9exv/QqMQ0Qsh6steU3nAx5d7TLfrE6cyL9ZlkVFCA7Tb4AVDDL/YD3w235f0+S5NzMjPLEKHBgU0EU83EMzS+Hy4wU+ixehfVknuucBvDhLWiNiMBZSg2wezaNhJFSo1nABHWJD7udFj+mhM1xo+gpDtwi0ZVJtk1z54Lp/JK1bAfM2JMaVQPOpnAeQzl1vf9fl510NIuHOJNV3g8ducnF8iRn7Q8AXVe2PVQNBmr1AFzGVdmn0Yzm0XH0OeeJgo+C+djP8vgAtNoqP/htpPnKv8jPs6/2xqdQNNIKhViOxzSxxc6Ee0XYwmV0kLwIDAQAB";//支付宝应用公钥 |
| | | private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkoPidM7vHL/74FhOWARjkMDZN0GktpVEQaYz6qpIjTuKLcQsR74CUv9LoiGD9uquYAI52TdmxzMWbuMEvrdVIT6pWyJuCvScX2U5Zwn9Bk8bE5RmTobUrU3LFudMYIGFU3qUHqnTJFQxLsSUibTtxbov1bpCQNwk3/2RdYOpJHKDjkXzNcjJrkuNcGcuzNW/3+L5CMaVm0dxqxx0dhJ4H0xvpMw2uvdxdLXN/KoYszfps4j61x0KFwkulvD1WHzR1f/ot9NU8FZe+dkNm5cXb9HbwQIbfARyB5bd0EYHSr4fJIUJx1GnjpfT6/traxEoyOcI6diJa4b2hZpR3WvxTQIDAQAB";//支付宝支付公钥 |
| | | private String callbackPath = "http://221.182.45.100:9000";//支付回调网关地址 |
| | | private AlipayConfig getAlipayConfig() { |
| | | AlipayConfig alipayConfig = new AlipayConfig(); |
| | | alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | alipayConfig.setAppId(aliH5Properties.getAppId()); |
| | | alipayConfig.setPrivateKey(aliH5Properties.getPrivateKey()); |
| | | alipayConfig.setFormat("json"); |
| | | alipayConfig.setAlipayPublicKey(aliH5Properties.getAlipayPublicKey()); |
| | | alipayConfig.setCharset("UTF-8"); |
| | | alipayConfig.setSignType("RSA2"); |
| | | return alipayConfig; |
| | | } |
| | | /** |
| | | * 支付宝支付 |
| | | */ |
| | | public String alipay(String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl,String returnUrl) { |
| | | try { |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig()); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeWapPayModel model = new AlipayTradeWapPayModel(); |
| | | model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | model.setTimeoutExpress("30m"); |
| | | model.setTotalAmount(new BigDecimal(amount).setScale(2, RoundingMode.HALF_UP).toString());//付款金额 |
| | | model.setProductCode("QUICK_WAP_WAY"); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(aliH5Properties.getNotifyUrl() + notifyUrl); |
| | | request.setReturnUrl(returnUrl); |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeWapPayResponse response = alipayClient.pageExecute(request, "POST"); |
| | | // 如果需要返回GET请求,请使用 |
| | | // AlipayTradeWapPayResponse response = alipayClient.pageExecute(request, "GET"); |
| | | String pageRedirectionData = response.getBody(); |
| | | log.info("-----支付宝H5支付-------:{}",pageRedirectionData); |
| | | if (response.isSuccess()) { |
| | | log.info("支付宝H5支付成功"); |
| | | return pageRedirectionData; |
| | | }else { |
| | | log.info("支付宝H5支付失败"); |
| | | String diagnosisUrl = DiagnosisUtils.getDiagnosisUrl(response); |
| | | return diagnosisUrl; |
| | | } |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public boolean close(String outTradeNo){ |
| | | try { |
| | | // 初始化SDK |
| | | AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig()); |
| | | // 构造请求参数以调用接口 |
| | | AlipayTradeCloseRequest request = new AlipayTradeCloseRequest(); |
| | | AlipayTradeCloseModel model = new AlipayTradeCloseModel(); |
| | | // 设置订单支付时传入的商户订单号 |
| | | model.setOutTradeNo(outTradeNo); |
| | | request.setBizModel(model); |
| | | AlipayTradeCloseResponse response = alipayClient.execute(request); |
| | | log.info("-----关闭支付宝支付订单-----"); |
| | | log.info("请求参数:{}", outTradeNo); |
| | | log.info("返回结果:{}", response.getBody()); |
| | | if(response.isSuccess()){ |
| | | return true; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 支付成功后的回调处理逻辑 |
| | | * |
| | | * @param request |
| | | */ |
| | | public Map<String, String> alipayCallback(HttpServletRequest request) { |
| | | //获取支付宝POST过来反馈信息 |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | Map requestParams = request.getParameterMap(); |
| | | for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) { |
| | | String name = (String) iter.next(); |
| | | String[] values = (String[]) requestParams.get(name); |
| | | String valueStr = ""; |
| | | for (int i = 0; i < values.length; i++) { |
| | | valueStr = (i == values.length - 1) ? valueStr + values[i] |
| | | : valueStr + values[i] + "_"; |
| | | } |
| | | //乱码解决,这段代码在出现乱码时使用。 |
| | | //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8"); |
| | | params.put(name, valueStr); |
| | | } |
| | | //切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。 |
| | | //boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type) |
| | | Map<String, String> map = new HashMap<>(); |
| | | System.err.println("返回码"+params); |
| | | if (params.get("trade_status").equals("TRADE_SUCCESS")){ |
| | | String out_trade_no = params.get("out_trade_no"); |
| | | String subject = params.get("subject"); |
| | | String total_amount = params.get("total_amount"); |
| | | String trade_no = params.get("trade_no"); |
| | | String passback_params = params.get("passback_params"); |
| | | map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | map.put("subject", subject); |
| | | map.put("total_amount", total_amount); |
| | | map.put("trade_no", trade_no);//支付宝交易号 |
| | | map.put("passback_params", passback_params);//回传参数 |
| | | System.err.println("回调map"); |
| | | return map; |
| | | }else{ |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝查询订单支付状态 |
| | | * |
| | | * @param out_trade_no |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public AlipayTradeQueryResponse queryAliOrder(String out_trade_no) { |
| | | try { |
| | | // 初始化SDK |
| | | AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig()); |
| | | AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); |
| | | AlipayTradeQueryModel model = new AlipayTradeQueryModel(); |
| | | // 设置订单支付时传入的商户订单号 |
| | | model.setOutTradeNo(out_trade_no); |
| | | request.setBizModel(model); |
| | | AlipayTradeQueryResponse response = alipayClient.execute(request); |
| | | if (response.isSuccess()) { |
| | | String tradeStatus = response.getTradeStatus();//交易状态:WAIT_BUYER_PAY(交易创建,等待买家付款)、TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、TRADE_SUCCESS(交易支付成功)、TRADE_FINISHED(交易结束,不可退款) |
| | | return response; |
| | | } else { |
| | | return response; |
| | | } |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝退款 |
| | | * |
| | | * @param trade_no 支付宝交易号 |
| | | * @param refund_amount 退款金额 |
| | | * @return |
| | | * @throws AlipayApiException |
| | | */ |
| | | public Map<String, String> aliRefund(String trade_no, String refund_amount) { |
| | | try { |
| | | // 初始化SDK |
| | | AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig()); |
| | | AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); |
| | | AlipayTradeRefundModel model = new AlipayTradeRefundModel(); |
| | | // 设置订单支付时传入的商户订单号 |
| | | model.setTradeNo(trade_no); |
| | | model.setRefundAmount(refund_amount); |
| | | model.setRefundReason("充电退款"); |
| | | request.setBizModel(model); |
| | | AlipayTradeRefundResponse response = alipayClient.execute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if (response.isSuccess()) { |
| | | log.info("调用成功"); |
| | | String outTradeNo = response.getOutTradeNo(); |
| | | map.put("code", response.getCode());//10000 |
| | | map.put("trade_no", response.getTradeNo());//支付宝交易号 |
| | | map.put("out_trade_no", outTradeNo);//商户订单号 |
| | | map.put("refund_fee", response.getRefundFee()); |
| | | map.put("msg", response.getMsg()); |
| | | } else { |
| | | log.error("调用失败"); |
| | | map.put("code", response.getCode()); |
| | | map.put("msg", response.getSubMsg()); |
| | | } |
| | | return map; |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static Map<String, String> xmlToMap(Element tmpElement, Map<String, String> respMap) { |
| | | if (tmpElement.isTextOnly()) { |
| | | respMap.put(tmpElement.getName(), tmpElement.getText()); |
| | | return respMap; |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | Iterator<Element> eItor = tmpElement.elementIterator(); |
| | | while (eItor.hasNext()) { |
| | | Element element = eItor.next(); |
| | | xmlToMap(element, respMap); |
| | | } |
| | | return respMap; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.payment.ali.v2.util; |
| | | |
| | | import java.security.MessageDigest; |
| | | |
| | | public class Md5Util { |
| | | private static final String hexDigIts[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; |
| | | |
| | | /** |
| | | * MD5加密 |
| | | * |
| | | * @param origin 字符 |
| | | * @param charsetname 编码 |
| | | * @return |
| | | */ |
| | | public static String MD5Encode(String origin, String charsetname) { |
| | | String resultString = null; |
| | | try { |
| | | resultString = new String(origin); |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | if (null == charsetname || "".equals(charsetname)) { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes())); |
| | | } else { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | return resultString; |
| | | } |
| | | |
| | | |
| | | public static String byteArrayToHexString(byte b[]) { |
| | | StringBuffer resultSb = new StringBuffer(); |
| | | for (int i = 0; i < b.length; i++) { |
| | | resultSb.append(byteToHexString(b[i])); |
| | | } |
| | | return resultSb.toString(); |
| | | } |
| | | |
| | | public static String byteToHexString(byte b) { |
| | | int n = b; |
| | | if (n < 0) { |
| | | n += 256; |
| | | } |
| | | int d1 = n / 16; |
| | | int d2 = n % 16; |
| | | return hexDigIts[d1] + hexDigIts[d2]; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.payment.controller; |
| | | |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.payment.ali.v2.AppPayUtil; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/24 14:29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/aliApp") |
| | | public class AppAliPayController { |
| | | |
| | | @Resource |
| | | private AppPayUtil appPayUtil; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | /** |
| | | * 调起支付宝小程序支付 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/payment") |
| | | public R<Map<String, String>> payment(@RequestBody AliPaymentReq req){ |
| | | Map<String, String> alipay = appPayUtil.alipay(req.getBody(), req.getSubject(), req.getPassbackParams(), req.getOutTradeNo(), req.getTotalAmount(), req.getNotifyUrl()); |
| | | return R.ok(alipay); |
| | | } |
| | | |
| | | /** |
| | | * 查询订单 |
| | | * @param outTradeNo |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/query") |
| | | public R<AliQueryOrder> query(@RequestParam("outTradeNo") String outTradeNo){ |
| | | AlipayTradeQueryResponse alipayTradeQueryResponse = appPayUtil.queryAliOrder(outTradeNo); |
| | | if(null != alipayTradeQueryResponse){ |
| | | AliQueryOrder aliQueryOrder = new AliQueryOrder(); |
| | | BeanUtils.copyProperties(alipayTradeQueryResponse, aliQueryOrder); |
| | | return R.ok(aliQueryOrder); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 关闭订单 |
| | | * @param outTradeNo |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/close") |
| | | public void close(@RequestParam("outTradeNo") String outTradeNo){ |
| | | boolean close = appPayUtil.close(outTradeNo); |
| | | if(!close){ |
| | | throw new RuntimeException("关闭支付宝订单失败"); |
| | | } |
| | | } |
| | | /** |
| | | * 后台退款 远程调用 |
| | | */ |
| | | @PostMapping("/refund") |
| | | public R<RefundResp> refund(@RequestBody RefundReq dto){ |
| | | Map<String, String> map = appPayUtil.aliRefund(dto.getOutTradeNo(), dto.getRefundAmount()); |
| | | RefundResp refundResp = new RefundResp(); |
| | | refundResp.setCode(map.get("code")); |
| | | refundResp.setMsg(map.get("msg")); |
| | | refundResp.setTradeNo(map.get("trade_no")); |
| | | refundResp.setOutTradeNo(map.get("out_trade_no")); |
| | | refundResp.setRefundFee(new Double(map.get("refund_fee"))); |
| | | return R.ok(refundResp); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/callBack") |
| | | public void chargingOrderALICallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | // Map<String, String> callback = appPayUtil.alipayCallback(request); |
| | | // if(null != callback){ |
| | | // String out_trade_no = callback.get("out_trade_no"); |
| | | // String attach = callback.get("subject"); |
| | | // String total_amount = callback.get("total_amount"); |
| | | // String transaction_id = callback.get("trade_no"); |
| | | // String substring = out_trade_no.substring(0, 2); |
| | | // switch (substring){ |
| | | // case "CD": |
| | | // chargingOrderClient.chargingOrderALIAppCallback(out_trade_no, transaction_id, attach); |
| | | // System.err.println("----充电支付回调"); |
| | | // break; |
| | | // } |
| | | // PrintWriter writer = response.getWriter(); |
| | | // writer.println("success"); |
| | | // writer.flush(); |
| | | // writer.close(); |
| | | // } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.payment.controller; |
| | | |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.payment.ali.v2.AppPayUtil; |
| | | import com.ruoyi.payment.ali.v2.H5PayUtil; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/24 14:29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/aliH5") |
| | | public class H5AliPayController { |
| | | |
| | | @Resource |
| | | private H5PayUtil h5PayUtil; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | /** |
| | | * 调起支付宝小程序支付 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/payment") |
| | | public R<String> payment(@RequestBody AliPaymentReq req){ |
| | | String alipay = h5PayUtil.alipay(req.getBody(), req.getSubject(), req.getPassbackParams(), req.getOutTradeNo(), req.getTotalAmount(), req.getNotifyUrl(),req.getReturnUrl()); |
| | | return R.ok(alipay); |
| | | } |
| | | |
| | | /** |
| | | * 查询订单 |
| | | * @param outTradeNo |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/query") |
| | | public R<AliQueryOrder> query(@RequestParam("outTradeNo") String outTradeNo){ |
| | | AlipayTradeQueryResponse alipayTradeQueryResponse = h5PayUtil.queryAliOrder(outTradeNo); |
| | | if(null != alipayTradeQueryResponse){ |
| | | AliQueryOrder aliQueryOrder = new AliQueryOrder(); |
| | | BeanUtils.copyProperties(alipayTradeQueryResponse, aliQueryOrder); |
| | | return R.ok(aliQueryOrder); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 关闭订单 |
| | | * @param outTradeNo |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/close") |
| | | public void close(@RequestParam("outTradeNo") String outTradeNo){ |
| | | boolean close = h5PayUtil.close(outTradeNo); |
| | | if(!close){ |
| | | throw new RuntimeException("关闭支付宝订单失败"); |
| | | } |
| | | } |
| | | /** |
| | | * 后台退款 远程调用 |
| | | */ |
| | | @PostMapping("/refund") |
| | | public R<RefundResp> refund(@RequestBody RefundReq dto){ |
| | | Map<String, String> map = h5PayUtil.aliRefund(dto.getOutTradeNo(), dto.getRefundAmount()); |
| | | RefundResp refundResp = new RefundResp(); |
| | | refundResp.setCode(map.get("code")); |
| | | refundResp.setMsg(map.get("msg")); |
| | | refundResp.setTradeNo(map.get("trade_no")); |
| | | refundResp.setOutTradeNo(map.get("out_trade_no")); |
| | | refundResp.setRefundFee(new Double(map.get("refund_fee"))); |
| | | return R.ok(refundResp); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/callBack") |
| | | public void chargingOrderALICallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> callback = h5PayUtil.alipayCallback(request); |
| | | if(null != callback){ |
| | | String out_trade_no = callback.get("out_trade_no"); |
| | | String attach = callback.get("subject"); |
| | | String total_amount = callback.get("total_amount"); |
| | | String transaction_id = callback.get("trade_no"); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | case "CD": |
| | | chargingOrderClient.chargingOrderALIH5Callback(out_trade_no, transaction_id, attach); |
| | | System.err.println("----充电支付回调"); |
| | | break; |
| | | } |
| | | PrintWriter writer = response.getWriter(); |
| | | writer.println("success"); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |