Compare commits

..

No commits in common. "6bd755c81ed435c8768b991a3fb0bcf7b4625a62" and "0ff28c7aadde19a85e2b7ef1a165b097edb34789" have entirely different histories.

5 changed files with 329 additions and 400 deletions

View File

@ -214,28 +214,6 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.15</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-ext-jdk15on</artifactId>
<version>1.69</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.69</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.69</version>
</dependency>
<!-- JAX-WS API --> <!-- JAX-WS API -->
<dependency> <dependency>
<groupId>javax.xml.ws</groupId> <groupId>javax.xml.ws</groupId>

View File

@ -6,12 +6,10 @@ import cn.zhxu.okhttps.HttpResult;
import cn.zhxu.okhttps.OkHttps; 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.fasterxml.jackson.core.JsonProcessingException;
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.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.oil.mapper.ThDeviceMapper;
import com.ruoyi.project.outside.service.OutSideService; import com.ruoyi.project.outside.service.OutSideService;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -20,7 +18,6 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
@Component @Component
public class EquTask { public class EquTask {
@ -31,8 +28,6 @@ public class EquTask {
private MyTaskClient myClient; private MyTaskClient myClient;
@Autowired @Autowired
private OutSideService outSideService; private OutSideService outSideService;
@Autowired
private ThDeviceMapper thDeviceMapper;
/** /**
* 港口原有设备对接 * 港口原有设备对接
*/ */
@ -47,9 +42,11 @@ public class EquTask {
JSONObject tokenByJson = httpResult.getBody().toBean(JSONObject.class); 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<>(); //查询 数据库 获取 港口以前的 设备信息
ThDevice thDevice = new ThDevice(); ThDevice thDevice = new ThDevice();
thDevice.setDeptId(5l); thDevice.setSn("e75153fd53d243289057ffec33f36cb9");
List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice); thDevice.setName("油气回收voc监测设备3#");
equLists.add(thDevice);
equLists.forEach(e->{ equLists.forEach(e->{
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
@ -63,12 +60,7 @@ public class EquTask {
JSONObject vocByJson = result.getBody().toBean(JSONObject.class); 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.toString()); System.out.println(vocByArray.toJSONString());
try {
Integer integer = outSideService.insertOldDeviceData(vocByArray.toJSONString());
} catch (JsonProcessingException jsonProcessingException) {
jsonProcessingException.printStackTrace();
}
}); });
} }

View File

@ -1,6 +1,5 @@
package com.ruoyi.common.wsdl; package com.ruoyi.common.wsdl;
import cn.hutool.core.lang.Console;
import cn.hutool.http.webservice.SoapClient; import cn.hutool.http.webservice.SoapClient;
@ -13,24 +12,24 @@ import javax.xml.soap.SOAPMessage;
*/ */
public class TestWsdl { public class TestWsdl {
public static void main(String[] args) throws Exception { 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参数实际开发并不需要
SoapClient client = SoapClient.create("http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx") SOAPMessage message = client.getMessage();
// 设置要请求的方法此接口方法前缀为web传入对应的命名空间 System.out.println(client.getMsgStr(true));
.setMethod("web:getCountryCityByIp", "http://WebXml.com.cn/")
// 设置参数此处自动添加方法的前缀web
.setParam("phone", "18437762352")
.setParam("msg", "1112121")
.setParam("dwdm", "SGJT-山港集团");
// 发送请求参数true表示返回一个格式化后的XML内容
// 返回内容为XML字符串可以配合XmlUtil解析这个响应
Console.log(client.send(true));
// 发送请求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

@ -111,8 +111,7 @@ public class SecurityConfig
.authorizeHttpRequests((requests) -> { .authorizeHttpRequests((requests) -> {
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests.antMatchers("/login","/bbc/**", requests.antMatchers("/login", "/register", "/captchaImage","/outside/*").permitAll()
"/register", "/captchaImage","/outside/*").permitAll()
// 静态资源可匿名访问 // 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

View File

@ -1,307 +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.security.core.userdetails.User; //import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.security.core.userdetails.UserDetails; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RestController;
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.ServletException; //import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest; //import java.io.BufferedReader;
import javax.servlet.http.HttpServletResponse; //import java.io.IOException;
import java.io.BufferedReader; //import java.io.PrintWriter;
import java.io.IOException; //import java.util.*;
import java.io.PrintWriter; //
import java.util.*; ///**
// * swagger 用户测试方法
/** // * 加密认证
* swagger 用户测试方法 // * @author ruoyi
* 加密认证 // */
* @author ruoyi //
*/ //@RestController
//@RequestMapping("/bbc/user")
@RestController //public class BbcController extends BaseController {
@RequestMapping("/bbc/user") //
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
// private ISysUserService userService;
@Autowired //
private ISysUserService userService; // @Autowired
// private ISysRoleService roleService;
@Autowired //
private ISysRoleService roleService; // @Autowired
// private ISysDeptService deptService;
@Autowired //
private ISysDeptService deptService; // @Autowired
// private ISysPostService postService;
@Autowired //
private ISysPostService postService; //// @ApiOperation("测试")
// @RequestMapping()
// @ApiOperation("测试") // public JSONObject bbcUser() {
@RequestMapping() //
public JSONObject bbcUser() { // JSONObject jsonObject = new JSONObject();
// jsonObject.put("resultCode", "0");
JSONObject jsonObject = new JSONObject(); // jsonObject.put("message", "success");
jsonObject.put("resultCode", "0"); // return jsonObject;
jsonObject.put("message", "success"); //
return jsonObject; // }
//
} //// @ApiOperation("对象属性字段查询")
// @PostMapping("/schemaService")
// @ApiOperation("对象属性字段查询") // public String SchemaService(HttpServletRequest req, HttpServletResponse resp) {
@PostMapping("/schemaService") //
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");
ArrayList<HashMap<String,Object>> accountList = new ArrayList<>(); // String password = (String) reqmap.get("bimRemotePwd");
HashMap<String, Object> nameMap = new HashMap<>(); //
nameMap.put("multivalued",false); // if (BamboocloudUtils.checkUsernamePassword(username, password)) {
nameMap.put("name","userName"); // /**
nameMap.put("required",true); // * 新增用户
nameMap.put("type","String"); // */
HashMap<String, Object> passMap = new HashMap<>(); // //获取用户创建所需的参数
passMap.put("multivalued",false); //// User user = createUpdateUser(reqmap);
passMap.put("name","password"); // SysUser user = new SysUser();
passMap.put("required",true); // //用户创建
passMap.put("type","String"); // userService.insertUser(user);
HashMap<String, Object> mobileMap = new HashMap<>(); // //获取返回给IAM连接器的唯一标识用于后续该条数据的更新修改删除
mobileMap.put("multivalued",false); // String uid = user.getUserId() + "";
mobileMap.put("name","mobile"); // if (uid != null) {
mobileMap.put("required",true); // schema.put("uid", uid);
mobileMap.put("type","String"); // schema.put("bimRequestId", reqmap.get("bimRequestId"));
HashMap<String, Object> statusMap = new HashMap<>(); // schema.put("resultCode", "0");
statusMap.put("multivalued",false); // schema.put("message", "success");
statusMap.put("name","status"); // } else {
statusMap.put("required",true); // schema.put("bimRequestId", reqmap.get("bimRequestId"));
statusMap.put("type","String"); // schema.put("resultCode", "500");
accountList.add(nameMap); // schema.put("message", "账号创建失败");
accountList.add(passMap); // }
accountList.add(mobileMap); // String mapJson = JSON.toJSONString(schema);
accountList.add(statusMap); // mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
jsonObject.put("account", accountList); // return mapJson;
// jsonObject.put("organization", mapJson.organizationList()); // }
// jsonObject.put("role", mapJson.roleList()); // schema.put("bimRequestId", reqmap.get("bimRequestId"));
// jsonObject.put("post", mapJson.postList()); // schema.put("resultCode", "500");
// jsonObject.put("dict", mapJson.dictDataList()); // schema.put("message", "账号创建失败,请检查连接器配置的参数");
jsonObject.put("bimRequestId", reqmap.get("bimRequestId")); // String mapJson = JSON.toJSONString(schema);
String mapJs = JSON.toJSONString(jsonObject); // //返回加密的json字符串
logger.info(jsonObject.toJSONString()); // mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
//返回加密的json字符串 // return mapJson;
mapJs = BamboocloudFacade.encrypt(mapJs, "123456", "AES"); // }
//jsonObject.put(map); //
//<Object> values = jsonObject.values(); //
return mapJs; //// @ApiOperation("修改用户")
} //// @ApiImplicitParam(name = "user", value = "修改用户信息", dataType = "User")
} // @PostMapping("/UserUpdateService")
jsonObject.put("bimRequestId", bimRequestId); // @ResponseBody
jsonObject.put("resultCode", "505"); // public String userUpdateService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
jsonObject.put("message", "连接失败,请检查连接器配置的参数"); //
logger.info(jsonObject.toJSONString()); // Map<String, Object> schema = new HashMap<String, Object>();
String mapJs = JSON.toJSONString(jsonObject); //
//返回加密的json字符串 // JSONObject jsonObject = new JSONObject();
mapJs = BamboocloudFacade.encrypt(mapJs, "123456", "AES"); //
return mapJs; // StringBuilder sb = stringBuilder(req);
} //
// String bodyparam = sb.toString();
// @ApiOperation("新增用户") //
// @ApiImplicitParam(name = "user", value = "新增用户信息", dataType = "User") // bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES");
@PostMapping("/UserCreateService") // //修改多值的属性格式方便转换
@ResponseBody // String p = bodyparam;
public String userCreateService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // String bdp = bodyparam;
// String z = "[\"";
Map<String, Object> schema = new HashMap<String, Object>(); // String y = "\"]";
// bodyparam.indexOf(z);
JSONObject jsonObject = new JSONObject(); // bodyparam.indexOf(y);
// while (bodyparam.contains(z)) {
StringBuilder sb = stringBuilder(req); // 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());
String bodyparam = sb.toString(); // }
bodyparam = BamboocloudUtils.getPlaintext(bodyparam, "123456", "AES"); // logger.info("json--param-->" + bodyparam);
String p = bodyparam; // Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam);
String z = "[\""; // String username = (String) reqmap.get("bimRemoteUser");
String y = "\"]"; // String password = (String) reqmap.get("bimRemotePwd");
bodyparam.indexOf(z); // if (BamboocloudUtils.checkUsernamePassword(username, password)) {
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("\",\"", ","); //// user = createUpdateUser(reqmap);
bodyparam = bodyparam.substring(0, bodyparam.indexOf(z)) + p + bodyparam.substring(bodyparam.indexOf(y) + 2, bodyparam.length()); // //获取用于更新的唯一标识
} // user.setUserId(Long.valueOf(String.valueOf(reqmap.get("bimUid"))));
logger.info("json--param-->" + bodyparam); // //更新用户
Map<String, Object> reqmap = (Map<String, Object>) JSON.parse(bodyparam); // userService.updateUser(user);
String username = (String) reqmap.get("bimRemoteUser"); // schema.put("bimRequestId", reqmap.get("bimRequestId"));
String password = (String) reqmap.get("bimRemotePwd"); // schema.put("resultCode", "0");
// schema.put("message", "success");
if (BamboocloudUtils.checkUsernamePassword(username, password)) { // String mapJson = JSON.toJSONString(schema);
/** // mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
* 新增用户 // logger.info("response----->" + schema);
*/ // return mapJson;
//获取用户创建所需的参数 // }
// User user = createUpdateUser(reqmap); // schema.put("bimRequestId", reqmap.get("bimRequestId"));
String userName = (String) reqmap.get("userName"); // schema.put("resultCode", "500");
String pass = (String) reqmap.get("password"); // schema.put("message", "账号更新失败,请检查连接器配置的参数");
// String mapJson = JSON.toJSONString(schema);
logger.info("reqmap---------->"+reqmap); // mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
SysUser user = new SysUser(); // logger.info("response----->" + schema);
user.setUserName(userName); // return mapJson;
user.setPassword(pass); // }
//用户创建 //
userService.registerUser(user); //
//获取返回给IAM连接器的唯一标识用于后续该条数据的更新修改删除 // public StringBuilder stringBuilder(HttpServletRequest req) {
String uid = user.getUserId() + ""; // BufferedReader br = null;
if (uid != null) { // StringBuilder sb = new StringBuilder();
schema.put("uid", uid); // String str = "";
schema.put("bimRequestId", reqmap.get("bimRequestId")); // try {
schema.put("resultCode", "0"); // br = req.getReader();
schema.put("message", "success"); // while ((str = br.readLine()) != null) {
} else { // sb.append(str);
schema.put("bimRequestId", reqmap.get("bimRequestId")); // }
schema.put("resultCode", "500"); // br.close();
schema.put("message", "账号创建失败"); // } catch (IOException e) {
} // e.printStackTrace();
String mapJson = JSON.toJSONString(schema); // if (br != null)
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES"); // try {
return mapJson; // br.close();
} // } catch (IOException eo) {
schema.put("bimRequestId", reqmap.get("bimRequestId")); // eo.printStackTrace();
schema.put("resultCode", "500"); // }
schema.put("message", "账号创建失败,请检查连接器配置的参数"); // } finally {
String mapJson = JSON.toJSONString(schema); // if (br != null) {
//返回加密的json字符串 // try {
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES"); // br.close();
return mapJson; // } catch (IOException e) {
} // e.printStackTrace();
// }
// }
// @ApiOperation("修改用户") // }
// @ApiImplicitParam(name = "user", value = "修改用户信息", dataType = "User") // return sb;
@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);
String userName = (String) reqmap.get("userName");
String pass = (String) reqmap.get("password");
logger.info("reqmap---------->"+reqmap);
user.setUserName(userName);
user.setPassword(pass);
//获取用于更新的唯一标识
user.setUserId(Long.valueOf(String.valueOf(reqmap.get("bimUid"))));
//更新用户
userService.updateUserStatus(user);
schema.put("bimRequestId", reqmap.get("bimRequestId"));
schema.put("resultCode", "0");
schema.put("message", "success");
String mapJson = JSON.toJSONString(schema);
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
logger.info("response----->" + schema);
return mapJson;
}
schema.put("bimRequestId", reqmap.get("bimRequestId"));
schema.put("resultCode", "500");
schema.put("message", "账号更新失败,请检查连接器配置的参数");
String mapJson = JSON.toJSONString(schema);
mapJson = BamboocloudFacade.encrypt(mapJson, "123456", "AES");
logger.info("response----->" + schema);
return mapJson;
}
public StringBuilder stringBuilder(HttpServletRequest req) {
BufferedReader br = null;
StringBuilder sb = new StringBuilder();
String str = "";
try {
br = req.getReader();
while ((str = br.readLine()) != null) {
sb.append(str);
}
br.close();
} catch (IOException e) {
e.printStackTrace();
if (br != null)
try {
br.close();
} catch (IOException eo) {
eo.printStackTrace();
}
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return sb;
}
}