luodangjia
2024-11-01 be1ab2eb2032a747a409fb765ec90f76c3116c51
merge
12个文件已修改
119 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java
@@ -123,5 +123,7 @@
    @TableField("serialnumber")
    private String serialnumber;
    @TableField(exist = false)
    private String parkName;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java
@@ -46,6 +46,12 @@
            }
            @Override
            public R<Integer> getSalesCountByGoodsIdgetCount(Integer goodId, Integer goodeType, Integer buyType) {
                return null;
            }
            @Override
            public R<List<String>> getCodeByOrderId(String goodsIds) {
                return R.fail("根据订单ids查询现金购买优惠券订单编号:" + cause.getMessage());
            }
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
@@ -28,6 +28,8 @@
    public R managementGiveVip(@RequestBody TGrantVip grantVip);
    @GetMapping("/t-exchange-order/getSalesCountByGoodsIds/{goodsIds}")
    R<List<Integer>> getSalesCountByGoodsId(@PathVariable("goodsIds") String goodsIds);
    @GetMapping("/t-exchange-order/getCount")
    R<Integer> getSalesCountByGoodsIdgetCount(@RequestParam("goodId") Integer goodId,@RequestParam("goodeType")Integer goodeType,@RequestParam("buyType")Integer buyType);
    /**
     * 管理后台 根据t_app_coupon订单购买或者兑换优惠券的订单编号
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java
@@ -122,6 +122,10 @@
    @TableField(exist = false)
    private Integer useCount;
    @ApiModelProperty(value = "销量")
    @TableField(exist = false)
    private Integer salesCount;
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
@@ -229,17 +229,22 @@
        siteList.setPageSize(99999);
        PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList);
        for (GetSiteListDTO record : list.getRecords()) {
            Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
            List<Integer> c1 = new ArrayList<>();
            c1.add(3);
            c1.add(4);
            c1.add(5);
            c1.add(6);
            Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count();
            record.setC1(count);
            Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count();
            Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).count();
            record.setC2(count1);
            Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
            Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count();
            record.setK1(count2);
            Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count();
            Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).count();
            record.setK2(count3);
            Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
            Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count();
            record.setM1(count4);
            Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count();
            Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).count();
            record.setM2(count5);
            //利用率
@@ -295,14 +300,7 @@
    @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"})
    public R getPercentByCityCode(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto){
        if (chargingPercentProvinceDto.getDate1()==null){
            LocalDate today = LocalDate.now();
            LocalDate lastMonth = today.minusMonths(1);
            LocalDate firstDayOfLastMonth = lastMonth.withDayOfMonth(1);
            LocalDate lastDayOfLastMonth =lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
            chargingPercentProvinceDto.setDate1(firstDayOfLastMonth);
            chargingPercentProvinceDto.setDate2(lastDayOfLastMonth);
        }
@@ -316,6 +314,9 @@
        List<GetSiteListDTO> records = siteService.getSiteList(siteList).getRecords();
        List<Integer> collect = records.stream().map(GetSiteListDTO::getId).collect(Collectors.toList());
        // 通过时间段获取和充电桩id获取各个充电站的充电订单
        if (chargingPercentProvinceDto.getDate1().equals(chargingPercentProvinceDto.getDate2())){
            chargingPercentProvinceDto.setDate2(chargingPercentProvinceDto.getDate1().plusDays(1));
        }
            List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData();
        // 计算利用率展示
        for (ChargingOrderGroup datum : data) {
@@ -325,7 +326,7 @@
                bigDecimal1 = bigDecimal1.add(chargingPile.getRatedPower());
            }
            long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2()) + 1;
            long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2());
            BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")).multiply(BigDecimal.valueOf(daysBetween));
            //得到利用率
            BigDecimal divide = datum.getChargingCapacity().divide(multiply, 0, BigDecimal.ROUND_HALF_UP);
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java
@@ -70,7 +70,11 @@
                .page(Page.of(query.getPageCurr(), query.getPageSize()));
        for (TParkingRecord record : page.getRecords()) {
            TParkingLot byId = parkingLotService.getById(record.getParkingLotId());
            record.setUid(record.getId().toString());
            if (byId!=null) {
                record.setParkName(byId.getName());
            }
        }
        return R.ok(page);
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -1186,6 +1186,8 @@
        tCharingUserMapVO.setMap(charMap);
        tCharingUserMapVO.setMap1(charMap1);
        }else {
            List<Map<String,Object>> map =  chargingOrderService.usersByQuery(statisticsQueryDto);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java
@@ -237,6 +237,46 @@
        }
        return R.ok(res);
    }
    @GetMapping("/getCount")
    public R<Integer> getCount(@RequestParam("goodId") Integer goodId,@RequestParam("goodeType")Integer goodeType,@RequestParam("buyType")Integer buyType){
        if (buyType==1){
            //现金
            if (goodeType==1){
                //商品
                Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>()
                                .eq("order_type",1)
                                .eq("goods_id", goodId)
                                .isNull("refund_status"))
                        .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum);
                return R.ok(reduce);
            }else {
                //优惠券
                Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>()
                                .eq("order_type",2)
                                .eq("coupon_id", goodId)
                                .isNull("refund_status"))
                        .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum);
                return R.ok(reduce);
            }
        }else {
            //兑换
            if (goodeType==1){
                Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",1)
                                .ne("status",4).eq("goods_id", goodId))
                        .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum);
                return R.ok(reduce);
            }else {
                Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",2)
                        .ne("status",4).eq("coupon_id", goodId))
                        .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum);
                return R.ok(reduce);
            }
        }
    }
    /**
     * 管理后台 根据t_app_coupon订单ids查询优惠券的订单编号
     * @param goodsIds  订单号-商品类型
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -702,10 +702,10 @@
        </if>
        <if test="statisticsQueryDto.dayType ==5">
            <if test="statisticsQueryDto.startTime != null">
                AND create_time >= #{statisticsQueryDto.startTime}
                AND DATE(create_time) >= #{statisticsQueryDto.startTime}
            </if>
            <if test="statisticsQueryDto.endTime != null">
                AND create_time &lt;= #{statisticsQueryDto.endTime}
                AND DATE(create_time) &lt;= #{statisticsQueryDto.endTime}
            </if>
        </if>
        GROUP BY
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
@@ -125,7 +125,7 @@
    @GetMapping("/getInfoByType")
    @ApiOperation(tags = {"小程序-兑换商城"},value = "商品查看详情")
    public R getInfoByType(Integer goodType,Integer id) {
    public R getInfoByType(Integer goodType,Integer id,Integer type) {
        if (goodType==1){
        TGoods byId = goodsService.getById(id);
        if (byId==null||byId.getStatus()==2){
@@ -135,7 +135,8 @@
//            for (int i = 0; i < list.size(); i++) {
//                list.get(i).setSalesCount(data.get(i));
//            }
            Integer data = orderClient.getSalesCountByGoodsIdgetCount(byId.getId(), 1, type).getData();
            byId.setSalesCount(data);
        return R.ok(byId);
        }
        else {
@@ -143,7 +144,9 @@
            if (byId==null||byId.getStatus()==2){
                return R.fail(2,"该商品已不存在");
            }
                return R.ok(byId);
            Integer data = orderClient.getSalesCountByGoodsIdgetCount(byId.getId(),2, type).getData();
            byId.setSalesCount(data);
            return R.ok(byId);
            }
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java
@@ -78,14 +78,11 @@
            pageInfo.setRecords(list);
            return pageInfo;
        }
        String string = stringBuilder.toString();
        // 订单号加上商品类型
        String res = string+"-"+basePage.getType();
        List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData();
        for (int i = 0; i < list.size(); i++) {
            list.get(i).setSalesCount(data.get(i));
        for (TGoods tGoods : list) {
            Integer data = orderClient.getSalesCountByGoodsIdgetCount(tGoods.getId(), tGoods.getGoodType(), basePage.getType()).getData();
            tGoods.setSalesCount(data);
        }
        pageInfo.setRecords(list);
        return pageInfo;
    }
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml
@@ -55,13 +55,13 @@
    <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods">
        SELECT
            id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture
            id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture,underlying_sales as underlyingSales
        FROM
            t_goods
        WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type}
        UNION ALL
        SELECT
            id,name,redeem_points  as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture
            id,name,redeem_points  as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture,0 as underlyingSales
        FROM
            t_coupon
        WHERE `status`= 1 and del_flag = 0 and ways_to_obtain != #{appGoodQuery.type}