初始
This commit is contained in:
13
internal/app/boot/boot.go
Normal file
13
internal/app/boot/boot.go
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* @desc:启动
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/9/23 15:55
|
||||
*/
|
||||
|
||||
package boot
|
||||
|
||||
import (
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic"
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/system/logic"
|
||||
)
|
5
internal/app/boot/test.go
Normal file
5
internal/app/boot/test.go
Normal file
@ -0,0 +1,5 @@
|
||||
package boot
|
||||
|
||||
import (
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/test/logic"
|
||||
)
|
5
internal/app/boot/wxApplet.go
Normal file
5
internal/app/boot/wxApplet.go
Normal file
@ -0,0 +1,5 @@
|
||||
package boot
|
||||
|
||||
import (
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/wxApplet/logic"
|
||||
)
|
21
internal/app/common/consts/cache.go
Normal file
21
internal/app/common/consts/cache.go
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @desc:缓存相关
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu
|
||||
* @Date: 2022/3/9 11:25
|
||||
*/
|
||||
|
||||
package consts
|
||||
|
||||
const (
|
||||
CacheModelMem = "memory"
|
||||
CacheModelRedis = "redis"
|
||||
|
||||
// CacheSysDict 字典缓存菜单KEY
|
||||
CacheSysDict = "sysDict"
|
||||
|
||||
// CacheSysDictTag 字典缓存标签
|
||||
CacheSysDictTag = "sysDictTag"
|
||||
// CacheSysConfigTag 系统参数配置
|
||||
CacheSysConfigTag = "sysConfigTag"
|
||||
)
|
8
internal/app/common/consts/consts.go
Normal file
8
internal/app/common/consts/consts.go
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* @desc:常量
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/3/30 11:54
|
||||
*/
|
||||
|
||||
package consts
|
11
internal/app/common/consts/upload.go
Normal file
11
internal/app/common/consts/upload.go
Normal file
@ -0,0 +1,11 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
UploadPath = "upload_file"
|
||||
ImgTypeKey = "sys.uploadFile.imageType"
|
||||
ImgSizeKey = "sys.uploadFile.imageSize"
|
||||
FileTypeKey = "sys.uploadFile.fileType"
|
||||
FileSizeKey = "sys.uploadFile.fileSize"
|
||||
CheckFileTypeImg = "img" // 文件类型(图片)
|
||||
CheckFileTypeFile = "file" // 文件类型(任意)
|
||||
)
|
19
internal/app/common/controller/base.go
Normal file
19
internal/app/common/controller/base.go
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* @desc:
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu
|
||||
* @Date: 2022/3/4 18:19
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
)
|
||||
|
||||
type BaseController struct {
|
||||
}
|
||||
|
||||
// Init 自动执行的初始化方法
|
||||
func (c *BaseController) Init(r *ghttp.Request) {
|
||||
}
|
118
internal/app/common/controller/bususer.go
Normal file
118
internal/app/common/controller/bususer.go
Normal file
@ -0,0 +1,118 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/common/coryCommon"
|
||||
busFolderFile "github.com/tiger1103/gfast/v3/internal/app/system/logic/busFolderFile"
|
||||
ct "github.com/tiger1103/gfast/v3/internal/app/system/logic/context"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/wxApplet/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/wxApplet/model"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
// CommmonUpdateFile 修改施工人员图片/文件信息
|
||||
func CommmonUpdateFile(ctx context.Context, filesListReq []*model.BusConstructionUserFileListRes, id int64, wxOrPc string, openid string, projectId int64) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
// 4、批量修改身份证等图片数据
|
||||
if filesListReq != nil && id != 0 {
|
||||
listReq := filesListReq
|
||||
for i := range listReq {
|
||||
//根据id+图片类型插入数据,如果数据存在则修改
|
||||
//if wxOrPc != "1" {
|
||||
// var str = ""
|
||||
// busfile := strings.Split(listReq[i].Path, ",")
|
||||
// for _, imgData := range busfile {
|
||||
// str = str + strings.Replace(imgData, "file", "wxfile", 1) + ","
|
||||
// }
|
||||
// listReq[i].Path = str[0 : len(str)-1]
|
||||
//}
|
||||
_, err = dao.BusConstructionUserFile.Ctx(ctx).WherePri(listReq[i].Id).Update(listReq[i])
|
||||
// 5、将图片信息添加到图库中
|
||||
pe := strings.Split(listReq[i].Path, ",")
|
||||
zjId := strconv.FormatUint(ct.New().GetLoginUser(ctx).Id, 10)
|
||||
if wxOrPc != "1" {
|
||||
zjId = openid
|
||||
for i, imgData := range pe {
|
||||
pe[i] = strings.Replace(imgData, "file", "wxfile", 1)
|
||||
}
|
||||
}
|
||||
// 判断是否是图片,不是就不允许进入图库
|
||||
for i, imgData := range pe {
|
||||
re := regexp.MustCompile(`(?i)\.(` + coryCommon.PictureSuffix + `)$`)
|
||||
match := re.FindString(imgData)
|
||||
if match != "" {
|
||||
err = busFolderFile.New().AllPicture(
|
||||
ctx,
|
||||
pe,
|
||||
3,
|
||||
dao.BusConstructionUserFile.Table(),
|
||||
listReq[i].Id,
|
||||
wxOrPc,
|
||||
zjId,
|
||||
"",
|
||||
projectId,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// @Title BatchUpdateTheOpenidsOfIndividualTables 2024/4/26 15:07:00
|
||||
// @Description 批量更新各个表的openid (原因是最开始账号的openid是微信开发生成的,如果当前账号进入过了小程序那就根据小程序的微信openid来)
|
||||
// @Auth Cory
|
||||
// @param openid ---> "openid"
|
||||
// @Return error ---> "错误信息"
|
||||
func BatchUpdateTheOpenidsOfIndividualTables(ctx context.Context, openid string) (err error) {
|
||||
err = g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
tableNmaes := []string{
|
||||
"bus_attendance",
|
||||
"bus_complaint_box",
|
||||
"bus_constructiom_user_signature",
|
||||
"bus_construction_blacklist",
|
||||
"bus_question_offline",
|
||||
"bus_question_save",
|
||||
"bus_question_save_pdf",
|
||||
"bus_reissue_a_card",
|
||||
"bus_violation_record",
|
||||
"sys_project_team_member",
|
||||
"user_registration",
|
||||
"bus_askforleave",
|
||||
}
|
||||
// 1、批量修改对应表字段
|
||||
for i := range tableNmaes {
|
||||
err = updateFunc(ctx, tableNmaes[i], openid)
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
// 2、站班会不一样,单独写sql sys_project_team_squad
|
||||
sql := `UPDATE sys_project_team_squad set participant_id = REPLACE(participant_id,participant_id,` + "'" + openid + "'" + `) WHERE participant_id like '%` + openid + `%'`
|
||||
_, err = g.DB().Exec(ctx, sql)
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
_, err = g.DB().Model("sys_project_team_squad").Ctx(ctx).Unscoped().Where("compere_id", openid).Update(g.Map{"compere_id": openid})
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
return
|
||||
})
|
||||
return err
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func updateFunc(ctx context.Context, tableName string, openid string) (err error) {
|
||||
op := "openid"
|
||||
_, err = g.DB().Model(tableName).Ctx(ctx).Unscoped().Where(op, openid).Update(g.Map{op: openid})
|
||||
return
|
||||
}
|
32
internal/app/common/controller/captcha.go
Normal file
32
internal/app/common/controller/captcha.go
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* @desc:验证码获取
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu
|
||||
* @Date: 2022/3/2 17:45
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/common"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
)
|
||||
|
||||
var Captcha = captchaController{}
|
||||
|
||||
type captchaController struct {
|
||||
}
|
||||
|
||||
// Get 获取验证码
|
||||
func (c *captchaController) Get(ctx context.Context, req *common.CaptchaReq) (res *common.CaptchaRes, err error) {
|
||||
var (
|
||||
idKeyC, base64stringC string
|
||||
)
|
||||
idKeyC, base64stringC, err = service.Captcha().GetVerifyImgString(ctx)
|
||||
res = &common.CaptchaRes{
|
||||
Key: idKeyC,
|
||||
Img: base64stringC,
|
||||
}
|
||||
return
|
||||
}
|
26
internal/app/common/controller/design.go
Normal file
26
internal/app/common/controller/design.go
Normal file
@ -0,0 +1,26 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
// AuditEntityReq 审核请求参数
|
||||
type AuditEntityReq struct {
|
||||
TableName string `p:"table_name" dc:"表名"`
|
||||
TableId string `p:"table_id" dc:"表ID"`
|
||||
ProjectId int64 `p:"projectId"`
|
||||
}
|
||||
|
||||
// AuditDataListCommon 设计审核列表
|
||||
func AuditDataListCommon(ctx context.Context, audit *AuditEntityReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
dao.DocumentCompletion.Ctx(ctx).Where("")
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 根据当前数据的项目id递归推断出根目录id
|
24
internal/app/common/dao/casbin_rule.go
Normal file
24
internal/app/common/dao/casbin_rule.go
Normal file
@ -0,0 +1,24 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/dao/internal"
|
||||
)
|
||||
|
||||
// casbinRuleDao is the data access object for table casbin_rule.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type casbinRuleDao struct {
|
||||
*internal.CasbinRuleDao
|
||||
}
|
||||
|
||||
var (
|
||||
// CasbinRule is globally public accessible object for table casbin_rule operations.
|
||||
CasbinRule = casbinRuleDao{
|
||||
internal.NewCasbinRuleDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
84
internal/app/common/dao/internal/casbin_rule.go
Normal file
84
internal/app/common/dao/internal/casbin_rule.go
Normal file
@ -0,0 +1,84 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// CasbinRuleDao is the data access object for table casbin_rule.
|
||||
type CasbinRuleDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns CasbinRuleColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// CasbinRuleColumns defines and stores column names for table casbin_rule.
|
||||
type CasbinRuleColumns struct {
|
||||
Ptype string //
|
||||
V0 string //
|
||||
V1 string //
|
||||
V2 string //
|
||||
V3 string //
|
||||
V4 string //
|
||||
V5 string //
|
||||
}
|
||||
|
||||
// casbinRuleColumns holds the columns for table casbin_rule.
|
||||
var casbinRuleColumns = CasbinRuleColumns{
|
||||
Ptype: "ptype",
|
||||
V0: "v0",
|
||||
V1: "v1",
|
||||
V2: "v2",
|
||||
V3: "v3",
|
||||
V4: "v4",
|
||||
V5: "v5",
|
||||
}
|
||||
|
||||
// NewCasbinRuleDao creates and returns a new DAO object for table data access.
|
||||
func NewCasbinRuleDao() *CasbinRuleDao {
|
||||
return &CasbinRuleDao{
|
||||
group: "default",
|
||||
table: "casbin_rule",
|
||||
columns: casbinRuleColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *CasbinRuleDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *CasbinRuleDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *CasbinRuleDao) Columns() CasbinRuleColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *CasbinRuleDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *CasbinRuleDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *CasbinRuleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
90
internal/app/common/dao/internal/sys_config.go
Normal file
90
internal/app/common/dao/internal/sys_config.go
Normal file
@ -0,0 +1,90 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-18 21:09:17
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysConfigDao is the data access object for table sys_config.
|
||||
type SysConfigDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns SysConfigColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysConfigColumns defines and stores column names for table sys_config.
|
||||
type SysConfigColumns struct {
|
||||
ConfigId string // 参数主键
|
||||
ConfigName string // 参数名称
|
||||
ConfigKey string // 参数键名
|
||||
ConfigValue string // 参数键值
|
||||
ConfigType string // 系统内置(Y是 N否)
|
||||
CreateBy string // 创建者
|
||||
UpdateBy string // 更新者
|
||||
Remark string // 备注
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// sysConfigColumns holds the columns for table sys_config.
|
||||
var sysConfigColumns = SysConfigColumns{
|
||||
ConfigId: "config_id",
|
||||
ConfigName: "config_name",
|
||||
ConfigKey: "config_key",
|
||||
ConfigValue: "config_value",
|
||||
ConfigType: "config_type",
|
||||
CreateBy: "create_by",
|
||||
UpdateBy: "update_by",
|
||||
Remark: "remark",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysConfigDao creates and returns a new DAO object for table data access.
|
||||
func NewSysConfigDao() *SysConfigDao {
|
||||
return &SysConfigDao{
|
||||
group: "default",
|
||||
table: "sys_config",
|
||||
columns: sysConfigColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysConfigDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysConfigDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysConfigDao) Columns() SysConfigColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysConfigDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysConfigDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
98
internal/app/common/dao/internal/sys_dict_data.go
Normal file
98
internal/app/common/dao/internal/sys_dict_data.go
Normal file
@ -0,0 +1,98 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysDictDataDao is the data access object for table sys_dict_data.
|
||||
type SysDictDataDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns SysDictDataColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysDictDataColumns defines and stores column names for table sys_dict_data.
|
||||
type SysDictDataColumns struct {
|
||||
DictCode string // 字典编码
|
||||
DictSort string // 字典排序
|
||||
DictLabel string // 字典标签
|
||||
DictValue string // 字典键值
|
||||
DictType string // 字典类型
|
||||
CssClass string // 样式属性(其他样式扩展)
|
||||
ListClass string // 表格回显样式
|
||||
IsDefault string // 是否默认(1是 0否)
|
||||
Status string // 状态(0正常 1停用)
|
||||
CreateBy string // 创建者
|
||||
UpdateBy string // 更新者
|
||||
Remark string // 备注
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// sysDictDataColumns holds the columns for table sys_dict_data.
|
||||
var sysDictDataColumns = SysDictDataColumns{
|
||||
DictCode: "dict_code",
|
||||
DictSort: "dict_sort",
|
||||
DictLabel: "dict_label",
|
||||
DictValue: "dict_value",
|
||||
DictType: "dict_type",
|
||||
CssClass: "css_class",
|
||||
ListClass: "list_class",
|
||||
IsDefault: "is_default",
|
||||
Status: "status",
|
||||
CreateBy: "create_by",
|
||||
UpdateBy: "update_by",
|
||||
Remark: "remark",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysDictDataDao creates and returns a new DAO object for table data access.
|
||||
func NewSysDictDataDao() *SysDictDataDao {
|
||||
return &SysDictDataDao{
|
||||
group: "default",
|
||||
table: "sys_dict_data",
|
||||
columns: sysDictDataColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysDictDataDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysDictDataDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysDictDataDao) Columns() SysDictDataColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysDictDataDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysDictDataDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysDictDataDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
88
internal/app/common/dao/internal/sys_dict_type.go
Normal file
88
internal/app/common/dao/internal/sys_dict_type.go
Normal file
@ -0,0 +1,88 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysDictTypeDao is the data access object for table sys_dict_type.
|
||||
type SysDictTypeDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns SysDictTypeColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysDictTypeColumns defines and stores column names for table sys_dict_type.
|
||||
type SysDictTypeColumns struct {
|
||||
DictId string // 字典主键
|
||||
DictName string // 字典名称
|
||||
DictType string // 字典类型
|
||||
Status string // 状态(0正常 1停用)
|
||||
CreateBy string // 创建者
|
||||
UpdateBy string // 更新者
|
||||
Remark string // 备注
|
||||
CreatedAt string // 创建日期
|
||||
UpdatedAt string // 修改日期
|
||||
}
|
||||
|
||||
// sysDictTypeColumns holds the columns for table sys_dict_type.
|
||||
var sysDictTypeColumns = SysDictTypeColumns{
|
||||
DictId: "dict_id",
|
||||
DictName: "dict_name",
|
||||
DictType: "dict_type",
|
||||
Status: "status",
|
||||
CreateBy: "create_by",
|
||||
UpdateBy: "update_by",
|
||||
Remark: "remark",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysDictTypeDao creates and returns a new DAO object for table data access.
|
||||
func NewSysDictTypeDao() *SysDictTypeDao {
|
||||
return &SysDictTypeDao{
|
||||
group: "default",
|
||||
table: "sys_dict_type",
|
||||
columns: sysDictTypeColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysDictTypeDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysDictTypeDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysDictTypeDao) Columns() SysDictTypeColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysDictTypeDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysDictTypeDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysDictTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
24
internal/app/common/dao/sys_config.go
Normal file
24
internal/app/common/dao/sys_config.go
Normal file
@ -0,0 +1,24 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/dao/internal"
|
||||
)
|
||||
|
||||
// sysConfigDao is the data access object for table sys_config.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysConfigDao struct {
|
||||
*internal.SysConfigDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysConfig is globally public accessible object for table sys_config operations.
|
||||
SysConfig = sysConfigDao{
|
||||
internal.NewSysConfigDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
24
internal/app/common/dao/sys_dict_data.go
Normal file
24
internal/app/common/dao/sys_dict_data.go
Normal file
@ -0,0 +1,24 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/dao/internal"
|
||||
)
|
||||
|
||||
// sysDictDataDao is the data access object for table sys_dict_data.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysDictDataDao struct {
|
||||
*internal.SysDictDataDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysDictData is globally public accessible object for table sys_dict_data operations.
|
||||
SysDictData = sysDictDataDao{
|
||||
internal.NewSysDictDataDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
24
internal/app/common/dao/sys_dict_type.go
Normal file
24
internal/app/common/dao/sys_dict_type.go
Normal file
@ -0,0 +1,24 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/dao/internal"
|
||||
)
|
||||
|
||||
// sysDictTypeDao is the data access object for table sys_dict_type.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysDictTypeDao struct {
|
||||
*internal.SysDictTypeDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysDictType is globally public accessible object for table sys_dict_type operations.
|
||||
SysDictType = sysDictTypeDao{
|
||||
internal.NewSysDictTypeDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
71
internal/app/common/logic/bigUpload/big_upload.go
Normal file
71
internal/app/common/logic/bigUpload/big_upload.go
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* @desc:大文件上传
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/9/27 16:25
|
||||
*/
|
||||
|
||||
package bigUpload
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
"github.com/tiger1103/gfast/v3/library/upload_chunk"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterBigUpload(New())
|
||||
}
|
||||
|
||||
func New() *sBigUpload {
|
||||
return &sBigUpload{}
|
||||
}
|
||||
|
||||
type sBigUpload struct{}
|
||||
|
||||
// Upload 上传分片文件
|
||||
func (s *sBigUpload) Upload(ctx context.Context, req *system.BigUploadReq) (res *system.BigUploadRes, err error) {
|
||||
uploadChunk := &upload_chunk.UploadChunk{}
|
||||
result, err := uploadChunk.Upload(req.UploadReq)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = new(system.BigUploadRes)
|
||||
res.UpLoadRes = *result
|
||||
return
|
||||
}
|
||||
|
||||
// UploadCheck 上传文件检查
|
||||
func (s *sBigUpload) UploadCheck(ctx context.Context, req *system.BigUploadCheckReq) (res *system.BigUploadCheckRes, err error) {
|
||||
uploadChunk := &upload_chunk.UploadChunk{}
|
||||
result, err := uploadChunk.CheckChunk(req.UploadReq)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &system.BigUploadCheckRes{
|
||||
CheckRes: *result,
|
||||
Identifier: req.Identifier,
|
||||
TotalChunks: req.TotalChunks,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UploadMerge 上传文件合并
|
||||
func (s *sBigUpload) UploadMerge(ctx context.Context, req *system.BigUploadMergeReq) (res *system.BigUploadRes, err error) {
|
||||
uploadChunk := &upload_chunk.UploadChunk{}
|
||||
result, err := uploadChunk.MergeChunk(req.UploadReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &system.BigUploadRes{
|
||||
UpLoadRes: upload_chunk.UpLoadRes{
|
||||
BaseRes: result.BaseRes,
|
||||
NeedMerge: false,
|
||||
Identifier: req.Identifier,
|
||||
TotalChunks: req.TotalChunks,
|
||||
},
|
||||
}
|
||||
|
||||
return
|
||||
}
|
45
internal/app/common/logic/cache/cache.go
vendored
Normal file
45
internal/app/common/logic/cache/cache.go
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* @desc:缓存处理
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/9/27 16:33
|
||||
*/
|
||||
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/tiger1103/gfast-cache/cache"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/consts"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterCache(New())
|
||||
}
|
||||
|
||||
func New() *sCache {
|
||||
var (
|
||||
ctx = gctx.New()
|
||||
cacheContainer *cache.GfCache
|
||||
)
|
||||
prefix := g.Cfg().MustGet(ctx, "system.cache.prefix").String()
|
||||
model := g.Cfg().MustGet(ctx, "system.cache.model").String()
|
||||
if model == consts.CacheModelRedis {
|
||||
// redis
|
||||
cacheContainer = cache.NewRedis(prefix)
|
||||
} else {
|
||||
// memory
|
||||
cacheContainer = cache.New(prefix)
|
||||
}
|
||||
return &sCache{
|
||||
GfCache: cacheContainer,
|
||||
prefix: prefix,
|
||||
}
|
||||
}
|
||||
|
||||
type sCache struct {
|
||||
*cache.GfCache
|
||||
prefix string
|
||||
}
|
76
internal/app/common/logic/captcha/captcha.go
Normal file
76
internal/app/common/logic/captcha/captcha.go
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* @desc:验证码处理
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/9/28 9:01
|
||||
*/
|
||||
|
||||
package captcha
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"github.com/mojocn/base64Captcha"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterCaptcha(New())
|
||||
}
|
||||
|
||||
func New() *sCaptcha {
|
||||
return &sCaptcha{
|
||||
driver: &base64Captcha.DriverString{
|
||||
//Height: 80,
|
||||
//Width: 240,
|
||||
Height: 100,
|
||||
Width: 260,
|
||||
NoiseCount: 50,
|
||||
ShowLineOptions: 20,
|
||||
Length: 4,
|
||||
Source: "0123456789",
|
||||
//Length: 4,
|
||||
//Source: "abcdefghjkmnpqrstuvwxyz23456789",
|
||||
Fonts: []string{"chromohv.ttf"},
|
||||
},
|
||||
store: base64Captcha.DefaultMemStore,
|
||||
}
|
||||
}
|
||||
|
||||
type sCaptcha struct {
|
||||
driver *base64Captcha.DriverString
|
||||
store base64Captcha.Store
|
||||
}
|
||||
|
||||
var (
|
||||
captcha = sCaptcha{
|
||||
driver: &base64Captcha.DriverString{
|
||||
Height: 100,
|
||||
Width: 260,
|
||||
NoiseCount: 50,
|
||||
ShowLineOptions: 20,
|
||||
Length: 4,
|
||||
Source: "0123456789",
|
||||
//Length: 4,
|
||||
//Source: "abcdefghjkmnpqrstuvwxyz23456789",
|
||||
Fonts: []string{"chromohv.ttf"},
|
||||
},
|
||||
store: base64Captcha.DefaultMemStore,
|
||||
}
|
||||
)
|
||||
|
||||
// GetVerifyImgString 获取字母数字混合验证码
|
||||
func (s *sCaptcha) GetVerifyImgString(ctx context.Context) (idKeyC string, base64stringC string, err error) {
|
||||
driver := s.driver.ConvertFonts()
|
||||
c := base64Captcha.NewCaptcha(driver, s.store)
|
||||
//idKeyC, base64stringC, _, err = c.Generate()
|
||||
idKeyC, base64stringC, err = c.Generate()
|
||||
return
|
||||
}
|
||||
|
||||
// VerifyString 验证输入的验证码是否正确
|
||||
func (s *sCaptcha) VerifyString(id, answer string) bool {
|
||||
c := base64Captcha.NewCaptcha(s.driver, s.store)
|
||||
answer = gstr.ToLower(answer)
|
||||
return c.Verify(id, answer, true)
|
||||
}
|
16
internal/app/common/logic/logic.go
Normal file
16
internal/app/common/logic/logic.go
Normal file
@ -0,0 +1,16 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package logic
|
||||
|
||||
import (
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/bigUpload"
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/cache"
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/captcha"
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/middleware"
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/sysConfig"
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/sysDictData"
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/sysDictType"
|
||||
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/upload"
|
||||
)
|
31
internal/app/common/logic/middleware/middleware.go
Normal file
31
internal/app/common/logic/middleware/middleware.go
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* @desc:中间件处理
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/9/28 9:08
|
||||
*/
|
||||
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterMiddleware(New())
|
||||
}
|
||||
|
||||
func New() *sMiddleware {
|
||||
return &sMiddleware{}
|
||||
}
|
||||
|
||||
type sMiddleware struct{}
|
||||
|
||||
func (s *sMiddleware) MiddlewareCORS(r *ghttp.Request) {
|
||||
corsOptions := r.Response.DefaultCORSOptions()
|
||||
// you can set options
|
||||
//corsOptions.AllowDomain = []string{"goframe.org", "baidu.com"}
|
||||
r.Response.CORS(corsOptions)
|
||||
r.Middleware.Next()
|
||||
}
|
178
internal/app/common/logic/sysConfig/sys_config.go
Normal file
178
internal/app/common/logic/sysConfig/sys_config.go
Normal file
@ -0,0 +1,178 @@
|
||||
/*
|
||||
* @desc:配置参数管理
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/9/28 9:13
|
||||
*/
|
||||
|
||||
package sysConfig
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/consts"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model/do"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
systemConsts "github.com/tiger1103/gfast/v3/internal/app/system/consts"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterSysConfig(New())
|
||||
}
|
||||
|
||||
func New() *sSysConfig {
|
||||
return &sSysConfig{}
|
||||
}
|
||||
|
||||
type sSysConfig struct {
|
||||
}
|
||||
|
||||
// List 系统参数列表
|
||||
func (s *sSysConfig) List(ctx context.Context, req *system.ConfigSearchReq) (res *system.ConfigSearchRes, err error) {
|
||||
res = new(system.ConfigSearchRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
m := dao.SysConfig.Ctx(ctx)
|
||||
if req != nil {
|
||||
if req.ConfigName != "" {
|
||||
m = m.Where("config_name like ?", "%"+req.ConfigName+"%")
|
||||
}
|
||||
if req.ConfigType != "" {
|
||||
m = m.Where("config_type = ", gconv.Int(req.ConfigType))
|
||||
}
|
||||
if req.ConfigKey != "" {
|
||||
m = m.Where("config_key like ?", "%"+req.ConfigKey+"%")
|
||||
}
|
||||
if len(req.DateRange) > 0 {
|
||||
m = m.Where("created_at >= ? AND created_at<=?", req.DateRange[0], req.DateRange[1])
|
||||
}
|
||||
}
|
||||
res.Total, err = m.Count()
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
if req.PageNum == 0 {
|
||||
req.PageNum = 1
|
||||
}
|
||||
res.CurrentPage = req.PageNum
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = systemConsts.PageSize
|
||||
}
|
||||
err = m.Page(req.PageNum, req.PageSize).Order("config_id asc").Scan(&res.List)
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sSysConfig) Add(ctx context.Context, req *system.ConfigAddReq, userId uint64) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = s.CheckConfigKeyUnique(ctx, req.ConfigKey)
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
_, err = dao.SysConfig.Ctx(ctx).Insert(do.SysConfig{
|
||||
ConfigName: req.ConfigName,
|
||||
ConfigKey: req.ConfigKey,
|
||||
ConfigValue: req.ConfigValue,
|
||||
ConfigType: req.ConfigType,
|
||||
CreateBy: userId,
|
||||
Remark: req.Remark,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "添加系统参数失败")
|
||||
//清除缓存
|
||||
service.Cache().RemoveByTag(ctx, consts.CacheSysConfigTag)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// CheckConfigKeyUnique 验证参数键名是否存在
|
||||
func (s *sSysConfig) CheckConfigKeyUnique(ctx context.Context, configKey string, configId ...int64) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
data := (*entity.SysConfig)(nil)
|
||||
m := dao.SysConfig.Ctx(ctx).Fields(dao.SysConfig.Columns().ConfigId).Where(dao.SysConfig.Columns().ConfigKey, configKey)
|
||||
if len(configId) > 0 {
|
||||
m = m.Where(dao.SysConfig.Columns().ConfigId+" != ?", configId[0])
|
||||
}
|
||||
err = m.Scan(&data)
|
||||
liberr.ErrIsNil(ctx, err, "校验失败")
|
||||
if data != nil {
|
||||
liberr.ErrIsNil(ctx, errors.New("参数键名重复"))
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取系统参数
|
||||
func (s *sSysConfig) Get(ctx context.Context, id int) (res *system.ConfigGetRes, err error) {
|
||||
res = new(system.ConfigGetRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = dao.SysConfig.Ctx(ctx).WherePri(id).Scan(&res.Data)
|
||||
liberr.ErrIsNil(ctx, err, "获取系统参数失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改系统参数
|
||||
func (s *sSysConfig) Edit(ctx context.Context, req *system.ConfigEditReq, userId uint64) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = s.CheckConfigKeyUnique(ctx, req.ConfigKey, req.ConfigId)
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
_, err = dao.SysConfig.Ctx(ctx).WherePri(req.ConfigId).Update(do.SysConfig{
|
||||
ConfigName: req.ConfigName,
|
||||
ConfigKey: req.ConfigKey,
|
||||
ConfigValue: req.ConfigValue,
|
||||
ConfigType: req.ConfigType,
|
||||
UpdateBy: userId,
|
||||
Remark: req.Remark,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "修改系统参数失败")
|
||||
//清除缓存
|
||||
service.Cache().RemoveByTag(ctx, consts.CacheSysConfigTag)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除系统参数
|
||||
func (s *sSysConfig) Delete(ctx context.Context, ids []int) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err = dao.SysConfig.Ctx(ctx).Delete(dao.SysConfig.Columns().ConfigId+" in (?)", ids)
|
||||
liberr.ErrIsNil(ctx, err, "删除失败")
|
||||
//清除缓存
|
||||
service.Cache().RemoveByTag(ctx, consts.CacheSysConfigTag)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// GetConfigByKey 通过key获取参数(从缓存获取)
|
||||
func (s *sSysConfig) GetConfigByKey(ctx context.Context, key string) (config *entity.SysConfig, err error) {
|
||||
if key == "" {
|
||||
err = gerror.New("参数key不能为空")
|
||||
return
|
||||
}
|
||||
cache := service.Cache()
|
||||
cf := cache.Get(ctx, consts.CacheSysConfigTag+key)
|
||||
if cf != nil && !cf.IsEmpty() {
|
||||
err = gconv.Struct(cf, &config)
|
||||
return
|
||||
}
|
||||
config, err = s.GetByKey(ctx, key)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if config != nil {
|
||||
cache.Set(ctx, consts.CacheSysConfigTag+key, config, 0, consts.CacheSysConfigTag)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetByKey 通过key获取参数(从数据库获取)
|
||||
func (s *sSysConfig) GetByKey(ctx context.Context, key string) (config *entity.SysConfig, err error) {
|
||||
err = dao.SysConfig.Ctx(ctx).Where("config_key", key).Scan(&config)
|
||||
if err != nil {
|
||||
g.Log().Error(ctx, err)
|
||||
err = gerror.New("获取配置失败")
|
||||
}
|
||||
return
|
||||
}
|
173
internal/app/common/logic/sysDictData/sys_dict_data.go
Normal file
173
internal/app/common/logic/sysDictData/sys_dict_data.go
Normal file
@ -0,0 +1,173 @@
|
||||
/*
|
||||
* @desc:字典数据管理
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/9/28 9:22
|
||||
*/
|
||||
|
||||
package sysDictData
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/consts"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model/do"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
systemConsts "github.com/tiger1103/gfast/v3/internal/app/system/consts"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterSysDictData(New())
|
||||
}
|
||||
|
||||
func New() *sSysDictData {
|
||||
return &sSysDictData{}
|
||||
}
|
||||
|
||||
type sSysDictData struct {
|
||||
}
|
||||
|
||||
// GetDictWithDataByType 通过字典键类型获取选项
|
||||
func (s *sSysDictData) GetDictWithDataByType(ctx context.Context, req *system.GetDictReq) (dict *system.GetDictRes,
|
||||
err error) {
|
||||
cache := service.Cache()
|
||||
cacheKey := consts.CacheSysDict + "_" + req.DictType
|
||||
//从缓存获取
|
||||
iDict := cache.GetOrSetFuncLock(ctx, cacheKey, func(ctx context.Context) (value interface{}, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
//从数据库获取
|
||||
dict = &system.GetDictRes{}
|
||||
//获取类型数据
|
||||
err = dao.SysDictType.Ctx(ctx).Where(dao.SysDictType.Columns().DictType, req.DictType).
|
||||
Where(dao.SysDictType.Columns().Status, 1).Fields(model.DictTypeRes{}).Scan(&dict.Info)
|
||||
liberr.ErrIsNil(ctx, err, "获取字典类型失败")
|
||||
err = dao.SysDictData.Ctx(ctx).Fields(model.DictDataRes{}).
|
||||
Where(dao.SysDictData.Columns().DictType, req.DictType).
|
||||
Order(dao.SysDictData.Columns().DictSort + " asc," +
|
||||
dao.SysDictData.Columns().DictCode + " asc").
|
||||
Scan(&dict.Values)
|
||||
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
|
||||
})
|
||||
value = dict
|
||||
return
|
||||
}, 0, consts.CacheSysDictTag)
|
||||
if iDict != nil {
|
||||
err = gconv.Struct(iDict, &dict)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
//设置给定的默认值
|
||||
for _, v := range dict.Values {
|
||||
if req.DefaultValue != "" {
|
||||
if gstr.Equal(req.DefaultValue, v.DictValue) {
|
||||
v.IsDefault = 1
|
||||
} else {
|
||||
v.IsDefault = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// List 获取字典数据
|
||||
func (s *sSysDictData) List(ctx context.Context, req *system.DictDataSearchReq) (res *system.DictDataSearchRes, err error) {
|
||||
res = new(system.DictDataSearchRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
m := dao.SysDictData.Ctx(ctx)
|
||||
if req != nil {
|
||||
if req.DictLabel != "" {
|
||||
m = m.Where(dao.SysDictData.Columns().DictLabel+" like ?", "%"+req.DictLabel+"%")
|
||||
}
|
||||
if req.Status != "" {
|
||||
m = m.Where(dao.SysDictData.Columns().Status+" = ", gconv.Int(req.Status))
|
||||
}
|
||||
if req.DictType != "" {
|
||||
m = m.Where(dao.SysDictData.Columns().DictType+" = ?", req.DictType)
|
||||
}
|
||||
res.Total, err = m.Count()
|
||||
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
|
||||
if req.PageNum == 0 {
|
||||
req.PageNum = 1
|
||||
}
|
||||
res.CurrentPage = req.PageNum
|
||||
}
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = systemConsts.PageSize
|
||||
}
|
||||
err = m.Page(req.PageNum, req.PageSize).Order(dao.SysDictData.Columns().DictSort + " asc," +
|
||||
dao.SysDictData.Columns().DictCode + " asc").Scan(&res.List)
|
||||
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sSysDictData) Add(ctx context.Context, req *system.DictDataAddReq, userId uint64) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err = dao.SysDictData.Ctx(ctx).Insert(do.SysDictData{
|
||||
DictSort: req.DictSort,
|
||||
DictLabel: req.DictLabel,
|
||||
DictValue: req.DictValue,
|
||||
DictType: req.DictType,
|
||||
CssClass: req.CssClass,
|
||||
ListClass: req.ListClass,
|
||||
IsDefault: req.IsDefault,
|
||||
Status: req.Status,
|
||||
CreateBy: userId,
|
||||
Remark: req.Remark,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "添加字典数据失败")
|
||||
//清除缓存
|
||||
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取字典数据
|
||||
func (s *sSysDictData) Get(ctx context.Context, dictCode uint) (res *system.DictDataGetRes, err error) {
|
||||
res = new(system.DictDataGetRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = dao.SysDictData.Ctx(ctx).WherePri(dictCode).Scan(&res.Dict)
|
||||
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改字典数据
|
||||
func (s *sSysDictData) Edit(ctx context.Context, req *system.DictDataEditReq, userId uint64) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err = dao.SysDictData.Ctx(ctx).WherePri(req.DictCode).Update(do.SysDictData{
|
||||
DictSort: req.DictSort,
|
||||
DictLabel: req.DictLabel,
|
||||
DictValue: req.DictValue,
|
||||
DictType: req.DictType,
|
||||
CssClass: req.CssClass,
|
||||
ListClass: req.ListClass,
|
||||
IsDefault: req.IsDefault,
|
||||
Status: req.Status,
|
||||
UpdateBy: userId,
|
||||
Remark: req.Remark,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "修改字典数据失败")
|
||||
//清除缓存
|
||||
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除字典数据
|
||||
func (s *sSysDictData) Delete(ctx context.Context, ids []int) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err = dao.SysDictData.Ctx(ctx).Where(dao.SysDictData.Columns().DictCode+" in(?)", ids).Delete()
|
||||
liberr.ErrIsNil(ctx, err, "删除字典数据失败")
|
||||
//清除缓存
|
||||
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
|
||||
})
|
||||
return
|
||||
}
|
186
internal/app/common/logic/sysDictType/sys_dict_type.go
Normal file
186
internal/app/common/logic/sysDictType/sys_dict_type.go
Normal file
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* @desc:字典类型管理
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/9/28 9:26
|
||||
*/
|
||||
|
||||
package sysDictType
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/container/garray"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/consts"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model/do"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
systemConsts "github.com/tiger1103/gfast/v3/internal/app/system/consts"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterSysDictType(New())
|
||||
}
|
||||
|
||||
func New() *sSysDictType {
|
||||
return &sSysDictType{}
|
||||
}
|
||||
|
||||
type sSysDictType struct {
|
||||
}
|
||||
|
||||
// List 字典类型列表
|
||||
func (s *sSysDictType) List(ctx context.Context, req *system.DictTypeSearchReq) (res *system.DictTypeSearchRes, err error) {
|
||||
res = new(system.DictTypeSearchRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
m := dao.SysDictType.Ctx(ctx)
|
||||
if req.DictName != "" {
|
||||
m = m.Where(dao.SysDictType.Columns().DictName+" like ?", "%"+req.DictName+"%")
|
||||
}
|
||||
if req.DictType != "" {
|
||||
m = m.Where(dao.SysDictType.Columns().DictType+" like ?", "%"+req.DictType+"%")
|
||||
}
|
||||
if req.Status != "" {
|
||||
m = m.Where(dao.SysDictType.Columns().Status+" = ", gconv.Int(req.Status))
|
||||
}
|
||||
res.Total, err = m.Count()
|
||||
liberr.ErrIsNil(ctx, err, "获取字典类型失败")
|
||||
if req.PageNum == 0 {
|
||||
req.PageNum = 1
|
||||
}
|
||||
res.CurrentPage = req.PageNum
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = systemConsts.PageSize
|
||||
}
|
||||
err = m.Fields(model.SysDictTypeInfoRes{}).Page(req.PageNum, req.PageSize).
|
||||
Order(dao.SysDictType.Columns().DictId + " asc").Scan(&res.DictTypeList)
|
||||
liberr.ErrIsNil(ctx, err, "获取字典类型失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加字典类型
|
||||
func (s *sSysDictType) Add(ctx context.Context, req *system.DictTypeAddReq, userId uint64) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = s.ExistsDictType(ctx, req.DictType)
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
_, err = dao.SysDictType.Ctx(ctx).Insert(do.SysDictType{
|
||||
DictName: req.DictName,
|
||||
DictType: req.DictType,
|
||||
Status: req.Status,
|
||||
CreateBy: userId,
|
||||
Remark: req.Remark,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "添加字典类型失败")
|
||||
//清除缓存
|
||||
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改字典类型
|
||||
func (s *sSysDictType) Edit(ctx context.Context, req *system.DictTypeEditReq, userId uint64) (err error) {
|
||||
err = g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = s.ExistsDictType(ctx, req.DictType, req.DictId)
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
dictType := (*entity.SysDictType)(nil)
|
||||
e := dao.SysDictType.Ctx(ctx).Fields(dao.SysDictType.Columns().DictType).WherePri(req.DictId).Scan(&dictType)
|
||||
liberr.ErrIsNil(ctx, e, "获取字典类型失败")
|
||||
liberr.ValueIsNil(dictType, "字典类型不存在")
|
||||
//修改字典类型
|
||||
_, e = dao.SysDictType.Ctx(ctx).TX(tx).WherePri(req.DictId).Update(do.SysDictType{
|
||||
DictName: req.DictName,
|
||||
DictType: req.DictType,
|
||||
Status: req.Status,
|
||||
UpdateBy: userId,
|
||||
Remark: req.Remark,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, e, "修改字典类型失败")
|
||||
//修改字典数据
|
||||
_, e = dao.SysDictData.Ctx(ctx).TX(tx).Data(do.SysDictData{DictType: req.DictType}).
|
||||
Where(dao.SysDictData.Columns().DictType, dictType.DictType).Update()
|
||||
liberr.ErrIsNil(ctx, e, "修改字典数据失败")
|
||||
//清除缓存
|
||||
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
|
||||
})
|
||||
return err
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sSysDictType) Get(ctx context.Context, req *system.DictTypeGetReq) (dictType *entity.SysDictType, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = dao.SysDictType.Ctx(ctx).Where(dao.SysDictType.Columns().DictId, req.DictId).Scan(&dictType)
|
||||
liberr.ErrIsNil(ctx, err, "获取字典类型失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// ExistsDictType 检查类型是否已经存在
|
||||
func (s *sSysDictType) ExistsDictType(ctx context.Context, dictType string, dictId ...int64) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
m := dao.SysDictType.Ctx(ctx).Fields(dao.SysDictType.Columns().DictId).
|
||||
Where(dao.SysDictType.Columns().DictType, dictType)
|
||||
if len(dictId) > 0 {
|
||||
m = m.Where(dao.SysDictType.Columns().DictId+" !=? ", dictId[0])
|
||||
}
|
||||
res, e := m.One()
|
||||
liberr.ErrIsNil(ctx, e, "sql err")
|
||||
if !res.IsEmpty() {
|
||||
liberr.ErrIsNil(ctx, gerror.New("字典类型已存在"))
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除字典类型
|
||||
func (s *sSysDictType) Delete(ctx context.Context, dictIds []int) (err error) {
|
||||
err = g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
discs := ([]*entity.SysDictType)(nil)
|
||||
err = dao.SysDictType.Ctx(ctx).Fields(dao.SysDictType.Columns().DictType).
|
||||
Where(dao.SysDictType.Columns().DictId+" in (?) ", dictIds).Scan(&discs)
|
||||
liberr.ErrIsNil(ctx, err, "删除失败")
|
||||
types := garray.NewStrArray()
|
||||
for _, dt := range discs {
|
||||
types.Append(dt.DictType)
|
||||
}
|
||||
if types.Len() > 0 {
|
||||
_, err = dao.SysDictType.Ctx(ctx).TX(tx).Delete(dao.SysDictType.Columns().DictId+" in (?) ", dictIds)
|
||||
liberr.ErrIsNil(ctx, err, "删除类型失败")
|
||||
_, err = dao.SysDictData.Ctx(ctx).TX(tx).Delete(dao.SysDictData.Columns().DictType+" in (?) ", types.Slice())
|
||||
liberr.ErrIsNil(ctx, err, "删除字典数据失败")
|
||||
}
|
||||
//清除缓存
|
||||
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
|
||||
})
|
||||
return err
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// GetAllDictType 获取所有正常状态下的字典类型
|
||||
func (s *sSysDictType) GetAllDictType(ctx context.Context) (list []*entity.SysDictType, err error) {
|
||||
cache := service.Cache()
|
||||
//从缓存获取
|
||||
data := cache.Get(ctx, consts.CacheSysDict+"_dict_type_all")
|
||||
if !data.IsNil() {
|
||||
err = data.Structs(&list)
|
||||
return
|
||||
}
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = dao.SysDictType.Ctx(ctx).Where("status", 1).Order("dict_id ASC").Scan(&list)
|
||||
liberr.ErrIsNil(ctx, err, "获取字典类型数据出错")
|
||||
//缓存
|
||||
cache.Set(ctx, consts.CacheSysDict+"_dict_type_all", list, 0, consts.CacheSysDictTag)
|
||||
})
|
||||
return
|
||||
}
|
201
internal/app/common/logic/upload/upload.go
Normal file
201
internal/app/common/logic/upload/upload.go
Normal file
@ -0,0 +1,201 @@
|
||||
/*
|
||||
* @desc:上传处理
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/9/28 9:37
|
||||
*/
|
||||
|
||||
package upload
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/text/gregex"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/consts"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
"github.com/tiger1103/gfast/v3/library/upload"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterUpload(New())
|
||||
}
|
||||
|
||||
func New() *sUpload {
|
||||
return &sUpload{}
|
||||
}
|
||||
|
||||
type sUpload struct{}
|
||||
|
||||
// UploadFiles 上传多文件
|
||||
func (s *sUpload) UploadFiles(ctx context.Context, files []*ghttp.UploadFile, checkFileType string, source int) (result system.UploadMultipleRes, err error) {
|
||||
for _, item := range files {
|
||||
f, e := s.UploadFile(ctx, item, checkFileType, source)
|
||||
if e != nil {
|
||||
return
|
||||
}
|
||||
result = append(result, &f)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UploadFile 上传单文件
|
||||
func (s *sUpload) UploadFile(ctx context.Context, file *ghttp.UploadFile, checkFileType string, source int) (result system.UploadResponse, err error) {
|
||||
|
||||
// 检查文件类型
|
||||
err = s.CheckType(ctx, checkFileType, file)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查文件大小
|
||||
err = s.CheckSize(ctx, checkFileType, file)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
uploader := upload.GetUploader(upload.UploaderType(source))
|
||||
if uploader == nil {
|
||||
err = errors.New("没有找到上传适配器")
|
||||
return
|
||||
}
|
||||
return uploader.Upload(ctx, file)
|
||||
}
|
||||
|
||||
// CheckSize 检查上传文件大小
|
||||
func (s *sUpload) CheckSize(ctx context.Context, checkFileType string, file *ghttp.UploadFile) (err error) {
|
||||
|
||||
var (
|
||||
configSize *entity.SysConfig
|
||||
)
|
||||
|
||||
if checkFileType == consts.CheckFileTypeFile {
|
||||
|
||||
//获取上传大小配置
|
||||
configSize, err = s.getUpConfig(ctx, consts.FileSizeKey)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
} else if checkFileType == consts.CheckFileTypeImg {
|
||||
|
||||
//获取上传大小配置
|
||||
configSize, err = s.getUpConfig(ctx, consts.ImgSizeKey)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return errors.New(fmt.Sprintf("文件检查类型错误:%s|%s", consts.CheckFileTypeFile, consts.CheckFileTypeImg))
|
||||
}
|
||||
|
||||
var rightSize bool
|
||||
rightSize, err = s.checkSize(configSize.ConfigValue, file.Size)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !rightSize {
|
||||
err = gerror.New("上传文件超过最大尺寸:" + configSize.ConfigValue)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// CheckType 检查上传文件类型
|
||||
func (s *sUpload) CheckType(ctx context.Context, checkFileType string, file *ghttp.UploadFile) (err error) {
|
||||
|
||||
var (
|
||||
configType *entity.SysConfig
|
||||
)
|
||||
|
||||
if checkFileType == consts.CheckFileTypeFile {
|
||||
//获取上传类型配置
|
||||
configType, err = s.getUpConfig(ctx, consts.FileTypeKey)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
} else if checkFileType == consts.CheckFileTypeImg {
|
||||
//获取上传类型配置
|
||||
configType, err = s.getUpConfig(ctx, consts.ImgTypeKey)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return errors.New(fmt.Sprintf("文件检查类型错误:%s|%s", consts.CheckFileTypeFile, consts.CheckFileTypeImg))
|
||||
}
|
||||
|
||||
rightType := s.checkFileType(file.Filename, configType.ConfigValue)
|
||||
if !rightType {
|
||||
err = gerror.New("上传文件类型错误,只能包含后缀为:" + configType.ConfigValue + "的文件。")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取上传配置
|
||||
func (s *sUpload) getUpConfig(ctx context.Context, key string) (config *entity.SysConfig, err error) {
|
||||
config, err = service.SysConfig().GetConfigByKey(ctx, key)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if config == nil {
|
||||
err = gerror.New("上传文件类型未设置,请在后台配置")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 判断上传文件类型是否合法
|
||||
func (s *sUpload) checkFileType(fileName, typeString string) bool {
|
||||
suffix := gstr.SubStrRune(fileName, gstr.PosRRune(fileName, ".")+1, gstr.LenRune(fileName)-1)
|
||||
imageType := gstr.Split(typeString, ",")
|
||||
rightType := false
|
||||
for _, v := range imageType {
|
||||
if gstr.Equal(suffix, v) {
|
||||
rightType = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return rightType
|
||||
}
|
||||
|
||||
// 检查文件大小是否合法
|
||||
func (s *sUpload) checkSize(configSize string, fileSize int64) (bool, error) {
|
||||
match, err := gregex.MatchString(`^([0-9]+)(?i:([a-z]*))$`, configSize)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if len(match) == 0 {
|
||||
err = gerror.New("上传文件大小未设置,请在后台配置,格式为(30M,30k,30MB)")
|
||||
return false, err
|
||||
}
|
||||
var cfSize int64
|
||||
switch gstr.ToUpper(match[2]) {
|
||||
case "MB", "M":
|
||||
cfSize = gconv.Int64(match[1]) * 1024 * 1024
|
||||
case "KB", "K":
|
||||
cfSize = gconv.Int64(match[1]) * 1024
|
||||
case "":
|
||||
cfSize = gconv.Int64(match[1])
|
||||
}
|
||||
if cfSize == 0 {
|
||||
err = gerror.New("上传文件大小未设置,请在后台配置,格式为(30M,30k,30MB),最大单位为MB")
|
||||
return false, err
|
||||
}
|
||||
return cfSize >= fileSize, nil
|
||||
}
|
||||
|
||||
// 静态文件夹目录
|
||||
func (s *sUpload) getStaticPath(ctx context.Context) string {
|
||||
value, _ := g.Cfg().Get(ctx, "server.serverRoot")
|
||||
if !value.IsEmpty() {
|
||||
return value.String()
|
||||
}
|
||||
return ""
|
||||
}
|
21
internal/app/common/model/do/casbin_rule.go
Normal file
21
internal/app/common/model/do/casbin_rule.go
Normal file
@ -0,0 +1,21 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package do
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// CasbinRule is the golang structure of table casbin_rule for DAO operations like Where/Data.
|
||||
type CasbinRule struct {
|
||||
g.Meta `orm:"table:casbin_rule, do:true"`
|
||||
Ptype interface{} //
|
||||
V0 interface{} //
|
||||
V1 interface{} //
|
||||
V2 interface{} //
|
||||
V3 interface{} //
|
||||
V4 interface{} //
|
||||
V5 interface{} //
|
||||
}
|
25
internal/app/common/model/do/sys_config.go
Normal file
25
internal/app/common/model/do/sys_config.go
Normal file
@ -0,0 +1,25 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-18 21:09:17
|
||||
// =================================================================================
|
||||
|
||||
package do
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// SysConfig is the golang structure of table sys_config for DAO operations like Where/Data.
|
||||
type SysConfig struct {
|
||||
g.Meta `orm:"table:sys_config, do:true"`
|
||||
ConfigId interface{} // 参数主键
|
||||
ConfigName interface{} // 参数名称
|
||||
ConfigKey interface{} // 参数键名
|
||||
ConfigValue interface{} // 参数键值
|
||||
ConfigType interface{} // 系统内置(Y是 N否)
|
||||
CreateBy interface{} // 创建者
|
||||
UpdateBy interface{} // 更新者
|
||||
Remark interface{} // 备注
|
||||
CreatedAt *gtime.Time // 创建时间
|
||||
UpdatedAt *gtime.Time // 修改时间
|
||||
}
|
29
internal/app/common/model/do/sys_dict_data.go
Normal file
29
internal/app/common/model/do/sys_dict_data.go
Normal file
@ -0,0 +1,29 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
|
||||
// =================================================================================
|
||||
|
||||
package do
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// SysDictData is the golang structure of table sys_dict_data for DAO operations like Where/Data.
|
||||
type SysDictData struct {
|
||||
g.Meta `orm:"table:sys_dict_data, do:true"`
|
||||
DictCode interface{} // 字典编码
|
||||
DictSort interface{} // 字典排序
|
||||
DictLabel interface{} // 字典标签
|
||||
DictValue interface{} // 字典键值
|
||||
DictType interface{} // 字典类型
|
||||
CssClass interface{} // 样式属性(其他样式扩展)
|
||||
ListClass interface{} // 表格回显样式
|
||||
IsDefault interface{} // 是否默认(1是 0否)
|
||||
Status interface{} // 状态(0正常 1停用)
|
||||
CreateBy interface{} // 创建者
|
||||
UpdateBy interface{} // 更新者
|
||||
Remark interface{} // 备注
|
||||
CreatedAt *gtime.Time // 创建时间
|
||||
UpdatedAt *gtime.Time // 修改时间
|
||||
}
|
24
internal/app/common/model/do/sys_dict_type.go
Normal file
24
internal/app/common/model/do/sys_dict_type.go
Normal file
@ -0,0 +1,24 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
|
||||
// =================================================================================
|
||||
|
||||
package do
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// SysDictType is the golang structure of table sys_dict_type for DAO operations like Where/Data.
|
||||
type SysDictType struct {
|
||||
g.Meta `orm:"table:sys_dict_type, do:true"`
|
||||
DictId interface{} // 字典主键
|
||||
DictName interface{} // 字典名称
|
||||
DictType interface{} // 字典类型
|
||||
Status interface{} // 状态(0正常 1停用)
|
||||
CreateBy interface{} // 创建者
|
||||
UpdateBy interface{} // 更新者
|
||||
Remark interface{} // 备注
|
||||
CreatedAt *gtime.Time // 创建日期
|
||||
UpdatedAt *gtime.Time // 修改日期
|
||||
}
|
16
internal/app/common/model/entity/casbin_rule.go
Normal file
16
internal/app/common/model/entity/casbin_rule.go
Normal file
@ -0,0 +1,16 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package entity
|
||||
|
||||
// CasbinRule is the golang structure for table casbin_rule.
|
||||
type CasbinRule struct {
|
||||
Ptype string `json:"ptype" description:""`
|
||||
V0 string `json:"v0" description:""`
|
||||
V1 string `json:"v1" description:""`
|
||||
V2 string `json:"v2" description:""`
|
||||
V3 string `json:"v3" description:""`
|
||||
V4 string `json:"v4" description:""`
|
||||
V5 string `json:"v5" description:""`
|
||||
}
|
23
internal/app/common/model/entity/sys_config.go
Normal file
23
internal/app/common/model/entity/sys_config.go
Normal file
@ -0,0 +1,23 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-18 21:09:17
|
||||
// =================================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// SysConfig is the golang structure for table sys_config.
|
||||
type SysConfig struct {
|
||||
ConfigId uint `json:"configId" description:"参数主键"`
|
||||
ConfigName string `json:"configName" description:"参数名称"`
|
||||
ConfigKey string `json:"configKey" description:"参数键名"`
|
||||
ConfigValue string `json:"configValue" description:"参数键值"`
|
||||
ConfigType int `json:"configType" description:"系统内置(Y是 N否)"`
|
||||
CreateBy uint `json:"createBy" description:"创建者"`
|
||||
UpdateBy uint `json:"updateBy" description:"更新者"`
|
||||
Remark string `json:"remark" description:"备注"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
|
||||
}
|
27
internal/app/common/model/entity/sys_dict_data.go
Normal file
27
internal/app/common/model/entity/sys_dict_data.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
|
||||
// =================================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// SysDictData is the golang structure for table sys_dict_data.
|
||||
type SysDictData struct {
|
||||
DictCode int64 `json:"dictCode" description:"字典编码"`
|
||||
DictSort int `json:"dictSort" description:"字典排序"`
|
||||
DictLabel string `json:"dictLabel" description:"字典标签"`
|
||||
DictValue string `json:"dictValue" description:"字典键值"`
|
||||
DictType string `json:"dictType" description:"字典类型"`
|
||||
CssClass string `json:"cssClass" description:"样式属性(其他样式扩展)"`
|
||||
ListClass string `json:"listClass" description:"表格回显样式"`
|
||||
IsDefault int `json:"isDefault" description:"是否默认(1是 0否)"`
|
||||
Status int `json:"status" description:"状态(0正常 1停用)"`
|
||||
CreateBy uint64 `json:"createBy" description:"创建者"`
|
||||
UpdateBy uint64 `json:"updateBy" description:"更新者"`
|
||||
Remark string `json:"remark" description:"备注"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
|
||||
}
|
22
internal/app/common/model/entity/sys_dict_type.go
Normal file
22
internal/app/common/model/entity/sys_dict_type.go
Normal file
@ -0,0 +1,22 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
|
||||
// =================================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// SysDictType is the golang structure for table sys_dict_type.
|
||||
type SysDictType struct {
|
||||
DictId uint64 `json:"dictId" description:"字典主键"`
|
||||
DictName string `json:"dictName" description:"字典名称"`
|
||||
DictType string `json:"dictType" description:"字典类型"`
|
||||
Status uint `json:"status" description:"状态(0正常 1停用)"`
|
||||
CreateBy uint `json:"createBy" description:"创建者"`
|
||||
UpdateBy uint `json:"updateBy" description:"更新者"`
|
||||
Remark string `json:"remark" description:"备注"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"创建日期"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改日期"`
|
||||
}
|
8
internal/app/common/model/sys_config.go
Normal file
8
internal/app/common/model/sys_config.go
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* @desc:xxxx功能描述
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/3/18 11:56
|
||||
*/
|
||||
|
||||
package model
|
21
internal/app/common/model/sys_dict_data.go
Normal file
21
internal/app/common/model/sys_dict_data.go
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @desc:字典数据
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/3/18 11:56
|
||||
*/
|
||||
|
||||
package model
|
||||
|
||||
type DictTypeRes struct {
|
||||
DictName string `json:"name"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// DictDataRes 字典数据
|
||||
type DictDataRes struct {
|
||||
DictValue string `json:"key"`
|
||||
DictLabel string `json:"value"`
|
||||
IsDefault int `json:"isDefault"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
19
internal/app/common/model/sys_dict_type.go
Normal file
19
internal/app/common/model/sys_dict_type.go
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* @desc:字典类型
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/3/18 11:56
|
||||
*/
|
||||
|
||||
package model
|
||||
|
||||
import "github.com/gogf/gf/v2/os/gtime"
|
||||
|
||||
type SysDictTypeInfoRes struct {
|
||||
DictId uint64 `orm:"dict_id,primary" json:"dictId"` // 字典主键
|
||||
DictName string `orm:"dict_name" json:"dictName"` // 字典名称
|
||||
DictType string `orm:"dict_type,unique" json:"dictType"` // 字典类型
|
||||
Status uint `orm:"status" json:"status"` // 状态(0正常 1停用)
|
||||
Remark string `orm:"remark" json:"remark"` // 备注
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` // 创建日期
|
||||
}
|
32
internal/app/common/model/token.go
Normal file
32
internal/app/common/model/token.go
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* @desc:token options
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu
|
||||
* @Date: 2022/3/8 16:02
|
||||
*/
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type TokenOptions struct {
|
||||
// server name
|
||||
ServerName string `json:"serverName"`
|
||||
// 缓存key (每创建一个实例CacheKey必须不相同)
|
||||
CacheKey string `json:"cacheKey"`
|
||||
// 超时时间 默认10天(秒)
|
||||
Timeout int64 `json:"timeout"`
|
||||
// 缓存刷新时间 默认5天(秒)
|
||||
// 处理携带token的请求时当前时间大于超时时间并小于缓存刷新时间时token将自动刷新即重置token存活时间
|
||||
// MaxRefresh值为0时,token将不会自动刷新
|
||||
MaxRefresh int64 `json:"maxRefresh"`
|
||||
// 是否允许多点登录
|
||||
MultiLogin bool `json:"multiLogin"`
|
||||
// Token加密key 32位
|
||||
EncryptKey []byte `json:"encryptKey"`
|
||||
// 拦截排除地址
|
||||
ExcludePaths g.SliceStr `json:"excludePaths"`
|
||||
CacheModel string `json:"cacheModel"`
|
||||
}
|
15
internal/app/common/model/upload.go
Normal file
15
internal/app/common/model/upload.go
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* @desc:上传文件model
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/12/6 15:29
|
||||
*/
|
||||
|
||||
package model
|
||||
|
||||
type UpFile struct {
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
FileType string `json:"fileType"`
|
||||
Size uint64 `json:"size"`
|
||||
}
|
28
internal/app/common/router/router.go
Normal file
28
internal/app/common/router/router.go
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* @desc:后台路由
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu
|
||||
* @Date: 2022/2/18 17:34
|
||||
*/
|
||||
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/controller"
|
||||
)
|
||||
|
||||
var R = new(Router)
|
||||
|
||||
type Router struct{}
|
||||
|
||||
func (router *Router) BindController(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
group.Group("/pub", func(group *ghttp.RouterGroup) {
|
||||
group.Group("/captcha", func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
controller.Captcha,
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
30
internal/app/common/service/big_upload.go
Normal file
30
internal/app/common/service/big_upload.go
Normal file
@ -0,0 +1,30 @@
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
)
|
||||
|
||||
type IBigUpload interface {
|
||||
Upload(ctx context.Context, req *system.BigUploadReq) (res *system.BigUploadRes, err error)
|
||||
UploadCheck(ctx context.Context, req *system.BigUploadCheckReq) (res *system.BigUploadCheckRes, err error)
|
||||
UploadMerge(ctx context.Context, req *system.BigUploadMergeReq) (res *system.BigUploadRes, err error)
|
||||
}
|
||||
|
||||
var localBigUpload IBigUpload
|
||||
|
||||
func BigUpload() IBigUpload {
|
||||
if localBigUpload == nil {
|
||||
panic("implement not found for interface IBigUpload, forgot register?")
|
||||
}
|
||||
return localBigUpload
|
||||
}
|
||||
|
||||
func RegisterBigUpload(i IBigUpload) {
|
||||
localBigUpload = i
|
||||
}
|
29
internal/app/common/service/cache.go
Normal file
29
internal/app/common/service/cache.go
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* @desc:缓存处理
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu
|
||||
* @Date: 2022/3/9 11:15
|
||||
*/
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"github.com/tiger1103/gfast-cache/cache"
|
||||
)
|
||||
|
||||
type ICache interface {
|
||||
cache.IGCache
|
||||
}
|
||||
|
||||
var c ICache
|
||||
|
||||
func Cache() ICache {
|
||||
if c == nil {
|
||||
panic("implement not found for interface ICache, forgot register?")
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func RegisterCache(che ICache) {
|
||||
c = che
|
||||
}
|
28
internal/app/common/service/captcha.go
Normal file
28
internal/app/common/service/captcha.go
Normal file
@ -0,0 +1,28 @@
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type ICaptcha interface {
|
||||
GetVerifyImgString(ctx context.Context) (idKeyC string, base64stringC string, err error)
|
||||
VerifyString(id, answer string) bool
|
||||
}
|
||||
|
||||
var localCaptcha ICaptcha
|
||||
|
||||
func Captcha() ICaptcha {
|
||||
if localCaptcha == nil {
|
||||
panic("implement not found for interface ICaptcha, forgot register?")
|
||||
}
|
||||
return localCaptcha
|
||||
}
|
||||
|
||||
func RegisterCaptcha(i ICaptcha) {
|
||||
localCaptcha = i
|
||||
}
|
218
internal/app/common/service/casbin.go
Normal file
218
internal/app/common/service/casbin.go
Normal file
@ -0,0 +1,218 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/casbin/casbin/v2"
|
||||
"github.com/casbin/casbin/v2/model"
|
||||
"github.com/casbin/casbin/v2/persist"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
|
||||
)
|
||||
|
||||
type cabinImpl struct{}
|
||||
|
||||
type adapterCasbin struct {
|
||||
Enforcer *casbin.SyncedEnforcer
|
||||
EnforcerErr error
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
var (
|
||||
cb = cabinImpl{}
|
||||
ac *adapterCasbin
|
||||
)
|
||||
|
||||
// CasbinEnforcer 获取adapter单例对象
|
||||
func CasbinEnforcer(ctx context.Context) (enforcer *casbin.SyncedEnforcer, err error) {
|
||||
ac = cb.newAdapter(ctx)
|
||||
enforcer = ac.Enforcer
|
||||
err = ac.EnforcerErr
|
||||
return
|
||||
}
|
||||
|
||||
// 初始化adapter操作
|
||||
func (s *cabinImpl) newAdapter(ctx context.Context) (a *adapterCasbin) {
|
||||
a = new(adapterCasbin)
|
||||
a.initPolicy(ctx)
|
||||
a.ctx = ctx
|
||||
return
|
||||
}
|
||||
|
||||
func (a *adapterCasbin) initPolicy(ctx context.Context) {
|
||||
// Because the DB is empty at first,
|
||||
// so we need to load the policy from the file adapter (.CSV) first.
|
||||
e, err := casbin.NewSyncedEnforcer(g.Cfg().MustGet(ctx, "casbin.modelFile").String(), a)
|
||||
if err != nil {
|
||||
a.EnforcerErr = err
|
||||
return
|
||||
}
|
||||
a.Enforcer = e
|
||||
}
|
||||
|
||||
// SavePolicy saves policy to database.
|
||||
func (a *adapterCasbin) SavePolicy(model model.Model) (err error) {
|
||||
err = a.dropTable()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = a.createTable()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for ptype, ast := range model["p"] {
|
||||
for _, rule := range ast.Policy {
|
||||
line := savePolicyLine(ptype, rule)
|
||||
_, err := dao.CasbinRule.Ctx(a.ctx).Data(line).Insert()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ptype, ast := range model["g"] {
|
||||
for _, rule := range ast.Policy {
|
||||
line := savePolicyLine(ptype, rule)
|
||||
_, err := dao.CasbinRule.Ctx(a.ctx).Data(line).Insert()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (a *adapterCasbin) dropTable() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (a *adapterCasbin) createTable() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// LoadPolicy loads policy from database.
|
||||
func (a *adapterCasbin) LoadPolicy(model model.Model) error {
|
||||
var lines []*entity.CasbinRule
|
||||
if err := dao.CasbinRule.Ctx(a.ctx).Scan(&lines); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, line := range lines {
|
||||
loadPolicyLine(line, model)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddPolicy adds a policy rule to the storage.
|
||||
func (a *adapterCasbin) AddPolicy(sec string, ptype string, rule []string) error {
|
||||
line := savePolicyLine(ptype, rule)
|
||||
_, err := dao.CasbinRule.Ctx(a.ctx).Data(line).Insert()
|
||||
return err
|
||||
}
|
||||
|
||||
// RemovePolicy removes a policy rule from the storage.
|
||||
func (a *adapterCasbin) RemovePolicy(sec string, ptype string, rule []string) error {
|
||||
line := savePolicyLine(ptype, rule)
|
||||
err := rawDelete(a, line)
|
||||
return err
|
||||
}
|
||||
|
||||
// RemoveFilteredPolicy removes policy rules that match the filter from the storage.
|
||||
func (a *adapterCasbin) RemoveFilteredPolicy(sec string, ptype string,
|
||||
fieldIndex int, fieldValues ...string,
|
||||
) error {
|
||||
line := &entity.CasbinRule{}
|
||||
line.Ptype = ptype
|
||||
if fieldIndex <= 0 && 0 < fieldIndex+len(fieldValues) {
|
||||
line.V0 = fieldValues[0-fieldIndex]
|
||||
}
|
||||
if fieldIndex <= 1 && 1 < fieldIndex+len(fieldValues) {
|
||||
line.V1 = fieldValues[1-fieldIndex]
|
||||
}
|
||||
if fieldIndex <= 2 && 2 < fieldIndex+len(fieldValues) {
|
||||
line.V2 = fieldValues[2-fieldIndex]
|
||||
}
|
||||
if fieldIndex <= 3 && 3 < fieldIndex+len(fieldValues) {
|
||||
line.V3 = fieldValues[3-fieldIndex]
|
||||
}
|
||||
if fieldIndex <= 4 && 4 < fieldIndex+len(fieldValues) {
|
||||
line.V4 = fieldValues[4-fieldIndex]
|
||||
}
|
||||
if fieldIndex <= 5 && 5 < fieldIndex+len(fieldValues) {
|
||||
line.V5 = fieldValues[5-fieldIndex]
|
||||
}
|
||||
err := rawDelete(a, line)
|
||||
return err
|
||||
}
|
||||
|
||||
func loadPolicyLine(line *entity.CasbinRule, model model.Model) {
|
||||
lineText := line.Ptype
|
||||
if line.V0 != "" {
|
||||
lineText += ", " + line.V0
|
||||
}
|
||||
if line.V1 != "" {
|
||||
lineText += ", " + line.V1
|
||||
}
|
||||
if line.V2 != "" {
|
||||
lineText += ", " + line.V2
|
||||
}
|
||||
if line.V3 != "" {
|
||||
lineText += ", " + line.V3
|
||||
}
|
||||
if line.V4 != "" {
|
||||
lineText += ", " + line.V4
|
||||
}
|
||||
if line.V5 != "" {
|
||||
lineText += ", " + line.V5
|
||||
}
|
||||
|
||||
persist.LoadPolicyLine(lineText, model)
|
||||
}
|
||||
|
||||
func savePolicyLine(ptype string, rule []string) *entity.CasbinRule {
|
||||
line := &entity.CasbinRule{}
|
||||
line.Ptype = ptype
|
||||
if len(rule) > 0 {
|
||||
line.V0 = rule[0]
|
||||
}
|
||||
if len(rule) > 1 {
|
||||
line.V1 = rule[1]
|
||||
}
|
||||
if len(rule) > 2 {
|
||||
line.V2 = rule[2]
|
||||
}
|
||||
if len(rule) > 3 {
|
||||
line.V3 = rule[3]
|
||||
}
|
||||
if len(rule) > 4 {
|
||||
line.V4 = rule[4]
|
||||
}
|
||||
if len(rule) > 5 {
|
||||
line.V5 = rule[5]
|
||||
}
|
||||
return line
|
||||
}
|
||||
|
||||
func rawDelete(a *adapterCasbin, line *entity.CasbinRule) error {
|
||||
db := dao.CasbinRule.Ctx(a.ctx).Where("ptype = ?", line.Ptype)
|
||||
if line.V0 != "" {
|
||||
db = db.Where("v0 = ?", line.V0)
|
||||
}
|
||||
if line.V1 != "" {
|
||||
db = db.Where("v1 = ?", line.V1)
|
||||
}
|
||||
if line.V2 != "" {
|
||||
db = db.Where("v2 = ?", line.V2)
|
||||
}
|
||||
if line.V3 != "" {
|
||||
db = db.Where("v3 = ?", line.V3)
|
||||
}
|
||||
if line.V4 != "" {
|
||||
db = db.Where("v4 = ?", line.V4)
|
||||
}
|
||||
if line.V5 != "" {
|
||||
db = db.Where("v5 = ?", line.V5)
|
||||
}
|
||||
_, err := db.Delete()
|
||||
return err
|
||||
}
|
27
internal/app/common/service/middleware.go
Normal file
27
internal/app/common/service/middleware.go
Normal file
@ -0,0 +1,27 @@
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
)
|
||||
|
||||
type IMiddleware interface {
|
||||
MiddlewareCORS(r *ghttp.Request)
|
||||
}
|
||||
|
||||
var localMiddleware IMiddleware
|
||||
|
||||
func Middleware() IMiddleware {
|
||||
if localMiddleware == nil {
|
||||
panic("implement not found for interface IMiddleware, forgot register?")
|
||||
}
|
||||
return localMiddleware
|
||||
}
|
||||
|
||||
func RegisterMiddleware(i IMiddleware) {
|
||||
localMiddleware = i
|
||||
}
|
37
internal/app/common/service/sys_config.go
Normal file
37
internal/app/common/service/sys_config.go
Normal file
@ -0,0 +1,37 @@
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
|
||||
)
|
||||
|
||||
type ISysConfig interface {
|
||||
List(ctx context.Context, req *system.ConfigSearchReq) (res *system.ConfigSearchRes, err error)
|
||||
Add(ctx context.Context, req *system.ConfigAddReq, userId uint64) (err error)
|
||||
CheckConfigKeyUnique(ctx context.Context, configKey string, configId ...int64) (err error)
|
||||
Get(ctx context.Context, id int) (res *system.ConfigGetRes, err error)
|
||||
Edit(ctx context.Context, req *system.ConfigEditReq, userId uint64) (err error)
|
||||
Delete(ctx context.Context, ids []int) (err error)
|
||||
GetConfigByKey(ctx context.Context, key string) (config *entity.SysConfig, err error)
|
||||
GetByKey(ctx context.Context, key string) (config *entity.SysConfig, err error)
|
||||
}
|
||||
|
||||
var localSysConfig ISysConfig
|
||||
|
||||
func SysConfig() ISysConfig {
|
||||
if localSysConfig == nil {
|
||||
panic("implement not found for interface ISysConfig, forgot register?")
|
||||
}
|
||||
return localSysConfig
|
||||
}
|
||||
|
||||
func RegisterSysConfig(i ISysConfig) {
|
||||
localSysConfig = i
|
||||
}
|
34
internal/app/common/service/sys_dict_data.go
Normal file
34
internal/app/common/service/sys_dict_data.go
Normal file
@ -0,0 +1,34 @@
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
)
|
||||
|
||||
type ISysDictData interface {
|
||||
GetDictWithDataByType(ctx context.Context, req *system.GetDictReq) (dict *system.GetDictRes, err error)
|
||||
List(ctx context.Context, req *system.DictDataSearchReq) (res *system.DictDataSearchRes, err error)
|
||||
Add(ctx context.Context, req *system.DictDataAddReq, userId uint64) (err error)
|
||||
Get(ctx context.Context, dictCode uint) (res *system.DictDataGetRes, err error)
|
||||
Edit(ctx context.Context, req *system.DictDataEditReq, userId uint64) (err error)
|
||||
Delete(ctx context.Context, ids []int) (err error)
|
||||
}
|
||||
|
||||
var localSysDictData ISysDictData
|
||||
|
||||
func SysDictData() ISysDictData {
|
||||
if localSysDictData == nil {
|
||||
panic("implement not found for interface ISysDictData, forgot register?")
|
||||
}
|
||||
return localSysDictData
|
||||
}
|
||||
|
||||
func RegisterSysDictData(i ISysDictData) {
|
||||
localSysDictData = i
|
||||
}
|
36
internal/app/common/service/sys_dict_type.go
Normal file
36
internal/app/common/service/sys_dict_type.go
Normal file
@ -0,0 +1,36 @@
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
|
||||
)
|
||||
|
||||
type ISysDictType interface {
|
||||
List(ctx context.Context, req *system.DictTypeSearchReq) (res *system.DictTypeSearchRes, err error)
|
||||
Add(ctx context.Context, req *system.DictTypeAddReq, userId uint64) (err error)
|
||||
Edit(ctx context.Context, req *system.DictTypeEditReq, userId uint64) (err error)
|
||||
Get(ctx context.Context, req *system.DictTypeGetReq) (dictType *entity.SysDictType, err error)
|
||||
ExistsDictType(ctx context.Context, dictType string, dictId ...int64) (err error)
|
||||
Delete(ctx context.Context, dictIds []int) (err error)
|
||||
GetAllDictType(ctx context.Context) (list []*entity.SysDictType, err error)
|
||||
}
|
||||
|
||||
var localSysDictType ISysDictType
|
||||
|
||||
func SysDictType() ISysDictType {
|
||||
if localSysDictType == nil {
|
||||
panic("implement not found for interface ISysDictType, forgot register?")
|
||||
}
|
||||
return localSysDictType
|
||||
}
|
||||
|
||||
func RegisterSysDictType(i ISysDictType) {
|
||||
localSysDictType = i
|
||||
}
|
33
internal/app/common/service/upload.go
Normal file
33
internal/app/common/service/upload.go
Normal file
@ -0,0 +1,33 @@
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
)
|
||||
|
||||
type IUpload interface {
|
||||
UploadFiles(ctx context.Context, files []*ghttp.UploadFile, checkFileType string, source int) (result system.UploadMultipleRes, err error)
|
||||
UploadFile(ctx context.Context, file *ghttp.UploadFile, checkFileType string, source int) (result system.UploadResponse, err error)
|
||||
CheckSize(ctx context.Context, checkFileType string, file *ghttp.UploadFile) (err error)
|
||||
CheckType(ctx context.Context, checkFileType string, file *ghttp.UploadFile) (err error)
|
||||
}
|
||||
|
||||
var localUpload IUpload
|
||||
|
||||
func Upload() IUpload {
|
||||
if localUpload == nil {
|
||||
panic("implement not found for interface IUpload, forgot register?")
|
||||
}
|
||||
return localUpload
|
||||
}
|
||||
|
||||
func RegisterUpload(i IUpload) {
|
||||
localUpload = i
|
||||
}
|
29
internal/app/system/consts/cache.go
Normal file
29
internal/app/system/consts/cache.go
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* @desc:缓存键
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu
|
||||
* @Date: 2022/3/9 12:06
|
||||
*/
|
||||
|
||||
package consts
|
||||
|
||||
const (
|
||||
// CacheSysAuthMenu 缓存菜单key
|
||||
CacheSysAuthMenu = "sysAuthMenu"
|
||||
// CacheSysDept 缓存部门key
|
||||
CacheSysDept = "sysDept"
|
||||
|
||||
// CacheSysRole 角色缓存key
|
||||
CacheSysRole = "sysRole"
|
||||
// CacheSysWebSet 站点配置缓存key
|
||||
CacheSysWebSet = "sysWebSet"
|
||||
// CacheSysCmsMenu cms缓存key
|
||||
CacheSysCmsMenu = "sysCmsMenu"
|
||||
|
||||
// CacheSysAuthTag 权限缓存TAG标签
|
||||
CacheSysAuthTag = "sysAuthTag"
|
||||
// CacheSysModelTag 模型缓存标签
|
||||
CacheSysModelTag = "sysModelTag"
|
||||
// CacheSysCmsTag cms缓存标签
|
||||
CacheSysCmsTag = "sysCmsTag"
|
||||
)
|
5
internal/app/system/consts/consts.go
Normal file
5
internal/app/system/consts/consts.go
Normal file
@ -0,0 +1,5 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
PageSize = 10 //分页长度
|
||||
)
|
13
internal/app/system/consts/context.go
Normal file
13
internal/app/system/consts/context.go
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* @desc:context 相关常量
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu<yxh669@qq.com>
|
||||
* @Date: 2022/3/16 14:52
|
||||
*/
|
||||
|
||||
package consts
|
||||
|
||||
const (
|
||||
// CtxKey 上下文变量存储键名,前后端系统共享
|
||||
CtxKey = "GFastContext"
|
||||
)
|
53
internal/app/system/controller/app_menus.go
Normal file
53
internal/app/system/controller/app_menus.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-05-28 15:09:13
|
||||
// 生成路径: internal/app/system/controller/app_menus.go
|
||||
// 生成人:gfast
|
||||
// desc:app菜单
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type appMenusController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var AppMenus = new(appMenusController)
|
||||
|
||||
// List 列表
|
||||
func (c *appMenusController) List(ctx context.Context, req *system.AppMenusSearchReq) (res *system.AppMenusSearchRes, err error) {
|
||||
res, err = service.AppMenus().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取app菜单
|
||||
func (c *appMenusController) Get(ctx context.Context, req *system.AppMenusGetReq) (res *system.AppMenusGetRes, err error) {
|
||||
res = new(system.AppMenusGetRes)
|
||||
res.AppMenusInfoRes, err = service.AppMenus().GetByMenuId(ctx, req.MenuId)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加app菜单
|
||||
func (c *appMenusController) Add(ctx context.Context, req *system.AppMenusAddReq) (res *system.AppMenusAddRes, err error) {
|
||||
err = service.AppMenus().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改app菜单
|
||||
func (c *appMenusController) Edit(ctx context.Context, req *system.AppMenusEditReq) (res *system.AppMenusEditRes, err error) {
|
||||
err = service.AppMenus().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除app菜单
|
||||
func (c *appMenusController) Delete(ctx context.Context, req *system.AppMenusDeleteReq) (res *system.AppMenusDeleteRes, err error) {
|
||||
err = service.AppMenus().Delete(ctx, req.MenuIds)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/app_role_menus.go
Normal file
53
internal/app/system/controller/app_role_menus.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-05-28 15:11:15
|
||||
// 生成路径: internal/app/system/controller/app_role_menus.go
|
||||
// 生成人:gfast
|
||||
// desc:app角色绑定菜单
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type appRoleMenusController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var AppRoleMenus = new(appRoleMenusController)
|
||||
|
||||
// List 列表
|
||||
func (c *appRoleMenusController) List(ctx context.Context, req *system.AppRoleMenusSearchReq) (res *system.AppRoleMenusSearchRes, err error) {
|
||||
res, err = service.AppRoleMenus().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取app角色绑定菜单
|
||||
func (c *appRoleMenusController) Get(ctx context.Context, req *system.AppRoleMenusGetReq) (res *system.AppRoleMenusGetRes, err error) {
|
||||
res = new(system.AppRoleMenusGetRes)
|
||||
res.AppRoleMenusInfoRes, err = service.AppRoleMenus().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加app角色绑定菜单
|
||||
func (c *appRoleMenusController) Add(ctx context.Context, req *system.AppRoleMenusAddReq) (res *system.AppRoleMenusAddRes, err error) {
|
||||
err = service.AppRoleMenus().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改app角色绑定菜单
|
||||
func (c *appRoleMenusController) Edit(ctx context.Context, req *system.AppRoleMenusEditReq) (res *system.AppRoleMenusEditRes, err error) {
|
||||
err = service.AppRoleMenus().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除app角色绑定菜单
|
||||
func (c *appRoleMenusController) Delete(ctx context.Context, req *system.AppRoleMenusDeleteReq) (res *system.AppRoleMenusDeleteRes, err error) {
|
||||
err = service.AppRoleMenus().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
117
internal/app/system/controller/app_roles.go
Normal file
117
internal/app/system/controller/app_roles.go
Normal file
@ -0,0 +1,117 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-05-28 15:11:36
|
||||
// 生成路径: internal/app/system/controller/app_roles.go
|
||||
// 生成人:gfast
|
||||
// desc:app角色
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model/do"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model/entity"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
type appRolesController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var AppRoles = new(appRolesController)
|
||||
|
||||
// List 列表
|
||||
func (c *appRolesController) List(ctx context.Context, req *system.AppRolesSearchReq) (res *system.AppRolesSearchRes, err error) {
|
||||
res, err = service.AppRoles().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取app角色
|
||||
func (c *appRolesController) Get(ctx context.Context, req *system.AppRolesGetReq) (res *system.AppRolesGetRes, err error) {
|
||||
res = new(system.AppRolesGetRes)
|
||||
res.AppRolesInfoRes, err = service.AppRoles().GetByRoleId(ctx, req.RoleId)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加app角色
|
||||
func (c *appRolesController) Add(ctx context.Context, req *system.AppRolesAddReq) (res *system.AppRolesAddRes, err error) {
|
||||
err = service.AppRoles().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改app角色
|
||||
func (c *appRolesController) Edit(ctx context.Context, req *system.AppRolesEditReq) (res *system.AppRolesEditRes, err error) {
|
||||
err = service.AppRoles().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除app角色
|
||||
func (c *appRolesController) Delete(ctx context.Context, req *system.AppRolesDeleteReq) (res *system.AppRolesDeleteRes, err error) {
|
||||
err = service.AppRoles().Delete(ctx, req.RoleIds)
|
||||
return
|
||||
}
|
||||
|
||||
// AddMenu 添加角色时绑定菜单
|
||||
func (c *appRolesController) AddMenu(ctx context.Context, req *system.AppRolesAddMenuReq) (*system.AppRolesAddMenuRes, error) {
|
||||
err := g.Try(ctx, func(ctx context.Context) {
|
||||
var roleID uint
|
||||
|
||||
// 判断角色名是否存在
|
||||
var appRoles entity.AppRoles
|
||||
if err := dao.AppRoles.Ctx(ctx).Where(dao.AppRoles.Columns().RoleName, req.RoleName).Scan(&appRoles); errors.Is(err, sql.ErrNoRows) {
|
||||
roleId, err := dao.AppRoles.Ctx(ctx).Data(do.AppRoles{
|
||||
RoleName: req.RoleName,
|
||||
}).InsertAndGetId()
|
||||
liberr.ErrIsNil(ctx, err, "添加角色失败")
|
||||
roleID = uint(roleId)
|
||||
} else {
|
||||
roleID = appRoles.RoleId
|
||||
}
|
||||
|
||||
if len(req.MenuIds) > 0 {
|
||||
insertData := make([]do.AppRoleMenus, 0, len(req.MenuIds))
|
||||
for _, menuId := range req.MenuIds {
|
||||
insertData = append(insertData, do.AppRoleMenus{
|
||||
RoleId: roleID,
|
||||
MenuId: menuId,
|
||||
})
|
||||
}
|
||||
|
||||
// 删除原有的角色菜单
|
||||
_, err := dao.AppRoleMenus.Ctx(ctx).Where("role_id", roleID).Delete()
|
||||
liberr.ErrIsNil(ctx, err, "删除角色菜单失败")
|
||||
_, err = dao.AppRoleMenus.Ctx(ctx).Where("role_id", roleID).Data(insertData).Insert()
|
||||
liberr.ErrIsNil(ctx, err, "添加角色菜单失败")
|
||||
}
|
||||
})
|
||||
|
||||
return &system.AppRolesAddMenuRes{}, err
|
||||
}
|
||||
|
||||
// 获取一个角色的菜单
|
||||
func (c *appRolesController) GetRoleMenus(ctx context.Context, req *system.AppRolesGetMenuReq) (*system.AppRolesGetMenuRes, error) {
|
||||
res := new(system.AppRolesGetMenuRes)
|
||||
err := g.Try(ctx, func(ctx context.Context) {
|
||||
err := dao.AppRoles.Ctx(ctx).WithAll().Where(dao.AppRoles.Columns().RoleId, req.RoleId).Scan(&res.List)
|
||||
|
||||
// SELECT m.menu_id, m.menu_name
|
||||
// FROM app_menus m
|
||||
// JOIN app_role_menus rm ON m.menu_id = rm.menu_id
|
||||
// WHERE rm.role_id = 3;
|
||||
|
||||
dao.AppMenus.Ctx(ctx).As("m").Fields("m.menu_id, m.menu_name").
|
||||
InnerJoin("app_role_menus rm", "m.menu_id = rm.menu_id").Where("rm.role_id", req.RoleId).Scan(&res.List.Menus)
|
||||
|
||||
liberr.ErrIsNil(ctx, err, "获取信息失败")
|
||||
})
|
||||
return res, err
|
||||
}
|
53
internal/app/system/controller/app_user_disable_menus.go
Normal file
53
internal/app/system/controller/app_user_disable_menus.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-05-28 15:11:37
|
||||
// 生成路径: internal/app/system/controller/app_user_disable_menus.go
|
||||
// 生成人:gfast
|
||||
// desc:app用户禁用菜单关联
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type appUserDisableMenusController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var AppUserDisableMenus = new(appUserDisableMenusController)
|
||||
|
||||
// List 列表
|
||||
func (c *appUserDisableMenusController) List(ctx context.Context, req *system.AppUserDisableMenusSearchReq) (res *system.AppUserDisableMenusSearchRes, err error) {
|
||||
res, err = service.AppUserDisableMenus().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取app用户禁用菜单关联
|
||||
func (c *appUserDisableMenusController) Get(ctx context.Context, req *system.AppUserDisableMenusGetReq) (res *system.AppUserDisableMenusGetRes, err error) {
|
||||
res = new(system.AppUserDisableMenusGetRes)
|
||||
res.AppUserDisableMenusInfoRes, err = service.AppUserDisableMenus().GetByUserDisabledMenuId(ctx, req.UserDisabledMenuId)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加app用户禁用菜单关联
|
||||
func (c *appUserDisableMenusController) Add(ctx context.Context, req *system.AppUserDisableMenusAddReq) (res *system.AppUserDisableMenusAddRes, err error) {
|
||||
err = service.AppUserDisableMenus().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改app用户禁用菜单关联
|
||||
func (c *appUserDisableMenusController) Edit(ctx context.Context, req *system.AppUserDisableMenusEditReq) (res *system.AppUserDisableMenusEditRes, err error) {
|
||||
err = service.AppUserDisableMenus().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除app用户禁用菜单关联
|
||||
func (c *appUserDisableMenusController) Delete(ctx context.Context, req *system.AppUserDisableMenusDeleteReq) (res *system.AppUserDisableMenusDeleteRes, err error) {
|
||||
err = service.AppUserDisableMenus().Delete(ctx, req.UserDisabledMenuIds)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/app_user_menus.go
Normal file
53
internal/app/system/controller/app_user_menus.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-05-28 15:11:37
|
||||
// 生成路径: internal/app/system/controller/app_user_menus.go
|
||||
// 生成人:gfast
|
||||
// desc:app用户菜单关联
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type appUserMenusController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var AppUserMenus = new(appUserMenusController)
|
||||
|
||||
// List 列表
|
||||
func (c *appUserMenusController) List(ctx context.Context, req *system.AppUserMenusSearchReq) (res *system.AppUserMenusSearchRes, err error) {
|
||||
res, err = service.AppUserMenus().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取app用户菜单关联
|
||||
func (c *appUserMenusController) Get(ctx context.Context, req *system.AppUserMenusGetReq) (res *system.AppUserMenusGetRes, err error) {
|
||||
res = new(system.AppUserMenusGetRes)
|
||||
res.AppUserMenusInfoRes, err = service.AppUserMenus().GetByUserMenuId(ctx, req.UserMenuId)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加app用户菜单关联
|
||||
func (c *appUserMenusController) Add(ctx context.Context, req *system.AppUserMenusAddReq) (res *system.AppUserMenusAddRes, err error) {
|
||||
err = service.AppUserMenus().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改app用户菜单关联
|
||||
func (c *appUserMenusController) Edit(ctx context.Context, req *system.AppUserMenusEditReq) (res *system.AppUserMenusEditRes, err error) {
|
||||
err = service.AppUserMenus().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除app用户菜单关联
|
||||
func (c *appUserMenusController) Delete(ctx context.Context, req *system.AppUserMenusDeleteReq) (res *system.AppUserMenusDeleteRes, err error) {
|
||||
err = service.AppUserMenus().Delete(ctx, req.UserMenuIds)
|
||||
return
|
||||
}
|
132
internal/app/system/controller/app_user_roles.go
Normal file
132
internal/app/system/controller/app_user_roles.go
Normal file
@ -0,0 +1,132 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-05-28 15:11:37
|
||||
// 生成路径: internal/app/system/controller/app_user_roles.go
|
||||
// 生成人:gfast
|
||||
// desc:app用户角色关联
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type appUserRolesController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var AppUserRoles = new(appUserRolesController)
|
||||
|
||||
// List 列表
|
||||
func (c *appUserRolesController) List(ctx context.Context, req *system.AppUserRolesSearchReq) (res *system.AppUserRolesSearchRes, err error) {
|
||||
res, err = service.AppUserRoles().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取app用户角色关联
|
||||
func (c *appUserRolesController) Get(ctx context.Context, req *system.AppUserRolesGetReq) (res *system.AppUserRolesGetRes, err error) {
|
||||
res = new(system.AppUserRolesGetRes)
|
||||
res.AppUserRolesInfoRes, err = service.AppUserRoles().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加app用户角色关联
|
||||
func (c *appUserRolesController) Add(ctx context.Context, req *system.AppUserRolesAddReq) (res *system.AppUserRolesAddRes, err error) {
|
||||
err = service.AppUserRoles().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改app用户角色关联
|
||||
func (c *appUserRolesController) Edit(ctx context.Context, req *system.AppUserRolesEditReq) (res *system.AppUserRolesEditRes, err error) {
|
||||
err = service.AppUserRoles().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除app用户角色关联
|
||||
func (c *appUserRolesController) Delete(ctx context.Context, req *system.AppUserRolesDeleteReq) (res *system.AppUserRolesDeleteRes, err error) {
|
||||
err = service.AppUserRoles().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// BindRole给用户绑定角色
|
||||
func (c *appUserRolesController) BindRole(ctx context.Context, req *system.AppUserRolesBindReq) (res *system.AppUserRolesBindRes, err error) {
|
||||
err = service.AppUserRoles().BindRole(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取用户的角色
|
||||
func (c *appUserRolesController) GetUserRoles(ctx context.Context, req *system.AppUserRolesGetRolesReq) (*system.AppUserRolesGetRolesRes, error) {
|
||||
// select ar.role_id,ar.role_name,aur.user_id,aur.major_role
|
||||
// from app_user_roles aur
|
||||
// join app_roles ar on aur.role_id = ar.role_id
|
||||
// where aur.user_id = 112 and aur.major_role in (0,1);
|
||||
query := dao.AppUserRoles.Ctx(ctx).As("aur").
|
||||
InnerJoin("app_roles ar", "aur.role_id = ar.role_id").
|
||||
Fields("ar.role_id, ar.role_name, aur.user_id, aur.major_role").
|
||||
Where("aur.user_id", req.UserID).
|
||||
Where("aur.major_role IN (0, 1)")
|
||||
|
||||
var roles []model.Ruler
|
||||
if err := query.Scan(&roles); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
roleMap := make(map[int][]model.Ruler)
|
||||
for _, role := range roles {
|
||||
roleMap[role.MajorRole] = append(roleMap[role.MajorRole], role)
|
||||
}
|
||||
|
||||
// 检查是否存在键 0 和 1
|
||||
adminRole, adminExists := roleMap[0]
|
||||
constructionRole, constructionExists := roleMap[1]
|
||||
|
||||
if !adminExists {
|
||||
adminRole = []model.Ruler{}
|
||||
}
|
||||
|
||||
if !constructionExists {
|
||||
constructionRole = []model.Ruler{}
|
||||
}
|
||||
|
||||
return &system.AppUserRolesGetRolesRes{
|
||||
AdminRole: adminRole,
|
||||
ConstructionRole: constructionRole,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetRoles 获取用户的角色
|
||||
func (c *appUserRolesController) GetRoles(ctx context.Context, req *system.AppUserRolesGetAllRolesReq) (res *system.AppUserRolesGetAllRolesRes, err error) {
|
||||
// select * from app_rules
|
||||
var roles []model.AppRoles
|
||||
if err := dao.AppRoles.Ctx(ctx).Scan(&roles); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
roleMap := make(map[int][]model.AppRoles)
|
||||
for _, role := range roles {
|
||||
roleMap[role.Tag] = append(roleMap[role.Tag], role)
|
||||
}
|
||||
|
||||
// 检查是否存在键 0 和 1
|
||||
adminRole, adminExists := roleMap[0]
|
||||
if !adminExists {
|
||||
adminRole = []model.AppRoles{}
|
||||
}
|
||||
|
||||
constructionRole, constructionExists := roleMap[1]
|
||||
if !constructionExists {
|
||||
constructionRole = []model.AppRoles{}
|
||||
}
|
||||
|
||||
return &system.AppUserRolesGetAllRolesRes{
|
||||
AdminRole: adminRole,
|
||||
ConstructionRole: constructionRole,
|
||||
}, nil
|
||||
}
|
22
internal/app/system/controller/base.go
Normal file
22
internal/app/system/controller/base.go
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* @desc:system base controller
|
||||
* @company:云南奇讯科技有限公司
|
||||
* @Author: yixiaohu
|
||||
* @Date: 2022/3/4 18:12
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
commonController "github.com/tiger1103/gfast/v3/internal/app/common/controller"
|
||||
)
|
||||
|
||||
type BaseController struct {
|
||||
commonController.BaseController
|
||||
}
|
||||
|
||||
// Init 自动执行的初始化方法
|
||||
func (c *BaseController) Init(r *ghttp.Request) {
|
||||
c.BaseController.Init(r)
|
||||
}
|
38
internal/app/system/controller/big_file.go
Normal file
38
internal/app/system/controller/big_file.go
Normal file
@ -0,0 +1,38 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type bigFile struct{}
|
||||
|
||||
var BigFile = new(bigFile)
|
||||
|
||||
func (c *bigFile) List(ctx context.Context, req *system.BigFileSearchReq) (res *system.BigFileSearchRes, err error) {
|
||||
return service.BigFile().List(ctx, req)
|
||||
}
|
||||
|
||||
// Add 添加系统参数
|
||||
func (c *bigFile) Add(ctx context.Context, req *system.BigFileAddReq) (res *system.BigFileAddRes, err error) {
|
||||
err = service.BigFile().Add(ctx, req, service.Context().GetUserId(ctx))
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取文件信息
|
||||
func (c *bigFile) Get(ctx context.Context, req *system.BigFileGetReq) (res *system.BigFileGetRes, err error) {
|
||||
return service.BigFile().Get(ctx, req.Id)
|
||||
}
|
||||
|
||||
// Edit 修改系统参数
|
||||
func (c *bigFile) Edit(ctx context.Context, req *system.BigFileEditReq) (res *system.BigFileEditRes, err error) {
|
||||
err = service.BigFile().Edit(ctx, req, service.Context().GetUserId(ctx))
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除系统参数
|
||||
func (c *bigFile) Delete(ctx context.Context, req *system.BigFileDeleteReq) (res *system.BigFileDeleteRes, err error) {
|
||||
err = service.BigFile().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
46
internal/app/system/controller/big_upload.go
Normal file
46
internal/app/system/controller/big_upload.go
Normal file
@ -0,0 +1,46 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/common/service"
|
||||
)
|
||||
|
||||
var BigUpload = new(bigUploadController)
|
||||
|
||||
type bigUploadController struct{}
|
||||
|
||||
// 上传分片文件
|
||||
func (c *bigUploadController) Upload(ctx context.Context, req *system.BigUploadReq) (res *system.BigUploadRes, err error) {
|
||||
r := g.RequestFromCtx(ctx)
|
||||
req = new(system.BigUploadReq)
|
||||
err = req.Bind(r.Request)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res, err = service.BigUpload().Upload(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// 上传文件检查
|
||||
func (c *bigUploadController) UploadCheck(ctx context.Context, req *system.BigUploadCheckReq) (res *system.BigUploadCheckRes, err error) {
|
||||
r := g.RequestFromCtx(ctx)
|
||||
req = new(system.BigUploadCheckReq)
|
||||
err = req.Bind(r.Request)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return service.BigUpload().UploadCheck(ctx, req)
|
||||
}
|
||||
|
||||
// 上传文件合并
|
||||
func (c *bigUploadController) UploadMerge(ctx context.Context, req *system.BigUploadMergeReq) (res *system.BigUploadRes, err error) {
|
||||
r := g.RequestFromCtx(ctx)
|
||||
req = new(system.BigUploadMergeReq)
|
||||
err = req.Bind(r.Request)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return service.BigUpload().UploadMerge(ctx, req)
|
||||
}
|
53
internal/app/system/controller/bus_askforleave.go
Normal file
53
internal/app/system/controller/bus_askforleave.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2025-03-27 14:14:25
|
||||
// 生成路径: internal/app/wxApplet/controller/bus_askforleave.go
|
||||
// 生成人:gfast
|
||||
// desc:请假
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/wxApplet/wxApplet"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/wxApplet/service"
|
||||
)
|
||||
|
||||
type busAskforleaveController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusAskforleave = new(busAskforleaveController)
|
||||
|
||||
// List 列表
|
||||
func (c *busAskforleaveController) List(ctx context.Context, req *wxApplet.BusAskforleaveSearchReq) (res *wxApplet.BusAskforleaveSearchRes, err error) {
|
||||
res, err = service.BusAskforleave().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取请假
|
||||
func (c *busAskforleaveController) Get(ctx context.Context, req *wxApplet.BusAskforleaveGetReq) (res *wxApplet.BusAskforleaveGetRes, err error) {
|
||||
res = new(wxApplet.BusAskforleaveGetRes)
|
||||
res.BusAskforleaveInfoRes, err = service.BusAskforleave().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
//// Add 添加请假
|
||||
//func (c *busAskforleaveController) Add(ctx context.Context, req *wxApplet.BusAskforleaveAddReq) (res *wxApplet.BusAskforleaveAddRes, err error) {
|
||||
// err = service.BusAskforleave().Add(ctx, req)
|
||||
// return
|
||||
//}
|
||||
|
||||
// Edit 修改请假
|
||||
func (c *busAskforleaveController) Edit(ctx context.Context, req *wxApplet.BusAskforleaveEditReq) (res *wxApplet.BusAskforleaveEditRes, err error) {
|
||||
err = service.BusAskforleave().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//// Delete 删除请假
|
||||
//func (c *busAskforleaveController) Delete(ctx context.Context, req *wxApplet.BusAskforleaveDeleteReq) (res *wxApplet.BusAskforleaveDeleteRes, err error) {
|
||||
// err = service.BusAskforleave().Delete(ctx, req.Ids)
|
||||
// return
|
||||
//}
|
83
internal/app/system/controller/bus_attendance_machine.go
Normal file
83
internal/app/system/controller/bus_attendance_machine.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2025-03-03 10:32:47
|
||||
// 生成路径: internal/app/system/controller/bus_attendance_machine.go
|
||||
// 生成人:gfast
|
||||
// desc:考勤机
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busAttendanceMachineController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusAttendanceMachine = new(busAttendanceMachineController)
|
||||
|
||||
// List 列表
|
||||
func (c *busAttendanceMachineController) List(ctx context.Context, req *system.BusAttendanceMachineSearchReq) (res *system.BusAttendanceMachineSearchRes, err error) {
|
||||
res, err = service.BusAttendanceMachine().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取考勤机
|
||||
func (c *busAttendanceMachineController) Get(ctx context.Context, req *system.BusAttendanceMachineGetReq) (res *system.BusAttendanceMachineGetRes, err error) {
|
||||
res = new(system.BusAttendanceMachineGetRes)
|
||||
res.BusAttendanceMachineExtendRes, err = service.BusAttendanceMachine().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加考勤机
|
||||
func (c *busAttendanceMachineController) Add(ctx context.Context, req *system.BusAttendanceMachineAddReq) (res *system.BusAttendanceMachineAddRes, err error) {
|
||||
err = service.BusAttendanceMachine().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改考勤机
|
||||
func (c *busAttendanceMachineController) Edit(ctx context.Context, req *system.BusAttendanceMachineEditReq) (res *system.BusAttendanceMachineEditRes, err error) {
|
||||
err = service.BusAttendanceMachine().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除考勤机
|
||||
func (c *busAttendanceMachineController) Delete(ctx context.Context, req *system.BusAttendanceMachineDeleteReq) (res *system.BusAttendanceMachineDeleteRes, err error) {
|
||||
err = service.BusAttendanceMachine().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// Change 变更考勤机状态
|
||||
func (c *busAttendanceMachineController) Change(ctx context.Context, req *system.BusAttendanceMachineChangeReq) (res *system.BusAttendanceMachineChangeRes, err error) {
|
||||
err = service.BusAttendanceMachine().Change(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// BindUserInformationToDevicesInBatches 批量将用户信息绑定到设备上
|
||||
func (c *busAttendanceMachineController) BindUserInformationToDevicesInBatches(ctx context.Context, req *system.BindUserInformationToDevicesInBatchesReq) (res *system.BindUserInformationToDevicesInBatchesRes, err error) {
|
||||
err = service.BusAttendanceMachine().BindUserInformationToDevicesInBatches(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteTheUserBoundToTheAttendanceMachineAndDevice 将考勤机和设备绑定的用户删除掉
|
||||
func (c *busAttendanceMachineController) DeleteTheUserBoundToTheAttendanceMachineAndDevice(ctx context.Context, req *system.DeleteTheUserBoundToTheAttendanceMachineAndDeviceReq) (res *system.DeleteTheUserBoundToTheAttendanceMachineAndDeviceRes, err error) {
|
||||
err = service.BusAttendanceMachine().DeleteTheUserBoundToTheAttendanceMachineAndDevice(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// SendTheUserInformationToTheAttendanceMachine 将用户信息下发到考勤机上
|
||||
func (c *busAttendanceMachineController) SendTheUserInformationToTheAttendanceMachine(ctx context.Context, req *system.SendTheUserInformationToTheAttendanceMachineReq) (res *system.SendTheUserInformationToTheAttendanceMachineRes, err error) {
|
||||
err = service.BusAttendanceMachine().SendTheUserInformationToTheAttendanceMachine(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// ObtainInformationAboutPersonnelAssociatedWithTheAttendanceDevice 获取考勤设备关联的人员信息
|
||||
func (c *busAttendanceMachineController) ObtainInformationAboutPersonnelAssociatedWithTheAttendanceDevice(ctx context.Context, req *system.ObtainInformationAboutPersonnelAssociatedWithTheAttendanceDeviceReq) (res *system.ObtainInformationAboutPersonnelAssociatedWithTheAttendanceDeviceRes, err error) {
|
||||
return service.BusAttendanceMachine().ObtainInformationAboutPersonnelAssociatedWithTheAttendanceDevice(ctx, req)
|
||||
return
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2025-03-03 10:33:17
|
||||
// 生成路径: internal/app/system/controller/bus_attendance_machine_user.go
|
||||
// 生成人:gfast
|
||||
// desc:考勤机用户列
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busAttendanceMachineUserController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusAttendanceMachineUser = new(busAttendanceMachineUserController)
|
||||
|
||||
// List 列表
|
||||
func (c *busAttendanceMachineUserController) List(ctx context.Context, req *system.BusAttendanceMachineUserSearchReq) (res *system.BusAttendanceMachineUserSearchRes, err error) {
|
||||
res, err = service.BusAttendanceMachineUser().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取考勤机用户列
|
||||
func (c *busAttendanceMachineUserController) Get(ctx context.Context, req *system.BusAttendanceMachineUserGetReq) (res *system.BusAttendanceMachineUserGetRes, err error) {
|
||||
res = new(system.BusAttendanceMachineUserGetRes)
|
||||
res.BusAttendanceMachineUserInfoRes, err = service.BusAttendanceMachineUser().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加考勤机用户列
|
||||
func (c *busAttendanceMachineUserController) Add(ctx context.Context, req *system.BusAttendanceMachineUserAddReq) (res *system.BusAttendanceMachineUserAddRes, err error) {
|
||||
err = service.BusAttendanceMachineUser().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改考勤机用户列
|
||||
func (c *busAttendanceMachineUserController) Edit(ctx context.Context, req *system.BusAttendanceMachineUserEditReq) (res *system.BusAttendanceMachineUserEditRes, err error) {
|
||||
err = service.BusAttendanceMachineUser().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除考勤机用户列
|
||||
func (c *busAttendanceMachineUserController) Delete(ctx context.Context, req *system.BusAttendanceMachineUserDeleteReq) (res *system.BusAttendanceMachineUserDeleteRes, err error) {
|
||||
err = service.BusAttendanceMachineUser().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_category.go
Normal file
53
internal/app/system/controller/bus_category.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-10-07 15:52:19
|
||||
// 生成路径: internal/app/system/controller/bus_category.go
|
||||
// 生成人:gfast
|
||||
// desc:题库_题库类别
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busCategoryController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusCategory = new(busCategoryController)
|
||||
|
||||
// List 列表
|
||||
func (c *busCategoryController) List(ctx context.Context, req *system.BusCategorySearchReq) (res *system.BusCategorySearchRes, err error) {
|
||||
res, err = service.BusCategory().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取题库_题库类别
|
||||
func (c *busCategoryController) Get(ctx context.Context, req *system.BusCategoryGetReq) (res *system.BusCategoryGetRes, err error) {
|
||||
res = new(system.BusCategoryGetRes)
|
||||
res.BusCategoryInfoRes, err = service.BusCategory().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加题库_题库类别
|
||||
func (c *busCategoryController) Add(ctx context.Context, req *system.BusCategoryAddReq) (res *system.BusCategoryAddRes, err error) {
|
||||
err = service.BusCategory().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改题库_题库类别
|
||||
func (c *busCategoryController) Edit(ctx context.Context, req *system.BusCategoryEditReq) (res *system.BusCategoryEditRes, err error) {
|
||||
err = service.BusCategory().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除题库_题库类别
|
||||
func (c *busCategoryController) Delete(ctx context.Context, req *system.BusCategoryDeleteReq) (res *system.BusCategoryDeleteRes, err error) {
|
||||
err = service.BusCategory().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
60
internal/app/system/controller/bus_company.go
Normal file
60
internal/app/system/controller/bus_company.go
Normal file
@ -0,0 +1,60 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-07-28 14:08:14
|
||||
// 生成路径: internal/app/system/controller/bus_company.go
|
||||
// 生成人:gfast
|
||||
// desc:公司
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busCompanyController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusCompany = new(busCompanyController)
|
||||
|
||||
// List 列表
|
||||
func (c *busCompanyController) List(ctx context.Context, req *system.BusCompanySearchReq) (res *system.BusCompanySearchRes, err error) {
|
||||
res, err = service.BusCompany().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取公司
|
||||
func (c *busCompanyController) Get(ctx context.Context, req *system.BusCompanyGetReq) (res *system.BusCompanyGetRes, err error) {
|
||||
res = new(system.BusCompanyGetRes)
|
||||
res.BusCompanyInfoRes, err = service.BusCompany().GetByCompanyId(ctx, req.CompanyId)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加公司
|
||||
func (c *busCompanyController) Add(ctx context.Context, req *system.BusCompanyAddReq) (res *system.BusCompanyAddRes, err error) {
|
||||
err = service.BusCompany().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改公司
|
||||
func (c *busCompanyController) Edit(ctx context.Context, req *system.BusCompanyEditReq) (res *system.BusCompanyEditRes, err error) {
|
||||
err = service.BusCompany().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除公司
|
||||
func (c *busCompanyController) Delete(ctx context.Context, req *system.BusCompanyDeleteReq) (res *system.BusCompanyDeleteRes, err error) {
|
||||
err = service.BusCompany().Delete(ctx, req.CompanyIds)
|
||||
return
|
||||
}
|
||||
|
||||
//app
|
||||
|
||||
func (c *busCompanyController) AppList(ctx context.Context, req *system.BusCompanyAppSearchReq) (res *system.BusCompanyAppSearchRes, err error) {
|
||||
res, err = service.BusCompany().AppList(ctx, req)
|
||||
return
|
||||
}
|
60
internal/app/system/controller/bus_complaint_box.go
Normal file
60
internal/app/system/controller/bus_complaint_box.go
Normal file
@ -0,0 +1,60 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-12-04 18:09:50
|
||||
// 生成路径: internal/app/system/controller/bus_complaint_box.go
|
||||
// 生成人:gfast
|
||||
// desc:意见箱
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
wxSystem "github.com/tiger1103/gfast/v3/api/wxApplet/wxApplet"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busComplaintBoxController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusComplaintBox = new(busComplaintBoxController)
|
||||
|
||||
// List 列表
|
||||
func (c *busComplaintBoxController) List(ctx context.Context, req *system.BusComplaintBoxSearchReq) (res *system.BusComplaintBoxSearchRes, err error) {
|
||||
res, err = service.BusComplaintBox().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取意见箱
|
||||
func (c *busComplaintBoxController) Get(ctx context.Context, req *system.BusComplaintBoxGetReq) (res *system.BusComplaintBoxGetRes, err error) {
|
||||
res = new(system.BusComplaintBoxGetRes)
|
||||
res.BusComplaintBoxInfoRes, err = service.BusComplaintBox().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改意见箱
|
||||
func (c *busComplaintBoxController) Edit(ctx context.Context, req *system.BusComplaintBoxEditReq) (res *system.BusComplaintBoxEditRes, err error) {
|
||||
err = service.BusComplaintBox().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除意见箱
|
||||
func (c *busComplaintBoxController) Delete(ctx context.Context, req *system.BusComplaintBoxDeleteReq) (res *system.BusComplaintBoxDeleteRes, err error) {
|
||||
err = service.BusComplaintBox().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// AppletList 获取当前人的所有意见(根据openid查询)
|
||||
func (c *busComplaintBoxController) AppletList(ctx context.Context, req *wxSystem.AppletComplaintBoxSearchReq) (res *wxSystem.AppletComplaintBoxSearchRes, err error) {
|
||||
res, err = service.BusComplaintBox().AppletList(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// AppletAdd 添加意见箱
|
||||
func (c *busComplaintBoxController) AppletAdd(ctx context.Context, req *wxSystem.AppletComplaintBoxAddReq) (res *wxSystem.AppletComplaintBoxAddRes, err error) {
|
||||
err = service.BusComplaintBox().AppletAdd(ctx, req)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_construction_blacklist.go
Normal file
53
internal/app/system/controller/bus_construction_blacklist.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-11-10 14:08:39
|
||||
// 生成路径: internal/app/system/controller/bus_construction_blacklist.go
|
||||
// 生成人:gfast
|
||||
// desc:黑名单
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busConstructionBlacklistController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusConstructionBlacklist = new(busConstructionBlacklistController)
|
||||
|
||||
// List 列表
|
||||
func (c *busConstructionBlacklistController) List(ctx context.Context, req *system.BusConstructionBlacklistSearchReq) (res *system.BusConstructionBlacklistSearchRes, err error) {
|
||||
res, err = service.BusConstructionBlacklist().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取黑名单
|
||||
func (c *busConstructionBlacklistController) Get(ctx context.Context, req *system.BusConstructionBlacklistGetReq) (res *system.BusConstructionBlacklistGetRes, err error) {
|
||||
res = new(system.BusConstructionBlacklistGetRes)
|
||||
res.BusConstructionBlacklistInfoRes, err = service.BusConstructionBlacklist().GetByOpenid(ctx, req.Openid)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加黑名单
|
||||
func (c *busConstructionBlacklistController) Add(ctx context.Context, req *system.BusConstructionBlacklistAddReq) (res *system.BusConstructionBlacklistAddRes, err error) {
|
||||
err = service.BusConstructionBlacklist().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除黑名单
|
||||
func (c *busConstructionBlacklistController) Delete(ctx context.Context, req *system.BusConstructionBlacklistDeleteReq) (res *system.BusConstructionBlacklistDeleteRes, err error) {
|
||||
err = service.BusConstructionBlacklist().Delete(ctx, req.Openids)
|
||||
return
|
||||
}
|
||||
|
||||
// BlackListFunc 黑名单人员列表查询
|
||||
func (c *busConstructionBlacklistController) BlackListFunc(ctx context.Context, req *system.BlackListReq) (res *system.BlackListRes, err error) {
|
||||
res, err = service.BusConstructionBlacklist().BlackListFunc(ctx, req)
|
||||
return
|
||||
}
|
74
internal/app/system/controller/bus_construction_log.go
Normal file
74
internal/app/system/controller/bus_construction_log.go
Normal file
@ -0,0 +1,74 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-03-22 16:27:43
|
||||
// 生成路径: internal/app/system/controller/bus_construction_log.go
|
||||
// 生成人:gfast
|
||||
// desc:施工日志
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/api/wxApplet/wxApplet"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busConstructionLogController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusConstructionLog = new(busConstructionLogController)
|
||||
|
||||
// ConstructionLogAdd 小程序-新增
|
||||
func (c *busConstructionLogController) ConstructionLogAdd(ctx context.Context, req *wxApplet.ConstructionLogAddReq) (res *wxApplet.ConstructionLogAddRes, err error) {
|
||||
err = service.BusConstructionLog().ConstructionLogAdd(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// ConstructionLogDetails 小程序-详情
|
||||
func (c *busConstructionLogController) ConstructionLogDetails(ctx context.Context, req *wxApplet.ConstructionLogDetailsReq) (res *wxApplet.ConstructionLogDetailsRes, err error) {
|
||||
res = new(wxApplet.ConstructionLogDetailsRes)
|
||||
res, err = service.BusConstructionLog().ConstructionLogDetails(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// ConstructionLogList 小程序-列表
|
||||
func (c *busConstructionLogController) ConstructionLogList(ctx context.Context, req *wxApplet.ConstructionLogListReq) (res *wxApplet.ConstructionLogListRes, err error) {
|
||||
res = new(wxApplet.ConstructionLogListRes)
|
||||
res, err = service.BusConstructionLog().ConstructionLogList(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// List 列表
|
||||
func (c *busConstructionLogController) List(ctx context.Context, req *system.BusConstructionLogSearchReq) (res *system.BusConstructionLogSearchRes, err error) {
|
||||
res, err = service.BusConstructionLog().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取施工日志
|
||||
func (c *busConstructionLogController) Get(ctx context.Context, req *system.BusConstructionLogGetReq) (res *system.BusConstructionLogGetRes, err error) {
|
||||
res = new(system.BusConstructionLogGetRes)
|
||||
res.DataEntity, err = service.BusConstructionLog().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加施工日志
|
||||
func (c *busConstructionLogController) Add(ctx context.Context, req *system.BusConstructionLogAddReq) (res *system.BusConstructionLogAddRes, err error) {
|
||||
err = service.BusConstructionLog().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改施工日志
|
||||
func (c *busConstructionLogController) Edit(ctx context.Context, req *system.BusConstructionLogEditReq) (res *system.BusConstructionLogEditRes, err error) {
|
||||
err = service.BusConstructionLog().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除施工日志
|
||||
func (c *busConstructionLogController) Delete(ctx context.Context, req *system.BusConstructionLogDeleteReq) (res *system.BusConstructionLogDeleteRes, err error) {
|
||||
err = service.BusConstructionLog().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_construction_project.go
Normal file
53
internal/app/system/controller/bus_construction_project.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-08-07 10:17:50
|
||||
// 生成路径: internal/app/system/controller/bus_construction_project.go
|
||||
// 生成人:gfast
|
||||
// desc:施工人员对应项目
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busConstructionProjectController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusConstructionProject = new(busConstructionProjectController)
|
||||
|
||||
// List 列表
|
||||
func (c *busConstructionProjectController) List(ctx context.Context, req *system.BusConstructionProjectSearchReq) (res *system.BusConstructionProjectSearchRes, err error) {
|
||||
res, err = service.BusConstructionProject().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取施工人员对应项目
|
||||
func (c *busConstructionProjectController) Get(ctx context.Context, req *system.BusConstructionProjectGetReq) (res *system.BusConstructionProjectGetRes, err error) {
|
||||
res = new(system.BusConstructionProjectGetRes)
|
||||
res.BusConstructionProjectInfoRes, err = service.BusConstructionProject().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加施工人员对应项目
|
||||
func (c *busConstructionProjectController) Add(ctx context.Context, req *system.BusConstructionProjectAddReq) (res *system.BusConstructionProjectAddRes, err error) {
|
||||
err = service.BusConstructionProject().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改施工人员对应项目
|
||||
func (c *busConstructionProjectController) Edit(ctx context.Context, req *system.BusConstructionProjectEditReq) (res *system.BusConstructionProjectEditRes, err error) {
|
||||
err = service.BusConstructionProject().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除施工人员对应项目
|
||||
func (c *busConstructionProjectController) Delete(ctx context.Context, req *system.BusConstructionProjectDeleteReq) (res *system.BusConstructionProjectDeleteRes, err error) {
|
||||
err = service.BusConstructionProject().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
274
internal/app/system/controller/bus_construction_user.go
Normal file
274
internal/app/system/controller/bus_construction_user.go
Normal file
@ -0,0 +1,274 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-08-07 10:31:18
|
||||
// 生成路径: internal/app/system/controller/bus_construction_user.go
|
||||
// 生成人:gfast
|
||||
// desc:施工人员
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/common/coryCommon"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
logic "github.com/tiger1103/gfast/v3/internal/app/system/logic/manageAirline"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
wxModel "github.com/tiger1103/gfast/v3/internal/app/wxApplet/model"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type busConstructionUserController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusConstructionUser = new(busConstructionUserController)
|
||||
|
||||
// ExportDataFunc 导出施工人员数据查询
|
||||
func (c *busConstructionUserController) ExportDataFunc(ctx context.Context, req *system.BusConstructionUserSearchReq) (res *system.BusConstructionUserSearchRes, err error) {
|
||||
res, err = service.BusConstructionUser().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// List 列表
|
||||
func (c *busConstructionUserController) List(ctx context.Context, req *system.BusConstructionUserSearchReq) (res *system.BusConstructionUserSearchRes, err error) {
|
||||
res, err = service.BusConstructionUser().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取施工人员
|
||||
func (c *busConstructionUserController) Get(ctx context.Context, req *system.BusConstructionUserGetReq) (res *system.BusConstructionUserGetRes, err error) {
|
||||
res = new(system.BusConstructionUserGetRes)
|
||||
res.BusConstructionUserInfoRes, err = service.BusConstructionUser().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
//// Add 添加施工人员
|
||||
//func (c *busConstructionUserController) Add(ctx context.Context, req *system.BusConstructionUserAddReq) (res *system.BusConstructionUserAddRes, err error) {
|
||||
// err = service.BusConstructionUser().Add(ctx, req)
|
||||
// return
|
||||
//}
|
||||
|
||||
// Edit 修改施工人员
|
||||
func (c *busConstructionUserController) Edit(ctx context.Context, req *system.BusConstructionUserEditReq) (res *system.BusConstructionUserEditRes, err error) {
|
||||
err = service.BusConstructionUser().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//// Delete 删除施工人员
|
||||
//func (c *busConstructionUserController) Delete(ctx context.Context, req *system.BusConstructionUserDeleteReq) (res *system.BusConstructionUserDeleteRes, err error) {
|
||||
// err = service.BusConstructionUser().Delete(ctx, req.Ids)
|
||||
// return
|
||||
//}
|
||||
|
||||
// BatchImportDataFunc 批量导入施工人员的资料
|
||||
func (c *busConstructionUserController) BatchImportDataFunc(ctx context.Context, req *system.BatchImportDataReq) (res *system.BatchImportDataRes, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
//2、调用java那边的接口,得到文件里面的内容
|
||||
rpath := coryCommon.ResourcePublicToFunc("/"+req.File.Url, 2)
|
||||
cwd := "/" + coryCommon.Ynr(coryCommon.GetCWD()+coryCommon.Helmet)
|
||||
jsonData, err := logic.ExcelConvert(ctx, rpath, cwd)
|
||||
//3、根据文件里的内容转成对应的实体类
|
||||
var nestedList []map[int]model.ExcelEntity
|
||||
err = json.Unmarshal([]byte(jsonData), &nestedList)
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
return
|
||||
}
|
||||
//7、删除文件
|
||||
os.Remove(rpath)
|
||||
//4、查询到对应数据的id,返回id+身份证号码
|
||||
var identityCard []string
|
||||
for i, m := range nestedList {
|
||||
num := i + 1
|
||||
// 不看第一排的数据(表头不看)
|
||||
if num > 1 {
|
||||
//根据数据内容的身份证去获取到对应的数据ID
|
||||
for key, value := range m {
|
||||
if key == 0 {
|
||||
identityCard = append(identityCard, value.Data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var userEntity []*model.BusConstructionUserInfoRes
|
||||
err = dao.BusConstructionUser.Ctx(ctx).WhereIn("sfz_number", identityCard).Fields("id,sfz_number").Scan(&userEntity)
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
return
|
||||
}
|
||||
//5、将数据中的身份证号码替换成对应的ID.
|
||||
dataList := make([]map[int]model.ExcelEntity, 0) //这里表示在数据库找到了的数据,这些用户的资料可以上传
|
||||
for i, m := range nestedList {
|
||||
num := i + 1
|
||||
// 不看第一排的数据(表头不看)
|
||||
if num > 1 {
|
||||
for key, _ := range m {
|
||||
//key为0表示身份证这一列,这一列不需要
|
||||
if key != 0 {
|
||||
continue
|
||||
}
|
||||
temp := nestedList[i][key]
|
||||
for j := range userEntity {
|
||||
if userEntity[j].SfzNumber == temp.Data {
|
||||
userId := strconv.FormatInt(userEntity[j].Id, 10)
|
||||
temp.Data = userId
|
||||
nestedList[i][key] = temp
|
||||
dataList = append(dataList, nestedList[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var updateSql = ""
|
||||
for i, m := range dataList {
|
||||
userId := dataList[i][0].Data
|
||||
for key, _ := range m {
|
||||
if key == 0 {
|
||||
continue
|
||||
}
|
||||
itoa := strconv.Itoa(key + 3)
|
||||
if key == 6 {
|
||||
itoa = strconv.Itoa(key + 3 + 1)
|
||||
}
|
||||
toFunc := coryCommon.ResourcePublicToFunc(dataList[i][key].Data, 1)
|
||||
updateSql = updateSql + "UPDATE bus_construction_user_file SET path = " + "'" + toFunc + "'" + " WHERE user_id = " + userId + " and user_img_type = " + itoa + ";"
|
||||
}
|
||||
}
|
||||
//6、将数据存储到
|
||||
_, err = g.DB().Exec(ctx, updateSql)
|
||||
liberr.ErrIsNil(ctx, err, "批量操作失败!")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// ExportSalaryTeamFunc 导出施工人员工资组成(项目)
|
||||
func (c *busConstructionUserController) ExportSalaryTeamFunc(ctx context.Context, req *system.ExportSalaryTeamReq) (res *system.ExportSalaryRes, err error) {
|
||||
res = new(system.ExportSalaryRes)
|
||||
salaryReq := system.ExportSalaryReq{
|
||||
ProjectId: req.ProjectId,
|
||||
TeamId: req.TeamId,
|
||||
FuzzyQuery: req.FuzzyQuery,
|
||||
TypeOfWork: req.TypeOfWork,
|
||||
DateStr: req.DateStr,
|
||||
}
|
||||
res, err = service.BusConstructionUser().ExportSalaryFunc(ctx, &salaryReq)
|
||||
return
|
||||
}
|
||||
|
||||
// ExportSalaryFunc 导出施工人员工资组成(班组)
|
||||
func (c *busConstructionUserController) ExportSalaryFunc(ctx context.Context, req *system.ExportSalaryReq) (res *system.ExportSalaryRes, err error) {
|
||||
res = new(system.ExportSalaryRes)
|
||||
res, err = service.BusConstructionUser().ExportSalaryFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// SigningMessagesFunc 【签名】根据openid获取到指定小程序用户的签名信息
|
||||
func (c *busConstructionUserController) SigningMessagesFunc(ctx context.Context, req *system.SigningMessagesReq) (res *system.SigningMessagesRes, err error) {
|
||||
res = new(system.SigningMessagesRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
var signature *wxModel.BusConstructiomUserSignatureRes
|
||||
err = g.DB().Model("bus_constructiom_user_signature").Where("openid", req.Openid).Scan(&signature)
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
if signature != nil {
|
||||
signature.Signature = strings.Replace(signature.Signature, "resource/public", "/wxfile", 1)
|
||||
res.Signature = signature
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// SigningUpdateFunc 【签名】修改指定签名的状态(change是否更改签名(1不更改 2更改))
|
||||
func (c *busConstructionUserController) SigningUpdateFunc(ctx context.Context, req *system.SigningUpdateFuncReq) (res *system.SigningUpdateFuncRes, err error) {
|
||||
res = new(system.SigningUpdateFuncRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err := g.DB().Model("bus_constructiom_user_signature").WherePri(req.Id).Update(g.Map{"change": req.Change})
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// OneClickOpenFunc 一键开启/关闭打开
|
||||
func (c *busConstructionUserController) OneClickOpenFunc(ctx context.Context, req *system.OneClickOpenReq) (res *system.OneClickOpenRes, err error) {
|
||||
res = new(system.OneClickOpenRes)
|
||||
err = service.BusConstructionUser().OneClickOpenFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// ClockingConditionFunc 开启/关闭打开(根据某个人)
|
||||
func (c *busConstructionUserController) ClockingConditionFunc(ctx context.Context, req *system.ClockingConditionReq) (res *system.ClockingConditionRes, err error) {
|
||||
res = new(system.ClockingConditionRes)
|
||||
err = service.BusConstructionUser().ClockingConditionFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// TemplateExportFunc 施工人员资料文件上传模板导出
|
||||
func (c *busConstructionUserController) TemplateExportFunc(ctx context.Context, req *system.TemplateExportReq) (res *system.TemplateExportRes, err error) {
|
||||
res = new(system.TemplateExportRes)
|
||||
res.Path, err = service.BusConstructionUser().TemplateExportFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// ZipFolderuploadFunc 批量上传施工人员的资料(压缩文件zip上传)
|
||||
func (c *busConstructionUserController) ZipFolderuploadFunc(ctx context.Context, req *system.ZipFolderuploadReq) (res *system.ZipFolderuploadRes, err error) {
|
||||
res = new(system.ZipFolderuploadRes)
|
||||
err = service.BusConstructionUser().ZipFolderuploadFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DepartureFunc 离场(成员离开班组)
|
||||
func (c *busConstructionUserController) DepartureFunc(ctx context.Context, req *system.DepartureReq) (res *system.DepartureRes, err error) {
|
||||
err = service.BusConstructionUser().DepartureFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DepartureRecordFunc 施工人员入场退场历史记录信息(根据身份证信息查询)
|
||||
func (c *busConstructionUserController) DepartureRecordFunc(ctx context.Context, req *system.DepartureRecordReq) (res *system.DepartureRecordRes, err error) {
|
||||
res = new(system.DepartureRecordRes)
|
||||
res, err = service.BusConstructionUser().DepartureRecordFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// PcCollectDataForTwoWeeksFunc 获取最近两周指定项目的考勤数据(统计全勤、半勤、缺勤)
|
||||
func (c *busConstructionUserController) PcCollectDataForTwoWeeksFunc(ctx context.Context, req *system.PcCollectDataForTwoWeeksReq) (res *system.PcCollectDataForTwoWeeksRes, err error) {
|
||||
res, err = service.BusConstructionUser().PcCollectDataForTwoWeeksFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//// PcEmployeeAttendanceFunc 员工考勤情况
|
||||
//func (c *busConstructionUserController) PcEmployeeAttendanceFunc(ctx context.Context, req *system.PcCollectDataForTwoWeeksReq) (res *system.PcCollectDataForTwoWeeksRes, err error) {
|
||||
// res, err = service.BusConstructionUser().PcCollectDataForTwoWeeksFunc(ctx, req)
|
||||
// return
|
||||
//}
|
||||
|
||||
// PcSelectBelowProjectOfPersonnelFunc 获取指定项目下的人员打卡信息
|
||||
func (c *busConstructionUserController) PcSelectBelowProjectOfPersonnelFunc(ctx context.Context, req *system.PcSelectBelowProjectOfPersonnelReq) (res *system.PcSelectBelowProjectOfPersonnelRes, err error) {
|
||||
res, err = service.BusConstructionUser().PcSelectBelowProjectOfPersonnelFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// PcQueryBasedOnOpenidFunc 根据openid查询某人指定月份的打卡详情
|
||||
func (c *busConstructionUserController) PcQueryBasedOnOpenidFunc(ctx context.Context, req *system.PcQueryBasedOnOpenidReq) (res *system.PcQueryBasedOnOpenidRes, err error) {
|
||||
res, err = service.BusConstructionUser().PcQueryBasedOnOpenidFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
==========================================================考勤机相关=========================================================
|
||||
==========================================================考勤机相关=========================================================
|
||||
==========================================================考勤机相关=========================================================
|
||||
*/
|
||||
|
||||
// ListOfAttendanceMachinesFunc 考勤机列表
|
||||
func (c *busConstructionUserController) ListOfAttendanceMachinesFunc(ctx context.Context, req *system.ListOfAttendanceMachinesReq) (res *system.ListOfAttendanceMachinesRes, err error) {
|
||||
|
||||
return
|
||||
}
|
60
internal/app/system/controller/bus_construction_user_file.go
Normal file
60
internal/app/system/controller/bus_construction_user_file.go
Normal file
@ -0,0 +1,60 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-08-07 10:17:41
|
||||
// 生成路径: internal/app/system/controller/bus_construction_user_file.go
|
||||
// 生成人:gfast
|
||||
// desc:微信用户的文件存储
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busConstructionUserFileController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusConstructionUserFile = new(busConstructionUserFileController)
|
||||
|
||||
// List 列表
|
||||
func (c *busConstructionUserFileController) List(ctx context.Context, req *system.BusConstructionUserFileSearchReq) (res *system.BusConstructionUserFileSearchRes, err error) {
|
||||
res, err = service.BusConstructionUserFile().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取微信用户的文件存储
|
||||
func (c *busConstructionUserFileController) Get(ctx context.Context, req *system.BusConstructionUserFileGetReq) (res *system.BusConstructionUserFileGetRes, err error) {
|
||||
res = new(system.BusConstructionUserFileGetRes)
|
||||
res.BusConstructionUserFileInfoRes, err = service.BusConstructionUserFile().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// GetBySafetyId 根据主键id获取安全考试信息GetBySafetyId(ctx context.Context, req *system.BusConstructionUserFileGetSafetyFileReq) (res *model.ModelWeChatPdfWoRes, err error)
|
||||
func (c *busConstructionUserFileController) GetBySafetyId(ctx context.Context, req *system.BusConstructionUserFileGetSafetyFileReq) (res *system.BusConstructionUserFileGetSafetyFileRes, err error) {
|
||||
res = new(system.BusConstructionUserFileGetSafetyFileRes)
|
||||
res, err = service.BusConstructionUserFile().GetBySafetyId(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加微信用户的文件存储
|
||||
func (c *busConstructionUserFileController) Add(ctx context.Context, req *system.BusConstructionUserFileAddReq) (res *system.BusConstructionUserFileAddRes, err error) {
|
||||
err = service.BusConstructionUserFile().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改微信用户的文件存储
|
||||
func (c *busConstructionUserFileController) Edit(ctx context.Context, req *system.BusConstructionUserFileEditReq) (res *system.BusConstructionUserFileEditRes, err error) {
|
||||
err = service.BusConstructionUserFile().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除微信用户的文件存储
|
||||
func (c *busConstructionUserFileController) Delete(ctx context.Context, req *system.BusConstructionUserFileDeleteReq) (res *system.BusConstructionUserFileDeleteRes, err error) {
|
||||
err = service.BusConstructionUserFile().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_construction_user_post.go
Normal file
53
internal/app/system/controller/bus_construction_user_post.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-08-07 10:06:34
|
||||
// 生成路径: internal/app/system/controller/bus_construction_user_post.go
|
||||
// 生成人:gfast
|
||||
// desc:施工人员岗位
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busConstructionUserPostController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusConstructionUserPost = new(busConstructionUserPostController)
|
||||
|
||||
// List 列表
|
||||
func (c *busConstructionUserPostController) List(ctx context.Context, req *system.BusConstructionUserPostSearchReq) (res *system.BusConstructionUserPostSearchRes, err error) {
|
||||
res, err = service.BusConstructionUserPost().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取施工人员岗位
|
||||
func (c *busConstructionUserPostController) Get(ctx context.Context, req *system.BusConstructionUserPostGetReq) (res *system.BusConstructionUserPostGetRes, err error) {
|
||||
res = new(system.BusConstructionUserPostGetRes)
|
||||
res.BusConstructionUserPostInfoRes, err = service.BusConstructionUserPost().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加施工人员岗位
|
||||
func (c *busConstructionUserPostController) Add(ctx context.Context, req *system.BusConstructionUserPostAddReq) (res *system.BusConstructionUserPostAddRes, err error) {
|
||||
err = service.BusConstructionUserPost().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改施工人员岗位
|
||||
func (c *busConstructionUserPostController) Edit(ctx context.Context, req *system.BusConstructionUserPostEditReq) (res *system.BusConstructionUserPostEditRes, err error) {
|
||||
err = service.BusConstructionUserPost().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除施工人员岗位
|
||||
func (c *busConstructionUserPostController) Delete(ctx context.Context, req *system.BusConstructionUserPostDeleteReq) (res *system.BusConstructionUserPostDeleteRes, err error) {
|
||||
err = service.BusConstructionUserPost().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_corporate_events.go
Normal file
53
internal/app/system/controller/bus_corporate_events.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-03-20 16:49:36
|
||||
// 生成路径: internal/app/system/controller/bus_corporate_events.go
|
||||
// 生成人:gfast
|
||||
// desc:企业大事记
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busCorporateEventsController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusCorporateEvents = new(busCorporateEventsController)
|
||||
|
||||
// List 列表
|
||||
func (c *busCorporateEventsController) List(ctx context.Context, req *system.BusCorporateEventsSearchReq) (res *system.BusCorporateEventsSearchRes, err error) {
|
||||
res, err = service.BusCorporateEvents().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取企业大事记
|
||||
func (c *busCorporateEventsController) Get(ctx context.Context, req *system.BusCorporateEventsGetReq) (res *system.BusCorporateEventsGetRes, err error) {
|
||||
res = new(system.BusCorporateEventsGetRes)
|
||||
res.BusCorporateEventsInfoRes, err = service.BusCorporateEvents().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加企业大事记
|
||||
func (c *busCorporateEventsController) Add(ctx context.Context, req *system.BusCorporateEventsAddReq) (res *system.BusCorporateEventsAddRes, err error) {
|
||||
err = service.BusCorporateEvents().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改企业大事记
|
||||
func (c *busCorporateEventsController) Edit(ctx context.Context, req *system.BusCorporateEventsEditReq) (res *system.BusCorporateEventsEditRes, err error) {
|
||||
err = service.BusCorporateEvents().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除企业大事记
|
||||
func (c *busCorporateEventsController) Delete(ctx context.Context, req *system.BusCorporateEventsDeleteReq) (res *system.BusCorporateEventsDeleteRes, err error) {
|
||||
err = service.BusCorporateEvents().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
70
internal/app/system/controller/bus_design_audit.go
Normal file
70
internal/app/system/controller/bus_design_audit.go
Normal file
@ -0,0 +1,70 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-04-09 15:40:16
|
||||
// 生成路径: internal/app/system/controller/bus_design_audit.go
|
||||
// 生成人:gfast
|
||||
// desc:设计审核(竣工、施工、可研)
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
type busDesignAuditController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusDesignAudit = new(busDesignAuditController)
|
||||
|
||||
// List 列表
|
||||
func (c *busDesignAuditController) List(ctx context.Context, req *system.BusDesignAuditSearchReq) (res *system.BusDesignAuditSearchRes, err error) {
|
||||
res, err = service.BusDesignAudit().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取设计审核(竣工、施工、可研)
|
||||
func (c *busDesignAuditController) Get(ctx context.Context, req *system.BusDesignAuditGetReq) (res *system.BusDesignAuditGetRes, err error) {
|
||||
res = new(system.BusDesignAuditGetRes)
|
||||
res.BusDesignAuditInfoRes, err = service.BusDesignAudit().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
//// Add 添加设计审核(竣工、施工、可研)
|
||||
//func (c *busDesignAuditController) Add(ctx context.Context, req *system.BusDesignAuditAddReq) (res *system.BusDesignAuditAddRes, err error) {
|
||||
// err = service.BusDesignAudit().Add(ctx, req)
|
||||
// return
|
||||
//}
|
||||
|
||||
// Edit 修改设计审核(竣工、施工、可研)
|
||||
func (c *busDesignAuditController) Edit(ctx context.Context, req *system.BusDesignAuditEditReq) (res *system.BusDesignAuditEditRes, err error) {
|
||||
err = service.BusDesignAudit().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除设计审核(竣工、施工、可研)
|
||||
func (c *busDesignAuditController) Delete(ctx context.Context, req *system.BusDesignAuditDeleteReq) (res *system.BusDesignAuditDeleteRes, err error) {
|
||||
err = service.BusDesignAudit().Delete(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// DesignAuditFileDownload 单文件下载
|
||||
func (c *busDesignAuditController) DesignAuditFileDownload(ctx context.Context, req *system.DesignAuditFileDownloadReq) (res *system.DesignAuditFileDownloadRes, err error) {
|
||||
res = new(system.DesignAuditFileDownloadRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
value, err := g.DB().Model(req.TableName).Ctx(ctx).Unscoped().WherePri(req.TableId).Fields("filen_path").Value()
|
||||
liberr.ErrIsNil(ctx, err, "下载失败")
|
||||
//进行下载
|
||||
path, err := WpFileDownload(ctx, value.String(), req.Type, req.TableName, req.TableId, req.ProjectId)
|
||||
if err == nil {
|
||||
res.Path = path
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_design_document.go
Normal file
53
internal/app/system/controller/bus_design_document.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-07-29 16:31:29
|
||||
// 生成路径: internal/app/system/controller/bus_design_document.go
|
||||
// 生成人:gfast
|
||||
// desc:设计管理
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busDesignDocumentController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusDesignDocument = new(busDesignDocumentController)
|
||||
|
||||
// List 列表
|
||||
func (c *busDesignDocumentController) List(ctx context.Context, req *system.BusDesignDocumentSearchReq) (res *system.BusDesignDocumentSearchRes, err error) {
|
||||
res, err = service.BusDesignDocument().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取设计管理
|
||||
func (c *busDesignDocumentController) Get(ctx context.Context, req *system.BusDesignDocumentGetReq) (res *system.BusDesignDocumentGetRes, err error) {
|
||||
res = new(system.BusDesignDocumentGetRes)
|
||||
res.BusDesignDocumentInfoRes, err = service.BusDesignDocument().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加设计管理
|
||||
func (c *busDesignDocumentController) Add(ctx context.Context, req *system.BusDesignDocumentAddReq) (res *system.BusDesignDocumentAddRes, err error) {
|
||||
err = service.BusDesignDocument().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改设计管理
|
||||
func (c *busDesignDocumentController) Edit(ctx context.Context, req *system.BusDesignDocumentEditReq) (res *system.BusDesignDocumentEditRes, err error) {
|
||||
err = service.BusDesignDocument().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除设计管理
|
||||
func (c *busDesignDocumentController) Delete(ctx context.Context, req *system.BusDesignDocumentDeleteReq) (res *system.BusDesignDocumentDeleteRes, err error) {
|
||||
err = service.BusDesignDocument().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_design_period_range.go
Normal file
53
internal/app/system/controller/bus_design_period_range.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-04-11 17:28:54
|
||||
// 生成路径: internal/app/system/controller/bus_design_period_range.go
|
||||
// 生成人:gfast
|
||||
// desc:设计-周期范围
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busDesignPeriodRangeController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusDesignPeriodRange = new(busDesignPeriodRangeController)
|
||||
|
||||
// List 列表
|
||||
func (c *busDesignPeriodRangeController) List(ctx context.Context, req *system.BusDesignPeriodRangeSearchReq) (res *system.BusDesignPeriodRangeSearchRes, err error) {
|
||||
res, err = service.BusDesignPeriodRange().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//// Get 获取设计-周期范围
|
||||
//func (c *busDesignPeriodRangeController) Get(ctx context.Context, req *system.BusDesignPeriodRangeGetReq) (res *system.BusDesignPeriodRangeGetRes, err error) {
|
||||
// res = new(system.BusDesignPeriodRangeGetRes)
|
||||
// res.BusDesignPeriodRangeInfoRes, err = service.BusDesignPeriodRange().GetById(ctx, req.Id)
|
||||
// return
|
||||
//}
|
||||
|
||||
// Add 添加设计-周期范围
|
||||
func (c *busDesignPeriodRangeController) Add(ctx context.Context, req *system.BusDesignPeriodRangeAddReq) (res *system.BusDesignPeriodRangeAddRes, err error) {
|
||||
err = service.BusDesignPeriodRange().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//// Edit 修改设计-周期范围
|
||||
//func (c *busDesignPeriodRangeController) Edit(ctx context.Context, req *system.BusDesignPeriodRangeEditReq) (res *system.BusDesignPeriodRangeEditRes, err error) {
|
||||
// err = service.BusDesignPeriodRange().Edit(ctx, req)
|
||||
// return
|
||||
//}
|
||||
|
||||
// Delete 删除设计-周期范围
|
||||
func (c *busDesignPeriodRangeController) Delete(ctx context.Context, req *system.BusDesignPeriodRangeDeleteReq) (res *system.BusDesignPeriodRangeDeleteRes, err error) {
|
||||
err = service.BusDesignPeriodRange().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
59
internal/app/system/controller/bus_engineering_quality.go
Normal file
59
internal/app/system/controller/bus_engineering_quality.go
Normal file
@ -0,0 +1,59 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-07-29 09:31:22
|
||||
// 生成路径: internal/app/system/controller/bus_engineering_quality.go
|
||||
// 生成人:gfast
|
||||
// desc:工程质量列
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busEngineeringQualityController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusEngineeringQuality = new(busEngineeringQualityController)
|
||||
|
||||
// List 列表
|
||||
func (c *busEngineeringQualityController) List(ctx context.Context, req *system.BusEngineeringQualitySearchReq) (res *system.BusEngineeringQualitySearchRes, err error) {
|
||||
res, err = service.BusEngineeringQuality().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取工程质量列
|
||||
func (c *busEngineeringQualityController) Get(ctx context.Context, req *system.BusEngineeringQualityGetReq) (res *system.BusEngineeringQualityGetRes, err error) {
|
||||
res = new(system.BusEngineeringQualityGetRes)
|
||||
res.BusEngineeringQualityInfoRes, err = service.BusEngineeringQuality().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加工程质量列
|
||||
func (c *busEngineeringQualityController) Add(ctx context.Context, req *system.BusEngineeringQualityAddReq) (res *system.BusEngineeringQualityAddRes, err error) {
|
||||
err = service.BusEngineeringQuality().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改工程质量列
|
||||
func (c *busEngineeringQualityController) Edit(ctx context.Context, req *system.BusEngineeringQualityEditReq) (res *system.BusEngineeringQualityEditRes, err error) {
|
||||
err = service.BusEngineeringQuality().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除工程质量列
|
||||
func (c *busEngineeringQualityController) Delete(ctx context.Context, req *system.BusEngineeringQualityDeleteReq) (res *system.BusEngineeringQualityDeleteRes, err error) {
|
||||
err = service.BusEngineeringQuality().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// 文件上传 单文件
|
||||
func (c *busEngineeringQualityController) BusEngineeringQualityUploading(ctx context.Context, req *system.BusEngineeringQualityUploadingReq) (res *system.BusEngineeringQualityUploadingRes, err error) {
|
||||
err = service.BusEngineeringQuality().BusEngineeringQualityUploading(ctx, req)
|
||||
return
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-07-29 11:14:45
|
||||
// 生成路径: internal/app/system/controller/bus_equipment_equipment_unpacking.go
|
||||
// 生成人:gfast
|
||||
// desc:开箱记录
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busEquipmentEquipmentUnpackingController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusEquipmentEquipmentUnpacking = new(busEquipmentEquipmentUnpackingController)
|
||||
|
||||
// List 列表
|
||||
func (c *busEquipmentEquipmentUnpackingController) List(ctx context.Context, req *system.BusEquipmentEquipmentUnpackingSearchReq) (res *system.BusEquipmentEquipmentUnpackingSearchRes, err error) {
|
||||
res, err = service.BusEquipmentEquipmentUnpacking().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取开箱记录
|
||||
func (c *busEquipmentEquipmentUnpackingController) Get(ctx context.Context, req *system.BusEquipmentEquipmentUnpackingGetReq) (res *system.BusEquipmentEquipmentUnpackingGetRes, err error) {
|
||||
res = new(system.BusEquipmentEquipmentUnpackingGetRes)
|
||||
res.BusEquipmentEquipmentUnpackingInfoRes, err = service.BusEquipmentEquipmentUnpacking().GetByUnpackingId(ctx, req.UnpackingId)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加开箱记录
|
||||
func (c *busEquipmentEquipmentUnpackingController) Add(ctx context.Context, req *system.BusEquipmentEquipmentUnpackingAddReq) (res *system.BusEquipmentEquipmentUnpackingAddRes, err error) {
|
||||
err = service.BusEquipmentEquipmentUnpacking().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改开箱记录
|
||||
func (c *busEquipmentEquipmentUnpackingController) Edit(ctx context.Context, req *system.BusEquipmentEquipmentUnpackingEditReq) (res *system.BusEquipmentEquipmentUnpackingEditRes, err error) {
|
||||
err = service.BusEquipmentEquipmentUnpacking().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除开箱记录
|
||||
func (c *busEquipmentEquipmentUnpackingController) Delete(ctx context.Context, req *system.BusEquipmentEquipmentUnpackingDeleteReq) (res *system.BusEquipmentEquipmentUnpackingDeleteRes, err error) {
|
||||
err = service.BusEquipmentEquipmentUnpacking().Delete(ctx, req.UnpackingIds)
|
||||
return
|
||||
}
|
91
internal/app/system/controller/bus_equipment_materials.go
Normal file
91
internal/app/system/controller/bus_equipment_materials.go
Normal file
@ -0,0 +1,91 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-07-29 11:14:16
|
||||
// 生成路径: internal/app/system/controller/bus_equipment_materials.go
|
||||
// 生成人:gfast
|
||||
// desc:材料/设备名称
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busEquipmentMaterialsController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusEquipmentMaterials = new(busEquipmentMaterialsController)
|
||||
|
||||
// List 列表
|
||||
func (c *busEquipmentMaterialsController) List(ctx context.Context, req *system.BusEquipmentMaterialsSearchReq) (res *system.BusEquipmentMaterialsSearchRes, err error) {
|
||||
res, err = service.BusEquipmentMaterials().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取材料/设备名称
|
||||
func (c *busEquipmentMaterialsController) Get(ctx context.Context, req *system.BusEquipmentMaterialsGetReq) (res *system.BusEquipmentMaterialsGetRes, err error) {
|
||||
res = new(system.BusEquipmentMaterialsGetRes)
|
||||
res.BusEquipmentMaterialsInfoRes, err = service.BusEquipmentMaterials().GetByEquipmentMaterialsId(ctx, req.EquipmentMaterialsId)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加材料/设备名称
|
||||
func (c *busEquipmentMaterialsController) Add(ctx context.Context, req *system.BusEquipmentMaterialsAddReq) (res *system.BusEquipmentMaterialsAddRes, err error) {
|
||||
err = service.BusEquipmentMaterials().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改材料/设备名称
|
||||
func (c *busEquipmentMaterialsController) Edit(ctx context.Context, req *system.BusEquipmentMaterialsEditReq) (res *system.BusEquipmentMaterialsEditRes, err error) {
|
||||
err = service.BusEquipmentMaterials().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除材料/设备名称
|
||||
func (c *busEquipmentMaterialsController) Delete(ctx context.Context, req *system.BusEquipmentMaterialsDeleteReq) (res *system.BusEquipmentMaterialsDeleteRes, err error) {
|
||||
err = service.BusEquipmentMaterials().Delete(ctx, req.EquipmentMaterialsIds)
|
||||
return
|
||||
}
|
||||
|
||||
// MaterialsFunc 材料数量
|
||||
func (c *busEquipmentMaterialsController) MaterialsFunc(ctx context.Context, req *system.MaterialsReq) (res *system.MaterialsRes, err error) {
|
||||
res, err = service.BusEquipmentMaterials().MaterialsFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// ConditionFunc 材料情况
|
||||
func (c *busEquipmentMaterialsController) ConditionFunc(ctx context.Context, req *system.ConditionReq) (res *system.ConditionRes, err error) {
|
||||
res, err = service.BusEquipmentMaterials().ConditionFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// App
|
||||
// AppAdd 添加材料/设备名称
|
||||
func (c *busEquipmentMaterialsController) AppAdd(ctx context.Context, req *system.BusEquipmentMaterialsAppAddReq) (res *system.BusEquipmentMaterialsAppAddRes, err error) {
|
||||
err = service.BusEquipmentMaterials().AppAdd(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// AppEdit 修改材料/设备名称
|
||||
func (c *busEquipmentMaterialsController) AppEdit(ctx context.Context, req *system.BusEquipmentMaterialsAppEditReq) (res *system.BusEquipmentMaterialsAppEditRes, err error) {
|
||||
err = service.BusEquipmentMaterials().AppEdit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// AppList 列表
|
||||
func (c *busEquipmentMaterialsController) AppList(ctx context.Context, req *system.BusEquipmentMaterialsAppSearchReq) (res *system.BusEquipmentMaterialsAppSearchRes, err error) {
|
||||
res, err = service.BusEquipmentMaterials().AppList(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// AppGetById 获取材料/设备名称
|
||||
func (c *busEquipmentMaterialsController) AppGetById(ctx context.Context, req *system.BusEquipmentMaterialsAppGetReq) (res *system.BusEquipmentMaterialsAppGetRes, err error) {
|
||||
res = new(system.BusEquipmentMaterialsAppGetRes)
|
||||
res.BusEquipmentMaterialsAppFileInfoRes, err = service.BusEquipmentMaterials().AppGetById(ctx, req.EquipmentMaterialsId)
|
||||
return
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busEquipmentMaterialsexcelController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusEquipmentMaterialsExcel = new(busEquipmentMaterialsexcelController)
|
||||
|
||||
func (c *busEquipmentMaterialsexcelController) Index(ctx context.Context, req *system.BusEquipmentMaterialsExcelIndexReq) (listRes *system.BusEquipmentMaterialsExcelIndexRes, err error) {
|
||||
listRes, err = service.BusEquipmentMaterialsExcel().Index(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Excel List
|
||||
func (c *busEquipmentMaterialsexcelController) List(ctx context.Context, req *system.BusEquipmentMaterialsExcelSearchReq) (res *system.BusEquipmentMaterialsExcelSearchRes, err error) {
|
||||
res, err = service.BusEquipmentMaterialsExcel().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// excel exit
|
||||
func (c *busEquipmentMaterialsexcelController) Exit(ctx context.Context, req *system.BusEquipmentMaterialsExcelEditReq) (res *system.BusEquipmentMaterialsExcelEditRes, err error) {
|
||||
err = service.BusEquipmentMaterialsExcel().Edit(ctx, req)
|
||||
return
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-09-13 14:21:30
|
||||
// 生成路径: internal/app/system/controller/bus_equipment_materials_inventory.go
|
||||
// 生成人:gfast
|
||||
// desc:设备材料入库
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busEquipmentMaterialsInventoryController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusEquipmentMaterialsInventory = new(busEquipmentMaterialsInventoryController)
|
||||
|
||||
// List 列表
|
||||
func (c *busEquipmentMaterialsInventoryController) List(ctx context.Context, req *system.BusEquipmentMaterialsInventorySearchReq) (res *system.BusEquipmentMaterialsInventorySearchRes, err error) {
|
||||
res, err = service.BusEquipmentMaterialsInventory().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取设备材料入库
|
||||
func (c *busEquipmentMaterialsInventoryController) Get(ctx context.Context, req *system.BusEquipmentMaterialsInventoryGetReq) (res *system.BusEquipmentMaterialsInventoryGetRes, err error) {
|
||||
res = new(system.BusEquipmentMaterialsInventoryGetRes)
|
||||
res.BusEquipmentMaterialsInventoryInfoRes, err = service.BusEquipmentMaterialsInventory().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加设备材料入库
|
||||
func (c *busEquipmentMaterialsInventoryController) Add(ctx context.Context, req *system.BusEquipmentMaterialsInventoryAddReq) (res *system.BusEquipmentMaterialsInventoryAddRes, err error) {
|
||||
err = service.BusEquipmentMaterialsInventory().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改设备材料入库
|
||||
func (c *busEquipmentMaterialsInventoryController) Edit(ctx context.Context, req *system.BusEquipmentMaterialsInventoryEditReq) (res *system.BusEquipmentMaterialsInventoryEditRes, err error) {
|
||||
err = service.BusEquipmentMaterialsInventory().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除设备材料入库
|
||||
func (c *busEquipmentMaterialsInventoryController) Delete(ctx context.Context, req *system.BusEquipmentMaterialsInventoryDeleteReq) (res *system.BusEquipmentMaterialsInventoryDeleteRes, err error) {
|
||||
err = service.BusEquipmentMaterialsInventory().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
//app
|
||||
|
||||
func (c *busEquipmentMaterialsInventoryController) AppAdd(ctx context.Context, req *system.BusEquipmentMaterialsInventoryAppAddReq) (res *system.BusEquipmentMaterialsInventoryAppAddRes, err error) {
|
||||
err = service.BusEquipmentMaterialsInventory().AppAdd(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *busEquipmentMaterialsInventoryController) AppEdit(ctx context.Context, req *system.BusEquipmentMaterialsInventoryAppEditReq) (res *system.BusEquipmentMaterialsInventoryAppEditRes, err error) {
|
||||
err = service.BusEquipmentMaterialsInventory().AppEdit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *busEquipmentMaterialsInventoryController) AppList(ctx context.Context, req *system.BusEquipmentMaterialsInventoryAppSearchReq) (res *system.BusEquipmentMaterialsInventoryAppSearchRes, err error) {
|
||||
res, err = service.BusEquipmentMaterialsInventory().AppList(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *busEquipmentMaterialsInventoryController) AppGetById(ctx context.Context, req *system.BusEquipmentMaterialsInventoryAppGetReq) (res *system.BusEquipmentMaterialsInventoryAppGetRes, err error) {
|
||||
res = new(system.BusEquipmentMaterialsInventoryAppGetRes)
|
||||
res.BusEquipmentMaterialsInventoryAppInfoRes, err = service.BusEquipmentMaterialsInventory().AppGetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除设备材料入库
|
||||
func (c *busEquipmentMaterialsInventoryController) AppDelete(ctx context.Context, req *system.BusEquipmentMaterialsInventoryAppDeleteReq) (res *system.BusEquipmentMaterialsInventoryAppDeleteRes, err error) {
|
||||
err = service.BusEquipmentMaterialsInventory().AppDelete(ctx, req.Ids)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_essential_information.go
Normal file
53
internal/app/system/controller/bus_essential_information.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-03-20 19:38:54
|
||||
// 生成路径: internal/app/system/controller/bus_essential_information.go
|
||||
// 生成人:gfast
|
||||
// desc:项目基本信息
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busEssentialInformationController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusEssentialInformation = new(busEssentialInformationController)
|
||||
|
||||
// List 列表
|
||||
func (c *busEssentialInformationController) List(ctx context.Context, req *system.BusEssentialInformationSearchReq) (res *system.BusEssentialInformationSearchRes, err error) {
|
||||
res, err = service.BusEssentialInformation().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取项目基本信息
|
||||
func (c *busEssentialInformationController) Get(ctx context.Context, req *system.BusEssentialInformationGetReq) (res *system.BusEssentialInformationGetRes, err error) {
|
||||
res = new(system.BusEssentialInformationGetRes)
|
||||
res.BusEssentialInformationInfoRes, err = service.BusEssentialInformation().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加项目基本信息
|
||||
func (c *busEssentialInformationController) Add(ctx context.Context, req *system.BusEssentialInformationAddReq) (res *system.BusEssentialInformationAddRes, err error) {
|
||||
err = service.BusEssentialInformation().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改项目基本信息
|
||||
func (c *busEssentialInformationController) Edit(ctx context.Context, req *system.BusEssentialInformationEditReq) (res *system.BusEssentialInformationEditRes, err error) {
|
||||
err = service.BusEssentialInformation().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除项目基本信息
|
||||
func (c *busEssentialInformationController) Delete(ctx context.Context, req *system.BusEssentialInformationDeleteReq) (res *system.BusEssentialInformationDeleteRes, err error) {
|
||||
err = service.BusEssentialInformation().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
59
internal/app/system/controller/bus_folder.go
Normal file
59
internal/app/system/controller/bus_folder.go
Normal file
@ -0,0 +1,59 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-09-15 17:15:59
|
||||
// 生成路径: internal/app/system/controller/bus_folder.go
|
||||
// 生成人:gfast
|
||||
// desc:文件夹
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busFolderController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusFolder = new(busFolderController)
|
||||
|
||||
// List 列表
|
||||
func (c *busFolderController) List(ctx context.Context, req *system.BusFolderSearchReq) (res *system.BusFolderSearchRes, err error) {
|
||||
res, err = service.BusFolder().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// TreeFormListFunc 树形结构列表(系统文件夹的虚拟树形结构)
|
||||
func (c *busFolderController) TreeFormListFunc(ctx context.Context, req *system.TreeFormListFuncReq) (res *system.TreeFormListFuncRes, err error) {
|
||||
res, err = service.BusFolder().TreeFormListFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取文件夹
|
||||
func (c *busFolderController) Get(ctx context.Context, req *system.BusFolderGetReq) (res *system.BusFolderGetRes, err error) {
|
||||
res = new(system.BusFolderGetRes)
|
||||
res.BusFolderInfoRes, err = service.BusFolder().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加文件夹
|
||||
func (c *busFolderController) Add(ctx context.Context, req *system.BusFolderAddReq) (res *system.BusFolderAddRes, err error) {
|
||||
err = service.BusFolder().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改文件夹
|
||||
func (c *busFolderController) Edit(ctx context.Context, req *system.BusFolderEditReq) (res *system.BusFolderEditRes, err error) {
|
||||
err = service.BusFolder().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除文件夹
|
||||
func (c *busFolderController) Delete(ctx context.Context, req *system.BusFolderDeleteReq) (res *system.BusFolderDeleteRes, err error) {
|
||||
err = service.BusFolder().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_folder_file.go
Normal file
53
internal/app/system/controller/bus_folder_file.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-09-15 17:16:00
|
||||
// 生成路径: internal/app/system/controller/bus_folder_file.go
|
||||
// 生成人:gfast
|
||||
// desc:文件
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busFolderFileController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusFolderFile = new(busFolderFileController)
|
||||
|
||||
// List 列表
|
||||
func (c *busFolderFileController) List(ctx context.Context, req *system.BusFolderFileSearchReq) (res *system.BusFolderFileSearchRes, err error) {
|
||||
res, err = service.BusFolderFile().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取文件
|
||||
func (c *busFolderFileController) Get(ctx context.Context, req *system.BusFolderFileGetReq) (res *system.BusFolderFileGetRes, err error) {
|
||||
res = new(system.BusFolderFileGetRes)
|
||||
res.BusFolderFileInfoRes, err = service.BusFolderFile().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加文件
|
||||
func (c *busFolderFileController) Add(ctx context.Context, req *system.BusFolderFileAddReq) (res *system.BusFolderFileAddRes, err error) {
|
||||
err = service.BusFolderFile().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改文件
|
||||
func (c *busFolderFileController) Edit(ctx context.Context, req *system.BusFolderFileEditReq) (res *system.BusFolderFileEditRes, err error) {
|
||||
err = service.BusFolderFile().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除文件
|
||||
func (c *busFolderFileController) Delete(ctx context.Context, req *system.BusFolderFileDeleteReq) (res *system.BusFolderFileDeleteRes, err error) {
|
||||
err = service.BusFolderFile().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
108
internal/app/system/controller/bus_hse_management.go
Normal file
108
internal/app/system/controller/bus_hse_management.go
Normal file
@ -0,0 +1,108 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-03-28 14:53:05
|
||||
// 生成路径: internal/app/system/controller/bus_hse_management.go
|
||||
// 生成人:gfast
|
||||
// desc:HSE-巡检工单
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
wxSystem "github.com/tiger1103/gfast/v3/api/wxApplet/wxApplet"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busHseManagementController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusHseManagement = new(busHseManagementController)
|
||||
|
||||
// List 列表
|
||||
func (c *busHseManagementController) List(ctx context.Context, req *system.BusHseManagementSearchReq) (res *system.BusHseManagementSearchRes, err error) {
|
||||
res, err = service.BusHseManagement().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取HSE-巡检工单
|
||||
func (c *busHseManagementController) Get(ctx context.Context, req *system.BusHseManagementGetReq) (res *system.BusHseManagementGetRes, err error) {
|
||||
res = new(system.BusHseManagementGetRes)
|
||||
res.BusHseManagementDetailsRes, err = service.BusHseManagement().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加HSE-巡检工单-通知
|
||||
func (c *busHseManagementController) Add(ctx context.Context, req *system.BusHseManagementAddReq) (res *system.BusHseManagementAddRes, err error) {
|
||||
err = service.BusHseManagement().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//// Edit 修改HSE-巡检工单-整改
|
||||
//func (c *busHseManagementController) Edit(ctx context.Context, req *system.BusHseManagementEditReq) (res *system.BusHseManagementEditRes, err error) {
|
||||
// err = service.BusHseManagement().Edit(ctx, req)
|
||||
// return
|
||||
//}
|
||||
|
||||
// EditReview 修改HSE-巡检工单-复查
|
||||
func (c *busHseManagementController) EditReview(ctx context.Context, req *system.EditReviewReq) (res *system.EditReviewRes, err error) {
|
||||
err = service.BusHseManagement().EditReview(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除HSE-巡检工单
|
||||
func (c *busHseManagementController) Delete(ctx context.Context, req *system.BusHseManagementDeleteReq) (res *system.BusHseManagementDeleteRes, err error) {
|
||||
err = service.BusHseManagement().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// HseManagementAppletAddFunc 微信小程序-新增
|
||||
func (c *busHseManagementController) HseManagementAppletAddFunc(ctx context.Context, req *wxSystem.HseManagementAppletAddReq) (res *wxSystem.HseManagementAppletAddRes, err error) {
|
||||
err = service.BusHseManagement().HseManagementAppletAddFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// HseManagementAppletAbarbeitungFunc 微信小程序-整改
|
||||
func (c *busHseManagementController) HseManagementAppletAbarbeitungFunc(ctx context.Context, req *wxSystem.HseManagementAppletAbarbeitungReq) (res *wxSystem.HseManagementAppletAbarbeitungRes, err error) {
|
||||
err = service.BusHseManagement().HseManagementAppletAbarbeitungFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// HseManagementAppletVerifyFunc 微信小程序-验证
|
||||
func (c *busHseManagementController) HseManagementAppletVerifyFunc(ctx context.Context, req *wxSystem.HseManagementAppletVerifyReq) (res *wxSystem.HseManagementAppletVerifyRes, err error) {
|
||||
err = service.BusHseManagement().HseManagementAppletVerifyFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// HseManagementAppletListFunc 微信小程序-列表
|
||||
func (c *busHseManagementController) HseManagementAppletListFunc(ctx context.Context, req *wxSystem.HseManagementAppletListReq) (res *wxSystem.HseManagementAppletListRes, err error) {
|
||||
res, err = service.BusHseManagement().HseManagementAppletListFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// HseManagementAppletDetailsFunc 微信小程序-详情
|
||||
func (c *busHseManagementController) HseManagementAppletDetailsFunc(ctx context.Context, req *wxSystem.HseManagementAppletDetailsReq) (res *wxSystem.HseManagementAppletDetailsRes, err error) {
|
||||
res, err = service.BusHseManagement().HseManagementAppletDetailsFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// GisSafetyManagementFunc Gis安全管理统计
|
||||
func (c *busHseManagementController) GisSafetyManagementFunc(ctx context.Context, req *system.GisSafetyManagementReq) (res *system.GisSafetyManagementRes, err error) {
|
||||
res, err = service.BusHseManagement().GisSafetyManagementFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// GisSafetyManagementListFunc Gis质量管理列表
|
||||
func (c *busHseManagementController) GisSafetyManagementListFunc(ctx context.Context, req *system.GisSafetyManagementListReq) (res *system.GisSafetyManagementListRes, err error) {
|
||||
res, err = service.BusHseManagement().GisSafetyManagementListFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// SafetyLargeScreenDetailsFunc 大屏详情
|
||||
func (c *busInspectionTicketController) SafetyLargeScreenDetailsFunc(ctx context.Context, req *system.SafetyLargeScreenDetailsReq) (res *system.SafetyLargeScreenDetailsRes, err error) {
|
||||
res, err = service.BusHseManagement().SafetyLargeScreenDetails(ctx, req)
|
||||
return
|
||||
}
|
78
internal/app/system/controller/bus_hse_security_log.go
Normal file
78
internal/app/system/controller/bus_hse_security_log.go
Normal file
@ -0,0 +1,78 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-04-07 17:00:45
|
||||
// 生成路径: internal/app/system/controller/bus_hse_security_log.go
|
||||
// 生成人:gfast
|
||||
// desc:HSE安全日志
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
wxSystem "github.com/tiger1103/gfast/v3/api/wxApplet/wxApplet"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busHseSecurityLogController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusHseSecurityLog = new(busHseSecurityLogController)
|
||||
|
||||
// List 列表
|
||||
func (c *busHseSecurityLogController) List(ctx context.Context, req *system.BusHseSecurityLogSearchReq) (res *system.BusHseSecurityLogSearchRes, err error) {
|
||||
res, err = service.BusHseSecurityLog().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取HSE安全日志
|
||||
func (c *busHseSecurityLogController) Get(ctx context.Context, req *system.BusHseSecurityLogGetReq) (res *system.BusHseSecurityLogGetRes, err error) {
|
||||
res = new(system.BusHseSecurityLogGetRes)
|
||||
res.BusHseSecurityLogInfoTwoRes, err = service.BusHseSecurityLog().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// AddText 添加HSE安全日志--文字
|
||||
func (c *busHseSecurityLogController) AddText(ctx context.Context, req *system.BusHseSecurityLogAddTxetReq) (res *system.BusHseSecurityLogAddTxetRes, err error) {
|
||||
err = service.BusHseSecurityLog().AddText(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// AddFile 添加HSE安全日志--附件
|
||||
func (c *busHseSecurityLogController) AddFile(ctx context.Context, req *system.BusHseSecurityLogAddFileReq) (res *system.BusHseSecurityLogAddFileRes, err error) {
|
||||
err = service.BusHseSecurityLog().AddFile(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//// Edit 修改HSE安全日志
|
||||
//func (c *busHseSecurityLogController) Edit(ctx context.Context, req *system.BusHseSecurityLogEditReq) (res *system.BusHseSecurityLogEditRes, err error) {
|
||||
// err = service.BusHseSecurityLog().Edit(ctx, req)
|
||||
// return
|
||||
//}
|
||||
|
||||
// Delete 删除HSE安全日志
|
||||
func (c *busHseSecurityLogController) Delete(ctx context.Context, req *system.BusHseSecurityLogDeleteReq) (res *system.BusHseSecurityLogDeleteRes, err error) {
|
||||
err = service.BusHseSecurityLog().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// HseSecurityLogAppletAddFunc 微信小程序-新增
|
||||
func (c *busHseSecurityLogController) HseSecurityLogAppletAddFunc(ctx context.Context, req *wxSystem.HseSecurityLogAppletAddReq) (res *wxSystem.HseSecurityLogAppletAddRes, err error) {
|
||||
err = service.BusHseSecurityLog().HseSecurityLogAppletAdd(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// HseSecurityLogAppletListFunc 微信小程序-列表分页
|
||||
func (c *busHseSecurityLogController) HseSecurityLogAppletListFunc(ctx context.Context, req *wxSystem.HseSecurityLogAppletListReq) (res *wxSystem.HseSecurityLogAppletListRes, err error) {
|
||||
res, err = service.BusHseSecurityLog().HseSecurityLogAppletList(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// HseSecurityLogAppletDetailsFunc 微信小程序-详情
|
||||
func (c *busHseSecurityLogController) HseSecurityLogAppletDetailsFunc(ctx context.Context, req *wxSystem.HseSecurityLogAppletDetailsReq) (res *wxSystem.HseSecurityLogAppletDetailsRes, err error) {
|
||||
res, err = service.BusHseSecurityLog().HseSecurityLogAppletDetails(ctx, req)
|
||||
return
|
||||
}
|
122
internal/app/system/controller/bus_inspection_ticket.go
Normal file
122
internal/app/system/controller/bus_inspection_ticket.go
Normal file
@ -0,0 +1,122 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-03-21 15:23:59
|
||||
// 生成路径: internal/app/system/controller/bus_inspection_ticket.go
|
||||
// 生成人:gfast
|
||||
// desc:质量工单
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
wxSystem "github.com/tiger1103/gfast/v3/api/wxApplet/wxApplet"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busInspectionTicketController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusInspectionTicket = new(busInspectionTicketController)
|
||||
|
||||
// UpdataCorrector pc网页版本:工单状态在通知状态下,可更改整改人(需要删除之前整改人通知和待办的数据)
|
||||
func (c *busInspectionTicketController) UpdataCorrector(ctx context.Context, req *system.UpdataCorrectorReq) (res *system.UpdataCorrectorRes, err error) {
|
||||
err = service.BusInspectionTicket().UpdataCorrector(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// List 列表
|
||||
func (c *busInspectionTicketController) List(ctx context.Context, req *system.BusInspectionTicketSearchReq) (res *system.BusInspectionTicketSearchRes, err error) {
|
||||
res, err = service.BusInspectionTicket().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取质量工单
|
||||
func (c *busInspectionTicketController) Get(ctx context.Context, req *system.BusInspectionTicketGetReq) (res *system.BusInspectionTicketGetRes, err error) {
|
||||
res = new(system.BusInspectionTicketGetRes)
|
||||
entity, err := service.BusInspectionTicket().GetById(ctx, req.Id)
|
||||
res.Details = entity
|
||||
return
|
||||
}
|
||||
|
||||
// LargeScreenDetailsFunc 大屏详情
|
||||
func (c *busInspectionTicketController) LargeScreenDetailsFunc(ctx context.Context, req *system.LargeScreenDetailsReq) (res *system.LargeScreenDetailsRes, err error) {
|
||||
res, err = service.BusInspectionTicket().LargeScreenDetails(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加质量工单
|
||||
func (c *busInspectionTicketController) Add(ctx context.Context, req *system.BusInspectionTicketAddReq) (res *system.BusInspectionTicketAddRes, err error) {
|
||||
err = service.BusInspectionTicket().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 整改
|
||||
func (c *busInspectionTicketController) Edit(ctx context.Context, req *system.BusInspectionTicketAbarbeitungReq) (res *system.BusInspectionTicketAbarbeitungRes, err error) {
|
||||
err = service.BusInspectionTicket().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// EditVerification 验证
|
||||
func (c *busInspectionTicketController) EditVerification(ctx context.Context, req *system.BusInspectionTicketVerificationReq) (res *system.BusInspectionTicketVerificationRes, err error) {
|
||||
err = service.BusInspectionTicket().EditVerification(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除质量工单
|
||||
func (c *busInspectionTicketController) Delete(ctx context.Context, req *system.BusInspectionTicketDeleteReq) (res *system.BusInspectionTicketDeleteRes, err error) {
|
||||
err = service.BusInspectionTicket().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// InspectionTicketAppletAddFunc 微信小程序-新增
|
||||
func (c *busInspectionTicketController) InspectionTicketAppletAddFunc(ctx context.Context, req *wxSystem.InspectionTicketAppletAddReq) (res *wxSystem.InspectionTicketAppletAddRes, err error) {
|
||||
|
||||
err = service.BusInspectionTicket().InspectionTicketAppletAddFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// InspectionTicketAppletAbarbeitungFunc 微信小程序-整改
|
||||
func (c *busInspectionTicketController) InspectionTicketAppletAbarbeitungFunc(ctx context.Context, req *wxSystem.InspectionTicketAppletAbarbeitungReq) (res *wxSystem.InspectionTicketAppletAbarbeitungRes, err error) {
|
||||
err = service.BusInspectionTicket().InspectionTicketAppletAbarbeitungFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// InspectionTicketAppletVerifyFunc 微信小程序-验证
|
||||
func (c *busInspectionTicketController) InspectionTicketAppletVerifyFunc(ctx context.Context, req *wxSystem.InspectionTicketAppletVerifyReq) (res *wxSystem.InspectionTicketAppletVerifyRes, err error) {
|
||||
err = service.BusInspectionTicket().InspectionTicketAppletVerifyFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// InspectionTicketAppletListFunc 微信小程序-列表
|
||||
func (c *busInspectionTicketController) InspectionTicketAppletListFunc(ctx context.Context, req *wxSystem.InspectionTicketAppletListReq) (res *wxSystem.InspectionTicketAppletListRes, err error) {
|
||||
res, err = service.BusInspectionTicket().InspectionTicketAppletListFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// AcquisitionOfCorrectivePersonnelFunc 微信小程序-获取整改人(整改人为当前项目的所有班组长)
|
||||
func (c *busInspectionTicketController) AcquisitionOfCorrectivePersonnelFunc(ctx context.Context, req *wxSystem.AcquisitionOfCorrectivePersonnelReq) (res *wxSystem.AcquisitionOfCorrectivePersonnelRes, err error) {
|
||||
res, err = service.BusInspectionTicket().AcquisitionOfCorrectivePersonnelFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// InspectionTicketAppletDetailsFunc 微信小程序-详情
|
||||
func (c *busInspectionTicketController) InspectionTicketAppletDetailsFunc(ctx context.Context, req *wxSystem.InspectionTicketAppletDetailsReq) (res *wxSystem.InspectionTicketAppletDetailsRes, err error) {
|
||||
res, err = service.BusInspectionTicket().InspectionTicketAppletDetailsFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// GisQualityManagementResFunc Gis质量管理统计
|
||||
func (c *busInspectionTicketController) GisQualityManagementResFunc(ctx context.Context, req *system.GisQualityManagementReq) (res *system.GisQualityManagementRes, err error) {
|
||||
res, err = service.BusInspectionTicket().GisQualityManagementResFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// GisQualityManagementListFunc Gis质量管理列表
|
||||
func (c *busInspectionTicketController) GisQualityManagementListFunc(ctx context.Context, req *system.GisQualityManagementListReq) (res *system.GisQualityManagementListRes, err error) {
|
||||
res, err = service.BusInspectionTicket().GisQualityManagementListFunc(ctx, req)
|
||||
return
|
||||
}
|
71
internal/app/system/controller/bus_machinery.go
Normal file
71
internal/app/system/controller/bus_machinery.go
Normal file
@ -0,0 +1,71 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-07-29 14:02:01
|
||||
// 生成路径: internal/app/system/controller/bus_machinery.go
|
||||
// 生成人:gfast
|
||||
// desc:机械
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busMachineryController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusMachinery = new(busMachineryController)
|
||||
|
||||
// List 列表
|
||||
func (c *busMachineryController) List(ctx context.Context, req *system.BusMachinerySearchReq) (res *system.BusMachinerySearchRes, err error) {
|
||||
res, err = service.BusMachinery().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取机械
|
||||
func (c *busMachineryController) Get(ctx context.Context, req *system.BusMachineryGetReq) (res *system.BusMachineryGetRes, err error) {
|
||||
res = new(system.BusMachineryGetRes)
|
||||
res.BusMachineryInfoRes, err = service.BusMachinery().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加机械
|
||||
func (c *busMachineryController) Add(ctx context.Context, req *system.BusMachineryAddReq) (res *system.BusMachineryAddRes, err error) {
|
||||
err = service.BusMachinery().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改机械
|
||||
func (c *busMachineryController) Edit(ctx context.Context, req *system.BusMachineryEditReq) (res *system.BusMachineryEditRes, err error) {
|
||||
err = service.BusMachinery().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除机械
|
||||
func (c *busMachineryController) Delete(ctx context.Context, req *system.BusMachineryDeleteReq) (res *system.BusMachineryDeleteRes, err error) {
|
||||
err = service.BusMachinery().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// MachineNumberFunc 机械数量
|
||||
func (c *busMachineryController) MachineNumberFunc(ctx context.Context, req *system.MachineNumberReq) (res *system.MachineNumberRes, err error) {
|
||||
res, err = service.BusMachinery().MachineNumberFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// MechanicalConditionFunc 机械情况
|
||||
func (c *busMachineryController) MechanicalConditionFunc(ctx context.Context, req *system.MechanicalConditionReq) (res *system.MechanicalConditionRes, err error) {
|
||||
res, err = service.BusMachinery().MechanicalConditionFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// app列表
|
||||
func (c *busMachineryController) AppList(ctx context.Context, req *system.BusMachineryAppSearchReq) (res *system.BusMachineryAppSearchRes, err error) {
|
||||
res, err = service.BusMachinery().AppList(ctx, req)
|
||||
return
|
||||
}
|
139
internal/app/system/controller/bus_machinery_detail.go
Normal file
139
internal/app/system/controller/bus_machinery_detail.go
Normal file
@ -0,0 +1,139 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-10-12 11:41:32
|
||||
// 生成路径: internal/app/system/controller/bus_machinery_detail.go
|
||||
// 生成人:gfast
|
||||
// desc:机械详情
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
logic "github.com/tiger1103/gfast/v3/internal/app/system/logic/busMachineryDetail"
|
||||
ct "github.com/tiger1103/gfast/v3/internal/app/system/logic/context"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model/do"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
type busMachineryDetailController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusMachineryDetail = new(busMachineryDetailController)
|
||||
|
||||
// List 列表
|
||||
func (c *busMachineryDetailController) List(ctx context.Context, req *system.BusMachineryDetailSearchReq) (res *system.BusMachineryDetailSearchRes, err error) {
|
||||
res, err = service.BusMachineryDetail().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取机械详情
|
||||
func (c *busMachineryDetailController) Get(ctx context.Context, req *system.BusMachineryDetailGetReq) (res *system.BusMachineryDetailGetRes, err error) {
|
||||
res = new(system.BusMachineryDetailGetRes)
|
||||
res.BusMachineryDetailGetIdInfoRes, err = service.BusMachineryDetail().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加机械详情
|
||||
func (c *busMachineryDetailController) Add(ctx context.Context, req *system.BusMachineryDetailAddReq) (res *system.BusMachineryDetailAddRes, err error) {
|
||||
err = service.BusMachineryDetail().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改机械详情
|
||||
func (c *busMachineryDetailController) Edit(ctx context.Context, req *system.BusMachineryDetailEditReq) (res *system.BusMachineryDetailEditRes, err error) {
|
||||
err = service.BusMachineryDetail().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除机械详情
|
||||
func (c *busMachineryDetailController) Delete(ctx context.Context, req *system.BusMachineryDetailDeleteReq) (res *system.BusMachineryDetailDeleteRes, err error) {
|
||||
err = service.BusMachineryDetail().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
//app
|
||||
|
||||
func (c *busMachineryDetailController) AppList(ctx context.Context, req *system.BusMachineryDetailAppSearchReq) (res *system.BusMachineryDetailAppSearchRes, err error) {
|
||||
res, err = service.BusMachineryDetail().AppList(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// app新增
|
||||
func (c *busMachineryDetailController) AppAdd(ctx context.Context, req *system.BusMachineryDetailAppAddReq) (res *system.BusMachineryDetailGetRes, err error) {
|
||||
err = service.BusMachineryDetail().AppAdd(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// app 修改
|
||||
func (c *busMachineryDetailController) AppEdit(ctx context.Context, req *system.BusMachineryDetailAppEditReq) (res *system.BusMachineryDetailAppEditRes, err error) {
|
||||
err = service.BusMachineryDetail().AppEdit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// appgetid
|
||||
func (c *busMachineryDetailController) AppGetById(ctx context.Context, req *system.BusMachineryDetailAppGetReq) (res *system.BusMachineryDetailAppGetRes, err error) {
|
||||
res = new(system.BusMachineryDetailAppGetRes)
|
||||
res.BusMachineryDetailAppGetIdInfoRes, err = service.BusMachineryDetail().AppGetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// app一键退场
|
||||
func (c *busMachineryDetailController) AppExitId(ctx context.Context, req *system.BusMachineryDetailAppExitReq) (res *system.BusMachineryDetailAppExitRes, err error) {
|
||||
machineryId, err := dao.BusMachineryDetail.Ctx(ctx).Where(dao.BusMachineryDetail.Columns().Id, req.Id).Count()
|
||||
if machineryId != 0 {
|
||||
Nowtime := gtime.Now()
|
||||
detail := do.BusMachineryDetail{
|
||||
Type: logic.Exarch,
|
||||
EntryTime: Nowtime,
|
||||
UpdateBy: ct.New().GetLoginUser(ctx).Id,
|
||||
}
|
||||
_, err = dao.BusMachineryDetail.Ctx(ctx).WherePri(req.Id).Update(detail)
|
||||
liberr.ErrIsNil(ctx, err, "获取信息失败")
|
||||
//机械设备详细新增记录
|
||||
if err == nil {
|
||||
dao.BusMachineryRecord.Ctx(ctx).Insert(do.BusMachineryRecord{
|
||||
MachineryDetailId: req.Id,
|
||||
RecordTime: Nowtime,
|
||||
Type: logic.Exarch,
|
||||
CreateBy: ct.New().GetLoginUser(ctx).Id,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return nil, errors.New("此信息不存在")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *busMachineryDetailController) AppEntranceId(ctx context.Context, req *system.BusMachineryDetailAppEntranceReq) (res *system.BusMachineryDetailAppEntranceRes, err error) {
|
||||
machineryId, err := dao.BusMachineryDetail.Ctx(ctx).Where(dao.BusMachineryDetail.Columns().Id, req.Id).Count()
|
||||
if machineryId != 0 {
|
||||
Nowtime := gtime.Now()
|
||||
detail := do.BusMachineryDetail{
|
||||
Type: logic.Entry,
|
||||
EntryTime: Nowtime,
|
||||
UpdateBy: ct.New().GetLoginUser(ctx).Id,
|
||||
}
|
||||
_, err = dao.BusMachineryDetail.Ctx(ctx).WherePri(req.Id).Update(detail)
|
||||
liberr.ErrIsNil(ctx, err, "获取信息失败")
|
||||
//机械设备详细新增记录
|
||||
if err == nil {
|
||||
dao.BusMachineryRecord.Ctx(ctx).Insert(do.BusMachineryRecord{
|
||||
MachineryDetailId: req.Id,
|
||||
RecordTime: Nowtime,
|
||||
Type: logic.Entry,
|
||||
CreateBy: ct.New().GetLoginUser(ctx).Id,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return nil, errors.New("此信息不存在")
|
||||
}
|
||||
return
|
||||
}
|
89
internal/app/system/controller/bus_payroll_list.go
Normal file
89
internal/app/system/controller/bus_payroll_list.go
Normal file
@ -0,0 +1,89 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-11-20 13:51:38
|
||||
// 生成路径: internal/app/system/controller/bus_payroll_list.go
|
||||
// 生成人:gfast
|
||||
// desc:工资(excel导入形成的)
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busPayrollListController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusPayrollList = new(busPayrollListController)
|
||||
|
||||
// =============工资表列表=============
|
||||
// =============工资表列表=============
|
||||
// =============工资表列表=============
|
||||
|
||||
// ImportExcelPaySheet 导入excel工资表
|
||||
func (c *busPayrollListController) ImportExcelPaySheet(ctx context.Context, req *system.ImportExcelPaySheetReq) (res *system.ImportExcelPaySheetRes, err error) {
|
||||
err = service.BusPayrollList().ImportExcelPaySheet(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// ReadAllImportedListData 读取所有导入列表数据(汇总)
|
||||
func (c *busPayrollListController) ReadAllImportedListData(ctx context.Context, req *system.ReadAllImportedListDataReq) (res *system.ReadAllImportedListDataRes, err error) {
|
||||
res, err = service.BusPayrollList().ReadAllImportedListData(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePayroll 删除工资表目录
|
||||
func (c *busPayrollListController) DeletePayroll(ctx context.Context, req *system.BusDeletePayrollReq) (res *system.BusDeletePayrollRes, err error) {
|
||||
service.BusPayrollList().DeletePayroll(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//=============工资表文件资源=============
|
||||
//=============工资表文件资源=============
|
||||
//=============工资表文件资源=============
|
||||
|
||||
// GetTheSourceExcelAccordingToTheIdOfThePayroll 根据工资表的id获取到源excel(只允许查看)
|
||||
func (c *busPayrollListController) GetTheSourceExcelAccordingToTheIdOfThePayroll(ctx context.Context, req *system.GetTheSourceExcelAccordingToTheIdOfThePayrollReq) (res *system.GetTheSourceExcelAccordingToTheIdOfThePayrollRes, err error) {
|
||||
res, err = service.BusPayrollList().GetTheSourceExcelAccordingToTheIdOfThePayroll(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//=============工资表excel导入数据=============
|
||||
//=============工资表excel导入数据=============
|
||||
//=============工资表excel导入数据=============
|
||||
|
||||
// List 读取工资
|
||||
func (c *busPayrollListController) List(ctx context.Context, req *system.BusPayrollListSearchReq) (res *system.BusPayrollListSearchRes, err error) {
|
||||
res, err = service.BusPayrollList().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//// Get 获取工资(excel导入形成的)
|
||||
//func (c *busPayrollListController) Get(ctx context.Context, req *system.BusPayrollListGetReq) (res *system.BusPayrollListGetRes, err error) {
|
||||
// res = new(system.BusPayrollListGetRes)
|
||||
// res.BusPayrollListInfoRes, err = service.BusPayrollList().GetById(ctx, req.Id)
|
||||
// return
|
||||
//}
|
||||
|
||||
//// Add 添加工资(excel导入形成的)
|
||||
//func (c *busPayrollListController) Add(ctx context.Context, req *system.BusPayrollListAddReq) (res *system.BusPayrollListAddRes, err error) {
|
||||
// err = service.BusPayrollList().Add(ctx, req)
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//// Edit 修改工资(excel导入形成的)
|
||||
//func (c *busPayrollListController) Edit(ctx context.Context, req *system.BusPayrollListEditReq) (res *system.BusPayrollListEditRes, err error) {
|
||||
// err = service.BusPayrollList().Edit(ctx, req)
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//// Delete 删除工资(excel导入形成的)
|
||||
//func (c *busPayrollListController) Delete(ctx context.Context, req *system.BusPayrollListDeleteReq) (res *system.BusPayrollListDeleteRes, err error) {
|
||||
// err = service.BusPayrollList().Delete(ctx, req.Ids)
|
||||
// return
|
||||
//}
|
77
internal/app/system/controller/bus_projectin_progress.go
Normal file
77
internal/app/system/controller/bus_projectin_progress.go
Normal file
@ -0,0 +1,77 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-03-20 19:45:19
|
||||
// 生成路径: internal/app/system/controller/bus_projectin_progress.go
|
||||
// 生成人:gfast
|
||||
// desc:在建项目
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busProjectinProgressController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusProjectinProgress = new(busProjectinProgressController)
|
||||
|
||||
// ListALLFunc 在建项目
|
||||
func (c *busProjectinProgressController) ListALLFunc(ctx context.Context, req *system.BusProjectinProgressSearchAllReq) (res *system.BusProjectinProgressSearchAllRes, err error) {
|
||||
res = new(system.BusProjectinProgressSearchAllRes)
|
||||
var eneity []*model.SysProjectListRes
|
||||
err = dao.SysProject.Ctx(ctx).Where("show_hidden", "1").Scan(&eneity)
|
||||
if eneity != nil {
|
||||
res.SumNum = len(eneity)
|
||||
for _, data := range eneity {
|
||||
if data.IsType == "1" {
|
||||
res.Photovoltaic = res.Photovoltaic + 1
|
||||
}
|
||||
if data.IsType == "2" {
|
||||
res.WindPower = res.WindPower + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
value, err := dao.BusProjectinProgress.Ctx(ctx).Fields("sum(parallel_in)").Value()
|
||||
res.ParallelIn = value.Float64()
|
||||
return
|
||||
}
|
||||
|
||||
// List 列表
|
||||
func (c *busProjectinProgressController) List(ctx context.Context, req *system.BusProjectinProgressSearchReq) (res *system.BusProjectinProgressSearchRes, err error) {
|
||||
res, err = service.BusProjectinProgress().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取在建项目
|
||||
func (c *busProjectinProgressController) Get(ctx context.Context, req *system.BusProjectinProgressGetReq) (res *system.BusProjectinProgressGetRes, err error) {
|
||||
res = new(system.BusProjectinProgressGetRes)
|
||||
res.BusProjectinProgressInfoRes, err = service.BusProjectinProgress().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加在建项目
|
||||
func (c *busProjectinProgressController) Add(ctx context.Context, req *system.BusProjectinProgressAddReq) (res *system.BusProjectinProgressAddRes, err error) {
|
||||
err = service.BusProjectinProgress().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改在建项目
|
||||
func (c *busProjectinProgressController) Edit(ctx context.Context, req *system.BusProjectinProgressEditReq) (res *system.BusProjectinProgressEditRes, err error) {
|
||||
err = service.BusProjectinProgress().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除在建项目
|
||||
func (c *busProjectinProgressController) Delete(ctx context.Context, req *system.BusProjectinProgressDeleteReq) (res *system.BusProjectinProgressDeleteRes, err error) {
|
||||
err = service.BusProjectinProgress().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
83
internal/app/system/controller/bus_quality.go
Normal file
83
internal/app/system/controller/bus_quality.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-08-02 17:11:39
|
||||
// 生成路径: internal/app/system/controller/bus_quality.go
|
||||
// 生成人:gfast
|
||||
// desc:质量文档管理
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busQualityController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusQuality = new(busQualityController)
|
||||
|
||||
// List 列表
|
||||
func (c *busQualityController) List(ctx context.Context, req *system.BusQualitySearchReq) (res *system.BusQualitySearchRes, err error) {
|
||||
res, err = service.BusQuality().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取质量文档管理
|
||||
func (c *busQualityController) Get(ctx context.Context, req *system.BusQualityGetReq) (res *system.BusQualityGetRes, err error) {
|
||||
res = new(system.BusQualityGetRes)
|
||||
res.BusQualityInfoRes, err = service.BusQuality().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加质量文档管理
|
||||
func (c *busQualityController) Add(ctx context.Context, req *system.BusQualityAddReq) (res *system.BusQualityAddRes, err error) {
|
||||
err = service.BusQuality().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// WxAddFunc 添加质量文档管理
|
||||
func (c *busQualityController) WxAddFunc(ctx context.Context, req *system.WxBusQualityAddReq) (res *system.WxBusQualityAddRes, err error) {
|
||||
err = service.BusQuality().WxAddFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改质量文档管理
|
||||
func (c *busQualityController) Edit(ctx context.Context, req *system.BusQualityEditReq) (res *system.BusQualityEditRes, err error) {
|
||||
err = service.BusQuality().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除质量文档管理
|
||||
func (c *busQualityController) Delete(ctx context.Context, req *system.BusQualityDeleteReq) (res *system.BusQualityDeleteRes, err error) {
|
||||
err = service.BusQuality().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// GraphFunc 图标统计
|
||||
func (c *busQualityController) GraphFunc(ctx context.Context, req *system.GraphReq) (res *system.GraphRes, err error) {
|
||||
res, err = service.BusQuality().GraphFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// GraphDataListFunc 图标统计列表
|
||||
func (c *busQualityController) GraphDataListFunc(ctx context.Context, req *system.GraphDataListReq) (res *system.GraphDataListRes, err error) {
|
||||
res, err = service.BusQuality().GraphDataListFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// QualityFunc 质量监控统计
|
||||
func (c *busQualityController) QualityFunc(ctx context.Context, req *system.QualityReq) (res *system.QualityRes, err error) {
|
||||
res, err = service.BusQuality().QualityFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// QualityDataListFunc 质量监控统计列表
|
||||
func (c *busQualityController) QualityDataListFunc(ctx context.Context, req *system.QualityDataListReq) (res *system.QualityDataListRes, err error) {
|
||||
res, err = service.BusQuality().QualityDataListFunc(ctx, req)
|
||||
return
|
||||
}
|
107
internal/app/system/controller/bus_question_bank.go
Normal file
107
internal/app/system/controller/bus_question_bank.go
Normal file
@ -0,0 +1,107 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-10-07 15:52:18
|
||||
// 生成路径: internal/app/system/controller/bus_question_bank.go
|
||||
// 生成人:gfast
|
||||
// desc:题库
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type busQuestionBankController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusQuestionBank = new(busQuestionBankController)
|
||||
|
||||
// List 列表
|
||||
func (c *busQuestionBankController) List(ctx context.Context, req *system.BusQuestionBankSearchReq) (res *system.BusQuestionBankSearchRes, err error) {
|
||||
res, err = service.BusQuestionBank().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取题库
|
||||
func (c *busQuestionBankController) Get(ctx context.Context, req *system.BusQuestionBankGetReq) (res *system.BusQuestionBankGetRes, err error) {
|
||||
res = new(system.BusQuestionBankGetRes)
|
||||
res.BusQuestionBankInfoRes, err = service.BusQuestionBank().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加题库
|
||||
func (c *busQuestionBankController) Add(ctx context.Context, req *system.BusQuestionBankAddReq) (res *system.BusQuestionBankAddRes, err error) {
|
||||
err = service.BusQuestionBank().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改题库
|
||||
func (c *busQuestionBankController) Edit(ctx context.Context, req *system.BusQuestionBankEditReq) (res *system.BusQuestionBankEditRes, err error) {
|
||||
err = service.BusQuestionBank().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除题库
|
||||
func (c *busQuestionBankController) Delete(ctx context.Context, req *system.BusQuestionBankDeleteReq) (res *system.BusQuestionBankDeleteRes, err error) {
|
||||
err = service.BusQuestionBank().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// ExaminationPaper 随机生成试卷
|
||||
func (c *busQuestionBankController) ExaminationPaper(ctx context.Context, req *system.ExaminationPaperReq) (res *system.ExaminationPaperRes, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
res = new(system.ExaminationPaperRes)
|
||||
//1、获取配置信息
|
||||
var configurationEntity *model.BusQuestionsConfigurationInfoRes
|
||||
err = dao.BusQuestionsConfiguration.Ctx(ctx).Limit(1).Scan(&configurationEntity)
|
||||
//2、随机获取数据,返回id和score
|
||||
s := configurationEntity.SingleChoice
|
||||
m := configurationEntity.MultipleChoice
|
||||
e := configurationEntity.Estimate
|
||||
var sEntity []*system.ExaminationPaperTwo
|
||||
var mEntity []*system.ExaminationPaperTwo
|
||||
var eEntity []*system.ExaminationPaperTwo
|
||||
err = dao.BusQuestionBank.Ctx(ctx).Where("question_type", "1").OrderRandom().Limit(s).Scan(&sEntity)
|
||||
err = dao.BusQuestionBank.Ctx(ctx).Where("question_type", "2").OrderRandom().Limit(m).Scan(&mEntity)
|
||||
err = dao.BusQuestionBank.Ctx(ctx).Where("question_type", "3").OrderRandom().Limit(e).Scan(&eEntity)
|
||||
//3、组装数据
|
||||
var one = new(system.ExaminationPaperOne)
|
||||
one.Topic = "一、单选题,共" + strconv.Itoa(s) + "道题,每小题" + strconv.FormatFloat(configurationEntity.SingleScore, 'f', -1, 64) + "分,共计" + strconv.FormatFloat(float64(s)*configurationEntity.SingleScore, 'f', -1, 64) + "分"
|
||||
for _, data := range sEntity {
|
||||
data.Score = configurationEntity.SingleScore
|
||||
}
|
||||
one.List = sEntity
|
||||
res.Single = one
|
||||
|
||||
var two = new(system.ExaminationPaperOne)
|
||||
two.Topic = "二、多选题,共" + strconv.Itoa(m) + "道题,每小题" + strconv.FormatFloat(configurationEntity.MultipleScore, 'f', -1, 64) + "分,共计" + strconv.FormatFloat(float64(m)*configurationEntity.MultipleScore, 'f', -1, 64) + "分"
|
||||
for _, data := range mEntity {
|
||||
data.Score = configurationEntity.MultipleScore
|
||||
}
|
||||
two.List = mEntity
|
||||
res.Multiple = two
|
||||
|
||||
var three = new(system.ExaminationPaperOne)
|
||||
three.Topic = "三、判断题,共" + strconv.Itoa(e) + "道题,每小题" + strconv.FormatFloat(configurationEntity.EstimateScore, 'f', -1, 64) + "分,共计" + strconv.FormatFloat(float64(e)*configurationEntity.EstimateScore, 'f', -1, 64) + "分"
|
||||
for _, data := range eEntity {
|
||||
data.Score = configurationEntity.EstimateScore
|
||||
}
|
||||
three.List = eEntity
|
||||
res.Estimate = three
|
||||
//4、设置最大考试时间
|
||||
res.Maximum = configurationEntity.AnswerTime
|
||||
//4、需要将生成的数据存储到记录表中
|
||||
liberr.ErrIsNil(ctx, err, "试卷生成失败!")
|
||||
})
|
||||
return
|
||||
}
|
344
internal/app/system/controller/bus_question_save.go
Normal file
344
internal/app/system/controller/bus_question_save.go
Normal file
@ -0,0 +1,344 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-11-01 17:33:04
|
||||
// 生成路径: internal/app/system/controller/bus_question_save.go
|
||||
// 生成人:gfast
|
||||
// desc:用户试卷存储
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/common/coryCommon"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type busQuestionSaveController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
type UploadZipFileEntity struct {
|
||||
Openid string `p:"openid" `
|
||||
SfzNumber string `p:"sfzNumber" `
|
||||
ProjectId int64 `p:"projectId" `
|
||||
}
|
||||
|
||||
var BusQuestionSave = new(busQuestionSaveController)
|
||||
|
||||
// List 列表
|
||||
func (c *busQuestionSaveController) List(ctx context.Context, req *system.BusQuestionSaveSearchReq) (res *system.BusQuestionSaveSearchRes, err error) {
|
||||
res, err = service.BusQuestionSave().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取用户试卷存储
|
||||
func (c *busQuestionSaveController) Get(ctx context.Context, req *system.BusQuestionSaveGetReq) (res *system.BusQuestionSaveGetRes, err error) {
|
||||
res = new(system.BusQuestionSaveGetRes)
|
||||
res.BusQuestionSaveInfoRes, err = service.BusQuestionSave().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加用户试卷存储
|
||||
func (c *busQuestionSaveController) Add(ctx context.Context, req *system.BusQuestionSaveAddReq) (res *system.BusQuestionSaveAddRes, err error) {
|
||||
res = new(system.BusQuestionSaveAddRes)
|
||||
res, err = service.BusQuestionSave().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除用户试卷存储
|
||||
func (c *busQuestionSaveController) Delete(ctx context.Context, req *system.BusQuestionSaveDeleteReq) (res *system.BusQuestionSaveDeleteRes, err error) {
|
||||
err = service.BusQuestionSave().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// PassOrNotFunc 查询用户的考试是否已达到及格线
|
||||
func (c *busQuestionSaveController) PassOrNotFunc(ctx context.Context, req *system.PassOrNotReq) (res *system.PassOrNotRes, err error) {
|
||||
res = new(system.PassOrNotRes)
|
||||
res, err = service.BusQuestionSave().PassOrNotFunc(ctx, req.Openid)
|
||||
return
|
||||
}
|
||||
|
||||
// WeChatPdfWoFunc 根据项目id+班组id 查询到当前用户的考试信息-(安全考试)
|
||||
func (c *busQuestionSaveController) WeChatPdfWoFunc(ctx context.Context, req *system.WeChatPdfWoReq) (res *system.WeChatPdfWoRes, err error) {
|
||||
res = new(system.WeChatPdfWoRes)
|
||||
res, err = service.BusQuestionSave().WeChatPdfWoFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// MultifileDownloadFunc 批量下载pdf
|
||||
func (c *busQuestionSaveController) MultifileDownloadFunc(ctx context.Context, req *system.MultifileDownloadReq) (res *system.MultifileDownloadRes, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
res = new(system.MultifileDownloadRes)
|
||||
//1、根据条件获取到数据
|
||||
var mw []*model.ModelWeChatPdfWoRes
|
||||
if len(req.Openids) > 0 {
|
||||
downloadFunc, err := DownloadFunc(ctx, req.Openids)
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
mw = append(mw, downloadFunc...)
|
||||
}
|
||||
//else {
|
||||
// //array, err = g.DB().Model("bus_question_save_pdf").As("a").
|
||||
// // LeftJoin("bus_construction_user", "b", "b.openid = a.openid and b.project_id = '"+strconv.FormatInt(req.ProjectId, 10)+"' and team_id = '"+strconv.FormatInt(req.TeamId, 10)+"'").
|
||||
// // WhereNotNull("a.openid").Fields("a.path").Array()
|
||||
//}
|
||||
path, err := coryCommon.CustomizationMultifileDownload(coryCommon.Temporary, mw)
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "下载失败")
|
||||
}
|
||||
path = filepath.ToSlash(coryCommon.ResourcePublicToFunc(path, 1))
|
||||
res.Path = path
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func DownloadFunc(ctx context.Context, openids []string) (res []*model.ModelWeChatPdfWoRes, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
mp := make(map[string]*model.ModelWeChatPdfWoRes)
|
||||
//0、获取配置信息
|
||||
var configurationEntity *model.BusQuestionsConfigurationInfoRes
|
||||
err = dao.BusQuestionsConfiguration.Ctx(ctx).Limit(1).Scan(&configurationEntity)
|
||||
liberr.ErrIsNil(ctx, err, "查询失败")
|
||||
//1、获取线上的试卷信息
|
||||
var mwor []*model.ModelWeChatPdfWoRes
|
||||
err = dao.BusQuestionSave.Ctx(ctx).As("a").Fields(`a.openid,
|
||||
b.user_name as userName,
|
||||
a.pass,
|
||||
(select sum( score ) from bus_question_save WHERE correct = 1 and openid = a.openid) as sumScore,
|
||||
c.path`).
|
||||
RightJoin("bus_construction_user", "b", "b.openid = a.openid").
|
||||
LeftJoin("bus_question_save_pdf", "c", "c.openid = b.openid").
|
||||
Where("a.openid in (?)", openids).
|
||||
Where(`a.pass is not null`).
|
||||
Order("a.created_at").
|
||||
Scan(&mwor)
|
||||
for i := range mwor {
|
||||
mwor[i].Type = "1" //pdf
|
||||
mp[mwor[i].Openid] = mwor[i]
|
||||
}
|
||||
liberr.ErrIsNil(ctx, err, "查询失败")
|
||||
//2、获取线下的试卷信息
|
||||
var offlineEnitnty []*model.ModelWeChatPdfWoRes
|
||||
err = g.DB().Model("bus_question_offline").As("a").
|
||||
Fields(
|
||||
"a.openid,"+
|
||||
"b.user_name as userName,"+
|
||||
"concat_ws( ',',a.pass,a.full_mark ) as pass,"+
|
||||
"a.score as sumScore,"+
|
||||
"a.img as path,").
|
||||
LeftJoin("bus_construction_user", "b", "b.openid = a.openid").
|
||||
Where("a.openid in (?)", openids).
|
||||
Scan(&offlineEnitnty)
|
||||
liberr.ErrIsNil(ctx, err, "查询失败")
|
||||
//3、数据信息合并(同一个人选取最大分数的试卷信息)
|
||||
for i := range offlineEnitnty {
|
||||
//如果发现有重复的openid,那么就选取得分最大的
|
||||
mpdata, ok := mp[offlineEnitnty[i].Openid]
|
||||
if ok {
|
||||
mpdataSplit := strings.Split(mpdata.Pass, ",")
|
||||
mpdataFloat, _ := strconv.ParseFloat(mpdataSplit[1], 64)
|
||||
mpdataScore, _ := strconv.ParseFloat(mpdata.SumScore, 64)
|
||||
mpdataScoreOne := 100.00 / mpdataFloat * mpdataScore
|
||||
offlineSplit := strings.Split(offlineEnitnty[i].Pass, ",")
|
||||
offlineFloat, _ := strconv.ParseFloat(offlineSplit[1], 64)
|
||||
offlineScore, _ := strconv.ParseFloat(offlineEnitnty[i].SumScore, 64)
|
||||
offlineScoreTwo := 100.00 / offlineFloat * offlineScore
|
||||
if mpdataScoreOne < offlineScoreTwo {
|
||||
offlineEnitnty[i].Type = "2" //图片
|
||||
mp[offlineEnitnty[i].Openid] = offlineEnitnty[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, v := range mp {
|
||||
res = append(res, v)
|
||||
}
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// UploadZipFileFunc 上传施工人员线下安全考试的资料信息(上传压缩zip文件)
|
||||
func (c *busQuestionSaveController) UploadZipFileFunc(ctx context.Context, req *system.UploadZipFileReq) (res *system.UploadZipFileRes, err error) {
|
||||
err = g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
// 初始化 res 变量
|
||||
res = &system.UploadZipFileRes{}
|
||||
////1、上传压缩文件
|
||||
//file := req.File
|
||||
//path, err := coryCommon.UploadFile(ctx, file, coryCommon.Temporary+"/")
|
||||
//liberr.ErrIsNil(ctx, err)
|
||||
const old = "/resource/public/"
|
||||
if !strings.Contains(req.FilePath, old) {
|
||||
req.FilePath = old + req.FilePath
|
||||
}
|
||||
rpath := strings.Replace(req.FilePath, old, coryCommon.GetCWD()+old, 1)
|
||||
str := "/" + coryCommon.Ynr(coryCommon.Temporary+"/") + coryCommon.FileName("del")
|
||||
//2、解压文件 删除解压文件
|
||||
folderPath, err := coryCommon.FileZipFunc(rpath, "", str)
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
//3、读取文件目录
|
||||
offline, err := ReadDirectory(ctx, folderPath)
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
//4、获取身份证信息对应的openid
|
||||
var sfz []string
|
||||
for _, data := range offline {
|
||||
// 根据身份证获取到指定用户所在的项目
|
||||
sfz = append(sfz, data.IdentityCard)
|
||||
}
|
||||
if len(sfz) > 0 {
|
||||
var entity []*UploadZipFileEntity
|
||||
err = dao.BusConstructionUser.Ctx(ctx).Where("sfz_number in (?)", sfz).Fields("project_id as projectId,openid,sfz_number as sfzNumber").Scan(&entity)
|
||||
liberr.ErrIsNil(ctx, err, "上传失败")
|
||||
for _, one := range entity {
|
||||
for j, two := range offline {
|
||||
if one.SfzNumber == two.IdentityCard {
|
||||
offline[j].Openid = one.Openid
|
||||
offline[j].ProjectId = one.ProjectId
|
||||
}
|
||||
}
|
||||
}
|
||||
//5、查询原本的数据,然后对比哪个分数大就保留哪个
|
||||
var offlineEntity []*model.BusQuestionOfflineRes
|
||||
err = g.DB().Model("bus_question_offline").Ctx(ctx).Scan(&offlineEntity)
|
||||
liberr.ErrIsNil(ctx, err, "上传失败")
|
||||
var ids []int64
|
||||
for _, one := range offlineEntity {
|
||||
scoreOne := 100.00 / one.FullMark * one.Score
|
||||
for _, two := range offline {
|
||||
if one.Openid == two.Openid {
|
||||
scoreTwo := 100.00 / two.FullMark * two.Score
|
||||
if scoreOne <= scoreTwo {
|
||||
//记录需要删除的id
|
||||
ids = append(ids, one.Id)
|
||||
if one.Img != "" {
|
||||
os.Remove(coryCommon.FileToFunc(one.Img, 2))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//6、删除分数小的对比数据
|
||||
if len(ids) > 0 {
|
||||
value, err := g.DB().Model("bus_question_offline").Ctx(ctx).
|
||||
Fields("GROUP_CONCAT(img)").
|
||||
Where("id in (?)", ids).Value()
|
||||
liberr.ErrIsNil(ctx, err, "上传失败")
|
||||
_, err = g.DB().Model("bus_question_offline").Ctx(ctx).Where("id in (?)", ids).Delete()
|
||||
liberr.ErrIsNil(ctx, err, "上传失败")
|
||||
if err == nil {
|
||||
split := strings.Split(value.String(), ",")
|
||||
for _, files := range split {
|
||||
var f = coryCommon.FileToFunc(files, 2)
|
||||
os.Remove(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
//7、插入数据
|
||||
if offline != nil {
|
||||
var oe []*model.BusQuestionOfflineRes
|
||||
for i := range offline {
|
||||
if offline[i].Openid != "" {
|
||||
oe = append(oe, offline[i])
|
||||
}
|
||||
}
|
||||
_, err = g.DB().Model("bus_question_offline").Ctx(ctx).Insert(oe)
|
||||
liberr.ErrIsNil(ctx, err, "上传失败")
|
||||
}
|
||||
}
|
||||
defer func() {
|
||||
os.RemoveAll(rpath)
|
||||
os.RemoveAll(coryCommon.GetCWD() + str)
|
||||
}()
|
||||
return
|
||||
})
|
||||
return err
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// ReadDirectory 获取文件夹下面的所有文件
|
||||
func ReadDirectory(ctx context.Context, folderPath string) (entity []*model.BusQuestionOfflineRes, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
// 读取文件夹下的所有文件和子文件夹
|
||||
files, err := os.ReadDir(folderPath)
|
||||
if err != nil {
|
||||
fmt.Println("读取文件夹失败: ", err)
|
||||
return
|
||||
}
|
||||
for _, file := range files {
|
||||
// 获取文件或子文件夹的名称
|
||||
fileName := file.Name()
|
||||
//fileName, err = coryCommon.GbkDecode(fileName)
|
||||
//if err != nil {
|
||||
// fmt.Println("解码文件名称失败: ", err)
|
||||
// return
|
||||
//}
|
||||
// 获取文件或子文件夹的绝对路径
|
||||
filePath := filepath.Join(folderPath, fileName)
|
||||
// 检查文件是否为文件夹
|
||||
if file.IsDir() {
|
||||
split := strings.Split(fileName, "-")
|
||||
if len(split) < 5 {
|
||||
err := errors.New("您的文件【" + filePath + "】不符合规格!(示例:小明-5130112333654X-100-59-60)")
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
return
|
||||
}
|
||||
fullMark, err := strconv.ParseFloat(split[2], 64)
|
||||
liberr.ErrIsNil(ctx, err, "满分转换失败")
|
||||
score, err := strconv.ParseFloat(split[3], 64)
|
||||
liberr.ErrIsNil(ctx, err, "得分转换失败")
|
||||
pass, err := strconv.ParseFloat(split[4], 64)
|
||||
liberr.ErrIsNil(ctx, err, "及格分转换失败")
|
||||
res := model.BusQuestionOfflineRes{
|
||||
FullMark: fullMark,
|
||||
Score: score,
|
||||
Pass: pass,
|
||||
IdentityCard: split[1],
|
||||
//CreatedAt: gtime.New(time.Now()),
|
||||
}
|
||||
offlineRes, err := ReadDirectory(ctx, filePath)
|
||||
imgStr := ""
|
||||
for i := range offlineRes {
|
||||
s2 := filepath.ToSlash(offlineRes[i].Img)
|
||||
var s1 = filepath.ToSlash(coryCommon.GetCWD() + "/" + coryCommon.Ynr(coryCommon.Helmet) + coryCommon.FileName("aqks") + path.Ext(s2))
|
||||
os.Rename(s2, s1)
|
||||
all := strings.ReplaceAll(s1, coryCommon.GetCWD()+"/resource/public/", "/file/")
|
||||
imgStr = imgStr + all + ","
|
||||
}
|
||||
if len(imgStr) > 0 {
|
||||
imgStr = imgStr[0 : len(imgStr)-1]
|
||||
}
|
||||
res.Img = imgStr
|
||||
entity = append(entity, &res)
|
||||
} else {
|
||||
var suffix = ".jpg,.jpeg,.png,.pdf,.doc,.docx"
|
||||
flag := coryCommon.FormatRestrictionFunc(filePath, suffix)
|
||||
if !flag {
|
||||
err = errors.New("仅支持的格式为:" + suffix)
|
||||
liberr.ErrIsNil(ctx, err)
|
||||
return
|
||||
} else {
|
||||
res := model.BusQuestionOfflineRes{
|
||||
Img: filePath,
|
||||
}
|
||||
entity = append(entity, &res)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-10-07 17:11:20
|
||||
// 生成路径: internal/app/system/controller/bus_questions_configuration.go
|
||||
// 生成人:gfast
|
||||
// desc:题库配置
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busQuestionsConfigurationController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusQuestionsConfiguration = new(busQuestionsConfigurationController)
|
||||
|
||||
// List 列表
|
||||
func (c *busQuestionsConfigurationController) List(ctx context.Context, req *system.BusQuestionsConfigurationSearchReq) (res *system.BusQuestionsConfigurationSearchRes, err error) {
|
||||
res, err = service.BusQuestionsConfiguration().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取题库配置
|
||||
func (c *busQuestionsConfigurationController) Get(ctx context.Context, req *system.BusQuestionsConfigurationGetReq) (res *system.BusQuestionsConfigurationGetRes, err error) {
|
||||
res = new(system.BusQuestionsConfigurationGetRes)
|
||||
res.BusQuestionsConfigurationInfoRes, err = service.BusQuestionsConfiguration().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加题库配置
|
||||
func (c *busQuestionsConfigurationController) Add(ctx context.Context, req *system.BusQuestionsConfigurationAddReq) (res *system.BusQuestionsConfigurationAddRes, err error) {
|
||||
err = service.BusQuestionsConfiguration().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改题库配置
|
||||
func (c *busQuestionsConfigurationController) Edit(ctx context.Context, req *system.BusQuestionsConfigurationEditReq) (res *system.BusQuestionsConfigurationEditRes, err error) {
|
||||
err = service.BusQuestionsConfiguration().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除题库配置
|
||||
func (c *busQuestionsConfigurationController) Delete(ctx context.Context, req *system.BusQuestionsConfigurationDeleteReq) (res *system.BusQuestionsConfigurationDeleteRes, err error) {
|
||||
err = service.BusQuestionsConfiguration().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
53
internal/app/system/controller/bus_reissue_a_card.go
Normal file
53
internal/app/system/controller/bus_reissue_a_card.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2024-02-02 15:18:48
|
||||
// 生成路径: internal/app/system/controller/bus_reissue_a_card.go
|
||||
// 生成人:gfast
|
||||
// desc:施工人员补卡申请
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busReissueACardController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusReissueACard = new(busReissueACardController)
|
||||
|
||||
// List 列表
|
||||
func (c *busReissueACardController) List(ctx context.Context, req *system.BusReissueACardSearchReq) (res *system.BusReissueACardSearchRes, err error) {
|
||||
res, err = service.BusReissueACard().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取施工人员补卡申请
|
||||
func (c *busReissueACardController) Get(ctx context.Context, req *system.BusReissueACardGetReq) (res *system.BusReissueACardGetRes, err error) {
|
||||
res = new(system.BusReissueACardGetRes)
|
||||
res.BusReissueACardInfoRes, err = service.BusReissueACard().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
//// Add 添加施工人员补卡申请
|
||||
//func (c *busReissueACardController) Add(ctx context.Context, req *system.BusReissueACardAddReq) (res *system.BusReissueACardAddRes, err error) {
|
||||
// err = service.BusReissueACard().Add(ctx, req)
|
||||
// return
|
||||
//}
|
||||
|
||||
// Edit 修改施工人员补卡申请
|
||||
func (c *busReissueACardController) Edit(ctx context.Context, req *system.BusReissueACardEditReq) (res *system.BusReissueACardEditRes, err error) {
|
||||
err = service.BusReissueACard().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
//// Delete 删除施工人员补卡申请
|
||||
//func (c *busReissueACardController) Delete(ctx context.Context, req *system.BusReissueACardDeleteReq) (res *system.BusReissueACardDeleteRes, err error) {
|
||||
// err = service.BusReissueACard().Delete(ctx, req.Ids)
|
||||
// return
|
||||
//}
|
53
internal/app/system/controller/bus_research_document.go
Normal file
53
internal/app/system/controller/bus_research_document.go
Normal file
@ -0,0 +1,53 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-07-29 16:04:06
|
||||
// 生成路径: internal/app/system/controller/bus_research_document.go
|
||||
// 生成人:gfast
|
||||
// desc:科研文档
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busResearchDocumentController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusResearchDocument = new(busResearchDocumentController)
|
||||
|
||||
// List 列表
|
||||
func (c *busResearchDocumentController) List(ctx context.Context, req *system.BusResearchDocumentSearchReq) (res *system.BusResearchDocumentSearchRes, err error) {
|
||||
res, err = service.BusResearchDocument().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取科研文档
|
||||
func (c *busResearchDocumentController) Get(ctx context.Context, req *system.BusResearchDocumentGetReq) (res *system.BusResearchDocumentGetRes, err error) {
|
||||
res = new(system.BusResearchDocumentGetRes)
|
||||
res.BusResearchDocumentInfoRes, err = service.BusResearchDocument().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加科研文档
|
||||
func (c *busResearchDocumentController) Add(ctx context.Context, req *system.BusResearchDocumentAddReq) (res *system.BusResearchDocumentAddRes, err error) {
|
||||
err = service.BusResearchDocument().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改科研文档
|
||||
func (c *busResearchDocumentController) Edit(ctx context.Context, req *system.BusResearchDocumentEditReq) (res *system.BusResearchDocumentEditRes, err error) {
|
||||
err = service.BusResearchDocument().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除科研文档
|
||||
func (c *busResearchDocumentController) Delete(ctx context.Context, req *system.BusResearchDocumentDeleteReq) (res *system.BusResearchDocumentDeleteRes, err error) {
|
||||
err = service.BusResearchDocument().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
59
internal/app/system/controller/bus_safety.go
Normal file
59
internal/app/system/controller/bus_safety.go
Normal file
@ -0,0 +1,59 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-08-02 15:40:48
|
||||
// 生成路径: internal/app/system/controller/bus_safety.go
|
||||
// 生成人:gfast
|
||||
// desc:安全例会管理
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type busSafetyController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var BusSafety = new(busSafetyController)
|
||||
|
||||
// List 列表
|
||||
func (c *busSafetyController) List(ctx context.Context, req *system.BusSafetySearchReq) (res *system.BusSafetySearchRes, err error) {
|
||||
res, err = service.BusSafety().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取安全例会管理
|
||||
func (c *busSafetyController) Get(ctx context.Context, req *system.BusSafetyGetReq) (res *system.BusSafetyGetRes, err error) {
|
||||
res = new(system.BusSafetyGetRes)
|
||||
res.BusSafetyInfoRes, err = service.BusSafety().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加安全例会管理
|
||||
func (c *busSafetyController) Add(ctx context.Context, req *system.BusSafetyAddReq) (res *system.BusSafetyAddRes, err error) {
|
||||
err = service.BusSafety().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// WxAddFunc 微信小程序添加安全例会管理
|
||||
func (c *busSafetyController) WxAddFunc(ctx context.Context, req *system.WxBusSafetyAddReq) (res *system.WxBusSafetyAddRes, err error) {
|
||||
err = service.BusSafety().WxAddFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改安全例会管理
|
||||
func (c *busSafetyController) Edit(ctx context.Context, req *system.BusSafetyEditReq) (res *system.BusSafetyEditRes, err error) {
|
||||
err = service.BusSafety().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除安全例会管理
|
||||
func (c *busSafetyController) Delete(ctx context.Context, req *system.BusSafetyDeleteReq) (res *system.BusSafetyDeleteRes, err error) {
|
||||
err = service.BusSafety().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user