소스 검색

前后:业务流程查询全部的分页问题;登录接口加log

dubch 4 년 전
부모
커밋
ff4e8d9908

+ 92 - 0
src/dashoo.cn/backend/api/business/oilsupplier/annualaudit/annualauditService.go

@@ -202,4 +202,96 @@ func (s *OilAnnualAuditService) GetProcessInfoWithOrderBytbl(oilAnnualAuditName
 	}
 
 	return total
+}
+
+func (s *OilAnnualAuditService) GetProcessInfoAllWithOrderBytbl(pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string, where1 string, where2 string, where3 string) {
+	//var resultsSlice []map[string][]byte
+
+	//获取总记录数
+	//sqlCount := `select count(*) from ` + oilAnnualAuditName + ` a `
+	//sqlCount += ` LEFT JOIN Base_User u ON a.CreateUserId = u.Id`
+	//sqlCount += ` Left join OilSupplier s on a.SupplierId = s.Id
+	//		 left join Base_User uu on s.CreateUserId = uu.Id
+	//		 left join OilCorporateInfo c on s.CreateUserId = c.UserId`
+	//sqlCount += ` where ` + where
+
+	var sql string
+	sql = `select a.SupplierName, b.Id,`
+	sql += ` b.Status, b.SupplierTypeCode, `
+	sql += ` b.WorkflowId, b.ProcessKey, '1' as Type,`
+	sql += ` b.CreateOn, b.AccessCardNo, b.ModifiedOn As AddinTime,`
+	sql += ` u.Realname as ContactName,`
+	sql += ` u.Telephone as Mobile,`
+	sql += ` org.FullName As RecUnitName`
+	sql += ` from OilSupplier a `
+	sql += ` left join OilSupplierCert b on b.SupplierId = a.Id`
+	sql += ` Left join Base_User u on a.CreateUserId = u.Id `
+	sql += ` LEFT JOIN Base_Organize org ON b.CommitComId = org.Id`
+	sql += ` where ` + where1
+	sql += ` union `
+
+	sql += `select a.SupplierName, a.Id, `
+	sql += ` a.Status, a.AppendType SupplierTypeCode, `
+	sql += ` a.WorkflowId, a.ProcessKey, '2' as Type, a.CreateOn, a.AccessCardNo, a.ModifiedOn as AddinTime, u.Realname AS ContactName, u.Telephone AS Mobile,`
+	sql += ` case when uu.IsCompanyUser = 1 then c.CheckUnitName
+ 				when uu.IsCompanyUser = 0 then uu.Unit
+ 				else ''
+ 			end As RecUnitName `
+	sql += ` from OilSupplierCertAppend a `
+	sql += ` LEFT JOIN Base_User u ON a.CreateUserId = u.Id`
+	sql += ` Left join OilSupplier s on a.SupplierId = s.Id
+			 left join Base_User uu on s.CreateUserId = uu.Id
+			 left join OilCorporateInfo c on s.CreateUserId = c.UserId`
+	sql += ` where ` + where2
+	sql += ` union `
+
+	sql += `select a.SupplierName, a.Id, `
+	sql += ` a.Status, a.SupplierTypeName SupplierTypeCode, `
+	sql += ` a.WorkflowId, a.ProcessKey, '3' as Type, a.CreateOn, a.AccessCardNo, a.ModifiedOn as AddinTime, u.Realname AS ContactName, u.Telephone AS Mobile,`
+	sql += ` CASE WHEN uu.IsCompanyUser = 1 THEN c.CheckUnitName
+			WHEN uu.IsCompanyUser = 0 THEN uu.Unit
+ 			ELSE ''
+ 			END AS RecUnitName`
+	sql += ` from OilAnnualAudit a `
+	sql += ` LEFT JOIN Base_User u ON a.CreateUserId = u.Id`
+	sql += ` Left join OilSupplier s on a.SupplierId = s.Id
+			 left join Base_User uu on s.CreateUserId = uu.Id
+			 left join OilCorporateInfo c on s.CreateUserId = c.UserId`
+	sql += ` where ` + where3
+	sql += ` union `
+
+	sql += `select a.SupplierName, a.Id, `
+	sql += ` a.Status,a.SupplierTypeCode, `
+	sql += ` a.WorkflowId, a.ProcessKey, '4' as Type, a.CreateOn, a.AccessCardNo, a.ModifiedOn as AddinTime, u.Realname AS ContactName, u.Telephone AS Mobile, `
+	sql += ` CASE WHEN uu.IsCompanyUser = 1 THEN c.CheckUnitName
+ 				WHEN uu.IsCompanyUser = 0 THEN uu.Unit
+ 				ELSE ''
+ 				END AS RecUnitName`
+	sql += ` from OilInfoChange a `
+	sql += ` LEFT JOIN Base_User u ON a.CreateUserId = u.Id`
+	sql += ` Left join OilSupplier s on a.SupplierId = s.Id
+			left join Base_User uu on s.CreateUserId = uu.Id
+			left join OilCorporateInfo c on s.CreateUserId = c.UserId `
+	sql += ` where ` + where
+	if asc {
+		sql += ` order by ` + orderby + ` ASC `
+	} else {
+		sql += ` order by ` + orderby + ` DESC `
+	}
+	if (pageIndex != 0 && itemsPerPage !=0) {
+		sql += ` limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage)
+	}
+	s.DBE.SQL(sql).Find(entitiesPtr)
+
+	//resultsSlice, _ = s.DBE.Query(sqlCount)
+
+	//if len(resultsSlice) > 0 {
+	//	results := resultsSlice[0]
+	//	for _, value := range results {
+	//		total, _ = strconv.ParseInt(string(value), 10, 64)
+	//		break
+	//	}
+	//}
+	//
+	//return total
 }

+ 38 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/select.go

@@ -540,7 +540,7 @@ func (this *SelectController) GetProcessAuditList() {
 			whereapp = whereapp + " and a.CreateUserId = '" + this.User.Id + "'"
 		}
 		if supplierTypeCode != "" {
-			whereapp = whereapp + " and a.AppendType like '%" + supplierTypeCode + "%'"
+			whereapp = whereapp + " and a.AppendType = '" + supplierTypeCode + "'"
 		}
 		if supplierName != "" {
 			whereapp = whereapp + " and a.SupplierName like '%" + supplierName + "%'"
@@ -630,6 +630,43 @@ func (this *SelectController) GetProcessAuditList() {
 		total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp)
 		datainfo.Items = list
 	}
+	if tabinx == "0" {
+		whereapp := "1=1 and WorkflowId != '' and WorkflowId != '0'"
+		where1 := "1=1 and WorkflowId != '' and WorkflowId != '0'"
+		where2 := "1=1 and WorkflowId != '' and WorkflowId != '0'"
+		where3 := "1=1 and WorkflowId != '' and WorkflowId != '0'"
+		//企业用户必须加创建人条件
+		if this.User.IsCompanyUser == 1 {
+			whereapp = whereapp + " and a.CreateUserId = '" + this.User.Id + "'"
+			where1 = where1 + " and a.CreateUserId = '" + this.User.Id + "'"
+			where2 = where2 + " and a.CreateUserId = '" + this.User.Id + "'"
+			where3 = where3 + " and a.CreateUserId = '" + this.User.Id + "'"
+		}
+		if supplierTypeCode != "" {
+			//whereapp = whereapp + " and a.SupplierTypeCode = '" + supplierTypeCode + "'"
+			where1 = where1 + " and b.SupplierTypeCode = '" + supplierTypeCode + "'"
+			where2 = where2 + " and a.AppendType = '" + supplierTypeCode + "'"
+			where3 = where3 + " and a.SupplierTypeName = '" + supplierTypeCode + "'"
+		}
+		if supplierName != "" {
+			whereapp = whereapp + " and a.SupplierName like '%" + supplierName + "%'"
+			where1 = where1 + " and a.SupplierName like '%" + supplierName + "%'"
+			where2 = where2 + " and a.SupplierName like '%" + supplierName + "%'"
+			where3 = where3 + " and a.SupplierName like '%" + supplierName + "%'"
+		}
+		if CreateOn != "" {
+			dates := strings.Split(CreateOn, ",")
+			if len(dates) == 2 {
+				minDate := dates[0]
+				maxDate := dates[1]
+				whereapp = whereapp + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
+			}
+		}
+		svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
+		var list []Processinfo
+		svc.GetProcessInfoAllWithOrderBytbl(page.CurrentPage, page.Size, orderby, asc, &list, whereapp, where1, where2, where3)
+		processinfolist = list
+	}
 	sort.Slice(processinfolist, func(i, j int) bool {
 		return processinfolist[i].CreateOn.Unix() > processinfolist[j].CreateOn.Unix()
 	})

+ 5 - 0
src/dashoo.cn/backend/api/controllers/token.go

@@ -8,6 +8,7 @@ import (
 	"encoding/base64"
 	"encoding/json"
 	"encoding/pem"
+	"log"
 	"os"
 	"strconv"
 	"strings"
@@ -56,7 +57,10 @@ func (this *TokenController) Post() {
 		this.Data["json"] = &userToken
 		this.ServeJSON()
 	} else {
+		log.Println("用户名 "+user4CreateToken.Username)
+		log.Println("密码 "+user4CreateToken.Password)
 		if svc.VerifyUser3DES(user4CreateToken.Username, user4CreateToken.Password, &user) {
+			log.Println("匹配成功")
 			if user4CreateToken.Username != "yanshi" {
 				//sql := " UserName='" + user4CreateToken.Username + "'"
 				var baseUser userRole.Base_User
@@ -80,6 +84,7 @@ func (this *TokenController) Post() {
 			this.Data["json"] = &userToken
 			this.ServeJSON()
 		} else {
+			log.Println("匹配失败")
 			var registerUser register.OilCorporateInfo
 			//sql := " BINARY UserName='" + user4CreateToken.Username + "' and BINARY UserPass='"+user4CreateToken.Password+"'"
 			svc.DBE.Table("OilCorporateInfo").Where("BINARY UserName=?", user4CreateToken.Username).

+ 2 - 2
src/dashoo.cn/frontend_web/src/pages/select/processselect/index.vue

@@ -15,7 +15,7 @@
         <el-form :model="searchForm" ref="searchformRef" :inline="true"
           style="float: right;position:absolute;right:15px;top:10.5px">
           <el-form-item label="企业名称">
-            <el-input size="mini" v-model="searchForm.SupplierName" placeholder="请输入内容"></el-input>
+            <el-input size="mini" v-model="searchForm.SupplierName" clearable placeholder="请输入内容"></el-input>
           </el-form-item>
           <el-form-item label="类型">
             <el-select size="mini" style="width:100px" v-model="searchForm.SupplierTypeCode" placeholder="准入类别">
@@ -92,7 +92,7 @@
             </el-table-column>
           </el-table>
           <el-pagination @size-change="handleSizeChangeAll" @current-change="handleCurrentChangeAll" :current-page="currentPage"
-                         :page-sizes="[40, 80, 120, 160, 200]" :page-size="sizeAll" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
+                         :page-sizes="[10, 50, 100, 200, 500]" :page-size="sizeAll" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
           </el-pagination>
         </el-tab-pane>
         <el-tab-pane label="准入" name="first">