Browse Source

归档、结算统计

lamphua 7 months ago
parent
commit
a8101f9533

+ 59
- 16
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcProjectController.java View File

@@ -1,6 +1,8 @@
1 1
 package com.ruoyi.web.controller.oa;
2 2
 
3 3
 import java.io.IOException;
4
+import java.text.ParseException;
5
+import java.text.SimpleDateFormat;
4 6
 import java.util.*;
5 7
 import java.util.stream.Collectors;
6 8
 import javax.servlet.http.HttpServletResponse;
@@ -9,10 +11,10 @@ import com.alibaba.fastjson2.JSONArray;
9 11
 import com.alibaba.fastjson2.JSONObject;
10 12
 import com.ruoyi.common.core.domain.entity.SysUser;
11 13
 import com.ruoyi.common.utils.StringUtils;
14
+import com.ruoyi.oa.domain.CmcArchive;
12 15
 import com.ruoyi.oa.domain.CmcManageDept;
13
-import com.ruoyi.oa.service.ICmcManageDeptService;
14
-import com.ruoyi.oa.service.ICmcPartyAService;
15
-import com.ruoyi.oa.service.ICmcProjectWorkService;
16
+import com.ruoyi.oa.domain.CmcSettle;
17
+import com.ruoyi.oa.service.*;
16 18
 import com.ruoyi.system.service.ISysDeptService;
17 19
 import com.ruoyi.system.service.ISysUserService;
18 20
 import com.ruoyi.web.controller.qyweixin.MessageController;
@@ -23,7 +25,6 @@ import com.ruoyi.common.core.controller.BaseController;
23 25
 import com.ruoyi.common.core.domain.AjaxResult;
24 26
 import com.ruoyi.common.enums.BusinessType;
25 27
 import com.ruoyi.oa.domain.CmcProject;
26
-import com.ruoyi.oa.service.ICmcProjectService;
27 28
 import com.ruoyi.common.utils.poi.ExcelUtil;
28 29
 import com.ruoyi.common.core.page.TableDataInfo;
29 30
 
@@ -55,6 +56,12 @@ public class CmcProjectController extends BaseController
55 56
     @Autowired
56 57
     private ICmcManageDeptService cmcManageDeptService;
57 58
 
59
+    @Autowired
60
+    private ICmcArchiveService cmcArchiveService;
61
+
62
+    @Autowired
63
+    private ICmcSettleService cmcSettleService;
64
+
58 65
     /**
59 66
      * 查询cmc项目列表
60 67
      */
@@ -144,8 +151,7 @@ public class CmcProjectController extends BaseController
144 151
      * 获取cmc项目统计信息
145 152
      */
146 153
     @GetMapping("/statistic")
147
-    public AjaxResult getProjectStatistic(CmcProject cmcProject)
148
-    {
154
+    public AjaxResult getProjectStatistic(CmcProject cmcProject) throws ParseException {
149 155
         JSONObject jsonObject = new JSONObject();
150 156
         JSONArray yearArray = new JSONArray();
151 157
         JSONObject yearObject = new JSONObject();
@@ -157,40 +163,84 @@ public class CmcProjectController extends BaseController
157 163
         JSONObject deptObject = new JSONObject();
158 164
         JSONArray completeArray = new JSONArray();
159 165
         JSONObject completeObject = new JSONObject();
166
+        JSONArray archiveArray = new JSONArray();
167
+        JSONObject archiveObject = new JSONObject();
168
+        JSONArray settleArray = new JSONArray();
169
+        JSONObject settleObject = new JSONObject();
160 170
         //整体
161 171
         if (cmcProject.getProjectNumber() == null && cmcProject.getProjectSource() == null && cmcProject.getProjectType() == null && cmcProject.getUndertakingDept() == null) {
162 172
             //每年项目数量
163 173
             for (int i = 2019; i <= Calendar.getInstance().get(Calendar.YEAR); i++) {
174
+                //总数
164 175
                 cmcProject.setProjectNumber(String.valueOf(i));
165 176
                 List<CmcProject> yearList = cmcProjectService.selectCmcAllProjectList(cmcProject);
166 177
                 yearObject.put(String.valueOf(i), yearList.size());
178
+                //已完成
179
+                cmcProject.setIsComplete("1");
180
+                yearList = cmcProjectService.selectCmcAllProjectList(cmcProject);
181
+                completeObject.put(String.valueOf(i), yearList.size());
182
+                //已归档
183
+                CmcArchive cmcArchive = new CmcArchive();
184
+                cmcArchive.setProjectNumber(String.valueOf(i));
185
+                cmcArchive.setArchiveTime(new SimpleDateFormat("yyyy").parse(String.valueOf(i)));
186
+                List<CmcArchive> archiveList = cmcArchiveService.selectCmcArchiveList(cmcArchive);
187
+                archiveObject.put(String.valueOf(i), archiveList.size());
188
+                //已结算
189
+                CmcSettle cmcSettle = new CmcSettle();
190
+                cmcSettle.setProjectNumber(String.valueOf(i));
191
+                cmcSettle.setGmTime(new SimpleDateFormat("yyyy").parse(String.valueOf(i)));
192
+                List<CmcSettle> settleList = cmcSettleService.selectCmcSettleList(cmcSettle);
193
+                settleObject.put(String.valueOf(i), settleList.size());
167 194
             }
168 195
             cmcProject.setProjectNumber(null);
196
+            cmcProject.setIsComplete(null);
169 197
             getProjectSourceStatistic(cmcProject, sourceObject);
170 198
             getProjectTypeStatistic(cmcProject, typeObject);
171 199
             getProjectDeptStatistic(cmcProject, deptObject);
172
-            getProjectCompleteStatistic(cmcProject, completeObject);
173 200
 
174 201
         }
175 202
         //年度
176 203
         else if (cmcProject.getProjectNumber() != null && cmcProject.getProjectSource() == null && cmcProject.getProjectType() == null && cmcProject.getUndertakingDept() == null) {
177 204
             //输入年份项目数量
178
-            yearObject.put(cmcProject.getProjectNumber(),  cmcProjectService.selectCmcAllProjectList(cmcProject).size());
205
+            List<CmcProject> yearList = cmcProjectService.selectCmcAllProjectList(cmcProject);
206
+            //总数
207
+            yearObject.put(cmcProject.getProjectNumber(),  yearList.size());
208
+            //已完成
209
+            cmcProject.setIsComplete("1");
210
+            yearList = cmcProjectService.selectCmcAllProjectList(cmcProject);
211
+            completeObject.put(cmcProject.getProjectNumber(), yearList.size());
212
+            cmcProject.setIsComplete(null);
213
+            //已归档
214
+            CmcArchive cmcArchive = new CmcArchive();
215
+            cmcArchive.setProjectNumber(cmcProject.getProjectNumber());
216
+            cmcArchive.setArchiveTime(new SimpleDateFormat("yyyy").parse(cmcProject.getProjectNumber() + "-01-01"));
217
+            List<CmcArchive> archiveList = cmcArchiveService.selectCmcArchiveList(cmcArchive);
218
+            archiveObject.put(cmcProject.getProjectNumber(), archiveList.size());
219
+            //已结算
220
+            CmcSettle cmcSettle = new CmcSettle();
221
+            cmcSettle.setProjectNumber(cmcProject.getProjectNumber());
222
+            cmcSettle.setGmTime(new SimpleDateFormat("yyyy").parse(cmcProject.getProjectNumber() + "-01-01"));
223
+            List<CmcSettle> settleList = cmcSettleService.selectCmcSettleList(cmcSettle);
224
+            settleObject.put(cmcProject.getProjectNumber(), settleList.size());
225
+            
179 226
             getProjectSourceStatistic(cmcProject, sourceObject);
180 227
             getProjectTypeStatistic(cmcProject, typeObject);
181 228
             getProjectDeptStatistic(cmcProject, deptObject);
182
-            getProjectCompleteStatistic(cmcProject, completeObject);
183 229
         }
184 230
         yearArray.add(yearObject);
185 231
         sourceArray.add(sourceObject);
186 232
         deptArray.add(deptObject);
187 233
         typeArray.add(typeObject);
188 234
         completeArray.add(completeObject);
235
+        archiveArray.add(archiveObject);
236
+        settleArray.add(settleObject);
189 237
         jsonObject.put("year", yearArray);
190 238
         jsonObject.put("source", sourceArray);
191 239
         jsonObject.put("dept", deptArray);
192 240
         jsonObject.put("type", typeArray);
193 241
         jsonObject.put("complete", completeArray);
242
+        jsonObject.put("archive", archiveArray);
243
+        jsonObject.put("settle", settleArray);
194 244
         return success(jsonObject);
195 245
     }
196 246
 
@@ -335,11 +385,4 @@ public class CmcProjectController extends BaseController
335 385
         cmcProject.setUndertakingDept(null);
336 386
     }
337 387
 
338
-    //项目完成数量
339
-    public void getProjectCompleteStatistic(CmcProject cmcProject, JSONObject completeObject) {
340
-        cmcProject.setIsComplete("1");
341
-        List<CmcProject> completeList = cmcProjectService.selectCmcAllProjectList(cmcProject);
342
-        completeObject.put("已完成",completeList.size());
343
-    }
344
-
345 388
 }

+ 9
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcArchive.java View File

@@ -133,6 +133,15 @@ public class CmcArchive extends BaseEntity
133 133
     {
134 134
         return projectId;
135 135
     }
136
+    public void setProjectNumber(String projectNumber)
137
+    {
138
+        this.projectNumber = projectNumber;
139
+    }
140
+
141
+    public String getProjectNumber()
142
+    {
143
+        return projectNumber;
144
+    }
136 145
     public void setProject(CmcProject project)
137 146
     {
138 147
         this.project = project;

+ 9
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcSettle.java View File

@@ -199,6 +199,15 @@ public class CmcSettle extends BaseEntity
199 199
     {
200 200
         return projectId;
201 201
     }
202
+    public void setProjectNumber(String projectNumber)
203
+    {
204
+        this.projectNumber = projectNumber;
205
+    }
206
+
207
+    public String getProjectNumber()
208
+    {
209
+        return projectNumber;
210
+    }
202 211
     public void setProject(CmcProject project)
203 212
     {
204 213
         this.project = project;

+ 3
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcArchiveMapper.xml View File

@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
7 7
     <resultMap type="CmcArchive" id="CmcArchiveResult">
8 8
         <result property="archiveId"    column="archive_id"    />
9 9
         <result property="projectId"    column="project_id"    />
10
+        <result property="projectNumber"    column="project_number"    />
10 11
         <result property="projectLeader"    column="project_leader"    />
11 12
         <result property="submitTime"    column="submit_time"    />
12 13
         <result property="submitSituation"    column="submit_situation"    />
@@ -79,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
79 80
         <include refid="selectCmcArchiveVo"/>
80 81
         <where>  
81 82
             <if test="projectId != null  and projectId != ''"> and a.project_id = #{projectId}</if>
83
+            <if test="projectNumber != null  and projectNumber != ''"> and p.project_number like concat('%', #{projectNumber}, '%')</if>
82 84
             <if test="projectLeader != null  and projectLeader != ''"> and a.project_leader = #{projectLeader}</if>
83 85
             <if test="submitTime != null "> and a.submit_time = #{submitTime}</if>
84 86
             <if test="submitSituation != null  and submitSituation != ''"> and a.submit_situation = #{submitSituation}</if>
@@ -90,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
90 92
             <if test="qualityTime != null "> and a.quality_time = #{qualityTime}</if>
91 93
             <if test="produceTime != null "> and a.produce_time = #{produceTime}</if>
92 94
             <if test="deptTime != null "> and a.dept_time = #{deptTime}</if>
93
-            <if test="archiveTime != null "> and a.archive_time = #{archiveTime}</if>
95
+            <if test="archiveTime != null "> and YEAR(a.archive_time) = YEAR(#{archiveTime})</if>
94 96
             <if test="produceComment != null  and produceComment != ''"> and a.produce_comment = #{produceComment}</if>
95 97
             <if test="qualityComment != null  and qualityComment != ''"> and a.quality_comment = #{qualityComment}</if>
96 98
             <if test="deptComment != null  and deptComment != ''"> and a.dept_comment = #{deptComment}</if>

+ 3
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcSettleMapper.xml View File

@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
7 7
     <resultMap type="CmcSettle" id="CmcSettleResult">
8 8
         <result property="settleId"    column="settle_id"    />
9 9
         <result property="projectId"    column="project_id"    />
10
+        <result property="projectNumber"    column="project_number"    />
10 11
         <result property="undertakingDept"    column="undertaking_dept"    />
11 12
         <result property="reportDept"    column="report_dept"    />
12 13
         <result property="xmName"    column="xm_name"    />
@@ -114,6 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
114 115
         <where>
115 116
             <if test="settleId != null  and settleId != ''"> and s.settle_id = #{settleId}</if>
116 117
             <if test="projectId != null"> and s.project_id = #{projectId}</if>
118
+            <if test="projectNumber != null  and projectNumber != ''"> and p.project_number like concat('%', #{projectNumber}, '%')</if>
117 119
             <if test="undertakingDept != null  and undertakingDept != ''"> and find_in_set(#{undertakingDept}, p.undertaking_dept)</if>
118 120
             <if test="reportDept != null  and reportDept != ''"> and s.report_dept = #{reportDept}</if>
119 121
             <if test="xmName != null"> and s.xm_name like concat('%', #{xmName}, '%')</if>
@@ -134,7 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
134 136
             <if test="managerTime != null "> and s.manager_time = #{managerTime}</if>
135 137
             <if test="managerComment != null  and managerComment != ''"> and s.manager_comment = #{managerComment}</if>
136 138
             <if test="gmUserId != null "> and s.gm_user_id = #{gmUserId}</if>
137
-            <if test="gmTime != null "> and s.gm_time = #{gmTime}</if>
139
+            <if test="gmTime != null "> and YEAR(s.gm_time) = YEAR(#{gmTime})</if>
138 140
             <if test="gmComment != null  and gmComment != ''"> and s.gm_comment = #{gmComment}</if>
139 141
         </where>
140 142
         order by s.report_time desc

Loading…
Cancel
Save