|
|
|
@@ -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<>(); |
|
|
|
|