From bc427c64d8c9066eda7a817c7c7926954e39abb0 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期一, 26 一月 2026 14:55:26 +0800
Subject: [PATCH] 删除操作添加日志记录,系统添加定时删除操作日志

---
 fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticePR.java |  357 +++++++++++++++++------------------------------------------
 1 files changed, 102 insertions(+), 255 deletions(-)

diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticePR.java b/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticePR.java
index 35a3da4..3f45655 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticePR.java
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/InoutNoticePR.java
@@ -5,76 +5,36 @@
 import com.bstek.dorado.annotation.DataResolver;
 import com.bstek.dorado.annotation.Expose;
 import com.bstek.dorado.data.provider.Page;
+import com.fzzy.common.constant.BizTypeEnum;
 import com.fzzy.igds.constant.Constant;
+import com.fzzy.igds.data.BaseResp;
 import com.fzzy.igds.data.NoticeDto;
 import com.fzzy.igds.data.NoticeParam;
 import com.fzzy.igds.service.InoutNoticeService;
 import com.fzzy.igds.domain.InoutNoticeIn;
 import com.fzzy.igds.domain.InoutNoticeOut;
-import com.fzzy.igds.service.SysDeptService;
 import com.fzzy.igds.utils.ContextUtil;
-import com.ruoyi.common.core.domain.entity.SysDept;
+import com.fzzy.work.data.WorkStatus;
+import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Component;
 import javax.annotation.Resource;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
 import java.util.*;
 
 /**
  * @Description 閫氱煡鍗曠鐞�
  * @Author CZT
- * @Date 2024/12/16 10:10
+ * @Date 2025/11/29 16:42
  */
 @Component
 public class InoutNoticePR {
 
 	@Resource
 	private InoutNoticeService inoutNoticeService;
-	@Resource
-	private SysDeptService sysDeptService;
-
-/*	*//**
-	 * inoutNoticePR#getTitle 鏍规嵁鎶ヨ〃绫诲瀷锛岃幏鍙栭粯璁ゆ煡璇俊鎭紝姣斿琛ㄥご淇℃伅绛�
-	 *
-	 * @param
-	 * @return
-	 *//*
-	@DataProvider
-	public Map<String, Object> getTitle(Map<String, Object> param) {
-		Map<String, Object> result = new HashMap<String, Object>();
-		//鑾峰彇鍙傛暟涓姤琛ㄧ被鍨�
-		String type = (String)param.get("type");
-
-		//鑾峰彇鍒嗗簱缂栫爜瀵瑰簲鐨勫垎搴撳悕绉�
-		String deptName = "";
-		SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
-		if (null != subDept) {
-			deptName = subDept.getDeptName();
-		}
-		if ("NOTICE_IN".equals(type)) {
-			result.put("title", "鍏ュ簱閫氱煡鍗�");
-			if (StringUtils.isNotEmpty(deptName)) {
-				result.put("title", deptName + "鍏ュ簱閫氱煡鍗�");
-			}
-		}
-		if ("NOTICE_OUT".equals(type)) {
-			result.put("title", "鍑哄簱閫氱煡鍗�");
-			if (StringUtils.isNotEmpty(deptName)) {
-				result.put("title", deptName + "鍑哄簱閫氱煡鍗�");
-			}
-		}
-		return result;
-	}*/
 
 	/**
 	 * inoutNoticePR#getYearQuery 榛樿骞翠唤
@@ -84,7 +44,9 @@
 	 */
 	@DataProvider
 	public Map<String, Object> getYearQuery(Map<String, Object> param) {
-		Map<String, Object> result = new HashMap<String, Object>();
+
+		if(null == param) param = new HashMap<>();
+		Map<String, Object> result = new HashMap<>();
 		//鑾峰彇鍙傛暟涓垎搴撶紪鐮�
 		String deptId = (String)param.get("deptId");
 
@@ -92,47 +54,6 @@
 		result.put("deptId", deptId);
 		return result;
 	}
-
-	/**
-	 * inoutNoticePR#queryNoticeByKey  鏍规嵁鍙傛暟鏌ヨ鍑哄叆搴撻�氱煡鍗曪紝鐢ㄤ簬鎵嬪姩琛ュ崟鏃讹紝閫夋嫨閫氱煡鍗�
-	 *
-	 * @param
-	 * @return
-	 */
-	@DataProvider
-	public List<NoticeDto> queryNoticeByKey(Map<String, Object> param) {
-		if (param == null) {
-			return null;
-		}
-		String type = (String) param.get("type");
-		if (StringUtils.isEmpty(type)) {
-			return null;
-		}
-		List<NoticeDto> list = new ArrayList<>();
-		NoticeDto dto;
-		if (Constant.TYPE_IN.equals(type)) {
-			List<InoutNoticeIn> listIn = this.queryNoticeIn(param);
-			if (null != listIn && listIn.size() > 0) {
-				for (InoutNoticeIn inoutNoticeIn : listIn) {
-					dto = new NoticeDto();
-					BeanUtils.copyProperties(inoutNoticeIn, dto);
-					list.add(dto);
-				}
-			}
-		}
-		if (Constant.TYPE_OUT.equals(type)) {
-			List<InoutNoticeOut> listOut = this.queryNoticeOut(param);
-			if (null != listOut && listOut.size() > 0) {
-				for (InoutNoticeOut inoutNoticeOut : listOut) {
-					dto = new NoticeDto();
-					BeanUtils.copyProperties(inoutNoticeOut, dto);
-					list.add(dto);
-				}
-			}
-		}
-		return list;
-	}
-
 
 	/*==================== 鍏ュ簱閫氱煡鍗曠浉鍏充笟鍔� ====================*/
 
@@ -156,6 +77,18 @@
 	}
 
 	/**
+	 * inoutNoticePR#getNoticeInOne
+	 *
+	 * @param businessId
+	 * @return
+	 */
+	@DataProvider
+	public InoutNoticeIn getNoticeInOne(String businessId) {
+		InoutNoticeIn notice = inoutNoticeService.getNoticeInOne(businessId);
+		return notice;
+	}
+
+	/**
 	 * inoutNoticePR#pageQueryIn 鑾峰彇鍏ュ簱閫氱煡鍗�
 	 *
 	 * @param param
@@ -176,7 +109,7 @@
 	 * inoutNoticePR#saveIn 鏇存柊鍏ュ簱閫氱煡鍗�
 	 */
 	@DataResolver
