jz.kai 3 lat temu
rodzic
commit
b8d837a3c6

+ 19 - 0
common/src/main/java/com/jpsoft/excellent/modules/base/dao/IncidentReplyDAO.java

@@ -0,0 +1,19 @@
+package com.jpsoft.excellent.modules.base.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.excellent.modules.base.entity.IncidentReply;
+import java.util.Map;
+import com.jpsoft.excellent.modules.common.dto.Sort;
+
+@Repository
+public interface IncidentReplyDAO {
+	int insert(IncidentReply entity);
+	int update(IncidentReply entity);
+	int exist(String id);
+	IncidentReply get(String id);
+	int delete(String id);
+	List<IncidentReply> list();
+	List<IncidentReply> search(Map<String,Object> searchParams,List<Sort> sortList);
+	List<IncidentReply> findListByIncidentId(String incidentId);
+}

+ 28 - 9
common/src/main/java/com/jpsoft/excellent/modules/base/entity/Incident.java

@@ -32,14 +32,34 @@ public class Incident {
     @ApiModelProperty(value = "所属区域")
     private String areaId;
     private String areaName;
+    @ApiModelProperty(value = "交办单位/交办人")
+    private String orgId;
+    private String orgName;
+    private String orgUserName;
     @ApiModelProperty(value = "跟踪专班/人员")
     private String specialClassId;
     private String specialClassName;
-    private String personName;
+    private String specialUserName;
     @DateTimeFormat(pattern="yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
     @ApiModelProperty(value = "建议办结时限")
     private Date suggestedDate;
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
+    @ApiModelProperty(value = "提醒时间")
+    private Date warnDate1;
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
+    @ApiModelProperty(value = "提醒时间")
+    private Date warnDate2;
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
+    @ApiModelProperty(value = "提醒时间")
+    private Date warnDate3;
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
+    @ApiModelProperty(value = "办理期限")
+    private Date allotedDate;
     @ApiModelProperty(value = "主要问题")
     private String problem;
     @ApiModelProperty(value = "备注")
@@ -68,15 +88,11 @@ public class Incident {
     private List<IncidentAttachmentDTO> picList;
     @ApiModelProperty(value = "图片路径数组")
     private String[] picUrlList;
-    @ApiModelProperty(value = "步进列表")
-    private List<IncidentStep> incidentStepList;
+    @ApiModelProperty(value = "回复列表")
+    private List<IncidentReply> incidentReplyList;
 
-    @ApiModelProperty(value = "第一个步骤")
-    private IncidentStep firstStep;
-    @ApiModelProperty(value = "最后一个步骤")
-    private IncidentStep lastStep;
-    @ApiModelProperty(value = "新步骤")
-    private IncidentStep newStep;
+    @ApiModelProperty(value = "新回复")
+    private IncidentReply newReply;
     @ApiModelProperty(value = "提醒灯")
     private String warningLight;
 
@@ -85,4 +101,7 @@ public class Incident {
     private List<IncidentAttachmentDTO> attStepOrgList;
     @ApiModelProperty(value = "图片列表")
     private List<IncidentAttachmentDTO> picStepOrgList;
+
+    @ApiModelProperty(value = "完成按钮")
+    private Boolean btnClose;
 }

+ 50 - 0
common/src/main/java/com/jpsoft/excellent/modules/base/entity/IncidentReply.java

@@ -0,0 +1,50 @@
+package com.jpsoft.excellent.modules.base.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+import java.util.List;
+
+import com.jpsoft.excellent.modules.base.dto.IncidentAttachmentDTO;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:base_incident_reply的实体类
+ */
+@Data
+@ApiModel(value = "base_incident_reply的实体类")
+public class IncidentReply {
+        @ApiModelProperty(value = "编号")
+    private String id;
+        @ApiModelProperty(value = "事件编号")
+    private String incidentId;
+        @ApiModelProperty(value = "回复机构")
+    private String orgId;
+    private String orgName;
+        @ApiModelProperty(value = "回复专班")
+    private String specialClassId;
+    private String specialClassName;
+        @ApiModelProperty(value = "回复人")
+    private String userId;
+    private String userName;
+        @ApiModelProperty(value = "回复内容")
+    private String content;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+        @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    @ApiModelProperty(value = "附件列表")
+    private List<IncidentAttachmentDTO> attList;
+    @ApiModelProperty(value = "图片列表")
+    private List<IncidentAttachmentDTO> picList;
+    @ApiModelProperty(value = "图片路径数组")
+    private String[] picUrlList;
+}

+ 18 - 0
common/src/main/java/com/jpsoft/excellent/modules/base/service/IncidentReplyService.java

@@ -0,0 +1,18 @@
+package com.jpsoft.excellent.modules.base.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.excellent.modules.base.entity.IncidentReply;
+import com.github.pagehelper.Page;
+import com.jpsoft.excellent.modules.common.dto.Sort;
+
+public interface IncidentReplyService {
+	IncidentReply get(String id);
+	boolean exist(String id);
+	int insert(IncidentReply model);
+	int update(IncidentReply model);
+	int delete(String id);
+	List<IncidentReply> list();
+	Page<IncidentReply> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+	List<IncidentReply> findListByIncidentId(String incidentId);
+}

+ 76 - 0
common/src/main/java/com/jpsoft/excellent/modules/base/service/impl/IncidentReplyServiceImpl.java

@@ -0,0 +1,76 @@
+package com.jpsoft.excellent.modules.base.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.excellent.modules.base.dao.IncidentReplyDAO;
+import com.jpsoft.excellent.modules.base.entity.IncidentReply;
+import com.jpsoft.excellent.modules.base.service.IncidentReplyService;
+import com.github.pagehelper.Page;
+import com.jpsoft.excellent.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="incidentReplyService")
+public class IncidentReplyServiceImpl implements IncidentReplyService {
+	@Resource(name="incidentReplyDAO")
+	private IncidentReplyDAO incidentReplyDAO;
+
+	@Override
+	public IncidentReply get(String id) {
+		// TODO Auto-generated method stub
+		return incidentReplyDAO.get(id);
+	}
+
+	@Override
+	public int insert(IncidentReply model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return incidentReplyDAO.insert(model);
+	}
+
+	@Override
+	public int update(IncidentReply model) {
+		// TODO Auto-generated method stub
+		return incidentReplyDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return incidentReplyDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = incidentReplyDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<IncidentReply> list() {
+		// TODO Auto-generated method stub
+		return incidentReplyDAO.list();
+	}
+		
+	@Override
+	public Page<IncidentReply> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<IncidentReply> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            incidentReplyDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+	@Override
+	public List<IncidentReply> findListByIncidentId(String incidentId) {
+		// TODO Auto-generated method stub
+		return incidentReplyDAO.findListByIncidentId(incidentId);
+	}
+}

+ 39 - 1
common/src/main/resources/mapper/base/Incident.xml

@@ -10,8 +10,13 @@
 		<result property="complainant" column="complainant_" />
 		<result property="complainantPhone" column="complainant_phone" />
 		<result property="areaId" column="area_id" />
+		<result property="orgId" column="org_id" />
 		<result property="specialClassId" column="special_class_id" />
 		<result property="suggestedDate" column="suggested_date" />
+		<result property="warnDate1" column="warn_date_1" />
+		<result property="warnDate2" column="warn_date_2" />
+		<result property="warnDate3" column="warn_date_3" />
+		<result property="allotedDate" column="alloted_date" />
 		<result property="problem" column="problem_" />
 		<result property="remark" column="remark_" />
 		<result property="isFinished" column="is_finished" />
@@ -57,7 +62,7 @@
 	-->
 	<![CDATA[
 		insert into base_incident
-	    (id_,batch_,serial_no,complainant_,complainant_phone,area_id,special_class_id,suggested_date,problem_,remark_,is_finished,del_flag,create_time,create_by,update_time,update_by)
+	    (id_,batch_,serial_no,complainant_,complainant_phone,area_id,org_id,special_class_id,suggested_date,warn_date_1,warn_date_2,warn_date_3,alloted_date,problem_,remark_,is_finished,del_flag,create_time,create_by,update_time,update_by)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -66,8 +71,13 @@
 ,#{complainant,jdbcType=VARCHAR}
 ,#{complainantPhone,jdbcType=VARCHAR}
 ,#{areaId,jdbcType=VARCHAR}
+,#{orgId,jdbcType=VARCHAR}
 ,#{specialClassId,jdbcType=VARCHAR}
 ,#{suggestedDate,jdbcType= TIMESTAMP }
+,#{warnDate1,jdbcType= TIMESTAMP }
+,#{warnDate2,jdbcType= TIMESTAMP }
+,#{warnDate3,jdbcType= TIMESTAMP }
+,#{allotedDate,jdbcType= TIMESTAMP }
 ,#{problem,jdbcType=VARCHAR}
 ,#{remark,jdbcType=VARCHAR}
 ,#{isFinished,jdbcType=VARCHAR}
@@ -100,12 +110,27 @@
 				<if test="areaId!=null">
 		area_id=#{areaId,jdbcType=VARCHAR},
 		</if>
+			<if test="orgId!=null">
+				org_id=#{orgId,jdbcType=VARCHAR},
+			</if>
 				<if test="specialClassId!=null">
 		special_class_id=#{specialClassId,jdbcType=VARCHAR},
 		</if>
 				<if test="suggestedDate!=null">
 		suggested_date=#{suggestedDate,jdbcType= TIMESTAMP },
 		</if>
+			<if test="warnDate1!=null">
+				warn_date_1=#{warnDate1,jdbcType= TIMESTAMP },
+			</if>
+			<if test="warnDate2!=null">
+				warn_date_2=#{warnDate2,jdbcType= TIMESTAMP },
+			</if>
+			<if test="warnDate3!=null">
+				warn_date_3=#{warnDate3,jdbcType= TIMESTAMP },
+			</if>
+			<if test="allotedDate!=null">
+				alloted_date=#{allotedDate,jdbcType= TIMESTAMP },
+			</if>
 				<if test="problem!=null">
 		problem_=#{problem,jdbcType=VARCHAR},
 		</if>
@@ -180,6 +205,19 @@
 			<if test="searchParams.createBy != null">
 				and a.create_by = #{searchParams.createBy}
 			</if>
+			<if test="searchParams.orSpecialClassId != null || searchParams.orOrgId != null || searchParams.orCreateBy != null">
+				and ( 1=0
+				<if test="searchParams.orSpecialClassId != null" >
+					or a.special_class_id like #{searchParams.orSpecialClassId}
+				</if>
+				<if test="searchParams.orOrgId != null">
+					or a.org_id like #{searchParams.orOrgId}
+				</if>
+				<if test="searchParams.orCreateBy != null">
+					or a.create_by = #{searchParams.orCreateBy}
+				</if>
+				)
+			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}

+ 95 - 0
common/src/main/resources/mapper/base/IncidentReply.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.excellent.modules.base.dao.IncidentReplyDAO">
+	<resultMap id="IncidentReplyMap" type="com.jpsoft.excellent.modules.base.entity.IncidentReply">
+		<id property="id" column="id_" />
+			<result property="incidentId" column="incident_id" />
+			<result property="orgId" column="org_id" />
+			<result property="specialClassId" column="special_class_id" />
+			<result property="userId" column="user_id" />
+			<result property="content" column="content_" />
+			<result property="createTime" column="create_time" />
+			<result property="createBy" column="create_by" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.excellent.modules.base.entity.IncidentReply">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into base_incident_reply
+	    (id_,incident_id,org_id,special_class_id,user_id,content_,create_time,create_by)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{incidentId,jdbcType=VARCHAR}
+,#{orgId,jdbcType=VARCHAR}
+,#{specialClassId,jdbcType=VARCHAR}
+,#{userId,jdbcType=VARCHAR}
+,#{content,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{createBy,jdbcType=VARCHAR}
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from base_incident_reply where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.excellent.modules.base.entity.IncidentReply">
+		update base_incident_reply
+		<set>
+				<if test="incidentId!=null">
+		incident_id=#{incidentId,jdbcType=VARCHAR},
+		</if>
+				<if test="orgId!=null">
+		org_id=#{orgId,jdbcType=VARCHAR},
+		</if>
+			<if test="specialClassId!=null">
+				special_class_id=#{specialClassId,jdbcType=VARCHAR},
+			</if>
+				<if test="userId!=null">
+		user_id=#{userId,jdbcType=VARCHAR},
+		</if>
+				<if test="content!=null">
+		content_=#{content,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="IncidentReplyMap">
+		select * from base_incident_reply where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_incident_reply where id_=#{0}
+	</select>
+	<select id="list" resultMap="IncidentReplyMap">
+		select * from base_incident_reply
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="IncidentReplyMap">
+		<![CDATA[
+			select * from base_incident_reply
+		]]>
+		<where>
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+	<select id="findListByIncidentId" parameterType="string" resultMap="IncidentReplyMap">
+		select * from base_incident_reply
+		where incident_id = #{0}
+		order by create_time asc
+	</select>
+</mapper>

+ 197 - 224
web/src/main/java/com/jpsoft/excellent/modules/base/controller/IncidentController.java

@@ -52,6 +52,8 @@ public class IncidentController {
     @Autowired
     private IncidentStepService incidentStepService;
     @Autowired
+    private IncidentReplyService incidentReplyService;
+    @Autowired
     private DataDictionaryService dataDictionaryService;
     @Autowired
     private OrganizationService organizationService;
@@ -70,12 +72,10 @@ public class IncidentController {
         MessageResult<Incident> msgResult = new MessageResult<>();
 
         List<IncidentAttachmentDTO> incidentAttachmentDTOList = new ArrayList<IncidentAttachmentDTO>();
-        IncidentStep incidentStep = new IncidentStep();
 
         Incident incident = new Incident();
         incident.setAttList(incidentAttachmentDTOList);
         incident.setPicList(incidentAttachmentDTOList);
-        incident.setFirstStep(incidentStep);
 
         msgResult.setData(incident);
         msgResult.setResult(true);
@@ -125,57 +125,19 @@ public class IncidentController {
                     incidentAttachment.setCreateTime(new Date());
                     incidentAttachmentService.insert(incidentAttachment);
                 }
-                //启动督查,下发第一步任务
-                if(incident.getFirstStep() != null) {
-                    IncidentStep incidentStep = new IncidentStep();
-                    incidentStep.setId(UUID.randomUUID().toString());
-                    incidentStep.setIncidentId(incident.getId());
-                    incidentStep.setOrgId(incident.getFirstStep().getOrgId());
-                    incidentStep.setWarnDate1(incident.getFirstStep().getWarnDate1());
-                    incidentStep.setIsWarned1(false);
-                    incidentStep.setWarnDate2(incident.getFirstStep().getWarnDate2());
-                    incidentStep.setIsWarned2(false);
-                    incidentStep.setWarnDate3(incident.getFirstStep().getWarnDate3());
-                    incidentStep.setIsWarned3(false);
-                    incidentStep.setAllotedDate(incident.getFirstStep().getAllotedDate());
-//                    incidentStep.setContent("办理中");
-                    incidentStep.setCreateBy(subject);
-                    incidentStep.setCreateTime(new Date());
-                    incidentStepService.insert(incidentStep);
-
-                    //保存到交办单位操作表
-                    //List<IncidentStepStatus> incidentStepStatusList = incidentStepStatusService.findByIncidentId(incident.getId());
-                    incidentStepStatusService.deleteByIncidentId(incident.getId());
-                    String [] orgIds = incident.getFirstStep().getOrgId().split(",");
-                    for(String orgId : orgIds){
-                        IncidentStepStatus incidentStepStatus = new IncidentStepStatus();
-                        incidentStepStatus.setId(UUID.randomUUID().toString());
-                        incidentStepStatus.setCreateBy(subject);
-                        incidentStepStatus.setCreateTime(new Date());
-                        incidentStepStatus.setIncidentId(incident.getId());
-                        incidentStepStatus.setIncidentStepId(incidentStep.getId());
-                        incidentStepStatus.setOrgId(orgId);
-                        incidentStepStatus.setStatus("0");
-                        incidentStepStatus.setDelFlag(false);
-                        incidentStepStatusService.insert(incidentStepStatus);
-                    }
 
-                    User user = userService.get(subject);
-                    SimpleDateFormat sdfDetail = new SimpleDateFormat("yyyy年MM月dd日");
-                    String templateId = "";
-                    String MessageContent = "";
-                    //发送跟踪专班短信
-                    templateId = "2431012137069";
-                    MessageContent = "您有一条待办提醒,请登录双优督办平台手机端查看。(http://39.104.144.104/excellent-mobile)";
-                    sendSMSing(MessageContent, templateId, null, incident.getSpecialClassId(), "");
-                    //发送交办单位短信
-                    templateId = "2431012137069";
-                    MessageContent = "您有一条待办提醒,请登录双优督办平台电脑端查看。(http://39.104.144.104/excellent-portal)";
-                    sendSMSing(MessageContent, templateId, incidentStep.getOrgId(), null, "");
-//                    templateId = "2431012137069";
-//                    MessageContent = String.format("您好!%s,市委督查室已向你单位发送了督办事项“%s”,请安排人员及时接收办理。联系人:%s %s。", sdfDetail.format(incidentStep.getCreateTime()), incident.getTitle(), user.getRealName(), user.getPhone());
-//                    SMSUtil.sendSMSing(MessageContent, templateId, incidentStep.getOrgId(), null, "");
-                }
+//                User user = userService.get(subject);
+//                SimpleDateFormat sdfDetail = new SimpleDateFormat("yyyy年MM月dd日");
+                String templateId = "";
+                String MessageContent = "";
+                //发送跟踪专班短信
+                templateId = "2431012137069";
+                MessageContent = "您有一条待办提醒,请登录双优督办平台手机端查看。(http://39.104.144.104/excellent-mobile)";
+                sendSMSing(MessageContent, templateId, null, incident.getSpecialClassId(), "");
+                //发送交办单位短信
+                templateId = "2431012137069";
+                MessageContent = "您有一条待办提醒,请登录双优督办平台电脑端查看。(http://39.104.144.104/excellent-portal)";
+                sendSMSing(MessageContent, templateId, incident.getOrgId(), null, "");
 
                 msgResult.setResult(true);
                 msgResult.setData(incident);
@@ -203,7 +165,17 @@ public class IncidentController {
             //督办事件
             Incident incident = incidentService.get(id);
             incident.setSpecialClassName(dataDictionaryService.getName(incident.getSpecialClassId()));
-            incident.setNewStep(new IncidentStep());
+            List<String> orgNames = new ArrayList<>();
+            String[] orgIds = incident.getOrgId().split(",");
+            for(String orgId : orgIds) {
+                Organization organization = organizationService.get(orgId);
+                orgNames.add(organization.getName());
+            }
+            incident.setOrgName(String.join(",", orgNames));
+            IncidentReply incidentReplyNew = new IncidentReply();
+            incidentReplyNew.setAttList(new ArrayList<IncidentAttachmentDTO>());
+            incidentReplyNew.setPicList(new ArrayList<IncidentAttachmentDTO>());
+            incident.setNewReply(incidentReplyNew);
             //附件列表
             List<IncidentAttachment> incidentAttachmentList1 = incidentAttachmentService.findListByIncidentId(id,"1");
             List<IncidentAttachmentDTO> incidentAttachmentDTOList1 = new ArrayList<>();
@@ -228,32 +200,44 @@ public class IncidentController {
             }
             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));
+            //回复列表
+            List<IncidentReply> incidentReplyList = incidentReplyService.findListByIncidentId(id);
+            for(IncidentReply incidentReply : incidentReplyList){
+                if(StringUtils.isNotEmpty(incidentReply.getOrgId())) {
+                    Organization organization = organizationService.get(incidentReply.getOrgId());
+                    incidentReply.setOrgName(organization.getName());
                 }
-                incident.setIncidentStepList(incidentStepList);
-                incident.setFirstStep(incidentStepList.get(0));
-                incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
-
-                incident.setAttStepOrgList(new ArrayList<>());
-                incident.setPicStepOrgList(new ArrayList<>());
+                if(StringUtils.isNotEmpty(incidentReply.getSpecialClassId())) {
+                    incidentReply.setSpecialClassName(dataDictionaryService.getName(incidentReply.getSpecialClassId()));
+                }
+                User user = userService.get(incidentReply.getUserId());
+                incidentReply.setUserName(user.getRealName());
+                //附件列表
+                List<IncidentAttachment> incidentAttachments1 = incidentAttachmentService.findListByIncidentId(incidentReply.getId(),"1");
+                List<IncidentAttachmentDTO> incidentAttachmentDTOS1 = new ArrayList<>();
+                for(IncidentAttachment incidentAttachment : incidentAttachments1){
+                    IncidentAttachmentDTO incidentAttachmentDTO = new IncidentAttachmentDTO();
+                    incidentAttachmentDTO.setName(incidentAttachment.getAttachmentTitle());
+                    incidentAttachmentDTO.setUrl(incidentAttachment.getAttachmentUrl());
+                    incidentAttachmentDTOS1.add(incidentAttachmentDTO);
+                }
+                incidentReply.setAttList(incidentAttachmentDTOS1);
+                //图片列表
+                List<IncidentAttachment> incidentAttachments2 = incidentAttachmentService.findListByIncidentId(incidentReply.getId(),"2");
+                List<IncidentAttachmentDTO> incidentAttachmentDTOS2 = new ArrayList<>();
+                String[] picUrlListEx = new String[incidentAttachments2.size()];
+                for(int i=0;i<incidentAttachments2.size();i++){
+                    IncidentAttachment incidentAttachment = incidentAttachments2.get(i);
+                    IncidentAttachmentDTO incidentAttachmentDTO = new IncidentAttachmentDTO();
+                    incidentAttachmentDTO.setName(incidentAttachment.getAttachmentTitle());
+                    incidentAttachmentDTO.setUrl(incidentAttachment.getAttachmentUrl());
+                    incidentAttachmentDTOS2.add(incidentAttachmentDTO);
+                    picUrlListEx[i] = incidentAttachment.getAttachmentUrl();
+                }
+                incidentReply.setPicList(incidentAttachmentDTOS2);
+                incidentReply.setPicUrlList(picUrlListEx);
             }
+            incident.setIncidentReplyList(incidentReplyList);
 
             if (incident != null) {
                 msgResult.setResult(true);
@@ -318,52 +302,19 @@ public class IncidentController {
                     incidentAttachment.setCreateTime(new Date());
                     incidentAttachmentService.insert(incidentAttachment);
                 }
-                //启动督查,下发第一步任务
-                if(incident.getFirstStep() != null) {
-                    IncidentStep incidentStep = incidentStepService.get(incident.getFirstStep().getId());
-                    incidentStep.setOrgId(incident.getFirstStep().getOrgId());
-                    incidentStep.setWarnDate1(incident.getFirstStep().getWarnDate1());
-                    incidentStep.setIsWarned1(false);
-                    incidentStep.setWarnDate2(incident.getFirstStep().getWarnDate2());
-                    incidentStep.setIsWarned2(false);
-                    incidentStep.setWarnDate3(incident.getFirstStep().getWarnDate3());
-                    incidentStep.setIsWarned3(false);
-                    incidentStep.setAllotedDate(incident.getFirstStep().getAllotedDate());
-//                    incidentStep.setContent("办理中");
-                    incidentStep.setUpdateBy(subject);
-                    incidentStep.setUpdateTime(new Date());
-                    incidentStepService.update(incidentStep);
-
-                    //保存到交办单位操作表
-                    //List<IncidentStepStatus> incidentStepStatusList = incidentStepStatusService.findByIncidentId(incident.getId());
-                    incidentStepStatusService.deleteByIncidentId(incident.getId());
-                    String [] orgIds = incident.getFirstStep().getOrgId().split(",");
-                    for(String orgId : orgIds){
-                        IncidentStepStatus incidentStepStatus = new IncidentStepStatus();
-                        incidentStepStatus.setId(UUID.randomUUID().toString());
-                        incidentStepStatus.setCreateBy(subject);
-                        incidentStepStatus.setCreateTime(new Date());
-                        incidentStepStatus.setIncidentId(incident.getId());
-                        incidentStepStatus.setIncidentStepId(incidentStep.getId());
-                        incidentStepStatus.setOrgId(orgId);
-                        incidentStepStatus.setStatus("0");
-                        incidentStepStatus.setDelFlag(false);
-                        incidentStepStatusService.insert(incidentStepStatus);
-                    }
 
-                    User user = userService.get(subject);
-                    SimpleDateFormat sdfDetail = new SimpleDateFormat("yyyy年MM月dd日");
-                    String templateId = "";
-                    String MessageContent = "";
-                    //发送跟踪专班短信
-                    templateId = "2431012152806";
-                    MessageContent = "您有一条待办提醒,请登录双优督办平台手机端查看。(http://39.104.144.104/excellent-mobile)";
-                    sendSMSing(MessageContent, templateId, null, incident.getSpecialClassId(), "");
-                    //发送交办单位短信
-                    templateId = "2431012152806";
-                    MessageContent = "您有一条待办提醒,请登录双优督办平台电脑端查看。(http://39.104.144.104/excellent-portal)";
-                    sendSMSing(MessageContent, templateId, incidentStep.getOrgId(), null, "");
-                }
+//                User user = userService.get(subject);
+//                SimpleDateFormat sdfDetail = new SimpleDateFormat("yyyy年MM月dd日");
+                String templateId = "";
+                String MessageContent = "";
+                //发送跟踪专班短信
+                templateId = "2431012152806";
+                MessageContent = "您有一条待办提醒,请登录双优督办平台手机端查看。(http://39.104.144.104/excellent-mobile)";
+                sendSMSing(MessageContent, templateId, null, incident.getSpecialClassId(), "");
+                //发送交办单位短信
+                templateId = "2431012152806";
+                MessageContent = "您有一条待办提醒,请登录双优督办平台电脑端查看。(http://39.104.144.104/excellent-portal)";
+                sendSMSing(MessageContent, templateId, incident.getOrgId(), null, "");
 
                 msgResult.setResult(true);
                 msgResult.setData(incident);
@@ -386,47 +337,59 @@ public class IncidentController {
     @PostMapping("nextStep")
     public MessageResult<Incident> nextStep(@RequestBody Incident incident, @RequestAttribute String subject){
         MessageResult<Incident> msgResult = new MessageResult<>();
+        User user = userService.get(subject);
+        Organization organization = organizationService.get(incident.getOrgId());
 
         try {
-            //更新当前最后一条的督办记录的处置记录
-            IncidentStep incidentStep = incident.getLastStep();
-            incidentStep.setIsWarned1(true);
-            incidentStep.setIsWarned2(true);
-            incidentStep.setIsWarned3(true);
-            incidentStep.setUpdateBy(subject);
-            incidentStep.setUpdateTime(new Date());
-            incidentStepService.update(incidentStep);
-
-            if(StringUtils.isEmpty(incident.getNewStep().getOrgId())){
-                //督办事件办结
-                incident.setIsFinished("0");
-                incident.setUpdateBy(subject);
-                incident.setUpdateTime(new Date());
-                incidentService.update(incident);
-            }
-            else{
-                //督办事件重启
-                if(incident.getIsFinished().equals("0")) {
-                    incident.setIsFinished("1");
-                    incident.setUpdateBy(subject);
-                    incident.setUpdateTime(new Date());
-                    incidentService.update(incident);
+            if(StringUtils.isNotEmpty(incident.getNewReply().getContent())){
+                //写入回复
+                IncidentReply incidentReply = new IncidentReply();
+                incidentReply.setId(UUID.randomUUID().toString());
+                incidentReply.setIncidentId(incident.getId());
+                incidentReply.setOrgId(user.getOrgId());
+                incidentReply.setSpecialClassId(user.getSpecialClassId());
+                incidentReply.setUserId(subject);
+                incidentReply.setContent(incident.getNewReply().getContent());
+                incidentReply.setCreateBy(subject);
+                incidentReply.setCreateTime(new Date());
+                incidentReplyService.insert(incidentReply);
+                //关联附件
+                for(int i=0;i<incident.getNewReply().getAttList().size();i++){
+                    IncidentAttachmentDTO incidentAttachmentDTO = incident.getNewReply().getAttList().get(i);
+                    IncidentAttachment incidentAttachment = new IncidentAttachment();
+                    incidentAttachment.setId(UUID.randomUUID().toString());
+                    incidentAttachment.setIncidentId(incidentReply.getId());
+                    incidentAttachment.setAttachmentType("1");
+                    incidentAttachment.setAttachmentTitle(incidentAttachmentDTO.getName());
+                    incidentAttachment.setAttachmentUrl(incidentAttachmentDTO.getUrl());
+                    incidentAttachment.setSortNo(i);
+                    incidentAttachment.setCreateBy(subject);
+                    incidentAttachment.setCreateTime(new Date());
+                    incidentAttachmentService.insert(incidentAttachment);
+                }
+                //关联图片
+                for(int i=0;i<incident.getNewReply().getPicList().size();i++){
+                    IncidentAttachmentDTO incidentAttachmentDTO = incident.getNewReply().getPicList().get(i);
+                    IncidentAttachment incidentAttachment = new IncidentAttachment();
+                    incidentAttachment.setId(UUID.randomUUID().toString());
+                    incidentAttachment.setIncidentId(incidentReply.getId());
+                    incidentAttachment.setAttachmentType("2");
+                    incidentAttachment.setAttachmentTitle(incidentAttachmentDTO.getName());
+                    incidentAttachment.setAttachmentUrl(incidentAttachmentDTO.getUrl());
+                    incidentAttachment.setSortNo(i);
+                    incidentAttachment.setCreateBy(subject);
+                    incidentAttachment.setCreateTime(new Date());
+                    incidentAttachmentService.insert(incidentAttachment);
                 }
-                //督办事件进入下一步
-                IncidentStep incidentStepNext = new IncidentStep();
-                incidentStepNext.setId(UUID.randomUUID().toString());
-                incidentStepNext.setIncidentId(incident.getId());
-                incidentStepNext.setOrgId(incident.getNewStep().getOrgId());
-                incidentStepNext.setWarnDate1(incident.getNewStep().getWarnDate1());
-                incidentStepNext.setIsWarned1(false);
-                incidentStepNext.setWarnDate2(incident.getNewStep().getWarnDate2());
-                incidentStepNext.setIsWarned2(false);
-                incidentStepNext.setWarnDate3(incident.getNewStep().getWarnDate3());
-                incidentStepNext.setIsWarned3(false);
-                incidentStepNext.setAllotedDate(incident.getNewStep().getAllotedDate());
-                incidentStepNext.setCreateBy(subject);
-                incidentStepNext.setCreateTime(new Date());
-                incidentStepService.insert(incidentStepNext);
+            }
+
+            if(StringUtils.isNotEmpty(incident.getSpecialClassId())) {
+                String templateId = "";
+                String MessageContent = "";
+                //发送跟踪专班短信
+                templateId = "2431012153083";
+                MessageContent = organization.getName() + "责任单位已上传文档,请查阅。";
+                sendSMSing(MessageContent, templateId, null, incident.getSpecialClassId(), "");
             }
 
             msgResult.setResult(true);
@@ -517,9 +480,17 @@ public class IncidentController {
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
         MessageResult<Map> msgResult = new MessageResult<>();
+        User user = userService.get(subject);
 
         Map<String,Object> searchParams = new HashMap<>();
         searchParams.put("createBy", subject);
+//        searchParams.put("orCreateBy", subject);
+//        if(StringUtils.isNotEmpty(user.getSpecialClassId())) {
+//            searchParams.put("orSpecialClassId", user.getSpecialClassId());
+//        }
+//        if(StringUtils.isNotEmpty(user.getOrgId())) {
+//            searchParams.put("orOrgId", user.getOrgId());
+//        }
 
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("batch_","asc"));
@@ -558,7 +529,7 @@ public class IncidentController {
         Page<Incident> page = incidentService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
         for(Incident incident : page.getResult()){
             List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
-            incident.setIncidentStepList(incidentStepList);
+//            incident.setIncidentStepList(incidentStepList);
 
             if(StringUtils.isNotEmpty(incident.getSpecialClassId())){
                 List<String> nameList = new ArrayList<>();
@@ -579,26 +550,32 @@ public class IncidentController {
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageListPending",method = RequestMethod.POST)
     public MessageResult<Map> pageListPending(
-            String batch, String serialNo, String complainant, String complainantPhone, String areaId, String specialClassId, String isFinished,
+            String batch, String serialNo, String complainant, String complainantPhone, String areaId,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
         MessageResult<Map> msgResult = new MessageResult<>();
+        User user = userService.get(subject);
 
         Map<String,Object> searchParams = new HashMap<>();
         searchParams.put("isFinished", "1");
+        if(StringUtils.isNotEmpty(user.getSpecialClassId())) {
+            searchParams.put("orSpecialClassId", user.getSpecialClassId());
+        }
+        if(StringUtils.isNotEmpty(user.getOrgId())) {
+            searchParams.put("orOrgId", user.getOrgId());
+        }
 //        searchParams.put("createBy", subject);
 
         List<Sort> sortList = new ArrayList<>();
-//        sortList.add(new Sort("a.warn_time","asc"));
         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);
-        }
+//        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)) {
@@ -616,18 +593,9 @@ public class IncidentController {
         if (StringUtils.isNotEmpty(areaId)) {
             searchParams.put("areaId",areaId);
         }
-        if (StringUtils.isNotEmpty(specialClassId)) {
-            searchParams.put("specialClassId","%"+specialClassId+"%");
-        }
-        if (StringUtils.isNotEmpty(isFinished)) {
-            searchParams.put("isFinished",isFinished);
-        }
 
         Page<Incident> page = incidentService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
         for(Incident incident : page.getResult()){
-            List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
-            incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
-
             if(StringUtils.isNotEmpty(incident.getSpecialClassId())){
                 List<String> nameList = new ArrayList<>();
                 String[] ids = incident.getSpecialClassId().split(",");
@@ -635,12 +603,20 @@ public class IncidentController {
                     nameList.add(dataDictionaryService.getName(id));
                 }
                 incident.setSpecialClassName(String.join(",", nameList));
+
+                if(StringUtils.isNotEmpty(incident.getSpecialClassId()) && StringUtils.isNotEmpty(user.getSpecialClassId())) {
+                    if (incident.getSpecialClassId().contains(user.getSpecialClassId())) {
+                        incident.setBtnClose(true);
+                    } else {
+                        incident.setBtnClose(false);
+                    }
+                }
             }
 
             //报警灯
             Date currentTime = new Date();
-            Date warnTime = incident.getLastStep().getWarnDate1();
-            Date allotedTime = incident.getLastStep().getAllotedDate();
+            Date warnTime = incident.getWarnDate1();
+            Date allotedTime = incident.getAllotedDate();
 
             if(currentTime.before(warnTime)){
                 incident.setWarningLight("绿");
@@ -839,11 +815,11 @@ public class IncidentController {
         total = page.size();
         for(Incident incident : page.getResult()){
             List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
-            incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
+//            incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
             //报警灯
             Date currentTime = new Date();
-            Date warnTime = incident.getLastStep().getWarnDate1();
-            Date allotedTime = incident.getLastStep().getAllotedDate();
+            Date warnTime = incident.getWarnDate1();
+            Date allotedTime = incident.getAllotedDate();
 
             if(currentTime.before(warnTime)){
                 intSafety++;
@@ -889,9 +865,6 @@ public class IncidentController {
 
         Page<Incident> page = incidentService.pageSearch(searchParams,1,10000,false,sortList);
         for(Incident incident : page.getResult()){
-            List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
-            incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
-
             if(StringUtils.isNotEmpty(incident.getSpecialClassId())){
                 List<String> nameList = new ArrayList<>();
                 String[] ids = incident.getSpecialClassId().split(",");
@@ -977,9 +950,6 @@ public class IncidentController {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         Page<Incident> page = incidentService.pageSearch(searchParams,1,10000,false,sortList);
         for(Incident incident : page.getResult()){
-            List<IncidentStep> incidentStepList = incidentStepService.findListByIncidentId(incident.getId());
-            incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
-
             if(StringUtils.isNotEmpty(incident.getSpecialClassId())){
                 List<String> nameList = new ArrayList<>();
                 String[] ids = incident.getSpecialClassId().split(",");
@@ -1011,8 +981,8 @@ public class IncidentController {
             row.getCell(3).setCellValue(incident.getAreaName());
             row.getCell(4).setCellValue(incident.getSpecialClassName());
             row.getCell(5).setCellValue(incident.getSuggestedDate());
-            row.getCell(6).setCellValue(sdf.format(incident.getLastStep().getAllotedDate()));
-            if(incident.getLastStep().getUpdateTime() != null) row.getCell(7).setCellValue(sdf.format(incident.getLastStep().getUpdateTime()));
+            row.getCell(6).setCellValue(sdf.format(incident.getAllotedDate()));
+            if(incident.getUpdateTime() != null) row.getCell(7).setCellValue(sdf.format(incident.getUpdateTime()));
             row.getCell(8).setCellValue(incident.getIsFinishedName());
 
             row.getCell(0).setCellStyle(cellStyleContent);
@@ -1208,13 +1178,6 @@ public class IncidentController {
                         incident.setRemark(strRemark);
                     }
 
-                    //案件步骤
-                    IncidentStep incidentStep = new IncidentStep();
-                    incidentStep.setId(UUID.randomUUID().toString());
-                    incidentStep.setIncidentId(incident.getId());
-                    incidentStep.setCreateBy(subject);
-                    incidentStep.setCreateTime(new Date());
-
                     if(StringUtils.isNotEmpty(strOrg)){
                         List<String> ids = new ArrayList<>();
                         String[] names = strOrg.split(",");
@@ -1225,7 +1188,7 @@ public class IncidentController {
                             }
                         }
                         if(ids.size() > 0) {
-                            incidentStep.setOrgId(String.join(",", ids));
+                            incident.setOrgId(String.join(",", ids));
                         }
                         else{
                             sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("交办单位出现错误!");
@@ -1240,8 +1203,7 @@ public class IncidentController {
                     }
 
                     if(StringUtils.isNotEmpty(strWarnDate1)){
-                        incidentStep.setWarnDate1(sdf.parse(strWarnDate1));
-                        incidentStep.setIsWarned1(false);
+                        incident.setWarnDate1(sdf.parse(strWarnDate1));
                     }
                     else{
                         sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写第一次提醒时间!");
@@ -1250,17 +1212,15 @@ public class IncidentController {
                     }
 
                     if(StringUtils.isNotEmpty(strWarnDate2)){
-                        incidentStep.setWarnDate2(sdf.parse(strWarnDate2));
-                        incidentStep.setIsWarned2(false);
+                        incident.setWarnDate2(sdf.parse(strWarnDate2));
                     }
 
                     if(StringUtils.isNotEmpty(strWarnDate3)){
-                        incidentStep.setWarnDate3(sdf.parse(strWarnDate3));
-                        incidentStep.setIsWarned3(false);
+                        incident.setWarnDate3(sdf.parse(strWarnDate3));
                     }
 
                     if(StringUtils.isNotEmpty(strAllotedDate)){
-                        incidentStep.setAllotedDate(sdf.parse(strAllotedDate));
+                        incident.setAllotedDate(sdf.parse(strAllotedDate));
                     }
                     else{
                         sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写到期时间!");
@@ -1269,24 +1229,6 @@ public class IncidentController {
                     }
 
                     incidentService.insert(incident);
-                    incidentStepService.insert(incidentStep);
-
-                    //保存到交办单位操作表
-                    //List<IncidentStepStatus> incidentStepStatusList = incidentStepStatusService.findByIncidentId(incident.getId());
-                    incidentStepStatusService.deleteByIncidentId(incident.getId());
-                    String [] orgIds = incidentStep.getOrgId().split(",");
-                    for(String orgId : orgIds){
-                        IncidentStepStatus incidentStepStatus = new IncidentStepStatus();
-                        incidentStepStatus.setId(UUID.randomUUID().toString());
-                        incidentStepStatus.setCreateBy(subject);
-                        incidentStepStatus.setCreateTime(new Date());
-                        incidentStepStatus.setIncidentId(incident.getId());
-                        incidentStepStatus.setIncidentStepId(incidentStep.getId());
-                        incidentStepStatus.setOrgId(orgId);
-                        incidentStepStatus.setStatus("0");
-                        incidentStepStatus.setDelFlag(false);
-                        incidentStepStatusService.insert(incidentStepStatus);
-                    }
 
                     String templateId = "";
                     String MessageContent = "";
@@ -1297,12 +1239,13 @@ public class IncidentController {
                     //发送交办单位短信
                     templateId = "2431012137069";
                     MessageContent = "您有一条待办提醒,请登录双优督办平台电脑端查看。(http://39.104.144.104/excellent-portal)";
-                    sendSMSing(MessageContent, templateId, incidentStep.getOrgId(), null, "");
+                    sendSMSing(MessageContent, templateId, incident.getOrgId(), null, "");
 
                     affectCount++;
                 }
                 catch(Exception innerEx){
                     logger.error(innerEx.getMessage(),innerEx);
+                    failCount++;
                 }
             }
 
@@ -1443,4 +1386,34 @@ public class IncidentController {
             }
         }
     }
+
+    @ApiOperation(value="变更信息状态")
+    @GetMapping("changeFinished/{id}")
+    public MessageResult<Incident> changeFinished(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<Incident> msgResult = new MessageResult<>();
+
+        try {
+            Incident incident = incidentService.get(id);
+            if(incident.getIsFinished().equals("0")){
+                incident.setIsFinished("1");
+            }
+            else{
+                incident.setIsFinished("0");
+            }
+            incident.setUpdateBy(subject);
+            incident.setUpdateTime(new Date());
+            incidentService.update(incident);
+
+            msgResult.setResult(true);
+            msgResult.setData(incident);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }

+ 15 - 15
web/src/main/java/com/jpsoft/excellent/modules/mobile/IncidentApiController.java

@@ -69,22 +69,22 @@ public class IncidentApiController {
         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));
+//            incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
 
             List<String> personNames = new ArrayList<>();
-            String[] orgIds = incident.getLastStep().getOrgId().split(",");
+            String[] orgIds = incident.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));
+            incident.setOrgUserName(String.join(",", personNames));
 
             //报警灯
             Date currentTime = new Date();
-            Date warnTime = incident.getLastStep().getWarnDate1();
-            Date allotedTime = incident.getLastStep().getAllotedDate();
+            Date warnTime = incident.getWarnDate1();
+            Date allotedTime = incident.getAllotedDate();
 
             if(currentTime.before(warnTime)){
                 incident.setWarningLight("green-line");
@@ -125,7 +125,7 @@ public class IncidentApiController {
                 nameList.add(dataDictionaryService.getName(specialClassId));
             }
             incident.setSpecialClassName(String.join(",", nameList));
-            incident.setNewStep(new IncidentStep());
+//            incident.setNewStep(new IncidentStep());
             //附件列表
             List<IncidentAttachment> incidentAttachmentList1 = incidentAttachmentService.findListByIncidentId(id,"1");
             List<IncidentAttachmentDTO> incidentAttachmentDTOList1 = new ArrayList<>();
@@ -169,9 +169,9 @@ public class IncidentApiController {
                     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));
+//                incident.setIncidentStepList(incidentStepList);
+//                incident.setFirstStep(incidentStepList.get(0));
+//                incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
             }
 
             if (incident != null) {
@@ -213,12 +213,12 @@ public class IncidentApiController {
         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));
+//            incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
 
             //报警灯
             Date currentTime = new Date();
-            Date warnTime = incident.getLastStep().getWarnDate1();
-            Date allotedTime = incident.getLastStep().getAllotedDate();
+            Date warnTime = incident.getWarnDate1();
+            Date allotedTime = incident.getAllotedDate();
 
             if(incident.getIsFinished().equals("0")){
                 green++;
@@ -268,12 +268,12 @@ public class IncidentApiController {
             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));
+//                incident.setLastStep(incidentStepList.get(incidentStepList.size()-1));
 
                 //报警灯
                 Date currentTime = new Date();
-                Date warnTime = incident.getLastStep().getWarnDate1();
-                Date allotedTime = incident.getLastStep().getAllotedDate();
+                Date warnTime = incident.getWarnDate1();
+                Date allotedTime = incident.getAllotedDate();
 
                 if(incident.getIsFinished().equals("0")){
                     green++;

+ 39 - 0
web/src/main/java/com/jpsoft/excellent/modules/textController.java

@@ -1,6 +1,10 @@
 package com.jpsoft.excellent.modules;
 
+import com.jpsoft.excellent.modules.base.entity.Incident;
+import com.jpsoft.excellent.modules.base.entity.IncidentStep;
 import com.jpsoft.excellent.modules.base.entity.Person;
+import com.jpsoft.excellent.modules.base.service.IncidentService;
+import com.jpsoft.excellent.modules.base.service.IncidentStepService;
 import com.jpsoft.excellent.modules.base.service.PersonService;
 import com.jpsoft.excellent.modules.common.dto.MessageResult;
 import com.jpsoft.excellent.modules.common.utils.DES3;
@@ -25,6 +29,10 @@ public class textController {
     private UserService userService;
     @Autowired
     private PersonService personService;
+    @Autowired
+    private IncidentService incidentService;
+    @Autowired
+    private IncidentStepService incidentStepService;
 
     @ApiOperation(value="短信发送")
     @RequestMapping(value = "sendSMS",method = RequestMethod.POST)
@@ -124,4 +132,35 @@ public class textController {
 
         return msgResult;
     }
+
+    @ApiOperation(value="督查步进表信息写入督查事件表")
+    @RequestMapping(value = "stepToIncident",method = RequestMethod.POST)
+    public MessageResult stepToIncident(@RequestAttribute String subject){
+        MessageResult msgResult = new MessageResult();
+
+        try {
+            Integer count = 0;
+            List<IncidentStep> incidentSteps = incidentStepService.list();
+            for(IncidentStep incidentStep : incidentSteps){
+                Incident incident = incidentService.get(incidentStep.getIncidentId());
+                incident.setOrgId(incidentStep.getOrgId());
+                incident.setWarnDate1(incidentStep.getWarnDate1());
+                incident.setWarnDate2(incidentStep.getWarnDate2());
+                incident.setWarnDate3(incidentStep.getWarnDate3());
+                incident.setAllotedDate(incidentStep.getAllotedDate());
+                incidentService.update(incident);
+
+                count++;
+            }
+
+            msgResult.setResult(true);
+            msgResult.setMessage("导入数据"+count+"条。");
+        }
+        catch(Exception ex){
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }