From b06ccd76e50812d81ee689dcd609bb02ac5c4ed4 Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期四, 11 八月 2022 14:48:52 +0800
Subject: [PATCH] 1、优化页面展示行问题

---
 service-fee/src/main/java/com/java110/fee/api/FeeApi.java |  277 +++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 248 insertions(+), 29 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/api/FeeApi.java b/service-fee/src/main/java/com/java110/fee/api/FeeApi.java
old mode 100644
new mode 100755
index ab3decc..354bf0f
--- a/service-fee/src/main/java/com/java110/fee/api/FeeApi.java
+++ b/service-fee/src/main/java/com/java110/fee/api/FeeApi.java
@@ -1,20 +1,23 @@
 package com.java110.fee.api;
 
 import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.constant.ResponseConstant;
-import com.java110.utils.exception.InitConfigDataException;
-import com.java110.utils.exception.InitDataFlowContextException;
 import com.java110.core.base.controller.BaseController;
 import com.java110.core.context.BusinessServiceDataFlow;
 import com.java110.core.factory.DataTransactionFactory;
+import com.java110.core.log.LoggerFactory;
+import com.java110.dto.fee.FeeAttrDto;
+import com.java110.dto.fee.FeeDto;
+import com.java110.fee.bmo.*;
 import com.java110.fee.smo.IFeeServiceSMO;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.InitConfigDataException;
+import com.java110.utils.exception.InitDataFlowContextException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.StringUtil;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
@@ -25,24 +28,41 @@
  * Created by wuxw on 2018/5/14.
  */
 @RestController
+@RequestMapping(value = "/feeApi")
 public class FeeApi extends BaseController {
     private final static Logger logger = LoggerFactory.getLogger(FeeApi.class);
 
     @Autowired
     IFeeServiceSMO feeServiceSMOImpl;
 
-    @RequestMapping(path = "/feeApi/service",method= RequestMethod.GET)
+    @Autowired
+    private IQueryFeeByAttr queryFeeByAttrImpl;
+
+    @Autowired
+    private IQueryParkspaceFee queryParkspaceFeeImpl;
+
+    @Autowired
+    private IQueryOweFee queryOweFeeImpl;
+
+    @Autowired
+    private IPayOweFee payOweFeeImpl;
+
+    @Autowired
+    private IImportRoomFee importRoomFeeImpl;
+
+    @RequestMapping(path = "/service", method = RequestMethod.GET)
     public String serviceGet(HttpServletRequest request) {
-        return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,"涓嶆敮鎸丟et鏂规硶璇锋眰").toJSONString();
+        return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR, "涓嶆敮鎸丟et鏂规硶璇锋眰").toJSONString();
     }
 
     /**
      * 鐢ㄦ埛鏈嶅姟缁熶竴澶勭悊鎺ュ彛
+     *
      * @param orderInfo
      * @param request
      * @return
      */
