Bläddra i källkod

反馈意见流程化

jz.kai 2 år sedan
förälder
incheckning
5a20025bb6

+ 1 - 0
common/src/main/java/com/jpsoft/excellent/modules/base/dao/FeedbackOpinionDAO.java

@@ -16,4 +16,5 @@ public interface FeedbackOpinionDAO {
 	List<FeedbackOpinion> list();
 	List<FeedbackOpinion> search(Map<String,Object> searchParams,List<Sort> sortList);
 	String getLastSort(String date);
+	List<FeedbackOpinion> searchTodo(Map<String,Object> searchParams,List<Sort> sortList);
 }

+ 1 - 0
common/src/main/java/com/jpsoft/excellent/modules/base/dao/FeedbackStepStatusDAO.java

@@ -15,4 +15,5 @@ public interface FeedbackStepStatusDAO {
 	int delete(String id);
 	List<FeedbackStepStatus> list();
 	List<FeedbackStepStatus> search(Map<String,Object> searchParams,List<Sort> sortList);
+	List<FeedbackStepStatus> findByList(String feedbackOpinionId, Boolean status);
 }

+ 10 - 0
common/src/main/java/com/jpsoft/excellent/modules/base/entity/FeedbackOpinion.java

@@ -75,4 +75,14 @@ public class FeedbackOpinion {
     private List<FeedbackAttachmentDTO> picList;
         @ApiModelProperty(value = "图片路径数组")
     private String[] picUrlList;
+        @ApiModelProperty(value = "处理完成")
+    private Boolean isProcessed;
+        @ApiModelProperty(value = "站点回复")
+    private List<FeedbackStepStatus> stepStatusList;
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
+    @ApiModelProperty(value = "办理期限")
+    private Date allotedDate;
+    @ApiModelProperty(value = "步进状态编号")
+    private String stepStatusId;
 }

+ 4 - 2
common/src/main/java/com/jpsoft/excellent/modules/base/entity/FeedbackStepStatus.java

@@ -22,8 +22,10 @@ public class FeedbackStepStatus {
     private String feedbackStepId;
         @ApiModelProperty(value = "交办站点")
     private String stationId;
+    private String stationName;
         @ApiModelProperty(value = "回复人")
     private String userId;
+    private String userName;
         @ApiModelProperty(value = "回复内容")
     private String content;
         @ApiModelProperty(value = "完成状态(0:未完成 1:已完成)")
@@ -40,8 +42,8 @@ public class FeedbackStepStatus {
     private Date createTime;
         @ApiModelProperty(value = "创建人")
     private String createBy;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+        @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
 	    @ApiModelProperty(value = "更新时间")
     private Date updateTime;
         @ApiModelProperty(value = "更新人")

+ 1 - 0
common/src/main/java/com/jpsoft/excellent/modules/base/service/FeedbackOpinionService.java

@@ -15,4 +15,5 @@ public interface FeedbackOpinionService {
 	List<FeedbackOpinion> list();
 	Page<FeedbackOpinion> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
 	String getLastSort(String date);
+	Page<FeedbackOpinion> pageSearchTodo(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
 }

+ 1 - 0
common/src/main/java/com/jpsoft/excellent/modules/base/service/FeedbackStepStatusService.java

@@ -14,4 +14,5 @@ public interface FeedbackStepStatusService {
 	int delete(String id);
 	List<FeedbackStepStatus> list();
 	Page<FeedbackStepStatus> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+	List<FeedbackStepStatus> findByList(String feedbackOpinionId, Boolean status);
 }

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

@@ -73,4 +73,13 @@ public class FeedbackOpinionServiceImpl implements FeedbackOpinionService {
 		// TODO Auto-generated method stub
 		return feedbackOpinionDAO.getLastSort(date);
 	}
+
+	@Override
+	public Page<FeedbackOpinion> pageSearchTodo(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+		Page<FeedbackOpinion> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+			feedbackOpinionDAO.searchTodo(searchParams,sortList);
+		});
+
+		return page;
+	}
 }

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