-	public String saveIn(InoutNoticeIn data) {
+	public BaseResp saveIn(InoutNoticeIn data) {
 		InoutNoticeIn inoutNoticeIn = new InoutNoticeIn();
 		BeanUtils.copyProperties(data, inoutNoticeIn);
 		return inoutNoticeService.saveOrUpdateIn(inoutNoticeIn);
@@ -186,65 +119,11 @@
 	 * inoutNoticePR#delDataIn
 	 */
 	@Expose
+    @Log(title = "閫氱煡鍗曠鐞�", businessType = BusinessType.DELETE,bizType = BizTypeEnum.INOUT)
 	public String delDataIn(InoutNoticeIn data) {
 		InoutNoticeIn inoutNoticeIn = new InoutNoticeIn();
 		BeanUtils.copyProperties(data, inoutNoticeIn);
 		return inoutNoticeService.delDataIn(inoutNoticeIn);
-	}
-
-	/**
-	 * 鏍规嵁涓嶅悓鏉′欢鏌ヨ
-	 * @param param
-	 * @return
-	 */
-	public List<InoutNoticeIn> queryNoticeIn(Map<String, Object> param) {
-		if (null == param) {
-			param = new HashMap<>();
-		}
-		Map<String, Object> finalParam = param;
-
-		//澶氬弬鏁板垎椤垫煡璇�
-		Pageable pageable = PageRequest.of(0, 10000, Sort.Direction.ASC, InoutNoticeIn.SORT_PROP);
-		Specification<InoutNoticeIn> specification = new Specification<InoutNoticeIn>() {
-			private static final long serialVersionUID = 1L;
-
-			public Predicate toPredicate(Root<InoutNoticeIn> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
-				List<Predicate> predicates = new ArrayList<Predicate>(); //鎵�鏈夌殑鏂█
-
-				Predicate predicate1 = cb.equal(root.get("companyId"), ContextUtil.getCompanyId());
-				predicates.add(predicate1);
-				Predicate predicate2 = cb.equal(root.get("deptId"), ContextUtil.subDeptId(null));
-				predicates.add(predicate2);
-				Predicate predicate3 = cb.equal(root.get("completeStatus"), "NONE");
-				predicates.add(predicate3);
-
-				String key = (String) finalParam.get("customerId");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate4 = cb.equal(root.get("customerId"), key);
-					predicates.add(predicate4);
-				}
-				key = (String) finalParam.get("foodVariety");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate5 = cb.equal(root.get("foodVariety"),  key);
-					predicates.add(predicate5);
-				}
-				key = (String) finalParam.get("depotId");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate6 = cb.equal(root.get("depotId"), key);
-					predicates.add(predicate6);
-				}
-				key = (String) finalParam.get("key");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate7 = cb.like(root.get("name"), "%" + key + "%");
-					predicates.add(predicate7);
-				}
-				return cb.and(predicates.toArray(new Predicate[0]));
-			}
-		};
-		//org.springframework.data.domain.Page<InoutNoticeIn> japPage = inoutNoticeService.queryAllNoticeIn(specification, pageable);
-
-		//return japPage.getContent();
-		return null;
 	}
 
 	/**
@@ -259,7 +138,6 @@
 
 		//鑾峰彇鎵�鏈夋湭瀹屾垚鐘舵�佺殑鍏ュ簱閫氱煡鍗�
 		String companyId = ContextUtil.getCompanyId();
-		String deptId = ContextUtil.subDeptId(null);
 
 		List<InoutNoticeIn> noticeInList = inoutNoticeService.getUnComNoticeIn(companyId);
 
@@ -267,8 +145,6 @@
 			inoutNoticeService.updateSumNoticeIn(noticeInList);
 			return "success";
 		}
-		
-		
 		return "fail";
 	}
 
@@ -283,13 +159,28 @@
 	public InoutNoticeOut initAddOut() {
 		SysUser user = ContextUtil.getLoginUser();
 		InoutNoticeOut data = new InoutNoticeOut();
-		data.setId("CKTZD_" + ContextUtil.generateId());
+		data.setId(ContextUtil.generateOrderId("CK"));
 		data.setName("鍑哄簱閫氱煡鍗�");
 		data.setCompanyId(user.getCompanyId());
 		data.setDeptId(ContextUtil.subDeptId(user));
-		data.setTag(Constant.YN_Y);
+		data.setYear(DateFormatUtils.format(new Date(), "yyyy"));
+		data.setCreateBy(ContextUtil.getLoginUserName());
+		data.setCreateTime(new Date());
 		return data;
 	}
+
+	/**
+	 * inoutNoticePR#getNoticeOutOne
+	 *
+	 * @param businessId
+	 * @return
+	 */
+	@DataProvider
+	public InoutNoticeOut getNoticeOutOne(String businessId) {
+		InoutNoticeOut notice = inoutNoticeService.getNoticeOutOne(businessId);
+		return notice;
+	}
+
 
 	/**
 	 * inoutNoticePR#pageQueryOut 鑾峰彇鍑哄簱閫氱煡鍗�
@@ -297,57 +188,15 @@
 	 * @param param
 	 */
 	@DataProvider
