|
@@ -3,7 +3,9 @@ package bidCreditReport
|
|
import (
|
|
import (
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
"app.yhyue.com/moapp/jybase/es"
|
|
"app.yhyue.com/moapp/jybase/es"
|
|
|
|
+ . "app.yhyue.com/moapp/jybase/mongodb"
|
|
"bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
|
|
"bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
|
|
|
|
+ . "bp.jydev.jianyu360.cn/BaseService/userCenter/identity"
|
|
"encoding/csv"
|
|
"encoding/csv"
|
|
"errors"
|
|
"errors"
|
|
"fmt"
|
|
"fmt"
|
|
@@ -24,7 +26,7 @@ import (
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
-const esQuery = `{"query":{"bool":{"must":[{"term":{"s_winner":"%s"}},{"range":{"lasttime":{"gt":%d}}},{"exists":{"field":"projectname"}},{"exists":{"field":"buyer"}},{"exists":{"field":"lasttime"}}]}},"_source":["id","projectname","buyer","area","city","district","bidamount","lasttime","list.infoid","topscopeclass"],"sort":{"bidamount":"desc"},"size":%d}`
|
|
|
|
|
|
+const esQuery = `{"query":{"bool":{"must":[{"term":{"s_winner":"%s"}},{"range":{"lasttime":{"gt":%d}}},{"exists":{"field":"projectname"}},{"exists":{"field":"buyer"}},{"exists":{"field":"lasttime"}}]}},"_source":["id","projectname","buyer","area","city","district","sortprice","lasttime","list.infoid","topscopeclass"],"sort":{"sortprice":"desc"},"size":%d}`
|
|
|
|
|
|
var BidCreditReport *bidCreditReport
|
|
var BidCreditReport *bidCreditReport
|
|
|
|
|
|
@@ -103,12 +105,15 @@ func (b *bidCreditReport) EntHasRisk(userId, certNo string) bool {
|
|
func (b *bidCreditReport) CallBack(from url.Values) bool {
|
|
func (b *bidCreditReport) CallBack(from url.Values) bool {
|
|
log.Println("芝麻企业信用服务变化通知", from)
|
|
log.Println("芝麻企业信用服务变化通知", from)
|
|
verifySign := b.Client.VerifySign(from)
|
|
verifySign := b.Client.VerifySign(from)
|
|
- go util.Mgo_log.Save("bidcredit_report_log", map[string]interface{}{
|
|
|
|
|
|
+ logData := map[string]interface{}{
|
|
"createTime": time.Now().Unix(),
|
|
"createTime": time.Now().Unix(),
|
|
"from": from,
|
|
"from": from,
|
|
"method": "zhima.credit.ep.acceptance.notify",
|
|
"method": "zhima.credit.ep.acceptance.notify",
|
|
- "verifySign": verifySign,
|
|
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ if verifySign != nil {
|
|
|
|
+ logData["verifySign"] = verifySign.Error()
|
|
|
|
+ }
|
|
|
|
+ go util.Mgo_log.Save("bidcredit_report_log", logData)
|
|
if verifySign != nil {
|
|
if verifySign != nil {
|
|
log.Println(from, "芝麻企业信用服务变化通知验签失败", verifySign)
|
|
log.Println(from, "芝麻企业信用服务变化通知验签失败", verifySign)
|
|
return false
|
|
return false
|
|
@@ -134,6 +139,7 @@ func (b *bidCreditReport) ReportQuery(orderNo string) bool {
|
|
ctx := gctx.New()
|
|
ctx := gctx.New()
|
|
orderCode := gconv.String((*datas)[0]["order_code"])
|
|
orderCode := gconv.String((*datas)[0]["order_code"])
|
|
entName := gconv.String((*datas)[0]["ent_name"])
|
|
entName := gconv.String((*datas)[0]["ent_name"])
|
|
|
|
+ buyer := gconv.String((*datas)[0]["buyer"])
|
|
fileName := "/" + b.folderName(bcrId, orderCode, entName) + "/" + entName + ".pdf"
|
|
fileName := "/" + b.folderName(bcrId, orderCode, entName) + "/" + entName + ".pdf"
|
|
downloadUrl := g.Config().MustGet(ctx, "bidCreditReport.visitUrl").String() + fileName
|
|
downloadUrl := g.Config().MustGet(ctx, "bidCreditReport.visitUrl").String() + fileName
|
|
r1 := util.Mysql.UpdateOrDeleteBySql(`update jianyu.bid_credit_report set download_url=?,report_url=?,status=2,complete_time=? where id=?`, downloadUrl, reportUrl, gtime.Datetime(), bcrId)
|
|
r1 := util.Mysql.UpdateOrDeleteBySql(`update jianyu.bid_credit_report set download_url=?,report_url=?,status=2,complete_time=? where id=?`, downloadUrl, reportUrl, gtime.Datetime(), bcrId)
|
|
@@ -152,6 +158,8 @@ func (b *bidCreditReport) ReportQuery(orderNo string) bool {
|
|
"l_createTime": time.Now().Unix(),
|
|
"l_createTime": time.Now().Unix(),
|
|
"s_pdfUrl": downloadUrl,
|
|
"s_pdfUrl": downloadUrl,
|
|
"bcr_id": bcrId,
|
|
"bcr_id": bcrId,
|
|
|
|
+ "ent": entName,
|
|
|
|
+ "buyer": buyer,
|
|
},
|
|
},
|
|
}, true, false)
|
|
}, true, false)
|
|
downloadUrl = config.Config.WebDomain + downloadUrl
|
|
downloadUrl = config.Config.WebDomain + downloadUrl
|
|
@@ -179,7 +187,7 @@ func (b *bidCreditReport) ReportQuery(orderNo string) bool {
|
|
}
|
|
}
|
|
for _, v := range userMails {
|
|
for _, v := range userMails {
|
|
go func(vv string) {
|
|
go func(vv string) {
|
|
- if b.sendMail(userId, v, entName, gconv.String((*datas)[0]["buyer"]), downloadUrl, orderCode) && userMail == vv {
|
|
|
|
|
|
+ if b.sendMail(userId, v, entName, buyer, downloadUrl, orderCode) && userMail == vv {
|
|
util.Mysql.UpdateOrDeleteBySql(`update jianyu.bid_credit_report set status=2,send_mail=1,send_mail_time=? where id=?`, gtime.Datetime(), bcrId)
|
|
util.Mysql.UpdateOrDeleteBySql(`update jianyu.bid_credit_report set status=2,send_mail=1,send_mail_time=? where id=?`, gtime.Datetime(), bcrId)
|
|
}
|
|
}
|
|
}(v)
|
|
}(v)
|
|
@@ -190,7 +198,8 @@ func (b *bidCreditReport) ReportQuery(orderNo string) bool {
|
|
// 发邮件
|
|
// 发邮件
|
|
func (b *bidCreditReport) sendMail(userId, userMail, entName, buyer, downloadUrl, orderCode string) bool {
|
|
func (b *bidCreditReport) sendMail(userId, userMail, entName, buyer, downloadUrl, orderCode string) bool {
|
|
ctx := gctx.New()
|
|
ctx := gctx.New()
|
|
- content := fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.mailContent").String(), downloadUrl, config.Config.WebDomain, orderCode, entName, buyer)
|
|
|
|
|
|
+ previewUrl := fmt.Sprintf("%s/swordfish/page_big_pc/free/report/preview?url=%s", config.Config.WebDomain, url.QueryEscape(downloadUrl))
|
|
|
|
+ content := fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.mailContent").String(), downloadUrl, previewUrl, entName, buyer)
|
|
log.Println("开始给", userId, orderCode, userMail, "发送招投标企业信用报告邮件。。。")
|
|
log.Println("开始给", userId, orderCode, userMail, "发送招投标企业信用报告邮件。。。")
|
|
if util.SendRetryMail(g.Config().MustGet(ctx, "bidCreditReport.sendMailRetry").Int(), userMail, fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.mailSubject").String(), entName), content, "", nil, config.GmailAuth) {
|
|
if util.SendRetryMail(g.Config().MustGet(ctx, "bidCreditReport.sendMailRetry").Int(), userMail, fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.mailSubject").String(), entName), content, "", nil, config.GmailAuth) {
|
|
log.Println("给", userId, orderCode, userMail, "发送招投标企业信用报告邮件成功。。。")
|
|
log.Println("给", userId, orderCode, userMail, "发送招投标企业信用报告邮件成功。。。")
|
|
@@ -213,6 +222,16 @@ func (b *bidCreditReport) Create(id int64) error {
|
|
certNo := gconv.String((*datas)[0]["cert_no"])
|
|
certNo := gconv.String((*datas)[0]["cert_no"])
|
|
orderNo := gconv.String((*datas)[0]["order_no"])
|
|
orderNo := gconv.String((*datas)[0]["order_no"])
|
|
outBizNo := guid.S()
|
|
outBizNo := guid.S()
|
|
|
|
+ mgoUserId := userId
|
|
|
|
+ if !IsObjectIdHex(mgoUserId) {
|
|
|
|
+ identity := IdentityByPositionId(util.BaseMysql, gconv.Int64(userId))
|
|
|
|
+ if identity != nil && identity.UserId > 0 {
|
|
|
|
+ user, ok := util.MQFW.FindOneByField("user", map[string]interface{}{"base_user_id": identity.UserId}, `{"_id":1}`)
|
|
|
|
+ if ok && user != nil && len(*user) > 0 {
|
|
|
|
+ mgoUserId = BsonIdToSId((*user)["_id"])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if !g.Config().MustGet(ctx, "bidCreditReport.productEnv").Bool() || garray.NewStrArrayFrom(g.Config().MustGet(ctx, "bidCreditReport.testIds").Strings()).Contains(userId) {
|
|
if !g.Config().MustGet(ctx, "bidCreditReport.productEnv").Bool() || garray.NewStrArrayFrom(g.Config().MustGet(ctx, "bidCreditReport.testIds").Strings()).Contains(userId) {
|
|
outBizNo = "test_" + outBizNo
|
|
outBizNo = "test_" + outBizNo
|
|
}
|
|
}
|
|
@@ -327,15 +346,15 @@ func (b *bidCreditReport) Create(id int64) error {
|
|
} else if district != "" {
|
|
} else if district != "" {
|
|
city = district
|
|
city = district
|
|
}
|
|
}
|
|
- bidamount := "-"
|
|
|
|
- if !vv.GetVar("bidamount").IsNil() {
|
|
|
|
- bidamount = vv.GetVar("bidamount").String()
|
|
|
|
|
|
+ sortprice := "-"
|
|
|
|
+ if !vv.GetVar("sortprice").IsNil() {
|
|
|
|
+ sortprice = vv.GetVar("sortprice").String()
|
|
}
|
|
}
|
|
infoUrl := ""
|
|
infoUrl := ""
|
|
if infos := vv.GetVar("list").Maps(); len(infos) > 0 {
|
|
if infos := vv.GetVar("list").Maps(); len(infos) > 0 {
|
|
- infoUrl = config.Config.WebDomain + "/nologin/content/" + encrypt.CommonEncodeArticle("content", gmap.NewStrAnyMapFrom(infos[len(infos)-1]).GetVar("infoid").String()) + ".html"
|
|
|
|
|
|
+ infoUrl = config.Config.WebDomain + "/nologin/content/" + encrypt.CommonEncodeArticle("content", gmap.NewStrAnyMapFrom(infos[len(infos)-1]).GetVar("infoid").String()) + ".html?source=bidCreditReport"
|
|
}
|
|
}
|
|
- records = append(records, []string{vv.GetVar("id").String(), projectName, buyer, gtime.New(vv.GetVar("lasttime").Int64()).Layout(time.DateTime), "-", bidamount, "-", area, city, "-", "-", infoUrl})
|
|
|
|
|
|
+ records = append(records, []string{vv.GetVar("id").String(), projectName, buyer, gtime.New(vv.GetVar("lasttime").Int64()).Layout(time.DateTime), "-", sortprice, "-", area, city, "-", "-", infoUrl})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if len(records) > 1 {
|
|
if len(records) > 1 {
|
|
@@ -362,7 +381,7 @@ func (b *bidCreditReport) Create(id int64) error {
|
|
"status_code": "SUCCESS",
|
|
"status_code": "SUCCESS",
|
|
"biz_type": "BIDDING_RECORD_HIS",
|
|
"biz_type": "BIDDING_RECORD_HIS",
|
|
//"biz_value": config.Config.WebDomain + performance,
|
|
//"biz_value": config.Config.WebDomain + performance,
|
|
- "biz_value": "http://47.94.231.30" + performance,
|
|
|
|
|
|
+ "biz_value": "http://101.200.125.254" + performance,
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
log.Println(userId, id, "没有查询到业绩证明")
|
|
log.Println(userId, id, "没有查询到业绩证明")
|