港口 代码 提交

This commit is contained in:
lmc 2024-11-04 11:07:18 +08:00
parent 490bd84309
commit 227aa48e8c
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-framework.version>5.3.33</spring-framework.version>
<spring-security.version>5.7.12</spring-security.version> <spring-security.version>5.7.12</spring-security.version>
<pagehelper.spring.boot.starter.version>1.4.7</pagehelper.spring.boot.starter.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> <druid.version>1.2.23</druid.version>
<commons.io.version>2.13.0</commons.io.version> <commons.io.version>2.13.0</commons.io.version>
<bitwalker.version>1.21</bitwalker.version> <bitwalker.version>1.21</bitwalker.version>
@ -55,6 +55,12 @@
<version>4.1.63.Final</version> <version>4.1.63.Final</version>
</dependency> </dependency>
<dependency>
<groupId>cn.zhxu</groupId>
<artifactId>okhttps</artifactId>
<version>4.0.3</version>
</dependency>
<!-- SpringBoot 测试 --> <!-- SpringBoot 测试 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -159,11 +165,16 @@
<version>${bitwalker.version}</version> <version>${bitwalker.version}</version>
</dependency> </dependency>
<!-- 阿里JSON解析器 --> <!-- &lt;!&ndash; 阿里JSON解析器 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.alibaba.fastjson2</groupId>-->
<!-- <artifactId>fastjson2</artifactId>-->
<!-- <version>${fastjson.version}</version>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>com.alibaba.fastjson2</groupId> <groupId>cn.zhxu</groupId>
<artifactId>fastjson2</artifactId> <artifactId>okhttps-fastjson2</artifactId>
<version>${fastjson.version}</version> <version>4.0.3</version>
</dependency> </dependency>
<!-- Spring框架基本的核心工具--> <!-- Spring框架基本的核心工具-->
@ -171,6 +182,11 @@
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId> <artifactId>spring-context-support</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<!-- Token生成与解析--> <!-- Token生成与解析-->
<dependency> <dependency>
@ -179,6 +195,58 @@
<version>${jwt.version}</version> <version>${jwt.version}</version>
</dependency> </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 --> <!-- Jaxb -->
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>

View File

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

View File

