Browse Source

删除上缴印章和销毁印章 时删除印章档案的日期 ,销毁时改状态

xieyn 1 year ago
parent
commit
87f60b0da3

+ 18 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/controller/SealDestroyController.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.oa.controller;
 
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -17,6 +18,7 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.oa.entity.SealArchives;
 import org.jeecg.modules.oa.entity.SealDestroy;
+import org.jeecg.modules.oa.entity.SealTurn;
 import org.jeecg.modules.oa.service.ISealArchivesService;
 import org.jeecg.modules.oa.service.ISealDestroyService;
 
@@ -127,7 +129,14 @@ public class SealDestroyController extends JeecgController<SealDestroy, ISealDes
 	@AutoLog(value = "销毁印章登记-通过id删除")
 	@ApiOperation(value="销毁印章登记-通过id删除", notes="销毁印章登记-通过id删除")
 	@DeleteMapping(value = "/delete")
+	@Transactional
 	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		SealDestroy sealDestroy = sealDestroyService.getById(id);
+		String sealId = sealDestroy.getSealId();
+		SealArchives sealArchives = sealArchivesService.getById(sealId);
+		sealArchives.setDestroyDate(null);
+		sealArchives.setSealStatus("正在使用");
+		sealArchivesService.updateById(sealArchives);
 		sealDestroyService.removeById(id);
 		return Result.ok("删除成功!");
 	}
@@ -142,6 +151,15 @@ public class SealDestroyController extends JeecgController<SealDestroy, ISealDes
 	@ApiOperation(value="销毁印章登记-批量删除", notes="销毁印章登记-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		//变更印章档案数据
+		Collection<SealDestroy> sealTurnList = sealDestroyService.listByIds(Arrays.asList(ids.split(",")));
+		for(SealDestroy sealDestroy:sealTurnList){
+			String sealId = sealDestroy.getSealId();
+			SealArchives sealArchives = sealArchivesService.getById(sealId);
+			sealArchives.setDestroyDate(null);
+			sealArchives.setSealStatus("正在使用");
+			sealArchivesService.updateById(sealArchives);
+		}
 		this.sealDestroyService.removeByIds(Arrays.asList(ids.split(",")));
 		return Result.ok("批量删除成功!");
 	}

+ 17 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/controller/SealTurnController.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.oa.controller;
 
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -22,6 +23,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 
 import org.jeecg.modules.oa.entity.SealArchives;
+import org.jeecg.modules.oa.entity.SealDestroy;
 import org.jeecg.modules.oa.entity.SealTurn;
 import org.jeecg.modules.oa.service.ISealArchivesService;
 import org.jeecg.modules.oa.service.ISealTurnService;
@@ -128,7 +130,13 @@ public class SealTurnController extends JeecgController<SealTurn, ISealTurnServi
 	@AutoLog(value = "上缴印章-通过id删除")
 	@ApiOperation(value="上缴印章-通过id删除", notes="上缴印章-通过id删除")
 	@DeleteMapping(value = "/delete")
+	@Transactional
 	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		SealTurn sealTurn = sealTurnService.getById(id);
+		String sealId = sealTurn.getSealId();
+		SealArchives sealArchives = sealArchivesService.getById(sealId);
+		sealArchives.setTurnDate(null);
+		sealArchivesService.updateById(sealArchives);
 		sealTurnService.removeById(id);
 		return Result.ok("删除成功!");
 	}
@@ -142,7 +150,16 @@ public class SealTurnController extends JeecgController<SealTurn, ISealTurnServi
 	@AutoLog(value = "上缴印章-批量删除")
 	@ApiOperation(value="上缴印章-批量删除", notes="上缴印章-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
+	@Transactional
 	public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		//变更印章档案数据
+		Collection<SealTurn> sealTurnList = sealTurnService.listByIds(Arrays.asList(ids.split(",")));
+		for(SealTurn sealTurn:sealTurnList){
+			String sealId = sealTurn.getSealId();
+			SealArchives sealArchives = sealArchivesService.getById(sealId);
+			sealArchives.setTurnDate(null);
+			sealArchivesService.updateById(sealArchives);
+		}
 		this.sealTurnService.removeByIds(Arrays.asList(ids.split(",")));
 		return Result.ok("批量删除成功!");
 	}