|
|
@@ -1198,6 +1198,221 @@ func (this *OilSupplierController) GetJoinStoreEntityList() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
+// @Title 企业入库列表-导出
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} []supplier.OilSupplier
|
|
|
+// @router /exportStoreList [get]
|
|
|
+func (this *OilSupplierController) ExportStoreList() {
|
|
|
+
|
|
|
+ //获取分页信息
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SupplierName := this.GetString("SupplierName")
|
|
|
+ Grade := this.GetString("Grade")
|
|
|
+ SupplierTypeName := this.GetString("SupplierTypeName")
|
|
|
+ CreateOn := this.GetString("CreateOn")
|
|
|
+ SupplierTypeCode := this.GetString("SupplierTypeCode")
|
|
|
+ OperType := this.GetString("OperType")
|
|
|
+ SpecTypeCode := this.GetString("SpecTypeCode")
|
|
|
+ Country := this.GetString("Country")
|
|
|
+ InStyle := this.GetString("InStyle")
|
|
|
+ MgrUnit := this.GetString("MgrUnit")
|
|
|
+ PACNumber := this.GetString("PACNumber")
|
|
|
+ CommercialNo := this.GetString("CommercialNo")
|
|
|
+ Province := this.GetString("Province")
|
|
|
+ City := this.GetString("City")
|
|
|
+ Street := this.GetString("Street")
|
|
|
+ Address := this.GetString("Address")
|
|
|
+ LinkProvince := this.GetString("LinkProvince")
|
|
|
+ LinkCity := this.GetString("LinkCity")
|
|
|
+ LinkStreet := this.GetString("LinkStreet")
|
|
|
+ LinkAddress := this.GetString("LinkAddress")
|
|
|
+ LegalPerson := this.GetString("LegalPerson")
|
|
|
+ ContactName := this.GetString("ContactName")
|
|
|
+ CompanyType := this.GetString("CompanyType")
|
|
|
+ SetupTime := this.GetString("SetupTime")
|
|
|
+ RegCapital1 := this.GetString("RegCapital1")
|
|
|
+ RegCapital2 := this.GetString("RegCapital2")
|
|
|
+ BusinessScope := this.GetString("BusinessScope")
|
|
|
+ Code := this.GetString("Code")
|
|
|
+ InFlag := this.GetString("InFlag")
|
|
|
+
|
|
|
+ if SupplierName != "" {
|
|
|
+ where = where + " and a.SupplierName like '%" + SupplierName + "%'"
|
|
|
+ }
|
|
|
+ if Grade != "" {
|
|
|
+ where = where + " and a.Grade = '" + Grade + "'"
|
|
|
+ }
|
|
|
+ if SupplierTypeName != "" {
|
|
|
+ where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
|
|
|
+ }
|
|
|
+ if CreateOn != "" {
|
|
|
+ dates := strings.Split(CreateOn, ",")
|
|
|
+ if len(dates) == 2 {
|
|
|
+ minDate := dates[0]
|
|
|
+ maxDate := dates[1]
|
|
|
+ where = where + " and b.CreateOn>='" + minDate + "' and b.CreateOn<='" + maxDate + "'"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if SupplierTypeCode != "" {
|
|
|
+ where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
|
|
|
+ }
|
|
|
+ if OperType != "" {
|
|
|
+ where = where + " and a.OperType like '%" + OperType + "%'"
|
|
|
+ }
|
|
|
+ if SpecTypeCode != "" {
|
|
|
+ where = where + " and a.SpecTypeCode = '" + SpecTypeCode + "'"
|
|
|
+ }
|
|
|
+ if Country != "" {
|
|
|
+ where = where + " and a.Country like '%" + Country + "%'"
|
|
|
+ }
|
|
|
+ if InStyle != "" {
|
|
|
+ where = where + " and b.InStyle ='" + InStyle + "'"
|
|
|
+ }
|
|
|
+ if MgrUnit != "" {
|
|
|
+ where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
|
|
|
+ }
|
|
|
+ if PACNumber != "" {
|
|
|
+ where = where + " and a.PACNumber ='" + PACNumber + "'"
|
|
|
+ }
|
|
|
+ if CommercialNo != "" {
|
|
|
+ where = where + " and a.CommercialNo ='" + CommercialNo + "'"
|
|
|
+ }
|
|
|
+ if Province != "" {
|
|
|
+ where = where + " and a.Province ='" + Province + "'"
|
|
|
+ }
|
|
|
+ if City != "" {
|
|
|
+ where = where + " and a.City ='" + City + "'"
|
|
|
+ }
|
|
|
+ if Street != "" {
|
|
|
+ where = where + " and a.Street ='" + Street + "'"
|
|
|
+ }
|
|
|
+ if Address != "" {
|
|
|
+ where = where + " and a.Address ='" + Address + "'"
|
|
|
+ }
|
|
|
+ if LinkProvince != "" {
|
|
|
+ where = where + " and a.LinkProvince ='" + LinkProvince + "'"
|
|
|
+ }
|
|
|
+ if LinkCity != "" {
|
|
|
+ where = where + " and a.LinkCity ='" + LinkCity + "'"
|
|
|
+ }
|
|
|
+ if LinkStreet != "" {
|
|
|
+ where = where + " and a.LinkStreet ='" + LinkStreet + "'"
|
|
|
+ }
|
|
|
+ if LinkAddress != "" {
|
|
|
+ where = where + " and a.LinkAddress ='" + LinkAddress + "'"
|
|
|
+ }
|
|
|
+ if LegalPerson != "" {
|
|
|
+ where = where + " and a.LegalPerson ='" + LegalPerson + "'"
|
|
|
+ }
|
|
|
+ if ContactName != "" {
|
|
|
+ where = where + " and a.ContactName ='" + ContactName + "'"
|
|
|
+ }
|
|
|
+ if CompanyType != "" {
|
|
|
+ where = where + " and a.CompanyType like '%" + CompanyType + "%'"
|
|
|
+ }
|
|
|
+ if SetupTime != "" {
|
|
|
+ where = where + " and a.SetupTime ='" + SetupTime + "'"
|
|
|
+ }
|
|
|
+ //注册资金范围
|
|
|
+ if RegCapital1 != "" {
|
|
|
+ where = where + " and a.RegCapital >= '" + RegCapital1 + "'"
|
|
|
+ }
|
|
|
+ if RegCapital2 != "" {
|
|
|
+ where = where + " and a.RegCapital <= '" + RegCapital2 + "'"
|
|
|
+ }
|
|
|
+ if BusinessScope != "" {
|
|
|
+ where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
|
|
|
+ }
|
|
|
+ status := this.GetString("Status")
|
|
|
+
|
|
|
+ if status != "" {
|
|
|
+ where = where + " and b.Status='" + status + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if InFlag != "" {
|
|
|
+ where = where + " and b.InFlag='" + InFlag + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ //企业用户只看自己的数据记录
|
|
|
+ /*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 + "'"
|
|
|
+ }*/
|
|
|
+
|
|
|
+ //企业用户必须加创建人条件
|
|
|
+ if this.User.IsCompanyUser == 1 {
|
|
|
+ where = where + " and a.CreateUserId = '" + this.User.Id + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ svc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ var list []supplier.OilSupplierView
|
|
|
+ var Ids supplier.OilCertIds
|
|
|
+
|
|
|
+ if Code != "" {
|
|
|
+ where1 := " SupplierTypeCode = '" + SupplierTypeCode + "' and Code like '" + Code + "%'"
|
|
|
+ svc.GetCertIds(&Ids, where1)
|
|
|
+ }
|
|
|
+
|
|
|
+ svc.GetMyPagingEntitiesWithOrderBytbl2(OilSupplierName, OilSupplierCertName, 1, 5000, orderby, asc, &list, where, Code, Ids.Ids)
|
|
|
+
|
|
|
+ fileTitle := "已入库"
|
|
|
+ showColumnArr := "序号,准入标识,准入证编号,准入类别,企业名称,有效期,工商注册号,省市县,单位地址,注册资本,币种,联系人姓名,公司类型,成立时间,开户银行,银行账号,电子邮箱,银行信用等级,移动电话,固定电话,传真,公司电话,备注"
|
|
|
+
|
|
|
+ f := xlsx.NewFile()
|
|
|
+ sheet, _ := f.AddSheet(fileTitle)
|
|
|
+ cellName := strings.Split(showColumnArr, ",")
|
|
|
+ row := sheet.AddRow()
|
|
|
+ row.WriteSlice(&cellName, -1)
|
|
|
+
|
|
|
+ for idx, item := range list {
|
|
|
+ regCapital := strconv.FormatFloat(item.RegCapital, 'f', 2, 64)
|
|
|
+ inStyle := ""
|
|
|
+ if item.InFlag == "1" {
|
|
|
+ inStyle = "准入"
|
|
|
+ } else if item.InFlag == "2" {
|
|
|
+ inStyle = "暂停"
|
|
|
+ } else if item.InFlag == "3" {
|
|
|
+ inStyle = "取消"
|
|
|
+ }
|
|
|
+ dataString := strconv.Itoa(idx+1) + "," + inStyle + "," + item.AccessCardNo + "," + item.SupplierTypeName + "," + item.SupplierName + "," +
|
|
|
+ utils.ToStr(item.ApplyTime.Format("2006-01-02")) + "," + item.CommercialNo + "," + item.AllAddress + "," + item.Address + "," + regCapital + "," + item.Currency + "," + item.ContactName + "," + item.CompanyType + "," + utils.ToStr(item.SetupTime.Format("2006-01-02")) + "," + item.DepositBank + "," + item.BankAccount + "," + item.EMail + "," + item.BankCreditRating + "," + item.Mobile + "," + item.Telphone + "," + item.Fax + "," + item.CompanyTel + "," + item.Remark
|
|
|
+ cellName := strings.Split(dataString, ",")
|
|
|
+ row := sheet.AddRow()
|
|
|
+ row.WriteSlice(&cellName, -1)
|
|
|
+ }
|
|
|
+ for c, cl := 0, len(sheet.Cols); c < cl; c++ {
|
|
|
+ sheet.Cols[c].Width = 20
|
|
|
+ }
|
|
|
+ dir := "static/file/excel/report/" + this.GetAccode()
|
|
|
+ SaveDirectory(dir)
|
|
|
+ path := dir + "/" + utils.TimeFormat(time.Now(), "20060102") + fileTitle + ".xlsx"
|
|
|
+ f.Save(path)
|
|
|
+ var sw *Seaweed
|
|
|
+ var filer []string
|
|
|
+ if _filer := os.Getenv("GOSWFS_FILER_URL"); _filer != "" {
|
|
|
+ filer = []string{_filer}
|
|
|
+ }
|
|
|
+ sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
|
|
|
+ _, _, fID, _ := sw.UploadFile(path, "", "")
|
|
|
+
|
|
|
+ retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
|
|
|
+ os.Remove(path)
|
|
|
+ fmt.Println("==retDocWatermarkUrl==", retDocUrl)
|
|
|
+ this.Data["json"] = retDocUrl
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
// @Title 获取列表
|
|
|
// @Description get user by token
|
|
|
// @Success 200 {object} []supplier.OilSupplierView
|