From 2ff2d4d4d13c6f774a8ab682f66ef2770e7311eb Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 28 九月 2021 15:46:51 +0800
Subject: [PATCH] 优化代码

---
 service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java |   44 +++++++++++++++++---------------------------
 1 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java b/service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java
index 4f64c9a..a2f89b2 100644
--- a/service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java
+++ b/service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java
@@ -4,12 +4,10 @@
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.parser.Feature;
 import com.java110.api.smo.DefaultAbstractComponentSMO;
-import com.java110.core.component.BaseComponentSMO;
-import com.java110.core.context.IPageData;
-import com.java110.core.factory.Java110ThreadPoolFactory;
-import com.java110.entity.component.ComponentValidateResult;
 import com.java110.api.smo.assetExport.IExportFeeManualCollectionSMO;
-import com.java110.utils.constant.ServiceConstant;
+import com.java110.core.context.IPageData;
+import com.java110.dto.fee.FeeDto;
+import com.java110.entity.component.ComponentValidateResult;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Base64Convert;
 import com.java110.utils.util.DateUtil;
@@ -32,8 +30,8 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.text.ParseException;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -147,7 +145,7 @@
         String apiUrl = "";
         ResponseEntity<String> responseEntity = null;
         JSONObject reqJson = JSONObject.parseObject(pd.getReqData());
-        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeApi/listAllRoomOweFees" + mapToUrlParam(reqJson);
+        apiUrl = "/feeApi/listAllRoomOweFees" + mapToUrlParam(reqJson);
         responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
 
         if (responseEntity.getStatusCode() != HttpStatus.OK) { //璺宠繃 淇濆瓨鍗曞厓淇℃伅
@@ -170,7 +168,7 @@
 
         //鏌ヨ鍌即鍗曚簩缁寸爜
         JSONObject feePrint = null;
-        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feePrintSpec/queryFeePrintSpec?page=1&row=1&specCd=1010&communityId=" + result.getCommunityId();
+        apiUrl = "/feePrintSpec/queryFeePrintSpec?page=1&row=1&specCd=1010&communityId=" + result.getCommunityId();
         responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
         if (responseEntity.getStatusCode() == HttpStatus.OK) {
             JSONObject feePrintResults = JSONObject.parseObject(responseEntity.getBody(), Feature.OrderedField);
@@ -347,6 +345,15 @@
             row = sheet.createRow(line + feeIndex + 3);
             startTime = feeObj.getString("endTime").length() > 10 ? feeObj.getString("endTime").substring(0, 10) : feeObj.getString("endTime");
             endTime = feeObj.getString("deadlineTime").length() > 10 ? feeObj.getString("deadlineTime").substring(0, 10) : feeObj.getString("deadlineTime");
+            //濡傛灉璐圭敤鏄懆鏈熸�ц垂鐢� 鍒� 缁撴潫鏃堕棿鍑忎竴澶�
+            try {
+                if (feeObj.containsKey("feeFlag") && FeeDto.FEE_FLAG_CYCLE.equals(feeObj.getString("feeFlag"))) {
+                    endTime = DateUtil.getFormatTimeString(DateUtil.stepDay(DateUtil.getDateFromString(endTime, DateUtil.DATE_FORMATE_STRING_B), -1),
+                            DateUtil.DATE_FORMATE_STRING_B);
+                }
+            } catch (ParseException e) {
+                logger.error("澶勭悊缁撴潫鏃堕棿澶辫触", e);
+            }
 
             cell0 = row.createCell(0);
             cell0.setCellValue(feeObj.getString("feeName"));
@@ -435,7 +442,7 @@
     private JSONArray getExistsRoomFee(IPageData pd, ComponentValidateResult result) {
         String apiUrl = "";
         ResponseEntity<String> responseEntity = null;
-        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeManualCollection/queryExportCollections?communityId=" + result.getCommunityId();
+        apiUrl = "/feeManualCollection/queryExportCollections?communityId=" + result.getCommunityId();
         responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
 
         if (responseEntity.getStatusCode() != HttpStatus.OK) { //璺宠繃 淇濆瓨鍗曞厓淇℃伅
@@ -528,22 +535,5 @@
         this.restTemplate = restTemplate;
     }
 
-    public static void main(String[] args) {
-        Java110ThreadPoolFactory<String> pool = Java110ThreadPoolFactory.getInstance().createThreadPool(20);
-        for (int i = 21; i > 0; i--) {
-            Integer data = i;
-            pool.submit(() -> {
-//杩欎釜鍦版柟鍙互鍐欎竴涓嚱鏁帮紝鍙傛暟鍙互浠庡灞備紶鍏�
-                System.out.println("缃戠粶鎿嶄綔寮�濮�" + data);
-                Thread.sleep(data * 1000);
-                System.out.println("缃戠粶鎿嶄綔缁撴潫" + data);
-                return data + "";
-            });
-        }
-        List<String> users = pool.get();
-        for (String u : users) {
-            System.out.println(u);
-        }
-        pool.stop();
-    }
+
 }

--
Gitblit v1.8.0