Browse Source

调整架构,审核流程未完成

Yansen 2 years ago
parent
commit
e666fa9b72

+ 7
- 7
src/main/java/com/example/civilizedcity/controller/TaIssueApplyController.java View File

140
             return ResponseBean.error("未找到申请数据");
140
             return ResponseBean.error("未找到申请数据");
141
         }
141
         }
142
 
142
 
143
-        SysUser sysUser = currentUser();
143
+        // 如果是审核驳回
144
+        if (StringUtils.isEmpty(taIssueApply.getVerifyDesc()) && Constants.APPLY_STATUS_REJECT.equals(taIssueApply.getVerifyStatus())) {
145
+            return ResponseBean.error("请填写驳回理由");
146
+        }
144
 
147
 
145
-//        // 如果是问题单审核
146
-//        if (Constants.APPLY_VERIFY.equals(origin.getApplyType())) {
147
-//            if (StringUtils.isEmpty(taIssueApply.getVerifyDesc()) && Constants.APPLY_STATUS_REJECT.equals(taIssueApply.getVerifyStatus())) {
148
-//                return ResponseBean.error("请填写驳回理由");
149
-//            }
150
-//        }
148
+        SysUser sysUser = currentUser();
149
+        taIssueApply.setApplyId(id);
150
+        taIssueApplyService.verify(taIssueApply, sysUser, origin);
151
 
151
 
152
         origin.setVerifyStatus(taIssueApply.getVerifyStatus());
152
         origin.setVerifyStatus(taIssueApply.getVerifyStatus());
153
         origin.setVerifyDesc(taIssueApply.getVerifyDesc());
153
         origin.setVerifyDesc(taIssueApply.getVerifyDesc());

+ 2
- 0
src/main/java/com/example/civilizedcity/service/TaIssueApplyService.java View File

15
      void createNewApply(TaIssueApply taIssueApply, SysUser sysUser) throws Exception;
15
      void createNewApply(TaIssueApply taIssueApply, SysUser sysUser) throws Exception;
16
 
16
 
17
      IPage<TaIssueApply> getPageBy(IPage<TaIssueApply> pg, Integer issueId, String applyType, String orgId, String sourceType);
17
      IPage<TaIssueApply> getPageBy(IPage<TaIssueApply> pg, Integer issueId, String applyType, String orgId, String sourceType);
18
+
19
+     void verify(TaIssueApply taIssueApply, SysUser sysUser, TaIssueApply origin) throws Exception;
18
  }
20
  }

+ 73
- 0
src/main/java/com/example/civilizedcity/service/impl/TaIssueApplyServiceImpl.java View File

1
 package com.example.civilizedcity.service.impl;
1
 package com.example.civilizedcity.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.example.civilizedcity.common.Constants;
5
 import com.example.civilizedcity.common.Constants;
5
 import com.example.civilizedcity.common.ResponseBean;
6
 import com.example.civilizedcity.common.ResponseBean;
6
 import com.example.civilizedcity.entity.SysUser;
7
 import com.example.civilizedcity.entity.SysUser;
8
+import com.example.civilizedcity.entity.TaIssue;
7
 import com.example.civilizedcity.entity.TaOrgIssue;
9
 import com.example.civilizedcity.entity.TaOrgIssue;
8
 import com.example.civilizedcity.event.MessagEvent;
10
 import com.example.civilizedcity.event.MessagEvent;
9
 import com.example.civilizedcity.mapper.TaIssueMapper;
11
 import com.example.civilizedcity.mapper.TaIssueMapper;
14
 import com.example.civilizedcity.entity.TaIssueApply;
16
 import com.example.civilizedcity.entity.TaIssueApply;
15
 import com.example.civilizedcity.mapper.TaIssueApplyMapper;
17
 import com.example.civilizedcity.mapper.TaIssueApplyMapper;
16
 import com.example.civilizedcity.service.TaIssueApplyService;
18
 import com.example.civilizedcity.service.TaIssueApplyService;
19
+import org.springframework.transaction.annotation.Transactional;
17
 
20
 
18
 import java.time.LocalDateTime;
21
 import java.time.LocalDateTime;
19
 
22
 
74
     public IPage<TaIssueApply> getPageBy(IPage<TaIssueApply> pg, Integer issueId, String applyType, String orgId, String sourceType) {
77
     public IPage<TaIssueApply> getPageBy(IPage<TaIssueApply> pg, Integer issueId, String applyType, String orgId, String sourceType) {
75
         return baseMapper.getPageBy(pg, issueId, applyType, orgId, sourceType);
78
         return baseMapper.getPageBy(pg, issueId, applyType, orgId, sourceType);
76
     }
79
     }