@@ -67,4 +67,10 @@ public class FeedbackStepStatusServiceImpl implements FeedbackStepStatusService
         
         return page;
 	}
+
+	@Override
+	public List<FeedbackStepStatus> findByList(String feedbackOpinionId, Boolean status) {
+		// TODO Auto-generated method stub
+		return feedbackStepStatusDAO.findByList(feedbackOpinionId, status);
+	}
 }

+ 33 - 0
common/src/main/resources/mapper/base/FeedbackOpinion.xml

@@ -25,6 +25,8 @@
 
 		<result property="areaId" column="area_id" />
 		<result property="stationName" column="station_name" />
+		<result property="allotedDate" column="alloted_date" />
+		<result property="stepStatusId" column="step_status_id" />
 	</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.excellent.modules.base.entity.FeedbackOpinion">
 	<!--
@@ -197,4 +199,35 @@
 		order by sort_ desc
 		limit 1
 	</select>
+	<select id="searchTodo" parameterType="hashmap" resultMap="FeedbackOpinionMap">
+		<![CDATA[
+			SELECT c.*,a.alloted_date,a.id_ AS step_status_id,d.station_name FROM base_feedback_step_status a
+			LEFT JOIN base_feedback_step b ON a.feedback_step_id = b.id_
+			LEFT JOIN base_feedback_opinion c ON b.feedback_opinion_id = c.id_
+			LEFT JOIN base_work_station d on c.work_station_id = d.id_
+		]]>
+		<where>
+			and a.del_flag = 0
+			and a.status_ = false
+			<if test="searchParams.workStation != null">
+				and a.station_id = #{searchParams.workStation}
+			</if>
+			<if test="searchParams.connectPhone != null">
+				and c.connect_phone like #{searchParams.connectPhone}
+			</if>
+			<if test="searchParams.reportDateStart != null">
+				<![CDATA[
+				and c.create_time >= #{searchParams.reportDateStart}
+				]]>
+			</if>
+			<if test="searchParams.reportDateEnd != null">
+				<![CDATA[
+				and c.create_time < #{searchParams.reportDateEnd}
+				]]>
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+			${sort.name} ${sort.order}
+		</foreach>
+	</select>
 </mapper>

+ 9 - 0
common/src/main/resources/mapper/base/FeedbackStepStatus.xml

@@ -108,4 +108,13 @@ id_,feedback_step_id,station_id,user_id,content_,status_,alloted_date,del_flag,c
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
+	<select id="findByList" resultMap="FeedbackStepStatusMap">
+		SELECT a.* FROM base_feedback_step_status a
+		LEFT JOIN base_feedback_step b ON a.feedback_step_id = b.id_
+		WHERE b.feedback_opinion_id = #{feedbackOpinionId}
+		<if test="status != null">
+			AND a.status_ = #{status}
+		</if>
+		ORDER BY create_time ASC
+	</select>
 </mapper>

+ 175 - 6
web/src/main/java/com/jpsoft/excellent/modules/base/controller/FeedbackOpinionController.java

@@ -6,18 +6,16 @@ import com.github.pagehelper.Page;
 import com.jpsoft.excellent.config.OSSConfig;
 import com.jpsoft.excellent.modules.base.dto.FeedbackAttachmentDTO;
 import com.jpsoft.excellent.modules.base.dto.FeedbackOpinionReportDTO;
-import com.jpsoft.excellent.modules.base.entity.Area;
-import com.jpsoft.excellent.modules.base.entity.FeedbackAttachment;
-import com.jpsoft.excellent.modules.base.service.AreaService;
-import com.jpsoft.excellent.modules.base.service.FeedbackAttachmentService;
+import com.jpsoft.excellent.modules.base.entity.*;
+import com.jpsoft.excellent.modules.base.service.*;
 import com.jpsoft.excellent.modules.common.utils.OSSUtil;
 import com.jpsoft.excellent.modules.common.utils.PojoUtils;
 import com.jpsoft.excellent.modules.common.dto.Sort;
 import com.jpsoft.excellent.modules.common.dto.MessageResult;
