Commit 51b10b2a authored by zhangc's avatar zhangc

commit

parent 4e66f97f
......@@ -23,12 +23,13 @@ public class MapUtil {
/**
* 获取签名参数
*
* @param apiKey
* @param method
* @param signType
* @return
*/
public static String getSignValue(String apiKey,String method,String signType){
public static String getSignValue(String apiKey, String method, String signType) {
StringBuilder builder = new StringBuilder();
builder.append("apiKey=").append(apiKey).append(LoggingConstants.AND_SPILT)
.append("method=").append(method).append(LoggingConstants.AND_SPILT)
......@@ -39,21 +40,22 @@ public class MapUtil {
/**
* 给map集合中的key实现字典排序
*
* @param map
* @return
*/
public Map<String , Object> MapKeySort(Map<String , Object> map){
public Map<String, Object> mapKeySort(Map<String, Object> map) {
ArrayList list = new ArrayList();
for (Map.Entry<String, Object> entry : map.entrySet()) {
list.add(entry.getKey());
//System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());
}
HashMap<String , Object> newMap = new HashMap<String , Object>();
HashMap<String, Object> newMap = new HashMap<String, Object>();
//运用Collections的sort()方法对其进行排序 sort()方法需要传 连个参数,一个是需要进行排序的Collection 另一个是一个Comparator
Collections.sort(list, new SpellComparatorUtils());
for (int i = 0; i < list.size(); i++) {
newMap.put(list.get(i).toString() , map.get(list.get(i).toString()));
newMap.put(list.get(i).toString(), map.get(list.get(i).toString()));
}
return newMap;
}
......@@ -118,11 +120,37 @@ public class MapUtil {
return sb.toString();
}
/**
* * 把数组元素按照按照字典倒序排序,并按照“参数=参数值”的模式用“&”字符拼接成字符串
* @param params 需要排序并参与字符拼接的参数组
* @return 拼接后字符串
*/
public static String stringInvertSort(Map<String, String> params) {
List<String> keys = new ArrayList<String>(params.keySet());
Collections.reverse(keys);
String prestr = "";
for (int i = 0; i < keys.size(); i++) {
String key = keys.get(i);
String value = params.get(key);
try {
value = URLEncoder.encode(value, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (i == keys.size() - 1) {//拼接时,不包括最后一个&字符
prestr = prestr + key + "=" + value;
} else {
prestr = prestr + key + "=" + value + "&";
}
}
return prestr;
}
/**
*   * 把数组所有元素排序,并按照“参数=参数值”的模式用“&”字符拼接成字符串
*   * @param params 需要排序并参与字符拼接的参数组
*   * @return 拼接后字符串
*   * @throws UnsupportedEncodingException
*   
*/
public static String createLinkStringByGet(Map<String, String> params) {
List<String> keys = new ArrayList<String>(params.keySet());
......@@ -144,7 +172,8 @@ public class MapUtil {
}
return prestr;
}
class SpellComparatorUtils implements Comparator {
class SpellComparatorUtils implements Comparator {
@Override
public int compare(Object o1, Object o2) {
try {
......@@ -161,9 +190,14 @@ class SpellComparatorUtils implements Comparator {
}
public static void main(String[] args) {
Map<String, String> map = new HashMap();
map.put("name", "hello");
map.put("value", "world");
System.out.println(createLinkStringByGet(map));
//Map<String, String> map = new HashMap();
//map.put("name", "hello");
//map.put("value", "world");
//System.out.println(createLinkStringByGet(map));
StringJoiner joiner = new StringJoiner(",","[","]");
joiner.add("123");
joiner.add("456");
joiner.add("789");
System.out.println(joiner);
}
}
......@@ -143,6 +143,11 @@ public class ApiInterface extends BaseObject implements Serializable {
*/
@TableField(exist = false)
private String responseParam;
/**
* 固定参数
*/
@TableField(exist = false)
private String inboxParam;
/**
* 响应状态码
*/
......@@ -152,7 +157,7 @@ public class ApiInterface extends BaseObject implements Serializable {
/*---------------------------------日志查询--------------------------------*/
/**
* 日志id
* */
**/
@TableField(exist = false)
private Long logId;
/**
......
......@@ -114,10 +114,10 @@ public class AuthServiceImpl implements AuthService {
query.eq("ai.api_name",req.getApiName());
}
if (StringUtils.isNotBlank(req.getOrgName())){
query.like("au.org_name",req.getOrgName());
query.like("ar.org_name",req.getOrgName());
}
query.eq("ai.is_deleted",0);
query.orderByDesc("au.create_time");
query.orderByDesc("au.create_date");
return Result.of_success(apiInterfaceMapper.listApiAuthService(page, query));
}
......
......@@ -28,6 +28,7 @@
</select>
<select id="selectDetail" resultType="com.jz.dm.models.domian.ApiInterface">
SELECT ai.*,
aic.inbox_param AS inboxParam,
aic.request_param AS requestParam,
aic.response_param AS responseParam,
aic.resp_code AS respCode
......@@ -70,11 +71,12 @@
aic.max_row AS maxRow,
aic.page_row AS pageRow,
au.auth_code AS authCode,
au.org_name AS orgName,
ar.org_name AS orgName,
au.create_date AS createDate
FROM t_api_interface AS ai
JOIN t_api_interface_custom AS aic ON ai.id =aic.api_interface_id AND aic.is_deleted =0
JOIN t_api_auth AS au ON au.api_interface_id = ai.id AND aic.is_deleted =0
JOIN t_api_org AS ar ON ar.id = au.api_org_id AND ar.is_deleted =0
${ew.customSqlSegment}
</select>
<select id="listApiDetail" resultType="com.jz.dm.models.dto.ApiServiceApplyDto">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment