| @@ -970,7 +970,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| Date rentalStartDate = wxRentContract.getRentalStartDate(); | Date rentalStartDate = wxRentContract.getRentalStartDate(); | ||||
| Long price = wxRentContract.getPrice(); | Long price = wxRentContract.getPrice(); | ||||
| if(EnumContractOperationType.JINMAO.getCode().equals(wxRentContract.getOperationType())){ | if(EnumContractOperationType.JINMAO.getCode().equals(wxRentContract.getOperationType())){ | ||||
| // rentList = buildRentJinmao(userId, wxRentContract, receivePeriod, lease, rentalStartDate, price, isPreview,saveDb); | |||||
| Date startDate = wxRentContract.getStartDate(); | |||||
| rentList = buildRentJinmao(userId, wxRentContract, receivePeriod, lease, startDate, price, isPreview,saveDb); | |||||
| }else{ | }else{ | ||||
| //按月计租 | //按月计租 | ||||
| @@ -1170,67 +1171,32 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| int size = 0; | int size = 0; | ||||
| long[] priceArrs = null; | long[] priceArrs = null; | ||||
| List<Map<String, Object>> shopInfos = new ArrayList<>(); | 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; | |||||
| } | |||||
| if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) | |||||
| && wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())){ | |||||
| 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); | |||||
| String adjustRatio = wxRentContract.getAdjustRatio(); | |||||
| JSONArray array = JSONArray.parseArray(adjustRatio); | |||||
| List<Integer> integers = new ArrayList<>(); | |||||
| if(array != null && array.size() > 0){ | |||||
| for (int i=0;i<array.size();i++){ | |||||
| JSONObject jsonObject = array.getJSONObject(0); | |||||
| String increasingProportion = jsonObject.getString("increasingProportion"); | |||||
| if(StringUtils.isNotBlank(increasingProportion)){ | |||||
| integers.add(Integer.parseInt(increasingProportion)); | |||||
| } | |||||
| } | } | ||||
| shopInfos.add(shopInfo); | |||||
| } | } | ||||
| } else { | |||||
| String adjustRatio = wxRentContract.getAdjustRatio(); | |||||
| List<Integer> integers = JSONArray.parseArray(adjustRatio, Integer.class); | |||||
| integers.add(0, 0); | integers.add(0, 0); | ||||
| size = integers.size(); | size = integers.size(); | ||||
| priceArrs = new long[size]; | priceArrs = new long[size]; | ||||
| priceArrs[0] = price; | priceArrs[0] = price; | ||||
| BigDecimal priceD = new BigDecimal(price); | BigDecimal priceD = new BigDecimal(price); | ||||
| if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { | |||||
| if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { | |||||
| for (int i = 1; i < size; i++) { | for (int i = 1; i < size; i++) { | ||||
| BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000)); | BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000)); | ||||
| priceD = priceD.add(divide); | priceD = priceD.add(divide); | ||||
| priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); | 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 { | |||||
| 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(); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||