java110 5 vuotta sitten
vanhempi
commit
2b51dbc333

+ 18 - 0
java110-bean/src/main/java/com/java110/dto/feeReceipt/FeeReceiptDto.java

@@ -27,6 +27,8 @@ public class FeeReceiptDto extends PageDto implements Serializable {
     private String objType;
     private String feeTypeCd;
     private String feeName;
+    private String payObjId;
+    private String payObjName;
 
     //商户名称
     private String storeName;
@@ -157,4 +159,20 @@ public class FeeReceiptDto extends PageDto implements Serializable {
     public void setFeeName(String feeName) {
         this.feeName = feeName;
     }
+
+    public String getPayObjId() {
+        return payObjId;
+    }
+
+    public void setPayObjId(String payObjId) {
+        this.payObjId = payObjId;
+    }
+
+    public String getPayObjName() {
+        return payObjName;
+    }
+
+    public void setPayObjName(String payObjName) {
+        this.payObjName = payObjName;
+    }
 }

+ 16 - 0
java110-bean/src/main/java/com/java110/po/feeReceipt/FeeReceiptPo.java

@@ -12,6 +12,8 @@ public class FeeReceiptPo implements Serializable {
     private String communityId;
     private String receiptId;
     private String objType;
+    private String payObjId;
+    private String payObjName;
 
     public String getAmount() {
         return amount;
@@ -77,5 +79,19 @@ public class FeeReceiptPo implements Serializable {
         this.objType = objType;
     }
 
+    public String getPayObjId() {
+        return payObjId;
+    }
+
+    public void setPayObjId(String payObjId) {
+        this.payObjId = payObjId;
+    }
 
+    public String getPayObjName() {
+        return payObjName;
+    }
+
+    public void setPayObjName(String payObjName) {
+        this.payObjName = payObjName;
+    }
 }

+ 8 - 0
java110-core/src/main/java/com/java110/core/smo/IComputeFeeSMO.java

@@ -3,6 +3,7 @@ package com.java110.core.smo;
 import com.java110.dto.RoomDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.owner.OwnerCarDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.report.ReportCarDto;
 import com.java110.dto.report.ReportFeeDto;
 import com.java110.dto.report.ReportRoomDto;
@@ -61,6 +62,13 @@ public interface IComputeFeeSMO {
      */
     public String getFeeObjName(FeeDto feeDto);
 
+    /**
+     * 查询费用的业主信息
+     * @param feeDto
+     * @return
+     */
+    public OwnerDto getFeeOwnerDto(FeeDto feeDto);
+
     /**
      * 刷入 付费方名称
      * @param feeDtos

+ 72 - 5
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java

@@ -9,6 +9,7 @@ import com.java110.dto.fee.FeeAttrDto;
 import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.owner.OwnerCarDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.parking.ParkingSpaceDto;
 import com.java110.dto.report.ReportCarDto;
 import com.java110.dto.report.ReportFeeDto;
@@ -18,6 +19,7 @@ import com.java110.intf.community.IParkingSpaceInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.fee.IFeeInnerServiceSMO;
 import com.java110.intf.user.IOwnerCarInnerServiceSMO;
+import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.po.feeReceiptDetail.FeeReceiptDetailPo;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.exception.ListenerExecuteException;
@@ -69,6 +71,9 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
     @Autowired(required = false)
     private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
 
+    @Autowired
+    private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
+
     @Override
     public Date getFeeEndTime() {
         return null;
@@ -342,6 +347,68 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
         return objName;
     }
 
+    @Override
+    public OwnerDto getFeeOwnerDto(FeeDto feeDto) {
+        OwnerDto ownerDto = getOwnerDtoByFeeAttr(feeDto);
+        if (ownerDto != null) {
+            return ownerDto;
+        }
+
+        if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())) { //房屋相关
+            ownerDto = new OwnerDto();
+            ownerDto.setRoomId(feeDto.getPayerObjId());
+            ownerDto.setCommunityId(feeDto.getCommunityId());
+            List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
+            Assert.listOnlyOne(ownerDtos, "业主不存在");
+            return ownerDtos.get(0);
+        }
+
+        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,"车辆不存在");
+            ownerDto = new OwnerDto();
+            ownerDto.setOwnerId(ownerCarDtos.get(0).getOwnerId());
+            ownerDto.setCommunityId(feeDto.getCommunityId());
+            List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
+            Assert.listOnlyOne(ownerDtos, "业主不存在");
+            return ownerDtos.get(0);
+        }
+        return null;
+    }
+
+    private OwnerDto getOwnerDtoByFeeAttr(FeeDto feeDto) {
+        List<FeeAttrDto> feeAttrDtos = feeDto.getFeeAttrDtos();
+
+        if (feeAttrDtos == null || feeAttrDtos.size() < 1) {
+            return null;
+        }
+
+        OwnerDto ownerDto = new OwnerDto();
+        for (FeeAttrDto feeAttrDto : feeAttrDtos) {
+            if (feeAttrDto.getSpecCd().equals(FeeAttrDto.SPEC_CD_OWNER_ID)) {
+                ownerDto.setOwnerId(feeAttrDto.getValue());
+            }
+
+            if (feeAttrDto.getSpecCd().equals(FeeAttrDto.SPEC_CD_OWNER_NAME)) {
+                ownerDto.setName(feeAttrDto.getValue());
+            }
+
+            if (feeAttrDto.getSpecCd().equals(FeeAttrDto.SPEC_CD_OWNER_LINK)) {
+                ownerDto.setLink(feeAttrDto.getValue());
+            }
+        }
+
+        if (StringUtil.isEmpty(ownerDto.getOwnerId())) {
+            return null;
+        }
+
+        return ownerDto;
+    }
+
     @Override
     public void freshFeeObjName(List<FeeDto> feeDtos) {
 
@@ -510,9 +577,9 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
         int hours = new Double((cycle - Math.floor(cycle)) * futureDay * 24).intValue();
         endCalender.add(Calendar.HOUR, hours);
         if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
-            if(feeDto.getDeadlineTime() != null){
-               endCalender.setTime(feeDto.getDeadlineTime());
-            }else 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());
@@ -842,9 +909,9 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
         }
         if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
             //先取 deadlineTime
-            if(feeDto.getDeadlineTime() != null){
+            if (feeDto.getDeadlineTime() != null) {
                 targetEndDate = feeDto.getDeadlineTime();
-            }else if (!StringUtil.isEmpty(feeDto.getCurDegrees())) {
+            } else if (!StringUtil.isEmpty(feeDto.getCurDegrees())) {
                 targetEndDate = feeDto.getCurReadingTime();
             } else if (feeDto.getImportFeeEndTime() == null) {
                 targetEndDate = feeDto.getConfigEndTime();

+ 17 - 5
java110-db/src/main/resources/mapper/fee/FeeReceiptServiceDaoImplMapper.xml

@@ -8,9 +8,9 @@
     <!-- 保存收据信息 add by wuxw 2018-07-03 -->
     <insert id="saveFeeReceiptInfo" parameterType="Map">
         insert into fee_receipt(
-        amount,obj_id,remark,obj_name,community_id,receipt_id,obj_type
+        amount,obj_id,remark,obj_name,community_id,receipt_id,obj_type,pay_obj_id,pay_obj_name
         ) values (
-        #{amount},#{objId},#{remark},#{objName},#{communityId},#{receiptId},#{objType}
+        #{amount},#{objId},#{remark},#{objName},#{communityId},#{receiptId},#{objType},#{payObjId},#{payObjName}
         )
     </insert>
 
@@ -18,10 +18,10 @@
     <!-- 批量插入费用 -->
     <insert id="saveFeeReceipts" parameterType="Map">
         insert into fee_receipt(
-        amount,obj_id,remark,obj_name,community_id,receipt_id,obj_type
+        amount,obj_id,remark,obj_name,community_id,receipt_id,obj_type,pay_obj_id,pay_obj_name
         ) values
         <foreach collection="feeReceiptPos" item="item" separator=",">
-            (#{item.amount},#{item.objId},#{item.remark},#{item.objName},#{item.communityId},#{item.receiptId},#{item.objType})
+            (#{item.amount},#{item.objId},#{item.remark},#{item.objName},#{item.communityId},#{item.receiptId},#{item.objType},#{item.payObjId},#{item.payObjName})
         </foreach>
     </insert>
 
@@ -30,7 +30,7 @@
     <select id="getFeeReceiptInfo" parameterType="Map" resultType="Map">
         select t.amount,t.obj_id,t.obj_id objId,t.remark,t.status_cd,t.status_cd statusCd,t.obj_name,t.obj_name
         objName,t.community_id,t.community_id communityId,t.receipt_id,t.receipt_id receiptId,t.obj_type,t.obj_type
-        objType,t.create_time createTime,frd.fee_name feeName
+        objType,t.create_time createTime,frd.fee_name feeName,t.pay_obj_id payObjId,t.pay_obj_name payObjName
         from fee_receipt t
         inner join fee_receipt_detail frd on t.receipt_id = frd.receipt_id and frd.status_cd = '0'
         inner join pay_fee pf on frd.fee_id = pf.fee_id and pf.status_cd = '0'
@@ -41,6 +41,12 @@
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
+        <if test="payObjId !=null and payObjId != ''">
+            and t.pay_obj_id= #{payObjId}
+        </if>
+        <if test="payObjName !=null and payObjName != ''">
+            and t.pay_obj_name= #{payObjName}
+        </if>
         <if test="remark !=null and remark != ''">
             and t.remark= #{remark}
         </if>
@@ -282,6 +288,12 @@
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
+        <if test="payObjId !=null and payObjId != ''">
+            and t.pay_obj_id= #{payObjId}
+        </if>
+        <if test="payObjName !=null and payObjName != ''">
+            and t.pay_obj_name= #{payObjName}
+        </if>
         <if test="remark !=null and remark != ''">
             and t.remark= #{remark}
         </if>

+ 6 - 0
service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java

@@ -11,6 +11,7 @@ import com.java110.dto.fee.FeeConfigDto;
 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;
@@ -254,6 +255,9 @@ public class FeeBMOImpl extends ApiBaseBMO implements IFeeBMO {
         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());
@@ -261,6 +265,8 @@ public class FeeBMOImpl extends ApiBaseBMO implements IFeeBMO {
         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;
     }

+ 8 - 0
service-fee/src/main/java/com/java110/fee/bmo/impl/PayOweFeeImpl.java

@@ -6,6 +6,7 @@ import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.fee.*;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.repair.RepairDto;
 import com.java110.fee.bmo.IPayOweFee;
 import com.java110.fee.listener.fee.UpdateFeeInfoListener;
@@ -99,6 +100,10 @@ public class PayOweFeeImpl implements IPayOweFee {
         FeeReceiptPo feeReceiptPo = new FeeReceiptPo();
         feeReceiptPo.setReceiptId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_receiptId));
         feeReceiptPo.setAmount("0.0");
+
+        feeReceiptPo.setPayObjId("-1");
+        feeReceiptPo.setPayObjName("未知");
+
         for (int feeIndex = 0; feeIndex < fees.size(); feeIndex++) {
             feeObj = fees.getJSONObject(feeIndex);
             Assert.hasKeyAndValue(feeObj, "feeId", "未包含费用项ID");
@@ -264,5 +269,8 @@ public class PayOweFeeImpl implements IPayOweFee {
         if (StringUtil.isEmpty(feeReceiptPo.getObjName())) {
             feeReceiptPo.setObjName(computeFeeSMOImpl.getFeeObjName(feeDto));
         }
+        OwnerDto ownerDto = computeFeeSMOImpl.getFeeOwnerDto(feeDto);
+        feeReceiptPo.setPayObjId(ownerDto.getOwnerId());
+        feeReceiptPo.setPayObjName(ownerDto.getName());
     }
 }

+ 7 - 0
service-job/src/main/java/com/java110/job/adapt/payment/receipt/PayFeeReceiptAdapt.java

@@ -7,6 +7,7 @@ import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.fee.FeeDetailDto;
 import com.java110.dto.fee.FeeDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.entity.order.Business;
 import com.java110.intf.community.ICommunityInnerServiceSMO;
 import com.java110.intf.fee.IFeeDetailInnerServiceSMO;
@@ -127,6 +128,9 @@ public class PayFeeReceiptAdapt extends DatabusAdaptImpl {
 
         feeDto = feeDtos.get(0);
 
+        //查询业主信息
+        OwnerDto ownerDto = computeFeeSMOImpl.getFeeOwnerDto(feeDto);
+
         //添加单元信息
         FeeReceiptPo feeReceiptPo = new FeeReceiptPo();
         FeeReceiptDetailPo feeReceiptDetailPo = new FeeReceiptDetailPo();
@@ -147,6 +151,9 @@ public class PayFeeReceiptAdapt extends DatabusAdaptImpl {
         feeReceiptPo.setObjType(feeDto.getPayerObjType());
         feeReceiptPo.setObjId(feeDto.getPayerObjId());
         feeReceiptPo.setObjName(computeFeeSMOImpl.getFeeObjName(feeDto));
+        feeReceiptPo.setPayObjId(ownerDto.getOwnerId());
+        feeReceiptPo.setPayObjName(ownerDto.getName());
+
         //这里只是写入 收据表,暂不考虑 事务一致性问题,就算写入失败 也只是影响 收据打印,如果 贵公司对 收据要求 比较高,不能有失败的情况 请加入事务管理
         feeReceiptDetailInnerServiceSMOImpl.saveFeeReceiptDetail(feeReceiptDetailPo);
         feeReceiptInnerServiceSMOImpl.saveFeeReceipt(feeReceiptPo);