-	public void pageQueryOut(Page<InoutNoticeOut> page, Map<String, Object> param) {
+	public void pageQueryOut(Page<InoutNoticeOut> page, NoticeParam param) {
 
-		if (null == param) {
-			param = new HashMap<>();
-		}
-		Map<String, Object> finalParam = param;
+		com.baomidou.mybatisplus.extension.plugins.pagination.Page<InoutNoticeOut> corePage = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page.getPageNo(), page.getPageSize());
 
-		//澶氬弬鏁板垎椤垫煡璇�
-		Pageable pageable = PageRequest.of(0, 10000, Sort.Direction.ASC, InoutNoticeOut.SORT_PROP);
-		Specification<InoutNoticeOut> specification = new Specification<InoutNoticeOut>() {
-			private static final long serialVersionUID = 1L;
+		inoutNoticeService.pageQueryOut(corePage, param);
 
-			public Predicate toPredicate(Root<InoutNoticeOut> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
-				List<Predicate> predicates = new ArrayList<Predicate>(); //鎵�鏈夌殑鏂█
-
-				Predicate predicate1 = cb.equal(root.get("companyId"), ContextUtil.getCompanyId());
-				predicates.add(predicate1);
-				Predicate predicate2 = cb.equal(root.get("deptId"), ContextUtil.subDeptId(null));
-				predicates.add(predicate2);
-
-				String key = String.valueOf(finalParam.get("year"));
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate3 = cb.equal(root.get("year"), key);
-					predicates.add(predicate3);
-				}
-				key = (String) finalParam.get("id");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate4 = cb.equal(root.get("id"),  key);
-					predicates.add(predicate4);
-				}
-				key = (String) finalParam.get("customerId");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate5 = cb.equal(root.get("customerId"), key);
-					predicates.add(predicate5);
-				}
-				key = (String) finalParam.get("completeStatus");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate6 = cb.equal(root.get("completeStatus"), key);
-					predicates.add(predicate6);
-				}
-				key = (String) finalParam.get("foodVariety");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate7 = cb.equal(root.get("foodVariety"), key);
-					predicates.add(predicate7);
-				}
-				return cb.and(predicates.toArray(new Predicate[0]));
-			}
-		};
-		//org.springframework.data.domain.Page<InoutNoticeOut> japPage = inoutNoticeService.queryAllNoticeOut(specification, pageable);
-		//page.setEntityCount((int) japPage.getTotalElements());
-		//page.setEntities(japPage.getContent());
+		// 閲嶆柊灏佽
+		page.setEntities(corePage.getRecords());
+		page.setEntityCount(Integer.parseInt(String.valueOf(corePage.getTotal())));
 	}
 
 	/**
@@ -355,8 +204,8 @@
 	 * @param data
 	 * @return
 	 */
