| @@ -4,7 +4,9 @@ import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.service.MarkingDataReportService; | |||
| import com.iformall.service.WxMallService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -19,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| /** | |||
| * Created by syf on 2018/8/29. | |||
| @@ -31,6 +34,8 @@ public class MarkingDataReportController extends BaseController { | |||
| @Autowired | |||
| private MarkingDataReportService markingDataReportService; | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @ApiOperation("查询券数据") | |||
| @GetMapping("/couponData") | |||
| @@ -86,14 +91,21 @@ public class MarkingDataReportController extends BaseController { | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] MarkingDataReportController::touchUsersDataList"); | |||
| return new ResultData(markingDataReportService.getTouchUsersReportList(getTenantInfo(), markingCouponDataReportDto, pageNum, pageSize)); | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantInfo); | |||
| markingCouponDataReportDto.setTenantEntitys(tenantEntitys); | |||
| markingCouponDataReportDto.updateTenantInfo(tenantInfo); | |||
| return new ResultData(markingDataReportService.getTouchUsersReportList(markingCouponDataReportDto, pageNum, pageSize)); | |||
| } | |||
| @ApiOperation("触达用户数数据导出") | |||
| @GetMapping("/exportTouchUsersData") | |||
| @SystemControllerLog(description = "券数据-触达用户数数据导出") | |||
| public void exportTouchUsersData(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, HttpServletRequest request, HttpServletResponse response) { | |||
| markingCouponDataReportDto.updateTenantInfo(getTenantInfo()); | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantInfo); | |||
| markingCouponDataReportDto.setTenantEntitys(tenantEntitys); | |||
| markingCouponDataReportDto.updateTenantInfo(tenantInfo); | |||
| markingDataReportService.exportTouchUsersData(request, response, markingCouponDataReportDto); | |||
| } | |||
| @@ -24,6 +24,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; | |||
| import org.springframework.test.web.servlet.result.MockMvcResultHandlers; | |||
| import org.springframework.test.web.servlet.result.MockMvcResultMatchers; | |||
| import java.io.PrintStream; | |||
| import java.util.Arrays; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -154,4 +155,222 @@ public class CouponsendTest { | |||
| log.info("respMap -> {}", JSON.toJSONString(respMap)); | |||
| } | |||
| // @Test | |||
| // public void actionLog1() throws Exception { | |||
| // PrintStream ps = new PrintStream("C:/Users/xiaohu/Desktop/img/log.txt"); | |||
| // System.setOut(ps); | |||
| // for(int i = 0;i < 100;i++){ | |||
| // String str = "CREATE OR REPLACE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `view_coupon_data_000` AS SELECT\n" + | |||
| // "\t`baseInfo`.`createTime` AS `createTime`,\n" + | |||
| // "\t`baseInfo`.`couponId` AS `couponId`,\n" + | |||
| // "\t`baseInfo`.`couponUserCount` AS `couponUserCount`,\n" + | |||
| // "\t`baseInfo`.`couponCount` AS `couponCount`,\n" + | |||
| // "\t`baseInfo`.`verifyUserCount` AS `verifyUserCount`,\n" + | |||
| // "\t`baseInfo`.`verifyCount` AS `verifyCount`,\n" + | |||
| // "\t`c`.`type` AS `couponType`,\n" + | |||
| // "\t`c`.`tenant_id` AS `tenant_id`,\n" + | |||
| // "\t`c`.`parent_tenant_id` AS `parent_tenant_id`,\n" + | |||
| // "\t`c`.`title` AS `couponTitle`\n" + | |||
| // "FROM\n" + | |||
| // "\t(\n" + | |||
| // "\t(\n" + | |||
| // "\t(\n" + | |||
| // "SELECT\n" + | |||
| // "\t`orderInfo`.`createTime` AS `createTime`,\n" + | |||
| // "\t`orderInfo`.`couponId` AS `couponId`,\n" + | |||
| // "\t`orderInfo`.`couponUserCount` AS `couponUserCount`,\n" + | |||
| // "\t`orderInfo`.`couponCount` AS `couponCount`,\n" + | |||
| // "\tifnull( `verifiedInfo`.`verifyUserCount`, 0 ) AS `verifyUserCount`,\n" + | |||
| // "\tifnull( `verifiedInfo`.`verifyCount`, 0 ) AS `verifyCount`\n" + | |||
| // "FROM\n" + | |||
| // "\t(\n" + | |||
| // "\t(\n" + | |||
| // "\t(\n" + | |||
| // "\t(\n" + | |||
| // "SELECT\n" + | |||
| // "\tdate_format( `co`.`create_date`, '%Y-%m-%d' ) AS `createTime`,\n" + | |||
| // "\t`co`.`coupon_id` AS `couponId`,\n" + | |||
| // "\tcount( `co`.`c_user_id` ) AS `couponUserCount`,\n" + | |||
| // "\tcount( `co`.`coupon_id` ) AS `couponCount`\n" + | |||
| // "FROM\n" + | |||
| // "\t`wx_coupon_order_000` `co`\n" + | |||
| // "GROUP BY\n" + | |||
| // "\t`createTime`,\n" + | |||
| // "\t`couponId`\n" + | |||
| // "\t)\n" + | |||
| // "\t) `orderInfo`\n" + | |||
| // "\tLEFT JOIN (\n" + | |||
| // "SELECT\n" + | |||
| // "\tdate_format( `co`.`update_date`, '%Y-%m-%d' ) AS `updateTime`,\n" + | |||
| // "\t`co`.`coupon_id` AS `couponId`,\n" + | |||
| // "\t(\n" + | |||
| // "CASE\n" + | |||
| // "\n" + | |||
| // "\tWHEN ( `co`.`coupon_type` < 100 ) THEN\n" + | |||
| // "\tcount( IF ( ( `co`.`coupon_order_status` = 1 ), `co`.`coupon_id`, NULL ) ) ELSE (\n" + | |||
| // "\tSELECT\n" + | |||
| // "\t\tcount( `xcs`.`card_id` )\n" + | |||
| // "\tFROM\n" + | |||
| // "\t\t( `wx_coupon_order_000` `xco` JOIN `wx_card_spend` `xcs` )\n" + | |||
| // "\tWHERE\n" + | |||
| // "\t\t(\n" + | |||
| // "\t\t\t( date_format( `xcs`.`create_date`, '%Y-%m-%d' ) = `updateTime` )\n" + | |||
| // "\t\t\tAND ( `xco`.`coupon_id` = `co`.`coupon_id` )\n" + | |||
| // "\t\t\tAND ( `xco`.`id` = `xcs`.`card_id` )\n" + | |||
| // "\t\t)\n" + | |||
| // "\t)\n" + | |||
| // "END\n" + | |||
| // "\t) AS `verifyCount`,\n" + | |||
| // "\t(\n" + | |||
| // "\tCASE\n" + | |||
| // "\n" + | |||
| // "\t\t\tWHEN ( `co`.`coupon_type` < 100 ) THEN\n" + | |||
| // "\t\t\tcount( DISTINCT IF ( ( `co`.`coupon_order_status` = 1 ), `co`.`c_user_id`, NULL ) ) ELSE (\n" + | |||
| // "\t\t\tSELECT\n" + | |||
| // "\t\t\t\tcount( DISTINCT `xcs`.`owner_id` )\n" + | |||
| // "\t\t\tFROM\n" + | |||
| // "\t\t\t\t( `wx_coupon_order_000` `xco` JOIN `wx_card_spend` `xcs` )\n" + | |||
| // "\t\t\tWHERE\n" + | |||
| // "\t\t\t\t(\n" + | |||
| // "\t\t\t\t\t( date_format( `xcs`.`create_date`, '%Y-%m-%d' ) = `updateTime` )\n" + | |||
| // "\t\t\t\t\tAND ( `xco`.`coupon_id` = `co`.`coupon_id` )\n" + | |||
| // "\t\t\t\t\tAND ( `xco`.`id` = `xcs`.`card_id` )\n" + | |||
| // "\t\t\t\t)\n" + | |||
| // "\t\t\t)\n" + | |||
| // "\t\tEND\n" + | |||
| // "\t\t) AS `verifyUserCount`\n" + | |||
| // "\tFROM\n" + | |||
| // "\t\t`wx_coupon_order_000` `co`\n" + | |||
| // "\tWHERE\n" + | |||
| // "\t\t(\n" + | |||
| // "\t\tCASE\n" + | |||
| // "\n" + | |||
| // "\t\t\t\tWHEN ( `co`.`coupon_type` < 100 ) THEN\n" + | |||
| // "\t\t\t\t( `co`.`coupon_order_status` = 1 ) ELSE (\n" + | |||
| // "\t\t\t\t\t(\n" + | |||
| // "\t\t\t\t\tSELECT\n" + | |||
| // "\t\t\t\t\t\tcount( DISTINCT `xcs`.`owner_id` )\n" + | |||
| // "\t\t\t\t\tFROM\n" + | |||
| // "\t\t\t\t\t\t( `wx_coupon_order_000` `xco` JOIN `wx_card_spend` `xcs` )\n" + | |||
| // "\t\t\t\t\tWHERE\n" + | |||
| // "\t\t\t\t\t\t(\n" + | |||
| // "\t\t\t\t\t\t\t( date_format( `xcs`.`create_date`, '%Y-%m-%d' ) = date_format( `co`.`update_date`, '%Y-%m-%d' ) )\n" + | |||
| // "\t\t\t\t\t\t\tAND ( `xco`.`coupon_id` = `co`.`coupon_id` )\n" + | |||
| // "\t\t\t\t\t\t\tAND ( `xco`.`id` = `xcs`.`card_id` )\n" + | |||
| // "\t\t\t\t\t\t)\n" + | |||
| // "\t\t\t\t\t) > 0\n" + | |||
| // "\t\t\t\t)\n" + | |||
| // "\t\t\tEND\n" + | |||
| // "\t\t\t)\n" + | |||
| // "\t\tGROUP BY\n" + | |||
| // "\t\t\t`updateTime`,\n" + | |||
| // "\t\t\t`couponId`\n" + | |||
| // "\t\t) `verifiedInfo` ON ( ( ( `orderInfo`.`createTime` = `verifiedInfo`.`updateTime` ) AND ( `orderInfo`.`couponId` = `verifiedInfo`.`couponId` ) ) )\n" + | |||
| // "\t)\n" + | |||
| // "\tLEFT JOIN `wx_coupon_000` `c` ON ( ( `c`.`id` = `orderInfo`.`couponId` ) )\n" + | |||
| // "\t)\n" + | |||
| // "\t) UNION\n" + | |||
| // "SELECT\n" + | |||
| // "\t`verifiedInfo`.`updateTime` AS `createTime`,\n" + | |||
| // "\t`verifiedInfo`.`couponId` AS `couponId`,\n" + | |||
| // "\tifnull( `orderInfo`.`couponUserCount`, 0 ) AS `couponUserCount`,\n" + | |||
| // "\tifnull( `orderInfo`.`couponCount`, 0 ) AS `couponCount`,\n" + | |||
| // "\t`verifiedInfo`.`verifyUserCount` AS `verifyUserCount`,\n" + | |||
| // "\t`verifiedInfo`.`verifyCount` AS `verifyCount`\n" + | |||
| // "FROM\n" + | |||
| // "\t(\n" + | |||
| // "\t\t(\n" + | |||
| // "\t\t\t(\n" + | |||
| // "\t\t\tSELECT\n" + | |||
| // "\t\t\t\tdate_format( `co`.`update_date`, '%Y-%m-%d' ) AS `updateTime`,\n" + | |||
| // "\t\t\t\t`co`.`coupon_id` AS `couponId`,\n" + | |||
| // "\t\t\t\t(\n" + | |||
| // "\t\t\t\tCASE\n" + | |||
| // "\n" + | |||
| // "\t\t\t\t\t\tWHEN ( `co`.`coupon_type` < 100 ) THEN\n" + | |||
| // "\t\t\t\t\t\tcount( IF ( ( `co`.`coupon_order_status` = 1 ), `co`.`coupon_id`, NULL ) ) ELSE (\n" + | |||
| // "\t\t\t\t\t\tSELECT\n" + | |||
| // "\t\t\t\t\t\t\tcount( `xcs`.`card_id` )\n" + | |||
| // "\t\t\t\t\t\tFROM\n" + | |||
| // "\t\t\t\t\t\t\t( `wx_coupon_order_000` `xco` JOIN `wx_card_spend` `xcs` )\n" + | |||
| // "\t\t\t\t\t\tWHERE\n" + | |||
| // "\t\t\t\t\t\t\t(\n" + | |||
| // "\t\t\t\t\t\t\t\t( date_format( `xcs`.`create_date`, '%Y-%m-%d' ) = `updateTime` )\n" + | |||
| // "\t\t\t\t\t\t\t\tAND ( `xco`.`coupon_id` = `co`.`coupon_id` )\n" + | |||
| // "\t\t\t\t\t\t\t\tAND ( `xco`.`id` = `xcs`.`card_id` )\n" + | |||
| // "\t\t\t\t\t\t\t)\n" + | |||
| // "\t\t\t\t\t\t)\n" + | |||
| // "\t\t\t\t\tEND\n" + | |||
| // "\t\t\t\t\t) AS `verifyCount`,\n" + | |||
| // "\t\t\t\t\t(\n" + | |||
| // "\t\t\t\t\tCASE\n" + | |||
| // "\n" + | |||
| // "\t\t\t\t\t\t\tWHEN ( `co`.`coupon_type` < 100 ) THEN\n" + | |||
| // "\t\t\t\t\t\t\tcount( DISTINCT IF ( ( `co`.`coupon_order_status` = 1 ), `co`.`c_user_id`, NULL ) ) ELSE (\n" + | |||
| // "\t\t\t\t\t\t\tSELECT\n" + | |||
| // "\t\t\t\t\t\t\t\tcount( DISTINCT `xcs`.`owner_id` )\n" + | |||
| // "\t\t\t\t\t\t\tFROM\n" + | |||
| // "\t\t\t\t\t\t\t\t( `wx_coupon_order_000` `xco` JOIN `wx_card_spend` `xcs` )\n" + | |||
| // "\t\t\t\t\t\t\tWHERE\n" + | |||
| // "\t\t\t\t\t\t\t\t(\n" + | |||
| // "\t\t\t\t\t\t\t\t\t( date_format( `xcs`.`create_date`, '%Y-%m-%d' ) = `updateTime` )\n" + | |||
| // "\t\t\t\t\t\t\t\t\tAND ( `xco`.`coupon_id` = `co`.`coupon_id` )\n" + | |||
| // "\t\t\t\t\t\t\t\t\tAND ( `xco`.`id` = `xcs`.`card_id` )\n" + | |||
| // "\t\t\t\t\t\t\t\t)\n" + | |||
| // "\t\t\t\t\t\t\t)\n" + | |||
| // "\t\t\t\t\t\tEND\n" + | |||
| // "\t\t\t\t\t\t) AS `verifyUserCount`\n" + | |||
| // "\t\t\t\t\tFROM\n" + | |||
| // "\t\t\t\t\t\t`wx_coupon_order_000` `co`\n" + | |||
| // "\t\t\t\t\tWHERE\n" + | |||
| // "\t\t\t\t\t\t(\n" + | |||
| // "\t\t\t\t\t\tCASE\n" + | |||
| // "\n" + | |||
| // "\t\t\t\t\t\t\t\tWHEN ( `co`.`coupon_type` < 100 ) THEN\n" + | |||
| // "\t\t\t\t\t\t\t\t( `co`.`coupon_order_status` = 1 ) ELSE (\n" + | |||
| // "\t\t\t\t\t\t\t\t\t(\n" + | |||
| // "\t\t\t\t\t\t\t\t\tSELECT\n" + | |||
| // "\t\t\t\t\t\t\t\t\t\tcount( DISTINCT `xcs`.`owner_id` )\n" + | |||
| // "\t\t\t\t\t\t\t\t\tFROM\n" + | |||
| // "\t\t\t\t\t\t\t\t\t\t( `wx_coupon_order_000` `xco` JOIN `wx_card_spend` `xcs` )\n" + | |||
| // "\t\t\t\t\t\t\t\t\tWHERE\n" + | |||
| // "\t\t\t\t\t\t\t\t\t\t(\n" + | |||
| // "\t\t\t\t\t\t\t\t\t\t\t( date_format( `xcs`.`create_date`, '%Y-%m-%d' ) = date_format( `co`.`update_date`, '%Y-%m-%d' ) )\n" + | |||
| // "\t\t\t\t\t\t\t\t\t\t\tAND ( `xco`.`coupon_id` = `co`.`coupon_id` )\n" + | |||
| // "\t\t\t\t\t\t\t\t\t\t\tAND ( `xco`.`id` = `xcs`.`card_id` )\n" + | |||
| // "\t\t\t\t\t\t\t\t\t\t)\n" + | |||
| // "\t\t\t\t\t\t\t\t\t) > 0\n" + | |||
| // "\t\t\t\t\t\t\t\t)\n" + | |||
| // "\t\t\t\t\t\t\tEND\n" + | |||
| // "\t\t\t\t\t\t\t)\n" + | |||
| // "\t\t\t\t\t\tGROUP BY\n" + | |||
| // "\t\t\t\t\t\t\t`updateTime`,\n" + | |||
| // "\t\t\t\t\t\t\t`couponId`\n" + | |||
| // "\t\t\t\t\t\t)\n" + | |||
| // "\t\t\t\t\t) `verifiedInfo`\n" + | |||
| // "\t\t\t\t\tLEFT JOIN (\n" + | |||
| // "\t\t\t\t\tSELECT\n" + | |||
| // "\t\t\t\t\t\tdate_format( `co`.`create_date`, '%Y-%m-%d' ) AS `createTime`,\n" + | |||
| // "\t\t\t\t\t\t`co`.`coupon_id` AS `couponId`,\n" + | |||
| // "\t\t\t\t\t\tcount( `co`.`c_user_id` ) AS `couponUserCount`,\n" + | |||
| // "\t\t\t\t\t\tcount( `co`.`coupon_id` ) AS `couponCount`\n" + | |||
| // "\t\t\t\t\tFROM\n" + | |||
| // "\t\t\t\t\t\t`wx_coupon_order_000` `co`\n" + | |||
| // "\t\t\t\t\tGROUP BY\n" + | |||
| // "\t\t\t\t\t\t`createTime`,\n" + | |||
| // "\t\t\t\t\t\t`couponId`\n" + | |||
| // "\t\t\t\t\t) `orderInfo` ON ( ( ( `orderInfo`.`createTime` = `verifiedInfo`.`updateTime` ) AND ( `orderInfo`.`couponId` = `verifiedInfo`.`couponId` ) ) )\n" + | |||
| // "\t\t\t\t)\n" + | |||
| // "\t\t\t) `baseInfo`\n" + | |||
| // "\t\t\tLEFT JOIN `wx_coupon_000` `c` ON ( ( `c`.`id` = `baseInfo`.`couponId` ) )\n" + | |||
| // "\t\t)\n" + | |||
| // "ORDER BY\n" + | |||
| // "`baseInfo`.`createTime` DESC;"; | |||
| // String s = str.replaceAll("000", "" + i); | |||
| // System.out.println(s); | |||
| // System.out.println(); | |||
| // System.out.println(); | |||
| // } | |||
| // } | |||
| } | |||
| @@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -68,6 +69,7 @@ public class WxCampaignController extends BaseController { | |||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||
| wxCouponChannel.setStatus(0); | |||
| wxCouponChannel.setShowBeginTime(new Date()); | |||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listVo(wxCouponChannel); | |||
| wxCampaign.setCoupons(couponList); | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.*; | |||
| @@ -58,7 +59,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||
| List<MarkingCouponDataReportVo> couponDataList(HashMap<String,Object> params); //返回日期格式yy-MM-dd | |||
| //营销报表 触达用户数 | |||
| List<TouchUsersReportVo> touchUsersReportList(HashMap<String,Object> params); //返回日期格式yy-MM-dd | |||
| List<TouchUsersReportVo> touchUsersReportList(MarkingCouponDataReportDto params); //返回日期格式yy-MM-dd | |||
| /** | |||
| @@ -25,7 +25,7 @@ public interface MarkingDataReportService { | |||
| PageInfo<MarkingSceneDataVo> getSceneDataList(TenantEntity tenantEntity, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); | |||
| PageInfo<TouchUsersReportVo> getTouchUsersReportList(TenantEntity tenantEntity, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); | |||
| PageInfo<TouchUsersReportVo> getTouchUsersReportList(MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); | |||
| List<TouchUsersReportVo> getTouchUsersReportData(TenantEntity tenantEntity); | |||
| @@ -753,21 +753,20 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| if (markingCouponDataReportDto.getEndTime() != null) { | |||
| markingCouponDataReportDto.setEndTime(markingCouponDataReportDto.getEndTime()); | |||
| } | |||
| HashMap<String, Object> params2 = new HashMap<>(); | |||
| params2.put("tenantId", markingCouponDataReportDto.getTenantId()); | |||
| if (markingCouponDataReportDto.getStartTime() != null) | |||
| params2.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(), 0)); | |||
| if (markingCouponDataReportDto.getEndTime() != null) | |||
| params2.put("endTime", markingCouponDataReportDto.getEndTime()); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxCouponOrderMapper.touchUsersReportList(params2); | |||
| // HashMap<String, Object> params2 = new HashMap<>(); | |||
| // params2.put("tenantId", markingCouponDataReportDto.getTenantId()); | |||
| // if (markingCouponDataReportDto.getStartTime() != null) | |||
| // params2.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(), 0)); | |||
| // if (markingCouponDataReportDto.getEndTime() != null) | |||
| // params2.put("endTime", markingCouponDataReportDto.getEndTime()); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxCouponOrderMapper.touchUsersReportList(markingCouponDataReportDto); | |||
| excelService.exportExcel(wxUserVisitList, null, "触达用户数", TouchUsersReportVo.class, "触达用户数" + ".xlsx", response, false); | |||
| } | |||
| @Override | |||
| public PageInfo<TouchUsersReportVo> getTouchUsersReportList(TenantEntity tenantEntity, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | |||
| public PageInfo<TouchUsersReportVo> getTouchUsersReportList(MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | |||
| //查询UV PV | |||
| markingCouponDataReportDto.updateTenantInfo(tenantEntity); | |||
| if (markingCouponDataReportDto.getStartTime() != null) | |||
| markingCouponDataReportDto.setStartTime(convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0)); | |||
| if (markingCouponDataReportDto.getEndTime() != null) | |||
| @@ -779,16 +778,16 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| //获取领取量 | |||
| //获取核销人数 | |||
| //核销量 | |||
| HashMap<String, Object> params2 = new HashMap<>(); | |||
| params2.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params2.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| } | |||
| if (markingCouponDataReportDto.getStartTime() != null) | |||
| params2.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0)); | |||
| if (markingCouponDataReportDto.getEndTime() != null) | |||
| params2.put("endTime", markingCouponDataReportDto.getEndTime()); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxCouponOrderMapper.touchUsersReportList(params2); | |||
| // HashMap<String, Object> params2 = new HashMap<>(); | |||
| // params2.put("tenantId", tenantEntity.getTenantId()); | |||
| // if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| // params2.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| // } | |||
| // if (markingCouponDataReportDto.getStartTime() != null) | |||
| // params2.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0)); | |||
| // if (markingCouponDataReportDto.getEndTime() != null) | |||
| // params2.put("endTime", markingCouponDataReportDto.getEndTime()); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxCouponOrderMapper.touchUsersReportList(markingCouponDataReportDto); | |||
| return new PageInfo<>(wxUserVisitList); | |||
| } | |||
| @@ -91,7 +91,7 @@ public class WxGameServiceImpl implements WxGameService { | |||
| if (record != null) { | |||
| record.setGameTemplate(wxGameTemplateService.getById(record.getGameId())); | |||
| record.setCouponIdsList(getParams(record)); | |||
| record.setCouponIdsList(getParams(record,3)); | |||
| } | |||
| return record; | |||
| @@ -99,16 +99,16 @@ public class WxGameServiceImpl implements WxGameService { | |||
| @Override | |||
| public WxGame getOneGame(WxGame wxGame) { | |||
| try { | |||
| WxGame record = wxGameMapper.selectOne(new QueryWrapper(wxGame)); | |||
| if (record != null) { | |||
| record.setGameTemplate(wxGameTemplateService.getById(record.getGameId())); | |||
| record.setCouponIdsList(getParams(record)); | |||
| } | |||
| return record; | |||
| } catch (Exception e) { | |||
| logger.error("find game error: " + e.getMessage()); | |||
| } | |||
| // try { | |||
| // WxGame record = wxGameMapper.selectOne(new QueryWrapper(wxGame)); | |||
| // if (record != null) { | |||
| // record.setGameTemplate(wxGameTemplateService.getById(record.getGameId())); | |||
| // record.setCouponIdsList(getParams(record,3)); | |||
| // } | |||
| // return record; | |||
| // } catch (Exception e) { | |||
| // logger.error("find game error: " + e.getMessage()); | |||
| // } | |||
| return null; | |||
| } | |||
| @@ -172,9 +172,12 @@ public class WxGameServiceImpl implements WxGameService { | |||
| } | |||
| private List<Object> getParams(WxGame record) { | |||
| private List<Object> getParams(WxGame record,Integer source) { | |||
| // 获取已上架的CouponChannel | |||
| WxCouponChannel couponChannelQ = new WxCouponChannel(); | |||
| if(source.intValue() == 3){//C端来源--判断显示时间 | |||
| couponChannelQ.setShowBeginTime(new Date()); | |||
| } | |||
| couponChannelQ.updateTenantInfo(record); | |||
| couponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_GAME.getCode()); | |||
| couponChannelQ.setSubTargetId(record.getId()); | |||
| @@ -216,7 +219,7 @@ public class WxGameServiceImpl implements WxGameService { | |||
| WxGame game = wxGameMapper.selectById(id); | |||
| if (game != null) { | |||
| game.setGameTemplate(wxGameTemplateService.getById(game.getGameId())); | |||
| game.setCouponIdsList(getParams(game)); | |||
| game.setCouponIdsList(getParams(game,1)); | |||
| } | |||
| return game; | |||
| } | |||
| @@ -224,8 +224,10 @@ | |||
| </select> | |||
| <select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | |||
| SELECT createTime,couponId,couponCount,couponUserCount,verifyCount,verifyUserCount | |||
| from view_coupon_data | |||
| SELECT createTime,couponId,sum(couponCount),sum(couponUserCount),sum(verifyCount),sum(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} | |||
| @@ -245,13 +247,16 @@ | |||
| <if test="couponTitle != null"> | |||
| and couponTitle like concat('%', #{couponTitle},'%') | |||
| </if> | |||
| GROUP BY createTime,couponId | |||
| order by createTime desc | |||
| </select> | |||
| <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="com.iformall.domain.dto.MarkingCouponDataReportDto"> | |||
| SELECT xTime, tenant_id, pv, uv, couponCount, userCount, verifyCount, verifyUserCount | |||
| FROM view_touch_user | |||
| SELECT xTime, sum(pv), sum(uv), sum(couponCount), sum(userCount), sum(verifyCount), sum(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} | |||