From b1e9f850ffa9406c7df90d9cb9fd6dc0b7446202 Mon Sep 17 00:00:00 2001 From: xyh <18782104331@139.com> Date: 星期四, 24 六月 2021 18:30:24 +0800 Subject: [PATCH] 联调修改 --- springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventVisitingTasksServiceImpl.java | 101 ++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 84 insertions(+), 17 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..cc7c6f1 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,10 +1,12 @@ 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; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.enums.EventTasksStatusEnum; +import com.panzhihua.common.enums.PopulPoliticalOutlookEnum; import com.panzhihua.common.model.dtos.grid.EventVisitingTasksAddDTO; import com.panzhihua.common.model.dtos.grid.EventVisitingTasksDeleteDTO; import com.panzhihua.common.model.dtos.grid.EventVisitingTasksEditDTO; @@ -31,9 +33,7 @@ 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 @@ -137,10 +137,21 @@ } @Override - public R taskList(EventTasksQuery query) { + public R taskList(EventTasksQuery query) throws Exception{ IPage<EventVisitingTasksVO> page = eventVisitingTasksMapper.findListByPage(new Page(query.getPageNum(),query.getPageSize()),query); + for(EventVisitingTasksVO eventVisitingTasksVO:page.getRecords()){ + if(eventVisitingTasksVO.getNationCode() != null){ + eventVisitingTasksVO.setNation(PopulPoliticalOutlookEnum.getCnDescByName(eventVisitingTasksVO.getNationCode())); + } + if(eventVisitingTasksVO.getVisiterTele() != null){ + } + eventVisitingTasksVO.setVisiterTele(AESUtil.decrypt128(eventVisitingTasksVO.getVisiterTele(), aesKey)); + } + page.getRecords().forEach(e->{ + + }); return R.ok(page); } @@ -179,8 +190,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(); @@ -188,7 +199,7 @@ @Transactional(rollbackFor = Exception.class) @Override - public R add(String ids, Long communityId, Long userId) { + public R add(String ids, Long communityId, Long userId) throws Exception { Map<String,Object> map = eventVisitingTasksMapper.findUserByCommunityId(communityId,6); if(CollectionUtils.isEmpty(map)){ return R.fail("网格员不存在"); @@ -205,15 +216,14 @@ } @Override - public List<EventVisitingTasksVO> exportTaskList(EventTasksQuery query) { + public List<EventVisitingTasksVO> exportTaskList(EventTasksQuery query) throws Exception { IPage<EventVisitingTasksVO> page = eventVisitingTasksMapper.findListByPage(new Page(query.getPageNum(),query.getPageSize()),query); - return page.getRecords(); } - private void addVisitingTask(Long id, Map<String, Object> gridMap,Long communityId,Long userId) { + private void addVisitingTask(Long id, Map<String, Object> gridMap,Long communityId,Long userId) throws Exception{ Integer count = eventVisitingTasksMapper.countNoneComplete(id); if(count > 0){ @@ -224,15 +234,17 @@ 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())); - visitingTasksDO.setVisiterTele(map.get("phone") == null?"":map.get("phone").toString()); + if(map.get("phone") != null){ + visitingTasksDO.setVisiterTele(AESUtil.decrypt128(map.get("phone").toString(),aesKey)); + } StringBuilder sb = new StringBuilder(); sb.append(map.get("address")).append(map.get("road")).append(map.get("door_no")).append(map.get("floor")).append("栋").append(map.get("unit_no")).append("单元").append(map.get("house_no")).append("号"); visitingTasksDO.setVisiterAddress(sb.toString()); @@ -247,7 +259,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 +332,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 +368,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 +387,7 @@ createResource(eventVisitingTasksDO.getId(),eventVisitingTasksDO.getDellUserId(),2,3,e); }); } + int rt = eventVisitingTasksMapper.complete(taskCompleteDTO); if(rt > 0){ return R.ok(); -- Gitblit v1.7.1