| @@ -8,6 +8,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.UserCountVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.cuser.CUserServiceFactory; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| @@ -29,7 +30,7 @@ public class WxUserStatisticsController extends BaseController { | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| private CUserServiceFactory cuserFactory; | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @@ -37,9 +38,13 @@ public class WxUserStatisticsController extends BaseController { | |||
| @ApiOperation("查询微信用户数量") | |||
| @GetMapping("/findWxUserCount") | |||
| @SystemControllerLog(description = "查询微信用户数量") | |||
| public ResultData findWxUserCount() { | |||
| public ResultData findWxUserCount(Integer plat) { | |||
| logger.debug("[" + getIpAddr() + "] userStatistics::findWxUserCount"); | |||
| if(plat == null){ | |||
| plat = EnumAppPlat.WX.getCode(); | |||
| } | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| //昨日同比 | |||
| @@ -48,7 +53,7 @@ public class WxUserStatisticsController extends BaseController { | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setEndTime(new Date()); | |||
| //微信用户数据 | |||
| long wxTotalCount = wxCUserService.findCount(dto,tenantEntitys);//总量 | |||
| long wxTotalCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto,tenantEntitys);//总量 | |||
| map.put("wxTotalCount",wxTotalCount); | |||
| @@ -59,7 +64,7 @@ public class WxUserStatisticsController extends BaseController { | |||
| Date today = c.getTime(); | |||
| dto.setStartTime(today); | |||
| dto.setEndTime(null); | |||
| long wxTodayCount = wxCUserService.findCount(dto, tenantEntitys);//今天新增 | |||
| long wxTodayCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto, tenantEntitys);//今天新增 | |||
| map.put("wxTodayCount",wxTodayCount); | |||
| @@ -70,7 +75,7 @@ public class WxUserStatisticsController extends BaseController { | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long wxYesterdayCount = wxCUserService.findCount(dto, tenantEntitys); | |||
| long wxYesterdayCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto, tenantEntitys); | |||
| if (wxYesterdayCount > 0) { | |||
| double yesterday = (double) (wxTodayCount - wxYesterdayCount) / wxYesterdayCount * 100; | |||
| double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| @@ -132,9 +137,11 @@ public class WxUserStatisticsController extends BaseController { | |||
| @ApiOperation("查询微信用户趋势") | |||
| @GetMapping("/findWxUserTrend") | |||
| @SystemControllerLog(description = "查询微信用户趋势") | |||
| public ResultData findWxUserTrend(Date startTime, Date endTime, Integer reportType) { | |||
| public ResultData findWxUserTrend(Date startTime, Date endTime, Integer reportType,Integer plat) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStatisticsController::findUserCount"); | |||
| if(plat == null){ | |||
| plat = EnumAppPlat.WX.getCode(); | |||
| } | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| @@ -153,7 +160,7 @@ public class WxUserStatisticsController extends BaseController { | |||
| dto.setReportType(reportType); | |||
| List<UserCountVo> wxCountList = new ArrayList<>();//每日新增会员数 | |||
| List<UserCountVo> wxCounts = wxCUserService.findCountHistory(dto,tenantEntitys);//每日新增会员数 | |||
| List<UserCountVo> wxCounts = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCountHistory(dto,tenantEntitys);//每日新增会员数 | |||
| SimpleDateFormat sdf; | |||
| SimpleDateFormat fsdf; | |||
| @@ -206,7 +213,7 @@ public class WxUserStatisticsController extends BaseController { | |||
| WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto(); | |||
| pdto.updateTenantInfo(tenantEntity); | |||
| pdto.setEndTime(startTime); | |||
| wxCountList.get(0).setTotalCount(wxCUserService.findCount(pdto, tenantEntitys)); | |||
| wxCountList.get(0).setTotalCount(cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(pdto, tenantEntitys)); | |||
| } | |||
| for (int i = 1; i < wxCountList.size(); i++){ | |||
| if (wxCountList.get(i).getTotalCount() != null && | |||
| @@ -15,7 +15,9 @@ import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.cuser.CUserServiceFactory; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -40,7 +42,7 @@ public class WxCUserDataController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| private CUserServiceFactory cuserFactory; | |||
| @Autowired | |||
| private WxUserVisitService wxUserVisitService; | |||
| @Autowired | |||
| @@ -53,13 +55,16 @@ public class WxCUserDataController extends BaseController { | |||
| @GetMapping("findUserCountData") | |||
| @ApiOperation("查询用户数量接口") | |||
| @SystemControllerLog(description = "会员首页-报表数据-查询用户数量接口") | |||
| public ResultData findUserCountData() { | |||
| public ResultData findUserCountData(Integer plat) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserCountData"); | |||
| if(plat == null){ | |||
| plat = EnumAppPlat.WX.getCode(); | |||
| } | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| long allCount = wxCUserService.findCount(dto, tenantEntitys);//总数 | |||
| long allCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto, tenantEntitys); | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| @@ -79,7 +84,7 @@ public class WxCUserDataController extends BaseController { | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long count = wxCUserService.findCount(dto, tenantEntitys); | |||
| long count = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto, tenantEntitys); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime())); | |||
| @@ -2,5 +2,9 @@ | |||
| INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (680, '抖音列表投放', 606, 'Y', NULL, 1, NULL, NULL, 'dyxcx', NULL, 0, 680); | |||
| INSERT INTO `mallink`.`mall_sale_type`(`id`, `name`, `type`, `period`, `menus`) VALUES (11, '抖音尊享', 11, 12, '[1, 2, 4, 5, 6, 50, 105, 106, 201, 202, 211, 212, 221, 222, 409, 411, 416, 501, 502, 504, 505, 506, 511, 512, 591, 592, 595, 602, 606, 610, 613, 641, 680, 711, 901, 902, 903, 931, 932]'); | |||
| INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (110, '抖音用户概览', 1, 'Y', NULL, 1, NULL, NULL, 'ttuserHome', 'icon-yonghushuju', 0, 110); | |||
| INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (500, '抖音用户概览', 5, 'Y', NULL, 1, NULL, NULL, 'ttuserHome', 'icon-yonghushuju', 0, 500); | |||
| INSERT INTO `mallink`.`mall_sale_type`(`id`, `name`, `type`, `period`, `menus`) VALUES (11, '抖音尊享', 11, 12, '[1, 2, 4, 5, 6, 50, 105, 110, 201, 202, 211, 212, 221, 222, 409, 411, 416, 500, 502, 504, 505, 506, 511, 512, 591, 592, 595, 602, 606, 610, 613, 641, 680, 711, 901, 902, 903, 931, 932]'); | |||
| @@ -52,7 +52,7 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||
| @Excel(name="性别",width = 20,replace = { "保密_0", "男_1", "女_2"},orderNum = "3") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | |||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2.女",name="sex") | |||
| private Integer sex; | |||
| @Excel(name = "手机号*", width = 20, orderNum = "4") | |||
| @@ -15,6 +15,8 @@ public enum EnumCouponChannelType { | |||
| COUPON_CHANNEL_ID_TOPIC(8, "专题"), | |||
| COUPON_CHANNEL_ID_CREDIT(50, "积分商城"), | |||
| COUPON_CHANNEL_ID_H5(100, "DSP的H5页面"), | |||
| COUPON_CHANNEL_ID_DOUYIN_LIST(101, "抖音列表"), | |||
| ; | |||
| public static EnumCouponChannelType getEnum(Integer code) { | |||
| @@ -1,10 +1,15 @@ | |||
| package com.iformall.service.cuser; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.CUser; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCUserFrom; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.UserCountVo; | |||
| import java.util.List; | |||
| /** | |||
| * C端用户操作 | |||
| @@ -33,4 +38,8 @@ public interface CUserServiceApapter { | |||
| void updateExtInfo(CUser user); | |||
| void updateMsgCount(CUser user); | |||
| long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | |||
| } | |||
| @@ -5,9 +5,12 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.tt.TtCUser; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.domain.vo.UserCountVo; | |||
| import com.iformall.douyin.miniapp.api.TtMaService; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| @@ -208,7 +211,7 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| wxCUserFrom.setIsNewUser(EnumYesOrNo.YES.getCode()); | |||
| } | |||
| wxCUserFrom.setCUserId(cUser.getId()); | |||
| wxCUserFrom.setCUserId(user.getId()); | |||
| actionMsgAfterLogin(wxCUserFrom); | |||
| return user; | |||
| } | |||
| @@ -261,6 +264,22 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| ttCUserMapper.updateMsgCount((TtCUser) user); | |||
| } | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| long count = 0l; | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| dto.updateTenantInfo(tenantEntity); | |||
| long count1 = ttCUserMapper.findCount(dto); | |||
| count += count1; | |||
| } | |||
| return count; | |||
| } | |||
| @Override | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| return ttCUserMapper.findCountHistory(tenantEntitys,dto); | |||
| } | |||
| private TtMaService getTtMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { | |||
| TtMaService ttMaService = maUtil.getTtappService(wxAppinfo); | |||
| if (StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||
| @@ -5,7 +5,10 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.UserCountVo; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| @@ -215,7 +218,7 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| wxCUserFrom.setIsNewUser(EnumYesOrNo.YES.getCode()); | |||
| } | |||
| wxCUserFrom.setCUserId(cUser.getId()); | |||
| wxCUserFrom.setCUserId(user.getId()); | |||
| actionMsgAfterLogin(wxCUserFrom); | |||
| return user; | |||
| } | |||
| @@ -268,6 +271,22 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| wxCUserMapper.updateMsgCount((WxCUser) user); | |||
| } | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| long count = 0l; | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| dto.updateTenantInfo(tenantEntity); | |||
| long count1 = wxCUserMapper.findCount(dto); | |||
| count += count1; | |||
| } | |||
| return count; | |||
| } | |||
| @Override | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| return wxCUserMapper.findCountHistory(tenantEntitys,dto); | |||
| } | |||
| private WxMaService getWxMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { | |||
| WxMaService wxMaService = null; | |||
| if (isFmOpen) { | |||
| @@ -377,7 +377,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| public PageInfo<WxCouponChannelVo> listPageCVo(WxCouponChannel record, Integer pageIndex, Integer pageSize) { | |||
| PageInfo<WxCouponChannelVo> pageInfo; | |||
| //仅c端首页走缓存 | |||
| if(EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode().equals(record.getTargetAd()) | |||
| if((EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode().equals(record.getTargetAd()) | |||
| || EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode().equals(record.getTargetAd())) | |||
| && new Integer(6).equals(pageSize) | |||
| && pageIndex.intValue() <=5 | |||
| && record.getBusiness() == null) { | |||