-	@Expose
-	public String saveOut(InoutNoticeOut data) {
+	@DataResolver
+	public BaseResp saveOut(InoutNoticeOut data) {
 		InoutNoticeOut inoutNoticeOut = new InoutNoticeOut();
 		BeanUtils.copyProperties(data, inoutNoticeOut);
 		return inoutNoticeService.saveOrUpdateOut(inoutNoticeOut);
@@ -366,66 +215,13 @@
 	 * inoutNoticePR#delDataOut
 	 */
 	@Expose
-	public String delDataOut(InoutNoticeOut data) {
+    @Log(title = "閫氱煡鍗曠鐞�", businessType = BusinessType.DELETE,bizType = BizTypeEnum.INOUT)
+    public String delDataOut(InoutNoticeOut data) {
 		InoutNoticeOut inoutNoticeOut = new InoutNoticeOut();
 		BeanUtils.copyProperties(data, inoutNoticeOut);
 		return inoutNoticeService.delDataOut(inoutNoticeOut);
 	}
 
-	/**
-	 * 鏍规嵁涓嶅悓鏉′欢鏌ヨ
-	 * @param param
-	 * @return
-	 */
-	public List<InoutNoticeOut> queryNoticeOut(Map<String, Object> param) {
-		if (null == param) {
-			param = new HashMap<>();
-		}
-		Map<String, Object> finalParam = param;
-
-		//澶氬弬鏁板垎椤垫煡璇�
-		Pageable pageable = PageRequest.of(0, 10000, Sort.Direction.ASC, InoutNoticeOut.SORT_PROP);
-		Specification<InoutNoticeOut> specification = new Specification<InoutNoticeOut>() {
-			private static final long serialVersionUID = 1L;
-
-			public Predicate toPredicate(Root<InoutNoticeOut> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
-				List<Predicate> predicates = new ArrayList<Predicate>(); //鎵�鏈夌殑鏂█
-
-				Predicate predicate1 = cb.equal(root.get("companyId"), ContextUtil.getCompanyId());
-				predicates.add(predicate1);
-				Predicate predicate2 = cb.equal(root.get("deptId"), ContextUtil.subDeptId(null));
-				predicates.add(predicate2);
-				Predicate predicate3 = cb.equal(root.get("completeStatus"), "NONE");
-				predicates.add(predicate3);
-
-				String key = (String) finalParam.get("customerId");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate4 = cb.equal(root.get("customerId"), key);
-					predicates.add(predicate4);
-				}
-				key = (String) finalParam.get("foodVariety");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate5 = cb.equal(root.get("foodVariety"),  key);
-					predicates.add(predicate5);
-				}
-				key = (String) finalParam.get("depotId");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate6 = cb.equal(root.get("depotId"), key);
-					predicates.add(predicate6);
-				}
-				key = (String) finalParam.get("key");
-				if (StringUtils.isNotEmpty(key)) {
-					Predicate predicate7 = cb.like(root.get("name"), "%" + key + "%");
-					predicates.add(predicate7);
-				}
-				return cb.and(predicates.toArray(new Predicate[0]));
-			}
-		};
-		//org.springframework.data.domain.Page<InoutNoticeOut> japPage = inoutNoticeService.queryAllNoticeOut(specification, pageable);
-
-		//return japPage.getContent();
-		return null;
-	}
 
 	/**
 	 * 閲嶆柊鏍哥畻鍑哄簱閫氱煡鍗曞畬鎴愰噺
@@ -439,7 +235,6 @@
 
 		//鑾峰彇鎵�鏈夋湭瀹屾垚鐘舵�佺殑鍏ュ簱閫氱煡鍗�
 		String companyId = ContextUtil.getCompanyId();
-		String deptId = ContextUtil.subDeptId(null);
 
 		List<InoutNoticeOut> noticeOutList = inoutNoticeService.getUnComNoticeOut(companyId);
 
@@ -450,4 +245,56 @@
 		return "fail";
 	}
 
+
+	/**
+	 * inoutNoticePR#queryNoticeByKey  鏍规嵁鍙傛暟鏌ヨ鍑哄叆搴撻�氱煡鍗曪紝鐢ㄤ簬鎵嬪姩琛ュ崟鏃讹紝閫夋嫨閫氱煡鍗�
+	 *
+	 * @param
+	 * @return
+	 */
+	@DataProvider
+	public List<NoticeDto> queryNoticeByKey(Map<String, Object> param) {
+		if (param == null) {
+			return null;
+		}
+		String type = (String)param.get("type");
+		if (StringUtils.isEmpty(type)) {
+			return null;
+		}
+		List<NoticeDto> list = new ArrayList<>();
+		NoticeDto dto;
+
+		NoticeParam noticeParam = new NoticeParam();
+		noticeParam.setCompanyId(ContextUtil.getCompanyId());
+		noticeParam.setDeptId(ContextUtil.subDeptId(null));
+		noticeParam.setAuditStatus(WorkStatus.STATUS_50.getCode());
+		noticeParam.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+		String key = (String)param.get("key");
+		if (StringUtils.isNotEmpty(key)) {
+			noticeParam.setKey(key);
+		}
+
+		if (Constant.TYPE_IN.equals(type)) {
+			List<InoutNoticeIn> listIn = inoutNoticeService.getNoticeIn(noticeParam);
+			if (null != listIn && listIn.size() > 0) {
+				for (InoutNoticeIn inoutNoticeIn : listIn) {
+					dto = new NoticeDto();
+					BeanUtils.copyProperties(inoutNoticeIn, dto);
+					list.add(dto);
+				}
+			}
+		}
+		if (Constant.TYPE_OUT.equals(type)) {
+			List<InoutNoticeOut> listOut = inoutNoticeService.getNoticeOut(noticeParam);
+			if (null != listOut && listOut.size() > 0) {
+				for (InoutNoticeOut inoutNoticeOut : listOut) {
+					dto = new NoticeDto();
+					BeanUtils.copyProperties(inoutNoticeOut, dto);
+					list.add(dto);
+				}
+			}
+		}
+		return list;
+	}
+
 }

--
Gitblit v1.9.3