From 7c70e102c4359915310ba85ba64ff47c9b11c9f4 Mon Sep 17 00:00:00 2001 From: Lenovo Date: Fri, 19 Jul 2024 15:41:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusStoreDayHistoryInfoController.java | 9 ++- .../controller/BusStoreInfoController.java | 18 +++++ .../ruoyi/business/resp/RespBusStoreInfo.java | 74 ++++++++++++------- .../mapper/BusStoreDayInfoMapper.java | 20 +++-- .../service/IBusStoreDayInfoService.java | 19 +++-- .../impl/BusStoreDayInfoServiceImpl.java | 23 ++++-- .../service/impl/MeituanServiceImpl.java | 7 -- .../business/BusStoreDayHistoryInfoMapper.xml | 4 +- .../mapper/business/BusStoreDayInfoMapper.xml | 16 ++-- ruoyi-ui/src/views/statistics/shop/index.vue | 2 +- 10 files changed, 123 insertions(+), 69 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 ef1432a..e4c25a9 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 @@ -9,9 +9,11 @@ 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.service.IBusReturnVisitInfoService; +import com.ruoyi.business.service.IBusStoreDayInfoService; import com.ruoyi.business.service.IBusStoreInfoService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -44,6 +46,8 @@ public class BusStoreDayHistoryInfoController extends BaseController @Autowired private IBusStoreDayHistoryInfoService busStoreDayHistoryInfoService; @Autowired + private IBusStoreDayInfoService busStoreDayInfoService; + @Autowired private IBusStoreInfoService busStoreInfoService; @Autowired private IBusReturnVisitInfoService iBusReturnVisitInfoService; @@ -80,8 +84,9 @@ public class BusStoreDayHistoryInfoController extends BaseController int visitCount = iBusReturnVisitInfoService.getByDate(storeInfo.getStoreCode(),sT,eT); excelInfo.setVisitNumber(visitCount); - BusStoreDayHistoryInfo data = busStoreDayHistoryInfoService.getByDate(storeId,sT,eT); - if (data != null && data.getLastPositiveReviewsNum() != null){ +// BusStoreDayHistoryInfo data = busStoreDayHistoryInfoService.getByDate(storeId,sT,eT); + BusStoreDayInfo data = busStoreDayInfoService.getByDate(storeId,sT,eT); + if (data != null){ excelInfo.setCommentsNumber(data.getLastPositiveReviewsNum()); totalComments += data.getLastPositiveReviewsNum(); }else{ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java index ad383f7..a68fc52 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java @@ -314,6 +314,24 @@ public class BusStoreInfoController extends BaseController { if(list1.size() == 1){ info.setReturnVisitUserRange(list1.get(0).getMinOrderNum()+"~"+list1.get(0).getMaxOrderNum()); } + if("1".equals(info.getPlatformType())){ + info.setPlatformType("美团"); + } + if ("1".equals(info.getGrantStatus())){ + info.setGrantStatus("在线"); + }else if("2".equals(info.getGrantStatus())){ + info.setGrantStatus("掉线"); + } + if ("1".equals(info.getReturnVisitStatus())){ + info.setReturnVisitStatus("开启"); + }else if("2".equals(info.getReturnVisitStatus())){ + info.setReturnVisitStatus("关闭"); + } + if ("1".equals(info.getSelfDeliveryStatus())){ + info.setSelfDeliveryStatus("正常"); + }else if("2".equals(info.getSelfDeliveryStatus())){ + info.setSelfDeliveryStatus("自配送"); + } return info; }) .collect(Collectors.toList()); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/business/resp/RespBusStoreInfo.java b/ruoyi-admin/src/main/java/com/ruoyi/business/resp/RespBusStoreInfo.java index 4a31c39..195dcfd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/business/resp/RespBusStoreInfo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/business/resp/RespBusStoreInfo.java @@ -1,5 +1,7 @@ package com.ruoyi.business.resp; +import com.alibaba.fastjson2.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.ruoyi.business.domain.BusStoreInfo; import com.ruoyi.common.annotation.Excel; import io.swagger.annotations.ApiModel; @@ -22,6 +24,7 @@ public class RespBusStoreInfo { */ @ApiModelProperty(name = "平台类型") @Excel(name = "平台类型") + @JSONField(ordinal = 1) private String platformType; /** @@ -29,6 +32,7 @@ public class RespBusStoreInfo { */ @ApiModelProperty(name = "编号") @Excel(name = "编号") + @JSONField(ordinal = 2) private String storeCode; /** @@ -36,6 +40,7 @@ public class RespBusStoreInfo { */ @ApiModelProperty(name = "名称") @Excel(name = "名称") + @JSONField(ordinal = 3) private String storeName; /** @@ -44,11 +49,47 @@ public class RespBusStoreInfo { // @ApiModelProperty(name = "归属") private String storeBelong; + @ApiModelProperty(name = "昨日订单量") + @Excel(name = "昨日单量") + @JSONField(ordinal = 4) + private int lastOrderNum; + + /** 昨日好评量 */ + @ApiModelProperty(name = "昨日好评量") + @Excel(name = "昨日好评量") + @JSONField(ordinal = 5) + private int lastPositiveReviewsNum; + + /** 昨日五星量 */ + @ApiModelProperty(name = "昨日五星量") + @Excel(name = "昨日五星量") + @JSONField(ordinal = 6) + private int lastFiveStarReviewsNum; + + /** 昨日回访量 */ + @ApiModelProperty(name = "昨日回访量") + @Excel(name = "昨日回访量") + @JSONField(ordinal = 7) + private int lastReturnVisitNum; + + /** 昨日回访比50% */ + @ApiModelProperty(name = "昨日回访比50%") + @Excel(name = "昨日回访比") + @JSONField(ordinal = 8) + private String lastReturnVisitRate; + + /** 今日回访量 */ + @ApiModelProperty(name = "今日回访量") + @Excel(name = "今日回访量") + @JSONField(ordinal = 9) + private int todayReturnVisitNum; + /** * 授权状态 */ @ApiModelProperty(name = "授权状态") @Excel(name = "在线状态") + @JSONField(ordinal = 10) private String grantStatus; /** @@ -56,6 +97,7 @@ public class RespBusStoreInfo { */ @ApiModelProperty(name = "回访状态") @Excel(name = "是否开启") + @JSONField(ordinal = 11) private String returnVisitStatus; /** @@ -63,6 +105,7 @@ public class RespBusStoreInfo { */ @ApiModelProperty(name = "是否自配送") @Excel(name = "是否自配送") + @JSONField(ordinal = 12) private String selfDeliveryStatus; /** @@ -70,6 +113,7 @@ public class RespBusStoreInfo { */ @ApiModelProperty(name = "回访用户区间{=营销用户下单?}") @Excel(name = "营销用户区间") + @JSONField(ordinal = 13) private String returnVisitUserRange; /** @@ -83,6 +127,7 @@ public class RespBusStoreInfo { */ @ApiModelProperty(name = "归属销售姓名") @Excel(name = "归属销售姓名") + @JSONField(ordinal = 14) private String saleBindName; /** @@ -91,38 +136,11 @@ public class RespBusStoreInfo { @ApiModelProperty(name = "绑定时间(创建)") private Date bindTime; - /** 昨日订单量 */ - @ApiModelProperty(name = "昨日订单量") - @Excel(name = "昨日单量") - private int lastOrderNum; - /** 昨日好评量 */ - @ApiModelProperty(name = "昨日好评量") - @Excel(name = "昨日好评量") - private int lastPositiveReviewsNum; - - /** 昨日五星量 */ - @ApiModelProperty(name = "昨日五星量") - @Excel(name = "昨日五星量") - private int lastFiveStarReviewsNum; - - /** 昨日回访量 */ - @ApiModelProperty(name = "昨日回访量") - @Excel(name = "昨日回访量") - private int lastReturnVisitNum; - - /** 昨日回访比50% */ - @ApiModelProperty(name = "昨日回访比50%") - @Excel(name = "昨日回访比") - private String lastReturnVisitRate; - - /** 今日回访量 */ - @ApiModelProperty(name = "今日回访量") - @Excel(name = "今日回访量") - private int todayReturnVisitNum; /** 评分 */ @Excel(name = "评分") + @JSONField(ordinal = 15) private String score; public RespBusStoreInfo() { diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayInfoMapper.java index fe36b84..814fe4c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayInfoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayInfoMapper.java @@ -1,19 +1,22 @@ package com.ruoyi.business.mapper; import java.util.List; + +import com.ruoyi.business.domain.BusStoreDayHistoryInfo; import com.ruoyi.business.domain.BusStoreDayInfo; +import org.apache.ibatis.annotations.Param; /** * 店铺单日信息Mapper接口 - * + * * @author ruoyi * @date 2024-07-02 */ -public interface BusStoreDayInfoMapper +public interface BusStoreDayInfoMapper { /** * 查询店铺单日信息 - * + * * @param id 店铺单日信息主键 * @return 店铺单日信息 */ @@ -21,7 +24,7 @@ public interface BusStoreDayInfoMapper /** * 查询店铺单日信息列表 - * + * * @param busStoreDayInfo 店铺单日信息 * @return 店铺单日信息集合 */ @@ -29,7 +32,7 @@ public interface BusStoreDayInfoMapper /** * 新增店铺单日信息 - * + * * @param busStoreDayInfo 店铺单日信息 * @return 结果 */ @@ -37,7 +40,7 @@ public interface BusStoreDayInfoMapper /** * 修改店铺单日信息 - * + * * @param busStoreDayInfo 店铺单日信息 * @return 结果 */ @@ -45,7 +48,7 @@ public interface BusStoreDayInfoMapper /** * 删除店铺单日信息 - * + * * @param id 店铺单日信息主键 * @return 结果 */ @@ -53,9 +56,10 @@ public interface BusStoreDayInfoMapper /** * 批量删除店铺单日信息 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ public int deleteBusStoreDayInfoByIds(Long[] ids); + BusStoreDayInfo getByDate(@Param("id") Long id, @Param("sT") String sT, @Param("eT") String eT); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/IBusStoreDayInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/IBusStoreDayInfoService.java index 154ad7f..c8eff63 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/IBusStoreDayInfoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/IBusStoreDayInfoService.java @@ -1,19 +1,21 @@ package com.ruoyi.business.service; import java.util.List; + +import com.ruoyi.business.domain.BusStoreDayHistoryInfo; import com.ruoyi.business.domain.BusStoreDayInfo; /** * 店铺单日信息Service接口 - * + * * @author ruoyi * @date 2024-07-02 */ -public interface IBusStoreDayInfoService +public interface IBusStoreDayInfoService { /** * 查询店铺单日信息 - * + * * @param id 店铺单日信息主键 * @return 店铺单日信息 */ @@ -21,7 +23,7 @@ public interface IBusStoreDayInfoService /** * 查询店铺单日信息列表 - * + * * @param busStoreDayInfo 店铺单日信息 * @return 店铺单日信息集合 */ @@ -29,7 +31,7 @@ public interface IBusStoreDayInfoService /** * 新增店铺单日信息 - * + * * @param busStoreDayInfo 店铺单日信息 * @return 结果 */ @@ -37,7 +39,7 @@ public interface IBusStoreDayInfoService /** * 修改店铺单日信息 - * + * * @param busStoreDayInfo 店铺单日信息 * @return 结果 */ @@ -45,7 +47,7 @@ public interface IBusStoreDayInfoService /** * 批量删除店铺单日信息 - * + * * @param ids 需要删除的店铺单日信息主键集合 * @return 结果 */ @@ -53,9 +55,10 @@ public interface IBusStoreDayInfoService /** * 删除店铺单日信息信息 - * + * * @param id 店铺单日信息主键 * @return 结果 */ public int deleteBusStoreDayInfoById(Long id); + BusStoreDayInfo getByDate(Long id, String sT, String eT); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayInfoServiceImpl.java index b1ee4ad..78e9d58 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayInfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayInfoServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.business.service.impl; import java.util.List; + +import com.ruoyi.business.domain.BusStoreDayHistoryInfo; import com.ruoyi.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -10,19 +12,19 @@ import com.ruoyi.business.service.IBusStoreDayInfoService; /** * 店铺单日信息Service业务层处理 - * + * * @author ruoyi * @date 2024-07-02 */ @Service -public class BusStoreDayInfoServiceImpl implements IBusStoreDayInfoService +public class BusStoreDayInfoServiceImpl implements IBusStoreDayInfoService { @Autowired private BusStoreDayInfoMapper busStoreDayInfoMapper; /** * 查询店铺单日信息 - * + * * @param id 店铺单日信息主键 * @return 店铺单日信息 */ @@ -34,7 +36,7 @@ public class BusStoreDayInfoServiceImpl implements IBusStoreDayInfoService /** * 查询店铺单日信息列表 - * + * * @param busStoreDayInfo 店铺单日信息 * @return 店铺单日信息 */ @@ -46,7 +48,7 @@ public class BusStoreDayInfoServiceImpl implements IBusStoreDayInfoService /** * 新增店铺单日信息 - * + * * @param busStoreDayInfo 店铺单日信息 * @return 结果 */ @@ -59,7 +61,7 @@ public class BusStoreDayInfoServiceImpl implements IBusStoreDayInfoService /** * 修改店铺单日信息 - * + * * @param busStoreDayInfo 店铺单日信息 * @return 结果 */ @@ -71,7 +73,7 @@ public class BusStoreDayInfoServiceImpl implements IBusStoreDayInfoService /** * 批量删除店铺单日信息 - * + * * @param ids 需要删除的店铺单日信息主键 * @return 结果 */ @@ -83,7 +85,7 @@ public class BusStoreDayInfoServiceImpl implements IBusStoreDayInfoService /** * 删除店铺单日信息信息 - * + * * @param id 店铺单日信息主键 * @return 结果 */ @@ -92,4 +94,9 @@ public class BusStoreDayInfoServiceImpl implements IBusStoreDayInfoService { return busStoreDayInfoMapper.deleteBusStoreDayInfoById(id); } + + @Override + public BusStoreDayInfo getByDate(Long id, String sT, String eT) { + return busStoreDayInfoMapper.getByDate(id, sT,eT); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java index 5f9ef88..f7763ef 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java @@ -7,20 +7,16 @@ import com.ruoyi.business.domain.*; import com.ruoyi.business.mapper.*; import com.ruoyi.business.service.*; import com.ruoyi.common.config.ProxyProperties; -import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; -import jdk.nashorn.internal.runtime.logging.Logger; import org.apache.http.HttpEntity; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; -import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -32,14 +28,12 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import org.apache.ibatis.javassist.Loader; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.io.IOException; import java.net.URLEncoder; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -47,7 +41,6 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; -import java.util.stream.Collectors; /** * 采集美团数据service diff --git a/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml index 2ad4b0c..785a91e 100644 --- a/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml @@ -31,12 +31,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ifnull(a.last_positive_reviews_num,0) as commentsNumber, ifnull(b.price,0) as price, (ifnull(b.price,0) * ifnull(a.last_return_visit_num,0)) as money - from bus_store_day_history_info a INNER JOIN bus_store_info b on b.id = a.store_id + from bus_store_day_info a INNER JOIN bus_store_info b on b.id = a.store_id - + and store_id = #{storeId} @@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + where store_id = #{id} and DATE_SUB(create_time, INTERVAL 1 DAY) between #{sT} and #{eT} + + + diff --git a/ruoyi-ui/src/views/statistics/shop/index.vue b/ruoyi-ui/src/views/statistics/shop/index.vue index 377242b..f508c2e 100644 --- a/ruoyi-ui/src/views/statistics/shop/index.vue +++ b/ruoyi-ui/src/views/statistics/shop/index.vue @@ -789,7 +789,7 @@ export default { handleExport(data) { this.download('business/store/export', { ...this.queryParams1 - }, `export_${new Date().getTime()}.xlsx`) + }, `store_${new Date().getTime()}.xlsx`) } } };