From bb5b79aaef860d6bf696eb30ddec648a4d7a9376 Mon Sep 17 00:00:00 2001 From: winter Date: Fri, 14 Jan 2022 15:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=B8=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/mapper/WxCouponOrderMapper.java | 4 +- .../service/WxCouponOrderService.java | 3 + .../service/impl/WxChartServiceImpl.java | 45 +++++-- .../impl/WxCouponOrderServiceImpl.java | 110 ++++++++++++++++++ .../resources/mapper/WxCouponOrderMapper.xml | 89 +++++++------- 5 files changed, 195 insertions(+), 56 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java index 789763819..ffd01ef62 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java @@ -57,7 +57,9 @@ public interface WxCouponOrderMapper extends CommonMapper { WxCouponOrder findDetailOfAdmin(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("finalTenantId")String finalTenantId); //营销报表 券数据图表 - List couponDataMap(HashMap params); + //List couponDataMap(HashMap params); + HashMap findCreateDateCouponOrderCount(HashMap params); + HashMap findCreateDateCouponOrderUserCount(HashMap params); //营销报表 券数据报表 List couponDataList(HashMap params); //返回日期格式yy-MM-dd diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java index 6b2292519..de8c1db2d 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java @@ -13,6 +13,7 @@ import com.iformall.service.order.entity.WxComposeOrder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -226,4 +227,6 @@ public interface WxCouponOrderService { Integer findCount(WxCouponOrder wxCouponOrder); PageInfo goodsListAsPage(WxCouponOrderBVo couponOrderBvo, Integer pageNum, Integer pageSize); + + List couponDataMap(TenantEntity tenantEntity,Date startTime,Date endTime); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java index 3ff2c7c5c..44d90ab30 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -70,8 +71,11 @@ public class WxChartServiceImpl implements WxChartDataService { WxLevelConfigMapper wxLevelConfigMapper; @Autowired WxCUserTagsMapper wxCUserTagsMapper; + + @Lazy @Autowired WxCouponService wxCouponService; + @Autowired WxOrderGroupMapper wxOrderGroupMapper; @Autowired @@ -82,23 +86,40 @@ public class WxChartServiceImpl implements WxChartDataService { WxBillOtherMapper wxBillOtherMapper; @Autowired WxBillAllMapper wxBillAllMapper; + + @Lazy @Autowired MarkingDataReportService markingDataReportService; + + @Lazy @Autowired WxBusinessService wxBusinessService; + @Lazy @Autowired WxCouponOrderService wxCouponOrderService; + + @Lazy @Autowired KwMeterDataService kwMeterDataService; + + @Lazy @Autowired KwMerchantMeterService kwMerchantMeterService; + + @Lazy @Autowired KwMeterService kwMeterService; + + @Lazy @Autowired private WxCUserBasicInfoService wxCUserBasicInfoService; + + @Lazy @Autowired private WxCUserService wxCUserService; + + @Lazy @Autowired private WxCUserCarService wxCUserCarService; @@ -1893,17 +1914,19 @@ public class WxChartServiceImpl implements WxChartDataService { String startdate; String enddate; HashMap datamap = new HashMap<>(); - List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); - //couponData - HashMap params = new HashMap<>(); - params.put("tenantEntitys",tenantEntitys); - params.put("tenantId", tenantEntity.getTenantId()); - if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { - params.put("tenantId", tenantEntity.getParentTenantId()); - } - params.put("startTime", addDay(-30)); - params.put("endTime", addDay(1)); - List couponDatalist = wxCouponOrderMapper.couponDataMap(params); +// List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); +// //couponData +// HashMap params = new HashMap<>(); +// params.put("tenantEntitys",tenantEntitys); +// params.put("tenantId", tenantEntity.getTenantId()); +// if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { +// params.put("tenantId", tenantEntity.getParentTenantId()); +// } +// params.put("startTime", addDay(-30)); +// params.put("endTime", addDay(1)); + + + List couponDatalist = wxCouponOrderService.couponDataMap(tenantEntity,addDay(-30),addDay(1)); //查询券领取人数 startdate = DateUtils.getTimeBefore(30, new Date()); enddate = DateUtils.getTimeBefore(1, new Date()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index 0b6bedfa1..56afdbf7b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -42,6 +42,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Lazy; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -82,12 +83,15 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { @Autowired WxCUserBasicInfoMapper wxCUserBasicInfoMapper; + @Lazy @Autowired WxOrderService wxOrderService; + @Lazy @Autowired WxCouponSendService wxCouponSendService; + @Lazy @Autowired WxProfitSharingOrderService wxProfitSharingOrderService; @@ -106,6 +110,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { @Autowired WxCouponMapper wxCouponMapper; + @Lazy @Autowired WxAppinfoService wxAppinfoService; @@ -133,12 +138,15 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { @Autowired ExcelService excelService; + @Lazy @Autowired WxCreditHistoryService wxCreditHistoryService; + @Lazy @Autowired WxScoreRulesService wxScoreRulesService; + @Lazy @Autowired WxMsgLimitService wxMsgLimitService; @@ -151,6 +159,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { @Autowired PayServiceFactory payServiceFactory; + @Lazy @Autowired WxCashOutService cashOutService; @@ -164,10 +173,15 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { @Autowired OrderFactory orderFactory; + @Lazy @Autowired WxCUserBasicInfoService wxCUserBasicInfoService; + + @Lazy @Autowired SysConfigService sysConfigService; + + @Lazy @Autowired WxMerchantBUserService wxMerchantBUserService; @@ -2379,5 +2393,101 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { public PageInfo goodsListAsPage(WxCouponOrderBVo record, Integer pageIndex, Integer pageSize) { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findGoodsList(record)); } + + @Override + public List couponDataMap(TenantEntity tenantEntity,Date startTime,Date endTime) { + + List dateList = new ArrayList(); + + //券数量 + HashMap paramMap = new HashMap(); + paramMap.put("tenantId", tenantEntity.getTenantId()); + paramMap.put("parentTenantId", tenantEntity.getParentTenantId()); + paramMap.put("startCreateDateTimes", startTime.getTime()); + paramMap.put("endCreateDateTimes", endTime.getTime()); + Map couponCount = wxCouponOrderMapper.findCreateDateCouponOrderCount(paramMap); + if (null != couponCount) { + for (Iterator it = couponCount.keySet().iterator();it.hasNext();) { + String date = it.next(); + if (!dateList.contains(date)){ + dateList.add(date); + } + } + } + + //券领取人数 + Map couponUserCount = wxCouponOrderMapper.findCreateDateCouponOrderUserCount(paramMap); + if (null != couponUserCount) { + for (Iterator it = couponUserCount.keySet().iterator();it.hasNext();) { + String date = it.next(); + if (!dateList.contains(date)){ + dateList.add(date); + } + } + } + + //核销数量 + HashMap verfiyParamMap = new HashMap(); + verfiyParamMap.put("tenantId", tenantEntity.getTenantId()); + verfiyParamMap.put("parentTenantId", tenantEntity.getParentTenantId()); + verfiyParamMap.put("couponOrderStatus", 1); + verfiyParamMap.put("updateStartTime", startTime); + verfiyParamMap.put("updateEndTime", endTime); + Map verfiyCount = wxCouponOrderMapper.findCreateDateCouponOrderCount(verfiyParamMap); + if (null != verfiyCount) { + for (Iterator it = verfiyCount.keySet().iterator();it.hasNext();) { + String date = it.next(); + if (!dateList.contains(date)){ + dateList.add(date); + } + } + } + + //券核销人数 + Map verfiyUserCount = wxCouponOrderMapper.findCreateDateCouponOrderUserCount(verfiyParamMap); + if (null != verfiyUserCount) { + for (Iterator it = verfiyUserCount.keySet().iterator();it.hasNext();) { + String date = it.next(); + if (!dateList.contains(date)){ + dateList.add(date); + } + } + } + + if (dateList.size() > 0) { + List volist = new ArrayList(); + for (int i = 0 ; i < dateList.size(); i ++) { + String date = dateList.get(i); + MarkingCouponDataReportVo vo = new MarkingCouponDataReportVo(); + if (null != couponCount && couponCount.containsKey(date)) { + vo.setCouponCount(couponCount.get(date)); + }else { + vo.setCouponCount(0); + } + + if (null != couponUserCount && couponUserCount.containsKey(date)) { + vo.setCouponUserCount(couponUserCount.get(date));; + }else { + vo.setCouponUserCount(0); + } + + if (null != verfiyCount && verfiyCount.containsKey(date)) { + vo.setVerifyCount(verfiyCount.get(date)); + }else { + vo.setVerifyCount(0); + } + + if (null != verfiyUserCount && verfiyUserCount.containsKey(date)) { + vo.setVerifyUserCount(verfiyUserCount.get(date)); + }else { + vo.setVerifyUserCount(0); + } + volist.add(vo); + } + return volist; + } + + return null; + } } diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index baa11545c..fcd96cc58 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -186,20 +186,19 @@ co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info` from wx_coupon_order co where co.tenant_id = #{tenantId} + + AND co.create_date_times > #{startDateTimes} + + + AND co.create_date_times < #{endDateTimes} + and co.coupon_id in #{couponIdItem} - - AND co.create_date_times > #{startDateTimes} - - - AND co.create_date_times < #{endDateTimes} - order by co.create_date_times desc - @@ -293,53 +292,55 @@ where id=#{id} - + select DATE_FORMAT(create_date,'%m/%d') as createTime ,count(1) as count from wx_coupon_order + where `tenant_id` = #{tenantId} and `parent_tenant_id` = #{parentTenantId} - AND c.update_date >= #{startTime} - AND c.update_date <= #{endTime}) as verifyCount, - (select Count(DISTINCT c_user_id) - from ( - SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} - ) d - where coupon_order_status=1 - AND DATE_FORMAT(create_date,'%m/%d')=createTime - - and `tenant_id` = #{tenantId} + + AND co.create_date_times >= #{startCreateDateTimes} - - and `parent_tenant_id` = #{parentTenantId} + + AND co.create_date_times <= #{endCreateDateTimes} - AND d.update_date >= #{startTime} - AND d.update_date <= #{endTime}) as verifyUserCount - from ( - SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} - ) wx_coupon_order - where 1=1 - - and `tenant_id` = #{tenantId} + + and co.coupon_order_status = #{couponOrderStatus} + + + AND co.update_date >= #{updateStartTime} + + AND co.update_date <= #{updateEndTime} + + group by DATE_FORMAT(create_date,'%m/%d') + + + - +