Merge remote-tracking branch 'origin/master'
1 文件已重命名
59个文件已修改
46个文件已添加
| | |
| | | public R<List<TAppUserCar>> getCarByIds(List<Long> carIds) { |
| | | return R.fail("根据用户车辆id查询车辆信息失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TAppUserCar> getAppUserCarByLicensePlate(String licensePlate) { |
| | | return R.fail("根据车牌号查询数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.InviteUserClient; |
| | | import com.ruoyi.account.api.model.TInviteUser; |
| | | import com.ruoyi.account.api.vo.GetInviteUser; |
| | | 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 InviteUserFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<InviteUserClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(InviteUserFallbackFactory.class); |
| | | |
| | | @Override |
| | | public InviteUserClient create(Throwable throwable) { |
| | | log.error("邀请用户调用失败:{}", throwable.getMessage()); |
| | | return new InviteUserClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<TInviteUser> getInviteUser(GetInviteUser query) { |
| | | return R.fail("获取用户邀请数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void updateInviteUser(TInviteUser query) { |
| | | R.fail("修改用户邀请数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void saveInviteUser(TInviteUser query) { |
| | | R.fail("添加用户邀请数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Long> carIds); |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号查询数据 |
| | | * @param licensePlate |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getAppUserCarByLicensePlate") |
| | | R<TAppUserCar> getAppUserCarByLicensePlate(@RequestParam("licensePlate") String licensePlate); |
| | | } |
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.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 = "InviteUserClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = InviteUserFallbackFactory.class) |
| | | public interface InviteUserClient { |
| | | |
| | | |
| | | /** |
| | | * 获取用户邀请数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-invite-user/getInviteUser") |
| | | R<TInviteUser> getInviteUser(@RequestBody GetInviteUser query); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改用户邀请数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-invite-user/updateInviteUser") |
| | | void updateInviteUser(@RequestBody TInviteUser query); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加用户邀请数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-invite-user/saveInviteUser") |
| | | void saveInviteUser(@RequestBody TInviteUser query); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 17:58 |
| | | */ |
| | | @Data |
| | | public class GetInviteUser { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Long appUserId; |
| | | /** |
| | | * 被邀请用户id |
| | | */ |
| | | private Long beInvitedAppUserId; |
| | | } |
| | |
| | | com.ruoyi.account.api.factory.AppUserIntegralChangeFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserAddressFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserVipDetailFallbackFactory |
| | | com.ruoyi.account.api.factory.InviteUserFallbackFactory |
| | |
| | | return new AccountingStrategyDetailClient(){ |
| | | |
| | | @Override |
| | | public R<TAccountingStrategyDetail> getNowData(Integer accountingStrategyId) { |
| | | return R.fail("获取当前有效的计费策略明细失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TAccountingStrategyDetail> getDetailBySiteId(Integer siteId) { |
| | | return R.fail("通过站点id查询当前时段使用的策略明细失败:" + throwable.getMessage()); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAccountingStrategyDetail>> getListByAccountingStrategyId(Integer id) { |
| | | throw new RuntimeException("根据计费策略主表id策略明细失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAccountingStrategyDetail>> getDetailListByCode(String code) { |
| | | return R.fail("通过桩编号查询当前使用的策略明细列表失败:" + throwable.getMessage()); |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/28 18:33 |
| | | */ |
| | | @Component |
| | | public class AccountingStrategyFallbackFactory implements FallbackFactory<AccountingStrategyClient> { |
| | | private static final Logger log = LoggerFactory.getLogger(AccountingStrategyFallbackFactory.class); |
| | | |
| | | |
| | | @Override |
| | | public AccountingStrategyClient create(Throwable throwable) { |
| | | log.error("计费策略调用失败:{}", throwable.getMessage()); |
| | | return new AccountingStrategyClient(){ |
| | | |
| | | |
| | | @Override |
| | | public R<TAccountingStrategy> getAccountingStrategyById(Integer id) { |
| | | throw new RuntimeException("根据id查询计费策略失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | public R<BigDecimal> getRecordAmount(LocalDate sixBefore) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<TParkingLot> getParkingLotByAppKey(String appKey) { |
| | | return R.fail("根据停车场标识查询失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | 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 ParkingRecordFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<ParkingRecordClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(ParkingRecordFallbackFactory.class); |
| | | |
| | | @Override |
| | | public ParkingRecordClient create(Throwable throwable) { |
| | | log.error("停车记录调用失败:{}", throwable.getMessage()); |
| | | return new ParkingRecordClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<TParkingRecord> getParkingRecord(GetParkingRecord query) { |
| | | return R.fail("根据车牌和状态查询停车数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void updateParkingRecord(TParkingRecord parkingRecord) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public R<TParkingRecord> getParkingRecordById(Long id) { |
| | | return R.fail("根据id获取数失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void addParkingRecord(TParkingRecord parkingRecord) { |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.AccountingStrategyFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | 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.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 15:51 |
| | | */ |
| | | @FeignClient(contextId = "AccountingStrategyClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = AccountingStrategyFallbackFactory.class) |
| | | public interface AccountingStrategyClient { |
| | | |
| | | /** |
| | | * 根据id查询计费策略 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy/getAccountingStrategyById") |
| | | R<TAccountingStrategy> getAccountingStrategyById(@RequestParam("id") Integer id); |
| | | } |
| | |
| | | public interface AccountingStrategyDetailClient { |
| | | |
| | | |
| | | /** |
| | | * 获取当前有效的计费策略明细 |
| | | * @param accountingStrategyId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getNowData") |
| | | R<TAccountingStrategyDetail> getNowData(@RequestParam("accountingStrategyId") Integer accountingStrategyId); |
| | | |
| | | /** |
| | | * 通过站点id查询当前时段使用的策略明细 |
| | | * @param siteId |
| | |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/checkChargingStrategy") |
| | | R<Boolean> checkChargingStrategy(@RequestBody CheckChargingStrategyDTO dto); |
| | | |
| | | |
| | | /** |
| | | * 根据计费策略主表id策略明细 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getListByAccountingStrategyId") |
| | | R<List<TAccountingStrategyDetail>> getListByAccountingStrategyId(@RequestParam("id") Integer id); |
| | | /** |
| | | * 通过桩编号查询当前使用的策略明细列表 |
| | | * @param code |
| | |
| | | @PostMapping(value = "/t-parking-lot/getRecordAmount") |
| | | public R<BigDecimal> getRecordAmount(@RequestParam("sixBefore") LocalDate sixBefore); |
| | | |
| | | |
| | | /** |
| | | * 根据停车场标识查询停车场 |
| | | * @param appKey |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-parking-lot/getParkingLotByAppKey") |
| | | R<TParkingLot> getParkingLotByAppKey(@RequestParam("appKey") String appKey); |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | 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; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 14:05 |
| | | */ |
| | | @FeignClient(contextId = "ParkingRecordClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = ParkingRecordFallbackFactory.class) |
| | | public interface ParkingRecordClient { |
| | | |
| | | |
| | | /** |
| | | * 根据车牌和状态查询停车数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-parking-record/getParkingRecord") |
| | | R<TParkingRecord> getParkingRecord(@RequestBody GetParkingRecord query); |
| | | |
| | | |
| | | /** |
| | | * 修改停车数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/t-parking-record/updateParkingRecord") |
| | | void updateParkingRecord(@RequestBody TParkingRecord parkingRecord); |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-parking-record/getParkingRecordById") |
| | | R<TParkingRecord> getParkingRecordById(@RequestParam("id") Long id); |
| | | |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/t-parking-record/addParkingRecord") |
| | | void addParkingRecord(@RequestBody TParkingRecord parkingRecord); |
| | | |
| | | } |
| | |
| | | @TableField("site_id") |
| | | private Integer siteId; |
| | | |
| | | @TableField(exist = false) |
| | | private String siteName; |
| | | |
| | | @ApiModelProperty(value = "充电桩id") |
| | | @TableField("charging_pile_id") |
| | | private Integer chargingPileId; |
| | | |
| | | @TableField(exist = false) |
| | | private String chargingPileName; |
| | | |
| | | @ApiModelProperty(value = "状态(1=离线,2=故障)") |
| | | @TableField("status") |
| | | private Integer status; |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "类型(1=自营,2=合作)") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "车场名称") |
| | | @TableField("name") |
| | | private String name; |
| | |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "停车场标识") |
| | | @TableField("app_Key") |
| | | private String appKey; |
| | | |
| | | @ApiModelProperty(value = "停车场秘钥") |
| | | @TableField("secret_Key") |
| | | private String secretKey; |
| | | |
| | | @ApiModelProperty(value = "站点id") |
| | | @TableField("site_id") |
| | | private Integer siteId; |
| | |
| | | @ApiModelProperty(value = "车牌号") |
| | | @TableField("license_plate") |
| | | private String licensePlate; |
| | | |
| | | @TableField(exist = false) |
| | | private String name; |
| | | @TableField(exist = false) |
| | | |
| | | @TableField(exist = false) |
| | | private String uid; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | | private String code; |
| | |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "超时占位费") |
| | | @TableField("timeout_amount") |
| | | private BigDecimal timeoutAmount; |
| | | |
| | | @ApiModelProperty(value = "电话") |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "免费时长(分钟)") |
| | | @TableField("free_duration") |
| | | private Integer freeDuration; |
| | | |
| | | @ApiModelProperty(value = "免费金额") |
| | | @TableField("free_amount") |
| | | private BigDecimal freeAmount; |
| | | |
| | | @ApiModelProperty(value = "车场流水号") |
| | | @TableField("serialnumber") |
| | | private String serialnumber; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("site_id") |
| | | private Integer siteId; |
| | | |
| | | @TableField(exist = false) |
| | | private String siteName; |
| | | |
| | | @ApiModelProperty(value = "充电桩id") |
| | | @TableField("charging_pile_id") |
| | | private Integer chargingPileId; |
| | | |
| | | @TableField(exist = false) |
| | | private String chargingPileName; |
| | | |
| | | @ApiModelProperty(value = "报修内容") |
| | | @TableField("content") |
| | | private String content; |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 14:16 |
| | | */ |
| | | @Data |
| | | public class GetParkingRecord { |
| | | /** |
| | | * 车牌 |
| | | */ |
| | | private String licensePlate; |
| | | /** |
| | | * 状态(1=已进场,2=已出场,3=已缴费出场) |
| | | */ |
| | | private Integer status; |
| | | } |
| | |
| | | com.ruoyi.chargingPile.api.factory.ParkingLotFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyDetailFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory |
New file |
| | |
| | | package com.ruoyi.order.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.feignClient.AccountingStrategyDetailOrderClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.model.AccountingStrategyDetailOrder; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 充电订单服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class AccountingStrategyDetailOrderFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<AccountingStrategyDetailOrderClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(AccountingStrategyDetailOrderFallbackFactory.class); |
| | | |
| | | @Override |
| | | public AccountingStrategyDetailOrderClient create(Throwable throwable) { |
| | | log.error("计费策略调用失败:{}", throwable.getMessage()); |
| | | return new AccountingStrategyDetailOrderClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<AccountingStrategyDetailOrder> getNowAccountingStrategyDetailOrder(Long orderId) { |
| | | return R.fail("根据订单id获取当前有效的策略失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | public R<Long> useOrderCount(Long userId) { |
| | | return R.fail("订单计数:" + throwable.getMessage()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public R<ChargingBillVO> chargingBillListR(ChargingListQuery dto) { |
| | | return R.fail("查询充电算帐单失败" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public R<TChargingOrder> getOrderByCode(String code) { |
| | | return R.fail("通过流水号查询订单调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void endCharge(String code) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void excelEndCharge(String code) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public R<TChargingOrder> getChargingOrderByLicensePlate(GetChargingOrderByLicensePlate query) { |
| | | return R.fail("根据车牌号和时间查询有效的充电数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.slf4j.Logger; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> addVipOrder(TVipOrder vipOrder) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<TShoppingOrder> shopCreate(ExchangeDto exchangeDto) { |
| | | return R.fail("订单创建" + cause.getMessage()); |
| | | } |
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.AccountingStrategyDetailOrderFallbackFactory; |
| | | import com.ruoyi.order.api.model.AccountingStrategyDetailOrder; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 16:11 |
| | | */ |
| | | @FeignClient(contextId = "AccountingStrategyDetailOrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = AccountingStrategyDetailOrderFallbackFactory.class) |
| | | public interface AccountingStrategyDetailOrderClient { |
| | | |
| | | |
| | | /** |
| | | * 根据订单id获取当前有效的策略 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping("/accountingStrategyDetailOrder/getNowAccountingStrategyDetailOrder") |
| | | R<AccountingStrategyDetailOrder> getNowAccountingStrategyDetailOrder(@RequestParam("orderId") Long orderId); |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | public interface ChargingOrderClient { |
| | | @PostMapping(value = "/t-charging-order/useOrderCount") |
| | | R<Long> useOrderCount(@RequestParam("userId") Long userId); |
| | | |
| | | @PostMapping(value = "/t-charging-order/chargingBillListR") |
| | | R<ChargingBillVO> chargingBillListR(@RequestBody ChargingListQuery dto); |
| | | @PostMapping(value = "/t-charging-order/detail") |
| | | R<TChargingOrder> orderDetail(@RequestParam("orderId") Long orderId); |
| | | |
| | |
| | | */ |
| | | @PostMapping(value = "/t-charging-order/getOrderByCode/{code}") |
| | | R<TChargingOrder> getOrderByCode(@PathVariable("code") String code); |
| | | |
| | | |
| | | /** |
| | | * 充电解释后处理逻辑 |
| | | * @param code |
| | | */ |
| | | @PostMapping("/t-charging-order/endCharge") |
| | | void endCharge(@RequestParam("code") String code); |
| | | |
| | | |
| | | /** |
| | | * 硬件异常结束充电后的处理逻辑 |
| | | * @param code |
| | | */ |
| | | @PostMapping("/t-charging-order/excelEndCharge") |
| | | void excelEndCharge(@RequestParam("code") String code); |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号和时间查询有效的充电数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-order/getChargingOrderByLicensePlate") |
| | | R<TChargingOrder> getChargingOrderByLicensePlate(@RequestBody GetChargingOrderByLicensePlate query); |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.factory.OrderFallbackFactory; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | |
| | | @PostMapping("/t-exchange-order/create") |
| | | public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-vip-order//addVipOrder") |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder vipOrder); |
| | | @PostMapping("/t-shopping-order/create") |
| | | public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-shopping-order/callBack") |
File was renamed from ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ChargingListQuery.java |
| | |
| | | package com.ruoyi.order.dto; |
| | | package com.ruoyi.order.api.model; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @ApiModel(value = "充电账单列表查询参数") |
| | | public class ChargingListQuery extends BasePage { |
| | | @ApiModelProperty("订单分类 1全站 2各个站点") |
| | | private String category; |
| | | @ApiModelProperty("账单周期2020-01-01 - 2020-01-01") |
| | | private String type; |
| | | @ApiModelProperty("账单周期2020-01-01 00:00:00 - 2020-01-01 23:59:59") |
| | | private String startTime; |
| | | @ApiModelProperty("1已出账 2未出账") |
| | | private Integer state; |
| | | @ApiModelProperty("uid 前端忽略") |
| | | private String uid; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.model; |
| | | |
| | | 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 org.springframework.cglib.core.Local; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 充电算帐单 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-09-04 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_charging_bill") |
| | | @ApiModel(value="TChargingBill对象", description="") |
| | | public class TChargingBill extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "账单编号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "账单类型 1全站账单 2站点账单") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "站点id") |
| | | @TableField("site_id") |
| | | private Integer siteId; |
| | | |
| | | @ApiModelProperty(value = "账单生成时间 每月二号") |
| | | @TableField("bill_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime billTime; |
| | | |
| | | @ApiModelProperty(value = "1未出账2已出账") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "uid") |
| | | @TableField(exist = false) |
| | | private String uid; |
| | | } |
| | |
| | | @ApiModelProperty(value = "退款流水号") |
| | | @TableField("refund_code") |
| | | private String refundCode; |
| | | @ApiModelProperty(value = "退款原因") |
| | | @TableField("refund_reason") |
| | | private String refundReason; |
| | | |
| | | @ApiModelProperty(value = "退款金额") |
| | | @TableField("refund_amount") |
| | |
| | | @TableField("pay_time") |
| | | private LocalDateTime payTime; |
| | | |
| | | @ApiModelProperty(value = "站点名称") |
| | | @TableField(exist = false) |
| | | private String siteName; |
| | | @ApiModelProperty(value = "终端名称") |
| | | @TableField(exist = false) |
| | | private String terminalName; |
| | | @ApiModelProperty(value = "终端编号") |
| | | @TableField(exist = false) |
| | | private String terminalCode; |
| | | @ApiModelProperty(value = "订单分类") |
| | | @TableField(exist = false) |
| | | private String orderClassification1; |
| | | @ApiModelProperty(value = "支付方式") |
| | | @TableField(exist = false) |
| | | private String rechargePaymentType1; |
| | | @ApiModelProperty(value = "充电启动方式") |
| | | @TableField(exist = false) |
| | | private String chargingType; |
| | | @ApiModelProperty(value = "订单状态") |
| | | @TableField(exist = false) |
| | | private String status1; |
| | | @ApiModelProperty(value = "终端名称") |
| | | @TableField(exist = false) |
| | | private String endMode1; |
| | | @ApiModelProperty(value = "充电费用") |
| | | @TableField(exist = false) |
| | | private String totalAmount; |
| | | @ApiModelProperty(value = "优惠抵扣") |
| | | @TableField(exist = false) |
| | | private String discount; |
| | | @ApiModelProperty(value = "充电时长") |
| | | @TableField(exist = false) |
| | | private String chargingTime; |
| | | @ApiModelProperty(value = "充电后soc") |
| | | @TableField(exist = false) |
| | | private String endSoc; |
| | | @ApiModelProperty(value = "客户昵称") |
| | | @TableField(exist = false) |
| | | private String userName; |
| | | @ApiModelProperty(value = "手机号") |
| | | @TableField(exist = false) |
| | | private String phone; |
| | | @ApiModelProperty(value = "车牌号") |
| | | @TableField(exist = false) |
| | | private String licensePlate; |
| | | @ApiModelProperty(value = "车辆品牌") |
| | | @TableField(exist = false) |
| | | private String vehicleModel; |
| | | |
| | | } |
| | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_charging_order_refund") |
| | | @ApiModel(value="TChargingOrderRefund对象", description="") |
| | | @ApiModel(value="TChargingOrderRefund对象1", description="") |
| | | public class TChargingOrderRefund implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | @TableField("pay_amount") |
| | | private BigDecimal payAmount; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer type; |
| | | @ApiModelProperty(value = "第三方支付流水号") |
| | | @TableField(exist = false) |
| | | private String serailNumber; |
| | | @ApiModelProperty(value = "支付金额") |
| | | @TableField(exist = false) |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "支付时间") |
| | | @TableField(exist = false) |
| | | private LocalDateTime payTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel(value = "ChargingBillListVO对象",description = "充电算帐单列表VO") |
| | | public class ChargingBillListVO extends TChargingBill { |
| | | @ApiModelProperty(value = "账单周期") |
| | | private String billWeek; |
| | | @ApiModelProperty(value = "充电时间 秒") |
| | | private Integer chargingSecond; |
| | | @ApiModelProperty(value = "订单数量") |
| | | private Integer orderCount; |
| | | @ApiModelProperty(value = "站点名称") |
| | | private String siteName; |
| | | @ApiModelProperty(value = "实收金额") |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "总金额") |
| | | private BigDecimal orderAmount; |
| | | @ApiModelProperty(value = "累计电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "累计服务费") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "平台手续费") |
| | | private BigDecimal commissionAmount; |
| | | @ApiModelProperty(value = "平台分佣") |
| | | private BigDecimal sharingAmount; |
| | | @ApiModelProperty(value = "充电电流 度") |
| | | private BigDecimal chargingCapacity; |
| | | } |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "ChargingBillVO对象",description = "充电算帐单") |
| | |
| | | @ApiModelProperty(value = "订单数量") |
| | | private Integer orderCount; |
| | | @ApiModelProperty(value = "平台手续费") |
| | | private String commissionAmount; |
| | | private BigDecimal commissionAmount; |
| | | @ApiModelProperty(value = "三方平台分佣") |
| | | private String sharingAmount; |
| | | private BigDecimal sharingAmount; |
| | | @ApiModelProperty(value = "优惠抵扣") |
| | | private String discount; |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "账单分类 1全站 2各个站点 前端忽略") |
| | | private String category; |
| | | @ApiModelProperty(value = "账单类型 月结 前端忽略") |
| | | private String type; |
| | | @ApiModelProperty(value = "站点名称 前端忽略") |
| | | private String siteName; |
| | | @ApiModelProperty(value = "账单周期 前端忽略") |
| | | private String billWeek; |
| | | @ApiModelProperty(value = "账单生成日期 前端忽略") |
| | | private String createTime; |
| | | @ApiModelProperty(value = "账单编号 前端忽略") |
| | | private String code; |
| | | @ApiModelProperty(value = "充电时长 前端忽略") |
| | | private String chargingTime; |
| | | @ApiModelProperty(value = "列表数据") |
| | | private PageInfo<ChargingOrderListVO> list; |
| | | private PageInfo<ChargingBillListVO> list; |
| | | @ApiModelProperty(value = "导出Excel数据 前端忽略") |
| | | private List<TChargingOrder> exportList; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 14:25 |
| | | */ |
| | | @Data |
| | | public class GetChargingOrderByLicensePlate { |
| | | /** |
| | | * 车牌 |
| | | */ |
| | | private String licensePlate; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startTime; |
| | | |
| | | } |
| | |
| | | com.ruoyi.order.api.factory.OrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ExchangeOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ChargingOrderAccountingStrategyFallbackFactory |
| | | com.ruoyi.order.api.factory.AccountingStrategyDetailOrderFallbackFactory |
| | |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.auth.form.LoginBody; |
| | | import com.ruoyi.auth.form.RegisterBody; |
| | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("token", tokenService.createToken(userInfo)); |
| | | List<SysRole> roles = userInfo.getSysUser().getRoles(); |
| | | // if(CollectionUtils.isEmpty(roles)){ |
| | | // return R.fail("请关联角色!"); |
| | | // } |
| | | if(CollectionUtils.isEmpty(roles)){ |
| | | return R.fail("请关联角色!"); |
| | | } |
| | | |
| | | // map.put("roleName",roles.get(0).getRoleName()); |
| | | map.put("roleName",roles.get(0).getRoleName()); |
| | | map.put("info", userInfo); |
| | | // 修改用户最后登录时间 |
| | | SysUser sysUser = new SysUser(); |
| | |
| | | public LoginUserApplet getLoginUserApplet() { |
| | | LoginUserApplet loginUserAppletToken = getLoginUserAppletToken(ServletUtils.getRequest()); |
| | | if (loginUserAppletToken == null) { |
| | | throw new UserAppletException("登录失效,请重新登录!", 401); |
| | | throw new RuntimeException("令牌已过期,请重新登录!"); |
| | | } |
| | | return loginUserAppletToken; |
| | | } |
| | |
| | | * @return 用户信息 |
| | | */ |
| | | public LoginUser getLoginUser() { |
| | | return getLoginUser(ServletUtils.getRequest()); |
| | | LoginUser loginUser = getLoginUser(ServletUtils.getRequest()); |
| | | if (loginUser == null) { |
| | | throw new RuntimeException("令牌已过期,请重新登录!"); |
| | | } |
| | | return loginUser; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | public void refreshToken1(LoginUserApplet dto) { |
| | | dto.setLoginTime(System.currentTimeMillis()); |
| | | dto.setExpireTime(dto.getLoginTime() + expireTime * MILLIS_MINUTE); |
| | | dto.setExpireTime(dto.getLoginTime() + expireAppletTime * MILLIS_MINUTE); |
| | | // 根据uuid将loginUser缓存 |
| | | String userKey = getTokenKey(dto.getToken()); |
| | | redisService.setCacheObject(userKey, dto, expireTime, TimeUnit.MINUTES); |
| | | redisService.setCacheObject(userKey, dto, expireAppletTime, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | private String getTokenKey(String token) { |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.service.TAppUserCarService; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | return R.ok(appUserCarService.list(Wrappers.lambdaQuery(TAppUserCar.class).in(TAppUserCar::getId,carIds))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号查询数据 |
| | | * @param licensePlate |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getAppUserCarByLicensePlate") |
| | | public R<TAppUserCar> getAppUserCarByLicensePlate(@RequestParam("licensePlate") String licensePlate){ |
| | | TAppUserCar one = appUserCarService.getOne(new LambdaQueryWrapper<TAppUserCar>().eq(TAppUserCar::getLicensePlate, licensePlate).eq(TAppUserCar::getDelFlag, 0)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.model.TInviteUser; |
| | | import com.ruoyi.account.api.vo.GetInviteUser; |
| | | import com.ruoyi.account.service.TInviteUserService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-invite-user") |
| | | public class TInviteUserController { |
| | | |
| | | @Resource |
| | | private TInviteUserService inviteUserService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户邀请数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/getInviteUser") |
| | | public R<TInviteUser> getInviteUser(@RequestBody GetInviteUser query){ |
| | | TInviteUser one = inviteUserService.getOne(new LambdaQueryWrapper<TInviteUser>().eq(TInviteUser::getAppUserId, query.getBeInvitedAppUserId()) |
| | | .eq(TInviteUser::getBeInvitedAppUserId, query.getBeInvitedAppUserId())); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改邀请数据 |
| | | * @param query |
| | | */ |
| | | @PostMapping("/updateInviteUser") |
| | | public void updateInviteUser(@RequestBody TInviteUser query){ |
| | | inviteUserService.updateById(query); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加邀请数据 |
| | | * @param query |
| | | */ |
| | | @PostMapping("/saveInviteUser") |
| | | public void saveInviteUser(@RequestBody TInviteUser query){ |
| | | inviteUserService.save(query); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | /** |
| | | * 小程序扫一扫 |
| | | * @param number |
| | |
| | | byId.setAuditStatus(3); |
| | | byId.setTwoRemark(steategyPassDto.getRemark()); |
| | | byId.setTwoAuditTime(LocalDateTime.now()); |
| | | |
| | | //如果parentId不为空,则将parentId对应的siteId改为现在的,并且将parenId对应的数据删除 |
| | | |
| | | |
| | | //将site表对应的模板id修改为新的这个 |
| | | |
| | | } |
| | | }else { |
| | | byId.setAuditStatus(4); |
| | |
| | | |
| | | return R.ok(res); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id查询数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getAccountingStrategyById") |
| | | public R<TAccountingStrategy> getAccountingStrategyById(@RequestParam("id") Integer id) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(id); |
| | | return R.ok(accountingStrategy); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取当前有效的计费模板 |
| | | * @param accountingStrategyId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getNowData") |
| | | public R<TAccountingStrategyDetail> getNowData(@RequestParam("accountingStrategyId") Integer accountingStrategyId){ |
| | | TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(new LambdaQueryWrapper<TAccountingStrategyDetail>() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategyId) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过站点id查询当前时段使用的策略明细 |
| | |
| | | return R.ok(dto.getStrategyDetailId().equals(one.getId())); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据计费策略主表id策略明细 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getListByAccountingStrategyId") |
| | | public R<List<TAccountingStrategyDetail>> getListByAccountingStrategyId(@RequestParam("id") Integer id){ |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.list(new LambdaQueryWrapper<TAccountingStrategyDetail>().eq(TAccountingStrategyDetail::getAccountingStrategyId, id)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * 通过桩编号查询当前使用的策略明细列表 |
| | | * @param code |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | import java.math.BigDecimal; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.vo.ChargingBillListVO; |
| | | |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.EasyExcelFactory; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.enums.WriteDirectionEnum; |
| | | import com.alibaba.excel.write.builder.ExcelWriterBuilder; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.excel.write.metadata.fill.FillConfig; |
| | | import com.alibaba.excel.write.metadata.fill.FillWrapper; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.codec.CharEncoding; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | |
| | | private final TApplyChargingPileService applyChargingPileService; |
| | | private final TokenService tokenService; |
| | | private final RedisService redisService; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | @Autowired |
| | | public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService, TokenService tokenService, RedisService redisService) { |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "下载-已出账", tags = {"管理后台-充电算账单"}) |
| | | @GetMapping("/downloadBill") |
| | | public R downloadBill(String uid,HttpServletResponse response) |
| | | { |
| | | ChargingListQuery chargingListQuery = new ChargingListQuery(); |
| | | chargingListQuery.setUid(uid); |
| | | chargingListQuery.setPageCurr(1); |
| | | chargingListQuery.setPageSize(99999); |
| | | ChargingBillVO data = chargingOrderClient.chargingBillListR(chargingListQuery).getData(); |
| | | |
| | | List<ChargingBillVO> chargingBillVOS = new ArrayList<>(); |
| | | chargingBillVOS.add(data); |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-disposition"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + |
| | | URLEncoder.encode("月账单-"+data.getCategory()+"-"+data.getBillWeek()+"-"+data.getSiteName(), CharEncoding.UTF_8) + ".xlsx"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | try { |
| | | // excel模板封装 |
| | | ExcelWriterBuilder excelWriterBuilder = EasyExcelFactory.write(response.getOutputStream()); |
| | | InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"充电算帐单已出账" + ".xlsx"); |
| | | // 自动释放资源 |
| | | try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) { |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
| | | excelWriter.fill(new FillWrapper("data1", chargingBillVOS), fillConfig, writeSheet); |
| | | excelWriter.fill(new FillWrapper("data2", data.getExportList()), fillConfig, writeSheet); |
| | | excelWriter.finish(); |
| | | } catch (Exception e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | } catch (IOException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"}) |
| | | @GetMapping("/download") |
| | | public R download(String uid,HttpServletResponse response) |
| | | { |
| | | ChargingListQuery chargingListQuery = new ChargingListQuery(); |
| | | chargingListQuery.setUid(uid); |
| | | chargingListQuery.setPageCurr(1); |
| | | chargingListQuery.setPageSize(99999); |
| | | ChargingBillVO data = chargingOrderClient.chargingBillListR(chargingListQuery).getData(); |
| | | |
| | | List<ChargingBillVO> chargingBillVOS = new ArrayList<>(); |
| | | chargingBillVOS.add(data); |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-disposition"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + |
| | | URLEncoder.encode("月账单-"+data.getCategory()+data.getBillWeek()+data.getSiteName(), CharEncoding.UTF_8) + ".xlsx"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | try { |
| | | // excel模板封装 |
| | | ExcelWriterBuilder excelWriterBuilder = EasyExcelFactory.write(response.getOutputStream()); |
| | | InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"充电算帐单已出账" + ".xlsx"); |
| | | // 自动释放资源 |
| | | try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) { |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
| | | excelWriter.fill(new FillWrapper("data1", chargingBillVOS), fillConfig, writeSheet); |
| | | excelWriter.fill(new FillWrapper("data2", data.getExportList()), fillConfig, writeSheet); |
| | | excelWriter.finish(); |
| | | } catch (Exception e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | } catch (IOException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | public static boolean isImageUrl(JSONObject jsonObject) { |
| | | String url = jsonObject.getString("url"); |
| | | Pattern pattern = Pattern.compile( |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | 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.log.enums.OperatorType; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取故障信息列表 |
| | | * @param siteId |
| | | * @param basePage |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getFaultMessageList") |
| | | @ApiOperation(value = "获取故障信息列表数据", tags = {"管理后台-设备监控"}) |
| | | public AjaxResult<PageInfo<TFaultMessage>> getFaultMessageList(Integer siteId, BasePage basePage){ |
| | | PageInfo<TFaultMessage> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | List<TFaultMessage> faultMessageList = faultMessageService.getFaultMessageList(pageInfo, siteId); |
| | | pageInfo.setRecords(faultMessageList); |
| | | return AjaxResult.success(pageInfo); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/addFaultMessage") |
| | | @ApiOperation(value = "添加故障信息", tags = {"管理后台-设备监控"}) |
| | | public AjaxResult addFaultMessage(@RequestBody TFaultMessage faultMessage){ |
| | | faultMessageService.save(faultMessage); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @DeleteMapping("/delFaultMessage/{id}") |
| | | @ApiOperation(value = "删除故障信息", tags = {"管理后台-设备监控"}) |
| | | public AjaxResult delFaultMessage(@PathVariable Integer id){ |
| | | faultMessageService.removeById(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.TParkingLotDTO; |
| | | import com.ruoyi.chargingPile.api.model.TCarport; |
| | |
| | | BigDecimal sum = parkingRecordService.getSum(sixBefore); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据停车场标识查询停车场 |
| | | * @param appKey |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getParkingLotByAppKey") |
| | | public R<TParkingLot> getParkingLotByAppKey(@RequestParam("appKey") String appKey){ |
| | | TParkingLot parkingLot = parkingLotService.getOne(new LambdaQueryWrapper<TParkingLot>() |
| | | .eq(TParkingLot::getAppKey, appKey).eq(TParkingLot::getDelFlag, 0)); |
| | | return R.ok(parkingLot); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.chargingPile.dto.ParkingRecordPageQuery; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | import com.ruoyi.chargingPile.service.TParkingRecordService; |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "详情") |
| | | @GetMapping(value = "/detail") |
| | | public R<TParkingRecord> detail(Long id) { |
| | | |
| | | return R.ok(parkingRecordService.getById(id)); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "出场") |
| | | @GetMapping(value = "/out") |
| | | public R out(Long id) { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据车牌和状态查询停车数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/getParkingRecord") |
| | | public R<TParkingRecord> getParkingRecord(@RequestBody GetParkingRecord query){ |
| | | TParkingRecord one = parkingRecordService.getOne(new LambdaQueryWrapper<TParkingRecord>() |
| | | .eq(TParkingRecord::getLicensePlate, query.getLicensePlate()).eq(TParkingRecord::getStatus, query.getStatus())); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改停车数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/updateParkingRecord") |
| | | public void updateParkingRecord(@RequestBody TParkingRecord parkingRecord){ |
| | | parkingRecordService.updateById(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getParkingRecordById") |
| | | public R<TParkingRecord> getParkingRecordById(@RequestParam("id") Long id){ |
| | | TParkingRecord parkingRecord = parkingRecordService.getById(id); |
| | | return R.ok(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/addParkingRecord") |
| | | public void addParkingRecord(@RequestBody TParkingRecord parkingRecord){ |
| | | parkingRecordService.save(parkingRecord); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.chargingPile.service.TRepairService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-repair") |
| | | public class TRepairController { |
| | | |
| | | @Resource |
| | | private TRepairService repairService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getRepairList") |
| | | @ApiOperation(value = "获取报修记录列表数据", tags = {"管理后台-设备监控"}) |
| | | public AjaxResult<PageInfo<TRepair>> getRepairList(String name, String siteId, BasePage basePage){ |
| | | PageInfo<TRepair> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | List<TRepair> repairList = repairService.getRepairList(pageInfo, name, siteId); |
| | | return AjaxResult.success(repairList); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/addRepair") |
| | | @ApiOperation(value = "添加报修记录", tags = {"管理后台-设备监控"}) |
| | | public AjaxResult addRepair(@RequestBody TRepair repair){ |
| | | repairService.save(repair); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @DeleteMapping("/delRepair/{id}") |
| | | @ApiOperation(value = "删除报修记录", tags = {"管理后台-设备监控"}) |
| | | public AjaxResult delRepair(@PathVariable Integer id){ |
| | | repairService.removeById(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TFaultMessageMapper extends BaseMapper<TFaultMessage> { |
| | | |
| | | /** |
| | | * 获取故障信息列表 |
| | | * @param pageInfo |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, @Param("siteId") Integer siteId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TRepairMapper extends BaseMapper<TRepair> { |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param pageInfo |
| | | * @param name |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, String siteId); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | void add(TFaultMessage dto); |
| | | |
| | | |
| | | /** |
| | | * 获取故障信息列表 |
| | | * @param pageInfo |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, Integer siteId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TRepairService extends IService<TRepair> { |
| | | |
| | | /** |
| | | * 获取报修记录列表 |
| | | * @param name |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, String siteId); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | chargingPileNotificationService.saveData(4,dto.getSiteId(),dto.getChargingPileId(),site.getPhone(),"检测到"+siteName+"..."+chargingPile.getNumber()+"号桩设备离线,请及时查看处理!"); |
| | | this.save(dto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取故障信息列表 |
| | | * @param pageInfo |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, Integer siteId) { |
| | | return this.baseMapper.getFaultMessageList(pageInfo, siteId); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.chargingPile.mapper.TRepairMapper; |
| | | import com.ruoyi.chargingPile.service.TRepairService; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TRepairServiceImpl extends ServiceImpl<TRepairMapper, TRepair> implements TRepairService { |
| | | |
| | | |
| | | /** |
| | | * 获取报修记录列表 |
| | | * @param name |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, String siteId) { |
| | | return this.baseMapper.getRepairList(pageInfo, name, siteId); |
| | | } |
| | | } |
| | |
| | | id, app_user_id, site_id, charging_pile_id, status, down_time, create_time, del_flag |
| | | </sql> |
| | | |
| | | |
| | | |
| | | <select id="getFaultMessageList" resultType="com.ruoyi.chargingPile.api.model.TFaultMessage"> |
| | | select |
| | | a.*, |
| | | b.name as chargingPileName, |
| | | c.name as siteName |
| | | from t_fault_message a |
| | | left join t_charging_pile b on (a.charging_pile_id = b.id) |
| | | left join t_site c on (a.site_id = c.id) |
| | | where a.del_flag = 0 |
| | | <if test="null != siteId"> |
| | | and a.site_id = #{siteId} |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | id, repairman, site_id, charging_pile_id, content, repair_time, create_time, del_flag |
| | | </sql> |
| | | |
| | | |
| | | |
| | | <select id="getRepairList" resultType="com.ruoyi.chargingPile.api.model.TRepair"> |
| | | select |
| | | a.*, |
| | | b.name as chargingPileName, |
| | | c.name as siteName |
| | | from t_repair a |
| | | left join t_charging_pile b on (a.charging_pile_id = b.id) |
| | | left join t_site c on (a.site_id = c.id) |
| | | where a.del_flag = 0 |
| | | <if test="null != name and '' != name"> |
| | | and a.repairman like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != siteId"> |
| | | and a.site_id = #{siteId} |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.controller; |
| | | |
| | | import com.ruoyi.integration.barrierGate.model.BaseResponse; |
| | | import com.ruoyi.integration.barrierGate.model.GetCouponReq; |
| | | import com.ruoyi.integration.barrierGate.model.GetCouponResp; |
| | | import com.ruoyi.integration.barrierGate.model.UsedCoupon; |
| | | import com.ruoyi.integration.barrierGate.server.CouponService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 优惠券控制器 |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:10 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/coupon") |
| | | public class CouponController { |
| | | |
| | | @Resource |
| | | private CouponService couponService; |
| | | |
| | | |
| | | /** |
| | | * 获取优惠券 |
| | | * 减免停车费的优惠 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getCoupon") |
| | | public BaseResponse<GetCouponResp> getCoupon(@RequestBody GetCouponReq req){ |
| | | GetCouponResp coupon = couponService.getCoupon(req); |
| | | return BaseResponse.ok(coupon); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用优惠券 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/usedCoupon") |
| | | public BaseResponse usedCoupon(@RequestBody UsedCoupon req){ |
| | | couponService.usedCoupon(req); |
| | | return BaseResponse.ok(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.controller; |
| | | |
| | | import com.ruoyi.integration.barrierGate.model.*; |
| | | import com.ruoyi.integration.barrierGate.server.ParkingOrderService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 16:14 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/parkingOrder") |
| | | public class ParkingOrderController { |
| | | |
| | | @Resource |
| | | private ParkingOrderService parkingOrderService; |
| | | |
| | | |
| | | /** |
| | | * 云停车入场 |
| | | * @param order |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingInOrder") |
| | | public BaseResponse cloudParkingInOrder(@RequestBody CloudParkingOrder order){ |
| | | parkingOrderService.cloudParkingInOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 云停车出场 |
| | | * @param order |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingOutOrder") |
| | | public BaseResponse cloudParkingOutOrder(@RequestBody CloudParkingOrder order){ |
| | | parkingOrderService.cloudParkingOutOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 云停车实时车位 |
| | | * @param parkingSpace |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingSpace") |
| | | public BaseResponse cloudParkingSpace(@RequestBody CloudParkingSpace parkingSpace){ |
| | | parkingOrderService.cloudParkingSpace(parkingSpace); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 线下停车场入场 |
| | | * @param order |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingInOrder") |
| | | public BaseResponse offlineParkingInOrder(@RequestBody OfflineParkingOrder order){ |
| | | parkingOrderService.offlineParkingInOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场出场 |
| | | * @param order |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingOutOrder") |
| | | public BaseResponse offlineParkingOutOrder(@RequestBody OfflineParkingOrder order){ |
| | | parkingOrderService.offlineParkingOutOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场实时车位 |
| | | * @param parkingSpace |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingSpace") |
| | | public BaseResponse offlineParkingSpace(@RequestBody OfflineParkingSpace parkingSpace){ |
| | | parkingOrderService.offlineParkingSpace(parkingSpace); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:29 |
| | | */ |
| | | @Data |
| | | public class BaseResponse<T> { |
| | | |
| | | private String code; |
| | | |
| | | private String msg; |
| | | |
| | | private T data; |
| | | |
| | | |
| | | public static BaseResponse ok(){ |
| | | return ok(new Object()); |
| | | } |
| | | |
| | | |
| | | public static <T> BaseResponse<T> ok(T data){ |
| | | BaseResponse baseResponse = new BaseResponse(); |
| | | baseResponse.setCode("0"); |
| | | baseResponse.setData(data); |
| | | baseResponse.setMsg("成功"); |
| | | return baseResponse; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 云停车订单实体 |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 15:54 |
| | | */ |
| | | @Data |
| | | public class CloudParkingOrder { |
| | | /** |
| | | * 停车场appKey |
| | | */ |
| | | private String appkey; |
| | | /** |
| | | * 车场业务ID |
| | | */ |
| | | private String id; |
| | | /** |
| | | * 入场通道号 |
| | | */ |
| | | private String enterChannel; |
| | | /** |
| | | * 入场时间 |
| | | */ |
| | | private String enterDateTime; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String plate; |
| | | /** |
| | | * 入场通道名称 |
| | | */ |
| | | private String enterChannelName; |
| | | /** |
| | | * 车牌颜色 |
| | | */ |
| | | private String plateColor; |
| | | /** |
| | | * 卡种类 |
| | | */ |
| | | private String kind; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 应收金额 |
| | | */ |
| | | private String receivable; |
| | | /** |
| | | * 实收金额 |
| | | */ |
| | | private String payment; |
| | | /** |
| | | * 支付方式 |
| | | */ |
| | | private String payType; |
| | | /** |
| | | * 离场通道号 |
| | | */ |
| | | private String leaveChannel; |
| | | /** |
| | | * 离场时间 |
| | | */ |
| | | private String leaveDateTime; |
| | | /** |
| | | * 离场通道名称 |
| | | */ |
| | | private String leaveChannelName; |
| | | /** |
| | | * 停车时长 |
| | | */ |
| | | private String longTime; |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 16:22 |
| | | */ |
| | | @Data |
| | | public class CloudParkingSpace { |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appkey; |
| | | /** |
| | | * 总车位数 |
| | | */ |
| | | private String total; |
| | | /** |
| | | * 已用车位 |
| | | */ |
| | | private String used; |
| | | /** |
| | | * 空余车位 |
| | | */ |
| | | private String free; |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:12 |
| | | */ |
| | | @Data |
| | | public class GetCouponReq { |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appKey; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String carNumber; |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 停车费用 |
| | | */ |
| | | private String fee; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:19 |
| | | */ |
| | | @Data |
| | | public class GetCouponResp { |
| | | /** |
| | | * 优惠券记录id |
| | | */ |
| | | private Long recordId; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String carNumber; |
| | | /** |
| | | * 平台编号 |
| | | */ |
| | | private String sysOrgId; |
| | | /** |
| | | * 商户名称 |
| | | */ |
| | | private String posName; |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | private String couponName; |
| | | /** |
| | | * 发放人 |
| | | */ |
| | | private String lssuer; |
| | | /** |
| | | * 类型:1单次全免、2金额优惠、3单笔折扣、4优惠时长、5日期范围全免 |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 优惠明细 |
| | | */ |
| | | private Parameter parameter; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 云停车订单实体 |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 15:54 |
| | | */ |
| | | @Data |
| | | public class OfflineParkingOrder { |
| | | /** |
| | | * 停车场appKey |
| | | */ |
| | | private String appkey; |
| | | /** |
| | | * 10 位时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | /** |
| | | * 进出记录 ID |
| | | */ |
| | | private String id; |
| | | /** |
| | | * 卡号 |
| | | */ |
| | | private String cardid; |
| | | /** |
| | | * 会员 ID |
| | | */ |
| | | private String memberid; |
| | | /** |
| | | * 会员类型 |
| | | */ |
| | | private String membertype; |
| | | /** |
| | | * 会员姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String platenumber; |
| | | /** |
| | | * 车牌颜色 |
| | | */ |
| | | private String platecolor; |
| | | /** |
| | | * 入场通道 |
| | | */ |
| | | private String enterchannel; |
| | | /** |
| | | * 入场时间 |
| | | */ |
| | | private String entertime; |
| | | /** |
| | | * 是否库中库 0、不是库中库,1、是库中库 |
| | | */ |
| | | private Integer subplace; |
| | | /** |
| | | * 抓拍图片(base64) |
| | | */ |
| | | private String image; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | /** |
| | | * 停车时长(分钟) |
| | | */ |
| | | @JsonProperty("long") |
| | | private String longTime; |
| | | /** |
| | | * 停车费用 |
| | | */ |
| | | private String money; |
| | | /** |
| | | * 出场通道 |
| | | */ |
| | | private String leavechannel; |
| | | /** |
| | | * 出场时间 |
| | | */ |
| | | private String leavetime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 16:22 |
| | | */ |
| | | @Data |
| | | public class OfflineParkingSpace { |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appkey; |
| | | /** |
| | | * 10 位时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | /** |
| | | * 总车位数 |
| | | */ |
| | | private Integer place; |
| | | /** |
| | | * 剩余车位数 |
| | | */ |
| | | private Integer surplus; |
| | | /** |
| | | * 固定车数量 |
| | | */ |
| | | private Integer fixed; |
| | | /** |
| | | * 临时车数量 |
| | | */ |
| | | private Integer interim; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:24 |
| | | */ |
| | | @Data |
| | | public class Parameter { |
| | | /** |
| | | * 使用门槛 |
| | | */ |
| | | private Boolean isHaveUseRequirement; |
| | | /** |
| | | * 金额优惠满减阈值 |
| | | */ |
| | | private Double minAmount; |
| | | /** |
| | | * 时长优惠满减阈值 |
| | | */ |
| | | private Double minRequirement; |
| | | /** |
| | | * 全免标记 |
| | | */ |
| | | private Boolean freeFlag; |
| | | /** |
| | | * 优惠折扣 |
| | | */ |
| | | private Double discount; |
| | | /** |
| | | * 优惠金额 |
| | | */ |
| | | private Double money; |
| | | /** |
| | | * 优惠时长 |
| | | */ |
| | | private Integer time; |
| | | /** |
| | | * 开始日期 yyyy-mm-dd HH:mm:ss #日期范围开始 |
| | | */ |
| | | private String startTime; |
| | | /** |
| | | * 结束日期 yyyy-mm-dd HH:mm:ss #日期范围开始 |
| | | */ |
| | | private String endTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 15:39 |
| | | */ |
| | | @Data |
| | | public class UsedCoupon { |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appKey; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String carNumber; |
| | | /** |
| | | * 车场流水号 |
| | | */ |
| | | private String serialnumber; |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 未优惠停车费用 |
| | | */ |
| | | private String fee; |
| | | /** |
| | | * 优惠金额 |
| | | */ |
| | | private String actualFee; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | private String recordId; |
| | | /** |
| | | * 平台编号 |
| | | */ |
| | | private String sysOrgId; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.server; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.integration.barrierGate.model.GetCouponReq; |
| | | import com.ruoyi.integration.barrierGate.model.GetCouponResp; |
| | | import com.ruoyi.integration.barrierGate.model.Parameter; |
| | | import com.ruoyi.integration.barrierGate.model.UsedCoupon; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:11 |
| | | */ |
| | | @Service |
| | | public class CouponService { |
| | | |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | |
| | | @Resource |
| | | private ParkingRecordClient parkingRecordClient; |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取优惠券 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | public GetCouponResp getCoupon(GetCouponReq req){ |
| | | //根据车牌查询入场时间,后再根据入场时间和车牌查询是否有充电订单 |
| | | String carNumber = req.getCarNumber(); |
| | | String appKey = req.getAppKey(); |
| | | TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(appKey).getData(); |
| | | if(null == parkingLot){ |
| | | return null; |
| | | } |
| | | GetParkingRecord query = new GetParkingRecord(); |
| | | query.setStatus(1); |
| | | query.setLicensePlate(carNumber); |
| | | TParkingRecord data = parkingRecordClient.getParkingRecord(query).getData(); |
| | | if(null == data){ |
| | | return null; |
| | | } |
| | | //入场时间 |
| | | LocalDateTime inParkingTime = data.getInParkingTime(); |
| | | //开始查询充电订单 |
| | | GetChargingOrderByLicensePlate getChargingOrderByLicensePlate = new GetChargingOrderByLicensePlate(); |
| | | getChargingOrderByLicensePlate.setLicensePlate(carNumber); |
| | | getChargingOrderByLicensePlate.setStartTime(inParkingTime); |
| | | TChargingOrder tChargingOrder = chargingOrderClient.getChargingOrderByLicensePlate(getChargingOrderByLicensePlate).getData(); |
| | | |
| | | GetCouponResp resp = new GetCouponResp(); |
| | | resp.setRecordId(data.getId()); |
| | | resp.setCarNumber(carNumber); |
| | | // todo 需要第三方提供数据 |
| | | resp.setSysOrgId(""); |
| | | resp.setPosName(""); |
| | | resp.setLssuer("admin"); |
| | | resp.setType(4); |
| | | Parameter parameter = new Parameter(); |
| | | parameter.setFreeFlag(false); |
| | | if(null == tChargingOrder){ |
| | | //按照非充电进行优惠计算 |
| | | resp.setCouponName("普通停车时长优惠"); |
| | | parameter.setTime(parkingLot.getNonChargeFreeDuration()); |
| | | data.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | parkingRecordClient.updateParkingRecord(data); |
| | | }else{ |
| | | resp.setCouponName("充电停车时长优惠"); |
| | | parameter.setTime(parkingLot.getChargeFreeDuration()); |
| | | data.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | data.setChargingOrderId(tChargingOrder.getId()); |
| | | data.setAppUserId(tChargingOrder.getAppUserId()); |
| | | parkingRecordClient.updateParkingRecord(data); |
| | | } |
| | | resp.setParameter(parameter); |
| | | return resp; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用优惠券 |
| | | * @param req |
| | | */ |
| | | public void usedCoupon(UsedCoupon req){ |
| | | TParkingRecord data = parkingRecordClient.getParkingRecordById(Long.valueOf(req.getRecordId())).getData(); |
| | | data.setSerialnumber(req.getSerialnumber()); |
| | | data.setFreeAmount(new BigDecimal(req.getActualFee())); |
| | | data.setOrderAmount(new BigDecimal(req.getFee())); |
| | | BigDecimal subtract = data.getOrderAmount().subtract(data.getFreeAmount()); |
| | | if(BigDecimal.ZERO.compareTo(subtract) < 0){ |
| | | data.setTimeoutAmount(subtract); |
| | | data.setOutParkingType(1); |
| | | data.setStatus(3); |
| | | }else{ |
| | | data.setTimeoutAmount(BigDecimal.ZERO); |
| | | data.setOutParkingType(2); |
| | | data.setStatus(2); |
| | | } |
| | | parkingRecordClient.updateParkingRecord(data); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.server; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.integration.barrierGate.model.CloudParkingOrder; |
| | | import com.ruoyi.integration.barrierGate.model.CloudParkingSpace; |
| | | import com.ruoyi.integration.barrierGate.model.OfflineParkingOrder; |
| | | import com.ruoyi.integration.barrierGate.model.OfflineParkingSpace; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | 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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 16:15 |
| | | */ |
| | | @Service |
| | | public class ParkingOrderService { |
| | | |
| | | @Resource |
| | | private ParkingRecordClient parkingRecordClient; |
| | | |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 云停车入场记录 |
| | | * @param order |
| | | */ |
| | | public void cloudParkingInOrder(CloudParkingOrder order) { |
| | | TParkingRecord parkingRecord = new TParkingRecord(); |
| | | parkingRecord.setLicensePlate(order.getPlate()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = "TC" + Math.random() * 1000 + sdf.format(new Date()); |
| | | parkingRecord.setCode(code); |
| | | parkingRecord.setVehicleColor(order.getPlateColor()); |
| | | TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | parkingRecord.setParkingLotId(data.getId()); |
| | | parkingRecord.setInParkingTime(LocalDateTime.parse(order.getEnterDateTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | parkingRecord.setStatus(1); |
| | | parkingRecord.setCreateTime(LocalDateTime.now()); |
| | | parkingRecord.setSerialnumber(order.getId()); |
| | | parkingRecordClient.addParkingRecord(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 云停车出场记录 |
| | | * @param order |
| | | */ |
| | | public void cloudParkingOutOrder(CloudParkingOrder order) { |
| | | GetParkingRecord query = new GetParkingRecord(); |
| | | query.setLicensePlate(order.getPlate()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | parkingRecord.setOutParkingTime(LocalDateTime.parse(order.getLeaveDateTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | parkingRecord.setParkingDuration(Integer.valueOf(order.getLongTime())); |
| | | parkingRecord.setOrderAmount(new BigDecimal(order.getReceivable())); |
| | | BigDecimal payment = new BigDecimal(order.getPayment()); |
| | | parkingRecord.setStatus(BigDecimal.ZERO.compareTo(payment) == 0 ? 2 : 3); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 云停车实时车位 |
| | | * @param parkingSpace |
| | | */ |
| | | public void cloudParkingSpace(CloudParkingSpace parkingSpace){ |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场入场记录 |
| | | * @param order |
| | | */ |
| | | public void offlineParkingInOrder(OfflineParkingOrder order) { |
| | | TParkingRecord parkingRecord = new TParkingRecord(); |
| | | parkingRecord.setLicensePlate(order.getPlatenumber()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = "TC" + Math.random() * 1000 + sdf.format(new Date()); |
| | | parkingRecord.setCode(code); |
| | | parkingRecord.setVehicleColor(order.getPlatecolor()); |
| | | TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | parkingRecord.setParkingLotId(data.getId()); |
| | | parkingRecord.setInParkingTime(LocalDateTime.parse(order.getEntertime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | parkingRecord.setStatus(1); |
| | | parkingRecord.setCreateTime(LocalDateTime.now()); |
| | | parkingRecord.setSerialnumber(order.getId()); |
| | | parkingRecordClient.addParkingRecord(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场出场记录 |
| | | * @param order |
| | | */ |
| | | public void offlineParkingOutOrder(OfflineParkingOrder order) { |
| | | GetParkingRecord query = new GetParkingRecord(); |
| | | query.setLicensePlate(order.getPlatenumber()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | parkingRecord.setOutParkingTime(LocalDateTime.parse(order.getLeavetime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | parkingRecord.setParkingDuration(Integer.valueOf(order.getLongTime())); |
| | | parkingRecord.setOrderAmount(new BigDecimal(order.getMoney())); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场实时车位 |
| | | * @param parkingSpace |
| | | */ |
| | | public void offlineParkingSpace(OfflineParkingSpace parkingSpace){ |
| | | |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.BmsAbortService; |
| | | import com.ruoyi.integration.rocket.model.BmsAbortMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | |
| | | @Autowired |
| | | private BmsAbortService bmsAbortService; |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | |
| | | @Override |
| | | protected void handleMessage(BmsAbortMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | |
| | | BeanUtils.copyProperties(message,bmsAbort); |
| | | bmsAbortService.create(bmsAbort); |
| | | // 业务处理 |
| | | chargingOrderClient.excelEndCharge(bmsAbort.getTransaction_serial_number()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.integration.rocket.model.EndChargeMessage; |
| | | import com.ruoyi.integration.rocket.model.PingMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | private MessageUtil messageUtil; |
| | | @Autowired |
| | | private IotMessageProduce iotMessageProduce; |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | |
| | | @Override |
| | | protected void handleMessage(EndChargeMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | |
| | | BeanUtils.copyProperties(message,endCharge); |
| | | endChargeService.create(endCharge); |
| | | // 业务处理 |
| | | chargingOrderClient.endCharge(endCharge.getTransaction_serial_number()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.integration.mongodb.service.MotorAbortService; |
| | | import com.ruoyi.integration.rocket.model.MotorAbortMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | |
| | | @Autowired |
| | | private MotorAbortService motorAbortService; |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | protected void handleMessage(MotorAbortMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | |
| | | BeanUtils.copyProperties(message,motorAbort); |
| | | motorAbortService.create(motorAbort); |
| | | // 业务处理 |
| | | chargingOrderClient.excelEndCharge(motorAbort.getTransaction_serial_number()); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.model.AccountingStrategyDetailOrder; |
| | | import com.ruoyi.order.service.AccountingStrategyDetailOrderService; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 16:17 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/accountingStrategyDetailOrder") |
| | | public class AccountingStrategyDetailOrderController { |
| | | |
| | | @Resource |
| | | private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService; |
| | | |
| | | |
| | | /** |
| | | * 根据订单id获取当前有效的策略 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getNowAccountingStrategyDetailOrder") |
| | | public R<AccountingStrategyDetailOrder> getNowAccountingStrategyDetailOrder(@RequestParam("orderId") Long orderId){ |
| | | AccountingStrategyDetailOrder one = accountingStrategyDetailOrderService.getOne(new LambdaQueryWrapper<AccountingStrategyDetailOrder>() |
| | | .eq(AccountingStrategyDetailOrder::getChargingOrderId, orderId) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(one); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("/callBack") |
| | | public class CallBackController { |
| | | |
| | | @Resource |
| | | private TVipOrderService tVipOrderService; |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/ali/all") |
| | | public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { |
| | | try { |
| | | String out_trade_no = aliQueryOrder.getOutTradeNo(); |
| | | String transaction_id = aliQueryOrder.getTradeNo(); |
| | | String attach = aliQueryOrder.getPassbackParams(); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | |
| | | break; |
| | | case "HY": |
| | | tVipOrderService.payBack(out_trade_no); |
| | | break; |
| | | } |
| | | |
| | | // AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | // if (ajaxResult.isSuccess()) { |
| | | // PrintWriter writer = response.getWriter(); |
| | | // writer.println("success"); |
| | | // writer.flush(); |
| | | // writer.close(); |
| | | // } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; |
| | | import com.alibaba.nacos.shaded.com.google.common.collect.Maps; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.ChargingBillListVO; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.dto.ChargingBillQuery; |
| | | import com.ruoyi.order.dto.ChargingListQuery; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.export.*; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | 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 org.springframework.beans.factory.annotation.Autowired; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class ChargingBillController { |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TOrderEvaluateService orderEvaluateService; |
| | | |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | @Resource |
| | | private TShoppingOrderService shoppingOrderService; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private TVipOrderService vipOrderService; |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | @Resource |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | | |
| | | @Resource |
| | | private TShoppingOrderRefundService shoppingOrderRefundService; |
| | | @Resource |
| | | private TVipOrderRefundService vipOrderRefundService; |
| | | private TChargingBillService chargingBillService; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | @Resource |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingList") |
| | | @ApiOperation(value = "充电算帐单列表查询", tags = {"管理后台-充电算账单"}) |
| | | public AjaxResult<ChargingBillVO> chargingList(@RequestBody ChargingListQuery dto) { |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | return AjaxResult.success(null); |
| | | |
| | | @PostMapping(value = "/chargingBillList") |
| | | @ApiOperation(value = "充电算帐单列表查询", tags = {"管理后台-充电算账单"}) |
| | | public AjaxResult<ChargingBillVO> chargingBillList(@RequestBody ChargingListQuery dto) { |
| | | ChargingBillVO res = chargingBillService.chargingBillList(dto); |
| | | return AjaxResult.success(res); |
| | | } |
| | | @PostMapping(value = "/chargingBillListR") |
| | | public R<ChargingBillVO> chargingBillListR(@RequestBody ChargingListQuery dto) { |
| | | ChargingBillVO res = chargingBillService.chargingBillList(dto); |
| | | return R.ok(res); |
| | | } |
| | | @GetMapping(value = "/chargingBillListExport") |
| | | public R<ChargingBillVO> chargingBillListExport(String uid) { |
| | | return R.ok(null); |
| | | } |
| | | @ApiOperation(value = "导出", tags = {"管理后台-充电算账单"}) |
| | | @PostMapping("/export") |
| | | public void export(@RequestBody ChargingListQuery dto) |
| | | { |
| | | ChargingBillVO res = chargingBillService.chargingBillList(dto); |
| | | List<ChargingBillListVO> list = res.getList().getRecords(); |
| | | List<TChargingBillExport> tChargingBillExports = new ArrayList<>(); |
| | | for (ChargingBillListVO orderInvoiceVO : list) { |
| | | TChargingBillExport tChargingBillExport = new TChargingBillExport(); |
| | | tChargingBillExport.setCode(orderInvoiceVO.getCode()); |
| | | tChargingBillExport.setBillType("月账单"); |
| | | tChargingBillExport.setType(orderInvoiceVO.getType().toString()); |
| | | tChargingBillExport.setBillWeek(orderInvoiceVO.getBillWeek()); |
| | | tChargingBillExport.setSiteName(orderInvoiceVO.getSiteName()); |
| | | tChargingBillExport.setPaymentAmount(orderInvoiceVO.getPaymentAmount()); |
| | | tChargingBillExport.setElectrovalence(orderInvoiceVO.getElectrovalence()); |
| | | tChargingBillExport.setServiceCharge(orderInvoiceVO.getServiceCharge()); |
| | | tChargingBillExport.setChargingCapacity(orderInvoiceVO.getChargingCapacity()); |
| | | Integer chargingSecond = orderInvoiceVO.getChargingSecond(); |
| | | // 根据秒数 转换为xx小时xx分钟xx秒 如果小时为0不展示 如果分钟为0则不展示 |
| | | // 计算小时、分钟和秒 |
| | | int hours = chargingSecond / 60 / 60; |
| | | int minutes = chargingSecond /60 % 60; |
| | | int seconds = 0; // 如果没有秒数,则默认是0 |
| | | // 构造结果字符串 |
| | | StringBuilder result = new StringBuilder(); |
| | | if (hours > 0) { |
| | | result.append(hours).append("小时"); |
| | | } |
| | | if (minutes > 0) { |
| | | result.append(minutes).append("分钟"); |
| | | } |
| | | if (seconds > 0 || result.length() == 0) { // 如果秒数大于0,或者小时和分钟都为0,则显示秒数 |
| | | result.append(seconds).append("秒"); |
| | | } |
| | | tChargingBillExport.setChargingTime(result.toString()); |
| | | tChargingBillExport.setOrderCount(orderInvoiceVO.getOrderCount()); |
| | | tChargingBillExport.setBillTime(orderInvoiceVO.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | tChargingBillExports.add(tChargingBillExport); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TChargingBillExport.class, tChargingBillExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("月账单-"+res.getCategory()+"-"+res.getBillWeek()+"-"+res.getSiteName()+".xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"}) |
| | | @GetMapping("/download") |
| | | public void download(String uid) |
| | | { |
| | | List<ChargingBillExport> chargingBillExports = new ArrayList<>(); |
| | | List<ChargingBillRefundExport> chargingBillRefundExports = new ArrayList<>(); |
| | | List<ChargingBillPayExport> chargingBillPayExports = new ArrayList<>(); |
| | | TChargingBill byId = chargingBillService.getById(uid); |
| | | ChargingBillExport chargingBillExport = new ChargingBillExport(); |
| | | chargingBillExport.setCode(byId.getCode()); |
| | | // todo 确认商户类型 |
| | | chargingBillExport.setAccountType("商户类型"); |
| | | chargingBillExport.setType(byId.getType().toString()); |
| | | chargingBillExport.setBillType("月结"); |
| | | LocalDateTime billTime = byId.getBillTime(); |
| | | // 将billTime 减去一个月 转化为yyyy-MM格式字符串 |
| | | billTime = billTime.minusMonths(1); |
| | | chargingBillExport.setBillWeek(DateUtils.parseDateToStr("yyyy-MM",DateUtils.toDate(billTime))); |
| | | |
| | | chargingBillExport.setBillTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(billTime))); |
| | | chargingBillExport.setState("未出账"); |
| | | List<Site> data = siteClient.getSiteByIds(Arrays.asList(byId.getSiteId())).getData(); |
| | | if (!data.isEmpty()){ |
| | | chargingBillExport.setSiteName(data.get(0).getName()); |
| | | } |
| | | // 根据账单的出账时间 查询上个月的充电订单 |
| | | LocalDateTime localDate = byId.getBillTime().minusMonths(1); |
| | | // 账单周期 |
| | | // 获取 LocalDate 对象 |
| | | LocalDate date = localDate.toLocalDate(); |
| | | // 获取该月份的第一天 |
| | | LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // 获取该月份的最后一天 |
| | | LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | | .between("create_time", firstDayOfMonth, lastDayOfMonth) |
| | | .eq("status", 5) |
| | | .eq("recharge_payment_status", 2); |
| | | if (byId.getType() == 2) { |
| | | eq.eq("site_id", byId.getSiteId()); |
| | | } |
| | | BigDecimal paymentAmount = new BigDecimal("0"); |
| | | BigDecimal refundAmount = new BigDecimal("0"); |
| | | BigDecimal income = new BigDecimal("0"); |
| | | |
| | | List<TChargingOrder> tChargingOrders = chargingOrderService.list(eq); |
| | | // 累加支付金额 |
| | | int i =1; |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | // 账单信息 |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); |
| | | if (tChargingOrder.getRefundStatus()!=null && tChargingOrder.getRefundStatus()==2){ |
| | | refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); |
| | | } |
| | | // 退款信息 |
| | | ChargingBillRefundExport chargingBillRefundExport = new ChargingBillRefundExport(); |
| | | ChargingBillPayExport chargingBillPayExport = new ChargingBillPayExport(); |
| | | |
| | | chargingBillRefundExport.setId(i+""); |
| | | switch (tChargingOrder.getRechargePaymentType()){ |
| | | case 1: |
| | | chargingBillRefundExport.setPlatform("微信"); |
| | | chargingBillRefundExport.setPlatformPay("微信小程序支付"); |
| | | chargingBillPayExport.setPlatform("微信"); |
| | | chargingBillPayExport.setPlatformPay("微信小程序支付"); |
| | | break; |
| | | case 2: |
| | | chargingBillRefundExport.setPlatform("支付宝"); |
| | | chargingBillRefundExport.setPlatformPay("支付宝小程序支付"); |
| | | chargingBillPayExport.setPlatform("支付宝"); |
| | | chargingBillPayExport.setPlatformPay("支付宝小程序支付"); |
| | | |
| | | } |
| | | chargingBillRefundExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); |
| | | chargingBillRefundExport.setCode(tChargingOrder.getCode()); |
| | | chargingBillRefundExport.setPayTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime()))); |
| | | if (tChargingOrder.getRefundTime()!=null){ |
| | | chargingBillRefundExport.setRefundTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getRefundTime()))); |
| | | } |
| | | chargingBillRefundExport.setRefundMoney(tChargingOrder.getRefundAmount().toString()); |
| | | chargingBillRefundExport.setRefundRemark(tChargingOrder.getRefundReason()); |
| | | chargingBillRefundExport.setRefundCode(tChargingOrder.getRefundCode()); |
| | | chargingBillRefundExport.setRefundSerialNumber(tChargingOrder.getRefundSerialNumber()); |
| | | chargingBillRefundExports.add(chargingBillRefundExport); |
| | | // 支付信息 |
| | | chargingBillPayExport.setId(i+""); |
| | | chargingBillPayExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); |
| | | chargingBillPayExport.setCode(tChargingOrder.getCode()); |
| | | chargingBillPayExport.setPayTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime()))); |
| | | chargingBillPayExport.setPaymentAmount(tChargingOrder.getPaymentAmount().toString()); |
| | | chargingBillPayExport.setTotal(""); |
| | | chargingBillPayExports.add(chargingBillPayExport); |
| | | i++; |
| | | } |
| | | chargingBillExport.setPaymentAmount(paymentAmount); |
| | | chargingBillExport.setRefundAmount(refundAmount); |
| | | chargingBillExport.setIncome(paymentAmount.subtract(refundAmount)); |
| | | chargingBillExports.add(chargingBillExport); |
| | | |
| | | // 导出 |
| | | List<Map<String, Object>> sheetsList = new ArrayList<>(); |
| | | AtomicInteger atomicInteger = new AtomicInteger(); |
| | | |
| | | for (int i1 = 0; i1 < 3; i1++) { |
| | | String sheetName=""; |
| | | switch (i1){ |
| | | case 1: |
| | | sheetName= "账单信息"; |
| | | Map<String, Object> exportMap = Maps.newHashMap(); |
| | | ExportParams exportParams = new ExportParams(null, sheetName, ExcelType.HSSF); |
| | | // 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集 |
| | | exportMap.put("title", exportParams); |
| | | exportMap.put("entity", ChargingBillExport.class); |
| | | exportMap.put("data", chargingBillExports); |
| | | // 加入多sheet配置列表 |
| | | sheetsList.add(exportMap); |
| | | break; |
| | | case 2: |
| | | sheetName= "退款订单"; |
| | | Map<String, Object> exportMap1 = Maps.newHashMap(); |
| | | ExportParams exportParams1 = new ExportParams(null, sheetName, ExcelType.HSSF); |
| | | // 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集 |
| | | exportMap1.put("title", exportParams1); |
| | | exportMap1.put("entity", ChargingBillRefundExport.class); |
| | | exportMap1.put("data", chargingBillRefundExports); |
| | | // 加入多sheet配置列表 |
| | | sheetsList.add(exportMap1); |
| | | break; |
| | | case 3: |
| | | sheetName= "支付记录"; |
| | | Map<String, Object> exportMap2 = Maps.newHashMap(); |
| | | ExportParams exportParams2 = new ExportParams(null, sheetName, ExcelType.HSSF); |
| | | // 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集 |
| | | exportMap2.put("title", exportParams2); |
| | | exportMap2.put("entity", ChargingBillPayExport.class); |
| | | exportMap2.put("data", chargingBillPayExports); |
| | | // 加入多sheet配置列表 |
| | | sheetsList.add(exportMap2); |
| | | break; |
| | | } |
| | | } |
| | | if (!chargingBillRefundExports.isEmpty()){ |
| | | ChargingBillRefundExport chargingBillRefundExport = chargingBillRefundExports.get(0); |
| | | chargingBillRefundExport.setTotal(refundAmount.toString()); |
| | | } |
| | | if (!chargingBillPayExports.isEmpty()){ |
| | | ChargingBillPayExport chargingBillPayExport = chargingBillPayExports.get(0); |
| | | chargingBillPayExport.setTotal(refundAmount.toString()); |
| | | } |
| | | String type=""; |
| | | String type1=""; |
| | | switch (byId.getType()){ |
| | | case 1: |
| | | type = "全站账单"; |
| | | type1 = "全站"; |
| | | break; |
| | | case 2: |
| | | type = "各个站点账单"; |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(byId.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | | type1 = data.get(0).getName(); |
| | | } |
| | | break; |
| | | } |
| | | String s = DateUtils.parseDateToStr("yyyy-MM", DateUtils.toDate(billTime)); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.HSSF); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("账户结算账单-月账单-"+type+"-"+s+"-"+type1+".xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.dto.ChargingListQuery; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderInfoVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.dto.GetMyChargingOrderList; |
| | | import com.ruoyi.order.dto.GetNoInvoicedOrder; |
| | |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund") |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"}) |
| | | @ApiOperation(value = "退款", tags = {"管理后台-支付订单-订单信息"}) |
| | | public R refund(@RequestBody PayOrderRefundDto payOrderQueryDto) { |
| | | return chargingOrderService.payRefund(payOrderQueryDto); |
| | | } |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund/list") |
| | | @ApiOperation(value = "充电信息", tags = {"管理后台-支付订单-退款订单"}) |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-退款订单"}) |
| | | public R<PageInfo<TChargingOrderRefund>> refundList(@RequestBody ChargingRefundDto chargingRefundDto) { |
| | | return chargingOrderService.getRefundList(chargingRefundDto); |
| | | |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund/list1") |
| | | @ApiOperation(value = "列表1", tags = {"管理后台-支付订单-退款订单"}) |
| | | public R<PageInfo<TChargingOrderRefund>> refundList1(@RequestBody ChargingRefundDto chargingRefundDto) { |
| | | return chargingOrderService.getRefundList(chargingRefundDto); |
| | | |
| | | } |
| | |
| | | .eq(TChargingOrder::getDelFlag, 0).eq(TChargingOrder::getStatus, 3)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/getMyChargingOrderList") |
| | |
| | | return resultList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 硬件充电结束后的处理逻辑 |
| | | * @param code |
| | | */ |
| | | @PostMapping("/endCharge") |
| | | public void endCharge(@RequestParam("code") String code){ |
| | | chargingOrderService.endCharge(code, 2); |
| | | } |
| | | |
| | | /** |
| | | * 硬件异常结束充电后的处理逻辑 |
| | | * @param code |
| | | */ |
| | | @PostMapping("/excelEndCharge") |
| | | public void excelEndCharge(@RequestParam("code") String code){ |
| | | chargingOrderService.excelEndCharge(code); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号和时间查询有效的充电数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/getChargingOrderByLicensePlate") |
| | | public R<TChargingOrder> getChargingOrderByLicensePlate(@RequestBody GetChargingOrderByLicensePlate query){ |
| | | TChargingOrder chargingOrder = chargingOrderService.getChargingOrderByLicensePlate(query); |
| | | return R.ok(chargingOrder); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | |
| | | } |
| | | @PostMapping("/addVipOrder") |
| | | @ApiOperation(value = "添加会员订单", tags = {"管理后台-会员订单"}) |
| | | public AjaxResult addVipOrder(@RequestBody TVipOrder dto) { |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder dto) { |
| | | vipOrderService.saveOrUpdate(dto); |
| | | return AjaxResult.success(); |
| | | return R.ok(dto.getId()); |
| | | } |
| | | @GetMapping("/deleteVipOrder") |
| | | @ApiOperation(value = "批量删除会员订单", tags = {"管理后台-会员订单"}) |
New file |
| | |
| | | package com.ruoyi.order.export; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "导出充电算帐单明细") |
| | | public class ChargingBillDetailExport implements Serializable { |
| | | @Excel(name = "序号",width = 30) |
| | | private String id; |
| | | @Excel(name = "订单编号",width = 30) |
| | | private String code; |
| | | @Excel(name = "电站名称",width = 30) |
| | | private String siteName; |
| | | @Excel(name = "终端名称",width = 30) |
| | | private String terminalName; |
| | | @Excel(name = "终端编号",width = 30) |
| | | private String terminalCode; |
| | | @Excel(name = "收款方式(直接修改成订单分类)",width = 30,replace = {"线上订单_1","线下订单_2"}) |
| | | private String type; |
| | | @Excel(name = "支付方式(预付/先充后付)",width = 30) |
| | | private String billType; |
| | | @Excel(name = "充电启动方式(对应订单类型)",width = 30) |
| | | private String billWeek; |
| | | @Excel(name = "订单创建时间(支付订单)",width = 30) |
| | | private String orderAmount; |
| | | @Excel(name = "充电开始时间(充电桩订单)",width = 30) |
| | | private BigDecimal discount; |
| | | @Excel(name = "充电结束时间(充电桩订单)",width = 30) |
| | | private BigDecimal discount1; |
| | | @Excel(name = "订单状态",width = 30,replace = {"未知_0","等待中_1","启动中_2","充电中_3","停止_4","已结束_5"}) |
| | | private BigDecimal d; |
| | | @Excel(name = "判定结束原因",width = 30) |
| | | private BigDecimal electrovalence1; |
| | | @Excel(name = "充电电费(元)",width = 30) |
| | | private BigDecimal electrovalence; |
| | | @Excel(name = "充电服务费(元)",width = 30) |
| | | private BigDecimal serviceCharge; |
| | | @Excel(name = "充电费用(元)",width = 30) |
| | | private BigDecimal serviceCharge1; |
| | | @Excel(name = "优惠券抵扣",width = 30) |
| | | private BigDecimal chargingCapacity; |
| | | @Excel(name = "充电电量(度)",width = 30) |
| | | private BigDecimal chargingCapacity1; |
| | | @Excel(name = "充电时长(从充电桩订单中获取)",width = 30) |
| | | private String chargingTime; |
| | | @Excel(name = "充电后soc",width = 30) |
| | | private Integer orderCount; |
| | | @Excel(name = "客户昵称",width = 30) |
| | | private Integer orderCount1; |
| | | @Excel(name = "手机号",width = 30) |
| | | private Integer orderCount2; |
| | | @Excel(name = "车牌号",width = 30) |
| | | private Integer orderCount3; |
| | | @Excel(name = "汽车类型",width = 30) |
| | | private Integer orderCount4; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.export; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "导出充电算帐单-导出") |
| | | public class ChargingBillExport implements Serializable { |
| | | |
| | | @Excel(name = "账单编号",width = 30) |
| | | private String code; |
| | | @Excel(name = "账户类型",width = 30) |
| | | private String accountType; |
| | | @Excel(name = "账单分类",width = 30,replace = {"全站账单_1","各个站点账单_2"}) |
| | | private String type; |
| | | @Excel(name = "账单类型",width = 30) |
| | | private String billType; |
| | | @Excel(name = "账单周期",width = 30 ) |
| | | private String billWeek; |
| | | @Excel(name = "账单生成日期",width = 30) |
| | | private String billTime; |
| | | @Excel(name = "状态",width = 30) |
| | | private String state; |
| | | @Excel(name = "站点名称",width = 30) |
| | | private String siteName; |
| | | @Excel(name = "支付金额",width = 30) |
| | | private BigDecimal paymentAmount; |
| | | @Excel(name = "退款金额",width = 30) |
| | | private BigDecimal refundAmount; |
| | | @Excel(name = "入账金额",width = 30) |
| | | private BigDecimal income; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.export; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "导出充电算帐单支付-导出") |
| | | public class ChargingBillPayExport implements Serializable { |
| | | @Excel(name = "序号",width = 30) |
| | | private String id; |
| | | @Excel(name = "支付平台",width = 30) |
| | | private String platform; |
| | | @Excel(name = "支付方式名称",width = 30) |
| | | private String platformPay; |
| | | @Excel(name = "支付平台流水号",width = 30) |
| | | private String rechargeSerialNumber; |
| | | @Excel(name = "平台订单号",width = 30) |
| | | private String code; |
| | | @Excel(name = "支付时间",width = 30) |
| | | private String payTime; |
| | | @Excel(name = "支付金额",width = 30) |
| | | private String paymentAmount; |
| | | @Excel(name = "合计",width = 30) |
| | | private String total; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.export; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "导出充电算帐单退款-导出") |
| | | public class ChargingBillRefundExport implements Serializable { |
| | | @Excel(name = "序号",width = 30) |
| | | private String id; |
| | | @Excel(name = "支付平台",width = 30) |
| | | private String platform; |
| | | @Excel(name = "支付方式名称",width = 30) |
| | | private String platformPay; |
| | | @Excel(name = "源(支付平台流水号)",width = 30) |
| | | private String rechargeSerialNumber; |
| | | @Excel(name = "源(平台支付订单号)",width = 30) |
| | | private String code; |
| | | @Excel(name = "支付时间",width = 30) |
| | | private String payTime; |
| | | @Excel(name = "退款时间",width = 30) |
| | | private String refundTime; |
| | | @Excel(name = "退款金额",width = 30) |
| | | private String refundMoney; |
| | | @Excel(name = "退款描述",width = 30) |
| | | private String refundRemark; |
| | | @Excel(name = "平台退款编号",width = 30) |
| | | private String refundCode; |
| | | @Excel(name = "支付平台退款流水号",width = 30) |
| | | private String refundSerialNumber; |
| | | @Excel(name = "合计",width = 30) |
| | | private String total; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.export; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "充电算帐单列表-导出") |
| | | public class TChargingBillExport implements Serializable { |
| | | |
| | | @Excel(name = "账单编号",width = 30) |
| | | private String code; |
| | | @Excel(name = "账单类型",width = 30) |
| | | private String billType; |
| | | @Excel(name = "账单分类",width = 30,replace = {"全站账单_1","各个站点账单_2"}) |
| | | private String type; |
| | | @Excel(name = "账单周期",width = 30 ) |
| | | private String billWeek; |
| | | @Excel(name = "站点名称",width = 30) |
| | | private String siteName; |
| | | @Excel(name = "总金额",width = 30) |
| | | private BigDecimal paymentAmount; |
| | | @Excel(name = "总电费",width = 30) |
| | | private BigDecimal electrovalence; |
| | | @Excel(name = "总服务费",width = 30) |
| | | private BigDecimal serviceCharge; |
| | | @Excel(name = "总电量",width = 30) |
| | | private BigDecimal chargingCapacity; |
| | | @Excel(name = "充电时长",width = 30) |
| | | private String chargingTime; |
| | | @Excel(name = "充电订单数量",width = 30) |
| | | private Integer orderCount; |
| | | @Excel(name = "账单生成日期",width = 30) |
| | | private String billTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.order.api.model.AccountingStrategyDetailOrder; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 15:42 |
| | | */ |
| | | public interface AccountingStrategyDetailOrderMapper extends BaseMapper<AccountingStrategyDetailOrder> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.order.api.model.AccountingStrategyOrder; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 15:37 |
| | | */ |
| | | public interface AccountingStrategyOrderMapper extends BaseMapper<AccountingStrategyOrder> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | import com.ruoyi.order.api.vo.ChargingBillListVO; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Mapper |
| | | public interface TChargingBillMapper extends BaseMapper<TChargingBill> { |
| | | |
| | | List<ChargingBillListVO> chargingBillList( |
| | | @Param("pageInfo") PageInfo<ChargingBillListVO> pageInfo, |
| | | @Param("req") ChargingListQuery dto, |
| | | @Param("startTime1")String startTime1, |
| | | @Param("startTime2")String startTime2); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderRefund; |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
New file |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.api.model.AccountingStrategyDetailOrder; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 15:41 |
| | | */ |
| | | public interface AccountingStrategyDetailOrderService extends IService<AccountingStrategyDetailOrder> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.api.model.AccountingStrategyOrder; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 15:36 |
| | | */ |
| | | public interface AccountingStrategyOrderService extends IService<AccountingStrategyOrder> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | public interface TChargingBillService extends IService<TChargingBill> { |
| | | |
| | | ChargingBillVO chargingBillList(ChargingListQuery dto); |
| | | |
| | | } |
| | |
| | | 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.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderRefund; |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | |
| | | * @param query |
| | | */ |
| | | void chargeMonitoring(UploadRealTimeMonitoringDataQuery query); |
| | | |
| | | |
| | | /** |
| | | * 自动结束充电后的处理逻辑 |
| | | * @param code |
| | | */ |
| | | void endCharge(String code, Integer endMode); |
| | | |
| | | |
| | | /** |
| | | * 异常结束充电处理逻辑 |
| | | * @param orderCode |
| | | */ |
| | | void excelEndCharge(String orderCode); |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号和开始时间查询充电数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | TChargingOrder getChargingOrderByLicensePlate(GetChargingOrderByLicensePlate query); |
| | | |
| | | } |
| | |
| | | List<SixVipDto> sixBefore(LocalDate sixBefore); |
| | | |
| | | BigDecimal getSumAmout(LocalDate sixBefore); |
| | | |
| | | void payBack(String outTradeNo); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.order.api.model.AccountingStrategyDetailOrder; |
| | | import com.ruoyi.order.mapper.AccountingStrategyDetailOrderMapper; |
| | | import com.ruoyi.order.service.AccountingStrategyDetailOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 15:42 |
| | | */ |
| | | @Service |
| | | public class AccountingStrategyDetailOrderServiceImpl extends ServiceImpl<AccountingStrategyDetailOrderMapper, AccountingStrategyDetailOrder> implements AccountingStrategyDetailOrderService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.order.api.model.AccountingStrategyOrder; |
| | | import com.ruoyi.order.mapper.AccountingStrategyOrderMapper; |
| | | import com.ruoyi.order.service.AccountingStrategyOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 15:36 |
| | | */ |
| | | @Service |
| | | public class AccountingStrategyOrderServiceImpl extends ServiceImpl<AccountingStrategyOrderMapper, AccountingStrategyOrder> implements AccountingStrategyOrderService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.vo.ChargingBillListVO; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.mapper.TChargingBillMapper; |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.service.TChargingBillService; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Service |
| | | public class TChargingBillServiceImpl extends ServiceImpl<TChargingBillMapper, TChargingBill> implements TChargingBillService { |
| | | |
| | | @Resource |
| | | private TChargingOrderMapper chargingOrderList; |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | @Override |
| | | public ChargingBillVO chargingBillList(ChargingListQuery dto) { |
| | | ChargingBillVO chargingBillVO = new ChargingBillVO(); |
| | | String startTime1 = null; |
| | | String startTime2 = null; |
| | | if (StringUtils.hasLength(dto.getStartTime())){ |
| | | String[] split = dto.getStartTime().split(" - "); |
| | | startTime1 = split[0]; |
| | | startTime2 = split[1]; |
| | | } |
| | | PageInfo<ChargingBillListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<ChargingBillListVO> list = this.baseMapper.chargingBillList(pageInfo,dto,startTime1,startTime2); |
| | | BigDecimal paymentAmountTotal = new BigDecimal("0"); |
| | | BigDecimal orderAmountTotal = new BigDecimal("0"); |
| | | BigDecimal electrovalenceTotal = new BigDecimal("0"); |
| | | BigDecimal serviceChargeTotal = new BigDecimal("0"); |
| | | BigDecimal commissionAmountTotal = new BigDecimal("0"); |
| | | BigDecimal sharingAmountTotal = new BigDecimal("0"); |
| | | BigDecimal chargingCapacityTotal = new BigDecimal("0"); |
| | | BigDecimal discountTotal = new BigDecimal("0"); |
| | | int orderCount = 0; |
| | | for (ChargingBillListVO chargingBillListVO : list) { |
| | | String temp = ""; |
| | | String temp1 = ""; |
| | | switch (chargingBillListVO.getType()){ |
| | | case 1: |
| | | temp = "全站账单"; |
| | | temp1 = "全站"; |
| | | break; |
| | | case 2: |
| | | temp = "各个站点账单"; |
| | | temp1 = siteClient.getSiteByIds(Arrays.asList(chargingBillListVO.getSiteId())).getData().get(0).getName(); |
| | | break; |
| | | } |
| | | chargingBillVO.setCategory(temp); |
| | | chargingBillVO.setSiteName(temp1); |
| | | |
| | | chargingBillVO.setType("月账单"); |
| | | chargingBillVO.setCode(chargingBillListVO.getCode()); |
| | | |
| | | LocalDateTime billTime = chargingBillListVO.getBillTime(); |
| | | // 将其转化为yyyy-MM格式字符串 |
| | | chargingBillVO.setCreateTime(billTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | // 将billTime减去一个月 转化为yyyy-MM格式字符串 |
| | | chargingBillVO.setBillWeek(billTime.minusMonths(1).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM"))); |
| | | |
| | | chargingBillListVO.setUid(chargingBillListVO.getId().toString()); |
| | | // 根据账单的出账时间 查询上个月的充电订单 |
| | | LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1); |
| | | // 账单周期 |
| | | chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM"))); |
| | | // 获取 LocalDate 对象 |
| | | LocalDate date = localDate.toLocalDate(); |
| | | // 获取该月份的第一天 |
| | | LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // 获取该月份的最后一天 |
| | | LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | | .between("create_time", firstDayOfMonth, lastDayOfMonth) |
| | | .eq("status", 5) |
| | | .eq("recharge_payment_status", 2); |
| | | if (chargingBillListVO.getType() == 2) { |
| | | eq.eq("site_id", chargingBillListVO.getSiteId()); |
| | | } |
| | | List<TChargingOrder> tChargingOrders = chargingOrderList.selectList(eq); |
| | | int chargingSecond = 0; |
| | | BigDecimal paymentAmount = new BigDecimal("0"); |
| | | BigDecimal orderAmount = new BigDecimal("0"); |
| | | BigDecimal electrovalence = new BigDecimal("0"); |
| | | BigDecimal serviceCharge = new BigDecimal("0"); |
| | | BigDecimal commissionAmount = new BigDecimal("0"); |
| | | BigDecimal sharingAmount = new BigDecimal("0"); |
| | | BigDecimal chargingCapacity = new BigDecimal("0"); |
| | | orderCount+=tChargingOrders.size(); |
| | | chargingBillVO.setCategory(""); |
| | | chargingBillVO.setExportList(tChargingOrders); |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | List<Site> data = siteClient.getSiteByIds(Arrays.asList(tChargingOrder.getSiteId())).getData(); |
| | | if (!data.isEmpty()){ |
| | | chargingBillVO.setSiteName(data.get(0).getName()); |
| | | } |
| | | TChargingPile data1 = chargingPileClient.getChargingPileById(tChargingOrder.getChargingPileId()).getData(); |
| | | TChargingGun data2 = chargingGunClient.getChargingGunById(tChargingOrder.getChargingGunId()).getData(); |
| | | if (data1!=null && data2!=null){ |
| | | tChargingOrder.setTerminalName(data1.getName()+data2.getName()); |
| | | tChargingOrder.setTerminalCode(data2.getCode()); |
| | | } |
| | | tChargingOrder.setOrderClassification1("线上订单"); |
| | | tChargingOrder.setRechargePaymentType1("预付"); |
| | | tChargingOrder.setChargingType("充电桩接口充电服务"); |
| | | switch (tChargingOrder.getStatus()){ |
| | | case 1: |
| | | tChargingOrder.setStatus1("等待中"); |
| | | break; |
| | | case 2: |
| | | tChargingOrder.setStatus1("启动中"); |
| | | break; |
| | | case 3: |
| | | tChargingOrder.setStatus1("充电中"); |
| | | break; |
| | | case 4: |
| | | tChargingOrder.setStatus1("停止中"); |
| | | break; |
| | | case 5: |
| | | tChargingOrder.setStatus1("已结束"); |
| | | break; |
| | | case 0: |
| | | tChargingOrder.setStatus1("未知"); |
| | | break; |
| | | } |
| | | if (tChargingOrder.getEndMode()!=null){ |
| | | switch (tChargingOrder.getEndMode()){ |
| | | case 1: |
| | | tChargingOrder.setEndMode1("主动终止"); |
| | | break; |
| | | case 2: |
| | | tChargingOrder.setEndMode1("满电终止"); |
| | | break; |
| | | case 3: |
| | | tChargingOrder.setEndMode1("费用不足终止"); |
| | | break; |
| | | case 0: |
| | | tChargingOrder.setEndMode1("异常终止"); |
| | | break; |
| | | } |
| | | } |
| | | BigDecimal add = tChargingOrder.getElectrovalence().add(tChargingOrder.getServiceCharge()); |
| | | tChargingOrder.setTotalAmount(add.toString()); |
| | | tChargingOrder.setDiscount(tChargingOrder.getCouponDiscountAmount().toString()); |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(tChargingOrder.getCode()).getData(); |
| | | if (data5!=null){ |
| | | if (data5.getTime_remaining()!=null){ |
| | | chargingSecond+=data5.getTime_remaining()*60; |
| | | } |
| | | } |
| | | Integer cumulativeChargingTime = data5.getCumulative_charging_time(); |
| | | // 将其转化为xx小时xx分钟xx秒显示 如果是0小时则不展示小时 如果是0分钟则不展示分钟 |
| | | if (cumulativeChargingTime!=null){ |
| | | // 计算小时、分钟和秒 |
| | | int hours = cumulativeChargingTime / 60; |
| | | int minutes = cumulativeChargingTime % 60; |
| | | int seconds = 0; // 如果没有秒数,则默认是0 |
| | | StringBuilder result = new StringBuilder(); |
| | | if (hours > 0) { |
| | | result.append(hours).append("小时"); |
| | | } |
| | | if (minutes > 0) { |
| | | result.append(minutes).append("分钟"); |
| | | } |
| | | if (seconds > 0 || result.length() == 0) { // 如果秒数大于0,或者小时和分钟都为0,则显示秒数 |
| | | result.append(seconds).append("秒"); |
| | | } |
| | | tChargingOrder.setChargingTime(result.toString()); |
| | | } |
| | | tChargingOrder.setEndSoc(data5.getSoc().toString()); |
| | | TAppUser data3 = appUserClient.getUserById(tChargingOrder.getAppUserId()).getData(); |
| | | if (tChargingOrder.getAppUserCarId()!=null){ |
| | | List<TAppUserCar> data4 = appUserCarClient.getCarByIds(Arrays.asList(tChargingOrder.getAppUserCarId())).getData(); |
| | | if (!data4.isEmpty()){ |
| | | tChargingOrder.setLicensePlate(data4.get(0).getLicensePlate()); |
| | | tChargingOrder.setVehicleModel(data4.get(0).getVehicleModel()); |
| | | } |
| | | } |
| | | if (data3!=null)tChargingOrder.setUserName(data3.getName()); |
| | | // 累加实收金额 支付金额减去退款金额 |
| | | if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){ |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()).subtract(tChargingOrder.getRefundAmount()); |
| | | paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()).subtract(tChargingOrder.getRefundAmount()); |
| | | |
| | | }else if (tChargingOrder.getPaymentAmount()!=null){ |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); |
| | | paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); |
| | | } |
| | | // 累加订单金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | orderAmount = orderAmount.add(tChargingOrder.getOrderAmount()); |
| | | orderAmountTotal = orderAmountTotal.add(tChargingOrder.getOrderAmount()); |
| | | } |
| | | // 累加累计电费 |
| | | if (tChargingOrder.getElectrovalence()!=null){ |
| | | electrovalence = electrovalence.add(tChargingOrder.getElectrovalence()); |
| | | electrovalenceTotal = electrovalenceTotal.add(tChargingOrder.getElectrovalence()); |
| | | } |
| | | // 累加累计服务费 |
| | | if (tChargingOrder.getServiceCharge()!=null){ |
| | | serviceCharge = serviceCharge.add(tChargingOrder.getServiceCharge()); |
| | | serviceChargeTotal = serviceChargeTotal.add(tChargingOrder.getServiceCharge()); |
| | | } |
| | | // 累加平台手续费 |
| | | if (tChargingOrder.getCommissionAmount()!=null){ |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getCommissionAmount()); |
| | | commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getCommissionAmount()); |
| | | } |
| | | // 累加平台分佣 |
| | | if (tChargingOrder.getSharingAmount()!=null){ |
| | | sharingAmount = sharingAmount.add(tChargingOrder.getSharingAmount()); |
| | | sharingAmountTotal = sharingAmountTotal.add(tChargingOrder.getSharingAmount()); |
| | | } |
| | | // 累加充电度数 |
| | | if (tChargingOrder.getChargingCapacity()!=null){ |
| | | chargingCapacity = chargingCapacity.add(tChargingOrder.getChargingCapacity()); |
| | | chargingCapacityTotal = chargingCapacityTotal.add(tChargingOrder.getChargingCapacity()); |
| | | } |
| | | // 累加优惠金额 |
| | | if (tChargingOrder.getCouponDiscountAmount()!=null){ |
| | | discountTotal = discountTotal.add(tChargingOrder.getCouponDiscountAmount()); |
| | | } |
| | | if (tChargingOrder.getVipDiscountAmount()!=null){ |
| | | discountTotal = discountTotal.add(tChargingOrder.getVipDiscountAmount()); |
| | | } |
| | | } |
| | | // 将chargingSecond 这是以秒为单位存放的总秒数 将其转化为xx小时xx分钟xx秒 |
| | | int hours = chargingSecond / 3600; |
| | | int minutes = (chargingSecond % 3600) / 60; |
| | | int seconds = chargingSecond % 60; |
| | | // 格式化为字符串 |
| | | String timeString = String.format("%d小时%d分钟%d秒", hours, minutes, seconds); |
| | | chargingBillVO.setChargingTime(timeString); |
| | | |
| | | chargingBillListVO.setPaymentAmount(paymentAmount); |
| | | chargingBillListVO.setOrderAmount(orderAmount); |
| | | chargingBillListVO.setElectrovalence(electrovalence); |
| | | chargingBillListVO.setServiceCharge(serviceCharge); |
| | | chargingBillListVO.setCommissionAmount(commissionAmount); |
| | | chargingBillListVO.setSharingAmount(sharingAmount); |
| | | chargingBillListVO.setChargingCapacity(chargingCapacity); |
| | | switch (chargingBillListVO.getType()){ |
| | | case 1: |
| | | chargingBillListVO.setSiteName("全站"); |
| | | break; |
| | | case 2: |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(chargingBillListVO.getSiteId())).getData().get(0); |
| | | if (site!=null){ |
| | | chargingBillListVO.setSiteName(site.getName()); |
| | | } |
| | | break; |
| | | } |
| | | // 订单数 |
| | | chargingBillListVO.setOrderCount(tChargingOrders.size()); |
| | | // 充电时间秒 |
| | | chargingBillListVO.setChargingSecond(chargingSecond); |
| | | } |
| | | chargingBillVO.setChargingCapacity(chargingCapacityTotal); |
| | | chargingBillVO.setPaymentAmount(paymentAmountTotal); |
| | | chargingBillVO.setOrderAmount(orderAmountTotal); |
| | | chargingBillVO.setElectrovalence(electrovalenceTotal); |
| | | chargingBillVO.setServiceCharge(serviceChargeTotal); |
| | | chargingBillVO.setOrderCount(orderCount); |
| | | chargingBillVO.setCommissionAmount(commissionAmountTotal); |
| | | chargingBillVO.setSharingAmount(sharingAmountTotal); |
| | | chargingBillVO.setDiscount(discountTotal); |
| | | |
| | | |
| | | pageInfo.setRecords(list); |
| | | chargingBillVO.setList(pageInfo); |
| | | return chargingBillVO; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 将时间转化为字符串 只保留年月日 格式为yyyy-MM-dd |
| | | String format = now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | 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.AppCouponClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserVipDetailClient; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.api.feignClient.*; |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.account.api.vo.GetAppUserVipDetail; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.account.api.vo.GetInviteUser; |
| | | 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.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | 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.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient; |
| | | import com.ruoyi.integration.api.feignClient.PlatformStartChargingReplyClient; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | |
| | | import com.ruoyi.integration.api.feignClient.*; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | import com.ruoyi.order.api.feignClient.AccountingStrategyDetailOrderClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderListVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.api.vo.*; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; |
| | | import com.ruoyi.order.service.TChargingOrderRefundService; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.vo.*; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | */ |
| | | @Service |
| | | public class TChargingOrderServiceImpl extends ServiceImpl<TChargingOrderMapper, TChargingOrder> implements TChargingOrderService { |
| | | |
| | | private Logger log = LoggerFactory.getLogger(TChargingOrderServiceImpl.class); |
| | | |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | |
| | | private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | |
| | | @Resource |
| | | private AccountingStrategyDetailOrderClient accountingStrategyDetailOrderClient; |
| | | |
| | | @Resource |
| | | private AccountingStrategyClient accountingStrategyClient; |
| | | |
| | | @Resource |
| | | private PlatformStartChargingReplyClient platformStartChargingReplyClient; |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private PlatformStopChargingReplyClient platformStopChargingReplyClient; |
| | | |
| | | @Resource |
| | | private AccountingStrategyOrderService accountingStrategyOrderService; |
| | | |
| | | @Resource |
| | | private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService; |
| | | |
| | | @Resource |
| | | private InviteUserClient inviteUserClient; |
| | | |
| | | @Resource |
| | | private AppUserIntegralChangeClient appUserIntegralChangeClient; |
| | | |
| | | @Resource |
| | | private IntegralRuleClient integralRuleClient; |
| | | |
| | | //计数器 |
| | | private Map<String, Integer> counter_map = new HashMap<>(); |
| | |
| | | |
| | | } |
| | | this.save(chargingOrder); |
| | | |
| | | //添加订单的计费策略 |
| | | TAccountingStrategy accountingStrategy = accountingStrategyClient.getAccountingStrategyById(tChargingGun.getAccountingStrategyId()).getData(); |
| | | List<TAccountingStrategyDetail> strategyDetailList = accountingStrategyDetailClient.getListByAccountingStrategyId(tChargingGun.getAccountingStrategyId()).getData(); |
| | | AccountingStrategyOrder accountingStrategyOrder = new AccountingStrategyOrder(); |
| | | BeanUtils.copyProperties(accountingStrategy, accountingStrategyOrder); |
| | | accountingStrategyOrder.setChargingOrderId(chargingOrder.getId()); |
| | | accountingStrategyOrderService.save(accountingStrategyOrder); |
| | | List<AccountingStrategyDetailOrder> list1 = new ArrayList<>(); |
| | | for (TAccountingStrategyDetail tAccountingStrategyDetail : strategyDetailList) { |
| | | AccountingStrategyDetailOrder accountingStrategyDetailOrder = new AccountingStrategyDetailOrder(); |
| | | BeanUtils.copyProperties(tAccountingStrategyDetail, accountingStrategyDetailOrder); |
| | | accountingStrategyDetailOrder.setChargingOrderId(chargingOrder.getId()); |
| | | list1.add(accountingStrategyDetailOrder); |
| | | } |
| | | accountingStrategyDetailOrderService.saveBatch(list1); |
| | | |
| | | //会员优惠折扣将其计入增加充电时长(增加总充电金额) |
| | | //如果充电总金额未使用完,则需要退回费用=(原金额/总金额)*(总金额-实际充电金额) |
| | | if(1 == addChargingOrder.getPaymentType()){ |
| | |
| | | BigDecimal rechargeAmount = chargingOrder.getRechargeAmount(); |
| | | //计算充电金额,会员需要将折扣金额加入到充电总金额中 |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | TAccountingStrategyDetail strategyDetail = accountingStrategyDetailClient.getNowData(chargingGun.getAccountingStrategyId()).getData(); |
| | | AccountingStrategyDetailOrder strategyDetail = accountingStrategyDetailOrderClient.getNowAccountingStrategyDetailOrder(chargingOrder.getId()).getData(); |
| | | //总单价 |
| | | BigDecimal totalUnitPrice = strategyDetail.getServiceCharge().add(strategyDetail.getElectrovalence()); |
| | | //计算能充电的度数 |
| | |
| | | preChargeCheck1.setFailureCause(failure_cause); |
| | | //启动失败后取消订单,退款操作 |
| | | refund(code); |
| | | order.setStatus(5); |
| | | order.setStatus(-1); |
| | | order.setEndMode(0); |
| | | }else{ |
| | | preChargeCheck1.setStartupSuccess(2); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public AjaxResult stopCharging(String id) { |
| | | TChargingOrder chargingOrder = this.getById(id); |
| | | Integer status = chargingOrder.getStatus(); |
| | |
| | | chargingOrder.setStatus(4); |
| | | chargingOrder.setEndMode(1); |
| | | this.updateById(chargingOrder); |
| | | |
| | | //异步线程处理停机 |
| | | ExecutorService cachedThreadPool = Executors.newFixedThreadPool(1); |
| | | cachedThreadPool.execute(()->{ |
| | | //调用硬件停止充电,停止成功后开始计算费用退款 |
| | | TChargingPile chargingPile = chargingPileClient.getChargingPileById(chargingOrder.getChargingPileId()).getData(); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | |
| | | failure_cause = "其他"; |
| | | break; |
| | | } |
| | | log.error("停机失败:订单号:{},失败原因:{}", chargingOrder.getCode(), failure_cause); |
| | | throw new RuntimeException(failure_cause); |
| | | } |
| | | |
| | |
| | | endCharge(chargingOrder); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | |
| | | //处理推荐奖励(被推荐首单奖励) |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | long count = this.count(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, chargingOrder.getAppUserId()) |
| | | .eq(TChargingOrder::getStatus, 5).isNull(TChargingOrder::getEndMode).eq(TChargingOrder::getDelFlag, 0)); |
| | | if(null != appUser.getInviteUserId() && 1 == count){ |
| | | TIntegralRule integralRule = integralRuleClient.getSet().getData(); |
| | | String inviteUsersToEarnPoints = integralRule.getInviteUsersToEarnPoints(); |
| | | JSONObject jsonObject = JSON.parseObject(inviteUsersToEarnPoints); |
| | | Integer num1 = jsonObject.getInteger("num1"); |
| | | GetInviteUser query = new GetInviteUser(); |
| | | query.setAppUserId(appUser.getInviteUserId()); |
| | | query.setBeInvitedAppUserId(chargingOrder.getAppUserId()); |
| | | TInviteUser inviteUser = inviteUserClient.getInviteUser(query).getData(); |
| | | if(null == inviteUser){ |
| | | inviteUser = new TInviteUser(); |
| | | inviteUser.setAppUserId(appUser.getInviteUserId()); |
| | | inviteUser.setBeInvitedAppUserId(chargingOrder.getAppUserId()); |
| | | inviteUser.setAward(num1); |
| | | inviteUser.setCreateTime(LocalDateTime.now()); |
| | | inviteUserClient.saveInviteUser(inviteUser); |
| | | }else{ |
| | | inviteUser.setAward(num1); |
| | | inviteUserClient.updateInviteUser(inviteUser); |
| | | } |
| | | TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChange.setAppUserId(appUser.getInviteUserId()); |
| | | appUserIntegralChange.setChangeType(5); |
| | | appUserIntegralChange.setHistoricalIntegral(appUser1.getPoints()); |
| | | appUserIntegralChange.setCurrentIntegral(appUser1.getPoints() + num1); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | |
| | | appUser1.setPoints(appUser1.getPoints() + num1); |
| | | appUserClient.updateAppUser(appUser1); |
| | | } |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | chargingOrder.setOrderAmount(total); |
| | | } |
| | | |
| | | if(chargingOrder.getEndMode() == 2){ |
| | | chargingOrder.setEndMode(refundAmount.compareTo(BigDecimal.ZERO) > 0 ? 2 : 3); |
| | | } |
| | | chargingOrder.setStatus(5); |
| | | chargingOrder.setPaymentAmount(payAmount); |
| | | this.updateById(chargingOrder); |
| | | |
| | | //计算优惠券 |
| | | if(null != chargingOrder.getAppCouponId()){ |
| | | //判断实际充电金额是否满足优惠券使用条件,如果不满足则不适用优惠券。 |
| | | TAppCoupon appCoupon = appCouponClient.getAppCouponById(chargingOrder.getAppCouponId()).getData(); |
| | |
| | | chargingOrder.setVipDiscountAmount(subtract); |
| | | payAmount = payAmount.subtract(subtract); |
| | | } |
| | | chargingOrder.setPaymentAmount(payAmount); |
| | | this.updateById(chargingOrder); |
| | | |
| | | //开始构建退款费用 |
| | | if(refundAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | Integer rechargePaymentType = chargingOrder.getRechargePaymentType(); |
| | |
| | | return chargingOrderTimeVO; |
| | | } |
| | | |
| | | @Override |
| | | public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | return null; |
| | | } |
| | | // @Override |
| | | // public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | // return null; |
| | | // } |
| | | |
| | | @Override |
| | | public ChargingOrderListInfoVO chargingInfo(String uid) { |
| | |
| | | return chargingOrderListInfoVO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理充电订单实时监控数据相关的业务逻辑 |
| | | * @param query |
| | |
| | | if(com.ruoyi.common.core.utils.StringUtils.isNotEmpty(query.getCharging_gun_code())){ |
| | | //获取当前的计费策略 |
| | | TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, query.getCharging_gun_code())); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | TAccountingStrategyDetail strategyDetail = accountingStrategyDetailClient.getNowData(chargingGun.getAccountingStrategyId()).getData(); |
| | | AccountingStrategyDetailOrder strategyDetail = accountingStrategyDetailOrderClient.getNowAccountingStrategyDetailOrder(chargingOrder.getId()).getData(); |
| | | TChargingOrderAccountingStrategy chargingOrderAccountingStrategy = chargingOrderAccountingStrategyService.getOne(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>() |
| | | .eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId()).orderByDesc(TChargingOrderAccountingStrategy::getCreateTime).last(" limit 0, 1")); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| | |
| | | this.updateById(chargingOrder); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 自动结束充电后的处理逻辑 |
| | | * @param orderCode |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public void endCharge(String orderCode, Integer endMode) { |
| | | TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, orderCode)); |
| | | Integer status = chargingOrder.getStatus(); |
| | | if(status == 4 || status == 5){ |
| | | return; |
| | | } |
| | | chargingOrder.setStatus(5); |
| | | chargingOrder.setEndMode(endMode); |
| | | this.updateById(chargingOrder); |
| | | |
| | | //计算费用,处理退款 |
| | | endCharge(chargingOrder); |
| | | |
| | | //处理推荐奖励(被推荐首单奖励) |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | long count = this.count(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, chargingOrder.getAppUserId()) |
| | | .eq(TChargingOrder::getStatus, 5).isNull(TChargingOrder::getEndMode).eq(TChargingOrder::getDelFlag, 0)); |
| | | if(null != appUser.getInviteUserId() && 1 == count){ |
| | | TIntegralRule integralRule = integralRuleClient.getSet().getData(); |
| | | String inviteUsersToEarnPoints = integralRule.getInviteUsersToEarnPoints(); |
| | | JSONObject jsonObject = JSON.parseObject(inviteUsersToEarnPoints); |
| | | Integer num1 = jsonObject.getInteger("num1"); |
| | | GetInviteUser query = new GetInviteUser(); |
| | | query.setAppUserId(appUser.getInviteUserId()); |
| | | query.setBeInvitedAppUserId(chargingOrder.getAppUserId()); |
| | | TInviteUser inviteUser = inviteUserClient.getInviteUser(query).getData(); |
| | | if(null == inviteUser){ |
| | | inviteUser = new TInviteUser(); |
| | | inviteUser.setAppUserId(appUser.getInviteUserId()); |
| | | inviteUser.setBeInvitedAppUserId(chargingOrder.getAppUserId()); |
| | | inviteUser.setAward(num1); |
| | | inviteUser.setCreateTime(LocalDateTime.now()); |
| | | inviteUserClient.saveInviteUser(inviteUser); |
| | | }else{ |
| | | inviteUser.setAward(num1); |
| | | inviteUserClient.updateInviteUser(inviteUser); |
| | | } |
| | | TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChange.setAppUserId(appUser.getInviteUserId()); |
| | | appUserIntegralChange.setChangeType(5); |
| | | appUserIntegralChange.setHistoricalIntegral(appUser1.getPoints()); |
| | | appUserIntegralChange.setCurrentIntegral(appUser1.getPoints() + num1); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | |
| | | appUser1.setPoints(appUser1.getPoints() + num1); |
| | | appUserClient.updateAppUser(appUser1); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 异常结束充电处理逻辑 |
| | | * @param orderCode |
| | | */ |
| | | @Override |
| | | public void excelEndCharge(String orderCode) { |
| | | endCharge(orderCode, 0); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | if (payOrderQueryDto.getType()==1){ |
| | | TChargingOrder tChargingOrder = this.baseMapper.selectById(payOrderQueryDto.getOrderId()); |
| | | TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); |
| | | chargingOrderRefund.setChargingOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | | chargingOrderRefund.setRefundStatus(1); |
| | | chargingOrderRefund.setPayType(tChargingOrder.getRechargePaymentType()); |
| | | chargingOrderRefund.setRefundTime(LocalDateTime.now()); |
| | | chargingOrderRefund.setCode(tChargingOrder.getCode()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000)); |
| | | chargingOrderRefund.setRefundTitle("后台退款"); |
| | | chargingOrderRefund.setRefundContent("后台退款"); |
| | | chargingOrderRefund.setRefundReason("后台退款"); |
| | | chargingOrderRefund.setRefundRemark("后台退款"); |
| | | chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); |
| | | chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); |
| | | |
| | | if(1 == tChargingOrder.getRechargePaymentType()){ |
| | | WxPaymentRefundModel model = new WxPaymentRefundModel(); |
| | | model.setOut_trade_no(tChargingOrder.getCode()); |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setTransaction_id(tChargingOrder.getRechargeSerialNumber()); |
| | | model.setReason("取消订单"); |
| | | model.setNotify_url("http://127.0.0.1:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setCurrency("CNY"); |
| | | model.setAmount(amount); |
| | | R<String> orderR = wxPaymentClient.refundOrderR(model); |
| | | if(200 == orderR.getCode()){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | | } |
| | | |
| | | if(2 == tChargingOrder.getRechargePaymentType()){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(tChargingOrder.getCode()); |
| | | dto.setOutRequestNo(tChargingOrder.getCode()); |
| | | dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号和开始时间查询充电数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public TChargingOrder getChargingOrderByLicensePlate(GetChargingOrderByLicensePlate query) { |
| | | TAppUserCar appUserCar = appUserCarClient.getAppUserCarByLicensePlate(query.getLicensePlate()).getData(); |
| | | if(null == appUserCar){ |
| | | return null; |
| | | } |
| | | TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserCarId, appUserCar.getId()) |
| | | .eq(TChargingOrder::getDelFlag, 0).gt(TChargingOrder::getStartTime, query.getStartTime()) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).ne(TChargingOrder::getStatus, -1)); |
| | | return one; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import com.ruoyi.order.api.model.TOrderInvoiceDetail; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.mapper.TOrderInvoiceMapper; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TOrderInvoiceDetailService; |
| | | import com.ruoyi.order.service.TOrderInvoiceService; |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | //获取开票类型 |
| | | TInvoiceType invoiceType = invoiceTypeClient.getInvoiceType(addOrderInvoice.getInvoiceTypeId()).getData(); |
| | | for (Long orderId : orderIds) { |
| | | List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.list(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>() |
| | | .eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId)); |
| | | BigDecimal electrovalence = list.stream().map(TChargingOrderAccountingStrategy::getElectrovalence).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal serviceCharge = list.stream().map(TChargingOrderAccountingStrategy::getServiceCharge).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | TOrderInvoiceDetail orderInvoiceDetail = new TOrderInvoiceDetail(); |
| | | orderInvoiceDetail.setOrderInvoiceId(addOrderInvoice.getId()); |
| | | orderInvoiceDetail.setInvoiceAmount(map.get(orderId)); |
| | |
| | | orderInvoiceDetail.setElectricityTariff(invoiceType.getElectricityTariff()); |
| | | orderInvoiceDetail.setServiceTariff(invoiceType.getServiceTariff()); |
| | | orderInvoiceDetail.setAddedServiceTariff(invoiceType.getAddedServiceTariff()); |
| | | orderInvoiceDetail.setElectrovalence(electrovalence); |
| | | orderInvoiceDetail.setServiceCharge(serviceCharge); |
| | | orderInvoiceDetail.setAddedService(serviceCharge.multiply(invoiceType.getAddedServiceTariff().divide(new BigDecimal(100)))); |
| | | orderInvoiceDetailService.save(orderInvoiceDetail); |
| | | } |
| | | return AjaxResult.success(); |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | |
| | | public BigDecimal getSumAmout(LocalDate sixBefore) { |
| | | return this.baseMapper.getSumAmout(sixBefore); |
| | | } |
| | | |
| | | @Override |
| | | public void payBack(String outTradeNo) { |
| | | //将vip订单改为已完成 |
| | | TVipOrder tVipOrder = this.baseMapper.selectOne(Wrappers.lambdaQuery(TVipOrder.class).eq(TVipOrder::getCode, outTradeNo)); |
| | | tVipOrder.setPaymentStatus(2); |
| | | this.baseMapper.updateById(tVipOrder); |
| | | //赠送会员 |
| | | GiveVipDto giveVipDto = new GiveVipDto(); |
| | | giveVipDto.setUserIds(tVipOrder.getAppUserId().toString()); |
| | | giveVipDto.setVipId(tVipOrder.getVipId()); |
| | | giveVipDto.setType(tVipOrder.getVipType()); |
| | | // vipClient.giveVip(giveVipDto); |
| | | } |
| | | } |
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.order.mapper.AccountingStrategyDetailOrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.order.api.model.AccountingStrategyDetailOrder"> |
| | | <id column="id" property="id" /> |
| | | <result column="accounting_strategy_id" property="accountingStrategyId" /> |
| | | <result column="`type`" property="type" /> |
| | | <result column="start_time" property="startTime" /> |
| | | <result column="end_time" property="endTime" /> |
| | | <result column="electrovalence" property="electrovalence" /> |
| | | <result column="service_charge" property="serviceCharge" /> |
| | | <result column="cost_service_charge" property="costServiceCharge" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
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.order.mapper.AccountingStrategyOrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.order.api.model.AccountingStrategyOrder"> |
| | | <id column="id" property="id" /> |
| | | <result column="site_id" property="siteId" /> |
| | | <result column="`name`" property="name" /> |
| | | <result column="description" property="description" /> |
| | | <result column="discount" property="discount" /> |
| | | <result column="first_user_id" property="firstUserId" /> |
| | | <result column="two_user_id" property="twoUserId" /> |
| | | <result column="first_remark" property="firstRemark" /> |
| | | <result column="two_remark" property="twoRemark" /> |
| | | <result column="audit_status" property="auditStatus" /> |
| | | <result column="first_audit_time" property="firstAuditTime" /> |
| | | <result column="two_audit_time" property="twoAuditTime" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
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.order.mapper.TChargingBillMapper"> |
| | | |
| | | |
| | | <select id="chargingBillList" resultType="com.ruoyi.order.api.vo.ChargingBillListVO"> |
| | | select t1.* from t_charging_bill t1 |
| | | where 1=1 |
| | | <if test="req.type != null "> |
| | | and t1.type = #{req.type} |
| | | </if> |
| | | <if test="req.state != null "> |
| | | and t1.status = #{req.state} |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.bill_time between #{startTime1} and #{startTime2} |
| | | </if> |
| | | <if test="req.uid != null and req.uid!=''"> |
| | | and t1.id = #{req.uid} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | </select> |
| | | <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund"> |
| | | |
| | | select * from (SELECT id, |
| | | `code`, |
| | | refund_code, |
| | | refund_title, |
| | | refund_reason, |
| | | refund_amount, |
| | | refund_total_amount, |
| | | refund_time, |
| | | pay_type, |
| | | pay_amount, |
| | | refund_remark |
| | | FROM t_charging_order_refund |
| | | select * from (SELECT re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | co.recharge_serial_number as serail_number, |
| | | co.payment_amount, |
| | | co.pay_time |
| | | FROM t_charging_order_refund re |
| | | LEFT JOIN t_charging_order co ON re.charging_order_id = co.id |
| | | UNION ALL |
| | | SELECT id, |
| | | `code`, |
| | | refund_code, |
| | | refund_title, |
| | | refund_reason, |
| | | refund_amount, |
| | | refund_total_amount, |
| | | refund_time, |
| | | pay_type, |
| | | pay_amount, |
| | | refund_remark |
| | | FROM t_shopping_order_refund |
| | | SELECT re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | so.serial_number, |
| | | so.payment_amount, |
| | | so.pay_time |
| | | FROM t_shopping_order_refund re |
| | | LEFT JOIN t_shopping_order so on re.shopping_order_id = so.id |
| | | UNION ALL |
| | | SELECT id, |
| | | `code`, |
| | | refund_code, |
| | | refund_title, |
| | | refund_reason, |
| | | refund_amount, |
| | | refund_total_amount, |
| | | refund_time, |
| | | pay_type, |
| | | pay_amount, |
| | | refund_remark |
| | | FROM t_vip_order_refund) o |
| | | SELECT vr.id, |
| | | vr.`code`, |
| | | vr.refund_code, |
| | | vr.refund_title, |
| | | vr.refund_reason, |
| | | vr.refund_amount, |
| | | vr.refund_total_amount, |
| | | vr.refund_time, |
| | | vr.pay_type, |
| | | vr.pay_amount, |
| | | vr.refund_remark, |
| | | vo.serial_number, |
| | | vo.payment_amount, |
| | | vo.pay_time |
| | | FROM t_vip_order_refund vr |
| | | LEFT JOIN t_vip_order vo on vr.vip_order_id = vo.id |
| | | |
| | | |
| | | ) o |
| | | <where> |
| | | <if test="data.code != null and data.code != ''"> |
| | | AND o.code LIKE CONCAT('%',#{data.code},'%') |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | |
| | | private TVipService vipService; |
| | | @Resource |
| | | private TCouponService couponService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @PostMapping("/saveVip") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员添加") |
| | | public AjaxResult saveVip(@RequestBody TVip dto) { |
| | |
| | | return R.ok(vipInfoDtos); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo/pay") |
| | | public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam(name = "1月2季3年",value = "buyType") Integer buyType, |
| | | @RequestParam(name = "1微信2支付宝",value = "payType") Integer payType |
| | | ) { |
| | | |
| | | TVip byId = vipService.getById(vipId); |
| | | BigDecimal payMoney = BigDecimal.ZERO; |
| | | BigDecimal discountMoney = BigDecimal.ZERO; |
| | | BigDecimal discount = BigDecimal.ZERO; |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | switch (buyType){ |
| | | case 1: |
| | | if (byId.getMonthlyCardDiscountStart()!=null&&(now.isAfter(byId.getMonthlyCardDiscountStart())&&now.isBefore(byId.getMonthlyCardDiscountEnd()))){ |
| | | payMoney = byId.getMonthlyCard().multiply(byId.getMonthlyCardDiscount()); |
| | | discountMoney = byId.getMonthlyCard().subtract(payMoney); |
| | | discount = byId.getMonthlyCardDiscount(); |
| | | }else { |
| | | payMoney = byId.getMonthlyCard(); |
| | | } |
| | | break; |
| | | case 2: |
| | | if (byId.getSeasonCardDiscountStart()!=null&&(now.isAfter(byId.getSeasonCardDiscountStart())&&now.isBefore(byId.getSeasonCardDiscountEnd()))){ |
| | | payMoney = byId.getSeasonCard().multiply(byId.getSeasonCardDiscount()); |
| | | discountMoney = byId.getSeasonCard().subtract(payMoney); |
| | | discount = byId.getSeasonCardDiscount(); |
| | | }else { |
| | | payMoney = byId.getSeasonCard(); |
| | | } |
| | | break; |
| | | case 3: |
| | | if (byId.getAnnualCardDiscountStart()!=null&&(now.isAfter(byId.getAnnualCardDiscountStart())&&now.isBefore(byId.getAnnualCardDiscountEnd()))){ |
| | | payMoney = byId.getAnnualCard().multiply(byId.getAnnualCardDiscount()); |
| | | discountMoney = byId.getAnnualCard().subtract(payMoney); |
| | | discount = byId.getAnnualCardDiscount(); |
| | | }else { |
| | | payMoney = byId.getAnnualCard(); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | |
| | | return R.ok(vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | |
| | | PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize); |
| | | |
| | | |
| | | Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId); |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.mapper.TCouponMapper; |
| | | import com.ruoyi.other.mapper.TVipMapper; |
| | | import com.ruoyi.other.service.TVipService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import org.apache.poi.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private TCouponMapper tCouponMapper; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize) { |
| | | PageInfo<TVip> pageInfo = new PageInfo<>(pageCurr,pageSize); |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId) { |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | |
| | | //生成会员购买订单 |
| | | |
| | | TVipOrder shopOrder = new TVipOrder(); |
| | | shopOrder.setCode(OrderCodeUtil.getOrderCode("HY")); |
| | | shopOrder.setAppUserId(userId); |
| | | shopOrder.setType(1); |
| | | shopOrder.setVipId(byId.getId()); |
| | | shopOrder.setVipType(buyType); |
| | | shopOrder.setOrderAmount(payMoney.add(discountMoney)); |
| | | shopOrder.setDiscount(discount); |
| | | shopOrder.setDiscountAmount(discountMoney); |
| | | shopOrder.setPaymentAmount(payMoney); |
| | | shopOrder.setPaymentStatus(1); |
| | | shopOrder.setPaymentType(payType); |
| | | shopOrder.setPayTime(LocalDateTime.now()); |
| | | orderClient.addVipOrder(shopOrder).getData(); |
| | | |
| | | |
| | | if (payType==1){ |
| | | //调起支付 |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setCode(shopOrder.getCode()); |
| | | paymentOrder.setAmount(shopOrder.getPaymentAmount()); |
| | | paymentOrder.setOpenId(user.getWxOpenid()); |
| | | paymentOrder.setDescription("购买会员"); |
| | | return wxPaymentClient.orderPay(paymentOrder); |
| | | }else { |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(shopOrder.getCode()); |
| | | req.setTotalAmount(shopOrder.getPaymentAmount().toString()); |
| | | req.setSubject("充电充值"); |
| | | req.setBuyerOpenId(user.getAliOpenid()); |
| | | req.setBody("充电充值"); |
| | | AliPaymentResp data = aliPaymentClient.payment(req).getData(); |
| | | if(null != data){ |
| | | data.setNotifyUrl(data.getNotifyUrl() + "/callBack/ali/all"); |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.payment.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.payment.ali.config.AliProperties; |
| | | import com.ruoyi.payment.ali.v2.AppletPayUtil; |
| | | import com.ruoyi.payment.api.model.*; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/allCallBack") |
| | | public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { |
| | | try { |
| | | String out_trade_no = aliQueryOrder.getOutTradeNo(); |
| | | String transaction_id = aliQueryOrder.getTradeNo(); |
| | | String attach = aliQueryOrder.getPassbackParams(); |
| | | // AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | // if (ajaxResult.isSuccess()) { |
| | | // PrintWriter writer = response.getWriter(); |
| | | // writer.println("success"); |
| | | // writer.flush(); |
| | | // writer.close(); |
| | | // } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | log.info("支付回调:{}", params); |
| | | String outRefundNo = (String) params.get("out_refund_no"); |
| | | String out_trade_no = params.get("out_trade_no").toString(); |
| | | String substring = outRefundNo.substring(0, 2); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | |
| | | break; |
| | | case "HY": |
| | | break; |
| | | } |
| | | |
| | | return R.ok(params); |