From 9a89e76486fe3393c4589aa389f097a157f51f87 Mon Sep 17 00:00:00 2001 From: Lenovo Date: Fri, 26 Jul 2024 18:16:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=A6=82=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusStoreDayHistoryInfoController.java | 12 +- .../business/domain/BusOverviewInfo.java | 134 ++++++ .../mapper/BusStoreDayHistoryInfoMapper.java | 6 +- .../IBusStoreDayHistoryInfoService.java | 2 + .../BusStoreDayHistoryInfoServiceImpl.java | 90 +++- .../business/BusStoreDayHistoryInfoMapper.xml | 46 +++ ruoyi-ui/src/api/statistics/excel.js | 8 + .../src/views/statistics/overview/index.vue | 389 ++++++++++++++++++ 8 files changed, 676 insertions(+), 11 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/business/domain/BusOverviewInfo.java create mode 100644 ruoyi-ui/src/views/statistics/overview/index.vue diff --git a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreDayHistoryInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreDayHistoryInfoController.java index 59ae504..814551b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreDayHistoryInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreDayHistoryInfoController.java @@ -8,10 +8,7 @@ import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletResponse; -import com.ruoyi.business.domain.BusStoreDayHistoryInfo; -import com.ruoyi.business.domain.BusStoreDayInfo; -import com.ruoyi.business.domain.BusStoreExcelInfo; -import com.ruoyi.business.domain.BusStoreInfo; +import com.ruoyi.business.domain.*; import com.ruoyi.business.service.IBusReturnVisitInfoService; import com.ruoyi.business.service.IBusStoreDayInfoService; import com.ruoyi.business.service.IBusStoreInfoService; @@ -63,6 +60,13 @@ public class BusStoreDayHistoryInfoController extends BaseController List list = busStoreDayHistoryInfoService.selectBusStoreDayHistoryInfoList(excelInfo); return getDataTable(list); } + @GetMapping("/list1") + public TableDataInfo list1(String account, String expStartTime, String expEndTime) + { + startPage(); + List list = busStoreDayHistoryInfoService.selectBusStoreDayHistoryInfoList1(account, expStartTime,expEndTime); + return getDataTable(list); + } @PostMapping("/export") public void export(Long storeId,String expStartTime,String expEndTime,HttpServletResponse response) throws Exception { diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/domain/BusOverviewInfo.java b/ruoyi-system/src/main/java/com/ruoyi/business/domain/BusOverviewInfo.java new file mode 100644 index 0000000..76273e0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/business/domain/BusOverviewInfo.java @@ -0,0 +1,134 @@ +package com.ruoyi.business.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +import java.util.List; + +/** + * 店铺信息对象 bus_store_info + * + * @author ruoyi + * @date 2024-07-03 + */ +public class BusOverviewInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + private String account; + private int grantTotal; + private int noGrantTotal; + private int isGrantTotal; + private int orderTotal; + private int commentsTotal; + private int fiveTotal; + private int aiTotal; + private int smsTotal; + private int otherTotal; + private int minusTotal; + private String rate; + private String time; + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public int getGrantTotal() { + return grantTotal; + } + + public void setGrantTotal(int grantTotal) { + this.grantTotal = grantTotal; + } + + public int getNoGrantTotal() { + return noGrantTotal; + } + + public void setNoGrantTotal(int noGrantTotal) { + this.noGrantTotal = noGrantTotal; + } + + public int getIsGrantTotal() { + return isGrantTotal; + } + + public void setIsGrantTotal(int isGrantTotal) { + this.isGrantTotal = isGrantTotal; + } + + public int getOrderTotal() { + return orderTotal; + } + + public void setOrderTotal(int orderTotal) { + this.orderTotal = orderTotal; + } + + public int getCommentsTotal() { + return commentsTotal; + } + + public void setCommentsTotal(int commentsTotal) { + this.commentsTotal = commentsTotal; + } + + public int getFiveTotal() { + return fiveTotal; + } + + public void setFiveTotal(int fiveTotal) { + this.fiveTotal = fiveTotal; + } + + public int getAiTotal() { + return aiTotal; + } + + public void setAiTotal(int aiTotal) { + this.aiTotal = aiTotal; + } + + public int getSmsTotal() { + return smsTotal; + } + + public void setSmsTotal(int smsTotal) { + this.smsTotal = smsTotal; + } + + public int getOtherTotal() { + return otherTotal; + } + + public void setOtherTotal(int otherTotal) { + this.otherTotal = otherTotal; + } + + public int getMinusTotal() { + return minusTotal; + } + + public void setMinusTotal(int minusTotal) { + this.minusTotal = minusTotal; + } + + public String getRate() { + return rate; + } + + public void setRate(String rate) { + this.rate = rate; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayHistoryInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayHistoryInfoMapper.java index 2919456..c50dd74 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayHistoryInfoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayHistoryInfoMapper.java @@ -1,8 +1,6 @@ package com.ruoyi.business.mapper; -import com.ruoyi.business.domain.BusStoreDayHistoryInfo; -import com.ruoyi.business.domain.BusStoreDayInfo; -import com.ruoyi.business.domain.BusStoreExcelInfo; +import com.ruoyi.business.domain.*; import org.apache.ibatis.annotations.Param; import java.time.LocalDateTime; @@ -39,6 +37,8 @@ public interface BusStoreDayHistoryInfoMapper * @return 结果 */ public int insertBusStoreDayHistoryInfo(BusStoreDayHistoryInfo busStoreDayHistoryInfo); + public BusOverviewInfo getCount(@Param("ids") List ids, @Param("expStartTime") String expStartTime, @Param("expEndTime") String expEndTime); + public List getIntegralCount(@Param("account") String account, @Param("expStartTime") String expStartTime, @Param("expEndTime") String expEndTime); /** * 修改店铺单日信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/IBusStoreDayHistoryInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/IBusStoreDayHistoryInfoService.java index 48ad2fb..d334421 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/IBusStoreDayHistoryInfoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/IBusStoreDayHistoryInfoService.java @@ -1,5 +1,6 @@ package com.ruoyi.business.service; +import com.ruoyi.business.domain.BusOverviewInfo; import com.ruoyi.business.domain.BusStoreDayHistoryInfo; import com.ruoyi.business.domain.BusStoreExcelInfo; @@ -28,6 +29,7 @@ public interface IBusStoreDayHistoryInfoService * @return 店铺单日信息集合 */ public List selectBusStoreDayHistoryInfoList(BusStoreExcelInfo busStoreExcelInfo); + public List selectBusStoreDayHistoryInfoList1(String account, String expStartTime, String expEndTime); /** * 新增店铺单日信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayHistoryInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayHistoryInfoServiceImpl.java index 4e27e09..2eefc52 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayHistoryInfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayHistoryInfoServiceImpl.java @@ -1,9 +1,7 @@ package com.ruoyi.business.service.impl; -import com.ruoyi.business.domain.BusStoreDayHistoryInfo; -import com.ruoyi.business.domain.BusStoreDayInfo; -import com.ruoyi.business.domain.BusStoreExcelInfo; -import com.ruoyi.business.domain.BusStoreInfo; +import com.ruoyi.business.domain.*; +import com.ruoyi.business.mapper.BusAgentInfoMapper; import com.ruoyi.business.mapper.BusStoreDayHistoryInfoMapper; import com.ruoyi.business.mapper.BusStoreDayInfoMapper; import com.ruoyi.business.mapper.BusStoreInfoMapper; @@ -12,11 +10,17 @@ import com.ruoyi.business.service.IBusStoreDayInfoService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * 店铺单日信息Service业务层处理 @@ -31,6 +35,8 @@ public class BusStoreDayHistoryInfoServiceImpl implements IBusStoreDayHistoryInf private BusStoreDayHistoryInfoMapper busStoreDayHistoryInfoMapper; @Autowired private BusStoreInfoMapper storeInfoMapper; + @Autowired + private BusAgentInfoMapper agentInfoMapper; /** * 查询店铺单日信息 @@ -67,6 +73,82 @@ public class BusStoreDayHistoryInfoServiceImpl implements IBusStoreDayHistoryInf return busStoreDayHistoryInfoMapper.selectBusStoreDayHistoryInfoList(busStoreExcelInfo); } + @Override + public List selectBusStoreDayHistoryInfoList1(String account, String expStartTime, String expEndTime) { + BusAgentInfo agentInfo = new BusAgentInfo(); + agentInfo.setDelStatus("1"); + if (StringUtils.isNotEmpty(account)) { + agentInfo.setAgentAccount(account); + } + List agentInfoList = agentInfoMapper.selectBusAgentInfoList(agentInfo); + List data = new ArrayList<>(); + for (BusAgentInfo info : agentInfoList) { + BusOverviewInfo overviewInfo = new BusOverviewInfo(); + overviewInfo.setAccount(info.getAgentAccount()); + BusStoreInfo storeInfo = new BusStoreInfo(); + storeInfo.setBindUser(info.getAgentAccount()); + List l = storeInfoMapper.selectBusStoreInfoList(storeInfo); + overviewInfo.setGrantTotal(l.size()); + + BusStoreInfo storeInfo1 = new BusStoreInfo(); + storeInfo1.setGrantStatus("2"); + storeInfo1.setBindUser(info.getAgentAccount()); + List li = storeInfoMapper.selectBusStoreInfoList(storeInfo1); + overviewInfo.setNoGrantTotal(li.size()); + + BusStoreInfo storeInfo2 = new BusStoreInfo(); + storeInfo2.setGrantStatus("1"); + storeInfo2.setBindUser(info.getAgentAccount()); + List lis = storeInfoMapper.selectBusStoreInfoList(storeInfo2); + overviewInfo.setNoGrantTotal(lis.size()); + + List ids = new ArrayList<>(); + for (BusStoreInfo busStoreInfo : l) { + ids.add(busStoreInfo.getId()); + } + if (ids.size() > 0) { + BusOverviewInfo busOverviewInfo = busStoreDayHistoryInfoMapper.getCount(ids, expStartTime, expEndTime); + overviewInfo.setOrderTotal(busOverviewInfo.getOrderTotal()); + overviewInfo.setCommentsTotal(busOverviewInfo.getCommentsTotal()); + overviewInfo.setFiveTotal(busOverviewInfo.getFiveTotal()); + } + + List recordList = busStoreDayHistoryInfoMapper.getIntegralCount(info.getAgentAccount(),expStartTime,expEndTime); + overviewInfo.setMinusTotal(recordList.size()); + + if (recordList.size() > 0) { + List recordList1 = new ArrayList<>(); + List recordList2 = new ArrayList<>(); + List recordList3 = new ArrayList<>(); + for (BusIntegralRecord record : recordList) { + if (record.getAgentRemark() != null && "sms".equals(record.getAgentRemark())) { + recordList1.add(record); + }else if (record.getAgentRemark() != null && "AI".equals(record.getAgentRemark())){ + recordList2.add(record); + }else if (record.getAgentRemark() != null && "其他".equals(record.getAgentRemark())){ + recordList3.add(record); + } + } + overviewInfo.setSmsTotal(recordList1.size()); + overviewInfo.setAiTotal(recordList2.size()); + overviewInfo.setOtherTotal(recordList3.size()); + } + + //好评数量/消耗数量 + if (overviewInfo.getMinusTotal() == 0 || overviewInfo.getCommentsTotal() == 0){ + overviewInfo.setRate("0"); + }else { + BigDecimal b = new BigDecimal(overviewInfo.getCommentsTotal()).divide(new BigDecimal(overviewInfo.getMinusTotal()),2, RoundingMode.HALF_UP); + overviewInfo.setRate(b.toString()); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + overviewInfo.setTime(sdf.format(new Date())); + + data.add(overviewInfo); + } + return data; + } + /** * 新增店铺单日信息 * diff --git a/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml index bdff973..049d8d7 100644 --- a/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml @@ -17,10 +17,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + select id, store_id, last_order_num, last_positive_reviews_num, last_five_star_reviews_num, last_return_visit_num, last_return_visit_rate, today_return_visit_num, score, create_time from bus_store_day_history_info + + select id, account, platform, update_type, Integral_update_num, Integral_update_time, Integral_balance, agent_remark, remark from bus_integral_record + + SELECT a.store_id as storeId, @@ -53,6 +69,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + + + insert into bus_store_day_history_info diff --git a/ruoyi-ui/src/api/statistics/excel.js b/ruoyi-ui/src/api/statistics/excel.js index 96c664f..a56d146 100644 --- a/ruoyi-ui/src/api/statistics/excel.js +++ b/ruoyi-ui/src/api/statistics/excel.js @@ -9,6 +9,14 @@ export function listInfo(query) { }) } +export function listInfo1(query) { + return request({ + url: '/excel/info/list1', + method: 'get', + params: query + }) +} + // 查询店铺单日历史信息详细 export function getInfo(id) { return request({ diff --git a/ruoyi-ui/src/views/statistics/overview/index.vue b/ruoyi-ui/src/views/statistics/overview/index.vue new file mode 100644 index 0000000..8c1eb6c --- /dev/null +++ b/ruoyi-ui/src/views/statistics/overview/index.vue @@ -0,0 +1,389 @@ + + +