Quellcode durchsuchen

接口 /Tencent/CreateFlowByTemplateDirectly 增加入参,支持港澳通行证

zhouxnsz vor 1 Jahr
Ursprung
Commit
0a8002cc40
6 geänderte Dateien mit 38 neuen und 11 gelöschten Zeilen
  1. 2 2
      controllers/common/common.go
  2. 11 2
      controllers/tencent/qian.go
  3. 5 1
      docs/docs.go
  4. 5 1
      docs/swagger.json
  5. 4 1
      docs/swagger.yaml
  6. 11 4
      services/tencent/ess.go

+ 2 - 2
controllers/common/common.go

@@ -85,7 +85,7 @@ func QueryProvincesAndCities(c *gin.Context) {
 // @Success 200 {object} models.Division
 // @Failure  500     {object} app.Response
 // @Router  /Common/GetDivisions [get]
-// @Tags    通用服务
+// @Tags     通用服务
 func GetDivisions(c *gin.Context) {
 	appG := app.Gin{C: c}
 
@@ -207,7 +207,7 @@ type GetAllEnumsReq struct {
 // @Success     200    {object} models.Enumdicitem
 // @Failure     500    {object} app.Response
 // @Router      /Common/GetAllEnums [get]
-// @Tags     通用服务
+// @Tags    通用服务
 func GetAllEnums(c *gin.Context) {
 	appG := app.Gin{C: c}
 

+ 11 - 2
controllers/tencent/qian.go

@@ -167,7 +167,8 @@ func InitMdUserSwapProtocol(c *gin.Context) {
 type PersonInfo struct {
 	Name         string `json:"name"`         // 姓名
 	Mobile       string `json:"mobile"`       // 手机号码
-	IdCardNumber string `json:"idCardNumber"` // 身份证号码,目前只支持身份证
+	IdCardNumber string `json:"idCardNumber"` // 证件号码
+	IdCardType   *int   `json:"idCardType"`   // 证件类型 0-身份证 1-港澳通行证
 }
 
 // OrganizationInfo 签署企业信息
@@ -247,16 +248,24 @@ func CreateFlowByTemplateDirectly(c *gin.Context) {
 	personName := ""
 	personMobile := ""
 	idCardNumber := ""
+	idCardType := 0
 	if req.PersonInfo != nil {
 		personName = req.PersonInfo.Name
 		personMobile = req.PersonInfo.Mobile
 		idCardNumber = req.PersonInfo.IdCardNumber
+		if req.PersonInfo.IdCardType != nil {
+			if *req.PersonInfo.IdCardType != 0 && *req.PersonInfo.IdCardType != 1 {
+				appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, "证件类型不支持", nil)
+				return
+			}
+			idCardType = *req.PersonInfo.IdCardType
+		}
 	}
 	organizationName := ""
 	if req.OrganizationInfo != nil {
 		organizationName = req.OrganizationInfo.Name
 	}
-	flowId, signUrl, err := tencent.CreateFlowByTemplateDirectly(tmplateName, req.UserType, personName, personMobile, idCardNumber, organizationName, record)
+	flowId, signUrl, err := tencent.CreateFlowByTemplateDirectly(tmplateName, req.UserType, personName, personMobile, idCardNumber, organizationName, record, idCardType)
 	if err == nil {
 		appG.Response(http.StatusOK, e.SUCCESS, CreateFlowByTemplateDirectlyRsp{
 			FlowId:  flowId,

+ 5 - 1
docs/docs.go

@@ -65879,9 +65879,13 @@ const docTemplate = `{
             "type": "object",
             "properties": {
                 "idCardNumber": {
-                    "description": "身份证号码,目前只支持身份证",
+                    "description": "证号码",
                     "type": "string"
                 },
+                "idCardType": {
+                    "description": "证件类型 0-身份证 1-港澳通行证",
+                    "type": "integer"
+                },
                 "mobile": {
                     "description": "手机号码",
                     "type": "string"

+ 5 - 1
docs/swagger.json

@@ -65870,9 +65870,13 @@
             "type": "object",
             "properties": {
                 "idCardNumber": {
-                    "description": "身份证号码,目前只支持身份证",
+                    "description": "证号码",
                     "type": "string"
                 },
+                "idCardType": {
+                    "description": "证件类型 0-身份证 1-港澳通行证",
+                    "type": "integer"
+                },
                 "mobile": {
                     "description": "手机号码",
                     "type": "string"

+ 4 - 1
docs/swagger.yaml

@@ -31425,8 +31425,11 @@ definitions:
   tencent.PersonInfo:
     properties:
       idCardNumber:
-        description: 身份证号码,目前只支持身份证
+        description: 证号码
         type: string
+      idCardType:
+        description: 证件类型 0-身份证 1-港澳通行证
+        type: integer
       mobile:
         description: 手机号码
         type: string

+ 11 - 4
services/tencent/ess.go

@@ -69,7 +69,8 @@ func InitMdUserSwapProtocol(userId, areaUserId int) (err error) {
 func CreateFlowByTemplateDirectly(tmplateName string, userType int,
 	personName, personMobile, personIdCardNumber string,
 	organizationName string,
-	record *models.Useresignrecord) (flowId, signUrl string, err error) {
+	record *models.Useresignrecord,
+	idCardType int) (flowId, signUrl string, err error) {
 
 	// 获取模板信息
 	templateInfo, err := GetTemplateInfo(&tmplateName)
@@ -104,7 +105,7 @@ func CreateFlowByTemplateDirectly(tmplateName string, userType int,
 			// 乙方
 			if userType == 1 {
 				// 个人
-				flowApproverInfos = append(flowApproverInfos, buildPersonApprovers(personName, personMobile, personIdCardNumber, recipient)...)
+				flowApproverInfos = append(flowApproverInfos, buildPersonApprovers(personName, personMobile, personIdCardNumber, idCardType, recipient)...)
 			} else {
 				// 企业
 				flowApproverInfos = append(flowApproverInfos, buildOrganizationApprovers(organizationName, recipient)...)
@@ -250,7 +251,7 @@ func GetTemplateInfo(contractName *string) (templateInfo *essbasic.TemplateInfo,
 }
 
 // buildPersonApprovers 构造个人签署人 - 以BtoC为例, 实际请根据自己的场景构造签署方、控件
-func buildPersonApprovers(personName, personMobile, personIdCardNumber string, recipient *essbasic.Recipient) []*essbasic.FlowApproverInfo {
+func buildPersonApprovers(personName, personMobile, personIdCardNumber string, idCardType int, recipient *essbasic.Recipient) []*essbasic.FlowApproverInfo {
 	var flowApproverInfos []*essbasic.FlowApproverInfo
 
 	// 传入个人签署方
@@ -259,7 +260,13 @@ func buildPersonApprovers(personName, personMobile, personIdCardNumber string, r
 	flowApproverInfo.ApproverType = &approverType
 	flowApproverInfo.Name = &personName
 	flowApproverInfo.Mobile = &personMobile
-	flowApproverInfo.IdCardType = utils.SetPointValue("ID_CARD")
+	if idCardType == 0 {
+		flowApproverInfo.IdCardType = utils.SetPointValue("ID_CARD")
+	} else if idCardType == 1 {
+		flowApproverInfo.IdCardType = utils.SetPointValue("HONGKONG_AND_MACAO")
+	} else {
+		flowApproverInfo.IdCardType = utils.SetPointValue("ID_CARD")
+	}
 	flowApproverInfo.IdCardNumber = &personIdCardNumber
 	// 模板中对应签署方的参与方id
 	flowApproverInfo.RecipientId = recipient.RecipientId