From cbfdaf976e300bbf5e14193156795d303276fb3b Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期一, 19 四月 2021 17:21:55 +0800
Subject: [PATCH] 1.优化采购管理模块 2.优化报修物品库存减少

---
 service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java |  119 ++++++-----------------------------------------------------
 1 files changed, 13 insertions(+), 106 deletions(-)

diff --git a/service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java b/service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java
index 5092b4f..c7bebc4 100644
--- a/service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java
+++ b/service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java
@@ -11,6 +11,7 @@
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.machine.CarInoutDto;
 import com.java110.dto.owner.OwnerCarDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.parking.ParkingSpaceDto;
 import com.java110.intf.common.ICarInoutInnerServiceSMO;
 import com.java110.intf.community.IParkingSpaceInnerServiceSMO;
@@ -191,22 +192,7 @@
         paramInJson.put("feeInfo", feeDto);
         business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(PayFeeDetailPo.class.getSimpleName(), businessFeeDetail);
         paramInJson.put("detailId", businessFeeDetail.getString("detailId"));
-        feeReceiptDetailPo.setAmount(businessFeeDetail.getString("receivedAmount"));
-        feeReceiptDetailPo.setCommunityId(feeDto.getCommunityId());
-        feeReceiptDetailPo.setCycle(businessFeeDetail.getString("cycles"));
-        feeReceiptDetailPo.setDetailId(businessFeeDetail.getString("detailId"));
-        feeReceiptDetailPo.setEndTime(businessFeeDetail.getString("endTime"));
-        feeReceiptDetailPo.setFeeId(feeDto.getFeeId());
-        feeReceiptDetailPo.setFeeName(StringUtil.isEmpty(feeDto.getImportFeeName()) ? feeDto.getFeeName() : feeDto.getImportFeeName());
-        feeReceiptDetailPo.setStartTime(businessFeeDetail.getString("startTime"));
-        feeReceiptDetailPo.setReceiptId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_receiptId));
-        computeFeeSMOImpl.freshFeeReceiptDetail(feeDto, feeReceiptDetailPo);
-        feeReceiptPo.setAmount(feeReceiptDetailPo.getAmount());
-        feeReceiptPo.setCommunityId(feeReceiptDetailPo.getCommunityId());
-        feeReceiptPo.setReceiptId(feeReceiptDetailPo.getReceiptId());
-        feeReceiptPo.setObjType(feeDto.getPayerObjType());
-        feeReceiptPo.setObjId(feeDto.getPayerObjId());
-        feeReceiptPo.setObjName(computeFeeSMOImpl.getFeeObjName(feeDto));
+
         return business;
     }
 
@@ -269,6 +255,9 @@
         feeReceiptDetailPo.setReceiptId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_receiptId));
 
         computeFeeSMOImpl.freshFeeReceiptDetail(feeDto, feeReceiptDetailPo);
+        //鏌ヨ涓氫富淇℃伅
+        OwnerDto ownerDto = computeFeeSMOImpl.getFeeOwnerDto(feeDto);
+
         feeReceiptDetailPos.add(feeReceiptDetailPo);
         feeReceiptPo.setAmount(feeReceiptDetailPo.getAmount());
         feeReceiptPo.setCommunityId(feeReceiptDetailPo.getCommunityId());
@@ -276,6 +265,8 @@
         feeReceiptPo.setObjType(feeDto.getPayerObjType());
         feeReceiptPo.setObjId(feeDto.getPayerObjId());
         feeReceiptPo.setObjName(computeFeeSMOImpl.getFeeObjName(feeDto));
+        feeReceiptPo.setPayObjId(ownerDto.getOwnerId());
+        feeReceiptPo.setPayObjName(ownerDto.getName());
         feeReceiptPos.add(feeReceiptPo);
         return business;
     }
