diff --git a/RuoYi-Vue-Oracle/pom.xml b/RuoYi-Vue-Oracle/pom.xml index 19f49d6..0b18833 100644 --- a/RuoYi-Vue-Oracle/pom.xml +++ b/RuoYi-Vue-Oracle/pom.xml @@ -27,7 +27,7 @@ 5.3.33 5.7.12 1.4.7 - 2.0.43 + 4.0.3 1.2.23 2.13.0 1.21 @@ -55,6 +55,12 @@ 4.1.63.Final + + + cn.zhxu + okhttps + 4.0.3 + org.springframework.boot @@ -159,11 +165,16 @@ ${bitwalker.version} - + + + + + + - com.alibaba.fastjson2 - fastjson2 - ${fastjson.version} + cn.zhxu + okhttps-fastjson2 + 4.0.3 @@ -171,6 +182,11 @@ org.springframework spring-context-support + + org.springframework + spring-core + + @@ -179,6 +195,58 @@ ${jwt.version} + + + org.apache.axis + axis + 1.4 + + + org.apache.axis + axis-jaxrpc + 1.4 + + + + + + + + + + + + javax.xml.ws + jaxws-api + 2.3.1 + + + + + com.sun.xml.ws + jaxws-rt + 2.3.1 + + + + + cn.hutool + hutool-all + 5.7.15 + + + axis + axis-wsdl4j + 1.5.1 + + + commons-discovery + commons-discovery + 0.2 + + + + javax.xml.bind diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/RuoYiApplication.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/RuoYiApplication.java index 7ac0620..9b9ffb8 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/RuoYiApplication.java @@ -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" + diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/task/EquTask.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/task/EquTask.java index ba557fe..d1bc9e6 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/task/EquTask.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/task/EquTask.java @@ -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 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 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()); }); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/task/forest/MyTaskClient.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/task/forest/MyTaskClient.java index 3e7d0d4..b1014ed 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/task/forest/MyTaskClient.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/task/forest/MyTaskClient.java @@ -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); + } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/wsdl/TestWsdl.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/wsdl/TestWsdl.java new file mode 100644 index 0000000..3592e9f --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/wsdl/TestWsdl.java @@ -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); + } +} \ No newline at end of file diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/wsdl/WebServiceUtil.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/wsdl/WebServiceUtil.java new file mode 100644 index 0000000..6bfa35d --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/wsdl/WebServiceUtil.java @@ -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 phones, String msg) throws Exception { + + System.out.println("开始调用webservice"); + List> 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 objects = new ArrayList<>(); + objects.add("18437762352"); + try { + sendMessage(objects,"ceshi"); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/wsdl/WebServiceUtils.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/wsdl/WebServiceUtils.java new file mode 100644 index 0000000..4d0a716 --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/common/wsdl/WebServiceUtils.java @@ -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 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 call(String methodName, Map params, Class 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 parameterList = Lists.newArrayList(); + if (params != null) { + Set 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 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 parameterList = Lists.newArrayList(); + if (params != null) { + Set 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 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 parameterList = Lists.newArrayList(); + if (params != null) { + Set 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" + result); + return result; + } catch (Exception e) { +// log.error("调用 WebService 接口错误信息==>" + e.getMessage()); + } + return null; + } +} \ No newline at end of file diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThDevice.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThDevice.java index 3962ad3..7f0de78 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThDevice.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThDevice.java @@ -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; diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/system/controller/BbcController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/system/controller/BbcController.java index e09be40..a0229c2 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/system/controller/BbcController.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/system/controller/BbcController.java @@ -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 reqmap = (Map) 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>> 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); - // 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 schema = new HashMap(); - - 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 reqmap = (Map) 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 schema = new HashMap(); - - 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 reqmap = (Map) 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 reqmap = (Map) 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>> 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); +// // 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 schema = new HashMap(); +// +// 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 reqmap = (Map) 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 schema = new HashMap(); +// +// 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 reqmap = (Map) 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; +// } +// +//} +// diff --git a/RuoYi-Vue-Oracle/src/main/resources/application-druid.yml b/RuoYi-Vue-Oracle/src/main/resources/application-druid.yml index 72a7a04..6fe6bb2 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/application-druid.yml +++ b/RuoYi-Vue-Oracle/src/main/resources/application-druid.yml @@ -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: # 从数据源开关/默认关闭 diff --git a/RuoYi-Vue-Oracle/src/main/resources/application.yml b/RuoYi-Vue-Oracle/src/main/resources/application.yml index b615bb2..377777c 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/application.yml +++ b/RuoYi-Vue-Oracle/src/main/resources/application.yml @@ -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: