|
|
@ -9,6 +9,7 @@ import com.epmet.datareport.constant.*; |
|
|
|
import com.epmet.datareport.service.backdoor.BackDoorService; |
|
|
|
import com.epmet.dto.result.AppIdInfoResultDTO; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -20,30 +21,31 @@ import java.util.Map; |
|
|
|
* @DateTime 2020/10/21 5:17 下午 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class BackDoorServiceImpl implements BackDoorService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object backDoor(String dataType, String appId, String target) { |
|
|
|
public Object backDoor(String dataType, String appId, String target, Object o) { |
|
|
|
Result<AppIdInfoResultDTO> appIdInfoResultDTOResult = commonServiceOpenFeignClient.appIdInfo(appId); |
|
|
|
if (!appIdInfoResultDTOResult.success()){ |
|
|
|
throw new RenException("获取accessToken失败......"); |
|
|
|
} |
|
|
|
AppIdInfoResultDTO data = appIdInfoResultDTOResult.getData(); |
|
|
|
String url = FactConstant.URL.concat(target); |
|
|
|
Map map = new HashMap(16); |
|
|
|
Map<String,String> headerMap = new HashMap<>(16); |
|
|
|
headerMap.put("AccessToken",data.getAccessToken()); |
|
|
|
headerMap.put("AppId",data.getAppId()); |
|
|
|
headerMap.put("AuthType","jwt"); |
|
|
|
headerMap.put("Data-Type",dataType); |
|
|
|
// headerMap.put("Authorization","eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJhcHAiOiJnb3YiLCJjbGllbnQiOiJ3eG1wIiwiZXhwIjoxNjAzODY2MjY2LCJ1c2VySWQiOiI0ZWYwYTA4YTBiNWVmOTM0ZjBiOGE4YzQ2ODJjMzY2NSIsImlhdCI6MTYwMzI2MTQ2Nn0.pW1Wzss-xtj6vUuJbvglUltdDWlUKqTyVQ6rGQ7WpSaE_Iz1uAd5XWI5OGLajyU4-aYCW14Dw3C-XoFepyiZJQ");
|
|
|
|
map.put("bizType","community"); |
|
|
|
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(map),headerMap); |
|
|
|
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(o),headerMap); |
|
|
|
log.info(JSON.toJSONString(stringResult),stringResult.error()); |
|
|
|
if (!stringResult.success()){ |
|
|
|
throw new RenException("请求【"+url+"】失败......"+stringResult.error()); |
|
|
|
} |
|
|
|
JSONObject jsonObject = JSON.parseObject(stringResult.getData()); |
|
|
|
System.out.println(jsonObject); |
|
|
|
return jsonObject; |
|
|
|
} |
|
|
|
} |
|
|
|