From af1e2033557dffa4bebf9dadcb5fc824a1bba342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=86=E7=B1=B3=E8=8A=B1?= <417727563@qq.com> Date: Wed, 21 Jun 2023 10:39:37 +0800 Subject: [PATCH] 2023-06-22-01-bug --- .../demo/zyorders/mapper/ZyOrdersMapper.java | 37 ++++ .../zyorders/mapper/xml/ZyOrdersMapper.xml | 46 +++++ .../zyorders/service/IZyOrdersService.java | 21 +++ .../service/impl/ZyOrdersServiceImpl.java | 171 +++++++++++++++++- .../modules/demo/zyorders/vo/Groups.java | 12 ++ .../modules/demo/zyorders/vo/OrderSource.java | 11 ++ .../demo/zyorders/vo/ShopNameAndPayTime.java | 11 ++ .../modules/demo/zyorders/vo/SourceType.java | 11 ++ .../modules/demo/zyorders/vo/UserAge.java | 24 +++ .../controller/LargeScreenController.java | 25 +++ 10 files changed, 367 insertions(+), 2 deletions(-) create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/Groups.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/OrderSource.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/ShopNameAndPayTime.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/SourceType.java create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/UserAge.java diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/mapper/ZyOrdersMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/mapper/ZyOrdersMapper.java index daf90ba0..ce06d10b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/mapper/ZyOrdersMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/mapper/ZyOrdersMapper.java @@ -1,10 +1,13 @@ package org.jeecg.modules.demo.zyorders.mapper; +import java.util.Date; import java.util.List; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.demo.zyorders.entity.ZyOrders; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.demo.zyorders.vo.ShopNameAndPayTime; +import org.jeecg.modules.demo.zyorders.vo.UserAge; import org.jeecg.modules.demo.zyorders.vo.ZyNameAndPayMoney; import org.jeecg.modules.demo.zyorders.vo.ZyOrderPayAndTime; import org.jeecg.modules.orderbymakeclothplan.vo.TodayOrderAndQIriVo; @@ -23,7 +26,41 @@ public interface ZyOrdersMapper extends BaseMapper { */ TodayOrderAndQIriVo getTotalOrderAndWeek(); + /** + *查询所有店铺上月销售额 + * @param start_time + * @param end_time + * @param org_code + * @return + */ List selectAllShopSalesVolumeByLastM( @Param("start_time") String start_time,@Param("end_time") String end_time,@Param("org_code") String org_code); + /** + * 查询店铺12月销售额 + * @param id + * @param start_time + * @param end_time + * @return + */ List selectCurrentSales(@Param("id")String id, @Param("start_time")String start_time, @Param("end_time")String end_time); + + /** + * 订单来源 + * @param org_code + * @return + */ + List selectSourceType(@Param("org_code") String org_code); + + /** + * 订单消费群体 + * @return + */ + List consumerGroups(); + + /** + * 订单销售分析 + * @param lastSevenDay + * @return + */ + List selectOrderSale(@Param("lastSevenDay") String lastSevenDay); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/mapper/xml/ZyOrdersMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/mapper/xml/ZyOrdersMapper.xml index 6364e39b..75870d2e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/mapper/xml/ZyOrdersMapper.xml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/mapper/xml/ZyOrdersMapper.xml @@ -46,4 +46,50 @@ + + + + + + + + + diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/IZyOrdersService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/IZyOrdersService.java index 62367174..b57287ef 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/IZyOrdersService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/IZyOrdersService.java @@ -5,8 +5,11 @@ import org.jeecg.modules.demo.ordergoods.entity.OrderGoodsJk; import org.jeecg.modules.demo.zyorders.entity.ZyOrders; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.demo.zyorders.entity.ZyOrdersJk; +import org.jeecg.modules.demo.zyorders.vo.Groups; +import org.jeecg.modules.demo.zyorders.vo.OrderSource; import org.jeecg.modules.largeScreen.vo.Type; import org.jeecg.modules.orderbymakeclothplan.vo.TodayOrderAndQIriVo; +import org.jeecg.modules.shop.vo.OrderSales; import java.util.List; import java.util.Map; @@ -46,4 +49,22 @@ public interface IZyOrdersService extends IService { * @return */ List getsales12Month(); + + /** + * 订单来源 + * @return + */ + List selectSourceType(); + + /** + * 订单消费群体 + * @return + */ + List consumerGroups(); + + /** + * 订单销售分析 + * @return + */ + List selectOrderSale(); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java index 3d81e8a1..b69ba5e0 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java @@ -28,8 +28,7 @@ import org.jeecg.modules.demo.zyorders.entity.ZyOrders; import org.jeecg.modules.demo.zyorders.entity.ZyOrdersJk; import org.jeecg.modules.demo.zyorders.mapper.ZyOrdersMapper; import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; -import org.jeecg.modules.demo.zyorders.vo.ZyNameAndPayMoney; -import org.jeecg.modules.demo.zyorders.vo.ZyOrderPayAndTime; +import org.jeecg.modules.demo.zyorders.vo.*; import org.jeecg.modules.largeScreen.vo.Type; import org.jeecg.modules.largeScreen.vo.ZyShopSales; import org.jeecg.modules.message.entity.ZySpeechMessage; @@ -37,6 +36,8 @@ import org.jeecg.modules.message.mapper.ZySpeechMessageMapper; import org.jeecg.modules.orderbymakeclothplan.vo.TodayOrderAndQIriVo; import org.jeecg.modules.shop.utils.GetTime; import org.jeecg.modules.shop.utils.mapSort; +import org.jeecg.modules.shop.vo.OrderSales; +import org.jeecg.modules.shop.vo.OrderSalesH; import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.service.ISysDepartService; import org.springframework.beans.factory.annotation.Autowired; @@ -444,6 +445,172 @@ public class ZyOrdersServiceImpl extends ServiceImpl i return ls; } + /** + * 订单来源 + * @return + */ + @Override + public List selectSourceType() { + List orderSources = new ArrayList<>(); + List sourceTypeArr=new ArrayList<>(); + sourceTypeArr.add("4"); + sourceTypeArr.add("5"); + int i=1; + for (String code:sourceTypeArr){ + List list = baseMapper.selectSourceType(code); + + OrderSource orderSource = new OrderSource(); + List sourceTypeList = new ArrayList<>(); + for (int l = 7; l>=1; l--){ + String lastSevenDay = GetTime.getLastSevenDay(l); + SourceType sourceType = new SourceType(); + sourceType.setPayTime(lastSevenDay); + sourceType.setNumber(0); + sourceTypeList.add(sourceType); + } + Map map = new HashMap<>(); + for (int j = 1;j<=7;j++){ + String lastSevenDay = GetTime.getLastSevenDay(j); + map.put(lastSevenDay,0); + } + for (int k = 0;k consumerGroups() { + int one = 0, two = 0, three = 0, four = 0, five = 0; + String[] s = {"18-24", "24-30", "30-36", "36-42", "其他"}; + List userAges = baseMapper.consumerGroups(); + List ages = new ArrayList<>(); + List groups = new ArrayList<>(); + + for (int i = 0; i < userAges.size(); i++) { + Integer age = userAges.get(i).getAge(); + int n = age / 6; + switch (n) { + case 3: + one++; + break; + case 4: + two++; + break; + case 5: + three++; + break; + case 6: + four++; + break; + default: + five++; + break; + } + } + + ages.add(0, one); + ages.add(1, two); + ages.add(2, three); + ages.add(3, four); + ages.add(4, five); + + for (int i = 0; i < 5; i++) { + Groups groups1 = new Groups(); + groups1.setGroup(s[i]); + groups1.setNum(ages.get(i)); + groups.add(i, groups1); + } + + return groups; + } + + + /** + * 订单销售分析 + * @return + */ + @Override + public List selectOrderSale() { + String lastSevenDay = GetTime.getLastSevenDay(1); + //查找所有店铺 + QueryWrapper depWra=new QueryWrapper(); + String[] a3 = {"4","5"}; + depWra.in("org_category",a3); + List depList = sysDepartService.list(depWra); + List shopNameAndPayTimes = baseMapper.selectOrderSale(lastSevenDay); + List ls = new ArrayList<>(); + for(SysDepart item:depList){ + //for (int j = 0;j map = new HashMap<>(); + List orderSalesHList = new ArrayList<>(); + for (int l = 0;l<=18;l=l+6){ + OrderSalesH orderSalesH = new OrderSalesH(); + orderSalesH.setTime(l); + orderSalesH.setNumber(0); + orderSalesHList.add(orderSalesH); + } + for (int i = 0;i<=18;i=i+6){ + map.put(i,0); + } + for (int k = 0;k=z && i<=z+6){ + i = z; + } + } + if (map.containsKey(i)){ + Integer integer = map.get(i); + map.put(i,integer+1); + } + } + } + + for(Integer key:map.keySet()) { + for (int m = 0;m ls; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/ShopNameAndPayTime.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/ShopNameAndPayTime.java new file mode 100644 index 00000000..d33424bd --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/ShopNameAndPayTime.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.demo.zyorders.vo; + +import lombok.Data; + +import java.util.Date; + +@Data +public class ShopNameAndPayTime { + private String name; + private Date payTime; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/SourceType.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/SourceType.java new file mode 100644 index 00000000..a9550cc2 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/SourceType.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.demo.zyorders.vo; + +import lombok.Data; + +@Data +public class SourceType { + //支付时间 + private String payTime; + //支付类型 + private Integer number; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/UserAge.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/UserAge.java new file mode 100644 index 00000000..656bd754 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/vo/UserAge.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.demo.zyorders.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +@Data +public class UserAge { + + private String id; + + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date brithday; + + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date nowtime; + + private Integer age; + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/controller/LargeScreenController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/controller/LargeScreenController.java index 9063e45b..741fcaf3 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/controller/LargeScreenController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/largeScreen/controller/LargeScreenController.java @@ -12,6 +12,8 @@ import org.jeecg.modules.demo.ordergoods.entity.OrderGoods; import org.jeecg.modules.demo.ordergoods.service.IOrderGoodsService; import org.jeecg.modules.demo.zyorders.entity.ZyOrders; import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; +import org.jeecg.modules.demo.zyorders.vo.Groups; +import org.jeecg.modules.demo.zyorders.vo.OrderSource; import org.jeecg.modules.largeScreen.vo.LargeOrderVo; import org.jeecg.modules.largeScreen.vo.Type; import org.jeecg.modules.orderbymakeclothplan.vo.TodayOrderAndQIriVo; @@ -141,6 +143,14 @@ public class LargeScreenController { return Result.OK(list); } + @AutoLog(value = "订单来源") + @ApiOperation(value = "订单来源", notes = "订单来源") + @GetMapping("/selectSourceType") + public Result selectSourceType(){ + List list = zyOrdersService.selectSourceType(); + return Result.OK(list); + } + @AutoLog(value = "获取最新订单") @ApiOperation(value = "获取最新订单", notes = "获取最新订单") @GetMapping("/getNewOder") @@ -225,4 +235,19 @@ public class LargeScreenController { return Result.OK(list); } + @AutoLog(value = "订单消费群体") + @ApiOperation(value = "订单消费群体", notes = "订单消费群体") + @GetMapping("/consumerGroups") + public Result consumerGroups() { + List groups = zyOrdersService.consumerGroups(); + return Result.OK(groups); + } + @AutoLog(value = "订单销售分析") + @ApiOperation(value = "订单销售分析", notes = "订单销售分析") + @GetMapping("/selectOrderSale") + public Result selectOrderSale(){ + List list = zyOrdersService.selectOrderSale(); + return Result.OK(list); + } + }