diff --git a/mallinkAdmin/src/main/resources/db/migration/V202405010.sql b/mallinkAdmin/src/main/resources/db/migration/V202405010.sql index 6b442e3b2..0e341e108 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202405010.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202405010.sql @@ -4,4 +4,5 @@ ALTER TABLE wx_property_contract ADD COLUMN shop_numbers VARCHAR(100) COMMENT ' ALTER TABLE wx_rent_contract ADD COLUMN price_detail TEXT COMMENT '费用详细说明' AFTER rent_price; ALTER TABLE wx_property_contract ADD COLUMN price_detail TEXT COMMENT '费用详细说明' AFTER rent_price; ALTER TABLE wx_property_contract ADD COLUMN fees_standards_info TEXT COMMENT '其他标准费用信息' ; +ALTER TABLE wx_property_contract ADD COLUMN parent_bill_id bigint(20) COMMENT '主账单id' ; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java index 0e931fdd2..cc963c201 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java @@ -99,6 +99,9 @@ public class WxBillProperty extends WxBillBaseEntity { @io.swagger.annotations.ApiModelProperty(value = "备注", name = "comments") private String comments; + + @io.swagger.annotations.ApiModelProperty(value="主物业账单ID",name="parentBillId") + private Long parentBillId; @TableField(exist = false) private Integer allPeriod; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java index dd39e724f..a4498c105 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillFeesStandardsListVo.java @@ -15,5 +15,6 @@ public class WxBillFeesStandardsListVo implements Serializable { private Date end; private Date receiveDate; private WxFeesStandards feeStandards; + private Long parentBillId; } diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java index d9825e86c..78287fbff 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java @@ -477,7 +477,7 @@ public class WxRentContractHelper { } //其他标准计费项 - public static List getStandardsBillList(List feesStandarsList,Date billStartDate,Date billEndDate,boolean isFixed) { + public static List getStandardsBillList(Integer decimalSize,List feesStandarsList,Date billStartDate,Date billEndDate,boolean isFixed) { if (null == feesStandarsList || feesStandarsList.size() <= 0 ) { return null; } @@ -491,6 +491,7 @@ public class WxRentContractHelper { if (fees.getFixedPrice().intValue() == EnumYesOrNo.YES.getCode().intValue() && null != billStartDate && null != billEndDate) { vo.setStart(billStartDate); vo.setEnd(billEndDate); + vo.setTotal(fees.calcuteTotalMoney(decimalSize, billStartDate, billEndDate, "1")); vo.setReceiveDate(DateUtils.getDaySet(billStartDate,Calendar.DATE,-1)); } vo.setFeeStandards(fees); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index f380729b7..a87341277 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -445,7 +445,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService message = "更新物业合同信息成功"; } - + record.setFeeStandards(record.getFeesStardarsList()); return new ResultData(Result.SUCCESS, message, record); } @@ -644,8 +644,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxPropertyContract); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); Map resultMap = new HashedMap(); - List propertyResultList = new ArrayList<>(); - List allResultList = new ArrayList<>(); + List resultList = new ArrayList<>(); Date endDate = null; if(yearList.size() > 1){ @@ -674,7 +673,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService billEndDate = billTimeVoList.get(billTimeVoList.size()-1).getEndDate(); } //一次性费用的,只有一个账单。 - List fixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getFeesStardarsList(),billStartDate,billEndDate,true); + List fixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getDecimalSize(),wxPropertyContract.getFeesStardarsList(),billStartDate,billEndDate,true); int index = 0; @@ -685,7 +684,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService String standarsTotal = "0"; //非一次性费用的,跟随物业账单的周期 - List unFixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getFeesStardarsList(),billStartDate,billEndDate,true); + List unFixedList = WxRentContractHelper.getStandardsBillList(wxPropertyContract.getDecimalSize(),wxPropertyContract.getFeesStardarsList(),billStartDate,billEndDate,true); boolean flag = false; @@ -734,51 +733,50 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService ++billcount; //物业主账单 - WxBillProperty wxBillProperty = generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,billTimeVo.getStartDate(),billTimeVo.getEndDate(),billTimeVo.getReceiveDate(),needpay,userId,billcount,shopInfo,standarsTotal,""); + WxBillProperty wxBillProperty = generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,billTimeVo.getStartDate(),billTimeVo.getEndDate(),billTimeVo.getReceiveDate(),needpay,userId,billcount,shopInfo,standarsTotal,"",null); //非一次性账单 wxBillProperty.setUnFixedbillFeesStandardsList(unFixedList); //每个非从一次性都要创建账单 if (null != unFixedList) { for (int j = 0 ; j < unFixedList.size(); j ++ ) { WxBillFeesStandardsListVo svo = unFixedList.get(j); + svo.setParentBillId(wxBillProperty.getId()); WxBillProperty property = generateBillPropertyByBillStandards(wxPayAccountBill,wxPropertyContract,isPreview,userId,svo,billcount,shopInfo); - allResultList.add(property); + resultList.add(property); } } //主账单列表 - propertyResultList.add(wxBillProperty); - //所有账单列表 - allResultList.add(wxBillProperty); + resultList.add(wxBillProperty); } if (null != fixedList) { for (int i = 0 ; i < fixedList.size(); i ++ ) { WxBillFeesStandardsListVo svo = fixedList.get(i); WxBillProperty property = generateBillPropertyByBillStandards(wxPayAccountBill,wxPropertyContract,isPreview,userId,svo,billcount,shopInfo); - allResultList.add(property); + resultList.add(property); } } //批量生成预账单 - if(saveDb && allResultList.size() > 0 ) { - wxBillPropertyMapper.insertBills(allResultList); + if(saveDb && resultList.size() > 0 ) { + wxBillPropertyMapper.insertBills(resultList); //for (int i = 0 ; i < resultList.size() ; i++) { // wxBillPropertyMapper.insert(resultList.get(i)); //} } resultMap.put("billcount",billcount); - resultMap.put("billList",propertyResultList); + resultMap.put("billList",resultList); return resultMap; } private WxBillProperty generateBillPropertyByBillStandards(WxPayAccountBill wxPayAccountBill,WxPropertyContract wxPropertyContract,Integer isPreview,Long userId,WxBillFeesStandardsListVo svo, Integer billcount,Map shopInfo) { - return generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,svo.getStart(),svo.getEnd(),svo.getReceiveDate(),svo.getTotal(),userId,billcount,shopInfo,"0",svo.getBillName()); + return generateBillProperty(wxPayAccountBill,wxPropertyContract,isPreview,svo.getStart(),svo.getEnd(),svo.getReceiveDate(),svo.getTotal(),userId,billcount,shopInfo,"0",svo.getBillName(),svo.getParentBillId()); } private WxBillProperty generateBillProperty(WxPayAccountBill wxPayAccountBill,WxPropertyContract wxPropertyContract,Integer isPreview,Date start,Date end,Date receiveDate,String needpay, - Long userId,Integer billcount,Map shopInfo,String standarsTotal,String remark) { + Long userId,Integer billcount,Map shopInfo,String standarsTotal,String remark,Long parentBillId) { final IdWorker idWorker = IdWorker.get(); WxBillProperty wxBillProperty = new WxBillProperty(); wxBillProperty.setIsPreview(isPreview); @@ -812,6 +810,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService wxBillProperty.setLatePayRatio(0); wxBillProperty.setTotalFee(new BigDecimal(needpay).add(new BigDecimal(standarsTotal)).toPlainString()); wxBillProperty.setComments(remark); + wxBillProperty.setParentBillId(parentBillId); //计算手续费 BigDecimal servicePay = new BigDecimal(wxBillProperty.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(100), wxPropertyContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index 618d8084a..8a37a2518 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -2,10 +2,10 @@ - + - + @@ -18,9 +18,9 @@ - - - + + + @@ -33,6 +33,7 @@ + @@ -53,7 +54,7 @@ `createtime`,`expired_day`,`tenant_id`,`status`,`is_del`,`need_pay`,`last_owe_call_time`,`last_owe_call_user`, `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`apply_status`,`apply_pay_img`,`apply_update_time`, `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, - `pay_way`,`late_pay_status`,`comments`,starttime,endtime,freeze,service_charge_pay + `pay_way`,`late_pay_status`,`comments`,starttime,endtime,freeze,service_charge_pay,`parent_bill_id` @@ -84,6 +85,8 @@ and is_preview = #{isPreview} and `pay_way` = #{payWay} and `late_pay_status` = #{latePayStatus} + and `parent_bill_id` = #{parentBillId} + and (`last_owe_call_time` is not null and `receive_pay` - `pay` > 0 and status not in (3,6,7) ) and property_contract_id in @@ -156,7 +159,7 @@ and br.`property_contract_id` = #{propertyContractId} and br.`pay_way` = #{payWay} and br.`late_pay_status` = #{latePayStatus} - and br.`late_pay_status` = #{latePayStatus} + and br.`parent_bill_id` = #{parentBillId} and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` > 0 and br.status not in (3,6,7) ) and br.property_contract_id in @@ -186,7 +189,7 @@ br.`status`,br.`need_pay`,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`period`,br.`last_owe_call_time`,br.`last_owe_call_user`, br.`revenue`,br.`late_pay_time`,br.`property_contract_id`,br.late_pay_price,br.`shop_info`,br.pay_way,br.late_pay_status, br.`comments`,br.starttime,br.endtime,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.freeze,br.service_charge_pay, - br.`late_pay_ratio` + br.`late_pay_ratio`,br.`parent_bill_id` from wx_bill_property br order by ${sortColumns} @@ -367,7 +370,7 @@ tenant_id, parent_tenant_id, status, is_del, need_pay, merchant_id, user_id, shop_id, updatetime, starttime, endtime, rent_shop_type, revenue, late_pay_ratio, late_pay_time, late_pay_price, period, is_preview, shop_info, - pay_way, late_pay_status, comments,service_charge_pay) + pay_way, late_pay_status, comments,service_charge_pay,parent_bill_id) VALUES ( @@ -376,7 +379,7 @@ #{item.status},#{item.isDel},#{item.needPay},#{item.merchantId}, #{item.userId},#{item.shopId},#{item.updatetime},#{item.starttime},#{item.endtime},#{item.rentShopType},#{item.revenue}, #{item.latePayRatio},#{item.latePayTime},#{item.latePayPrice},#{item.period},#{item.isPreview},#{item.shopInfo}, - #{item.payWay},#{item.latePayStatus},#{item.comments},#{item.serviceChargePay} + #{item.payWay},#{item.latePayStatus},#{item.comments},#{item.serviceChargePay},#{parentBillId} )