yonge 5 年之前
父節點
當前提交
b6eecd086a

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -120,15 +120,15 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 				throw new BizException("创建企业电子存证账户失败");
 			}
 
-			/*String sealData = eSealPlugin.createSeal(accountId);
+			String sealData = eSealPlugin.createOrganSeal(accountId, "", "");
 
 			if (StringUtils.isBlank(sealData)) {
 				throw new BizException("创建电子存证印章失败");
 			}
 
-			sysUserTsign = new SysUserTsign(null, accountId, sealData, orgName, organCode);
+			sysUserTsign = new SysUserTsign(-1, accountId, sealData, orgName, organCode);
 
-			sysUserTsignService.insert(sysUserTsign);*/
+			sysUserTsignService.insert(sysUserTsign);
 
 		}
 	}
@@ -146,7 +146,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 				throw new BizException("创建电子存证账户失败");
 			}
 
-			String sealData = eSealPlugin.createSeal(accountId);
+			String sealData = eSealPlugin.createUserSeal(accountId);
 
 			if (StringUtils.isBlank(sealData)) {
 				throw new BizException("创建电子存证印章失败");

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/SysUserTsignMapper.xml

@@ -32,7 +32,7 @@
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 		</selectKey>
 		-->
-		INSERT INTO sys_user_tsign (user_id_,account_id_,seal_data_,name,card_no_,create_time_) VALUES(#{userId},#{accountId},#{sealData},#{name},#{cardNo},now())
+		INSERT INTO sys_user_tsign (user_id_,account_id_,seal_data_,name_,card_no_,create_time_) VALUES(#{userId},#{accountId},#{sealData},#{name},#{cardNo},now())
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->

+ 11 - 2
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/ESealPlugin.java

@@ -20,11 +20,20 @@ public interface ESealPlugin {
 	public String createOrganAccount(String orgName, String organCode);
 
 	/**
-	 * 创建印章
+	 * 创建个人印章
 	 * @param accountId 账户唯一标识
 	 * @return 电子印章数据
 	 */
-	public String createSeal(String accountId);
+	public String createUserSeal(String accountId);
+
+	/**
+	 * 创建企业印章
+	 * @param accountId 账户唯一标识
+	 * @param hText 生成印章中的横向文内容
+	 * @param qText 生成印章中的下弦文内容
+	 * @return 电子印章数据
+	 */
+	public String createOrganSeal(String accountId, String hText, String qText);
 
 	/**
 	 * 平台自身PDF摘要签署(印章标识)

+ 25 - 14
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/provider/TsignPlugin.java

@@ -15,6 +15,7 @@ import com.timevale.esign.sdk.tech.bean.result.AddSealResult;
 import com.timevale.esign.sdk.tech.bean.result.FileDigestSignResult;
 import com.timevale.esign.sdk.tech.bean.result.GetAccountProfileResult;
 import com.timevale.esign.sdk.tech.bean.result.Result;
+import com.timevale.esign.sdk.tech.bean.seal.OrganizeTemplateType;
 import com.timevale.esign.sdk.tech.bean.seal.PersonTemplateType;
 import com.timevale.esign.sdk.tech.bean.seal.SealColor;
 import com.timevale.esign.sdk.tech.impl.constants.LegalAreaType;
@@ -89,7 +90,7 @@ public class TsignPlugin implements ESealPlugin, InitializingBean, DisposableBea
 		AddAccountResult result = service.addAccount(personbean);
 		if (result.getErrCode() == 0) {
 			return result.getAccountId();
-		}else if(result.getErrCode() == 1500012){
+		} else if (result.getErrCode() == 1500012) {
 			return queryAccountIdByIdNo(idcard);
 		}
 		throw new ThirdpartyException(result.getMsg());
@@ -121,19 +122,29 @@ public class TsignPlugin implements ESealPlugin, InitializingBean, DisposableBea
 	 * @param accountId e签宝账户唯一标识
 	 * @return 电子印章数据
 	 */
-	public String createSeal(String accountId) {
-		// 创建模板类型
-		PersonTemplateType templateType = PersonTemplateType.RECTANGLE;
+	public String createUserSeal(String accountId) {
 		// 生成模板印章的颜色
-		SealColor color = SealColor.BLUE;
+		SealColor color = SealColor.RED;
 		SealService service = serviceClient.sealService();
-		AddSealResult result = service.addTemplateSeal(accountId, templateType, color);
+		AddSealResult result = service.addTemplateSeal(accountId, PersonTemplateType.RECTANGLE, color);
 		if (0 == result.getErrCode()) {
 			return result.getSealData();
 		}
 		throw new ThirdpartyException("个人模板印章接口调用失败code=" + result.getErrCode() + "msg=" + result.getMsg());
 	}
 
+	@Override
+	public String createOrganSeal(String accountId, String hText, String qText) {
+		// 生成模板印章的颜色
+		SealColor color = SealColor.RED;
+		SealService service = serviceClient.sealService();
+		AddSealResult result = service.addTemplateSeal(accountId, OrganizeTemplateType.STAR, color, hText, qText);
+		if (0 == result.getErrCode()) {
+			return result.getSealData();
+		}
+		throw new ThirdpartyException("企业模板印章接口调用失败code=" + result.getErrCode() + "msg=" + result.getMsg());
+	}
+
 	/**
 	 * 平台自身PDF摘要签署(印章标识)
 	 * @param srcPdfPath 源文件
@@ -230,20 +241,20 @@ public class TsignPlugin implements ESealPlugin, InitializingBean, DisposableBea
 		}
 		throw new ThirdpartyException("平台用户PDF摘要签署接口调用失败" + result.getErrCode() + "msg=" + result.getMsg());
 	}
-	
-	private String queryAccountIdByIdNo(String idcardNo){
-		
+
+	private String queryAccountIdByIdNo(String idcardNo) {
+
 		AccountService service = serviceClient.accountService();
-		
+
 		GetAccountProfileResult result = service.getAccountInfoByIdNo(idcardNo, LicenseQueryType.MAINLAND);
-		
-		if(result != null){
+
+		if (result != null) {
 			AccountProfile accountProfile = result.getAccountInfo();
-			if(accountProfile != null){
+			if (accountProfile != null) {
 				return accountProfile.getAccountUid();
 			}
 		}
-		
+
 		return null;
 	}
 }