|
@@ -7,7 +7,6 @@ import (
|
|
|
"mtp2_if/logger"
|
|
"mtp2_if/logger"
|
|
|
asignService "mtp2_if/services/asign"
|
|
asignService "mtp2_if/services/asign"
|
|
|
"net/http"
|
|
"net/http"
|
|
|
- "net/url"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gin-gonic/gin"
|
|
|
)
|
|
)
|
|
@@ -44,63 +43,93 @@ func CreateContract(c *gin.Context) {
|
|
|
func HandleASignCompleted(c *gin.Context) {
|
|
func HandleASignCompleted(c *gin.Context) {
|
|
|
g := app.Gin{C: c}
|
|
g := app.Gin{C: c}
|
|
|
|
|
|
|
|
- if g.C.Request.Method == "POST" {
|
|
|
|
|
- // 爱签合同签署完成后异步通知 POST
|
|
|
|
|
- action, ok := g.C.GetPostForm("action")
|
|
|
|
|
- if !ok {
|
|
|
|
|
- err := errors.New("获取action失败")
|
|
|
|
|
- g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- contractNo, ok := g.C.GetPostForm("contractNo")
|
|
|
|
|
- if !ok {
|
|
|
|
|
- err := errors.New("获取contractNo失败")
|
|
|
|
|
- g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- status, ok := g.C.GetPostForm("status")
|
|
|
|
|
- if !ok {
|
|
|
|
|
- err := errors.New("获取status失败")
|
|
|
|
|
- g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 爱签合同签署完成后异步通知 POST
|
|
|
|
|
+ action, ok := g.C.GetPostForm("action")
|
|
|
|
|
+ if !ok {
|
|
|
|
|
+ err := errors.New("获取action失败")
|
|
|
|
|
+ g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ contractNo, ok := g.C.GetPostForm("contractNo")
|
|
|
|
|
+ if !ok {
|
|
|
|
|
+ err := errors.New("获取contractNo失败")
|
|
|
|
|
+ g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ status, ok := g.C.GetPostForm("status")
|
|
|
|
|
+ if !ok {
|
|
|
|
|
+ err := errors.New("获取status失败")
|
|
|
|
|
+ g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if action == "signCompleted" {
|
|
|
|
|
- if err := asignService.ASignCompleted(contractNo, status); err == nil {
|
|
|
|
|
- g.C.String(http.StatusOK, "%s", "ok")
|
|
|
|
|
- } else {
|
|
|
|
|
- g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ if action == "signCompleted" {
|
|
|
|
|
+ if err := asignService.ASignCompleted(contractNo, status); err == nil {
|
|
|
g.C.String(http.StatusOK, "%s", "ok")
|
|
g.C.String(http.StatusOK, "%s", "ok")
|
|
|
|
|
+ } else {
|
|
|
|
|
+ g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
}
|
|
}
|
|
|
- } else if g.C.Request.Method == "GET" {
|
|
|
|
|
- // 爱签个人意愿核身认证接口异步通知 GET
|
|
|
|
|
- logger.GetLogger().Info("接收爱签个人意愿核身认证接口异步通知, url:" + g.C.Request.URL.String())
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ g.C.String(http.StatusOK, "%s", "ok")
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- sign := g.C.Query("sign")
|
|
|
|
|
- result := g.C.Query("result")
|
|
|
|
|
- msg := g.C.Query("msg")
|
|
|
|
|
- recordId := g.C.Query("recordId")
|
|
|
|
|
- if sign == "" || result == "" || msg == "" || recordId == "" {
|
|
|
|
|
- g.C.String(http.StatusOK, "提交信息失败,请关闭此页面稍后重试")
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if g.C.Request.Method == "POST" {
|
|
|
|
|
+ // // 爱签合同签署完成后异步通知 POST
|
|
|
|
|
+ // action, ok := g.C.GetPostForm("action")
|
|
|
|
|
+ // if !ok {
|
|
|
|
|
+ // err := errors.New("获取action失败")
|
|
|
|
|
+ // g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
+ // contractNo, ok := g.C.GetPostForm("contractNo")
|
|
|
|
|
+ // if !ok {
|
|
|
|
|
+ // err := errors.New("获取contractNo失败")
|
|
|
|
|
+ // g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
+ // status, ok := g.C.GetPostForm("status")
|
|
|
|
|
+ // if !ok {
|
|
|
|
|
+ // err := errors.New("获取status失败")
|
|
|
|
|
+ // g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
- if result != "1" {
|
|
|
|
|
- // 认证失败
|
|
|
|
|
- t, _ := url.QueryUnescape(msg)
|
|
|
|
|
- if t == "" {
|
|
|
|
|
- t = "提交信息失败,请关闭此页面稍后重试."
|
|
|
|
|
- }
|
|
|
|
|
- g.C.String(http.StatusOK, t)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if action == "signCompleted" {
|
|
|
|
|
+ // if err := asignService.ASignCompleted(contractNo, status); err == nil {
|
|
|
|
|
+ // g.C.String(http.StatusOK, "%s", "ok")
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // g.C.String(http.StatusBadRequest, "%s", err)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // g.C.String(http.StatusOK, "%s", "ok")
|
|
|
|
|
+ // }
|
|
|
|
|
+ // } else if g.C.Request.Method == "GET" {
|
|
|
|
|
+ // // 爱签个人意愿核身认证接口异步通知 GET
|
|
|
|
|
+ // logger.GetLogger().Info("接收爱签个人意愿核身认证接口异步通知, url:" + g.C.Request.URL.String())
|
|
|
|
|
|
|
|
- if err := asignService.HandleWillFace(sign, result, msg, recordId); err == nil {
|
|
|
|
|
- g.C.String(http.StatusOK, "提交信息成功,请关闭此页面")
|
|
|
|
|
- } else {
|
|
|
|
|
- g.C.String(http.StatusOK, "提交信息失败,请关闭此页面稍后重试")
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // sign := g.C.Query("sign")
|
|
|
|
|
+ // result := g.C.Query("result")
|
|
|
|
|
+ // msg := g.C.Query("msg")
|
|
|
|
|
+ // recordId := g.C.Query("recordId")
|
|
|
|
|
+ // if sign == "" || result == "" || msg == "" || recordId == "" {
|
|
|
|
|
+ // g.C.String(http.StatusOK, "提交信息失败,请关闭此页面稍后重试")
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ // if result != "1" {
|
|
|
|
|
+ // // 认证失败
|
|
|
|
|
+ // t, _ := url.QueryUnescape(msg)
|
|
|
|
|
+ // if t == "" {
|
|
|
|
|
+ // t = "提交信息失败,请关闭此页面稍后重试."
|
|
|
|
|
+ // }
|
|
|
|
|
+ // g.C.String(http.StatusOK, t)
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ // if err := asignService.HandleWillFace(sign, result, msg, recordId); err == nil {
|
|
|
|
|
+ // g.C.String(http.StatusOK, "提交信息成功,请关闭此页面")
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // g.C.String(http.StatusOK, "提交信息失败,请关闭此页面稍后重试")
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|