wangshan 1 month ago
parent
commit
52c84fd8c2

+ 10 - 8
src/jfw/modules/subscribepay/src/entity/bidCreditReport/bidCreditReport.go

@@ -358,7 +358,7 @@ func (b *bidCreditReport) sendMail(userId, userMail, entName, buyer, downloadUrl
 
 
 // 芝麻企业信用招投标报告创建请求
 // 芝麻企业信用招投标报告创建请求
 func (b *bidCreditReport) Create(id int64) error {
 func (b *bidCreditReport) Create(id int64) error {
-	datas := util.Mysql.SelectBySql(`select mold,bidding_id,project_name,user_id,order_code,ent_name,cert_no,buyer,prove_purchase,prove_purchase_status,prove_executed,prove_executed_status,prove_dishonesty,prove_dishonesty_status,prove_produce,prove_produce_status,creditchina,performance,out_biz_no,order_no from jianyu.bid_credit_report where id=?`, id)
+	datas := util.Mysql.SelectBySql(`select price,mold,bidding_id,project_name,user_id,order_code,ent_name,cert_no,buyer,prove_purchase,prove_purchase_status,prove_executed,prove_executed_status,prove_dishonesty,prove_dishonesty_status,prove_produce,prove_produce_status,creditchina,performance,out_biz_no,order_no from jianyu.bid_credit_report where id=?`, id)
 	if datas == nil || len(*datas) == 0 {
 	if datas == nil || len(*datas) == 0 {
 		return errors.New("没有找到相关记录")
 		return errors.New("没有找到相关记录")
 	}
 	}
@@ -372,6 +372,7 @@ func (b *bidCreditReport) Create(id int64) error {
 	biddingId := gconv.String((*datas)[0]["bidding_id"])
 	biddingId := gconv.String((*datas)[0]["bidding_id"])
 	projectName := gconv.String((*datas)[0]["project_name"])
 	projectName := gconv.String((*datas)[0]["project_name"])
 	performance := gconv.String((*datas)[0]["performance"])
 	performance := gconv.String((*datas)[0]["performance"])
+	price := gconv.Int((*datas)[0]["price"])
 	var err error
 	var err error
 	outBizNo := guid.S()
 	outBizNo := guid.S()
 	mgoUserId := userId
 	mgoUserId := userId
@@ -398,9 +399,10 @@ func (b *bidCreditReport) Create(id int64) error {
 	}
 	}
 	if orderNo == "" {
 	if orderNo == "" {
 		biz := map[string]interface{}{
 		biz := map[string]interface{}{
-			"scene_code": "ZTB_REPORT_JY",
-			"out_biz_no": outBizNo,
-			"order_type": consts.ZMReportOrderType[mold], //报告类型
+			"scene_code":    "ZTB_REPORT_JY",
+			"out_biz_no":    outBizNo,
+			"order_type":    consts.ZMReportOrderType[mold], //报告类型
+			"report_amount": b.YuanToWan(float64(price * 100)),
 		}
 		}
 		if buyer != "" {
 		if buyer != "" {
 			biz["bidding_ep_name"] = buyer
 			biz["bidding_ep_name"] = buyer
@@ -834,9 +836,9 @@ func (b *bidCreditReport) GetProjectDataInfo(di *DI) (dataInfo g.List, err error
 				})
 				})
 			}
 			}
 			//同类项目
 			//同类项目
-			if basicClass == "" { // todo
-				basicClass = "服务"
-			}
+			//if basicClass == "" { // todo
+			//	basicClass = "服务"
+			//}
 			if basicClass != "" {
 			if basicClass != "" {
 				//项目潜在供应商
 				//项目潜在供应商
 				potentialSupplier := b.GetPotentialSupplier(di.UserId, buyer, basicClass)
 				potentialSupplier := b.GetPotentialSupplier(di.UserId, buyer, basicClass)
@@ -1402,7 +1404,7 @@ func (b *bidCreditReport) GetNewSupplierList(userId, name string) (newSupplierLi
 // 近期拟购 recent_prepare_purchase  近三个月  采购意向
 // 近期拟购 recent_prepare_purchase  近三个月  采购意向
 func (b *bidCreditReport) GetRecentPreparePurchase(userId, name string) (recentPreparePurchase []g.Map) {
 func (b *bidCreditReport) GetRecentPreparePurchase(userId, name string) (recentPreparePurchase []g.Map) {
 	now := time.Now()
 	now := time.Now()
-	fromTime := now.AddDate(-2, -3, 0).Unix() //todo -2 改成 0
+	fromTime := now.AddDate(0, -3, 0).Unix() //todo -2 改成 0
 	searchSql := fmt.Sprintf(`{"query":{"bool":{"must":[{"term":{"toptype":"采购意向"}},{"term":{"buyer":"%s"}},{"range":{"publishtime":{"gt":%d}}}]}},"size":0,"aggs":{"group_by_basicClass":{"terms":{"field":"basicClass","size":10},"aggs":{"project_data":{"top_hits":{"size":10,"_source":["projectname","budget","publishtime"],"sort":[{"publishtime":{"order":"desc"}}]}}}}}}`, name, fromTime)
 	searchSql := fmt.Sprintf(`{"query":{"bool":{"must":[{"term":{"toptype":"采购意向"}},{"term":{"buyer":"%s"}},{"range":{"publishtime":{"gt":%d}}}]}},"size":0,"aggs":{"group_by_basicClass":{"terms":{"field":"basicClass","size":10},"aggs":{"project_data":{"top_hits":{"size":10,"_source":["projectname","budget","publishtime"],"sort":[{"publishtime":{"order":"desc"}}]}}}}}}`, name, fromTime)
 	aggs, _, _ := es.GetAggs(consts.ESBiddingIndex, consts.ESBiddingType, searchSql)
 	aggs, _, _ := es.GetAggs(consts.ESBiddingIndex, consts.ESBiddingType, searchSql)
 	if aggs != nil {
 	if aggs != nil {

+ 2 - 1
src/jfw/modules/subscribepay/src/entity/zmAnalysisReport.go

@@ -98,7 +98,8 @@ func (b *zmAnalysisReportPay) PayCallBack(param *CallBackParam) bool {
 				"mail":         mail,
 				"mail":         mail,
 				"project_name": qutil.ObjToString(filter["project_name"]),
 				"project_name": qutil.ObjToString(filter["project_name"]),
 				"create_time":  nowFormat,
 				"create_time":  nowFormat,
-				"status":       1, //  1:已提交
+				"status":       1,             //  1:已提交
+				"price":        param.CashFee, //支付价格
 			})
 			})
 			if rid <= 0 {
 			if rid <= 0 {
 				return false
 				return false

+ 7 - 5
src/jfw/modules/subscribepay/src/service/bidCreditReport.go

@@ -37,15 +37,17 @@ func (this *BidCreditReport) Example() {
 }
 }
 
 
 func (this *BidCreditReport) ReportTest() { //todo
 func (this *BidCreditReport) ReportTest() { //todo
-	if !g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "EnvSwitch").Bool() {
-		return
-	}
-	userId := this.GetString("userId")
+	phone := this.GetSession("phone")
 	id, _ := this.GetInt("id")
 	id, _ := this.GetInt("id")
-	if userId == "" || id <= 0 {
+	if phone == "" || id <= 0 {
 		this.ServeJson(api.Result{Error_code: -1, Error_msg: api.Error_msg_1003})
 		this.ServeJson(api.Result{Error_code: -1, Error_msg: api.Error_msg_1003})
 		return
 		return
 	}
 	}
+	envSwitch := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "EnvSwitch").Bool()
+	envPhone := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "EnvPhone").String()
+	if !envSwitch || phone != envPhone { //芝麻预发环境
+		return
+	}
 	err := bidCreditReport.BidCreditReport.Create(id)
 	err := bidCreditReport.BidCreditReport.Create(id)
 	if err != nil {
 	if err != nil {
 		this.ServeJson(api.Result{Error_code: -1, Error_msg: err.Error()})
 		this.ServeJson(api.Result{Error_code: -1, Error_msg: err.Error()})

+ 1 - 0
src/jfw/modules/subscribepay/src/zm_analysis_report.yaml

@@ -14,3 +14,4 @@ ExampleUrl:
   - name: 采购单位分析报告样例
   - name: 采购单位分析报告样例
     url: /common-module/pdf/【剑鱼标讯】采购单位分析报告.pdf
     url: /common-module/pdf/【剑鱼标讯】采购单位分析报告.pdf
 EnvSwitch: false
 EnvSwitch: false
+EnvPhone: 15737190152