|
|
|
@@ -1054,9 +1054,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
int size = 0; |
|
|
|
long[] priceArrs = null; |
|
|
|
List<Map<String, Object>> shopInfos = new ArrayList<>(); |
|
|
|
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) && |
|
|
|
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_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); |
|
|
|
@@ -1175,6 +1176,92 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
return shopInfoStr; |
|
|
|
} |
|
|
|
|
|
|
|
private String getRentPriceInfo(WxRentContract wxRentContract, long contractNeedPay){ |
|
|
|
long rentPrice = 0l, siteMoney = 0l, facilityMoney = 0l, administratorMoney = 0l; |
|
|
|
if(!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode()) && |
|
|
|
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_COUNT.getCode())){ |
|
|
|
if(wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())){ |
|
|
|
String rentInfo = wxRentContract.getRentInfo(); |
|
|
|
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); |
|
|
|
long[] priceList = computePrice(rentInfo, wxRentContract).get(0); |
|
|
|
long sum = Arrays.stream(priceList).sum(); |
|
|
|
int size = rentInfoArray.size(); |
|
|
|
for (int i = 0;i < size;) { |
|
|
|
BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0); |
|
|
|
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); |
|
|
|
|
|
|
|
String rentPrice1 = rentInfoObject.getString("rentPrice"); |
|
|
|
if(StringUtils.isNotBlank(rentPrice1)){ |
|
|
|
a = new BigDecimal(rentPrice1); |
|
|
|
} |
|
|
|
JSONObject otherRentPriceInfo = rentInfoObject.getJSONObject("otherRentPriceInfo"); |
|
|
|
if(otherRentPriceInfo != null ){ |
|
|
|
String siteMoney1 = otherRentPriceInfo.getString("siteMoney"); |
|
|
|
if(StringUtils.isNotBlank(siteMoney1)){ |
|
|
|
b = new BigDecimal(siteMoney1); |
|
|
|
} |
|
|
|
String facilityMoney1 = otherRentPriceInfo.getString("facilityMoney"); |
|
|
|
if(StringUtils.isNotBlank(facilityMoney1)){ |
|
|
|
c = new BigDecimal(facilityMoney1); |
|
|
|
} |
|
|
|
String administratorMoney1 = otherRentPriceInfo.getString("administratorMoney"); |
|
|
|
if(StringUtils.isNotBlank(administratorMoney1)){ |
|
|
|
d = new BigDecimal(administratorMoney1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
rentPrice += new BigDecimal(contractNeedPay).multiply(new BigDecimal(priceList[i])).divide(new BigDecimal(sum)) |
|
|
|
.multiply(a).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue(); |
|
|
|
siteMoney += new BigDecimal(contractNeedPay).multiply(new BigDecimal(priceList[i])).divide(new BigDecimal(sum)) |
|
|
|
.multiply(b).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue(); |
|
|
|
facilityMoney += new BigDecimal(contractNeedPay).multiply(new BigDecimal(priceList[i])).divide(new BigDecimal(sum)) |
|
|
|
.multiply(c).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue(); |
|
|
|
administratorMoney += new BigDecimal(contractNeedPay).multiply(new BigDecimal(priceList[i])).divide(new BigDecimal(sum)) |
|
|
|
.multiply(d).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0); |
|
|
|
String rentPrice1 = wxRentContract.getRentPrice(); |
|
|
|
if(StringUtils.isNotBlank(rentPrice1)){ |
|
|
|
a = new BigDecimal(rentPrice1).divide(new BigDecimal(100)); |
|
|
|
} |
|
|
|
String otherRentPriceInfo1 = wxRentContract.getOtherRentPriceInfo(); |
|
|
|
if(StringUtils.isNotBlank(otherRentPriceInfo1)){ |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(otherRentPriceInfo1); |
|
|
|
String siteMoney1 = jsonObject.getString("siteMoney"); |
|
|
|
if(StringUtils.isNotBlank(siteMoney1)){ |
|
|
|
b = new BigDecimal(siteMoney1); |
|
|
|
} |
|
|
|
String facilityMoney1 = jsonObject.getString("facilityMoney"); |
|
|
|
if(StringUtils.isNotBlank(facilityMoney1)){ |
|
|
|
c = new BigDecimal(facilityMoney1); |
|
|
|
} |
|
|
|
String administratorMoney1 = jsonObject.getString("administratorMoney"); |
|
|
|
if(StringUtils.isNotBlank(administratorMoney1)){ |
|
|
|
d = new BigDecimal(administratorMoney1); |
|
|
|
} |
|
|
|
} |
|
|
|
rentPrice = new BigDecimal(contractNeedPay).multiply(a).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue(); |
|
|
|
siteMoney = new BigDecimal(contractNeedPay).multiply(b).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue(); |
|
|
|
facilityMoney = new BigDecimal(contractNeedPay).multiply(c).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue(); |
|
|
|
administratorMoney = new BigDecimal(contractNeedPay).multiply(d).divide(a.add(b).add(c).add(d)).setScale(0,BigDecimal.ROUND_HALF_UP).longValue(); |
|
|
|
|
|
|
|
} |
|
|
|
}else{ |
|
|
|
rentPrice = contractNeedPay; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Map<String,String> resultMap = new HashedMap(); |
|
|
|
resultMap.put("rentPrice",new BigDecimal(rentPrice).divide(new BigDecimal(100)).toString()); |
|
|
|
resultMap.put("siteMoney",new BigDecimal(siteMoney).divide(new BigDecimal(100)).toString()); |
|
|
|
resultMap.put("facilityMoney",new BigDecimal(facilityMoney).divide(new BigDecimal(100)).toString()); |
|
|
|
resultMap.put("administratorMoney",new BigDecimal(administratorMoney).divide(new BigDecimal(100)).toString()); |
|
|
|
return resultMap.toString(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract); |
|
|
|
@@ -1265,6 +1352,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
wxBillRent.setEndtime(billTimeVo.getEndDate()); |
|
|
|
wxBillRent.setReceiveDate(billTimeVo.getReceiveDate()); |
|
|
|
|
|
|
|
wxBillRent.setContractNeedPay(needpay); |
|
|
|
wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,needpay)); |
|
|
|
wxBillRent.setNeedPay(needpay); |
|
|
|
wxBillRent.setOwe(needpay); |
|
|
|
wxBillRent.setReceivePay(needpay); |
|
|
|
|