Browse Source

[BUG][ID1001405][云端:version:.978.1416商铺物业和多经的租赁输入数过大会成负数需要限制]

release_toaliyun_real
gongbiao 7 years ago
parent
commit
ebd71a277c
2 changed files with 41 additions and 41 deletions
  1. +6
    -6
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  2. +35
    -35
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java

+ 6
- 6
mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java View File

@@ -109,7 +109,7 @@ public class WxRentContract implements Serializable {
private Long merchantId;
/*月租金/分成(分)**/
@io.swagger.annotations.ApiModelProperty(value = "月租金/分成(分)", name = "price")
private Integer price;
private Long price;
/*计租开始时间**/
@io.swagger.annotations.ApiModelProperty(value = "计租开始时间", name = "rentalStartDate")
private Date rentalStartDate;
@@ -136,7 +136,7 @@ public class WxRentContract implements Serializable {
private String contractNumber;
/*押金**/
@io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit")
private Integer deposit;
private Long deposit;

/*交租日 计租开始时间减去交租日的天数为基数 提前多少日交租**/
@io.swagger.annotations.ApiModelProperty(value = "交租日 计租开始时间减去交租日的天数为基数 提前多少日交租", name = "payDate")
@@ -317,11 +317,11 @@ public class WxRentContract implements Serializable {
merchantId = _merchantId;
}

public Integer getPrice() {
public Long getPrice() {
return price;
}

public void setPrice(Integer _price) {
public void setPrice(Long _price) {
price = _price;
}

@@ -389,11 +389,11 @@ public class WxRentContract implements Serializable {
contractNumber = _contractNumber;
}

public Integer getDeposit() {
public Long getDeposit() {
return deposit;
}

public void setDeposit(Integer _deposit) {
public void setDeposit(Long _deposit) {
deposit = _deposit;
}



+ 35
- 35
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java View File

@@ -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).intValue());
record.setPrice(price.multiply(hundred).longValue());
} else {
if (StringUtils.isNotEmpty(record.getPriceStr())) {
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).intValue());
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).longValue());
} else {
record.setPrice(0);
record.setPrice(0L);
}
}
if (StringUtils.isNotEmpty(record.getDepositStr())) {
record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).intValue());
record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).longValue());
} 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).intValue());
record.setPrice(price.multiply(hundred).longValue());
} else {
if (StringUtils.isNotEmpty(record.getPriceStr())) {
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).intValue());
record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).longValue());
} else {
record.setPrice(0);
record.setPrice(0L);
}
}

if (StringUtils.isNotEmpty(record.getDepositStr())) {
record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).intValue());
record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).longValue());
} 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)).intValue();
priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).longValue();
}
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).intValue();
priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue();
}
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;


Loading…
Cancel
Save