@ -1,15 +1,23 @@
package com.ruoyi.common.task; 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.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.task.forest.MyTaskClient; import com.ruoyi.common.task.forest.MyTaskClient;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.sign.Md5Utils; import com.ruoyi.common.utils.sign.Md5Utils;
import com.ruoyi.project.oil.domain.monitor.ThDevice; import com.ruoyi.project.oil.domain.monitor.ThDevice;
import com.ruoyi.project.outside.service.OutSideService; import com.ruoyi.project.outside.service.OutSideService;
import org.apache.http.client.HttpClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
@Component @Component
public class EquTask { public class EquTask {
@ -23,17 +31,36 @@ public class EquTask {
/** /**
* 港口原有设备对接 * 港口原有设备对接
*/ */
@Scheduled(fixedRate = 10000)
public void equ(){ public void equ(){
String tokenByStr = myClient.loginRequest("admin", Md5Utils.hash("123456")); String hash = "16EA8A305FB58BE0730DD67F04F022F4";
JSONObject tokenByJson = JSONObject.parseObject(tokenByStr);
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"); JSONObject dataByJson = tokenByJson.getJSONObject("data");
String token = dataByJson.getString("token"); String token = dataByJson.getString("token");
ArrayList<ThDevice> equLists = new ArrayList<>(); //查询 数据库 获取 港口以前的 设备信息 ArrayList<ThDevice> equLists = new ArrayList<>(); //查询 数据库 获取 港口以前的 设备信息
ThDevice thDevice = new ThDevice();
thDevice.setSn("e75153fd53d243289057ffec33f36cb9");
thDevice.setName("油气回收voc监测设备3#");
equLists.add(thDevice);
equLists.forEach(e->{ equLists.forEach(e->{
String vocByStr = myClient.selectRequest(token, e.getSn(), e.getName()); HashMap<String, Object> map = new HashMap<>();
JSONObject vocByJson = JSONObject.parseObject(vocByStr);
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"); JSONObject vocDataByJson = vocByJson.getJSONObject("data");
JSONArray vocByArray = vocDataByJson.getJSONArray("array"); 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); 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.math.BigDecimal;
import java.util.Date; import java.util.Date;
public class ThDevice extends BaseEntity { public class ThDevice extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -1,268 +1,268 @@
package com.ruoyi.project.system.controller; //package com.ruoyi.project.system.controller;
//
//
import com.alibaba.fastjson2.JSON; //import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; //import com.alibaba.fastjson2.JSONObject;
import com.banboocloud.Codec.BamboocloudFacade; //import com.banboocloud.Codec.BamboocloudFacade;
import com.ruoyi.common.utils.reflect.ReflectUtils; //import com.ruoyi.common.utils.reflect.ReflectUtils;
import com.ruoyi.framework.web.controller.BaseController; //import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.project.system.domain.SysUser; //import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.service.ISysDeptService; //import com.ruoyi.project.system.service.ISysDeptService;
import com.ruoyi.project.system.service.ISysPostService; //import com.ruoyi.project.system.service.ISysPostService;
import com.ruoyi.project.system.service.ISysRoleService; //import com.ruoyi.project.system.service.ISysRoleService;
import com.ruoyi.project.system.service.ISysUserService; //import com.ruoyi.project.system.service.ISysUserService;
import com.ruoyi.project.system.utils.BamboocloudUtils; //import com.ruoyi.project.system.utils.BamboocloudUtils;
//
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; //import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; //import org.springframework.web.bind.annotation.RestController;
//
import javax.servlet.ServletException; //import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; //import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader; //import java.io.BufferedReader;
import java.io.IOException; //import java.io.IOException;
import java.io.PrintWriter; //import java.io.PrintWriter;
import java.util.*; //import java.util.*;
//
/** ///**
* swagger 用户测试方法 // * swagger 用户测试方法
* 加密认证 // * 加密认证
* @author ruoyi // * @author ruoyi
*/ // */
//
@RestController //@RestController
@RequestMapping("/bbc/user") //@RequestMapping("/bbc/user")
public class BbcController extends BaseController { //public class BbcController extends BaseController {
//
private String bimRequestId; // private String bimRequestId;
//
private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class); // private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class);
//
//
@Autowired // @Autowired
private ISysUserService userService; // private ISysUserService userService;
//
@Autowired // @Autowired
private ISysRoleService roleService; // private ISysRoleService roleService;
//
@Autowired // @Autowired
private ISysDeptService deptService; // private ISysDeptService deptService;
//
@Autowired // @Autowired
private ISysPostService postService; // private ISysPostService postService;
//
// @ApiOperation("测试") //// @ApiOperation("测试")
@RequestMapping() // @RequestMapping()
public JSONObject bbcUser() { // public JSONObject bbcUser() {
//
JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
jsonObject.put("resultCode", "0"); // jsonObject.put("resultCode", "0");
jsonObject.put("message", "success"); // jsonObject.put("message", "success");
return jsonObject; // return jsonObject;
//
} // }
//
// @ApiOperation("对象属性字段查询") //// @ApiOperation("对象属性字段查询")
@PostMapping("/schemaService") // @PostMapping("/schemaService")
public String SchemaService(HttpServletRequest req, HttpServletResponse resp) { // public String SchemaService(HttpServletRequest req, HttpServletResponse resp) {
//
JSONObject jsonObject = new JSONObject(); // 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); // StringBuilder sb = stringBuilder(req);
String bodyparam= BamboocloudUtils.getRequestBody(req); // //修改多值的属性格式方便转换
logger.info("json--param-->" + bodyparam);
// String bodyparam = sb.toString(); // String bodyparam = sb.toString();
//解密json字符传 // bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES");
bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES"); // String p = bodyparam;
logger.info("json--param-->" + bodyparam); // String z = "[\"";
Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam); // String y = "\"]";
//验证签名 // bodyparam.indexOf(z);
if (BamboocloudUtils.verify(reqmap, "MD5").booleanValue()) { // bodyparam.indexOf(y);
String username = (String) reqmap.get("bimRemoteUser"); // while (bodyparam.contains(z)) {
String password = (String) reqmap.get("bimRemotePwd"); // 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());
if (BamboocloudUtils.checkUsernamePassword(username, password)) { // }
// //添加返回的对象及属性字段名 // logger.info("json--param-->" + bodyparam);
// MapJson mapJson = new MapJson(); // Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam);
// Map<String, List<Map<String, Object>>> map = new HashMap<>(); // String username = (String) reqmap.get("bimRemoteUser");
// jsonObject.put("account", mapJson.accountList()); // String password = (String) reqmap.get("bimRemotePwd");
// jsonObject.put("organization", mapJson.organizationList()); //
// jsonObject.put("role", mapJson.roleList()); // if (BamboocloudUtils.checkUsernamePassword(username, password)) {
// 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()); //// User user = createUpdateUser(reqmap);
//返回加密的json字符串 // SysUser user = new SysUser();
mapJs = BamboocloudFacade.encrypt(mapJs, "123456", "AES"); // //用户创建
//jsonObject.put(map); // userService.insertUser(user);
//<Object> values = jsonObject.values(); // //获取返回给IAM连接器的唯一标识用于后续该条数据的更新修改删除
return mapJs; // String uid = user.getUserId() + "";
} // if (uid != null) {
} // schema.put("uid", uid);
jsonObject.put("bimRequestId", bimRequestId); // schema.put("bimRequestId", reqmap.get("bimRequestId"));
jsonObject.put("resultCode", "505"); // schema.put("resultCode", "0");
jsonObject.put("message", "连接失败,请检查连接器配置的参数"); // schema.put("message", "success");
logger.info(jsonObject.toJSONString()); // } else {
String mapJs = JSON.toJSONString(jsonObject); // schema.put("bimRequestId", reqmap.get("bimRequestId"));
//返回加密的json字符串 // schema.put("resultCode", "500");
mapJs = BamboocloudFacade.encrypt(mapJs, "123456", "AES"); // schema.put("message", "账号创建失败");
return mapJs; // }
} // String mapJson = JSON.toJSONString(schema);
// mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
// @ApiOperation("新增用户") // return mapJson;
// @ApiImplicitParam(name = "user", value = "新增用户信息", dataType = "User") // }
@PostMapping("/UserCreateService") // schema.put("bimRequestId", reqmap.get("bimRequestId"));
@ResponseBody // schema.put("resultCode", "500");
public String userCreateService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // schema.put("message", "账号创建失败,请检查连接器配置的参数");
// String mapJson = JSON.toJSONString(schema);
Map<String, Object> schema = new HashMap<String, Object>(); // //返回加密的json字符串
// mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
JSONObject jsonObject = new JSONObject(); // return mapJson;
// }
StringBuilder sb = stringBuilder(req); //
//修改多值的属性格式方便转换 //
String bodyparam = sb.toString(); //// @ApiOperation("修改用户")
bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES"); //// @ApiImplicitParam(name = "user", value = "修改用户信息", dataType = "User")
String p = bodyparam; // @PostMapping("/UserUpdateService")
String z = "[\""; // @ResponseBody
String y = "\"]"; // public String userUpdateService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
bodyparam.indexOf(z); //
bodyparam.indexOf(y); // Map<String, Object> schema = new HashMap<String, Object>();
while (bodyparam.contains(z)) { //
p = bodyparam.substring(bodyparam.indexOf(z), bodyparam.indexOf(y) + 2).replace(z, "\"").replace(y, "\"").replace("\",\"", ","); // JSONObject jsonObject = new JSONObject();
bodyparam = bodyparam.substring(0, bodyparam.indexOf(z)) + p + bodyparam.substring(bodyparam.indexOf(y) + 2, bodyparam.length()); //
} // StringBuilder sb = stringBuilder(req);
logger.info("json--param-->" + bodyparam); //
Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam); // String bodyparam = sb.toString();
String username = (String) reqmap.get("bimRemoteUser"); //
String password = (String) reqmap.get("bimRemotePwd"); // bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES");
// //修改多值的属性格式方便转换
if (BamboocloudUtils.checkUsernamePassword(username, password)) { // String p = bodyparam;
/** // String bdp = bodyparam;
* 新增用户 // String z = "[\"";
*/ // String y = "\"]";
//获取用户创建所需的参数 // bodyparam.indexOf(z);
// User user = createUpdateUser(reqmap); // bodyparam.indexOf(y);
SysUser user = new SysUser(); // while (bodyparam.contains(z)) {
//用户创建 // p = bodyparam.substring(bodyparam.indexOf(z), bodyparam.indexOf(y) + 2).replace(z, "\"").replace(y, "\"").replace("\",\"", ",");
userService.insertUser(user); // bodyparam = bodyparam.substring(0, bodyparam.indexOf(z)) + p + bodyparam.substring(bodyparam.indexOf(y) + 2, bodyparam.length());
//获取返回给IAM连接器的唯一标识用于后续该条数据的更新修改删除 // }
String uid = user.getUserId() + ""; // logger.info("json--param-->" + bodyparam);
if (uid != null) { // Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam);
schema.put("uid", uid); // String username = (String) reqmap.get("bimRemoteUser");
schema.put("bimRequestId", reqmap.get("bimRequestId")); // String password = (String) reqmap.get("bimRemotePwd");
schema.put("resultCode", "0"); // if (BamboocloudUtils.checkUsernamePassword(username, password)) {
schema.put("message", "success"); // SysUser user = new SysUser();
} else { // //获取用于更新的参数
schema.put("bimRequestId", reqmap.get("bimRequestId")); //// user = createUpdateUser(reqmap);
schema.put("resultCode", "500"); // //获取用于更新的唯一标识
schema.put("message", "账号创建失败"); // user.setUserId(Long.valueOf(String.valueOf(reqmap.get("bimUid"))));
} // //更新用户
String mapJson = JSON.toJSONString(schema); // userService.updateUser(user);
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES"); // schema.put("bimRequestId", reqmap.get("bimRequestId"));
return mapJson; // schema.put("resultCode", "0");
} // schema.put("message", "success");
schema.put("bimRequestId", reqmap.get("bimRequestId")); // String mapJson = JSON.toJSONString(schema);
schema.put("resultCode", "500"); // mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
schema.put("message", "账号创建失败,请检查连接器配置的参数"); // logger.info("response----->" + schema);
String mapJson = JSON.toJSONString(schema); // return mapJson;
//返回加密的json字符串 // }
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES"); // schema.put("bimRequestId", reqmap.get("bimRequestId"));
return mapJson; // schema.put("resultCode", "500");
} // schema.put("message", "账号更新失败,请检查连接器配置的参数");
// String mapJson = JSON.toJSONString(schema);
// mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
// @ApiOperation("修改用户") // logger.info("response----->" + schema);
// @ApiImplicitParam(name = "user", value = "修改用户信息", dataType = "User") // return mapJson;
@PostMapping("/UserUpdateService") // }
@ResponseBody //
public String userUpdateService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //
// public StringBuilder stringBuilder(HttpServletRequest req) {
Map<String, Object> schema = new HashMap<String, Object>(); // BufferedReader br = null;
// StringBuilder sb = new StringBuilder();
JSONObject jsonObject = new JSONObject(); // String str = "";
// try {
StringBuilder sb = stringBuilder(req); // br = req.getReader();
// while ((str = br.readLine()) != null) {
String bodyparam = sb.toString(); // sb.append(str);
// }
bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES"); // br.close();
//修改多值的属性格式方便转换 // } catch (IOException e) {
String p = bodyparam; // e.printStackTrace();
String bdp = bodyparam; // if (br != null)
String z = "[\""; // try {
String y = "\"]"; // br.close();
bodyparam.indexOf(z); // } catch (IOException eo) {
bodyparam.indexOf(y); // eo.printStackTrace();
while (bodyparam.contains(z)) { // }
p = bodyparam.substring(bodyparam.indexOf(z), bodyparam.indexOf(y) + 2).replace(z, "\"").replace(y, "\"").replace("\",\"", ","); // } finally {
bodyparam = bodyparam.substring(0, bodyparam.indexOf(z)) + p + bodyparam.substring(bodyparam.indexOf(y) + 2, bodyparam.length()); // if (br != null) {
} // try {
logger.info("json--param-->" + bodyparam); // br.close();
Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam); // } catch (IOException e) {
String username = (String) reqmap.get("bimRemoteUser"); // e.printStackTrace();
String password = (String) reqmap.get("bimRemotePwd"); // }
if (BamboocloudUtils.checkUsernamePassword(username, password)) { // }
SysUser user = new SysUser(); // }
//获取用于更新的参数 // return sb;
// 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 # url: jdbc:oracle:thin:@127.0.0.1:1521/orcl
# username: root # username: root
# password: password # password: password
url: jdbc:oracle:thin:@218.58.79.146:17521/orcl url: jdbc:oracle:thin:@10.169.28.44:1521/orcl
username: system username: spg_voc
password: oracle password: SPG$spgvoc_24!
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

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