xuhy
2024-09-13 cb02f43ad81fd2ce3e1c3e0cd95234746b7927ad
Merge remote-tracking branch 'origin/master'
6个文件已添加
51个文件已修改
1682 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserIntegralChange.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/vo/ExchangeRecordVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingPileFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingPileClient.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/TParkLotRecordCountVo.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/TParkLotRecordVO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TSettlementConfirm.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrder.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEquimentVO.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEvaluateVO.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingWorkVO.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TActivity.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/WxPaymentClient.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/PaymentOrder.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/ExchangeDto.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/BasePage.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserIntegralChangeController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserTagController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/dto/ParkingRecordQueryDto.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TParkingRecordMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/TChargingPileService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/TParkingRecordService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml 168 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java 207 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ChargingDetailQueryDto.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ChargingStatisticsQueryDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TShoppingOrderMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingBillMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml 565 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TSettlementConfirmMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-payment/pom.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserIntegralChange.java
@@ -57,6 +57,7 @@
    @ApiModelProperty(value = "添加时间")
    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDateTime createTime;
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/vo/ExchangeRecordVO.java
@@ -40,4 +40,5 @@
    private Boolean delFlag;
    @ApiModelProperty(value = " 是否删除0否1是 前端忽略")
    private Long id;
    private Long appUserId;
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingPileFallbackFactory.java
@@ -33,6 +33,11 @@
            }
            @Override
            public R<List<TChargingPile>> getChargingPileBySiteIds(List<Integer> siteIds) {
                return null;
            }
            @Override
            public R<BigDecimal> getServiceMoney(String param) {
                return R.fail("根据会员折扣、预付金额 计算服务费失败:"+throwable.getMessage());
            }
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingPileClient.java
@@ -28,6 +28,10 @@
    @PostMapping(value = "/t-charging-pile/getChargingPileBySiteId")
    R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId);
    @ApiOperation(value = "获取站点列表")
    @PostMapping(value = "/t-charging-pile/getChargingPileBySiteIds")
    R<List<TChargingPile>> getChargingPileBySiteIds(@RequestParam("siteIds") List<Integer> siteIds);
    /**
     * 小程序远程调用 根据会员折扣、预付金额 计算服务费
     * @return
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/TParkLotRecordCountVo.java
New file
@@ -0,0 +1,19 @@
package com.ruoyi.chargingPile.api.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@Data
public class TParkLotRecordCountVo {
    @ApiModelProperty("从左到右依次")
    int count1;
    int count2;
    int count3;
    int count4;
    BigDecimal count5;
}
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/TParkLotRecordVO.java
New file
@@ -0,0 +1,20 @@
package com.ruoyi.chargingPile.api.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class TParkLotRecordVO {
    @ApiModelProperty("上方折线图")
    List<Map<String,Object>> maps;
    @ApiModelProperty("车辆类型饼图")
    List<Map<String,Object>> carColor;
    @ApiModelProperty("出场类型")
    List<Map<String,Object>> outType;
    @ApiModelProperty("进场充电占比")
    List<Map<String,Object>> isCharge;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TSettlementConfirm.java
@@ -25,14 +25,14 @@
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_settlement confirm")
@TableName("t_settlement_confirm")
@ApiModel(value="TSettlementConfirm对象", description="")
public class TSettlementConfirm extends BasePojo {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    @TableId(value = "id")
    private Long id;
    @ApiModelProperty(value = "站点id")
@@ -58,7 +58,7 @@
    @TableField("loss_electronic")
    private BigDecimal lossElectronic;
    @ApiModelProperty(value = "收入合计")
    @TableField("收入合计")
    @TableField("income")
    private BigDecimal income;
    @ApiModelProperty(value = "场地费")
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrder.java
@@ -37,6 +37,9 @@
    @ApiModelProperty(value = "订单编号")
    @TableField("code")
    private String code;
    @ApiModelProperty(value = "订单标题")
    @TableField("title")
    private String title;
    @ApiModelProperty(value = "用户id")
    @TableField("app_user_id")
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEquimentVO.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.order.api.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class TCharingUserEquimentVO {
    @ApiModelProperty("直流可用率")
    List<Map<String,Object>> equipmentMap1;
    @ApiModelProperty("交流可用率")
    List<Map<String,Object>> equipmentMap2;
    @ApiModelProperty("直流故障率")
    List<Map<String,Object>> equipmentMapbroke1;
    @ApiModelProperty("交流故障率")
    List<Map<String,Object>> equipmentMapbroke2;
    @ApiModelProperty("直流离网率")
    List<Map<String,Object>> equipmentMapOut1;
    @ApiModelProperty("交流离网率")
    List<Map<String,Object>> equipmentMapOut2;
    @ApiModelProperty("需求电流满足率")
    List<Map<String,Object>> needElec;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEvaluateVO.java
@@ -14,5 +14,11 @@
    List<Map<String,Object>> evaluate;
    @ApiModelProperty("差评数量")
    Long blackCount;
    @ApiModelProperty("好评标签")
    List<Map<String,Object>> goodTop;
    @ApiModelProperty("差评标签")
    List<Map<String,Object>> badTop;
    @ApiModelProperty("流量分析")
    List<Map<String,Object>> flow;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingWorkVO.java
New file
@@ -0,0 +1,23 @@
package com.ruoyi.order.api.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@Data
public class TCharingWorkVO {
    @ApiModelProperty("订单数量")
    int count;
    @ApiModelProperty("充电总收入")
    BigDecimal totalPaymentAmount;
    @ApiModelProperty("充电电费")
    BigDecimal totalElectrovalence;
    @ApiModelProperty("累计服务费")
    BigDecimal totalServiceCharge;
    @ApiModelProperty("充电度数综合")
    BigDecimal totalChargingCapacity;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TActivity.java
@@ -60,7 +60,12 @@
    @ApiModelProperty(value = "上架状态(0=否,1=是)")
    @TableField("status")
    private Integer status;
    @ApiModelProperty(value = "小程序id")
    @TableField("applet_id")
    private String appletId;
    @ApiModelProperty(value = "小程序名称")
    @TableField("applet_name")
    private String appletName;
    @ApiModelProperty(value = "活动状态 1未开始 2已开始 3已结束")
    @TableField(exist = false)
    private Integer startState;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java
@@ -28,7 +28,7 @@
public interface OtherClient {
    //单位分页
    @PostMapping(value = "/t-invoice-type/t-company/unit/page")
    @PostMapping(value = "/t-company/unit/page")
    R<Page<TCompany>> queryUnitPage(@RequestBody UnitListQueryDto unitListQueryDto);
    //单位添加修改
    @PostMapping(value = "/t-company/unit/addOrUpdate")
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/WxPaymentClient.java
@@ -29,7 +29,7 @@
     * @return
     */
    @PostMapping("/wx/query/queryOrderInfo")
    R<NotifyV3PayDecodeRespBody> queryOrderInfo(String orderId);
    R<NotifyV3PayDecodeRespBody> queryOrderInfo(@RequestParam("orderId") String orderId);
    
    
    /**
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/PaymentOrder.java
@@ -29,5 +29,5 @@
    /**
     * 回调地址
     */
    private String notifyUrl ="http://192.168.110.80:9000/payment/wx/pay/notify";
    private String notifyUrl ="http://221.182.45.100:9000/payment/wx/pay/notify";
}
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/ExchangeDto.java
@@ -36,6 +36,10 @@
    BigDecimal discountPrice;
    @ApiModelProperty(hidden =true)
    BigDecimal vipDiscount;
    @ApiModelProperty(hidden =true)
    String title;
    @ApiModelProperty(hidden =true)
    String phone;
}
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/BasePage.java
@@ -23,9 +23,9 @@
    private Integer pageSize = 10;
    public Integer getPageCurr() {
        if(null != pageCurr){
            pageCurr = (pageCurr - 1) * pageSize;
        }
//        if(null != pageCurr){
//            pageCurr = (pageCurr - 1) * pageSize;
//        }
        return pageCurr;
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserIntegralChangeController.java
@@ -35,7 +35,7 @@
    @ResponseBody
    @PostMapping("/addAppUserIntegralChange")
    public R addAppUserIntegralChange(@RequestBody TAppUserIntegralChange appUserIntegralChange){
        String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
        String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
        appUserIntegralChange.setCode(code);
        appUserIntegralChangeService.save(appUserIntegralChange);
        return R.ok();
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserTagController.java
@@ -15,6 +15,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
 * <p>
@@ -44,6 +45,15 @@
        }
        return R.ok(data);
    }
    @ApiOperation(value = "标签管理列表", tags = {"用户管理-用户标签管理"})
    @GetMapping(value = "/tags/select")
    public R<List<TUserTag>> select() {
        TagListQueryDto tagListQueryDto = new TagListQueryDto();
        tagListQueryDto.setPageCurr(1);
        tagListQueryDto.setPageSize(999);
        R<Page<TUserTag>> pageR = otherClient.queryTagPage(tagListQueryDto);
        return R.ok(pageR.getData().getRecords());
    }
    @ApiOperation(value = "标签添加或修改", tags = {"用户管理-用户标签管理"})
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java
@@ -73,11 +73,17 @@
    @Override
    public List<ExchangeRecordVO> pagelist(ExchangeRecordGoodsQuery dto) {
        List<Integer> integers = new ArrayList<>();
        integers.add(1);
        integers.add(2);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        QueryWrapper<TAppCoupon> wrapper = new QueryWrapper<>();
        wrapper.eq("coupon_id",dto.getCouponId());
        wrapper.in("ways_to_obtain",integers);
        if (dto.getStatus()!=null){
            wrapper.eq("status",dto.getStatus());
        }
        List<TAppCoupon> tAppCoupons = this.baseMapper.selectList(wrapper);
        List<ExchangeRecordVO> list = new ArrayList<>();
        // 订单ids
        StringBuilder stringBuilder = new StringBuilder();
@@ -87,6 +93,8 @@
            list.add(exchangeRecordVO);
        }
        for (ExchangeRecordVO exchangeRecordVO : list) {
            TAppUser tAppUser = tAppUserMapper.selectById(exchangeRecordVO.getAppUserId());
            if (tAppUser!=null)exchangeRecordVO.setPhone(tAppUser.getPhone());
            switch (exchangeRecordVO.getWaysToObtain()){
                case 1:
                    if (exchangeRecordVO.getId()!=null){
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
@@ -367,9 +367,9 @@
    @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"})
    @PutMapping("/downloadSettlement")
    @Log(title = "【结算表记录】下载结算表", businessType = BusinessType.EXPORT)
    public R downloadSettlement(@RequestBody ExportUidDto uid,HttpServletResponse response)
    public R downloadSettlement(String uid,HttpServletResponse response)
    {
        TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid.getUid()).getData();
        TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid).getData();
        List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData();
        if (!data1.isEmpty()){
            data.setSiteName(data1.get(0).getName());
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
@@ -94,7 +94,12 @@
        return R.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class)
                .eq(TChargingPile::getSiteId,siteId)));
    }
    @PostMapping(value = "/getChargingPileBySiteIds")
    public R<List<TChargingPile>> getChargingPileBySiteIds(@RequestParam("siteIds") List<Integer> siteIds) {
        return R.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class)
                .in(!siteIds.isEmpty(),TChargingPile::getSiteId,siteIds)));
    }
    
    @ResponseBody
    @GetMapping("/pageChargingPileList")
