This commit is contained in:
JIAL 2024-03-06 08:46:51 +08:00
commit 6c95ddf924
8 changed files with 93 additions and 38 deletions

View File

@ -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 "";
}
}
}

View File

@ -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);

View File

@ -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;

View File

@ -198,3 +198,7 @@ minio:
accessKey: minioadmin
secretKey: minioadmin
bucketName: test
# OA单点登录key
OA:
KEY: uy4MbH

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/ruoyi/logs" />
<property name="log.path" value="D:/ruoyi/logs" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
@ -11,7 +11,7 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
@ -34,7 +34,7 @@
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
@ -56,7 +56,7 @@
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
@ -70,7 +70,7 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
@ -79,15 +79,15 @@
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
</configuration>
</configuration>

View File

@ -69,19 +69,20 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table width="100%" v-loading="loading" :data="factoryList" @selection-change="handleSelectionChange">
<el-table width="100%" v-loading="loading" :data="factoryList" :row-class-name="rowFactoryIndex" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="index" width="80"/>
<el-table-column label="id" align="center" prop="factoryId" v-if="false"/>
<el-table-column label="编码" width="100" align="center" prop="factoryNo" />
<el-table-column label="名称" width="100" align="center" prop="factoryName" />
<el-table-column label="人工成本占比" width="150" align="center" prop="factoryRgRatio" />
<el-table-column label="五金费用占比" width="150" align="center" prop="factoryWjRatio" />
<el-table-column label="辅料费用占比" width="150" align="center" prop="factoryFlRatio" />
<el-table-column label="电费占比" width="150" align="center" prop="factoryDfRatio" />
<el-table-column label="天然气费用占比" width="150" align="center" prop="factoryTrqRatio" />
<el-table-column label="运输费用占比" width="150" align="center" prop="factoryYsRatio" />
<el-table-column label="总占比" align="center" prop="factoryTotalRatio" />
<el-table-column label="盘具费用占比" width="150" align="center" prop="factoryPjRatio" />
<el-table-column label="人工成本占比(%)" width="150" align="center" prop="factoryRgRatio" />
<el-table-column label="五金费用占比(%)" width="150" align="center" prop="factoryWjRatio" />
<el-table-column label="辅料费用占比(%)" width="150" align="center" prop="factoryFlRatio" />
<el-table-column label="电费占比(%)" width="150" align="center" prop="factoryDfRatio" />
<el-table-column label="天然气费用占比(%)" width="150" align="center" prop="factoryTrqRatio" />
<el-table-column label="运输费用占比(%)" width="150" align="center" prop="factoryYsRatio" />
<el-table-column label="总占比(%)" width="150" align="center" prop="factoryTotalRatio" />
<el-table-column label="盘具费用占比(%)" width="150" align="center" prop="factoryPjRatio" />
<el-table-column fixed="right" label="操作" align="center" width="150">
<template slot-scope="scope">
<el-button
@ -115,60 +116,60 @@
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="编码" prop="factoryNo" label-width="120px">
<el-form-item label="编码" prop="factoryNo" label-width="150px">
<el-input v-model="form.factoryNo" placeholder="请输入编码" :disabled="isDis"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="factoryName" label-width="120px">
<el-form-item label="名称" prop="factoryName" label-width="150px">
<el-input v-model="form.factoryName" placeholder="请输入名称" :disabled="isDis" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="人工成本占比" prop="factoryRgRatio" label-width="120px">
<el-form-item label="人工成本占比(%)" prop="factoryRgRatio" label-width="150px">
<el-input v-model="form.factoryRgRatio" placeholder="请输入人工成本占比" @input="wat()"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="五金费用占比" prop="factoryWjRatio" label-width="120px">
<el-form-item label="五金费用占比(%)" prop="factoryWjRatio" label-width="150px">
<el-input v-model="form.factoryWjRatio" placeholder="请输入五金费用占比" @input="wat()"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="辅料费用占比" prop="factoryFlRatio" label-width="120px">
<el-form-item label="辅料费用占比(%)" prop="factoryFlRatio" label-width="150px">
<el-input v-model="form.factoryFlRatio" placeholder="请输入辅料费用占比" @input="wat()"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="电费占比" prop="factoryDfRatio" label-width="120px">
<el-form-item label="电费占比(%)" prop="factoryDfRatio" label-width="150px">
<el-input v-model="form.factoryDfRatio" placeholder="请输入电费占比" @input="wat()"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="天然气费用占比" prop="factoryTrqRatio" label-width="120px">
<el-form-item label="天然气费用占比(%)" prop="factoryTrqRatio" label-width="150px">
<el-input v-model="form.factoryTrqRatio" placeholder="请输入天然气费用占比" @input="wat()"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运输费用占比" prop="factoryYsRatio" label-width="120px">
<el-form-item label="运输费用占比(%)" prop="factoryYsRatio" label-width="150px">
<el-input v-model="form.factoryYsRatio" placeholder="请输入运输费用占比" @input="wat()"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="盘具费用占比" prop="factoryPjRatio" label-width="120px">
<el-form-item label="盘具费用占比(%)" prop="factoryPjRatio" label-width="150px">
<el-input v-model="form.factoryPjRatio" placeholder="请输入盘具费用占比" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总占比" prop="factoryYsRatio" label-width="120px">
<el-form-item label="总占比(%)" prop="factoryYsRatio" label-width="150px">
<el-input v-model="form.factoryTotalRatio" :disabled="true"/>
</el-form-item>
</el-col>
@ -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;
}
}
};

View File

@ -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()
});
},

View File

@ -71,6 +71,7 @@
<el-table v-loading="loading" :data="materialTypeList" :row-class-name="rowCMaterialTypeIndex" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="index" width="80"/>
<el-table-column label="id" align="center" prop="typeId" v-if="false"/>
<el-table-column label="编码" align="center" prop="typeNo" />
<el-table-column label="名称" align="center" prop="typeName" />