You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
admin-client-temperature/src/main/java/com/rehome/mqttclienttemperature/webservice/AgencyServiceImpl.java

64 lines
4.0 KiB
Java

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.rehome.mqttclienttemperature.webservice;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import javax.jws.WebService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* 单位信息 webService 远程接口实现
* 1、@WebService 定义接口为 webservice 服务。
* * serviceName对应生成的 WSDL 文件中的 definitions 元素中的 name 属性值,默认以服务类名称+"Service"为值。
* * targetNamespace目标名称空间对应 WSDL 文档的根元素 definition 元素的 targetNameSpace 属性。默认为 "http://" 加 "包名的反写"。
* * endpointInterface终端接口定义服务抽象 WebService 协定的服务端点接口的完整名称,通常设置为服务接口的全路径。
* @author HuangWenfei
* @version 1.0
* @date 2025/04/15 13:51
*/
@Component
@WebService(serviceName = "agencyService",
targetNamespace = "http://webservice.mqttclienttemperature.rehome.com/",
endpointInterface = "com.rehome.mqttclienttemperature.webservice.AgencyService")
public class AgencyServiceImpl implements AgencyService {
private static final Logger log = LoggerFactory.getLogger(AgencyServiceImpl.class);
/**
* 查询单位信息
* 1、@WebMethod 定义方法为 webservice 方法
* 2、@WebParam 定义方法参数用于定义wsdl中的参数映射
*
* @param paramJson Json 对象字符串,复杂对象统一转成 json 对象字符串进行传输,双方接收后再转成 Json 对象。
* 如 {"user_id":"4783748PL898878","token":"37483748YU23","user_name":"蚩尤后裔"}
* @return Json 对象字符串,复杂对象统一转成 json 对象字符串进行传输,双方接收后再转成 Json 对象 或者自己需要的实体对象
*/
@Override
public String queryAgencyStatInfo(String paramJson) {
String returnValue;
log.info("查询单位信息-开始-请求参数:\n{}", JSONUtil.toJsonPrettyStr(paramJson));
System.out.println("根据参数查询数据...");
returnValue = "{\"reason\":\"加载成功\",\"status_code\":\"1000\",\"data\":{\"msg\":\"查询成功\",\"subSystemName\":\"基础库管理\",\"subSystemCode\":\"bgt-basic-server\",\"tableList\":[{\"tableName\":\"BAS_AGENCY_EXT 单位扩展信息表\",\"tableSize\":560},{\"tableName\":\"BAS_AGENCY_INFO 单位基本信息表\",\"tableSize\":560}],\"sendStatus\":1,\"id\":\"5337a4bc06634e5491588c4fb9019787\"}}";
JSONObject jsonObject = JSONUtil.parseObj(returnValue);
return jsonObject.toString();
}
/**
* 更正单位信息
* 1、@WebMethod 定义方法为 webservice 方法
* 2、@WebParam 定义方法参数用于定义wsdl中的参数映射
*
* @param paramJson Json 对象字符串,复杂对象统一转成 json 对象字符串进行传输,双方接收后再转成 Json 对象。
* {"user_id":"5543748KH988878","token":"25483748YU98","user_name":"蚩尤后裔"}
* @return Json 对象字符串,复杂对象统一转成 json 对象字符串进行传输,双方接收后再转成 Json 对象 或者自己需要的实体对象
*/
@Override
public String syncAgencyStatInfo(String paramJson) {
String returnValue;
log.info("更正单位信息-开始-请求参数:\n{}", JSONUtil.toJsonPrettyStr(paramJson));
System.out.println("根据参数更正数据...");
returnValue = "{\"reason\":\"操作成功\",\"status_code\":\"1000\",\"data\":{\"msg\":\"更正成功\",\"subSystemName\":\"基础库管理\",\"subSystemCode\":\"bgt-basic-server\",\"tableList\":[{\"tableName\":\"BAS_AGENCY_EXT 单位扩展信息表\",\"tableSize\":145},{\"tableName\":\"BAS_AGENCY_INFO 单位基本信息表\",\"tableSize\":146}],\"sendStatus\":1,\"id\":\"5337a4bc06634e5491588c4fb9019787\"}}";
JSONObject jsonObject = JSONUtil.parseObj(returnValue);
return jsonObject.toString();
}
}