Просмотр исходного кода

Merge branch 'release_real_202010' of https://git.malls.iformall.com/server/formallProject into release_real_202010

release_toaliyun_real
xiaohanzi 5 лет назад
Родитель
Сommit
3ee40a5f94
18 измененных файлов: 243 добавлений и 142 удалений
  1. +3
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java
  2. +13
    -4
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  3. +10
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderGroupController.java
  4. +14
    -8
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java
  5. +10
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderGroupController.java
  6. +4
    -2
      mallinkSchedule/src/main/java/com/iformall/schedule/ChartDataSchedule.java
  7. +3
    -3
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  8. +1
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxOrderGroupMapper.java
  9. +1
    -2
      mallinkService/src/main/java/com/iformall/service/WxCUserCarService.java
  10. +6
    -3
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  11. +2
    -1
      mallinkService/src/main/java/com/iformall/service/WxOrderGroupService.java
  12. +4
    -2
      mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java
  13. +3
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserCarServiceImpl.java
  14. +11
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java
  15. +6
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  16. +3
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java
  17. +120
    -68
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  18. +29
    -17
      mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml

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

@@ -156,14 +156,15 @@ public class WxUserStructureController extends BaseController {
public ResultData findCarLevelStructure(Date startTime, Date endTime) {
logger.debug("[" + getIpAddr() + "] WxUserStructureController::findCarLevelStructure");
TenantEntity tenantInfo = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantInfo);
// List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantInfo);
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.setStartTime(startTime);
dto.setEndTime(endTime);
long total = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);
dto.updateTenantInfo(tenantInfo);
dto.setFinalTenantId(tenantInfo.getFinalTenantId());

long userCountWithCar = wxCUserCarService.countUser(dto,tenantEntitys);
long userCountWithCar = wxCUserCarService.countUser(dto);
Map userWithCar = new HashMap();
userWithCar.put("title","已绑定车牌");
userWithCar.put("count",userCountWithCar);


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

@@ -16,6 +16,7 @@ import com.iformall.mapper.WxCouponChannelMapper;
import com.iformall.service.WxCouponPasswordService;
import com.iformall.service.WxCouponService;
import com.iformall.service.WxFlowService;
import com.iformall.service.WxMallService;
import com.iformall.utils.DateUtils;
import com.iformall.utils.RedisLock;

