wuxw
2022-07-17 ce64e667815b39efdc2f8bd52be0d43d49db8d84
service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java
@@ -4,12 +4,11 @@
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.FeeConfigDto;
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;
@@ -19,7 +18,7 @@
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.java110.core.log.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -32,8 +31,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 +146,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 +169,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);
@@ -342,17 +341,33 @@
        BigDecimal totalPrice = new BigDecimal(0);
        String startTime = "";
        String endTime = "";
        String squarePrice = "";
        for (int feeIndex = 0; feeIndex < fees.size(); feeIndex++) {
            JSONObject feeObj = fees.getJSONObject(feeIndex);
            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);
            }
            squarePrice = feeObj.getString("squarePrice");
            //动态费用单价就去动态单价
            if(feeObj.containsKey("computingFormula") && "9009".equals(feeObj.getString("computingFormula"))){
                squarePrice = feeObj.getString("mwPrice");
            }
            cell0 = row.createCell(0);
            cell0.setCellValue(feeObj.getString("feeName"));
            cell0.setCellStyle(cellStyle);
            cell1 = row.createCell(1);
            cell1.setCellValue(feeObj.getString("squarePrice"));
            cell1.setCellValue(squarePrice);
            cell1.setCellStyle(cellStyle);
            cell2 = row.createCell(2);
            cell2.setCellValue(room.getString("builtUpArea"));
@@ -435,7 +450,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 +543,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();
    }
}