@@ -161,7 +166,8 @@
        ChargeMonitoring chargeMonitoring = chargingPileService.chargeMonitoring(siteId);
        return AjaxResult.success(chargeMonitoring);
    }
    @ResponseBody
    @GetMapping("/getChargingGunCountMonitoring/{siteId}")
    @ApiOperation(value = "获取充电枪各种状态汇总监控数据", tags = {"管理后台-充电设备监控"})
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java
@@ -8,10 +8,9 @@
import com.ruoyi.chargingPile.api.model.TParkingLot;
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.chargingPile.api.query.ParkingRecordQuery;
import com.ruoyi.chargingPile.api.vo.GetParkingRecord;
import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO;
import com.ruoyi.chargingPile.api.vo.TParkingRecordVO;
import com.ruoyi.chargingPile.api.vo.*;
import com.ruoyi.chargingPile.dto.ParkingRecordPageQuery;
import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto;
import com.ruoyi.chargingPile.export.TParkingRecordExport;
import com.ruoyi.chargingPile.service.TParkingLotService;
import com.ruoyi.chargingPile.service.TParkingRecordService;
@@ -24,6 +23,7 @@
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.log.enums.OperatorType;
import com.ruoyi.order.api.query.TOrderInvoiceQuery;
import com.ruoyi.order.api.vo.TCharingUserEquimentVO;
import com.ruoyi.order.api.vo.TOrderInvoiceVO;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
@@ -34,9 +34,12 @@
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * <p>
@@ -182,5 +185,76 @@
    public void addParkingRecord(@RequestBody TParkingRecord parkingRecord){
        parkingRecordService.save(parkingRecord);
    }
    @ResponseBody
    @PostMapping(value = "/parking/data")
    @ApiOperation(value = "统计", tags = {"管理后台-数据分析-车场运营分析"})
    public R<TParkLotRecordVO> data(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){
        //上方折线图
        TParkLotRecordVO tParkLotRecordVO = new TParkLotRecordVO();
        if (parkingRecordQueryDto.getDayType()==1) {
            List<Map<String, Object>> maps = parkingRecordService.parkingData(parkingRecordQueryDto);
            tParkLotRecordVO.setMaps(maps);
        }else {
            List<Map<String, Object>> maps = parkingRecordService.parkingDataByDate(parkingRecordQueryDto);
            tParkLotRecordVO.setMaps(maps);
        }
        //车辆类型饼图
        List<Map<String, Object>> carColor  =   parkingRecordService.getCarColor(parkingRecordQueryDto);
        //出场类型
        List<Map<String, Object>> outType  =   parkingRecordService.getOutType(parkingRecordQueryDto);
        //进场充电占比
        List<Map<String, Object>> isCharge  =   parkingRecordService.getIsCharge(parkingRecordQueryDto);
        tParkLotRecordVO.setCarColor(carColor);
        tParkLotRecordVO.setOutType(outType);
        tParkLotRecordVO.setIsCharge(isCharge);
        return R.ok(tParkLotRecordVO);
    }
    @ResponseBody
    @PostMapping(value = "/parking/work")
    @ApiOperation(value = "停车订单统计", tags = {"管理后台-工作台"})
    public R<TParkLotRecordCountVo> work(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){
        List<TParkingRecord> list = parkingRecordService.lambdaQuery().eq(parkingRecordQueryDto.getParkingLotId() != null, TParkingRecord::getParkingLotId, parkingRecordQueryDto.getParkingLotId())
                .between(TParkingRecord::getCreateTime, parkingRecordQueryDto.getStartTime(), parkingRecordQueryDto.getEndTime()).list();
        int count1 = list.size();
        //统计出list中chargingOrderId为null的数据个数
        int count2 = list.stream().filter(item -> item.getChargingOrderId() == null).collect(Collectors.toList()).size();
        int count3 = count1-count2;
        //计算出list中parkingDuration的总和
        int count4 = 0;
        for (TParkingRecord tParkingRecord : list) {
            count4 = count4+tParkingRecord.getParkingDuration();
        }
        //计算出list中orderAmount的总和
        BigDecimal count5 = list.stream().map(TParkingRecord::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
        TParkLotRecordCountVo tParkLotRecordCountVo = new TParkLotRecordCountVo();
        tParkLotRecordCountVo.setCount1(count1);
        tParkLotRecordCountVo.setCount2(count2);
        tParkLotRecordCountVo.setCount3(count3);
        tParkLotRecordCountVo.setCount4(count4);
        tParkLotRecordCountVo.setCount5(count5);
        return R.ok(tParkLotRecordCountVo);
    }
    @ResponseBody
    @PostMapping(value = "/parking/income")
    @ApiOperation(value = "停车收入统计", tags = {"管理后台-工作台"})
    public R income(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){
       List<Map<String,Object>>  maps =  parkingRecordService.income(parkingRecordQueryDto);
        return R.ok(maps);
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/dto/ParkingRecordQueryDto.java
New file
@@ -0,0 +1,18 @@
package com.ruoyi.chargingPile.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
@Data
public class ParkingRecordQueryDto {
    @ApiModelProperty("停车场Id")
    private Integer parkingLotId;
    @ApiModelProperty("1今日2本周3本月4今年5自定义")
    private Integer dayType;
    @ApiModelProperty("开始时间")
    private LocalDate startTime;
    @ApiModelProperty("结束时间")
    private LocalDate endTime;
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TParkingRecordMapper.java
@@ -5,12 +5,14 @@
import com.ruoyi.chargingPile.api.query.ParkingRecordQuery;
import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO;
import com.ruoyi.chargingPile.api.vo.TParkingRecordVO;
import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto;
import com.ruoyi.common.core.web.page.PageInfo;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -39,4 +41,15 @@
     */
    TParkingRecordPageInfoVO getParkingRecordCount(@Param("query")ParkingRecordQuery query);
    List<Map<String, Object>> parkingData(@Param("parkingRecordQueryDto") ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> parkingDataByDate(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> getCarColor(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> getOutType(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> getIsCharge(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> income(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto);
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/TChargingPileService.java
@@ -89,7 +89,7 @@
     * @return
     */
    ChargeMonitoring chargeMonitoring(Integer siteId);
    
    /**
     * 获取充电枪各种状态汇总
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/TParkingRecordService.java
@@ -4,10 +4,13 @@
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.chargingPile.api.query.ParkingRecordQuery;
import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO;
import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto;
import com.ruoyi.common.core.web.page.PageInfo;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -27,4 +30,16 @@
     * @return
     */
    TParkingRecordPageInfoVO pageList(ParkingRecordQuery query);
    List<Map<String, Object>> parkingData(ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> parkingDataByDate(ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> getCarColor(ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> getOutType(ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> getIsCharge(ParkingRecordQueryDto parkingRecordQueryDto);
    List<Map<String, Object>> income(ParkingRecordQueryDto parkingRecordQueryDto);
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
@@ -351,7 +351,9 @@
        chargeMonitoring.setUtilizationTrend(utilizationTrend);
        return chargeMonitoring;
    }
    /**
     * 获取充电枪各种状态汇总
     * @param siteId 站点id
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java
@@ -10,6 +10,7 @@
import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO;
import com.ruoyi.chargingPile.api.vo.TParkingRecordVO;
import com.ruoyi.chargingPile.domain.SiteMenu;
import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto;
import com.ruoyi.chargingPile.mapper.SiteMapper;
import com.ruoyi.chargingPile.mapper.TParkingLotMapper;
import com.ruoyi.chargingPile.mapper.TParkingRecordMapper;
@@ -21,6 +22,7 @@
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -73,4 +75,34 @@
        infoVO.setParkingRecordVOS(pageInfo);
        return infoVO;
    }
    @Override
    public List<Map<String, Object>> parkingData(ParkingRecordQueryDto parkingRecordQueryDto) {
        return this.baseMapper.parkingData(parkingRecordQueryDto);
    }
    @Override
    public List<Map<String, Object>> parkingDataByDate(ParkingRecordQueryDto parkingRecordQueryDto) {
        return this.baseMapper.parkingDataByDate(parkingRecordQueryDto);
    }
    @Override
    public List<Map<String, Object>> getCarColor(ParkingRecordQueryDto parkingRecordQueryDto) {
        return this.baseMapper.getCarColor(parkingRecordQueryDto);
    }
    @Override
    public List<Map<String, Object>> getOutType(ParkingRecordQueryDto parkingRecordQueryDto) {
        return this.baseMapper.getOutType(parkingRecordQueryDto);
    }
    @Override
    public List<Map<String, Object>> getIsCharge(ParkingRecordQueryDto parkingRecordQueryDto) {
        return this.baseMapper.getIsCharge(parkingRecordQueryDto);
    }
    @Override
    public List<Map<String, Object>> income(ParkingRecordQueryDto parkingRecordQueryDto) {
        return this.baseMapper.income(parkingRecordQueryDto);
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml
@@ -82,5 +82,173 @@
        group by create_time
        ORDER BY create_time DESC
    </select>
    <select id="parkingData" resultType="java.util.Map">
        SELECT
            DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS TIME,
    count( 1 ) AS orders,
    SUM( timeout_amount ) AS timeoutAmount
        FROM
            t_parking_record
        where DATE(create_time ) = CURDATE()
        <if test="parkingRecordQueryDto.parkingLotId !=null">
            AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId}
        </if>
        GROUP BY
            TIME
        ORDER BY
            TIME
    </select>
    <select id="parkingDataByDate" resultType="java.util.Map">
        SELECT
            DATE_FORMAT( create_time, '%Y-%m-%d' ) AS TIME,
    count( 1 ) AS orders,
    SUM( timeout_amount ) AS timeoutAmount
        FROM
            t_parking_record
        <where>
            <if test="parkingRecordQueryDto.parkingLotId !=null">
                AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId}
            </if>
            <if test="parkingRecordQueryDto.dayType == 2">
                AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
            </if>
            <if test="parkingRecordQueryDto.dayType == 3">
                AND MONTH( co.create_time ) = MONTH(CURDATE())
            </if>
            <if test="parkingRecordQueryDto.dayType == 4">
                AND YEAR( co.create_time ) = YEAR(CURDATE() )
            </if>
            <if test="parkingRecordQueryDto.dayType == 5">
                <if test="parkingRecordQueryDto.startTime != null">
                    AND co.create_time >= #{parkingRecordQueryDto.startTime}
                </if>
                <if test="parkingRecordQueryDto.endTime != null">
                    AND co.create_time &lt;= #{parkingRecordQueryDto.endTime}
                </if>
            </if>
        </where>
        GROUP BY
            TIME
        ORDER BY
            TIME
    </select>
    <select id="getCarColor" resultType="java.util.Map">
        SELECT
            vehicle_color,count(1) as counts
        FROM
            t_parking_record
        <where>
            <if test="parkingRecordQueryDto.parkingLotId !=null">
                AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId}
            </if>
        <if test="parkingRecordQueryDto.dayType == 1">
            AND DATE( create_time ) = CURDATE()
        </if>
        <if test="parkingRecordQueryDto.dayType == 2">
            AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
        </if>
        <if test="parkingRecordQueryDto.dayType == 3">
            AND MONTH( co.create_time ) = MONTH(CURDATE())
        </if>
        <if test="parkingRecordQueryDto.dayType == 4">
            AND YEAR( co.create_time ) = YEAR(CURDATE() )
        </if>
        <if test="parkingRecordQueryDto.dayType == 5">
            <if test="parkingRecordQueryDto.startTime != null">
                AND co.create_time >= #{parkingRecordQueryDto.startTime}
            </if>
            <if test="parkingRecordQueryDto.endTime != null">
                AND co.create_time &lt;= #{parkingRecordQueryDto.endTime}
            </if>
        </if>
        </where>
        GROUP BY vehicle_color
    </select>
    <select id="getOutType" resultType="java.util.Map">
        SELECT
            out_parking_type,count(1) as counts
        FROM
            t_parking_record
        <where>
            <if test="parkingRecordQueryDto.parkingLotId !=null">
                AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId}
            </if>
            <if test="parkingRecordQueryDto.dayType == 1">
                AND DATE( create_time ) = CURDATE()
            </if>
            <if test="parkingRecordQueryDto.dayType == 2">
                AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
            </if>
            <if test="parkingRecordQueryDto.dayType == 3">
                AND MONTH( co.create_time ) = MONTH(CURDATE())
            </if>
            <if test="parkingRecordQueryDto.dayType == 4">
                AND YEAR( co.create_time ) = YEAR(CURDATE() )
            </if>
            <if test="parkingRecordQueryDto.dayType == 5">
                <if test="parkingRecordQueryDto.startTime != null">
                    AND co.create_time >= #{parkingRecordQueryDto.startTime}
                </if>
                <if test="parkingRecordQueryDto.endTime != null">
                    AND co.create_time &lt;= #{parkingRecordQueryDto.endTime}
                </if>
            </if>
        </where>
        GROUP BY out_parking_type
    </select>
    <select id="getIsCharge" resultType="java.util.Map">
        SELECT
            CASE
                WHEN charging_order_id IS NOT NULL THEN 'WithChargingOrder'
                ELSE 'WithoutChargingOrder'
                END AS order_status,
            COUNT(*) AS counts
        FROM
            `t_parking_record`
        <where>
            <if test="parkingRecordQueryDto.parkingLotId !=null">
                AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId}
            </if>
            <if test="parkingRecordQueryDto.dayType == 1">
                AND DATE( create_time ) = CURDATE()
            </if>
            <if test="parkingRecordQueryDto.dayType == 2">
                AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
            </if>
            <if test="parkingRecordQueryDto.dayType == 3">
                AND MONTH( co.create_time ) = MONTH(CURDATE())
            </if>
            <if test="parkingRecordQueryDto.dayType == 4">
                AND YEAR( co.create_time ) = YEAR(CURDATE() )
            </if>
            <if test="parkingRecordQueryDto.dayType == 5">
                <if test="parkingRecordQueryDto.startTime != null">
                    AND co.create_time >= #{parkingRecordQueryDto.startTime}
                </if>
                <if test="parkingRecordQueryDto.endTime != null">
                    AND co.create_time &lt;= #{parkingRecordQueryDto.endTime}
                </if>
            </if>
        </where>
        GROUP BY
            order_status
    </select>
    <select id="income" resultType="java.util.Map">
        SELECT sum(pr.order_amount) as amount,pl.name
        from t_parking_record pr
                 LEFT JOIN t_parking_lot pl on pr.parking_lot_id = pl.id
        <where>
            <if test="parkingRecordQueryDto.parkingLotId !=null">
                AND pr.parking_lot_id = #{parkingRecordQueryDto.parkingLotId}
            </if>
            AND DATE( pr.create_time ) between #{parkingRecordQueryDto.startTime} and #{parkingRecordQueryDto.endTime}
        </where>
        GROUP  BY pl.name
    </select>
</mapper>
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java
@@ -47,7 +47,7 @@
        TParkingRecord parkingRecord = new TParkingRecord();
        parkingRecord.setLicensePlate(order.getPlate());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String code = "TC" + Math.random() * 1000 + sdf.format(new Date());
        String code = "TC" + Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date());
        parkingRecord.setCode(code);
        parkingRecord.setVehicleColor(order.getPlateColor());
        TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData();
@@ -95,7 +95,7 @@
        TParkingRecord parkingRecord = new TParkingRecord();
        parkingRecord.setLicensePlate(order.getPlatenumber());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String code = "TC" + Math.random() * 1000 + sdf.format(new Date());
        String code = "TC" + Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date());
        parkingRecord.setCode(code);
        parkingRecord.setVehicleColor(order.getPlatecolor());
        TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData();
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java
@@ -82,8 +82,7 @@
    }
    @ApiOperation(value = "充电时段统计-导出", tags = {"管理后台-财务结算"})
    @PutMapping("/export")
    public void export(@RequestBody ChargingListQuery dto)
    {
    public void export(@RequestBody ChargingListQuery dto) {
        ChargingOrderTimeVO res = chargingOrderService.chargingList(dto);
        List<TChargingOrderExport> tChargingOrderExports = new ArrayList<>();
        List<ChargingOrderListVO> exportList = res.getExportList();
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -3,6 +3,7 @@
import com.google.common.collect.Lists;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -583,6 +584,16 @@
    }
    @ResponseBody
    @GetMapping(value = "/work/shop")
    @ApiOperation(value = "购物收入", tags = {"后台-工作台"})
    public R workShop(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) {
        //count近6个月的数据
        LocalDate sixBefore = PreviousSixMonths.get();
        List<Map<String,Object >> shopData =  shoppingOrderService.getData(statisticsQueryDto);
        return R.ok(shopData);
    }
    @ResponseBody
    @GetMapping(value = "/six/vip")
    @ApiOperation(value = "vip收入", tags = {"后台-数据分析-平台收入分析"})
    public R<List<SixVipDto>> vip() {
@@ -614,7 +625,7 @@
    @ResponseBody
    @PostMapping(value = "/watch/chargingOrder")
    @ApiOperation(value = "监控订单", tags = {"管理后台-订单管理"})
    public AjaxResult<TCharingOrderVO> watchChargingOrder(@RequestBody ChargingOrderQuery dto) {
    public R<List<ChargingOrderAndUploadRealTimeMonitoringDataDto>> watchChargingOrder(@RequestBody ChargingOrderQuery dto) {
        Integer page = dto.getPageCurr();
        Integer pageSize = dto.getPageSize();
        List<Long> data = appUserClient.getUserIdsByPhone(dto.getPhone()).getData();
@@ -641,7 +652,7 @@
        }
        return AjaxResult.success(res);
        return R.ok(dtos);
    }
    
    
@@ -849,18 +860,196 @@
        tCharingUserEvaluateVO.setBlackCount(count);
        //好评标签
       List<Map<String,Object>> goodTop = orderEvaluateService.goodTop(siteIds);
       //差评标签
        List<Map<String,Object>> badTop = orderEvaluateService.badTop(siteIds);
        //标签
        //查出好评ids
//        orderEvaluateService.goodTop();
        //流量分析
        List<Map<String,Object>> sourceMap = chargingOrderService.countBySource(siteIds);
        tCharingUserEvaluateVO.setGoodTop(goodTop);
        tCharingUserEvaluateVO.setBadTop(badTop);
        tCharingUserEvaluateVO.setFlow(sourceMap);
        //流量
        return R.ok(tCharingUserEvaluateVO);
    }
    @ResponseBody
    @PostMapping(value = "/charging/equipment")
    @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-设备运维分析"})
    public R<TCharingUserEquimentVO> equipment(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){
        List<Integer> siteIds =new ArrayList<>();
        if (statisticsQueryDto.getSiteId()==null) {
            Long userId = SecurityUtils.getUserId();
            //获取当前登录的siteIds
            List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData();
            for (GetSiteListDTO datum : data) {
                siteIds.add(datum.getId());
            }
        }else {
            siteIds.add(statisticsQueryDto.getSiteId());
        }
        //直流可用率
        List<Map<String,Object>> equipmentMap1 = chargingOrderService.equipmentUserType1(siteIds,statisticsQueryDto);
        //交流可用率
        List<Map<String,Object>> equipmentMap2= chargingOrderService.equipmentUserType2(siteIds,statisticsQueryDto);
        //直流故障率
        List<Map<String,Object>> equipmentMapbroke1 = chargingOrderService.equipmentMapbroke1(siteIds,statisticsQueryDto);
        //交流故障率
        List<Map<String,Object>> equipmentMapbroke2 = chargingOrderService.equipmentMapbroke2(siteIds,statisticsQueryDto);
        //直流离网率
        List<Map<String,Object>> equipmentMapOut1 = chargingOrderService.equipmentMapOut1(siteIds,statisticsQueryDto);
        //交流离网率
        List<Map<String,Object>> equipmentMapOut2 = chargingOrderService.equipmentMapOut2(siteIds,statisticsQueryDto);
        //需求电流满足率
        List<Map<String,Object>>  needElec =  chargingOrderService.needElec(siteIds,statisticsQueryDto);
        TCharingUserEquimentVO tCharingUserEquimentVO = new TCharingUserEquimentVO();
        tCharingUserEquimentVO.setEquipmentMap1(equipmentMap1);
        tCharingUserEquimentVO.setEquipmentMap2(equipmentMap2);
        tCharingUserEquimentVO.setEquipmentMapbroke1(equipmentMapbroke1);
        tCharingUserEquimentVO.setEquipmentMapbroke2(equipmentMapbroke2);
        tCharingUserEquimentVO.setEquipmentMapOut1(equipmentMapOut1);
        tCharingUserEquimentVO.setEquipmentMapOut2(equipmentMapOut2);
        tCharingUserEquimentVO.setNeedElec(needElec);
        return R.ok(tCharingUserEquimentVO);
    }
    @ResponseBody
    @PostMapping(value = "/work/charge")
    @ApiOperation(value = "上方充电数据统计", tags = {"管理后台-工作台"})
    public R<TCharingWorkVO> workCharge(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) {
        List<Integer> siteIds = new ArrayList<>();
        if (statisticsQueryDto.getSiteId() == null) {
            Long userId = SecurityUtils.getUserId();
            //获取当前登录的siteIds
            List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData();
            for (GetSiteListDTO datum : data) {
                siteIds.add(datum.getId());
            }
        } else {
            siteIds.add(statisticsQueryDto.getSiteId());
        }
        List<TChargingOrder> list = chargingOrderService.lambdaQuery().in(!siteIds.isEmpty(), TChargingOrder::getSiteId, siteIds).eq(statisticsQueryDto.getSiteId() != null, TChargingOrder::getSiteId, statisticsQueryDto.getSiteId()).list();
        //当日的订单总数
        int size = list.size();
        //计算list中paymentAmount的总和
        BigDecimal totalPaymentAmount = list.stream().map(TChargingOrder::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
        //计算list中electrovalence的总和
        BigDecimal totalElectrovalence = list.stream().map(TChargingOrder::getElectrovalence).reduce(BigDecimal.ZERO, BigDecimal::add);
        //计算list中serviceCharge的总和
        BigDecimal totalServiceCharge = list.stream().map(TChargingOrder::getServiceCharge).reduce(BigDecimal.ZERO, BigDecimal::add);
        //计算list中charging_capacity的总和
        BigDecimal totalChargingCapacity = list.stream().map(TChargingOrder::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add);
        TCharingWorkVO tCharingWorkVO = new TCharingWorkVO();
        tCharingWorkVO.setCount(size);
        tCharingWorkVO.setTotalPaymentAmount(totalPaymentAmount);
        tCharingWorkVO.setTotalElectrovalence(totalElectrovalence);
        tCharingWorkVO.setTotalServiceCharge(totalServiceCharge);
        tCharingWorkVO.setTotalChargingCapacity(totalChargingCapacity);
        return R.ok(tCharingWorkVO);
    }
    @ResponseBody
    @PostMapping(value = "/work/chargeDetail")
    @ApiOperation(value = "运营情况", tags = {"管理后台-工作台"})
    public R workCharge(@RequestBody ChargingDetailQueryDto statisticsQueryDto) {
        List<Integer> siteIds = new ArrayList<>();
        if (statisticsQueryDto.getSiteId() == null) {
            Long userId = SecurityUtils.getUserId();
            //获取当前登录的siteIds
            List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData();
            for (GetSiteListDTO datum : data) {
                siteIds.add(datum.getId());
            }
        } else {
            siteIds.add(statisticsQueryDto.getSiteId());
        }
        if (statisticsQueryDto.getDayType()==1) {
          List<Map<String,Object>> charMap = chargingOrderService.getHourType(siteIds,statisticsQueryDto);
          return R.ok(charMap);
        }else if (statisticsQueryDto.getDayType()==2){
            List<Map<String,Object>> charMap =  chargingOrderService.getDateType(siteIds,statisticsQueryDto);
            return R.ok(charMap);
        }else if (statisticsQueryDto.getDayType()==3){
            List<Map<String,Object>> charMap =  chargingOrderService.getMonthType(siteIds,statisticsQueryDto);
        }
        return R.ok();
    }
    @ResponseBody
    @PostMapping(value = "/work/use")
    @ApiOperation(value = "运营情况", tags = {"管理后台-工作台"})
    public R workUse(@RequestBody ChargingDetailQueryDto statisticsQueryDto) {
        List<Integer> siteIds = new ArrayList<>();
        if (statisticsQueryDto.getSiteId() == null) {
            Long userId = SecurityUtils.getUserId();
            //获取当前登录的siteIds
            List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData();
            for (GetSiteListDTO datum : data) {
                siteIds.add(datum.getId());
            }
        } else {
            siteIds.add(statisticsQueryDto.getSiteId());
        }
       List<Map<String,Object>>   capMap  =   chargingOrderService.getchargingCapacity(siteIds,statisticsQueryDto);
        List<TChargingPile> chargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData();
        //获取chargingPiles的ratedPower的总和再乘以chargingPiles的数量再乘以24
        BigDecimal totalRatedPower = chargingPiles.stream().map(TChargingPile::getRatedPower).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(new BigDecimal(chargingPiles.size())).multiply(new BigDecimal(24));
        //将capMap的chargingCapacity除以totalRatedPower保留两位数
        capMap.forEach(map -> {
            BigDecimal chargingCapacity = (BigDecimal) map.get("chargingCapacity");
            BigDecimal result = chargingCapacity.divide(totalRatedPower, 2, RoundingMode.HALF_UP);
            map.put("chargingCapacity", result);
        });
        return R.ok(capMap);
    }
    @Resource
    private TOrderInvoiceService invoiceService;
    @ResponseBody
    @PostMapping(value = "/work/shopOrder")
    @ApiOperation(value = "购物订单统计", tags = {"管理后台-工作台"})
    public R shopOrder(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) {
        Long count = shoppingOrderService.lambdaQuery().eq(TShoppingOrder::getStatus, 1).count();
        Long count1 = shoppingOrderService.lambdaQuery().eq(TShoppingOrder::getStatus, 2).count();
        List<Long> counts = new ArrayList<>();
        counts.add(count);
        counts.add(count1);
        return R.ok(counts);
    }
    @ResponseBody
    @PostMapping(value = "/work/invoice")
    @ApiOperation(value = "开票统计", tags = {"管理后台-工作台"})
    public R invoice(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) {
        Long count = invoiceService.lambdaQuery().eq(TOrderInvoice::getStatus, 1).count();
        Long count1 = invoiceService.lambdaQuery().eq(TOrderInvoice::getStatus, 3).count();
        List<Long> counts = new ArrayList<>();
        counts.add(count);
        counts.add(count1);
        return R.ok(counts);
    }
    @ResponseBody
    @PostMapping(value = "/work/users/count")
    @ApiOperation(value = "用户数量", tags = {"管理后台-工作台"})
    public R usersCount(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) {
       List<Map<String,Object>>  userMap  =    chargingOrderService.countAllUserData();
            return R.ok(userMap);
    }
    public static void main(String[] args) {
        // 示例数据
        List<TChargingOrder> list = getSampleData();
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java
@@ -84,9 +84,9 @@
    /**
     * 发票管理导出
     */
    @ApiOperation(value = "发票管理导出")
    @ApiOperation(value = "发票管理导出", tags = {"管理后台-发票管理"})
    @Log(title = "发票管理导出", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @PutMapping("/export")
    public void export(@RequestBody TOrderInvoiceQuery query)
    {
        List<TOrderInvoiceVO> list = orderInvoiceService.export(query);
@@ -94,7 +94,9 @@
        for (TOrderInvoiceVO orderInvoiceVO : list) {
            OrderInvoiceExport orderInvoiceExport = new OrderInvoiceExport();
            BeanUtils.copyProperties(orderInvoiceVO,orderInvoiceExport);
            orderInvoiceExport.setBillingTime(DateUtils.localDateTimeToString(orderInvoiceVO.getBillingTime()));
            if (orderInvoiceVO.getBillingTime()!=null){
                orderInvoiceExport.setBillingTime(DateUtils.localDateTimeToString(orderInvoiceVO.getBillingTime()));
            }
            orderInvoiceExports.add(orderInvoiceExport);
        }
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), OrderInvoiceExport.class, orderInvoiceExports);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java
@@ -280,6 +280,7 @@
    @PostMapping("/create")
    public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto){
        TShoppingOrder shoppingOrder = new TShoppingOrder();
        shoppingOrder.setTitle(exchangeDto.getTitle());
        shoppingOrder.setCode(OrderCodeUtil.getOrderCode("GW"));
        shoppingOrder.setAppUserId(exchangeDto.getUserId());
        shoppingOrder.setOrderType(exchangeDto.getGoodType());
@@ -302,6 +303,7 @@
        shoppingOrder.setPaymentType(exchangeDto.getPayMethod());
        shoppingOrder.setRemark(exchangeDto.getRemark());
        shoppingOrder.setStatus(1);
        shoppingOrder.setPhone(exchangeDto.getPhone());
        shoppingOrder.setCreateTime(LocalDateTime.now());
        shoppingOrder.setDelFlag(false);
        shoppingOrderService.save(shoppingOrder);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ChargingDetailQueryDto.java
New file
@@ -0,0 +1,23 @@
package com.ruoyi.order.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
@Data
public class ChargingDetailQueryDto {
    @ApiModelProperty("电站id")
    private Integer siteId;
    @ApiModelProperty("1时2日3月")
    private Integer dayType;
    @ApiModelProperty("1开始或2结束")
    private Integer type;
    @ApiModelProperty("时用Date")
    private LocalDate hourDate;
    @ApiModelProperty("开始时间")
    private LocalDate startTime;
    @ApiModelProperty("结束时间")
    private LocalDate endTime;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/ChargingStatisticsQueryDto.java
@@ -15,4 +15,6 @@
    private LocalDate startTime;
    @ApiModelProperty("结束时间")
    private LocalDate endTime;
    @ApiModelProperty("工作台用查询参数")
    private LocalDate selectDate;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java
@@ -107,4 +107,30 @@
    Long getAver(List<Integer> siteIds);
    List<Map<String, Object>> getLevelEvaluate(List<Integer> siteIds);
    List<Map<String, Object>> countBySource(List<Integer> siteIds);
    List<Map<String, Object>> equipmentUserType1(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentUserType2(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentMapbroke1(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentMapbroke2(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentMapOut1(@Param("siteIds")List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentMapOut2(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> needElec(@Param("siteIds")List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> getHourType(@Param("siteIds")List<Integer> siteIds, @Param("statisticsQueryDto")ChargingDetailQueryDto statisticsQueryDto);
    List<Map<String, Object>> getDateType(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingDetailQueryDto statisticsQueryDto);
    List<Map<String, Object>> getMonthType(@Param("siteIds")List<Integer> siteIds, @Param("statisticsQueryDto")ChargingDetailQueryDto statisticsQueryDto);
    List<Map<String, Object>> getchargingCapacity(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingDetailQueryDto statisticsQueryDto);
    List<Map<String, Object>> countAllUserData();
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java
@@ -49,4 +49,8 @@
     * @return
     */
    List<TOrderEvaluateVO> getOrderEvaluateBySiteId(@Param("siteId")Integer siteId);
    List<Map<String, Object>> goodTop(List<Integer> siteIds);
    List<Map<String, Object>> badTop(List<Integer> siteIds);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TShoppingOrderMapper.java
@@ -6,6 +6,7 @@
import com.ruoyi.order.api.query.ShoppingOrderQuery;
import com.ruoyi.order.api.query.TActivityStatisticsQuery;
import com.ruoyi.order.api.vo.TActivityStatisticslVO;
import com.ruoyi.order.dto.ChargingStatisticsQueryDto;
import com.ruoyi.order.dto.SixShopDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -13,6 +14,7 @@
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -44,4 +46,6 @@
    List<SixShopDto> sixBefore(@Param("sixBefore")LocalDate sixBefore,@Param("status") Integer status);
    BigDecimal getSumAmount(@Param("sixBefore")LocalDate sixBefore);
    List<Map<String, Object>> getData(@Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java
@@ -200,4 +200,30 @@
    PageInfo<TSettlementConfirm> settlementList(SettlementListQuery dto);
    SettlementTotalVO settlementTotal(String time);
    List<Map<String, Object>> countBySource(List<Integer> siteIds);
    List<Map<String, Object>> equipmentUserType1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentUserType2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentMapbroke1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentMapbroke2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentMapOut1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> equipmentMapOut2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> needElec(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
    List<Map<String, Object>> getHourType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto);
    List<Map<String, Object>> getDateType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto);
    List<Map<String, Object>> getMonthType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto);
    List<Map<String, Object>> getchargingCapacity(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto);
    List<Map<String, Object>> countAllUserData();
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java
@@ -15,6 +15,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -69,4 +70,8 @@
     * @return
     */
    OrderEvaluateVo getOrderEvaluate(Integer orderId, Integer orderType);
    List<Map<String, Object>> goodTop(List<Integer> siteIds);
    List<Map<String, Object>> badTop(List<Integer> siteIds);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderService.java
@@ -80,4 +80,6 @@
    List<SixShopDto> sixBefore(LocalDate sixBefore, Integer status);
    BigDecimal getSumAmount(LocalDate sixBefore);
    List<Map<String, Object>> getData(ChargingStatisticsQueryDto statisticsQueryDto);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -417,7 +417,7 @@
        //构建新的待支付订单
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        TChargingOrder chargingOrder = new TChargingOrder();
        String code = "CD" + Math.random() * 1000 + sdf.format(new Date());
        String code = "CD" + Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date());
        chargingOrder.setCode(code);
        chargingOrder.setOrderType(1);
        chargingOrder.setOrderClassification(1);
@@ -633,7 +633,7 @@
            TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund();
            chargingOrderRefund.setChargingOrderId(chargingOrder.getId());
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
            chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Math.random() * 1000));
            chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + Double.valueOf(Math.random() * 1000).intValue());
            chargingOrderRefund.setRefundAmount(rechargeAmount);
            chargingOrderRefund.setRefundStatus(1);
            chargingOrderRefund.setPayType(rechargePaymentType);
@@ -844,7 +844,7 @@
            }
            TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData();
            TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange();
            String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
            String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
            appUserIntegralChange.setCode(code);
            appUserIntegralChange.setAppUserId(appUser.getInviteUserId());
            appUserIntegralChange.setChangeType(5);
@@ -943,7 +943,7 @@
            TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund();
            chargingOrderRefund.setChargingOrderId(chargingOrder.getId());
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
            chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Math.random() * 1000));
            chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue()));
            chargingOrderRefund.setRefundAmount(refundAmount);
            chargingOrderRefund.setRefundStatus(1);
            chargingOrderRefund.setPayType(rechargePaymentType);
@@ -1611,7 +1611,7 @@
            }
            TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData();
            TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange();
            String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
            String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
            appUserIntegralChange.setCode(code);
            appUserIntegralChange.setAppUserId(appUser.getInviteUserId());
            appUserIntegralChange.setChangeType(5);
@@ -1717,7 +1717,7 @@
                chargingOrderRefund.setRefundTime(LocalDateTime.now());
                chargingOrderRefund.setCode(tChargingOrder.getCode());
                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
                chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000));
                chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue()));
                chargingOrderRefund.setRefundTitle("后台退款");
                chargingOrderRefund.setRefundContent("后台退款");
                chargingOrderRefund.setRefundReason("后台退款");
@@ -1907,7 +1907,7 @@
            tSettlementConfirm.setVenue(dto.getVenue());
            tSettlementConfirm.setMetering(dto.getMetering());
            tSettlementConfirm.setClean(dto.getClean());
            tSettlementConfirm.setLossElectronic(dto.getLossElectronic());
            tSettlementConfirm.setLossElectronic(dto.getMeteringElectronic().subtract(dto.getChargingElectronic()));
            tSettlementConfirm.setMaintain(dto.getMaintain());
            tSettlementConfirm.setMeteringElectronic(dto.getMeteringElectronic());
@@ -1934,14 +1934,15 @@
        List<TSettlementConfirm> list = tSettlementConfirmMapper.settlementList(pageInfo,dto);
        for (TSettlementConfirm tSettlementConfirm : list) {
            tSettlementConfirm.setUid(tSettlementConfirm.getId().toString());
            Partner data = siteClient.getPartnerR(tSettlementConfirm.getPartnerId()).getData();
            List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(tSettlementConfirm.getSiteId())).getData();
            if (!data1.isEmpty()){
                tSettlementConfirm.setSiteName(data1.get(0).getName());
                Partner data = siteClient.getPartnerR(data1.get(0).getPartnerId()).getData();
                if (data!=null){
                    tSettlementConfirm.setPartnerName(data.getName());
                }
            }
            if (data!=null){
                tSettlementConfirm.setPartnerName(data.getName());
            }
            String format = tSettlementConfirm.getStartTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss"));
            String format1 = tSettlementConfirm.getEndTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss"));
            tSettlementConfirm.setTime(format+"至"+format1);
@@ -2134,6 +2135,71 @@
        return res;
    }
    @Override
    public List<Map<String, Object>> countBySource(List<Integer> siteIds) {
        return this.baseMapper.countBySource(siteIds);
    }
    @Override
    public List<Map<String, Object>> equipmentUserType1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
        return this.baseMapper.equipmentUserType1(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> equipmentUserType2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
        return this.baseMapper.equipmentUserType2(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> equipmentMapbroke1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
        return this.baseMapper.equipmentMapbroke1(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> equipmentMapbroke2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
        return this.baseMapper.equipmentMapbroke2(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> equipmentMapOut1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
        return this.baseMapper.equipmentMapOut1(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> equipmentMapOut2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
        return this.baseMapper.equipmentMapOut2(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> needElec(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
        return this.baseMapper.needElec(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> getHourType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto) {
        return this.baseMapper.getHourType(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> getDateType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto) {
        return this.baseMapper.getDateType(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> getMonthType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto) {
        return this.baseMapper.getMonthType(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> getchargingCapacity(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto) {
        return this.baseMapper.getchargingCapacity(siteIds,statisticsQueryDto);
    }
    @Override
    public List<Map<String, Object>> countAllUserData() {
        return this.baseMapper.countAllUserData();
    }
    public static void main(String[] args) {
//        String format = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss"));
//        String format1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss"));
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TExchangeOrderServiceImpl.java
@@ -75,7 +75,8 @@
            wrapper.eq(TExchangeOrder::getStatus, query.getStatus());
        }
        long count = this.count(wrapper);
        List<TExchangeOrder> list = this.list(wrapper.orderByDesc(TExchangeOrder::getCreateTime).last(" limit " + query.getPageCurr() + "," + query.getPageSize()));
        Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize();
        List<TExchangeOrder> list = this.list(wrapper.orderByDesc(TExchangeOrder::getCreateTime).last(" limit " + pageCurr + "," + query.getPageSize()));
        List<MyExchangeOrderList> pageList = new ArrayList<>();
        for (TExchangeOrder tExchangeOrder : list) {
            MyExchangeOrderList exchangeOrderList = new MyExchangeOrderList();
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
@@ -309,4 +309,14 @@
        }
        return null;
    }
    @Override
    public List<Map<String, Object>> goodTop(List<Integer> siteIds) {
        return this.baseMapper.goodTop(siteIds);
    }
    @Override
    public List<Map<String, Object>> badTop(List<Integer> siteIds) {
        return this.baseMapper.badTop(siteIds);
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java
@@ -117,7 +117,7 @@
            return AjaxResult.error("不能重复申请开票,请刷新数据后重试");
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String code = Math.random() * 1000 + sdf.format(new Date());
        String code = Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date());
        addOrderInvoice.setAppUserId(userId);
        addOrderInvoice.setCode(code);
        addOrderInvoice.setStatus(1);
@@ -155,9 +155,10 @@
    @Override
    public List<OrderInvoiceList> getMyOrderInvoiceList(GetOrderInvoiceList query) {
        Long userId = tokenService.getLoginUserApplet().getUserId();
        Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize();
        List<TOrderInvoice> list = this.list(new LambdaQueryWrapper<TOrderInvoice>().eq(TOrderInvoice::getAppUserId, userId)
                .eq(TOrderInvoice::getStatus, query.getStatus()).orderByDesc(TOrderInvoice::getCreateTime)
                .last(" limit " + query.getPageCurr() + ", " + query.getPageSize()));
                .last(" limit " + pageCurr + ", " + query.getPageSize()));
        List<OrderInvoiceList> pageList = new ArrayList<>();
        for (TOrderInvoice tOrderInvoice : list) {
            OrderInvoiceList orderInvoiceList = new OrderInvoiceList();
@@ -247,12 +248,15 @@
    @Override
    public PageInfo<TOrderInvoiceVO> pageList(TOrderInvoiceQuery query) {
        List<TAppUser> tAppUsers = new ArrayList<>();
        // 查询申请用户
        List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData();
        if(CollectionUtils.isEmpty(userList)){
            return new PageInfo<>();
        if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){
             tAppUsers = appUserClient.selectByPhoneLike(query.getUserPhone()).getData();
            if(CollectionUtils.isEmpty(tAppUsers)){
                return new PageInfo<>();
            }
        }
        query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList()));
        query.setUserIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()));
        PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize());
        List<TOrderInvoiceVO> list = this.baseMapper.pageList(query,pageInfo);
        for (TOrderInvoiceVO tOrderInvoiceVO : list) {
@@ -269,14 +273,17 @@
        List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>()
                .in(TOrderInvoiceDetail::getOrderInvoiceId, ids));
        List<TAppUser> finalTAppUsers = tAppUsers;
        list.forEach(e->{
            e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff());
            e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff());
            e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff());
            e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get());
            e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get());
            e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get());
            e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone());
            e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get());
            e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get());
            e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get());
            if (e.getBillingUserId()!=null){
                e.setUserPhone(finalTAppUsers.stream().filter(t->t.getId()!=null).filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone());
            }
        });
        pageInfo.setRecords(list);
