This commit is contained in:
lmc 2024-12-02 14:30:04 +08:00
commit 6e30f5c17d
14 changed files with 105 additions and 26 deletions

View File

@ -342,15 +342,6 @@
<version>${velocity.version}</version>
</dependency>
<dependency>
<groupId>com.banboocloud</groupId>
<artifactId>banboocloudCodec</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/java/com/ruoyi/project/system/lib/banboocloud_Codec-0.0.jar</systemPath>
</dependency>
<!-- 定时任务 -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
@ -386,6 +377,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>

View File

@ -72,7 +72,7 @@ public class OilMonitorController extends BaseController {
*/
@Log(title = "密封点", businessType = BusinessType.DELETE)
@GetMapping("/delete/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
public AjaxResult remove(@PathVariable Long ids) {
return toAjax(oilMonitorService.deleteOilMonitorByIds(ids));
}

View File

@ -38,7 +38,7 @@ public interface OilMonitorMapper {
* 删除
* @param ids
*/
void deleteOilMonitorByIds(@Param("ids") Long[] ids);
void deleteOilMonitorByIds(@Param("ids") Long ids);
/**
* 获取检测地图

View File

@ -18,7 +18,7 @@ public interface IOilMonitorService {
int updateOilMonitor(OilMonitor oilMonitor);
int deleteOilMonitorByIds(Long[] ids);
int deleteOilMonitorByIds(Long ids);
/**
* 查询检测设备地图列表

View File

@ -49,7 +49,7 @@ public class OilMonitorServiceImpl implements IOilMonitorService {
}
@Override
public int deleteOilMonitorByIds(Long[] ids) {
public int deleteOilMonitorByIds(Long ids) {
oilMonitorMapper.deleteOilMonitorByIds(ids);
return 1;
}

View File

@ -83,6 +83,7 @@ public class OutSideServiceImpl implements OutSideService {
if (rootNode.isArray()) {
for (JsonNode node : rootNode) {
SensorData sd = insertOldData(node);
outSideMapper.insertDevice(sd);
}
} else {

View File

@ -153,10 +153,8 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
</update>
<delete id="deleteOilMonitorByIds">
delete from th_device where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
delete from th_device where id = #{id}
</delete>
<select id="getMonitorMap" resultMap="ThDeviceList">

View File

@ -19,6 +19,18 @@ export function login(username, password, code, uuid) {
})
}
export function singleSign(username, password) {
return request({
url: '/singleSign',
headers: {
isToken: false,
repeatSubmit: false
},
method: 'post',
data: { username, password }
})
}
// 注册方法
export function register(data) {
return request({
@ -66,3 +78,11 @@ export function getAccountName(data) {
params: data
})
}
export function redirectToAuth(data) {
return request({
url: '/redirectToAuth',
method: 'get',
params: data
})
}

View File

@ -8,7 +8,7 @@ import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/register', '/LoginSso']
const whiteList = ['/login', '/register', '/LoginSso', '/LoginRedirect', '/SingleSign']
router.beforeEach((to, from, next) => {
NProgress.start()

View File

@ -51,6 +51,16 @@ export const constantRoutes = [
component: () => import('@/views/login-sso'),
hidden: true
},
{
path: '/SingleSign',
component: () => import('@/views/single-sign'),
hidden: true
},
{
path: '/LoginRedirect',
component: () => import('@/views/login-redirect'),
hidden: true
},
{
path: '/register',
component: () => import('@/views/register'),

View File

@ -1,4 +1,4 @@
import { login, logout, getInfo, getAccountName } from '@/api/login'
import { login, logout, getInfo, getAccountName, singleSign } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import {encrypt, decrypt} from '@/utils/secret'
const user = {
@ -51,6 +51,21 @@ const user = {
})
},
SingleSign({ commit }, userInfo) {
const username = userInfo.userName.trim();
const password = userInfo.password;
let encodePs = encrypt(password)//加密
return new Promise((resolve, reject) => {
singleSign(username, encodePs).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
}).catch(error => {
reject(error)
})
})
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {

View File

@ -0,0 +1,24 @@
<template>
<div></div>
</template>
<script>
export default {
name: "LoginRedirect",
data() {
return {
authorizeUrl: "https://iam.sd-port.com:18010/idp/oauth2/authorize",
clientId: "hfxyjwzxjc",
redirectUri: `${window.location.origin}/prod-api/redirectToAuth&response_type=code&state=123`,
};
},
created() {
this.loginRedirect();
},
methods: {
loginRedirect() {
window.location = `${this.authorizeUrl}?client_id=${this.clientId}&redirect_uri=${this.redirectUri}`;
},
}
};
</script>

View File

@ -7,11 +7,6 @@ export default {
name: "LoginSso",
data() {
return {
loginRules: {},
//
captchaOnOff: true,
//
register: false,
//
redirect: undefined
};
@ -24,7 +19,6 @@ export default {
loginSso() {
//code
const code = this.$route.query.code;
console.log("code="+code)
//
if(code==''||code==undefined||code==null){
//code

View File

@ -0,0 +1,25 @@
<template>
<div></div>
</template>
<script>
export default {
name: "SingleSign",
data() {
return {
redirect: undefined
};
},
created() {
this.singleSign();
},
methods: {
singleSign() {
const { userName, password = "123456" } = this.$route.query;
this.$store.dispatch("SingleSign", { userName, password }).finally(() => {
this.$router.push({ path: "/" }).catch(()=>{});
});
},
}
};
</script>