|
@@ -8,8 +8,11 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
+import com.gree.mall.manager.bean.CommonParam;
|
|
|
|
+import com.gree.mall.manager.bean.OutAppDefaultReq;
|
|
import com.gree.mall.manager.constant.Constant;
|
|
import com.gree.mall.manager.constant.Constant;
|
|
import com.gree.mall.manager.exception.RemoteServiceException;
|
|
import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
|
+import com.gree.mall.manager.helper.GreeResponseHelper;
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
import com.gree.mall.manager.utils.RedisUtil;
|
|
import com.gree.mall.manager.utils.RedisUtil;
|
|
import com.gree.mall.manager.utils.http.HttpUtils;
|
|
import com.gree.mall.manager.utils.http.HttpUtils;
|
|
@@ -32,8 +35,9 @@ import java.util.*;
|
|
|
|
|
|
*/
|
|
*/
|
|
/**
|
|
/**
|
|
- * 格力总部接口
|
|
|
|
- *//*
|
|
|
|
|
|
+ * 格力总部接口*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
@@ -93,12 +97,13 @@ public class GreeLogic {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
* 获取总部接口的请求token
|
|
* 获取总部接口的请求token
|
|
* @return
|
|
* @return
|
|
- * @throws RemoteServiceException
|
|
|
|
- *//*
|
|
|
|
|
|
+ * @throws RemoteServiceException*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
public String getAccessToken() throws RemoteServiceException {
|
|
public String getAccessToken() throws RemoteServiceException {
|
|
String redisKey = Constant.RedisPrefix.TOKEN_GREE;
|
|
String redisKey = Constant.RedisPrefix.TOKEN_GREE;
|
|
@@ -122,12 +127,13 @@ public class GreeLogic {
|
|
return accessToken;
|
|
return accessToken;
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
* 获取总部接口的请求token
|
|
* 获取总部接口的请求token
|
|
* @return
|
|
* @return
|
|
- * @throws RemoteServiceException
|
|
|
|
- *//*
|
|
|
|
|
|
+ * @throws RemoteServiceException*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
public String getAccessTokenV3() throws RemoteServiceException {
|
|
public String getAccessTokenV3() throws RemoteServiceException {
|
|
String redisKey = Constant.RedisPrefix.TOKEN_GREE_V3;
|
|
String redisKey = Constant.RedisPrefix.TOKEN_GREE_V3;
|
|
@@ -152,36 +158,12 @@ public class GreeLogic {
|
|
return accessToken;
|
|
return accessToken;
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
-/**
|
|
|
|
- * 获取机型名称
|
|
|
|
- * @param objCode 内积条码 或者 外机条码
|
|
|
|
- * @param mainNumber 大类id
|
|
|
|
- * @return
|
|
|
|
- * @throws RemoteServiceException
|
|
|
|
- *//*
|
|
|
|
|
|
|
|
-*/
|
|
|
|
-/*
|
|
|
|
- public CheckBarcodeBean getProductName(String objCode,Integer mainNumber){
|
|
|
|
- try {
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- map.put("clientid", clientId);
|
|
|
|
- map.put("barcode", objCode);
|
|
|
|
- map.put("spid", mainNumber);
|
|
|
|
- JSONObject jsonObject = this.post(checkBarcodeUrl, map);
|
|
|
|
- CheckBarcodeBean data = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("data")), CheckBarcodeBean.class);
|
|
|
|
- return data;
|
|
|
|
- }catch(Exception e){
|
|
|
|
- log.error("获取总部机型失败:"+e.getMessage());
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-*//*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
* 获取销司结算标准
|
|
* 获取销司结算标准
|
|
* @param jxbh 机型编号,条码前五位
|
|
* @param jxbh 机型编号,条码前五位
|
|
@@ -191,6 +173,7 @@ public class GreeLogic {
|
|
* @param spid 大类
|
|
* @param spid 大类
|
|
*//*
|
|
*//*
|
|
|
|
|
|
|
|
+
|
|
public String getRepairSettle(String jxbh,String wxxmh,String gmrg,String wxlx,String spid){
|
|
public String getRepairSettle(String jxbh,String wxxmh,String gmrg,String wxlx,String spid){
|
|
try {
|
|
try {
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -211,12 +194,13 @@ public class GreeLogic {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- */
|
|
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
* 批量转结算
|
|
* 批量转结算
|
|
* @param ids 多个逗号隔开
|
|
* @param ids 多个逗号隔开
|
|
*//*
|
|
*//*
|
|
|
|
|
|
|
|
+
|
|
public String doRepairSettle(String ids){
|
|
public String doRepairSettle(String ids){
|
|
try {
|
|
try {
|
|
|
|
|
|
@@ -232,14 +216,14 @@ public class GreeLogic {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
* 请求总部接口
|
|
* 请求总部接口
|
|
- * @return
|
|
|
|
- *//*
|
|
|
|
|
|
+ * @return*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
- */
|
|
|
|
-/* public String post(String apiPath,Map<String,Object> bizContent,Integer belongType) throws Exception {
|
|
|
|
|
|
+ public String post(String apiPath,Map<String,Object> bizContent,Integer belongType) throws Exception {
|
|
CommonParam commonParam = new CommonParam();
|
|
CommonParam commonParam = new CommonParam();
|
|
commonParam.setAppId(this.getAppId(belongType));
|
|
commonParam.setAppId(this.getAppId(belongType));
|
|
commonParam.setAppKey(this.getAppKey(belongType));
|
|
commonParam.setAppKey(this.getAppKey(belongType));
|
|
@@ -259,7 +243,7 @@ public class GreeLogic {
|
|
}
|
|
}
|
|
return (String)greeResponseHelper.getData();
|
|
return (String)greeResponseHelper.getData();
|
|
}
|
|
}
|
|
- *//*
|
|
|
|
|
|
+
|
|
|
|
|
|
public JSONObject post(String url,List param){
|
|
public JSONObject post(String url,List param){
|
|
Map<String, String> header = new HashMap<>();
|
|
Map<String, String> header = new HashMap<>();
|
|
@@ -277,13 +261,14 @@ public class GreeLogic {
|
|
return jsonObject;
|
|
return jsonObject;
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
* post请求,用3.0的token
|
|
* post请求,用3.0的token
|
|
* @param url
|
|
* @param url
|
|
* @param param
|
|
* @param param
|
|
- * @return
|
|
|
|
- *//*
|
|
|
|
|
|
+ * @return*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
public JSONObject postV3(String url,List param){
|
|
public JSONObject postV3(String url,List param){
|
|
Map<String, String> header = new HashMap<>();
|
|
Map<String, String> header = new HashMap<>();
|
|
@@ -321,7 +306,7 @@ public class GreeLogic {
|
|
header.put("authorization", "Bearer " + this.getAccessToken());
|
|
header.put("authorization", "Bearer " + this.getAccessToken());
|
|
log.info("【总部接口对接】request:{}",JSONObject.toJSONString(map));
|
|
log.info("【总部接口对接】request:{}",JSONObject.toJSONString(map));
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
- String s = com.gree.settlement.api.utils.HttpUtils.requestPostBodyIO(url, JSONObject.toJSONString(map), header);
|
|
|
|
|
|
+ String s = HttpUtils.requestPostBodyIO(url, JSONObject.toJSONString(map), header);
|
|
log.info("【总部接口对接】response:{}",s);
|
|
log.info("【总部接口对接】response:{}",s);
|
|
jsonObject = JSONObject.parseObject(s);
|
|
jsonObject = JSONObject.parseObject(s);
|
|
|
|
|
|
@@ -340,7 +325,7 @@ public class GreeLogic {
|
|
header.put("authorization", "Bearer " + this.getAccessTokenV3());
|
|
header.put("authorization", "Bearer " + this.getAccessTokenV3());
|
|
log.info("【总部接口对接】request:{}",JSONObject.toJSONString(map));
|
|
log.info("【总部接口对接】request:{}",JSONObject.toJSONString(map));
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
- String s = com.gree.settlement.api.utils.HttpUtils.requestPostBodyIO(url, JSONObject.toJSONString(map), header);
|
|
|
|
|
|
+ String s = HttpUtils.requestPostBodyIO(url, JSONObject.toJSONString(map), header);
|
|
log.info("【总部接口对接】response:{}",s);
|
|
log.info("【总部接口对接】response:{}",s);
|
|
jsonObject = JSONObject.parseObject(s);
|
|
jsonObject = JSONObject.parseObject(s);
|
|
|
|
|
|
@@ -359,7 +344,7 @@ public class GreeLogic {
|
|
header.put("authorization", "Bearer " + this.getAccessTokenV3());
|
|
header.put("authorization", "Bearer " + this.getAccessTokenV3());
|
|
log.info("【总部接口对接】request:{}",JSONObject.toJSONString(map));
|
|
log.info("【总部接口对接】request:{}",JSONObject.toJSONString(map));
|
|
// String s = HttpUtils.requestPostBody(url, JSONObject.toJSONString(map), header);
|
|
// String s = HttpUtils.requestPostBody(url, JSONObject.toJSONString(map), header);
|
|
- String s = com.gree.settlement.api.utils.HttpUtils.requestGet(apiPath+url, map, header);
|
|
|
|
|
|
+ String s = HttpUtils.requestGet(apiPath+url, map, header);
|
|
log.info("【总部接口对接】response:{}",s);
|
|
log.info("【总部接口对接】response:{}",s);
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
@@ -401,12 +386,13 @@ public class GreeLogic {
|
|
return jsonObject;
|
|
return jsonObject;
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
* 同步总部机型名称和单价
|
|
* 同步总部机型名称和单价
|
|
* @param outCode
|
|
* @param outCode
|
|
- * @param mainNumber
|
|
|
|
- *//*
|
|
|
|
|
|
+ * @param mainNumber*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
public void syncProduct(String insideCode,String outCode,String mainNumber,Rule rule){
|
|
public void syncProduct(String insideCode,String outCode,String mainNumber,Rule rule){
|
|
try {
|
|
try {
|
|
@@ -500,10 +486,11 @@ public class GreeLogic {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- */
|
|
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
- * 初始化机型名称
|
|
|
|
- *//*
|
|
|
|
|
|
+ * 初始化机型名称*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
public void init(){
|
|
public void init(){
|
|
List<ProductNew> list = productNewService.list();
|
|
List<ProductNew> list = productNewService.list();
|
|
@@ -523,11 +510,12 @@ public class GreeLogic {
|
|
productNewService.updateBatchById(list);
|
|
productNewService.updateBatchById(list);
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
* 请求总部接口
|
|
* 请求总部接口
|
|
- * @return
|
|
|
|
- *//*
|
|
|
|
|
|
+ * @return*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
public GreeResponseHelper greePost(String apiPath,Map<String,Object> bizContent,Integer belongType) throws Exception {
|
|
public GreeResponseHelper greePost(String apiPath,Map<String,Object> bizContent,Integer belongType) throws Exception {
|
|
CommonParam commonParam = new CommonParam();
|
|
CommonParam commonParam = new CommonParam();
|
|
@@ -573,11 +561,12 @@ public class GreeLogic {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
|
|
+*/
|
|
/**
|
|
/**
|
|
* 请求总部接口
|
|
* 请求总部接口
|
|
- * @return
|
|
|
|
- *//*
|
|
|
|
|
|
+ * @return*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
public GreeResponseHelper greePostDecryptFeed(String apiPath, DecryptFeedbackBean bean) throws Exception {
|
|
public GreeResponseHelper greePostDecryptFeed(String apiPath, DecryptFeedbackBean bean) throws Exception {
|
|
Map<String,String> header = new HashMap<>();
|
|
Map<String,String> header = new HashMap<>();
|