@@ -286,39 +293,50 @@
    @Override
    public Map<String, Integer> statusCount(TOrderInvoiceQuery query) {
        Map<String, Integer> map = new HashMap<>();
        List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData();
        if(CollectionUtils.isEmpty(userList)){
            map.put("notAccepted",0);
            map.put("processing",0);
            map.put("finished",0);
            return map;
        List<TAppUser> tAppUsers = new ArrayList<>();
        if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){
    tAppUsers = appUserClient.selectByPhoneLike(query.getUserPhone()).getData();
            if(CollectionUtils.isEmpty(tAppUsers)){
                map.put("notAccepted",0);
                map.put("processing",0);
                map.put("finished",0);
                return map;
            }
        }
        query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList()));
        query.setUserIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()));
        map = this.baseMapper.statusCount(query);
        return map;
    }
    @Override
    public List<TOrderInvoiceVO> export(TOrderInvoiceQuery query) {
        List<TAppUser> tAppUsers = new ArrayList<>();
        // 查询申请用户
        List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData();
        if(CollectionUtils.isEmpty(userList)){
            return new ArrayList<>();
        if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){
            tAppUsers = appUserClient.selectByPhoneLike(query.getUserPhone()).getData();
            if(CollectionUtils.isEmpty(tAppUsers)){
                return new ArrayList<TOrderInvoiceVO>();
            }
        }
        query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList()));
        query.setUserIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()));
        PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize());
        List<TOrderInvoiceVO> list = this.baseMapper.export(query);
        List<Long> ids = list.stream().map(TOrderInvoiceVO::getId).collect(Collectors.toList());
        List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>()
                .in(TOrderInvoiceDetail::getOrderInvoiceId, ids));
        List<TAppUser> finalTAppUsers = tAppUsers;
        list.forEach(e->{
            e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff());
            e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff());
            e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff());
            e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get());
            e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get());
            e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get());
            e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone());
            e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get());
            e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get());
            e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get());
            if (e.getBillingUserId()!=null){
                e.setUserPhone(finalTAppUsers.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone());
            }
        });
        return list;
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java
@@ -201,7 +201,8 @@
            wrapper.eq(TShoppingOrder::getStatus, query.getStatus());
        }
        long count = this.count(wrapper);
        List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + query.getPageCurr() + ", " + query.getPageSize()));
        Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize();
        List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + pageCurr + ", " + query.getPageSize()));
        List<MyShoppingOrderList> pageList = new ArrayList<>();
        for (TShoppingOrder tShoppingOrder : list) {
            MyShoppingOrderList myShoppingOrderList = new MyShoppingOrderList();
@@ -347,7 +348,7 @@
        shoppingOrderRefund.setPayType(shoppingOrder.getPaymentType());
        shoppingOrderRefund.setShoppingOrderId(shoppingOrder.getId());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        shoppingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000));
        shoppingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + Double.valueOf((Math.random() * 1000)).intValue());
        shoppingOrderRefund.setRefundAmount(refundAmount);
        shoppingOrderRefund.setRefundStatus(1);
        shoppingOrderRefund.setCode(shoppingOrder.getCode());
