2
3
Quellcode durchsuchen

定时任务bug

lining vor 6 Jahren
Ursprung
Commit
fc4296bc58

+ 16 - 8
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplier.go

@@ -329,13 +329,20 @@ type OilSupplierApply struct {
 }
 
 type ExpireFile struct {
-	Id            int
-	SupplierName  string
-	Mobile        string
-	NeedAllFile   string
-	CreateBy      string
-	ContactName   string
-	CreateUserId  int
+	Id           int
+	SupplierName string
+	Mobile       string
+	NeedAllFile  string
+	CreateBy     string
+	ContactName  string
+	CreateUserId int
+}
+
+type ExpireFileList struct {
+	Id               int
+	SupplierName     string
+	Mobile           string
+	SupplierTypeCode string
 }
 
 type InterfaceData struct {
@@ -427,7 +434,8 @@ type OilSupplierInte struct {
 	JFsub        []OilSupplierCertSubInte // 技术服务类
 	JSsub        []OilSupplierCertSubInte // 基建类
 }
+
 const (
 	// 管理单位
 	MGRUNIT string = "大港油田分公司"
-	)
+)

+ 13 - 1
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplierService.go

@@ -215,7 +215,7 @@ func (s *OilSupplierService) GetMyTodoEntitie(supplierTableName, supplierCertTab
 func (s *OilSupplierService) GetExpireFile(supplierTableName, supplierFileTableName string, entitiesPtr interface{}, where string) error {
 
 	var sql string
-	sql = `SELECT a.Id, a.SupplierName, a.Mobile, a.CreateBy, a.ContactName, a.CreateUserId, GROUP_CONCAT(b.NeedFileType SEPARATOR ';' ) NeedAllFile  `
+	sql = `SELECT a.Id, a.SupplierName, a.Mobile, b.SupplierTypeCode,a.CreateBy, a.ContactName, a.CreateUserId, GROUP_CONCAT(b.NeedFileType SEPARATOR ';' ) NeedAllFile  `
 	sql += ` FROM ` + supplierTableName + ` a `
 	sql += ` left join ` + supplierFileTableName + " b ON a.Id=b.SupplierId "
 	sql += ` where ` + where
@@ -224,6 +224,18 @@ func (s *OilSupplierService) GetExpireFile(supplierTableName, supplierFileTableN
 	return err
 }
 
+func (s *OilSupplierService) GetExpireFileList(supplierTableName, supplierFileTableName string, entitiesPtr interface{}, where string) error {
+
+	var sql string
+	sql = `SELECT a.Id, a.SupplierName, a.Mobile, b.SupplierTypeCode`
+	sql += ` FROM ` + supplierTableName + ` a `
+	sql += ` left join ` + supplierFileTableName + " b ON a.Id=b.SupplierId "
+	sql += ` where ` + where
+	sql += ` GROUP BY a.Id, a.SupplierName, a.Mobile, b.SupplierTypeCode `
+	err := s.DBE.SQL(sql).Find(entitiesPtr)
+	return err
+}
+
 func (s *OilSupplierService) GetInterfaceData(supplierTableName, supplierFileTableName string, entitiesPtr interface{}, where string) error {
 
 	var sql string

+ 6 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercert.go

@@ -1710,9 +1710,9 @@ func (this *OilSupplierCertController) SendingSMSSupplierFile() {
 func (this *OilSupplierCertController) ChangeSupplierStatus() {
 
 	svcsupp := supplier.GetOilSupplierService(utils.DBE)
-	var fileData []supplier.ExpireFile
+	var fileData []supplier.ExpireFileList
 	where := " b.EffectDate LIKE '%" + time.Now().AddDate(0, 0, -1).Format("2006-01-02") + "%'"
-	svcsupp.GetExpireFile(OilSupplierName, OilSupplierFileName, &fileData, where)
+	svcsupp.GetExpireFileList(OilSupplierName, OilSupplierFileName, &fileData, where)
 
 	for _, item := range fileData {
 		var sert suppliercert.OilSupplierCert
@@ -1720,7 +1720,10 @@ func (this *OilSupplierCertController) ChangeSupplierStatus() {
 			"InFlag",
 		}
 		sert.InFlag = "2"
-		where := "SupplierId=" + strconv.Itoa(item.Id) + " AND b.InFlag = '1'"
+		where := "SupplierId=" + strconv.Itoa(item.Id) + " AND InFlag = '1'"
+		if item.SupplierTypeCode != "000" {
+			where = where + " and SupplierTypeCode='" + item.SupplierTypeCode +"'"
+		}
 		svcsupp.UpdateEntityBywheretbl(OilSupplierCertName, &sert, cols, where)
 	}