From be1ab2eb2032a747a409fb765ec90f76c3116c51 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期五, 01 十一月 2024 09:15:25 +0800
Subject: [PATCH] merge
---
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java | 2 +
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java | 40 ++++++++++++++++++++
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java | 31 ++++++++-------
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 4 +-
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java | 6 +++
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java | 2 +
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 2 +
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java | 11 ++---
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml | 4 +-
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java | 4 ++
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java | 4 ++
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 9 +++-
12 files changed, 90 insertions(+), 29 deletions(-)
diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java
index 81b5024..39343ad 100644
--- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java
+++ b/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;
}
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java
index 20929f8..19ec997 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java
+++ b/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());
}
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
index 210327e..02994b0 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
+++ b/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订单购买或者兑换优惠券的订单编号
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java
index ebe7621..5a99b2a 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java
+++ b/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;
+
}
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
index 171a350..06a4e3f 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
+++ b/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);
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java
index 8c9284b..5d91a4c 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java
+++ b/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);
}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
index efc6208..25718a7 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
+++ b/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);
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java
index e179dab..7d688c5 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java
+++ b/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 订单号-商品类型
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
index f126021..162f271 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
+++ b/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 <= #{statisticsQueryDto.endTime}
+ AND DATE(create_time) <= #{statisticsQueryDto.endTime}
</if>
</if>
GROUP BY
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
index 3ea9ee4..c003b2e 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
+++ b/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);
}
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java
index 5f390ad..d5e2f68 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java
+++ b/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;
}
diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml
index c8879ee..4351904 100644
--- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml
+++ b/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}
--
Gitblit v1.7.1