|
|
@@ -22,7 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service("gxResumptionService")
|
|
|
-public class ResumptionServiceImpl implements ResumptionService{
|
|
|
+public class ResumptionServiceImpl implements ResumptionService {
|
|
|
|
|
|
@Autowired
|
|
|
private ResumptionMapper resumptionMapper;
|
|
|
@@ -49,7 +49,7 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
public Map<String, List<ResumptionTaskListVo>> getTaskList(ResumptionTaskNewDto dto) {
|
|
|
|
|
|
Date dateTime = dto.getDateTime();
|
|
|
- if(dateTime == null){
|
|
|
+ if (dateTime == null) {
|
|
|
dateTime = new Date();
|
|
|
dto.setDateTime(dateTime);
|
|
|
}
|
|
|
@@ -59,7 +59,6 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
*/
|
|
|
|
|
|
|
|
|
-
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@@ -80,20 +79,20 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
* 2)获取计划对应的数据,组装数据
|
|
|
*/
|
|
|
DateHelper dateTime = new DateHelper(taskDetailVo.getTaskDate());
|
|
|
- int year =dateTime.getYear();
|
|
|
- int quarter =dateTime.getQuarter() ;
|
|
|
+ int year = dateTime.getYear();
|
|
|
+ int quarter = dateTime.getQuarter();
|
|
|
//履职状态:1 待履职,2 进行中,3 已完成,4 已过期
|
|
|
- Resumption resumption = resumptionMapper.findOneByTaskIdAndDate(taskDetailVo.getTaskId(), year,quarter);
|
|
|
+ Resumption resumption = resumptionMapper.findOneByTaskIdAndDate(taskDetailVo.getTaskId(), year, quarter);
|
|
|
Integer status = resumption.getStatus();
|
|
|
List<ResumptionPlanVo> resumptionPlanVos = new ArrayList<>();
|
|
|
boolean isExist = false;
|
|
|
- if(status == 1 || status == 4){
|
|
|
+ if (status == 1 || status == 4) {
|
|
|
//履职中待履职 和已过期的数据是没有保存过数据的只能根据计划获取
|
|
|
Long planId = resumption.getPlanId();
|
|
|
resumptionPlanVos = appPlanMapper.selectResumptionPlan(planId);
|
|
|
isExist = false;
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
resumptionPlanVos = resumptionMapper.selectResumptionPlan(taskDetailVo.getTaskId());
|
|
|
isExist = true;
|
|
|
}
|
|
|
@@ -115,10 +114,10 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
*/
|
|
|
Long taskId = taskDetailVo.getTaskId();
|
|
|
DateHelper dateTime = new DateHelper(taskDetailVo.getTaskDate());
|
|
|
- int year =dateTime.getYear();
|
|
|
- int quarter =dateTime.getQuarter() ;
|
|
|
+ int year = dateTime.getYear();
|
|
|
+ int quarter = dateTime.getQuarter();
|
|
|
//获取履职任务
|
|
|
- Resumption sysResumption = resumptionMapper.findOneByTaskIdAndDate(taskId,year,quarter);
|
|
|
+ Resumption sysResumption = resumptionMapper.findOneByTaskIdAndDate(taskId, year, quarter);
|
|
|
Long orgId = sysResumption.getOrgId();
|
|
|
|
|
|
sysResumption.setUpdateBy(SecurityUtils.getUsername());
|
|
|
@@ -126,18 +125,13 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
sysResumption.setSubmitTime(new Date());
|
|
|
sysResumption.setStatus(2);
|
|
|
|
|
|
- if(taskDetailVo.getSubType() == 2){
|
|
|
+ if (taskDetailVo.getSubType() == 2) {
|
|
|
if (sysResumption.getStatus() == 3) {
|
|
|
throw new RuntimeException("该任务已过期不能完成提交");
|
|
|
}
|
|
|
sysResumption.setStatus(3);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- resumptionMapper.updateById(sysResumption);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//删除之前的数据
|
|
|
appResumptionDataMapper.deleteByResumptionId(taskId);
|
|
|
appResumptionDataNfcMapper.deleteByResumptionId(taskId);
|
|
|
@@ -146,30 +140,31 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
//保存新的数据
|
|
|
AppResumptionData data = null;
|
|
|
List<ResumptionItemVo> checks = taskDetailVo.getChecks();
|
|
|
+ Integer exceptionCount = 0;
|
|
|
for (ResumptionItemVo check : checks) {
|
|
|
List<ResumptionPointVo> points = check.getPoints();
|
|
|
for (ResumptionPointVo point : points) {
|
|
|
- data = new AppResumptionData();
|
|
|
- data.setDataStatus(point.getDataStatus());
|
|
|
- data.setResumptionId(taskId);
|
|
|
- data.setAreaId(check.getAreaId());
|
|
|
- data.setItemId(point.getPointId());
|
|
|
- data.setRectificationDeadline(point.getRectificationDeadline());
|
|
|
- data.setResRemark(point.getResRemark());
|
|
|
- data.setResValue(point.getResValue());
|
|
|
- data.setSubmitTime(new Date());
|
|
|
- data.setResTime(new Date());
|
|
|
- data.setPlanId(sysResumption.getPlanId());
|
|
|
- data.setSubmitBy(SecurityUtils.getLoginUser().getUserid());
|
|
|
- data.setSubmitName(SecurityUtils.getUsername());
|
|
|
- if(taskDetailVo.getSubType() == 2){
|
|
|
- if(point.getDataStatus() == 1){
|
|
|
+ data = new AppResumptionData();
|
|
|
+ data.setDataStatus(point.getDataStatus());
|
|
|
+ data.setResumptionId(taskId);
|
|
|
+ data.setAreaId(check.getAreaId());
|
|
|
+ data.setItemId(point.getPointId());
|
|
|
+ data.setRectificationDeadline(point.getRectificationDeadline());
|
|
|
+ data.setResRemark(point.getResRemark());
|
|
|
+ data.setResValue(point.getResValue());
|
|
|
+ data.setSubmitTime(new Date());
|
|
|
+ data.setResTime(new Date());
|
|
|
+ data.setPlanId(sysResumption.getPlanId());
|
|
|
+ data.setSubmitBy(SecurityUtils.getLoginUser().getUserid());
|
|
|
+ data.setSubmitName(SecurityUtils.getUsername());
|
|
|
+ if (taskDetailVo.getSubType() == 2) {
|
|
|
+ if (point.getDataStatus() == 1) {
|
|
|
data.setDataStatus(2);
|
|
|
}
|
|
|
}
|
|
|
- appResumptionDataMapper.insert(data);
|
|
|
+ appResumptionDataMapper.insert(data);
|
|
|
|
|
|
- if(taskDetailVo.getSubType() == 2 && ObjectUtil.equal(point.getResValue(),1) ){
|
|
|
+ if (taskDetailVo.getSubType() == 2 && ObjectUtil.equal(point.getResValue(), 1)) {
|
|
|
SysOrg org = remoteOrgService.selectSysOrgById(sysResumption.getOrgId(), SecurityConstants.INNER);
|
|
|
Question question = Question.builder()
|
|
|
.srcTaskId(taskId)
|
|
|
@@ -192,6 +187,9 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
questionService.insertQuestion(question);
|
|
|
}
|
|
|
|
|
|
+ if (ObjectUtil.equal(point.getResValue(), 1)) {
|
|
|
+ exceptionCount++;
|
|
|
+ }
|
|
|
List<AppResumptionDataRemarkimg> imgs = point.getImgs();
|
|
|
for (AppResumptionDataRemarkimg img : imgs) {
|
|
|
img.setResumptionDataId(data.getId());
|
|
|
@@ -200,33 +198,36 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ sysResumption.setExceptionCount(exceptionCount);
|
|
|
|
|
|
List<ResumptionNFCVo> nfcs = taskDetailVo.getNfcs();
|
|
|
AppResumptionDataNfc dataNfc = null;
|
|
|
for (ResumptionNFCVo nfc : nfcs) {
|
|
|
- if(nfc.getStatus() == 0){
|
|
|
+ if (nfc.getStatus() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
dataNfc = new AppResumptionDataNfc();
|
|
|
dataNfc.setResumptionId(taskId);
|
|
|
dataNfc.setNfcId(nfc.getNfcId());
|
|
|
dataNfc.setPointId(nfc.getAreaId());
|
|
|
- dataNfc.setSubmitTime(new Date());
|
|
|
dataNfc.setImg(nfc.getImg());
|
|
|
dataNfc.setScanMethod(nfc.getScanMethod());
|
|
|
dataNfc.setStatus(nfc.getStatus());
|
|
|
+ dataNfc.setSubmitTime(ObjectUtil.isNull(nfc.getSubmitTime()) ? new Date() : nfc.getSubmitTime());
|
|
|
+ dataNfc.setSubmitBy(nfc.getSubmitBy());
|
|
|
appResumptionDataNfcMapper.insert(dataNfc);
|
|
|
}
|
|
|
|
|
|
+ resumptionMapper.updateById(sysResumption);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 组装到前端的数据
|
|
|
+ *
|
|
|
* @param resumptionPlanVos
|
|
|
* @return
|
|
|
*/
|
|
|
- private ResumptionTaskDetailVo assemblyData(List<ResumptionPlanVo> resumptionPlanVos, boolean isExist, Resumption resumption){
|
|
|
+ private ResumptionTaskDetailVo assemblyData(List<ResumptionPlanVo> resumptionPlanVos, boolean isExist, Resumption resumption) {
|
|
|
|
|
|
ResumptionTaskDetailVo taskVo = new ResumptionTaskDetailVo();
|
|
|
taskVo.setTaskId(resumption.getId());
|
|
|
@@ -239,8 +240,8 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
* 2.根据检查内容获取检查图片
|
|
|
* 3.构建返回到前端的数据
|
|
|
*/
|
|
|
- Map<Long,List<AppResumptionDataRemarkimg>> imgMap = new HashMap<>();
|
|
|
- if(isExist){
|
|
|
+ Map<Long, List<AppResumptionDataRemarkimg>> imgMap = new HashMap<>();
|
|
|
+ if (isExist) {
|
|
|
//数据存在,需要获取任务的所有图片信息
|
|
|
QueryWrapper<AppResumptionDataRemarkimg> qw = new QueryWrapper<>();
|
|
|
qw.lambda().eq(AppResumptionDataRemarkimg::getResumptionId, resumption.getId());
|
|
|
@@ -248,7 +249,7 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
for (AppResumptionDataRemarkimg img : imgs) {
|
|
|
Long resumptionDataId = img.getResumptionDataId();
|
|
|
List<AppResumptionDataRemarkimg> paths = imgMap.get(resumptionDataId);
|
|
|
- if(paths == null){
|
|
|
+ if (paths == null) {
|
|
|
paths = new ArrayList<>();
|
|
|
}
|
|
|
paths.add(img);
|
|
|
@@ -257,24 +258,24 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
}
|
|
|
Integer yesPointNum = 0;
|
|
|
Integer noPointNum = 0;
|
|
|
- Map<Long,ResumptionItemVo> itemMap = new HashMap<>();
|
|
|
- Map<Long,Map<String,Integer>> itComMap = new HashMap<>();
|
|
|
+ Map<Long, ResumptionItemVo> itemMap = new HashMap<>();
|
|
|
+ Map<Long, Map<String, Integer>> itComMap = new HashMap<>();
|
|
|
for (ResumptionPlanVo vo : resumptionPlanVos) {
|
|
|
- if(vo.getDataStatus() == 1){
|
|
|
+ if (vo.getDataStatus() == 1) {
|
|
|
noPointNum++;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
yesPointNum++;
|
|
|
}
|
|
|
|
|
|
- if(isExist){
|
|
|
+ if (isExist) {
|
|
|
//如果存在数据则设置图片啊
|
|
|
List<AppResumptionDataRemarkimg> imgs = imgMap.get(vo.getDataId());
|
|
|
- if(imgs != null && imgs.size() > 0){
|
|
|
+ if (imgs != null && imgs.size() > 0) {
|
|
|
vo.getImgs().addAll(imgs);
|
|
|
}
|
|
|
}
|
|
|
ResumptionItemVo resumptionItemVo = itemMap.get(vo.getItemId());
|
|
|
- if(resumptionItemVo == null){
|
|
|
+ if (resumptionItemVo == null) {
|
|
|
resumptionItemVo = new ResumptionItemVo();
|
|
|
}
|
|
|
resumptionItemVo.setItemName(vo.getItemName());
|
|
|
@@ -287,44 +288,44 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
pointVo.setImgs(vo.getImgs());
|
|
|
pointVo.setPointId(vo.getPointId());
|
|
|
pointVo.setResRemark(vo.getResRemark());
|
|
|
- if(vo.getResValue() == null){
|
|
|
+ if (vo.getResValue() == null) {
|
|
|
pointVo.setResValue(0);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
pointVo.setResValue(vo.getResValue());
|
|
|
}
|
|
|
pointVo.setRectificationDeadline(vo.getRectificationDeadline());
|
|
|
pointVo.setDataStatus(vo.getDataStatus());
|
|
|
resumptionItemVo.getPoints().add(pointVo);
|
|
|
Map<String, Integer> itCom = itComMap.get(vo.getAreaId());
|
|
|
- if(itCom == null){
|
|
|
+ if (itCom == null) {
|
|
|
itCom = new HashMap<>();
|
|
|
itCom.put("total", 1);
|
|
|
- if(pointVo.getDataStatus() == 1){
|
|
|
- itCom.put("yes",0);
|
|
|
- }else{
|
|
|
- itCom.put("yes",1);
|
|
|
+ if (pointVo.getDataStatus() == 1) {
|
|
|
+ itCom.put("yes", 0);
|
|
|
+ } else {
|
|
|
+ itCom.put("yes", 1);
|
|
|
}
|
|
|
- itComMap.put(vo.getAreaId(),itCom);
|
|
|
- }else{
|
|
|
- itCom.put("total",itCom.get("total") + 1);
|
|
|
- if(pointVo.getDataStatus() == 2){
|
|
|
- itCom.put("yes",itCom.get("yes") + 1);
|
|
|
+ itComMap.put(vo.getAreaId(), itCom);
|
|
|
+ } else {
|
|
|
+ itCom.put("total", itCom.get("total") + 1);
|
|
|
+ if (pointVo.getDataStatus() == 2) {
|
|
|
+ itCom.put("yes", itCom.get("yes") + 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- itemMap.put(vo.getItemId(),resumptionItemVo);
|
|
|
+ itemMap.put(vo.getItemId(), resumptionItemVo);
|
|
|
}
|
|
|
|
|
|
Map<Long, AreaResumptionVo> map = new HashMap<>();
|
|
|
List<ResumptionItemVo> items = new ArrayList<>();
|
|
|
- for (Map.Entry<Long, ResumptionItemVo> entry: itemMap.entrySet()) {
|
|
|
+ for (Map.Entry<Long, ResumptionItemVo> entry : itemMap.entrySet()) {
|
|
|
ResumptionItemVo itemVo = entry.getValue();
|
|
|
AreaResumptionVo areaData = map.get(itemVo.getAreaId());
|
|
|
- if(areaData == null){
|
|
|
+ if (areaData == null) {
|
|
|
areaData = new AreaResumptionVo();
|
|
|
areaData.setAreaId(itemVo.getAreaId());
|
|
|
areaData.setAreaName(itemVo.getAreaName());
|
|
|
- map.put(itemVo.getAreaId(),areaData);
|
|
|
+ map.put(itemVo.getAreaId(), areaData);
|
|
|
}
|
|
|
items.add(itemVo);
|
|
|
}
|
|
|
@@ -335,7 +336,7 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
|
|
|
List<ResumptionNFCVo> nfcs = new ArrayList<>();
|
|
|
List<AreaResumptionVo> areas = new ArrayList<>();
|
|
|
- for (Map.Entry<Long, AreaResumptionVo> entry: map.entrySet()) {
|
|
|
+ for (Map.Entry<Long, AreaResumptionVo> entry : map.entrySet()) {
|
|
|
AreaResumptionVo vo = entry.getValue();
|
|
|
Long areaId = entry.getKey();
|
|
|
//获取每个区域下的nfc
|
|
|
@@ -343,24 +344,24 @@ public class ResumptionServiceImpl implements ResumptionService{
|
|
|
for (ResumptionNFCVo resumptionNFCVo : resumptionNFCVos) {
|
|
|
Integer status = resumptionNFCVo.getStatus();
|
|
|
Map<String, Integer> com = itComMap.get(resumptionNFCVo.getAreaId());
|
|
|
- com.put("total",com.get("total") + 1);
|
|
|
- if(status == 0){
|
|
|
+ com.put("total", com.get("total") + 1);
|
|
|
+ if (status == 0) {
|
|
|
noNFC++;
|
|
|
continue;
|
|
|
}
|
|
|
- com.put("yes",com.get("yes") + 1);
|
|
|
+ com.put("yes", com.get("yes") + 1);
|
|
|
yesNFC++;
|
|
|
}
|
|
|
nfcs.addAll(resumptionNFCVos);
|
|
|
Map<String, Integer> com = itComMap.get(areaId);
|
|
|
Integer total = com.get("total");
|
|
|
Integer yes = com.get("yes");
|
|
|
- if(total.equals(yes)){
|
|
|
+ if (total.equals(yes)) {
|
|
|
//总数等于处理数
|
|
|
vo.setAreaStatus("1");
|
|
|
- }else if(yes > 0){
|
|
|
+ } else if (yes > 0) {
|
|
|
vo.setAreaStatus("2");
|
|
|
- }else if(yes == 0){
|
|
|
+ } else if (yes == 0) {
|
|
|
vo.setAreaStatus("0");
|
|
|
}
|
|
|
areas.add(vo);
|