From b9086588c215b7493682d65d49ed1070d88c3058 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Tue, 26 Sep 2023 15:49:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wb' into wb
---
screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java | 93 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 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
new file mode 100644
index 0000000..a2259b6
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java
@@ -0,0 +1,93 @@
+package com.moral.api.service.impl;
+
+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>
+ * ��������������� ���������������
+ * </p>
+ * deyt template generate
+ * @author JI
+ * @since 2023-09-25
+ */
+@Service
+public class AllocationExtensionServiceImpl extends ServiceImpl<AllocationExtensionMapper, AllocationExtension> implements AllocationExtensionService {
+
+ 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) {
+ 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;
+ }
+
+
+
+ @Override
+ public Page<AllocationExtensionPageExt> extPage(AllocationExtensionPageCond allocationExtensionPageCond) {
+ return this.baseMapper.extPage(allocationExtensionPageCond.getPage().convertPage(), allocationExtensionPageCond);
+ }
+
+ @Override
+ public boolean save(AllocationExtensionAddCond allocationExtensionAddCond) {
+ return this.save(allocationExtensionAddCond.convert());
+ }
+
+ @Override
+ @Transactional
+ public boolean check(Integer id, Integer state) {
+ 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(state);
+ this.baseMapper.updateById(allocationExtension);
+ if(AllocationExtensionApproveEnum.PASS.value.equals(state)){
+ Allocation allocation = new Allocation();
+ allocation.setAllocationId(extensionExt.getAllocationId());
+ allocation.setChangeDay(extensionExt.getChangeDay()+extensionExt.getExtensionNum());
+ allocationService.updateById(allocation);
+ }
+ return true;
+ }
+}
--
Gitblit v1.8.0