Pārlūkot izejas kodu

Merge branch 'dev2.6' of http://192.168.3.207:10080/qmx/qfw into dev2.6

6 gadi atpakaļ
vecāks
revīzija
6261f6dacd

+ 30 - 1
common/src/qfw/util/elastic/elasticutil.go

@@ -1005,6 +1005,9 @@ const (
 	MatchQueryString = `{"match": {%s: { "query":"%s", "operator": "and"}}}`
 	HL_New           = `"highlight": {"pre_tags": ["<HL>"],"post_tags": ["<HL>"],"fields": {%s}}`
 
+	//数据查询高亮标记2019-07-10
+	HL_MP = `"highlight": {"pre_tags": ["<HL>"],"post_tags": ["</HL>"],"fields": {%s}}`
+
 	ik_highlightStr = `%s: {"fragment_size": %d,"number_of_fragments": 1,"require_field_match": true}`
 	IK_pre_tags     = `<font class=\"es-highlight\">`
 	IK_post_tags    = `</font>`
@@ -1292,7 +1295,33 @@ func GetAllByNgram(index, itype, qstr, findfields, order, fields string, start,
 		if start > -1 {
 			qstr = qstr[:len(qstr)-1] + `,"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(limit) + "}"
 		}
-		//log.Println("GetAllByNgram:", qstr)
+		//		log.Println("GetAllByNgram:", qstr)
+		return Get(index, itype, qstr)
+	} else {
+		return nil
+	}
+}
+
+//数据标记2019-07-10
+func GetAllByNgram_MP(index, itype, qstr, findfields, order, fields string, start, limit, count int, highlight bool) *[]map[string]interface{} {
+	if qstr != "" {
+		if highlight {
+			ws := []string{}
+			for _, w := range strings.Split(findfields, ",") {
+				ws = append(ws, fmt.Sprintf(highlightStr, w, count))
+			}
+			qstr = qstr[:len(qstr)-1] + `,` + fmt.Sprintf(HL_MP, strings.Join(ws, ",")) + `}`
+		}
+		if len(fields) > 0 {
+			qstr = qstr[:len(qstr)-1] + `,"_source":[` + fields + "]}"
+		}
+		if len(order) > 0 {
+			qstr = qstr[:len(qstr)-1] + `,"sort":[` + SR(SR(SR(SR(order, ",", "},{", -1), " ", "", -1), ":-1", `:"desc"`, -1), ":1", `:"asc"`, -1) + `]}`
+		}
+		if start > -1 {
+			qstr = qstr[:len(qstr)-1] + `,"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(limit) + "}"
+		}
+		//		log.Println("GetAllByNgram:", qstr)
 		return Get(index, itype, qstr)
 	} else {
 		return nil

+ 18 - 0
common/src/qfw/util/mongodb/mongodbSim.go

@@ -316,6 +316,24 @@ func (m *MongodbSim) Save(c string, doc interface{}) string {
 	return ""
 }
 
+//原_id不变
+func (m *MongodbSim) SaveByOriID(c string, doc interface{}) bool {
+	defer util.Catch()
+	sess := m.GetMgoConn()
+	if sess != nil {
+		defer m.DestoryMongoConn(sess)
+		coll := sess.DB(m.DbName).C(c)
+		obj := ObjToM(doc)
+		err := coll.Insert(obj)
+		if nil != err {
+			log.Println("SaveError", err)
+			return false
+		}
+		return true
+	}
+	return false
+}
+
 //查询单条对象
 func (m *MongodbSim) FindOne(c string, query interface{}) (*map[string]interface{}, bool) {
 	return m.FindOneByField(c, query, nil)

+ 20 - 6
common/src/qfw/util/mysql/mysql.go

@@ -74,7 +74,8 @@ func (m *Mysql) Insert(tableName string, data map[string]interface{}) int64 {
 }
 
 /*不等于 map[string]string{"ne":"1"}
- *
+ *字段为空 map[string]string{"name":"$isNull"}
+ *字段不为空 map[string]string{"name":"$isNotNull"}
  */
 func (m *Mysql) Find(tableName string, query map[string]interface{}, fields, order string, start, pageSize int) *[]map[string]interface{} {
 	fs := []string{}
@@ -90,8 +91,14 @@ func (m *Mysql) Find(tableName string, query map[string]interface{}, fields, ord
 				}
 			}
 		} else {
-			fs = append(fs, fmt.Sprintf("%s=?", k))
-			vs = append(vs, v)
+			if v == "$isNull" {
+				fs = append(fs, fmt.Sprintf("%s is null", k))
+			} else if v == "$isNotNull" {
+				fs = append(fs, fmt.Sprintf("%s is not null", k))
+			} else {
+				fs = append(fs, fmt.Sprintf("%s=?", k))
+				vs = append(vs, v)
+			}
 		}
 	}
 	var buffer bytes.Buffer
@@ -241,11 +248,18 @@ func (m *Mysql) Count(tableName string, query map[string]interface{}) int64 {
 	fields := []string{}
 	values := []interface{}{}
 	for k, v := range query {
-		fields = append(fields, fmt.Sprintf("%s=?", k))
-		values = append(values, v)
+		if v == "$isNull" {
+			fields = append(fields, fmt.Sprintf("%s is null", k))
+		} else if v == "$isNotNull" {
+			log.Println("xxxx")
+			fields = append(fields, fmt.Sprintf("%s is not null", k))
+		} else {
+			fields = append(fields, fmt.Sprintf("%s=?", k))
+			values = append(values, v)
+		}
 	}
 	q := fmt.Sprintf("select count(1) as count from %s", tableName)
-	if len(values) > 0 {
+	if len(query) > 0 {
 		q += fmt.Sprintf(" where %s", strings.Join(fields, " and "))
 	}
 	log.Println(q, values)

+ 17 - 17
core/src/qfw/manage/dataExport.go

@@ -41,7 +41,7 @@ func (d *DataExport) DataDetail(order_code string) error {
 	qMap["order_code"] = order_code
 	res := cutil.Mysql.FindOne("dataexport_order", qMap, "", "create_time desc")
 
-	orderStatus := util.IntAll((*res)["order_status"])
+	pay_time := util.ObjToString((*res)["pay_time"])
 	orderMoney := util.Float64All((*res)["order_money"]) / 100
 	serviceStatus := util.IntAll((*res)["service_status"])
 	downloadUrl := util.ObjToString((*res)["download_url"])
@@ -62,17 +62,23 @@ func (d *DataExport) DataDetail(order_code string) error {
 	}
 	(*res)["showOfflinePayBtn"] = false
 	(*res)["orderCode"] = order_code
-	(*res)["service_status"] = "发送失败"
+	(*res)["service_status"] = "-"
 	(*res)["product_type"] = "历史数据导出"
 	(*res)["order_money"] = orderMoney
 	(*res)["order_status"] = "未支付"
 
 	//微信订单编号
-	if (*res)["pay_way"] == "微信" {
+	if (*res)["pay_way"] == "微信" || (*res)["pay_way"] == "支付宝" {
+		table := "weixin_pay"
+		if (*res)["pay_way"] == "支付宝" {
+			table = "ali_pay"
+		}
 		wxPayMap := map[string]interface{}{}
 		wxPayMap["out_trade_no"] = (*res)["out_trade_no"]
-		wxpay := cutil.Mysql.FindOne("weixin_pay", wxPayMap, "", "create_time desc")
-		d.T["wxpay"] = *wxpay
+		wxpay := cutil.Mysql.FindOne(table, wxPayMap, "", "create_time desc")
+		if wxpay != nil {
+			d.T["transaction_id"] = util.ObjToString((*wxpay)["transaction_id"])
+		}
 	} else if (*res)["pay_way"] == "线下支付" {
 		offlinePayMap := map[string]interface{}{}
 		offlinePayMap["out_trade_no"] = (*res)["out_trade_no"]
@@ -82,25 +88,19 @@ func (d *DataExport) DataDetail(order_code string) error {
 		}
 	}
 
-	if orderStatus == 1 {
+	if pay_time != "" {
 		(*res)["order_status"] = "已支付"
 		if serviceStatus == 1 {
 			(*res)["service_status"] = "发送成功"
+		} else {
+			(*res)["service_status"] = "未发送"
 		}
 	} else {
-		if (*res)["pay_way"] != nil {
-			(*res)["order_status"] = "已支付"
-			if serviceStatus == 1 {
-				(*res)["service_status"] = "发送成功"
-			}
-		} else {
-			(*res)["order_status"] = "未支付"
-			(*res)["service_status"] = "-"
-			if util.ObjToString(d.GetSession("dataexportManager")) == "ok" { //是否显示线下支付材料上传
-				(*res)["showOfflinePayBtn"] = true
-			}
+		if util.ObjToString(d.GetSession("dataexportManager")) == "ok" { //是否显示线下支付材料上传
+			(*res)["showOfflinePayBtn"] = true
 		}
 	}
+
 	//下载链接
 	if downloadUrl != "" {
 		(*res)["download_url"] = coreconfig.SysConfig.JyWebdomain + (*res)["download_url"].(string)

+ 23 - 20
core/src/qfw/manage/dataExportOrder.go

@@ -2,6 +2,7 @@ package manage
 
 import (
 	"fmt"
+
 	"qfw/coreconfig"
 	util "qfw/coreutil"
 
@@ -32,26 +33,32 @@ func (d *DataExportOrder) Pageing() {
 		qMap["order_code"] = code
 	}
 	if order_status != "" {
-		qMap["order_status"] = order_status
+		if order_status == "0" {
+			qMap["pay_time"] = "$isNull"
+		} else if order_status == "1" {
+			qMap["pay_time"] = "$isNotNull"
+		}
 	}
 	if service_status != "" {
 		qMap["service_status"] = service_status
 	}
-	res := util.Mysql.Find("dataexport_order", qMap, "order_code,pay_time,data_spec,order_money,order_status,service_status,download_url,applybill_status,pay_money,pay_way,user_mail,applybill_company", "create_time desc", (currentPage-1)*perPage, perPage)
-	fmt.Println("res", res)
-	count := util.Mysql.Count("dataexport_order", qMap)
+	res := util.Mysql.Find("dataexport_order", qMap, "order_code,pay_time,data_spec,order_money,order_status,service_status,download_url,applybill_status,pay_money,pay_way,user_mail,applybill_company,applybill_type", "create_time desc", (currentPage-1)*perPage, perPage)
 
+	count := util.Mysql.Count("dataexport_order", qMap)
 	for k, v := range *res {
 		v["index"] = k + 1
-		if v["pay_time"] == nil {
-			v["pay_time"] = "-"
-		}
 		var y, n int64 = 1, 0
 		//申请发票
 		if v["applybill_status"] == y {
 			v["applybill_status"] = "已申请"
+			if v["applybill_type"] == n {
+				v["applybill_company"] = "个人"
+			}
 		} else if v["applybill_status"] == n || v["applybill_status"] == nil {
 			v["applybill_status"] = "未申请"
+			if v["applybill_company"] == nil {
+				v["applybill_company"] = "-"
+			}
 		}
 		//数据发送状态
 		if v["service_status"] == y {
@@ -60,28 +67,24 @@ func (d *DataExportOrder) Pageing() {
 			v["service_status"] = "发送失败"
 		}
 		//是否支付
-		if v["order_status"] == n {
+		if v["pay_time"] == nil {
 			v["order_status"] = "未支付"
 			v["service_status"] = "-"
 			v["applybill_status"] = "-"
-		} else if v["order_status"] == y {
-			v["order_status"] = "已支付"
+			v["pay_time"] = "-"
 		} else {
 			//删除用户 -1 根据支付金额判断
-			if v["pay_way"] != nil {
-				v["order_status"] = "已支付"
-			} else {
-				v["order_status"] = "未支付"
-				v["service_status"] = "-"
-				v["applybill_status"] = "-"
-			}
+			v["order_status"] = "已支付"
 		}
 		if v["download_url"] != nil {
 			v["download_url"] = coreconfig.SysConfig.JyWebdomain + v["download_url"].(string)
 		}
-		if v["applybill_company"] == nil {
-			v["applybill_company"] = "-"
-		}
+
+		/*
+			if v["applybill_company"] == nil {
+				v["applybill_company"] = "-"
+			}
+		*/
 	}
 	data := map[string]interface{}{
 		"currentPage": currentPage,

+ 3 - 5
core/src/web/templates/manage/dataExport.html

@@ -78,14 +78,12 @@
 							{{if .T.res.order_status}}
 							{{if eq .T.res.order_status "已支付"}}
 							<li class="row-list nofloat">支付时间:{{.T.res.pay_time}}</li>
-                {{if .T.wxpay.transaction_id}}
-							  <li class="row-list nofloat">微信支付单号:{{.T.wxpay.transaction_id}}</li>
-                {{else}}
-                <li class="row-list nofloat">微信支付单号:-</li>
+                {{if .T.transaction_id}}
+							  <li class="row-list nofloat">{{.T.res.pay_way}}支付单号:{{.T.transaction_id}}</li>
                 {{end}}
 							{{else}}
 							<li class="row-list nofloat">支付时间:-</li>
-							<li class="row-list nofloat">微信支付单号:-</li>
+							<li class="row-list nofloat">{{.T.res.pay_way}}支付单号:-</li>
 							{{end}}
 							{{end}}
 						</ul>

+ 20 - 2
core/src/web/templates/manage/dataExportOrder.html

@@ -24,15 +24,29 @@ width:15%;
 .table>thead>tr>th:nth-child(3){
 width:11%;	
 }
-.table>thead>tr>th:nth-child(4),.table>thead>tr>th:nth-child(6),.table>thead>tr>th:nth-child(5){
+.table>thead>tr>th:nth-child(4){
 width:10%;
 }
+.table>thead>tr>th:nth-child(5){
+	text-align:right;
+	width:6%;
+}
+.table>thead>tr>th:nth-child(6){
+	padding-left:4%;
+	width:14%;
+}
 .table>thead>tr>th:nth-child(7){
 width:20%;
 }
 .table>thead>tr>th:nth-child(8){
 width:16%;
 }
+.table>tbody>tr>td:nth-child(5){
+	text-align:right;
+}
+.table>tbody>tr>td:nth-child(6){
+	padding-left:4%;
+}
 /*
 .table>thead>tr>th:nth-child(9){
 width:10%;
@@ -53,6 +67,9 @@ overflow: hidden;
 border:0px;
 border-bottom:1px dashed #999999;
 }
+.table >tbody>tr{
+	cursor: pointer;
+}
 #_Container_0{
 background-color:#FFFFFF;
 }
@@ -109,7 +126,8 @@ $(function(){
 						//保留小数点后两位
 						var o_money =ct["order_money"]/100
 						var a = num(o_money)
-						return a
+						//return "<div style='padding-right:50%'>"+a+"</div>"
+						return a;
 						}
 					}
 		        },