From 760e53aeef80c287ced8b6716336733867fc7565 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: 星期四, 07 三月 2024 08:30:57 +0800
Subject: [PATCH] 新增需求

---
 src/main/java/com/nanometer/smartlab/service/OpeApplyServiceImpl.java |   65 ++++++++++++++++++++++++++++----
 1 files changed, 57 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/service/OpeApplyServiceImpl.java b/src/main/java/com/nanometer/smartlab/service/OpeApplyServiceImpl.java
index fed8f2c..cd38618 100644
--- a/src/main/java/com/nanometer/smartlab/service/OpeApplyServiceImpl.java
+++ b/src/main/java/com/nanometer/smartlab/service/OpeApplyServiceImpl.java
@@ -22,6 +22,7 @@
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.primefaces.event.FileUploadEvent;
 import org.primefaces.model.UploadedFile;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.dao.DataAccessException;
 import org.springframework.dao.DataIntegrityViolationException;
@@ -67,11 +68,16 @@
     SysSequenceService sysSequenceService;
 	@Resource
 	private SysUserService sysUserService;
+    @Resource
+    private BaseMetaService baseMetaService;
+
+    @Value("${activeEnv}")
+    private String activeEnv;
 
     @Transactional(propagation = Propagation.REQUIRED)
-    public List<OpeApply> getOpeApplyList(String reagentName, Timestamp startDeadline, Timestamp endDeadline, Integer status,
+    public List<OpeApply> getOpeApplyList(String reagentName, Timestamp startDeadline, String controlProduct,Timestamp endDeadline, Integer status,
                                           String applyUserId, String approveUserId, String queryCas,
-                                          Integer first, Integer pageSize,String applyCode,String applyUserName) {
+                                          Integer first, Integer pageSize,String applyCode,String applyUserName,Byte isShow) {
         try {
             Map<String, Object> params = new HashMap<String, Object>();
             if (StringUtils.isNotBlank(reagentName)) {
@@ -80,6 +86,8 @@
             params.put("startDeadline", startDeadline);
             params.put("endDeadline", endDeadline);
             params.put("status", status);
+            params.put("isShow", isShow);
+            params.put("controlProduct", controlProduct);
 
             if (StringUtils.isNotBlank(applyUserId)) {
     			SysUser sysUser = sysUserService.getSysUser(applyUserId);
@@ -191,8 +199,8 @@
     }
 
     @Transactional(propagation = Propagation.REQUIRED)
-    public int getOpeApplyTotalCount(String reagentName, Timestamp startDeadline, Timestamp endDeadline, Integer status,
-                                     String applyUserId, String approveUserId, String queryCas,String applyCode,String applyUserName) {
+    public int getOpeApplyTotalCount(String reagentName, Timestamp startDeadline,String controlProduct, Timestamp endDeadline, Integer status,
+                                     String applyUserId, String approveUserId, String queryCas,String applyCode,String applyUserName,Byte isShow) {
         try {
             Map<String, Object> params = new HashMap<String, Object>();
             if (StringUtils.isNotBlank(reagentName)) {
@@ -201,6 +209,8 @@
             params.put("startDeadline", startDeadline);
             params.put("endDeadline", endDeadline);
             params.put("status", status);
+            params.put("isShow", isShow);
+            params.put("controlProduct", controlProduct);
 
     		if (StringUtils.isNotBlank(applyUserId)) {
     			SysUser sysUser = sysUserService.getSysUser(applyUserId);
@@ -366,7 +376,11 @@
     public boolean updateSelectedOpeApplyStatus(String memo, List<String> applyIds, String adminUserId, List<String> adminApplyIds,List<String> firstUserIds) {
         boolean apply = false, adminApply = false;
         if (!CollectionUtils.isEmpty(applyIds)) {
-            apply = this.updateOpeApplyStatus(ApplyStatus.APPROVED, memo, applyIds);
+            if("gslab".equalsIgnoreCase(activeEnv)){
+                apply = this.updateOpeApplyStatus(ApplyStatus.Price_CONFIRM, memo, applyIds);
+            }else{
+                apply = this.updateOpeApplyStatus(ApplyStatus.APPROVED, memo, applyIds);
+            }
         }
         if (!CollectionUtils.isEmpty(adminApplyIds)) {
             adminApply = this.updateOpeApplyAdminStatus2(memo, adminApplyIds, adminUserId,firstUserIds);
@@ -556,7 +570,7 @@
             params.put("productSn",productSn);
             params.put("applyCode",applyCode);
             if (isExpired) {
-                params.put("status",ApplyStatus.EXPIRED);
+                params.put("status",ApplyStatus.EXPIRED.getKey());
             }else{
                 params.put("status", status);
             }
@@ -581,7 +595,7 @@
             params.put("productSn",productSn);
             params.put("applyCode",applyCode);
             if (isExpired) {
-                params.put("status",ApplyStatus.EXPIRED);
+                params.put("status",ApplyStatus.EXPIRED.getKey());
             }else{
                 params.put("status", status);
             }
@@ -863,7 +877,7 @@
                 //申购数量
                 opeApply.setNum(num);
                 //申购人
-                opeApply.setApplyUserId(user.getId());
+                opeApply.setApplyUserId(applyUser.getId());
                 //选择的审批人
                 opeApply.setApproveUserId(approveUser.getId());
                 //选择的课题组信息
@@ -884,4 +898,39 @@
         return opeApplyDao.getOpeApplyReserveListByNameForRowData(rowKey);
     }
 
+    @Override
+    public int getOpeApplySupplerRequireMngTotalCount(SysUser user,String reagentName, Timestamp startDeadline, Timestamp endDeadline, int status, byte isShow) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("reagentName",reagentName );
+        params.put("startDeadline", startDeadline);
+        params.put("endDeadline", endDeadline);
+        params.put("status", status);
+        params.put("isShow", isShow);
+        //看到供应商是自己的单位的数据
+        String company = baseMetaService.getBaseMetaValue(user.getCompany());
+        if (user.getSeeFlag().getKey() != SeeFlag.MANAGE.getKey()
+                && user.getSeeFlag().getKey() != SeeFlag.LEADING.getKey()) {
+            params.put("company", company);
+        }
+        return this.opeApplyDao.getOpeApplySupplerRequireMngTotalCount(params);
+    }
+
+    @Override
+    public List<OpeApply> getOpeApplySupplerRequireMngList(SysUser user,String reagentName, Timestamp startDeadline, Timestamp endDeadline, int status, int first, int pageSize, byte isShow) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("reagentName", reagentName);
+        params.put("startDeadline", startDeadline);
+        params.put("endDeadline", endDeadline);
+        params.put("status", status);
+        params.put("isShow", isShow);
+        //看到供应商是自己的单位的数据
+        String company = baseMetaService.getBaseMetaValue(user.getCompany());
+        if (user.getSeeFlag().getKey() != SeeFlag.MANAGE.getKey()
+                && user.getSeeFlag().getKey() != SeeFlag.LEADING.getKey()) {
+            params.put("company", company);
+        }
+
+        return this.opeApplyDao.getOpeApplySupplerRequireMngList(params);
+    }
+
 }

--
Gitblit v1.9.2