From f6e8a63d39ebd0b15b92c0fb16ab789edace8e4f Mon Sep 17 00:00:00 2001 From: winter Date: Fri, 30 Aug 2024 19:15:53 +0800 Subject: [PATCH] fix --- .../service/helper/WxRentContractHelper.java | 57 +--- .../impl/WxRentContractServiceImpl.java | 243 +----------------- 2 files changed, 7 insertions(+), 293 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java index 05d04a9b6..02ed0a7b4 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java @@ -187,8 +187,8 @@ public class WxRentContractHelper { List retList = new ArrayList(); //租金的年调整 String adjustRatio = wxRentContract.getAdjustRatio(); - List integers = JSONArray.parseArray(adjustRatio, Integer.class); - integers.add(0, 0); + List integers = JSONArray.parseArray(adjustRatio, String.class); + integers.add(0, "0"); int size = integers.size(); String[] priceArrs = new String[size]; @@ -346,8 +346,8 @@ public class WxRentContractHelper { //合铺计算某项计费 private static String[] calcuteRatioByJoin(Integer decimalSize,Integer ratioWay,String ratio,String ratioFirstYearPrice,String rentArea) { - List integers = JSONArray.parseArray(ratio, Integer.class); - integers.add(0, 0); + List integers = JSONArray.parseArray(ratio, String.class); + integers.add(0, "0"); int size = integers.size(); String[] priceArrs = new String[size]; priceArrs[0] = ratioFirstYearPrice; @@ -677,55 +677,6 @@ public class WxRentContractHelper { return validDays; } - public static void main(String[] args) { - Date start = DateUtils.str2Date("2024-08-14 00:00:00").getTime(); - Date end = DateUtils.str2Date("2024-10-30 00:00:00").getTime(); - Date startFirstDay = DateUtils.getFirstDayForCurrMonth(start); - Date endLastDay = DateUtils.getLastDayForMonth(end); - int[] rdiffs = DateUtils.getDiff(startFirstDay, endLastDay); -// int[] diffs = DateUtils.getDiff(start, end); - System.out.println(rdiffs[0]+">>>"+rdiffs[1]); -// System.out.println(DateUtils.daysBetween(start, end)+1); -// -// Date d1 = DateUtils.str2Date("2026-08-09 00:00:00").getTime(); -// Date d2 = DateUtils.str2Date("2026-09-08 00:00:00").getTime(); -// List f1 = DateUtils.getAllDays(d1, d2); -// -// Date endMonthDate = DateUtils.getDaySet(start, Calendar.MONTH, 2); -// System.out.println(DateUtils.date2String(endMonthDate)); - -// Date d3 = DateUtils.str2Date("2024-09-01 00:00:00").getTime(); -// Date d4 = DateUtils.str2Date("2024-09-30 00:00:00").getTime(); -// f1.addAll(DateUtils.getAllDays(d3, d4)); -// System.out.println(getValidDays(start,end,f1)); -// Date start = DateUtils.str2Date("2024-08-05 00:00:00").getTime(); -// Date end = DateUtils.str2Date("2025-11-04 23:59:59").getTime(); -// -// Date d1 = DateUtils.str2Date("2024-07-31 00:00:00").getTime(); -// Date d2 = DateUtils.str2Date("2024-08-03 00:00:00").getTime(); -// Date d3 = DateUtils.str2Date("2024-08-06 00:00:00").getTime(); -// Date d4 = DateUtils.str2Date("2024-08-31 00:00:00").getTime(); -// Date d5 = DateUtils.str2Date("2024-09-01 00:00:00").getTime(); -// Date d6 = DateUtils.str2Date("2024-09-11 00:00:00").getTime(); -// Date d7 = DateUtils.str2Date("2024-09-30 00:00:00").getTime(); -// -// List freeDays = new ArrayList(); -// freeDays.add(d1); -// freeDays.add(d2); -// freeDays.add(d3); -// freeDays.add(d4); -// freeDays.add(d5); -// freeDays.add(d6); -// freeDays.add(d7); - -// System.out.println(DateUtils.getDaySet(d1, Calendar.DATE, -1)); - //String dayMoney = getNeedPay(freeDays, 2, new BigDecimal(10), start, end, EnumRentDayPriceCalcute.AVERAGE_DAYS, 30); - //System.out.println(dayMoney); - - //String monthMoney = getMonthNeedPay(freeDays, 2, new BigDecimal(2000), start, end, EnumContractReceivePeriodUnit.QUARTER.getCode(), 1, EnumRentDayPriceCalcute.AVERAGE_DAYS.getCode(), 30); - //System.out.println(monthMoney); - } - //查询当前月内的金额 private static NeedPayDTO getCurrentMonthPay(Date start,Date end, BigDecimal priceMonth,Integer decimalSize,List validDays,Integer dayPriceCalcute,Integer monthAvageDays) { NeedPayDTO np = new NeedPayDTO(); 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 1ce9f27d8..ab4a3dbbd 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -1019,7 +1019,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { String price = wxRentContract.getPrice(); if(EnumContractOperationType.JINMAO.getCode().equals(wxRentContract.getOperationType())){ Date startDate = wxRentContract.getStartDate(); - rentList = buildRentJinmao(user, wxRentContract, receivePeriod, lease, startDate, price, isPreview,saveDb); + //rentList = buildRentJinmao(user, wxRentContract, receivePeriod, lease, startDate, price, isPreview,saveDb); }else{ rentList = buildRentMonth(user, wxRentContract, receivePeriod, lease, rentalStartDate, isPreview,saveDb); } @@ -1067,106 +1067,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { return resultList; } - public List buildRentJinmao(MallUserInfo user, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, String price, Integer isPreview, boolean saveDb) { - int size = 0; - String[] priceArrs = null; - if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())){ - - String adjustRatio = wxRentContract.getAdjustRatio(); - JSONArray array = JSONArray.parseArray(adjustRatio); - List integers = new ArrayList<>(); - if(array != null && array.size() > 0){ - for (int i=0;i 0){ - priceArrs = new String[array.size()]; - size = array.size(); - for (int i=0;i(); - } - - int month = 12; -// int divide = lease / month; -// int mod = lease % month; -// int[] leaseArr = new int[size]; -// for (int i = 0; i < divide; i++) { -// leaseArr[i] = month; -// } -// if (mod > 0) { -// leaseArr[divide] = mod; -// } - - int billcount = 0; - List resultList = new ArrayList(); - - List yearList = new ArrayList<>(); - for (int i = 0; i < size; i++) { - Calendar instance = Calendar.getInstance(); - Date startDate; - //自然月 - if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ - if(i == 0){ //第一期 - startDate = rentalStartDate; - }else{ - instance.setTime(rentalStartDate); - instance.add(Calendar.MONTH, month * i); - startDate = DateUtils.getFirstDayForCurrMonth(instance.getTime()); - } - }else{ - instance.setTime(rentalStartDate); - instance.add(Calendar.MONTH, month * i); - startDate = instance.getTime(); - } - yearList.add(startDate); - } - - String shopInfoStr = getShopInfoStr(wxRentContract); - Map resultMap = buildRent(receivePeriod, priceArrs,null,null, yearList, Calendar.MONTH, wxRentContract, user, billcount, isPreview, shopInfoStr,saveDb); - List billRentList = (List)resultMap.get("billList"); - resultList.addAll(billRentList); - return resultList; - } - public String getShopInfoStr(WxRentContract wxRentContract){ String shopInfoStr = null; // if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { @@ -1748,143 +1648,6 @@ 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) { - - String[] priceArrs = new String[]{}; - List adjustRatioList = new ArrayList<>(); - adjustRatioList.add(0, "0"); - if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { - String rentInfo = wxRentContract.getRentInfo(); - JSONArray objects = JSONArray.parseArray(rentInfo); - JSONObject jsonObject = objects.getJSONObject(0); - JSONArray adjustRatio = jsonObject.getJSONArray("adjustRatio"); - for (int i = 0, size = adjustRatio.size(); i < size; i++) { - StringBuffer adjustRatioStr = new StringBuffer(); - for (int j = 0, shopSize = objects.size(); j < shopSize; j++) { - JSONObject shopObject = objects.getJSONObject(j); - JSONArray adjustRatioArr = shopObject.getJSONArray("adjustRatio"); - String shopNumber = shopObject.getString("shopNumber"); - adjustRatioStr.append(shopNumber).append("[").append(adjustRatioArr.getString(i)).append("]"); - } - adjustRatioList.add(adjustRatioStr.toString()); - } - List priceList = WxRentContractHelper.computeRentPriceByShop(wxRentContract); - int size = priceList.size(); - priceArrs = new String[size]; - for (int i = 0; i < size; i++) { - String[] priceInt = priceList.get(i); - BigDecimal sum = new BigDecimal(0); - for (String p : priceInt) { - sum = sum.add(new BigDecimal(p)); - } - priceArrs[i] = sum.toPlainString(); - } - } else { - String adjustRatio = wxRentContract.getAdjustRatio(); - List integers = JSONArray.parseArray(adjustRatio, Integer.class); - for (int i = 0, size = integers.size(); i < size; i++) { - double ratioStr = new BigDecimal(integers.get(i)).divide(new BigDecimal(100)).doubleValue(); - adjustRatioList.add(String.valueOf(ratioStr)); - } - } - String payRatioStr = "0"; - if (wxRentContract.getPayRatio() != null) { - payRatioStr = new BigDecimal(wxRentContract.getPayRatio()).divide(new BigDecimal(100)).toPlainString(); - } - //常规租期 - for (int i = 0; i <= count; i++) { - //开始时间 - Calendar instance = Calendar.getInstance(); - instance.setTime(wxRentContract.getRentalStartDate()); - instance.add(Calendar.MONTH, lease * i); - Date starttime = instance.getTime(); - String startdate = DateUtils.date2String(starttime, "yyyy-MM-dd"); - result.put("rentalStartDate" + i, startdate); - result.put("rentalStartDateYear" + i, startdate.substring(0, 4)); - result.put("rentalStartDateMonth" + i, startdate.substring(5, 7)); - result.put("rentalStartDateDay" + i, startdate.substring(8)); - //结束时间 - instance.clear(); - instance.setTime(starttime); - instance.add(Calendar.MONTH, lease); - instance.add(Calendar.DAY_OF_MONTH, -1); - Date endtime = instance.getTime(); - String enddate = DateUtils.date2String(endtime, "yyyy-MM-dd"); - result.put("rentalEndDate" + i, enddate); - result.put("rentalEndDateYear" + i, enddate.substring(0, 4)); - result.put("rentalEndDateMonth" + i, enddate.substring(5, 7)); - result.put("rentalEndDateDay" + i, enddate.substring(8)); - - if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { - rentPrice = new BigDecimal(priceArrs[i]).divide(new BigDecimal(100)).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN); - result.put("priceRentUpper" + i, PriceUtil.digitUppercase(rentPrice.doubleValue())); - result.put("priceRent" + i, rentPrice.toPlainString()); - result.put("adjustRatio" + i, adjustRatioList.get(i)); - } else { - rentPrice = rentPrice.multiply(new BigDecimal(adjustRatioList.get(i))) - .add(rentPrice).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN); - result.put("priceRentUpper" + i, PriceUtil.digitUppercase(rentPrice.doubleValue())); - result.put("priceRent" + i, rentPrice.toPlainString()); - result.put("adjustRatio" + i, adjustRatioList.get(i)); - } - result.put("payRatio" + i, payRatioStr); - result.put("adjustPeriod" + i, wxRentContract.getAdjustPeriod()); - } - if (extracount > 0) { - //额外租期 - //开始时间 - Calendar instance = Calendar.getInstance(); - instance.setTime(wxRentContract.getRentalStartDate()); - instance.add(Calendar.MONTH, lease * count); - Date starttime = instance.getTime(); - String startdate = DateUtils.date2String(starttime, "yyyy-MM-dd"); - result.put("rentalStartDate" + count, startdate); - result.put("rentalStartDateYear" + count, startdate.substring(0, 4)); - result.put("rentalStartDateMonth" + count, startdate.substring(5, 7)); - result.put("rentalStartDateDay" + count, startdate.substring(8)); - //结束时间 - instance.clear(); - instance.setTime(starttime); - instance.add(Calendar.MONTH, extralease); - instance.add(Calendar.DAY_OF_MONTH, -1); - Date endtime = instance.getTime(); - String enddate = DateUtils.date2String(endtime, "yyyy-MM-dd"); - result.put("rentalEndDate" + count, enddate); - result.put("rentalEndDateYear" + count, enddate.substring(0, 4)); - result.put("rentalEndDateMonth" + count, enddate.substring(5, 7)); - result.put("rentalEndDateDay" + count, enddate.substring(8)); - - if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { - rentPrice = new BigDecimal(priceArrs[count]).divide(new BigDecimal(100)).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN); - result.put("priceRentUpper" + count, PriceUtil.digitUppercase(rentPrice.doubleValue())); - result.put("priceRent" + count, rentPrice.toPlainString()); - } else { - rentPrice = rentPrice.multiply(new BigDecimal(adjustRatioList.get(count))) - .add(rentPrice).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN); - result.put("priceRentUpper" + count, PriceUtil.digitUppercase(rentPrice.doubleValue())); - result.put("priceRent" + count, rentPrice.toPlainString()); - } - - } - //无数据租期 - for (int i = paycount; i <= 10; i++) { - result.put("rentalStartDate" + i, "/"); - result.put("rentalStartDateYear" + i, "/"); - result.put("rentalStartDateMonth" + i, "/"); - result.put("rentalStartDateDay" + i, "/"); - result.put("rentalEndDate" + i, "/"); - result.put("rentalEndDateYear" + i, "/"); - result.put("rentalEndDateMonth" + i, "/"); - result.put("rentalEndDateDay" + i, "/"); - result.put("priceRentUpper" + i, "/"); - result.put("priceRent" + i, "/"); - result.put("adjustRatio" + i, "/"); - result.put("payRatio" + i, "/"); - result.put("adjustPeriod" + i, "/"); - } - } - - @Override public void updateApplyStatus(WxRentContract wxRentContract) { wxRentContractMapper.updateApplyStatus(wxRentContract); @@ -2351,8 +2114,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Override public List getRentContractYears(WxRentContract rentContract) { String adjustRatio = rentContract.getAdjustRatio(); - List integers = JSONArray.parseArray(adjustRatio, Integer.class); - integers.add(0, 0); + List integers = JSONArray.parseArray(adjustRatio, String.class); + integers.add(0, "0"); int years = integers.size(); //合同以什么日期来计算开始计租日期 if(rentContract.getRentStartType()!=null &&rentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){