| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.DictConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.ProcessCategoryEnum; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.system.bo.ProcessStartBO; |
| | | import com.ruoyi.system.dto.SignContractDTO; |
| | | import com.ruoyi.system.dto.TerminateContractDTO; |
| | | import com.ruoyi.system.mapper.TBillMapper; |
| | |
| | | import com.ruoyi.system.query.TContractAppletQuery; |
| | | import com.ruoyi.system.query.TContractBillQuery; |
| | | import com.ruoyi.system.query.TContractQuery; |
| | | import com.ruoyi.system.service.StateProcessTemplateService; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import com.ruoyi.system.service.TContractRentTypeService; |
| | | import com.ruoyi.system.service.TContractService; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TBillService billService; |
| | | @Resource |
| | | private TContractMapper contractMapper; |
| | | @Autowired |
| | | private StateProcessTemplateService stateProcessTemplateService; |
| | | |
| | | @Override |
| | | public PageInfo<TContract> contractList(TContractQuery query) { |
| | |
| | | contract.setTerminateRemark(dto.getTerminateRemark()); |
| | | contract.setStatus("4"); |
| | | this.baseMapper.updateById(contract); |
| | | |
| | | // 进入合同提前终止审批流程 |
| | | ProcessStartBO processStartBO = new ProcessStartBO(); |
| | | processStartBO.setCategory(ProcessCategoryEnum.CATEGORY3.getValue().toString()); |
| | | processStartBO.setModuleName("合同提前终止审批"); |
| | | processStartBO.setName(contract.getContractName()); |
| | | processStartBO.setRemark(""); |
| | | Map<String, Object> variable = new HashMap<>(); |
| | | variable.put("projectId", dto.getId()); |
| | | processStartBO.setVariable(variable); |
| | | //开启工作流程 |
| | | stateProcessTemplateService.start(processStartBO); |
| | | |
| | | // 生成验收记录 |
| | | TCheckAcceptRecord tCheckAcceptRecord = new TCheckAcceptRecord(); |
| | | tCheckAcceptRecord.setContractId(dto.getId()); |
| | | tCheckAcceptRecord.setHouseId(contract.getHouseId()); |
| | | tCheckAcceptRecord.setLeaseReason("后台终止"); |
| | | tCheckAcceptRecord.setStatus("1"); |
| | | tCheckAcceptRecord.setLeaseReason("后台终止合同"); |
| | | tCheckAcceptRecord.setStatus(false); |
| | | tCheckAcceptRecord.setAcceptanceTime(LocalDateTime.now()); |
| | | LocalDate now = LocalDate.now(); |
| | | String replace = (now + "").replace("-", ""); |
| | | int size = checkAcceptRecordMapper.selectList(new LambdaQueryWrapper<TCheckAcceptRecord>() |
| | | .likeRight(TCheckAcceptRecord::getAcceptanceTime, LocalDate.now())).size(); |
| | | tCheckAcceptRecord.setCode(replace.substring(2)+String.format("%03d", size+1)); |
| | | |
| | | |
| | | checkAcceptRecordMapper.insert(tCheckAcceptRecord); |
| | | // 将所有未缴费账单设置未已失效 |
| | | List<TBill> tBills = billMapper.selectList(new LambdaQueryWrapper<TBill>() |
| | |
| | | billService.updateBatchById(tBills); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // LocalDate now = LocalDate.now(); |
| | | // String replace = (now + "").replace("-", ""); |
| | | // System.err.println(replace.substring(2)); |
| | | // |
| | | // System.err.println(String.format("%03d",1)); |
| | | } |
| | | @Override |
| | | public CheckAcceptRecordVO getCheckByContractId(String id) { |
| | | CheckAcceptRecordVO checkAcceptRecordVO = new CheckAcceptRecordVO(); |
| | |
| | | if (contract==null)return R.fail("合同不存在"); |
| | | if (contract.getStatus().equals("4"))return R.fail("该合同已签订"); |
| | | contract.setSignature(dto.getSignature()); |
| | | contract.setStatus("2"); |
| | | contractMapper.updateById(contract); |
| | | contract.setStatus("4"); |
| | | contract.setFirstPayTime(contract.getStartTime().plusDays(10)); |
| | | List<TBill> bills = new ArrayList<>(); |
| | | contractMapper.updateById(contract); |
| | | |
| | | // 进入签订审批流程 |
| | | ProcessStartBO processStartBO = new ProcessStartBO(); |
| | | processStartBO.setCategory(ProcessCategoryEnum.CATEGORY2.getValue().toString()); |
| | | processStartBO.setModuleName("合同签订审批"); |
| | | processStartBO.setName(contract.getContractName()); |
| | | processStartBO.setRemark(""); |
| | | Map<String, Object> variable = new HashMap<>(); |
| | | variable.put("projectId", dto.getId()); |
| | | processStartBO.setVariable(variable); |
| | | //开启工作流程 |
| | | stateProcessTemplateService.start(processStartBO); |
| | | |
| | | List<TContractRentType> contractRentTypes = contractRentTypeService.list(); |
| | | // 生成第一笔账单 |
| | | // 第一次应缴费日期 |
| | |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updateContractAuditStatus(String projectId, Integer status) { |
| | | LambdaUpdateWrapper<TContract> contractLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); |
| | | contractLambdaUpdateWrapper.eq(TContract::getId, projectId).set(TContract::getStatus, status); |
| | | return this.update(contractLambdaUpdateWrapper); |
| | | } |
| | | } |