diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java index a76a881fd..54f9465f4 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -191,6 +191,31 @@ public class WxRentContractController extends WxContractBaseController { return new ResultData(wxRentContract.getPrice()); } + /** + * 获取免租期 + */ + @GetMapping("getFreePeriod") + public ResultData getFreePeriod(@ModelAttribute WxRentContract wxRentContract) { + //查询 + WxRentContract contract = wxRentContractService.selectById(wxRentContract.getId()); + return new ResultData(wxRentContractService.getFreePeriods(contract)); + } + + /** + * 设置免租期 + * @param wxRentContract + * @return + */ + @PostMapping("setFreePeriod") + public ResultData setFreePeriod(@RequestBody WxRentContract wxRentContract) { + if (null == wxRentContract.getFreePeriods()) { + return new ResultData(Result.ERROR,"免租期不能为空"); + } + wxRentContract.updateTenantInfo(getTenantInfo()); + wxRentContractService.saveFreePeriods(wxRentContract); + return new ResultData(); + } + /** * 新增第二步 防止前端3秒重复提交 * @param wxRentContract diff --git a/mallinkAdmin/src/main/java/com/iformall/tenant/TenantInfoImpl.java b/mallinkAdmin/src/main/java/com/iformall/tenant/TenantInfoImpl.java index cbb2e388b..a7f5f7155 100644 --- a/mallinkAdmin/src/main/java/com/iformall/tenant/TenantInfoImpl.java +++ b/mallinkAdmin/src/main/java/com/iformall/tenant/TenantInfoImpl.java @@ -190,7 +190,7 @@ public class TenantInfoImpl implements TenantInfo { return true; if ("com.iformall.mapper.WxAllBillMapper.insertBills".equals(ms.getId())) return true; - if ("com.iformall.mapper.WxBillPropertyMapper.updateBills".equals(ms.getId())) + if ("com.iformall.mapper.WxRentContractFreePeriodMapper.inertPeriods".equals(ms.getId())) return true; if ("com.iformall.mapper.WxActivityJoinMapper.updateSendMsg".equals(ms.getId())) return true; diff --git a/mallinkAdmin/src/main/resources/db/migration/V202408000000001.sql b/mallinkAdmin/src/main/resources/db/migration/V202408000000001.sql index c4932235b..1dea6e558 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202408000000001.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202408000000001.sql @@ -107,3 +107,19 @@ create table wx_all_bill_98 like wx_all_bill; create table wx_all_bill_99 like wx_all_bill; drop table wx_all_bill; + + +CREATE TABLE `wx_rent_contract_free_period` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', + `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `start_date` datetime NOT NULL COMMENT '起租开始时间', + `end_date` datetime NOT NULL COMMENT '起租结束时间', + `rent_contract_id` bigint(20) NOT NULL COMMENT '合同编号', + `year_index` int(2) NOT NULL COMMENT '年序号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租赁合同'; + + 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 b488eea65..52aef1b09 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.iformall.common.SortColumn; import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.vo.RentContractFreePeriodVo; import com.iformall.enums.EnumPriceUnit; import com.iformall.enums.EnumRentContractAdjustPeriod; import com.iformall.enums.EnumRentContractType; @@ -564,5 +565,7 @@ public class WxRentContract extends TenantEntity { @TableField(exist = false) private Long propertyContractId; + @TableField(exist = false) + private List freePeriods; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractFreePeriod.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractFreePeriod.java new file mode 100644 index 000000000..6b6b6f380 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContractFreePeriod.java @@ -0,0 +1,41 @@ +package com.iformall.domain.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.iformall.domain.po.base.TenantEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import java.util.Date; + +/** + */ +@TableName(value = "wx_rent_contract_free_period") +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class WxRentContractFreePeriod extends TenantEntity { + + private static final long serialVersionUID = 7009117540201976664L; + + @io.swagger.annotations.ApiModelProperty(value="id",name="id") + private Long id; + + @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") + private Date createTime; + + @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") + private Date updateTime; + + @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") + private Date startDate; + + @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") + private Date endDate; + + @io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "rentContractId") + private Long rentContractId; + + @io.swagger.annotations.ApiModelProperty(value="年序号",name="yearIndex") + private Integer yearIndex; + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/RentContractFreePeriodVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/RentContractFreePeriodVo.java new file mode 100644 index 000000000..635ca6bb1 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/RentContractFreePeriodVo.java @@ -0,0 +1,25 @@ +package com.iformall.domain.vo; + +import com.iformall.domain.po.WxRentContractFreePeriod; +import lombok.Data; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + */ + +@Data +public class RentContractFreePeriodVo implements Serializable{ + + private static final long serialVersionUID = 4494858079134918638L; + //核销金额记录 + private Integer yearIndex; + + private Date start; + + private Date end; + + private List periods; + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractFreePeriodMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractFreePeriodMapper.java new file mode 100644 index 000000000..f3efb3e9a --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractFreePeriodMapper.java @@ -0,0 +1,21 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxRentContractFreePeriod; + +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + */ +public interface WxRentContractFreePeriodMapper extends CommonMapper { + + List findList(WxRentContractFreePeriod wxBillRent); + + WxRentContractFreePeriod selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + + void inertPeriods(@Param("tenantId")String tenantId,@Param("list")List list); + + void deleteByContract(WxRentContractFreePeriod wxBillRent); + +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java index 90a6873dd..9d132c1f0 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java @@ -6,7 +6,9 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxMall; import com.iformall.domain.po.WxRentContract; +import com.iformall.domain.po.WxRentContractFreePeriod; import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.vo.RentContractFreePeriodVo; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -38,6 +40,7 @@ public interface WxRentContractService { * @return */ Map getById(Long id); + WxRentContract selectById(Long id); /** * 保存或更新实体 @@ -147,4 +150,8 @@ public interface WxRentContractService { void deletePrewBill(WxRentContract wxRentContract); + List getFreePeriods(WxRentContract wxRentContract); + + void saveFreePeriods(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 cf5e18791..3a427f7eb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -1,6 +1,5 @@ package com.iformall.service.impl; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -10,18 +9,71 @@ import com.iformall.common.ErrorCode; import com.iformall.common.IdWorker; import com.iformall.common.Result; import com.iformall.common.ResultData; -import com.iformall.domain.po.*; -import com.iformall.domain.po.base.BaseEntity; +import com.iformall.domain.po.MallUserInfo; +import com.iformall.domain.po.WxAllBill; +import com.iformall.domain.po.WxEnergyFees; +import com.iformall.domain.po.WxFlowModel; +import com.iformall.domain.po.WxFlowRecord; +import com.iformall.domain.po.WxMall; +import com.iformall.domain.po.WxMerchant; +import com.iformall.domain.po.WxMerchantTradeDaily; +import com.iformall.domain.po.WxPayAccountBill; +import com.iformall.domain.po.WxPropertyContract; +import com.iformall.domain.po.WxRentContract; +import com.iformall.domain.po.WxRentContractFreePeriod; +import com.iformall.domain.po.WxShop; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.BillTimeVo; import com.iformall.domain.vo.RatioVo; -import com.iformall.enums.*; +import com.iformall.domain.vo.RentContractFreePeriodVo; +import com.iformall.enums.EnumBillAllType; +import com.iformall.enums.EnumBillStatus; +import com.iformall.enums.EnumContractOperationType; +import com.iformall.enums.EnumContractReceivePeriodUnit; +import com.iformall.enums.EnumEndProperty; +import com.iformall.enums.EnumFeesStandardsCalcuteUnit; +import com.iformall.enums.EnumFlowKey; +import com.iformall.enums.EnumFlowRecordStatus; +import com.iformall.enums.EnumFromType; +import com.iformall.enums.EnumGetRatioFrom; +import com.iformall.enums.EnumIsPreview; +import com.iformall.enums.EnumMissTimeType; +import com.iformall.enums.EnumPriceUnit; +import com.iformall.enums.EnumRentContractAdjustPeriod; +import com.iformall.enums.EnumRentContractAdjustRatioWay; +import com.iformall.enums.EnumRentContractAppStatus; +import com.iformall.enums.EnumRentContractManageFeeType; +import com.iformall.enums.EnumRentContractStatus; +import com.iformall.enums.EnumRentContractType; +import com.iformall.enums.EnumRentShopType; +import com.iformall.enums.EnumTradeDailyDateType; +import com.iformall.enums.EnumYesOrNo; import com.iformall.exception.MallinkException; -import com.iformall.mapper.*; -import com.iformall.service.*; +import com.iformall.mapper.WxAllBillMapper; +import com.iformall.mapper.WxBusinessMapper; +import com.iformall.mapper.WxFlowRecordMapper; +import com.iformall.mapper.WxMerchantMapper; +import com.iformall.mapper.WxMerchantShopMapper; +import com.iformall.mapper.WxMerchantTradeDailyMapper; +import com.iformall.mapper.WxPropertyContractMapper; +import com.iformall.mapper.WxRentContractFreePeriodMapper; +import com.iformall.mapper.WxRentContractMapper; +import com.iformall.mapper.WxShopMapper; +import com.iformall.service.WxEnergyService; +import com.iformall.service.WxFlowRecordService; +import com.iformall.service.WxFlowService; +import com.iformall.service.WxMallService; +import com.iformall.service.WxMerchantService; +import com.iformall.service.WxPayAccountBillService; +import com.iformall.service.WxPropertyContractService; +import com.iformall.service.WxRentContractService; +import com.iformall.service.WxShopService; import com.iformall.service.helper.WxBillAllHelper; import com.iformall.service.helper.WxRentContractHelper; -import com.iformall.utils.*; +import com.iformall.utils.Constant; +import com.iformall.utils.DateUtils; +import com.iformall.utils.DownFileUtil; +import com.iformall.utils.PriceUtil; import org.apache.commons.collections.map.HashedMap; import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; @@ -36,7 +88,6 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; @@ -44,7 +95,15 @@ import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; /** * @author gongbiao @@ -58,6 +117,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxRentContractMapper wxRentContractMapper; + + @Autowired + WxRentContractFreePeriodMapper wxRentContractFreePeriodMapper; @Autowired WxShopMapper wxShopMapper; @@ -78,8 +140,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxMallService wxMallService; - @Autowired - WxBrandMapper WxBrandMapper; + //@Autowired + //WxBrandMapper WxBrandMapper; @Lazy @Autowired @@ -282,6 +344,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { return result; } + + @Override + public WxRentContract selectById(Long id) { + return wxRentContractMapper.selectById(id); + } /** * 计算金额 * @param ratio @@ -508,46 +575,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); } - //生成预览账单(补录第二步,第三步走编辑) -// if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null -// && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0)) { -// wxBillRentMapper.deletePreviewBill(record); -// //重新生成 -// List resultList = buildRent(null, record, EnumIsPreview.YES.getCode(),true); -// record.setPreviewBillRentList(resultList); -// } - - //创建预览账单 -// List resultList = buildRent(null, record, EnumIsPreview.YES.getCode(),true); -// record.setPreviewBillRentList(resultList); - //EventUtil.publistRentEvent(this, record); - return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); } @Override public List getShopIds(WxRentContract record) { return record.shopIdsByRentInfo(); -// List shopList = Lists.newArrayList(); -// if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { -// String rentInfo = record.getRentInfo(); -// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); -// int size = rentInfoArray.size(); -// //查询rent_info 包括 shopId -// for (int i = 0; i < size; i++) { -// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); -// WxRentContract wxRentContract = new WxRentContract(); -// wxRentContract.updateTenantInfo(record); -// Long shopId = rentInfoObject.getLong("shopId"); -// shopList.add(shopId); -// } -// } else { -// WxRentContract wxRentContract = new WxRentContract(); -// wxRentContract.updateTenantInfo(record); -// wxRentContract.setShopId(record.getShopId()); -// shopList.add(record.getShopId()); -// } -// return shopList; } //@Transactional(rollbackFor = {Exception.class}) @@ -998,39 +1031,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { return rentContractList; } -// @Override -// public void updateInvalidContract(Long rentContractId) { -// WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); -// if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { -// String rentInfo = wxRentContract.getRentInfo(); -// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); -// WxRentContract record = new WxRentContract(); -// for (int i = 0, size = rentInfoArray.size(); i < size; i++) { -// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); -// Long shopId = rentInfoObject.getLong("shopId"); -// record.setShopId(shopId); -// record.updateTenantInfo(wxRentContract); -// record.setStatus(EnumRentContractStatus.INVALID.getCode()); -// wxRentContractMapper.updateInvalidContract(record); -// List rentContractList = wxRentContractMapper.selectRentContractByShopId(record); -// for (WxRentContract updateContract : rentContractList) { -// updateInvalidStatus(updateContract); -// } -// } -// } else { -// WxRentContract record = new WxRentContract(); -// record.updateTenantInfo(wxRentContract); -// record.setRentShopType(wxRentContract.getRentShopType()); -// record.setStatus(EnumRentContractStatus.INVALID.getCode()); -// wxRentContractMapper.updateRentInvalidStatus(record); -// List rentContractList = wxRentContractMapper.selectList(new QueryWrapper(record)); -// for (WxRentContract updateContract : rentContractList) { -// updateInvalidStatus(updateContract); -// } -// } -// -// } - @Override public ResultData hasRentStatus(WxRentContract record) { String rentInfo = record.getRentInfo(); @@ -1316,120 +1316,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { return shopInfoStr; } -// private String getRentPriceInfo(WxRentContract wxRentContract, BigDecimal contractNeedPay){ -// if(contractNeedPay.compareTo(new BigDecimal(0)) == 0){ -// return null; -// } -// BigDecimal rentPrice = new BigDecimal(0), siteMoney = new BigDecimal(0), facilityMoney = new BigDecimal(0), administratorMoney = new BigDecimal(0),managementMoney = new BigDecimal(0); -// if(!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode()) && -// !wxRentContract.getType().equals(EnumRentContractType.RENT_BY_COUNT.getCode()) -// && !wxRentContract.getType().equals(EnumRentContractType.RENT_BY_CUSTOMIZE.getCode())){ -// if(wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())){ -// String rentInfo = wxRentContract.getRentInfo(); -// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); -// String[] priceList = WxRentContractHelper.computeRentPriceByShop(wxRentContract).get(0); -// BigDecimal sum = new BigDecimal(0); -// for (int i = 0 ; i < priceList.length ; i++) { -// sum = sum.add(new BigDecimal(priceList[i])); -// } -// int size = rentInfoArray.size(); -// for (int i = 0;i < size;i++) { -// BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0),e=new BigDecimal(0); -// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); -// -// String rentPrice1 = rentInfoObject.getString("rentPrice"); -// if(StringUtils.isNotBlank(rentPrice1)){ -// a = new BigDecimal(rentPrice1); -// } -// JSONObject otherRentPriceInfo = rentInfoObject.getJSONObject("otherRentPriceInfo"); -// if(otherRentPriceInfo != null ){ -// -// //场地费 -// String siteMoney1 = otherRentPriceInfo.getString("siteMoney"); -// if(StringUtils.isNotBlank(siteMoney1)){ -// b = new BigDecimal(siteMoney1); -// } -// //设备费 -// String facilityMoney1 = otherRentPriceInfo.getString("facilityMoney"); -// if(StringUtils.isNotBlank(facilityMoney1)){ -// c = new BigDecimal(facilityMoney1); -// } -// //商业管理费 -// String administratorMoney1 = otherRentPriceInfo.getString("administratorMoney"); -// if(StringUtils.isNotBlank(administratorMoney1)){ -// d = new BigDecimal(administratorMoney1); -// } -// -// //营业管理费 -// String managementMoney1 = otherRentPriceInfo.getString("managementMoney"); -// if(StringUtils.isNotBlank(managementMoney1)){ -// e = new BigDecimal(managementMoney1); -// } -// } -// -// rentPrice =rentPrice.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP) -// .multiply(a).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP)); -// siteMoney =siteMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP) -// .multiply(b).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP)); -// facilityMoney =facilityMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP) -// .multiply(c).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP)); -// administratorMoney =administratorMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP) -// .multiply(d).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP)); -// managementMoney =managementMoney.add(contractNeedPay.multiply(new BigDecimal(priceList[i])).divide(sum,Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP) -// .multiply(e).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP)); -// } -// -// }else{ -// BigDecimal a=new BigDecimal(0),b=new BigDecimal(0),c=new BigDecimal(0),d=new BigDecimal(0),e=new BigDecimal(0); -// String rentPrice1 = wxRentContract.getRentPrice(); -// if(StringUtils.isNotBlank(rentPrice1)){ -// //a = new BigDecimal(rentPrice1).divide(new BigDecimal(100)); -// a = new BigDecimal(rentPrice1); -// } -// String otherRentPriceInfo1 = wxRentContract.getOtherRentPriceInfo(); -// if(StringUtils.isNotBlank(otherRentPriceInfo1)){ -// -// JSONObject jsonObject = JSONObject.parseObject(otherRentPriceInfo1); -// -// String siteMoney1 = jsonObject.getString("siteMoney"); -// if(StringUtils.isNotBlank(siteMoney1)){ -// b = new BigDecimal(siteMoney1); -// } -// String facilityMoney1 = jsonObject.getString("facilityMoney"); -// if(StringUtils.isNotBlank(facilityMoney1)){ -// c = new BigDecimal(facilityMoney1); -// } -// String administratorMoney1 = jsonObject.getString("administratorMoney"); -// if(StringUtils.isNotBlank(administratorMoney1)){ -// d = new BigDecimal(administratorMoney1); -// } -// -// String managementMoney1 = jsonObject.getString("managementMoney"); -// if(StringUtils.isNotBlank(managementMoney1)){ -// e = new BigDecimal(managementMoney1); -// } -// } -// rentPrice = contractNeedPay.multiply(a).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); -// siteMoney = contractNeedPay.multiply(b).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); -// facilityMoney = contractNeedPay.multiply(c).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); -// administratorMoney = contractNeedPay.multiply(d).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); -// managementMoney = contractNeedPay.multiply(e).divide(a.add(b).add(c).add(d).add(e),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP).setScale(wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); -// } -// }else{ -// rentPrice = contractNeedPay; -// } -// -// -// Map resultMap = new HashedMap(); -// resultMap.put("rentPrice",rentPrice.toString()); -// resultMap.put("siteMoney",siteMoney.toString()); -// resultMap.put("facilityMoney",facilityMoney.toString()); -// resultMap.put("administratorMoney",administratorMoney.toString()); -// resultMap.put("managementMoney",managementMoney.toString()); -// return JSON.toJSONString(resultMap); -// } - - private static Date getCurrentYearRentDate(Date yearEndDate,Date rentDate){ Calendar calendar = Calendar.getInstance(); calendar.setTime(yearEndDate); @@ -1699,52 +1585,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { return manage; } -// public void setExpiredDay(WxBillRent wxBillRent,int dayType, int receivePeriod){ -// //截止收租日在当前时间之前 -// Date date = new Date(); -// wxBillRent.setExpiredDay(0L); -// if (wxBillRent.getReceiveDate().before(date)) { -// long day = (date.getTime() - wxBillRent.getReceiveDate().getTime()) / (24 * 60 * 60 * 1000); -// wxBillRent.setStatus(EnumBillStatus.NOT_PAID.getCode()); -// if (day > 0) { -// wxBillRent.setExpiredDay(day); -// } -// } else {//截止收租日在当前时间之后 -// Calendar now = Calendar.getInstance(); -// now.add(dayType, receivePeriod); -// Date currenttime = now.getTime(); -// //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 -// if (currenttime.before(wxBillRent.getReceiveDate())) { -// wxBillRent.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); -// } else { -// wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); -// } -// } -// } - -// public void setManageExpiredDay(WxBillRentManage wxBillRentManage,int dayType, int receivePeriod){ -// //截止收租日在当前时间之前 -// Date date = new Date(); -// wxBillRentManage.setExpiredDay(0L); -// if (wxBillRentManage.getReceiveDate().before(date)) { -// long day = (date.getTime() - wxBillRentManage.getReceiveDate().getTime()) / (24 * 60 * 60 * 1000); -// wxBillRentManage.setStatus(EnumBillStatus.NOT_PAID.getCode()); -// if (day > 0) { -// wxBillRentManage.setExpiredDay(day); -// } -// } else {//截止收租日在当前时间之后 -// Calendar now = Calendar.getInstance(); -// now.add(dayType, receivePeriod); -// Date currenttime = now.getTime(); -// //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 -// if (currenttime.before(wxBillRentManage.getReceiveDate())) { -// wxBillRentManage.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); -// } else { -// wxBillRentManage.setStatus(EnumBillStatus.WAIT_PAY.getCode()); -// } -// } -// } - @Transactional(rollbackFor = {Exception.class}) @Override public ResultData deleteById(String id) { @@ -1775,33 +1615,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { } } -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public Object getRentContractStatusInfo(WxRentContract rentContract) { -// -// Map resultData = new HashMap(); -// //商铺信息 -// WxShop wxShop = new WxShop(); -// wxShop.updateTenantInfo(rentContract); -// wxShop.setType(rentContract.getRentShopType()); -// wxShop.setStatus(EnumShopStatus.RENT.getCode()); -// List rentedList = wxShopMapper.findList(wxShop); -// wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode()); -// List unrentedList = wxShopMapper.findList(wxShop); -// -// HashMap shopMap = new HashMap<>(3); -// int rentedCount = rentedList.size(); -// int unrentedCount = unrentedList.size(); -// shopMap.put("rentedCount", rentedCount); -// shopMap.put("unrentedCount", unrentedCount); -// shopMap.put("allCount", rentedCount + unrentedCount); -// resultData.put("shopCountInfo", shopMap); -// -// //需要更新的状态 -// resultData.putAll(updateStatus(rentContract)); -// return resultData; -// } - @Transactional(rollbackFor = {Exception.class}) @Override public ResultData endContract(WxRentContract wxRentContract,MallUserInfo userInfo) { @@ -1888,79 +1701,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { return pageInfo; } -// @Override -// public Map updateStatus(WxRentContract record) { -// Map resultData = new HashMap(); -// WxRentContract wxRentContract = new WxRentContract(); -// wxRentContract.updateTenantInfo(record); -// wxRentContract.setRentShopType(record.getRentShopType()); -// -// int allCount = wxRentContractMapper.selectCount(new QueryWrapper(wxRentContract)); -// resultData.put("allCount", allCount); -// -// //待签约 -// //wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); -// //int waitSignCount = wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract); -// //resultData.put("waitSignCount", waitSignCount); -// resultData.put("waitSignCount", 0); -// -// //计租中 -// wxRentContract.setStatus(EnumRentContractStatus.PAING.getCode()); -// wxRentContractMapper.updateRentContractPaidStatus(wxRentContract); -// int rendPaidCount = wxRentContractMapper.queryRentContractPaidStatus(wxRentContract); -// resultData.put("rendPaidCount", rendPaidCount); -// -// //将到期 -// //wxRentContract.setStatus(EnumRentContractStatus.CONTRACT_END_SOON.getCode()); -// //wxRentContractMapper.updateRentContractEndSoonStatus(wxRentContract); -// //int endSoonCount = wxRentContractMapper.queryRentContractEndSoonStatus(wxRentContract); -// //resultData.put("endSoonCount", endSoonCount); -// resultData.put("endSoonCount", 0); -// -// //到期 -// wxRentContract.setStatus(EnumRentContractStatus.OUT_DATE.getCode()); -// wxRentContractMapper.updateRentContractEndStatus(wxRentContract); -// int endCount = wxRentContractMapper.queryRentContractEndStatus(wxRentContract); -// resultData.put("endCount", endCount); -// -// //合同到期 -// contractEnd(record.getTenantId()); -// -// return resultData; -// } - -// @Override -// public void exportContract(HttpServletRequest request, HttpServletResponse response, Long rentId,Long propertyId) { -// String contracType = "0"; -// String templatePath = null; -// Map result = null; -// if (EnumContractType.ALL.getCode().toString().equals(contracType)) { -// logger.info("获取租赁及物业合同数据"); -// result = getRentAndPropertyInfo(rentId,propertyId); -// result.put("contractType", EnumContractType.ALL.getMessage()); -// if(EnumContractOperationType.JINMAO.getCode().equals(result.get("operationType"))){ -// templatePath = "contract-word-template/jinmao_contract_rent_property.docx"; -// }else{ -// if (EnumRentContractType.RENT_BY_AREA.getCode().equals(result.get("type"))) { -// templatePath = "contract-word-template/contract_rent_property.docx"; -// } else { -// templatePath = "contract-word-template/contract_rent_property_by_ratio.docx"; -// } -// } -// -// logger.info("租赁及物业合同数据结果:" + result); -// } -// -// if (templatePath == null) { -// logger.info("没有租赁及物业合同模板"); -// return; -// } -// String filepath = fmUploadDir; -// String filename = UUID.randomUUID() + ".docx"; -// String exportFileName = result.get("merchantName").toString() + "合同.docx"; -// WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,null); -// } - @Override @Transactional(rollbackFor = {Exception.class}) public ResultData updateFile(WxRentContract record, MallUserInfo user,String userName,Date oldRentStartDate,boolean writeComplate) { @@ -2083,775 +1823,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { } } -// public Map getRentAndPropertyInfo(Long rentId,Long propertyId) { -// logger.info("获取租赁物业合同数据>>>>>>rentId:" + rentId +" >>>>propertyId:"+propertyId); -// Map result = new HashMap<>(); -// WxRentContract wxRentContract = wxRentContractMapper.selectById(rentId); -// -// result.put("operationType", wxRentContract.getOperationType()); -// if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { -// JSONArray jsonArray = JSONArray.parseArray(wxRentContract.getRentInfo()); -// StringBuffer shopNumberStr = new StringBuffer(); -// StringBuffer floorNameStr = new StringBuffer(); -// StringBuffer buildingNameStr = new StringBuffer(); -// StringBuffer buildAreaStr = new StringBuffer(); -// StringBuffer operationAreaStr = new StringBuffer(); -// for (int i = 0, size = jsonArray.size(); i < size; i++) { -// JSONObject jsonObject = jsonArray.getJSONObject(i); -// shopNumberStr.append("[").append(jsonObject.getString("shopNumber")).append("]"); -// floorNameStr.append("[").append(jsonObject.getString("floorName")).append("]"); -// buildingNameStr.append("[").append(jsonObject.getString("buildingName")).append("]"); -// buildAreaStr.append("[").append(jsonObject.getString("buildArea")).append("]"); -// operationAreaStr.append("[").append(jsonObject.getString("operationArea")).append("]"); -// } -// result.put("shopNumber", shopNumberStr); -// result.put("floorName", floorNameStr); -// result.put("buildingName", buildingNameStr); -// result.put("buildArea", buildAreaStr); -// result.put("operationArea", operationAreaStr); -// } else { -// //record.setId(wxRentContract.getShopId()); -// if (wxRentContract.shopIdsByRentInfo().size() == 0) { -// result.put("shopNumber", " "); -// result.put("floorName", " "); -// result.put("buildingName", " "); -// result.put("buildArea", " "); -// result.put("operationArea", " "); -// }else { -// WxShop record = new WxShop(); -// record.setIds(wxRentContract.shopIdsByRentInfo()); -// record.updateTenantInfo(wxRentContract); -// PageInfo> shopPageInfo = wxShopService.findListMap(record,1,10000); -// List> wxShops = shopPageInfo.getList(); -// if (!wxShops.isEmpty()) { -// //店铺信息 -// Map wxShop = wxShops.get(0); -// result.put("shopNumber", wxShop.get("shopNumber")); -// result.put("floorName", wxShop.get("floor")); -// result.put("buildingName", wxShop.get("building")); -// result.put("buildArea", wxShop.get("buildArea")); -// result.put("operationArea", wxShop.get("operationArea")); -// } -// } -// } -// //MALL信息 -// WxMall wxMall = new WxMall(); -// wxMall.setTenantInfo(wxRentContract); -// wxMall = wxMallService.findList(wxMall).get(0); -// 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()); -// //经营业态 -// wxRentContract.getMerchantId(); -// WxBusiness wxBusiness = wxBusinessMapper.selectById(merchant.getFinalTenantId(),merchant.getBusinessId()); -// result.put("business", wxBusiness.getTitle()); -// -// if (merchant != null) { -// result.put("merchantName", merchant.getName()); -// //法人信息 -// WxMerchantCorp wxMerchantCorp = merchant.getWxMerchantCorp(); -// result.put("corpPapersNumber", StringUtils.isNotEmpty(wxMerchantCorp.getCorpPapersNumber()) ? wxMerchantCorp.getCorpPapersNumber() : " "); -// result.put("corpPapersType", wxMerchantCorp.getCorpPapersType() != null ? EnumPapersType.getEnum(wxMerchantCorp.getCorpPapersType()).getMessage() : " "); -// result.put("corpPapersPerson", StringUtils.isNotEmpty(wxMerchantCorp.getCorpPapersPerson()) ? wxMerchantCorp.getCorpPapersPerson() : " "); -// //税务信息 -// WxMerchantTax wxMerchantTax = merchant.getWxMerchantTax(); -// result.put("taxPapersType", wxMerchantTax.getTaxPapersType() != null ? EnumTaxpayerType.getEnum(wxMerchantTax.getTaxPapersType()).getMessage() : " "); -// result.put("bankName", StringUtils.isNotEmpty(wxMerchantTax.getBankName()) ? wxMerchantTax.getBankName() : " "); -// result.put("bankAccount", StringUtils.isNotEmpty(wxMerchantTax.getBankAccount()) ? wxMerchantTax.getBankAccount() : " "); -// result.put("invoiceAddressPhone", StringUtils.isNotEmpty(wxMerchantTax.getInvoiceAddressPhone()) ? wxMerchantTax.getInvoiceAddressPhone() : " "); -// } else { -// result.put("merchantName", ""); -// //法人信息 -// result.put("corpPapersNumber", " "); -// result.put("corpPapersType", " "); -// result.put("corpPapersPerson", " "); -// //税务信息 -// result.put("taxPapersType", " "); -// result.put("bankName", " "); -// result.put("bankAccount", " "); -// result.put("invoiceAddressPhone", " "); -// } -// -// //租赁合同信息 -// if(StringUtils.isNotBlank(wxRentContract.getContractualRules())){ -// //{total:,partyA:,partyB:} -// JSONObject jsonObject = JSONObject.parseObject(wxRentContract.getContractualRules()); -// result.put("rentTotal",jsonObject.getString("total")); -// result.put("rentPartyA",jsonObject.getString("partyA")); -// result.put("rentPartyB",jsonObject.getString("partyB")); -// } -// if(StringUtils.isNotBlank(wxRentContract.getBusinessHours())){ -// //{"beginEnd": "00", "finishEnd": "00", "beginStart": "00", "finishStart": "18"} -// JSONObject jsonObject = JSONObject.parseObject(wxRentContract.getBusinessHours()); -// if(!("-1").equals(jsonObject.getString("beginStart")) && !("-1").equals(jsonObject.getString("beginEnd")) -// && !("-1").equals(jsonObject.getString("finishStart")) && !("-1").equals(jsonObject.getString("finishEnd"))){ -// result.put("businessStart",jsonObject.getString("beginStart")+":"+jsonObject.getString("beginEnd")); -// result.put("businessEnd",jsonObject.getString("finishStart")+":"+jsonObject.getString("finishEnd")); -// } -// } -// //甲方信息 -// 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("shopTypeSub",wxRentContract.getShopTypeSub()); -// 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",""); -// } -// -// //物业 -// result.put("propertyName",wxRentContract.getPropertyName()); -// if(wxRentContract.getPropertyFee() != null){ -// double propertyFee = new BigDecimal(wxRentContract.getPropertyFee()) -// .divide(new BigDecimal(100)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("propertyFee",propertyFee); -// } -// if(wxRentContract.getFeeCycle() != null){ -// if(wxRentContract.getFeeCycle().intValue() == 1){ -// result.put("feeCycle","月"); -// }else if(wxRentContract.getFeeCycle().intValue() == 2){ -// result.put("feeCycle","季"); -// }else if(wxRentContract.getFeeCycle().intValue() == 3){ -// result.put("feeCycle","年"); -// } -// } -// if(wxRentContract.getWaterFee() != null){ -// double waterFee = new BigDecimal(wxRentContract.getWaterFee()) -// .divide(new BigDecimal(100)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("waterFee",waterFee); -// } -// if(wxRentContract.getElectricityFees() != null){ -// double electricityFees = new BigDecimal(wxRentContract.getElectricityFees()) -// .divide(new BigDecimal(100)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("electricityFees",electricityFees); -// } -// -// -// -// //交付 -// 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.getStartDate() != null && wxRentContract.getRentalEndDate() != null){ -// String rentalStartDate = DateUtils.date2String(wxRentContract.getStartDate(), "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.getRentalStartDate(), "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"); -// String reductionEndDate = DateUtils.getTimeBefore(1,wxRentContract.getStartDate()); -// 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", "/"); -// } -// -// String shopType4Str = ""; -// if(wxRentContract.getShopType() != null && wxRentContract.getShopType().intValue() == 1){ -// shopType4Str = "直营"; -// }else if(wxRentContract.getShopType() != null && wxRentContract.getShopType().intValue() == 6){ -// shopType4Str = "代理"; -// }else if(wxRentContract.getShopType() != null && wxRentContract.getShopType().intValue() == 2){ -// shopType4Str = "加盟"; -// }else{ -// shopType4Str = "其他("+wxRentContract.getShopTypeStr()+")"; -// } -// result.put("shopType4Str",shopType4Str); -// -// -// -// -// result.put("price", wxRentContract.getPrice()); -// result.put("contractNumber", wxRentContract.getContractNumber()); -// Integer lease = wxRentContract.getLease(); -// Integer receivePeriod = wxRentContract.getReceivePeriod(); -// result.put("lease", lease); -// result.put("receivePeriod", receivePeriod); -// String payAccountStr = " "; -// if(wxRentContract.getPayAccount() != null && !wxRentContract.getPayAccount().equals("")) { -// payAccountStr = wxRentContract.getPayAccount(); -// } -// result.put("payAccount", payAccountStr); -// result.put("signDate", DateUtils.date2String(wxRentContract.getSignDate(), "yyyy-MM-dd")); -// //主体名称-乙方 -// if (StringUtils.isNotEmpty(wxRentContract.getSubjectName())) { -// result.put("subjectName", wxRentContract.getSubjectName()); -// } else { -// result.put("subjectName", " "); -// } -// -// //品牌 -// Long brandId = wxRentContract.getBrand(); -// String brand = " "; -// if (brandId != null) { -// WxBrand wxBrand = WxBrandMapper.selectById(brandId); -// if (wxBrand != null) { -// brand = wxBrand.getName(); -// } -// } -// result.put("brand", brand); -// 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")); -// if(StringUtils.isNotBlank(jsonObject.getString("honourPledge"))){ -// result.put("honourPledgeUpper",PriceUtil.digitUppercase(Double.valueOf(jsonObject.getString("honourPledge")))); -// } -// result.put("honourDuration",jsonObject.getString("honourDuration")); -// result.put("qualityPledge",jsonObject.getString("qualityPledge")); -// if(StringUtils.isNotBlank(jsonObject.getString("qualityPledge"))){ -// result.put("honourPledgeUpper",PriceUtil.digitUppercase(Double.valueOf(jsonObject.getString("qualityPledge")))); -// } -// result.put("qualityDuration",jsonObject.getString("qualityDuration")); -// -// } -// //[{"progressivePay": "", "tempAdjustRatio": "2021-11-30 00:00:00", "incrementStartDate": "2021-11-29T16:00:00.000Z", "increasingProportion": "1.78"}] -// //increasingProportion//租金递增比例 -// //progressivePay//递增租赁单价 -// List> ratioList = new ArrayList<>(); -// if(StringUtils.isNotBlank(wxRentContract.getAdjustRatio())){ -// JSONArray array = JSONArray.parseArray(wxRentContract.getAdjustRatio()); -// if(array != null && array.size() > 0){ -// for(int i=0;i ratioMap = new HashMap<>(); -// String afterYear = DateUtils.getAfterYear(wxRentContract.getStartDate(), i + 1); -// String beforeAfterYear = DateUtils.getTimeBefore(1, afterYear); -// ratioMap.put("incrementStartDate",afterYear); -// ratioMap.put("beforeOneIncrementStartDate",beforeAfterYear); -// ratioMap.put("increasingProportion",jsonObject.getString("increasingProportion")); -// ratioMap.put("progressivePay",jsonObject.getString("progressivePay")); -// ratioList.add(ratioMap); -// } -// } -// } -// } -// result.put("countRatioList",ratioList.size()); -// -// if(EnumRentContractType.RENT_BY_AREA.getCode().equals(type)){ -// -// 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)); -// -// double oneRentPrice = new BigDecimal(wxRentContract.getRentPrice()) -// .divide(new BigDecimal(100)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("oneRentPrice",oneRentPrice); -// -// WxBillRent wxBillRent = new WxBillRent(); -// wxBillRent.setRentContractId(wxRentContract.getId()); -// wxBillRent.setSortColumns(BaseEntity.SortField.Period_ASC); -// List resultList = wxBillRentMapper.findList(wxBillRent); -// //稍后详细计算(查询首期账单用于显示) -// if(resultList != null && resultList.size() > 0){ -// double oneRentalQuarterPrice1 = new BigDecimal(resultList.get(0).getReceivePay()) -// .divide(new BigDecimal(100)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("oneRentalQuarterPrice1", oneRentalQuarterPrice1); -// result.put("oneRentalQuarterPriceUpper1", PriceUtil.digitUppercase(oneRentalQuarterPrice1)); -// } -// -// if(ratioList.size() > 0){ -// String beforeOneIncrementStartDate = ratioList.get(0).get("beforeOneIncrementStartDate"); -// result.put("oneRentalEndDateYear1",beforeOneIncrementStartDate.substring(0,4)); -// result.put("oneRentalEndDateMonth1",beforeOneIncrementStartDate.substring(5,7)); -// result.put("oneRentalEndDateDay1",beforeOneIncrementStartDate.substring(8,10)); -// -// String incrementStartDate = ratioList.get(0).get("incrementStartDate"); -// result.put("oneRentalStartDateYear2",incrementStartDate.substring(0,4)); -// result.put("oneRentalStartDateMonth2",incrementStartDate.substring(5,7)); -// result.put("oneRentalStartDateDay2",incrementStartDate.substring(8,10)); -// String increasingProportion = ratioList.get(0).get("increasingProportion"); -// result.put("oneRentIncreasing2",increasingProportion); -// double priceRent2 = new BigDecimal(priceRent) -// .multiply(new BigDecimal(1).add(new BigDecimal(increasingProportion).divide(new BigDecimal(100)))) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("oneRentalPrice2", priceRent2); -// result.put("oneRentalPriceUpper2", PriceUtil.digitUppercase(priceRent2)); -// -// if(ratioList.size() > 1){ -// for (int i = 1;i < ratioList.size();i++){ -// int n = i+2; -// String incrementStartDaten = ratioList.get(i).get("incrementStartDate"); -// result.put("oneRentalStartDateYear"+n,incrementStartDaten.substring(0,4)); -// result.put("oneRentalStartDateMonth"+n,incrementStartDaten.substring(5,7)); -// result.put("oneRentalStartDateDay"+n,incrementStartDaten.substring(8,10)); -// String increasingProportionn = ratioList.get(i).get("increasingProportion"); -// result.put("oneRentIncreasing"+n,increasingProportionn); -// priceRent2 = new BigDecimal(priceRent2) -// .multiply(new BigDecimal(1).add(new BigDecimal(increasingProportionn).divide(new BigDecimal(100)))) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("oneRentalPrice"+n, priceRent2); -// result.put("oneRentalPriceUpper"+n, PriceUtil.digitUppercase(priceRent2)); -// } -// } -// -// }else{ -// String rentalEndDate = DateUtils.date2String(wxRentContract.getRentalEndDate(), "yyyy-MM-dd"); -// result.put("oneRentalStartDateYear1", rentalEndDate.substring(0, 4)); -// result.put("oneRentalStartDateMonth1", rentalEndDate.substring(5, 7)); -// result.put("oneRentalStartDateDay1", rentalEndDate.substring(8)); -// } -// -// -// }else if(EnumRentContractType.RENT_BY_JOINT.getCode().equals(type)){ -// Double twoPayRatio1 = new BigDecimal(wxRentContract.getPayRatio()) -// .divide(new BigDecimal(100)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("twoPayRatio1",twoPayRatio1); -// result.put("twoPayDate",wxRentContract.getPayDate()); -// if(ratioList.size() > 0){ -// String beforeOneIncrementStartDate = ratioList.get(0).get("beforeOneIncrementStartDate"); -// result.put("twoRentalEndDateYear1",beforeOneIncrementStartDate.substring(0,4)); -// result.put("twoRentalEndDateMonth1",beforeOneIncrementStartDate.substring(5,7)); -// result.put("twoRentalEndDateDay1",beforeOneIncrementStartDate.substring(8,10)); -// String incrementStartDate = ratioList.get(0).get("incrementStartDate"); -// result.put("twoRentalStartDateYear2",incrementStartDate.substring(0,4)); -// result.put("twoRentalStartDateMonth2",incrementStartDate.substring(5,7)); -// result.put("twoRentalStartDateDay2",incrementStartDate.substring(8,10)); -// String increasingProportion = ratioList.get(0).get("increasingProportion"); -// result.put("twoRentIncreasing2",increasingProportion); -//// Double twoPayRatio2 = new BigDecimal(twoPayRatio1) -//// .add(new BigDecimal(increasingProportion)) -//// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("twoPayRatio2",twoPayRatio1); -// -// if(ratioList.size() > 1){ -// for (int i = 1;i < ratioList.size();i++){ -// int n = i+2; -// String incrementStartDaten = ratioList.get(i).get("incrementStartDate"); -// result.put("twoRentalStartDateYear"+n,incrementStartDaten.substring(0,4)); -// result.put("twoRentalStartDateMonth"+n,incrementStartDaten.substring(5,7)); -// result.put("twoRentalStartDateDay"+n,incrementStartDaten.substring(8,10)); -// String increasingProportionn = ratioList.get(i).get("increasingProportion"); -// result.put("twoRentIncreasing"+n,increasingProportionn); -//// Double twoPayRatio2 = new BigDecimal(twoPayRatio1) -//// .add(new BigDecimal(increasingProportion)) -//// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("twoPayRatio"+n,twoPayRatio1); -// } -// } -// -// }else{ -// String rentalEndDate = DateUtils.date2String(wxRentContract.getRentalEndDate(), "yyyy-MM-dd"); -// result.put("twoRentalStartDateYear1", rentalEndDate.substring(0, 4)); -// result.put("twoRentalStartDateMonth1", rentalEndDate.substring(5, 7)); -// result.put("twoRentalStartDateDay1", rentalEndDate.substring(8)); -// } -// -// }else if(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode().equals(type)){ -// double priceRent = new BigDecimal(wxRentContract.getPrice()) -// .divide(new BigDecimal(100)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("threeRentalPrice1", priceRent); -// result.put("threeRentalPriceUpper1", PriceUtil.digitUppercase(priceRent)); -// -// double threeRentPrice = new BigDecimal(wxRentContract.getRentPrice()) -// .divide(new BigDecimal(100)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("threeRentPrice",threeRentPrice); -// double threePayRatio1 = new BigDecimal(wxRentContract.getPayRatio()) -// .divide(new BigDecimal(100)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("threePayRatio1",threePayRatio1); -// -// result.put("threePayDate",wxRentContract.getPayDate()); -// if(ratioList.size() > 0){ -// String beforeOneIncrementStartDate = ratioList.get(0).get("beforeOneIncrementStartDate"); -// result.put("threeRentalEndDateYear1",beforeOneIncrementStartDate.substring(0,4)); -// result.put("threeRentalEndDateMonth1",beforeOneIncrementStartDate.substring(5,7)); -// result.put("threeRentalEndDateDay1",beforeOneIncrementStartDate.substring(8,10)); -// String incrementStartDate = ratioList.get(0).get("incrementStartDate"); -// result.put("threeRentalStartDateYear2",incrementStartDate.substring(0,4)); -// result.put("threeRentalStartDateMonth2",incrementStartDate.substring(5,7)); -// result.put("threeRentalStartDateDay2",incrementStartDate.substring(8,10)); -// String progressivePay = ratioList.get(0).get("progressivePay"); -// double threeProgressivePay2 = new BigDecimal(progressivePay) -// .multiply(new BigDecimal(wxRentContract.getRentArea())) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("threeProgressivePay2",threeProgressivePay2); -// result.put("threeProgressivePayUpper2",PriceUtil.digitUppercase(threeProgressivePay2)); -// result.put("threeRentPrice2",progressivePay); -// String increasingProportion = ratioList.get(0).get("increasingProportion"); -// result.put("threeRentIncreasing2",increasingProportion); -// if(ratioList.size() > 1){ -// for (int i = 1;i < ratioList.size();i++){ -// int n = i+2; -// String incrementStartDaten = ratioList.get(i).get("incrementStartDate"); -// result.put("threeRentalStartDateYear"+n,incrementStartDaten.substring(0,4)); -// result.put("threeRentalStartDateMonth"+n,incrementStartDaten.substring(5,7)); -// result.put("threeRentalStartDateDay"+n,incrementStartDaten.substring(8,10)); -// String progressivePayn = ratioList.get(i).get("progressivePay"); -// double threeProgressivePayn = new BigDecimal(progressivePayn) -// .multiply(new BigDecimal(wxRentContract.getRentArea())) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("threeProgressivePay"+n,threeProgressivePayn); -// result.put("threeProgressivePayUpper"+n,PriceUtil.digitUppercase(threeProgressivePayn)); -// result.put("threeRentPrice"+n,progressivePayn); -// String increasingProportionn = ratioList.get(i).get("increasingProportion"); -// result.put("threeRentIncreasing"+n,increasingProportionn); -// } -// } -// }else{ -// String rentalEndDate = DateUtils.date2String(wxRentContract.getRentalEndDate(), "yyyy-MM-dd"); -// result.put("threeRentalStartDateYear1", rentalEndDate.substring(0, 4)); -// result.put("threeRentalStartDateMonth1", rentalEndDate.substring(5, 7)); -// result.put("threeRentalStartDateDay1", rentalEndDate.substring(8)); -// } -// -// } -// }else{ -// //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; -// BigDecimal cashDepositRent = new BigDecimal(wxRentContract.getPrice()).multiply(new BigDecimal(cashDepositMonthRent)) -// .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN); -// result.put("cashDepositMonthRent", cashDepositMonthRent); -// result.put("cashDepositRent", cashDepositRent.toPlainString()); -// result.put("cashDepositRentUpper", PriceUtil.digitUppercase(cashDepositRent.setScale(2,RoundingMode.HALF_EVEN).longValue())); -// -// 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", wxRentContract.getRevenue()); -// result.put("revenueUpper", PriceUtil.digitUppercase(new BigDecimal(wxRentContract.getRevenue()) -// .setScale(2,RoundingMode.HALF_EVEN).longValue())); -// } 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); -// //propertyContract.setRentContractId(wxRentContract.getId()); -//// Optional> first = wxPropertyContractMapper.queryPropertyContractData(propertyContract) -//// .stream().filter(rc -> !rc.get("status").equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) -//// && !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode()) -//// && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) -//// && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode()) -//// && !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode())).findFirst(); -// //Optional> first = wxPropertyContractMapper.queryPropertyContractData(propertyContract) -// //.stream().filter(rc -> !rc.get("status").equals(EnumRentContractStatus.TERMINATE.getCode()) -// // && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) -// // && !rc.get("status").equals(EnumRentContractStatus.OUT_DATE.getCode())).findFirst(); -// // Map wxPropertyContract = null; -// // if (first.isPresent()) { -// // wxPropertyContract = first.get(); -// // } -// WxPropertyContract propertyContract = null; -// if (null != propertyId) { -// propertyContract = wxPropertyContractMapper.selectById(propertyId); -// } -// if (propertyContract != null) { -// Integer receivePeriodProperty = propertyContract.getReceivePeriod(); -// result.put("receivePeriodProperty", receivePeriodProperty); -// double priceProperty = new BigDecimal(propertyContract.getPrice().toString()) -// .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("priceProperty", priceProperty); -// if (!wxRentContract.getRentArea().equals("0")) { -// double unitPriceProperty = new BigDecimal(propertyContract.getPrice().toString()) -// .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) -// .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("unitPriceProperty", unitPriceProperty); -// result.put("pricePropertyUpper", PriceUtil.digitUppercase(priceProperty)); -// result.put("unitPricePropertyUpper", PriceUtil.digitUppercase(unitPriceProperty)); -// } else { -// result.put("unitPriceProperty", 0); -// result.put("pricePropertyUpper", PriceUtil.digitUppercase(0)); -// result.put("unitPricePropertyUpper", PriceUtil.digitUppercase(0)); -// } -// -// //首期物业费 -// Calendar instance = Calendar.getInstance(); -// instance.setTime(wxRentContract.getRentalStartDate()); -// instance.add(Calendar.MONTH, 0); -// Date starttime = instance.getTime(); -// String startdate = DateUtils.date2String(starttime, "yyyy-MM-dd"); -// result.put("rentalStartDateProperty", startdate); -// result.put("rentalStartDateYearProperty", startdate.substring(0, 4)); -// result.put("rentalStartDateMonthProperty", startdate.substring(5, 7)); -// result.put("rentalStartDateDayProperty", startdate.substring(8)); -// //结束时间 -// instance.clear(); -// instance.setTime(starttime); -// instance.add(Calendar.MONTH, receivePeriodProperty); -// instance.add(Calendar.DAY_OF_MONTH, -1); -// Date endtime = instance.getTime(); -// String enddate = DateUtils.date2String(endtime, "yyyy-MM-dd"); -// result.put("rentalEndDateProperty", enddate); -// result.put("rentalEndDateYearProperty", enddate.substring(0, 4)); -// result.put("rentalEndDateMonthProperty", enddate.substring(5, 7)); -// result.put("rentalEndDateDayProperty", enddate.substring(8)); -// double pricePropertyFirst = new BigDecimal(priceProperty) -// .multiply(new BigDecimal(receivePeriodProperty)) -// .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("pricePropertyFirst", pricePropertyFirst); -// result.put("pricePropertyFirstUpper", PriceUtil.digitUppercase(pricePropertyFirst)); -// -// -// //物业保证金 -// int cashDepositMonthProperty = 3; -// double cashDepositProperty = new BigDecimal(propertyContract.getPrice().toString()).multiply(new BigDecimal(cashDepositMonthProperty)) -// .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); -// result.put("cashDepositMonthProperty", cashDepositMonthProperty); -// result.put("cashDepositProperty", cashDepositProperty); -// result.put("cashDepositPropertyUpper", PriceUtil.digitUppercase(cashDepositProperty)); -// -// -// } else { -// result.put("receivePeriodProperty", " "); -// result.put("priceProperty", " "); -// result.put("unitPriceProperty", " "); -// result.put("pricePropertyUpper", " "); -// result.put("unitPricePropertyUpper", " "); -// //首期物业费 -// result.put("rentalStartDateProperty", " "); -// result.put("rentalStartDateYearProperty", " "); -// result.put("rentalStartDateMonthProperty", " "); -// result.put("rentalStartDateDayProperty", " "); -// //结束时间 -// result.put("rentalEndDateProperty", " "); -// result.put("rentalEndDateYearProperty", " "); -// result.put("rentalEndDateMonthProperty", " "); -// result.put("rentalEndDateDayProperty", " "); -// result.put("pricePropertyFirst", " "); -// result.put("pricePropertyFirstUpper", " "); -// //物业保证金 -// result.put("cashDepositMonthProperty", " "); -// result.put("cashDepositProperty", " "); -// result.put("cashDepositPropertyUpper", " "); -// } -// -// -// return result; -// } - -// public void ratioWay(WxRentContract wxRentContract, Map result, Integer lease, int extralease, int extracount, int paycount, int index, int count, BigDecimal rentPrice) { -// String adjustRatio = wxRentContract.getAdjustRatio(); -// List integers = JSONArray.parseArray(adjustRatio, Integer.class); -// integers.add(0, 0); -// //常规租期 -// 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)); -// String ratio = new BigDecimal(integers.get(i)).divide(new BigDecimal(100)).toPlainString(); -// result.put("adjustRatio" + i, ratio); -// result.put("adjustPeriod" + i, wxRentContract.getAdjustPeriod()); -// Integer tempPayRatio = Optional.ofNullable(wxRentContract.getPayRatio()).orElse(0); -// String payRatio = new BigDecimal(tempPayRatio).divide(new BigDecimal(100)).toPlainString(); -// result.put("payRatio" + i, payRatio); -// -// } -// 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)); -// result.put("adjustRatio" + count, wxRentContract.getAdjustRatio()); -// result.put("adjustPeriod" + count, wxRentContract.getAdjustPeriod()); -// Integer tempPayRatio = Optional.ofNullable(wxRentContract.getPayRatio()).orElse(0); -// String payRatio = new BigDecimal(tempPayRatio).divide(new BigDecimal(100)).toPlainString(); -// result.put("payRatio" + count, payRatio); -// -// } -// //无数据租期 -// 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("adjustRatio" + i, "/"); -// result.put("adjustPeriod" + i, "/"); -// result.put("payRatio" + i, "/"); -// } -// } - 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[]{}; @@ -3077,42 +2048,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { return wxRentContractMapper.getByBill(billRent); } -// @Override -// public Map selectRentContractByShopIds(Collection shopIds, String shopIdsRegexp, TenantEntity tenantEntity) { -// List list = wxRentContractMapper.selectRentContractByShopIds(shopIds, shopIdsRegexp, tenantEntity.getTenantId(), tenantEntity.getParentTenantId()); -// List shopIdArr = Arrays.asList(StringUtils.split(shopIdsRegexp,"|")) ; -// Map allShopContract = new HashMap<>(); -// for (WxRentContract wxRentContract : list) { -// if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { -// String rentInfo = wxRentContract.getRentInfo(); -// JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); -// int size = rentInfoArray.size(); -// //查询rent_info 包括 shopId -// for (int i = 0; i < size; i++) { -// JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); -// Long shopId = rentInfoObject.getLong("shopId"); -// if (!shopIdArr.contains(String.valueOf(shopId))) { -// continue; -// } -// WxRentContract rentContract = new WxRentContract(); -// BeanUtils.copyProperties(wxRentContract,rentContract); -// rentContract.setRentalStartDate(wxRentContract.getRentalStartDate()); -// rentContract.setRentalEndDate(wxRentContract.getRentalEndDate()); -// rentContract.setShopId(shopId); -// allShopContract.put(shopId, rentContract); -// } -// } -// if (shopIds.contains(wxRentContract.getShopId())) { -// allShopContract.put(wxRentContract.getShopId(), wxRentContract); -// } -// } -// return allShopContract; -// } - -// @Override -// public int selectContractCountByShopId(WxRentContract wxRentContract) { -// return wxRentContractMapper.selectContractCountByShopId(wxRentContract) ; -// } @Override public ResultData getContractByContractNumber(WxRentContract rentContract) { @@ -3335,75 +2270,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { return wxRentContractMapper.findList(wrc); } - public static void main(String[] args) { - System.out.println(DateUtils.getDayBegin(DateUtils.getFirstDayOfNextMonth(new Date(),-1))); - } - @Override public void calcuteByTradeDaily(WxRentContract wxRentContract) { -// WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract); -// //查询合同下截止时间为昨天的账单 -// WxBillRent bq = new WxBillRent(); -// bq.updateTenantInfo(wxRentContract); -// bq.setRentContractId(wxRentContract.getId()); -// bq.setIsPreview(EnumIsPreview.NO.getCode()); -// Date current = new Date(); -// //从上个月1号开始的都更新 -// bq.setEndtimeBegin(DateUtils.getDayBegin(DateUtils.getFirstDayOfNextMonth(current,-1))); -// bq.setEndtimeEnd(current); -// bq.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// List billList = wxBillRentMapper.findList(bq); -// if (null != billList && billList.size() > 0 ) { -// for (int j = 0 ; j < billList.size(); j++) { -// WxBillRent br = billList.get(j); -// try { -// //判断账单是否跨月,如果跨月,需要按照每月来查询解单金额 -// BigDecimal needPay = new BigDecimal(0) ; -// int months = DateUtils.monthsBetween(br.getStarttime(), br.getEndtime()); -// if ( months > 0 ) { -// for (int i = 0 ; i <= months ; i++ ) { -// BigDecimal _money = new BigDecimal(0); -// if (i == 0 ) { -// _money = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(), br.getStarttime(), -// DateUtils.getLastDayForMonth(br.getStarttime())); -// }else if (i == months){ -// _money = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(), -// DateUtils.getFirstDayForCurrMonth(DateUtils.getTimeAfterMonths(i,br.getStarttime())), -// DateUtils.getDayEnd(DateUtils.getTimeAfterDays(-1, br.getEndtime()))); -// }else { -// Date _date = DateUtils.getTimeAfterMonths(i,br.getStarttime()); -// _money = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(), -// DateUtils.getFirstDayForCurrMonth(_date), -// DateUtils.getLastDayForMonth(_date)); -// } -// needPay = needPay.add(_money); -// } -// }else { -// //同一个月 -// //合同账单结束的时间是00:00:00,取日期要取前一天 -// needPay = sumTradeDailyBySameMonthDay(Constant.default_long_decimal_size,bq, wxRentContract.getMerchantId(), -// br.getStarttime(), DateUtils.getDayEnd(br.getEndtime())); -// } -// needPay = needPay.multiply(new BigDecimal(wxRentContract.getPayRatio())) -// .divide(new BigDecimal(10000), wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); -// String oldNeedPay = br.getNeedPay(); -// if (needPay.compareTo(new BigDecimal(br.getNeedPay())) > 0) { -// br.setNeedPay(needPay.toPlainString()); -// //br.setOwe(needPay.toPlainString()); -// br.setReceivePay(needPay.toPlainString()); -// br.setUpdatetime(new Date()); -// BigDecimal servicePay = new BigDecimal(br.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP); -// br.setServiceChargePay(servicePay.toPlainString()); -// //br.setOwe(new BigDecimal(br.getReceivePay()).add(new BigDecimal(br.getServiceChargePay())).toPlainString()); -// //br.setOwe(new BigDecimal(br.getReceivePay()).toPlainString()); -// br.setComments("原金额["+oldNeedPay+"(分)]小于解单金额["+needPay+"(分)],系统自动更新"); -// wxBillRentMapper.updateById(br); -// } -// }catch(Exception e) { -// logger.error("calcuteByTradeDaily error:"+br.getId(),e); -// } -// } -// } } private BigDecimal sumTradeDailyBySameMonthDay(Integer decimalSize,TenantEntity tenantEntity,Long merchantId,Date begin ,Date end) { @@ -3457,4 +2325,68 @@ public class WxRentContractServiceImpl implements WxRentContractService { //wxBillRentManage.setManageFeeType(EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode()); //wxBillRentManageMapper.deletePreviewBill(wxBillRentManage); } + + @Override + public List getFreePeriods(WxRentContract wxRentContract) { + int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate()); + int months = array[0]; + int years = 0; + if ( months % 12 == 0) { + years = months / 12; + }else { + years = months / 12 + 1; + } + if (years == 0) { + years = 1; + } + Date start = wxRentContract.getRentalStartDate(); + List volist = new ArrayList(); + for (int i = 0 ; i < years; i ++) { + RentContractFreePeriodVo vo = new RentContractFreePeriodVo(); + vo.setYearIndex(i+1); + vo.setStart(start); + if (i == years-1) { + vo.setEnd(wxRentContract.getRentalEndDate()); + }else { + start = DateUtils.getTimeAfterDays(365*(i+1)+1,wxRentContract.getRentalStartDate()); + vo.setEnd(start); + } + WxRentContractFreePeriod fpq = new WxRentContractFreePeriod(); + fpq.updateTenantInfo(wxRentContract); + fpq.setRentContractId(wxRentContract.getId()); + fpq.setYearIndex(i+1); + vo.setPeriods(wxRentContractFreePeriodMapper.findList(fpq)); + volist.add(vo); + } + return volist; + } + + @Override + public void saveFreePeriods(WxRentContract wxRentContract) { + WxRentContractFreePeriod del = new WxRentContractFreePeriod(); + del.updateTenantInfo(wxRentContract); + del.setRentContractId(wxRentContract.getId());; + wxRentContractFreePeriodMapper.deleteByContract(del); + List volist = wxRentContract.getFreePeriods(); + if (null != volist && volist.size() > 0 ) { + List fpList = new ArrayList(); + for (int i = 0 ; i < volist.size() ; i ++) { + RentContractFreePeriodVo vo = volist.get(i); + if (null != vo.getPeriods()) { + for (int j = 0 ; j < vo.getPeriods().size(); j++ ){ + WxRentContractFreePeriod fp = vo.getPeriods().get(j); + final IdWorker idWorker = IdWorker.get(); + fp.setId(idWorker.nextId()); + fp.setYearIndex(vo.getYearIndex()); + fp.setCreateTime(new Date()); + fp.setUpdateTime(new Date()); + fp.setRentContractId(wxRentContract.getId()); + fpList.add(fp); + } + } + } + wxRentContractFreePeriodMapper.inertPeriods(wxRentContract.getTenantId(), fpList); + } + + } } diff --git a/mallinkService/src/main/resources/mapper/WxRentContractFreePeriodMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractFreePeriodMapper.xml new file mode 100644 index 000000000..38782e40f --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxRentContractFreePeriodMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`start_date`,`end_date`,`rent_contract_id`,`year_index` + + + + where 1=1 + and `id` = #{id} + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + and `rent_contract_id` = #{rentContractId} + and `year_index` = #{yearIndex} + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + INSERT INTO wx_rent_contract_free_period ( + + ) + VALUES + + ( + #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.createTime},#{item.updateTime}, + #{item.startDate},#{item.endDate},#{item.rentContractId},#{item.yearIndex} + ) + + + + + delete from wx_rent_contract_free_period where `rent_contract_id` = #{rentContractId} + + +