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 1d0be0548..2989aab7b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -15,10 +15,7 @@ import com.iformall.domain.vo.BillTimeVo; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; -import com.iformall.service.WxFlowRecordService; -import com.iformall.service.WxFlowService; -import com.iformall.service.WxPropertyContractService; -import com.iformall.service.WxRentContractService; +import com.iformall.service.*; import com.iformall.utils.DateUtils; import org.apache.commons.collections.map.HashedMap; import org.apache.commons.lang3.StringUtils; @@ -76,6 +73,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService @Autowired WxRentContractService wxRentContractService; + @Autowired + WxPayAccountBillService wxPayAccountBillService; + @Override public Map listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) { //Object rentContractStatusInfo = getRentContractStatusInfo(record); @@ -621,6 +621,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService } public Map buildRent(int receivePeriod,long[] priceArrs, List yearList,int dayType, WxPropertyContract wxPropertyContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview,Map shopInfo,boolean saveDb) { + WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxPropertyContract.getTenantId()); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); Map resultMap = new HashedMap(); List resultList = new ArrayList<>(); @@ -724,6 +725,11 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService wxBillProperty.setShopInfo(JSONObject.toJSONString(shopInfo)); } wxBillProperty.setLatePayRatio(0); + + //计算手续费 + BigDecimal servicePay = new BigDecimal(wxBillProperty.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); + wxBillProperty.setServiceChargePay(servicePay.intValue()); + resultList.add(wxBillProperty); } //批量生成预账单 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 85de7d0b8..3e4c8a263 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -109,6 +109,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxPropertyContractService wxPropertyContractService; + @Autowired + WxPayAccountBillService wxPayAccountBillService; + @Override public Map listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { //Object rentContractStatusInfo = getRentContractStatusInfo(record); @@ -1213,6 +1216,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { public Map buildRent(int receivePeriod, long[] priceArrs, List yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) { + WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxRentContract.getTenantId()); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); Map resultMap = new HashedMap(); List resultList = new ArrayList<>(); @@ -1253,7 +1257,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { index++; //如果是计算账单金额&cross 拆分日期进行计算 - if(!saveDb && billTimeVo.getEndDate().after(endDate)) { + if(billTimeVo.getEndDate().after(endDate)) { long needpayFront = 0; long needpayAfter = 0; //同一天,算一天 @@ -1320,6 +1324,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxBillRent.setPeriod(++billcount); wxBillRent.setShopInfo(shopInfoStr); wxBillRent.setLatePayRatio(0); + + //计算手续费 + BigDecimal servicePay = new BigDecimal(wxBillRent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); + wxBillRent.setServiceChargePay(servicePay.intValue()); resultList.add(wxBillRent); } diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index a5d762dcb..252d5ec49 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -196,7 +196,7 @@ expired_day, tenant_id, owe, 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) + pay_way, late_pay_status, comments,service_charge_pay) VALUES ( @@ -204,7 +204,7 @@ #{item.expiredDay},#{item.tenantId},#{item.owe},#{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.payWay},#{item.latePayStatus},#{item.comments},#{item.serviceChargePay} ) diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index a7acc2256..37cbba659 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -202,7 +202,7 @@ expired_day, tenant_id, owe, 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) + pay_way, late_pay_status, comments,service_charge_pay) VALUES ( @@ -210,7 +210,7 @@ #{item.expiredDay},#{item.tenantId},#{item.owe},#{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.payWay},#{item.latePayStatus},#{item.comments},#{item.serviceChargePay} )