|
@@ -190,6 +190,9 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
|
|
|
if (planQuarterMapper.countProjectName(quarterStandardVo.getProjectName()) > 0) {
|
|
|
return AjaxResult.error("该项目名称已经存在");
|
|
|
}
|
|
|
+ if (!isBetweenValue(quarterStandardVo)) {
|
|
|
+ return AjaxResult.error("所创计划不在提报日期内!");
|
|
|
+ }
|
|
|
//默认未超额
|
|
|
if (ObjectUtils.isEmpty(quarterStandardVo.getIsExcess())) {
|
|
|
quarterStandardVo.setIsExcess("0");
|
|
@@ -265,6 +268,9 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
|
|
|
if (planQuarterMapper.countProjectNameOther(quarterStandardVo.getProjectName(), String.valueOf(quarterStandardVo.getPlanPracticalId())) > 0) {
|
|
|
return AjaxResult.error("该项目名称已经存在");
|
|
|
}
|
|
|
+ if (!isBetweenValue(quarterStandardVo)) {
|
|
|
+ return AjaxResult.error("所创计划不在提报日期内!");
|
|
|
+ }
|
|
|
//默认未超额
|
|
|
if (ObjectUtils.isEmpty(quarterStandardVo.getIsExcess())) {
|
|
|
quarterStandardVo.setIsExcess("0");
|
|
@@ -733,5 +739,53 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
|
|
|
return subTips;
|
|
|
}
|
|
|
|
|
|
+ //是否在提报时间内
|
|
|
+ public Boolean isBetweenValue(PlanQuarterStandardVo quarterStandardVo) {
|
|
|
+ //获取年度计划提报时间的阈值
|
|
|
+ //获取季度计划各个季度提报时间的阈值
|
|
|
+ List<SysDictData> supTime = dictTypeService.selectDictDataByType("sys_quarterly_plan");
|
|
|
+ HashMap<String, String> thresholdMap = new LinkedHashMap<>();
|
|
|
+ //各个季度提报时间的阈值
|
|
|
+ for (SysDictData dictData : supTime) {
|
|
|
+ // 季度----阈值
|
|
|
+ thresholdMap.put(dictData.getDictLabel(), dictData.getDictValue());
|
|
|
+ }
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date thresholdTimeStart = null;
|
|
|
+ Date thresholdTimeEnd = null;
|
|
|
+ Date subTime = quarterStandardVo.getPlanDemandSubTime();
|
|
|
+ try {
|
|
|
+ for (QuarterEnum val : QuarterEnum.values()) {
|
|
|
+ if (val.getInfo().contains(subTime.getMonth() + "")) {
|
|
|
+ switch (val.getCode()) {
|
|
|
+ case "1":
|
|
|
+ thresholdTimeStart = dateFormat.parse(thresholdMap.get("第一季度开始时间"));
|
|
|
+ thresholdTimeEnd = dateFormat.parse(thresholdMap.get("第一季度结束时间"));
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ thresholdTimeStart = dateFormat.parse(thresholdMap.get("第二季度开始时间"));
|
|
|
+ thresholdTimeEnd = dateFormat.parse(thresholdMap.get("第二季度结束时间"));
|
|
|
+ break;
|
|
|
+ case "3":
|
|
|
+ thresholdTimeStart = dateFormat.parse(thresholdMap.get("第三季度开始时间"));
|
|
|
+ thresholdTimeEnd = dateFormat.parse(thresholdMap.get("第三季度结束时间"));
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ thresholdTimeStart = dateFormat.parse(thresholdMap.get("第四季度开始时间"));
|
|
|
+ thresholdTimeEnd = dateFormat.parse(thresholdMap.get("第四季度结束时间"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(thresholdTimeStart) && !ObjectUtils.isEmpty(thresholdTimeEnd)) {
|
|
|
+ if (!subTime.after(thresholdTimeStart) && !subTime.before(thresholdTimeEnd)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
}
|