| @@ -14,6 +14,7 @@ import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | import com.iformall.domain.dto.MarkingCouponDataReportDto; | ||||
| import com.iformall.domain.po.WxCouponOrder; | import com.iformall.domain.po.WxCouponOrder; | ||||
| import com.iformall.domain.po.WxUserVisit; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumAppPlat; | import com.iformall.enums.EnumAppPlat; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| @@ -288,27 +289,24 @@ public class WxCUserDataController extends BaseController { | |||||
| public ResultData findUserVisitCount() { | public ResultData findUserVisitCount() { | ||||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserVisitCount"); | logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserVisitCount"); | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| HashMap<String, Object> params = new HashMap<>(); | |||||
| Calendar c = Calendar.getInstance(); | Calendar c = Calendar.getInstance(); | ||||
| 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); | ||||
| c.set(Calendar.MINUTE, 0); | c.set(Calendar.MINUTE, 0); | ||||
| c.set(Calendar.SECOND, 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); | 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); | 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<>(); | Map<String, Object> mapVo = new HashMap<>(); | ||||
| mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -37,4 +38,11 @@ import java.util.*; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| private Date 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> 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 | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxUserVisit getById(Long id, TenantEntity tenantEntity); | |||||
| WxUserVisit getById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| @@ -47,13 +47,13 @@ public interface WxUserVisitService { | |||||
| * | * | ||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id, TenantEntity tenantEntity); | |||||
| void deleteById(Long id); | |||||
| List<TouchUsersReportVo> touchUsersReportList(MarkingCouponDataReportDto markingCouponDataReportDto); | 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.common.ErrorCode; | ||||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | import com.iformall.domain.dto.MarkingCouponDataReportDto; | ||||
| import com.iformall.domain.dto.WxOrderReportDto; | 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.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.*; | import com.iformall.domain.vo.*; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| @@ -656,14 +653,11 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| @Override | @Override | ||||
| public List<TouchUsersReportVo> getTouchUsersReportData(TenantEntity tenantEntity){ | public List<TouchUsersReportVo> getTouchUsersReportData(TenantEntity tenantEntity){ | ||||
| //查询UV PV | //查询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 startdate = DateUtils.getTimeBefore(30, new Date()); | ||||
| String enddate = DateUtils.getTimeBefore(1,new Date()); | String enddate = DateUtils.getTimeBefore(1,new Date()); | ||||
| @@ -1175,6 +1175,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| @Override | @Override | ||||
| public long findCount(WxCUserBasicInfoDto dto) { | public long findCount(WxCUserBasicInfoDto dto) { | ||||
| if(wxMallService.isgroupSupport(dto)){ | if(wxMallService.isgroupSupport(dto)){ | ||||
| dto.setParentTenantId(dto.getTenantId()); | |||||
| dto.setTenantId(null); | dto.setTenantId(null); | ||||
| } | } | ||||
| return wxCUserBasicInfoMapper.findCount(dto); | return wxCUserBasicInfoMapper.findCount(dto); | ||||
| @@ -1163,14 +1163,11 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| private ResultData getTodayTouchUser(TenantEntity tenantEntity) { | private ResultData getTodayTouchUser(TenantEntity tenantEntity) { | ||||
| HashMap<String, Object> datamap = new HashMap<>(); | HashMap<String, Object> datamap = new HashMap<>(); | ||||
| //查询UV PV | //查询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(); | TouchUsersReportVo touchUsersReportVo = new TouchUsersReportVo(); | ||||
| if (!wxUserVisitList.isEmpty()) { | if (!wxUserVisitList.isEmpty()) { | ||||
| touchUsersReportVo = wxUserVisitList.get(0); | touchUsersReportVo = wxUserVisitList.get(0); | ||||
| @@ -1257,14 +1254,11 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| private ResultData getTouchUserCount(TenantEntity tenantEntity) { | private ResultData getTouchUserCount(TenantEntity tenantEntity) { | ||||
| String startdate; | String startdate; | ||||
| String enddate;//查询UV PV | 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()); | startdate = DateUtils.getTimeBefore(30, new Date()); | ||||
| enddate = DateUtils.getTimeBefore(1, new Date()); | enddate = DateUtils.getTimeBefore(1, new Date()); | ||||
| List<String> tjTimeList = DateUtils.getTjTimeList(startdate, enddate, "0"); | 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.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.TouchUsersReportVo; | import com.iformall.domain.vo.TouchUsersReportVo; | ||||
| import com.iformall.mapper.WxUserVisitMapper; | import com.iformall.mapper.WxUserVisitMapper; | ||||
| import com.iformall.service.WxMallService; | |||||
| import com.iformall.service.WxUserVisitService; | import com.iformall.service.WxUserVisitService; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -25,6 +26,8 @@ public class WxUserVisitServiceImpl implements WxUserVisitService { | |||||
| @Autowired | @Autowired | ||||
| WxUserVisitMapper wxUserVisitMapper; | WxUserVisitMapper wxUserVisitMapper; | ||||
| @Autowired | |||||
| WxMallService wxMallService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxUserVisit> listAsPage(WxUserVisit record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxUserVisit> listAsPage(WxUserVisit record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -37,11 +40,8 @@ public class WxUserVisitServiceImpl implements WxUserVisitService { | |||||
| } | } | ||||
| @Override | @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 | @Override | ||||
| @@ -57,11 +57,8 @@ public class WxUserVisitServiceImpl implements WxUserVisitService { | |||||
| } | } | ||||
| @Override | @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 | @Override | ||||
| @@ -71,7 +68,11 @@ public class WxUserVisitServiceImpl implements WxUserVisitService { | |||||
| @Override | @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> | <if test=" null == sortColumns"> order by xTime desc </if> | ||||
| </select> | </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 | 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 | from wx_user_visit | ||||
| where 1=1 | where 1=1 | ||||
| @@ -149,7 +149,7 @@ | |||||
| order by xTime desc | order by xTime desc | ||||
| </select> | </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 | select IFNULL(sum(visit_uv),0) from wx_user_visit where 1=1 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||