Browse Source

借款、结算统计

lamphua 7 months ago
parent
commit
2ffb3de140

+ 3
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcBorrowController.java View File

191
     }
191
     }
192
 
192
 
193
     //各用途借款次数
193
     //各用途借款次数
194
-    public void getBorrowUsageStatistic(CmcBorrow cmcBorrow, JSONObject usageObject, JSONObject usageAmountObject, JSONObject yearProjectCountObject, JSONObject yearProjectAmountObject) {
194
+    public void getBorrowUsageStatistic(CmcBorrow cmcBorrow, JSONObject usageObject, JSONObject usageAmountObject, JSONObject yearProjectCountObject, JSONObject yearProjectAmountObject) throws ParseException {
195
         cmcBorrow.setBorrowUsage("0");
195
         cmcBorrow.setBorrowUsage("0");
196
+        if (cmcBorrow.getLendTime() == null)
197
+            cmcBorrow.setLendTime(new SimpleDateFormat("yyyy").parse("2000-01-01"));
196
         List<CmcBorrow> usageList = cmcBorrowService.selectCmcBorrowList(cmcBorrow);
198
         List<CmcBorrow> usageList = cmcBorrowService.selectCmcBorrowList(cmcBorrow);
197
         usageObject.put("项目借款", usageList.size());
199
         usageObject.put("项目借款", usageList.size());
198
         BigDecimal pAmount = new BigDecimal(0);
200
         BigDecimal pAmount = new BigDecimal(0);

+ 11
- 13
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcSettleController.java View File

10
 import com.alibaba.fastjson2.JSONArray;
10
 import com.alibaba.fastjson2.JSONArray;
11
 import com.alibaba.fastjson2.JSONObject;
11
 import com.alibaba.fastjson2.JSONObject;
12
 import com.ruoyi.oa.domain.CmcSettle;
12
 import com.ruoyi.oa.domain.CmcSettle;
13
-import com.ruoyi.oa.domain.CmcSettleSummary;
14
 import com.ruoyi.oa.service.ICmcSettleSummaryService;
13
 import com.ruoyi.oa.service.ICmcSettleSummaryService;
15
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.web.bind.annotation.GetMapping;
15
 import org.springframework.web.bind.annotation.GetMapping;
99
         if (cmcSettle.getGmTime() == null) {
98
         if (cmcSettle.getGmTime() == null) {
100
             for (int i = 2019; i <= Calendar.getInstance().get(Calendar.YEAR); i++) {
99
             for (int i = 2019; i <= Calendar.getInstance().get(Calendar.YEAR); i++) {
101
                 cmcSettle.setGmTime(new SimpleDateFormat("yyyy").parse(String.valueOf(i)));
100
                 cmcSettle.setGmTime(new SimpleDateFormat("yyyy").parse(String.valueOf(i)));
102
-                List<CmcSettle> yearList = cmcSettleService.selectCmcSettleList(cmcSettle);
103
-                yearObject.put(String.valueOf(i), yearList.size());
101
+                yearObject.put(String.valueOf(i), cmcSettleService.selectCmcSettleList(cmcSettle).size());
104
                 BigDecimal amount = new BigDecimal(0);
102
                 BigDecimal amount = new BigDecimal(0);
105
-                for (CmcSettle settle : cmcSettleService.selectCmcSettleStatisticList(cmcSettle)) {
103
+                for (CmcSettle settle : cmcSettleService.selectCmcSettleList(cmcSettle)) {
106
                     if (settle.getAmount() != null)
104
                     if (settle.getAmount() != null)
107
                         amount = amount.add(settle.getAmount());
105
                         amount = amount.add(settle.getAmount());
108
                 }
106
                 }
113
         else {
111
         else {
114
             yearObject.put(new SimpleDateFormat("yyyy").format(cmcSettle.getGmTime()), cmcSettleService.selectCmcSettleList(cmcSettle).size());
112
             yearObject.put(new SimpleDateFormat("yyyy").format(cmcSettle.getGmTime()), cmcSettleService.selectCmcSettleList(cmcSettle).size());
115
             BigDecimal amount = new BigDecimal(0);
113
             BigDecimal amount = new BigDecimal(0);
116
-            for (CmcSettle settle : cmcSettleService.selectCmcSettleStatisticList(cmcSettle)) {
114
+            for (CmcSettle settle : cmcSettleService.selectCmcSettleList(cmcSettle)) {
117
                 if (settle.getAmount() != null)
115
                 if (settle.getAmount() != null)
118
                     amount = amount.add(settle.getAmount());
116
                     amount = amount.add(settle.getAmount());
119
             }
117
             }
171
     }
169
     }
172
 
170
 
173
     //各用途结算次数
171
     //各用途结算次数
174
-    public void getSettleTypeStatistic(CmcSettle cmcSettle, JSONObject typeObject, JSONObject typeAmountObject, JSONObject yearProjectCountObject, JSONObject yearProjectAmountObject) {
172
+    public void getSettleTypeStatistic(CmcSettle cmcSettle, JSONObject typeObject, JSONObject typeAmountObject, JSONObject yearProjectCountObject, JSONObject yearProjectAmountObject) throws ParseException {
175
         cmcSettle.setXmName(" ");
173
         cmcSettle.setXmName(" ");
176
-        List<CmcSettle> typeList = cmcSettleService.selectCmcSettleList(cmcSettle);
177
-        typeObject.put("项目结算", typeList.size());
174
+        if (cmcSettle.getGmTime() == null)
175
+            cmcSettle.setGmTime(new SimpleDateFormat("yyyy").parse("2000-01-01"));
176
+        typeObject.put("项目结算", cmcSettleService.selectCmcSettleList(cmcSettle).size());
178
         BigDecimal pAmount = new BigDecimal(0);
177
         BigDecimal pAmount = new BigDecimal(0);
179
-        for (CmcSettle settle : cmcSettleService.selectCmcSettleStatisticList(cmcSettle)) {
178
+        for (CmcSettle settle : cmcSettleService.selectCmcSettleList(cmcSettle)) {
180
             if (settle.getAmount() != null)
179
             if (settle.getAmount() != null)
181
                 pAmount = pAmount.add(settle.getAmount());
180
                 pAmount = pAmount.add(settle.getAmount());
182
         }
181
         }
184
         for (int i = 2019; i <= Calendar.getInstance().get(Calendar.YEAR); i++) {
183
         for (int i = 2019; i <= Calendar.getInstance().get(Calendar.YEAR); i++) {
185
             BigDecimal pyAmount = new BigDecimal(0);
184
             BigDecimal pyAmount = new BigDecimal(0);
186
             int count = 0;
185
             int count = 0;
187
-            for (CmcSettle settle : cmcSettleService.selectCmcSettleStatisticList(cmcSettle)) {
186
+            for (CmcSettle settle : cmcSettleService.selectCmcSettleList(cmcSettle)) {
188
                 if (settle.getAmount() != null && settle.getProjectNumber() != null && settle.getProjectNumber().contains(String.valueOf(i))) {
187
                 if (settle.getAmount() != null && settle.getProjectNumber() != null && settle.getProjectNumber().contains(String.valueOf(i))) {
189
                     pyAmount = pyAmount.add(settle.getAmount());
188
                     pyAmount = pyAmount.add(settle.getAmount());
190
                     count ++;
189
                     count ++;
195
         }
194
         }
196
         cmcSettle.setXmName(null);
195
         cmcSettle.setXmName(null);
197
         cmcSettle.setProjectId("0");
196
         cmcSettle.setProjectId("0");
198
-        typeList = cmcSettleService.selectCmcSettleList(cmcSettle);
199
-        typeObject.put("其他结算", typeList.size());
197
+        typeObject.put("其他结算", cmcSettleService.selectCmcSettleList(cmcSettle).size());
200
         BigDecimal oAmount = new BigDecimal(0);
198
         BigDecimal oAmount = new BigDecimal(0);
201
-        for (CmcSettle settle : cmcSettleService.selectCmcSettleStatisticList(cmcSettle)) {
199
+        for (CmcSettle settle : cmcSettleService.selectCmcSettleList(cmcSettle)) {
202
             if (settle.getAmount() != null)
200
             if (settle.getAmount() != null)
203
                 oAmount = oAmount.add(settle.getAmount());
201
                 oAmount = oAmount.add(settle.getAmount());
204
         }
202
         }

+ 0
- 8
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/mapper/CmcSettleMapper.java View File

27
      */
27
      */
28
     public List<CmcSettle> selectCmcSettleList(CmcSettle cmcSettle);
28
     public List<CmcSettle> selectCmcSettleList(CmcSettle cmcSettle);
29
 
29
 
30
-    /**
31
-     * 查询cmc结算统计列表
32
-     *
33
-     * @param cmcSettle cmc结算审批
34
-     * @return cmc结算审批集合
35
-     */
36
-    public List<CmcSettle> selectCmcSettleStatisticList(CmcSettle cmcSettle);
37
-
38
     /**
30
     /**
39
      * 新增cmc结算审批
31
      * 新增cmc结算审批
40
      * 
32
      * 

+ 0
- 8
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/ICmcSettleService.java View File

27
      */
27
      */
28
     public List<CmcSettle> selectCmcSettleList(CmcSettle cmcSettle);
28
     public List<CmcSettle> selectCmcSettleList(CmcSettle cmcSettle);
29
 
29
 
30
-    /**
31
-     * 查询cmc结算统计列表
32
-     *
33
-     * @param cmcSettle cmc结算审批
34
-     * @return cmc结算审批集合
35
-     */
36
-    public List<CmcSettle> selectCmcSettleStatisticList(CmcSettle cmcSettle);
37
-
38
     /**
30
     /**
39
      * 新增cmc结算审批
31
      * 新增cmc结算审批
40
      * 
32
      * 

+ 0
- 11
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/impl/CmcSettleServiceImpl.java View File

43
         return cmcSettleMapper.selectCmcSettleList(cmcSettle);
43
         return cmcSettleMapper.selectCmcSettleList(cmcSettle);
44
     }
44
     }
45
 
45
 
46
-    /**
47
-     * 查询cmc结算统计列表
48
-     *
49
-     * @param cmcSettle cmc结算审批
50
-     * @return cmc结算审批集合
51
-     */
52
-    public List<CmcSettle> selectCmcSettleStatisticList(CmcSettle cmcSettle)
53
-    {
54
-        return cmcSettleMapper.selectCmcSettleStatisticList(cmcSettle);
55
-    }
56
-
57
     /**
46
     /**
58
      * 新增cmc结算审批
47
      * 新增cmc结算审批
59
      * 
48
      * 

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

141
             <if test="managerTime != null "> and b.manager_time = #{managerTime}</if>
141
             <if test="managerTime != null "> and b.manager_time = #{managerTime}</if>
142
             <if test="zjlTime != null "> and b.zjl_time = #{zjlTime}</if>
142
             <if test="zjlTime != null "> and b.zjl_time = #{zjlTime}</if>
143
             <if test="dszTime != null "> and b.dsz_time = #{dszTime}</if>
143
             <if test="dszTime != null "> and b.dsz_time = #{dszTime}</if>
144
-            <if test="lendTime != null "> and YEAR(b.lend_time) = YEAR(#{lendTime})</if>
144
+            <if test="lendTime != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', lendTime) == '2000' "> and b.lend_time is not null</if>
145
+            <if test="lendTime != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', lendTime) != '2000' "> and YEAR(b.lend_time) = YEAR(#{lendTime})</if>
145
             <if test="unionTime != null "> and b.union_time = #{unionTime}</if>
146
             <if test="unionTime != null "> and b.union_time = #{unionTime}</if>
146
         </where>
147
         </where>
147
         order by b.apply_date desc
148
         order by b.apply_date desc

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

97
 
97
 
98
     <sql id="selectCmcSettleVo">
98
     <sql id="selectCmcSettleVo">
99
         select distinct s.settle_id, s.project_id, p.project_number, p.project_name, p.undertaking_dept, s.xm_name, s.workload_report, s.reporter, u.nick_name as report_nick_name, s.report_time, s.settle_comment, s.zh_user_id, u1.nick_name as zh_nick_name,
99
         select distinct s.settle_id, s.project_id, p.project_number, p.project_name, p.undertaking_dept, s.xm_name, s.workload_report, s.reporter, u.nick_name as report_nick_name, s.report_time, s.settle_comment, s.zh_user_id, u1.nick_name as zh_nick_name,
100
-               s.zh_time, s.zh_comment, s.js_user_id, u2.nick_name as js_nick_name, s.js_time, s.js_comment, s.jy_user_id, u3.nick_name as jy_nick_name, s.jy_time, s.jy_comment,
101
-               s.manager_user_id, u4.nick_name as manager_nick_name, s.manager_time, s.manager_comment, s.gm_user_id, u5.nick_name as gm_nick_name, s.gm_time, s.gm_comment,
100
+               s.zh_time, s.zh_comment, s.js_user_id, u2.nick_name as js_nick_name, s.js_time, s.js_comment, s.jy_user_id, u3.nick_name as jy_nick_name, s.jy_time, s.jy_comment, ss.amount,
101
+               s.manager_user_id, u4.nick_name as manager_nick_name, s.manager_time, s.manager_comment, s.gm_user_id, u5.nick_name as gm_nick_name, s.gm_time, s.gm_comment, ss.content,
102
                s.dsz_user_id, u6.nick_name as dsz_nick_name, s.dsz_time, s.dsz_comment, s.settle_document, s.modify_document, s.final_document, s.report_dept, d.dept_name from cmc_settle as s
102
                s.dsz_user_id, u6.nick_name as dsz_nick_name, s.dsz_time, s.dsz_comment, s.settle_document, s.modify_document, s.final_document, s.report_dept, d.dept_name from cmc_settle as s
103
         left join sys_user as u on u.user_id = s.reporter
103
         left join sys_user as u on u.user_id = s.reporter
104
         left join sys_user as u1 on u1.user_id = s.zh_user_id
104
         left join sys_user as u1 on u1.user_id = s.zh_user_id
115
     <select id="selectCmcSettleList" parameterType="CmcSettle" resultMap="CmcSettleResult">
115
     <select id="selectCmcSettleList" parameterType="CmcSettle" resultMap="CmcSettleResult">
116
         <include refid="selectCmcSettleVo"/>
116
         <include refid="selectCmcSettleVo"/>
117
         <where>
117
         <where>
118
+            ss.content = '实际结算总金额'
118
             <if test="settleId != null  and settleId != ''"> and s.settle_id = #{settleId}</if>
119
             <if test="settleId != null  and settleId != ''"> and s.settle_id = #{settleId}</if>
119
             <if test="projectId != null"> and s.project_id = #{projectId}</if>
120
             <if test="projectId != null"> and s.project_id = #{projectId}</if>
120
             <if test="projectNumber != null  and projectNumber != ''"> and p.project_number like concat('%', #{projectNumber}, '%')</if>
121
             <if test="projectNumber != null  and projectNumber != ''"> and p.project_number like concat('%', #{projectNumber}, '%')</if>
146
         order by s.report_time desc
147
         order by s.report_time desc
147
     </select>
148
     </select>
148
 
149
 
149
-    <select id="selectCmcSettleStatisticList" parameterType="CmcSettle" resultMap="CmcSettleResult">
150
-        select t0.settle_id, t0.project_id, t0.project_number, t0.project_name, t0.xm_name, t0.gm_time, (t2.amount - t0.amount) as amount from
151
-        (select distinct s.settle_id, s.project_id, p.project_number, p.project_name, s.xm_name, ss.table_number, s.gm_time, sum(ss.amount) as amount from cmc_settle as s
152
-        left join cmc_project as p on p.project_id = s.project_id
153
-        left join cmc_settle_summary as ss on ss.settle_id = s.settle_id
154
-        where ss.table_number = '0' group by s.settle_id) as t0 left join
155
-        (select distinct s.settle_id, sum(ss.amount) as amount from cmc_settle as s
156
-        left join cmc_project as p on p.project_id = s.project_id
157
-        left join cmc_settle_summary as ss on ss.settle_id = s.settle_id
158
-        where ss.table_number = '2' group by s.settle_id) as t2 on t0.settle_id = t2.settle_id
159
-        <where>
160
-            <if test="projectId != null"> and t0.project_id = #{projectId}</if>
161
-            <if test="projectNumber != null  and projectNumber != ''"> and t0.project_number like concat('%', #{projectNumber}, '%')</if>
162
-            <if test="xmName != null"> and t0.xm_name = #{xmName}</if>
163
-            <if test="gmTime != null"> and YEAR(t0.gm_time) = YEAR(#{gmTime})</if>
164
-        </where>
165
-    </select>
166
-
167
     <select id="selectCmcSettleBySettleId" parameterType="String" resultMap="CmcSettleResult">
150
     <select id="selectCmcSettleBySettleId" parameterType="String" resultMap="CmcSettleResult">
168
         <include refid="selectCmcSettleVo"/>
151
         <include refid="selectCmcSettleVo"/>
169
         where s.settle_id = #{settleId}
152
         where s.settle_id = #{settleId}

Loading…
Cancel
Save