From 3154d80303294d32672ca2402159bf0b1cccafb0 Mon Sep 17 00:00:00 2001 From: cjl <276999030@qq.com> Date: Tue, 26 Sep 2023 13:49:00 +0800 Subject: [PATCH] feat:延期申请完善 --- screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 50 insertions(+), 3 deletions(-) diff --git a/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java index ca0b58c..998576e 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java @@ -2,14 +2,22 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.moral.api.entity.Allocation; import com.moral.api.entity.AllocationExtension; +import com.moral.api.exception.BusinessException; import com.moral.api.mapper.AllocationExtensionMapper; +import com.moral.api.pojo.enums.AllocationExtensionApproveEnum; +import com.moral.api.pojo.enums.FileTableEnum; +import com.moral.api.pojo.ext.allocation.AllocationExt; import com.moral.api.pojo.ext.allocationextension.AllocationExtensionExt; import com.moral.api.pojo.ext.allocationextension.AllocationExtensionPageExt; import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond; import com.moral.api.pojo.query.allocationextension.AllocationExtensionPageCond; import com.moral.api.service.AllocationExtensionService; +import com.moral.api.service.AllocationService; +import com.moral.api.service.FileTableService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** * <p> @@ -22,12 +30,33 @@ @Service public class AllocationExtensionServiceImpl extends ServiceImpl<AllocationExtensionMapper, AllocationExtension> implements AllocationExtensionService { - // private final All + private final AllocationService allocationService; + private final FileTableService fileTableService; + + public AllocationExtensionServiceImpl(AllocationService allocationService, FileTableService fileTableService) { + this.allocationService = allocationService; + this.fileTableService = fileTableService; + } @Override public AllocationExtensionExt extOne(Integer id) { - return this.baseMapper.extOne(id); + AllocationExtensionExt extensionExt = this.baseMapper.extOne(id); + AllocationExt extOne = allocationService.oneAllocation(extensionExt.getAllocationId()); + extensionExt.setAllocationNum(extOne.getAllocationNum()) + .setEscalationTime(extOne.getEscalationTime()) + .setPollutePosition(extOne.getPollutePosition()) + .setUnitId(extOne.getUnitId()) + .setPolluteType(extOne.getPolluteType()) + .setChangeType(extOne.getChangeType()) + .setChangeDay(extOne.getChangeDay()) + .setEscalationName(extOne.getEscalationName()) + .setInvestigationType(extOne.getInvestigationType()) + .setProblemDescribe(extOne.getProblemDescribe()) + .setEscalationUnitId(extOne.getEscalationUnitId()); + extensionExt.setFileBaseList(fileTableService.list(extensionExt.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value)); + extensionExt.setFileList(fileTableService.list(id, FileTableEnum.ALLOCATION_EXTENSION.value)); + return extensionExt; } @@ -42,5 +71,23 @@ return this.save(allocationExtensionAddCond.convert()); } - + @Override + @Transactional + public boolean check(Integer id, Integer sate) { + AllocationExtensionExt extensionExt = this.baseMapper.extOne(id); + if(!AllocationExtensionApproveEnum.APPLYING.value.equals(extensionExt.getState())){ + throw new BusinessException("������������������������������"); + } + AllocationExtension allocationExtension = new AllocationExtension(); + allocationExtension.setId(id); + allocationExtension.setState(sate); + this.baseMapper.updateById(allocationExtension); + if(AllocationExtensionApproveEnum.PASS.value.equals(sate)){ + Allocation allocation = new Allocation(); + allocation.setAllocationId(extensionExt.getAllocationId()); + allocation.setChangeDay(extensionExt.getChangeDay()+extensionExt.getExtensionNum()); + allocationService.updateById(allocation); + } + return true; + } } -- Gitblit v1.8.0