|
@@ -2,17 +2,11 @@ package com.jpsoft.supervision.modules.base.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
import com.jpsoft.supervision.modules.base.dto.IncidentAttachmentDTO;
|
|
import com.jpsoft.supervision.modules.base.dto.IncidentAttachmentDTO;
|
|
-import com.jpsoft.supervision.modules.base.entity.IncidentAttachment;
|
|
|
|
-import com.jpsoft.supervision.modules.base.entity.IncidentStep;
|
|
|
|
-import com.jpsoft.supervision.modules.base.entity.Organization;
|
|
|
|
-import com.jpsoft.supervision.modules.base.service.IncidentAttachmentService;
|
|
|
|
-import com.jpsoft.supervision.modules.base.service.IncidentStepService;
|
|
|
|
-import com.jpsoft.supervision.modules.base.service.OrganizationService;
|
|
|
|
|
|
+import com.jpsoft.supervision.modules.base.entity.*;
|
|
|
|
+import com.jpsoft.supervision.modules.base.service.*;
|
|
import com.jpsoft.supervision.modules.common.utils.PojoUtils;
|
|
import com.jpsoft.supervision.modules.common.utils.PojoUtils;
|
|
import com.jpsoft.supervision.modules.common.dto.Sort;
|
|
import com.jpsoft.supervision.modules.common.dto.Sort;
|
|
import com.jpsoft.supervision.modules.common.dto.MessageResult;
|
|
import com.jpsoft.supervision.modules.common.dto.MessageResult;
|
|
-import com.jpsoft.supervision.modules.base.entity.Incident;
|
|
|
|
-import com.jpsoft.supervision.modules.base.service.IncidentService;
|
|
|
|
import com.jpsoft.supervision.modules.sys.entity.DataDictionary;
|
|
import com.jpsoft.supervision.modules.sys.entity.DataDictionary;
|
|
import com.jpsoft.supervision.modules.sys.service.DataDictionaryService;
|
|
import com.jpsoft.supervision.modules.sys.service.DataDictionaryService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -44,6 +38,8 @@ public class IncidentController {
|
|
private DataDictionaryService dataDictionaryService;
|
|
private DataDictionaryService dataDictionaryService;
|
|
@Autowired
|
|
@Autowired
|
|
private OrganizationService organizationService;
|
|
private OrganizationService organizationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private PersonService personService;
|
|
|
|
|
|
@ApiOperation(value="创建空记录")
|
|
@ApiOperation(value="创建空记录")
|
|
@GetMapping("create")
|
|
@GetMapping("create")
|
|
@@ -178,6 +174,8 @@ public class IncidentController {
|
|
for(IncidentStep incidentStep : incidentStepList){
|
|
for(IncidentStep incidentStep : incidentStepList){
|
|
Organization organization = organizationService.get(incidentStep.getOrgId());
|
|
Organization organization = organizationService.get(incidentStep.getOrgId());
|
|
incidentStep.setOrgName(organization.getName());
|
|
incidentStep.setOrgName(organization.getName());
|
|
|
|
+ Person person = personService.get(incidentStep.getPersonId());
|
|
|
|
+ incidentStep.setPersonName(person.getName());
|
|
}
|
|
}
|
|
incident.setIncidentStepList(incidentStepList);
|
|
incident.setIncidentStepList(incidentStepList);
|
|
incident.setStepId(incidentStepList.get(0).getId());
|
|
incident.setStepId(incidentStepList.get(0).getId());
|
|
@@ -439,4 +437,68 @@ public class IncidentController {
|
|
|
|
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="列表")
|
|
|
|
+ @RequestMapping(value = "pageListPending",method = RequestMethod.POST)
|
|
|
|
+ public MessageResult<Map> pageListPending(
|
|
|
|
+ String title, String caseType,
|
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
|
+ @RequestAttribute String subject){
|
|
|
|
+
|
|
|
|
+ //当前用户ID
|
|
|
|
+ System.out.println(subject);
|
|
|
|
+
|
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("a.warn_time","asc"));
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(title)) {
|
|
|
|
+ searchParams.put("title","%" + title + "%");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(caseType)) {
|
|
|
|
+ searchParams.put("caseType",caseType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Page<Incident> page = incidentService.pageSearchPanding(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
+ for(Incident incident : page.getResult()){
|
|
|
|
+ DataDictionary dataDictionary = dataDictionaryService.findByCatalogNameAndValue("督办类型",incident.getCaseType());
|
|
|
|
+ if(dataDictionary != null)
|
|
|
|
+ incident.setCaseTypeName(dataDictionary.getName());
|
|
|
|
+ dataDictionary = dataDictionaryService.findByCatalogNameAndValue("督查事件步骤",incident.getIsFinished());
|
|
|
|
+ if(dataDictionary != null)
|
|
|
|
+ incident.setIsFinishedName(dataDictionary.getName());
|
|
|
|
+
|
|
|
|
+ List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
|
|
|
|
+ incident.setIncidentStepSize(incidentStepList.size());
|
|
|
|
+ incident.setStepWarnTime(incidentStepList.get(incidentStepList.size()-1).getWarnTime());
|
|
|
|
+ //报警灯
|
|
|
|
+ Date beginTime = new Date();
|
|
|
|
+ Date endTime = incident.getStepWarnTime();
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.setTime(beginTime);
|
|
|
|
+
|
|
|
|
+ if(beginTime.after(endTime)){
|
|
|
|
+ incident.setWarningLight("红");
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ calendar.add(Calendar.DATE, 3);
|
|
|
|
+ beginTime = calendar.getTime();
|
|
|
|
+ if(beginTime.after(endTime)){
|
|
|
|
+ incident.setWarningLight("黄");
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ incident.setWarningLight("绿");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
}
|
|
}
|