Преглед изворни кода

Merge remote-tracking branch 'origin/master' into xinghong-dev

xiaogang пре 5 година
родитељ
комит
f26ea6aea7

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/reportFeeMonthStatistics/ReportFeeMonthStatisticsDto.java

@@ -40,6 +40,7 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
     private String roomId;
     private String roomNum;
     private String carNum;
+    private String contractCode;
     private String payerObjType;
 
     private String objCount;
@@ -473,4 +474,12 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
     public void setVacantHousingReduction(String vacantHousingReduction) {
         this.vacantHousingReduction = vacantHousingReduction;
     }
+
+    public String getContractCode() {
+        return contractCode;
+    }
+
+    public void setContractCode(String contractCode) {
+        this.contractCode = contractCode;
+    }
 }

+ 56 - 18
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java

@@ -3,12 +3,9 @@ package com.java110.core.smo.impl;
 import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.RoomDto;
 import com.java110.dto.community.CommunityDto;
+import com.java110.dto.contract.ContractDto;
 import com.java110.dto.contractRoom.ContractRoomDto;
-import com.java110.dto.fee.BillDto;
-import com.java110.dto.fee.BillOweFeeDto;
-import com.java110.dto.fee.FeeAttrDto;
-import com.java110.dto.fee.FeeConfigDto;
-import com.java110.dto.fee.FeeDto;
+import com.java110.dto.fee.*;
 import com.java110.dto.owner.OwnerCarDto;
 import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.parking.ParkingSpaceDto;
@@ -19,6 +16,7 @@ import com.java110.intf.community.ICommunityInnerServiceSMO;
 import com.java110.intf.community.IParkingSpaceInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.fee.IFeeInnerServiceSMO;
+import com.java110.intf.store.IContractInnerServiceSMO;
 import com.java110.intf.store.IContractRoomInnerServiceSMO;
 import com.java110.intf.user.IOwnerCarInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
@@ -38,12 +36,7 @@ import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 费用计算 服务类
@@ -79,6 +72,9 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
     @Autowired(required = false)
     private IContractRoomInnerServiceSMO contractRoomInnerServiceSMOImpl;
 
+    @Autowired(required = false)
+    private IContractInnerServiceSMO contractInnerServiceSMOImpl;
+
     @Override
     public Date getFeeEndTime() {
         return null;
@@ -143,6 +139,8 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
             computeFeePriceByRoom(feeDto, roomDto);
         } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//车位相关
             computeFeePriceByParkingSpace(feeDto);
+        }else if(FeeDto.PAYER_OBJ_TYPE_CONTRACT.equals(feeDto.getPayerObjType())) { //房屋相关
+            computeFeePriceByContract(feeDto, roomDto);
         }
     }
 
@@ -201,6 +199,31 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
             //feeDto.setDeadlineTime(DateUtil.getCurrentDate()); 欠费日期不对先注释
         }
     }
