| | |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.constant.WechatConstant; |
| | | import com.java110.utils.factory.ApplicationContextFactory; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.PayUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.apache.commons.codec.binary.Hex; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | |
| | | |
| | | JSONObject paramMap = new JSONObject(); |
| | | paramMap.put("appId", appId); |
| | | paramMap.put("timestamp", PayUtil.getCurrentTimeStamp()); |
| | | paramMap.put("timestamp", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_DEFAULT)); |
| | | paramMap.put("nonce", PayUtil.makeUUID(32)); |
| | | paramMap.put("signMethod", "SHA256"); |
| | | paramMap.put("signature", getSignature(paramMap, appSecure)); |
| | |
| | | RestTemplate outRestTemplate = ApplicationContextFactory.getBean("outRestTemplate", RestTemplate.class); |
| | | logger.debug("获取access_token 入参:" + url + " 请求参数" + paramMap.toJSONString()); |
| | | |
| | | ResponseEntity<String> response = outRestTemplate.postForEntity(url, paramMap.toJSONString(), String.class); |
| | | //ResponseEntity<String> response = outRestTemplate.postForEntity(url, paramMap.toJSONString(), String.class); |
| | | |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.add("Content-Type", "application/json"); |
| | | HttpEntity httpEntity = new HttpEntity(paramMap.toJSONString(), headers); |
| | | ResponseEntity<String> response = outRestTemplate.exchange( |
| | | url, HttpMethod.POST, httpEntity, String.class); |
| | | |
| | | logger.debug("获取access_token 入参:" + url + " 返回参数" + response); |
| | | |