|
@@ -278,7 +278,20 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
|
|
|
cmCouponVipDao.insertVipCouponMonth(cmVipCoupon);
|
|
|
}
|
|
|
Date beginTime = DateUtil.getMinDay(svipcouponForm.getMonth());
|
|
|
- Date endTime = DateUtil.getMaxDay(svipcouponForm.getMonth());
|
|
|
+ // 结束时间为一个季度
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
|
|
+ Date dateMonth = null;
|
|
|
+ try {
|
|
|
+ dateMonth = dateFormat.parse(svipcouponForm.getMonth());
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(dateMonth);
|
|
|
+ calendar.add(Calendar.MONTH,2);
|
|
|
+ Date time = calendar.getTime();
|
|
|
+ String format = dateFormat.format(time);
|
|
|
+ Date endTime = DateUtil.getMaxDay(format);
|
|
|
/*
|
|
|
* 第1张券
|
|
|
*/
|
|
@@ -472,12 +485,29 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
|
|
|
flag = true;
|
|
|
cmCouponVipDao.insertVipCouponMonth(cmVipCoupon);
|
|
|
}
|
|
|
- Date beginTime = DateUtil.getMinDay(svipcouponForm.getMonth());
|
|
|
- Date endTime = DateUtil.getMaxDay(svipcouponForm.getMonth());
|
|
|
+ // 结束时间为一个季度
|
|
|
+ Date dateMonth = null;
|
|
|
+ String month = countMonth(svipcouponForm.getMonth());
|
|
|
+ try {
|
|
|
+ dateMonth = df.parse(month);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(dateMonth);
|
|
|
+ calendar.add(Calendar.MONTH,3);
|
|
|
+ Date time = calendar.getTime();
|
|
|
+ String format = df.format(time);
|
|
|
+ Date beginTime = DateUtil.getMinDay(format);
|
|
|
+ calendar.setTime(time);
|
|
|
+ calendar.add(Calendar.MONTH,2);
|
|
|
+ Date timeEnd = calendar.getTime();
|
|
|
+ String formatEnd = df.format(timeEnd);
|
|
|
+ Date endTime = DateUtil.getMaxDay(formatEnd);
|
|
|
/*
|
|
|
* 第1张券
|
|
|
*/
|
|
|
- coupon1.setName("超级会员优惠券"+svipcouponForm.getMonth());
|
|
|
+ coupon1.setName("超级会员优惠券"+format);
|
|
|
coupon1.setStartDate(beginTime);
|
|
|
coupon1.setEndDate(endTime);
|
|
|
coupon1.setCouponAmount(svipcouponForm.getCouponAmount1());
|
|
@@ -504,7 +534,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
|
|
|
/*
|
|
|
* 第2张券
|
|
|
*/
|
|
|
- coupon2.setName("超级会员优惠券"+svipcouponForm.getMonth());
|
|
|
+ coupon2.setName("超级会员优惠券"+format);
|
|
|
coupon2.setStartDate(beginTime);
|
|
|
coupon2.setEndDate(endTime);
|
|
|
coupon2.setCouponAmount(svipcouponForm.getCouponAmount2());
|
|
@@ -531,7 +561,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
|
|
|
/*
|
|
|
* 第3张券
|
|
|
*/
|
|
|
- coupon3.setName("超级会员优惠券"+svipcouponForm.getMonth());
|
|
|
+ coupon3.setName("超级会员优惠券"+format);
|
|
|
coupon3.setStartDate(beginTime);
|
|
|
coupon3.setEndDate(endTime);
|
|
|
coupon3.setCouponAmount(svipcouponForm.getCouponAmount3());
|
|
@@ -558,7 +588,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
|
|
|
/*
|
|
|
* 第4张券
|
|
|
*/
|
|
|
- coupon4.setName("超级会员优惠券"+svipcouponForm.getMonth());
|
|
|
+ coupon4.setName("超级会员优惠券"+format);
|
|
|
coupon4.setStartDate(beginTime);
|
|
|
coupon4.setEndDate(endTime);
|
|
|
coupon4.setCouponAmount(svipcouponForm.getCouponAmount4());
|
|
@@ -675,34 +705,34 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
|
|
|
if (com.thinkgem.jeesite.common.utils.StringUtils.isNotEmpty(cmVipCoupon.getStartDate())) {
|
|
|
year = cmVipCoupon.getStartDate().substring(0,cmVipCoupon.getStartDate().length() - 2);
|
|
|
month = cmVipCoupon.getStartDate().substring(cmVipCoupon.getStartDate().length() - 2);
|
|
|
- if (month.equals("01") || month.equals("02") || month.equals("03")) {
|
|
|
- month = "01";
|
|
|
+ if (month.equals("02") || month.equals("03") || month.equals("04")) {
|
|
|
+ month = "02";
|
|
|
}
|
|
|
- if (month.equals("04") || month.equals("05") || month.equals("06")) {
|
|
|
- month = "04";
|
|
|
+ if (month.equals("05") || month.equals("06") || month.equals("07")) {
|
|
|
+ month = "05";
|
|
|
}
|
|
|
- if (month.equals("07") || month.equals("08") || month.equals("09")) {
|
|
|
- month = "07";
|
|
|
+ if (month.equals("08") || month.equals("09") || month.equals("10")) {
|
|
|
+ month = "08";
|
|
|
}
|
|
|
- if (month.equals("10") || month.equals("11") || month.equals("12")) {
|
|
|
- month = "10";
|
|
|
+ if (month.equals("11") || month.equals("12") || month.equals("1")) {
|
|
|
+ month = "11";
|
|
|
}
|
|
|
startDate = year + month;
|
|
|
}
|
|
|
if (com.thinkgem.jeesite.common.utils.StringUtils.isNotEmpty(cmVipCoupon.getEndDate())) {
|
|
|
year = cmVipCoupon.getEndDate().substring(0,cmVipCoupon.getEndDate().length() - 2);
|
|
|
month = cmVipCoupon.getEndDate().substring(cmVipCoupon.getEndDate().length() - 2);
|
|
|
- if (month.equals("01") || month.equals("02") || month.equals("03")) {
|
|
|
- month = "03";
|
|
|
+ if (month.equals("02") || month.equals("03") || month.equals("04")) {
|
|
|
+ month = "02";
|
|
|
}
|
|
|
- if (month.equals("04") || month.equals("05") || month.equals("06")) {
|
|
|
- month = "06";
|
|
|
+ if (month.equals("05") || month.equals("06") || month.equals("07")) {
|
|
|
+ month = "05";
|
|
|
}
|
|
|
- if (month.equals("07") || month.equals("08") || month.equals("09")) {
|
|
|
- month = "09";
|
|
|
+ if (month.equals("08") || month.equals("09") || month.equals("10")) {
|
|
|
+ month = "08";
|
|
|
}
|
|
|
- if (month.equals("10") || month.equals("11") || month.equals("12")) {
|
|
|
- month = "12";
|
|
|
+ if (month.equals("11") || month.equals("12") || month.equals("1")) {
|
|
|
+ month = "11";
|
|
|
}
|
|
|
endDate = year + month;
|
|
|
}
|
|
@@ -710,4 +740,21 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
|
|
|
cmVipCoupon.setEndDate(endDate);
|
|
|
return cmVipCoupon;
|
|
|
}
|
|
|
+ public String countMonth(String countMonth) {
|
|
|
+ String year = countMonth.substring(0,countMonth.length() - 2);
|
|
|
+ String month = countMonth.substring(countMonth.length() - 2);
|
|
|
+ if (month.equals("02") || month.equals("03") || month.equals("04")) {
|
|
|
+ month = "02";
|
|
|
+ }
|
|
|
+ if (month.equals("05") || month.equals("06") || month.equals("07")) {
|
|
|
+ month = "05";
|
|
|
+ }
|
|
|
+ if (month.equals("08") || month.equals("09") || month.equals("10")) {
|
|
|
+ month = "08";
|
|
|
+ }
|
|
|
+ if (month.equals("11") || month.equals("12") || month.equals("1")) {
|
|
|
+ month = "11";
|
|
|
+ }
|
|
|
+ return year + month;
|
|
|
+ }
|
|
|
}
|