|
|
@@ -11,6 +11,8 @@ import com.uas.erp.schedular.web.ResultWrap;
|
|
|
import com.usoft.mq.utils.BaseRabbitReceiveService;
|
|
|
import com.usoft.mq.utils.MessageInfo;
|
|
|
import com.usoft.security.utils.OpenApiSignUtil;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
@@ -36,14 +38,14 @@ public class RabbitReceiveServiceImpl extends BaseRabbitReceiveService {
|
|
|
|
|
|
private final static String SECRETKEY = "600d3f07955ba67fe050007f01002db2";
|
|
|
private final static String BASEPATH = "https://finrest.usoftchina.com";
|
|
|
- private final static String UASURL = "http://218.18.115.198:8888/ERP";
|
|
|
+ private final static String UASURL = "http://10.1.1.188:8082/JK";
|
|
|
private final static String MASTERNAME = "YITOA_BL";
|
|
|
-
|
|
|
+ private Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
@PostConstruct
|
|
|
public void init() throws InterruptedException {
|
|
|
Master master = new Master();
|
|
|
- master.setMa_user("YITOA_DATACENTER");
|
|
|
- master.setMa_uu(10050002L);
|
|
|
+ master.setMa_user("YITOA_JK");
|
|
|
+ master.setMa_uu(10046590L);
|
|
|
master.setMa_accesssecret(SECRETKEY);
|
|
|
master.setMa_env("prod");
|
|
|
ContextHolder.setMaster(master);
|
|
|
@@ -66,6 +68,7 @@ public class RabbitReceiveServiceImpl extends BaseRabbitReceiveService {
|
|
|
|
|
|
@Override
|
|
|
public void processMessage(MessageInfo messageInfo) throws Exception {
|
|
|
+ logger.debug("应收宝申请处理:BizId{},BizType{}",messageInfo.getBizId(), messageInfo.getBizType());
|
|
|
switch (messageInfo.getAppId()){
|
|
|
case "1001": //应收宝
|
|
|
processMessageForReceivable(messageInfo.getBizId(), messageInfo.getBizType());
|
|
|
@@ -115,12 +118,13 @@ public class RabbitReceiveServiceImpl extends BaseRabbitReceiveService {
|
|
|
|
|
|
RestTemplate restTemp = new RestTemplate(new HttpsClientRequestFactory());
|
|
|
restTemp.setUriTemplateHandler(uriTemplateHandler);
|
|
|
+ logger.debug("应收宝申请处理: 数据请求");
|
|
|
String result = restTemp.getForObject(requestURL, String.class);
|
|
|
|
|
|
String UASurl = UASURL + uasURL;
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
map.put("data", result);
|
|
|
-
|
|
|
+ logger.debug("应收宝申请处理: 数据返回");
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
|
headers.add("referer", getSignature(codeName));
|
|
|
@@ -128,16 +132,17 @@ public class RabbitReceiveServiceImpl extends BaseRabbitReceiveService {
|
|
|
formData.setAll(map);
|
|
|
HttpEntity<MultiValueMap<String, Object>> request = new HttpEntity<>(formData, headers);
|
|
|
String returnStr = restTemplate.postForEntity(UASurl, request, String.class).getBody();
|
|
|
+ logger.debug("应收宝申请ERP处理: 数据返回{}", returnStr);
|
|
|
ResultWrap<String> wrap = JSON.parseObject(returnStr, new TypeReference<ResultWrap<String>>(){});
|
|
|
}
|
|
|
|
|
|
public String getSignature(String code) {
|
|
|
String url = "_timestamp=" + System.currentTimeMillis() + "&master=";
|
|
|
- if("code".equals(code)){
|
|
|
+ // if("code".equals(code)){
|
|
|
url += "YITOA_BL";
|
|
|
- }else{
|
|
|
+ /* }else{
|
|
|
url += "YITOA_DATACENTER";
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 签名
|
|
|
return url + "&_signature=" + HmacUtils.encode(url);
|
|
|
}
|