zhengfangyuan 3 лет назад
Родитель
Сommit
17b13156e6
5 измененных файлов: 185 добавлений и 124 удалений
  1. +6
    -0
      mallinkAdmin/src/main/resources/db/migration/V202301200001__contract.sql
  2. +6
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java
  3. +103
    -0
      mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java
  4. +63
    -119
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  5. +7
    -5
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml

+ 6
- 0
mallinkAdmin/src/main/resources/db/migration/V202301200001__contract.sql Просмотреть файл

@@ -35,3 +35,9 @@ ALTER TABLE `mallink`.`wx_rent_contract`
ADD COLUMN `operating_management_fee_ratio` JSON COMMENT '营业管理费调整比率' ;


ALTER TABLE `mallink`.`wx_bill_rent`
ADD COLUMN `bussiness_manage_fee_need_pay` bigint(12) COMMENT '商业管理费应收' AFTER `need_pay`;

ALTER TABLE `mallink`.`wx_bill_rent`
ADD COLUMN `operating_manage_fee_need_pay` bigint(12) COMMENT '营业管理费应收' AFTER `need_pay`;


+ 6
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java Просмотреть файл

@@ -130,6 +130,12 @@ public class WxBillRent extends TenantEntity {

@io.swagger.annotations.ApiModelProperty(value="应收金额",name="needPay")
private Long needPay;
@io.swagger.annotations.ApiModelProperty(value="商业管理费应收金额",name="bussinessManageFeeNeedPay")
private Long bussinessManageFeeNeedPay;
@io.swagger.annotations.ApiModelProperty(value="运营管理费应收金额",name="operatingManageFeeNeedPay")
private Long operatingManageFeeNeedPay;

@io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId")
private Long merchantId;


+ 103
- 0
mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java Просмотреть файл

@@ -20,6 +20,8 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.iformall.domain.po.WxRentContract;
import com.iformall.enums.EnumMissTimeType;
import com.iformall.enums.EnumPriceUnit;
import com.iformall.enums.EnumRentContractAdjustPeriod;
import com.iformall.enums.EnumRentContractAdjustRatioWay;
import com.iformall.enums.EnumRentContractRentInputWay;
import com.iformall.enums.EnumRentContractType;
@@ -361,6 +363,107 @@ public class WxRentContractHelper {
return priceList;
}
//查询月账单需要支付的金额
public static long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod,boolean part,boolean monthCalDay){
long needpay;
//按日
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){
Double priceD = new Double(price);
double needpayD = WxRentContractHelper.getNeedPay(0,priceD,startDate,endDate);
//取整
//needpay = new Double(needpayD).longValue();
//四舍五入
needpay = new BigDecimal(needpayD).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}else{
Double priceD = new Double(price);
if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType())) {
//设置跳点率为年周期 price不变
if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
return priceD.longValue();
}
//年或者设置跳点率为年周期 除12
if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) {
priceD = new Double(price) / 12;
}
}else{
//年 除12
if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){
priceD = new Double(price)/12;
}
}


//生成金额直接计算
if(!saveDb){
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
return needpay;
}

SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM");
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");

