|
@@ -2,6 +2,7 @@ package common
|
|
|
|
|
|
import (
|
|
|
"bytes"
|
|
|
+ "context"
|
|
|
"crypto/md5"
|
|
|
"encoding/hex"
|
|
|
"encoding/json"
|
|
@@ -9,6 +10,7 @@ import (
|
|
|
"git.listensoft.net/tool/jspkit/common/lxhttp"
|
|
|
"git.listensoft.net/tool/jspkit/common/models"
|
|
|
"git.listensoft.net/tool/jspkit/common/variable"
|
|
|
+ "git.listensoft.net/tool/jspkit/common/watermark"
|
|
|
"git.listensoft.net/tool/jspkit/logger"
|
|
|
"git.listensoft.net/tool/jspkit/taxerr"
|
|
|
"github.com/go-kratos/kratos/v2/log"
|
|
@@ -32,8 +34,8 @@ type LvName string
|
|
|
const (
|
|
|
CheckSuccess LvName = "申报成功" // 检查成功 ------ 检查完全通过
|
|
|
CheckFail LvName = "检查失败" // 检查任务失败 ----- 网页打开失败等
|
|
|
- CheckOmit LvName = "有遗漏" // 检查有遗漏 ----- 未申报问题
|
|
|
- CheckAbnormal LvName = "有异常" //检查有异常 ----- 税款问题
|
|
|
+ CheckOmit LvName = "有遗漏" // 检查有遗漏 ----- 未申报问题
|
|
|
+ CheckAbnormal LvName = "有异常" //检查有异常 ----- 税款问题
|
|
|
)
|
|
|
|
|
|
func GeneratePath(suffix string) string {
|
|
@@ -433,3 +435,25 @@ func SaveCookiesNoPhone(key string) error {
|
|
|
logger.Info("SaveSessionKey:", key)
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+func SaveErrImgLv(lv LvName, p *rod.Page, info models.CompanyInfo, location string) string {
|
|
|
+ checkPath := GenerateCheckImagePath(lv, info.TaxNo, info.Period, location)
|
|
|
+ p.Timeout(ClickTimeOut).MustScreenshot(checkPath)
|
|
|
+ _ = watermark.Add(checkPath)
|
|
|
+ checkPath2 := PostSbjt(info.TaxNo, info.Period, checkPath)
|
|
|
+ _ = os.Remove(checkPath)
|
|
|
+ return checkPath2
|
|
|
+}
|
|
|
+
|
|
|
+func CheckError(ctx context.Context, task *models.TaxTask, err error) {
|
|
|
+ errStr := HandleError(ctx, err).Error()
|
|
|
+ if strings.Contains(errStr, "网页") {
|
|
|
+ //task.Result.Status = variable.TaxFail
|
|
|
+ //task.Result.ErrLog = errStr
|
|
|
+ task.Result.BusinessStatus = variable.TaxFail
|
|
|
+ task.Result.BusinessLog = errStr
|
|
|
+ } else {
|
|
|
+ task.Result.BusinessStatus = variable.TaxFail
|
|
|
+ task.Result.BusinessLog = errStr
|
|
|
+ }
|
|
|
+}
|