|
|
|
@@ -2,6 +2,7 @@ package com.iformall.controller.contract; |
|
|
|
|
|
|
|
import com.iformall.annotation.SystemControllerLog; |
|
|
|
import com.iformall.annotation.UserDataRuleAnnotation; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
@@ -9,10 +10,14 @@ import com.iformall.domain.po.MallUserInfo; |
|
|
|
import com.iformall.domain.po.WxBillProperty; |
|
|
|
import com.iformall.domain.po.WxMerchant; |
|
|
|
import com.iformall.domain.po.WxPropertyContract; |
|
|
|
import com.iformall.domain.po.WxRentContract; |
|
|
|
import com.iformall.enums.EnumContractType; |
|
|
|
import com.iformall.enums.EnumFlowContractType; |
|
|
|
import com.iformall.enums.EnumFlowKey; |
|
|
|
import com.iformall.enums.EnumIsPreview; |
|
|
|
import com.iformall.enums.EnumRentContractAppStatus; |
|
|
|
import com.iformall.enums.EnumRentContractStatus; |
|
|
|
import com.iformall.enums.EnumRentShopType; |
|
|
|
import com.iformall.enums.EnumRentStartType; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.WxPropertyContractMapper; |
|
|
|
@@ -28,6 +33,8 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@@ -53,7 +60,6 @@ public class WxPropertyContractController extends WxContractBaseController { |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) |
|
|
|
@SystemControllerLog(description = "物业合同-列表") |
|
|
|
public ResultData list(@ModelAttribute WxPropertyContract wxPropertyContract, Integer pageNum, Integer pageSize) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::list"); |
|
|
|
if (null == wxPropertyContract) { |
|
|
|
@@ -102,19 +108,9 @@ public class WxPropertyContractController extends WxContractBaseController { |
|
|
|
return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/del") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "物业合同-删除") |
|
|
|
public ResultData delete(Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::delete"); |
|
|
|
wxPropertyContractService.deleteById(id); |
|
|
|
return new ResultData(Result.SUCCESS, "删除成功", null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/findById") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "物业合同-根据ID查询") |
|
|
|
public ResultData findById(Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::findById"); |
|
|
|
WxBillProperty wxBillProperty = new WxBillProperty(); |
|
|
|
@@ -128,6 +124,106 @@ public class WxPropertyContractController extends WxContractBaseController { |
|
|
|
return new ResultData(e.getErrorCode(), e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 作废 |
|
|
|
* @param wxRentContract |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/unvalid") |
|
|
|
@SystemControllerLog(description = "物业合同-作废合同") |
|
|
|
public ResultData unvalid(@ModelAttribute WxPropertyContract proertyContract) { |
|
|
|
WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); |
|
|
|
if (null == contract) { |
|
|
|
return new ResultData(Result.ERROR, "合同不存在."); |
|
|
|
} |
|
|
|
if (contract.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || |
|
|
|
(contract.getStatus().intValue() == EnumRentContractStatus.PERFORMANCE.getCode().intValue() |
|
|
|
&& (contract.getApplyStatus().intValue() == EnumRentContractAppStatus.REJECT.getCode().intValue() || |
|
|
|
contract.getApplyStatus().intValue() == EnumRentContractAppStatus.SETBACK.getCode().intValue()))) { |
|
|
|
contract.setStatus(EnumRentContractStatus.INVALID.getCode()); |
|
|
|
contract.setUpdatetime(new Date()); |
|
|
|
try { |
|
|
|
wxPropertyContractService.updatePropertyContract(contract); |
|
|
|
return new ResultData(contract); |
|
|
|
}catch(Exception e) { |
|
|
|
logger.error(" WxPropertyContract unvalid error.",e); |
|
|
|
return new ResultData(Result.ERROR,"系统错误"); |
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
return new ResultData(Result.ERROR, "合同状态不允许作废.只能作废草稿或者履约拒绝的合同。"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 终止 |
|
|
|
* @param id |
|
|
|
* @param status |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("endContract") |
|
|
|
@SystemControllerLog(description = "物业合同-终止合同") |
|
|
|
public ResultData endContract(@RequestBody WxPropertyContract proertyContract) { |
|
|
|
proertyContract.updateTenantInfo(getTenantInfo()); |
|
|
|
wxPropertyContractService.endContract(proertyContract); |
|
|
|
return new ResultData(proertyContract); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("effective") |
|
|
|
@ApiImplicitParams({}) |
|
|
|
@SystemControllerLog(description = "物业合同-合同生效") |
|
|
|
public ResultData effective(@ModelAttribute WxPropertyContract proertyContract) { |
|
|
|
WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); |
|
|
|
if (null == contract) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"物业合同不存在"); |
|
|
|
} |
|
|
|
//查询是否有审批流程 |
|
|
|
if(propertyContractHasWorkFlow(contract)) { |
|
|
|
return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"物业合同存在工作流,不允许直接生效。"); |
|
|
|
} |
|
|
|
|
|
|
|
if (contract.getStatus().intValue() != EnumRentContractStatus.DRAFT.getCode().intValue()) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"租赁合同状态为草稿才能进行此操作"); |
|
|
|
} |
|
|
|
wxPropertyContractService.updatePropertyContractStatus(proertyContract.getId()); |
|
|
|
return new ResultData(Result.SUCCESS,"合同生效成功!"); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("apply") |
|
|
|
@SystemControllerLog(description = "物业合同-提交审批") |
|
|
|
public ResultData apply(@ModelAttribute WxPropertyContract proertyContract) { |
|
|
|
MallUserInfo user = getUser(); |
|
|
|
WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); |
|
|
|
if (null == contract) { |
|
|
|
return new ResultData(Result.ERROR, "编号["+contract.getId()+"]未找到租金合同"); |
|
|
|
} |
|
|
|
|
|
|
|
//查询是否有审批流程 |
|
|
|
if(propertyContractHasWorkFlow(contract)) { |
|
|
|
return new ResultData(ErrorCode.FLOW_FAIL.getCode(),"租赁合同存在工作流,不允许直接生效。"); |
|
|
|
} |
|
|
|
|
|
|
|
if (contract.getRentShopType().intValue() == EnumRentShopType.SHOP.getCode().intValue()) { |
|
|
|
contract.setFlowParams(generateFlowParams(EnumFlowKey.NEW_PRO_CONTRACT, EnumFlowContractType.PROPERTY, contract.getRemark(), contract.getId())); |
|
|
|
}else if (contract.getRentShopType().intValue() == EnumRentShopType.POINT.getCode().intValue()) { |
|
|
|
contract.setFlowParams(generateFlowParams(EnumFlowKey.NEW_PRO_POINT_CONTRACT, EnumFlowContractType.PROPERTY_POINT, contract.getRemark(), contract.getId())); |
|
|
|
} |
|
|
|
return wxPropertyContractService.apply(contract,user); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/del") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "物业合同-删除") |
|
|
|
public ResultData delete(Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::delete"); |
|
|
|
wxPropertyContractService.deleteById(id); |
|
|
|
return new ResultData(Result.SUCCESS, "删除成功", null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/download") |
|
|
|
@SystemControllerLog(description = "物业合同-下载") |
|
|
|
@@ -144,14 +240,6 @@ public class WxPropertyContractController extends WxContractBaseController { |
|
|
|
// return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractStatusInfo(wxPropertyContract)); |
|
|
|
// } |
|
|
|
|
|
|
|
@GetMapping("/endPropertyContract") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "物业合同-终止") |
|
|
|
public ResultData endRentContract(Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxPropertyContractController::endRentContract"); |
|
|
|
return wxPropertyContractService.endRentContract(id); |
|
|
|
} |
|
|
|
|
|
|
|
// @GetMapping("/getRentContractList") |
|
|
|
// @SystemControllerLog(description = "物业合同-查询列表") |
|
|
|
// public ResultData getRentContractList(@ModelAttribute WxPropertyContract wxPropertyContract) { |
|
|
|
@@ -184,15 +272,6 @@ public class WxPropertyContractController extends WxContractBaseController { |
|
|
|
return wxPropertyContractService.updatePropertyContractStatus(wxPropertyContract.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("endContract") |
|
|
|
@SystemControllerLog(description = "物业合同-终止合同") |
|
|
|
public ResultData endContract(@RequestBody WxPropertyContract wxPropertyContract) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxRentContractController::endContract"); |
|
|
|
wxPropertyContract.updateTenantInfo(getTenantInfo()); |
|
|
|
wxPropertyContractService.endContract(wxPropertyContract); |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 预览账单展示,编辑账期,后端生成账单金额 |
|
|
|
* @param wxPropertyContract |
|
|
|
@@ -210,12 +289,5 @@ public class WxPropertyContractController extends WxContractBaseController { |
|
|
|
List<WxBillProperty> result = wxPropertyContractService.buildProperty(new WxMerchant(),getUserId(),dbRent, EnumIsPreview.YES.getCode(), false); |
|
|
|
return new ResultData(result); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("apply") |
|
|
|
@SystemControllerLog(description = "物业合同-提交审批") |
|
|
|
public ResultData apply(@RequestBody WxPropertyContract wxPropertyContract) { |
|
|
|
MallUserInfo user = getUser(); |
|
|
|
wxPropertyContract.setFlowParams(generateFlowParams(EnumFlowKey.NEW_PRO_CONTRACT, EnumFlowContractType.PROPERTY, wxPropertyContract.getRemark(), wxPropertyContract.getId())); |
|
|
|
return wxPropertyContractService.apply(wxPropertyContract, user); |
|
|
|
} |
|
|
|
|
|
|
|
} |