|  | @@ -14,6 +14,7 @@ import com.kmall.admin.cuspay.common.core.db.IdWorkerAide;
 | 
	
		
			
				|  |  |  import com.kmall.admin.cuspay.entity.merch.MerchNoti;
 | 
	
		
			
				|  |  |  import com.kmall.admin.cuspay.entity.merch.MerchPayCfg;
 | 
	
		
			
				|  |  |  import com.kmall.admin.cuspay.service.MerchNotiService;
 | 
	
		
			
				|  |  | +import com.kmall.admin.cuspay.support.sign.RSA;
 | 
	
		
			
				|  |  |  import com.kmall.admin.cuspay.util.OkHttpUtils;
 | 
	
		
			
				|  |  |  import com.kmall.admin.cuspay.util.ReaderXmlForDOM4J;
 | 
	
		
			
				|  |  |  import com.kmall.admin.cuspay.util.XmlUtils;
 | 
	
	
		
			
				|  | @@ -41,6 +42,7 @@ import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  |  import org.springframework.context.annotation.PropertySource;
 | 
	
		
			
				|  |  | +import org.springframework.core.env.Environment;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Component;
 | 
	
		
			
				|  |  |  import com.kmall.admin.cuspay.biz.ali.support.sign.MD5;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -61,14 +63,14 @@ import java.util.*;
 | 
	
		
			
				|  |  |  public class AliCusDeclareQueryBiz extends AbstractCusDeclareBiz implements CuspayBiz {
 | 
	
		
			
				|  |  |      private static final Logger logger = LoggerFactory.getLogger(AliCusDeclareQueryBiz.class);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -//    @Value("${db.ali.declare.limit}")
 | 
	
		
			
				|  |  | -    private Integer limit = 20;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private Environment environment;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private Integer limit;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -//    @Value("${db.ali.declare.count}")
 | 
	
		
			
				|  |  | -    private Integer count = 2;
 | 
	
		
			
				|  |  | +    private Integer count;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -//    @Value("${ali.payment.query.url}")
 | 
	
		
			
				|  |  | -    private String queryURL = "https://mapi.alipay.com/gateway.do?";
 | 
	
		
			
				|  |  | +    private String queryURL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private AliCbPayDocService aliCbPayDocService;
 | 
	
	
		
			
				|  | @@ -82,11 +84,12 @@ public class AliCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cusp
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 微信订单信息查询
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  |      public void biz(Map<String, Object> params) {
 | 
	
		
			
				|  |  | -        // -------- TODO ALL ----
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        limit = (limit != null && limit > 0) ? limit : 20;
 | 
	
		
			
				|  |  | -        count = (count != null && count > 0) ? count : 10;
 | 
	
		
			
				|  |  | +        limit = Integer.parseInt(environment.getProperty("db.ali.declare.limit"));
 | 
	
		
			
				|  |  | +        count = Integer.parseInt(environment.getProperty("db.ali.declare.count"));
 | 
	
		
			
				|  |  | +        queryURL = environment.getProperty("ali.payment.query.url");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //查出等待处理、业务处理中的支付单证信息
 | 
	
		
			
				|  |  |          List<AliCbPayDoc> aliCbPayDocs = null;
 | 
	
	
		
			
				|  | @@ -232,7 +235,7 @@ public class AliCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cusp
 | 
	
		
			
				|  |  |                              aliCbPayDoc.setDocStatus(AliDict.PaymentDocStatus.i_03.getItem());
 | 
	
		
			
				|  |  |                              this.aliCbPayDocService.updateAliCbPay(aliCbPayDoc);
 | 
	
		
			
				|  |  |                              merchNoti = builder.code(AliDict.ResponseMsgState.FAIL.getItem()).msg("未查询到报关请求号").cusDeclStatus(AliDict.MerchNoticeStatus.i_13.getItem()).certCheckResult(MerchNoticeDict.BuyerPayerCheckStatus.i_0.getItem()).build();
 | 
	
		
			
				|  |  | -                                                                                                  MerchNoti noti = new MerchNoti();
 | 
	
		
			
				|  |  | +                            MerchNoti noti = new MerchNoti();
 | 
	
		
			
				|  |  |                              noti.setNotiSn(builder.build().getNotiSn());
 | 
	
		
			
				|  |  |                              merchNoti.setNotiSn(builder.build().getNotiSn());
 | 
	
		
			
				|  |  |                              noti.setCode(aliCbPayDoc.getDetailErrorCode());
 | 
	
	
		
			
				|  | @@ -308,7 +311,10 @@ public class AliCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cusp
 | 
	
		
			
				|  |  |       * @param key2 Api密钥
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    protected static String assemblyDeclareQueryXml(AliCbPayDoc aliCbPayDoc, String key2) {
 | 
	
		
			
				|  |  | +    protected String assemblyDeclareQueryXml(AliCbPayDoc aliCbPayDoc, String key2) {
 | 
	
		
			
				|  |  | +        String MD5Key = environment.getProperty("ali.payment.md5.key");
 | 
	
		
			
				|  |  | +        String RSAPrivateKey = environment.getProperty("ali.payment.rsa.private-key");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          Map<String, String> paramMap = new HashMap<>();
 | 
	
		
			
				|  |  |          paramMap.put("_input_charset", "UTF-8");
 | 
	
		
			
				|  |  |          paramMap.put("out_request_nos", aliCbPayDoc.getOutRequestNo());
 | 
	
	
		
			
				|  | @@ -326,8 +332,14 @@ public class AliCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cusp
 | 
	
		
			
				|  |  |                  prestr = prestr + key + "=" + value + "&";
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        String sign = MD5.sign(prestr, "6zo20oar6qufb6x41ipli3yma9ju107h", "UTF-8");
 | 
	
		
			
				|  |  | +        // MD5加密
 | 
	
		
			
				|  |  | +        String sign = MD5.sign(prestr, MD5Key, "UTF-8");
 | 
	
		
			
				|  |  |          prestr = prestr + "&sign_type=MD5";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // RSA加密
 | 
	
		
			
				|  |  | +        // String sign = RSA.sign(prestr, RSAPrivateKey, "UTF-8");
 | 
	
		
			
				|  |  | +        // prestr = prestr + "&sign_type=RSA";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          prestr = prestr + "&sign=" + sign;
 | 
	
		
			
				|  |  |          prestr = "?" + prestr;
 | 
	
		
			
				|  |  |          return prestr;
 |