+    /**
+     * 根据房屋来算单价
+     *
+     * @param feeDto
+     */
+    private void computeFeePriceByContract(FeeDto feeDto, RoomDto roomDto) {
+        Map<String, Object> targetEndDateAndOweMonth = getTargetEndDateAndOweMonth(feeDto);
+        Date targetEndDate = (Date) targetEndDateAndOweMonth.get("targetEndDate");
+        double oweMonth = (double) targetEndDateAndOweMonth.get("oweMonth");
+
+        String computingFormula = feeDto.getComputingFormula();
+        double feePrice = getFeePrice(feeDto, roomDto);
+        feeDto.setFeePrice(feePrice);
+        //double month = dayCompare(feeDto.getEndTime(), DateUtil.getCurrentDate());
+        BigDecimal price = new BigDecimal(feeDto.getFeePrice());
+        price = price.multiply(new BigDecimal(oweMonth));
+        feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
+        feeDto.setDeadlineTime(targetEndDate);
+
+        //动态费用
+        if ("4004".equals(computingFormula) && !FeeDto.STATE_FINISH.equals(feeDto.getState())) {
+            feeDto.setAmountOwed(feeDto.getFeePrice() + "");
+            //feeDto.setDeadlineTime(DateUtil.getCurrentDate()); 欠费日期不对先注释
+        }
+    }
 
 
     /**
@@ -368,13 +391,13 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
             return ownerDtos.get(0);
         }
 
-        if(FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())){
+        if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {
             OwnerCarDto ownerCarDto = new OwnerCarDto();
             ownerCarDto.setCarId(feeDto.getPayerObjId());
             ownerCarDto.setCommunityId(feeDto.getCommunityId());
             List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
 
-            Assert.listOnlyOne(ownerCarDtos,"车辆不存在");
+            Assert.listOnlyOne(ownerCarDtos, "车辆不存在");
             ownerDto = new OwnerDto();
             ownerDto.setOwnerId(ownerCarDtos.get(0).getOwnerId());
             ownerDto.setCommunityId(feeDto.getCommunityId());
@@ -382,6 +405,21 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
             Assert.listOnlyOne(ownerDtos, "业主不存在");
             return ownerDtos.get(0);
         }
+
+        if (FeeDto.PAYER_OBJ_TYPE_CONTRACT.equals(feeDto.getPayerObjType())) {
+            ContractDto contractDto = new ContractDto();
+            contractDto.setContractId(feeDto.getPayerObjId());
+            contractDto.setCommunityId(feeDto.getCommunityId());
+            List<ContractDto> contractDtos = contractInnerServiceSMOImpl.queryContracts(contractDto);
+
+            Assert.listOnlyOne(contractDtos, "车辆不存在");
+            ownerDto = new OwnerDto();
+            ownerDto.setOwnerId(contractDtos.get(0).getObjId());
+            ownerDto.setCommunityId(feeDto.getCommunityId());
+            List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
+            Assert.listOnlyOne(ownerDtos, "业主不存在");
+            return ownerDtos.get(0);
+        }
         return null;
     }
 
@@ -795,10 +833,10 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 //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(0);
-                for(ContractRoomDto tmpContractRoomDto: contractRoomDtos){
+                for (ContractRoomDto tmpContractRoomDto : contractRoomDtos) {
                     builtUpArea = builtUpArea.add(new BigDecimal(Double.parseDouble(tmpContractRoomDto.getBuiltUpArea())));
                 }
-                feeDto.setBuiltUpArea(builtUpArea.doubleValue()+"");
+                feeDto.setBuiltUpArea(builtUpArea.doubleValue() + "");
                 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
                 feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN);
             } else if ("2002".equals(computingFormula)) { // 固定费用
@@ -904,9 +942,9 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
     private BigDecimal computeContractCustomizeFormula(FeeDto feeDto, List<ContractRoomDto> contractRoomDtos) {
 
         BigDecimal total = new BigDecimal(0.0);
-       for(ContractRoomDto contractRoomDto :contractRoomDtos){
-           total = total.add(computeRoomCustomizeFormula(feeDto,contractRoomDto));
-       }
+        for (ContractRoomDto contractRoomDto : contractRoomDtos) {
+            total = total.add(computeRoomCustomizeFormula(feeDto, contractRoomDto));
+        }
         return total;
     }
 

+ 3 - 3
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml

@@ -916,7 +916,7 @@
         pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
         t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
         importFeeName,t.prime_rate,d.name primeRate,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName,pfdd.discount_price discountPrice
+        ruleName,pfdd.discount_price discountPrice,co.contract_code contractCode
         from pay_fee_detail t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
         inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
@@ -928,8 +928,8 @@
         left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
         left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
         left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
-        d.table_columns="prime_rate"
+        left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and d.table_columns="prime_rate"
+        LEFT JOIN contract co on pf.payer_obj_id = co.contract_id and co.status_cd = '0' and pf.payer_obj_type='7777'
         where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}

+ 4 - 1
service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java

@@ -329,8 +329,11 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
                     reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getFloorNum()
                             + "栋" + reportFeeMonthStatistics.getUnitNum()
                             + "单元" + reportFeeMonthStatistics.getRoomNum() + "室");
-                } else {
+                } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(reportFeeMonthStatistics.getPayerObjType())) {
                     reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getCarNum());
+                }else{
+                    reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getContractCode());
+
                 }
 
                 if (!StringUtil.isEmpty(reportFeeMonthStatistics.getImportFeeName())) {