Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
7030656019
|
@ -176,7 +176,11 @@
|
|||
<artifactId>okhttps-fastjson2</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.banboocloud.Codec </groupId>
|
||||
<artifactId>banboocloud_Codec</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<!-- Spring框架基本的核心工具-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
@ -223,8 +227,41 @@
|
|||
<version>3.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.banboocloud.Codec </groupId>
|
||||
<artifactId>banboocloud_Codec</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jodd</groupId>
|
||||
<artifactId>jodd-http</artifactId>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-ext-jdk15on</artifactId>
|
||||
<version>1.69</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcpkix-jdk15on</artifactId>
|
||||
<version>1.69</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.69</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JAX-WS API -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.ws</groupId>
|
||||
|
|
|
@ -2,6 +2,10 @@ package com.ruoyi.common.OAuth;
|
|||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.framework.security.service.SysLoginService;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
@ -15,6 +19,7 @@ import java.net.HttpURLConnection;
|
|||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Author:Zhenggang
|
||||
|
@ -29,23 +34,24 @@ public class OauthDemo {
|
|||
//认证地址
|
||||
public static final String BASE_URL = "http://utuum.sd-gold.com:7021/idp/oauth2";
|
||||
//应用注册id
|
||||
public static final String CLIENT_ID = "ERM";
|
||||
public static final String CLIENT_ID = "hfxyjwzxjc";
|
||||
//应用注册key
|
||||
public static final String CLIENT_SECRET = "ermsecret";
|
||||
public static final String CLIENT_SECRET = "2c9ecb1b6b1f47d297abb6ffa7ede060";
|
||||
|
||||
//获取access_token的url
|
||||
public static final String GET_ACCESS_TOKEN_URL = BASE_URL + "/getToken";
|
||||
//获取用户信息的url
|
||||
public static final String GET_USERINFO_URL = BASE_URL + "/getUserInfo?client_id=" + CLIENT_ID + "&access_token=";
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
/**
|
||||
* 访问ip:port/root/redirectToAuth时,拼接并且重定向到
|
||||
* http://utuum.sd-gold.com:7021/idp/oauth2/authorize?redirect_uri=ip:port/root/getAccountName&state=sso&client_id=ECD&response_type=code
|
||||
*/
|
||||
@RequestMapping("/redirectToAuth")
|
||||
public void reToAuth(HttpServletRequest request, HttpServletResponse response) {
|
||||
String url = request.getRequestURL().toString().replaceAll("/redirectToAuth", "/getAccountName");
|
||||
String url = request.getRequestURL().toString().replaceAll("/prod-api/redirectToAuth", "/prod-api/getAccountName");
|
||||
String re_url = BASE_URL + "/authorize?redirect_uri=" + url + "&state=sso&client_id=" + CLIENT_ID + "&response_type=code";
|
||||
try {
|
||||
response.sendRedirect(re_url);
|
||||
|
@ -61,7 +67,7 @@ public class OauthDemo {
|
|||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/getAccountName", method = RequestMethod.GET)
|
||||
public String getAccountName(@RequestParam(name = "code") String code) {
|
||||
public AjaxResult getAccountName(@RequestParam(name = "code") String code) {
|
||||
String accessTokenParam = null;
|
||||
System.out.println("1).authorize code is:" + code);
|
||||
try {
|
||||
|
@ -88,12 +94,18 @@ public class OauthDemo {
|
|||
}
|
||||
System.out.println("3).userInfo is :" + userInfo);
|
||||
String acc = getValueFromJson(userInfo, "spRoleList");
|
||||
String userName = getValueFromJson(userInfo, "userName");
|
||||
String passWord = getValueFromJson(userInfo, "passWord");
|
||||
if (acc == null || acc.equals("")) {
|
||||
System.out.println("cannot get acc");
|
||||
return null;
|
||||
}
|
||||
System.out.println("the acc is :" + acc);
|
||||
return "the acc is : " + acc;
|
||||
String s = loginService.loginNoCaptcha(userName, passWord, null);
|
||||
AjaxResult success = AjaxResult.success();
|
||||
success.put(Constants.TOKEN,s);
|
||||
success.put("mgs","登录成功");
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,10 +6,12 @@ import cn.zhxu.okhttps.HttpResult;
|
|||
import cn.zhxu.okhttps.OkHttps;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.ruoyi.common.task.forest.MyTaskClient;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||
import com.ruoyi.project.oil.domain.monitor.ThDevice;
|
||||
import com.ruoyi.project.oil.mapper.ThDeviceMapper;
|
||||
import com.ruoyi.project.outside.service.OutSideService;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -18,6 +20,7 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class EquTask {
|
||||
|
@ -28,10 +31,12 @@ public class EquTask {
|
|||
private MyTaskClient myClient;
|
||||
@Autowired
|
||||
private OutSideService outSideService;
|
||||
@Autowired
|
||||
private ThDeviceMapper thDeviceMapper;
|
||||
/**
|
||||
* 港口原有设备对接
|
||||
*/
|
||||
@Scheduled(fixedRate = 10000)
|
||||
// @Scheduled(fixedRate = 10000)
|
||||
public void equ(){
|
||||
String hash = "16EA8A305FB58BE0730DD67F04F022F4";
|
||||
|
||||
|
@ -42,11 +47,9 @@ public class EquTask {
|
|||
JSONObject tokenByJson = httpResult.getBody().toBean(JSONObject.class);
|
||||
JSONObject dataByJson = tokenByJson.getJSONObject("data");
|
||||
String token = dataByJson.getString("token");
|
||||
ArrayList<ThDevice> equLists = new ArrayList<>(); //查询 数据库 获取 港口以前的 设备信息
|
||||
ThDevice thDevice = new ThDevice();
|
||||
thDevice.setSn("e75153fd53d243289057ffec33f36cb9");
|
||||
thDevice.setName("油气回收voc监测设备3#");
|
||||
equLists.add(thDevice);
|
||||
thDevice.setDeptId(5l);
|
||||
List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice);
|
||||
equLists.forEach(e->{
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
|
||||
|
@ -55,12 +58,17 @@ public class EquTask {
|
|||
HttpResult result = OkHttps.sync("http://10.201.35.30:8090/enviSensor/select?" +
|
||||
"page=1&pageSize=20&valid=0&type=5&sensorUId={sensorUId}&label={label}")
|
||||
.addPathPara(map)
|
||||
.addHeader("token", token)
|
||||
.get();
|
||||
JSONObject vocByJson = result.getBody().toBean(JSONObject.class);
|
||||
JSONObject vocDataByJson = vocByJson.getJSONObject("data");
|
||||
JSONArray vocByArray = vocDataByJson.getJSONArray("array");
|
||||
System.out.println(vocByArray.toJSONString());
|
||||
.addHeader("token", token)
|
||||
.get();
|
||||
JSONObject vocByJson = result.getBody().toBean(JSONObject.class);
|
||||
JSONObject vocDataByJson = vocByJson.getJSONObject("data");
|
||||
JSONArray vocByArray = vocDataByJson.getJSONArray("array");
|
||||
System.out.println(vocByArray.toString());
|
||||
try {
|
||||
Integer integer = outSideService.insertOldDeviceData(vocByArray.toJSONString());
|
||||
} catch (JsonProcessingException jsonProcessingException) {
|
||||
jsonProcessingException.printStackTrace();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.common.wsdl;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.http.webservice.SoapClient;
|
||||
|
||||
|
||||
|
@ -12,24 +13,24 @@ import javax.xml.soap.SOAPMessage;
|
|||
*/
|
||||
public class TestWsdl {
|
||||
public static void main(String[] args) throws Exception {
|
||||
// 创建SoapClient实例 wsdl协议请求地址:http://xxx.cn/services/GanSuInterface (去掉?wsdl)
|
||||
SoapClient client = SoapClient.create("http://10.171.19.193:8080/dxpt/ws/shortMessageWs")
|
||||
// 设置方法名和命名空间(命名空间url:http://webservice.xxx.xxx ,方法名:getSydwJsonList)
|
||||
// tns 命名空间targetNamespace,没有命名空间时直接写方法名即可
|
||||
.setMethod("tns:returnMassages", "http://service.cxf.com")
|
||||
// 设置参数(最后的false参数表示参数不加命名空间的前缀web)
|
||||
.setParam("in0", "afe9cff39173ff8901917a54c90e448d", false);
|
||||
|
||||
//获取SOAPMessage实例(此步作用是输出请求的XML参数,实际开发并不需要)
|
||||
SOAPMessage message = client.getMessage();
|
||||
System.out.println(client.getMsgStr(true));
|
||||
|
||||
// 发送请求(true表示输出的结果格式化处理)
|
||||
String send = client.send(true);
|
||||
// Document document = DocumentHelper.parseText(send);
|
||||
// Element root = document.getRootElement();
|
||||
// String value = root.getStringValue();
|
||||
System.out.println(send);
|
||||
// System.out.println(value);
|
||||
|
||||
// 新建客户端
|
||||
SoapClient client = SoapClient.create("http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx")
|
||||
// 设置要请求的方法,此接口方法前缀为web,传入对应的命名空间
|
||||
.setMethod("web:getCountryCityByIp", "http://WebXml.com.cn/")
|
||||
// 设置参数,此处自动添加方法的前缀:web
|
||||
.setParam("phone", "18437762352")
|
||||
.setParam("msg", "1112121")
|
||||
.setParam("dwdm", "SGJT-山港集团");
|
||||
|
||||
// 发送请求,参数true表示返回一个格式化后的XML内容
|
||||
// 返回内容为XML字符串,可以配合XmlUtil解析这个响应
|
||||
Console.log(client.send(true));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -23,7 +23,7 @@ import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
|
|||
|
||||
/**
|
||||
* spring security配置
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||
|
@ -35,7 +35,7 @@ public class SecurityConfig
|
|||
*/
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
|
||||
/**
|
||||
* 认证失败处理类
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@ public class SecurityConfig
|
|||
*/
|
||||
@Autowired
|
||||
private JwtAuthenticationTokenFilter authenticationTokenFilter;
|
||||
|
||||
|
||||
/**
|
||||
* 跨域过滤器
|
||||
*/
|
||||
|
@ -97,35 +97,36 @@ public class SecurityConfig
|
|||
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception
|
||||
{
|
||||
return httpSecurity
|
||||
// CSRF禁用,因为不使用session
|
||||
.csrf(csrf -> csrf.disable())
|
||||
// 禁用HTTP响应标头
|
||||
.headers((headersCustomizer) -> {
|
||||
headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
|
||||
})
|
||||
// 认证失败处理类
|
||||
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
||||
// 基于token,所以不需要session
|
||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
// 注解标记允许匿名访问的url
|
||||
.authorizeHttpRequests((requests) -> {
|
||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
requests.antMatchers("/login", "/register", "/captchaImage","/outside/*").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated();
|
||||
})
|
||||
// 添加Logout filter
|
||||
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
||||
// 添加JWT filter
|
||||
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
// 添加CORS filter
|
||||
.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
|
||||
.addFilterBefore(corsFilter, LogoutFilter.class)
|
||||
.build();
|
||||
// CSRF禁用,因为不使用session
|
||||
.csrf(csrf -> csrf.disable())
|
||||
// 禁用HTTP响应标头
|
||||
.headers((headersCustomizer) -> {
|
||||
headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
|
||||
})
|
||||
// 认证失败处理类
|
||||
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
||||
// 基于token,所以不需要session
|
||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
// 注解标记允许匿名访问的url
|
||||
.authorizeHttpRequests((requests) -> {
|
||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
requests.antMatchers("/login","/bbc/**",
|
||||
"/register", "/captchaImage","/outside/*","/redirectToAuth","/getAccountName").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated();
|
||||
})
|
||||
// 添加Logout filter
|
||||
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
||||
// 添加JWT filter
|
||||
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
// 添加CORS filter
|
||||
.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
|
||||
.addFilterBefore(corsFilter, LogoutFilter.class)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -100,6 +100,48 @@ public class SysLoginService
|
|||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 无需验证码登录
|
||||
* 重写login方法将验证码模块去掉
|
||||
* @param username
|
||||
* @param password
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
public String loginNoCaptcha(String username, String password, String uuid)
|
||||
{
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
try
|
||||
{
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
|
||||
AuthenticationContextHolder.setContext(authenticationToken);
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager.authenticate(authenticationToken);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e instanceof BadCredentialsException)
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
else
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
recordLoginInfo(loginUser.getUserId());
|
||||
// 生成token
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 校验验证码
|
||||
*
|
||||
|
|
|
@ -1,268 +1,331 @@
|
|||
//package com.ruoyi.project.system.controller;
|
||||
//
|
||||
//
|
||||
//import com.alibaba.fastjson2.JSON;
|
||||
//import com.alibaba.fastjson2.JSONObject;
|
||||
//import com.banboocloud.Codec.BamboocloudFacade;
|
||||
//import com.ruoyi.common.utils.reflect.ReflectUtils;
|
||||
//import com.ruoyi.framework.web.controller.BaseController;
|
||||
//import com.ruoyi.project.system.domain.SysUser;
|
||||
//import com.ruoyi.project.system.service.ISysDeptService;
|
||||
//import com.ruoyi.project.system.service.ISysPostService;
|
||||
//import com.ruoyi.project.system.service.ISysRoleService;
|
||||
//import com.ruoyi.project.system.service.ISysUserService;
|
||||
//import com.ruoyi.project.system.utils.BamboocloudUtils;
|
||||
//
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.ResponseBody;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import javax.servlet.ServletException;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import java.io.BufferedReader;
|
||||
//import java.io.IOException;
|
||||
//import java.io.PrintWriter;
|
||||
//import java.util.*;
|
||||
//
|
||||
///**
|
||||
// * swagger 用户测试方法
|
||||
// * 加密认证
|
||||
// * @author ruoyi
|
||||
// */
|
||||
//
|
||||
//@RestController
|
||||
//@RequestMapping("/bbc/user")
|
||||
//public class BbcController extends BaseController {
|
||||
//
|
||||
// private String bimRequestId;
|
||||
//
|
||||
// private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class);
|
||||
//
|
||||
//
|
||||
// @Autowired
|
||||
// private ISysUserService userService;
|
||||
//
|
||||
// @Autowired
|
||||
// private ISysRoleService roleService;
|
||||
//
|
||||
// @Autowired
|
||||
// private ISysDeptService deptService;
|
||||
//
|
||||
// @Autowired
|
||||
// private ISysPostService postService;
|
||||
//
|
||||
//// @ApiOperation("测试")
|
||||
// @RequestMapping()
|
||||
// public JSONObject bbcUser() {
|
||||
//
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("resultCode", "0");
|
||||
// jsonObject.put("message", "success");
|
||||
// return jsonObject;
|
||||
//
|
||||
// }
|
||||
//
|
||||
//// @ApiOperation("对象属性字段查询")
|
||||
// @PostMapping("/schemaService")
|
||||
// public String SchemaService(HttpServletRequest req, HttpServletResponse resp) {
|
||||
//
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
//
|
||||
// // StringBuilder sb = stringBuilder(req);
|
||||
// String bodyparam= BamboocloudUtils.getRequestBody(req);
|
||||
// logger.info("json--param-->" + bodyparam);
|
||||
// // String bodyparam = sb.toString();
|
||||
// //解密json字符传
|
||||
// bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES");
|
||||
// logger.info("json--param-->" + bodyparam);
|
||||
// Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam);
|
||||
// //验证签名
|
||||
// if (BamboocloudUtils.verify(reqmap, "MD5").booleanValue()) {
|
||||
// String username = (String) reqmap.get("bimRemoteUser");
|
||||
// String password = (String) reqmap.get("bimRemotePwd");
|
||||
// //判断接口中的调用名及调用密码是否正确
|
||||
// if (BamboocloudUtils.checkUsernamePassword(username, password)) {
|
||||
//// //添加返回的对象及属性字段名
|
||||
//// MapJson mapJson = new MapJson();
|
||||
//// Map<String, List<Map<String, Object>>> map = new HashMap<>();
|
||||
//// jsonObject.put("account", mapJson.accountList());
|
||||
//// jsonObject.put("organization", mapJson.organizationList());
|
||||
//// jsonObject.put("role", mapJson.roleList());
|
||||
//// jsonObject.put("post", mapJson.postList());
|
||||
//// jsonObject.put("dict", mapJson.dictDataList());
|
||||
//// jsonObject.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
// String mapJs = JSON.toJSONString(jsonObject);
|
||||
// logger.info(jsonObject.toJSONString());
|
||||
// //返回加密的json字符串
|
||||
// mapJs = BamboocloudFacade.encrypt(mapJs, "123456", "AES");
|
||||
// //jsonObject.put(map);
|
||||
// //<Object> values = jsonObject.values();
|
||||
// return mapJs;
|
||||
// }
|
||||
// }
|
||||
// jsonObject.put("bimRequestId", bimRequestId);
|
||||
// jsonObject.put("resultCode", "505");
|
||||
// jsonObject.put("message", "连接失败,请检查连接器配置的参数");
|
||||
// logger.info(jsonObject.toJSONString());
|
||||
// String mapJs = JSON.toJSONString(jsonObject);
|
||||
// //返回加密的json字符串
|
||||
// mapJs = BamboocloudFacade.encrypt(mapJs, "123456", "AES");
|
||||
// return mapJs;
|
||||
// }
|
||||
//
|
||||
//// @ApiOperation("新增用户")
|
||||
//// @ApiImplicitParam(name = "user", value = "新增用户信息", dataType = "User")
|
||||
// @PostMapping("/UserCreateService")
|
||||
// @ResponseBody
|
||||
// public String userCreateService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
//
|
||||
// Map<String, Object> schema = new HashMap<String, Object>();
|
||||
//
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
//
|
||||
// StringBuilder sb = stringBuilder(req);
|
||||
// //修改多值的属性格式方便转换
|
||||
// String bodyparam = sb.toString();
|
||||
// bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES");
|
||||
// String p = bodyparam;
|
||||
// String z = "[\"";
|
||||
// String y = "\"]";
|
||||
// bodyparam.indexOf(z);
|
||||
// bodyparam.indexOf(y);
|
||||
// while (bodyparam.contains(z)) {
|
||||
// p = bodyparam.substring(bodyparam.indexOf(z), bodyparam.indexOf(y) + 2).replace(z, "\"").replace(y, "\"").replace("\",\"", ",");
|
||||
// bodyparam = bodyparam.substring(0, bodyparam.indexOf(z)) + p + bodyparam.substring(bodyparam.indexOf(y) + 2, bodyparam.length());
|
||||
// }
|
||||
// logger.info("json--param-->" + bodyparam);
|
||||
// Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam);
|
||||
// String username = (String) reqmap.get("bimRemoteUser");
|
||||
// String password = (String) reqmap.get("bimRemotePwd");
|
||||
//
|
||||
// if (BamboocloudUtils.checkUsernamePassword(username, password)) {
|
||||
// /**
|
||||
// * 新增用户
|
||||
// */
|
||||
// //获取用户创建所需的参数
|
||||
//// User user = createUpdateUser(reqmap);
|
||||
// SysUser user = new SysUser();
|
||||
// //用户创建
|
||||
// userService.insertUser(user);
|
||||
// //获取返回给IAM连接器的唯一标识,用于后续该条数据的更新修改删除
|
||||
// String uid = user.getUserId() + "";
|
||||
// if (uid != null) {
|
||||
// schema.put("uid", uid);
|
||||
// schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
// schema.put("resultCode", "0");
|
||||
// schema.put("message", "success");
|
||||
// } else {
|
||||
// schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
// schema.put("resultCode", "500");
|
||||
// schema.put("message", "账号创建失败");
|
||||
// }
|
||||
// String mapJson = JSON.toJSONString(schema);
|
||||
// mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
|
||||
// return mapJson;
|
||||
// }
|
||||
// schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
// schema.put("resultCode", "500");
|
||||
// schema.put("message", "账号创建失败,请检查连接器配置的参数");
|
||||
// String mapJson = JSON.toJSONString(schema);
|
||||
// //返回加密的json字符串
|
||||
// mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
|
||||
// return mapJson;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//// @ApiOperation("修改用户")
|
||||
//// @ApiImplicitParam(name = "user", value = "修改用户信息", dataType = "User")
|
||||
// @PostMapping("/UserUpdateService")
|
||||
// @ResponseBody
|
||||
// public String userUpdateService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
//
|
||||
// Map<String, Object> schema = new HashMap<String, Object>();
|
||||
//
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
//
|
||||
// StringBuilder sb = stringBuilder(req);
|
||||
//
|
||||
// String bodyparam = sb.toString();
|
||||
//
|
||||
// bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES");
|
||||
// //修改多值的属性格式方便转换
|
||||
// String p = bodyparam;
|
||||
// String bdp = bodyparam;
|
||||
// String z = "[\"";
|
||||
// String y = "\"]";
|
||||
// bodyparam.indexOf(z);
|
||||
// bodyparam.indexOf(y);
|
||||
// while (bodyparam.contains(z)) {
|
||||
// p = bodyparam.substring(bodyparam.indexOf(z), bodyparam.indexOf(y) + 2).replace(z, "\"").replace(y, "\"").replace("\",\"", ",");
|
||||
// bodyparam = bodyparam.substring(0, bodyparam.indexOf(z)) + p + bodyparam.substring(bodyparam.indexOf(y) + 2, bodyparam.length());
|
||||
// }
|
||||
// logger.info("json--param-->" + bodyparam);
|
||||
// Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam);
|
||||
// String username = (String) reqmap.get("bimRemoteUser");
|
||||
// String password = (String) reqmap.get("bimRemotePwd");
|
||||
// if (BamboocloudUtils.checkUsernamePassword(username, password)) {
|
||||
// SysUser user = new SysUser();
|
||||
// //获取用于更新的参数
|
||||
//// user = createUpdateUser(reqmap);
|
||||
// //获取用于更新的唯一标识
|
||||
// user.setUserId(Long.valueOf(String.valueOf(reqmap.get("bimUid"))));
|
||||
// //更新用户
|
||||
// userService.updateUser(user);
|
||||
// schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
// schema.put("resultCode", "0");
|
||||
// schema.put("message", "success");
|
||||
// String mapJson = JSON.toJSONString(schema);
|
||||
// mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
|
||||
// logger.info("response----->" + schema);
|
||||
// return mapJson;
|
||||
// }
|
||||
// schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
// schema.put("resultCode", "500");
|
||||
// schema.put("message", "账号更新失败,请检查连接器配置的参数");
|
||||
// String mapJson = JSON.toJSONString(schema);
|
||||
// mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
|
||||
// logger.info("response----->" + schema);
|
||||
// return mapJson;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public StringBuilder stringBuilder(HttpServletRequest req) {
|
||||
// BufferedReader br = null;
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// String str = "";
|
||||
// try {
|
||||
// br = req.getReader();
|
||||
// while ((str = br.readLine()) != null) {
|
||||
// sb.append(str);
|
||||
// }
|
||||
// br.close();
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// if (br != null)
|
||||
// try {
|
||||
// br.close();
|
||||
// } catch (IOException eo) {
|
||||
// eo.printStackTrace();
|
||||
// }
|
||||
// } finally {
|
||||
// if (br != null) {
|
||||
// try {
|
||||
// br.close();
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return sb;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
package com.ruoyi.project.system.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.banboocloud.Codec.BamboocloudFacade;
|
||||
import com.ruoyi.common.utils.reflect.ReflectUtils;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.project.system.domain.SysUser;
|
||||
import com.ruoyi.project.system.service.ISysDeptService;
|
||||
import com.ruoyi.project.system.service.ISysPostService;
|
||||
import com.ruoyi.project.system.service.ISysRoleService;
|
||||
import com.ruoyi.project.system.service.ISysUserService;
|
||||
import com.ruoyi.project.system.utils.BamboocloudUtils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* swagger 用户测试方法
|
||||
* 加密认证
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/bbc/user")
|
||||
public class BbcController extends BaseController {
|
||||
|
||||
private String bimRequestId;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
// @ApiOperation("测试")
|
||||
@RequestMapping()
|
||||
public JSONObject bbcUser() {
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("resultCode", "0");
|
||||
jsonObject.put("message", "success");
|
||||
return jsonObject;
|
||||
|
||||
}
|
||||
|
||||
// @ApiOperation("对象属性字段查询")
|
||||
@PostMapping("/SchemaService")
|
||||
public String SchemaService(HttpServletRequest req, HttpServletResponse resp) {
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
// StringBuilder sb = stringBuilder(req);
|
||||
String bodyparam= BamboocloudUtils.getRequestBody(req);
|
||||
logger.info("json--param-->" + bodyparam);
|
||||
// String bodyparam = sb.toString();
|
||||
//解密json字符传
|
||||
bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES");
|
||||
logger.info("json--param-->" + bodyparam);
|
||||
Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam);
|
||||
//验证签名
|
||||
if (BamboocloudUtils.verify(reqmap, "MD5").booleanValue()) {
|
||||
String username = (String) reqmap.get("bimRemoteUser");
|
||||
String password = (String) reqmap.get("bimRemotePwd");
|
||||
//判断接口中的调用名及调用密码是否正确
|
||||
if (BamboocloudUtils.checkUsernamePassword(username, password)) {
|
||||
// //添加返回的对象及属性字段名
|
||||
// MapJson mapJson = new MapJson();
|
||||
Map<String, List<Map<String, Object>>> map = new HashMap<>();
|
||||
ArrayList<HashMap<String,Object>> accountList = new ArrayList<>();
|
||||
HashMap<String, Object> nameMap = new HashMap<>();
|
||||
nameMap.put("multivalued",false);
|
||||
nameMap.put("name","userName");
|
||||
nameMap.put("required",true);
|
||||
nameMap.put("type","String");
|
||||
HashMap<String, Object> passMap = new HashMap<>();
|
||||
passMap.put("multivalued",false);
|
||||
passMap.put("name","password");
|
||||
passMap.put("required",true);
|
||||
passMap.put("type","String");
|
||||
HashMap<String, Object> mobileMap = new HashMap<>();
|
||||
mobileMap.put("multivalued",false);
|
||||
mobileMap.put("name","mobile");
|
||||
mobileMap.put("required",true);
|
||||
mobileMap.put("type","String");
|
||||
HashMap<String, Object> statusMap = new HashMap<>();
|
||||
statusMap.put("multivalued",false);
|
||||
statusMap.put("name","status");
|
||||
statusMap.put("required",true);
|
||||
statusMap.put("type","String");
|
||||
HashMap<String, Object> nickNameMap = new HashMap<>();
|
||||
nickNameMap.put("multivalued",false);
|
||||
nickNameMap.put("name","nickName");
|
||||
nickNameMap.put("required",true);
|
||||
nickNameMap.put("type","String");
|
||||
accountList.add(nameMap);
|
||||
accountList.add(passMap);
|
||||
accountList.add(mobileMap);
|
||||
accountList.add(statusMap);
|
||||
accountList.add(nickNameMap);
|
||||
jsonObject.put("account", accountList);
|
||||
// jsonObject.put("organization", mapJson.organizationList());
|
||||
// jsonObject.put("role", mapJson.roleList());
|
||||
// jsonObject.put("post", mapJson.postList());
|
||||
// jsonObject.put("dict", mapJson.dictDataList());
|
||||
jsonObject.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
String mapJs = JSON.toJSONString(jsonObject);
|
||||
logger.info(jsonObject.toJSONString());
|
||||
//返回加密的json字符串
|
||||
mapJs = BamboocloudFacade.encrypt(mapJs, "123456", "AES");
|
||||
//jsonObject.put(map);
|
||||
//<Object> values = jsonObject.values();
|
||||
return mapJs;
|
||||
}
|
||||
}
|
||||
jsonObject.put("bimRequestId", bimRequestId);
|
||||
jsonObject.put("resultCode", "505");
|
||||
jsonObject.put("message", "连接失败,请检查连接器配置的参数");
|
||||
logger.info(jsonObject.toJSONString());
|
||||
String mapJs = JSON.toJSONString(jsonObject);
|
||||
//返回加密的json字符串
|
||||
mapJs = BamboocloudFacade.encrypt(mapJs, "123456", "AES");
|
||||
return mapJs;
|
||||
}
|
||||
|
||||
// @ApiOperation("新增用户")
|
||||
// @ApiImplicitParam(name = "user", value = "新增用户信息", dataType = "User")
|
||||
@PostMapping("/UserCreateService")
|
||||
@ResponseBody
|
||||
public String userCreateService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
|
||||
Map<String, Object> schema = new HashMap<String, Object>();
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
StringBuilder sb = stringBuilder(req);
|
||||
logger.info("json--bodyStr-->"+sb);
|
||||
//修改多值的属性格式方便转换
|
||||
String bodyparam = sb.toString();
|
||||
bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES");
|
||||
String p = bodyparam;
|
||||
String z = "[\"";
|
||||
String y = "\"]";
|
||||
bodyparam.indexOf(z);
|
||||
bodyparam.indexOf(y);
|
||||
while (bodyparam.contains(z)) {
|
||||
p = bodyparam.substring(bodyparam.indexOf(z), bodyparam.indexOf(y) + 2).replace(z, "\"").replace(y, "\"").replace("\",\"", ",");
|
||||
bodyparam = bodyparam.substring(0, bodyparam.indexOf(z)) + p + bodyparam.substring(bodyparam.indexOf(y) + 2, bodyparam.length());
|
||||
}
|
||||
logger.info("json--param-->" + bodyparam);
|
||||
Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam);
|
||||
String username = (String) reqmap.get("bimRemoteUser");
|
||||
String password = (String) reqmap.get("bimRemotePwd");
|
||||
|
||||
if (BamboocloudUtils.checkUsernamePassword(username, password)) {
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
//获取用户创建所需的参数
|
||||
// User user = createUpdateUser(reqmap);
|
||||
String userName = (String) reqmap.get("userName");
|
||||
String pass = (String) reqmap.get("password");
|
||||
String mobile = (String) reqmap.get("mobile");
|
||||
String status = (String) reqmap.get("status");
|
||||
String nickName = (String) reqmap.get("nickName");
|
||||
|
||||
logger.info("reqmap---------->"+reqmap);
|
||||
SysUser user = new SysUser();
|
||||
user.setUserName(userName);
|
||||
user.setPassword(pass);
|
||||
user.setPhonenumber(mobile);
|
||||
user.setStatus(status);
|
||||
user.setNickName(nickName);
|
||||
Random random = new Random();
|
||||
int min = 8000;
|
||||
int max = 9000;
|
||||
int randomNumber = random.nextInt(max - min + 1) + min;
|
||||
user.setUserId(Long.valueOf(randomNumber));
|
||||
//用户创建
|
||||
userService.registerUser(user);
|
||||
//获取返回给IAM连接器的唯一标识,用于后续该条数据的更新修改删除
|
||||
String uid = user.getUserId() + "";
|
||||
if (uid != null) {
|
||||
schema.put("uid", uid);
|
||||
schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
schema.put("resultCode", "0");
|
||||
schema.put("message", "success");
|
||||
} else {
|
||||
schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
schema.put("resultCode", "500");
|
||||
schema.put("message", "账号创建失败");
|
||||
}
|
||||
String mapJson = JSON.toJSONString(schema);
|
||||
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
|
||||
return mapJson;
|
||||
}
|
||||
schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
schema.put("resultCode", "500");
|
||||
schema.put("message", "账号创建失败,请检查连接器配置的参数");
|
||||
String mapJson = JSON.toJSONString(schema);
|
||||
//返回加密的json字符串
|
||||
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
|
||||
return mapJson;
|
||||
}
|
||||
|
||||
|
||||
// @ApiOperation("修改用户")
|
||||
// @ApiImplicitParam(name = "user", value = "修改用户信息", dataType = "User")
|
||||
@PostMapping("/UserUpdateService")
|
||||
@ResponseBody
|
||||
public String userUpdateService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
|
||||
Map<String, Object> schema = new HashMap<String, Object>();
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
StringBuilder sb = stringBuilder(req);
|
||||
|
||||
String bodyparam = sb.toString();
|
||||
logger.info("json--bodyStr-->"+sb);
|
||||
bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES");
|
||||
//修改多值的属性格式方便转换
|
||||
String p = bodyparam;
|
||||
String bdp = bodyparam;
|
||||
String z = "[\"";
|
||||
String y = "\"]";
|
||||
bodyparam.indexOf(z);
|
||||
bodyparam.indexOf(y);
|
||||
while (bodyparam.contains(z)) {
|
||||
p = bodyparam.substring(bodyparam.indexOf(z), bodyparam.indexOf(y) + 2).replace(z, "\"").replace(y, "\"").replace("\",\"", ",");
|
||||
bodyparam = bodyparam.substring(0, bodyparam.indexOf(z)) + p + bodyparam.substring(bodyparam.indexOf(y) + 2, bodyparam.length());
|
||||
}
|
||||
logger.info("json--param-->" + bodyparam);
|
||||
Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam);
|
||||
String username = (String) reqmap.get("bimRemoteUser");
|
||||
String password = (String) reqmap.get("bimRemotePwd");
|
||||
if (BamboocloudUtils.checkUsernamePassword(username, password)) {
|
||||
//获取用于更新的参数
|
||||
// user = createUpdateUser(reqmap);
|
||||
String userName = (String) reqmap.get("userName");
|
||||
String pass = (String) reqmap.get("password");
|
||||
String mobile = (String) reqmap.get("mobile");
|
||||
String status = (String) reqmap.get("status");
|
||||
String nickName = (String) reqmap.get("nickName");
|
||||
|
||||
logger.info("reqmap---------->"+reqmap);
|
||||
SysUser user = new SysUser();
|
||||
user.setUserName(userName);
|
||||
user.setPassword(pass);
|
||||
user.setPhonenumber(mobile);
|
||||
user.setStatus(status);
|
||||
user.setNickName(nickName);
|
||||
//获取用于更新的唯一标识
|
||||
user.setUserId(Long.valueOf(String.valueOf(reqmap.get("bimUid"))));
|
||||
//更新用户
|
||||
userService.updateUserStatus(user);
|
||||
schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
schema.put("resultCode", "0");
|
||||
schema.put("message", "success");
|
||||
String mapJson = JSON.toJSONString(schema);
|
||||
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
|
||||
logger.info("response----->" + schema);
|
||||
return mapJson;
|
||||
}
|
||||
schema.put("bimRequestId", reqmap.get("bimRequestId"));
|
||||
schema.put("resultCode", "500");
|
||||
schema.put("message", "账号更新失败,请检查连接器配置的参数");
|
||||
String mapJson = JSON.toJSONString(schema);
|
||||
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
|
||||
logger.info("response----->" + schema);
|
||||
return mapJson;
|
||||
}
|
||||
|
||||
|
||||
public StringBuilder stringBuilder(HttpServletRequest req) {
|
||||
BufferedReader br = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String str = "";
|
||||
try {
|
||||
br = req.getReader();
|
||||
while ((str = br.readLine()) != null) {
|
||||
sb.append(str);
|
||||
}
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (br != null)
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException eo) {
|
||||
eo.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
if (br != null) {
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ ruoyi:
|
|||
# 版权年份
|
||||
copyrightYear: 2024
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
profile: /home/admin
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
|
@ -16,7 +16,7 @@ ruoyi:
|
|||
file:
|
||||
domain:
|
||||
# path: /home/file/upload
|
||||
path: D:/ruoyi/uploadPath
|
||||
path: /home/admin
|
||||
prefix: /statics
|
||||
# 开发环境配置
|
||||
server:
|
||||
|
|
|
@ -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="/home/admin/logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
|
|
|
@ -144,11 +144,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, email from sys_user where email = #{email} and del_flag = '0' and rownum <![CDATA[ <= ]]> 1
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
<selectKey keyProperty="userId" order="BEFORE" resultType="Long">
|
||||
select seq_sys_user.nextval as userId from DUAL
|
||||
</selectKey>
|
||||
|
||||
<!-- <selectKey keyProperty="userId" order="BEFORE" resultType="Long">-->
|
||||
<!-- select seq_sys_user.nextval as userId from DUAL-->
|
||||
<!-- </selectKey>-->
|
||||
<!-- <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">-->
|
||||
<insert id="insertUser" parameterType="SysUser" >
|
||||
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -57,4 +57,12 @@ export function getCodeImg() {
|
|||
method: 'get',
|
||||
timeout: 20000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export function getAccountName(data) {
|
||||
return request({
|
||||
url: '/getAccountName',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import { isRelogin } from '@/utils/request'
|
|||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
const whiteList = ['/login', '/register']
|
||||
const whiteList = ['/login', '/register', '/LoginSso']
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
|
|
|
@ -46,6 +46,11 @@ export const constantRoutes = [
|
|||
component: () => import('@/views/login'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/LoginSso',
|
||||
component: () => import('@/views/login-sso'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/register',
|
||||
component: () => import('@/views/register'),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { login, logout, getInfo } from '@/api/login'
|
||||
import { login, logout, getInfo, getAccountName } from '@/api/login'
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||
import {encrypt, decrypt} from '@/utils/secret'
|
||||
import {encrypt, decrypt} from '@/utils/secret'
|
||||
const user = {
|
||||
state: {
|
||||
token: getToken(),
|
||||
|
@ -95,6 +95,22 @@ const user = {
|
|||
removeToken()
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
|
||||
LoginSso({ commit }, code) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getAccountName({"code": code}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
setToken(res.token)
|
||||
commit('SET_TOKEN', res.token)
|
||||
resolve()
|
||||
} else {
|
||||
reject(res)
|
||||
}
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</el-table>
|
||||
|
||||
<!-- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" /> -->
|
||||
@pagination="getList" /> -->
|
||||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-page="queryParams.pageNum" :page-sizes="[10, 20, 30, 50]" :page-size="queryParams.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
<!--发送通知-->
|
||||
<send-msg :deviceInfo="deviceInfo" v-if="isOpenMsg" :isOpenMsg="isOpenMsg" @closeMsg="closeMsg"></send-msg>
|
||||
<!--处理报警-->
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
<!--发送通知-->
|
||||
<send-msg :deviceInfo="deviceInfo" v-if="isOpenMsg" :isOpenMsg="isOpenMsg" @closeMsg="closeMsg"></send-msg>
|
||||
<!--处理报警-->
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
<!--发送通知-->
|
||||
<send-msg :deviceInfo="deviceInfo" v-if="isOpenMsg" :isOpenMsg="isOpenMsg" @closeMsg="closeMsg"></send-msg>
|
||||
<!--处理报警-->
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "LoginSso",
|
||||
data() {
|
||||
return {
|
||||
loginRules: {},
|
||||
//验证码开关
|
||||
captchaOnOff: true,
|
||||
//注册开关
|
||||
register: false,
|
||||
//重定向
|
||||
redirect: undefined
|
||||
};
|
||||
},
|
||||
created() {
|
||||
//页面初始化时调单点登录方法
|
||||
this.loginSso();
|
||||
},
|
||||
methods: {
|
||||
loginSso() {
|
||||
//获取地址栏中的code
|
||||
const code = this.$route.query.code;
|
||||
console.log("code="+code)
|
||||
//调用登录的接口
|
||||
if(code==''||code==undefined||code==null){
|
||||
//请求中不带code,拦截为正常登录
|
||||
} else {
|
||||
this.$store.dispatch("LoginSso", code).then(() => {
|
||||
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
this.$message.error("单点登录失败");
|
||||
this.$router.push({ path: "/login" }).catch(()=>{});
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -60,7 +60,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="handleQuery" />
|
||||
@pagination="getList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,239 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-tabs type="border-card" v-model="activeTab" @tab-click="getListData">
|
||||
<el-tab-pane v-for="item in choseList " :label="item">
|
||||
|
||||
<div class="main-box" v-if="dataList.length>0">
|
||||
<div class="main" v-for="item in dataList" >
|
||||
<div class="left" @click="read(item)" >
|
||||
<div :class="item.isRead === '0' ? 'not-read' : 'readed'"></div>
|
||||
{{ item.sendText }}
|
||||
</div>
|
||||
<div style="display: inline-flex;">
|
||||
<div class="right">{{ '发送时间:' + item.sendTime }}</div>
|
||||
<div class="right" style="margin-left: 10px;">{{ '发送人:' + item.sender }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
<div v-else class="content"> <img class="img" src="@/assets/home/not-data.png" ></div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-dialog
|
||||
title="查看消息详情"
|
||||
:visible.sync="isShowMsg"
|
||||
width="50%"
|
||||
:before-close="handleClose">
|
||||
<div class="title">消息时间轴 </div>
|
||||
<el-timeline>
|
||||
<el-timeline-item v-for="item in infoList" :timestamp="item.sendTime" placement="top" >
|
||||
<el-card >
|
||||
<h4>{{item.infoType}}{{item.sendText}}</h4>
|
||||
<p>{{item.sender}} 提交于 {{item.sendTime}}</p>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
<div class="title">添加回复 </div>
|
||||
<div style="margin:10px">
|
||||
<el-input type="textarea" :rows="2" placeholder="请输入回复内容..." v-model="shareContent">
|
||||
</el-input>
|
||||
</div>
|
||||
<div> <el-button class="agreeButton" @click="sendMsg">发送</el-button></div>
|
||||
<!-- <span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleClose">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
|
||||
</span> -->
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { listMsg, readMsg,getMsgDetail } from "@/api/home";
|
||||
import { sendMessage} from "@/api/home";
|
||||
export default {
|
||||
name: "SendMsg",
|
||||
data() {
|
||||
return {
|
||||
shareContent:'',
|
||||
repayUser:{},
|
||||
infoList:[],
|
||||
isShowMsg:false,
|
||||
activeTab: '0',
|
||||
choseList: ['未读消息', '已读消息', '全部消息'],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
isRead: '0',
|
||||
},
|
||||
total: 4,
|
||||
dataList: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
getListData() {
|
||||
if (this.activeTab == 0) {//未读
|
||||
this.queryParams.isRead = '0'
|
||||
} else if (this.activeTab == 1) {//已读
|
||||
this.queryParams.isRead = '1'
|
||||
} else {
|
||||
this.queryParams.isRead = ''
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
/** 查询消息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listMsg(this.queryParams).then(response => {
|
||||
this.dataList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
//消息已读
|
||||
read(item){
|
||||
this.isShowMsg=true;
|
||||
this.repayUser=item
|
||||
getMsgDetail(item.id).then(response => {
|
||||
if(response.code !=500){
|
||||
this.infoList=response.data
|
||||
}
|
||||
});
|
||||
},
|
||||
sendMsg(){
|
||||
let readList=[]
|
||||
readList.push(this.repayUser.sender)
|
||||
let params={
|
||||
readerList: readList,
|
||||
sendText:this.shareContent,
|
||||
parentId:this.infoList[0].id
|
||||
}
|
||||
sendMessage(params).then(response => {
|
||||
if(response.code==200){
|
||||
this.$message.success("消息回复成功!")
|
||||
}else{
|
||||
this.$message.error("消息回复失败!")
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
//关闭
|
||||
handleClose(){
|
||||
this.isShowMsg=false
|
||||
readMsg(this.repayUser.id).then(response => {
|
||||
if(response.code !=500){
|
||||
// this.$Message.info("消息已读")
|
||||
this.getList()
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.agreeButton {
|
||||
display: inline-block;
|
||||
line-height: 8px;
|
||||
width: 80px;
|
||||
height: 32px;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
color: #ffffff;
|
||||
-webkit-appearance: none;
|
||||
text-align: center;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
outline: 0;
|
||||
margin-left: 10px;
|
||||
-webkit-transition: .1s;
|
||||
transition: .1s;
|
||||
font-weight: 500;
|
||||
//padding: 12px 20px;
|
||||
font-size: 14px;
|
||||
border-radius: 4px;
|
||||
background-color: #068f5c;
|
||||
}
|
||||
|
||||
.agreeButton:hover {
|
||||
background: #65a5f9;
|
||||
border-color: #65a5f9;
|
||||
color: #FFF;
|
||||
}
|
||||
.title {
|
||||
padding-left: 20px;
|
||||
color: #212121;
|
||||
font-size: 16px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
background: url("~@/assets/ucs/biaoti.png") no-repeat;
|
||||
background-position-y: 7px;
|
||||
}
|
||||
.content{
|
||||
height: 800px;
|
||||
position: relative;
|
||||
}
|
||||
.img{
|
||||
position: absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
transform:translate(-50%,-50%);
|
||||
}
|
||||
.main-box {
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
height: 800px;
|
||||
|
||||
.main {
|
||||
background: #fff;
|
||||
margin: 0 5px;
|
||||
// min-height: 80px;
|
||||
// overflow-y: scroll;
|
||||
border-top: 1px solid #dddee1;
|
||||
|
||||
.readed {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
display: inline-flex;
|
||||
background: green;
|
||||
}
|
||||
|
||||
.not-read {
|
||||
display: inline-flex;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
background: red;
|
||||
}
|
||||
|
||||
.left {
|
||||
margin-top: 5px;
|
||||
width: 90%;
|
||||
max-height: 43px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
word-break: break-all;
|
||||
cursor: pointer;
|
||||
}
|
||||
.left:hover{
|
||||
color:#068f5c;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.right {
|
||||
margin-top: 5px;
|
||||
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue