xhxu 5 лет назад
Родитель
Сommit
780cf77547
9 измененных файлов: 74 добавлений и 35 удалений
  1. +12
    -7
      mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java
  2. +4
    -6
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserDataController.java
  3. +6
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/ChartDataSchedule.java
  4. +3
    -1
      mallinkService/src/main/java/com/iformall/service/WxCUserCarService.java
  5. +3
    -3
      mallinkService/src/main/java/com/iformall/service/WxCUserService.java
  6. +6
    -2
      mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java
  7. +9
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserCarServiceImpl.java
  8. +9
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java
  9. +22
    -11
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java

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

@@ -55,6 +55,9 @@ public class WxUserStructureController extends BaseController {
@Autowired
private WxScoreRulesService wxScoreRulesService;

@Autowired
private WxMallService wxMallService;

/***************************会员结构*****************************/

@ApiOperation("查询会员性别结构")
@@ -152,13 +155,15 @@ public class WxUserStructureController extends BaseController {
@SystemControllerLog(description = "会员管理-查询会员绑车牌结构")
public ResultData findCarLevelStructure(Date startTime, Date endTime) {
logger.debug("[" + getIpAddr() + "] WxUserStructureController::findCarLevelStructure");
TenantEntity tenantInfo = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantInfo);
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.setStartTime(startTime);
dto.setEndTime(endTime);
long total = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);
dto.updateTenantInfo(getTenantInfo());
dto.updateTenantInfo(tenantInfo);

long userCountWithCar = wxCUserCarService.countUser(dto);
long userCountWithCar = wxCUserCarService.countUser(dto,tenantEntitys);
Map userWithCar = new HashMap();
userWithCar.put("title","已绑定车牌");
userWithCar.put("count",userCountWithCar);
@@ -293,14 +298,14 @@ public class WxUserStructureController extends BaseController {
logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserCount");

TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);
//昨日同比
Map<String, Object> map = new HashMap<>();

WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
dto.setEndTime(new Date());
//微信用户数据
long wxTotalCount = wxCUserService.findCount(dto);//总量
long wxTotalCount = wxCUserService.findCount(dto,tenantEntitys);//总量
//微信用户数据
long memTotalCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//总量

@@ -314,7 +319,7 @@ public class WxUserStructureController extends BaseController {
Date today = c.getTime();
dto.setStartTime(today);
dto.setEndTime(null);
long wxTodayCount = wxCUserService.findCount(dto);//今天新增
long wxTodayCount = wxCUserService.findCount(dto, tenantEntitys);//今天新增
long memTodayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//今天新增

map.put("wxTodayCount",wxTodayCount);
@@ -327,7 +332,7 @@ public class WxUserStructureController extends BaseController {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long wxYesterdayCount = wxCUserService.findCount(dto);
long wxYesterdayCount = wxCUserService.findCount(dto, tenantEntitys);
long memYesterdayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);
if (wxYesterdayCount > 0) {
double yesterday = (double) (wxTodayCount - wxYesterdayCount) / wxYesterdayCount * 100;
@@ -424,7 +429,7 @@ public class WxUserStructureController extends BaseController {
WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto();
pdto.updateTenantInfo(tenantEntity);
pdto.setEndTime(startTime);
wxCountList.get(0).setTotalCount(wxCUserService.findCount(pdto));
wxCountList.get(0).setTotalCount(wxCUserService.findCount(pdto, tenantEntitys));
}
for (int i = 1; i < wxCountList.size(); i++){
if (wxCountList.get(i).getTotalCount() != null &&


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

@@ -15,10 +15,7 @@ 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.mapper.WxCUserBasicInfoMapper;
import com.iformall.service.*;
import com.iformall.utils.DataUtil;
import com.iformall.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +48,7 @@ public class WxCUserDataController extends BaseController {
@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;
@Autowired
WxMallService wxMallService;
private WxMallService wxMallService;

@GetMapping("findUserCountData")
@ApiOperation("查询用户数量接口")
@@ -59,9 +56,10 @@ public class WxCUserDataController extends BaseController {
public ResultData findUserCountData() {
logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserCountData");
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
long allCount = wxCUserService.findCount(dto);//总数
long allCount = wxCUserService.findCount(dto, tenantEntitys);//总数
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
@@ -81,7 +79,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);
long count = wxCUserService.findCount(dto, tenantEntitys);
UserStructureVo vo = new UserStructureVo();

vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime()));


+ 6
- 1
mallinkSchedule/src/main/java/com/iformall/schedule/ChartDataSchedule.java Просмотреть файл

@@ -8,6 +8,7 @@ import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumCarCmd;
import com.iformall.enums.EnumChartType;
import com.iformall.mapper.*;
import com.iformall.service.WxCUserCarService;
import com.iformall.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -48,6 +49,9 @@ public class ChartDataSchedule {
@Autowired
WxMerchantTradeDailyMapper wxMerchantTradeDailyMapper;

@Autowired
WxCUserCarService wxCUserCarService;


/**
* 每天7点执行
@@ -204,11 +208,12 @@ public class ChartDataSchedule {
}

public void carNewMemberData(Date createtime, Date date, TenantEntity tenantEntity) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
WxCUserBasicInfoDto wxCUserBasicInfoDto = new WxCUserBasicInfoDto();
wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
wxCUserBasicInfoDto.setStartTime(date);
wxCUserBasicInfoDto.setEndTime(date);
Integer carUserCount = wxCUserCarMapper.countUser(wxCUserBasicInfoDto);
Integer carUserCount = wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys);
addChartData(tenantEntity, carUserCount.toString(), EnumChartType.CAR_NEW_MEMBER.getCode(), date, createtime);
}



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

@@ -3,6 +3,7 @@ package com.iformall.service;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.dto.WxCUserBasicInfoDto;
import com.iformall.domain.po.WxCUserCar;
import com.iformall.domain.po.base.TenantEntity;

import java.util.List;

@@ -38,9 +39,10 @@ public interface WxCUserCarService {
* 根据实体查询count
*
* @param dto
* @param tenantEntitys
* @return
*/
Integer countUser(WxCUserBasicInfoDto dto);
Integer countUser(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys);
/**
* 根据实体查询
*


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

@@ -4,13 +4,12 @@ import com.github.pagehelper.PageInfo;
import com.iformall.domain.dto.WxCUserBasicInfoDto;
import com.iformall.domain.po.WxAuthorizerInfo;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxCreditHistory;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.UserCountVo;
import com.iformall.enums.EnumScoreType;
import me.chanjar.weixin.mp.bean.result.WxMpUser;

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

public interface WxCUserService {

@@ -94,9 +93,10 @@ public interface WxCUserService {
/**
* 统计数量
* @param dto
* @param tenantEntitys
* @return
*/
long findCount(WxCUserBasicInfoDto dto);
long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys);

/**
* 统计数量


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

@@ -12,6 +12,7 @@ import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.*;
import com.iformall.service.DataTowerService;
import com.iformall.service.WxCUserCarService;
import com.iformall.service.WxCouponChannelService;
import com.iformall.service.WxCouponOrderService;
import com.iformall.sms.wiwide.WiwideUtil;
@@ -84,6 +85,9 @@ public class DataTowerServiceImpl implements DataTowerService {
@Autowired
private WxCouponChannelService wxCouponChannelService;

@Autowired
private WxCUserCarService wxCUserCarService;


//出租与未出租***********************************************
private Map<String, Object> shopRunning(TenantEntity tenantEntity) {
@@ -620,13 +624,13 @@ public class DataTowerServiceImpl implements DataTowerService {
}catch (Exception e){
e.printStackTrace();
}
datamap.put("oneWeekNewCarUserCount",wxCUserCarMapper.countUser(wxCUserBasicInfoDto));
datamap.put("oneWeekNewCarUserCount",wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));
logger.info("停车-近一周新增停车会员数-结束");
//停车会员总数
logger.info("停车-停车会员总数-开始");
wxCUserBasicInfoDto = new WxCUserBasicInfoDto();
wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
datamap.put("newCarUserSumCount",wxCUserCarMapper.countUser(wxCUserBasicInfoDto));
datamap.put("newCarUserSumCount",wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));
logger.info("停车-停车会员总数-结束");

// 查询近一周的缴费车辆----end------


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

@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker;
import com.iformall.domain.dto.WxCUserBasicInfoDto;
import com.iformall.domain.po.WxCUserCar;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.mapper.WxCUserCarMapper;
import com.iformall.service.WxCUserCarService;
import org.slf4j.Logger;
@@ -39,8 +40,14 @@ public class WxCUserCarServiceImpl implements WxCUserCarService {
}

@Override
public Integer countUser(WxCUserBasicInfoDto dto) {
return wxCUserCarMapper.countUser(dto);
public Integer countUser(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) {
int i = 0;
for (TenantEntity tenantEntity:tenantEntitys) {
dto.updateTenantInfo(tenantEntity);
Integer integer = wxCUserCarMapper.countUser(dto);
i += (integer==null?0:integer);
}
return i;
}

@Override


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

@@ -10,6 +10,7 @@ import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.domain.po.WxCreditHistory;
import com.iformall.domain.po.base.BaseCUserEntity;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.msg.FmInsideCLoginMsg;
import com.iformall.domain.vo.UserCountVo;
import com.iformall.enums.*;
@@ -221,8 +222,14 @@ public class WxCUserServiceImpl implements WxCUserService {
// }

@Override
public long findCount(WxCUserBasicInfoDto dto) {
return wxCUserMapper.findCount(dto);
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


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

@@ -97,6 +97,10 @@ public class WxChartServiceImpl implements WxChartDataService {
KwMeterService kwMeterService;
@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;
@Autowired
private WxCUserService wxCUserService;
@Autowired
private WxCUserCarService wxCUserCarService;



@@ -1023,6 +1027,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getCarNewMemberCount(TenantEntity tenantEntity) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
String oneWeekStartdate = DateUtils.getTimeBefore(7, new Date());
String oneWeekEndDate = DateUtils.getTimeBefore(1, new Date());
@@ -1035,11 +1040,11 @@ public class WxChartServiceImpl implements WxChartDataService {
} catch (Exception e) {
e.printStackTrace();
}
datamap.put("oneWeekNewCarUserCount", wxCUserCarMapper.countUser(wxCUserBasicInfoDto));
datamap.put("oneWeekNewCarUserCount", wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));
//停车会员总数
wxCUserBasicInfoDto = new WxCUserBasicInfoDto();
wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
datamap.put("newCarUserSumCount", wxCUserCarMapper.countUser(wxCUserBasicInfoDto));
datamap.put("newCarUserSumCount", wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));

return new ResultData(datamap);
}
@@ -1349,10 +1354,11 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getNewUserCount(TenantEntity tenantEntity) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
long allCount = wxCUserMapper.findCount(dto);//总数
long allCount = wxCUserService.findCount(dto,tenantEntitys);//总数
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
@@ -1363,7 +1369,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long todayCount = wxCUserMapper.findCount(dto);
long todayCount = wxCUserService.findCount(dto,tenantEntitys);
datamap.put("allCount", allCount);//会员总数
datamap.put("todayCount", todayCount);//今日新增会员数
return new ResultData(datamap);
@@ -1440,6 +1446,7 @@ public class WxChartServiceImpl implements WxChartDataService {
}

private ResultData getNewMemberCount(TenantEntity tenantEntity, int days, String returnName) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
@@ -1456,7 +1463,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long count = wxCUserMapper.findCount(dto);
long count = wxCUserService.findCount(dto,tenantEntitys);
UserStructureVo vo = new UserStructureVo();
vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime()));
vo.setSortNum(sortNum++);
@@ -1756,11 +1763,12 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getMemeberWechatTotal(TenantEntity tenantEntity) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
//微信用户数据
long wxallCount = wxCUserMapper.findCount(dto);//总量
long wxallCount = wxCUserService.findCount(dto,tenantEntitys);//总量
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
@@ -1768,7 +1776,7 @@ public class WxChartServiceImpl implements WxChartDataService {
Date today = c.getTime();
dto.setStartTime(today);
dto.setEndTime(null);
long wxtodayCount = wxCUserMapper.findCount(dto);//今天新增
long wxtodayCount = wxCUserService.findCount(dto,tenantEntitys);//今天新增
datamap.put("wxallCount", wxallCount);//累计会员总数
datamap.put("wxtodayCount", wxtodayCount);//今日新增会员数
return new ResultData(datamap);
@@ -1802,6 +1810,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getMemberWechatJoinTrade(TenantEntity tenantEntity) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
final int daysBefore = 29;
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
@@ -1820,7 +1829,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long count = wxCUserMapper.findCount(dto);
long count = wxCUserService.findCount(dto,tenantEntitys);
UserStructureVo vo = new UserStructureVo();
vo.setSortNum(j);
j++;
@@ -1834,7 +1843,7 @@ public class WxChartServiceImpl implements WxChartDataService {
c.add(Calendar.DAY_OF_YEAR, -daysBefore);
dto.setEndTime(c.getTime());
dto.setStartTime(null);
long firstDay = wxCUserMapper.findCount(dto);//统计的第一天总数
long firstDay = wxCUserService.findCount(dto,tenantEntitys);//统计的第一天总数
int i = 0;
long sumCount = 0;
for (UserStructureVo v : wxnewCountVos) {
@@ -1987,6 +1996,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getWechatMemberTrade(TenantEntity tenantEntity) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
final int daysBefore = 29;
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
@@ -2005,7 +2015,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long count = wxCUserMapper.findCount(dto);
long count = wxCUserService.findCount(dto,tenantEntitys);
UserStructureVo vo = new UserStructureVo();
vo.setSortNum(j);
j++;
@@ -2120,12 +2130,13 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getMemberBindCar(TenantEntity tenantEntity, String startdate, String enddate) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.setStartTime(DateUtils.stringToDate(startdate));
dto.setEndTime(DateUtils.stringToDate(enddate));
long total = wxCUserBasicInfoService.findCount(tenantEntity,dto);
dto.updateTenantInfo(tenantEntity);
long userCountWithCar = wxCUserCarMapper.countUser(dto);
long userCountWithCar = wxCUserCarService.countUser(dto,tenantEntitys);
Map userWithCar = new HashMap();
userWithCar.put("title", "已绑定车牌");
userWithCar.put("count", userCountWithCar);


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