if(i == billTimeVoListSize - 1){//最后
//判断是否满足整月
Calendar instance = Calendar.getInstance();
instance.setTime(startDate);
instance.add(dayType, receivePeriod);
instance.add(Calendar.DATE, -1);
if(sd.format(instance.getTime()).equals(sd.format(endDate))){
int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(DateUtils.getDaySet(endDate,Calendar.DATE,1))+"-01");
needpay = new Double(months * priceD).longValue();
}else{
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}else if(i == 0){//第一期
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){
if(isFirstDay(startDate)){
int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
months++;
needpay = new Double(months * priceD).longValue();
}else{
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}else{
if(isFirstDay(startDate)){
int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
if(isFirstDay(startDate)){
months++;
}
needpay = new Double(months * priceD).longValue();
}else{
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}
}else{//中间
int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
if(isFirstDay(startDate)){
months++;
}
//如果当月费用需要按天计算
if (monthCalDay) {
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}else {
needpay = new Double(months * priceD).longValue();
}
}
}
return needpay;
}
private static boolean isFirstDay(Date date){
int dateInt = Integer.parseInt(new SimpleDateFormat("d").format(date));
if(dateInt == 1){
return true;
}
return false;
}
/**
* 按月计租 根据每月的日期总数计算needpay
* @param monthPrice


+ 63
- 119
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -619,6 +619,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
bill.setCreatetime(date);
bill.updateTenantInfo(record);
bill.setNeedPay(bill.getNeedPay());
bill.setBussinessManageFeeNeedPay(bill.getBussinessManageFeeNeedPay());
bill.setOperatingManageFeeNeedPay(bill.getOperatingManageFeeNeedPay());
bill.setUpdatetime(date);
bill.setRentShopType(record.getRentShopType());
bill.setPeriod(count);
@@ -1328,12 +1330,12 @@ public class WxRentContractServiceImpl implements WxRentContractService {
BillTimeVo billTimeVo = billTimeVoList.get(i);
//计算金额
long needpay = 0;
//商业管理费
long bussinessManageFeeNeedpay = 0;
//营业管理费
long operatingManageFeeNeedpay = 0;

boolean flag = false;
long bmpricePre = 0;
long bmPrce = 0;
long ompricePre = 0;
long omPrce = 0;
//此处逻辑处理这一年和下一年交接那一期账单。
if(yearList.size() > 1) {
if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) {
@@ -1342,41 +1344,80 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate));

index++;
if (null != bussinessManagerPriceArrs && null != operationManagerPriceArrs) {
bmpricePre = bussinessManagerPriceArrs[index-1];
bmPrce = bussinessManagerPriceArrs[index];
ompricePre = operationManagerPriceArrs[index-1];
omPrce = operationManagerPriceArrs[index];
}
//如果是计算账单金额&cross 拆分日期进行计算
if(billTimeVo.getEndDate().after(endDate)) {
long needpayFront = 0;
long needpayAfter = 0;
//商业管理费
long bussinessManageFeeNeedpayFront = 0;
long bussinessManageFeeNeedpayAfter = 0;
//营业管理费
long operatingManageFeeNeedpayFront = 0;
long operatingManageFeeNeedpayAfter = 0;
//同一天,算一天
if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){
needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],bmpricePre,ompricePre,billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
needpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) {
bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract,bussinessManagerPriceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
}
if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) {
operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract,operationManagerPriceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
}
}else{
if(billTimeVo.getStartDate().before(endDate)){
if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType()) && EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
//设置跳点率为年周期 price不变
needpayFront = priceArrs[index - 1];
if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) {
bussinessManageFeeNeedpayFront = bussinessManagerPriceArrs[index - 1];
}
if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) {
operatingManageFeeNeedpayFront = operationManagerPriceArrs[index - 1];
}
}else {
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1],bmpricePre,ompricePre, billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index],bmPrce,omPrce, endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
needpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
needpayAfter = WxRentContractHelper.getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) {
bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract, bussinessManagerPriceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
bussinessManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(wxRentContract, bussinessManagerPriceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
}
if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) {
operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract, operationManagerPriceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
operatingManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(wxRentContract, operationManagerPriceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
}
}
}else{
//如果是按自然月,则这一年和下一年交叉部分需要重新计算
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) {
Date currentYearRentDate = getCurrentYearRentDate(endDate,wxRentContract.getRentalStartDate());
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1],bmpricePre,ompricePre, endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index],bmPrce,omPrce, currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
needpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract, priceArrs[index - 1],endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
needpayAfter = WxRentContractHelper.getNeedPayMoney(wxRentContract, priceArrs[index],currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) {
bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract, bussinessManagerPriceArrs[index - 1],endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
bussinessManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(wxRentContract, bussinessManagerPriceArrs[index],currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
}
if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) {
operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract, operationManagerPriceArrs[index - 1],endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
operatingManageFeeNeedpayAfter = WxRentContractHelper.getNeedPayMoney(wxRentContract, operationManagerPriceArrs[index],currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
}
}else {
//按账单日
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index],bmPrce,omPrce, billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false,false);
needpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false,false);
if (null != bussinessManagerPriceArrs && bussinessManagerPriceArrs.length > 0) {
bussinessManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract, bussinessManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false,false);
}
if (null != operationManagerPriceArrs && operationManagerPriceArrs.length > 0) {
operatingManageFeeNeedpayFront = WxRentContractHelper.getNeedPayMoney(wxRentContract, operationManagerPriceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false,false);
}
}
}
}
needpay = needpayFront+needpayAfter;
bussinessManageFeeNeedpay = bussinessManageFeeNeedpayFront + bussinessManageFeeNeedpayAfter;
operatingManageFeeNeedpay = operatingManageFeeNeedpayFront + operatingManageFeeNeedpayAfter;
flag = true;
}
if(index >= yearList.size()-1){
@@ -1392,7 +1433,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {

//计算金额
if(!flag){
needpay = getNeedPayMoney(wxRentContract, priceArrs[index],bmPrce,omPrce, billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
needpay = WxRentContractHelper.getNeedPayMoney(wxRentContract, priceArrs[index],billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
}

WxBillRent wxBillRent = new WxBillRent();
@@ -1408,8 +1449,11 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,needpay));
wxBillRent.setNeedPay(needpay);
wxBillRent.setOwe(needpay);
wxBillRent.setReceivePay(needpay);

wxBillRent.setReceivePay(bussinessManageFeeNeedpay+operatingManageFeeNeedpay+needpay);
//商业管理费
wxBillRent.setBussinessManageFeeNeedPay(bussinessManageFeeNeedpay);
//运营管理费
wxBillRent.setOperatingManageFeeNeedPay(operatingManageFeeNeedpay);
//截止收租日在当前时间之前
Date date = new Date();
setExpiredDay(wxBillRent,dayType,receivePeriod);
@@ -1445,97 +1489,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return resultMap;
}

public long getNeedPayMoney(WxRentContract wxRentContract,long price,long bussinessManageFee,long operatingManageFee,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod,boolean part,boolean monthCalDay){
long needpay;
//按日
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){
Double priceD = new Double(price);
double needpayD = WxRentContractHelper.getNeedPay(0,priceD,startDate,endDate);
//取整
//needpay = new Double(needpayD).longValue();
//四舍五入
needpay = new BigDecimal(needpayD).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}else{
Double priceD = new Double(price);
if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType())) {
//设置跳点率为年周期 price不变
if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
return priceD.longValue();
}
//年或者设置跳点率为年周期 除12
if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) {
priceD = new Double(price) / 12;
}
}else{
//年 除12
if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){
priceD = new Double(price)/12;
}
}


//生成金额直接计算
if(!saveDb){
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).longValue();
needpay = new BigDecimal(WxRentContractHelper.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
return needpay;
}

SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM");
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");

if(i == billTimeVoListSize - 1){//最后
//判断是否满足整月
Calendar instance = Calendar.getInstance();
instance.setTime(startDate);
instance.add(dayType, receivePeriod);
instance.add(Calendar.DATE, -1);
if(sd.format(instance.getTime()).equals(sd.format(endDate))){
int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(DateUtils.getDaySet(endDate,Calendar.DATE,1))+"-01");
needpay = new Double(months * priceD).longValue();
}else{
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(WxRentContractHelper.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}else if(i == 0){//第一期
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){
if(isFirstDay(startDate)){
int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
months++;
needpay = new Double(months * priceD).longValue();
}else{
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(WxRentContractHelper.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}else{
if(isFirstDay(startDate)){
int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
if(isFirstDay(startDate)){
months++;
}
needpay = new Double(months * priceD).longValue();
}else{
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(WxRentContractHelper.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}
}
}else{//中间
int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
if(isFirstDay(startDate)){
months++;
}
//如果当月费用需要按天计算
if (monthCalDay) {
//needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue();
needpay = new BigDecimal(WxRentContractHelper.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
}else {
needpay = new Double(months * priceD).longValue();
}
}
}
return needpay;
}
public void setExpiredDay(WxBillRent wxBillRent,int dayType, int receivePeriod){
//截止收租日在当前时间之前
Date date = new Date();
@@ -1559,15 +1512,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}

public boolean isFirstDay(Date date){
int dateInt = Integer.parseInt(new SimpleDateFormat("d").format(date));
if(dateInt == 1){
return true;
}
return false;
}


@Transactional(rollbackFor = {Exception.class})
@Override
public ResultData deleteById(String id) {


+ 7
- 5
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml Просмотреть файл

@@ -21,6 +21,8 @@
<result column="contract_need_pay" jdbcType="BIGINT" property="contractNeedPay"/>
<result column="rent_price_info" jdbcType="VARCHAR" property="rentPriceInfo"/>
<result column="need_pay" jdbcType="BIGINT" property="needPay"/>
<result column="bussiness_manage_fee_need_pay" jdbcType="BIGINT" property="bussinessManageFeeNeedPay"/>
<result column="operating_manage_fee_need_pay" jdbcType="BIGINT" property="operatingManageFeeNeedPay"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="shop_id" jdbcType="BIGINT" property="shopId"/>
@@ -58,7 +60,7 @@

<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,
`createtime`,`expired_day`,`owe`,`status`,`is_del`,`contract_need_pay`,`rent_price_info`,`need_pay`,
`createtime`,`expired_day`,`owe`,`status`,`is_del`,`contract_need_pay`,`rent_price_info`,`need_pay`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,
`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,bus_discount_ratio,freeze,join_rent_price,service_charge_pay
@@ -112,8 +114,8 @@

<select id="queryBillRentList" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap">
select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,
case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`contract_need_pay`,br.`rent_price_info`,br.`need_pay`,r.merchant_name,
br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,
case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`contract_need_pay`,br.`rent_price_info`,br.`need_pay`,br.`bussiness_manage_fee_need_pay`,br.`operating_manage_fee_need_pay`,
r.merchant_name,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,
r.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`,
d.receive_pay deposit,d.`status`
deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime,
@@ -273,7 +275,7 @@
<insert id="insertBills" parameterType="java.util.List">
INSERT INTO wx_bill_rent (id,tenant_id,parent_tenant_id,
rent_contract_id, receive_pay, pay, receive_date, pay_date, createtime, expired_day,
owe, status, is_del, contract_need_pay,rent_price_info,need_pay, merchant_id, user_id, shop_id, updatetime, starttime, endtime,
owe, status, is_del, contract_need_pay,rent_price_info,need_pay,bussiness_manage_fee_need_pay,operating_manage_fee_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)
VALUES
@@ -281,7 +283,7 @@
(
#{item.id},#{item.tenantId},#{item.parentTenantId},
#{item.rentContractId},#{item.receivePay},#{item.pay},#{item.receiveDate},#{item.payDate},#{item.createtime},
#{item.expiredDay},#{item.owe},#{item.status},#{item.isDel},#{item.contractNeedPay},#{item.rentPriceInfo},#{item.needPay},#{item.merchantId},
#{item.expiredDay},#{item.owe},#{item.status},#{item.isDel},#{item.contractNeedPay},#{item.rentPriceInfo},#{item.needPay},#{item.bussinessManageFeeNeedPay},#{item.operatingManageFeeNeedPay},#{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}


Загрузка…
Отмена
Сохранить