Browse Source

贸易平台修改

fengx 8 months ago
parent
commit
e4122c581e

+ 34 - 20
src/main/java/com/sunxung/factoring/service/tradingPlatform/Impl/PlatformServiceImpl.java

@@ -38,6 +38,9 @@ public class PlatformServiceImpl extends ServiceImpl<PlatformMapper,Platform> im
     @Autowired
     private RestTemplate restTemplate;
 
+    @Value("${sop.getFlushUrl}")
+    private String flushUrl;
+
     @Value("${sop.getEnterpriseInfoUrl}")
     private String enterpriseInfoUrl;
 
@@ -62,7 +65,6 @@ public class PlatformServiceImpl extends ServiceImpl<PlatformMapper,Platform> im
         platform.setFddCustomerId(data.get("fddCustomerId"));
         platform.setAutoSignUrl(data.get("autoSignUrl"));
         platform.setShortAutoSignUrl(data.get("shortAutoSignUrl"));
-        platform.setAutoSignStatus(false);
         platform.setShortAutoSignUrlCreate(new Date());
         Integer autoSignStatus = Integer.valueOf(data.get("autoSignStatus"));
         platform.setAutoSignStatus(autoSignStatus == 1?true:false);
@@ -139,27 +141,39 @@ public class PlatformServiceImpl extends ServiceImpl<PlatformMapper,Platform> im
     @Override
     public void flushUrl(Long id) {
         Platform platform = getById(id);
-        //删除中间服务的认证信息
-        ElectronicSignatureUtil.removeAuthInfo(platform.getSocialCreditCode());
-        //刷新认证信息
-        String authResult = ElectronicSignatureUtil.getAuthUrl("2",platform.getSocialCreditCode(),null);
-        JSONObject authJson = (JSONObject) JSONObject.parse(authResult);
-        String authUrl = authJson.getString("authUrl");
-        String customerId = authJson.getString("customerId");
-        String shortAuthUrl = ElectronicSignatureUtil.shortUrl(null, authUrl);
-        platform.setShortAuthUrl(shortAuthUrl);
-        platform.setShortAuthUrlCreate(new Date());
-        platform.setFddCustomerId(customerId);
-        platform.setAuthUrl(authUrl);
-        String transactionId = "platformFDD" + platform.getId()+"FDD"+ DateUtil.getCurrentDate().replace("-","").replace(" ","").replace(":","");
-        logger.error("transactionId:"+transactionId);
-        String beforeAutoSignUrl = ElectronicSignatureUtil.beforeAutoSign(transactionId,customerId,customerId);
-        String shortAutoSignUrl = ElectronicSignatureUtil.shortUrl(null, beforeAutoSignUrl);
-        platform.setShortAutoSignUrl(shortAutoSignUrl);
-        platform.setShortAutoSignUrlCreate(new Date());
-        platform.setAutoSignUrl(beforeAutoSignUrl);
+
+        ResponseJson forObject = restTemplate.getForObject(flushUrl+"?code="+platform.getSocialCreditCode(), ResponseJson.class);
+        Map<String,String> data = (Map) forObject.getData();
+        platform.setAuthUrl(data.get("authUrl"));
+        platform.setShortAuthUrl(data.get("shortAuthUrl"));
         platform.setAuthStatus(0);
+        platform.setFddCustomerId(data.get("fddCustomerId"));
+        //更新自动签链接
+        platform.setAutoSignUrl(data.get("autoSignUrl"));
+        platform.setShortAutoSignUrl(data.get("shortAutoSignUrl"));
         platform.setAutoSignStatus(false);
+
+//        //删除中间服务的认证信息
+//        ElectronicSignatureUtil.removeAuthInfo(platform.getSocialCreditCode());
+//        //刷新认证信息
+//        String authResult = ElectronicSignatureUtil.getAuthUrl("2",platform.getSocialCreditCode(),null);
+//        JSONObject authJson = (JSONObject) JSONObject.parse(authResult);
+//        String authUrl = authJson.getString("authUrl");
+//        String customerId = authJson.getString("customerId");
+//        String shortAuthUrl = ElectronicSignatureUtil.shortUrl(null, authUrl);
+//        platform.setShortAuthUrl(shortAuthUrl);
+//        platform.setShortAuthUrlCreate(new Date());
+//        platform.setFddCustomerId(customerId);
+//        platform.setAuthUrl(authUrl);
+//        String transactionId = "platformFDD" + platform.getId()+"FDD"+ DateUtil.getCurrentDate().replace("-","").replace(" ","").replace(":","");
+//        logger.error("transactionId:"+transactionId);
+//        String beforeAutoSignUrl = ElectronicSignatureUtil.beforeAutoSign(transactionId,customerId,customerId);
+//        String shortAutoSignUrl = ElectronicSignatureUtil.shortUrl(null, beforeAutoSignUrl);
+//        platform.setShortAutoSignUrl(shortAutoSignUrl);
+//        platform.setShortAutoSignUrlCreate(new Date());
+//        platform.setAutoSignUrl(beforeAutoSignUrl);
+//        platform.setAuthStatus(0);
+//        platform.setAutoSignStatus(false);
         updateById(platform);
     }