From 1123d12eb51d23edcd4a39660ef8cd47802b931d Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: Tue, 30 Jan 2024 11:06:32 +0800
Subject: [PATCH] change config
---
src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java | 40 +++++++++++++++-----
src/main/java/com/nanometer/smartlab/controller/UserMngController.java | 8 ++--
src/main/java/com/nanometer/smartlab/realm/ShiroDbRealm.java | 1
src/main/webapp/WEB-INF/cq/cq.properties | 2
pom.xml | 4 +-
src/main/java/com/nanometer/smartlab/util/ExcelUtils.java | 4 ++
src/main/webapp/index.xhtml | 2
src/main/webapp/WEB-INF/sin_ma/sin_ma.properties | 18 +++++++++
8 files changed, 61 insertions(+), 18 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1ecb2c1..3e6290e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -345,7 +345,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
- <version>1.2.75</version>
+ <version>2.0.17</version>
</dependency>
<dependency>
<groupId>com.google.collections</groupId>
@@ -395,7 +395,7 @@
<profile>
<id>test</id>
<properties>
- <profile.active>gslab</profile.active>
+ <profile.active>sin_ma</profile.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
diff --git a/src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java b/src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java
index 4391eb5..09f5862 100644
--- a/src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java
+++ b/src/main/java/com/nanometer/smartlab/controller/ApprovalMngController.java
@@ -178,12 +178,17 @@
this.dangerousFlag = false;//二级审批标志
this.adminApproveUserId = null;
+ Map<Integer,Integer> checkMap=new HashMap<>();
for (OpeApply opeApply : this.selectedList) {
if (!this.opeApplyService.isApplyPendingApproval(opeApply)) {
FacesUtils.warn("只有待审批状态的数据可以审批。");
return;
}
-
+ String currentUserId = getUserId();
+ if(StringUtils.isNotBlank(opeApply.getBeforeApproveUserId())&&!opeApply.getApproveUserId().equalsIgnoreCase(currentUserId)){
+ FacesUtils.warn("提示您已审批完成,请等待二级审批者审批");
+ return;
+ }
/* if (DangerousFlag.DANGEROUS == opeApply.getReagent().getDangerousFlag()) {
if (!"15fc90a1f7bf43bda01313904b543195".equals(this.getUser().getRoleId())) {
dangerousFlag = true;
@@ -193,7 +198,6 @@
if(StringUtils.isBlank(opeApply.getBeforeApproveUserId())){
dangerousFlag = true;
}
-
}else{//其他情形:管制品打开二级审批
String controlProducts = opeApply.getReagent().getControlProducts();
if (StringUtils.isNotBlank(controlProducts)) {
@@ -201,10 +205,20 @@
if (StringUtils.isNotBlank(baseMetaValue) &&StringUtils.isBlank(opeApply.getBeforeApproveUserId())) {
dangerousFlag = true;
}
+ if(StringUtils.isNotBlank(baseMetaValue)) {
+ checkMap.put(1, 1);
+ }else{
+ checkMap.put(0, 1);
+ }
+ }else{
+ checkMap.put(0,1);
}
}
-
+ }
+ if(checkMap.size()>1){
+ FacesUtils.warn("不允许管制品和非管制品同时审批");
+ return;
}
this.memo = null;
@@ -220,14 +234,12 @@
return;
}
- if (this.dangerousFlag) {
- if (this.adminApproveUserId == null || "".equalsIgnoreCase(this.adminApproveUserId)) {
- FacesUtils.warn("请选择系统管理员审批。");
- return;
- }
+ if (this.dangerousFlag &&(this.adminApproveUserId == null || "".equalsIgnoreCase(this.adminApproveUserId))) {
+ FacesUtils.warn("请选择系统管理员审批。");
+ return;
}
-
+ String currentUserId = getUserId();
List<String> applyIds = new ArrayList<>();
List<String> adminApplyIds = new ArrayList<>();
List<String> firstUserIds = new ArrayList<>();
@@ -245,6 +257,10 @@
firstUserIds.add(opeApply.getApproveUserId());
} else {
applyIds.add(opeApply.getId());
+ }
+ if(StringUtils.isNotBlank(opeApply.getBeforeApproveUserId())&&!opeApply.getApproveUserId().equalsIgnoreCase(currentUserId)){
+ FacesUtils.warn("提示您已审批完成,请等待二级审批者审批");
+ return;
}
}
boolean result = this.opeApplyService.updateSelectedOpeApplyStatus(memo, applyIds, adminApproveUserId, adminApplyIds,firstUserIds);
@@ -269,10 +285,14 @@
FacesUtils.warn("请将拒绝理由输入在批注中。");
return;
}
-
+ String currentUserId = getUserId();
List<String> applyIds = new ArrayList<String>();
for (OpeApply opeApply : this.selectedList) {
applyIds.add(opeApply.getId());
+ if(StringUtils.isNotBlank(opeApply.getBeforeApproveUserId())&&!opeApply.getApproveUserId().equalsIgnoreCase(currentUserId)){
+ FacesUtils.warn("二级审批无权限");
+ return;
+ }
}
this.opeApplyService.updateOpeApplyStatus(ApplyStatus.REFUSE, this.memo, applyIds);
diff --git a/src/main/java/com/nanometer/smartlab/controller/UserMngController.java b/src/main/java/com/nanometer/smartlab/controller/UserMngController.java
index fbce822..d8dfaf3 100644
--- a/src/main/java/com/nanometer/smartlab/controller/UserMngController.java
+++ b/src/main/java/com/nanometer/smartlab/controller/UserMngController.java
@@ -8,14 +8,12 @@
import com.nanometer.smartlab.entity.enumtype.SeeFlag;
import com.nanometer.smartlab.entity.enumtype.ValidFlag;
import com.nanometer.smartlab.entity.enumtype.Waster;
+import com.nanometer.smartlab.realm.ShiroDbRealm;
import com.nanometer.smartlab.service.BaseMetaService;
import com.nanometer.smartlab.service.BaseRoleService;
import com.nanometer.smartlab.service.SysProjectService;
import com.nanometer.smartlab.service.SysUserService;
-import com.nanometer.smartlab.util.Constants;
-import com.nanometer.smartlab.util.FacesUtils;
-import com.nanometer.smartlab.util.IDUtils;
-import com.nanometer.smartlab.util.MD5Utils;
+import com.nanometer.smartlab.util.*;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
@@ -546,6 +544,8 @@
sysUser.setPassword(MD5Utils.encode(sysUser.getPassword()));
}
this.sysUserService.updateSysUser(sysUser);
+ ShiroDbRealm shiroDbRealm= SpringUtil.getBean("authorizationRealm",ShiroDbRealm.class);
+ shiroDbRealm.removeUserCache(sysUser.getAccount());
FacesUtils.info("修改成功。");
RequestContext.getCurrentInstance().execute("PF('dialog').hide()");
diff --git a/src/main/java/com/nanometer/smartlab/realm/ShiroDbRealm.java b/src/main/java/com/nanometer/smartlab/realm/ShiroDbRealm.java
index 83ca292..dc83fb6 100644
--- a/src/main/java/com/nanometer/smartlab/realm/ShiroDbRealm.java
+++ b/src/main/java/com/nanometer/smartlab/realm/ShiroDbRealm.java
@@ -106,4 +106,5 @@
principals.add(loginName, super.getName());
super.clearCachedAuthenticationInfo(principals);
}
+
}
diff --git a/src/main/java/com/nanometer/smartlab/util/ExcelUtils.java b/src/main/java/com/nanometer/smartlab/util/ExcelUtils.java
index 4ba663e..c2cff47 100644
--- a/src/main/java/com/nanometer/smartlab/util/ExcelUtils.java
+++ b/src/main/java/com/nanometer/smartlab/util/ExcelUtils.java
@@ -19,6 +19,10 @@
public class ExcelUtils {
+ static {
+ System.setProperty("java.awt.headless", "false");
+ }
+
public static SXSSFWorkbook exportExcelNew(Map<String, String> map, List<Map> dataList, String name){
SXSSFWorkbook sb = new SXSSFWorkbook(1000);
Integer total = null;
diff --git a/src/main/webapp/WEB-INF/cq/cq.properties b/src/main/webapp/WEB-INF/cq/cq.properties
index 8a06e74..7d4165d 100644
--- a/src/main/webapp/WEB-INF/cq/cq.properties
+++ b/src/main/webapp/WEB-INF/cq/cq.properties
@@ -1,4 +1,4 @@
-jdbc.url=jdbc:mysql://192.168.30.107:3306/cq_smartlab?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc:mysql://121.239.169.27:23306/cq_smartlab?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
#jdbc.url=jdbc:mysql://sinanoaq.com:23306/cq_smartlab?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
jdbc.username=root
jdbc.password=NMS@uss20201!
diff --git a/src/main/webapp/WEB-INF/sin_ma/sin_ma.properties b/src/main/webapp/WEB-INF/sin_ma/sin_ma.properties
new file mode 100644
index 0000000..8e0f358
--- /dev/null
+++ b/src/main/webapp/WEB-INF/sin_ma/sin_ma.properties
@@ -0,0 +1,18 @@
+jdbc.url=jdbc\:mysql\://localhost\:33306/smartlb?useUnicode\=true&characterEncoding\=utf-8&autoReconnect\=true&useSSL\=false
+jdbc.username=smartlb
+jdbc.password=kabAG6TmMhrmB7MJ
+
+institute.id = 2
+institute.name = \u4E2D\u56FD\u79D1\u5B66\u9662\u82CF\u5DDE\u7EB3\u7C73\u6280\u672F\u4E0E\u7EB3\u7C73\u4EFF\u751F\u7814\u7A76\u6240\u9A6C\u660C\u671F\u8BFE\u9898\u7EC4
+institute.logo = /resources/images/\u4E2D\u56FD\u79D1\u5B66\u9662\u82CF\u5DDE\u7EB3\u7C73\u6280\u672F\u4E0E\u7EB3\u7C73\u4EFF\u751F\u7814\u7A76\u6240logo.png
+institute.url = http://sinanoaq.com
+institute.app.id =
+institute.app.secret =
+alarm.url = http://sinanoaq.com/daping/sendWarnInfo.json
+reagent.detail.price.api =
+institute.copyright= Copyright\u00A92017 \u4E2D\u56FD\u79D1\u5B66\u9662\u82CF\u5DDE\u7EB3\u7C73\u6280\u672F\u4E0E\u7EB3\u7C73\u4EFF\u751F\u7814\u7A76\u6240\u00A0\u82CFICP\u590710220403\u53F7-6
+
+message.url= https://sinanoaq.com:8095/api/sendmessage
+personImgPath = /opt/file/smartlab/img/
+
+envTag = sin
\ No newline at end of file
diff --git a/src/main/webapp/index.xhtml b/src/main/webapp/index.xhtml
index c9e980c..a51c076 100644
--- a/src/main/webapp/index.xhtml
+++ b/src/main/webapp/index.xhtml
@@ -104,7 +104,7 @@
<p:panelGrid styleClass="menu" columns="1">
<c:if test="#{menuController.menuList != null and menuController.menuList.size() > 0}">
<c:forEach items="#{menuController.menuList}" var="menu">
- <c:if test="#{menu.dispInMenuList}">
+ <c:if test="#{menu.dispInMenuList and (menu.id ne 'system_link' or menuController.activeEnv eq 'gslab') }">
<c:if test="#{menu.subMenu != null and menu.subMenu.size() > 0}">
<p:panelMenu style="border: none">
<p:submenu label="#{menu.title}" rendered="#{menuController.isDispRootMenu(menu)}"
--
Gitblit v1.9.2