From ebd71a277c05c274708beeb4b465f6be9dde5013 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 25 Apr 2019 18:31:07 +0800 Subject: [PATCH] =?UTF-8?q?[BUG][ID1001405][=E4=BA=91=E7=AB=AF=EF=BC=9Aver?= =?UTF-8?q?sion:.978.1416=E5=95=86=E9=93=BA=E7=89=A9=E4=B8=9A=E5=92=8C?= =?UTF-8?q?=E5=A4=9A=E7=BB=8F=E7=9A=84=E7=A7=9F=E8=B5=81=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E8=BF=87=E5=A4=A7=E4=BC=9A=E6=88=90=E8=B4=9F=E6=95=B0?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E9=99=90=E5=88=B6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/domain/po/WxRentContract.java | 12 ++-- .../impl/WxRentContractServiceImpl.java | 70 +++++++++---------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 7ca4fcab2..0f0a85873 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -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; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 6dc51526a..2307b1975 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -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 computePrice(String rentInfo) { + public List computePrice(String rentInfo) { JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); int arraySize = rentInfoArray.size(); - List priceList = new ArrayList<>(); + List 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 buildRentMonth(WxMerchant wxMerchant, Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Integer price,Integer isPreview) { + public List 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> 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 priceList = computePrice(rentInfo); + List 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 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 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 buildRent(int lease, int receivePeriod, int price, Date startdate, int dayType, WxRentContract wxRentContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview, Map shopInfo,boolean isLastYesr) { + public Map buildRent(int lease, int receivePeriod, long price, Date startdate, int dayType, WxRentContract wxRentContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview, Map 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 result, Integer lease, int extralease, int extracount, int paycount, int index, int count, BigDecimal rentPrice) { - int[] priceArrs = new int[]{}; + long[] priceArrs = new long[]{}; List 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 priceList = computePrice(rentInfo); + List 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;