@@ -19,6 +19,7 @@ import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.*;
import com.iformall.mapper.*;
import com.iformall.service.*;
import com.iformall.service.*;
import com.iformall.service.helper.WxRentContractHelper;
import com.iformall.utils.*;
import com.iformall.utils.*;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.compress.utils.Lists;
@@ -1016,269 +1017,17 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return rentList;
return rentList;
}
}
//计算租金,每年-每个店铺租金
public List<long[]> computePrice(String rentInfo, WxRentContract wxRentContract) {
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int arraySize = rentInfoArray.size();
List<long[]> priceList = new ArrayList<>();
//第一年
long[] priceArr = new long[arraySize];
for (int i = 0; i < arraySize; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
String priceStr = rentInfoObject.getString("price");
if (priceStr == null || priceStr.equalsIgnoreCase("NaN")) {
priceStr = "0";
}
priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(100)).longValue();
}
priceList.add(priceArr); //每个店铺每月租金
//大于一年
JSONObject rentInfoObject = rentInfoArray.getJSONObject(0);
JSONArray adjustRatio = rentInfoObject.getJSONArray("adjustRatio");//[100,200]
int adjustRatioSize = adjustRatio.size();
//判断年租金调整方式
if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) {
for (int i = 0; i < adjustRatioSize; i++) {
long[] priceArrs = new long[arraySize];
for (int j = 0; j < arraySize; j++) {
rentInfoObject = rentInfoArray.getJSONObject(j);
adjustRatio = rentInfoObject.getJSONArray("adjustRatio");
BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100)));
BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply);
priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
priceList.add(priceArrs);
}
return priceList;
}
if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) {
for (int i = 0; i < adjustRatioSize; i++) {
long[] priceArrs = new long[arraySize];
for (int j = 0; j < arraySize; j++) {
rentInfoObject = rentInfoArray.getJSONObject(j);
adjustRatio = rentInfoObject.getJSONArray("adjustRatio");
BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100)));
priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
priceList.add(priceArrs);
}
return priceList;
}
if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())) {
for (int i = 0; i < adjustRatioSize; i++) {
long[] priceArrs = new long[arraySize];
for (int j = 0; j < arraySize; j++) {
rentInfoObject = rentInfoArray.getJSONObject(j);
adjustRatio = rentInfoObject.getJSONArray("adjustRatio");
BigDecimal price = new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100));
priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
priceList.add(priceArrs);
}
}
if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())) {
for (int i = 0; i < adjustRatioSize; i++) {
long[] priceArrs = new long[arraySize];
for (int j = 0; j < arraySize; j++) {
rentInfoObject = rentInfoArray.getJSONObject(j);
adjustRatio = rentInfoObject.getJSONArray("adjustRatio");
BigDecimal price = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100)));
priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
priceList.add(priceArrs);
}
}
return priceList;
}
public List<WxBillRent> buildRentMonth(Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Long price, Integer isPreview, boolean saveDb) {
public List<WxBillRent> buildRentMonth(Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Long price, Integer isPreview, boolean saveDb) {
int size = 0;
int size = 0;
long[] priceArrs = null;
List<Map<String, Object>> shopInfos = new ArrayList<>();
if (//wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) &&
wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode()) &&
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode()) &&
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_COUNT.getCode())) {
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
List<long[]> priceList = computePrice(rentInfo, wxRentContract);
size = priceList.size();
priceArrs = new long[size];
for (int i = 0; i < size; i++) {
long[] priceInt = priceList.get(i);
long sum = 0;
for (long p : priceInt) {
sum += p;
}
priceArrs[i] = sum;
}
for (int i = 0; i < size; i++) {
Map<String, Object> shopInfo = new HashMap<>();
long[] ints = priceList.get(i);
for (int j = 0; j < ints.length; j++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(j);
String s = new BigDecimal(ints[j]).divide(new BigDecimal(100)).toPlainString();
shopInfo.put(rentInfoObject.getString("shopNumber"), s);
}
shopInfos.add(shopInfo);
}
} else {
String adjustRatio = wxRentContract.getAdjustRatio();
List<Integer> integers = JSONArray.parseArray(adjustRatio, Integer.class);
integers.add(0, 0);
size = integers.size();
priceArrs = new long[size];
priceArrs[0] = price;
BigDecimal priceD = new BigDecimal(price);
//联营保底营业额。
String revenueYear = wxRentContract.getRevenueYear();
List<Long> revenueYears = null;
if (!StringUtils.isBlank(revenueYear)) {
revenueYears = JSONArray.parseArray(revenueYear, Long.class);
}else {
revenueYears = new ArrayList<Long>();
}
revenueYears.add(0,0L);
//联营面积取高时,联营扣点调整比率设置
long[] revenuePriceArrs = new long[size];
if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) {
long _revenuePriceD = wxRentContract.getRevenue()*wxRentContract.getPayRatio()/10000;
revenuePriceArrs[0] = _revenuePriceD;
BigDecimal revenuePriceD = new BigDecimal(_revenuePriceD);
//联营扣点调整比率
String revenueRationSet = wxRentContract.getRevenueRatioSet();
List<Long> revenueRationSets = null;
if (!StringUtils.isBlank(revenueRationSet)) {
revenueRationSets = JSONArray.parseArray(revenueRationSet, Long.class);
}else {
revenueRationSets = new ArrayList<Long>();
}
revenueRationSets.add(0,0L);
if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) {
for (int i = 1; i < size; i++) {
//联营扣点算法
if (revenueYears.size() == size && revenueRationSets.size() == size) {
BigDecimal _p = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(revenueRationSets.get(i))).divide(new BigDecimal(10000));
revenuePriceD = revenuePriceD.add(_p);
}
revenuePriceArrs[i] = revenuePriceD.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
} else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) {
for (int i = 1; i < size; i++) {
if (revenueYears.size() == size && revenueRationSets.size() == size) {
revenuePriceD = revenuePriceD.add(new BigDecimal(revenueRationSets.get(i)));
}
revenuePriceArrs[i] = revenuePriceD.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
} else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){
for (int i = 1; i < size; i++) {
if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) {
revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue();
continue;
}
if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue();
continue;
}
}
revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).setScale(0, RoundingMode.HALF_EVEN).longValue();
}
}else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){
for (int i = 1; i < size; i++) {
BigDecimal _p = new BigDecimal(0) ;
if (revenueYears.size() == size && revenueRationSets.size() == size) {
_p = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(revenueYears.get(i))).divide(new BigDecimal(10000));
}
if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) {
revenuePriceArrs[i] = _p.multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue();
continue;
}
if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
revenuePriceArrs[i] = _p.multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue();
continue;
}
}
revenuePriceArrs[i] = _p.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
}
}
if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) {
for (int i = 1; i < size; i++) {
BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000));
priceD = priceD.add(divide);
priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
} else if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) {
for (int i = 1; i < size; i++) {
priceD = priceD.add(new BigDecimal(integers.get(i)));
priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
} else if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){
for (int i = 1; i < size; i++) {
if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) {
priceArrs[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue();
continue;
}
if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
priceArrs[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue();
continue;
}
}
priceArrs[i] = new BigDecimal(integers.get(i)).setScale(0, RoundingMode.HALF_EVEN).longValue();
}
}else if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){
for (int i = 1; i < size; i++) {
BigDecimal _p = null;
//联营扣点才乘保底营业额
if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode()) && revenueYears.size() == size) {
_p = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000));
}else {
_p = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000));
}
if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) {
priceArrs[i] = _p.multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue();
continue;
}
if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
priceArrs[i] = _p.multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue();
continue;
}
}
priceArrs[i] = _p.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
}
//租金和联营取高
if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) {
for (int i = 0 ; i < priceArrs.length; i ++) {
if (priceArrs[i] < revenuePriceArrs[i]) {
priceArrs[i] = revenuePriceArrs[i];
}
}
}
}
//计算租金每年的计费基数
long[] priceArrs = WxRentContractHelper.calcuteRentPrice(wxRentContract);
//计算商业管理费
long[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(wxRentContract);
//计算运营管理费
long[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(wxRentContract);
int month = 12;
int month = 12;
// int divide = lease / month;
// int mod = lease % month;
// int[] leaseArr = new int[size];
// for (int i = 0; i < divide; i++) {
// leaseArr[i] = month;
// }
// if (mod > 0) {
// leaseArr[divide] = mod;
// }
int billcount = 0;
int billcount = 0;
List<WxBillRent> resultList = new ArrayList<>();
List<WxBillRent> resultList = new ArrayList<>();
@@ -1304,7 +1053,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
String shopInfoStr = getShopInfoStr(wxRentContract);
String shopInfoStr = getShopInfoStr(wxRentContract);
Map<String, Object> resultMap = buildRent(receivePeriod, priceArrs, yearList, Calendar.MONTH, wxRentContract, userId, billcount, isPreview, shopInfoStr,saveDb);
Map<String, Object> resultMap = buildRent(receivePeriod, priceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs, yearList, Calendar.MONTH, wxRentContract, userId, billcount, isPreview, shopInfoStr,saveDb);
List<WxBillRent> billRentList = (List<WxBillRent>)resultMap.get("billList");
List<WxBillRent> billRentList = (List<WxBillRent>)resultMap.get("billList");
resultList.addAll(billRentList);
resultList.addAll(billRentList);
return resultList;
return resultList;
@@ -1404,7 +1153,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
String shopInfoStr = getShopInfoStr(wxRentContract);
String shopInfoStr = getShopInfoStr(wxRentContract);
Map<String, Object> resultMap = buildRent(receivePeriod, priceArrs, yearList, Calendar.MONTH, wxRentContract, userId, billcount, isPreview, shopInfoStr,saveDb);
Map<String, Object> resultMap = buildRent(receivePeriod, priceArrs,null,null, yearList, Calendar.MONTH, wxRentContract, userId, billcount, isPreview, shopInfoStr,saveDb);
List<WxBillRent> billRentList = (List<WxBillRent>)resultMap.get("billList");
List<WxBillRent> billRentList = (List<WxBillRent>)resultMap.get("billList");
resultList.addAll(billRentList);
resultList.addAll(billRentList);
return resultList;
return resultList;
@@ -1437,7 +1186,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
if(wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())){
if(wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())){
String rentInfo = wxRentContract.getRentInfo();
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
long[] priceList = computePrice(rentInfo, wxRentContract).get(0);
long[] priceList = WxRentContractHelper. computePrice(rentInfo, wxRentContract).get(0);
long sum = Arrays.stream(priceList).sum();
long sum = Arrays.stream(priceList).sum();
int size = rentInfoArray.size();
int size = rentInfoArray.size();
for (int i = 0;i < size;i++) {
for (int i = 0;i < size;i++) {
@@ -1548,7 +1297,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return calendar.getTime();
return calendar.getTime();
}
}
public Map<String, Object> buildRent(int receivePeriod, long[] priceArrs, List<Date> yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) {
public Map<String, Object> buildRent(int receivePeriod, long[] priceArrs,long[] bussinessManagerPriceArrs,long[] operationManagerPriceArrs, List<Date> yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) {
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract);
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
Map<String,Object> resultMap = new HashedMap();
Map<String,Object> resultMap = new HashedMap();
@@ -1581,6 +1330,10 @@ public class WxRentContractServiceImpl implements WxRentContractService {
long needpay = 0;
long needpay = 0;
boolean flag = false;
boolean flag = false;
Long bmpricePre = null;
Long bmPrce = null;
Long ompricePre = null;
Long omPrce = null;
//此处逻辑处理这一年和下一年交接那一期账单。
//此处逻辑处理这一年和下一年交接那一期账单。
if(yearList.size() > 1) {
if(yearList.size() > 1) {
if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) {
if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) {
@@ -1589,32 +1342,37 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate));
//logger.info("=====billTimeVo.getStartDate():"+sd.format(billTimeVo.getStartDate())+" endDate:"+sd.format(endDate));
index++;
index++;
if (null != bussinessManagerPriceArrs && null != operationManagerPriceArrs) {
bmpricePre = bussinessManagerPriceArrs[index-1];
bmPrce = bussinessManagerPriceArrs[index];
ompricePre = operationManagerPriceArrs[index-1];
omPrce = operationManagerPriceArrs[index];
}
//如果是计算账单金额&cross 拆分日期进行计算
//如果是计算账单金额&cross 拆分日期进行计算
if(billTimeVo.getEndDate().after(endDate)) {
if(billTimeVo.getEndDate().after(endDate)) {
long needpayFront = 0;
long needpayFront = 0;
long needpayAfter = 0;
long needpayAfter = 0;
//同一天,算一天
//同一天,算一天
if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){
if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){
needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],bmpricePre,ompricePre ,billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
}else{
}else{
if(billTimeVo.getStartDate().before(endDate)){
if(billTimeVo.getStartDate().before(endDate)){
if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType()) && EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType()) && EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) {
//设置跳点率为年周期 price不变
//设置跳点率为年周期 price不变
needpayFront = priceArrs[index - 1];
needpayFront = priceArrs[index - 1];
}else {
}else {
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,false);
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);
}
}
}else{
}else{
//如果是按自然月,则这一年和下一年交叉部分需要重新计算
//如果是按自然月,则这一年和下一年交叉部分需要重新计算
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) {
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) {
Date currentYearRentDate = getCurrentYearRentDate(endDate,wxRentContract.getRentalStartDate());
Date currentYearRentDate = getCurrentYearRentDate(endDate,wxRentContract.getRentalStartDate());
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], endDate, DateUtils.getDaySet(currentYearRentDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], currentYearRentDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true,true);
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);
}else {
}else {
//按账单日
//按账单日
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false,false);
needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index],bmPrce,omPrce, billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false,false);
}
}
}
}
}
}
@@ -1634,7 +1392,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//计算金额
//计算金额
if(!flag){
if(!flag){
needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
needpay = getNeedPayMoney(wxRentContract, priceArrs[index],bmPrce,omPrce, billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod,false,false);
}
}
WxBillRent wxBillRent = new WxBillRent();
WxBillRent wxBillRent = new WxBillRent();
@@ -1645,7 +1403,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillRent.setStarttime(billTimeVo.getStartDate());
wxBillRent.setStarttime(billTimeVo.getStartDate());
wxBillRent.setEndtime(billTimeVo.getEndDate());
wxBillRent.setEndtime(billTimeVo.getEndDate());
wxBillRent.setReceiveDate(billTimeVo.getReceiveDate());
wxBillRent.setReceiveDate(billTimeVo.getReceiveDate());
```11111111
wxBillRent.setContractNeedPay(needpay);
wxBillRent.setContractNeedPay(needpay);
wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,needpay));
wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,needpay));
wxBillRent.setNeedPay(needpay);
wxBillRent.setNeedPay(needpay);
@@ -1687,7 +1445,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return resultMap;
return resultMap;
}
}
public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod,boolean part,boolean monthCalDay){
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;
long needpay;
//按日
//按日
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){
@@ -2901,7 +2659,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
adjustRatioList.add(adjustRatioStr.toString());
adjustRatioList.add(adjustRatioStr.toString());
}
}
List<long[]> priceList = computePrice(rentInfo, wxRentContract);
List<long[]> priceList = WxRentContractHelper. computePrice(rentInfo, wxRentContract);
int size = priceList.size();
int size = priceList.size();
priceArrs = new long[size];
priceArrs = new long[size];
for (int i = 0; i < size; i++) {
for (int i = 0; i < size; i++) {