@@ -395,7 +386,9 @@
         } else {
             endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles")));
             if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
-                if (!StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                if(feeDto.getDeadlineTime() != null){
+                    endCalender.setTime(feeDto.getDeadlineTime());
+                }else if (!StringUtil.isEmpty(feeDto.getCurDegrees())) {
                     endCalender.setTime(feeDto.getCurReadingTime());
                 } else if (feeDto.getImportFeeEndTime() == null) {
                     endCalender.setTime(feeDto.getConfigEndTime());
@@ -406,97 +399,11 @@
         }
         businessFeeDetail.put("endTime", DateUtil.getFormatTimeString(endCalender.getTime(), DateUtil.DATE_FORMATE_STRING_A));
 
-        BigDecimal feePrice = new BigDecimal("0.00");
+        double feePrice = 0.0;
 
-        if ("3333".equals(feeDto.getPayerObjType())) { //鎴垮眿鐩稿叧
-            String computingFormula = feeDto.getComputingFormula();
-            if ("1001".equals(computingFormula)) { //闈㈢Н*鍗曚环+闄勫姞璐�
-                RoomDto roomDto = new RoomDto();
-                roomDto.setRoomId(feeDto.getPayerObjId());
-                roomDto.setCommunityId(feeDto.getCommunityId());
-                List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
-                if (roomDtos == null || roomDtos.size() != 1) {
-                    throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏈煡鍒版埧灞嬩俊鎭紝鏌ヨ澶氭潯鏁版嵁");
-                }
-                roomDto = roomDtos.get(0);
-                //feePrice = Double.parseDouble(feeDto.getSquarePrice()) * Double.parseDouble(roomDtos.get(0).getBuiltUpArea()) + Double.parseDouble(feeDto.getAdditionalAmount());
-                BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
-                BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDtos.get(0).getBuiltUpArea()));
-                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                //鑾峰彇鏀粯鏂瑰紡
-                String primeRate = paramInJson.getString("primeRate");
-                //鍒ゆ柇鏄惁鏄嚎涓婃敮浠�
-                if (primeRate.equals("5") || primeRate.equals("6")) {
-                    feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount);
-                } else {
-                    feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN);
-                }
-            } else if ("2002".equals(computingFormula)) { // 鍥哄畾璐圭敤
-                //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
-                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
-            } else if ("4004".equals(computingFormula)) {
-                feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
-            } else if ("5005".equals(computingFormula)) {
-                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
-                    //throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
-                } else {
-                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
-                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
-                    BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
-                    BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                    BigDecimal sub = curDegree.subtract(preDegree);
-                    feePrice = sub.multiply(squarePrice)
-                            .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
-                }
-            } else if ("6006".equals(computingFormula)) {
-                feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
-            } else {
-                throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
-            }
-        } else if ("6666".equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
-            String computingFormula = feeDto.getComputingFormula();
-            if ("1001".equals(computingFormula)) { //闈㈢Н*鍗曚环+闄勫姞璐�
-                ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto();
-                parkingSpaceDto.setCommunityId(feeDto.getCommunityId());
-                parkingSpaceDto.setPsId(feeDto.getPayerObjId());
-                List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto);
+        feePrice = computeFeeSMOImpl.getFeePrice(feeDto);
 
-                if (parkingSpaceDtos == null || parkingSpaceDtos.size() < 1) { //鏁版嵁鏈夐棶棰�
-                    throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏈煡鍒板仠杞︿綅淇℃伅锛屾煡璇㈠鏉℃暟鎹�");
-                }
-                //feePrice = Double.parseDouble(feeDto.getSquarePrice()) * Double.parseDouble(parkingSpaceDtos.get(0).getArea()) + Double.parseDouble(feeDto.getAdditionalAmount());
-                BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
-                BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(parkingSpaceDtos.get(0).getArea()));
-                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN);
-            } else if ("2002".equals(computingFormula)) { // 鍥哄畾璐圭敤
-                //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
-                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
-            } else if ("5005".equals(computingFormula)) {
-                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
-                    throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
-                } else {
-                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
-                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
-                    BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
-                    BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
-                    BigDecimal sub = curDegree.subtract(preDegree);
-                    feePrice = sub.multiply(squarePrice)
-                            .add(additionalAmount)
-                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
-                }
-            } else if ("6006".equals(computingFormula)) {
-                feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
-            } else if ("4004".equals(computingFormula)) {
-                feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
-            } else {
-                throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
-            }
-        }
-        BigDecimal receivableAmount = feePrice;
+        BigDecimal receivableAmount = new BigDecimal(feePrice);
         BigDecimal cycles = new BigDecimal(Double.parseDouble(paramInJson.getString("cycles")));
         double tmpReceivableAmount = cycles.multiply(receivableAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
         double discountPrice = paramInJson.getDouble("discountPrice");

--
Gitblit v1.8.0