| @@ -92,9 +92,10 @@ public class MarkingDataReportController extends BaseController { | |||||
| public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] MarkingDataReportController::touchUsersDataList"); | logger.debug("[" + getIpAddr() + "] MarkingDataReportController::touchUsersDataList"); | ||||
| TenantEntity tenantInfo = getTenantInfo(); | TenantEntity tenantInfo = getTenantInfo(); | ||||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantInfo); | |||||
| markingCouponDataReportDto.setTenantEntitys(tenantEntitys); | |||||
| //List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantInfo); | |||||
| //markingCouponDataReportDto.setTenantEntitys(tenantEntitys); | |||||
| markingCouponDataReportDto.updateTenantInfo(tenantInfo); | markingCouponDataReportDto.updateTenantInfo(tenantInfo); | ||||
| markingCouponDataReportDto.setTenantEntity(tenantInfo); | |||||
| return new ResultData(markingDataReportService.getTouchUsersReportList(markingCouponDataReportDto, pageNum, pageSize)); | return new ResultData(markingDataReportService.getTouchUsersReportList(markingCouponDataReportDto, pageNum, pageSize)); | ||||
| } | } | ||||
| @@ -103,9 +104,10 @@ public class MarkingDataReportController extends BaseController { | |||||
| @SystemControllerLog(description = "券数据-触达用户数数据导出") | @SystemControllerLog(description = "券数据-触达用户数数据导出") | ||||
| public void exportTouchUsersData(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, HttpServletRequest request, HttpServletResponse response) { | public void exportTouchUsersData(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, HttpServletRequest request, HttpServletResponse response) { | ||||
| TenantEntity tenantInfo = getTenantInfo(); | TenantEntity tenantInfo = getTenantInfo(); | ||||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantInfo); | |||||
| markingCouponDataReportDto.setTenantEntitys(tenantEntitys); | |||||
| //List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantInfo); | |||||
| //markingCouponDataReportDto.setTenantEntitys(tenantEntitys); | |||||
| markingCouponDataReportDto.updateTenantInfo(tenantInfo); | markingCouponDataReportDto.updateTenantInfo(tenantInfo); | ||||
| markingCouponDataReportDto.setTenantEntity(tenantInfo); | |||||
| markingDataReportService.exportTouchUsersData(request, response, markingCouponDataReportDto); | markingDataReportService.exportTouchUsersData(request, response, markingCouponDataReportDto); | ||||
| } | } | ||||
| @@ -27,6 +27,8 @@ public class MarkingCouponDataReportDto extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private List<TenantEntity> tenantEntitys; | private List<TenantEntity> tenantEntitys; | ||||
| @TableField(exist = false) | |||||
| private TenantEntity tenantEntity; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @SortColumn(column = "xTime") | @SortColumn(column = "xTime") | ||||
| @@ -82,7 +82,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryVerified(HashMap<String,Object> params); | List<MarkingSceneDataVo> queryForSceneRepotyHistoryVerified(HashMap<String,Object> params); | ||||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryOrdered(HashMap<String,Object> params); | List<MarkingSceneDataVo> queryForSceneRepotyHistoryOrdered(HashMap<String,Object> params); | ||||
| List<MarkingSceneDataVo> queryForSceneRepotyMechantHistoryOrdered(HashMap<String,Object> params); | |||||
| //List<MarkingSceneDataVo> queryForSceneRepotyMechantHistoryOrdered(HashMap<String,Object> params); | |||||
| @@ -309,6 +309,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | ||||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | params.put("parentTenantId", tenantEntity.getParentTenantId()); | ||||
| } | } | ||||
| params.put("tenantEntity", tenantEntity); | |||||
| if (markingCouponDataReportDto.getStartTime() != null) | if (markingCouponDataReportDto.getStartTime() != null) | ||||
| params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(), 0)); | params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(), 0)); | ||||
| if (markingCouponDataReportDto.getEndTime() != null) | if (markingCouponDataReportDto.getEndTime() != null) | ||||
| @@ -491,13 +492,13 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getXtime, p -> p.getTriggerCount())); | triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getXtime, p -> p.getTriggerCount())); | ||||
| }else if (markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.MERCHANT.getCode())) { | }else if (markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.MERCHANT.getCode())) { | ||||
| //购买发券数 | //购买发券数 | ||||
| if (markingCouponDataReportDto.getStartTime() != null) | |||||
| params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0)); | |||||
| if (markingCouponDataReportDto.getEndTime() != null) | |||||
| params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1)); | |||||
| params.put("channelType", markingCouponDataReportDto.getType()); | |||||
| List<MarkingSceneDataVo> markingSceneDataVos = wxCouponOrderMapper.queryForSceneRepotyMechantHistoryOrdered(params); | |||||
| triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getXtime, p -> p.getTriggerCount())); | |||||
| // if (markingCouponDataReportDto.getStartTime() != null) | |||||
| // params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0)); | |||||
| // if (markingCouponDataReportDto.getEndTime() != null) | |||||
| // params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1)); | |||||
| // params.put("channelType", markingCouponDataReportDto.getType()); | |||||
| // List<MarkingSceneDataVo> markingSceneDataVos = wxCouponOrderMapper.queryForSceneRepotyMechantHistoryOrdered(params); | |||||
| // triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getXtime, p -> p.getTriggerCount())); | |||||
| } | } | ||||
| NumberFormat nf = NumberFormat.getPercentInstance(); | NumberFormat nf = NumberFormat.getPercentInstance(); | ||||
| nf.setMinimumFractionDigits(2); | nf.setMinimumFractionDigits(2); | ||||
| @@ -1456,9 +1456,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| wxCouponOrder.setStartTime(startTime); | wxCouponOrder.setStartTime(startTime); | ||||
| wxCouponOrder.setEndTime(endTime); | wxCouponOrder.setEndTime(endTime); | ||||
| // wxCouponOrder.updateTenantInfo(tenantEntity); | // wxCouponOrder.updateTenantInfo(tenantEntity); | ||||
| //TODO 待优化数据 | |||||
| //int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys);//月消费金额 | |||||
| int thisMonthCount = 0; | |||||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys);//月消费金额 | |||||
| c.clear(); | c.clear(); | ||||
| c.add(Calendar.DAY_OF_YEAR, -1); | c.add(Calendar.DAY_OF_YEAR, -1); | ||||
| c.set(Calendar.HOUR_OF_DAY, 0); | c.set(Calendar.HOUR_OF_DAY, 0); | ||||
| @@ -343,13 +343,7 @@ | |||||
| <select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | <select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | ||||
| SELECT createTime,couponId,sum(couponCount) couponCount,sum(couponUserCount) couponUserCount,sum(verifyCount) verifyCount,sum(verifyUserCount) verifyUserCount | SELECT createTime,couponId,sum(couponCount) couponCount,sum(couponUserCount) couponUserCount,sum(verifyCount) verifyCount,sum(verifyUserCount) verifyUserCount | ||||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||||
| SELECT * from view_coupon_data${tenantEntity.shardTableSuffix} WHERE `tenant_id` = #{tenantEntity.tenantId} | |||||
| </foreach>) view_coupon_data | |||||
| where 1=1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| from view_coupon_data${tenantEntity.shardTableSuffix} WHERE `tenant_id` = #{tenantEntity.tenantId} | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| @@ -372,13 +366,7 @@ | |||||
| <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="com.iformall.domain.dto.MarkingCouponDataReportDto"> | <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="com.iformall.domain.dto.MarkingCouponDataReportDto"> | ||||
| SELECT xTime, sum(pv) pv, sum(uv) uv, sum(couponCount) couponCount, sum(userCount) userCount, sum(verifyCount) verifyCount, sum(verifyUserCount) verifyUserCount | SELECT xTime, sum(pv) pv, sum(uv) uv, sum(couponCount) couponCount, sum(userCount) userCount, sum(verifyCount) verifyCount, sum(verifyUserCount) verifyUserCount | ||||
| FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||||
| SELECT * from view_touch_user${tenantEntity.shardTableSuffix} WHERE `tenant_id` = #{tenantEntity.tenantId} | |||||
| </foreach>) view_touch_user | |||||
| WHERE 1=1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| from view_touch_user${tenantEntity.shardTableSuffix} WHERE `tenant_id` = #{tenantEntity.tenantId} | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| @@ -395,9 +383,7 @@ | |||||
| <select id="queryForSceneRepotyHistoryVerified" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | <select id="queryForSceneRepotyHistoryVerified" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | ||||
| select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | ||||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||||
| </foreach>) c | |||||
| from wx_coupon_order c | |||||
| where c.coupon_order_status = 1 | where c.coupon_order_status = 1 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and c.`tenant_id` = #{tenantId} | and c.`tenant_id` = #{tenantId} | ||||
| @@ -413,13 +399,7 @@ | |||||
| <select id="queryForSceneRepotyHistoryOrdered" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | <select id="queryForSceneRepotyHistoryOrdered" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | ||||
| select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | ||||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||||
| </foreach>) c | |||||
| where 1=1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and c.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| from wx_coupon_order c where c.`tenant_id` = #{tenantId} | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and c.`parent_tenant_id` = #{parentTenantId} | and c.`parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| @@ -429,13 +409,13 @@ | |||||
| group by xTime | group by xTime | ||||
| </select> | </select> | ||||
| <select id="queryForSceneRepotyMechantHistoryOrdered" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | |||||
| <!-- <select id="queryForSceneRepotyMechantHistoryOrdered" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | |||||
| select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | ||||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||||
| </foreach>) c left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||||
| </foreach>) cal on cal.tenant_id = c.tenant_id | |||||
| from ( | |||||
| SELECT * from wx_coupon_order | |||||
| ) c left join ( | |||||
| SELECT * from wx_coupon_action_log | |||||
| ) cal on cal.tenant_id = c.tenant_id | |||||
| where cal.coupon_order_id=c.id | where cal.coupon_order_id=c.id | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and c.`tenant_id` = #{tenantId} | and c.`tenant_id` = #{tenantId} | ||||
| @@ -450,14 +430,11 @@ | |||||
| and c.create_date BETWEEN #{startTime} and #{endTime} | and c.create_date BETWEEN #{startTime} and #{endTime} | ||||
| </if> | </if> | ||||
| group by xTime | group by xTime | ||||
| </select> | |||||
| </select> --> | |||||
| <select id="queryPriceTotal" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer" > | <select id="queryPriceTotal" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer" > | ||||
| SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order | SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order | ||||
| where 1=1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| where `tenant_id` = #{tenantId} | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| @@ -474,10 +451,10 @@ | |||||
| and coupon_type = #{couponType} | and coupon_type = #{couponType} | ||||
| </if> | </if> | ||||
| <if test=" null != startTime"> | <if test=" null != startTime"> | ||||
| and create_date >= #{startTime} | |||||
| and create_date_times >= unix_timestamp(#{startTime})*1000 | |||||
| </if> | </if> | ||||
| <if test=" null != endTime"> | <if test=" null != endTime"> | ||||
| and create_date <= #{endTime} | |||||
| and create_date_times <= unix_timestamp(#{endTime})*1000 | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||