@@ -50,6 +51,8 @@ public class WxCouponController extends BaseController {
@Autowired
private WxFlowService wxFlowService;
@Autowired
private WxMallService wxMallService;
@Autowired
RedisLock redisLock;

@ApiOperation("分页列表接口")
@@ -312,6 +315,8 @@ public class WxCouponController extends BaseController {
public ResultData findCardCountList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
//默认时间本月第一天,截止到当天
Map<String, Object> result = new HashedMap();
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);
if (wxCoupon.getStartdate() == null) {
wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth());
}
@@ -319,7 +324,7 @@ public class WxCouponController extends BaseController {
wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"));
}
wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode());
PageInfo<WxCouponStatisVo> pageInfo = wxCouponService.findCountData(wxCoupon, pageNum, pageSize);
PageInfo<WxCouponStatisVo> pageInfo = wxCouponService.findCountData(wxCoupon,tenantEntitys, pageNum, pageSize);
for (WxCouponStatisVo coupon : pageInfo.getList()) {
if (coupon.getSaleAmount() == null) {
coupon.setSaleAmount(0);
@@ -343,6 +348,8 @@ public class WxCouponController extends BaseController {
@SystemControllerLog(description = "券投放-券营销列表")
public ResultData findCouponCountList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
//默认时间本月第一天,截止到当天
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);
Map<String, Object> result = new HashedMap();
if (wxCoupon.getStartdate() == null) {
wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth());
@@ -353,7 +360,7 @@ public class WxCouponController extends BaseController {

wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode());

PageInfo<WxCouponStatisVo> pageInfo = wxCouponService.findCouponData(wxCoupon, pageNum, pageSize);
PageInfo<WxCouponStatisVo> pageInfo = wxCouponService.findCouponData(wxCoupon, tenantEntitys, pageNum, pageSize);
for (WxCouponStatisVo coupon : pageInfo.getList()) {
if (coupon.getSumSubsidy() == null) {
coupon.setSumSubsidy(0);
@@ -372,10 +379,12 @@ public class WxCouponController extends BaseController {
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
@SystemControllerLog(description = "券投放-砍价营销列表")
public ResultData findPressCountList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);
Map<String,Object> result = new HashedMap();
wxCoupon.updateTenantInfo(getTenantInfo());
wxCoupon.updateTenantInfo(tenantEntity);
wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode());
PageInfo<WxCouponStatisVo> pages = wxCouponService.findPressData(wxCoupon,pageNum,pageSize);
PageInfo<WxCouponStatisVo> pages = wxCouponService.findPressData(wxCoupon,tenantEntitys,pageNum,pageSize);
return new ResultData(pages);
}



+ 10
- 2
mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderGroupController.java Просмотреть файл

@@ -4,7 +4,9 @@ import com.github.pagehelper.PageInfo;
import com.iformall.annotation.SystemControllerLog;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxOrderGroupMarketing;
import com.iformall.service.WxMallService;
import com.iformall.service.WxOrderGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -18,6 +20,8 @@ import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/orderGroup")
@Api(description = "拼团相关接口")
@@ -26,6 +30,8 @@ public class WxOrderGroupController extends BaseController {

@Autowired
WxOrderGroupService wxOrderGroupService;
@Autowired
WxMallService wxMallService;

@ApiOperation(value = "拼团营销分析")
@GetMapping("queryOrderGroupMarketingList")
@@ -36,8 +42,10 @@ public class WxOrderGroupController extends BaseController {
})
@SystemControllerLog(description = "订单管理-拼团营销分析")
public ResultData queryOrderGroupMarketingList(@ModelAttribute WxOrderGroupMarketing wxOrderGroupMarketing, Integer pageNum, Integer pageSize) {
wxOrderGroupMarketing.updateTenantInfo(getTenantInfo());
final PageInfo<WxOrderGroupMarketing> page = wxOrderGroupService.queryOrderGroupMarketingList(wxOrderGroupMarketing, pageNum, pageSize);
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);
wxOrderGroupMarketing.updateTenantInfo(tenantEntity);
final PageInfo<WxOrderGroupMarketing> page = wxOrderGroupService.queryOrderGroupMarketingList(wxOrderGroupMarketing,tenantEntitys, pageNum, pageSize);
return new ResultData(page);
}



+ 14
- 8
mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java Просмотреть файл

@@ -16,10 +16,7 @@ import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxCouponStatisVo;
import com.iformall.enums.*;
import com.iformall.mapper.WxCouponChannelMapper;
import com.iformall.service.WxCouponPasswordService;
import com.iformall.service.WxCouponService;
import com.iformall.service.WxFlowService;
import com.iformall.service.WxMerchantService;
import com.iformall.service.*;
import com.iformall.utils.DateUtils;
import com.iformall.utils.RedisLock;
import io.swagger.annotations.Api;
@@ -55,6 +52,8 @@ public class WxCouponController extends BaseController {
@Autowired
private WxMerchantService wxMerchantService;
@Autowired
private WxMallService wxMallService;
@Autowired
RedisLock redisLock;

@ApiOperation("分页列表接口")
@@ -350,6 +349,8 @@ public class WxCouponController extends BaseController {
public ResultData findCardCountList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
//默认时间本月第一天,截止到当天
Map<String, Object> result = new HashedMap();
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);
if (wxCoupon.getStartdate() == null) {
wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth());
}
@@ -357,7 +358,7 @@ public class WxCouponController extends BaseController {
wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"));
}
wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Bapi.getCode());
PageInfo<WxCouponStatisVo> pageInfo = wxCouponService.findCountData(wxCoupon, pageNum, pageSize);
PageInfo<WxCouponStatisVo> pageInfo = wxCouponService.findCountData(wxCoupon, tenantEntitys, pageNum, pageSize);
for (WxCouponStatisVo coupon : pageInfo.getList()) {
if (coupon.getSaleAmount() == null) {
coupon.setSaleAmount(0);
@@ -380,6 +381,9 @@ public class WxCouponController extends BaseController {
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData findCouponCountList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
//默认时间本月第一天,截止到当天
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);

Map<String, Object> result = new HashedMap();
if (wxCoupon.getStartdate() == null) {
wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth());
@@ -390,7 +394,7 @@ public class WxCouponController extends BaseController {

wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Bapi.getCode());

PageInfo<WxCouponStatisVo> pageInfo = wxCouponService.findCouponData(wxCoupon, pageNum, pageSize);
PageInfo<WxCouponStatisVo> pageInfo = wxCouponService.findCouponData(wxCoupon,tenantEntitys, pageNum, pageSize);
for (WxCouponStatisVo coupon : pageInfo.getList()) {
if (coupon.getSumSubsidy() == null) {
coupon.setSumSubsidy(0);
@@ -408,10 +412,12 @@ public class WxCouponController extends BaseController {
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData findPressCountList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);
Map<String,Object> result = new HashedMap();
wxCoupon.updateTenantInfo(getTenantInfo());
wxCoupon.updateTenantInfo(tenantEntity);
wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Bapi.getCode());
PageInfo<WxCouponStatisVo> pages = wxCouponService.findPressData(wxCoupon,pageNum,pageSize);
PageInfo<WxCouponStatisVo> pages = wxCouponService.findPressData(wxCoupon,tenantEntitys,pageNum,pageSize);
return new ResultData(pages);
}



+ 10
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxOrderGroupController.java Просмотреть файл

@@ -4,12 +4,13 @@ import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxOrder;
import com.iformall.domain.po.WxOrderGroup;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxOrderGroupMarketing;
import com.iformall.enums.EnumOrderStatus;
import com.iformall.service.WxCouponService;
import com.iformall.service.WxMallService;
import com.iformall.service.WxOrderGroupService;
import com.iformall.service.WxOrderService;
import io.swagger.annotations.Api;
@@ -21,6 +22,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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

@RestController
@@ -38,6 +40,9 @@ public class WxOrderGroupController extends BaseController {
@Autowired
WxOrderGroupService wxOrderGroupService;

@Autowired
WxMallService wxMallService;


@ApiOperation(value = "查询差1个的团购信息")
@GetMapping("queryRemainOne")
@@ -151,7 +156,10 @@ public class WxOrderGroupController extends BaseController {
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true),
})
public ResultData queryOrderGroupMarketingList(@ModelAttribute WxOrderGroupMarketing wxOrderGroupMarketing, Integer pageNum, Integer pageSize) {
final PageInfo<WxOrderGroupMarketing> page = wxOrderGroupService.queryOrderGroupMarketingList(wxOrderGroupMarketing, pageNum, pageSize);
TenantEntity tenantEntity = getTenantInfo();
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity);
wxOrderGroupMarketing.updateTenantInfo(tenantEntity);
final PageInfo<WxOrderGroupMarketing> page = wxOrderGroupService.queryOrderGroupMarketingList(wxOrderGroupMarketing, tenantEntitys, pageNum, pageSize);
return new ResultData(page);
}



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

