main
parent
52a5285b56
commit
42c6037de8
|
|
@ -180,4 +180,31 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
||||||
return Date.from(zdt.toInstant());
|
return Date.from(zdt.toInstant());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给datetime时间类型减去指定时间 type=1 增加分钟 type = 2 增加小时 type= 3增加天 type= 4 增加月 type=5增加年
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Date dateSubtractTime(Date stateTime,int type, int num) {
|
||||||
|
LocalDateTime localDate = ZonedDateTime.ofInstant(stateTime.toInstant(), ZoneId.systemDefault()).toLocalDateTime();
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
localDate = localDate.minusMinutes(num);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
localDate = localDate.minusHours(num);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
localDate = localDate.minusDays(num);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
localDate = localDate.minusMonths(num);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
localDate = localDate.minusYears(num);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ZonedDateTime zdt = localDate.atZone(ZoneId.systemDefault());
|
||||||
|
return Date.from(zdt.toInstant());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.ruoyi.app.mapper.AppOrderPayMapper;
|
||||||
import com.ruoyi.app.mapper.AppUserMapper;
|
import com.ruoyi.app.mapper.AppUserMapper;
|
||||||
import com.ruoyi.app.service.IAppDynamicCommentService;
|
import com.ruoyi.app.service.IAppDynamicCommentService;
|
||||||
import com.ruoyi.app.service.IPayService;
|
import com.ruoyi.app.service.IPayService;
|
||||||
|
import com.ruoyi.common.core.utils.DateUtils;
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -183,9 +184,11 @@ public class PayController extends BaseController
|
||||||
if (null == endDate) {
|
if (null == endDate) {
|
||||||
endDate = startDate;
|
endDate = startDate;
|
||||||
}
|
}
|
||||||
|
endDate = appOrder.getLevel() == 1 ? DateUtils.dateSubtractTime(endDate,3,7)
|
||||||
|
: (appOrder.getLevel() == 2 ? DateUtils.dateSubtractTime(endDate,4,31) : DateUtils.dateSubtractTime(endDate,5,365));
|
||||||
|
userEntity.setOrderStartTime(startDate);
|
||||||
|
userEntity.setOrderEndTime(endDate);
|
||||||
|
appUserMapper.updateAppUser(userEntity);
|
||||||
out.println("success");
|
out.println("success");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("异常订单:" + wexinResult.toString());
|
log.info("异常订单:" + wexinResult.toString());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue