|
@@ -191,25 +191,47 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
* 校验企业营业信息,不存在则添加一个
|
|
|
*/
|
|
|
@Override
|
|
|
- public void addTsign(Integer userId, String organCode, String orgName, Integer tenantId) {
|
|
|
- Optional.ofNullable(organCode).orElseThrow(() -> new BizException("营业执照编号不能为空!"));
|
|
|
- Optional.ofNullable(orgName).orElseThrow(() -> new BizException("营业名称不能为空"));
|
|
|
+ public void addTsign(Integer userId, String organCode, String orgName, Integer tenantId) {
|
|
|
+ Optional.ofNullable(organCode).orElseThrow(() -> new BizException("营业执照编号不能为空!"));
|
|
|
+ Optional.ofNullable(orgName).orElseThrow(() -> new BizException("营业名称不能为空"));
|
|
|
|
|
|
- String accountId = eSealPlugin.createOrganAccount(orgName, organCode);
|
|
|
- if (StringUtils.isBlank(accountId)) {
|
|
|
- throw new BizException("创建企业电子存证账户失败");
|
|
|
- }
|
|
|
+ SysUserTsign sysUserTsign = null;
|
|
|
|
|
|
- String sealData = eSealPlugin.createOrganSeal(accountId, "", "");
|
|
|
- if (StringUtils.isBlank(sealData)) {
|
|
|
- throw new BizException("创建电子存证印章失败");
|
|
|
- }
|
|
|
+ SysUserTsign orignSysUserTsign = sysUserTsignService.get(-userId);
|
|
|
|
|
|
- SysUserTsign sysUserTsign = new SysUserTsign(-userId, accountId, sealData, orgName, organCode, tenantId);
|
|
|
- sysUserTsignService.insert(sysUserTsign);
|
|
|
- }
|
|
|
+ if (orignSysUserTsign == null || !StringUtils.equals(orignSysUserTsign.getCardNo(), organCode)) {
|
|
|
|
|
|
- @Override
|
|
|
+ String accountId = eSealPlugin.createOrganAccount(orgName, organCode);
|
|
|
+ if (StringUtils.isBlank(accountId)) {
|
|
|
+ throw new BizException("创建企业电子存证账户失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ String sealData = eSealPlugin.createOrganSeal(accountId, "", "");
|
|
|
+ if (StringUtils.isBlank(sealData)) {
|
|
|
+ throw new BizException("创建电子存证印章失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ sysUserTsign = new SysUserTsign(-userId, accountId, sealData, orgName, organCode, tenantId);
|
|
|
+
|
|
|
+ if (orignSysUserTsign == null) {
|
|
|
+ sysUserTsignService.insert(sysUserTsign);
|
|
|
+ } else {
|
|
|
+ orignSysUserTsign.setAccountId(accountId);
|
|
|
+ orignSysUserTsign.setSealData(sealData);
|
|
|
+ orignSysUserTsign.setCardNo(organCode);
|
|
|
+ sysUserTsignService.update(orignSysUserTsign);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (!StringUtils.equals(orignSysUserTsign.getName(), orgName)) {
|
|
|
+ if (eSealPlugin.updateOrganAccount(orignSysUserTsign.getAccountId(), orgName, organCode)) {
|
|
|
+ orignSysUserTsign.setName(orgName);
|
|
|
+ sysUserTsignService.update(orignSysUserTsign);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public SysUserTsign register(Integer userId, String realName, String idCardNo, String mobileNo) {
|
|
|
|
|
|
if (StringUtils.isBlank(realName) || StringUtils.isBlank(idCardNo) || StringUtils.isBlank(mobileNo)) {
|