From d16d0648e75c0fb1382d9b2ac60a4893e6240c74 Mon Sep 17 00:00:00 2001 From: ywh <136o9815044@qq.com> Date: Sun, 18 Aug 2024 17:16:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=A6=82=E8=A7=88=E5=AF=BC?= =?UTF-8?q?=E5=87=BA+=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusStoreDayHistoryInfoController.java | 33 ++++++++-- .../business/mapper/BusAgentInfoMapper.java | 6 ++ .../IBusStoreDayHistoryInfoService.java | 2 +- .../BusStoreDayHistoryInfoServiceImpl.java | 32 ++++----- .../mapper/business/BusAgentInfoMapper.xml | 66 +++++++++++++++++++ 5 files changed, 118 insertions(+), 21 deletions(-) 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 896bd45..0b69388 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 @@ -2,16 +2,16 @@ package com.ruoyi.business.controller; import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; +import java.util.*; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import com.ruoyi.business.domain.*; +import com.ruoyi.business.mapper.BusAgentInfoMapper; import com.ruoyi.business.service.IBusReturnVisitInfoService; import com.ruoyi.business.service.IBusStoreDayInfoService; import com.ruoyi.business.service.IBusStoreInfoService; +import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -64,10 +64,33 @@ public class BusStoreDayHistoryInfoController extends BaseController public TableDataInfo list1(String account, String expStartTime, String expEndTime) { // startPage(); - TableDataInfo list = busStoreDayHistoryInfoService.selectBusStoreDayHistoryInfoList1(account, expStartTime,expEndTime); + TableDataInfo list = busStoreDayHistoryInfoService.selectBusStoreDayHistoryInfoList1(true,account, expStartTime,expEndTime); return list; } + @Resource + private BusAgentInfoMapper agentInfoMapper; + + @PostMapping("/exportDataOverview") + public void exportDataOverview(HttpServletResponse response,String account, String expStartTime, String expEndTime) throws Exception{ + + Map sql = new HashMap<>(); + if(StringUtils.isNotBlank(account)){ + sql.put("account",account); + } + if(StringUtils.isNotBlank(expStartTime)){ + sql.put("expStartTime",expStartTime); + } + if(StringUtils.isNotBlank(expEndTime)){ + sql.put("expEndTime",expEndTime); + } +// TableDataInfo tdi = busStoreDayHistoryInfoService.selectBusStoreDayHistoryInfoList1(false,account, expStartTime,expEndTime); +// List datas = (List) tdi.getRows(); + List datas = agentInfoMapper.selectDaataOverview(sql); + ExcelUtil util = new ExcelUtil<>(BusOverviewInfo.class); + util.exportExcel(response, datas, "数据概览统计数据"); + } + @PostMapping("/export") public void export(Long storeId,String expStartTime,String expEndTime,HttpServletResponse response) throws Exception { String startTime = expStartTime; diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusAgentInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusAgentInfoMapper.java index 8d08232..b9eeef0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusAgentInfoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusAgentInfoMapper.java @@ -1,7 +1,10 @@ package com.ruoyi.business.mapper; import java.util.List; +import java.util.Map; + import com.ruoyi.business.domain.BusAgentInfo; +import com.ruoyi.business.domain.BusOverviewInfo; /** * 代理管理Mapper接口 @@ -27,6 +30,9 @@ public interface BusAgentInfoMapper */ public List selectBusAgentInfoList(BusAgentInfo busAgentInfo); + public List selectDaataOverview(Map sql); + + /** * 新增代理管理 * 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 eba9b4f..4bf3e21 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 @@ -30,7 +30,7 @@ public interface IBusStoreDayHistoryInfoService * @return 店铺单日信息集合 */ public List selectBusStoreDayHistoryInfoList(BusStoreExcelInfo busStoreExcelInfo); - public TableDataInfo selectBusStoreDayHistoryInfoList1(String account, String expStartTime, String expEndTime); + public TableDataInfo selectBusStoreDayHistoryInfoList1(boolean isPage,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 e281036..f870dc6 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 @@ -77,8 +77,10 @@ public class BusStoreDayHistoryInfoServiceImpl implements IBusStoreDayHistoryInf } @Override - public TableDataInfo selectBusStoreDayHistoryInfoList1(String account, String expStartTime, String expEndTime) { - PageUtils.startPage(); + public TableDataInfo selectBusStoreDayHistoryInfoList1(boolean isPage,String account, String expStartTime, String expEndTime) { + if(isPage){ + PageUtils.startPage(); + } BusAgentInfo agentInfo = new BusAgentInfo(); agentInfo.setDelStatus("1"); if (StringUtils.isNotEmpty(account)) { @@ -93,23 +95,23 @@ public class BusStoreDayHistoryInfoServiceImpl implements IBusStoreDayHistoryInf List data = new ArrayList<>(); for (BusAgentInfo info : agentInfoList) { BusOverviewInfo overviewInfo = new BusOverviewInfo(); - overviewInfo.setAccount(info.getAgentAccount()); + overviewInfo.setAccount(info.getAgentAccount());//账号 BusStoreInfo storeInfo = new BusStoreInfo(); storeInfo.setBindUser(info.getAgentAccount()); List l = storeInfoMapper.selectBusStoreInfoList(storeInfo); - overviewInfo.setGrantTotal(l.size()); + overviewInfo.setGrantTotal(l.size());//营销源总数 BusStoreInfo storeInfo1 = new BusStoreInfo(); storeInfo1.setGrantStatus("2"); storeInfo1.setBindUser(info.getAgentAccount()); List li = storeInfoMapper.selectBusStoreInfoList(storeInfo1); - overviewInfo.setNoGrantTotal(li.size()); + overviewInfo.setNoGrantTotal(li.size());//失效总数 BusStoreInfo storeInfo2 = new BusStoreInfo(); storeInfo2.setGrantStatus("1"); storeInfo2.setBindUser(info.getAgentAccount()); List lis = storeInfoMapper.selectBusStoreInfoList(storeInfo2); - overviewInfo.setIsGrantTotal(lis.size()); + overviewInfo.setIsGrantTotal(lis.size());//在营销总数 List ids = new ArrayList<>(); for (BusStoreInfo busStoreInfo : l) { @@ -117,13 +119,13 @@ public class BusStoreDayHistoryInfoServiceImpl implements IBusStoreDayHistoryInf } if (ids.size() > 0) { BusOverviewInfo busOverviewInfo = busStoreDayHistoryInfoMapper.getCount(ids, expStartTime, expEndTime); - overviewInfo.setOrderTotal(busOverviewInfo.getOrderTotal()); - overviewInfo.setCommentsTotal(busOverviewInfo.getCommentsTotal()); - overviewInfo.setFiveTotal(busOverviewInfo.getFiveTotal()); + overviewInfo.setOrderTotal(busOverviewInfo.getOrderTotal());//订单数量 + overviewInfo.setCommentsTotal(busOverviewInfo.getCommentsTotal());//好评数量 + overviewInfo.setFiveTotal(busOverviewInfo.getFiveTotal());//五星数量 } List recordList = busStoreDayHistoryInfoMapper.getIntegralCount(info.getAgentAccount(),expStartTime,expEndTime); - overviewInfo.setMinusTotal(recordList.size()); + overviewInfo.setMinusTotal(recordList.size());//消耗数量 if (recordList.size() > 0) { List recordList1 = new ArrayList<>(); @@ -138,9 +140,9 @@ public class BusStoreDayHistoryInfoServiceImpl implements IBusStoreDayHistoryInf recordList3.add(record); } } - overviewInfo.setSmsTotal(recordList1.size()); - overviewInfo.setAiTotal(recordList2.size()); - overviewInfo.setOtherTotal(recordList3.size()); + overviewInfo.setSmsTotal(recordList1.size());//短信数量 + overviewInfo.setAiTotal(recordList2.size());//AI数量 + overviewInfo.setOtherTotal(recordList3.size());//通过数量 } //好评数量/消耗数量 @@ -148,10 +150,10 @@ public class BusStoreDayHistoryInfoServiceImpl implements IBusStoreDayHistoryInf overviewInfo.setRate("0"); }else { BigDecimal b = new BigDecimal(overviewInfo.getCommentsTotal()).divide(new BigDecimal(overviewInfo.getMinusTotal()),2, RoundingMode.HALF_UP); - overviewInfo.setRate(b.toString()); + overviewInfo.setRate(b.toString());//营销比(%) } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - overviewInfo.setTime(sdf.format(new Date())); + overviewInfo.setTime(sdf.format(new Date()));//结算时间 data.add(overviewInfo); } diff --git a/ruoyi-system/src/main/resources/mapper/business/BusAgentInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/business/BusAgentInfoMapper.xml index 5a0afbc..71cca6c 100644 --- a/ruoyi-system/src/main/resources/mapper/business/BusAgentInfoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/business/BusAgentInfoMapper.xml @@ -28,6 +28,72 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, agent_account, agent_name, integral,create_time ,superior_agent_code, superior_agent_account, grant_store_num, operate_store_num, last_use_integral_num, last_positive_reviews_num, ai_duration_balance, last_login_time, last_login_ip, login_num, del_status,ai_real_time_num from bus_agent_info + +