2
3
lining vor 6 Jahren
Ursprung
Commit
38b0484c4d

+ 7 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplier.go

@@ -257,3 +257,10 @@ type ExpireFile struct {
 	ContactName   string
 	CreateUserId  int
 }
+
+type InterfaceData struct {
+	Id            int
+	SupplierName  string
+	RegCapital    time.Time
+	ExpireAllFile string
+}

+ 12 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplierService.go

@@ -224,3 +224,15 @@ func (s *OilSupplierService) GetExpireFile(supplierTableName, supplierFileTableN
 	return err
 }
 
+func (s *OilSupplierService) GetInterfaceData(supplierTableName, supplierFileTableName string, entitiesPtr interface{}, where string) error {
+
+	var sql string
+	sql = `SELECT a.Id, a.SupplierName, a.RegCapital, GROUP_CONCAT(b.NeedFileType SEPARATOR ';' ) NeedAllFile  `
+	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 `
+	err := s.DBE.SQL(sql).Find(entitiesPtr)
+	return err
+}
+

+ 95 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -2047,4 +2047,98 @@ func (this *OilSupplierController) GetJurisdiction() {
 	datainfo.Item = isauth
 	this.Data["json"] = &datainfo
 	this.ServeJSON()
-}
+}
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []supplier.OilSupplier
+// @router /certlistinterface  [get]
+func (this *OilSupplierController) GetEntityListInterface () {
+
+	//获取分页信息
+	page := this.GetPageInfoForm()
+	where := " 1=1 "
+	orderby := "Id"
+	asc := false
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		}
+	}
+	status := this.GetString("status")
+
+	if status == "1" {
+		where += "b.InStyle='1'"
+	}  else if status == "2" {
+		where += "b.InStyle='4'"
+	}  else if status == "3" {
+		where += "b.InStyle='5'"
+	} else if status == "4" {
+		where += "b.InStyle=''"
+	} else if status == "5" {
+		where += "b.InStyle=''"
+	}
+
+
+	//企业用户只看自己的数据记录
+	/*parameterSvc := baseparameter.GetBaseparameterService(utils.DBE) //取出外部门ID
+	extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
+	if extOrganizeId == this.User.DepartmentId {
+		where = where + " and a.CreateUserId = '" + this.User.Id + "'"
+	}*/
+	svc := supplier.GetOilSupplierService(utils.DBE)
+	var registerUser register.OilCorporateInfo
+	sql := " UserName='" + this.User.Username + "'"
+	svc.GetEntity(&registerUser,sql)
+	//企业用户必须加创建人条件
+	if this.User.IsCompanyUser == 1 {
+		where = where + " and (a.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='"+registerUser.CommercialNo+"')"
+	} else {
+		//超级管理员和有查看所有数据权限的用户不加条件
+		svcPerm := permission.GetPermissionService(utils.DBE)
+		isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
+		if !svcPerm.IsAdmin(this.User.Id) && !isauth {
+			where = where + " and b.CreateUserId = '" + this.User.Id + "'"
+		}
+
+	}
+
+
+	var list []supplier.OilSupplierView
+
+	total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
+
+	var datainfo DataInfo
+	datainfo.Items = list
+	datainfo.CurrentItemCount = total
+	datainfo.PageIndex = page.CurrentPage
+	datainfo.ItemsPerPage = page.Size
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 23 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercert.go

@@ -1437,7 +1437,30 @@ func (this *OilSupplierCertController) SendingSMSSupplierFile() {
 	fmt.Println(elapsed, "资质到期提醒")
 }
 
+// @Title 资质
+// @Description
+// @Success 200 {object} controllers.Request
+// @router /changeSupplierStatus/ [get]
+func (this *OilSupplierCertController) ChangeSupplierStatus() {
 
+	svcsupp := supplier.GetOilSupplierService(utils.DBE)
+	var interfaceData  []supplier.InterfaceData
+	where := " b.EffectDate LIKE '%" + time.Now().AddDate(0,0,-1).Format("2006-01-02") + "%'"
+	err := svcsupp.GetInterfaceData(OilSupplierName, OilSupplierFileName, &interfaceData, where)
+	var errinfo ErrorDataInfo
+	if err == nil {
+		errinfo.Message = "成功!"
+		errinfo.Code = 0
+		errinfo.Item = interfaceData
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "失败!"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
 
 
 

+ 12 - 0
src/dashoo.cn/backend/api/controllers/toolbox/toolbox.go

@@ -45,6 +45,18 @@ func TimingTask(){
 	toolbox.AddTask("myTaskSupplierFile", tkSupplierFile)
 
 
+	//  资质到期 企业改为暂停
+	tkSupplierStatus := toolbox.NewTask("myTaskSupplierStatus", "0 0 2 * * *", func() error {
+		c.ChangeSupplierStatus()
+		return nil
+	})
+	err = tkSupplierStatus.Run()
+	if err != nil {
+		fmt.Println(err)
+	}
+	toolbox.AddTask("myTaskSupplierStatus", tkSupplierStatus)
+
+
 	toolbox.StartTask()
 
 	//toolbox.StopTask()