| @@ -2,12 +2,10 @@ package com.iformall.controller; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.service.WxChartDataService; | import com.iformall.service.WxChartDataService; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -116,7 +116,6 @@ public class WxCouponController extends BaseController { | |||||
| return new ResultData(wxCouponService.list(wxCoupon)); | return new ResultData(wxCouponService.list(wxCoupon)); | ||||
| } | } | ||||
| @ApiOperation("卡营销列表接口") | @ApiOperation("卡营销列表接口") | ||||
| @GetMapping("findCardCountList") | @GetMapping("findCardCountList") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -138,38 +137,24 @@ public class WxCouponController extends BaseController { | |||||
| return new ResultData(result); | return new ResultData(result); | ||||
| } | } | ||||
| @ApiOperation("卷列表统计接口") | |||||
| @GetMapping("findCouponHistory") | |||||
| public ResultData findCouponHistory(@ModelAttribute WxCoupon wxCoupon) { | |||||
| @ApiOperation("卷营销列表接口") | |||||
| @GetMapping("findCouponCountList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData findCouponCountList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||||
| //默认时间本月第一天,截止到当天 | //默认时间本月第一天,截止到当天 | ||||
| Map<String,Object> result = new HashedMap(); | Map<String,Object> result = new HashedMap(); | ||||
| // if(wxCoupon.getStartdate() == null){ | |||||
| // Calendar c = Calendar.getInstance(); | |||||
| // c.add(Calendar.MONTH, 0); | |||||
| // c.set(Calendar.DAY_OF_MONTH,1); | |||||
| // wxCoupon.setStartdate(c.getTime()); | |||||
| // } | |||||
| // if(wxCoupon.getEnddate() == null){ | |||||
| // wxCoupon.setEnddate(new Date()); | |||||
| // } | |||||
| // List<WxCoupon> saleMoneyList = wxCouponService.findSaleMoneyByDate(wxCoupon); | |||||
| // List<WxCoupon> paymentList = wxCouponService.findPaymentByDate(wxCoupon); | |||||
| // Map<String,Integer> saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| // Map<String,Integer> payMentMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| // | |||||
| // for (WxCoupon coupon:saleMoneyList){ | |||||
| // saleMap.put(coupon.getXtime(),coupon.getSaleAmount()); | |||||
| // } | |||||
| // for (WxCoupon coupon:paymentList){ | |||||
| // payMentMap.put(coupon.getXtime(),coupon.getSumPayment()); | |||||
| // } | |||||
| // 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)); | |||||
| return new ResultData(result); | |||||
| if(wxCoupon.getStartdate() == null){ | |||||
| Calendar c = Calendar.getInstance(); | |||||
| c.add(Calendar.MONTH, 0); | |||||
| c.set(Calendar.DAY_OF_MONTH,1); | |||||
| wxCoupon.setStartdate(c.getTime()); | |||||
| } | |||||
| if(wxCoupon.getEnddate() == null){ | |||||
| wxCoupon.setEnddate(new Date()); | |||||
| } | |||||
| return new ResultData(wxCouponService.findCouponData(wxCoupon,pageNum,pageSize)); | |||||
| } | } | ||||
| @@ -162,6 +162,8 @@ public class WxCoupon implements Serializable { | |||||
| //营销分析-----start----- | //营销分析-----start----- | ||||
| @Transient | @Transient | ||||
| private String xtime; | private String xtime; | ||||
| @Transient | |||||
| private Long xcount; | |||||
| /**售出卡数量**/ | /**售出卡数量**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="售出卡数量",name="saleCount") | @io.swagger.annotations.ApiModelProperty(value="售出卡数量",name="saleCount") | ||||
| @Transient | @Transient | ||||
| @@ -174,16 +176,33 @@ public class WxCoupon implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="售出金额",name="saleAmount") | @io.swagger.annotations.ApiModelProperty(value="售出金额",name="saleAmount") | ||||
| @Transient | @Transient | ||||
| private Integer saleAmount; | private Integer saleAmount; | ||||
| /**核销金额**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="核销金额",name="sumPayment") | |||||
| /**核销数量**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="核销数量",name="sumPayment") | |||||
| @Transient | @Transient | ||||
| private Integer sumPayment; | private Integer sumPayment; | ||||
| // /**fdsfsd**/ | |||||
| // @io.swagger.annotations.ApiModelProperty(value="核销金额",name="sumPayment") | |||||
| // @Transient | |||||
| // private Integer sumPayment; | |||||
| /**退款数量**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="退款数量",name="backpayCount") | |||||
| @Transient | |||||
| private Integer backpayCount; | |||||
| //营销分析-----end----- | //营销分析-----end----- | ||||
| public Long getXcount() { | |||||
| return xcount; | |||||
| } | |||||
| public void setXcount(Long xcount) { | |||||
| this.xcount = xcount; | |||||
| } | |||||
| public Integer getBackpayCount() { | |||||
| return backpayCount; | |||||
| } | |||||
| public void setBackpayCount(Integer backpayCount) { | |||||
| this.backpayCount = backpayCount; | |||||
| } | |||||
| public Long getSaleCount() { | public Long getSaleCount() { | ||||
| return saleCount; | return saleCount; | ||||
| } | } | ||||
| @@ -43,15 +43,19 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| Long findSubsidyMoney(WxCoupon wxCoupon); | Long findSubsidyMoney(WxCoupon wxCoupon); | ||||
| //-------卷-------- | //-------卷-------- | ||||
| Long findCouponSendCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> findCouponSendCount(WxCoupon wxCoupon); | |||||
| Long findCouponOrderCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> findCouponOrderCount(WxCoupon wxCoupon); | |||||
| Long findCouponGetCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> findCouponGetCount(WxCoupon wxCoupon); | |||||
| Long findCouponPaymentCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> findCouponPaymentCount(WxCoupon wxCoupon); | |||||
| Long priceCouponSaleCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> priceCouponSaleCount(WxCoupon wxCoupon); | |||||
| Long priceCouponPaymentCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> priceCouponPaymentCount(WxCoupon wxCoupon); | |||||
| Long findSumPriceSaleMoney(WxCoupon wxCoupon); | |||||
| Long findSumPricePayMent(WxCoupon wxCoupon); | |||||
| Long findSumSubsidyMoney(WxCoupon wxCoupon); | |||||
| } | } | ||||
| @@ -105,35 +105,39 @@ public interface WxCouponService { | |||||
| * 卷发放数量 | * 卷发放数量 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Long findCouponSendCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> findCouponSendCount(WxCoupon wxCoupon); | |||||
| /** | /** | ||||
| * 卷购买数量 | * 卷购买数量 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Long findCouponOrderCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> findCouponOrderCount(WxCoupon wxCoupon); | |||||
| /** | /** | ||||
| * 卷领取数量 | * 卷领取数量 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Long findCouponGetCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> findCouponGetCount(WxCoupon wxCoupon); | |||||
| /** | /** | ||||
| * 卷核销数量 | * 卷核销数量 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Long findCouponPaymentCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> findCouponPaymentCount(WxCoupon wxCoupon); | |||||
| /** | /** | ||||
| * 有价卷销售数量 | * 有价卷销售数量 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Long priceCouponSaleCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> priceCouponSaleCount(WxCoupon wxCoupon); | |||||
| /** | /** | ||||
| * 有价卷核销数量 | * 有价卷核销数量 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Long priceCouponPaymentCount(WxCoupon wxCoupon); | |||||
| List<WxCoupon> priceCouponPaymentCount(WxCoupon wxCoupon); | |||||
| Long findSumPriceSaleMoney(WxCoupon wxCoupon); | |||||
| Long findSumPricePayMent(WxCoupon wxCoupon); | |||||
| Long findSumSubsidyMoney(WxCoupon wxCoupon); | |||||
| } | } | ||||
| @@ -1471,10 +1471,6 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| //卡营销数据 | //卡营销数据 | ||||
| if (chart.equals(EnumChart.SALE_CARD.getCode())) { | if (chart.equals(EnumChart.SALE_CARD.getCode())) { | ||||
| WxCoupon wxCoupon = new WxCoupon(); | WxCoupon wxCoupon = new WxCoupon(); | ||||
| if(StringUtils.isNotBlank(paramsMap.get("id"))) { | |||||
| wxCoupon.setId(Long.parseLong(paramsMap.get("id"))); | |||||
| } | |||||
| //默认时间本月第一天,截止到当天 | //默认时间本月第一天,截止到当天 | ||||
| Map<String,Object> result = new HashedMap(); | Map<String,Object> result = new HashedMap(); | ||||
| if(startdate == null){ | if(startdate == null){ | ||||
| @@ -1494,14 +1490,14 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| } | } | ||||
| List<WxCoupon> saleMoneyList = wxCouponService.findSaleMoneyByDate(wxCoupon); | List<WxCoupon> saleMoneyList = wxCouponService.findSaleMoneyByDate(wxCoupon); | ||||
| List<WxCoupon> paymentList = wxCouponService.findPaymentByDate(wxCoupon); | List<WxCoupon> paymentList = wxCouponService.findPaymentByDate(wxCoupon); | ||||
| Map<String,Integer> saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| Map<String,Integer> payMentMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| Map<String,Long> saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| Map<String,Long> payMentMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| for (WxCoupon coupon:saleMoneyList){ | for (WxCoupon coupon:saleMoneyList){ | ||||
| saleMap.put(coupon.getXtime(),coupon.getSaleAmount()); | |||||
| saleMap.put(coupon.getXtime(),coupon.getXcount()); | |||||
| } | } | ||||
| for (WxCoupon coupon:paymentList){ | for (WxCoupon coupon:paymentList){ | ||||
| payMentMap.put(coupon.getXtime(),coupon.getSumPayment()); | |||||
| payMentMap.put(coupon.getXtime(),coupon.getXcount()); | |||||
| } | } | ||||
| result.put("saleHistory",saleMap); | result.put("saleHistory",saleMap); | ||||
| result.put("paymentHistory",payMentMap); | result.put("paymentHistory",payMentMap); | ||||
| @@ -1510,6 +1506,71 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| result.put("subsidyCount",wxCouponService.findSubsidyMoney(wxCoupon)); | result.put("subsidyCount",wxCouponService.findSubsidyMoney(wxCoupon)); | ||||
| return new ResultData(result); | return new ResultData(result); | ||||
| } | } | ||||
| //卡营销数据 | |||||
| if (chart.equals(EnumChart.SALE_COUPON.getCode())) { | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| //默认时间本月第一天,截止到当天 | |||||
| Map<String,Object> result = new HashedMap(); | |||||
| if(startdate == null){ | |||||
| Calendar c = Calendar.getInstance(); | |||||
| c.add(Calendar.MONTH, 0); | |||||
| c.set(Calendar.DAY_OF_MONTH,1); | |||||
| wxCoupon.setStartdate(c.getTime()); | |||||
| }else{ | |||||
| Date startTime = DateUtils.stringToDate(startdate + " 00:00:00"); | |||||
| wxCoupon.setStartdate(startTime); | |||||
| } | |||||
| if(enddate == null){ | |||||
| wxCoupon.setEnddate(new Date()); | |||||
| }else{ | |||||
| Date endTime = DateUtils.stringToDate(enddate + " 23:59:59"); | |||||
| wxCoupon.setEnddate(endTime); | |||||
| } | |||||
| List<WxCoupon> sendList = wxCouponService.findCouponSendCount(wxCoupon); | |||||
| List<WxCoupon> orderCountList = wxCouponService.findCouponOrderCount(wxCoupon); | |||||
| List<WxCoupon> getCountList = wxCouponService.findCouponGetCount(wxCoupon); | |||||
| List<WxCoupon> paymentCountList = wxCouponService.findCouponPaymentCount(wxCoupon); | |||||
| List<WxCoupon> priceCouponSaleCountList = wxCouponService.priceCouponSaleCount(wxCoupon); | |||||
| List<WxCoupon> priceCouponPaymentCountList = wxCouponService.priceCouponPaymentCount(wxCoupon); | |||||
| Map<String,Long> sendMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| Map<String,Long> orderCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| Map<String,Long> getCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| Map<String,Long> paymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| Map<String,Long> priceCouponSaleCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| Map<String,Long> priceCouponPaymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||||
| for (WxCoupon coupon:sendList){ | |||||
| sendMap.put(coupon.getXtime(),coupon.getXcount()); | |||||
| } | |||||
| for (WxCoupon coupon:orderCountList){ | |||||
| orderCountMap.put(coupon.getXtime(),coupon.getXcount()); | |||||
| } | |||||
| for (WxCoupon coupon:getCountList){ | |||||
| getCountMap.put(coupon.getXtime(),coupon.getXcount()); | |||||
| } | |||||
| for (WxCoupon coupon:paymentCountList){ | |||||
| paymentCountMap.put(coupon.getXtime(),coupon.getXcount()); | |||||
| } | |||||
| for (WxCoupon coupon:priceCouponSaleCountList){ | |||||
| priceCouponSaleCountMap.put(coupon.getXtime(),coupon.getXcount()); | |||||
| } | |||||
| for (WxCoupon coupon:priceCouponPaymentCountList){ | |||||
| priceCouponPaymentCountMap.put(coupon.getXtime(),coupon.getXcount()); | |||||
| } | |||||
| result.put("sendList",sendMap); | |||||
| result.put("orderCountList",orderCountMap); | |||||
| result.put("getCountList",getCountMap); | |||||
| 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)); | |||||
| return new ResultData(result); | |||||
| } | |||||
| return new ResultData(datamap); | return new ResultData(datamap); | ||||
| } | } | ||||
| @@ -1593,17 +1654,17 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| return vo; | return vo; | ||||
| } | } | ||||
| public static Map<String,Integer> getDateMap(Date begin, Date end) { | |||||
| public static Map<String,Long> getDateMap(Date begin, Date end) { | |||||
| SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | ||||
| Map<String,Integer> map = new LinkedHashMap<>(); | |||||
| map.put(format.format(begin),0); | |||||
| Map<String,Long> map = new LinkedHashMap<>(); | |||||
| map.put(format.format(begin),0l); | |||||
| Calendar calBegin = Calendar.getInstance(); | Calendar calBegin = Calendar.getInstance(); | ||||
| calBegin.setTime(begin); | calBegin.setTime(begin); | ||||
| Calendar calEnd = Calendar.getInstance(); | Calendar calEnd = Calendar.getInstance(); | ||||
| calEnd.setTime(end); | calEnd.setTime(end); | ||||
| while (calBegin.getTime().before(end)) { | while (calBegin.getTime().before(end)) { | ||||
| calBegin.add(Calendar.DAY_OF_MONTH, 1); | calBegin.add(Calendar.DAY_OF_MONTH, 1); | ||||
| map.put(format.format(calBegin.getTime()),0); | |||||
| map.put(format.format(calBegin.getTime()),0l); | |||||
| } | } | ||||
| return map; | return map; | ||||
| } | } | ||||
| @@ -164,7 +164,6 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return Integer.valueOf(merchantParam.getString("businessId")); | return Integer.valueOf(merchantParam.getString("businessId")); | ||||
| } | } | ||||
| @Override | @Override | ||||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public ResultData saveOrUpdate(WxCoupon record) { | public ResultData saveOrUpdate(WxCoupon record) { | ||||
| @@ -352,36 +351,51 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxCoupon> findCouponData(WxCoupon record, Integer pageNum, Integer pageSize) { | public PageInfo<WxCoupon> findCouponData(WxCoupon record, Integer pageNum, Integer pageSize) { | ||||
| return null; | |||||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCouponData(record)); | |||||
| } | |||||
| @Override | |||||
| public List<WxCoupon> findCouponSendCount(WxCoupon wxCoupon) { | |||||
| return wxCouponMapper.findCouponSendCount(wxCoupon); | |||||
| } | |||||
| @Override | |||||
| public List<WxCoupon> findCouponOrderCount(WxCoupon wxCoupon) { | |||||
| return wxCouponMapper.findCouponOrderCount(wxCoupon); | |||||
| } | |||||
| @Override | |||||
| public List<WxCoupon> findCouponGetCount(WxCoupon wxCoupon) { | |||||
| return wxCouponMapper.findCouponGetCount(wxCoupon); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Long findCouponSendCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| public List<WxCoupon> findCouponPaymentCount(WxCoupon wxCoupon) { | |||||
| return wxCouponMapper.findCouponPaymentCount(wxCoupon); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Long findCouponOrderCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| public List<WxCoupon> priceCouponSaleCount(WxCoupon wxCoupon) { | |||||
| return wxCouponMapper.priceCouponSaleCount(wxCoupon); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Long findCouponGetCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| public List<WxCoupon> priceCouponPaymentCount(WxCoupon wxCoupon) { | |||||
| return wxCouponMapper.priceCouponPaymentCount(wxCoupon); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Long findCouponPaymentCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| public Long findSumPriceSaleMoney(WxCoupon wxCoupon) { | |||||
| return wxCouponMapper.findSumPriceSaleMoney(wxCoupon); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Long priceCouponSaleCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| public Long findSumPricePayMent(WxCoupon wxCoupon) { | |||||
| return wxCouponMapper.findSumPricePayMent(wxCoupon); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Long priceCouponPaymentCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| public Long findSumSubsidyMoney(WxCoupon wxCoupon) { | |||||
| return wxCouponMapper.findSumSubsidyMoney(wxCoupon); | |||||
| } | } | ||||
| } | } | ||||
| @@ -43,7 +43,7 @@ | |||||
| `id`,`tenant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`, | `id`,`tenant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`, | ||||
| `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`, | `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`, | ||||
| `remark`,`status`,`create_date`,`update_date`,`business`,`support_transfer`,`subsidy_num`,`subsidy_type`, | `remark`,`status`,`create_date`,`update_date`,`business`,`support_transfer`,`subsidy_num`,`subsidy_type`, | ||||
| `press_limit_num`, `press_limit_hours`, `auto_refund` | |||||
| `press_limit_num`, `press_limit_hours`, `auto_refund`,subsidy_num | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -622,10 +622,13 @@ | |||||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | ||||
| <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/> | <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/> | ||||
| <result column="xtime" property="xtime"/> | <result column="xtime" property="xtime"/> | ||||
| <result column="xcount" property="xcount"/> | |||||
| <result column="sale_count" property="saleCount"/> | <result column="sale_count" property="saleCount"/> | ||||
| <result column="transfer_count" property="transferCount"/> | <result column="transfer_count" property="transferCount"/> | ||||
| <result column="sale_amount" property="saleAmount"/> | <result column="sale_amount" property="saleAmount"/> | ||||
| <result column="sum_payment" property="sumPayment"/> | <result column="sum_payment" property="sumPayment"/> | ||||
| <result column="backpay_count" property="backpayCount"/> | |||||
| <collection column="{productId=id}" property="merchantVoList" | <collection column="{productId=id}" property="merchantVoList" | ||||
| ofType="com.iformall.domain.vo.WxMerchantVo" | ofType="com.iformall.domain.vo.WxMerchantVo" | ||||
| @@ -663,7 +666,7 @@ | |||||
| </update> | </update> | ||||
| <select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | <select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | ||||
| select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(ci.sale_amount) sale_amount from wx_card_info ci | |||||
| select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(ci.sale_amount) xcount from wx_card_info ci | |||||
| left join wx_coupon c on c.id = ci.coupon_id | left join wx_coupon c on c.id = ci.coupon_id | ||||
| where ci.create_date between #{startdate} and #{enddate} | where ci.create_date between #{startdate} and #{enddate} | ||||
| <if test="id != null"> | <if test="id != null"> | ||||
| @@ -673,7 +676,7 @@ | |||||
| </select> | </select> | ||||
| <select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | <select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | ||||
| select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(wcs.real_payment) sum_payment from wx_card_info ci | |||||
| select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(wcs.payment) xcount from wx_card_info ci | |||||
| left join wx_coupon c on c.id = ci.coupon_id | left join wx_coupon c on c.id = ci.coupon_id | ||||
| left join wx_card_spend wcs on wcs.card_id = ci.id | left join wx_card_spend wcs on wcs.card_id = ci.id | ||||
| where ci.create_date between #{startdate} and #{enddate} | where ci.create_date between #{startdate} and #{enddate} | ||||
| @@ -714,7 +717,7 @@ | |||||
| <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select c.*, | select c.*, | ||||
| (select count(distinct wco.owner_id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | |||||
| (select count(wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | |||||
| (select count(distinct wcs.coupon_order_id) from wx_card_info ci | (select count(distinct wcs.coupon_order_id) from wx_card_info ci | ||||
| left join wx_coupon wc on wc.id = ci.coupon_id | left join wx_coupon wc on wc.id = ci.coupon_id | ||||
| left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id | left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id | ||||
| @@ -722,7 +725,7 @@ | |||||
| (select sum(ci.sale_amount) from wx_card_info ci | (select sum(ci.sale_amount) from wx_card_info ci | ||||
| left join wx_coupon wc on wc.id = ci.coupon_id | left join wx_coupon wc on wc.id = ci.coupon_id | ||||
| where wc.id = c.id) as sale_amount, | where wc.id = c.id) as sale_amount, | ||||
| (select sum(wcs.real_payment) from wx_card_info ci | |||||
| (select sum(wcs.payment) from wx_card_info ci | |||||
| left join wx_coupon wc on wc.id = ci.coupon_id | left join wx_coupon wc on wc.id = ci.coupon_id | ||||
| left join wx_card_spend wcs on wcs.card_id = ci.id | left join wx_card_spend wcs on wcs.card_id = ci.id | ||||
| where wc.id = c.id) as sum_payment | where wc.id = c.id) as sum_payment | ||||
| @@ -737,7 +740,7 @@ | |||||
| select c.*, | select c.*, | ||||
| (select count(distinct wco.owner_id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | (select count(distinct wco.owner_id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | ||||
| (select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as payment_count, | (select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as payment_count, | ||||
| (select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 3 and wc.id = c.id) as payment_count | |||||
| (select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 3 and wc.id = c.id) as backpay_count | |||||
| from wx_coupon c where 1=1 | from wx_coupon c where 1=1 | ||||
| <if test=" null != type "> | <if test=" null != type "> | ||||
| and c.type = #{type} | and c.type = #{type} | ||||
| @@ -748,11 +751,68 @@ | |||||
| order by status asc,create_date desc | order by status asc,create_date desc | ||||
| </select> | </select> | ||||
| <select id="findCouponSendCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||||
| select sum(subsidy_num) from wx_coupon c | |||||
| where c.create_date between #{startdate} and #{enddate} | |||||
| <if test="id != null"> | |||||
| and c.id = #{id} | |||||
| </if> | |||||
| <select id="findCouponSendCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||||
| select DATE_FORMAT(c.create_time,'%Y-%m-%d') xtime,count(id) xcount from wx_coupon_action_log c | |||||
| where c.create_time between #{startdate} and #{enddate} | |||||
| group by xtime | |||||
| </select> | |||||
| <select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||||
| 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 | |||||
| where 1=1 | |||||
| and wco.create_date between #{startdate} and #{enddate} | |||||
| and wco.coupon_price > 0 | |||||
| group by xtime | |||||
| </select> | |||||
| <select id="findCouponGetCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||||
| 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 | |||||
| where 1=1 | |||||
| and wco.create_date between #{startdate} and #{enddate} | |||||
| and wco.coupon_price = 0 | |||||
| group by xtime | |||||
| </select> | |||||
| <select id="findCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco | |||||
| where wco.coupon_id = c.id and wco.coupon_order_status = 1 | |||||
| and wco.create_date between #{startdate} and #{enddate} | |||||
| group by xtime | |||||
| </select> | |||||
| <select id="priceCouponSaleCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco | |||||
| where wco.coupon_id = c.id and wco.coupon_price > 0 | |||||
| and wco.create_date between #{startdate} and #{enddate} | |||||
| group by xtime | |||||
| </select> | |||||
| <select id="priceCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco | |||||
| where wco.coupon_id = c.id and wco.coupon_order_status = 1 and wco.coupon_price > 0 | |||||
| and wco.create_date between #{startdate} and #{enddate} | |||||
| group by xtime | |||||
| </select> | |||||
| <select id="findSumPriceSaleMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||||
| select sum(wco.coupon_price) from wx_coupon c,wx_coupon_order wco | |||||
| where wco.coupon_id = c.id and wco.coupon_price > 0 | |||||
| and wco.create_date between #{startdate} and #{enddate} | |||||
| </select> | |||||
| <select id="findSumPricePayMent" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||||
| select sum(wco.coupon_price) from wx_coupon c,wx_coupon_order wco | |||||
| where wco.coupon_id = c.id and wco.coupon_price > 0 and wco.coupon_order_status = 1 | |||||
| and wco.create_date between #{startdate} and #{enddate} | |||||
| </select> | |||||
| <select id="findSumSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||||
| select sum(c.subsidy_num) from wx_coupon c,wx_coupon_order wco | |||||
| where wco.coupon_id = c.id | |||||
| and wco.create_date between #{startdate} and #{enddate} | |||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||