|
|
@@ -8,7 +8,6 @@ import (
|
|
|
"mtp2_if/logger"
|
|
|
"mtp2_if/models"
|
|
|
"mtp2_if/services/tencent"
|
|
|
- "mtp2_if/utils"
|
|
|
"net/http"
|
|
|
"strconv"
|
|
|
|
|
|
@@ -94,6 +93,14 @@ func QianNotice(c *gin.Context) {
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, "ok")
|
|
|
}
|
|
|
|
|
|
+type CreateConsoleLoginUrlReq struct {
|
|
|
+ AreaUserId int `form:"areaUserId" binding:"required"` // 机构ID
|
|
|
+}
|
|
|
+
|
|
|
+type CreateConsoleLoginUrlRsp struct {
|
|
|
+ ConsoleUrl string `json:"consoleUrl"` // 电子签控制台登录链接
|
|
|
+}
|
|
|
+
|
|
|
// CreateConsoleLoginUrl 创建电子签控制台登录链接
|
|
|
// @Summary 创建电子签控制台登录链接
|
|
|
// @Produce json
|
|
|
@@ -106,11 +113,20 @@ func QianNotice(c *gin.Context) {
|
|
|
func CreateConsoleLoginUrl(c *gin.Context) {
|
|
|
appG := app.Gin{C: c}
|
|
|
|
|
|
- agent := utils.SetAgent()
|
|
|
- proxyOrganizationName := "天津麦顿"
|
|
|
- response, _ := tencent.CreateConsoleLoginUrl(agent, proxyOrganizationName)
|
|
|
+ // 获取请求参数
|
|
|
+ var req CreateConsoleLoginUrlReq
|
|
|
+ if err := appG.C.ShouldBindQuery(&req); err != nil {
|
|
|
+ logger.GetLogger().Errorf("CreateConsoleLoginUrl failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- appG.Response(http.StatusOK, e.SUCCESS, response.ToJsonString())
|
|
|
+ if response, err := tencent.CreateConsoleLoginUrl(req.AreaUserId); err != nil {
|
|
|
+ unquotedStr, _ := strconv.Unquote(response.ToJsonString())
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, CreateConsoleLoginUrlRsp{ConsoleUrl: unquotedStr})
|
|
|
+ } else {
|
|
|
+ appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
type InitTencentESSReq struct {
|
|
|
@@ -219,12 +235,12 @@ func CreateFlowByTemplateDirectly(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
// 构建电子签平台合同模板名称
|
|
|
- // 格式:所属会员ID_类型标志_合同模板名称;例如 "1000_P_风险提示书",个人为P企业为A
|
|
|
+ // 格式:合同模板名称_类型标志;例如 "风险提示书_P",个人为P企业为E
|
|
|
flag := "P"
|
|
|
if req.UserType == 2 {
|
|
|
- flag = "A"
|
|
|
+ flag = "E"
|
|
|
}
|
|
|
- tmplateName := fmt.Sprintf("%s_%s_%s", strconv.Itoa(int(record.AREAUSERID)), flag, record.TEMPLATENAME)
|
|
|
+ tmplateName := fmt.Sprintf("%s_%s", record.TEMPLATENAME, flag)
|
|
|
|
|
|
personName := ""
|
|
|
personMobile := ""
|
|
|
@@ -251,6 +267,7 @@ func CreateFlowByTemplateDirectly(c *gin.Context) {
|
|
|
|
|
|
type GetFlowStatusReq struct {
|
|
|
ContractNo string `form:"contractno" binding:"required"` // 合同编号
|
|
|
+ AreaUserId int `form:"areaUserId" binding:"required"` // 机构ID
|
|
|
}
|
|
|
|
|
|
// GetFlowStatus 获取合同状态
|
|
|
@@ -259,6 +276,7 @@ type GetFlowStatusReq struct {
|
|
|
// @Security ApiKeyAuth
|
|
|
// @accept application/json
|
|
|
// @Param contractno query string true "合同编号"
|
|
|
+// @Param areaUserId query int true "机构ID"
|
|
|
// @Success 200 {object} int "记录状态 - 1:未签署 2:签署中 3:已签署 4:签署拒绝"
|
|
|
// @Failure 500 {object} app.Response
|
|
|
// @Router /Tencent/GetFlowStatus [get]
|
|
|
@@ -274,7 +292,7 @@ func GetFlowStatus(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if recordStatus, err := tencent.GetFlowStatus(req.ContractNo); err == nil {
|
|
|
+ if recordStatus, err := tencent.GetFlowStatus(req.ContractNo, req.AreaUserId); err == nil {
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, recordStatus)
|
|
|
} else {
|
|
|
appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|