-    @RequestMapping(path = "/feeApi/service",method= RequestMethod.POST)
+    @RequestMapping(path = "/service", method = RequestMethod.POST)
     public String servicePost(@RequestBody String orderInfo, HttpServletRequest request) {
         BusinessServiceDataFlow businessServiceDataFlow = null;
         JSONObject responseJson = null;
@@ -53,23 +73,24 @@
             preValiateOrderInfo(orderInfo);
             businessServiceDataFlow = this.writeDataToDataFlowContext(orderInfo, headers);
             responseJson = feeServiceSMOImpl.service(businessServiceDataFlow);
-        }catch (InitDataFlowContextException e){
-            logger.error("璇锋眰鎶ユ枃閿欒,鍒濆鍖� BusinessServiceDataFlow澶辫触"+orderInfo,e);
-            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
-        }catch (InitConfigDataException e){
-            logger.error("璇锋眰鎶ユ枃閿欒,鍔犺浇閰嶇疆淇℃伅澶辫触"+orderInfo,e);
-            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
-        }catch (Exception e){
-            logger.error("璇锋眰璁㈠崟寮傚父",e);
-            responseJson = DataTransactionFactory.createBusinessResponseJson(businessServiceDataFlow,ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e,
+        } catch (InitDataFlowContextException e) {
+            logger.error("璇锋眰鎶ユ枃閿欒,鍒濆鍖� BusinessServiceDataFlow澶辫触" + orderInfo, e);
+            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo, ResponseConstant.RESULT_PARAM_ERROR, e.getMessage(), null);
+        } catch (InitConfigDataException e) {
+            logger.error("璇锋眰鎶ユ枃閿欒,鍔犺浇閰嶇疆淇℃伅澶辫触" + orderInfo, e);
+            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo, ResponseConstant.RESULT_PARAM_ERROR, e.getMessage(), null);
+        } catch (Exception e) {
+            logger.error("璇锋眰璁㈠崟寮傚父", e);
+            responseJson = DataTransactionFactory.createBusinessResponseJson(businessServiceDataFlow, ResponseConstant.RESULT_CODE_ERROR, e.getMessage() + e,
                     null);
-        }finally {
-            return responseJson.toJSONString();
+        } finally {
         }
