|
@@ -2,8 +2,6 @@ package com.ozs.plan.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.github.pagehelper.PageHelper;
|
|
|
-import com.github.pagehelper.PageInfo;
|
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
|
import com.ozs.common.core.domain.entity.SysDept;
|
|
|
import com.ozs.common.core.domain.entity.SysDictData;
|
|
@@ -12,6 +10,7 @@ import com.ozs.common.enums.DataIsDelete;
|
|
|
import com.ozs.common.enums.PmProjectStatus;
|
|
|
import com.ozs.common.enums.ProjectStatus;
|
|
|
import com.ozs.common.enums.ProjectTypes;
|
|
|
+import com.ozs.common.enums.QuarterEnum;
|
|
|
import com.ozs.common.enums.SysFileRefEnum;
|
|
|
import com.ozs.common.exception.ServiceException;
|
|
|
import com.ozs.common.utils.PageUtils;
|
|
@@ -21,7 +20,6 @@ import com.ozs.plan.doman.PlanQuarter;
|
|
|
import com.ozs.plan.doman.PlanYears;
|
|
|
import com.ozs.plan.doman.vo.requestVo.PlanQuarterStandardVo;
|
|
|
import com.ozs.plan.doman.vo.responseVo.PlanQuarterResponseVo;
|
|
|
-import com.ozs.plan.doman.vo.responseVo.PlanYearsResponseVo;
|
|
|
import com.ozs.plan.mapper.PlanQuarterMapper;
|
|
|
import com.ozs.plan.mapper.PlanYearsMapper;
|
|
|
import com.ozs.plan.service.PlanQuarterService;
|
|
@@ -35,6 +33,7 @@ import com.ozs.system.mapper.SysFileRefMapper;
|
|
|
import com.ozs.system.service.ISysDeptService;
|
|
|
import com.ozs.system.service.ISysDictTypeService;
|
|
|
import com.ozs.system.service.SysFileService;
|
|
|
+import com.sun.xml.internal.bind.util.Which;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -43,6 +42,8 @@ import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import javax.validation.Validator;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
@@ -100,7 +101,7 @@ public class PlanQuarterServiceImpl implements PlanQuarterService {
|
|
|
int num = 1;
|
|
|
int size = 200;
|
|
|
while (size == 200) {
|
|
|
- LambdaQueryWrapper<PlanQuarter> lw = new LambdaQueryWrapper<PlanQuarter>();
|
|
|
+ LambdaQueryWrapper<PlanQuarter> lw = new LambdaQueryWrapper<>();
|
|
|
if (!ObjectUtils.isEmpty(vo.getProjectName())) {
|
|
|
lw.like(PlanQuarter::getProjectName, vo.getProjectName());
|
|
|
}
|
|
@@ -120,7 +121,7 @@ public class PlanQuarterServiceImpl implements PlanQuarterService {
|
|
|
lw.le(PlanQuarter::getPlanDemandSubTime, vo.getEndTime());
|
|
|
}
|
|
|
lw.eq(PlanQuarter::getDelFlay, DataIsDelete.DataNOTDelete);
|
|
|
- Page<PlanQuarter> page = planQuarterMapper.selectPage(new Page<PlanQuarter>(num, size, false), lw);
|
|
|
+ Page<PlanQuarter> page = planQuarterMapper.selectPage(new Page<>(num, size, false), lw);
|
|
|
list.addAll(page.getRecords());
|
|
|
size = page.getRecords().size();
|
|
|
num++;
|
|
@@ -144,8 +145,7 @@ public class PlanQuarterServiceImpl implements PlanQuarterService {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- Page pages = PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), planQuarterList);
|
|
|
- return pages;
|
|
|
+ return PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), planQuarterList);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -339,7 +339,7 @@ public class PlanQuarterServiceImpl implements PlanQuarterService {
|
|
|
if (planQuarter.getProjectAttr().contains(",")) {
|
|
|
String[] split = planQuarter.getProjectAttr().split(",");
|
|
|
for (String s : split) {
|
|
|
- if (planQuarter.getProjectAttr().endsWith(s)) {
|
|
|
+ if (!planQuarter.getProjectAttr().endsWith(s)) {
|
|
|
builder.append(projectAttributes.get(s) + ",");
|
|
|
} else {
|
|
|
builder.append(projectAttributes.get(s));
|
|
@@ -356,14 +356,6 @@ public class PlanQuarterServiceImpl implements PlanQuarterService {
|
|
|
planQuarterMapper.insertPlanQuarter(planQuarter);
|
|
|
successNum++;
|
|
|
successMsg.append("*" + successNum + "、项目 " + planQuarter.getProjectName() + " 导入成功!");
|
|
|
- //} else if (isUpdateSupport) {
|
|
|
- // PlanQuarter quarter = plan.get(0);
|
|
|
- // BeanValidators.validateWithException(validator, planQuarter);
|
|
|
- // quarter.setCreateTime(new Date());
|
|
|
- // quarter.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
- // planQuarterMapper.updateById(quarter);
|
|
|
- // successNum++;
|
|
|
- // successMsg.append("<br/>" + successNum + "、项目 " + planQuarter.getProjectName() + " 更新成功");
|
|
|
} else {
|
|
|
failureNum++;
|
|
|
failureMsg.append(failureNum + "*项目 " + planQuarter.getProjectName() + " 已存在!/n");
|
|
@@ -386,28 +378,7 @@ public class PlanQuarterServiceImpl implements PlanQuarterService {
|
|
|
|
|
|
@Override
|
|
|
public AjaxResult commit(PlanQuarterStandardVo quarterStandardVo) {
|
|
|
- //PlanQuarter byId = PlanQuarterMapper.getById(quarterStandardVo.getPlanPracticalId());
|
|
|
- //BigDecimal evaluation = byId.getEvaluation();
|
|
|
- //BigDecimal threshold = new BigDecimal(0);
|
|
|
- ////获取各个项目类型设定的概算金额阈值
|
|
|
- //List<SysDictData> data = dictTypeService.selectDictDataByType("sys_over_limit_threshold");
|
|
|
- //HashMap<String, String> thresholdMap = new LinkedHashMap<>();
|
|
|
- ////各个类型的概算金额阈值
|
|
|
- //for (SysDictData dictData : data) {
|
|
|
- // // 类型----阈值
|
|
|
- // thresholdMap.put(dictData.getDictLabel(), dictData.getDictValue());
|
|
|
- //}
|
|
|
- ////项目类型
|
|
|
- //for (ProjectTypes value : ProjectTypes.values()) {
|
|
|
- // if (byId.getProjectType().equals(value.getCode())) {
|
|
|
- // threshold = BigDecimal.valueOf(Long.parseLong(thresholdMap.get(value.getInfo())));
|
|
|
- // }
|
|
|
- // break;
|
|
|
- //}
|
|
|
- //
|
|
|
- //if (evaluation.compareTo(threshold) == 1) {
|
|
|
- // //是超额项目
|
|
|
- //}
|
|
|
+
|
|
|
|
|
|
int commit = planQuarterMapper.commit(quarterStandardVo.getPlanPracticalId());
|
|
|
if (commit != 1) {
|
|
@@ -433,7 +404,7 @@ public class PlanQuarterServiceImpl implements PlanQuarterService {
|
|
|
BeanUtils.copyProperties(byId, demand);
|
|
|
demand.setPlanId(byId.getPlanPracticalId());
|
|
|
//同步到项目管理状态为需求待填制
|
|
|
- demand.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_FILL.getCode()));
|
|
|
+ demand.setProjectStatus(PmProjectStatus.DEMAND_WAIT_FILL.getCode());
|
|
|
demand.setCreateTime(new Date());
|
|
|
pmDemandMapper.insert(demand);
|
|
|
//计划附件也进行同步---查询年度计划附件后复制一份改为项目需求附件
|
|
@@ -585,10 +556,10 @@ public class PlanQuarterServiceImpl implements PlanQuarterService {
|
|
|
for (String s : split) {
|
|
|
for (Map.Entry<String, String> entry : projectAttributes.entrySet()) {
|
|
|
if (s.equals(entry.getValue())) {
|
|
|
- if (planQuarter.getProjectAttr().endsWith(s)) {
|
|
|
- builder.append(entry.getKey());
|
|
|
- } else {
|
|
|
+ if (!planQuarter.getProjectAttr().endsWith(s)) {
|
|
|
builder.append(entry.getKey() + ",");
|
|
|
+ } else {
|
|
|
+ builder.append(entry.getKey());
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -611,8 +582,65 @@ public class PlanQuarterServiceImpl implements PlanQuarterService {
|
|
|
}
|
|
|
}
|
|
|
BeanUtils.copyProperties(planQuarter, responseVo);
|
|
|
+
|
|
|
+ //获取季度计划各个季度提报时间的阈值
|
|
|
+ List<SysDictData> supTime = dictTypeService.selectDictDataByType("sys_quarterly_plan");
|
|
|
+ HashMap<String, String> thresholdMap = new LinkedHashMap<>();
|
|
|
+ //各个季度提报时间的阈值
|
|
|
+ for (SysDictData dictData : supTime) {
|
|
|
+ // 季度----阈值
|
|
|
+ thresholdMap.put(dictData.getDictLabel(), dictData.getDictValue());
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ responseVo.setTipsMessage(planQuarterGetTips(thresholdMap));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
list.add(responseVo);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据季度计划在各个季度提报时间的阈值进行提示
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String planQuarterGetTips(HashMap<String, String> thresholdMap) throws ParseException {
|
|
|
+ //提示信息:定义距离结束时间一周内提示
|
|
|
+ Integer remindTine = 1000 * 60 * 60 * 24 * 7; //提示语
|
|
|
+ String subTips = "";
|
|
|
+ //季度提报时间的结束时间阈值
|
|
|
+ Date thresholdTime = null;
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date = new Date();
|
|
|
+ for (QuarterEnum val : QuarterEnum.values()) {
|
|
|
+ if (val.getInfo().contains(date.getMonth() + "")) {
|
|
|
+ switch (val.getCode()) {
|
|
|
+ case "1":
|
|
|
+ thresholdTime = dateFormat.parse(thresholdMap.get("第一季度结束时间"));
|
|
|
+ case "2":
|
|
|
+ thresholdTime = dateFormat.parse(thresholdMap.get("第二季度结束时间"));
|
|
|
+ case "3":
|
|
|
+ thresholdTime = dateFormat.parse(thresholdMap.get("第三季度结束时间"));
|
|
|
+ case "4":
|
|
|
+ thresholdTime = dateFormat.parse(thresholdMap.get("第四季度结束时间"));
|
|
|
+ default:
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ double surplus = thresholdTime.getTime() - date.getTime();
|
|
|
+ //少于一周便提醒
|
|
|
+ if (surplus < remindTine && surplus > 0) {
|
|
|
+ //剩余天数(向上取整)
|
|
|
+ int i = new Double(Math.ceil(surplus / 1000 / 60 / 60 / 24)).intValue();
|
|
|
+ if (i > 0) {
|
|
|
+ subTips = "距离计划提报时间不足" + i + "天";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return subTips;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|