| @@ -147,13 +147,52 @@ public class WxCouponController extends BaseController { | |||
| result.put("list",wxCouponService.findCountData(wxCoupon,pageNum,pageSize)); | |||
| result.put("saleHistory",saleMap); | |||
| result.put("paymentHistory",payMentMap); | |||
| result.put("saleCardCount",0); | |||
| result.put("tranCount",0); | |||
| result.put("subsidyCount",0); | |||
| result.put("saleCardCount",wxCouponService.findSaleCardCount(wxCoupon)); | |||
| result.put("tranCount",wxCouponService.findTranCardCount(wxCoupon)); | |||
| result.put("subsidyCount",wxCouponService.findSubsidyMoney(wxCoupon)); | |||
| return new ResultData(result); | |||
| } | |||
| @ApiOperation("卷列表统计接口") | |||
| @GetMapping("findCouponData") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData findCouponData(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| //默认时间本月第一天,截止到当天 | |||
| 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("list",wxCouponService.findCountData(wxCoupon,pageNum,pageSize)); | |||
| 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); | |||
| } | |||
| public static Map<String,Integer> getDateMap(Date begin, Date end) { | |||
| SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |||
| Map<String,Integer> map = new LinkedHashMap<>(); | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| /** | |||
| @@ -22,6 +23,7 @@ public class BaseMsg implements Serializable { | |||
| private String statusMessage; | |||
| //延迟消息1s,5s,10s,30s,1m,2m,3m,4m,5m,6m,7m,8m,9m,10m,20m,30m,1h,2h | |||
| @Transient | |||
| private Integer delayTimeLevel = 0; | |||
| public Integer getDelayTimeLevel() { | |||
| @@ -59,16 +59,11 @@ public class WxCoupon implements Serializable { | |||
| private String subsidyNumStr; | |||
| @Transient | |||
| @DateTimeFormat(pattern = "yyyy-MM-dd") | |||
| private Date startdate; | |||
| @Transient | |||
| @DateTimeFormat(pattern = "yyyy-MM-dd") | |||
| private Date enddate; | |||
| @Transient | |||
| private String xtime; | |||
| /**租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @@ -161,8 +156,12 @@ public class WxCoupon implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="砍价限制时间",name="pressLimitHours") | |||
| private Integer pressLimitHours; | |||
| @Transient | |||
| private String merchantParams; | |||
| //营销分析-----start----- | |||
| @Transient | |||
| private String xtime; | |||
| /**售出卡数量**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="售出卡数量",name="saleCount") | |||
| @Transient | |||
| @@ -179,9 +178,11 @@ public class WxCoupon implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="核销金额",name="sumPayment") | |||
| @Transient | |||
| private Integer sumPayment; | |||
| @Transient | |||
| private String merchantParams; | |||
| // /**fdsfsd**/ | |||
| // @io.swagger.annotations.ApiModelProperty(value="核销金额",name="sumPayment") | |||
| // @Transient | |||
| // private Integer sumPayment; | |||
| //营销分析-----end----- | |||
| public Long getSaleCount() { | |||
| return saleCount; | |||
| @@ -36,6 +36,13 @@ public interface WxCouponService { | |||
| */ | |||
| PageInfo<WxCoupon> findCountData(WxCoupon record,Integer pageNum, Integer pageSize); | |||
| /** | |||
| * 卷列表,包括统计 | |||
| * @param record | |||
| * @return | |||
| */ | |||
| PageInfo<WxCoupon> findCouponData(WxCoupon record,Integer pageNum, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| @@ -349,4 +349,9 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| public Long findSubsidyMoney(WxCoupon wxCoupon) { | |||
| return null; | |||
| } | |||
| @Override | |||
| public PageInfo<WxCoupon> findCouponData(WxCoupon record, Integer pageNum, Integer pageSize) { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -703,4 +703,33 @@ | |||
| </if> | |||
| group by xtime | |||
| </select> | |||
| <select id="findSaleCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select count(distinct co.owner_id) | |||
| 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 | |||
| where c.create_date between #{startdate} and #{enddate} | |||
| <if test="title != null"> | |||
| and c.title like concat('%', #{title},'%') | |||
| </if> | |||
| </select> | |||
| <select id="findTranCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select count(distinct wcs.coupon_order_id) from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id | |||
| where c.create_date between #{startdate} and #{enddate} | |||
| <if test="title != null"> | |||
| and c.title like concat('%', #{title},'%') | |||
| </if> | |||
| </select> | |||
| <select id="findSubsidyMoney" 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="title != null"> | |||
| and c.title like concat('%', #{title},'%') | |||
| </if> | |||
| </select> | |||
| </mapper> | |||