Compare commits

...

2 Commits

Author SHA1 Message Date
lmc be16d6a901 Merge branch 'main' of http://39.101.199.1:8888/gongjiale/gangkou 2024-11-04 11:08:16 +08:00
lmc 227aa48e8c 港口 代码 提交 2024-11-04 11:07:18 +08:00
11 changed files with 675 additions and 289 deletions

View File

@ -27,7 +27,7 @@
<spring-framework.version>5.3.33</spring-framework.version>
<spring-security.version>5.7.12</spring-security.version>
<pagehelper.spring.boot.starter.version>1.4.7</pagehelper.spring.boot.starter.version>
<fastjson.version>2.0.43</fastjson.version>
<fastjson.version>4.0.3</fastjson.version>
<druid.version>1.2.23</druid.version>
<commons.io.version>2.13.0</commons.io.version>
<bitwalker.version>1.21</bitwalker.version>
@ -55,6 +55,12 @@
<version>4.1.63.Final</version>
</dependency>
<dependency>
<groupId>cn.zhxu</groupId>
<artifactId>okhttps</artifactId>
<version>4.0.3</version>
</dependency>
<!-- SpringBoot 测试 -->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -159,11 +165,16 @@
<version>${bitwalker.version}</version>
</dependency>
<!-- 阿里JSON解析器 -->
<!-- &lt;!&ndash; 阿里JSON解析器 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.alibaba.fastjson2</groupId>-->
<!-- <artifactId>fastjson2</artifactId>-->
<!-- <version>${fastjson.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version>
<groupId>cn.zhxu</groupId>
<artifactId>okhttps-fastjson2</artifactId>
<version>4.0.3</version>
</dependency>
<!-- Spring框架基本的核心工具-->
@ -171,6 +182,11 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<!-- Token生成与解析-->
<dependency>
@ -179,6 +195,58 @@
<version>${jwt.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.roufid.tutorials</groupId>-->
<!-- <artifactId>example-app</artifactId>-->
<!-- <version>1.0</version>-->
<!-- </dependency>-->
<!-- JAX-WS API -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<!-- JAX-WS Runtime -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.1</version>
</dependency>
<!-- 工具集 -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.15</version>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis-wsdl4j</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<!-- Jaxb -->
<dependency>
<groupId>javax.xml.bind</groupId>

View File

@ -1,9 +1,12 @@
package com.ruoyi;
import com.ruoyi.common.task.EquTask;
import com.ruoyi.common.tcp.CarTcpNettyServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 启动程序
@ -11,17 +14,14 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableScheduling
public class RuoYiApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
try {
new CarTcpNettyServer().bind(8001);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +

View File

@ -1,15 +1,23 @@
package com.ruoyi.common.task;
import cn.zhxu.okhttps.HTTP;
import cn.zhxu.okhttps.HttpCall;
import cn.zhxu.okhttps.HttpResult;
import cn.zhxu.okhttps.OkHttps;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
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.outside.service.OutSideService;
import org.apache.http.client.HttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
@Component
public class EquTask {
@ -23,17 +31,36 @@ public class EquTask {
/**
* 港口原有设备对接
*/
@Scheduled(fixedRate = 10000)
public void equ(){
String tokenByStr = myClient.loginRequest("admin", Md5Utils.hash("123456"));
JSONObject tokenByJson = JSONObject.parseObject(tokenByStr);
String hash = "16EA8A305FB58BE0730DD67F04F022F4";
HttpResult httpResult = OkHttps.sync("http://10.201.35.30:8090/user/login").addBodyPara("userName", "admin")
.addBodyPara("password", hash)
.bodyType("application/json")
.post();
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);
equLists.forEach(e->{
String vocByStr = myClient.selectRequest(token, e.getSn(), e.getName());
JSONObject vocByJson = JSONObject.parseObject(vocByStr);
HashMap<String, Object> map = new HashMap<>();
map.put("sensorUId",e.getSn());
map.put("label",e.getName());
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());
});
}

View File

@ -16,4 +16,9 @@ public interface MyTaskClient {
)
String selectRequest(@Body String token,@Var("sensorUId") String sensorUId,@Var("label")String label);
@Get(url = "http://10.171.19.193:8080/dxpt/ws/shortMessageWs?wsdl"
)
String sms(@Var("phone") String phone,@Var("msg") String msg,@Var("Dwdm")String Dwdm);
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.common.wsdl;
import cn.hutool.http.webservice.SoapClient;
import javax.xml.soap.SOAPMessage;
/**
* 测试调用wsdl接口
* @author laijiangfeng
* @date 2024/9/27 9:51
*/
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);
}
}

