From bde271fdbab51e654a293dba02a31eab8ff3ea8b Mon Sep 17 00:00:00 2001
From: chengf <cgf12138@163.com>
Date: 星期四, 21 八月 2025 20:20:23 +0800
Subject: [PATCH] 白单流水报表与费用初始化(差创建折扣使用记录)0821
---
service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java | 201 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 146 insertions(+), 55 deletions(-)
diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java
index bd845be..2f17d2f 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java
@@ -23,6 +23,7 @@
import org.springframework.http.ResponseEntity;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.text.ParseException;
import java.util.*;
@@ -54,6 +55,10 @@
feeQueryParams.setStartYear(startYear);
int currentYear = java.time.Year.now().getValue();
feeQueryParams.setEndYear(currentYear + 2);
+ if(reqJson.containsKey("endYear") && !reqJson.get("endYear").equals("") && reqJson.get("endYear") != null) {
+ currentYear=Integer.parseInt(reqJson.get("endYear")+"");
+ feeQueryParams.setEndYear(Integer.parseInt(reqJson.get("endYear")+"")+2);
+ }
int endYear = feeQueryParams.getEndYear();
int doYear = endYear - startYear;
@@ -64,35 +69,45 @@
reportQueryRecord.setEndYear(currentYear+"");
List<ReportQueryRecord> reportQueryRecords = reportFeeInnerServiceSMOImpl.queryReport(BeanConvertUtil.beanCovertMap(reportQueryRecord));
- if(reportQueryRecords.size()>0){
+ if(reportQueryRecords.size()>0 && !reqJson.containsKey("reload")){
+ ResultVo resultVo = new ResultVo(JSONObject.parse(reportQueryRecords.get(reportQueryRecords.size()-1).getReportContent()));
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+ context.setResponseEntity(responseEntity);
}
- List<List<FeeDto>> reportFeeDtoLists = new LinkedList<>();
- queryFee(reportFeeDtoLists ,reqJson);
+ else{
+ List<List<FeeDto>> reportFeeDtoLists = new LinkedList<>();
+ queryFee(reportFeeDtoLists ,reqJson);
+ int[] arr = new int[endYear - startYear + 1];
+ int[] arr2 = new int[endYear - startYear + 1 - 3];
+ for (int i = startYear; i <= endYear; i++) {
+ arr[i-startYear] = i;
+ }
+ for (int i = startYear; i < currentYear; i++) {
+ arr2[i-startYear] = i;
+ }
- int[] arr = new int[endYear - startYear + 1];
- for (int i = startYear; i <= endYear; i++) {
- arr[i-startYear] = i;
+ FeeDto feeDto = new FeeDto();
+ feeDto.setRepostList(reportFeeDtoLists);
+ feeDto.setYearArr(arr);
+ feeDto.setYearArr2(arr2);
+ feeDto.setReportLength(doYear - 1 + 20);
+
+ reportQueryRecord.setCommunityId(reqJson.getString("communityId"));
+ reportQueryRecord.setQueryStatus("0");
+ reportQueryRecord.setEndYear(currentYear+"");
+ reportQueryRecord.setReportContent(JSONObject.toJSONString(feeDto));
+
+ int i = reportFeeInnerServiceSMOImpl.saveReport(BeanConvertUtil.beanCovertMap(reportQueryRecord));
+
+ ResultVo resultVo = new ResultVo(feeDto);
+
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+ context.setResponseEntity(responseEntity);
}
-
- FeeDto feeDto = new FeeDto();
- feeDto.setRepostList(reportFeeDtoLists);
- feeDto.setYearArr(arr);
- feeDto.setLength(doYear - 1 + 20);
-
- reportQueryRecord.setCommunityId(reqJson.getString("communityId"));
- reportQueryRecord.setQueryStatus("0");
- reportQueryRecord.setEndYear(currentYear+"");
- reportQueryRecord.setReportContent(JSONObject.toJSONString(feeDto));
-
- int i = reportFeeInnerServiceSMOImpl.saveReport(BeanConvertUtil.beanCovertMap(reportQueryRecord));
-
- ResultVo resultVo = new ResultVo(feeDto);
-
- ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
-
- context.setResponseEntity(responseEntity);
}
public void queryFee(List<List<FeeDto>> reportFeeDtoLists, JSONObject reqJson) {
int startYear = 2020;
@@ -104,13 +119,46 @@
feeQueryParams.setStartYear(startYear);
int currentYear = java.time.Year.now().getValue();
feeQueryParams.setEndYear(currentYear + 2);
+ if(reqJson.containsKey("endYear") && !reqJson.get("endYear").equals("") && reqJson.get("endYear") != null){
+ currentYear=Integer.parseInt(reqJson.get("endYear")+"");
+ feeQueryParams.setEndYear(Integer.parseInt(reqJson.get("endYear")+"")+2);
+ }
int endYear = feeQueryParams.getEndYear();
- reportFeeDtoLists.add(new LinkedList<FeeDto>());
- reportFeeDtoLists.add(new LinkedList<FeeDto>());
- reportFeeDtoLists.add(new LinkedList<FeeDto>());
- reportFeeDtoLists.add(new LinkedList<FeeDto>());
- int ind = 1;
int doYear = endYear - startYear;
+ LinkedList<FeeDto> col1 = new LinkedList<>();
+ FeeDto col = new FeeDto();
+ BigDecimal[] col1Fee = new BigDecimal[doYear - 1 + 20];
+ col.setReport(col1Fee);
+ col.setCurYear("鏀跺叆鍚堣锛堢櫧鍗曟祦姘达級");
+ col1.add(col);
+
+ LinkedList<FeeDto> col2 = new LinkedList<>();
+ BigDecimal[] col2Fee = new BigDecimal[doYear - 1 + 20];
+ col = new FeeDto();
+ col.setReport(col2Fee);
+ col.setCurYear("鐗╀笟璐�+浠f敹鍚堣");
+ col2.add(col);
+
+ LinkedList<FeeDto> col3 = new LinkedList<>();
+ col = new FeeDto();
+ col.setReport(col2Fee);
+ col.setCurYear("鐗╀笟璐瑰悎璁�(1+2)");
+ col3.add(col);
+
+ LinkedList<FeeDto> col4 = new LinkedList<>();
+ col = new FeeDto();
+ col.setReport(new BigDecimal[doYear - 1 + 20]);
+ col.setCurYear("鐗╀笟璐逛唬鏀跺悎璁�");
+ col3.add(col);
+
+ BigDecimal[] col4Fee = new BigDecimal[doYear - 1 + 20];
+ BigDecimal[] colByCar = new BigDecimal[doYear - 1 + 20];
+ BigDecimal[] colByOther = new BigDecimal[doYear - 1 + 20];
+ reportFeeDtoLists.add(col1);
+ reportFeeDtoLists.add(col2);
+ reportFeeDtoLists.add(col2);
+ reportFeeDtoLists.add(col4);
+ int ind = 1;
int[] arr = new int[endYear - startYear + 1];
for (int i = startYear; i <= endYear; i++) {
@@ -128,28 +176,66 @@
int kg = 0;
for (Map map : result){
if(map.get("璐圭敤鎵�灞炲勾浠�").equals("绫诲瀷鎬昏") && map.get("fee_type_cd").equals(dictDto1.getStatusCd())){
- double[] doubles = new double[doYear - 1 + 20];
- doubles[0] = ((BigDecimal) map.get("璇ュ勾搴旂即鎬婚")).doubleValue();
- doubles[1] = ((BigDecimal) map.get("姣忔湀璐圭敤")).doubleValue();
- doubles[2] = ((Long) map.get("搴旀敹鏈堜唤鏁�")).doubleValue();
- doubles[3] = ((BigDecimal) map.get("褰撳勾鏀剁即鐜�")).doubleValue();
- doubles[4] = ((BigDecimal) map.get("鎶樻墸閲戦")).doubleValue();
+ BigDecimal[] doubles = new BigDecimal[doYear - 1 + 20];
+ doubles[0] = (BigDecimal) map.get("璇ュ勾搴旂即鎬婚");
+ doubles[1] = (BigDecimal) map.get("姣忔湀璐圭敤");
+ doubles[2] = (BigDecimal) map.get("搴旀敹鏈堜唤鏁�");
+ doubles[3] = (BigDecimal) map.get("褰撳勾鏀剁即鐜�");
+ doubles[4] = (BigDecimal) map.get("鎶樻墸閲戦");
int inde = 0;
for (int i : arr){
if(i < currentYear){
inde++;
- doubles[i - startYear + 5] = ((BigDecimal) map.get(i + "骞村疄缂�")).doubleValue();
+ doubles[i - startYear + 5] = (BigDecimal) map.get(i + "骞村疄缂�");
}
}
- doubles[inde + 5] =((BigDecimal) map.get("褰撳勾棰勭畻")).doubleValue();
- doubles[inde + 6] =((BigDecimal) map.get(currentYear + "骞村疄缂�")).doubleValue();
- doubles[inde + 7] =((BigDecimal) map.get("褰撳勾鎶樻墸鎬婚")).doubleValue();
- doubles[inde + 8] =((BigDecimal) map.get("褰撳勾娆犳")).doubleValue();
+ doubles[inde + 5] =(BigDecimal) map.get("褰撳勾棰勭畻");
+ doubles[inde + 6] =(BigDecimal) map.get(currentYear + "骞村疄缂�");
+ doubles[inde + 7] =(BigDecimal) map.get("褰撳勾鎶樻墸鎬婚");
+ doubles[inde + 8] =(BigDecimal) map.get("褰撳勾娆犳");
for (int i = 1 ; i <= 12 ; i++){
- doubles[inde + 8 + i] =((BigDecimal) map.get("褰撳勾"+(i < 10 ? "0"+i : i) +"鏈堝疄缂�")).doubleValue();
+ doubles[inde + 8 + i] =(BigDecimal) map.get("褰撳勾"+(i < 10 ? "0"+i : i) +"鏈堝疄缂�");
}
feeDto.setCurYear(dictDto1.getName()+"鎬昏");
+ if(Integer.parseInt(dictDto1.getStatusCd())%630000000 < 3){
+ for(int i = 0 ; i < doubles.length ; i++){
+ if(i == 3){
+ if (doubles[i].intValue() != 0){
+ col1Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+ col2Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+ }
+ }else{
+ col1Fee[i].add(doubleUse(doubles[i]));
+ col2Fee[i].add(doubleUse(doubles[i]));
+ }
+ }
+ }
+ else if(Integer.parseInt(dictDto1.getStatusCd())%630000000 < 8){
+ for(int i = 0 ; i < doubles.length ; i++){
+ if(i == 3){
+ if (doubles[i].intValue() != 0){
+ col1Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+ col2Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+ }
+ }else{
+ col1Fee[i].add(doubleUse(doubles[i]));
+ col2Fee[i].add(doubleUse(doubles[i]));
+ }
+ }
+ }else{
+ for(int i = 0 ; i < doubles.length ; i++){
+ if(i == 3){
+ if (doubles[i].intValue() != 0){
+ col1Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+ col2Fee[i] = BigDecimal.valueOf((doubles[i].add(col1Fee[i])).doubleValue()/2);
+ }
+ }else{
+ col1Fee[i].add(doubleUse(doubles[i]));
+ col2Fee[i].add(doubleUse(doubles[i]));
+ }
+ }
+ }
feeDto.setReport(doubles);
feeDto.setCount(ind);
@@ -159,7 +245,7 @@
feeDto.setCurYear("绫诲瀷鎬昏");
}
if (feeDto.getReport() == null){
- feeDto.setReport(new double[doYear - 1 + 20]);
+ feeDto.setReport(new BigDecimal[doYear - 1 + 20]);
}
if(feeDto.getFeeTypeCdName() == null) {
feeDto.setFeeTypeCdName(dictDto1.getName());
@@ -174,26 +260,26 @@
kg = 0;
for (Map map : result){
if(map.get("璐圭敤鎵�灞炲勾浠�").equals(i+"") && map.get("fee_type_cd").equals(dictDto1.getStatusCd())){
- double[] doubles = new double[doYear - 1 + 20];
- doubles[0] = ((BigDecimal) map.get("璇ュ勾搴旂即鎬婚")).doubleValue();
- doubles[1] = ((BigDecimal) map.get("姣忔湀璐圭敤")).doubleValue();
- doubles[2] = ((Long) map.get("搴旀敹鏈堜唤鏁�")).doubleValue();
- doubles[3] = ((BigDecimal) map.get("褰撳勾鏀剁即鐜�")).doubleValue();
- doubles[4] = ((BigDecimal) map.get("鎶樻墸閲戦")).doubleValue();
+ BigDecimal[] doubles = new BigDecimal[doYear - 1 + 20];
+ doubles[0] = (BigDecimal) map.get("璇ュ勾搴旂即鎬婚");
+ doubles[1] = (BigDecimal) map.get("姣忔湀璐圭敤");
+ doubles[2] = (BigDecimal) map.get("搴旀敹鏈堜唤鏁�");
+ doubles[3] = (BigDecimal) map.get("褰撳勾鏀剁即鐜�");
+ doubles[4] = (BigDecimal) map.get("鎶樻墸閲戦");
int inde = 0;
for (int in : arr){
if(in < currentYear){
inde++;
- doubles[in - startYear + 5] = ((BigDecimal) map.get(i + "骞村疄缂�")).doubleValue();
+ doubles[in - startYear + 5] = (BigDecimal) map.get(i + "骞村疄缂�");
}
}
- doubles[inde + 5] =((BigDecimal) map.get("褰撳勾棰勭畻")).doubleValue();
- doubles[inde + 6] =((BigDecimal) map.get(currentYear + "骞村疄缂�")).doubleValue();
- doubles[inde + 7] =((BigDecimal) map.get("褰撳勾鎶樻墸鎬婚")).doubleValue();
- doubles[inde + 8] =((BigDecimal) map.get("褰撳勾娆犳")).doubleValue();
+ doubles[inde + 5] =(BigDecimal) map.get("褰撳勾棰勭畻");
+ doubles[inde + 6] =(BigDecimal) map.get(currentYear + "骞村疄缂�");
+ doubles[inde + 7] =(BigDecimal) map.get("褰撳勾鎶樻墸鎬婚");
+ doubles[inde + 8] =(BigDecimal) map.get("褰撳勾娆犳");
for (int in = 1 ; in <= 12 ; in++){
- doubles[inde + 8 + in] =((BigDecimal) map.get("褰撳勾"+(in < 10 ? "0"+in : in) +"鏈堝疄缂�")).doubleValue();
+ doubles[inde + 8 + in] =(BigDecimal) map.get("褰撳勾"+(in < 10 ? "0"+in : in) +"鏈堝疄缂�");
}
feeDto = new FeeDto();
feeDto.setFeeTypeCdName(dictDto1.getName());
@@ -208,7 +294,7 @@
feeDto = new FeeDto();
feeDto.setFeeTypeCdName(dictDto1.getName());
feeDto.setCurYear(String.valueOf(i));
- feeDto.setReport(new double[doYear - 1 + 20]);
+ feeDto.setReport(new BigDecimal[doYear - 1 + 20]);
feeDto.setCount(ind);
feeDtos2.add(feeDto);
}
@@ -232,6 +318,7 @@
LinkedList linkedList = new LinkedList();
FeeDto feeDto1 = new FeeDto();
feeDto1.setCurYear("鍋滆溅璐瑰悎璁★紙3+...+7锛�");
+ feeDto1.setReport(colByCar);
linkedList.add(feeDto1);
reportFeeDtoLists.add(linkedList);
}
@@ -239,10 +326,14 @@
LinkedList linkedList = new LinkedList();
FeeDto feeDto1 = new FeeDto();
feeDto1.setCurYear("鍏朵粬绫诲悎璁★紙8+...+22锛�");
+ feeDto1.setReport(colByOther);
linkedList.add(feeDto1);
reportFeeDtoLists.add(linkedList);
}
ind ++;
}
}
+ public BigDecimal doubleUse(BigDecimal num){
+ return num;
+ }
}
--
Gitblit v1.8.0