Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAppUser>> selectByPhoneLike(String phone) { |
| | | return R.fail("通过手机号模糊查询用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R refundPoints(String param) { |
| | | return R.fail("后台兑换订单退款回退用户积分失败:"+throwable.getMessage()); |
| | | } |
| | |
| | | @GetMapping("/t-app-user/user/selectByPhone") |
| | | R<TAppUser> selectByPhone(@RequestParam("phone") String phone); |
| | | /** |
| | | * 通过手机号模糊查询用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-app-user/user/selectByPhoneLike") |
| | | R<List<TAppUser>> selectByPhoneLike(@RequestParam("phone") String phone); |
| | | /** |
| | | * 远程调用 积分兑换订单 退款回退积分 |
| | | * @return |
| | | */ |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "校验计费模版是否准确DTO") |
| | | public class CheckChargingStrategyDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "桩编号code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "计费模型编号 id") |
| | | private Integer strategyDetailId; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | public R<TAccountingStrategyDetail> getDetailBySiteId(Integer siteId) { |
| | | return R.fail("通过站点id查询当前时段使用的策略明细失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TAccountingStrategyDetail> getDetailByCode(String code) { |
| | | return R.fail("通过桩编号查询当前时段使用的策略明细失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Boolean> checkChargingStrategy(CheckChargingStrategyDTO dto) { |
| | | return R.fail("校验充电桩计费模版是否准确失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.factory.AccountingStrategyDetailFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | 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; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getDetailBySiteId") |
| | | R<TAccountingStrategyDetail> getDetailBySiteId(@RequestParam("siteId") Integer siteId); |
| | | /** |
| | | * 通过桩编号查询当前时段使用的策略明细 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getDetailByCode") |
| | | R<TAccountingStrategyDetail> getDetailByCode(@RequestParam("code") String code); |
| | | /** |
| | | * 校验充电桩计费模版是否准确 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/checkChargingStrategy") |
| | | R<Boolean> checkChargingStrategy(@RequestBody CheckChargingStrategyDTO dto); |
| | | } |
| | |
| | | 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 io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "开票时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("billing_time") |
| | | private LocalDateTime billingTime; |
| | | |
| | |
| | | @ApiModelProperty(value = "增值服务费税率") |
| | | @TableField("added_service_tariff") |
| | | private BigDecimal addedServiceTariff; |
| | | |
| | | @ApiModelProperty(value = "'电费'") |
| | | @TableField("electrovalence") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "'服务费'") |
| | | @TableField("service_charge") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "'增值服务费'") |
| | | @TableField("added_service") |
| | | private BigDecimal addedService; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.query; |
| | | |
| | | import com.ruoyi.common.core.query.TimeRangePageQuery; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "发票管理Query") |
| | | public class TOrderInvoiceQuery extends TimeRangePageQuery { |
| | | |
| | | @ApiModelProperty(value = "开票公司") |
| | | private String invoicingCompany; |
| | | |
| | | @ApiModelProperty(value = "发票类型") |
| | | private String invoiceType; |
| | | |
| | | @ApiModelProperty(value = "抬头类型(1=个人,2=企业)") |
| | | private Integer invoicingObjectType; |
| | | |
| | | @ApiModelProperty(value = "发票种类(1=纸质发票,2=电子发票)") |
| | | private Integer invoiceMaterial; |
| | | |
| | | @ApiModelProperty(value = "开票方式(1=人工,2=自动)") |
| | | private Integer invoicingMethod; |
| | | |
| | | @ApiModelProperty(value = "申请人电话") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty(value = "申请人姓名") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty(value = "公司名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "用户id 前端忽略") |
| | | private List<Long> userIds; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "ChargingBillVO对象",description = "充电算帐单") |
| | | public class ChargingBillVO { |
| | | @ApiModelProperty(value = "充电总度数") |
| | | private BigDecimal chargingCapacity; |
| | | @ApiModelProperty(value = "实收金额") |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "订单总金额") |
| | | private BigDecimal orderAmount; |
| | | @ApiModelProperty(value = "累计电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "累计服务费") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "订单数量") |
| | | private Integer orderCount; |
| | | @ApiModelProperty(value = "平台手续费") |
| | | private String commissionAmount; |
| | | @ApiModelProperty(value = "三方平台分佣") |
| | | private String sharingAmount; |
| | | @ApiModelProperty(value = "优惠抵扣") |
| | | private String discount; |
| | | @ApiModelProperty(value = "列表数据") |
| | | private PageInfo<ChargingOrderListVO> list; |
| | | } |
| | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "累计电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "累计服务费") |
| | | private BigDecimal serviceCharge; |
| | | |
| | | @ApiModelProperty(value = "时段数") |
| | | private Integer count; |
| | | @ApiModelProperty(value = "1明星充电 2快电 3新电途") |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "发票管理VO") |
| | | public class TOrderInvoiceVO extends TOrderInvoice { |
| | | |
| | | @ApiModelProperty(value = "电费税率") |
| | | private BigDecimal electricityTariff; |
| | | |
| | | @ApiModelProperty(value = "服务费税率") |
| | | private BigDecimal serviceTariff; |
| | | |
| | | @ApiModelProperty(value = "增值服务费税率") |
| | | private BigDecimal addedServiceTariff; |
| | | @ApiModelProperty(value = "电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "服务费") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "增值服务费") |
| | | private BigDecimal addedService; |
| | | @ApiModelProperty(value = "用户电话") |
| | | private String userPhone; |
| | | |
| | | } |
| | |
| | | return LocalTime.parse(time, formatter); |
| | | } |
| | | |
| | | /** |
| | | * localdatetime转为字符串 |
| | | * |
| | | * @param time localdatetime |
| | | * @return 字符串 |
| | | */ |
| | | public static String localDateTimeToString(LocalDateTime time) { |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | return df.format(time); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | .eq(TAppUser::getPhone,phone) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | /** |
| | | * 通过手机号模糊查询用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @GetMapping("/user/selectByPhoneLike") |
| | | public R<List<TAppUser>> selectByPhoneLike(@RequestParam("phone") String phone){ |
| | | return R.ok(appUserService.list(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone,phone))); |
| | | } |
| | | |
| | | @ApiOperation(value = "签到", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/sign") |
| | |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailByStrategyId(@RequestParam("strategyId") Integer strategyId) { |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getServiceCharge())); |
| | | }); |
| | | return AjaxResult.ok(list); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | public class TAccountingStrategyDetailController { |
| | | |
| | | private final ISiteService siteService; |
| | | private final TChargingPileService chargingPileService; |
| | | private final TAccountingStrategyService accountingStrategyService; |
| | | private final TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyDetailController(ISiteService siteService, TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | public TAccountingStrategyDetailController(ISiteService siteService, TChargingPileService chargingPileService, TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | this.siteService = siteService; |
| | | this.chargingPileService = chargingPileService; |
| | | this.accountingStrategyService = accountingStrategyService; |
| | | this.accountingStrategyDetailService = accountingStrategyDetailService; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取当前有效的计费模板 |
| | | * @param accountingStrategyId |
| | | * @return |
| | | */ |
| | | /** |
| | | * 通过站点id查询当前时段使用的策略明细 |
| | | * @param siteId |
| | | * @return |
| | |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(one); |
| | | } |
| | | /** |
| | | * 通过桩id查询当前时段使用的策略明细 |
| | | * @param code 设备编号 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getDetailByCode") |
| | | public R<TAccountingStrategyDetail> getDetailByPileId(@RequestParam("code") String code){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,code) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(chargingPile)){ |
| | | return R.fail("未查询到该桩设备"); |
| | | } |
| | | Site site = siteService.getById(chargingPile.getSiteId()); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(one); |
| | | } |
| | | /** |
| | | * 校验充电桩计费模版是否准确 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/checkChargingStrategy") |
| | | public R<Boolean> checkChargingStrategy(@RequestBody CheckChargingStrategyDTO dto){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,dto.getCode()) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(chargingPile)){ |
| | | return R.ok(false); |
| | | } |
| | | Site site = siteService.getById(chargingPile.getSiteId()); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(dto.getStrategyDetailId().equals(one.getId())); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.iotda.utils.tools; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Slf4j |
| | | public class StrategyUtil implements Serializable { |
| | | |
| | | |
| | | /** |
| | | * 校验计费模版是否准确 |
| | | * @return |
| | | */ |
| | | public static boolean checkStrategy() { |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.api.model.BillingModeVerifyReply; |
| | | import com.ruoyi.integration.iotda.enums.ServiceIdMenu; |
| | | import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; |
| | | import com.ruoyi.integration.iotda.utils.tools.MessageUtil; |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyReplyService; |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyService; |
| | | import com.ruoyi.integration.rocket.model.BillingModeVerifyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | |
| | | |
| | | @Autowired |
| | | private BillingModeVerifyService billingModeVerifyService; |
| | | @Autowired |
| | | private IotMessageProduce iotMessageProduce; |
| | | @Autowired |
| | | private MessageUtil messageUtil; |
| | | @Autowired |
| | | private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | |
| | | @Override |
| | | protected void handleMessage(BillingModeVerifyMessage message) throws Exception { |
| | |
| | | BeanUtils.copyProperties(message,billingModeVerify); |
| | | billingModeVerifyService.create(billingModeVerify); |
| | | // 业务处理 |
| | | BillingModeVerifyReply billingModeVerifyReply = new BillingModeVerifyReply(); |
| | | if(message.getBilling_model_code().equals("0")){ |
| | | // 首次 |
| | | billingModeVerifyReply.setCharging_pile_code(billingModeVerify.getCharging_pile_code()); |
| | | billingModeVerifyReply.setBilling_model_code("0"); |
| | | billingModeVerifyReply.setBilling_model_result(1); |
| | | }else { |
| | | // 查询桩使用的模版 |
| | | CheckChargingStrategyDTO dto = new CheckChargingStrategyDTO(); |
| | | dto.setCode(message.getBilling_model_code()); |
| | | dto.setStrategyDetailId(Integer.valueOf(message.getBilling_model_code())); |
| | | Boolean check = accountingStrategyDetailClient.checkChargingStrategy(dto).getData(); |
| | | // 校验计费模版是否准确 |
| | | billingModeVerifyReply.setCharging_pile_code(billingModeVerify.getCharging_pile_code()); |
| | | billingModeVerifyReply.setBilling_model_code(message.getBilling_model_code()); |
| | | if(check){ |
| | | billingModeVerifyReply.setBilling_model_result(0); |
| | | }else { |
| | | billingModeVerifyReply.setBilling_model_result(1); |
| | | } |
| | | } |
| | | iotMessageProduce.sendMessage(billingModeVerifyReply.getCharging_pile_code(), ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-spring-boot-starter</artifactId> |
| | | <version>4.0.0</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>guava</artifactId> |
| | | <groupId>com.google.guava</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
New file |
| | |
| | | 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 com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | 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.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.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.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Api(tags = "充电算帐单") |
| | | @RestController |
| | | @RequestMapping("/chargingBill") |
| | | 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; |
| | | @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) { |
| | | |
| | | return AjaxResult.success(null); |
| | | } |
| | | } |
| | | |
| | |
| | | .eq(TChargingOrder::getDelFlag, 0).eq(TChargingOrder::getStatus, 3)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/getMyChargingOrderList") |
| | | @ApiOperation(value = "获取充电记录列表", tags = {"小程序-充电记录"}) |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | 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.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.dto.AddOrderInvoice; |
| | | import com.ruoyi.order.dto.GetOrderInvoiceList; |
| | | import com.ruoyi.order.dto.MyOrderInvoiceInfo; |
| | | import com.ruoyi.order.dto.OrderInvoiceList; |
| | | import com.ruoyi.order.export.OrderInvoiceExport; |
| | | import com.ruoyi.order.service.TOrderInvoiceService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | 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.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public AjaxResult addOrderInvoice(@RequestBody AddOrderInvoice addOrderInvoice){ |
| | | return orderInvoiceService.addOrderInvoice(addOrderInvoice); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/pageList") |
| | | @ApiOperation(value = "查询开票分页列表", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<PageInfo<TOrderInvoiceVO>> pageList(@RequestBody TOrderInvoiceQuery query){ |
| | | return AjaxResult.success(orderInvoiceService.pageList(query)); |
| | | } |
| | | |
| | | @GetMapping("/uploadPdf") |
| | | @ApiOperation(value = "上传发票", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<String> uploadPdf(@RequestParam("id") Long id, |
| | | @RequestParam("invoiceUrl") String invoiceUrl){ |
| | | TOrderInvoice orderInvoice = orderInvoiceService.getById(id); |
| | | orderInvoice.setInvoiceUrl(invoiceUrl); |
| | | orderInvoiceService.updateById(orderInvoice); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/statusCount") |
| | | @ApiOperation(value = "查询开票状态数量", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<Map<String,Integer>> statusCount(@RequestBody TOrderInvoiceQuery query){ |
| | | return AjaxResult.success(orderInvoiceService.statusCount(query)); |
| | | } |
| | | |
| | | /** |
| | | * 发票管理导出 |
| | | */ |
| | | @ApiOperation(value = "发票管理导出") |
| | | @Log(title = "发票管理导出", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(@RequestBody TOrderInvoiceQuery query) |
| | | { |
| | | List<TOrderInvoiceVO> list = orderInvoiceService.export(query); |
| | | List<OrderInvoiceExport> orderInvoiceExports = new ArrayList<>(); |
| | | for (TOrderInvoiceVO orderInvoiceVO : list) { |
| | | OrderInvoiceExport orderInvoiceExport = new OrderInvoiceExport(); |
| | | BeanUtils.copyProperties(orderInvoiceVO,orderInvoiceExport); |
| | | orderInvoiceExport.setBillingTime(DateUtils.localDateTimeToString(orderInvoiceVO.getBillingTime())); |
| | | orderInvoiceExports.add(orderInvoiceExport); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), OrderInvoiceExport.class, orderInvoiceExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("发票导出.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(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getMyOrderInvoiceList") |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ChargingBillQuery extends BasePage { |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | |
| | | @ApiModelProperty("电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty("状态(0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | @ApiModelProperty("车牌号") |
| | | private String licensePlate; |
| | | |
| | | @ApiModelProperty("订单类型(1=充电订单(小程序),2=充电订单(刷卡))") |
| | | private Integer orderType; |
| | | |
| | | @ApiModelProperty("开始时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("结束时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00") |
| | | private String endTime; |
| | | @ApiModelProperty("用户ids 前端忽略") |
| | | private List<Long> userIds; |
| | | @ApiModelProperty("车辆ids 前端忽略") |
| | | private List<Long> carIds; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "充电账单列表查询参数") |
| | | public class ChargingListQuery extends BasePage { |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | |
| | | @ApiModelProperty("电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty("状态(0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | @ApiModelProperty("车牌号") |
| | | private String licensePlate; |
| | | |
| | | @ApiModelProperty("订单类型(1=充电订单(小程序),2=充电订单(刷卡))") |
| | | private Integer orderType; |
| | | |
| | | @ApiModelProperty("开始时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00") |
| | | @ApiModelProperty("订单分类 1全站 2各个站点") |
| | | private String category; |
| | | @ApiModelProperty("账单周期2020-01-01 - 2020-01-01") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("结束时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00") |
| | | private String endTime; |
| | | @ApiModelProperty("用户ids 前端忽略") |
| | | private List<Long> userIds; |
| | | @ApiModelProperty("车辆ids 前端忽略") |
| | | private List<Long> carIds; |
| | | |
| | | @ApiModelProperty("1已出账 2未出账") |
| | | private Integer state; |
| | | } |
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 OrderInvoiceExport implements Serializable { |
| | | |
| | | @Excel(name = "申请单编号",width = 30) |
| | | private String code; |
| | | |
| | | @Excel(name = "申请日期",width = 30) |
| | | private String billingTime; |
| | | |
| | | @Excel(name = "开票公司",width = 30) |
| | | private String invoicingCompany; |
| | | |
| | | @Excel(name = "发票类型",width = 30) |
| | | private String invoiceType; |
| | | |
| | | @Excel(name = "发票种类",replace = {"纸质发票_1","电子发票_2"},width = 30) |
| | | private Integer invoiceMaterial; |
| | | |
| | | @Excel(name = "开票方式",replace = {"人工_1","自动_2"},width = 30) |
| | | private Integer invoicingMethod; |
| | | |
| | | @Excel(name = "开票总金额",width = 30) |
| | | private BigDecimal totalAmount; |
| | | |
| | | @Excel(name = "服务费",width = 30) |
| | | private BigDecimal serviceCharge; |
| | | |
| | | @Excel(name = "服务费税率",width = 30) |
| | | private BigDecimal serviceTariff; |
| | | |
| | | @Excel(name = "增值服务费",width = 30) |
| | | private BigDecimal addedService; |
| | | |
| | | @Excel(name = "增值服务费税率",width = 30) |
| | | private BigDecimal addedServiceTariff; |
| | | |
| | | // @Excel(name = "开票订单类型",replace = {"充电订单_1","购物订单_2","兑换订单_3","会员订单_4"},width = 30) |
| | | // private Integer orderType; |
| | | |
| | | @Excel(name = "抬头类型",replace = {"个人_1","企业_2"},width = 30) |
| | | private Integer invoicingObjectType; |
| | | |
| | | @Excel(name = "发票抬头",width = 30) |
| | | private String name; |
| | | |
| | | @Excel(name = "开户银行",width = 30) |
| | | private String depositBank; |
| | | |
| | | @Excel(name = "银行账户",width = 30) |
| | | private String bankAccount; |
| | | |
| | | @Excel(name = "公司电话",width = 30) |
| | | private String companyPhone; |
| | | |
| | | @Excel(name = "纳税识别号",width = 30) |
| | | private String taxIdentificationNumber; |
| | | |
| | | @Excel(name = "公司地址",width = 30) |
| | | private String companyAddress; |
| | | |
| | | @Excel(name = "邮箱",width = 30) |
| | | private String mailbox; |
| | | |
| | | @Excel(name = "状态",replace = {"待开票_1","开票中_2","已开票_3"},width = 30) |
| | | private Integer status; |
| | | |
| | | @Excel(name = "用户电话",width = 30) |
| | | private String userPhone; |
| | | } |
| | |
| | | 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.TOrderInvoice; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface TOrderInvoiceMapper extends BaseMapper<TOrderInvoice> { |
| | | |
| | | /** |
| | | * 发票分页查询 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TOrderInvoiceVO> pageList(@Param("query") TOrderInvoiceQuery query, @Param("pageInfo")PageInfo<TOrderInvoiceVO> pageInfo); |
| | | |
| | | /** |
| | | * 查询开票状态数量 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Map<String, Integer> statusCount(@Param("query")TOrderInvoiceQuery query); |
| | | |
| | | /** |
| | | * 导出 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<TOrderInvoiceVO> export(@Param("query")TOrderInvoiceQuery query); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.dto.AddOrderInvoice; |
| | | import com.ruoyi.order.dto.GetOrderInvoiceList; |
| | | import com.ruoyi.order.dto.MyOrderInvoiceInfo; |
| | | import com.ruoyi.order.dto.OrderInvoiceList; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | MyOrderInvoiceInfo getMyOrderInvoiceInfo(String id); |
| | | |
| | | /** |
| | | * 查询开票分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TOrderInvoiceVO> pageList(TOrderInvoiceQuery query); |
| | | |
| | | /** |
| | | * 查询开票状态数量 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Map<String,Integer> statusCount(TOrderInvoiceQuery query); |
| | | |
| | | /** |
| | | * 发票管理导出 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<TOrderInvoiceVO> export(TOrderInvoiceQuery query); |
| | | |
| | | } |
| | |
| | | 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.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | 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.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | 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.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public List<Map<String, BigDecimal>> getYearData(List<Long> chargingOrderIds) { |
| | | return this.baseMapper.getYearData(chargingOrderIds); |
| | | } |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Override |
| | | public ChargingOrderTimeVO chargingList(ChargingListQuery dto) { |
| | | String startTime1 = null; |
| | |
| | | startTime1 = split[0]; |
| | | startTime2 = split[1]; |
| | | } |
| | | if (StringUtils.hasLength(dto.getEndTime())){ |
| | | String[] split = dto.getEndTime().split(" - "); |
| | | endTime1 = split[0]; |
| | | endTime2 = split[1]; |
| | | } |
| | | ChargingOrderTimeVO chargingOrderTimeVO = new ChargingOrderTimeVO(); |
| | | |
| | | |
| | | PageInfo<ChargingOrderListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<ChargingOrderListVO> list = this.baseMapper.chargingList(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); |
| | |
| | | } |
| | | chargingOrderListInfoVO.setEndMode(chargingOrder.getEndMode()); |
| | | // todo 周一完善 |
| | | // chargingOrderListInfoVO.setStartSoc(); |
| | | // chargingOrderListInfoVO.setEndSoc(); |
| | | // chargingOrderListInfoVO.setChargingCapacity(); |
| | | // chargingOrderListInfoVO.setSiteId(); |
| | | // chargingOrderListInfoVO.setChargingPileId(); |
| | | // chargingOrderListInfoVO.setAppUserId(); |
| | | // chargingOrderListInfoVO.setAppUserCarId(); |
| | | // chargingOrderListInfoVO.setChargingGunId(); |
| | | // chargingOrderListInfoVO.setOrderType(); |
| | | // chargingOrderListInfoVO.setChargingSecond(); |
| | | // chargingOrderListInfoVO.setLicensePlate(); |
| | | // chargingOrderListInfoVO.setPhone(); |
| | | // chargingOrderListInfoVO.setPaymentAmount(); |
| | | // chargingOrderListInfoVO.setElectrovalence(); |
| | | // chargingOrderListInfoVO.setServiceCharge(); |
| | | // chargingOrderListInfoVO.setStartTime(); |
| | | // chargingOrderListInfoVO.setEndTime(); |
| | | // chargingOrderListInfoVO.setId(); |
| | | // chargingOrderListInfoVO.setUid(); |
| | | // chargingOrderListInfoVO.setList(); |
| | | // 获取开始SOC 结束soc |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); |
| | | if (!data6.isEmpty()){ |
| | | // 第一条数据soc为开始 最后一条数据soc为结束soc |
| | | chargingOrderListInfoVO.setStartSoc(data6.get(0).getSoc().toString()); |
| | | chargingOrderListInfoVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString()); |
| | | chargingOrderListInfoVO.setChargingCapacity(data6.get(data6.size()-1).getCharging_degree()); |
| | | chargingOrderListInfoVO.setChargingSecond(data6.get(data6.size()-1).getCumulative_charging_time()*60+""); |
| | | |
| | | |
| | | return null; |
| | | } |
| | | if (chargingOrder.getAppUserCarId()!=null){ |
| | | List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(chargingOrder.getAppUserCarId())).getData(); |
| | | if (!data3.isEmpty())chargingOrderListInfoVO.setLicensePlate(data3.get(0).getLicensePlate()); |
| | | } |
| | | chargingOrderListInfoVO.setStartTime(chargingOrder.getStartTime()); |
| | | chargingOrderListInfoVO.setEndTime(chargingOrder.getEndTime()); |
| | | chargingOrderListInfoVO.setId(chargingOrder.getId()); |
| | | chargingOrderListInfoVO.setUid(chargingOrder.getId().toString()); |
| | | chargingOrderListInfoVO.setList(data6); |
| | | chargingOrderListInfoVO.setCouponDiscountAmount(chargingOrder.getCouponDiscountAmount()); |
| | | chargingOrderListInfoVO.setVipDiscountAmount(chargingOrder.getVipDiscountAmount()); |
| | | chargingOrderListInfoVO.setSharingAmount(chargingOrder.getSharingAmount()); |
| | | chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getCommissionAmount()); |
| | | // 查询费用明细列表 |
| | | List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery() |
| | | .eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId()) |
| | | .list(); |
| | | chargingOrderListInfoVO.setList1(list); |
| | | return chargingOrderListInfoVO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理充电订单实时监控数据相关的业务逻辑 |
| | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | 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.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | 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.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 io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @Resource |
| | | private CouponClient couponClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | return myOrderInvoiceInfo; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TOrderInvoiceVO> pageList(TOrderInvoiceQuery query) { |
| | | // 查询申请用户 |
| | | List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | return new PageInfo<>(); |
| | | } |
| | | query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TOrderInvoiceVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | |
| | | List<Long> ids = list.stream().map(TOrderInvoiceVO::getId).collect(Collectors.toList()); |
| | | |
| | | List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() |
| | | .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); |
| | | |
| | | list.forEach(e->{ |
| | | e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); |
| | | e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); |
| | | e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | }); |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Integer> statusCount(TOrderInvoiceQuery query) { |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | map.put("notAccepted",0); |
| | | map.put("processing",0); |
| | | map.put("finished",0); |
| | | return map; |
| | | } |
| | | query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | map = this.baseMapper.statusCount(query); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public List<TOrderInvoiceVO> export(TOrderInvoiceQuery query) { |
| | | // 查询申请用户 |
| | | List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TOrderInvoiceVO> list = this.baseMapper.export(query); |
| | | List<Long> ids = list.stream().map(TOrderInvoiceVO::getId).collect(Collectors.toList()); |
| | | List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() |
| | | .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); |
| | | list.forEach(e->{ |
| | | e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); |
| | | e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); |
| | | e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | }); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @ApiModelProperty(value = "订单类型(1=充电订单(小程序),2=充电订单(刷卡))") |
| | | private String orderType; |
| | | @ApiModelProperty(value = "充电时间 秒") |
| | | private Long chargingSecond; |
| | | private String chargingSecond; |
| | | @ApiModelProperty(value = "车牌号") |
| | | private String licensePlate; |
| | | @ApiModelProperty(value = "客户手机号") |
| | |
| | | private Long id; |
| | | @ApiModelProperty(value = "订单uid") |
| | | private String uid; |
| | | @ApiModelProperty(value = "费用明细-优惠券优惠金额") |
| | | private BigDecimal couponDiscountAmount; |
| | | @ApiModelProperty(value = "费用明细-会员优惠金额") |
| | | private BigDecimal vipDiscountAmount; |
| | | @ApiModelProperty(value = "费用明细-平台分佣") |
| | | private BigDecimal sharingAmount; |
| | | @ApiModelProperty(value = "费用明细-手续费") |
| | | private BigDecimal commissionAmount; |
| | | @ApiModelProperty(value = "充电信息") |
| | | List<UploadRealTimeMonitoringData> list; |
| | | @ApiModelProperty(value = "费用明细-费用列表") |
| | | List<TChargingOrderAccountingStrategy> list1; |
| | | } |
| | |
| | | <result column="electricity_tariff" property="electricityTariff" /> |
| | | <result column="service_tariff" property="serviceTariff" /> |
| | | <result column="added_service_tariff" property="addedServiceTariff" /> |
| | | <result column="electrovalence" property="electrovalence" /> |
| | | <result column="service_charge" property="serviceCharge" /> |
| | | <result column="added_service" property="addedService" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, order_invoice_id, order_type, order_id, invoice_amount, electricity_tariff, service_tariff, added_service_tariff |
| | | id, order_invoice_id, order_type, order_id, invoice_amount, electricity_tariff, service_tariff, added_service_tariff,electrovalence,service_charge,added_service |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, code, app_user_id, order_type, invoicing_company, invoice_type_id, invoice_type, invoice_material, invoicing_method, invoicing_object_type, name, tax_identification_number, company_address, company_phone, deposit_bank, bank_account, total_amount, invoice_url, mailbox, status, create_time, billing_time, billing_user_id |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.order.api.vo.TOrderInvoiceVO"> |
| | | select toi.id, toi.code, toi.app_user_id, toi.order_type, toi.invoicing_company, toi.invoice_type_id, toi.invoice_type, toi.invoice_material, |
| | | toi.invoicing_method, toi.invoicing_object_type, toi.name, toi.tax_identification_number, toi.company_address, toi.company_phone, |
| | | toi.deposit_bank, toi.bank_account, toi.total_amount, toi.invoice_url, toi.mailbox, toi.status, toi.create_time, toi.billing_time, |
| | | toi.billing_user_id |
| | | from t_order_invoice toi |
| | | <where> |
| | | <if test="query.invoicingCompany != null and query.invoicingCompany != ''"> |
| | | AND toi.invoicing_company LIKE concat('%',#{query.invoicingCompany},'%') |
| | | </if> |
| | | <if test="query.invoiceType != null and query.invoiceType != ''"> |
| | | AND toi.invoice_type LIKE concat('%',#{query.invoiceType},'%') |
| | | </if> |
| | | <if test="query.invoicingObjectType != null"> |
| | | AND toi.invoicing_object_type = #{query.invoicingObjectType} |
| | | </if> |
| | | <if test="query.invoiceMaterial != null"> |
| | | AND toi.invoice_material = #{query.invoiceMaterial} |
| | | </if> |
| | | <if test="query.invoicingMethod != null"> |
| | | AND toi.invoicing_method = #{query.invoicingMethod} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | AND toi.name LIKE concat('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.userIds != null and query.userIds.size()>0"> |
| | | AND toi.billing_user_id IN |
| | | <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> |
| | | #{userId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ORDER BY toi.billing_time DESC |
| | | </select> |
| | | <select id="statusCount" resultType="java.util.Map"> |
| | | select |
| | | COUNT(CASE WHEN status = 1 THEN 1 END) AS `notAccepted`, |
| | | COUNT(CASE WHEN status = 2 THEN 1 END) AS `processing`, |
| | | COUNT(CASE WHEN status = 3 THEN 1 END) AS `finished` |
| | | from t_order_invoice toi |
| | | <where> |
| | | <if test="query.invoicingCompany != null and query.invoicingCompany != ''"> |
| | | AND toi.invoicing_company LIKE concat('%',#{query.invoicingCompany},'%') |
| | | </if> |
| | | <if test="query.invoiceType != null and query.invoiceType != ''"> |
| | | AND toi.invoice_type LIKE concat('%',#{query.invoiceType},'%') |
| | | </if> |
| | | <if test="query.invoicingObjectType != null"> |
| | | AND toi.invoicing_object_type = #{query.invoicingObjectType} |
| | | </if> |
| | | <if test="query.invoiceMaterial != null"> |
| | | AND toi.invoice_material = #{query.invoiceMaterial} |
| | | </if> |
| | | <if test="query.invoicingMethod != null"> |
| | | AND toi.invoicing_method = #{query.invoicingMethod} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | AND toi.name LIKE concat('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.userIds != null and query.userIds.size()>0"> |
| | | AND toi.billing_user_id IN |
| | | <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> |
| | | #{userId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="export" resultType="com.ruoyi.order.api.vo.TOrderInvoiceVO"> |
| | | select toi.id, toi.code, toi.app_user_id, toi.order_type, toi.invoicing_company, toi.invoice_type_id, toi.invoice_type, toi.invoice_material, |
| | | toi.invoicing_method, toi.invoicing_object_type, toi.name, toi.tax_identification_number, toi.company_address, toi.company_phone, |
| | | toi.deposit_bank, toi.bank_account, toi.total_amount, toi.invoice_url, toi.mailbox, toi.status, toi.create_time, toi.billing_time, |
| | | toi.billing_user_id |
| | | from t_order_invoice toi |
| | | <where> |
| | | <if test="query.invoicingCompany != null and query.invoicingCompany != ''"> |
| | | AND toi.invoicing_company LIKE concat('%',#{query.invoicingCompany},'%') |
| | | </if> |
| | | <if test="query.invoiceType != null and query.invoiceType != ''"> |
| | | AND toi.invoice_type LIKE concat('%',#{query.invoiceType},'%') |
| | | </if> |
| | | <if test="query.invoicingObjectType != null"> |
| | | AND toi.invoicing_object_type = #{query.invoicingObjectType} |
| | | </if> |
| | | <if test="query.invoiceMaterial != null"> |
| | | AND toi.invoice_material = #{query.invoiceMaterial} |
| | | </if> |
| | | <if test="query.invoicingMethod != null"> |
| | | AND toi.invoicing_method = #{query.invoicingMethod} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | AND toi.name LIKE concat('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.userIds != null and query.userIds.size()>0"> |
| | | AND toi.billing_user_id IN |
| | | <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> |
| | | #{userId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ORDER BY toi.billing_time DESC |
| | | </select> |
| | | |
| | | </mapper> |