From eb0e0847f4030ec96d18ab0e632aa1668ff6126d Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期四, 24 六月 2021 16:55:48 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/test_esay_photo' into test_esay_photo

---
 springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventVisitingTasksServiceImpl.java |   81 ++++++++++++++++++++++++++++++++--------
 1 files changed, 65 insertions(+), 16 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventVisitingTasksServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventVisitingTasksServiceImpl.java
index b8c1aa7..838950e 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventVisitingTasksServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventVisitingTasksServiceImpl.java
@@ -1,5 +1,6 @@
 package com.panzhihua.service_grid.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -26,14 +27,7 @@
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
-import javax.crypto.BadPaddingException;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.NoSuchPaddingException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @auther lyq
@@ -179,8 +173,8 @@
         if(eventVisitingTasksDO!=null) {
             EventVisitingTasksDetailsVO eventVisitingTasksDetailsVO = new EventVisitingTasksDetailsVO();
             BeanUtils.copyProperties(eventVisitingTasksDO, eventVisitingTasksDetailsVO);
-            ;
             eventVisitingTasksDetailsVO.setVisiterTele(AESUtil.decrypt128(eventVisitingTasksDO.getVisiterTele(), aesKey));
+            eventVisitingTasksDetailsVO.setTableContentJson(JSONObject.parseObject(eventVisitingTasksDO.getTableContentJson()));
             return R.ok(eventVisitingTasksDetailsVO);
         }
         return R.fail();
@@ -224,11 +218,11 @@
             return ;
         }
         EventVisitingTasksDO visitingTasksDO = new EventVisitingTasksDO();
-        visitingTasksDO.setGridMemberStreet(Long.valueOf(gridMap.get("street_id").toString()));
-        visitingTasksDO.setGridMemberCommunity(communityId);
-        visitingTasksDO.setGridMember(Long.valueOf(gridMap.get("user_id").toString()));
-        visitingTasksDO.setGridMemberName(gridMap.get("name").toString());
-        visitingTasksDO.setGridMenberTele(gridMap.get("phone") ==null?"":gridMap.get("phone").toString());
+//        visitingTasksDO.setGridMemberStreet(Long.valueOf(gridMap.get("street_id").toString()));
+//        visitingTasksDO.setGridMemberCommunity(communityId);
+//        visitingTasksDO.setGridMember(Long.valueOf(gridMap.get("user_id").toString()));
+//        visitingTasksDO.setGridMemberName(gridMap.get("name").toString());
+//        visitingTasksDO.setGridMenberTele(gridMap.get("phone") ==null?"":gridMap.get("phone").toString());
         visitingTasksDO.setVisiterId(Long.valueOf(map.get("id").toString()));
         visitingTasksDO.setVisiterName(map.get("name").toString());
         visitingTasksDO.setVisiterSex(Integer.valueOf(map.get("sex").toString()));
@@ -247,7 +241,47 @@
         visitingTasksDO.setUrgent(false);
         visitingTasksDO.setUrgentDell(false);
         visitingTasksDO.setCreateBy(userId);
+        visitingTasksDO.setOutOrLocal(map.get("out_or_local") == null?null:Integer.valueOf(map.get("out_or_local").toString()));
+
+        if(map.get("label") != null){
+            List<String> option = getOption(map.get("label").toString());
+            if(!CollectionUtils.isEmpty(option)){
+                JSONObject json = new JSONObject();
+                json.put("option",option);
+                visitingTasksDO.setTableContentJson(json.toJSONString());
+            }
+        }
+
         eventVisitingTasksMapper.insert(visitingTasksDO);
+    }
+
+    private List<String> getOption(String label) {
+        List<String> option = new ArrayList<>();
+        if(!Objects.isNull(label)) {
+            if (label.contains("精神障碍")) {
+                option.add("精神障碍异常1");
+                option.add("精神障碍异常2");
+                option.add("精神障碍异常3");
+                option.add("精神障碍异常4");
+
+            } else if (label.contains("吸毒")) {
+                option.add("疑似复吸");
+                option.add("失联");
+                option.add("复吸");
+                option.add("空挂户");
+            } else if (label.contains("刑满释放")) {
+                option.add("刑满释放异常1");
+                option.add("刑满释放异常2");
+                option.add("刑满释放异常3");
+                option.add("刑满释放异常4");
+            } else if (label.contains("社区矫正")) {
+                option.add("社区矫正异常1");
+                option.add("社区矫正异常2");
+                option.add("社区矫正异常3");
+                option.add("社区矫正异常4");
+            }
+        }
+        return option;
     }
 
     @Transactional(rollbackFor = Exception.class)
@@ -280,13 +314,23 @@
         return R.fail();
     }
 
+    @Transactional(rollbackFor = Exception.class)
     @Override
-    public R start(Long id) {
+    public synchronized R start(Long id,Long userId) {
         EventVisitingTasksDO eventVisitingTasksDO = eventVisitingTasksMapper.selectById(id);
         if(eventVisitingTasksDO == null || eventVisitingTasksDO.getEventStatus() != EventTasksStatusEnum.DZF.getCode()){
             return R.fail("当前状态不可开始走访");
         }
-        int rt = eventVisitingTasksMapper.start(id,EventTasksStatusEnum.JXZ.getCode());
+        Map<String,Object> map = eventVisitingTasksMapper.findUserById(userId);
+        EventVisitingTasksDO start = new EventVisitingTasksDO();
+        start.setId(id);
+        start.setGridMemberStreet(Long.valueOf(map.get("street_id").toString()));
+        start.setGridMemberCommunity(Long.valueOf(map.get("community_id").toString()));
+        start.setGridMember(Long.valueOf(map.get("user_id").toString()));
+        start.setGridMemberName(map.get("name").toString());
+        start.setGridMenberTele(map.get("phone") ==null?"":map.get("phone").toString());
+        start.setEventStatus(EventTasksStatusEnum.JXZ.getCode());
+        int rt = eventVisitingTasksMapper.start(start);
         if(rt > 0){
             return R.ok();
         }
@@ -306,6 +350,10 @@
             taskCompleteDTO.setEventStatus(EventTasksStatusEnum.YC.getCode());
         }
 
+        JSONObject json = JSONObject.parseObject(eventVisitingTasksDO.getTableContentJson());
+        json.put("check",taskCompleteDTO.getOption());
+        taskCompleteDTO.setOption(json.toJSONString());
+
         if(!CollectionUtils.isEmpty(taskCompleteDTO.getImgList())){
             taskCompleteDTO.getImgList().forEach(e->{
                 createResource(eventVisitingTasksDO.getId(),eventVisitingTasksDO.getDellUserId(),2,1,e);
@@ -321,6 +369,7 @@
                 createResource(eventVisitingTasksDO.getId(),eventVisitingTasksDO.getDellUserId(),2,3,e);
             });
         }
+
         int rt = eventVisitingTasksMapper.complete(taskCompleteDTO);
         if(rt > 0){
             return R.ok();

--
Gitblit v1.7.1