| @@ -272,10 +272,7 @@ public class WxCouponController extends BaseController { | |||
| //默认时间本月第一天,截止到当天 | |||
| 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()); | |||
| wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth()); | |||
| } | |||
| if(wxCoupon.getEnddate() == null){ | |||
| wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); | |||
| @@ -296,7 +293,7 @@ public class WxCouponController extends BaseController { | |||
| return new ResultData(result); | |||
| } | |||
| @ApiOperation("卷营销列表接口") | |||
| @ApiOperation("券营销列表接口") | |||
| @GetMapping("findCouponCountList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @@ -306,10 +303,7 @@ public class WxCouponController extends BaseController { | |||
| //默认时间本月第一天,截止到当天 | |||
| 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()); | |||
| wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth()); | |||
| } | |||
| if(wxCoupon.getEnddate() == null){ | |||
| wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); | |||
| @@ -334,13 +328,9 @@ public class WxCouponController extends BaseController { | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "券投放-砍价营销列表") | |||
| public ResultData findPressCountList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| //默认时间本月第一天,截止到当天 | |||
| 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()); | |||
| wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth()); | |||
| } | |||
| if(wxCoupon.getEnddate() == null){ | |||
| wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); | |||
| @@ -2219,7 +2219,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| //默认时间本月第一天,截止到当天 | |||
| if (StringUtils.isEmpty(paramsMap.get("startdate"))) { | |||
| wxCoupon.setStartdate(getMonthFirstDay()); | |||
| wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth()); | |||
| }else{ | |||
| Date startTime = DateUtils.stringToDate(startdate); | |||
| wxCoupon.setStartdate(startTime); | |||
| @@ -2264,7 +2264,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| //默认时间本月第一天,截止到当天 | |||
| if (StringUtils.isEmpty(paramsMap.get("startdate"))) { | |||
| wxCoupon.setStartdate(getMonthFirstDay()); | |||
| wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth()); | |||
| }else{ | |||
| Date startTime = DateUtils.stringToDate(startdate); | |||
| wxCoupon.setStartdate(startTime); | |||
| @@ -2330,7 +2330,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| //默认时间本月第一天,截止到当天 | |||
| if (StringUtils.isEmpty(paramsMap.get("startdate"))) { | |||
| wxCoupon.setStartdate(getMonthFirstDay()); | |||
| wxCoupon.setStartdate(DateUtils.getFirstDayForCurrMonth()); | |||
| }else{ | |||
| Date startTime = DateUtils.stringToDate(startdate); | |||
| wxCoupon.setStartdate(startTime); | |||
| @@ -2381,16 +2381,6 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| return tatal; | |||
| } | |||
| private Date getMonthFirstDay() { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.add(Calendar.MONTH, 0); | |||
| c.set(Calendar.DAY_OF_MONTH,1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| return c.getTime(); | |||
| } | |||
| /** | |||
| * 拼团营销数据 | |||
| * @param paramsMap | |||
| @@ -2406,7 +2396,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| Date startTime = new Date(); | |||
| Date endTime = startTime; | |||
| if (StringUtils.isEmpty(paramsMap.get("startdate"))) { | |||
| startTime = getMonthFirstDay(); | |||
| startTime = DateUtils.getFirstDayForCurrMonth(); | |||
| params.put("startdate", startTime); | |||
| } else { | |||
| startTime = DateUtils.stringToDate(startdate + " 00:00:00"); | |||
| @@ -985,7 +985,12 @@ public class DateUtils { | |||
| */ | |||
| public static Date getFirstDayForCurrMonth(){ | |||
| Calendar cale = Calendar.getInstance(); | |||
| cale.add(Calendar.MONTH, 0); | |||
| cale.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天 | |||
| cale.set(Calendar.HOUR_OF_DAY, 0); //将小时至0 | |||
| cale.set(Calendar.MINUTE, 0); //将分钟至0 | |||
| cale.set(Calendar.SECOND,0); //将秒至0 | |||
| cale.set(Calendar.MILLISECOND, 0); //将毫秒至0 | |||
| return cale.getTime(); | |||
| } | |||
| /** | |||
| @@ -654,20 +654,20 @@ | |||
| <select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap"> | |||
| select c.id, c.`cover_img`,c.`title`,c.`sale_price`,c.`price`, | |||
| IFNULL(round((select count(o.id) from wx_order o where o.tenant_id = '1006' and o.product_id = c.id and o.order_status = 1)/ | |||
| (select count(op.id) from wx_order_press op where op.`tenant_id` = '1006' and op.`coupon_id` = c.`id` and op.first = 1 )*100,2),0) change_rate, | |||
| IFNULL(round((select count(o.id) from wx_order o where o.tenant_id = #{tenantId} and o.product_id = c.id and o.order_status = 1)/ | |||
| (select count(op.id) from wx_order_press op where op.`tenant_id` = #{tenantId} and op.`coupon_id` = c.`id` and op.first = 1 )*100,2),0) change_rate, | |||
| (select count(op.id) from wx_order_press op | |||
| where op.`tenant_id` = '1006' and op.first = 1 and op.coupon_id = c.id) as press_count, | |||
| where op.`tenant_id` = #{tenantId} and op.first = 1 and op.coupon_id = c.id) as press_count, | |||
| (select count(o.id) from wx_order o | |||
| where o.`tenant_id` = '1006' and o.product_id = c.id and o.order_status = 1) as press_succ_count, | |||
| where o.`tenant_id` = #{tenantId} and o.product_id = c.id and o.order_status = 1) as press_succ_count, | |||
| (select count(op.id) from wx_order_press op | |||
| where op.`tenant_id` = '1006' and op.`coupon_id` = c.`id`) as join_count, | |||
| where op.`tenant_id` = #{tenantId} and op.`coupon_id` = c.`id`) as join_count, | |||
| IFNULL(round((select count(wco.id) xcount from wx_coupon_order wco | |||
| where wco.`tenant_id` = '1006' and wco.coupon_id = c.id and wco.coupon_order_status = 1 | |||
| where wco.`tenant_id` = #{tenantId} and wco.coupon_id = c.id and wco.coupon_order_status = 1 | |||
| )/(select count(op.id) from wx_order_press op | |||
| where op.`tenant_id` = '1006' and op.`coupon_id` = c.`id` and op.first = 1) | |||
| where op.`tenant_id` = #{tenantId} and op.`coupon_id` = c.`id` and op.first = 1) | |||
| *100,2),0) as payment_rate | |||
| from wx_coupon c where c.type = 8 | |||