80
+
81
+    @Transactional(rollbackFor = Exception.class)
82
+    @Override
83
+    public void verify(TaIssueApply taIssueApply, SysUser sysUser, TaIssueApply origin) throws Exception {
84
+        // 先更新审核信息
85
+        origin.setVerifyStatus(taIssueApply.getVerifyStatus());
86
+        origin.setVerifyDesc(taIssueApply.getVerifyDesc());
87
+        origin.setVerifyOrg(sysUser.getOrgId());
88
+        origin.setVerifyUser(sysUser.getUserId());
89
+        origin.setVerifyUserName(sysUser.getName());
90
+        origin.setVerifyDate(LocalDateTime.now());
91
+        updateById(origin);
92
+
93
+        // 再判断审核类型
94
+        switch (origin.getApplyType()) {
95
+            case Constants.APPLY_VERIFY:
96
+                // 问题单审核
97
+                verifyIssue();
98
+                break;
99
+            case Constants.APPLY_REJECT:
100
+                // 问题单驳回
101
+                verifyReject();
102
+                break;
103
+            case Constants.APPLY_DELAY:
104
+                // 延期申请
105
+                verifyDelay(taIssueApply, origin);
106
+                break;
107
+            case Constants.APPLY_END:
108
+                // 销单申请
109
+                break;
110
+            default:
111
+                // 其他
112
+                break;
113
+        }
114
+
115
+    }
116
+
117
+    // 问题单审核
118
+    public void verifyIssue() throws Exception {
119
+        // TODO;
120
+    }
121
+
122
+    // 驳回审核
123
+    public void verifyReject() throws Exception {
124
+        // TODO;
125
+    }
126
+
127
+    // 延期审核
128
+    public void verifyDelay(TaIssueApply taIssueApply, TaIssueApply origin) throws Exception {
129
+        if (Constants.APPLY_STATUS_REJECT.equals(taIssueApply.getVerifyStatus())) {
130
+            // 如果审核不通过
131
+            // TODO;
132
+        } else {
133
+            // 问题单截止日期更新为申请的截止日期
134
+            // 问题单的申请关联清空
135
+            UpdateWrapper<TaIssue> updateWrapper = new UpdateWrapper<>();
136
+            updateWrapper.set("expire_date", taIssueApply.getContent());
137
+            updateWrapper.set("apply_type", null);
138
+            updateWrapper.set("apply_id", null);
139
+            updateWrapper.eq("issue_id", origin.getIssueId());
140
+
141
+        }
142
+    }
143
+
144
+    // 问题单审核
145
+    public void verifyIssue() throws Exception {
146
+        // TODO;
147
+    }
148
+
149
+
77
 }
150
 }

+ 4
- 0
src/main/java/com/example/civilizedcity/service/impl/TaIssueServiceImpl.java View File

17
 
17
 
18
 import java.time.LocalDateTime;
18
 import java.time.LocalDateTime;
19
 import java.util.ArrayList;
19
 import java.util.ArrayList;
20
+import java.util.HashMap;
20
 import java.util.List;
21
 import java.util.List;
21
 import java.util.Map;
22
 import java.util.Map;
22
 
23
 
97
         // 市民
98
         // 市民
98
         else {
99
         else {
99
             Map<String, Object> res = taFeedbackMapper.statMaIndex(person.getPersonId());
100
             Map<String, Object> res = taFeedbackMapper.statMaIndex(person.getPersonId());
101
+            if (null == res) {
102
+                res = new HashMap<>();
103
+            }
100
             result.add(new StatVo().setName("未处理").setValue(getStatValueBy(res.get("unassigned_num"), 0)));
104
             result.add(new StatVo().setName("未处理").setValue(getStatValueBy(res.get("unassigned_num"), 0)));
101
             result.add(new StatVo().setName("已处理").setValue(getStatValueBy(res.get("assigned_num"), 0) + getStatValueBy(res.get("end_num"), 0)));
105
             result.add(new StatVo().setName("已处理").setValue(getStatValueBy(res.get("assigned_num"), 0) + getStatValueBy(res.get("end_num"), 0)));
102
             result.add(new StatVo().setName("已打回").setValue(getStatValueBy(res.get("reject_num"), 0)));
106
             result.add(new StatVo().setName("已打回").setValue(getStatValueBy(res.get("reject_num"), 0)));