|
|
@@ -293,10 +293,68 @@ public class RequestSTKServiceImpl implements RequestSTKService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpResultResponse updateKSPostParam(Integer page, Integer size, SaveOrChangeCustomerDetailDto dto) throws Exception {
|
|
|
+ public SaveOrChangeCustomerDataVo updateKSPostParam(Integer page, Integer size, SaveOrChangeCustomerDetailDto dto) throws Exception {
|
|
|
+
|
|
|
//时间戳
|
|
|
String timestamp = Long.toString(System.currentTimeMillis());
|
|
|
|
|
|
+ //每一条数据在这里构造,根据实际情况修改
|
|
|
+ JSONObject request=new JSONObject(4);
|
|
|
+
|
|
|
+ Field[] fields = dto.getClass().getDeclaredFields();
|
|
|
+ for(Field field : fields){
|
|
|
+ String fieldName = field.getName();
|
|
|
+ if(getValueByFieldName(fieldName,dto)!=null)
|
|
|
+ request.put(fieldName, getValueByFieldName(fieldName,dto));
|
|
|
+ }
|
|
|
+ /*request.put("NAME","紫光展讯通信惠州有限公司");
|
|
|
+ request.put("S_CODE","2024-07-04 17:11:43");
|
|
|
+ request.put("UID_TYPE","01");
|
|
|
+ request.put("UID","91441300MA4WY7CN2T");
|
|
|
+ request.put("CUSTOMER_TYPE","C0201");
|
|
|
+ request.put("IS_VALID","1");
|
|
|
+ request.put("CREATED_ORG","HRORGI0000000001");
|
|
|
+ request.put("CREATED_SYSTEM","ZHONGTAI");
|
|
|
+ request.put("ISTEMPORARY","0");
|
|
|
+ request.put("MDM_CODE",null);
|
|
|
+ request.put("CREAT_AT","2024-07-04 17:11:43");
|
|
|
+ request.put("UPDATE_AT","2024-07-04 17:11:43");
|
|
|
+ request.put("SERIAL","23468156486151");*/
|
|
|
+
|
|
|
+
|
|
|
+ //param参数构造 并传入你构造的每一条数据参数,此处例:1条
|
|
|
+ JSONObject requestparam=new JSONObject(4);
|
|
|
+ requestparam.put("param",request);
|
|
|
+
|
|
|
+
|
|
|
+ String content = requestparam.toString();
|
|
|
+
|
|
|
+ //加签方法第一个参数
|
|
|
+ StringBuilder signBuilder = new StringBuilder("appid").append("=").append(STK_APP_ID).append("&")
|
|
|
+ .append(content).append("&")
|
|
|
+ .append("timestamp").append("=").append(timestamp).append("&")
|
|
|
+ .append("key").append("=").append(STK_APP_KEY);
|
|
|
+
|
|
|
+ //加签
|
|
|
+ String sign = STKSignUtil.HMACSHA256(signBuilder.toString(),STK_APP_KEY);
|
|
|
+
|
|
|
+ System.out.println("原始:"+signBuilder);
|
|
|
+ System.out.println("签名:"+sign);
|
|
|
+ System.out.println("content:"+content);
|
|
|
+
|
|
|
+ //请求数据(接口地址根据测试环境与正式环境变更)
|
|
|
+ String body = HttpRequest.post(SAVE_OR_UPDATE_URL+SAVE_OR_UPDATE_REQUEST_CODE)
|
|
|
+ .header("appid",STK_APP_ID) //请求头
|
|
|
+ .header("timestamp", timestamp)
|
|
|
+ .header("sign", sign)
|
|
|
+ .header("Content-Type", "application/json")
|
|
|
+ .body(content) //请求参数
|
|
|
+ .timeout(20000) //超时时间
|
|
|
+ .execute().body();
|
|
|
+
|
|
|
+ //时间戳
|
|
|
+ /* String timestamp = Long.toString(System.currentTimeMillis());
|
|
|
+
|
|
|
//加签方法的重要参数
|
|
|
JSONObject request=new JSONObject(4);
|
|
|
//传入参数 此处案例仅放置了时间,可自行添加
|
|
|
@@ -342,8 +400,8 @@ public class RequestSTKServiceImpl implements RequestSTKService {
|
|
|
HttpResultResponse resultResponse = HuToolUtils.post(SAVE_OR_UPDATE_URL+SAVE_OR_UPDATE_REQUEST_CODE
|
|
|
,request, header);
|
|
|
|
|
|
- log.info("示例返回:{}",JSONObject.toJSONString(resultResponse));
|
|
|
- return resultResponse ;
|
|
|
+ log.info("示例返回:{}",JSONObject.toJSONString(resultResponse));*/
|
|
|
+ return JSONObject.parseObject(body,SaveOrChangeCustomerDataVo.class);
|
|
|
}
|
|
|
|
|
|
/**
|