Просмотр исходного кода

fix property contract

release_toaliyun_real
winter 1 год назад
Родитель
Сommit
763d16facc
7 измененных файлов: 277 добавлений и 144 удалений
  1. +72
    -18
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java
  2. +50
    -19
      mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java
  3. +35
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumPropertyCreateType.java
  4. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java
  5. +91
    -88
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  6. +15
    -16
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  7. +13
    -2
      mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml

+ 72
- 18
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java Просмотреть файл

@@ -28,6 +28,8 @@ import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -161,14 +163,21 @@ public class WxPropertyContractController extends WxContractBaseController {
}

@PostMapping("add")
@SystemControllerLog(description = "物业合同-新增")
public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) {
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::add");
MallUserInfo user = getUser();
wxPropertyContract.updateTenantInfo(user);
wxPropertyContract.setAdjustPeriodHandle();
WxRentContract rentContract = rentContractService.getSimpleDeatil(wxPropertyContract.getRentContractId());
wxPropertyContract.calcutePrice(rentContract);
if (wxPropertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) {
if (StringUtils.isBlank(wxPropertyContract.getRentArea()) || StringUtils.isBlank(wxPropertyContract.getShopIds())) {
return new ResultData("rentArea,shopIds参数不能为空");
}
wxPropertyContract.setShopIds(","+wxPropertyContract.getShopIds()+",");
wxPropertyContract.calcutePrice(wxPropertyContract.getRentArea());
}else {
WxRentContract rentContract = rentContractService.getSimpleDeatil(wxPropertyContract.getRentContractId());
wxPropertyContract.calcutePrice(rentContract.getRentArea());
}
Integer contractType = wxRentPropertyContractService.getContractType(wxPropertyContract.getRentShopType(), wxPropertyContract.getOperationType(), EnumContractType.PROPERTY.getCode());
wxPropertyContract.setContractType(contractType);
if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){
@@ -177,22 +186,25 @@ public class WxPropertyContractController extends WxContractBaseController {
return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),false);
}

//物业合同-更新租赁开始日期
@PostMapping("updateRentStartTime")
@SystemControllerLog(description = "物业合同-更新租赁开始日期")
public ResultData updateRentStartTime(@RequestBody WxPropertyContract wxPropertyContract) {
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::updateRentStartTime");
WxPropertyContract propertyContract = wxPropertyContractMapper.selectById(wxPropertyContract.getId());
MallUserInfo user = getUser();
propertyContract.updateTenantInfo(user);
propertyContract.setAdjustPeriodHandle();
WxRentContract rentContract = rentContractService.getSimpleDeatil(propertyContract.getRentContractId());
wxPropertyContract.calcutePrice(rentContract);
if (propertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) {
propertyContract.calcutePrice(propertyContract.getRentArea());
}else {
WxRentContract rentContract = rentContractService.getSimpleDeatil(propertyContract.getRentContractId());
wxPropertyContract.calcutePrice(rentContract.getRentArea());
}
propertyContract.setRentStartType(wxPropertyContract.getRentStartType());
return wxPropertyContractService.saveOrUpdate(propertyContract, user.getId(), user.getName(),false);
}

