|
@@ -1,10 +1,10 @@
|
1
|
1
|
package com.ruoyi.web.controller.oa;
|
2
|
2
|
|
|
3
|
+import java.math.BigDecimal;
|
3
|
4
|
import java.text.ParseException;
|
4
|
5
|
import java.text.SimpleDateFormat;
|
5
|
|
-import java.util.Calendar;
|
6
|
|
-import java.util.Date;
|
7
|
|
-import java.util.List;
|
|
6
|
+import java.util.*;
|
|
7
|
+import java.util.stream.Collectors;
|
8
|
8
|
import javax.servlet.http.HttpServletResponse;
|
9
|
9
|
|
10
|
10
|
import com.alibaba.fastjson2.JSONArray;
|
|
@@ -12,6 +12,7 @@ import com.alibaba.fastjson2.JSONObject;
|
12
|
12
|
import com.ruoyi.oa.domain.CmcPartyA;
|
13
|
13
|
import com.ruoyi.oa.domain.CmcProject;
|
14
|
14
|
import com.ruoyi.oa.service.ICmcPartyAService;
|
|
15
|
+import org.apache.poi.hpsf.Decimal;
|
15
|
16
|
import org.springframework.beans.factory.annotation.Autowired;
|
16
|
17
|
import org.springframework.web.bind.annotation.GetMapping;
|
17
|
18
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -43,9 +44,6 @@ public class CmcContractController extends BaseController
|
43
|
44
|
@Autowired
|
44
|
45
|
private ICmcContractService cmcContractService;
|
45
|
46
|
|
46
|
|
- @Autowired
|
47
|
|
- private ICmcPartyAService cmcPartyAService;
|
48
|
|
-
|
49
|
47
|
/**
|
50
|
48
|
* 查询cmc合同评审列表
|
51
|
49
|
*/
|
|
@@ -65,14 +63,75 @@ public class CmcContractController extends BaseController
|
65
|
63
|
JSONObject jsonObject = new JSONObject();
|
66
|
64
|
JSONArray yearArray = new JSONArray();
|
67
|
65
|
JSONObject yearObject = new JSONObject();
|
68
|
|
- //每年合同数量
|
69
|
|
- for (int i = 2019; i <= Calendar.getInstance().get(Calendar.YEAR); i++) {
|
70
|
|
- cmcContract.setSignDate(new SimpleDateFormat("yyyy").parse(String.valueOf(i)));
|
|
66
|
+ JSONArray sourceArray = new JSONArray();
|
|
67
|
+ JSONObject sourceObject = new JSONObject();
|
|
68
|
+ JSONArray amountArray = new JSONArray();
|
|
69
|
+ JSONObject amountObject = new JSONObject();
|
|
70
|
+ JSONArray cwAmountArray = new JSONArray();
|
|
71
|
+ JSONObject cwAmountObject = new JSONObject();
|
|
72
|
+ //每年合同数量及金额
|
|
73
|
+ if (cmcContract.getSignDate() == null) {
|
|
74
|
+ for (int i = 2019; i <= Calendar.getInstance().get(Calendar.YEAR); i++) {
|
|
75
|
+ cmcContract.setSignDate(new SimpleDateFormat("yyyy").parse(String.valueOf(i)));
|
|
76
|
+ List<CmcContract> yearList = cmcContractService.selectCmcContractList(cmcContract);
|
|
77
|
+ yearObject.put(String.valueOf(i), yearList.size());
|
|
78
|
+ BigDecimal amount = new BigDecimal(0);
|
|
79
|
+ for (CmcContract contract : yearList) {
|
|
80
|
+ amount = amount.add(contract.getAmount());
|
|
81
|
+ }
|
|
82
|
+ amountObject.put(String.valueOf(i), amount);
|
|
83
|
+ }
|
|
84
|
+ cmcContract.setSignDate(null);
|
|
85
|
+ cmcContract.setProjectSource("1");
|
|
86
|
+ List<CmcContract> sourceList = cmcContractService.selectCmcContractList(cmcContract);
|
|
87
|
+ BigDecimal cAmount = new BigDecimal(0);
|
|
88
|
+ BigDecimal wAmount = new BigDecimal(0);
|
|
89
|
+ for (CmcContract contract : sourceList) {
|
|
90
|
+ wAmount = wAmount.add(contract.getAmount());
|
|
91
|
+ }
|
|
92
|
+ sourceObject.put("市场", sourceList.size());
|
|
93
|
+ cwAmountObject.put("市场", wAmount);
|
|
94
|
+ cmcContract.setProjectSource("0");
|
|
95
|
+ sourceList = cmcContractService.selectCmcContractList(cmcContract);
|
|
96
|
+ for (CmcContract contract : sourceList) {
|
|
97
|
+ cAmount = cAmount.add(contract.getAmount());
|
|
98
|
+ }
|
|
99
|
+ sourceObject.put("院内", sourceList.size());
|
|
100
|
+ cwAmountObject.put("院内", cAmount);
|
|
101
|
+ }
|
|
102
|
+ else {
|
71
|
103
|
List<CmcContract> yearList = cmcContractService.selectCmcContractList(cmcContract);
|
72
|
|
- yearObject.put(String.valueOf(i), yearList.size());
|
|
104
|
+ yearObject.put(new SimpleDateFormat("yyyy").format(cmcContract.getSignDate()), yearList.size());
|
|
105
|
+ BigDecimal amount = new BigDecimal(0);
|
|
106
|
+ for (CmcContract contract : yearList) {
|
|
107
|
+ amount = amount.add(contract.getAmount());
|
|
108
|
+ }
|
|
109
|
+ amountObject.put(new SimpleDateFormat("yyyy").format(cmcContract.getSignDate()), amount);
|
|
110
|
+ cmcContract.setProjectSource("1");
|
|
111
|
+ List<CmcContract> sourceList = cmcContractService.selectCmcContractList(cmcContract);
|
|
112
|
+ BigDecimal cAmount = new BigDecimal(0);
|
|
113
|
+ BigDecimal wAmount = new BigDecimal(0);
|
|
114
|
+ for (CmcContract contract : sourceList) {
|
|
115
|
+ wAmount = wAmount.add(contract.getAmount());
|
|
116
|
+ }
|
|
117
|
+ sourceObject.put("市场", sourceList.size());
|
|
118
|
+ cwAmountObject.put("市场", wAmount);
|
|
119
|
+ cmcContract.setProjectSource("0");
|
|
120
|
+ sourceList = cmcContractService.selectCmcContractList(cmcContract);
|
|
121
|
+ for (CmcContract contract : sourceList) {
|
|
122
|
+ cAmount = cAmount.add(contract.getAmount());
|
|
123
|
+ }
|
|
124
|
+ sourceObject.put("院内", sourceList.size());
|
|
125
|
+ cwAmountObject.put("院内", cAmount);
|
73
|
126
|
}
|
74
|
127
|
yearArray.add(yearObject);
|
|
128
|
+ sourceArray.add(sourceObject);
|
|
129
|
+ amountArray.add(amountObject);
|
|
130
|
+ cwAmountArray.add(cwAmountObject);
|
75
|
131
|
jsonObject.put("year", yearArray);
|
|
132
|
+ jsonObject.put("source", sourceArray);
|
|
133
|
+ jsonObject.put("amount", amountArray);
|
|
134
|
+ jsonObject.put("cwAmount", cwAmountArray);
|
76
|
135
|
return success(jsonObject);
|
77
|
136
|
}
|
78
|
137
|
|