diff --git a/mallinkAdmin/src/main/resources/db/migration/V202108100001__addwx_rent_contract.sql b/mallinkAdmin/src/main/resources/db/migration/V202108100001__addwx_rent_contract.sql index 34cda3cce..12c7755dc 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202108100001__addwx_rent_contract.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202108100001__addwx_rent_contract.sql @@ -35,3 +35,6 @@ ALTER TABLE `mallink`.`wx_rent_contract` ADD COLUMN `link_address` varchar(255) COMMENT '联系地址' AFTER `link_phone`, MODIFY COLUMN `bank_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '开户行名称' AFTER `pay_account`; + +ALTER TABLE `mallink`.`wx_rent_contract` +ADD COLUMN `shop_type_str` varchar(255) AFTER `shop_type`; 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 9ef7faefa..06cbf5ac2 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -260,6 +260,7 @@ public class WxRentContract extends TenantEntity { private Integer businessId; @io.swagger.annotations.ApiModelProperty(value = "店铺类型", name = "shopType") private Integer shopType; + private Integer shopTypeStr; @io.swagger.annotations.ApiModelProperty(value = "店铺名称", name = "shopName") private String shopName; @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime") diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java index b2cab7d95..9cb9495a5 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java @@ -20,8 +20,8 @@ public interface WxRentContractService { /** * 根据实体查询分页列表 * - * @param offset - * @param limit + * @param + * @param * @param record * @return */ @@ -106,7 +106,7 @@ public interface WxRentContractService { /** * 合同正常到期 - * @param wxRentContract + * @param */ void outDateContract(WxMall wxMall); @@ -124,5 +124,5 @@ public interface WxRentContractService { * @return */ boolean hasOtherValidContractShop(WxRentContract wxRentContract); - + } 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 a751753a7..28a80c344 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -1974,6 +1974,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { result.put("mallName", wxMall.getName()); result.put("province", wxMall.getProvince()); result.put("city", wxMall.getCity()); + result.put("mallAddr", wxMall.getAddr()); + result.put("mallServicePhone", wxMall.getServicePhone()); //商户信息 WxMerchant merchant = wxMerchantService.getById(wxRentContract.getMerchantId()); @@ -2008,16 +2010,122 @@ public class WxRentContractServiceImpl implements WxRentContractService { result.put("invoiceAddressPhone", " "); } //租赁合同信息 - String rentalStartDate = DateUtils.date2String(wxRentContract.getRentalStartDate(), "yyyy-MM-dd"); - result.put("rentalStartDate", rentalStartDate); - result.put("rentalStartDateYear", rentalStartDate.substring(0, 4)); - result.put("rentalStartDateMonth", rentalStartDate.substring(5, 7)); - result.put("rentalStartDateDay", rentalStartDate.substring(8)); - String rentalEndDate = DateUtils.date2String(wxRentContract.getRentalEndDate(), "yyyy-MM-dd"); - result.put("rentalEndDate", rentalEndDate); - result.put("rentalEndDateYear", rentalEndDate.substring(0, 4)); - result.put("rentalEndDateMonth", rentalEndDate.substring(5, 7)); - result.put("rentalEndDateDay", rentalEndDate.substring(8)); + //甲方信息 + if(StringUtils.isNotBlank(wxRentContract.getFirstPartyBankInfo())){ + //{"bankNameA": "", "accountNumA": "", "accountNameA": "", "socialCreditCodeA": ""} + JSONObject jsonObject = JSONObject.parseObject(wxRentContract.getFirstPartyBankInfo()); + result.put("bankNameA",jsonObject.getString("bankNameA")); + result.put("accountNumA",jsonObject.getString("accountNumA")); + result.put("accountNameA",jsonObject.getString("accountNameA")); + result.put("socialCreditCodeA",jsonObject.getString("socialCreditCodeA")); + }else{ + result.put("bankNameA",""); + result.put("accountNumA",""); + result.put("accountNameA",""); + result.put("socialCreditCodeA",""); + } + //乙方信息 + result.put("scopeMetre",wxRentContract.getScopeMetre()); + result.put("leasePurpose",wxRentContract.getLeasePurpose()); + result.put("linkPhoneB",wxRentContract.getLinkPhone()); + result.put("linkAddressB",wxRentContract.getLinkAddress()); + if(StringUtils.isNotBlank(wxRentContract.getSecondPartyBankInfo())){ + //{"bankName": "", "payAccount": "", "accountName": "", "socialCreditCode": ""} + JSONObject jsonObject = JSONObject.parseObject(wxRentContract.getSecondPartyBankInfo()); + result.put("bankNameB",jsonObject.getString("bankName")); + result.put("accountNumB",jsonObject.getString("payAccount")); + result.put("accountNameB",jsonObject.getString("accountName")); + result.put("socialCreditCodeB",jsonObject.getString("socialCreditCode")); + }else{ + result.put("bankNameB",""); + result.put("accountNumB",""); + result.put("accountNameB",""); + result.put("socialCreditCodeB",""); + } + //乙方税务信息 + if(StringUtils.isNotBlank(wxRentContract.getSecondPartyTaxInfo())){ + //{"bankName": "", "linkPhone": "", "payAccount": "", "accountName": "", "taxpayerAdress": "", "taxpayerNumber": ""} + JSONObject jsonObject = JSONObject.parseObject(wxRentContract.getSecondPartyTaxInfo()); + result.put("bankNameBTax",jsonObject.getString("bankName")); + result.put("accountNumBTax",jsonObject.getString("payAccount")); + result.put("accountNameBTax",jsonObject.getString("accountName")); + result.put("linkPhoneBTax",jsonObject.getString("linkPhone")); + result.put("taxpayerAdressB",jsonObject.getString("taxpayerAdress")); + result.put("taxpayerNumberB",jsonObject.getString("taxpayerNumber")); + }else{ + result.put("bankNameBTax",""); + result.put("accountNumBTax",""); + result.put("accountNameBTax",""); + result.put("linkPhoneBTax",""); + result.put("taxpayerAdressB",""); + result.put("taxpayerNumberB",""); + } + + + + //交付 + if(wxRentContract.getDeliveryDate() != null){ + String deliveryDate = DateUtils.date2String(wxRentContract.getDeliveryDate(), "yyyy-MM-dd"); + result.put("deliveryDateYear", deliveryDate.substring(0, 4)); + result.put("deliveryDateMonth", deliveryDate.substring(5, 7)); + result.put("deliveryDateDay", deliveryDate.substring(8)); + result.put("deliveryGracePeriod", wxRentContract.getDeliveryGracePeriod()); + } + + + //装修 + if(wxRentContract.getFixStartDate() != null && wxRentContract.getFixEndDate() != null){ + String fixStartDate = DateUtils.date2String(wxRentContract.getFixStartDate(), "yyyy-MM-dd"); + result.put("fixStartDateYear", fixStartDate.substring(0, 4)); + result.put("fixStartDateMonth", fixStartDate.substring(5, 7)); + result.put("fixStartDateDay", fixStartDate.substring(8)); + String fixEndDate = DateUtils.date2String(wxRentContract.getFixEndDate(), "yyyy-MM-dd"); + result.put("fixEndDateYear", fixEndDate.substring(0, 4)); + result.put("fixEndDateMonth", fixEndDate.substring(5, 7)); + result.put("fixEndDateDay", fixEndDate.substring(8)); + } + + //开业 + if(wxRentContract.getOpeningDate() != null){ + String openingDate = DateUtils.date2String(wxRentContract.getOpeningDate(), "yyyy-MM-dd"); + result.put("openingDateYear", openingDate.substring(0, 4)); + result.put("openingDateMonth", openingDate.substring(5, 7)); + result.put("openingDateDay", openingDate.substring(8)); + } + + //计租 + if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ + String rentalStartDate = DateUtils.date2String(wxRentContract.getRentalStartDate(), "yyyy-MM-dd"); + result.put("rentalStartDate", rentalStartDate); + result.put("rentalStartDateYear", rentalStartDate.substring(0, 4)); + result.put("rentalStartDateMonth", rentalStartDate.substring(5, 7)); + result.put("rentalStartDateDay", rentalStartDate.substring(8)); + String rentalEndDate = DateUtils.date2String(wxRentContract.getRentalEndDate(), "yyyy-MM-dd"); + result.put("rentalEndDate", rentalEndDate); + result.put("rentalEndDateYear", rentalEndDate.substring(0, 4)); + result.put("rentalEndDateMonth", rentalEndDate.substring(5, 7)); + result.put("rentalEndDateDay", rentalEndDate.substring(8)); + } + //免租 + if(wxRentContract.getStartDate() != null && wxRentContract.getRentalStartDate()!=null + && !DateUtils.isSameDate(wxRentContract.getStartDate(),wxRentContract.getRentalStartDate())){ + String reductionStartDate = DateUtils.date2String(wxRentContract.getStartDate(), "yyyy-MM-dd"); + result.put("reductionStartDateYear", reductionStartDate.substring(0, 4)); + result.put("reductionStartDateMonth", reductionStartDate.substring(5, 7)); + result.put("reductionStartDateDay", reductionStartDate.substring(8)); + String reductionEndDate = DateUtils.date2String(wxRentContract.getRentalStartDate(), "yyyy-MM-dd"); + result.put("reductionEndDateYear", reductionEndDate.substring(0, 4)); + result.put("reductionEndDateMonth", reductionEndDate.substring(5, 7)); + result.put("reductionEndDateDay", reductionEndDate.substring(8)); + }else{ + result.put("reductionStartDateYear", "/"); + result.put("reductionStartDateMonth", "/"); + result.put("reductionStartDateDay", "/"); + result.put("reductionEndDateYear", "/"); + result.put("reductionEndDateMonth", "/"); + result.put("reductionEndDateDay", "/"); + } + result.put("price", wxRentContract.getPrice()); result.put("contractNumber", wxRentContract.getContractNumber()); Integer lease = wxRentContract.getLease(); @@ -2047,55 +2155,134 @@ public class WxRentContractServiceImpl implements WxRentContractService { } } result.put("brand", brand); - // TODO - //double adjustRatio = wxRentContract.getAdjustRatio() != null ? wxRentContract.getAdjustRatio() / 100.0 : 0; - result.put("adjustRatio", 0); - double priceRent = new BigDecimal(wxRentContract.getPrice()) - .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); - result.put("priceRent", priceRent); - if (!wxRentContract.getRentArea().equals("0")) { - double unitPrice = new BigDecimal(wxRentContract.getPrice()) - .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) - .divide(new BigDecimal(100)) - .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); - result.put("unitPriceRent", unitPrice); - result.put("priceRentUpper", PriceUtil.digitUppercase(priceRent)); - result.put("unitPriceRentUpper", PriceUtil.digitUppercase(unitPrice)); - } else { - result.put("unitPriceRent", 0); - result.put("priceRentUpper", PriceUtil.digitUppercase(0)); - result.put("unitPriceRentUpper", PriceUtil.digitUppercase(0)); - } - - //租赁保证金 - int cashDepositMonthRent = 3; - double cashDepositRent = new BigDecimal(wxRentContract.getPrice()).multiply(new BigDecimal(cashDepositMonthRent)) - .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); - result.put("cashDepositMonthRent", cashDepositMonthRent); - result.put("cashDepositRent", cashDepositRent); - result.put("cashDepositRentUpper", PriceUtil.digitUppercase(cashDepositRent)); - result.put("type", wxRentContract.getType()); - int extralease = lease % 12; - int extracount = extralease > 0 ? 1 : 0; - int paycount = lease / 12 + extracount; - int index = 10 - paycount; - int count = paycount - 1; - BigDecimal rentPrice = new BigDecimal(priceRent); - //保底 - if (wxRentContract.getRevenue() != null) { - double revenue = new BigDecimal(wxRentContract.getRevenue()) + Integer type = wxRentContract.getType(); + result.put("type", type); + + if(EnumContractOperationType.JINMAO.getCode().equals(wxRentContract.getOperationType())){ + if(StringUtils.isNotBlank(wxRentContract.getCashtypeContentLsit())){ + //{"honourPledge": "", "fitmentPledge": "", "qualityPledge": "", "honourDuration": "", "qualityDuration": ""} + //fitmentPledge:"",//装修押金 + //honourPledge:"",//履约保证金 + //honourDuration:"",//履约保证金时限 + //qualityPledge:"",//品质保证金 + //qualityDuration:"",//品质保证金时限 + JSONObject jsonObject = JSONObject.parseObject(wxRentContract.getCashtypeContentLsit()); + result.put("fitmentPledge",jsonObject.getString("fitmentPledge")); + result.put("honourPledge",jsonObject.getString("honourPledge")); + result.put("honourDuration",jsonObject.getString("honourDuration")); + result.put("qualityPledge",jsonObject.getString("qualityPledge")); + result.put("qualityDuration",jsonObject.getString("qualityDuration")); + + } + //incrementStartDate//租金递增起始日期 + //increasingProportion//租金递增比例 + //progressivePay//递增租赁单价 + String incrementStartDate = ""; + String increasingProportion = ""; + String progressivePay = ""; + if(StringUtils.isNotBlank(wxRentContract.getAdjustRatio())){ + JSONArray array = JSONArray.parseArray(wxRentContract.getAdjustRatio()); + if(array != null && array.size() > 0){ + JSONObject jsonObject = array.getJSONObject(0); + incrementStartDate = jsonObject.getString("incrementStartDate"); + increasingProportion = jsonObject.getString("increasingProportion"); + progressivePay = jsonObject.getString("progressivePay"); + } + } + if(EnumRentContractType.RENT_BY_AREA.getCode().equals(type)){ + if(StringUtils.isNotBlank(incrementStartDate)){ + result.put("oneRentalEndDateYear1",incrementStartDate.substring(0,4)); + result.put("oneRentalEndDateMonth1",incrementStartDate.substring(5,7)); + result.put("oneRentalEndDateDay1",incrementStartDate.substring(8,10)); + double priceRent = new BigDecimal(wxRentContract.getPrice()) + .divide(new BigDecimal(100)) + .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + result.put("oneRentalPrice1", priceRent); + result.put("oneRentalPriceUpper1", PriceUtil.digitUppercase(priceRent)); + + result.put("oneRentalStartDateYear2",incrementStartDate.substring(0,4)); + result.put("oneRentalStartDateMonth2",incrementStartDate.substring(5,7)); + result.put("oneRentalStartDateDay2",incrementStartDate.substring(8,10)); + result.put("oneRentIncreasing2",increasingProportion); + double priceRent2 = new BigDecimal(priceRent) + .divide(new BigDecimal(1).add(new BigDecimal(increasingProportion))) + .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + result.put("oneRentalPrice2", priceRent2); + result.put("oneRentalPriceUpper2", PriceUtil.digitUppercase(priceRent2)); + }else{ + result.put("oneRentalStartDateYear1",incrementStartDate.substring(0,4)); + result.put("oneRentalStartDateMonth1",incrementStartDate.substring(5,7)); + result.put("oneRentalStartDateDay1",incrementStartDate.substring(8,10)); + double priceRent = new BigDecimal(wxRentContract.getPrice()) + .divide(new BigDecimal(100)) + .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + result.put("oneRentalPrice1", priceRent); + result.put("oneRentalPriceUpper1", PriceUtil.digitUppercase(priceRent)); + } + + + }else if(EnumRentContractType.RENT_BY_JOINT.getCode().equals(type)){ + + + }else if(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode().equals(type)){ + + + } + }else{ + // TODO + //double adjustRatio = wxRentContract.getAdjustRatio() != null ? wxRentContract.getAdjustRatio() / 100.0 : 0; + result.put("adjustRatio", 0); + double priceRent = new BigDecimal(wxRentContract.getPrice()) .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); - result.put("revenue", revenue); - result.put("revenueUpper", PriceUtil.digitUppercase(revenue)); - } else { - result.put("revenue", 0); - result.put("revenueUpper", PriceUtil.digitUppercase(0)); - } - if (!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - areaWay(wxRentContract, result, lease, extralease, extracount, paycount, index, count, rentPrice); - } else { - ratioWay(wxRentContract, result, lease, extralease, extracount, paycount, index, count, rentPrice); + result.put("priceRent", priceRent); + if (!wxRentContract.getRentArea().equals("0")) { + double unitPrice = new BigDecimal(wxRentContract.getPrice()) + .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) + .divide(new BigDecimal(100)) + .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + result.put("unitPriceRent", unitPrice); + result.put("priceRentUpper", PriceUtil.digitUppercase(priceRent)); + result.put("unitPriceRentUpper", PriceUtil.digitUppercase(unitPrice)); + } else { + result.put("unitPriceRent", 0); + result.put("priceRentUpper", PriceUtil.digitUppercase(0)); + result.put("unitPriceRentUpper", PriceUtil.digitUppercase(0)); + } + + //租赁保证金 + int cashDepositMonthRent = 3; + double cashDepositRent = new BigDecimal(wxRentContract.getPrice()).multiply(new BigDecimal(cashDepositMonthRent)) + .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + result.put("cashDepositMonthRent", cashDepositMonthRent); + result.put("cashDepositRent", cashDepositRent); + result.put("cashDepositRentUpper", PriceUtil.digitUppercase(cashDepositRent)); + + int extralease = lease % 12; + int extracount = extralease > 0 ? 1 : 0; + int paycount = lease / 12 + extracount; + int index = 10 - paycount; + int count = paycount - 1; + BigDecimal rentPrice = new BigDecimal(priceRent); + //保底 + if (wxRentContract.getRevenue() != null) { + double revenue = new BigDecimal(wxRentContract.getRevenue()) + .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + result.put("revenue", revenue); + result.put("revenueUpper", PriceUtil.digitUppercase(revenue)); + } else { + result.put("revenue", 0); + result.put("revenueUpper", PriceUtil.digitUppercase(0)); + } + if (!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { + areaWay(wxRentContract, result, lease, extralease, extracount, paycount, index, count, rentPrice); + } else { + ratioWay(wxRentContract, result, lease, extralease, extracount, paycount, index, count, rentPrice); + } } + + + + //物业合同信息 //WxPropertyContract propertyContract = new WxPropertyContract(); //propertyContract.updateTenantInfo(wxRentContract); diff --git a/mallinkService/src/main/java/com/iformall/utils/DateUtils.java b/mallinkService/src/main/java/com/iformall/utils/DateUtils.java index 625872b0b..fdb9512b7 100755 --- a/mallinkService/src/main/java/com/iformall/utils/DateUtils.java +++ b/mallinkService/src/main/java/com/iformall/utils/DateUtils.java @@ -1378,4 +1378,19 @@ public class DateUtils { return cal.getTime(); } + public static boolean isSameDate(Date date1, Date date2) { + Calendar cal1 = Calendar.getInstance(); + cal1.setTime(date1); + Calendar cal2 = Calendar.getInstance(); + cal2.setTime(date2); + boolean isSameYear = cal1.get(Calendar.YEAR) == cal2 + .get(Calendar.YEAR); + boolean isSameMonth = isSameYear + && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH); + boolean isSameDate = isSameMonth + && cal1.get(Calendar.DAY_OF_MONTH) == cal2 + .get(Calendar.DAY_OF_MONTH); + return isSameDate; + } + } diff --git a/mallinkService/src/main/resources/contract-word-template/jinmao_contract_rent_property.docx b/mallinkService/src/main/resources/contract-word-template/jinmao_contract_rent_property.docx index 87aab268c..4667a2563 100644 Binary files a/mallinkService/src/main/resources/contract-word-template/jinmao_contract_rent_property.docx and b/mallinkService/src/main/resources/contract-word-template/jinmao_contract_rent_property.docx differ diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index b6334a5f2..7d4a2c27e 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -47,6 +47,7 @@ + @@ -121,7 +122,7 @@ `first_party_bank_info`,`second_party_bank_info`,`second_party_tax_info`, `property_name`,`property_fee`,`fee_cycle`,`water_fee`,`electricity_fees`, `deposit`,cashtype_content_lsit,cashtype_lsit,`pay_date`,`is_del`,`merchant_name`, - `brand`,`business_id`,`shop_type`,`updatetime`,`createtime`,`link_person`,`link_phone`,`link_address`, + `brand`,`business_id`,`shop_type`,`shop_type_str`,`updatetime`,`createtime`,`link_person`,`link_phone`,`link_address`, `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, `start_date`,`end_date`,`shop_name`,`from_id`, `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`,