| @@ -14,6 +14,7 @@ import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.WxUserVisit; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.service.*; | |||
| @@ -288,27 +289,24 @@ public class WxCUserDataController extends BaseController { | |||
| public ResultData findUserVisitCount() { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserVisitCount"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| params.put("startTime", c.getTime()); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| } | |||
| WxUserVisit userVisit = new WxUserVisit(); | |||
| userVisit.updateTenantInfo(tenantEntity); | |||
| userVisit.setStartTime(c.getTime()); | |||
| //昨日活跃数 | |||
| long yesterdayCount = wxUserVisitService.queryVisitUv(params); | |||
| long yesterdayCount = wxUserVisitService.queryVisitUv(userVisit); | |||
| //近一周活跃 | |||
| c.add(Calendar.DAY_OF_YEAR, -6); | |||
| params.put("startTime", c.getTime()); | |||
| long weekCount = wxUserVisitService.queryVisitUv(params); | |||
| userVisit.setStartTime(c.getTime()); | |||
| long weekCount = wxUserVisitService.queryVisitUv(userVisit); | |||
| //近一月活跃 | |||
| c.add(Calendar.DAY_OF_YEAR, -22); | |||
| params.put("startTime", c.getTime()); | |||
| long monthCount = wxUserVisitService.queryVisitUv(params); | |||
| userVisit.setStartTime(c.getTime()); | |||
| long monthCount = wxUserVisitService.queryVisitUv(userVisit); | |||
| Map<String, Object> mapVo = new HashMap<>(); | |||
| mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| @@ -37,4 +38,11 @@ import java.util.*; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startTime") | |||
| private Date startTime; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime") | |||
| private Date endTime; | |||
| } | |||
| @@ -15,7 +15,7 @@ public interface WxUserVisitMapper extends CommonMapper<WxUserVisit, Long> { | |||
| List<TouchUsersReportVo> touchUsersReportList(MarkingCouponDataReportDto markingCouponDataReportDto); | |||
| List<TouchUsersReportVo> touchUsersReportData(HashMap<String,Object> params); | |||
| List<TouchUsersReportVo> touchUsersReportData(WxUserVisit record); | |||
| Long queryVisitUv(HashMap<String,Object> params); | |||
| Long queryVisitUv(WxUserVisit record); | |||
| } | |||
| @@ -33,7 +33,7 @@ public interface WxUserVisitService { | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxUserVisit getById(Long id, TenantEntity tenantEntity); | |||
| WxUserVisit getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -47,13 +47,13 @@ public interface WxUserVisitService { | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id, TenantEntity tenantEntity); | |||
| void deleteById(Long id); | |||
| List<TouchUsersReportVo> touchUsersReportList(MarkingCouponDataReportDto markingCouponDataReportDto); | |||
| Long queryVisitUv(HashMap<String,Object> params); | |||
| Long queryVisitUv(WxUserVisit record); | |||
| } | |||
| @@ -5,10 +5,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||
| import com.iformall.domain.dto.WxOrderReportDto; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.enums.*; | |||
| @@ -656,14 +653,11 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| @Override | |||
| public List<TouchUsersReportVo> getTouchUsersReportData(TenantEntity tenantEntity){ | |||
| //查询UV PV | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| } | |||
| params.put("startTime", addDay(-30)); | |||
| params.put("endTime", addDay(1)); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportData(params); | |||
| WxUserVisit userVisit = new WxUserVisit(); | |||
| userVisit.updateTenantInfo(tenantEntity); | |||
| userVisit.setStartTime(addDay(-30)); | |||
| userVisit.setEndTime(addDay(1)); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportData(userVisit); | |||
| String startdate = DateUtils.getTimeBefore(30, new Date()); | |||
| String enddate = DateUtils.getTimeBefore(1,new Date()); | |||
| @@ -1175,6 +1175,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto) { | |||
| if(wxMallService.isgroupSupport(dto)){ | |||
| dto.setParentTenantId(dto.getTenantId()); | |||
| dto.setTenantId(null); | |||
| } | |||
| return wxCUserBasicInfoMapper.findCount(dto); | |||
| @@ -1163,14 +1163,11 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| private ResultData getTodayTouchUser(TenantEntity tenantEntity) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| //查询UV PV | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| } | |||
| params.put("startTime", addDay(-1)); | |||
| params.put("endTime", addDay(1)); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportData(params); | |||
| WxUserVisit userVisit = new WxUserVisit(); | |||
| userVisit.updateTenantInfo(tenantEntity); | |||
| userVisit.setStartTime(addDay(-1)); | |||
| userVisit.setEndTime(addDay(1)); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportData(userVisit); | |||
| TouchUsersReportVo touchUsersReportVo = new TouchUsersReportVo(); | |||
| if (!wxUserVisitList.isEmpty()) { | |||
| touchUsersReportVo = wxUserVisitList.get(0); | |||
| @@ -1257,14 +1254,11 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| private ResultData getTouchUserCount(TenantEntity tenantEntity) { | |||
| String startdate; | |||
| String enddate;//查询UV PV | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| } | |||
| params.put("startTime", addDay(-30)); | |||
| params.put("endTime", addDay(1)); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportData(params); | |||
| WxUserVisit userVisit = new WxUserVisit(); | |||
| userVisit.updateTenantInfo(tenantEntity); | |||
| userVisit.setStartTime(addDay(-30)); | |||
| userVisit.setEndTime(addDay(1)); | |||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportData(userVisit); | |||
| startdate = DateUtils.getTimeBefore(30, new Date()); | |||
| enddate = DateUtils.getTimeBefore(1, new Date()); | |||
| List<String> tjTimeList = DateUtils.getTjTimeList(startdate, enddate, "0"); | |||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.WxUserVisit; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.TouchUsersReportVo; | |||
| import com.iformall.mapper.WxUserVisitMapper; | |||
| import com.iformall.service.WxMallService; | |||
| import com.iformall.service.WxUserVisitService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -25,6 +26,8 @@ public class WxUserVisitServiceImpl implements WxUserVisitService { | |||
| @Autowired | |||
| WxUserVisitMapper wxUserVisitMapper; | |||
| @Autowired | |||
| WxMallService wxMallService; | |||
| @Override | |||
| public PageInfo<WxUserVisit> listAsPage(WxUserVisit record, Integer pageIndex, Integer pageSize) { | |||
| @@ -37,11 +40,8 @@ public class WxUserVisitServiceImpl implements WxUserVisitService { | |||
| } | |||
| @Override | |||
| public WxUserVisit getById(Long id, TenantEntity tenantEntity) { | |||
| WxUserVisit record = new WxUserVisit(); | |||
| record.updateTenantInfo(tenantEntity); | |||
| record.setId(id); | |||
| return wxUserVisitMapper.selectOne(new QueryWrapper<>(record)); | |||
| public WxUserVisit getById(Long id) { | |||
| return wxUserVisitMapper.selectById(id); | |||
| } | |||
| @Override | |||
| @@ -57,11 +57,8 @@ public class WxUserVisitServiceImpl implements WxUserVisitService { | |||
| } | |||
| @Override | |||
| public void deleteById(Long id, TenantEntity tenantEntity) { | |||
| WxUserVisit record = new WxUserVisit(); | |||
| record.updateTenantInfo(tenantEntity); | |||
| record.setId(id); | |||
| wxUserVisitMapper.delete(new QueryWrapper<>(record)); | |||
| public void deleteById(Long id) { | |||
| wxUserVisitMapper.deleteById(id); | |||
| } | |||
| @Override | |||
| @@ -71,7 +68,11 @@ public class WxUserVisitServiceImpl implements WxUserVisitService { | |||
| @Override | |||
| public Long queryVisitUv(HashMap<String, Object> params) { | |||
| return wxUserVisitMapper.queryVisitUv(params); | |||
| public Long queryVisitUv(WxUserVisit record) { | |||
| if(wxMallService.isgroupSupport(record)){ | |||
| record.setParentTenantId(record.getTenantId()); | |||
| record.setTenantId(null); | |||
| } | |||
| return wxUserVisitMapper.queryVisitUv(record); | |||
| } | |||
| } | |||
| @@ -129,7 +129,7 @@ | |||
| <if test=" null == sortColumns"> order by xTime desc </if> | |||
| </select> | |||
| <select id="touchUsersReportData" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap"> | |||
| <select id="touchUsersReportData" parameterType="com.iformall.domain.po.WxUserVisit" resultType="com.iformall.domain.vo.TouchUsersReportVo"> | |||
| SELECT DATE_FORMAT(day_date,'%m/%d') as xTime,IFNULL(sum(visit_pv),0) as pv,IFNULL(sum(visit_uv),0) as uv | |||
| from wx_user_visit | |||
| where 1=1 | |||
| @@ -149,7 +149,7 @@ | |||
| order by xTime desc | |||
| </select> | |||
| <select id="queryVisitUv" resultType="Long" parameterType="hashmap"> | |||
| <select id="queryVisitUv" parameterType="com.iformall.domain.po.WxUserVisit" resultType="Long"> | |||
| select IFNULL(sum(visit_uv),0) from wx_user_visit where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||