@@ -447,7 +448,8 @@
    @Override
    public List<MyShoppingOrderList> getNoInvoicedOrder(GetNoInvoicedOrder query) {
        Long userId = tokenService.getLoginUserApplet().getUserId();
        List<TShoppingOrder> list = this.baseMapper.getNoInvoicedOrder(userId, query.getMonth(), query.getPageCurr(), query.getPageSize());
        Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize();
        List<TShoppingOrder> list = this.baseMapper.getNoInvoicedOrder(userId, query.getMonth(), pageCurr, query.getPageSize());
        List<MyShoppingOrderList> pageList = new ArrayList<>();
        for (TShoppingOrder tShoppingOrder : list) {
            MyShoppingOrderList myShoppingOrderList = new MyShoppingOrderList();
@@ -546,5 +548,10 @@
        return this.baseMapper.getSumAmount(sixBefore);
    }
    @Override
    public List<Map<String, Object>> getData(ChargingStatisticsQueryDto statisticsQueryDto) {
        return this.baseMapper.getData(statisticsQueryDto);
    }
}
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingBillMapper.xml
@@ -19,6 +19,7 @@
            and t1.id = #{req.uid}
        </if>
        and t1.billType = 1
        and t1.del_flag = 0
    </select>
    <select id="chargingBillList1" resultType="com.ruoyi.order.api.vo.ChargingBillListVO">
    select t1.* from t_charging_bill t1