@@ -208,16 +208,18 @@ public class ChartDataSchedule {
}

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

public void carMemberData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) {
params.put("finalTenantId",tenantEntity.getFinalTenantId());
List<Map<String, Object>> carCountHistory = wxCUserCarMapper.queryCarCountHistory(params);
Long userCount = carCountHistory.isEmpty() ? 0L : (Long) carCountHistory.get(0).get("count");
addChartData(tenantEntity, userCount.toString(), EnumChartType.CAR_MEMBER.getCode(), date, createtime);


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

@@ -10,9 +10,9 @@ import org.apache.ibatis.annotations.Param;
import com.iformall.domain.po.WxCoupon;

public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
List<WxCouponStatisVo> findPressData(WxCoupon wxCoupon);
List<WxCouponStatisVo> findCouponData(WxCoupon wxCoupon);
List<WxCouponStatisVo> findCountData(WxCoupon wxCoupon);
List<WxCouponStatisVo> findPressData(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon);
List<WxCouponStatisVo> findCouponData(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon);
List<WxCouponStatisVo> findCountData(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon);

List<WxCoupon> findList(WxCoupon wxCoupon);
List<WxCoupon> findCouponList(WxCoupon wxCoupon);


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

@@ -26,7 +26,7 @@ public interface WxOrderGroupMapper extends CommonMapper<WxOrderGroup, Long> {

int updateOrderGroup(WxOrderGroup wxOrderGroup);

List<WxOrderGroupMarketing> queryOrderGroupMarketingList(WxOrderGroupMarketing marketing);
List<WxOrderGroupMarketing> queryOrderGroupMarketingList(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("marketing")WxOrderGroupMarketing marketing);

List<Map<String, Object>> queryOrderGroupSuccessCountAndTime(Map<String, Object> params);



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

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


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

@@ -26,25 +26,28 @@ public interface WxCouponService {
/**
* 卡类列表,包括统计
* @param record
* @param tenantEntitys
* @return
*/
PageInfo<WxCouponStatisVo> findCountData(WxCoupon record, Integer pageNum, Integer pageSize);
PageInfo<WxCouponStatisVo> findCountData(WxCoupon record, List<TenantEntity> tenantEntitys, Integer pageNum, Integer pageSize);

/**
* 券列表,包括统计
* @param record
* @param tenantEntitys
* @return
*/
PageInfo<WxCouponStatisVo> findCouponData(WxCoupon record,Integer pageNum, Integer pageSize);
PageInfo<WxCouponStatisVo> findCouponData(WxCoupon record, List<TenantEntity> tenantEntitys, Integer pageNum, Integer pageSize);

/**
* 砍价列表,包括统计
* @param record
* @param tenantEntitys
* @param pageNum
* @param pageSize
* @return
*/
PageInfo<WxCouponStatisVo> findPressData(WxCoupon record,Integer pageNum, Integer pageSize);
PageInfo<WxCouponStatisVo> findPressData(WxCoupon record, List<TenantEntity> tenantEntitys, Integer pageNum, Integer pageSize);

/**
* 根据Id获得实体


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

@@ -5,6 +5,7 @@ import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxOrder;
import com.iformall.domain.po.WxOrderGroup;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxOrderGroupMarketing;

import java.util.List;
@@ -31,6 +32,6 @@ public interface WxOrderGroupService {

List<WxOrderGroup> findList(WxOrderGroup group);

PageInfo<WxOrderGroupMarketing> queryOrderGroupMarketingList(WxOrderGroupMarketing marketing, Integer pageNum, Integer pageSize);
PageInfo<WxOrderGroupMarketing> queryOrderGroupMarketingList(WxOrderGroupMarketing marketing, List<TenantEntity> tenantEntitys, Integer pageNum, Integer pageSize);
}

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

@@ -618,19 +618,21 @@ public class DataTowerServiceImpl implements DataTowerService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
WxCUserBasicInfoDto wxCUserBasicInfoDto = new WxCUserBasicInfoDto();
wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId());
try {
wxCUserBasicInfoDto.setStartTime(sdf.parse(oneWeekStartdate+ " 00:00:00"));
wxCUserBasicInfoDto.setEndTime(sdf.parse(oneWeekEndDate+ " 23:59:59"));
}catch (Exception e){
e.printStackTrace();
}
datamap.put("oneWeekNewCarUserCount",wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));
datamap.put("oneWeekNewCarUserCount",wxCUserCarService.countUser(wxCUserBasicInfoDto));
logger.info("停车-近一周新增停车会员数-结束");
//停车会员总数
logger.info("停车-停车会员总数-开始");
wxCUserBasicInfoDto = new WxCUserBasicInfoDto();
wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
datamap.put("newCarUserSumCount",wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));
wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId());
datamap.put("newCarUserSumCount",wxCUserCarService.countUser(wxCUserBasicInfoDto));
logger.info("停车-停车会员总数-结束");

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


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

@@ -40,14 +40,9 @@ public class WxCUserCarServiceImpl implements WxCUserCarService {
}

@Override
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;
public Integer countUser(WxCUserBasicInfoDto dto) {
Integer integer = wxCUserCarMapper.countUser(dto);
return integer==null?0:integer;
}

@Override


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

@@ -127,10 +127,9 @@ public class WxChartServiceImpl implements WxChartDataService {
enddate = enddate + " 23:59:59";
}

TenantEntity tenantEntity = new TenantEntity() {{
setTenantId(tenantId);
setParentTenantId(parentTenantId);
}};
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(tenantId);
tenantEntity.setParentTenantId(parentTenantId);

//出租率
if (chart.equals(EnumChart.CZL.getCode())) {
@@ -1033,18 +1032,20 @@ 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);
wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId());
try {
wxCUserBasicInfoDto.setStartTime(sdf.parse(oneWeekStartdate));
wxCUserBasicInfoDto.setEndTime(sdf.parse(oneWeekEndDate));
} catch (Exception e) {
e.printStackTrace();
}
datamap.put("oneWeekNewCarUserCount", wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));
datamap.put("oneWeekNewCarUserCount", wxCUserCarService.countUser(wxCUserBasicInfoDto));
//停车会员总数
wxCUserBasicInfoDto = new WxCUserBasicInfoDto();
// wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
datamap.put("newCarUserSumCount", wxCUserCarService.countUser(wxCUserBasicInfoDto,tenantEntitys));
wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId());
datamap.put("newCarUserSumCount", wxCUserCarService.countUser(wxCUserBasicInfoDto));

return new ResultData(datamap);
}
@@ -2140,7 +2141,8 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setEndTime(DateUtils.stringToDate(enddate));
long total = wxCUserBasicInfoService.findCount(tenantEntity,dto);
dto.updateTenantInfo(tenantEntity);
long userCountWithCar = wxCUserCarService.countUser(dto,tenantEntitys);
dto.setFinalTenantId(tenantEntity.getFinalTenantId());
long userCountWithCar = wxCUserCarService.countUser(dto);
Map userWithCar = new HashMap();
userWithCar.put("title", "已绑定车牌");
userWithCar.put("count", userCountWithCar);


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

@@ -173,8 +173,8 @@ public class WxCouponServiceImpl implements WxCouponService {


@Override
public PageInfo<WxCouponStatisVo> findCountData(WxCoupon record,Integer pageNum, Integer pageSize) {
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCountData(record));
public PageInfo<WxCouponStatisVo> findCountData(WxCoupon record, List<TenantEntity> tenantEntitys, Integer pageNum, Integer pageSize) {
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCountData(tenantEntitys,record));
}

@Override
@@ -542,8 +542,8 @@ public class WxCouponServiceImpl implements WxCouponService {
}

@Override
public PageInfo<WxCouponStatisVo> findCouponData(WxCoupon record, Integer pageNum, Integer pageSize) {
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCouponData(record));
public PageInfo<WxCouponStatisVo> findCouponData(WxCoupon record, List<TenantEntity> tenantEntitys, Integer pageNum, Integer pageSize) {
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCouponData(tenantEntitys,record));
}

@Override
@@ -609,8 +609,8 @@ public class WxCouponServiceImpl implements WxCouponService {
}

@Override
public PageInfo<WxCouponStatisVo> findPressData(WxCoupon record, Integer pageNum, Integer pageSize) {
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findPressData(record));
public PageInfo<WxCouponStatisVo> findPressData(WxCoupon record, List<TenantEntity> tenantEntitys, Integer pageNum, Integer pageSize) {
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findPressData(tenantEntitys,record));
}

@Override


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

@@ -8,6 +8,7 @@ import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxOrderGroupMarketing;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
@@ -405,9 +406,9 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService {
}

@Override
public PageInfo<WxOrderGroupMarketing> queryOrderGroupMarketingList(WxOrderGroupMarketing marketing, Integer pageIndex, Integer pageSize) {
public PageInfo<WxOrderGroupMarketing> queryOrderGroupMarketingList(WxOrderGroupMarketing marketing, List<TenantEntity> tenantEntitys, Integer pageIndex, Integer pageSize) {
PageHelper.startPage(pageIndex, pageSize);
List<WxOrderGroupMarketing> result = wxOrderGroupMapper.queryOrderGroupMarketingList(marketing);
List<WxOrderGroupMarketing> result = wxOrderGroupMapper.queryOrderGroupMarketingList(tenantEntitys,marketing);
PageInfo<WxOrderGroupMarketing> pageInfo = new PageInfo<>(result);
return pageInfo;
}


+ 120
- 68
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -746,141 +746,191 @@
where c.type = 100 and sc.create_date between #{startdate} and #{enddate}
</select>

<select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
<select id="findCountData" resultMap="statisMap">
select c.*,
IFNULL(round((select sum(wcs.real_payment) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc on wc.id = ci.coupon_id
left join wx_card_spend wcs on wcs.card_id = ci.id
where wc.id = c.id)/(select sum(ci.sale_amount) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc on wc.id = ci.coupon_id
where wc.id = c.id)*100,2),0) payment_rate,

(select count(wco.id) from wx_coupon wc
left join wx_coupon_order wco on wc.id = wco.coupon_id
(select count(wco.id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
</foreach>) wco on wc.id = wco.coupon_id
where wc.id = c.id) as sale_count,

(select count(distinct wcs.coupon_order_id) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc on wc.id = ci.coupon_id
left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id
where wc.id = c.id) as transfer_count,

(select sum(ci.sale_amount) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc on wc.id = ci.coupon_id
where wc.id = c.id) as sale_amount,

(select sum(wcs.real_payment) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc on wc.id = ci.coupon_id
left join wx_card_spend wcs on wcs.card_id = ci.id
where wc.id = c.id) as sum_payment,

(select sum(sc.subsidy) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc on wc.id = ci.coupon_id
left join wx_merchant_subsidy sc on sc.coupon_order_id = ci.id
where wc.id = c.id) as sum_subsidy

from wx_coupon c where c.type = 100
<if test="title != null and title !=''">
and c.title like concat('%', #{title},'%')
from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) c where c.type = 100
<if test="wxCoupon.title != null and wxCoupon.title !=''">
and c.title like concat('%', #{wxCoupon.title},'%')
</if>
<if test="id != null">
and c.id = #{id}
<if test="wxCoupon.id != null">
and c.id = #{wxCoupon.id}
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
<if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
<if test=" null != wxCoupon.sortColumns">order by ${wxCoupon.sortColumns}</if>
<if test=" null == wxCoupon.sortColumns">order by c.status asc,c.create_date desc</if>

</select>

<select id="findCouponData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
<select id="findCouponData" resultMap="statisMap">
select c.*,
IFNULL(round((select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and
wco.coupon_order_status = 1 and wc.id = c.id)/(select count(wco.id) from wx_coupon_order wco where wco.coupon_id
IFNULL(round((select count(wco.id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc,(<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
</foreach>) wco where wco.coupon_id = wc.id and
wco.coupon_order_status = 1 and wc.id = c.id)/(select count(wco.id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
</foreach>) wco where wco.coupon_id
= c.id)*100,2),0) payment_rate,
(select count(wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count,
(select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and
(select count(wco.id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
</foreach>) wco where wco.coupon_id = c.id) as sale_count,
(select count(wco.id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc,(<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
</foreach>) wco where wco.coupon_id = wc.id and
wco.coupon_order_status = 1 and wc.id = c.id) as sum_payment,
(select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and
(select count(wco.id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc,(<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
</foreach>) wco where wco.coupon_id = wc.id and
wco.coupon_order_status = 3 and wc.id = c.id) as backpay_count,
(select sum(sc.subsidy) from wx_coupon wc
left join wx_coupon_order wo on wo.coupon_id = wc.id
(select sum(sc.subsidy) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
</foreach>) wo on wo.coupon_id = wc.id
left join wx_merchant_subsidy sc on sc.coupon_order_id = wo.id
where wc.id = c.id) as sum_subsidy
from wx_coupon c where c.type not in(8,9,100)
<if test=" 1 == type ">
from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) c where c.type not in(8,9,100)
<if test=" 1 == wxCoupon.type ">
and c.sale_price > 0
</if>
<if test=" 2 == type ">
<if test=" 2 == wxCoupon.type ">
and c.sale_price = 0
</if>
<if test="title != null and title != ''">
and c.title like concat('%', #{title},'%')
<if test="wxCoupon.title != null and wxCoupon.title != ''">
and c.title like concat('%', #{wxCoupon.title},'%')
</if>
<if test="id != null">
and c.id = #{id}
<if test="wxCoupon.id != null">
and c.id = #{wxCoupon.id}
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
<if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
<if test=" null != wxCoupon.sortColumns">order by ${wxCoupon.sortColumns}</if>
<if test=" null == wxCoupon.sortColumns">order by c.status asc,c.create_date desc</if>
</select>

<select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
<select id="findPressData" resultMap="statisMap">
select c.id,c.tenant_id, c.`cover_img`,c.`title`,c.`sale_price`,c.`price`,
ifnull(op.press_count,0) as press_count,
ifnull(o.press_succ_count,0) as press_succ_count,
ifnull(op2.join_count,0) as join_count,
ifnull(round(o.press_succ_count/op.press_count*100,2),0) as change_rate,
ifnull(round(cop.xCount/op.press_count*100,2),0) as payment_rate
FROM wx_coupon c
left join (SELECT count(id) as press_count, coupon_id FROM wx_order_press WHERE `first` = 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_coupon${tenantEntity.shardTableSuffix}
</foreach>) c
left join (SELECT count(id) as press_count, coupon_id FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_order_press${tenantEntity.shardTableSuffix}
</foreach>) wx_order_press WHERE `first` = 1
<if test=" null != wxCoupon.tenantId and '' != wxCoupon.tenantId">
and `tenant_id` = #{wxCoupon.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != wxCoupon.parentTenantId and '' != wxCoupon.parentTenantId">
and `parent_tenant_id` = #{wxCoupon.parentTenantId}
</if>
group by coupon_id) op on op.coupon_id = c.id
left join (SELECT count(id) as press_succ_count, product_id FROM wx_order WHERE order_status = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
left join (SELECT count(id) as press_succ_count, product_id FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_order${tenantEntity.shardTableSuffix}
</foreach>) wx_order WHERE order_status = 1
<if test=" null != wxCoupon.tenantId and '' != wxCoupon.tenantId">
and `tenant_id` = #{wxCoupon.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != wxCoupon.parentTenantId and '' != wxCoupon.parentTenantId">
and `parent_tenant_id` = #{wxCoupon.parentTenantId}
</if>
group by product_id) o on o.product_id = c.id
left join (SELECT count(id) as join_count, coupon_id FROM wx_order_press WHERE 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
left join (SELECT count(id) as join_count, coupon_id FROM (SELECT count(id) as press_count, coupon_id FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_order_press${tenantEntity.shardTableSuffix}
</foreach>) wx_order_press WHERE 1=1
<if test=" null != wxCoupon.tenantId and '' != wxCoupon.tenantId">
and `tenant_id` = #{wxCoupon.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != wxCoupon.parentTenantId and '' != wxCoupon.parentTenantId">
and `parent_tenant_id` = #{wxCoupon.parentTenantId}
</if>
group by coupon_id) op2 on op2.coupon_id = c.id
left join (SELECT count(id) as xCount, coupon_id FROM wx_coupon_order WHERE coupon_order_status = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
left join (SELECT count(id) as xCount, coupon_id FROM (SELECT count(id) as join_count, coupon_id FROM (SELECT count(id) as press_count, coupon_id FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
</foreach>) wx_coupon_order WHERE coupon_order_status = 1
<if test=" null != wxCoupon.tenantId and '' != wxCoupon.tenantId">
and `tenant_id` = #{wxCoupon.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != wxCoupon.parentTenantId and '' != wxCoupon.parentTenantId">
and `parent_tenant_id` = #{wxCoupon.parentTenantId}
</if>
group by coupon_id) cop on cop.coupon_id = c.id
where c.type = 8

<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
<if test=" null != wxCoupon.tenantId and '' != wxCoupon.tenantId">
and c.`tenant_id` = #{wxCoupon.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
<if test=" null != wxCoupon.parentTenantId and '' != wxCoupon.parentTenantId">
and c.`parent_tenant_id` = #{wxCoupon.parentTenantId}
</if>
<if test="id != null">
and c.id = #{id}
<if test="wxCoupon.id != null">
and c.id = #{wxCoupon.id}
</if>
<if test="title != null and title != ''">
and c.title like concat('%', #{title},'%')
<if test="wxCoupon.title != null and wxCoupon.title != ''">
and c.title like concat('%', #{wxCoupon.title},'%')
</if>
<if test=" null != startdate and null!=enddate">
and c.`create_date` between #{startdate} and #{enddate}
<if test=" null != wxCoupon.startdate and null!=wxCoupon.enddate">
and c.`create_date` between #{wxCoupon.startdate} and #{wxCoupon.enddate}
</if>

<if test=" null != sortColumns">order by ${sortColumns}</if>
<if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
<if test=" null != wxCoupon.sortColumns">order by ${wxCoupon.sortColumns}</if>
<if test=" null == wxCoupon.sortColumns">order by c.status asc,c.create_date desc</if>
</select>

<select id="findCouponOrderCount"
@@ -964,7 +1014,9 @@
<!--砍价-->
<select id="pressSendHistory"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wop.create_date,'%Y-%m-%d') xtime,count(wop.id) xcount from wx_coupon wc
select DATE_FORMAT(wop.create_date,'%Y-%m-%d') xtime,count(wop.id) xcount from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_order${tenantEntity.shardTableSuffix}
</foreach>) wo on wo.product_id = wc.id


+ 29
- 17
mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml Просмотреть файл

@@ -109,7 +109,7 @@
</update>
<select id="queryOrderGroupMarketingList" parameterType="com.iformall.domain.vo.WxOrderGroupMarketing"
<select id="queryOrderGroupMarketingList"
resultType="com.iformall.domain.vo.WxOrderGroupMarketing">
SELECT c.tenant_id,c.parent_tenant_id, c.id, c.cover_img, c.title,
IFNULL(og.group_total_count,0) as group_total_count,
@@ -121,27 +121,39 @@
ROUND(IFNULL((co.verify_count / o.success_people), 0) * 100) verify_ratio,
ROUND(c.price / 100, 2) price,
ROUND(c.sale_price / 100, 2) sale_price
FROM wx_coupon c
left join (SELECT count(*) group_total_count, coupon_id FROM wx_order_group group by coupon_id) og on og.coupon_id = c.id
left join (SELECT count(*) group_success_count, coupon_id FROM wx_order_group WHERE status = 11 group by coupon_id) og2 on og2.coupon_id = c.id
left join (SELECT count(*) success_people, product_id FROM wx_order WHERE order_status = 11 group by product_id ) o on o.product_id = c.id
left join (SELECT count(*) verify_count, coupon_id FROM wx_coupon_order WHERE coupon_type = 9 AND coupon_order_status = 1 group by coupon_id ) co on co.coupon_id = c.id
left join (SELECT count(*) total_people, product_id FROM wx_order WHERE order_group_id != 0 group by product_id ) o2 on o2.product_id = c.id
FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) c
left join (SELECT count(*) group_total_count, coupon_id FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_order_group${tenantEntity.shardTableSuffix}
</foreach>) wx_order_group group by coupon_id) og on og.coupon_id = c.id
left join (SELECT count(*) group_success_count, coupon_id FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_order_group${tenantEntity.shardTableSuffix}
</foreach>) wx_order_group WHERE status = 11 group by coupon_id) og2 on og2.coupon_id = c.id
left join (SELECT count(*) success_people, product_id FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_order${tenantEntity.shardTableSuffix}
</foreach>) wx_order WHERE order_status = 11 group by product_id ) o on o.product_id = c.id
left join (SELECT count(*) verify_count, coupon_id FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
</foreach>) wx_coupon_order WHERE coupon_type = 9 AND coupon_order_status = 1 group by coupon_id ) co on co.coupon_id = c.id
left join (SELECT count(*) total_people, product_id FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_order${tenantEntity.shardTableSuffix}
</foreach>) wx_order WHERE order_group_id != 0 group by product_id ) o2 on o2.product_id = c.id
WHERE type = 9
<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
<if test=" null != marketing.tenantId and '' != marketing.tenantId">
and c.`tenant_id` = #{marketing.tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
<if test=" null != marketing.parentTenantId and '' != marketing.parentTenantId">
and c.`parent_tenant_id` = #{marketing.parentTenantId}
</if>
<if test=" null != couponId and ''!=couponId">
and c.coupon_id=#{couponId}
<if test=" null != marketing.couponId and ''! = marketing.couponId">
and c.coupon_id=#{marketing.couponId}
</if>
<if test=" null != title and ''!=title">
and c.title like concat('%',#{title},'%')
<if test=" null != marketing.title and ''! = marketing.title">
and c.title like concat('%',#{marketing.title},'%')
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
<if test=" null != marketing.sortColumns"> order by ${marketing.sortColumns} </if>
<if test=" null == marketing.sortColumns">order by c.status asc,c.create_date desc</if>
</select>
<select id="queryOrderGroupSuccessCountAndTime" parameterType="hashmap" resultType="hashmap">


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