|
@@ -14,15 +14,19 @@ import com.sunxung.factoring.entity.tradingPlatform.Platform;
|
|
|
import com.sunxung.factoring.entity.vo.ConditionVo;
|
|
|
import com.sunxung.factoring.mapper.tradingPlatform.PlatformMapper;
|
|
|
import com.sunxung.factoring.service.businessmanagement.BusinessBasicInfoService;
|
|
|
+import com.sunxung.factoring.service.sys.UserService;
|
|
|
import com.sunxung.factoring.service.tradingPlatform.PlatformService;
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author liutao yaFan
|
|
@@ -31,6 +35,12 @@ import java.util.List;
|
|
|
public class PlatformServiceImpl extends ServiceImpl<PlatformMapper,Platform> implements PlatformService {
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RestTemplate restTemplate;
|
|
|
+
|
|
|
+ @Value("${sop.getEnterpriseInfoUrl}")
|
|
|
+ private String enterpriseInfoUrl;
|
|
|
+
|
|
|
private static Logger logger = LogManager.getLogger(PlatformServiceImpl.class);
|
|
|
|
|
|
@Override
|
|
@@ -41,27 +51,44 @@ public class PlatformServiceImpl extends ServiceImpl<PlatformMapper,Platform> im
|
|
|
if(!list.isEmpty()){
|
|
|
return new ResponseJson("500","企业已添加,勿重复操作");
|
|
|
}
|
|
|
+
|
|
|
+ ResponseJson forObject = restTemplate.getForObject(enterpriseInfoUrl+"?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);
|
|
|
+ platform.setShortAutoSignUrlCreate(new Date());
|
|
|
+ Integer autoSignStatus = Integer.valueOf(data.get("autoSignStatus"));
|
|
|
+ platform.setAutoSignStatus(autoSignStatus == 1?true:false);
|
|
|
+ save(platform);
|
|
|
+
|
|
|
//电子签章获取认证地址
|
|
|
// String customerId = ElectronicSignatureUtil.registerAccount(platform.getSocialCreditCode(), "2");
|
|
|
- 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);
|
|
|
- save(platform);
|
|
|
- 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);
|
|
|
- updateById(platform);
|
|
|
+// 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);
|
|
|
+// save(platform);
|
|
|
+// 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);
|
|
|
+// updateById(platform);
|
|
|
return new ResponseJson("新增成功");
|
|
|
}
|
|
|
|