|
@@ -63,41 +63,50 @@ public class SysCustomerServiceImpl extends ServiceImpl<SysCustomerMapper, SysCu
|
|
|
|
|
|
if (customer == null) {
|
|
|
if (sysCustomer.getAccountType().equals("1")) {
|
|
|
- String openId = getOpenId(sysCustomer);
|
|
|
- //法大大认证
|
|
|
- //添加身份信息
|
|
|
- String customerId = ElectronicSignatureUtil.registerAccount(openId, sysCustomer.getAccountType());
|
|
|
- String authResult = ElectronicSignatureUtil.getAuthUrl(sysCustomer.getAccountType(), customerId, null);
|
|
|
- JSONObject authJson = (JSONObject) JSONObject.parse(authResult);
|
|
|
- String authUrl = authJson.getString("authUrl");
|
|
|
- if (authUrl == null || customerId == null) {
|
|
|
- throw new ValidatorException(CodeUtil.FAIL, "生成认证链接出错");
|
|
|
- }
|
|
|
- String shortUrl = ElectronicSignatureUtil.shortUrl(null, authUrl);
|
|
|
- sysCustomer.setShortAuthUrl(shortUrl);
|
|
|
- sysCustomer.setShortAuthUrlCreate(new Date());
|
|
|
- sysCustomer.setFddCustomerId(customerId);
|
|
|
- sysCustomer.setAuthStatus(false);
|
|
|
- sysCustomer.setAuthUrl(authUrl);
|
|
|
- //开启自动签署
|
|
|
- String transactionId = UUID.randomUUID().toString().trim().replaceAll("-", "").toUpperCase();
|
|
|
- String beforeAutoSignUrl = ElectronicSignatureUtil.beforeAutoSign(transactionId, customerId, customerId);
|
|
|
- String shortAutoSignUrl = ElectronicSignatureUtil.shortUrl(null, beforeAutoSignUrl);
|
|
|
- sysCustomer.setShortAutoSignUrl(shortAutoSignUrl);
|
|
|
- sysCustomer.setShortAutoSignUrlCreate(new Date());
|
|
|
- sysCustomer.setTransactionId(transactionId);
|
|
|
- sysCustomer.setAutoSignStatus(0);
|
|
|
- sysCustomer.setAutoSignUrl(beforeAutoSignUrl);
|
|
|
-
|
|
|
//更新电子签个人
|
|
|
ElectronicSignaturePersonal electronicSignaturePersonal = sysCustomer.getElectronicSignaturePersonal();
|
|
|
- electronicSignaturePersonal.setFddCustomerId(customerId);
|
|
|
- electronicSignaturePersonal.setOpenId(openId);
|
|
|
- electronicSignaturePersonal.setAuthUrl(authUrl);
|
|
|
- electronicSignaturePersonal.setShortAuthUrl(shortUrl);
|
|
|
- electronicSignaturePersonal.setShortAuthUrlCreat(new Date());
|
|
|
- electronicSignaturePersonal.setAuthStatus(0);
|
|
|
- electronicSignaturePersonalService.save(electronicSignaturePersonal);
|
|
|
+ if(electronicSignaturePersonal.getId() == null){
|
|
|
+ String openId = getOpenId(sysCustomer);
|
|
|
+ //法大大认证
|
|
|
+ //添加身份信息
|
|
|
+ String customerId = ElectronicSignatureUtil.registerAccount(openId, sysCustomer.getAccountType());
|
|
|
+ String authResult = ElectronicSignatureUtil.getAuthUrl(sysCustomer.getAccountType(), customerId, null);
|
|
|
+ JSONObject authJson = (JSONObject) JSONObject.parse(authResult);
|
|
|
+ String authUrl = authJson.getString("authUrl");
|
|
|
+ if (authUrl == null || customerId == null) {
|
|
|
+ throw new ValidatorException(CodeUtil.FAIL, "生成认证链接出错");
|
|
|
+ }
|
|
|
+ String shortUrl = ElectronicSignatureUtil.shortUrl(null, authUrl);
|
|
|
+ sysCustomer.setShortAuthUrl(shortUrl);
|
|
|
+ sysCustomer.setShortAuthUrlCreate(new Date());
|
|
|
+ sysCustomer.setFddCustomerId(customerId);
|
|
|
+ sysCustomer.setAuthStatus(false);
|
|
|
+ sysCustomer.setAuthUrl(authUrl);
|
|
|
+ //开启自动签署
|
|
|
+ String transactionId = UUID.randomUUID().toString().trim().replaceAll("-", "").toUpperCase();
|
|
|
+ String beforeAutoSignUrl = ElectronicSignatureUtil.beforeAutoSign(transactionId, customerId, customerId);
|
|
|
+ String shortAutoSignUrl = ElectronicSignatureUtil.shortUrl(null, beforeAutoSignUrl);
|
|
|
+ sysCustomer.setShortAutoSignUrl(shortAutoSignUrl);
|
|
|
+ sysCustomer.setShortAutoSignUrlCreate(new Date());
|
|
|
+ sysCustomer.setTransactionId(transactionId);
|
|
|
+ sysCustomer.setAutoSignStatus(0);
|
|
|
+ sysCustomer.setAutoSignUrl(beforeAutoSignUrl);
|
|
|
+
|
|
|
+ electronicSignaturePersonal.setFddCustomerId(customerId);
|
|
|
+ electronicSignaturePersonal.setOpenId(openId);
|
|
|
+ electronicSignaturePersonal.setAuthUrl(authUrl);
|
|
|
+ electronicSignaturePersonal.setShortAuthUrl(shortUrl);
|
|
|
+ electronicSignaturePersonal.setShortAuthUrlCreat(new Date());
|
|
|
+ electronicSignaturePersonal.setAuthStatus(0);
|
|
|
+ electronicSignaturePersonalService.save(electronicSignaturePersonal);
|
|
|
+ }else {
|
|
|
+ sysCustomer.setShortAuthUrl(electronicSignaturePersonal.getShortAuthUrl());
|
|
|
+ sysCustomer.setShortAuthUrlCreate(new Date());
|
|
|
+ sysCustomer.setFddCustomerId(electronicSignaturePersonal.getFddCustomerId());
|
|
|
+ sysCustomer.setAuthStatus(false);
|
|
|
+ sysCustomer.setAuthUrl(electronicSignaturePersonal.getAuthUrl());
|
|
|
+ sysCustomer.setAutoSignStatus(electronicSignaturePersonal.getAuthStatus());
|
|
|
+ }
|
|
|
|
|
|
sysCustomer.setEntBusinessId(electronicSignaturePersonal.getId());
|
|
|
|