@@ -36,5 +37,6 @@
            and t1.id = #{req.uid}
        </if>
        and t1.billType = 2
        and t1.del_flag = 0
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -125,7 +125,9 @@
        (payment_amount-refund_amount) as final_amount,
        del_flag
        FROM
        charging_pile_order.t_charging_order UNION ALL
        charging_pile_order.t_charging_order
        where  recharge_payment_status = 2
        UNION ALL
        SELECT
        id,
        `code`,
@@ -142,7 +144,9 @@
        (payment_amount-refund_amount) as final_amount,
        del_flag
        FROM
        charging_pile_order.t_shopping_order UNION ALL
        charging_pile_order.t_shopping_order
        where payment_status = 2
        UNION ALL
        SELECT
        id,
        `code`,
@@ -158,8 +162,11 @@
        refund_status,
        (payment_amount-refund_amount) as final_amount,
        del_flag
        FROM
        charging_pile_order.t_vip_order UNION ALL
        charging_pile_order.t_vip_order
        where  payment_status = 2
        UNION ALL
        SELECT
        id,
        `code`,
@@ -863,5 +870,557 @@
            and (t1.end_time between #{endTime1} and #{endTime2})
        </if>
    </select>
    <select id="countBySource" resultType="java.util.Map">
            select
                count(1) as counts,
              source_name as source
            from t_charging_order
            where 1=1
        del_flag = 0
        AND recharge_payment_status = 2
            <if test="siteIds != null and siteIds.size() > 0">
                and site_id IN
                <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                    #{siteId}
                </foreach>
            </if>
            group by source_name
    </select>
    <select id="equipmentUserType1" resultType="java.util.Map">
        SELECT
            FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.start_time)) /
                       <if test="statisticsQueryDto.dayType == 1">
                           86400
                       </if>
                   <if test="statisticsQueryDto.dayType == 2">
                       604800
                   </if>
                   <if test="statisticsQueryDto.dayType == 3">
                       2592000
                   </if>
                   <if test="statisticsQueryDto.dayType == 4">
                       31536000
                   </if>
                   <if test="statisticsQueryDto.dayType == 5">
                       (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
                       ))
                   </if>
                   ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as siteName
        FROM
            `charging_pile_order`.`t_charging_order` co
                LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
                LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
        WHERE
            co.start_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1
        <if test="siteIds != null and siteIds.size() > 0">
            and co.site_id IN
            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                #{siteId}
            </foreach>
        </if>
        <if test="statisticsQueryDto.dayType == 1">
            AND DATE( co.create_time ) = CURDATE()
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            AND MONTH( co.create_time ) = MONTH(CURDATE())
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            AND YEAR( co.create_time ) = YEAR(CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            <if test="statisticsQueryDto.startTime != null">
                AND co.create_time >= #{statisticsQueryDto.startTime}
            </if>
            <if test="statisticsQueryDto.endTime != null">
                AND co.create_time &lt;= #{statisticsQueryDto.endTime}
            </if>
        </if>
        GROUP BY tc.name,cp.name,co.charging_gun_id
    </select>
    <select id="equipmentUserType2" resultType="java.util.Map">
        SELECT
        FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.start_time)) /
        <if test="statisticsQueryDto.dayType == 1">
            86400
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            604800
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            2592000
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            31536000
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
            ))
        </if>
        ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as siteName
        FROM
        `charging_pile_order`.`t_charging_order` co
        LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
        LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
        WHERE
        co.start_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2
        <if test="siteIds != null and siteIds.size() > 0">
            and co.site_id IN
            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                #{siteId}
            </foreach>
        </if>
        <if test="statisticsQueryDto.dayType == 1">
            AND DATE( co.create_time ) = CURDATE()
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            AND MONTH( co.create_time ) = MONTH(CURDATE())
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            AND YEAR( co.create_time ) = YEAR(CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            <if test="statisticsQueryDto.startTime != null">
                AND co.create_time >= #{statisticsQueryDto.startTime}
            </if>
            <if test="statisticsQueryDto.endTime != null">
                AND co.create_time &lt;= #{statisticsQueryDto.endTime}
            </if>
        </if>
        GROUP BY tc.name,cp.name,co.charging_gun_id
    </select>
    <select id="equipmentMapbroke1" resultType="java.util.Map">
        SELECT
            FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) /
        <if test="statisticsQueryDto.dayType == 1">
            86400
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            604800
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            2592000
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            31536000
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
            ))
        </if>
                   ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1
        FROM
            `charging_pile_service`.`t_fault_message` co
                LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
                LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
        WHERE
            co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =2
        <if test="siteIds != null and siteIds.size() > 0">
            and co.site_id IN
            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                #{siteId}
            </foreach>
        </if>
        <if test="statisticsQueryDto.dayType == 1">
            AND DATE( co.create_time ) = CURDATE()
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            AND MONTH( co.create_time ) = MONTH(CURDATE())
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            AND YEAR( co.create_time ) = YEAR(CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            <if test="statisticsQueryDto.startTime != null">
                AND co.create_time >= #{statisticsQueryDto.startTime}
            </if>
            <if test="statisticsQueryDto.endTime != null">
                AND co.create_time &lt;= #{statisticsQueryDto.endTime}
            </if>
        </if>
        GROUP BY tc.name,cp.name,co.charging_gun_id
    </select>
    <select id="equipmentMapbroke2" resultType="java.util.Map">
        SELECT
        FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) /
        <if test="statisticsQueryDto.dayType == 1">
            86400
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            604800
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            2592000
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            31536000
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
            ))
        </if>
        ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1
        FROM
        `charging_pile_service`.`t_fault_message` co
        LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
        LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
        WHERE
        co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =2
        <if test="siteIds != null and siteIds.size() > 0">
            and co.site_id IN
            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                #{siteId}
            </foreach>
        </if>
        <if test="statisticsQueryDto.dayType == 1">
            AND DATE( co.create_time ) = CURDATE()
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            AND MONTH( co.create_time ) = MONTH(CURDATE())
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            AND YEAR( co.create_time ) = YEAR(CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            <if test="statisticsQueryDto.startTime != null">
                AND co.create_time >= #{statisticsQueryDto.startTime}
            </if>
            <if test="statisticsQueryDto.endTime != null">
                AND co.create_time &lt;= #{statisticsQueryDto.endTime}
            </if>
        </if>
        GROUP BY tc.name,cp.name,co.charging_gun_id
    </select>
    <select id="equipmentMapOut1" resultType="java.util.Map">
        SELECT
        FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) /
        <if test="statisticsQueryDto.dayType == 1">
            86400
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            604800
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            2592000
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            31536000
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
            ))
        </if>
        ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1
        FROM
        `charging_pile_service`.`t_fault_message` co
        LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
        LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
        WHERE
        co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1
        <if test="siteIds != null and siteIds.size() > 0">
            and co.site_id IN
            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                #{siteId}
            </foreach>
        </if>
        <if test="statisticsQueryDto.dayType == 1">
            AND DATE( co.create_time ) = CURDATE()
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            AND MONTH( co.create_time ) = MONTH(CURDATE())
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            AND YEAR( co.create_time ) = YEAR(CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            <if test="statisticsQueryDto.startTime != null">
                AND co.create_time >= #{statisticsQueryDto.startTime}
            </if>
            <if test="statisticsQueryDto.endTime != null">
                AND co.create_time &lt;= #{statisticsQueryDto.endTime}
            </if>
        </if>
        GROUP BY tc.name,cp.name,co.charging_gun_id
    </select>
    <select id="equipmentMapOut2" resultType="java.util.Map">
        SELECT
        FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) /
        <if test="statisticsQueryDto.dayType == 1">
            86400
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            604800
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            2592000
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            31536000
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
            ))
        </if>
        ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1
        FROM
        `charging_pile_service`.`t_fault_message` co
        LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
        LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
        WHERE
        co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =1
        <if test="siteIds != null and siteIds.size() > 0">
            and co.site_id IN
            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                #{siteId}
            </foreach>
        </if>
        <if test="statisticsQueryDto.dayType == 1">
            AND DATE( co.create_time ) = CURDATE()
        </if>
        <if test="statisticsQueryDto.dayType == 2">
            AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 3">
            AND MONTH( co.create_time ) = MONTH(CURDATE())
        </if>
        <if test="statisticsQueryDto.dayType == 4">
            AND YEAR( co.create_time ) = YEAR(CURDATE() )
        </if>
        <if test="statisticsQueryDto.dayType == 5">
            <if test="statisticsQueryDto.startTime != null">
                AND co.create_time >= #{statisticsQueryDto.startTime}
            </if>
            <if test="statisticsQueryDto.endTime != null">
                AND co.create_time &lt;= #{statisticsQueryDto.endTime}
            </if>
        </if>
        GROUP BY tc.name,cp.name,co.charging_gun_id
    </select>
    <select id="needElec" resultType="java.util.Map">
        SELECT
            FORMAT((SUM(co.current) / SUM(co.need_elec)), 2) AS percent,
            co.charging_gun_id,
            tc.name,
            cp.name AS gun_name
        FROM
            `charging_pile_order`.`t_charging_order` co
                LEFT JOIN `charging_pile_service`.`t_charging_gun` tc ON co.charging_gun_id = tc.id
                LEFT JOIN `charging_pile_service`.`t_charging_pile` cp ON tc.charging_pile_id = cp.id
        <where>
            <if test="siteIds != null and siteIds.size() > 0">
                and co.site_id IN
                <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                    #{siteId}
                </foreach>
            </if>
            <if test="statisticsQueryDto.dayType == 1">
                AND DATE( co.create_time ) = CURDATE()
            </if>
            <if test="statisticsQueryDto.dayType == 2">
                AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() )
            </if>
            <if test="statisticsQueryDto.dayType == 3">
                AND MONTH( co.create_time ) = MONTH(CURDATE())
            </if>
            <if test="statisticsQueryDto.dayType == 4">
                AND YEAR( co.create_time ) = YEAR(CURDATE() )
            </if>
            <if test="statisticsQueryDto.dayType == 5">
                <if test="statisticsQueryDto.startTime != null">
                    AND co.create_time >= #{statisticsQueryDto.startTime}
                </if>
                <if test="statisticsQueryDto.endTime != null">
                    AND co.create_time &lt;= #{statisticsQueryDto.endTime}
                </if>
            </if>
        </where>
        GROUP BY
            tc.name,
            cp.name,
            co.charging_gun_id;
    </select>
    <select id="getHourType" resultType="java.util.Map">
        SELECT
            DATE_FORMAT(
        <if test="statisticsQueryDto.type == 1">
            start_time
        </if>
        <if test="statisticsQueryDto.type == 2">
            end_time
        </if>
        , '%Y-%m-%d %H' ) as time,
    SUM(service_charge) as servicecharge,
    SUM(electrovalence) as electrovalence,
    count(1) as orderCount
        FROM
            t_charging_order
        WHERE     del_flag = 0 and recharge_payment_status = 2  and DATE(
        <if test="statisticsQueryDto.type == 1">
            start_time
        </if>
        <if test="statisticsQueryDto.type == 2">
            end_time
        </if>
        ) = #{statisticsQueryDto.hourDate}
        <if test="siteIds != null and siteIds.size() > 0">
            and site_id IN
            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                #{siteId}
            </foreach>
        </if>
        GROUP BY
            time
        ORDER BY
            time
    </select>
    <select id="getDateType" resultType="java.util.Map">
        SELECT
        DATE_FORMAT(
        <if test="statisticsQueryDto.type == 1">
            start_time
        </if>
        <if test="statisticsQueryDto.type == 2">
            end_time
        </if>
        , '%Y-%m-%d' ) as time,
        SUM(service_charge) as servicecharge,
        SUM(electrovalence) as electrovalence,
        count(1) as orderCount
        FROM
        t_charging_order
        WHERE     del_flag = 0 and recharge_payment_status = 2  and DATE(
        <if test="statisticsQueryDto.type == 1">
            start_time
        </if>
        <if test="statisticsQueryDto.type == 2">
            end_time
        </if>
        ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime}
        <if test="siteIds != null and siteIds.size() > 0">
            and site_id IN
            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                #{siteId}
            </foreach>
        </if>
        GROUP BY
        time
        ORDER BY
        time
    </select>
    <select id="getMonthType" resultType="java.util.Map">
        SELECT
        DATE_FORMAT(
        <if test="statisticsQueryDto.type == 1">
            start_time
        </if>
        <if test="statisticsQueryDto.type == 2">
            end_time
        </if>
        , '%Y-%m' ) as time,
        SUM(service_charge) as servicecharge,
        SUM(electrovalence) as electrovalence,
        count(1) as orderCount
        FROM
        t_charging_order
        WHERE     del_flag = 0 and recharge_payment_status = 2  and DATE(
        <if test="statisticsQueryDto.type == 1">
            start_time
        </if>
        <if test="statisticsQueryDto.type == 2">
            end_time
        </if>
        ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime}
        <if test="siteIds != null and siteIds.size() > 0">
            and site_id IN
            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
                #{siteId}
            </foreach>
        </if>
        GROUP BY
        time
        ORDER BY
        time
    </select>
    <select id="getchargingCapacity" resultType="java.util.Map">
        SELECT
            DATE_FORMAT( create_time, '%Y-%m-%d %H' ) as time,
    SUM(charging_capacity) as chargingCapacity
        FROM
            t_charging_order
        WHERE     del_flag = 0 and recharge_payment_status = 2
        <if test="statisticsQueryDto.dayType == 1">
            AND DATE( create_time ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime}
        </if>
        GROUP BY
            time
        ORDER BY
            time
    </select>
    <select id="countAllUserData" resultType="java.util.Map">
        SELECT
            COUNT( DISTINCT app_user_id ) AS counts,
            '1' AS type
        FROM
            `charging_pile_order`.`t_charging_order` UNION ALL
        SELECT
            COUNT(*) AS counts,
            '2' AS type
        FROM
            `charging_pile_account`.`t_app_user`
        WHERE
            `vip_end_time` > NOW()
        UNION ALL
        SELECT
            COUNT(*) AS counts,
            '3' AS type
        FROM
            `charging_pile_account`.`t_app_user`
        WHERE
            del_flag = 0
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml
@@ -124,4 +124,41 @@
        </if>
        order by a.create_time desc
    </select>
    <select id="goodTop" resultType="java.util.Map">
        SELECT count(1) as counts ,ot.evaluation_tag_id
        from t_order_evaluate_tag ot
                 left join t_order_evaluate te on ot.order_evaluate_id = te.id
                 left join t_charging_order co on te.order_id = co.id
        WHERE ot.evaluation_tag_id in (
            SELECT id from `charging_pile_other`.`t_evaluation_tag` WHERE type = 1
        ) <if test="null != siteIds">
            and co.site_id in
            <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        GROUP BY ot.evaluation_tag_id
        ORDER BY counts desc
            limit 5
    </select>
    <select id="badTop" resultType="java.util.Map">
        SELECT count(1) as counts ,ot.evaluation_tag_id
        from t_order_evaluate_tag ot
        left join t_order_evaluate te on ot.order_evaluate_id = te.id
        left join t_charging_order co on te.order_id = co.id
        WHERE ot.evaluation_tag_id in (
        SELECT id from `charging_pile_other`.`t_evaluation_tag` WHERE type = 3
        ) <if test="null != siteIds">
        and co.site_id in
        <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </if>
        GROUP BY ot.evaluation_tag_id
        ORDER BY counts desc
        limit 5
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TSettlementConfirmMapper.xml
@@ -35,5 +35,6 @@
                and (t1.end_time between #{req.startTime} and #{req.endTime}
            </if>
        </if>
and t1.del_flag = 0
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml
@@ -292,4 +292,31 @@
            and DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{sixBefore}, '%Y-%m-%d')
        </if>
    </select>
    <select id="getData" resultType="java.util.Map">
        SELECT
        DATE_FORMAT( subquery.create_time, '%Y-%m-%d' ) AS MONTH,
        count(1) AS orderNum,
        SUM(payment_amount) AS paymentAmount
        FROM
        (
        SELECT
        create_time,
        payment_amount
        FROM
        t_shopping_order
        <where>
            WHERE del_flag = 0 and payment_status = 2 and ISNULL(refund_status) and status!=4
                DATE_FORMAT(create_time, '%Y-%m-%d') between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime}
        </where>
        ) AS subquery
        GROUP BY
        DATE_FORMAT( subquery.create_time, '%Y-%m-%d' );
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java
@@ -112,7 +112,7 @@
    @PostMapping("/exchangeRecord")
    @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券查看详情-兑换记录")
    public AjaxResult<List<ExchangeRecordVO>> exchangeRecord(@RequestBody ExchangeRecordGoodsQuery dto) {
    public AjaxResult<PageInfo<ExchangeRecordVO>> exchangeRecord(@RequestBody ExchangeRecordGoodsQuery dto) {
        List<ExchangeRecordVO> data = appCouponClient.getExchangeRecordByCouponId(dto).getData();
        for (ExchangeRecordVO record : data) {
            TCoupon byId = tCouponService.getById(record.getCouponId());
@@ -127,7 +127,9 @@
                record.setDetailsPicture(byId.getDetailsPicture());
            }
        }
        return AjaxResult.ok(data);
        PageInfo<ExchangeRecordVO> exchangeRecordVOPageInfo = new PageInfo<>(1, 99999999);
        exchangeRecordVOPageInfo.setRecords(data);
        return AjaxResult.ok(exchangeRecordVOPageInfo);
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
@@ -184,12 +184,14 @@
        return R.ok();
    }
    @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品")
    @ApiOperation(tags = {"小程序-" +
            "兑换商城"},value = "积分兑换商品")
    @PostMapping(value = "/app/shop")
    public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) {
        //检查当前用户积分是否够
        Long userId = tokenService.getLoginUserApplet().getUserId();
        Integer point = 0;
        TAppUser user = appUserClient.getUserById(userId).getData();
        if (exchangeDto.getGoodType()==1) {
            //查询当前商品信息
@@ -200,7 +202,6 @@
            if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) {
                return AjaxResult.error("当前用户已兑换"+count+"张");
            }
        TAppUser user = appUserClient.getUserById(userId).getData();
        if (user.getPoints()<good.getRedeemPoints()){
            return AjaxResult.error("当前用户积分不足");
             }
@@ -212,12 +213,17 @@
            if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) {
                return AjaxResult.error("当前用户已到达兑换"+coupon+"次");
            }
            if (user.getPoints()<point){
                return AjaxResult.error("当前用户积分不足");
            }
        }
        exchangeDto.setPoint(point);
        exchangeDto.setUserId(userId);
        //生成积分兑换成功的订单
        R<Long> longR = orderClient.exchangeCreate(exchangeDto);
        if (exchangeDto.getGoodType()==2) {
            TCoupon coupon = couponService.getById(exchangeDto.getGoodId());
            //如果是优惠卷,赠送优惠卷给用户
            GrantCouponDto grantCouponDto = new GrantCouponDto();
            grantCouponDto.setUserIds(userId.toString());
@@ -225,6 +231,14 @@
            grantCouponDto.setWaysToObtain(1);
            grantCouponDto.setEndTime(LocalDateTime.now());
            grantCouponDto.setType(3);
            switch (coupon.getValidityPeriodMode()){
                case 1:
                    grantCouponDto.setEndTime(coupon.getEndTime());
                    break;
                case 2:
                    grantCouponDto.setEndTime(LocalDateTime.now().plusDays(coupon.getDays()));
                    break;
            }
            appCouponClient.grantCoupon(grantCouponDto);
        }
        //生成消耗积分的记录
