Commit 8c7c16d3 authored by huyuchen's avatar huyuchen

Merge remote-tracking branch 'origin/MVP1.7.5' into MVP1.7.5

parents e5835abe d379ab47
...@@ -124,11 +124,11 @@ public class WxConfig { ...@@ -124,11 +124,11 @@ public class WxConfig {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8); headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Gson gson = new Gson(); Gson gson = new Gson();
log.info(gson.toJson(requestMap)); log.info("发企业微信===请求:{}", gson.toJson(requestMap));
HttpEntity<String> requestEntity = new HttpEntity<>(gson.toJson(requestMap), headers); HttpEntity<String> requestEntity = new HttpEntity<>(gson.toJson(requestMap), headers);
String accessToken = getAccessToken(restTemplate); String accessToken = getAccessToken(restTemplate);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(SecurityConstants.WX_SEND_MESSAGE, accessToken), requestEntity, String.class); ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(SecurityConstants.WX_SEND_MESSAGE, accessToken), requestEntity, String.class);
log.info(JSON.toJSONString(responseEntity)); log.info("发企业微信===返回:{}",JSON.toJSONString(responseEntity));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(responseEntity)); JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(responseEntity));
JSONObject jsonBody = jsonObject.getJSONObject("body"); JSONObject jsonBody = jsonObject.getJSONObject("body");
if (jsonBody != null) { if (jsonBody != null) {
...@@ -147,41 +147,6 @@ public class WxConfig { ...@@ -147,41 +147,6 @@ public class WxConfig {
return true; return true;
} }
/**
* @param restTemplate
* @param requestMap 请求内容
* @Author: huyc
* @Date: 2023/7/28 14:50
* @Description: 发送卡片消息
* @return: java.lang.String
**/
public boolean sendAppTextCard(RestTemplate restTemplate, Map<String, Object> requestMap) {
// 必须加上header说明
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Gson gson = new Gson();
log.info("发企业微信===请求:{}", gson.toJson(requestMap));
HttpEntity<String> requestEntity = new HttpEntity<>(gson.toJson(requestMap), headers);
String accessToken = getAppAccessToken(restTemplate);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(SecurityConstants.WX_SEND_MESSAGE, accessToken), requestEntity, String.class);
log.info("发企业微信===返回:{}",JSON.toJSONString(responseEntity));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(responseEntity));
JSONObject jsonBody = jsonObject.getJSONObject("body");
if (jsonBody != null) {
String errcode = jsonBody.getString("errcode");
if (accossTokenInvliad.equals(errcode)) {
//删除accossToken缓存
removeAccessToken();
return false;
}
if (!CommonConstants.ZERO_STRING.equals(errcode)) { //非正常,则打印错误日志
log.info(jsonObject.toJSONString());
}
} else {
log.info(jsonObject.toJSONString());
}
return true;
}
/** /**
* 功能描述: 获取微信accos_token * 功能描述: 获取微信accos_token
* @Author: huyc * @Author: huyc
......
...@@ -210,7 +210,7 @@ public class TInsuranceUnpurchaseApplyAuditProcess extends AbastractAuditProcess ...@@ -210,7 +210,7 @@ public class TInsuranceUnpurchaseApplyAuditProcess extends AbastractAuditProcess
Map<String, Object> textcard = new HashMap<>(); Map<String, Object> textcard = new HashMap<>();
authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getAuthUrl(), "01"+insuranceUnpurchaseApply.getId()); authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), "https://test-wx.worfu.com/auth/oauth/wxLogin", "01"+insuranceUnpurchaseApply.getId());
textcard.put("title", "含风险项目不购买商险申请"); textcard.put("title", "含风险项目不购买商险申请");
textcard.put("url", authUrl); textcard.put("url", authUrl);
......
...@@ -30,5 +30,5 @@ spring: ...@@ -30,5 +30,5 @@ spring:
wx: wx:
corpid: wwbcb090af0dfe50e5 corpid: wwbcb090af0dfe50e5
corpsecret: 16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU corpsecret: 16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid: 1000010 agentid: 1000009
authUrl: https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin authUrl: https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
</springProfile> </springProfile>
<springProfile name="test"> <springProfile name="test">
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 --> <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="error"> <root level="debug">
<appender-ref ref="console"/> <appender-ref ref="console"/>
<appender-ref ref="debug"/> <appender-ref ref="debug"/>
<appender-ref ref="error"/> <appender-ref ref="error"/>
......
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