Yansen 2 yıl önce
ebeveyn
işleme
1faa7c6b8a

+ 1
- 0
src/main/java/com/example/civilizedcity/controller/CommController.java Dosyayı Görüntüle

@@ -78,6 +78,7 @@ public class CommController extends BaseController {
78 78
         String url = String.format("%s/%s", uploadPrefix, newFileName);
79 79
         return ResponseBean.success(new HashMap<String, Object>(){{
80 80
             put("url", url);
81
+            put("fileType", fileType);
81 82
         }});
82 83
     }
83 84
 

+ 34
- 17
src/main/java/com/example/civilizedcity/controller/TaOrgIssueController.java Dosyayı Görüntüle

@@ -8,6 +8,7 @@ import com.example.civilizedcity.common.Constants;
8 8
 import com.example.civilizedcity.common.ResponseBean;
9 9
 import java.util.List;
10 10
 
11
+import com.example.civilizedcity.common.StringUtils;
11 12
 import com.example.civilizedcity.entity.SysUser;
12 13
 import com.example.civilizedcity.entity.TaAttach;
13 14
 import com.example.civilizedcity.entity.TaIssue;
@@ -45,7 +46,15 @@ public class TaOrgIssueController extends BaseController {
45 46
     @ApiOperation("通过ID查询单条数据")
46 47
     @GetMapping("/taOrgIssue/{id}")
47 48
     public ResponseBean queryById(@ApiParam("对象ID") @PathVariable Integer id) throws Exception {
48
-        return ResponseBean.success(taOrgIssueService.getById(id));
49
+        TaOrgIssue taOrgIssue = taOrgIssueService.getById(id);
50
+        if (null == taOrgIssue || taOrgIssue.getStatus() == Constants.STATUS_DELETE) {
51
+            return ResponseBean.error("未找到记录");
52
+        }
53
+
54
+        List<TaAttach> attachList = taAttachService.getListBy(Constants.SOURCE_ORG_ISSUE, id.toString());
55
+        taOrgIssue.setAttachList(attachList);
56
+
57
+        return ResponseBean.success(taOrgIssue);
49 58
     }
50 59
      /**
51 60
       * 通过ISSUE_ID查询单条数据
@@ -55,10 +64,14 @@ public class TaOrgIssueController extends BaseController {
55 64
       */
56 65
      @ApiOperation("通过ISSUE_ID查询单条数据")
57 66
      @GetMapping("/taIssue/{issueId}/orgIssue")
58
-     public ResponseBean queryByIssueId(@ApiParam("对象ID") @PathVariable Integer issueId) throws Exception {
67
+     public ResponseBean queryByIssueId(@ApiParam("对象ID") @PathVariable Integer issueId,
68
+                                        @ApiParam("申请单位") @RequestParam(value = "orgId", required = false) String orgId) throws Exception {
69
+
70
+         SysUser sysUser = currentUser();
59 71
 
60 72
          QueryWrapper<TaOrgIssue> queryWrapper = new QueryWrapper<>();
61 73
          queryWrapper.eq("issue_id", issueId);
74
+         queryWrapper.eq("org_id", StringUtils.isEmpty(orgId) ? sysUser.getOrgId() : orgId);
62 75
          queryWrapper.eq("status", Constants.STATUS_NORMAL);
63 76
 
64 77
          TaOrgIssue taOrgIssue = taOrgIssueService.getOne(queryWrapper);
@@ -104,21 +117,25 @@ public class TaOrgIssueController extends BaseController {
104 117
 //        return ResponseBean.success(taOrgIssue);
105 118
 //    }
106 119
 //
107
-//    /**
108
-//     * 更新数据
109
-//     *
110
-//     * @param taOrgIssue 实例对象
111
-//     * @return 实例对象
112
-//     */
113
-//    @ApiOperation("更新数据")
114
-//    @PutMapping("/taOrgIssue/{id}")
115
-//    public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaOrgIssue taOrgIssue,
116
-//                            @ApiParam("对象ID") @PathVariable Integer id ) throws Exception {
117
-//        taOrgIssue.setOrgIssueId(id);
118
-//
119
-//        taOrgIssueService.updateById(taOrgIssue);
120
-//        return ResponseBean.success(taOrgIssue);
121
-//    }
120
+    /**
121
+     * 更新数据
122
+     *
123
+     * @param taOrgIssue 实例对象
124
+     * @return 实例对象
125
+     */
126
+    @ApiOperation("更新数据")
127
+    @PutMapping("/taOrgIssue/{id}")
128
+    public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaOrgIssue taOrgIssue,
129
+                            @ApiParam("对象ID") @PathVariable Integer id ) throws Exception {
130
+        taOrgIssue.setOrgIssueId(id);
131
+
132
+        if (null == taOrgIssue.getAttachList() || taOrgIssue.getAttachList().size() == 0) {
133
+            return ResponseBean.error("请上传图片");
134
+        }
135
+
136
+        taOrgIssueService.updateData(taOrgIssue);
137
+        return ResponseBean.success(taOrgIssue);
138
+    }
122 139
 //
123 140
 //    /**
124 141
 //     * 通过主键删除数据

+ 2
- 0
src/main/java/com/example/civilizedcity/service/TaOrgIssueService.java Dosyayı Görüntüle

@@ -18,4 +18,6 @@ public interface TaOrgIssueService extends IBaseService<TaOrgIssue> {
18 18
      void createNewIssue(TaIssue taIssue, TaIssueProcess taIssueProcess, SysUser sysUser) throws Exception;
19 19
 
20 20
      TaOrgIssue getByIssueAndOrg(Integer issueId, String orgId);
21
+
22
+     void updateData(TaOrgIssue taOrgIssue) throws Exception;
21 23
  }

+ 35
- 6
src/main/java/com/example/civilizedcity/service/impl/TaOrgIssueServiceImpl.java Dosyayı Görüntüle

@@ -4,16 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.example.civilizedcity.common.Constants;
5 5
 import com.example.civilizedcity.common.StringUtils;
6 6
 import com.example.civilizedcity.entity.*;
7
-import com.example.civilizedcity.mapper.TaFeedbackMapper;
8
-import com.example.civilizedcity.mapper.TaIssueMapper;
9
-import com.example.civilizedcity.mapper.TaIssueProcessMapper;
7
+import com.example.civilizedcity.mapper.*;
10 8
 import org.springframework.beans.factory.annotation.Autowired;
11 9
 import org.springframework.stereotype.Service;
12
-import com.example.civilizedcity.mapper.TaOrgIssueMapper;
13 10
 import com.example.civilizedcity.service.TaOrgIssueService;
14 11
 import org.springframework.transaction.annotation.Transactional;
15 12
 
16 13
 import java.time.LocalDateTime;
14
+import java.util.ArrayList;
15
+import java.util.List;
17 16
 
18 17
 /**
19 18
  * 单位问题单;(ta_org_issue)表服务实现类
@@ -33,6 +32,9 @@ public class TaOrgIssueServiceImpl extends BaseServiceImpl<TaOrgIssueMapper, TaO
33 32
     @Autowired
34 33
     TaFeedbackMapper taFeedbackMapper;
35 34
 
35
+    @Autowired
36
+    TaAttachMapper taAttachMapper;
37
+
36 38
     @Override
37 39
     public IPage<TaIssue> getIssuePageBy(IPage<TaIssue> pg, String orgId, String sourceType, String bizStatus) {
38 40
 
@@ -77,8 +79,8 @@ public class TaOrgIssueServiceImpl extends BaseServiceImpl<TaOrgIssueMapper, TaO
77 79
         TaOrgIssue taOrgIssue = new TaOrgIssue();
78 80
         taOrgIssue.setIssueId(taIssue.getIssueId());
79 81
         taOrgIssue.setOrgId(taIssue.getOrgId());
80
-        taOrgIssue.setProcessNode(Constants.PROCESS_START);
81
-        taOrgIssue.setProcessStatus(Constants.APPLY_READY); // 状态是未审核
82
+        taOrgIssue.setProcessNode(Constants.PROCESS_ASSIGNED);
83
+        taOrgIssue.setProcessStatus(null);
82 84
         taOrgIssue.setStatus(Constants.STATUS_NORMAL);
83 85
         taOrgIssue.setCreateDate(LocalDateTime.now());
84 86
         taOrgIssue.setCreateUser(sysUser.getUserId());
@@ -98,4 +100,31 @@ public class TaOrgIssueServiceImpl extends BaseServiceImpl<TaOrgIssueMapper, TaO
98 100
     public TaOrgIssue getByIssueAndOrg(Integer issueId, String orgId) {
99 101
         return baseMapper.getByIssueAndOrg(issueId, orgId);
100 102
     }
103
+
104
+    @Transactional(rollbackFor = Exception.class)
105
+    @Override
106
+    public void updateData(TaOrgIssue taOrgIssue) throws Exception {
107
+        updateById(taOrgIssue);
108
+
109
+        // 保存文件
110
+        List<TaAttach> attachList = taOrgIssue.getAttachList();
111
+        List<Integer> idList = new ArrayList<>();
112
+        for (TaAttach item : attachList) {
113
+            item.setOwnerType(Constants.SOURCE_ORG_ISSUE);
114
+            item.setOwnerId(taOrgIssue.getOrgIssueId().toString());
115
+            item.setStatus(Constants.STATUS_NORMAL);
116
+            item.setCreateDate(LocalDateTime.now());
117
+
118
+            if (null == item.getAttachId()) {
119
+                taAttachMapper.insert(item);
120
+            } else {
121
+                taAttachMapper.updateById(item);
122
+            }
123
+            idList.add(item.getAttachId());
124
+        }
125
+
126
+        // 删除部分文件
127
+        taAttachMapper.deleteNotIn(idList, Constants.SOURCE_ISSUE, taOrgIssue.getOrgIssueId().toString());
128
+        taOrgIssue.setAttachList(attachList);
129
+    }
101 130
 }

+ 3
- 3
src/main/resources/mapper/TaOrgIssueMapper.xml Dosyayı Görüntüle

@@ -55,9 +55,9 @@
55 55
     </select>
56 56
     <select id="statMaIndex" resultType="java.util.Map">
57 57
         select
58
-            SUM(IF(TO_DAYS(now()) > TO_DAYS(s.expire_date), 1, 0)) as delay_num,
59
-            SUM(s.process_node = '03', 1, 0) as end_num,
60
-            SUM(s.process_node != '03', 1, 0) as doing_num
58
+            SUM( IF ( TO_DAYS( now( ) ) > TO_DAYS( s.expire_date ) AND s.process_node != '03', 1, 0 ) ) AS delay_num,
59
+            SUM( IF (s.process_node = '03', 1, 0 ) ) AS end_num,
60
+            SUM( IF (s.process_node != '03', 1, 0 ) ) AS doing_num
61 61
         from ta_org_issue t
62 62
                  INNER JOIN ta_issue s on t.issue_id = s.issue_id AND t.org_id = s.org_id
63 63
         where t.org_id = #{orgId}