@@ -220,18 +220,18 @@ public class WxRentContractServiceImpl implements WxRentContractService {
BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred);
BigDecimal payRatio = new BigDecimal(record.getPayRatio() == null ? 0 : record.getPayRatio()).divide(new BigDecimal(10000));
BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);
record.setPrice(price.multiply(hundred).int Value());
record.setPrice(price.multiply(hundred).long Value());
} else {
if (StringUtils.isNotEmpty(record.getPriceStr())) {
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).int Value());
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).long Value());
} else {
record.setPrice(0);
record.setPrice(0L );
}
}
if (StringUtils.isNotEmpty(record.getDepositStr())) {
record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).int Value());
record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).long Value());
} else {
record.setDeposit(0);
record.setDeposit(0L );
}
Date date = new Date();
@@ -447,19 +447,19 @@ public class WxRentContractServiceImpl implements WxRentContractService {
BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred);
BigDecimal payRatio = new BigDecimal(record.getPayRatio() == null ? 0 : record.getPayRatio()).divide(new BigDecimal(10000));
BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);
record.setPrice(price.multiply(hundred).int Value());
record.setPrice(price.multiply(hundred).long Value());
} else {
if (StringUtils.isNotEmpty(record.getPriceStr())) {
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).int Value());
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).long Value());
} else {
record.setPrice(0);
record.setPrice(0L );
}
}
if (StringUtils.isNotEmpty(record.getDepositStr())) {
record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).int Value());
record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).long Value());
} else {
record.setDeposit(0);
record.setDeposit(0L );
}
record.setUpdatetime(new Date());
@@ -683,7 +683,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
int receivePeriod = wxRentContract.getReceivePeriod().intValue();
Integer lease = wxRentContract.getLease();
Date rentalStartDate = wxRentContract.getRentalStartDate();
Integer price = wxRentContract.getPrice();
Long price = wxRentContract.getPrice();
//按月计租
if (wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode())
||wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) {
@@ -701,16 +701,16 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
//计算租金,每年-每个店铺租金
public List<int []> computePrice(String rentInfo) {
public List<long []> computePrice(String rentInfo) {
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int arraySize = rentInfoArray.size();
List<int []> priceList = new ArrayList<>();
List<long []> priceList = new ArrayList<>();
//第一年
int[] priceArr = new int [arraySize];
long[] priceArr = new long [arraySize];
for (int i = 0; i < arraySize; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).int Value();
priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).long Value();
}
priceList.add(priceArr);
//大于一年
@@ -719,34 +719,34 @@ public class WxRentContractServiceImpl implements WxRentContractService {
int adjustRatioSize = adjustRatio.size();
for (int i = 0; i < adjustRatioSize; i++) {
int[] priceArrs = new int [arraySize];
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).int Value();
priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).long Value();
}
priceList.add(priceArrs);
}
return priceList;
}
public List<WxBillRent> buildRentMonth(WxMerchant wxMerchant, Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Integer price, Integer isPreview) {
public List<WxBillRent> buildRentMonth(WxMerchant wxMerchant, Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Long price, Integer isPreview) {
int size = 0;
int [] priceArrs = null;
long [] priceArrs = null;
List<Map<String, Object>> shopInfos = new ArrayList<>();
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) &&
!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
List<int []> priceList = computePrice(rentInfo);
List<long []> priceList = computePrice(rentInfo);
size = priceList.size();
priceArrs = new int [size];
priceArrs = new long [size];
for (int i = 0; i < size; i++) {
int [] priceInt = priceList.get(i);
int sum = 0;
for (int p : priceInt) {
long [] priceInt = priceList.get(i);
long sum = 0;
for (long p : priceInt) {
sum += p;
}
priceArrs[i] = sum;
@@ -754,7 +754,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
for (int i = 0; i < size; i++) {
Map<String, Object> shopInfo = new HashMap<>();
int [] ints = priceList.get(i);
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();
@@ -767,7 +767,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
List<Integer> integers = JSONArray.parseArray(adjustRatio, Integer.class);
integers.add(0, 0);
size = integers.size();
priceArrs = new int [size];
priceArrs = new long [size];
priceArrs[0] = price;
double priceD = price;
for (int i = 1; i < size; i++) {
@@ -822,7 +822,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return false;
}
public Map<String, Object> buildRent(int lease, int receivePeriod, int price, Date startdate, int dayType, WxRentContract wxRentContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview, Map<String, Object> shopInfo,boolean isLastYesr) {
public Map<String, Object> buildRent(int lease, int receivePeriod, long price, Date startdate, int dayType, WxRentContract wxRentContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview, Map<String, Object> shopInfo, boolean isLastYesr) {
System.out.println("------lease:"+lease+"receivePeriod:"+receivePeriod+"price:"+price+"start:"+DateUtils.date2String(startdate,"yyyy-MM-dd")
+"dayType:"+dayType+"billcount:"+billcount);
@@ -908,7 +908,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
instance.add(dayType, extralease);
instance.add(Calendar.DAY_OF_MONTH, -1);
wxBillRent.setEndtime(instance.getTime());
needpay = price * extralease ;
needpay = new BigDecimal(price).multiply(new BigDecimal(extralease)).longValue() ;
}
//自然月,开始日期、缴款日,结束日期
@@ -954,7 +954,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
DecimalFormat format = new DecimalFormat("0");
needpay = Integer.parseInt (format.format(needPayDouble)); //分做四舍五入
needpay = Long.parseLong (format.format(needPayDouble)); //分做四舍五入
}else if(i < paycount - 1){//中间周期
Date receiveDate = DateUtils.getFirstDayOfNextMonth(startdate,receivePeriod * i);
wxBillRent.setReceiveDate(receiveDate);
@@ -1784,7 +1784,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
public void areaWay(WxRentContract wxRentContract, Map<String, Object> result, Integer lease, int extralease, int extracount, int paycount, int index, int count, BigDecimal rentPrice) {
int[] priceArrs = new int []{};
long[] priceArrs = new long []{};
List<String> adjustRatioList = new ArrayList<>();
adjustRatioList.add(0, "0");
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
@@ -1802,13 +1802,13 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
adjustRatioList.add(adjustRatioStr.toString());
}
List<int []> priceList = computePrice(rentInfo);
List<long []> priceList = computePrice(rentInfo);
int size = priceList.size();
priceArrs = new int [size];
priceArrs = new long [size];
for (int i = 0; i < size; i++) {
int [] priceInt = priceList.get(i);
int sum = 0;
for (int p : priceInt) {
long [] priceInt = priceList.get(i);
long sum = 0;
for (long p : priceInt) {
sum += p;
}
priceArrs[i] = sum;