@PostMapping("update")
@SystemControllerLog(description = "物业合同-修改")
@PostMapping("update-第三步")
public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) {
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::update");
MallUserInfo user = getUser();
@@ -209,8 +221,18 @@ public class WxPropertyContractController extends WxContractBaseController {
*/
@PostMapping("calcutePrice")
public ResultData calcutePrice(@RequestBody WxPropertyContract wxPropertyContract) {
WxRentContract rentContract = rentContractService.getSimpleDeatil(wxPropertyContract.getRentContractId());
wxPropertyContract.calcutePrice(rentContract);
if (null == wxPropertyContract.getCreateType()) {
return new ResultData("createType参数不能为空");
}
if (wxPropertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) {
if (StringUtils.isBlank(wxPropertyContract.getRentArea())) {
return new ResultData("rentArea,shopIds参数不能为空");
}
wxPropertyContract.calcutePrice(wxPropertyContract.getRentArea());
}else {
WxRentContract rentContract = rentContractService.getSimpleDeatil(wxPropertyContract.getRentContractId());
wxPropertyContract.calcutePrice(rentContract.getRentArea());
}
return new ResultData(wxPropertyContract.getPrice());
}
@@ -305,13 +327,43 @@ public class WxPropertyContractController extends WxContractBaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"租赁合同状态为草稿才能进行此操作");
}
if (rentHasValidProperty(contract)) {
return new ResultData(Result.ERROR, "租金合同["+contract.getContractNumber()+"]存在有效或者审批中的物业合同。");
if (contract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) {
if (shopHasValidProperty(contract)) {
return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同。");
}
}else {
if (rentHasValidProperty(contract)) {
return new ResultData(Result.ERROR, "租金合同["+contract.getContractNumber()+"]存在有效或者审批中的物业合同。");
}
}
wxPropertyContractService.updatePropertyContractStatus(proertyContract.getId());
return new ResultData(Result.SUCCESS,"合同生效成功!");
}
private boolean shopHasValidProperty(WxPropertyContract contract) {
WxPropertyContract wpc = new WxPropertyContract();
String[] shopIds = contract.getShopIds().split(",");
List<Long> sidl = new ArrayList<Long>();
for (String sid : shopIds) {
if (StringUtils.isNotBlank(sid)) {
sidl.add(Long.parseLong(sid));
}
}
if (sidl.size() == 0 ) {
return false;
}
wpc.setShopIdsQuery(sidl);
List<Integer> statuss = EnumRentContractStatus.getValidStatus();
statuss.add(EnumRentContractStatus.PERFORMANCE.getCode());
wpc.setStatuss(statuss);
List<WxPropertyContract> list = wxPropertyContractService.findList(wpc);
if (null != list && list.size() > 0 ) {
return true;
}
return false;
}
private boolean rentHasValidProperty(WxPropertyContract contract) {
WxPropertyContract wpc = new WxPropertyContract();
wpc.setRentContractId(contract.getRentContractId());
@@ -339,8 +391,14 @@ public class WxPropertyContractController extends WxContractBaseController {
return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"物业合同不存在工作流,不能提交审批。");
}
if (rentHasValidProperty(contract)) {
return new ResultData(Result.ERROR, "租金合同["+contract.getContractNumber()+"]存在有效或者审批中的物业合同。");
if (contract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) {
if (shopHasValidProperty(contract)) {
return new ResultData(Result.ERROR, "店铺存在有效或者审批中的物业合同。");
}
}else {
if (rentHasValidProperty(contract)) {
return new ResultData(Result.ERROR, "租金合同["+contract.getContractNumber()+"]存在有效或者审批中的物业合同。");
}
}
if(contract.getOperationType().intValue() == EnumContractOperationType.PART.getCode().intValue()) {
@@ -372,7 +430,6 @@ public class WxPropertyContractController extends WxContractBaseController {


@RequestMapping("/download")
@SystemControllerLog(description = "物业合同-下载")
public void download(HttpServletRequest request, HttpServletResponse response) {
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::download");
wxPropertyContractService.download(request, response);
@@ -404,7 +461,6 @@ public class WxPropertyContractController extends WxContractBaseController {

@GetMapping("/hasRentContract")
@ApiImplicitParam(name = "rentContractId", value = "rentContractId", dataType = "Long", paramType = "query", required = true)
@SystemControllerLog(description = "物业合同-是否存在相关的租赁合同")
public ResultData hasRentContract(Long rentContractId) {
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::hasRentContract");
//return wxPropertyContractService.hasRentContract(rentContractId);
@@ -413,7 +469,6 @@ public class WxPropertyContractController extends WxContractBaseController {

@PostMapping("updatePropertyContractStatus")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
@SystemControllerLog(description = "物业合同-更新合同状态")
public ResultData updatePropertyContractStatus(@RequestBody WxPropertyContract wxPropertyContract) {
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::updateRentContractStatus");
//return wxPropertyContractService.updatePropertyContractStatus(wxPropertyContract.getId());
@@ -426,7 +481,6 @@ public class WxPropertyContractController extends WxContractBaseController {
* @return
*/
@PostMapping("buildBillPriceList")
@SystemControllerLog(description = "物业合同-生成账单列表金额")
public ResultData buildBillPriceList(@RequestBody WxPropertyContract wxPropertyContract) throws Exception{
logger.debug("[" + getIpAddr() + "] WxRentContractController::buildBillPriceList");
WxPropertyContract dbRent = wxPropertyContractMapper.selectById(wxPropertyContract.getId());


+ 50
- 19
mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java Просмотреть файл

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumPriceUnit;
import com.iformall.enums.EnumPropertyCreateType;
import com.iformall.enums.EnumRentContractAdjustPeriod;
import com.iformall.enums.EnumYesOrNo;

@@ -20,6 +21,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;

/**
@@ -55,10 +57,10 @@ public class WxPropertyContract extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="物业费(分)",name="price")
private String price;

@io.swagger.annotations.ApiModelProperty(value="租开始时间",name="rentalStartDate")
@io.swagger.annotations.ApiModelProperty(value="租开始时间",name="rentalStartDate")
private Date rentalStartDate;

@io.swagger.annotations.ApiModelProperty(value="租结束时间",name="rentalEndDate")
@io.swagger.annotations.ApiModelProperty(value="租结束时间",name="rentalEndDate")
private Date rentalEndDate;

@io.swagger.annotations.ApiModelProperty(value="签定合同时间",name="signDate")
@@ -132,10 +134,10 @@ public class WxPropertyContract extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId")
private Long rentContractId;

@io.swagger.annotations.ApiModelProperty(value = "起租开始时间", name = "rentalStartDate")
@io.swagger.annotations.ApiModelProperty(value = "计租日", name = "startDate")
private Date startDate;

@io.swagger.annotations.ApiModelProperty(value = "起租结束时间", name = "rentalEndDate")
@io.swagger.annotations.ApiModelProperty(value = "", name = "endDate")
private Date endDate;
@io.swagger.annotations.ApiModelProperty(value = "终止时间", name = "endContractTime")
@@ -216,6 +218,15 @@ public class WxPropertyContract extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "到期提醒手机号", name = "outDateNotifyPhone")
private String outDateNotifyPhone;
@io.swagger.annotations.ApiModelProperty(value = "创建方式EnumPropertyCreateType", name = "createType")
private Integer createType;
@io.swagger.annotations.ApiModelProperty(value = "店铺ids,根据店铺创建", name = "shopIds")
private String shopIds;
@io.swagger.annotations.ApiModelProperty(value = "店铺号,根据店铺创建", name = "shopNumbers")
private String shopNumbers;
@TableField(exist = false)
private List<Long> shopIdsQuery;
//查询过期提醒
@TableField(exist = false)
private Integer outDateNofity;
@@ -234,32 +245,52 @@ public class WxPropertyContract extends TenantEntity {
}
}
public void calcutePrice(WxRentContract rentContract) {
public void calcutePrice(String rentArea) {
//如果是固定的,则不计算
if (null != fixedPrice && fixedPrice.equals(EnumYesOrNo.YES.getCode())) {
}else {
if (StringUtils.isNoneBlank(rentContract.getRentArea()) && StringUtils.isNotBlank(this.rentPrice)) {
this.price = new BigDecimal(rentContract.getRentArea()).multiply(new BigDecimal(this.rentPrice)).setScale(this.decimalSize, RoundingMode.HALF_UP).toPlainString();
if (StringUtils.isNotBlank(rentArea) && StringUtils.isNotBlank(this.rentPrice)) {
this.price = new BigDecimal(rentArea).multiply(new BigDecimal(this.rentPrice)).setScale(this.decimalSize, RoundingMode.HALF_UP).toPlainString();
}
}
}
public String getRentInfoShopNumber() {
public String getShopNumber() {
StringBuffer sb = new StringBuffer("");
String rentInfo = this.getRentInfo();
if (!StringUtils.isBlank(rentInfo)) {
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int size = rentInfoArray.size();
for (int i = 0; i < size; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
String shopNumber = rentInfoObject.getString("shopNumber");
if (StringUtils.isNotBlank(shopNumber)) {
sb.append(shopNumber).append(",");
}
}
if (this.createType.intValue() == EnumPropertyCreateType.BY_RENT.getCode().intValue()) {
String rentInfo = this.getRentInfo();
if (!StringUtils.isBlank(rentInfo)) {
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int size = rentInfoArray.size();
for (int i = 0; i < size; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
String shopNumber = rentInfoObject.getString("shopNumber");
if (StringUtils.isNotBlank(shopNumber)) {
sb.append(shopNumber).append(",");
}
}
}
}else {
sb.append(this.shopNumbers);
}
return sb.toString();
}
public List<Long> shopIdsByShop() {
List<Long> shopList = Lists.newArrayList();
String shopids = this.getShopIds();
if (!StringUtils.isBlank(shopids)) {
String[] sids = shopids.split(",");
if (null != sids) {
for (int i = 0; i < sids.length; i++) {
if (StringUtils.isNotBlank(sids[i])) {
shopList.add(Long.parseLong(sids[i]));
}
}
}
}
return shopList;
}

@io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType")
private Integer contractType;


+ 35
- 0
mallinkService/src/main/java/com/iformall/enums/EnumPropertyCreateType.java Просмотреть файл

@@ -0,0 +1,35 @@
package com.iformall.enums;

/**
*/
public enum EnumPropertyCreateType {

BY_RENT(1, "根据租金合同创建"),
BY_SHOP(2, "根据店铺创建"),
;

public static EnumPropertyCreateType getEnum(Integer code) {
for (EnumPropertyCreateType value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumPropertyCreateType(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java Просмотреть файл

@@ -205,7 +205,7 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi
// e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio()));
// }
e.setLatePayDay(rent.getLatePayDay());
e.setShopNumber(rent.getRentInfoShopNumber());
e.setShopNumber(rent.getShopNumber());
}
// WxBillPropertyDeposit bd = billDepositMap.get(e.getPropertyContractId());


+ 91
- 88
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java Просмотреть файл

@@ -187,39 +187,45 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
}

//租赁费用欠缴
WxRentContract wxRentContract = new WxRentContract();
wxRentContract.setId(wxPropertyContract.getRentContractId());
result.put("rentOweCount",wxRentContractMapper.queryOweCount(wxRentContract));
//物业费用欠缴
WxPropertyContract propertyContract = new WxPropertyContract();
propertyContract.setId(id);
propertyContract.updateTenantInfo(wxPropertyContract);
result.put("propertyOweCount",wxPropertyContractMapper.queryOweCount(propertyContract));
//押金欠缴
result.put("depositOweCount",wxBillPropertyDepositMapper.queryOweCount(propertyContract));
//押金状态
WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit();
wxBillPropertyDeposit.setPropertyContractId(id);
wxBillPropertyDeposit.updateTenantInfo(wxPropertyContract);
List<WxBillPropertyDeposit> select = wxBillPropertyDepositMapper.findList(wxBillPropertyDeposit);
if (!select.isEmpty()) {
result.put("depositStatus", select.get(0).getStatus());
}
// WxRentContract wxRentContract = new WxRentContract();
// wxRentContract.setId(wxPropertyContract.getRentContractId());
// result.put("rentOweCount",wxRentContractMapper.queryOweCount(wxRentContract));
// //物业费用欠缴
// WxPropertyContract propertyContract = new WxPropertyContract();
// propertyContract.setId(id);
// propertyContract.updateTenantInfo(wxPropertyContract);
// result.put("propertyOweCount",wxPropertyContractMapper.queryOweCount(propertyContract));
// //押金欠缴
// result.put("depositOweCount",wxBillPropertyDepositMapper.queryOweCount(propertyContract));
// //押金状态
// WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit();
// wxBillPropertyDeposit.setPropertyContractId(id);
// wxBillPropertyDeposit.updateTenantInfo(wxPropertyContract);
// List<WxBillPropertyDeposit> select = wxBillPropertyDepositMapper.findList(wxBillPropertyDeposit);
// if (!select.isEmpty()) {
// result.put("depositStatus", select.get(0).getStatus());
// }
//关联的店铺
WxRentContract wrc = wxRentContractMapper.selectById(wxPropertyContract.getRentContractId());
if (wrc != null) {
WxShop record = new WxShop();
if (null != wrc.shopIdsByRentInfo() && wrc.shopIdsByRentInfo().size()>0) {
record.setIds(wrc.shopIdsByRentInfo());
record.updateTenantInfo(wxPropertyContract);
PageInfo<Map<String, Object>> shopPageInfo = wxShopService.findListMap(record,1,10000);
List<Map<String, Object>> list = shopPageInfo.getList();
result.put("wxShops", list);
}else {
result.put("wxShops", Collections.EMPTY_LIST);
}
}
WxShop record = new WxShop();
record.updateTenantInfo(wxPropertyContract);
if (wxPropertyContract.getCreateType().intValue() == EnumPropertyCreateType.BY_SHOP.getCode().intValue()) {
record.setIds(wxPropertyContract.shopIdsByShop());
}else {
WxRentContract wrc = wxRentContractMapper.selectById(wxPropertyContract.getRentContractId());
if (wrc != null) {
if (null != wrc.shopIdsByRentInfo() && wrc.shopIdsByRentInfo().size()>0) {
record.setIds(wrc.shopIdsByRentInfo());
}
}
}
if (null == record.getIds() || record.getIds().size() <= 0 ) {
result.put("wxShops", Collections.EMPTY_LIST);
}else {
PageInfo<Map<String, Object>> shopPageInfo = wxShopService.findListMap(record,1,10000);
List<Map<String, Object>> list = shopPageInfo.getList();
result.put("wxShops", list);
}
//发起人备注
WxFlowRecord wxFlowRecord = new WxFlowRecord();
@@ -304,16 +310,28 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
// if (record.getRentShopType().equals(EnumRentShopType.POINT.getCode()) && null == record.getShopId()) {
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "shopId不能为空");
// }

WxRentContract wxRentContract = wxRentContractMapper.selectById(record.getRentContractId());
if (wxRentContract != null) {
if (wxRentContract.getStatus().equals(EnumRentContractStatus.OUT_DATE.getCode()) ||
wxRentContract.getStatus().equals(EnumRentContractStatus.TERMINATE.getCode()) ||
wxRentContract.getStatus().equals(EnumRentContractStatus.INVALID.getCode())) {
return new ResultData(ErrorCode.RENT_CONTRACT_IS_TERMINATED);
WxRentContract wxRentContract = null;
if (record.getCreateType().intValue() == EnumPropertyCreateType.BY_RENT.getCode().intValue()) {
wxRentContract = wxRentContractMapper.selectById(record.getRentContractId());
if (wxRentContract != null) {
if (wxRentContract.getStatus().equals(EnumRentContractStatus.OUT_DATE.getCode()) ||
wxRentContract.getStatus().equals(EnumRentContractStatus.TERMINATE.getCode()) ||
wxRentContract.getStatus().equals(EnumRentContractStatus.INVALID.getCode())) {
return new ResultData(ErrorCode.RENT_CONTRACT_IS_TERMINATED);
}
} else {
return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND);
}
}else {
if (null == record.getRentalStartDate()) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "起租开始时间不能为空");
}
if (null == record.getRentalEndDate()) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "起租结束时间不能为空");
}
if (null == record.getStartDate()) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "计租日不能为空");
}
} else {
return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND);
}
if (null == record.getMerchantId() && record.getOperationType().equals(EnumContractOperationType.PART.getCode())) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantId不能为空");
@@ -336,50 +354,25 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
if (null == record.getDeposit()) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "押金不能为空");
}
// if (record.getPrice().longValue() <= 0) {
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "物业费要大于0");
// }

// WxPropertyContract propertyContract = new WxPropertyContract();
// propertyContract.updateTenantInfo(wxRentContract);
// propertyContract.setRentContractId(record.getRentContractId());
// long count = wxPropertyContractMapper.findList(propertyContract)
//// .stream().filter(p -> p.getStatus().equals(EnumRentContractStatus.READY_FOR_PAING.getCode()) ||
//// p.getStatus().equals(EnumRentContractStatus.RENT_PAID.getCode()) ||
//// p.getStatus().equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count();
// .stream().filter(p -> p.getStatus().equals(EnumRentContractStatus.READY_FOR_PAING.getCode()) ||
// p.getStatus().equals(EnumRentContractStatus.PAING.getCode())).count();
// if (count > 1) {
// return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND);
// }
//保存物业合同信息
String message;
boolean hasFlow = true;
if (record.getId() == null) {
// if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) {
// WxPropertyContract propertyContractQuery = new WxPropertyContract();
// propertyContractQuery.setRentContractId(record.getRentContractId());
// int propertyContractCount = wxPropertyContractMapper.selectCount(new QueryWrapper(propertyContractQuery));
// if (propertyContractCount > 0) {
// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"租金合同编号["+record.getRentContractId()+"]存在关联的物业合同");
// }
// }
hasFlow = false;
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
record.setRentalStartDate(wxRentContract.getRentalStartDate());
record.setRentalEndDate(wxRentContract.getRentalEndDate());
record.setStartDate(wxRentContract.getStartDate());
record.setEndDate(wxRentContract.getEndDate());
if (record.getCreateType().intValue() == EnumPropertyCreateType.BY_RENT.getCode().intValue()) {
record.setRentalStartDate(wxRentContract.getRentalStartDate());
record.setRentalEndDate(wxRentContract.getRentalEndDate());
record.setStartDate(wxRentContract.getStartDate());
record.setEndDate(wxRentContract.getEndDate());
}else {
record.setEndDate(setEndDate(record.getStartDate(),record.getRentalStartDate()));
}
Date date = new Date();
record.setCreatetime(date);
record.setUpdatetime(date);
// record.setStatus(EnumRentContractStatus.DRAFT.getCode());
// if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) {
// record.setStatus(EnumRentContractStatus.INTENTION.getCode());
// } else {
// record.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode());
// }
record.setStatus(EnumRentContractStatus.UNWRITE.getCode());
record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode());
try {
@@ -401,7 +394,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
wxBillRent.setPropertyContractId(record.getId());
wxBillRent.setSortColumns(BaseEntity.SortField.Period_ASC);
wxBillRent.setIsPreview(EnumIsPreview.YES.getCode());
wxBillRent.updateTenantInfo(wxRentContract);
wxBillRent.updateTenantInfo(record);
List<WxBillProperty> billList = wxBillPropertyMapper.findList(wxBillRent);
record.setPreviewBillRentList(billList);

@@ -420,11 +413,16 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
if (wxPropertyContract == null) {
return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND);
}

record.setRentalStartDate(wxRentContract.getRentalStartDate());
record.setRentalEndDate(wxRentContract.getRentalEndDate());
record.setStartDate(wxRentContract.getStartDate());
record.setEndDate(wxRentContract.getEndDate());
if (record.getCreateType().intValue() == EnumPropertyCreateType.BY_RENT.getCode().intValue()) {
record.setRentalStartDate(wxRentContract.getRentalStartDate());
record.setRentalEndDate(wxRentContract.getRentalEndDate());
record.setStartDate(wxRentContract.getStartDate());
record.setEndDate(wxRentContract.getEndDate());
}else {
record.setEndDate(setEndDate(record.getStartDate(),record.getRentalStartDate()));
}
record.setPrice(StringUtils.isNotBlank(record.getPrice()) ? record.getPrice() : "0");
record.setDeposit(StringUtils.isNotBlank(record.getDeposit()) ? record.getDeposit() : "0");
record.setUpdatetime(new Date());
@@ -435,14 +433,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
}else {
record.setStatus(wxPropertyContract.getStatus());
}
// if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) {
// record.setStatus(EnumRentContractStatus.INTENTION.getCode());
// }

// if (CollectionUtils.isEmpty(record.getFlowParams())) {
// hasFlow = false;
// record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode());
// }
record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode());
try {
wxPropertyContractMapper.updateById(record);
@@ -456,6 +446,19 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService

return new ResultData(Result.SUCCESS, message, record);
}
//跟租金合同保持逻辑一致
private Date setEndDate(Date startDate, Date rentalStartDate) {
//计租结束时间
if (!startDate.equals(rentalStartDate)) {
Calendar instance = Calendar.getInstance();
instance.setTime(rentalStartDate);
instance.add(Calendar.DAY_OF_MONTH, -1);
return instance.getTime();
} else {
return startDate;
}
}

