|
|
@@ -180,7 +180,7 @@ handleASignCompleted 处理爱签合同签署完成后回调通知
|
|
|
|
|
|
req 异步推送参数
|
|
|
*/
|
|
|
-func HandleASignCompleted(req map[string]string) (err error) {
|
|
|
+func HandleASignCompleted(req request.HandleASignCompletedReq) (err error) {
|
|
|
/*
|
|
|
// 合同签署完成后回调通知示例
|
|
|
String publickey = "MFwwDQcccccxxxxmEz/nw27Ln6AP90ZCMPi+iNF1m9mhNECAwEAAQ==";
|
|
|
@@ -204,21 +204,19 @@ func HandleASignCompleted(req map[string]string) (err error) {
|
|
|
*/
|
|
|
|
|
|
// 获取合同编号
|
|
|
- contractNo, ok := req["contractNo"]
|
|
|
- if !ok {
|
|
|
+ if req.ContractNo == "" {
|
|
|
global.M2A_LOG.Error("【HandleASignCompleted】 获取合同编号失败", zap.Any("req", req))
|
|
|
return
|
|
|
}
|
|
|
// 获取合同状态
|
|
|
- status, ok := req["status"]
|
|
|
- if !ok {
|
|
|
+ if req.Status == "" {
|
|
|
global.M2A_LOG.Error("【HandleASignCompleted】 获取获取合同状态失败", zap.Any("req", req))
|
|
|
return
|
|
|
}
|
|
|
- if status == "2" {
|
|
|
+ if req.Status == "2" {
|
|
|
// 已签约
|
|
|
// 下载合同
|
|
|
- r, e := asign.DownloadContract(contractNo)
|
|
|
+ r, e := asign.DownloadContract(req.ContractNo)
|
|
|
if e != nil {
|
|
|
err = e
|
|
|
return
|
|
|
@@ -253,11 +251,23 @@ func HandleASignCompleted(req map[string]string) (err error) {
|
|
|
defer f.Close()
|
|
|
// 更新数据库记录
|
|
|
// 获取用户电子签记录
|
|
|
- useresignrecord := new(account.Useresignrecord)
|
|
|
- has, e = global.M2A_DB.Where("CONTRACTNO = ?", contractNo).Get(useresignrecord)
|
|
|
- if e != nil || !has {
|
|
|
- err = e
|
|
|
- global.M2A_LOG.Error("【HandleASignCompleted】 获取用户电子签记录失败", zap.Error(err))
|
|
|
+ // useresignrecord := new(account.Useresignrecord)
|
|
|
+ // has, e = global.M2A_DB.Where("CONTRACTNO = ?", req.ContractNo).Get(useresignrecord)
|
|
|
+ // if e != nil || !has {
|
|
|
+ // err = e
|
|
|
+ // global.M2A_LOG.Error("【HandleASignCompleted】 获取用户电子签记录失败", zap.Error(err))
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ contractfileaddr := fmt.Sprintf("./uploadFile/%v/%v", folderPath, fileName)
|
|
|
+ sql := fmt.Sprintf(`
|
|
|
+ UPDATE useresignrecord
|
|
|
+ SET RECORDSTATUS = 3,
|
|
|
+ UPDATETIME = SYSDATE,
|
|
|
+ CONTRACTFILEADDR = '%v'
|
|
|
+ WHERE CONTRACTNO = %v
|
|
|
+ `, contractfileaddr, req.ContractNo)
|
|
|
+ if _, err = global.M2A_DB.Exec(sql); err != nil {
|
|
|
+ global.M2A_LOG.Error("【HandleASignCompleted】 更新用户电子签记录失败", zap.Error(err))
|
|
|
return
|
|
|
}
|
|
|
}
|