-import com.jpsoft.excellent.modules.base.entity.FeedbackOpinion;
-import com.jpsoft.excellent.modules.base.service.FeedbackOpinionService;
 import com.jpsoft.excellent.modules.sys.entity.DataDictionary;
+import com.jpsoft.excellent.modules.sys.entity.User;
 import com.jpsoft.excellent.modules.sys.service.DataDictionaryService;
+import com.jpsoft.excellent.modules.sys.service.UserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
@@ -26,6 +24,7 @@ import org.apache.poi.ss.usermodel.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -45,8 +44,16 @@ public class FeedbackOpinionController {
     @Autowired
     private DataDictionaryService dataDictionaryService;
     @Autowired
+    private UserService userService;
+    @Autowired
+    private WorkStationService workStationService;
+    @Autowired
     private FeedbackOpinionService feedbackOpinionService;
     @Autowired
+    private FeedbackStepService feedbackStepService;
+    @Autowired
+    private FeedbackStepStatusService feedbackStepStatusService;
+    @Autowired
     private FeedbackAttachmentService feedbackAttachmentService;
     @Autowired
     private AreaService areaService;
@@ -138,6 +145,19 @@ public class FeedbackOpinionController {
             }
             feedbackOpinion.setPicList(feedbackAttachmentDTOList2);
             feedbackOpinion.setPicUrlList(picUrlList);
+            //步进列表
+            List<FeedbackStepStatus> feedbackStepStatusList = feedbackStepStatusService.findByList(feedbackOpinion.getId(),null);
+            for(FeedbackStepStatus feedbackStepStatus : feedbackStepStatusList){
+                if(StringUtils.isNotEmpty(feedbackStepStatus.getStationId())){
+                    WorkStation workStation = workStationService.get(feedbackStepStatus.getStationId());
+                    feedbackStepStatus.setStationName(workStation.getStationName());
+                }
+                if(StringUtils.isNotEmpty(feedbackStepStatus.getUserId())){
+                    User user = userService.get(feedbackStepStatus.getUserId());
+                    feedbackStepStatus.setUserName(user.getRealName());
+                }
+            }
+            feedbackOpinion.setStepStatusList(feedbackStepStatusList);
             
             if (feedbackOpinion != null) {
                 msgResult.setResult(true);
@@ -369,6 +389,13 @@ public class FeedbackOpinionController {
             if(StringUtils.isNotEmpty(feedbackOpinion.getAreaId())) {
                 feedbackOpinion.setAreaName(parentFullName(feedbackOpinion.getAreaId()));
             }
+            int num = feedbackStepStatusService.findByList(feedbackOpinion.getId(),false).size();
+            if(num > 0) {
+                feedbackOpinion.setIsProcessed(false);
+            }
+            else{
+                feedbackOpinion.setIsProcessed(true);
+            }
         }
 
         msgResult.setResult(true);
@@ -690,6 +717,73 @@ public class FeedbackOpinionController {
         return msgResult;
     }
 
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "pageListTodo",method = RequestMethod.POST)
+    public MessageResult<Map> pageListTodo(
+            String connectPhone, Date[] reportDate,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestAttribute String subject){
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("create_time","desc"));
+
+        Map<String,Object> searchParams = new HashMap<>();
+        User user = userService.get(subject);
+        if(StringUtils.isNotEmpty(user.getStationId())) {
+            searchParams.put("workStation", user.getStationId());
+        }
+        else{
+            searchParams.put("workStation", "0");
+        }
+
+        if (StringUtils.isNotEmpty(connectPhone)) {
+            searchParams.put("connectPhone","%" + connectPhone + "%");
+        }
+
+        if (reportDate.length > 0) {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            Calendar calendar = new GregorianCalendar();
+            calendar.setTime(reportDate[1]);
+            calendar.add(calendar.DATE,1);
+
+            searchParams.put("reportDateStart",sdf.format(reportDate[0]));
+            searchParams.put("reportDateEnd",sdf.format(calendar.getTime()));
+        }
+
+        Page<FeedbackOpinion> page = feedbackOpinionService.pageSearchTodo(searchParams,pageIndex,pageSize,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="意见待办处理")
+    @RequestMapping(value = "saveTodo",method = RequestMethod.POST)
+    public MessageResult saveTodo(String stepStatusId, String content, @RequestAttribute String subject){
+        MessageResult msgResult = new MessageResult<>();
+
+        try {
+            FeedbackStepStatus feedbackStepStatus = feedbackStepStatusService.get(stepStatusId);
+            feedbackStepStatus.setUserId(subject);
+            feedbackStepStatus.setContent(content);
+            feedbackStepStatus.setStatus(true);
+            feedbackStepStatus.setUpdateBy(subject);
+            feedbackStepStatus.setUpdateTime(new Date());
+            feedbackStepStatusService.update(feedbackStepStatus);
+
+            msgResult.setResult(true);
+        }
+        catch (Exception exception) {
+            msgResult.setResult(false);
+            msgResult.setMessage(exception.getMessage());
+        }
+
+        return msgResult;
+    }
+
     @ApiOperation(value="导出报表")
     @RequestMapping(value = "reportXls",method = RequestMethod.POST)
     public String reportXls(@RequestBody FeedbackOpinionReportDTO feedbackOpinionReportDTO){
@@ -788,6 +882,81 @@ public class FeedbackOpinionController {
         return downloadUrl;
     }
 
+    @ApiOperation(value="步进")
+    @PostMapping("nextStep")
+    @Transactional(rollbackFor = Exception.class)
+    public MessageResult nextStep(String feedbackOpinionId, String[] stationIds, String allotedDate, @RequestAttribute String subject){
+        MessageResult msgResult = new MessageResult<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+        try {
+            //反馈意见
+            FeedbackOpinion feedbackOpinion = feedbackOpinionService.get(feedbackOpinionId);
+            feedbackOpinion.setConfirmStatus(true);
+            feedbackOpinionService.update(feedbackOpinion);
+
+            //反馈意见步进
+            FeedbackStep feedbackStep = new FeedbackStep();
+            feedbackStep.setId(UUID.randomUUID().toString());
+            feedbackStep.setFeedbackOpinionId(feedbackOpinion.getId());
+            feedbackStep.setAllotedDate(sdf.parse(allotedDate));
+            feedbackStep.setDelFlag(false);
+            feedbackStep.setCreateTime(new Date());
+            feedbackStep.setCreateBy(subject);
+            feedbackStepService.insert(feedbackStep);
+
+            //反馈意见反馈
+            for(String stationId : stationIds) {
+                FeedbackStepStatus feedbackStepStatus = new FeedbackStepStatus();
+                feedbackStepStatus.setId(UUID.randomUUID().toString());
+                feedbackStepStatus.setFeedbackStepId(feedbackStep.getId());
+                feedbackStepStatus.setStationId(stationId);
+                feedbackStepStatus.setStatus(false);
+                feedbackStepStatus.setAllotedDate(sdf.parse(allotedDate));
+                feedbackStepStatus.setDelFlag(false);
+                feedbackStepStatus.setCreateTime(new Date());
+                feedbackStepStatus.setCreateBy(subject);
+                feedbackStepStatusService.insert(feedbackStepStatus);
+            }
+
+            msgResult.setResult(true);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="完成")
+    @PostMapping("finish")
+    @Transactional(rollbackFor = Exception.class)
+    public MessageResult finish(String feedbackOpinionId, @RequestAttribute String subject){
+        MessageResult msgResult = new MessageResult<>();
+        try {
+            //反馈意见
+            FeedbackOpinion feedbackOpinion = feedbackOpinionService.get(feedbackOpinionId);
+            feedbackOpinion.setConfirmStatus(true);
+            feedbackOpinion.setOpinionStatus(true);
+            feedbackOpinion.setUpdateBy(subject);
+            feedbackOpinion.setUpdateTime(new Date());
+            feedbackOpinionService.update(feedbackOpinion);
+
+            msgResult.setResult(true);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
     private String parentFullName(String parentId){
         String fullName = "";