| @@ -172,7 +172,7 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | |||
| wxPropertyContract.setRentalStartDate(wxPropertyContract.getStartDate()); | |||
| } | |||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName()); | |||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),false); | |||
| } | |||
| @PostMapping("updateRentStartTime") | |||
| @@ -184,7 +184,7 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| propertyContract.updateTenantInfo(user); | |||
| propertyContract.setAdjustPeriodHandle(); | |||
| propertyContract.setRentStartType(wxPropertyContract.getRentStartType()); | |||
| return wxPropertyContractService.saveOrUpdate(propertyContract, user.getId(), user.getName()); | |||
| return wxPropertyContractService.saveOrUpdate(propertyContract, user.getId(), user.getName(),false); | |||
| } | |||
| @PostMapping("update") | |||
| @@ -195,7 +195,7 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| wxPropertyContract.updateTenantInfo(user); | |||
| wxPropertyContract.setAdjustPeriodHandle(); | |||
| //第三步提交 SWITCH | |||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName()); | |||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),true); | |||
| } | |||
| @@ -228,7 +228,8 @@ public class WxPropertyContractController extends WxContractBaseController { | |||
| if (null == contract) { | |||
| return new ResultData(Result.ERROR, "合同不存在."); | |||
| } | |||
| if (contract.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || | |||
| if (contract.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue() || | |||
| 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()))) { | |||
| @@ -266,7 +266,8 @@ public class WxRentContractController extends WxContractBaseController { | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"租赁合同未查询到"); | |||
| } | |||
| if (cure.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || | |||
| if (cure.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()|| | |||
| cure.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || | |||
| (cure.getStatus().intValue() == EnumRentContractStatus.PERFORMANCE.getCode().intValue() | |||
| && (cure.getApplyStatus().intValue()== EnumRentContractAppStatus.REJECT.getCode().intValue() || | |||
| cure.getApplyStatus().intValue()== EnumRentContractAppStatus.SETBACK.getCode().intValue()))) { | |||
| @@ -411,7 +412,8 @@ public class WxRentContractController extends WxContractBaseController { | |||
| if (null == contract) { | |||
| return new ResultData(Result.ERROR, "合同不存在."); | |||
| } | |||
| if (contract.getStatus().intValue() == EnumRentContractStatus.DRAFT.getCode().intValue() || | |||
| if (contract.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue() || | |||
| 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()))) { | |||
| @@ -61,8 +61,10 @@ WHERE wrc.rent_info IS NULL AND wrc.shop_id IS NOT NULL ; | |||
| //删除店铺不存在的垃圾数据 (先查询!!!!) | |||
| DELETE FROM wx_rent_contract WHERE shop_id IS NOT NULL AND shop_id NOT IN (SELECT id FROM wx_shop); | |||
| DELETE FROM wx_property_contract WHERE shop_id IS NOT NULL AND shop_id NOT IN (SELECT id FROM wx_shop); | |||
| //删除商户不存在得垃圾数据(先查询!!!!) | |||
| delete from wx_rent_contract where merchant_id IS NOT NULL AND merchant_id not in ( select id from wx_merchant ); | |||
| delete from wx_property_contract where merchant_id IS NOT NULL AND merchant_id not in ( select id from wx_merchant ); | |||
| //删除租金合同不在的物业合同 | |||
| delete from wx_property_contract where rent_contract_id is not null and rent_contract_id not in ( | |||
| @@ -48,7 +48,7 @@ public interface WxPropertyContractService { | |||
| * @param userName | |||
| * @return | |||
| */ | |||
| ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName); | |||
| ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName,boolean writeComplate); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -265,7 +265,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName) { | |||
| public ResultData saveOrUpdate(WxPropertyContract record, Long userId, String userName,boolean writeComplate) { | |||
| // 保存调整金额(预账单调整) | |||
| boolean haspreview = false; | |||
| if(!CollectionUtils.isEmpty(record.getPreviewBillRentList())){ | |||
| @@ -328,14 +328,14 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| 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()+"]存在关联的物业合同"); | |||
| } | |||
| } | |||
| // 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()); | |||
| @@ -352,7 +352,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| // } else { | |||
| // record.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||
| // } | |||
| record.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); | |||
| record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| try { | |||
| wxPropertyContractMapper.insert(record); | |||
| @@ -402,7 +402,11 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| record.setUpdatetime(new Date()); | |||
| //如果是合并合同 物业合同的状态为 意向 | |||
| record.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| if (writeComplate) { | |||
| record.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| }else { | |||
| record.setStatus(wxPropertyContract.getStatus()); | |||
| } | |||
| // if (record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())) { | |||
| // record.setStatus(EnumRentContractStatus.INTENTION.getCode()); | |||
| // } | |||