View File

@ -0,0 +1,50 @@
package com.ruoyi.common.wsdl;
import org.apache.axis.client.Call;
import org.springframework.util.*;
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public class WebServiceUtil {
public static String sendMessage(Collection<String> phones, String msg) throws Exception {
System.out.println("开始调用webservice");
List<Map<String, Object>> storeItemList_ = new ArrayList<>();
String endpoint = "http://10.171.19.193:8080/dxpt/ws/shortMessageWs?wsdl";
String soapaction = "http://service.cxf.com/";
String method = "returnMassages";
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
Call call = (Call) service.createCall();// 通过service创建call对象
call.setTargetEndpointAddress(endpoint);
call.setOperationName(new QName(soapaction, method));
call.addParameter(new QName(soapaction, "phone"),
org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(soapaction, "msg"),
org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(soapaction, "Dwdm"),
org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setUseSOAPAction(true);
//call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_STRING); //返回参数的类型
call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_VECTOR);
//call.setReturnType(XMLType.XSD_STRING);
call.setSOAPActionURI(soapaction + method);
java.util.Vector xmlStr = (java.util.Vector) call.invoke(new Object[]{StringUtils.collectionToCommaDelimitedString(phones), msg, "SGJT-山港集团"});
System.out.println("webservice response content :" + StringUtils.collectionToCommaDelimitedString(xmlStr));
return StringUtils.collectionToCommaDelimitedString(xmlStr);
}
public static void main(String[] args) {
Collection<String> objects = new ArrayList<>();
objects.add("18437762352");
try {
sendMessage(objects,"ceshi");
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,200 @@
package com.ruoyi.common.wsdl;
import ch.qos.logback.core.net.server.Client;
import com.alibaba.fastjson2.JSONObject;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.axis.types.Schema;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.compress.utils.Lists;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class WebServiceUtils {
// 接口调用地址
private static String url = "http://10.171.19.193:8080/dxpt/ws/shortMessageWs?wsdl";
// 命名空间
private static String namespace = "http://service.cxf.com/";
public static void main(String[] args) {
HashMap<String, String> map = new HashMap<>();
map.put("phone","18437762352");
map.put("msg","ceshi");
map.put("Dwdm","SGJT-山港集团");
String call = call("returnMassages", map);
System.out.println(call);
}
/**
* WebService - 调用接口
*
* @param methodName 函数名
* @param params 参数
* @param clazz 返回对象class
* @return 返回结果(Object)
*/
public static <T> T call(String methodName, Map<String, String> params, Class<T> clazz) {
// log.info("调用 WebService 发送参数==>" + JsonUtil.object2Json(params));
String soapActionURI = namespace + methodName;
try {
Service service = new Service();
SOAPHeaderElement header = new SOAPHeaderElement(namespace, methodName);
header.setNamespaceURI(namespace);
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setOperationName(new QName(namespace, methodName));
// 添加参数
List<String> parameterList = Lists.newArrayList();
if (params != null) {
Set<String> paramsKey = params.keySet();
for (String key : paramsKey) {
call.addParameter(new QName(namespace, key), XMLType.XSD_STRING, ParameterMode.IN);
String pValue = MapUtils.getString(params, key);
header.addChildElement(key).setValue(pValue);
parameterList.add(pValue);
}
}
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapActionURI);
call.addHeader(header);
// 进行序列化 实体类也要序列化 implements Serializable
call.registerTypeMapping(clazz, new QName(namespace, soapActionURI),
new BeanSerializerFactory(clazz, new QName(namespace, soapActionURI)),
new BeanDeserializerFactory(clazz, new QName(namespace, soapActionURI)));
// 设置输出的类
call.setReturnClass(clazz);
// 接口返回结果
T result = (T) call.invoke(parameterList.toArray());
// log.info("调用 WebService 接口返回===>" + result);
return result;
} catch (Exception e) {
// log.error("调用 WebService 接口错误信息==>" + e.getMessage());
}
return null;
}
/**
* WebService - 接口调用
*
* @param methodName 函数名
* @param params 参数
* @return 返回结果(String)
*/
public static String call(String methodName, Map<String, String> params) {
// log.info("调用 WebService 发送参数==>" + JsonUtil.object2Json(params));
System.out.println("调用 WebService 发送参数==>" + JSONObject.toJSONString(params));
String soapActionURI = namespace + methodName;
try {
Service service = new Service();
SOAPHeaderElement header = new SOAPHeaderElement(namespace, methodName);
header.setNamespaceURI(namespace);
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setOperationName(new QName(namespace, methodName));
// 添加参数
List<String> parameterList = Lists.newArrayList();
if (params != null) {
Set<String> paramsKey = params.keySet();
for (String key : paramsKey) {
call.addParameter(new QName(namespace, key), XMLType.XSD_STRING, ParameterMode.IN);
String pValue = MapUtils.getString(params, key);
header.addChildElement(key).setValue(pValue);
parameterList.add(pValue);
}
}
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapActionURI);
call.addHeader(header);
// 设置返回类型
call.setReturnType(new QName(namespace, methodName), String.class);
// 接口返回结果
String result = (String) call.invoke(parameterList.toArray());
// log.info("调用 WebService 接口返回===>" + result);
System.out.println("调用 WebService 接口返回===>" + result);
return result;
} catch (Exception e) {
// log.error("调用 WebService 接口错误信息==>" + e.getMessage());
System.out.println("调用 WebService 接口返回===>" + e.getMessage());
}
return null;
}
/**
* WebService - 调用接口
*
* @param methodName 函数名
* @param params 参数
* @return 返回结果(String)
*/
public static String call2(String methodName, Map<String, String> params) {
// log.info("调用 WebService 发送参数==>" + JsonUtil.object2Json(params));
String soapActionURI = namespace + methodName;
try {
Service service = new Service();
SOAPHeaderElement header = new SOAPHeaderElement(namespace, methodName);
header.setNamespaceURI(namespace);
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setOperationName(new QName(namespace, methodName));
// 添加参数
List<String> parameterList = Lists.newArrayList();
if (params != null) {
Set<String> paramsKey = params.keySet();
for (String key : paramsKey) {
call.addParameter(new QName(namespace, key), XMLType.XSD_STRING, ParameterMode.IN);
String pValue = MapUtils.getString(params, key);
header.addChildElement(key).setValue(pValue);
parameterList.add(pValue);
}
}
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapActionURI);
call.addHeader(header);
// 设置返回类型
call.setReturnType(XMLType.XSD_SCHEMA);
// 接口返回结果
Schema schemaResult = (Schema)call.invoke(parameterList.toArray());
String result = "";
for(int i = 0; i<schemaResult.get_any().length; i++){
result = result + schemaResult.get_any()[i];
}
// log.error("调用 WebService 接口返回===>" + result);
return result;
} catch (Exception e) {
// log.error("调用 WebService 接口错误信息==>" + e.getMessage());
}
return null;
}
}

View File

@ -6,6 +6,7 @@ import com.ruoyi.framework.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
public class ThDevice extends BaseEntity {
private static final long serialVersionUID = 1L;

View File

@ -1,268 +1,268 @@
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.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;
// }
//
//}
//

View File

@ -9,9 +9,9 @@ spring:
# url: jdbc:oracle:thin:@127.0.0.1:1521/orcl
# username: root
# password: password
url: jdbc:oracle:thin:@218.58.79.146:17521/orcl
username: system
password: oracle
url: jdbc:oracle:thin:@10.169.28.44:1521/orcl
username: spg_voc
password: SPG$spgvoc_24!
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

@ -73,15 +73,15 @@ spring:
# redis 配置
redis:
# 地址
host: 192.168.31.105
# host: 127.0.0.1
# host: 192.168.31.105
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
# password: 123456
password: admin123!
password: 123456
# password: admin123!
# 连接超时时间
timeout: 10s
lettuce: