|
@@ -991,6 +991,22 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
|
|
|
//字段赋值对应的名称
|
|
|
public List<PlanYearsResponseVo> changeTo(List<PlanYears> planYears) {
|
|
|
+ //获取年度计划提报时间的阈值
|
|
|
+ List<SysDictData> supTime = dictTypeService.selectDictDataByType("sys_annual_plan");
|
|
|
+ HashMap<String, String> thresholdMap = new LinkedHashMap<>();
|
|
|
+ //年度提报时间的阈值
|
|
|
+ for (SysDictData dictData : supTime) {
|
|
|
+ // 字段名称----阈值
|
|
|
+ thresholdMap.put(dictData.getDictLabel(), dictData.getDictValue());
|
|
|
+ }
|
|
|
+ //提前或延后*天进行提醒
|
|
|
+ List<SysDictData> alertTime = dictTypeService.selectDictDataByType("alert_time_setting");
|
|
|
+ HashMap<String, String> alertTimeMap = new LinkedHashMap<>();
|
|
|
+ //根据时间类别设定的提醒时间
|
|
|
+ for (SysDictData dictData : alertTime) {
|
|
|
+ // 字段名称----阈值
|
|
|
+ alertTimeMap.put(dictData.getDictLabel(), dictData.getDictValue());
|
|
|
+ }
|
|
|
//获取字典数据
|
|
|
HashMap<String, HashMap<String, String>> planEnums = dictTypeService.getAboutEnums();
|
|
|
HashMap<String, String> projectTypesMap = planEnums.get("projectTypes");
|
|
@@ -1049,17 +1065,8 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
}
|
|
|
}
|
|
|
BeanUtils.copyProperties(planYear, responseVo);
|
|
|
-
|
|
|
- //获取年度计划提报时间的阈值
|
|
|
- List<SysDictData> supTime = dictTypeService.selectDictDataByType("sys_annual_plan");
|
|
|
- HashMap<String, String> thresholdMap = new LinkedHashMap<>();
|
|
|
- //年度提报时间的阈值
|
|
|
- for (SysDictData dictData : supTime) {
|
|
|
- // 字段名称----阈值
|
|
|
- thresholdMap.put(dictData.getDictLabel(), dictData.getDictValue());
|
|
|
- }
|
|
|
try {
|
|
|
- responseVo.setTipsMessage(planYearsGetTips(thresholdMap));
|
|
|
+ responseVo.setTipsMessage(planYearsGetTips(responseVo, thresholdMap, alertTimeMap));
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -1073,22 +1080,35 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public String planYearsGetTips(HashMap<String, String> thresholdMap) throws ParseException {
|
|
|
- //提示信息:定义距离结束时间一周内提示
|
|
|
- Integer remindTine = 1000 * 60 * 60 * 24 * 7;
|
|
|
+ public String planYearsGetTips(PlanYearsResponseVo responseVo, HashMap<String, String> thresholdMap, HashMap<String, String> alertTimeMap) throws ParseException {
|
|
|
+ //提示信息:定义距离结束时间*天内提示
|
|
|
+ int alertDay = Integer.parseInt(alertTimeMap.get("计划提报时间"));
|
|
|
+ Integer remindTime = 1000 * 60 * 60 * 24 * alertDay;
|
|
|
//提报时间的结束时间阈值
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date thresholdTime = dateFormat.parse(thresholdMap.get("起止时间结束"));
|
|
|
|
|
|
double surplus = thresholdTime.getTime() - System.currentTimeMillis();
|
|
|
- //少于一周便提醒
|
|
|
- if (surplus < remindTine && surplus > 0) {
|
|
|
+ //少于设定阈值便提醒
|
|
|
+ if (surplus < remindTime && surplus > 0) {
|
|
|
//剩余天数(向上取整)
|
|
|
int i = new Double(Math.ceil(surplus / 1000 / 60 / 60 / 24)).intValue();
|
|
|
if (i > 0) {
|
|
|
return "距离计划提报时间不足" + i + "天";
|
|
|
}
|
|
|
}
|
|
|
+ //距离计划完成采购时间一周内提醒
|
|
|
+ Integer alertTime = 1000 * 60 * 60 * 24 * 7;
|
|
|
+ double surplusTwo = responseVo.getPlanPurchaseFinishTime().getTime() - System.currentTimeMillis();
|
|
|
+ //少于设定阈值便提醒
|
|
|
+ if (surplusTwo < alertTime && surplusTwo > 0) {
|
|
|
+ //剩余天数(向上取整)
|
|
|
+ int i = new Double(Math.ceil(surplusTwo / 1000 / 60 / 60 / 24)).intValue();
|
|
|
+ if (i > 0) {
|
|
|
+ return "距离计划完成采购时间不足" + i + "天";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return "";
|
|
|
}
|
|
|
|