2023年1月30日17:00:17

版本更新:v1.2.1->1.5.0
This commit is contained in:
chengzhichao
2023-01-30 17:01:24 +08:00
parent 4c6c4b978b
commit 6e25d1ad32
13 changed files with 557 additions and 21 deletions
@@ -13,19 +13,6 @@ import java.util.*;
*/
public class Query_LT extends LT_CMP_Api {
public static void main(String[] args) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("cd_username", "");
map.put("cd_pwd", "");
map.put("cd_key", "");
Query_LT Qy = new Query_LT(map);
System.out.println(Qy.queryAPNInfo("8986"));
}
public Query_LT(Map<String, Object> init_map) {
super(init_map);
@@ -72,6 +59,8 @@ public class Query_LT extends LT_CMP_Api {
/**
* 项目描述 当月流量查询接口
* <p>
* <p>
* 不再封装!!!!!!!!
* 注:上月27号 -本月26号晚 一个月。
*
@@ -114,7 +103,7 @@ public class Query_LT extends LT_CMP_Api {
* @Author:
* @Return: 历史流量查询
* @Description:
* @Date: 2021/11/14 0014 14:07
* @Date:
*/
public static Map<String, Object> queryFlowHis(String iccid, String time) {
Map<String, Object> result = new HashMap<String, Object>();
@@ -172,6 +161,7 @@ public class Query_LT extends LT_CMP_Api {
/**
* 业务参数,需要发给能力提供者
*/
Map<String, Object> params = new HashMap<String, Object>();
List<String> iccids = new ArrayList<String>();
iccids.add(iccid);
@@ -277,6 +267,7 @@ public class Query_LT extends LT_CMP_Api {
/**
* 项目描述 查询APN设置信息
*
* @throws IOException
*/
@SuppressWarnings("unchecked")
@@ -313,6 +304,7 @@ public class Query_LT extends LT_CMP_Api {
* 项目描述 查询是否需要实名认证
* 返回 true :已实名 不需要再实名
* fasle :未实名 需要实名认证
*
* @throws IOException
*/
public static Map<String, Object> queryRealNameStatus(String iccid) {
@@ -334,7 +326,9 @@ public class Query_LT extends LT_CMP_Api {
params.put("openId", openId);
params.put("version", version);
request.setParams(params);
//System.out.println(params);
CommonJsonResponse response = client.execute(request);
//System.out.println(response.getMessage());
params= response.getData();
if (response.isSuccess()) {
result.put("state", params.get("resultCode"));
@@ -24,7 +24,7 @@ public class LT_CMP_Api {
this.client = new IoTGatewayClient(server_Ip, appId,appSecret);
}
// 服务器请求地址
// 服务器请求地址 http://api.ct10649.com:9001
protected static String server_Ip = "https://gwapi.10646.cn/api/";;
// user_id
protected static String appId = null;
@@ -23,6 +23,7 @@ public class serviceAccept_LT extends LT_CMP_Api {
}
/**
*
* 项目描述
* SIM卡状态:
"0": 可测试,
@@ -14,10 +14,12 @@ import com.yunze.apiCommon.upstreamAPI.IoTLink.Inquire.Query_IoTLink;
import com.yunze.apiCommon.upstreamAPI.IoTLink.change.serviceAccept_IoTLink;
import com.yunze.apiCommon.upstreamAPI.LianTongCMP.Inquire.Query_LT;
import com.yunze.apiCommon.upstreamAPI.LianTongCMP.change.serviceAccept_LT;
import com.yunze.apiCommon.upstreamAPI.ShuoLang.Inquire.Query_Shuolang;
import com.yunze.apiCommon.upstreamAPI.YiDongEC.Inquire.Query_YD;
import com.yunze.apiCommon.upstreamAPI.YiDongEC.YD_EC_Api;
import com.yunze.apiCommon.upstreamAPI.YiDongEC.change.serviceAccept_YD;
import com.yunze.apiCommon.upstreamAPI.YiDongEcV2.Inquire.Query_EcV2;
import com.yunze.apiCommon.upstreamAPI.YiYuan.Inquire.Query_YiYuan;
import com.yunze.apiCommon.utils.VeDate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Lazy;
@@ -736,7 +738,86 @@ public class PublicApiService {
rmap.put("Message", "操作成功");
rmap.put("cd_code", cd_code);
} else {
} else if (cd_code.equals("LianTong_CMP")) { //联通CMP
if (function_name.equals("queryFlow")) {
//实例化 联通 CMP 查询 类
Query_LT Qy = new Query_LT(find_card_route_map);
rmap.put("Data", Qy.queryFlow(iccid));
} else if (function_name.equals("queryFlowHis")) {
//实例化 联通 CMP 查询 类
Query_LT Qy = new Query_LT(find_card_route_map);
rmap.put("Data", Qy.queryFlowHis(iccid, dateTime));
} else if (function_name.equals("queryCardStatus")) {
//实例化 联通 CMP 查询 类
Query_LT Qy = new Query_LT(find_card_route_map);
rmap.put("Data", Qy.queryCardStatus(iccid));
} else if (function_name.equals("changeCardStatus")) {
//实例化 联通 CMP 业务变更 类
serviceAccept_LT Ser = new serviceAccept_LT(find_card_route_map);
String stop = null;
if (Is_Stop.equals("on")) {
stop = "2";//正常
} else if (Is_Stop.equals("off")){
stop = "3";//停机
}
rmap.put("Data", Ser.changeCardStatus(iccid,stop));
}else if (function_name.equals("queryRealNameStatus")) {
//实例化 联通 CMP 查询 类
Query_LT Qy = new Query_LT(find_card_route_map);
//iccid = iccid.length()>19?iccid.substring(0,19):iccid;
rmap.put("Data", Qy.queryRealNameStatus(iccid));
}else if (function_name.equals("queryAPNInfo")) {
//实例化 联通 CMP 查询 类
Query_LT Qy = new Query_LT(find_card_route_map);
rmap.put("Data", Qy.queryAPNInfo(iccid));
}else if (function_name.equals("FunctionApnStatus")) {
rmap.put("Data", "未开放接口!");
}else if (function_name.equals("SpeedLimit")) {
//实例化 联通 CMP 业务变更 类
serviceAccept_LT Ser = new serviceAccept_LT(find_card_route_map);
Map<String,Object> Smap = Ser.speedValue_set(speedValue);
boolean bool = (boolean) Smap.get("bool");
speedValue = Smap.get("speedValue").toString();
if(bool){
rmap.put("Data", Ser.upNetWork(iccid,speedValue));
}else{
rmap.put("Data", "限速标准不存在,请检查后重试!");
}
}else if (function_name.equals("MachineCardBinding")) {
rmap.put("Data", "未开放接口!");
}
rmap.put("Message", "操作成功");
rmap.put("cd_code", cd_code);
}else if (cd_code.equals("YYWL")) {
if (function_name.equals("queryFlow")) {
//实例化 查询 类
Query_YiYuan Yy = new Query_YiYuan(find_card_route_map);
rmap.put("Data", Yy.queryInfo(iccid));
}else if (function_name.equals("queryCardStatus")) {
//实例化 查询 类
Query_YiYuan Yy = new Query_YiYuan(find_card_route_map);
rmap.put("Data", Yy.queryInfo(iccid));
}else if (function_name.equals("queryCardActiveTime")) {
//实例化 查询 类
Query_YiYuan Yy = new Query_YiYuan(find_card_route_map);
rmap.put("Data", Yy.queryInfo(iccid));
}
rmap.put("Message", "操作成功");
rmap.put("cd_code", cd_code);
}else if (cd_code.equals("ShuoLang")) {
if (function_name.equals("queryFlow")) {
//实例化 查询 类
Query_Shuolang Q_Sl = new Query_Shuolang(find_card_route_map);
rmap.put("Data", Q_Sl.queryInfo(card_no));
}else if (function_name.equals("queryCardStatus")) {
//实例化 查询 类
Query_Shuolang Q_Sl = new Query_Shuolang(find_card_route_map);
rmap.put("Data", Q_Sl.queryInfo(card_no));
}
rmap.put("Message", "操作成功");
rmap.put("cd_code", cd_code);
}else {
rmap.put("cd_code", 500);
rmap.put("Message", "划分的通道 通道编号配置错误请检查通道编号!");
}
@@ -0,0 +1,56 @@
package com.yunze.apiCommon.upstreamAPI.ShuoLang.Inquire;
import com.alibaba.fastjson.JSONObject;
import com.yunze.apiCommon.upstreamAPI.ShuoLang.ShuoLang_Api;
import com.yunze.apiCommon.utils.HttpUtil;
import com.yunze.apiCommon.utils.UrlUtil;
import java.util.HashMap;
import java.util.Map;
/**
* 查询类接口
*/
public class Query_Shuolang extends ShuoLang_Api {
public Query_Shuolang(Map<String, Object> init_map) {
super(init_map);
}
/**
* 获取单卡信息 用量 是 KB
* @param cardno 接入号
* @param
* @return
*/
public static String queryInfo(String cardno) {
String Rstr = null;
try {
Map<String, Object> params = new HashMap<>();
params.put("userId", userId);
params.put("cardno", cardno);
String times = System.currentTimeMillis()+"";
params.put("times", times);
String url = server_Ip + "/api/v1/getChaxun";
params.put("sign", getSign(times));
Rstr = HttpUtil.get(UrlUtil.getUrl(url, params));
} catch (Exception e) {
e.printStackTrace();
}
return Rstr;
}
}
@@ -0,0 +1,68 @@
package com.yunze.apiCommon.upstreamAPI.ShuoLang;
import com.alibaba.fastjson.JSONObject;
import com.yunze.apiCommon.utils.HttpUtil;
import com.yunze.apiCommon.utils.MD5Util;
import com.yunze.apiCommon.utils.UrlUtil;
import org.springframework.stereotype.Component;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
/**
* 硕朗物理网 系统 API 接口
*/
@Component
public class SL_Api {
/**
* 硕朗秘钥共享token 获取
* @param api
* @return
*/
public Map<String, Object> getSuolangToken(Map<String, Object> api) {
Map<String, Object> Rmap = new HashMap<>();
//System.out.println("=[api]");
//System.out.println(api.toString());
String rstr = null;
String userId = api.get("userId").toString();
String channel_id = api.get("channel_id").toString();
String channel_pname = api.get("channel_pname").toString();
String apikey = api.get("apikey").toString();
Long times = System.currentTimeMillis();
Map<String, Object> params = new HashMap<String, Object>();
params.put("userId", userId);
params.put("channel_id", channel_id);
params.put("channel_pname", channel_pname);
params.put("times", times+"");
String md5Str=MessageFormat.format("userId={0}&apikey={1}&times={2}", userId, apikey, times+"");
params.put("sign", MD5Util.MD5Encode(md5Str).toUpperCase());
//System.out.println(params.toString());
//System.out.println(JsonKit.toJson(params));
String param_url = UrlUtil.getUrl(api.get("method").toString(), params);
String res = HttpUtil.get(param_url);
System.out.println(res);
JSONObject dataJson = JSONObject.parseObject(res);
//System.out.println("SuoLang 共享 TOken 获取 "+ EscapeUtil.unescape(dataJson.getString("msg")));
if (dataJson.getString("code").equals("0")) {
JSONObject data = (JSONObject)dataJson.get("data");
/*rstr = "{\"status\":\"0\",\"message\":\"正确\", \"result\":[ { \"token\": \""
+ data.get("accesstoken").toString() + "\"}]}";*/
Rmap.put("token",data.get("accesstoken").toString());
} else {
Rmap.put("token",null);
//rstr = "{\"status\":\"12022\",\"message\":\"PASSWORD 鉴权不通过\",\"result\":[{\"token\":\"-1\"}]}";
}
//System.out.println("rstr = " + rstr);
return Rmap;
}
}
@@ -0,0 +1,49 @@
package com.yunze.apiCommon.upstreamAPI.ShuoLang;
import com.yunze.apiCommon.utils.MD5Util;
import java.text.MessageFormat;
import java.util.Map;
/**
* 硕朗 接口
*/
public class ShuoLang_Api {
//构造赋值
public ShuoLang_Api(Map<String, Object> init_map){
userId = init_map.get("cd_username").toString();
apikey = init_map.get("cd_pwd").toString();
server_Ip = init_map.get("cd_key").toString();
}
// 服务器请求地址 http://1.1.1.1:32003 [硕朗通用对外接口]
protected static String server_Ip = null;
// 秘钥key
public static String userId = null;
//秘钥密码
public static String apikey = null;
// 配置调用的名称
protected static String Config_name = "";
public static String getSign(String times){
String sign = null;
String md5Str= MessageFormat.format("userId={0}&apikey={1}&times={2}", userId, apikey, times+"");
return MD5Util.MD5Encode(md5Str).toUpperCase();
}
}
@@ -0,0 +1,106 @@
package com.yunze.apiCommon.upstreamAPI.YiYuan;
import com.cu.api.internal.utils.StringUtils;
import org.apache.commons.codec.digest.DigestUtils;
/**
* 进制转换
* @Auther: zhang feng
* @Description:
*/
public class BaseUtile {
/**
* 字符串转 二进制 Sha1 运算
* @param psw
* @return
*/
public static byte[] getSha1(String psw) {
if(StringUtils.isEmpty(psw)){
return null;
}else{
return DigestUtils.sha1(psw);
}
}
/**
* 二进制转十六进制
* @param src
* @return
*/
public static String bytesToHexString(byte[] src){
StringBuilder stringBuilder = new StringBuilder();
if (src == null || src.length <= 0) {
return null;
}
for (int i = 0; i < src.length; i++) {
int v = src[i] & 0xFF;
String hv = Integer.toHexString(v);
stringBuilder.append(i );
if (hv.length() < 2) {
stringBuilder.append(0);
}
stringBuilder.append(hv);
}
return stringBuilder.toString();
}
/**
* 十六进制转二进制
* @param hex
* @return
*/
public static byte[] hexStringToByte(String hex) {
int len = (hex.length() / 2);
byte[] result = new byte[len];
char[] achar = hex.toCharArray();
for (int i = 0; i < len; i++) {
int pos = i * 2;
result[i] = (byte) (toByte(achar[pos]) << 4 | toByte(achar[pos + 1]));
}
return result;
}
private static byte toByte(char c) {
byte b = (byte) "0789abcdef".indexOf(c);
return b;
}
/**
* 将字节数组转换成十六进制字符串进行输出
* @param bArr
* @return
*/
public static final String bytesToHexString2(byte[] bArr) {
StringBuffer sb = new StringBuffer(bArr.length);
String sTmp;
for (int i = 0; i < bArr.length; i++) {
sTmp = Integer.toHexString(0xFF & bArr[i]);
if (sTmp.length() < 2)
sb.append(0);
sb.append(sTmp.toUpperCase());
}
return sb.toString();
}
/**
* 将字节数组转换成十六进制字符串进行输出
* @param bytes
* @return
*/
public static final String bytesToHexFun3(byte[] bytes) {
StringBuilder buf = new StringBuilder(bytes.length * 2);
for(byte b : bytes) { // 使用String的format方法进行转换
buf.append(String.format("%02x", new Integer(b & 0xff)));
}
return buf.toString();
}
}
@@ -0,0 +1,61 @@
package com.yunze.apiCommon.upstreamAPI.YiYuan.Inquire;
import com.yunze.apiCommon.upstreamAPI.YiYuan.YiYuan_Api;
import com.yunze.apiCommon.utils.HttpUtil;
import java.util.HashMap;
import java.util.Map;
/**
* 查询类接口
*/
public class Query_YiYuan extends YiYuan_Api {
public Query_YiYuan(Map<String, Object> init_map) {
super(init_map);
}
/**
* 获取单个卡 信息
* @param iccid
* @param
* @return
*/
public static String queryInfo(String iccid) {
String Rstr = null;
try {
String method = "fc.function.card.info";//资产详细信息
String time = System.currentTimeMillis()+"";
time = time.substring(0,time.length()-3);
Map<String, Object> params = new HashMap<>();
params.put("appKey",appKey);
params.put("method",method);
params.put("iccid",iccid);
params.put("t",time);
String sign = getSign(params);
params.put("sign",sign);
String url = server_Ip ;
//System.out.println(reqUrl);
Rstr = HttpUtil.doPost(url, params);
} catch (Exception e) {
e.printStackTrace();
}
return Rstr;
}
}
@@ -0,0 +1,50 @@
package com.yunze.apiCommon.upstreamAPI.YiYuan;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* 移远 系统 API 接口
*/
public class YiYuan_Api {
//构造赋值
public YiYuan_Api(Map<String, Object> init_map){
appKey = init_map.get("cd_username").toString();
Secret = init_map.get("cd_pwd").toString();
}
// 服务器请求地址 http://api.quectel.com/openapi/router
protected static String server_Ip = "http://api.quectel.com/openapi/router";
// 用户登录名称
public static String appKey = null;
// 秘钥key
public static String Secret = null;
// 配置调用的名称
protected static String Config_name = "";
public static String getSign(Map<String,Object> map){
List<String> list=new ArrayList<>(map.keySet());
Collections.sort(list);
StringBuffer sb=new StringBuffer();
sb.append(Secret);
for(int i=0;i<list.size();i++){
String k =list.get(i);
String v=(String )map.get(k);
sb.append(k).append(v);
}
sb.append(Secret);
String sign = BaseUtile.bytesToHexString2(BaseUtile.getSha1(sb.toString()));
return sign;
}
}
@@ -267,6 +267,31 @@ public class ApiUtil_NoStatic{
Use = Arith.formatToTwo(Arith.mul(Double.parseDouble(total_bytes_cnt),1024));//GB 转 MB
}
}
}else if (cd_code.equals("YYWL")) {
//移远物联 解析
Map<String, Object> JsonData = JSON.parseObject(data.get("Data").toString());
try {
codeOn = JsonData.get("resultCode").toString();
rtMessage = JsonData.get("errorMessage").toString();
}catch (Exception e){}
Use = Double.parseDouble(JsonData.get("flow").toString());
}else if (cd_code.equals("ShuoLang")) {
//硕朗 解析
Map<String, Object> JsonData = JSON.parseObject(data.get("Data").toString());
Map<String, Object> Data = JSON.parseObject(JsonData.get("data").toString());
String code = JsonData.get("code").toString();
try {
codeOn = code;
rtMessage = JsonData.get("msg").toString();
}catch (Exception e){}
if(code.equals("0")){
double kb = Double.parseDouble(Data.get("used").toString());
if(kb>-1){
Use = Arith.formatToTwo(Arith.div(kb,1024));//KB 转 MB
}
}else{
data.put("Message",JsonData.get("msg"));
}
}
try {
@@ -477,6 +502,22 @@ public class ApiUtil_NoStatic{
statusCode = Integer.parseInt(DongXin_ECV2_CardStatusMap.get("statusCode").toString());
statusMessage = DongXin_ECV2_CardStatusMap.get("statusMessage").toString();
}else if (cd_code.equals("YYWL")) {
//移远物联 解析 status
Map<String, Object> Data = JSON.parseObject(data.get("Data").toString());
//SysstatusCodetem.out.println(Obj);
String StatusCd = Data.get("status").toString();
Map<String, Object> States = cardStatusReplacementUtil.getStates(StatusCd);
statusCode = Integer.parseInt(States.get("statusCode").toString());
statusMessage = States.get("statusMessage").toString();
}else if (cd_code.equals("ShuoLang")) {
//硕朗 解析 message
Map<String, Object> JsonData = JSON.parseObject(data.get("Data").toString());
Map<String, Object> Data = JSON.parseObject(JsonData.get("data").toString());
String message = Data.get("message").toString();
Map<String, Object> States = cardStatusReplacementUtil.getStates(message);
statusCode = Integer.parseInt(States.get("statusCode").toString());
statusMessage = States.get("statusMessage").toString();
}
Outdata.put("Message", data.get("Message"));
@@ -1155,6 +1196,17 @@ public class ApiUtil_NoStatic{
openDate = activateDate;
}
}
}else if (cd_code.equals("YYWL")) {
//移远物联 解析
Map<String, Object> Data = JSON.parseObject(data.get("Data").toString());
String active = Data.get("active").toString();
String activateTime = Data.get("activateTime").toString();
if (active!=null && activateTime!=null && active.equals("激活") ) {
activateDate = activateTime;
statusCode = 200;
} else {
statusMessage = Data.get("requestMsg").toString();
}
}
Outdata.put("Message", data.get("Message"));
@@ -1838,6 +1890,16 @@ public class ApiUtil_NoStatic{
} else {
statusMessage = Data.get("message").toString();
}
}else if (cd_code.equals("LianTong_CMP")) {
//联通 CMP 解析
Map<String, Object> Data = (Map<String, Object>) data.get("Data");
String Rcode = Data.get("resultCode").toString();
if (Rcode.equals("0000") || Rcode.equals("1193") ) {
statusCode = 200;
statusMessage = "操作成功!";
} else {
statusMessage = Data.get("resultDesc").toString();
}
}
Outdata.put("Message",statusMessage);
} catch (Exception e) {
+8 -1
View File
@@ -129,6 +129,13 @@
<span>更新日志</span>
</div>
<el-collapse accordion v-model="activeName">
<el-collapse-item title="v1.5.0 - 2023-02-02" name="5">
<ol>
<li>新增第三方接口 联通CMP</li>
<li>新增第三方接口 硕朗</li>
<li>新增第三方接口 移远</li>
</ol>
</el-collapse-item>
<el-collapse-item title="v1.2.1 - 2023-01-12" name="5">
<ol>
<li>新增 对外接口模块 <a style="color: red" target="_blank" href="https://gitee.com/sdyunze/iotlink/tree/master/yunze-iotapi">yunze-iotapi</a> </li>
@@ -241,7 +248,7 @@
data() {
return {
// 版本号
version: "1.2.1",
version: "1.5.0",
activeName:'5',
};
},
@@ -692,9 +692,9 @@
<el-dropdown-item v-hasPermi="['yunze:card:singleState']" @click.native="InfoStatus(scope.row.iccid)">
灵活变更状态
</el-dropdown-item>
<el-dropdown-item v-hasPermi="['yunze:card:SynActivateDate']"
@click.native="SynActivateDate(scope.row.iccid)">同步激活时间
</el-dropdown-item>
<!-- <el-dropdown-item v-hasPermi="['yunze:card:SynActivateDate']"-->
<!-- @click.native="SynActivateDate(scope.row.iccid)">同步激活时间-->
<!-- </el-dropdown-item>-->
<el-dropdown-item v-hasPermi="['yunze:flow:list']">
<router-link :to="'/card/type/cardFlow/'+ scope.row.iccid" class="link-type">
<span>订购资费查询</span>
@@ -2847,7 +2847,7 @@ export default {
this.singleCardSc = true;
this.ParamsShowId.iccid = row;
this.loadStatusFlexible(); //加载 灵活变更状态
// console.log(this.ParamsShowId.iccids = row)
console.log(this.ParamsShowId.iccids = row)
},
//同步激活时间
@@ -3446,6 +3446,7 @@ export default {
},
/*灵活变更状态 确定按钮*/
FlexibleAdd(row) {
console.log("变更状态")
let _this = this;//tools.getDkeyValue(status_Flexible,_this.ParamsShowId.status_ShowId)
if (_this.ParamsShowId.status_ShowId != null && _this.ParamsShowId.status_ShowId != '') {
let title = '';