xhxu 5 лет назад
Родитель
Сommit
39ccc4c076
7 измененных файлов: 90 добавлений и 70 удалений
  1. +9
    -4
      mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java
  2. +4
    -5
      mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java
  3. +5
    -3
      mallinkService/src/main/java/com/iformall/service/WxCUserService.java
  4. +6
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java
  5. +8
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java
  6. +2
    -1
      mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml
  7. +56
    -47
      mallinkService/src/main/resources/mapper/WxCUserMapper.xml

+ 9
- 4
mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java Просмотреть файл

@@ -361,7 +361,7 @@ public class WxUserStructureController extends BaseController {
dto.setReportType(reportType);

List<UserCountVo> wxCountList = new ArrayList<>();//每日新增会员数
List<UserCountVo> wxCounts = wxCUserService.findCountHistory(dto);//每日新增会员数
List<UserCountVo> wxCounts = wxCUserService.findCountHistory(dto,tenantEntitys);//每日新增会员数
List<UserCountVo> memCountList = new ArrayList<>();//每日新增会员数
List<UserCountVo> memCounts = wxCUserBasicInfoService.findCountHistory(ifParentUpdateTenantInfo(),dto);//每日新增会员数

@@ -471,6 +471,9 @@ public class WxUserStructureController extends BaseController {
Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserByChannel");
List<String> sceneList = null;
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);

if (StringUtils.isNotBlank(wxCUser.getChannelName())) {
WxUserChannel c = new WxUserChannel();
c.setChannelName(wxCUser.getChannelName());
@@ -483,7 +486,7 @@ public class WxUserStructureController extends BaseController {
}
}
wxCUser.setSceneList(sceneList);
PageInfo<WxCUser> page = wxCUserService.listByChannel(wxCUser, pageNum, pageSize);
PageInfo<WxCUser> page = wxCUserService.listByChannel(wxCUser,tenantEntitys, pageNum, pageSize);
for (WxCUser u : page.getList()) {
WxUserChannel c = new WxUserChannel();
c.setSceneAddress(u.getSceneAddress());
@@ -508,6 +511,8 @@ public class WxUserStructureController extends BaseController {
List<WxUserChannel> channelStructureList = new ArrayList<>();
List<WxUserChannel> senceStructureList = new ArrayList<>();

List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(getTenantInfo());

List<WxUserChannel> channels = wxUserChannelService.findDistinctChannel();
for (WxUserChannel w : channels) {
WxUserChannel c = new WxUserChannel();
@@ -521,7 +526,7 @@ public class WxUserStructureController extends BaseController {
wxCUser.setSceneList(scene);
WxUserChannel senceStructure = new WxUserChannel();
senceStructure.setDescription(uc.getDescription());
senceStructure.setCount(wxCUserService.countByChannel(wxCUser));
senceStructure.setCount(wxCUserService.countByChannel(tenantEntitys,wxCUser));
senceStructureList.add(senceStructure);
sceneList.add(uc.getSceneAddress());
}
@@ -529,7 +534,7 @@ public class WxUserStructureController extends BaseController {
wxCUser.setSceneList(sceneList);
WxUserChannel channelStructure = new WxUserChannel();
channelStructure.setChannelName(w.getChannelName());
channelStructure.setCount(wxCUserService.countByChannel(wxCUser));
channelStructure.setCount(wxCUserService.countByChannel(tenantEntitys,wxCUser));
channelStructureList.add(channelStructure);
}
}


+ 4
- 5
mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java Просмотреть файл

@@ -1,12 +1,11 @@
package com.iformall.mapper;

import java.util.List;
import java.util.Map;

import com.iformall.common.CommonMapper;
import com.iformall.domain.dto.WxCUserBasicInfoDto;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.base.BaseCUserEntity;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.UserCountVo;
import org.apache.ibatis.annotations.Param;

@@ -24,11 +23,11 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> {
long findCount(WxCUserBasicInfoDto dto);

List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto);
List<UserCountVo> findCountHistory(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("basicDto")WxCUserBasicInfoDto dto);

List<WxCUser> listByChannel(WxCUser wxCUser);
List<WxCUser> listByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCUser")WxCUser wxCUser);

long countByChannel(WxCUser wxCUser);
long countByChannel(List<TenantEntity> tenantEntitys, WxCUser wxCUser);

//List<Map<String, Object>> checkCountByTenantOpenId();



+ 5
- 3
mallinkService/src/main/java/com/iformall/service/WxCUserService.java Просмотреть файл

@@ -101,21 +101,23 @@ public interface WxCUserService {
/**
* 统计数量
* @param dto
* @param tenantEntitys
* @return
*/
List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto);
List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys);

/**
* 通过渠道获取会员信息
* @param user
* @param tenantEntitys
* @param pageIndex
* @param pageSize
* @return
*/
PageInfo<WxCUser> listByChannel(WxCUser user, Integer pageIndex, Integer pageSize);
PageInfo<WxCUser> listByChannel(WxCUser user, List<TenantEntity> tenantEntitys, Integer pageIndex, Integer pageSize);

long countByChannel(WxCUser user);
long countByChannel(List<TenantEntity> tenantEntitys, WxCUser user);

/**
* 登录后发消息


+ 6
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java Просмотреть файл

@@ -233,18 +233,18 @@ public class WxCUserServiceImpl implements WxCUserService {
}

@Override
public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) {
return wxCUserMapper.findCountHistory(dto);
public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) {
return wxCUserMapper.findCountHistory(tenantEntitys,dto);
}

@Override
public PageInfo<WxCUser> listByChannel(WxCUser user, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(user));
public PageInfo<WxCUser> listByChannel(WxCUser user, List<TenantEntity> tenantEntitys, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(tenantEntitys,user));
}

@Override
public long countByChannel(WxCUser user) {
return wxCUserMapper.countByChannel(user);
public long countByChannel(List<TenantEntity> tenantEntitys, WxCUser user) {
return wxCUserMapper.countByChannel(tenantEntitys, user);
}

@Override


+ 8
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java Просмотреть файл

@@ -1033,7 +1033,7 @@ public class WxChartServiceImpl implements WxChartDataService {
String oneWeekEndDate = DateUtils.getTimeBefore(1, new Date());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
WxCUserBasicInfoDto wxCUserBasicInfoDto = new WxCUserBasicInfoDto();
wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
// wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
try {
wxCUserBasicInfoDto.setStartTime(sdf.parse(oneWeekStartdate));
wxCUserBasicInfoDto.setEndTime(sdf.parse(oneWeekEndDate));
@@ -1043,7 +1043,7 @@ public class WxChartServiceImpl implements WxChartDataService {
datamap.put("oneWeekNewCarUserCount", wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));
//停车会员总数
wxCUserBasicInfoDto = new WxCUserBasicInfoDto();
wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
// wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
datamap.put("newCarUserSumCount", wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));

return new ResultData(datamap);
@@ -1056,8 +1056,10 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getCarNewMemberCountInWeek(TenantEntity tenantEntity) {
// List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
HashMap<String, Object> weekParams = new HashMap<>();
// weekParams.put("tenantEntitys", tenantEntitys);
weekParams.put("tenantId", tenantEntity.getTenantId());
weekParams.put("finalTenantId", tenantEntity.getFinalTenantId());
if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) {
@@ -1962,6 +1964,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getFromChannelAnalysis(TenantEntity tenantEntity) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
List<WxUserChannel> channelStructureList = new ArrayList<>();
WxCUser wxCUser = new WxCUser();
@@ -1982,7 +1985,7 @@ public class WxChartServiceImpl implements WxChartDataService {
wxCUser.setSceneList(sceneList);
WxUserChannel channelStructure = new WxUserChannel();
channelStructure.setChannelName(w.getChannelName());
channelStructure.setCount(wxCUserMapper.countByChannel(wxCUser));
channelStructure.setCount(wxCUserMapper.countByChannel(tenantEntitys,wxCUser));
channelStructureList.add(channelStructure);
}
}
@@ -2069,6 +2072,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getSceneAnalysis(TenantEntity tenantEntity) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
List<WxUserChannel> senceStructureList = new ArrayList<>();
WxCUser wxCUser = new WxCUser();
@@ -2085,7 +2089,7 @@ public class WxChartServiceImpl implements WxChartDataService {
wxCUser.setSceneList(scene);
WxUserChannel senceStructure = new WxUserChannel();
senceStructure.setDescription(uc.getDescription());
senceStructure.setCount(wxCUserMapper.countByChannel(wxCUser));
senceStructure.setCount(wxCUserMapper.countByChannel(tenantEntitys, wxCUser));
senceStructureList.add(senceStructure);
}
}


+ 2
- 1
mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml Просмотреть файл

@@ -123,7 +123,8 @@

<select id="queryCarCountHistory" resultType="hashmap" parameterType="hashmap">
SELECT count(DISTINCT c.id) count, c.create_time FROM
(SELECT ubi.id as id, DATE_FORMAT(uc.create_date, '%m/%d') create_time FROM wx_c_user_car uc, wx_c_user_basic_info ubi
(SELECT ubi.id as id, DATE_FORMAT(uc.create_date, '%m/%d') create_time
FROM wx_c_user_car uc, wx_c_user_basic_info ubi
WHERE uc.c_user_id = ubi.id
<if test=" null != tenantId and '' != tenantId">
and uc.tenant_id = #{tenantId}


+ 56
- 47
mallinkService/src/main/resources/mapper/WxCUserMapper.xml Просмотреть файл

@@ -268,97 +268,106 @@
</if>
</select>

<select id="findCountHistory" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="com.iformall.domain.vo.UserCountVo">
<select id="findCountHistory" resultType="com.iformall.domain.vo.UserCountVo">
select count(id) as incCount,
<if test="1 == reportType ">
<if test="1 == basicDto.reportType ">
date_format(create_date, '%Y-%m-%d') as reportTime,
</if>
<if test="2 == reportType ">
<if test="2 == basicDto.reportType ">
date_format(create_date, '%Y-%m') as reportTime,
</if>
<if test="3 == reportType ">
<if test="3 == basicDto.reportType ">
date_format(create_date, '%Y') as reportTime,
</if>

<if test="1 == reportType or 2 == reportType or 3 == reportType">
(select count(id) from wx_c_user where
<if test="1 == reportType ">
<if test="1 == basicDto.reportType or 2 == basicDto.reportType or 3 == basicDto.reportType">
(select count(id) from
(<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_c_user${tenantEntity.shardTableSuffix}
</foreach>) wx_c_user where
<if test="1 == basicDto.reportType ">
date_format(create_date, '%Y-%m-%d') &lt;= reportTime
</if>
<if test="2 == reportType ">
<if test="2 == basicDto.reportType ">
date_format(create_date, '%Y-%m') &lt;= reportTime
</if>
<if test="3 == reportType ">
<if test="3 == basicDto.reportType ">
date_format(create_date, '%Y') &lt;= reportTime
</if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
<if test=" null != basicDto.tenantId and '' != basicDto.tenantId">
and `tenant_id` = #{basicDto.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != basicDto.parentTenantId and '' != basicDto.parentTenantId">
and `parent_tenant_id` = #{basicDto.parentTenantId}
</if>
) as totalCount
</if>

from wx_c_user where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_c_user${tenantEntity.shardTableSuffix}
</foreach>) wx_c_user where 1=1
<if test=" null != basicDto.tenantId and '' != basicDto.tenantId">
and `tenant_id` = #{basicDto.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != basicDto.parentTenantId and '' != basicDto.parentTenantId">
and `parent_tenant_id` = #{basicDto.parentTenantId}
</if>
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
<if test=" null != basicDto.startTime ">
and create_date &gt;= #{basicDto.startTime}
</if>
<if test=" null != endTime">
and create_date &lt; #{endTime}
<if test=" null != basicDto.endTime">
and create_date &lt; #{basicDto.endTime}
</if>
<if test="1 == reportType or 2 == reportType or 3 == reportType">
<if test="1 == basicDto.reportType or 2 == basicDto.reportType or 3 == basicDto.reportType">
group by reportTime
</if>
</select>

<select id="listByChannel" resultMap="BaseResultMap" >
select id,user_id,nick_name,phone,create_date,scene_address from wx_c_user where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
select id,user_id,nick_name,phone,create_date,scene_address from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_c_user${tenantEntity.shardTableSuffix}
</foreach>) wx_c_user where 1=1
<if test=" null != wxCUser.tenantId and '' != wxCUser.tenantId">
and `tenant_id` = #{wxCUser.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != wxCUser.parentTenantId and '' != wxCUser.parentTenantId">
and `parent_tenant_id` = #{wxCUser.parentTenantId}
</if>
<if test=" null != startDate ">
and create_date &gt;= #{startDate}
<if test=" null != wxCUser.startDate ">
and create_date &gt;= #{wxCUser.startDate}
</if>
<if test=" null != endDate">
and create_date &lt; #{endDate}
<if test=" null != wxCUser.endDate">
and create_date &lt; #{wxCUser.endDate}
</if>
<if test=" sceneList!= null ">
<if test=" wxCUser.sceneList!= null ">
and scene_address in
<foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")">
<foreach collection="wxCUser.sceneList" index="index" item="scene" open="(" separator="," close=")">
#{scene}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns"> order by create_date desc </if>
<if test=" null != wxCUser.sortColumns"> order by ${wxCUser.sortColumns} </if>
<if test=" null == wxCUser.sortColumns"> order by create_date desc </if>
</select>

<select id="countByChannel" resultType="java.lang.Long" >
select count(id) from wx_c_user where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
select count(id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_c_user${tenantEntity.shardTableSuffix}
</foreach>) wx_c_user where 1=1
<if test=" null != wxCUser.tenantId and '' != wxCUser.tenantId">
and `tenant_id` = #{wxCUser.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != wxCUser.parentTenantId and '' != wxCUser.parentTenantId">
and `parent_tenant_id` = #{wxCUser.parentTenantId}
</if>
<if test=" null != startDate ">
and create_date &gt;= #{startDate}
<if test=" null != wxCUser.startDate ">
and create_date &gt;= #{wxCUser.startDate}
</if>
<if test=" null != endDate">
and create_date &lt; #{endDate}
<if test=" null != wxCUser.endDate">
and create_date &lt; #{wxCUser.endDate}
</if>
<if test=" sceneList!= null ">
<if test=" wxCUser.sceneList!= null ">
and scene_address in
<foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")">
<foreach collection="wxCUser.sceneList" index="index" item="scene" open="(" separator="," close=")">
#{scene}
</foreach>
</if>


Загрузка…
Отмена
Сохранить