@Override
public ResultData updatePropertyContractStatus(Long id) {


+ 15
- 16
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -256,21 +256,20 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//租赁费用欠缴
result.put("rentOweCount",wxRentContractMapper.queryOweCount(wxRentContract));
//物业费用欠缴
WxPropertyContract propertyContract = new WxPropertyContract();
propertyContract.setRentContractId(id);
result.put("propertyOweCount",wxPropertyContractMapper.queryOweCount(propertyContract));
result.put("protertyContract", wxPropertyContractMapper.findOneByRentId(wxRentContract));
//押金欠缴
;
result.put("depositOweCount",wxBillDepositMapper.queryOweCount(wxRentContract));
//押金状态
WxBillDeposit wxBillDeposit = new WxBillDeposit();
wxBillDeposit.setRentContractId(id);
wxBillDeposit.updateTenantInfo(wxRentContract);
List<WxBillDeposit> select = wxBillDepositMapper.findList(wxBillDeposit);
if (!select.isEmpty()) {
result.put("depositStatus", select.get(0).getStatus());
}
// WxPropertyContract propertyContract = new WxPropertyContract();
// propertyContract.setRentContractId(id);
// result.put("propertyOweCount",wxPropertyContractMapper.queryOweCount(propertyContract));
// result.put("protertyContract", wxPropertyContractMapper.findOneByRentId(wxRentContract));
// //押金欠缴
// result.put("depositOweCount",wxBillDepositMapper.queryOweCount(wxRentContract));
// //押金状态
// WxBillDeposit wxBillDeposit = new WxBillDeposit();
// wxBillDeposit.setRentContractId(id);
// wxBillDeposit.updateTenantInfo(wxRentContract);
// List<WxBillDeposit> select = wxBillDepositMapper.findList(wxBillDeposit);
// if (!select.isEmpty()) {
// result.put("depositStatus", select.get(0).getStatus());
// }
//发起人备注
WxFlowRecord wxFlowRecord = new WxFlowRecord();
wxFlowRecord.setBusinessId(String.valueOf(id));
@@ -438,7 +437,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
instance.setTime(record.getRentalStartDate());
instance.add(dayType, record.getLease());
instance.add(Calendar.DAY_OF_MONTH, -1);
//租结束时间
//租结束时间
if (!record.getStartDate().equals(record.getRentalStartDate())) {
instance.clear();
instance.setTime(record.getRentalStartDate());


+ 13
- 2
mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml Просмотреть файл

@@ -55,10 +55,14 @@
<result column="out_date_notify_days" jdbcType="INTEGER" property="outDateNotifyDays"/>
<result column="out_date_notify_phone" jdbcType="VARCHAR" property="outDateNotifyPhone"/>
<result column="create_type" jdbcType="INTEGER" property="createType"/>
<result column="shop_ids" jdbcType="VARCHAR" property="shopIds"/>
<result column="shop_numbers" jdbcType="VARCHAR" property="shopNumbers"/>
</resultMap>
<sql id="allColumns">
`id`,`merchant_id`,`decimal_size`,`price`,`rental_start_date`,`rental_end_date`,
`id`,`merchant_id`,`decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`create_type`,`shop_ids`,`shop_numbers`,
`sign_date`,`receive_period`,`tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`,
`deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,`receive_period_unit`,
`shop_type`,`updatetime`,`createtime`,`rent_area`,`rent_shop_type`,
@@ -108,7 +112,7 @@
<if test=" null != endDate ">and `end_date` = #{endDate}</if>
<if test=" null != rentShopType">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != operationType ">and `operation_type` = #{operationType}</if>
<if test=" null != createType ">and `create_type` = #{createType}</if>
<if test=" null != businessForRule and '' != businessForRule ">
and business_id in (${businessForRule})
</if>
@@ -119,6 +123,13 @@
</foreach>
</if>
<if test=" null != shopIdsQuery ">
and
<foreach collection="shopIdsQuery" index="index" item="shopidItem" open="(" separator="or" close=")">
shop_ids like concat('%,', #{shopidItem},',%')
</foreach>
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">


Загрузка…
Отмена
Сохранить