From 8e7f6f72f7f44a33021b8c198be8f252d2641020 Mon Sep 17 00:00:00 2001
From: xd <844539747@qq.com>
Date: Tue, 5 Mar 2024 14:08:13 +0800
Subject: [PATCH 1/3] '20240305'
---
.../main/java/com/ruoyi/web/Utils/SHA1.java | 33 +++++++++++++++++++
.../controller/system/SsoLoginController.java | 18 ++++++++--
.../controller/system/SysUserController.java | 3 --
.../src/main/resources/application.yml | 4 +++
4 files changed, 52 insertions(+), 6 deletions(-)
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/Utils/SHA1.java
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/SHA1.java b/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/SHA1.java
new file mode 100644
index 0000000..b62a3a9
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/SHA1.java
@@ -0,0 +1,33 @@
+package com.ruoyi.web.Utils;
+
+import java.security.MessageDigest;
+
+public class SHA1 {
+ /**
+ * @Comment SHA1实现
+ * @Author Ron
+ * @Date 2017年9月13日 下午3:30:36
+ * @return
+ */
+ public static String shaEncode(String inStr){
+ MessageDigest sha = null;
+ try {
+ sha = MessageDigest.getInstance("SHA");
+ byte[] byteArray = inStr.getBytes("UTF-8");
+ byte[] md5Bytes = sha.digest(byteArray);
+ StringBuffer hexValue = new StringBuffer();
+ for (int i = 0; i < md5Bytes.length; i++) {
+ int val = ((int) md5Bytes[i]) & 0xff;
+ if (val < 16) {
+ hexValue.append("0");
+ }
+ hexValue.append(Integer.toHexString(val));
+ }
+ return hexValue.toString();
+ } catch (Exception e) {
+ System.out.println(e.toString());
+ e.printStackTrace();
+ return "";
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SsoLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SsoLoginController.java
index 4642acf..2293503 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SsoLoginController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SsoLoginController.java
@@ -14,12 +14,16 @@ import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.NoPswLoginBody;
import com.ruoyi.framework.web.service.SsoLoginService;
+import com.ruoyi.web.Utils.SHA1;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
+import java.security.MessageDigest;
+
/**
* 第三方登录验证
*
@@ -27,6 +31,10 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
public class SsoLoginController {
+
+ @Value("${OA.KEY}")
+ private String key;
+
/**
* @Description: 平台带着token来系统里面登陆
* 这边需要做两个步骤:
@@ -43,14 +51,18 @@ public class SsoLoginController {
@PostMapping("/noPwdLogin")
@ApiOperation(value = "无密码登录")
public AjaxResult noPwdLogin(@RequestBody NoPswLoginBody noPswLoginBody) {
+ // 生成令牌(免密登录)
+ AjaxResult ajax = AjaxResult.success();
+
String loginid = noPswLoginBody.getLoginid();
String token = noPswLoginBody.getToken();
//OA验证
- //....
+ String newToken = SHA1.shaEncode(key+loginid);
+ if(!token.equals(newToken)){
+ return ajax.error("访问异常!");
+ }
- // 生成令牌(免密登录)
- AjaxResult ajax = AjaxResult.success();
// 生成令牌
String systoken = loginService.noPwdLogin(loginid);
ajax.put(Constants.TOKEN, systoken);
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index 89990ec..2858f30 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -13,10 +13,7 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.domain.cost;
import com.ruoyi.system.domain.material;
-import com.ruoyi.system.domain.temp;
import com.ruoyi.system.service.*;
-import com.ruoyi.web.Utils.batchInsert;
-import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index 6deac76..bf479a4 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -198,3 +198,7 @@ minio:
accessKey: minioadmin
secretKey: minioadmin
bucketName: test
+
+# OA单点登录key
+OA:
+ KEY: uy4MbH
From bccde8e7f6b66b615cdcd6aaa483aa100f86ad45 Mon Sep 17 00:00:00 2001
From: xd <844539747@qq.com>
Date: Tue, 5 Mar 2024 16:30:56 +0800
Subject: [PATCH 2/3] '20240305'
---
ruoyi-ui/src/views/factory/factory/index.vue | 46 +++++++++++--------
.../src/views/material/material/index.vue | 10 ++--
.../views/materialType/materialType/index.vue | 1 +
3 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/ruoyi-ui/src/views/factory/factory/index.vue b/ruoyi-ui/src/views/factory/factory/index.vue
index 39dc70b..950b89e 100644
--- a/ruoyi-ui/src/views/factory/factory/index.vue
+++ b/ruoyi-ui/src/views/factory/factory/index.vue
@@ -69,19 +69,20 @@
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -318,7 +319,6 @@ export default {
},
created() {
this.getList();
- this.getMaterialType();
},
methods: {
/** 查询车间管理列表 */
@@ -389,6 +389,7 @@ export default {
this.open = true;
this.title = "添加车间管理";
this.isDis = false;
+ this.getMaterialType();
},
/** 修改按钮操作 */
handleUpdate(row) {
@@ -400,6 +401,7 @@ export default {
this.open = true;
this.title = "修改车间管理";
this.isDis = true;
+ this.getMaterialType();
});
},
/** 提交按钮 */
@@ -484,6 +486,10 @@ export default {
var YsRatio = this.form.factoryYsRatio?parseFloat(this.form.factoryYsRatio):0;
this.form.factoryTotalRatio = (RgRatio+WjRatio+FlRatio+DfRatio+TrqRatio+YsRatio).toFixed(3)
+ },
+ /** 序号 */
+ rowFactoryIndex({ row, rowIndex }) {
+ row.index = rowIndex + 1;
}
}
};
diff --git a/ruoyi-ui/src/views/material/material/index.vue b/ruoyi-ui/src/views/material/material/index.vue
index 6af022b..d19a525 100644
--- a/ruoyi-ui/src/views/material/material/index.vue
+++ b/ruoyi-ui/src/views/material/material/index.vue
@@ -290,8 +290,6 @@ export default {
},
created() {
this.getList();
- this.getClMaterials();
- this.getMaterialType();
},
computed:{
@@ -326,13 +324,13 @@ export default {
getMaterialType(){
listMaterialType(this.queryParams).then(response => {
this.cTypeList = response.cTypeList;
-
+/*
let obj = {};
this.cTypeList.forEach(item => {
let key = item.typeNo;
obj[key] = item.typeName;
})
- this.cTypeMap = obj;
+ this.cTypeMap = obj;*/
});
},
@@ -374,6 +372,8 @@ export default {
this.reset();
this.open = true;
this.title = "添加物料管理";
+ this.getClMaterials();
+ this.getMaterialType();
},
/** 修改按钮操作 */
handleUpdate(row) {
@@ -384,6 +384,8 @@ export default {
this.cMaterialCostList = response.data.cmaterialCostList;
this.open = true;
this.title = "修改物料管理";
+ this.getClMaterials();
+ this.getMaterialType();
this.sumPriceTotal()
});
},
diff --git a/ruoyi-ui/src/views/materialType/materialType/index.vue b/ruoyi-ui/src/views/materialType/materialType/index.vue
index 271c982..8a45016 100644
--- a/ruoyi-ui/src/views/materialType/materialType/index.vue
+++ b/ruoyi-ui/src/views/materialType/materialType/index.vue
@@ -71,6 +71,7 @@
+
From 76cd127fc737b2ea22b42ead2dd74861f86598af Mon Sep 17 00:00:00 2001
From: xd <844539747@qq.com>
Date: Tue, 5 Mar 2024 16:44:16 +0800
Subject: [PATCH 3/3] 11
---
ruoyi-admin/src/main/resources/logback.xml | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml
index a360583..d8be2b9 100644
--- a/ruoyi-admin/src/main/resources/logback.xml
+++ b/ruoyi-admin/src/main/resources/logback.xml
@@ -1,7 +1,7 @@
-
+
@@ -11,7 +11,7 @@
${log.pattern}
-
+
${log.path}/sys-info.log
@@ -34,7 +34,7 @@
DENY
-
+
${log.path}/sys-error.log
@@ -56,7 +56,7 @@
DENY
-
+
${log.path}/sys-user.log
@@ -70,7 +70,7 @@
${log.pattern}
-
+
@@ -79,15 +79,15 @@
-
+
-
+
-
\ No newline at end of file
+