+        return responseJson.toJSONString();
     }
 
     /**
      * 杩欓噷棰勬牎楠岋紝璇锋眰鎶ユ枃涓笉鑳芥湁 dataFlowId
+     *
      * @param orderInfo
      */
     private void preValiateOrderInfo(String orderInfo) {
@@ -80,17 +101,18 @@
 
     /**
      * 鑾峰彇璇锋眰淇℃伅
+     *
      * @param request
      * @param headers
      * @throws RuntimeException
      */
-    private void getRequestInfo(HttpServletRequest request,Map headers) throws Exception{
-        try{
-            super.initHeadParam(request,headers);
-            super.initUrlParam(request,headers);
-        }catch (Exception e){
-            logger.error("鍔犺浇澶翠俊鎭け璐�",e);
-            throw new InitConfigDataException(ResponseConstant.RESULT_PARAM_ERROR,"鍔犺浇澶翠俊鎭け璐�");
+    private void getRequestInfo(HttpServletRequest request, Map headers) throws Exception {
+        try {
+            super.initHeadParam(request, headers);
+            super.initUrlParam(request, headers);
+        } catch (Exception e) {
+            logger.error("鍔犺浇澶翠俊鎭け璐�", e);
+            throw new InitConfigDataException(ResponseConstant.RESULT_PARAM_ERROR, "鍔犺浇澶翠俊鎭け璐�");
         }
     }
 
@@ -101,4 +123,201 @@
     public void setFeeServiceSMOImpl(IFeeServiceSMO feeServiceSMOImpl) {
         this.feeServiceSMOImpl = feeServiceSMOImpl;
     }
+
+
+    /**
+     * 鍋滆溅璐规煡璇�
+     *
+     * @param reqJson
+     * @return
+     */
+    @RequestMapping(value = "/parkSpaceFee", method = RequestMethod.POST)
+    public ResponseEntity<String> parkSpaceFee(@RequestBody JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "code", "鏈寘鍚皬鍖虹紪鐮�");
+        return queryParkspaceFeeImpl.query(reqJson);
+    }
+
+    /**
+     * 鏍规嵁灞炴�ф煡璇㈣垂鐢�
+     *
+     * @param communityId
+     * @return
+     * @path /app/feeApi/listFeeByAttr
+     */
+    @RequestMapping(value = "/listFeeByAttr", method = RequestMethod.GET)
+    public ResponseEntity<String> listFeeByAttr(@RequestParam(value = "communityId") String communityId,
+                                                @RequestParam(value = "feeId", required = false) String feeId,
+                                                @RequestParam(value = "specCd") String specCd,
+                                                @RequestParam(value = "value") String value,
+                                                @RequestParam(value = "row") int row,
+                                                @RequestParam(value = "page") int page) {
+
+        FeeAttrDto feeAttrDto = new FeeAttrDto();
+        feeAttrDto.setCommunityId(communityId);
+        feeAttrDto.setSpecCd(specCd);
+        feeAttrDto.setValue(value);
+        feeAttrDto.setFeeId(feeId);
+        feeAttrDto.setRow(row);
+        feeAttrDto.setPage(page);
+        return queryFeeByAttrImpl.query(feeAttrDto);
+    }
+
+    /**
+     * 鏌ヨ娆犺垂璐圭敤
+     *
+     * @param payObjId    浠樿垂鏂笽D
+     * @param communityId 灏忓尯ID
+     * @return
+     * @path /app/feeApi/listOweFees
+     */
+    @RequestMapping(value = "/listOweFees", method = RequestMethod.GET)
+    public ResponseEntity<String> listOweFees(@RequestParam(value = "payObjId", required = false) String payObjId,
+                                              @RequestParam(value = "payObjType", required = false) String payObjType,
+                                              @RequestParam(value = "ownerId", required = false) String ownerId,
+                                              @RequestParam(value = "communityId") String communityId) {
+        if (StringUtil.isEmpty(payObjId) && StringUtil.isEmpty(ownerId)) {
+            throw new IllegalArgumentException("璐圭敤瀵硅薄鎴栬�呬笟涓讳笉鑳介兘涓虹┖");
+        }
+        FeeDto feeDto = new FeeDto();
+        feeDto.setPayerObjId(payObjId);
+        feeDto.setPayerObjType(payObjType);
+        feeDto.setOwnerId(ownerId);
+        feeDto.setCommunityId(communityId);
+        return queryOweFeeImpl.query(feeDto);
+    }
+
+    /**
+     * 鏌ヨ娆犺垂璐圭敤
+     *
+     * @param roomId      鎴垮眿ID
+     * @param communityId 灏忓尯ID
+     * @return
+     * @path /app/feeApi/listAllRoomOweFees
+     */
+    @RequestMapping(value = "/listAllRoomOweFees", method = RequestMethod.GET)
+    public ResponseEntity<String> listAllRoomOweFees(
+            @RequestParam(value = "roomId", required = false) String roomId,
+            @RequestParam(value = "communityId") String communityId) {
+        FeeDto feeDto = new FeeDto();
+        feeDto.setPayerObjId(roomId);
+        feeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);
+        feeDto.setCommunityId(communityId);
+        return queryOweFeeImpl.querys(feeDto);
+    }
+
+
+    /**
+     * 鏌ヨ娆犺垂璐圭敤(鎵归噺鏌ヨ)
+     *
+     * @param num         鍋滆溅浣嶆垨鎴垮眿缂栧彿
+     * @param communityId 灏忓尯ID
+     * @return
+     * @path /app/feeApi/getOweFees
+     */
+    @RequestMapping(value = "/getOweFees", method = RequestMethod.GET)
+    public ResponseEntity<String> getOweFees(
+            @RequestParam(value = "payObjType") String payObjType,
+            @RequestParam(value = "communityId") String communityId,
+            @RequestParam(value = "billType") String billType,
+            @RequestParam(value = "row") int row,
+            @RequestParam(value = "page") int page,
+            @RequestParam(value = "num", required = false) String num
+    ) {
+        FeeDto feeDto = new FeeDto();
+        feeDto.setPayerObjId(num);
+        feeDto.setPayerObjType(payObjType);
+        feeDto.setCommunityId(communityId);
+        feeDto.setBillType(billType);
+        feeDto.setRow(row);
+        feeDto.setPage(page);
+        return queryOweFeeImpl.queryAllOwneFee(feeDto);
+    }
+
+    /**
+     * 娆犺垂鎵归噺缂磋垂
+     *
+     * @param reqJson {
+     *                "communityId":"",
+     *                "fees":[
+     *                {
+     *                "feeId":"123123",
+     *                "feePrice":10.00,
+     *                <p>
+     *                }
+     *                <p>
+     *                ]
+     *                }
+     * @return
+     * @path /app/feeApi/payOweFee
+     */
+    @RequestMapping(value = "/payOweFee", method = RequestMethod.POST)
+    public ResponseEntity<String> payOweFee(@RequestBody JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "communityId", "鏈寘鍚皬鍖轰俊鎭�");
+
+        Assert.hasKey(reqJson, "fees", "鏈寘鍚即璐归」鐩�");
+
+        return payOweFeeImpl.pay(reqJson);
+    }
+
+    /**
+     * 璐圭敤瀵煎叆
+     *
+     * @param reqString
+     * @return
+     */
+    @RequestMapping(value = "/importRoomFees", method = RequestMethod.POST)
+    public ResponseEntity<String> importRoomFees(@RequestBody String reqString) {
+
+        JSONObject reqJson = JSONObject.parseObject(reqString);
+        Assert.hasKeyAndValue(reqJson, "communityId", "鏈寘鍚皬鍖轰俊鎭�");
+        Assert.hasKeyAndValue(reqJson, "feeTypeCd", "鏈寘鍚垂鐢ㄧ被鍨�");
+        Assert.hasKeyAndValue(reqJson, "storeId", "鏈寘鍚晢鎴蜂俊鎭�");
+        Assert.hasKeyAndValue(reqJson, "userId", "鏈寘鍚敤鎴蜂俊鎭�");
+        Assert.hasKeyAndValue(reqJson, "batchId", "鏈寘鍚敤鎴蜂俊鎭�");
+
+        return importRoomFeeImpl.importFee(reqJson);
+    }
+
+    /**
+     * 杞﹁締璐圭敤瀵煎叆
+     * /feeApi/importCarFees
+     * path /app/feeApi/importCarFees
+     *
+     * @param reqString
+     * @return
+     */
+    @RequestMapping(value = "/importCarFees", method = RequestMethod.POST)
+    public ResponseEntity<String> importCarFees(@RequestBody String reqString) {
+
+        JSONObject reqJson = JSONObject.parseObject(reqString);
+        Assert.hasKeyAndValue(reqJson, "communityId", "鏈寘鍚皬鍖轰俊鎭�");
+        Assert.hasKeyAndValue(reqJson, "feeTypeCd", "鏈寘鍚垂鐢ㄧ被鍨�");
+        Assert.hasKeyAndValue(reqJson, "storeId", "鏈寘鍚晢鎴蜂俊鎭�");
+        Assert.hasKeyAndValue(reqJson, "userId", "鏈寘鍚敤鎴蜂俊鎭�");
+        Assert.hasKeyAndValue(reqJson, "batchId", "鏈寘鍚壒娆′俊鎭�");
+
+        return importRoomFeeImpl.importCarFee(reqJson);
+    }
+
+    /**
+     * 鍚堝悓璐圭敤瀵煎叆
+     * /feeApi/importContractFees
+     * path /app/feeApi/importContractFees
+     *
+     * @param reqString
+     * @return
+     */
+    @RequestMapping(value = "/importContractFees", method = RequestMethod.POST)
+    public ResponseEntity<String> importContractFees(@RequestBody String reqString) {
+
+        JSONObject reqJson = JSONObject.parseObject(reqString);
+        Assert.hasKeyAndValue(reqJson, "communityId", "鏈寘鍚皬鍖轰俊鎭�");
+        Assert.hasKeyAndValue(reqJson, "feeTypeCd", "鏈寘鍚垂鐢ㄧ被鍨�");
+        Assert.hasKeyAndValue(reqJson, "storeId", "鏈寘鍚晢鎴蜂俊鎭�");
+        Assert.hasKeyAndValue(reqJson, "userId", "鏈寘鍚敤鎴蜂俊鎭�");
+        Assert.hasKeyAndValue(reqJson, "batchId", "鏈寘鍚壒娆′俊鎭�");
+
+        return importRoomFeeImpl.importContractFees(reqJson);
+    }
+
 }

--
Gitblit v1.8.0