@@ -256,6 +270,7 @@
        if (exchangeDto.getGoodType()==1){
            TGoods good = goodsService.getById(exchangeDto.getGoodId());
            BigDecimal originalPrice = good.getPreferentialPrice();
            exchangeDto.setTitle("【商品购买】"+good.getName());
            if (isVip){
                if (good.getVipPrice()!=null){
                    vipDiscount = originalPrice.subtract(good.getVipPrice()).multiply(BigDecimal.valueOf(exchangeDto.getNum()));
@@ -264,7 +279,9 @@
            }
            orderPrice =  orderPrice.add(originalPrice.multiply(BigDecimal.valueOf(exchangeDto.getNum())));
        }else {
            TCoupon coupon = couponService.getById(exchangeDto.getGoodId());
            exchangeDto.setTitle("【优惠卷购买】"+coupon.getName());
            BigDecimal originalPrice = coupon.getPaymentAmount();
            if (isVip){
                if (coupon.getVipPaymentAmount()!=null) {
@@ -288,11 +305,14 @@
            }
            payPrice = orderPrice.subtract(coupon.getDiscountAmount());
            discountPrice = coupon.getDiscountAmount();
        }else {
            payPrice = orderPrice;
        }
        exchangeDto.setPayPrice(orderPrice);
        exchangeDto.setPayPrice(payPrice);
        exchangeDto.setDiscountPrice(discountPrice);
        exchangeDto.setVipDiscount(vipDiscount);
        exchangeDto.setUserId(userId);
        exchangeDto.setPhone(user.getPhone());
        //创建订单
        TShoppingOrder shopOrder = orderClient.shopCreate(exchangeDto).getData();
        if (exchangeDto.getPayMethod()==1) {
ruoyi-service/ruoyi-payment/pom.xml
@@ -134,6 +134,10 @@
            <artifactId>alipay-sdk-java</artifactId>
            <version>4.39.186.ALL</version>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-api-order</artifactId>
        </dependency>
    </dependencies>
    <build>
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java
@@ -3,6 +3,7 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.order.api.feignClient.OrderClient;
import com.ruoyi.payment.api.vo.PaymentOrder;
import com.ruoyi.payment.api.vo.WxRefundNotifyResp;
import com.ruoyi.payment.wx.enums.RefundEnum;
@@ -15,6 +16,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.math.BigDecimal;
@@ -32,6 +34,10 @@
public class WxPayController {
    @Autowired
    private WxV3Pay wxV3Pay;
    @Resource
    private OrderClient orderClient;
    /**
@@ -108,17 +114,19 @@
     * 支付回调
     */
    @PostMapping("pay/notify")
    @ApiOperation("订单回调")
    public R<Map<String, Object>> payNotify(HttpServletRequest request) throws Exception {
        try {
            Map<String, Object> params = wxV3Pay.verifyNotify(request, new TypeReference<Map<String, Object>>() {});
            log.info("支付回调:{}", params);
            String outRefundNo = (String) params.get("out_refund_no");
            String outRefundNo = (String) params.get("transaction_id");
            String out_trade_no = params.get("out_trade_no").toString();
            String substring = out_trade_no.substring(0, 2);
            switch (substring){
                //购物订单
                case "GW":
                System.err.println("----收到购物回调");
                    R r = orderClient.callBack(out_trade_no, outRefundNo);
                    System.err.println("----收到购物回调");
                    break;
                case "HY":
                    break;