| @@ -16,7 +16,7 @@ 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.WxCUserBasicInfoService; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DataUtil; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -32,9 +32,6 @@ import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.vo.CUserDateAmountVo; | |||
| import com.iformall.domain.vo.TouchUsersReportVo; | |||
| import com.iformall.domain.vo.UserStructureVo; | |||
| import com.iformall.service.WxCUserService; | |||
| import com.iformall.service.WxCouponOrderService; | |||
| import com.iformall.service.WxUserVisitService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -53,6 +50,8 @@ public class WxCUserDataController extends BaseController { | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| WxMallService wxMallService; | |||
| @GetMapping("findUserCountData") | |||
| @ApiOperation("查询用户数量接口") | |||
| @@ -277,11 +276,12 @@ public class WxCUserDataController extends BaseController { | |||
| Date endTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| Date startTime = c.getTime(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| wxCouponOrder.setStartTime(startTime); | |||
| wxCouponOrder.setEndTime(endTime); | |||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder);//月消费金额 | |||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys);//月消费金额 | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| Date eTime = c.getTime(); | |||
| @@ -218,17 +218,23 @@ public class ChartDataSchedule { | |||
| } | |||
| public void carPayFeeData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| List<Map<String, Object>> weekCarPayHistoryList = wxCarCmdLogMapper.queryWeekCarPay(params); | |||
| BigDecimal fee = weekCarPayHistoryList.isEmpty() ? new BigDecimal(0) : (BigDecimal) weekCarPayHistoryList.get(0).get("fee"); | |||
| addChartData(tenantEntity, fee.toString(), EnumChartType.CAR_PAY_FEE.getCode(), date, createtime); | |||
| } | |||
| public void carPaidData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| Long carPayFeeCount = wxCarCmdLogMapper.queryWeekCarPayCount(params); | |||
| addChartData(tenantEntity, carPayFeeCount.toString(), EnumChartType.CAR_PAID.getCode(), date, createtime); | |||
| } | |||
| public void carOutData(HashMap<String, Object> params, Date createtime, Date date, TenantEntity tenantEntity) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| List<Map<String, Object>> historylist = wxCarCmdLogMapper.queryHistory(params); | |||
| Long carOutCount = historylist.isEmpty() ? 0L : (Long) historylist.get(0).get("carcount"); | |||
| addChartData(tenantEntity, carOutCount.toString(), EnumChartType.CAR_OUT.getCode(), date, createtime); | |||
| @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * Created by syf on 2018/8/30. | |||
| @@ -24,6 +25,9 @@ public class MarkingCouponDataReportDto extends TenantEntity { | |||
| private String couponTitle; | |||
| private Integer channelType; | |||
| @TableField(exist = false) | |||
| private List<TenantEntity> tenantEntitys; | |||
| @TableField(exist = false) | |||
| @SortColumn(column = "xTime") | |||
| private String xTime; | |||
| @@ -29,6 +29,7 @@ public class BaseTenantEntity extends BaseEntity { | |||
| public void updateTenantInfo(TenantEntity info) { | |||
| log.info("info.tenantId:"+info.getTenantId()+". info.parentTenantId:"+info.getParentTenantId()+"."); | |||
| setTenantId(info.getTenantId()); | |||
| setParentTenantId(null); | |||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||
| setParentTenantId(info.getParentTenantId()); | |||
| } | |||
| @@ -36,6 +37,7 @@ public class BaseTenantEntity extends BaseEntity { | |||
| public void updateTenantInfo(BaseTenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| setParentTenantId(null); | |||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||
| setParentTenantId(info.getParentTenantId()); | |||
| } | |||
| @@ -21,8 +21,12 @@ public class TenantEntity extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="父租户ID",name="parentTenantId") | |||
| protected String parentTenantId; | |||
| @TableField(exist = false) | |||
| protected String shardTableSuffix; | |||
| public void updateTenantInfo(TenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| setParentTenantId(null); | |||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||
| setParentTenantId(info.getParentTenantId()); | |||
| } | |||
| @@ -30,6 +34,7 @@ public class TenantEntity extends BaseEntity { | |||
| public void updateTenantInfo(BaseTenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| setParentTenantId(null); | |||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||
| setParentTenantId(info.getParentTenantId()); | |||
| } | |||
| @@ -41,6 +46,10 @@ public class TenantEntity extends BaseEntity { | |||
| } | |||
| return tenantId; | |||
| } | |||
| public String getShardTableSuffix() { | |||
| return "_" + Integer.parseInt(this.getTenantId())%100; | |||
| } | |||
| public String getTenantId() { | |||
| @@ -27,6 +27,7 @@ public class TenantVEntity extends BaseEntity { | |||
| public void updateTenantInfo(TenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| setParentTenantId(null); | |||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||
| setParentTenantId(info.getParentTenantId()); | |||
| } | |||
| @@ -34,6 +35,7 @@ public class TenantVEntity extends BaseEntity { | |||
| public void updateTenantInfo(TenantVEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| setParentTenantId(null); | |||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||
| setParentTenantId(info.getParentTenantId()); | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.MarkingSceneDataReportTVo; | |||
| import com.iformall.domain.vo.MarkingSceneDataReportVo; | |||
| import com.iformall.domain.vo.MarkingSceneDataVo; | |||
| @@ -26,18 +27,20 @@ public interface WxCouponActionLogMapper extends CommonMapper<WxCouponActionLog, | |||
| List<MarkingSceneDataReportVo> sceneDataMapJoinCouponOrder(HashMap<String,Object> params); | |||
| List<MarkingSceneDataVo> sceneDataList(MarkingCouponDataReportDto markingCouponDataReportDto); | |||
| List<MarkingSceneDataVo> sceneDataList(@Param("markingCouponDataReportDto") MarkingCouponDataReportDto markingCouponDataReportDto); | |||
| List<MarkingSceneDataReportVo> sceneDataJoinCouponOrderList(HashMap<String,Object> params); | |||
| /** | |||
| * 查询场景投放发券数 | |||
| * @param tenantId | |||
| * @param startTime | |||
| * @param endTime | |||
| * @return | |||
| * | |||
| * @param tenantEntitys | |||
| * @param tenantId | |||
| * @param startTime | |||
| * @param endTime | |||
| * @return | |||
| */ | |||
| int getCountByDateLimit(@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); | |||
| int getCountByDateLimit(@Param("tenantEntitys") List<TenantEntity> tenantEntitys, @Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId, @Param("startTime") Date startTime, @Param("endTime") Date endTime); | |||
| int getCountByChannelId(@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId,@Param("channelType") int channelType,@Param("channelId")Long channelId); | |||
| @@ -3,6 +3,7 @@ package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxTopic; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| @@ -34,17 +35,21 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| /** | |||
| * 查询时间段内销售金额 | |||
| * @param wxCoupon | |||
| * @return | |||
| * | |||
| * @param tenantEntitys | |||
| * @param wxCoupon | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> findSaleMoneyByDate(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findSaleMoneyByDate(@Param("tenantEntitys") List<TenantEntity> tenantEntitys, @Param("wxCoupon") WxCoupon wxCoupon); | |||
| /** | |||
| * 查询时间段内核销金额 | |||
| * | |||
| * @param tenantEntitys | |||
| * @param wxCoupon | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> findPaymentByDate(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findPaymentByDate(@Param("tenantEntitys") List<TenantEntity> tenantEntitys, @Param("wxCoupon") WxCoupon wxCoupon); | |||
| Long findSaleCardCount(WxCoupon wxCoupon); | |||
| @@ -54,31 +59,31 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| //-------券-------- | |||
| List<WxCouponStatisVo> findCouponOrderCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findCouponOrderCount(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findCouponPaymentCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findCouponPaymentCount(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponSaleCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponSaleCount(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponPaymentCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponPaymentCount(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon") WxCoupon wxCoupon); | |||
| String findSumPriceSaleMoney(WxCoupon wxCoupon); | |||
| String findSumPricePayMent(WxCoupon wxCoupon); | |||
| String findSumSubsidyMoney(WxCoupon wxCoupon); | |||
| //-------砍价-------- | |||
| List<WxCouponStatisVo> pressSendHistory(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> pressSuccHistory(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> pressPaymentHistory(WxCoupon wxCoupon); | |||
| String pressSuccRate(WxCoupon wxCoupon); | |||
| Long sumJoin(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> pressSendHistory(@Param("tenantEntitys") List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> pressSuccHistory(@Param("tenantEntitys") List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> pressPaymentHistory(@Param("tenantEntitys") List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| String pressSuccRate(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| Long sumJoin(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| List<WxCoupon> findCouponByTopic(WxTopic wxTopic); | |||
| Long priceCouponCancelCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findSaleCardCountHistory(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findSaleCardCountHistory(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| // 库存,有效期修改 | |||
| int updateStockAndValidDate(WxCoupon wxCoupon); | |||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.*; | |||
| import org.apache.ibatis.annotations.Param; | |||
| @@ -62,12 +63,14 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||
| /** | |||
| * 日期分组 消费总数 | |||
| * | |||
| * @param tenantEntitys | |||
| * @param tenantId | |||
| * @param startTime | |||
| * @param endTime | |||
| * @return | |||
| */ | |||
| List<CUserDateAmountVo> queryPriceTotalGroup(@Param("tenantId")String tenantId, @Param("parentTenantId")String parentTenantId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); | |||
| List<CUserDateAmountVo> queryPriceTotalGroup(@Param("tenantEntitys") List<TenantEntity> tenantEntitys, @Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId, @Param("startTime") Date startTime, @Param("endTime") Date endTime); | |||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryVerified(HashMap<String,Object> params); | |||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| @@ -21,4 +22,6 @@ public interface WxMallMapper extends CommonMapper<WxMall, Long> { | |||
| void undateSubmall(@Param(value = "parentTenantId")String parentTenantId, @Param(value = "tenantIds")List<String> tenantIds); | |||
| List<WxMall> listAsSelectMall(@Param(value = "id")Long id); | |||
| List<TenantEntity> getTenantEntitys(TenantEntity tenantEntity); | |||
| } | |||
| @@ -4,6 +4,7 @@ import com.iformall.common.CommonMapper; | |||
| 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.WxCouponStatisVo; | |||
| import com.iformall.domain.vo.WxOrderGroupMarketing; | |||
| @@ -39,7 +40,7 @@ public interface WxOrderGroupMapper extends CommonMapper<WxOrderGroup, Long> { | |||
| long queryOrderGroupVerifyCount(Map<String, Object> params); | |||
| List<WxCouponStatisVo> queryOrderGroupCountHistory(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> queryOrderGroupCountHistory(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon); | |||
| long queryOrderGroupSuccessPeopleCount(Map<String, Object> params); | |||
| @@ -3,6 +3,7 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.dto.WxOrderReportDto; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.*; | |||
| import java.util.HashMap; | |||
| @@ -41,7 +42,7 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||
| List<WxOrderReportVo> listMicroPayOrderReportByDateAndMerchant(HashMap<String,Object> params); | |||
| List<WxMerchantMicroPayVo> findListOfMerchantMicroPayOrderByDate(WxOrderReportDto wxOrderReportDto); | |||
| List<WxMerchantMicroPayVo> findListOfMerchantMicroPayOrderByDate(@Param("wxOrderReportDto") WxOrderReportDto wxOrderReportDto, @Param("tenantEntitys")List<TenantEntity> tenantEntitys); | |||
| List<WxOrder> findListOrder(WxOrderQueryVo record); | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| @@ -76,4 +77,6 @@ public interface WxCouponChannelService { | |||
| ResultData change(WxCouponChannel wxCouponChannel); | |||
| int countCoupon(WxCouponChannel wxCouponChannel, List<TenantEntity> tenantEntitys); | |||
| } | |||
| @@ -176,7 +176,7 @@ public interface WxCouponOrderService { | |||
| * 查询消费额 | |||
| * @return | |||
| */ | |||
| int queryPriceTotal(WxCouponOrder wxCouponOrder); | |||
| int queryPriceTotal(WxCouponOrder wxCouponOrder,List<TenantEntity> tenantEntitys); | |||
| ////// ------- 卡 | |||
| @@ -215,4 +215,6 @@ public interface WxCouponOrderService { | |||
| */ | |||
| Integer shangAnVerify(Long couponOrderId,TenantEntity tenantinfo); | |||
| int findCount(WxCouponOrder wxCouponOrder,List<TenantEntity> tenantEntitys); | |||
| } | |||
| @@ -4,9 +4,9 @@ import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| public interface WxCouponService { | |||
| @@ -82,35 +82,39 @@ public interface WxCouponService { | |||
| /** | |||
| * 查询时间段内销售金额 | |||
| * | |||
| * @param tenantEntitys | |||
| * @param wxCoupon | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> findSaleMoneyByDate(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findSaleMoneyByDate(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 查询时间段内核销金额 | |||
| * | |||
| * @param tenantEntitys | |||
| * @param wxCoupon | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> findPaymentByDate(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findPaymentByDate(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 查询售出卡数量 | |||
| * @return | |||
| */ | |||
| Long findSaleCardCount(WxCoupon wxCoupon); | |||
| Long findSaleCardCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 查询转增数量 | |||
| * @return | |||
| */ | |||
| Long findTranCardCount(WxCoupon wxCoupon); | |||
| Long findTranCardCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 查询补贴金额 | |||
| * @return | |||
| */ | |||
| String findSubsidyMoney(WxCoupon wxCoupon); | |||
| String findSubsidyMoney(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| //----------------券-------------- | |||
| /** | |||
| @@ -123,7 +127,7 @@ public interface WxCouponService { | |||
| * 券购买数量 | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> findCouponOrderCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findCouponOrderCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 券领取数量 | |||
| @@ -135,62 +139,64 @@ public interface WxCouponService { | |||
| * 券核销数量 | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> findCouponPaymentCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findCouponPaymentCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 有价券销售数量 | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> priceCouponSaleCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponSaleCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 有价券核销数量 | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> priceCouponPaymentCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponPaymentCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 有价券退款数量 | |||
| * @return | |||
| */ | |||
| Long priceCouponCancelCount(WxCoupon wxCoupon); | |||
| Long priceCouponCancelCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 有价券销售总额 | |||
| * | |||
| * @param tenantEntitys | |||
| * @param wxCoupon | |||
| * @return | |||
| */ | |||
| String findSumPriceSaleMoney(WxCoupon wxCoupon); | |||
| String findSumPricePayMent(WxCoupon wxCoupon); | |||
| String findSumSubsidyMoney(WxCoupon wxCoupon); | |||
| String findSumPriceSaleMoney(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| String findSumPricePayMent(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| String findSumSubsidyMoney(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 砍价发起次数走势 | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> pressSendHistory(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> pressSendHistory(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 砍价成功次数走势 | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> pressSuccHistory(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> pressSuccHistory(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 砍价核销数量走势 | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> pressPaymentHistory(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> pressPaymentHistory(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 砍价转化率 | |||
| * @return | |||
| */ | |||
| String pressSuccRate(WxCoupon wxCoupon); | |||
| String pressSuccRate(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 砍价参与人数 | |||
| * @return | |||
| */ | |||
| Long sumJoin(WxCoupon wxCoupon); | |||
| Long sumJoin(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| @@ -198,7 +204,7 @@ public interface WxCouponService { | |||
| * 查询售出卡数量历史 | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> findSaleCardCountHistory(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findSaleCardCountHistory(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon); | |||
| /** | |||
| * 增加库存及修改有效时间 | |||
| @@ -231,4 +237,5 @@ public interface WxCouponService { | |||
| * @return | |||
| */ | |||
| ResultData cardDefer(Long id,String tenantId,Date validEndDate); | |||
| } | |||
| @@ -83,4 +83,5 @@ public interface WxMallService { | |||
| List<WxMall> listAsSelectMall(Long id); | |||
| List<TenantEntity> getTenantEntitys(TenantEntity tenantEntity); | |||
| } | |||
| @@ -12,6 +12,8 @@ import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.DataTowerService; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| import com.iformall.service.WxCouponOrderService; | |||
| import com.iformall.sms.wiwide.WiwideUtil; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -73,6 +75,15 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| @Autowired | |||
| StringRedisTemplate stringRedisTemplate; | |||
| @Autowired | |||
| private WxMallMapper wxMallMapper; | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| //出租与未出租*********************************************** | |||
| private Map<String, Object> shopRunning(TenantEntity tenantEntity) { | |||
| @@ -181,7 +192,9 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| //今日车流量*********************************************** | |||
| private Map<String, Object> carRunning(TenantEntity tenantEntity) { | |||
| HashMap<String, Object> carMap = new HashMap<>(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> paramsCar = new HashMap<>(); | |||
| paramsCar.put("tenantEntitys",tenantEntitys); | |||
| paramsCar.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| paramsCar.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -255,19 +268,20 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| cal.add(Calendar.DAY_OF_YEAR, 1); | |||
| Date endTime = cal.getTime(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| //wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| wxCouponOrder.setStartTime(startTime); | |||
| wxCouponOrder.setEndTime(endTime); | |||
| long orderedCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||
| long orderedCount = wxCouponOrderService.findCount(wxCouponOrder,tenantEntitys); | |||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); | |||
| long verifiedCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||
| long verifiedCount = wxCouponOrderService.findCount(wxCouponOrder,tenantEntitys); | |||
| couponMap.put("verifiedCount", verifiedCount); | |||
| couponMap.put("orderedCount", orderedCount); | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| wxCouponChannel.updateTenantInfo(tenantEntity); | |||
| // wxCouponChannel.updateTenantInfo(tenantEntity); | |||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| long couponCount = wxCouponChannelMapper.countCoupon(wxCouponChannel); | |||
| long couponCount = wxCouponChannelService.countCoupon(wxCouponChannel,tenantEntitys); | |||
| couponMap.put("couponCount", couponCount); | |||
| return couponMap; | |||
| @@ -494,7 +508,10 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| @Override | |||
| public Map<String, Object> queryCar(TenantEntity tenantEntity) { | |||
| logger.info("停车-月统计-开始"); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -532,6 +549,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| // 查询近一周的缴费车辆----start------ | |||
| logger.info("停车-查询近一周的缴费车辆-开始"); | |||
| HashMap<String, Object> weekParams = new HashMap<>(); | |||
| weekParams.put("tenantEntitys",tenantEntitys); | |||
| weekParams.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| weekParams.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -848,6 +866,4 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| return timemap; | |||
| } | |||
| } | |||
| @@ -15,6 +15,7 @@ import com.iformall.enums.EnumOrderType; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.MarkingDataReportService; | |||
| import com.iformall.service.WxCouponOrderService; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -49,8 +50,13 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| private WxCouponMapper wxCouponMapper; | |||
| @Autowired | |||
| private WxOrderMapper wxOrderMapper; | |||
| @Autowired | |||
| private WxMallMapper wxMallMapper; | |||
| @Autowired | |||
| private ExcelService excelService; | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| private Date addDay(int addDayAmount) { | |||
| Calendar c = Calendar.getInstance(); | |||
| @@ -79,19 +85,20 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| //取的当月券数据 | |||
| @Override | |||
| public Map<String, Object> getCouponData(TenantEntity tenantEntity) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| //今日领取券数 | |||
| //查询coupon order表 | |||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| wxCouponOrder.setStartTime(addDay(0)); | |||
| wxCouponOrder.setEndTime(addDay(1)); | |||
| int todayCouponCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||
| int todayCouponCount = wxCouponOrderService.findCount(wxCouponOrder,tenantEntitys); | |||
| wxCouponOrder.setStartTime(addDay(-1)); | |||
| wxCouponOrder.setEndTime(addDay(0)); | |||
| int yesterdayCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||
| int yesterdayCount = wxCouponOrderService.findCount(wxCouponOrder,tenantEntitys); | |||
| wxCouponOrder.setStartTime(addDay(-7)); | |||
| wxCouponOrder.setEndTime(addDay(-6)); | |||
| int lastWeekCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||
| int lastWeekCount = wxCouponOrderService.findCount(wxCouponOrder,tenantEntitys); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | |||
| @@ -106,6 +113,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| //couponData | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -148,10 +156,11 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| @Override | |||
| public Map<String, Object> getSceneData(TenantEntity tenantEntity) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| //今日营销投放券数 | |||
| int todaySceneCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(0), addDay(1)); | |||
| int yesterdayCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(-1), addDay(0)); | |||
| int lastWeekCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(-7), addDay(-6)); | |||
| int todaySceneCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntitys, tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(0), addDay(1)); | |||
| int yesterdayCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntitys, tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(-1), addDay(0)); | |||
| int lastWeekCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntitys, tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(-7), addDay(-6)); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | |||
| @@ -165,18 +174,24 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| } | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantEntitys", tenantEntitys); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| } | |||
| // if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| // params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| // } | |||
| params.put("startTime", addDay(-30)); | |||
| params.put("endTime", addDay(1)); | |||
| //停车发券数 停车发券被核销数 核销发券数 核销发券被核销数 | |||
| wxCouponActionLogMapper.updateCreateTimeMd(params); | |||
| for (TenantEntity t:tenantEntitys) { | |||
| params.put("tenantId", t.getTenantId()); | |||
| wxCouponActionLogMapper.updateCreateTimeMd(params); | |||
| } | |||
| List<MarkingSceneDataReportTVo> sceneList = wxCouponActionLogMapper.getSceneDataMap(params); | |||
| //停车发券被核销数 | |||
| HashMap<String, Object> params1 = new HashMap<>(); | |||
| params1.put("tenantEntitys", tenantEntitys); | |||
| params1.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params1.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -189,6 +204,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| //核销发券被核销数 | |||
| HashMap<String, Object> params2 = new HashMap<>(); | |||
| params2.put("tenantEntitys", tenantEntitys); | |||
| params2.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params2.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -201,6 +217,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| // B端刷卡支付被核销数 | |||
| HashMap<String, Object> params3 = new HashMap<>(); | |||
| params3.put("tenantEntitys", tenantEntitys); | |||
| params3.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params3.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -213,6 +230,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| // 购买发券被核销数 | |||
| HashMap<String, Object> params4 = new HashMap<>(); | |||
| params4.put("tenantEntitys", tenantEntitys); | |||
| params4.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params4.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -323,7 +341,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| @Override | |||
| public PageInfo<MarkingSceneDataVo> getSceneDataList(TenantEntity tenantEntity, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| MarkingCouponDataReportDto queryDto = new MarkingCouponDataReportDto(); | |||
| queryDto.setTenantEntitys(tenantEntitys); | |||
| org.springframework.beans.BeanUtils.copyProperties(markingCouponDataReportDto, queryDto); | |||
| queryDto.updateTenantInfo(tenantEntity); | |||
| @@ -491,8 +511,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| @Override | |||
| public Map<String, Object> getSceneDataHistory(TenantEntity tenantEntity, String startDate, String endDate) { | |||
| Map<String ,Object> result = new HashedMap(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| MarkingCouponDataReportDto markingCouponDataReportDto = new MarkingCouponDataReportDto(); | |||
| markingCouponDataReportDto.setTenantEntitys(tenantEntitys); | |||
| markingCouponDataReportDto.updateTenantInfo(tenantEntity); | |||
| Date starttime = DateUtils.stringToDate(startDate); | |||
| @@ -578,8 +600,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| @Override | |||
| public Map<String, Object> listOrderReportByDate(WxOrderReportDto wxOrderReportDto) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(wxOrderReportDto); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantId", wxOrderReportDto.getTenantId()); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| // params.put("tenantId", wxOrderReportDto.getTenantId()); | |||
| if (wxOrderReportDto.getStartTime() != null) { | |||
| params.put("startTime", convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | |||
| } else { | |||
| @@ -702,6 +726,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| @Override | |||
| public PageInfo<WxMerchantMicroPayVo> listMerchantMicroPayOrderReportByDate(WxOrderReportDto wxOrderReportDto,Integer pageIndex, Integer pageSize) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(wxOrderReportDto); | |||
| if (wxOrderReportDto.getStartTime() != null) { | |||
| wxOrderReportDto.setStartTime(convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | |||
| } else { | |||
| @@ -713,7 +738,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| wxOrderReportDto.setEndTime(addDay(0)); | |||
| } | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<WxMerchantMicroPayVo> list = wxOrderMapper.findListOfMerchantMicroPayOrderByDate(wxOrderReportDto); | |||
| List<WxMerchantMicroPayVo> list = wxOrderMapper.findListOfMerchantMicroPayOrderByDate(wxOrderReportDto,tenantEntitys); | |||
| return new PageInfo<>(list); | |||
| } | |||
| @@ -40,6 +40,8 @@ import java.util.stream.Collectors; | |||
| public class WxChartServiceImpl implements WxChartDataService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMallMapper wxMallMapper; | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @Autowired | |||
| @@ -85,6 +87,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| @Autowired | |||
| WxBusinessService wxBusinessService; | |||
| @Autowired | |||
| WxCouponOrderService wxCouponOrderService; | |||
| @Autowired | |||
| KwMeterDataService kwMeterDataService; | |||
| @Autowired | |||
| @@ -302,12 +306,12 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| } | |||
| //卡营销数据 | |||
| if (chart.equals(EnumChart.SALE_CARD.getCode())) { | |||
| return getSaleCardAnalysis(paramsMap, startdate, enddate); | |||
| return getSaleCardAnalysis(tenantEntity,paramsMap, startdate, enddate); | |||
| } | |||
| //券营销数据 | |||
| if (chart.equals(EnumChart.SALE_COUPON.getCode())) { | |||
| return getSaleCouponAnalysis(paramsMap, startdate, enddate); | |||
| return getSaleCouponAnalysis(tenantEntity,paramsMap, startdate, enddate); | |||
| } | |||
| //砍价营销数据 | |||
| @@ -793,11 +797,14 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| * @return | |||
| */ | |||
| private ResultData getCarDataCurrent(TenantEntity tenantEntity) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| String systemTime = DateUtils.getSystemTime("yyyy-MM-dd"); | |||
| String yesterday = DateUtils.getTimeBefore(1, new Date()); | |||
| String lastweek = DateUtils.getTimeBefore(7, new Date()); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -869,7 +876,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| private ResultData getCarHistoryAndTodayAndHB(TenantEntity tenantEntity, boolean withOthers ) { | |||
| String startdate; | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -946,7 +955,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| */ | |||
| private ResultData getCarPayCarCountInWeek(TenantEntity tenantEntity) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> weekParams = new HashMap<>(); | |||
| weekParams.put("tenantEntitys", tenantEntitys); | |||
| weekParams.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| weekParams.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -967,7 +978,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| */ | |||
| private ResultData getCarPayCountInWeek(TenantEntity tenantEntity) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> weekParams = new HashMap<>(); | |||
| weekParams.put("tenantEntitys",tenantEntitys); | |||
| weekParams.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| weekParams.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -1115,19 +1128,20 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| */ | |||
| private ResultData getTodayCouponCount(TenantEntity tenantEntity) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| //今日领取券数 | |||
| //查询coupon order表 | |||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| // wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| wxCouponOrder.setStartTime(addDay(0)); | |||
| wxCouponOrder.setEndTime(addDay(1)); | |||
| int todayCouponCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||
| int todayCouponCount = wxCouponOrderService.findCount(wxCouponOrder,tenantEntitys); | |||
| wxCouponOrder.setStartTime(addDay(-1)); | |||
| wxCouponOrder.setEndTime( addDay(0)); | |||
| int yesterdayCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||
| int yesterdayCount = wxCouponOrderService.findCount(wxCouponOrder,tenantEntitys); | |||
| wxCouponOrder.setStartTime(addDay(-7)); | |||
| wxCouponOrder.setEndTime( addDay(-6)); | |||
| int lastWeekCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||
| int lastWeekCount = wxCouponOrderService.findCount(wxCouponOrder,tenantEntitys); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | |||
| String couponUpDay = "--"; | |||
| @@ -1151,9 +1165,10 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| */ | |||
| private ResultData getSaleSceneCount(TenantEntity tenantEntity) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| int todaySceneCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(0), addDay(1)); | |||
| int yesterdayCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(-1), addDay(0)); | |||
| int lastWeekCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(-7), addDay(-6)); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| int todaySceneCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntitys,tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(0), addDay(1)); | |||
| int yesterdayCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntitys,tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(-1), addDay(0)); | |||
| int lastWeekCount = wxCouponActionLogMapper.getCountByDateLimit(tenantEntitys,tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), addDay(-7), addDay(-6)); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | |||
| String sceneDownDay = "--"; | |||
| @@ -1219,8 +1234,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| String startdate; | |||
| String enddate; | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantEntitys", tenantEntitys); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -1232,6 +1248,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| //停车发券被核销数 | |||
| HashMap<String, Object> params1 = new HashMap<>(); | |||
| params1.put("tenantEntitys", tenantEntitys); | |||
| params1.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params1.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -1244,6 +1261,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| //核销发券被核销数 | |||
| HashMap<String, Object> params2 = new HashMap<>(); | |||
| params2.put("tenantEntitys", tenantEntitys); | |||
| params2.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params2.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -1256,6 +1274,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| // B端刷卡支付被核销数 | |||
| HashMap<String, Object> params3 = new HashMap<>(); | |||
| params3.put("tenantEntitys", tenantEntitys); | |||
| params3.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params3.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -1268,6 +1287,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| // 购买发券被核销数 | |||
| HashMap<String, Object> params4 = new HashMap<>(); | |||
| params4.put("tenantEntitys", tenantEntitys); | |||
| params4.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params4.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -1395,11 +1415,12 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| Date endTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||
| Date startTime = c.getTime(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||
| wxCouponOrder.setStartTime(startTime); | |||
| wxCouponOrder.setEndTime(endTime); | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| int thisMonthCount = wxCouponOrderMapper.queryPriceTotal(wxCouponOrder);//月消费金额 | |||
| // wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys);//月消费金额 | |||
| c.clear(); | |||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| @@ -1408,8 +1429,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| startTime = c.getTime(); | |||
| wxCouponOrder.setStartTime(startTime); | |||
| wxCouponOrder.setEndTime(endTime); | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| int todayCount = wxCouponOrderMapper.queryPriceTotal(wxCouponOrder);//月消费金额 | |||
| // wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| int todayCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys);//月消费金额 | |||
| DecimalFormat df = new DecimalFormat("0.00"); | |||
| datamap.put("todayCount", df.format((float) todayCount / 100));//今日消费金额 | |||
| String thisMonthCountStr = df.format((float) thisMonthCount / 100); | |||
| @@ -1520,7 +1541,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| Date eTime = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, -7); | |||
| Date sTime = c.getTime(); | |||
| List<CUserDateAmountVo> datas = wxCouponOrderMapper.queryPriceTotalGroup(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), sTime, eTime); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| List<CUserDateAmountVo> datas = wxCouponOrderMapper.queryPriceTotalGroup(tenantEntitys, tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), sTime, eTime); | |||
| Map<String, Integer> dataMap = new HashMap<>(); | |||
| for (CUserDateAmountVo v : datas) { | |||
| dataMap.put(v.getXTime(), v.getPrice()); | |||
| @@ -1561,7 +1583,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| c.set(Calendar.SECOND, 0); | |||
| Date eTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| List<CUserDateAmountVo> datas = wxCouponOrderMapper.queryPriceTotalGroup(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), sTime, eTime); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| List<CUserDateAmountVo> datas = wxCouponOrderMapper.queryPriceTotalGroup(tenantEntitys,tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), sTime, eTime); | |||
| List<UserStructureVo> monthVos = new ArrayList<>();//周消费金额 | |||
| Map<String, Integer> dataMap = new HashMap<>(); | |||
| for (CUserDateAmountVo v : datas) { | |||
| @@ -1699,7 +1722,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| Date eTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| Date sTime = c.getTime(); | |||
| List<CUserDateAmountVo> datas = wxCouponOrderMapper.queryPriceTotalGroup(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), sTime, eTime); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| List<CUserDateAmountVo> datas = wxCouponOrderMapper.queryPriceTotalGroup(tenantEntitys, tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), sTime, eTime); | |||
| Map<String, Integer> dataMap = new HashMap<>(); | |||
| for (CUserDateAmountVo v : datas) { | |||
| dataMap.put(v.getXTime(), v.getPrice()); | |||
| @@ -1834,8 +1858,10 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| String startdate; | |||
| String enddate; | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| //couponData | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("tenantId", tenantEntity.getParentTenantId()); | |||
| @@ -2263,7 +2289,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| * @param enddate | |||
| * @return | |||
| */ | |||
| private ResultData getSaleCardAnalysis(Map<String, String> paramsMap, String startdate, String enddate) { | |||
| private ResultData getSaleCardAnalysis(TenantEntity tenantEntity,Map<String, String> paramsMap, String startdate, String enddate) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| WxCoupon wxCoupon = new WxCoupon(); | |||
| //默认时间本月第一天,截止到当天 | |||
| @@ -2281,8 +2308,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| } | |||
| Map<String,Object> result = new HashedMap(); | |||
| List<WxCouponStatisVo> saleMoneyList = wxCouponService.findSaleMoneyByDate(wxCoupon); | |||
| List<WxCouponStatisVo> paymentList = wxCouponService.findPaymentByDate(wxCoupon); | |||
| List<WxCouponStatisVo> saleMoneyList = wxCouponService.findSaleMoneyByDate(tenantEntitys,wxCoupon); | |||
| List<WxCouponStatisVo> paymentList = wxCouponService.findPaymentByDate(tenantEntitys,wxCoupon); | |||
| Map<String,String> saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> payMentMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| @@ -2294,20 +2321,23 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| } | |||
| result.put("saleHistory",saleMap); | |||
| result.put("paymentHistory",payMentMap); | |||
| result.put("saleCardCount",wxCouponService.findSaleCardCount(wxCoupon)); | |||
| result.put("tranCount",wxCouponService.findTranCardCount(wxCoupon)); | |||
| result.put("subsidyCount",wxCouponService.findSubsidyMoney(wxCoupon)); | |||
| result.put("saleCardCount",wxCouponService.findSaleCardCount(tenantEntitys,wxCoupon)); | |||
| result.put("tranCount",wxCouponService.findTranCardCount(tenantEntitys,wxCoupon)); | |||
| result.put("subsidyCount",wxCouponService.findSubsidyMoney(tenantEntitys,wxCoupon)); | |||
| return new ResultData(result); | |||
| } | |||
| /** | |||
| * 券营销数据 | |||
| * | |||
| * @param tenantEntity | |||
| * @param paramsMap | |||
| * @param startdate | |||
| * @param enddate | |||
| * @return | |||
| */ | |||
| private ResultData getSaleCouponAnalysis(Map<String, String> paramsMap, String startdate, String enddate) { | |||
| private ResultData getSaleCouponAnalysis(TenantEntity tenantEntity, Map<String, String> paramsMap, String startdate, String enddate) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| WxCoupon wxCoupon = new WxCoupon(); | |||
| Map<String,Object> result = new HashedMap(); | |||
| @@ -2324,11 +2354,11 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| Date endTime = DateUtils.stringToDate(enddate, "yyyy-MM-dd HH:mm:ss"); | |||
| wxCoupon.setEnddate(endTime); | |||
| } | |||
| List<WxCouponStatisVo> orderCountList = wxCouponService.findCouponOrderCount(wxCoupon); | |||
| List<WxCouponStatisVo> paymentCountList = wxCouponService.findCouponPaymentCount(wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponSaleCountList = wxCouponService.priceCouponSaleCount(wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponPaymentCountList = wxCouponService.priceCouponPaymentCount(wxCoupon); | |||
| Long priceCouponCancelCount = wxCouponService.priceCouponCancelCount(wxCoupon); | |||
| List<WxCouponStatisVo> orderCountList = wxCouponService.findCouponOrderCount(tenantEntitys,wxCoupon); | |||
| List<WxCouponStatisVo> paymentCountList = wxCouponService.findCouponPaymentCount(tenantEntitys,wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponSaleCountList = wxCouponService.priceCouponSaleCount(tenantEntitys,wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponPaymentCountList = wxCouponService.priceCouponPaymentCount(tenantEntitys,wxCoupon); | |||
| Long priceCouponCancelCount = wxCouponService.priceCouponCancelCount(tenantEntitys,wxCoupon); | |||
| Map<String,String> orderCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> paymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| @@ -2351,9 +2381,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| result.put("paymentCountList",paymentCountMap); | |||
| result.put("priceCouponSaleCountList",priceCouponSaleCountMap); | |||
| result.put("priceCouponPaymentCountList",priceCouponPaymentCountMap); | |||
| result.put("sumPriceSaleMoney",wxCouponService.findSumPriceSaleMoney(wxCoupon)); | |||
| result.put("sumPricePayMent",wxCouponService.findSumPricePayMent(wxCoupon)); | |||
| result.put("sumSubsidyMoney",wxCouponService.findSumSubsidyMoney(wxCoupon)); | |||
| result.put("sumPriceSaleMoney",wxCouponService.findSumPriceSaleMoney(tenantEntitys,wxCoupon)); | |||
| result.put("sumPricePayMent",wxCouponService.findSumPricePayMent(tenantEntitys,wxCoupon)); | |||
| result.put("sumSubsidyMoney",wxCouponService.findSumSubsidyMoney(tenantEntitys,wxCoupon)); | |||
| result.put("priceCouponCancelCount",priceCouponCancelCount);//有价券退款数量 | |||
| //有价券售出数量 | |||
| @@ -2374,6 +2404,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| * @return | |||
| */ | |||
| private ResultData getSalePressAnalysis(Map<String, String> paramsMap, TenantEntity tenantEntity, String startdate, String enddate) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| WxCoupon wxCoupon = new WxCoupon(); | |||
| Map<String,Object> result = new HashedMap(); | |||
| @@ -2390,9 +2421,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| Date endTime = DateUtils.stringToDate(enddate, "yyyy-MM-dd HH:mm:ss"); | |||
| wxCoupon.setEnddate(endTime); | |||
| } | |||
| List<WxCouponStatisVo> pressSendHistory = wxCouponService.pressSendHistory(wxCoupon); | |||
| List<WxCouponStatisVo> pressSuccHistory = wxCouponService.pressSuccHistory(wxCoupon); | |||
| List<WxCouponStatisVo> pressPaymentHistory = wxCouponService.pressPaymentHistory(wxCoupon); | |||
| List<WxCouponStatisVo> pressSendHistory = wxCouponService.pressSendHistory(tenantEntitys,wxCoupon); | |||
| List<WxCouponStatisVo> pressSuccHistory = wxCouponService.pressSuccHistory(tenantEntitys,wxCoupon); | |||
| List<WxCouponStatisVo> pressPaymentHistory = wxCouponService.pressPaymentHistory(tenantEntitys,wxCoupon); | |||
| Map<String,String> pressSendHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> pressSuccHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| @@ -2417,8 +2448,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| result.put("pressSuccHistoryCount",getTotal(pressSuccHistoryMap)); | |||
| result.put("pressPaymentHistoryCount",getTotal(pressPaymentHistoryMap)); | |||
| result.put("pressSuccRate",wxCouponService.pressSuccRate(wxCoupon)); | |||
| result.put("sumJoin",wxCouponService.sumJoin(wxCoupon)); | |||
| result.put("pressSuccRate",wxCouponService.pressSuccRate(tenantEntitys,wxCoupon)); | |||
| result.put("sumJoin",wxCouponService.sumJoin(tenantEntitys,wxCoupon)); | |||
| return new ResultData(result); | |||
| } | |||
| @@ -2438,7 +2469,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| * @return | |||
| */ | |||
| private ResultData getSaleGroupAnalysis(Map<String, String> paramsMap, TenantEntity tenantEntity, String startdate) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| Map<String, Object> params = new HashMap<>(); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -2931,6 +2964,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| * @return | |||
| */ | |||
| private ResultData getSaleDataHistory(TenantEntity tenantEntity, String startdate,String enddate) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| Date startDate = DateUtils.getDateFromString(startdate,"yyyy-MM-dd HH:mm:ss").getTime(); | |||
| Date endDate = DateUtils.getDateFromString(enddate,"yyyy-MM-dd HH:mm:ss").getTime(); | |||
| @@ -2944,7 +2978,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| couponQuery.setEnddate(endDate); | |||
| //卡数据 | |||
| List<WxCouponStatisVo> couponStatisVoList = wxCouponService.findSaleCardCountHistory(couponQuery); | |||
| List<WxCouponStatisVo> couponStatisVoList = wxCouponService.findSaleCardCountHistory(tenantEntitys,couponQuery); | |||
| countMap = couponStatisVoList.stream().collect(Collectors.toMap(WxCouponStatisVo::getXtime, p -> Integer.parseInt(p.getXcount()))); | |||
| historyMap = new TreeMap<>(); | |||
| for (String date:days) { | |||
| @@ -2957,7 +2991,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| datamap.put("cardHistory",historyMap); | |||
| //砍价数据 | |||
| List<WxCouponStatisVo> wxCouponStatisVoList = wxCouponService.pressSendHistory(couponQuery); | |||
| List<WxCouponStatisVo> wxCouponStatisVoList = wxCouponService.pressSendHistory(tenantEntitys,couponQuery); | |||
| Map<String,String> countHistoryMap = getDateMap(startDate,endDate); | |||
| for (WxCouponStatisVo coupon:wxCouponStatisVoList){ | |||
| countHistoryMap.put(coupon.getXtime(),coupon.getXcount()); | |||
| @@ -2965,7 +2999,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| datamap.put("pressSendHistory",countHistoryMap); | |||
| //拼团 | |||
| wxCouponStatisVoList = wxOrderGroupMapper.queryOrderGroupCountHistory(couponQuery); | |||
| wxCouponStatisVoList = wxOrderGroupMapper.queryOrderGroupCountHistory(tenantEntitys,couponQuery); | |||
| countHistoryMap = getDateMap(startDate,endDate); | |||
| for (WxCouponStatisVo coupon:wxCouponStatisVoList){ | |||
| countHistoryMap.put(coupon.getXtime(),coupon.getXcount()); | |||
| @@ -2973,7 +3007,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| datamap.put("groupHistory",countHistoryMap); | |||
| //券数据 | |||
| wxCouponStatisVoList = wxCouponService.findCouponOrderCount(couponQuery); | |||
| wxCouponStatisVoList = wxCouponService.findCouponOrderCount(tenantEntitys, couponQuery); | |||
| countHistoryMap = getDateMap(startDate,endDate); | |||
| for (WxCouponStatisVo coupon:wxCouponStatisVoList){ | |||
| countHistoryMap.put(coupon.getXtime(),coupon.getXcount()); | |||
| @@ -200,6 +200,17 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| return new ResultData(Result.SUCCESS, "查询成功", data); | |||
| } | |||
| @Override | |||
| public int countCoupon(WxCouponChannel wxCouponChannel, List<TenantEntity> tenantEntitys) { | |||
| int count = 0; | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCouponChannel.updateTenantInfo(tenantEntity); | |||
| int count1 = wxCouponChannelMapper.countCoupon(wxCouponChannel); | |||
| count += count1; | |||
| } | |||
| return count; | |||
| } | |||
| private boolean isCouponMerchantValid(Long couponId,String tenantId) { | |||
| List<WxMerchantVo> merchantVoList = wxCouponMerchantMapper.findMerchantNameList(couponId,tenantId); | |||
| if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){ | |||
| @@ -1019,12 +1019,19 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| @Override | |||
| public List<CUserDateAmountVo> queryPriceTotalGroup(TenantEntity tenantEntity, Date startTime, Date endTime) { | |||
| return wxCouponOrderMapper.queryPriceTotalGroup(tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), startTime, endTime); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| return wxCouponOrderMapper.queryPriceTotalGroup(tenantEntitys, tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), startTime, endTime); | |||
| } | |||
| @Override | |||
| public int queryPriceTotal(WxCouponOrder wxCouponOrder) { | |||
| return wxCouponOrderMapper.queryPriceTotal(wxCouponOrder); | |||
| public int queryPriceTotal(WxCouponOrder wxCouponOrder,List<TenantEntity> tenantEntitys) { | |||
| int count = 0; | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| int i = wxCouponOrderMapper.queryPriceTotal(wxCouponOrder); | |||
| count += i; | |||
| } | |||
| return count; | |||
| } | |||
| @@ -1481,4 +1488,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| return 0; | |||
| } | |||
| public int findCount(WxCouponOrder wxCouponOrder,List<TenantEntity> tenantEntitys){ | |||
| int count = 0; | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| int count1 = wxCouponOrderMapper.findCount(wxCouponOrder); | |||
| count += count1; | |||
| } | |||
| return count; | |||
| } | |||
| } | |||
| @@ -497,31 +497,48 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> findSaleMoneyByDate(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findSaleMoneyByDate(wxCoupon); | |||
| public List<WxCouponStatisVo> findSaleMoneyByDate(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findSaleMoneyByDate(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> findPaymentByDate(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findPaymentByDate(wxCoupon); | |||
| public List<WxCouponStatisVo> findPaymentByDate(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findPaymentByDate(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| public Long findSaleCardCount(WxCoupon wxCoupon) { | |||
| Long count = wxCouponMapper.findSaleCardCount(wxCoupon); | |||
| return (count==null)?0l:count; | |||
| public Long findSaleCardCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| long count = 0l; | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCoupon.updateTenantInfo(tenantEntity); | |||
| long saleCardCount = wxCouponMapper.findSaleCardCount(wxCoupon).longValue(); | |||
| count += saleCardCount; | |||
| } | |||
| return count; | |||
| } | |||
| @Override | |||
| public Long findTranCardCount(WxCoupon wxCoupon) { | |||
| Long count = wxCouponMapper.findTranCardCount(wxCoupon); | |||
| return (count==null)?0l:count; | |||
| public Long findTranCardCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| long count = 0l; | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCoupon.updateTenantInfo(tenantEntity); | |||
| long saleCardCount = wxCouponMapper.findTranCardCount(wxCoupon).longValue(); | |||
| count += saleCardCount; | |||
| } | |||
| return count; | |||
| } | |||
| @Override | |||
| public String findSubsidyMoney(WxCoupon wxCoupon) { | |||
| String count = wxCouponMapper.findSubsidyMoney(wxCoupon); | |||
| return (count==null)?"0":count; | |||
| public String findSubsidyMoney(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| BigDecimal a = new BigDecimal("0"); | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCoupon.updateTenantInfo(tenantEntity); | |||
| String subsidyMoney = wxCouponMapper.findSubsidyMoney(wxCoupon); | |||
| if(StringUtils.isNotBlank(subsidyMoney)){ | |||
| a = a.add(new BigDecimal(subsidyMoney)); | |||
| } | |||
| } | |||
| return a.toPlainString(); | |||
| } | |||
| @Override | |||
| @@ -530,42 +547,65 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> findCouponOrderCount(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findCouponOrderCount(wxCoupon); | |||
| public List<WxCouponStatisVo> findCouponOrderCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findCouponOrderCount(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> findCouponPaymentCount(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findCouponPaymentCount(wxCoupon); | |||
| public List<WxCouponStatisVo> findCouponPaymentCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findCouponPaymentCount(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> priceCouponSaleCount(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.priceCouponSaleCount(wxCoupon); | |||
| public List<WxCouponStatisVo> priceCouponSaleCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.priceCouponSaleCount(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> priceCouponPaymentCount(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.priceCouponPaymentCount(wxCoupon); | |||
| public List<WxCouponStatisVo> priceCouponPaymentCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.priceCouponPaymentCount(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| public String findSumPriceSaleMoney(WxCoupon wxCoupon) { | |||
| String count = wxCouponMapper.findSumPriceSaleMoney(wxCoupon); | |||
| return (count==null)?"0":count; | |||
| public String findSumPriceSaleMoney(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| BigDecimal a = new BigDecimal("0"); | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCoupon.updateTenantInfo(tenantEntity); | |||
| String subsidyMoney = wxCouponMapper.findSumPriceSaleMoney(wxCoupon); | |||
| if(StringUtils.isNotBlank(subsidyMoney)){ | |||
| a = a.add(new BigDecimal(subsidyMoney)); | |||
| } | |||
| } | |||
| return a.toPlainString(); | |||
| } | |||
| @Override | |||
| public String findSumPricePayMent(WxCoupon wxCoupon) { | |||
| String count = wxCouponMapper.findSumPricePayMent(wxCoupon); | |||
| return (count==null)?"0":count; | |||
| public String findSumPricePayMent(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| BigDecimal a = new BigDecimal("0"); | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCoupon.updateTenantInfo(tenantEntity); | |||
| String subsidyMoney = wxCouponMapper.findSumPricePayMent(wxCoupon); | |||
| if(StringUtils.isNotBlank(subsidyMoney)){ | |||
| a = a.add(new BigDecimal(subsidyMoney)); | |||
| } | |||
| } | |||
| return a.toPlainString(); | |||
| } | |||
| @Override | |||
| public String findSumSubsidyMoney(WxCoupon wxCoupon) { | |||
| String count = wxCouponMapper.findSumSubsidyMoney(wxCoupon); | |||
| return (count==null)?"0":count; | |||
| public String findSumSubsidyMoney(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| BigDecimal a = new BigDecimal("0"); | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCoupon.updateTenantInfo(tenantEntity); | |||
| String subsidyMoney = wxCouponMapper.findSumSubsidyMoney(wxCoupon); | |||
| if(StringUtils.isNotBlank(subsidyMoney)){ | |||
| a = a.add(new BigDecimal(subsidyMoney)); | |||
| } | |||
| } | |||
| return a.toPlainString(); | |||
| } | |||
| @Override | |||
| @@ -574,23 +614,23 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> pressSendHistory(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.pressSendHistory(wxCoupon); | |||
| public List<WxCouponStatisVo> pressSendHistory(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.pressSendHistory(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> pressSuccHistory(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.pressSuccHistory(wxCoupon); | |||
| public List<WxCouponStatisVo> pressSuccHistory(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.pressSuccHistory(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> pressPaymentHistory(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.pressPaymentHistory(wxCoupon); | |||
| public List<WxCouponStatisVo> pressPaymentHistory(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.pressPaymentHistory(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| public String pressSuccRate(WxCoupon wxCoupon) { | |||
| String count = wxCouponMapper.pressSuccRate(wxCoupon); | |||
| public String pressSuccRate(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| String count = wxCouponMapper.pressSuccRate(tenantEntitys,wxCoupon); | |||
| if (StringUtils.isBlank(count) || "0.00".equals(count)) { | |||
| return "0%"; | |||
| } else { | |||
| @@ -599,20 +639,25 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| @Override | |||
| public Long sumJoin(WxCoupon wxCoupon) { | |||
| Long count = wxCouponMapper.sumJoin(wxCoupon); | |||
| public Long sumJoin(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| Long count = wxCouponMapper.sumJoin(tenantEntitys,wxCoupon); | |||
| return (count==null)?0l:count; | |||
| } | |||
| @Override | |||
| public Long priceCouponCancelCount(WxCoupon wxCoupon) { | |||
| Long count = wxCouponMapper.priceCouponCancelCount(wxCoupon); | |||
| return (count==null)?0l:count; | |||
| public Long priceCouponCancelCount(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| Long count = 0l; | |||
| for (TenantEntity tenantEntity:tenantEntitys) { | |||
| wxCoupon.updateTenantInfo(tenantEntity); | |||
| Long aLong = wxCouponMapper.priceCouponCancelCount(wxCoupon); | |||
| count += (aLong==null)?0l:aLong; | |||
| } | |||
| return count; | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> findSaleCardCountHistory(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findSaleCardCountHistory(wxCoupon); | |||
| public List<WxCouponStatisVo> findSaleCardCountHistory(List<TenantEntity> tenantEntitys, WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findSaleCardCountHistory(tenantEntitys,wxCoupon); | |||
| } | |||
| @Override | |||
| @@ -234,6 +234,11 @@ public class WxMallServiceImpl implements WxMallService { | |||
| return wxMallMapper.listAsSelectMall(id); | |||
| } | |||
| @Override | |||
| public List<TenantEntity> getTenantEntitys(TenantEntity tenantEntity) { | |||
| return wxMallMapper.getTenantEntitys(tenantEntity); | |||
| } | |||
| private void deleteRedis(TenantEntity tenantEntity){ | |||
| String key1 = Constant.mallinfoPrev + tenantEntity.getTenantId(); | |||
| if(mallRedisTemplate.hasKey(key1)){ | |||
| @@ -226,7 +226,7 @@ | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <if test=" null != basicInfo.sortColumns">order by ${basicInfo.sortColumns}</if> | |||
| </sql> | |||
| @@ -76,7 +76,10 @@ | |||
| <select id="queryHistory" resultType="hashmap" parameterType="hashmap"> | |||
| select count(c.id) carcount,c.create_date from ( | |||
| select id,DATE_FORMAT(create_date,'%Y-%m-%d') create_date | |||
| from wx_car_cmd_log where cmd_type=#{cmdType} | |||
| from | |||
| (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) where cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -91,7 +94,9 @@ | |||
| <select id="queryTodayCar" resultType="hashmap" parameterType="hashmap"> | |||
| select count(c.id) carcount,c.create_time from ( | |||
| select id,DATE_FORMAT(DATE_ADD(create_date,INTERVAL 1 HOUR),'%H:00') create_time | |||
| from wx_car_cmd_log where cmd_type=#{cmdType} | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) where cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -104,7 +109,9 @@ | |||
| <select id="queryWeekCarPayCount" resultType="Long" parameterType="hashmap"> | |||
| select count(id) | |||
| from wx_car_cmd_log where cmd_type=#{cmdType} | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) where cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -117,7 +124,9 @@ | |||
| <select id="queryWeekCarPay" resultType="hashmap" parameterType="hashmap"> | |||
| select sum(fee) fee,c.create_time from ( | |||
| select id,DATE_FORMAT(create_date,'%m/%d') create_time,CONVERT(JSON_EXTRACT(cmd_json,'$.fee'), Decimal(16,2)) fee | |||
| from wx_car_cmd_log where cmd_type=#{cmdType} | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) where cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -87,7 +87,9 @@ | |||
| <select id="sceneDataMap" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap"> | |||
| select DATE_FORMAT(create_time,'%m/%d') as xTime, | |||
| (select Count(*) from wx_coupon_action_log c | |||
| (select Count(*) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) c | |||
| where DATE_FORMAT(create_time,'%m/%d')=xTime | |||
| and c.channel_type=2 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -97,7 +99,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) as parkSendCount, | |||
| (select Count(*) from wx_coupon_action_log c | |||
| (select Count(*) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) c | |||
| where DATE_FORMAT(create_time,'%m/%d')=xTime | |||
| and c.channel_type=3 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -107,7 +111,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) as verifySendCount, | |||
| (select Count(*) from wx_coupon_action_log c | |||
| (select Count(*) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) c | |||
| where DATE_FORMAT(create_time,'%m/%d')=xTime | |||
| and c.channel_type=4 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -117,7 +123,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) as microPaySendCount, | |||
| (select Count(*) from wx_coupon_action_log c | |||
| (select Count(*) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) c | |||
| where DATE_FORMAT(create_time,'%m/%d')=xTime | |||
| and c.channel_type=5 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -127,7 +135,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| ) as orderSendCount | |||
| from wx_coupon_action_log | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) | |||
| where channel_type in (2,3,4,5) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -143,7 +153,9 @@ | |||
| <select id="getSceneDataMap" resultType="com.iformall.domain.vo.MarkingSceneDataReportTVo" parameterType="hashmap"> | |||
| select create_time_md as xTime, channel_type, count(create_time_md + '' + channel_type) as count | |||
| from wx_coupon_action_log | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) | |||
| where channel_type in (2,3,4,5) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -172,8 +184,12 @@ | |||
| <select id="sceneDataMapJoinCouponOrder" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap"> | |||
| select DATE_FORMAT(create_time,'%m/%d') AS xTime, | |||
| COUNT(wx_coupon_order.id) as tempCount | |||
| from wx_coupon_action_log | |||
| left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) wx_coupon_action_log | |||
| left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wx_coupon_action_log.`tenant_id` = #{tenantId} | |||
| @@ -191,7 +207,9 @@ | |||
| <select id="sceneDataList" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | |||
| select DATE_FORMAT(create_time,'%Y-%m-%d') as xtime, | |||
| Count(*) as sendCount | |||
| from wx_coupon_action_log | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) | |||
| where channel_type=#{channelType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -236,7 +254,9 @@ | |||
| <select id="getCountByDateLimit" resultType="java.lang.Integer"> | |||
| select COUNT(*) FROM wx_coupon_action_log | |||
| select COUNT(*) FROM (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) | |||
| where `channel_type` != 0 | |||
| and `channel_type` != 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -700,19 +700,23 @@ | |||
| and m.status = 1) = 0 | |||
| </update> | |||
| <select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <select id="findSaleMoneyByDate" | |||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(round(ci.sale_amount/100,2)) xcount from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon${tenantEntity.shardTableSuffix} | |||
| </foreach>) c on c.id = ci.coupon_id | |||
| where c.type = 100 | |||
| and ci.create_date between #{startdate} and #{enddate} | |||
| and ci.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| group by xtime | |||
| </select> | |||
| <select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <select id="findPaymentByDate" | |||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(wcs.create_date,'%Y-%m-%d') xtime,sum(round(wcs.real_payment/100,2)) xcount from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon${tenantEntity.shardTableSuffix} | |||
| </foreach>) c on c.id = ci.coupon_id | |||
| left join wx_card_spend wcs on wcs.card_id = ci.id | |||
| where c.type = 100 | |||
| and wcs.create_date between #{startdate} and #{enddate} | |||
| @@ -879,40 +883,60 @@ | |||
| <if test=" null == sortColumns">order by c.status asc,c.create_date desc</if> | |||
| </select> | |||
| <select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <select id="findCouponOrderCount" | |||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c | |||
| left join wx_coupon_order wco on c.id = wco.coupon_id | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon${tenantEntity.shardTableSuffix} | |||
| </foreach>) c | |||
| left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) wco on c.id = wco.coupon_id | |||
| where c.type not in(8,9,100) | |||
| and wco.create_date between #{startdate} and #{enddate} | |||
| and wco.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| group by xtime | |||
| </select> | |||
| <select id="findCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <select id="findCouponPaymentCount" | |||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon${tenantEntity.shardTableSuffix} | |||
| </foreach>) c,(<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) wco | |||
| where c.type not in(8,9,100) | |||
| and wco.coupon_id = c.id and wco.coupon_order_status = 1 | |||
| and wco.update_date between #{startdate} and #{enddate} | |||
| and wco.update_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| group by xtime | |||
| </select> | |||
| <select id="priceCouponSaleCount" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <select id="priceCouponSaleCount" | |||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon${tenantEntity.shardTableSuffix} | |||
| </foreach>) c,(<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) wco | |||
| where c.type not in(8,9,100) | |||
| and wco.coupon_id = c.id and wco.coupon_price > 0 | |||
| and wco.create_date between #{startdate} and #{enddate} | |||
| and wco.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| group by xtime | |||
| </select> | |||
| <select id="priceCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <select id="priceCouponPaymentCount" | |||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon${tenantEntity.shardTableSuffix} | |||
| </foreach>) c,(<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) wco | |||
| where c.type not in(8,9,100) | |||
| and wco.coupon_id = c.id and wco.coupon_order_status = 1 and wco.coupon_price > 0 | |||
| and wco.update_date between #{startdate} and #{enddate} | |||
| and wco.update_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| group by xtime | |||
| </select> | |||
| @@ -938,69 +962,83 @@ | |||
| <!--砍价--> | |||
| <select id="pressSendHistory" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <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 | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| left join wx_order_press wop on wop.order_id = wo.id | |||
| 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 | |||
| left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order_press${tenantEntity.shardTableSuffix} | |||
| </foreach>) wop on wop.order_id = wo.id | |||
| where wc.type = 8 and wop.first = 1 and | |||
| wop.create_date between #{startdate} and #{enddate} | |||
| wop.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| group by xtime | |||
| </select> | |||
| <select id="pressSuccHistory" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <select id="pressSuccHistory" | |||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(wo.create_date,'%Y-%m-%d') xtime,count(wo.id) xcount from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| select DATE_FORMAT(wo.create_date,'%Y-%m-%d') xtime,count(wo.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 | |||
| where wc.type = 8 and wo.order_status = 1 | |||
| and wo.create_date between #{startdate} and #{enddate} | |||
| and wo.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| group by xtime | |||
| </select> | |||
| <select id="pressPaymentHistory" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <select id="pressPaymentHistory" | |||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon wc | |||
| left join wx_coupon_order wco on wco.coupon_id = wc.id | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.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_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) wco on wco.coupon_id = wc.id | |||
| where wc.type = 8 and wco.coupon_order_status = 1 | |||
| and wco.create_date between #{startdate} and #{enddate} | |||
| and wco.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| group by xtime | |||
| </select> | |||
| <select id="pressSuccRate" parameterType="com.iformall.domain.po.WxCoupon" resultType="java.lang.String"> | |||
| <select id="pressSuccRate" resultType="java.lang.String"> | |||
| select | |||
| round( | |||
| (select count(wo.id) from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| (select count(wo.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_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) wo on wo.product_id = wc.id | |||
| where wo.order_status = 1 and wc.type = 8 | |||
| and wo.create_date between #{startdate} and #{enddate} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wo.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wo.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and wo.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| ) | |||
| / | |||
| (select count(wop.id) from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| left join wx_order_press wop on wop.order_id = wo.id | |||
| 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 | |||
| left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order_press${tenantEntity.shardTableSuffix} | |||
| </foreach>) wop on wop.order_id = wo.id | |||
| where wop.first = 1 and wc.type = 8 | |||
| and wop.create_date between #{startdate} and #{enddate} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wo.`tenant_id` = #{tenantId} | |||
| and wop.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wo.`parent_tenant_id` = #{parentTenantId} | |||
| and wop.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and wop.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| ) | |||
| * 100 | |||
| ,2) | |||
| </select> | |||
| <select id="sumJoin" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select count(wop.id) from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| left join wx_order_press wop on wop.order_id = wo.id | |||
| <select id="sumJoin" resultType="Long"> | |||
| select count(wop.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_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) wo on wo.product_id = wc.id | |||
| left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order_press${tenantEntity.shardTableSuffix} | |||
| </foreach>) wop on wop.order_id = wo.id | |||
| where wc.type = 8 | |||
| and wop.create_date between #{startdate} and #{enddate} | |||
| and wop.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| </select> | |||
| <select id="priceCouponCancelCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| @@ -1011,14 +1049,18 @@ | |||
| and wco.coupon_order_status = 3 | |||
| </select> | |||
| <select id="findSaleCardCountHistory" parameterType="com.iformall.domain.po.WxCoupon" | |||
| <select id="findSaleCardCountHistory" | |||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(co.create_date,'%Y-%m-%d') xtime,count(co.id) xcount | |||
| from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join wx_coupon_order co on co.id = ci.id | |||
| left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon${tenantEntity.shardTableSuffix} | |||
| </foreach>) c on c.id = ci.coupon_id | |||
| left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) co on co.id = ci.id | |||
| where c.type = 100 | |||
| and co.create_date between #{startdate} and #{enddate} | |||
| and co.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| group by xtime | |||
| </select> | |||
| @@ -181,7 +181,9 @@ | |||
| COUNT(DISTINCT c_user_id) as couponUserCount, | |||
| count(*) as couponCount, | |||
| (select Count(*) | |||
| from wx_coupon_order c | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) c | |||
| where coupon_order_status=1 | |||
| AND DATE_FORMAT(create_date,'%m/%d')=createTime | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -193,7 +195,9 @@ | |||
| AND c.update_date >= #{startTime} | |||
| AND c.update_date <= #{endTime}) as verifyCount, | |||
| (select Count(DISTINCT c_user_id) | |||
| from wx_coupon_order d | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) d | |||
| where coupon_order_status=1 | |||
| AND DATE_FORMAT(create_date,'%m/%d')=createTime | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -204,7 +208,9 @@ | |||
| </if> | |||
| AND d.update_date >= #{startTime} | |||
| AND d.update_date <= #{endTime}) as verifyUserCount | |||
| from wx_coupon_order | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -628,7 +634,10 @@ | |||
| </select> | |||
| <select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" > | |||
| SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,IFNULL(SUM(coupon_price),0) as price from wx_coupon_order | |||
| SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,IFNULL(SUM(coupon_price),0) as price | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -204,5 +204,14 @@ | |||
| </update> | |||
| <select id="getTenantEntitys" parameterType="com.iformall.domain.po.base.TenantEntity" resultType="com.iformall.domain.po.base.TenantEntity"> | |||
| select `tenant_id`,`parent_tenant_id` from wx_mall where id > 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -145,7 +145,9 @@ | |||
| </select> | |||
| <select id="queryOrderGroupSuccessCountAndTime" parameterType="hashmap" resultType="hashmap"> | |||
| select count(1) total,DATE_FORMAT(create_date,'%Y-%m-%d') time from wx_coupon_order | |||
| select count(1) total,DATE_FORMAT(create_date,'%Y-%m-%d') time from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) | |||
| where coupon_type=9 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -164,7 +166,9 @@ | |||
| <select id="queryOrderGroupVerifyCountAndTime" parameterType="hashmap" resultType="hashmap"> | |||
| select count(1) total,DATE_FORMAT(create_date,'%Y-%m-%d') time | |||
| from wx_coupon_order where coupon_type=9 and coupon_order_status=1 | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) where coupon_type=9 and coupon_order_status=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -181,7 +185,9 @@ | |||
| </select> | |||
| <select id="queryOrderGroupCount" parameterType="hashmap" resultType="long"> | |||
| select count(1) total from wx_order_group | |||
| select count(1) total from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order_group${tenantEntity.shardTableSuffix} | |||
| </foreach>) | |||
| <where> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -195,25 +201,24 @@ | |||
| </where> | |||
| </select> | |||
| <select id="queryOrderGroupCountHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| <select id="queryOrderGroupCountHistory" resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(create_date,'%Y-%m-%d') xtime,count(*) xcount | |||
| from wx_order_group | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order_group${tenantEntity.shardTableSuffix} | |||
| </foreach>) | |||
| <where> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| and create_date BETWEEN #{startdate} and #{enddate} | |||
| <if test=" null != wxCoupon.startdate and null!= wxCoupon.enddate "> | |||
| and create_date BETWEEN #{wxCoupon.startdate} and #{wxCoupon.enddate} | |||
| </if> | |||
| </where> | |||
| group by xtime | |||
| </select> | |||
| <select id="queryOrderGroupSuccessCount" parameterType="hashmap" resultType="long"> | |||
| select count(1) total from wx_order_group where status=11 | |||
| select count(1) total from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order_group${tenantEntity.shardTableSuffix} | |||
| </foreach>) where status=11 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -226,7 +231,9 @@ | |||
| </select> | |||
| <select id="queryOrderGroupPeopleCount" parameterType="hashmap" resultType="long"> | |||
| select count(1) from (select id from wx_order where order_group_id!=0 | |||
| select count(1) from (select id from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) where order_group_id!=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -240,7 +247,9 @@ | |||
| </select> | |||
| <select id="queryOrderGroupVerifyCount" parameterType="hashmap" resultType="long"> | |||
| select count(1) total from wx_coupon_order where coupon_type=9 and coupon_order_status=1 | |||
| select count(1) total from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) where coupon_type=9 and coupon_order_status=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -256,7 +265,9 @@ | |||
| </select> | |||
| <select id="queryOrderGroupSuccessPeopleCount" parameterType="hashmap" resultType="long"> | |||
| select count(1) from wx_order where order_status=11 | |||
| select count(1) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) where order_status=11 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -569,7 +569,11 @@ | |||
| select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, | |||
| count(o.id) count, | |||
| IFNULL (SUM(o.payment),0) amount | |||
| from wx_order o | |||
| from ( | |||
| <foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order${tenantEntity.shardTableSuffix} | |||
| </foreach> | |||
| ) o | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and o.`tenant_id` = #{tenantId} | |||
| @@ -627,27 +631,30 @@ | |||
| from wx_merchant wm | |||
| left join | |||
| (select m.id as mid, IFNULL(sum(o.payment),0) amount,DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime | |||
| from wx_merchant m, wx_order o, wx_merchant_b_user bu | |||
| from wx_merchant m, | |||
| (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) o, wx_merchant_b_user bu | |||
| where bu.id = o.product_id | |||
| and m.status = 1 | |||
| and m.id = bu.merchant_id | |||
| and o.order_status = '1' | |||
| and o.type = 1 | |||
| <if test="startTime != null"> | |||
| AND o.create_date > #{startTime} | |||
| <if test="wxOrderReportDto.startTime != null"> | |||
| AND o.create_date > #{wxOrderReportDto.startTime} | |||
| </if> | |||
| <if test="endTime != null"> | |||
| AND o.create_date < #{endTime} | |||
| <if test="wxOrderReportDto.endTime != null"> | |||
| AND o.create_date < #{wxOrderReportDto.endTime} | |||
| </if> | |||
| group by m.id,xTime) mo on mo.mid = wm.id | |||
| where wm.status = 1 | |||
| <if test=" null != merchantName"> | |||
| <if test=" '' != merchantName"> | |||
| and wm.name like concat('%', #{merchantName},'%') | |||
| <if test=" null != wxOrderReportDto.merchantName"> | |||
| <if test=" '' != wxOrderReportDto.merchantName"> | |||
| and wm.name like concat('%', #{wxOrderReportDto.merchantName},'%') | |||
| </if> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns"> order by wm.create_date desc </if> | |||
| <if test=" null != wxOrderReportDto.sortColumns"> order by ${wxOrderReportDto.sortColumns} </if> | |||
| <if test=" null == wxOrderReportDto.sortColumns"> order by wm.create_date desc </if> | |||
| </select> | |||