|
@@ -7,8 +7,11 @@ import com.jpsoft.excellent.modules.base.service.*;
|
|
|
import com.jpsoft.excellent.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.excellent.modules.common.dto.Sort;
|
|
|
import com.jpsoft.excellent.modules.sys.entity.DataDictionary;
|
|
|
+import com.jpsoft.excellent.modules.sys.entity.Role;
|
|
|
+import com.jpsoft.excellent.modules.sys.entity.User;
|
|
|
import com.jpsoft.excellent.modules.sys.service.DataDictionaryService;
|
|
|
import com.jpsoft.excellent.modules.sys.service.UserRoleService;
|
|
|
+import com.jpsoft.excellent.modules.sys.service.UserService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -24,308 +27,246 @@ import java.util.*;
|
|
|
@RequestMapping("/mobile/incidentApi")
|
|
|
@Api(description = "督查督办移动端")
|
|
|
public class IncidentApiController {
|
|
|
-// private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IncidentService incidentService;
|
|
|
-// @Autowired
|
|
|
-// private IncidentAttachmentService incidentAttachmentService;
|
|
|
-// @Autowired
|
|
|
-// private IncidentStepService incidentStepService;
|
|
|
-// @Autowired
|
|
|
-// private DataDictionaryService dataDictionaryService;
|
|
|
-// @Autowired
|
|
|
-// private OrganizationService organizationService;
|
|
|
-// @Autowired
|
|
|
-// private PersonService personService;
|
|
|
-// @Autowired
|
|
|
-// private UserRoleService userRoleService;
|
|
|
-//
|
|
|
-// @ApiOperation(value="列表")
|
|
|
-// @RequestMapping(value = "pageListPending",method = RequestMethod.POST)
|
|
|
-// public List<Map> pageListPending(String title, String caseType,@RequestAttribute String subject){
|
|
|
-// List<Map> msgResult = new ArrayList<>();
|
|
|
-//
|
|
|
-// Map<String,Object> searchParams = new HashMap<>();
|
|
|
-//// searchParams.put("createBy",subject);
|
|
|
-//
|
|
|
-// List<Sort> sortList = new ArrayList<>();
|
|
|
-// sortList.add(new Sort("a.warn_time","asc"));
|
|
|
-//
|
|
|
-//// List<Role> roleList = userRoleService.findRoleByUserId(subject);
|
|
|
-//// for(Role role : roleList) {
|
|
|
-//// if("8d4dd9ac-dcf4-4178-885c-fd309f4be8f6".equals(role.getId()))
|
|
|
-//// searchParams.put("createBy", null);
|
|
|
-//// }
|
|
|
-//// if (StringUtils.isNotEmpty(title)) {
|
|
|
-//// searchParams.put("title","%" + title + "%");
|
|
|
-//// }
|
|
|
-//// if (StringUtils.isNotEmpty(caseType)) {
|
|
|
-//// searchParams.put("caseType",caseType);
|
|
|
-//// }
|
|
|
-//
|
|
|
-// Page<Incident> page = incidentService.pageSearchPanding(searchParams,1,10000,false,sortList);
|
|
|
-// for(Incident incident : page.getResult()){
|
|
|
-// Map<String,Object> map = new HashMap<>();
|
|
|
-// map.put("id",incident.getId());
|
|
|
-// map.put("title",incident.getTitle());
|
|
|
-//
|
|
|
-// DataDictionary dataDictionary = new DataDictionary();
|
|
|
-// dataDictionary = dataDictionaryService.findByCatalogNameAndValue("督办类型",incident.getCaseType());
|
|
|
-// if(dataDictionary != null)
|
|
|
-// map.put("caseTypeName",dataDictionary.getName());
|
|
|
-// dataDictionary = dataDictionaryService.findByCatalogNameAndValue("督查事件步骤",incident.getIsFinished());
|
|
|
-// if(dataDictionary != null)
|
|
|
-// map.put("isFinishedName",dataDictionary.getName());
|
|
|
-//
|
|
|
-// List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
|
|
|
-// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-// map.put("lastStepTime",simpleDateFormat.format(incidentStepList.get(incidentStepList.size()-1).getCreateTime()));
|
|
|
-// List<String> personNameList = new ArrayList<>();
|
|
|
-// String[] personIds = incidentStepList.get(incidentStepList.size()-1).getPersonId().split(",");
|
|
|
-// for(String personId : personIds) {
|
|
|
-// Person person = personService.get(personId);
|
|
|
-// if (person != null)
|
|
|
-// personNameList.add(person.getName());
|
|
|
-// }
|
|
|
-// map.put("lastStepPersonName", StringUtils.join(personNameList.toArray(), " "));
|
|
|
-//
|
|
|
-// //报警灯
|
|
|
-// Date currentTime = new Date();
|
|
|
-// Date warnTime = incidentStepList.get(incidentStepList.size()-1).getWarnTime();
|
|
|
-// Date allotedTime = incidentStepList.get(incidentStepList.size()-1).getAllotedTime();
|
|
|
-//
|
|
|
-// if(currentTime.before(warnTime)){
|
|
|
-// map.put("warningLight","green-line");
|
|
|
-// }
|
|
|
-// else if(currentTime.after(allotedTime)){
|
|
|
-// map.put("warningLight","red-line");
|
|
|
-// }
|
|
|
-// else{
|
|
|
-// map.put("warningLight","yellow-line");
|
|
|
-// }
|
|
|
-//
|
|
|
-// msgResult.add(map);
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IncidentService incidentService;
|
|
|
+ @Autowired
|
|
|
+ private IncidentAttachmentService incidentAttachmentService;
|
|
|
+ @Autowired
|
|
|
+ private IncidentStepService incidentStepService;
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationService organizationService;
|
|
|
+ @Autowired
|
|
|
+ private PersonService personService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private UserRoleService userRoleService;
|
|
|
+
|
|
|
+ @ApiOperation(value="列表")
|
|
|
+ @RequestMapping(value = "pageListPending",method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> pageListPending(@RequestAttribute String subject){
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ searchParams.put("isFinished", "1");
|
|
|
+ searchParams.put("createBy", subject);
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("batch_","asc"));
|
|
|
+ sortList.add(new Sort("serial_no","asc"));
|
|
|
+
|
|
|
+ List<Role> roleList = userRoleService.findRoleByUserId(subject);
|
|
|
+ for(Role role : roleList) {
|
|
|
+ if("8d4dd9ac-dcf4-4178-885c-fd309f4be8f6".equals(role.getId()))
|
|
|
+ searchParams.put("createBy", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ //搜索条件
|
|
|
+// if (StringUtils.isNotEmpty(batch)) {
|
|
|
+// searchParams.put("batch","%" + batch + "%");
|
|
|
// }
|
|
|
-//
|
|
|
-// return msgResult;
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value="获取信息")
|
|
|
-// @GetMapping("edit/{id}")
|
|
|
-// public MessageResult<Incident> edit(@PathVariable("id") String id){
|
|
|
-// MessageResult<Incident> msgResult = new MessageResult<>();
|
|
|
-//
|
|
|
-// try {
|
|
|
-// //督办事件
|
|
|
-// Incident incident = incidentService.get(id);
|
|
|
-// DataDictionary dataDictionary = dataDictionaryService.findByCatalogNameAndValue("督办类型",incident.getCaseType());
|
|
|
-// if(dataDictionary != null)
|
|
|
-// incident.setCaseTypeName(dataDictionary.getName());
|
|
|
-// dataDictionary = dataDictionaryService.findByCatalogNameAndValue("领导批示类型",incident.getInstructionsType());
|
|
|
-// if(dataDictionary != null)
|
|
|
-// incident.setInstructionsName(dataDictionary.getName());
|
|
|
-// dataDictionary = dataDictionaryService.findByCatalogNameAndValue("督查事件步骤",incident.getIsFinished());
|
|
|
-// if(dataDictionary != null)
|
|
|
-// incident.setIsFinishedName(dataDictionary.getName());
|
|
|
-// //附件列表
|
|
|
-// List<IncidentAttachment> incidentAttachmentList1 = incidentAttachmentService.findListByIncidentId(id,"1");
|
|
|
-// List<IncidentAttachmentDTO> incidentAttachmentDTOList1 = new ArrayList<>();
|
|
|
-// for(IncidentAttachment incidentAttachment : incidentAttachmentList1){
|
|
|
-// IncidentAttachmentDTO incidentAttachmentDTO = new IncidentAttachmentDTO();
|
|
|
-// incidentAttachmentDTO.setName(incidentAttachment.getAttachmentTitle());
|
|
|
-// incidentAttachmentDTO.setUrl(incidentAttachment.getAttachmentUrl());
|
|
|
-// incidentAttachmentDTOList1.add(incidentAttachmentDTO);
|
|
|
-// }
|
|
|
-// incident.setAttList(incidentAttachmentDTOList1);
|
|
|
-// //图片列表
|
|
|
-// List<IncidentAttachment> incidentAttachmentList2 = incidentAttachmentService.findListByIncidentId(id,"2");
|
|
|
-// List<IncidentAttachmentDTO> incidentAttachmentDTOList2 = new ArrayList<>();
|
|
|
-// String[] picUrlList = new String[incidentAttachmentList2.size()];
|
|
|
-// for(int i=0;i<incidentAttachmentList2.size();i++){
|
|
|
-// IncidentAttachment incidentAttachment = incidentAttachmentList2.get(i);
|
|
|
-// IncidentAttachmentDTO incidentAttachmentDTO = new IncidentAttachmentDTO();
|
|
|
-// incidentAttachmentDTO.setName(incidentAttachment.getAttachmentTitle());
|
|
|
-// incidentAttachmentDTO.setUrl(incidentAttachment.getAttachmentUrl());
|
|
|
-// incidentAttachmentDTOList2.add(incidentAttachmentDTO);
|
|
|
-// picUrlList[i] = incidentAttachment.getAttachmentUrl();
|
|
|
-// }
|
|
|
-// incident.setPicList(incidentAttachmentDTOList2);
|
|
|
-// incident.setPicUrlList(picUrlList);
|
|
|
-// //首次步进
|
|
|
-// List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(id);
|
|
|
-// if(incidentStepList.size() > 0) {
|
|
|
-// for(IncidentStep incidentStep : incidentStepList){
|
|
|
-// List<String> orgNames = new ArrayList<>();
|
|
|
-// String[] orgIds = incidentStep.getOrgId().split(",");
|
|
|
-// for(String orgId : orgIds) {
|
|
|
-// Organization organization = organizationService.get(orgId);
|
|
|
-// orgNames.add(organization.getName());
|
|
|
-// }
|
|
|
-// incidentStep.setOrgName(String.join(",", orgNames));
|
|
|
-//
|
|
|
-// List<String> personNames = new ArrayList<>();
|
|
|
-// String[] personIds = incidentStep.getPersonId().split(",");
|
|
|
-// for(String personId : personIds) {
|
|
|
-// Person person = personService.get(personId);
|
|
|
-// personNames.add(person.getName());
|
|
|
-// }
|
|
|
-// incidentStep.setPersonName(String.join(",", personNames));
|
|
|
-// }
|
|
|
-// incident.setIncidentStepList(incidentStepList);
|
|
|
-// incident.setStepId(incidentStepList.get(0).getId());
|
|
|
-// incident.setStepOrgId(incidentStepList.get(0).getOrgId());
|
|
|
-// incident.setStepPersonId(incidentStepList.get(0).getPersonId());
|
|
|
-// incident.setStepWarnTime(incidentStepList.get(incidentStepList.size()-1).getWarnTime());
|
|
|
-// incident.setStepContent(incidentStepList.get(0).getContent());
|
|
|
-//
|
|
|
-// List<String> orgNames = new ArrayList<>();
|
|
|
-// String[] orgIds = incident.getStepOrgId().split(",");
|
|
|
-// for(String orgId : orgIds) {
|
|
|
-// Organization organization = organizationService.get(orgId);
|
|
|
-// orgNames.add(organization.getName());
|
|
|
-// }
|
|
|
-// incident.setStepOrgName(String.join(",", orgNames));
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (incident != null) {
|
|
|
-// msgResult.setResult(true);
|
|
|
-// msgResult.setData(incident);
|
|
|
-// } else {
|
|
|
-// msgResult.setResult(false);
|
|
|
-// msgResult.setMessage("数据库不存在该记录!");
|
|
|
-// }
|
|
|
+// if (StringUtils.isNotEmpty(serialNo)) {
|
|
|
+// searchParams.put("serialNo","%" + serialNo + "%");
|
|
|
// }
|
|
|
-// catch(Exception ex){
|
|
|
-// logger.error(ex.getMessage(),ex);
|
|
|
-//
|
|
|
-// msgResult.setResult(false);
|
|
|
-// msgResult.setMessage(ex.getMessage());
|
|
|
+// if (StringUtils.isNotEmpty(complainant)) {
|
|
|
+// searchParams.put("complainant","%" + complainant + "%");
|
|
|
// }
|
|
|
-//
|
|
|
-// return msgResult;
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value="督办处置")
|
|
|
-// @RequestMapping(value = "nextStep",method = RequestMethod.POST)
|
|
|
-// public MessageResult<Incident> nextStep(String id, String content, String orgId, String personId, String stepWarnTime, String subWayType, @RequestAttribute String subject){
|
|
|
-// MessageResult<Incident> msgResult = new MessageResult<>();
|
|
|
-//
|
|
|
-// try {
|
|
|
-// //更新当前最后一条的督办记录的处置记录
|
|
|
-// List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(id);
|
|
|
-// IncidentStep incidentStep = incidentStepList.get(incidentStepList.size()-1);
|
|
|
-// incidentStep.setContent(content);
|
|
|
-// incidentStep.setWarnType(false);
|
|
|
-// incidentStep.setUpdateBy(subject);
|
|
|
-// incidentStep.setUpdateTime(new Date());
|
|
|
-// incidentStepService.update(incidentStep);
|
|
|
-//
|
|
|
-// if(subWayType.equals("0")){
|
|
|
-// //督办事件办结
|
|
|
-// Incident incident = incidentService.get(id);
|
|
|
-// incident.setIsFinished("0");
|
|
|
-// incident.setUpdateBy(subject);
|
|
|
-// incident.setUpdateTime(new Date());
|
|
|
-// incidentService.update(incident);
|
|
|
-// }
|
|
|
-// else{
|
|
|
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-// //督办事件进入下一步
|
|
|
-// IncidentStep incidentStepNext = new IncidentStep();
|
|
|
-// incidentStepNext.setId(UUID.randomUUID().toString());
|
|
|
-// incidentStepNext.setIncidentId(id);
|
|
|
-// incidentStepNext.setOrgId(orgId);
|
|
|
-// incidentStepNext.setPersonId(personId);
|
|
|
-// incidentStepNext.setWarnTime(sdf.parse(stepWarnTime));
|
|
|
-// incidentStepNext.setWarnType(true);
|
|
|
-// incidentStepNext.setCreateBy(subject);
|
|
|
-// incidentStepNext.setCreateTime(new Date());
|
|
|
-// incidentStepService.insert(incidentStepNext);
|
|
|
-// }
|
|
|
-//
|
|
|
-// msgResult.setResult(true);
|
|
|
+// if (StringUtils.isNotEmpty(complainantPhone)) {
|
|
|
+// searchParams.put("complainantPhone","%" + complainantPhone + "%");
|
|
|
// }
|
|
|
-// catch(Exception ex){
|
|
|
-// logger.error(ex.getMessage(),ex);
|
|
|
-//
|
|
|
-// msgResult.setResult(false);
|
|
|
-// msgResult.setMessage(ex.getMessage());
|
|
|
+// if (StringUtils.isNotEmpty(areaId)) {
|
|
|
+// searchParams.put("areaId",areaId);
|
|
|
// }
|
|
|
-//
|
|
|
-// return msgResult;
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value="督办类型数量")
|
|
|
-// @RequestMapping(value = "countByCaseType",method = RequestMethod.POST)
|
|
|
-// public MessageResult<Map> countByCaseType(@RequestAttribute String subject){
|
|
|
-// MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
-// Map<String, Object> map = new HashMap<>();
|
|
|
-//
|
|
|
-// int total = 0;
|
|
|
-// List<DataDictionary> dataDictionaryList = dataDictionaryService.findByCatalogName("督办类型");
|
|
|
-// for(DataDictionary dataDictionary : dataDictionaryList) {
|
|
|
-// Map<String, Object> searchParams = new HashMap<>();
|
|
|
-//// searchParams.put("createBy",subject);
|
|
|
-// searchParams.put("caseType",dataDictionary.getValue());
|
|
|
-// List<Sort> sortList = new ArrayList<>();
|
|
|
-// sortList.add(new Sort("a.warn_time", "asc"));
|
|
|
-// Page<Incident> page = incidentService.pageSearchPanding(searchParams, 1, 10000, false, sortList);
|
|
|
-// map.put("item" + dataDictionary.getValue(),page.getResult().size());
|
|
|
-// total += page.getResult().size();
|
|
|
+// if (StringUtils.isNotEmpty(specialClassId)) {
|
|
|
+// searchParams.put("specialClassId","%"+specialClassId+"%");
|
|
|
// }
|
|
|
-// map.put("total", total);
|
|
|
-//
|
|
|
-// msgResult.setResult(true);
|
|
|
-// msgResult.setData(map);
|
|
|
-//
|
|
|
-// return msgResult;
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value="提醒类型数量")
|
|
|
-// @RequestMapping(value = "countByWarningLight",method = RequestMethod.POST)
|
|
|
-// public MessageResult<Map> countByWarningLight(@RequestAttribute String subject){
|
|
|
-// MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
-// Map<String, Object> map = new HashMap<>();
|
|
|
-// int intDanger = 0;
|
|
|
-// int intWarning = 0;
|
|
|
-// int intSafety = 0;
|
|
|
-// int total = 0;
|
|
|
-//
|
|
|
-// Map<String,Object> searchParams = new HashMap<>();
|
|
|
-//// searchParams.put("createBy",subject);
|
|
|
-// List<Sort> sortList = new ArrayList<>();
|
|
|
-// sortList.add(new Sort("a.warn_time","asc"));
|
|
|
-//
|
|
|
-// Page<Incident> page = incidentService.pageSearchPanding(searchParams,1,10000,false,sortList);
|
|
|
-// total = page.size();
|
|
|
-// for(Incident incident : page.getResult()){
|
|
|
-// List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
|
|
|
-// incident.setStepWarnTime(incidentStepList.get(incidentStepList.size()-1).getWarnTime());
|
|
|
-// //报警灯
|
|
|
-// Date currentTime = new Date();
|
|
|
-// Date warnTime = incidentStepList.get(incidentStepList.size()-1).getWarnTime();
|
|
|
-// Date allotedTime = incidentStepList.get(incidentStepList.size()-1).getAllotedTime();
|
|
|
-//
|
|
|
-// if(currentTime.before(warnTime)){
|
|
|
-// intSafety++;
|
|
|
-// }
|
|
|
-// else if(currentTime.after(allotedTime)){
|
|
|
-// intDanger++;
|
|
|
-// }
|
|
|
-// else{
|
|
|
-// intWarning++;
|
|
|
-// }
|
|
|
+// if (StringUtils.isNotEmpty(isFinished)) {
|
|
|
+// searchParams.put("isFinished",isFinished);
|
|
|
// }
|
|
|
-//
|
|
|
-// map.put("intDanger",intDanger);
|
|
|
-// map.put("intWarning",intWarning);
|
|
|
-// map.put("intSafety",intSafety);
|
|
|
-// map.put("total",total);
|
|
|
-//
|
|
|
-// msgResult.setResult(true);
|
|
|
-// msgResult.setData(map);
|
|
|
-//
|
|
|
-// return msgResult;
|
|
|
-// }
|
|
|
+
|
|
|
+ Integer green = 0;
|
|
|
+ Integer yellow = 0;
|
|
|
+ Integer red = 0;
|
|
|
+ Page<Incident> page = incidentService.pageSearch(searchParams,1,1000,false,sortList);
|
|
|
+ for(Incident incident : page.getResult()){
|
|
|
+ List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
|
|
|
+ incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
|
|
|
+
|
|
|
+ List<String> personNames = new ArrayList<>();
|
|
|
+ String[] orgIds = incident.getLastStep().getOrgId().split(",");
|
|
|
+ for(String orgId : orgIds) {
|
|
|
+ List<Person> personList = personService.findListByOrgId(orgId);
|
|
|
+ for(Person person : personList) {
|
|
|
+ personNames.add(person.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ incident.getLastStep().setPersonName(String.join(",", personNames));
|
|
|
+
|
|
|
+ //报警灯
|
|
|
+ Date currentTime = new Date();
|
|
|
+ Date warnTime = incident.getLastStep().getWarnDate1();
|
|
|
+ Date allotedTime = incident.getLastStep().getAllotedDate();
|
|
|
+
|
|
|
+ if(currentTime.before(warnTime)){
|
|
|
+ incident.setWarningLight("green-line");
|
|
|
+ green++;
|
|
|
+ }
|
|
|
+ else if(currentTime.after(allotedTime)){
|
|
|
+ incident.setWarningLight("red-line");
|
|
|
+ red++;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ incident.setWarningLight("yellow-line");
|
|
|
+ yellow++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("green",green);
|
|
|
+ map.put("yellow",yellow);
|
|
|
+ map.put("red",red);
|
|
|
+ map.put("list",page.getResult());
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(map);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="获取信息")
|
|
|
+ @GetMapping("edit/{id}")
|
|
|
+ public MessageResult<Incident> edit(@PathVariable("id") String id){
|
|
|
+ MessageResult<Incident> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //督办事件
|
|
|
+ Incident incident = incidentService.get(id);
|
|
|
+ List<String> nameList = new ArrayList<>();
|
|
|
+ String[] specialClassIds = incident.getSpecialClassId().split(",");
|
|
|
+ for(String specialClassId : specialClassIds){
|
|
|
+ DataDictionary dataDictionary = dataDictionaryService.findByCatalogNameAndValue("工作专班",specialClassId);
|
|
|
+ nameList.add(dataDictionary.getName());
|
|
|
+ }
|
|
|
+ incident.setSpecialClassName(String.join(",", nameList));
|
|
|
+ incident.setNewStep(new IncidentStep());
|
|
|
+ //附件列表
|
|
|
+ List<IncidentAttachment> incidentAttachmentList1 = incidentAttachmentService.findListByIncidentId(id,"1");
|
|
|
+ List<IncidentAttachmentDTO> incidentAttachmentDTOList1 = new ArrayList<>();
|
|
|
+ for(IncidentAttachment incidentAttachment : incidentAttachmentList1){
|
|
|
+ IncidentAttachmentDTO incidentAttachmentDTO = new IncidentAttachmentDTO();
|
|
|
+ incidentAttachmentDTO.setName(incidentAttachment.getAttachmentTitle());
|
|
|
+ incidentAttachmentDTO.setUrl(incidentAttachment.getAttachmentUrl());
|
|
|
+ incidentAttachmentDTOList1.add(incidentAttachmentDTO);
|
|
|
+ }
|
|
|
+ incident.setAttList(incidentAttachmentDTOList1);
|
|
|
+ //图片列表
|
|
|
+ List<IncidentAttachment> incidentAttachmentList2 = incidentAttachmentService.findListByIncidentId(id,"2");
|
|
|
+ List<IncidentAttachmentDTO> incidentAttachmentDTOList2 = new ArrayList<>();
|
|
|
+ String[] picUrlList = new String[incidentAttachmentList2.size()];
|
|
|
+ for(int i=0;i<incidentAttachmentList2.size();i++){
|
|
|
+ IncidentAttachment incidentAttachment = incidentAttachmentList2.get(i);
|
|
|
+ IncidentAttachmentDTO incidentAttachmentDTO = new IncidentAttachmentDTO();
|
|
|
+ incidentAttachmentDTO.setName(incidentAttachment.getAttachmentTitle());
|
|
|
+ incidentAttachmentDTO.setUrl(incidentAttachment.getAttachmentUrl());
|
|
|
+ incidentAttachmentDTOList2.add(incidentAttachmentDTO);
|
|
|
+ picUrlList[i] = incidentAttachment.getAttachmentUrl();
|
|
|
+ }
|
|
|
+ incident.setPicList(incidentAttachmentDTOList2);
|
|
|
+ incident.setPicUrlList(picUrlList);
|
|
|
+ //首次步进
|
|
|
+ List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(id);
|
|
|
+ if(incidentStepList.size() > 0) {
|
|
|
+ for(IncidentStep incidentStep : incidentStepList){
|
|
|
+ List<String> orgNames = new ArrayList<>();
|
|
|
+ List<String> personNames = new ArrayList<>();
|
|
|
+ String[] orgIds = incidentStep.getOrgId().split(",");
|
|
|
+ for(String orgId : orgIds) {
|
|
|
+ Organization organization = organizationService.get(orgId);
|
|
|
+ orgNames.add(organization.getName());
|
|
|
+
|
|
|
+ List<Person> personList = personService.findListByOrgId(orgId);
|
|
|
+ for(Person person : personList) {
|
|
|
+ personNames.add(person.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ incidentStep.setOrgName(String.join(",", orgNames));
|
|
|
+ incidentStep.setPersonName(String.join(",", personNames));
|
|
|
+ }
|
|
|
+ incident.setIncidentStepList(incidentStepList);
|
|
|
+ incident.setFirstStep(incidentStepList.get(0));
|
|
|
+ incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (incident != null) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(incident);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库不存在该记录!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="提醒类型数量")
|
|
|
+ @RequestMapping(value = "countByWarningLight",method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> countByWarningLight(@RequestAttribute String subject){
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ int red = 0;
|
|
|
+ int yellow = 0;
|
|
|
+ int green = 0;
|
|
|
+
|
|
|
+ User user = userService.get(subject);
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ searchParams.put("createBy", subject);
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("batch_","asc"));
|
|
|
+ sortList.add(new Sort("serial_no","asc"));
|
|
|
+
|
|
|
+ Page<Incident> page = incidentService.pageSearch(searchParams,1,1000,false,sortList);
|
|
|
+ for(Incident incident : page.getResult()){
|
|
|
+ List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
|
|
|
+ incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
|
|
|
+
|
|
|
+ //报警灯
|
|
|
+ Date currentTime = new Date();
|
|
|
+ Date warnTime = incident.getLastStep().getWarnDate1();
|
|
|
+ Date allotedTime = incident.getLastStep().getAllotedDate();
|
|
|
+
|
|
|
+ if(incident.getIsFinished() == "0"){
|
|
|
+ green++;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (currentTime.before(warnTime)) {
|
|
|
+ yellow++;
|
|
|
+ } else if (currentTime.after(allotedTime)) {
|
|
|
+ red++;
|
|
|
+ } else {
|
|
|
+ yellow++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("red",red);
|
|
|
+ map.put("yellow",yellow);
|
|
|
+ map.put("green",green);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(map);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|