Răsfoiți Sursa

Merge branch 'develop' into feature/admin

# Conflicts:
#	opms_parent/app/dao/plat/internal/plat_task.go
#	opms_parent/app/model/plat/internal/plat_task.go
ZZH-wl 3 ani în urmă
părinte
comite
52d33e0298

+ 1 - 0
opms_admin/config/config.toml

@@ -5,6 +5,7 @@
     need-advertise-addr = false
     srv-name = "dashoo.opms.admin-0.0.1"
     env = "dev"
+    websocket-addr = "127.0.0.1:8899"
 
 # 微服务注册中心配置
 [service_registry]

+ 12 - 7
opms_libary/plugin/dingtalk/client.go

@@ -7,8 +7,8 @@ import (
 	"dashoo.cn/opms_libary/plugin/dingtalk/context"
 	"dashoo.cn/opms_libary/plugin/dingtalk/jsapi"
 	"dashoo.cn/opms_libary/plugin/dingtalk/message"
+	"dashoo.cn/opms_libary/plugin/dingtalk/storage"
 	"dashoo.cn/opms_libary/plugin/dingtalk/workflow"
-	"github.com/gogf/gf/frame/g"
 	"github.com/gogf/gf/os/gcache"
 	"sync"
 )
@@ -28,12 +28,12 @@ func init() {
 
 func NewClient() *ClientImpl {
 	var config = context.Config{
-		CorpId:    g.Config().GetString("dingtalk.corp-id"),    //"dinga8b316209f5ee42435c2f4657eb6378f",
-		AgentId:   g.Config().GetString("dingtalk.agent-id"),   //"2384115071",
-		AppKey:    g.Config().GetString("dingtalk.app-key"),    //"dinguytykawticadfoht",
-		AppSecret: g.Config().GetString("dingtalk.app-secret"), //"zPlj4ZpITsUbeq2C0GrwJ78-e8knH_kIeyvznaNQacqtrSb9zbeZcOajgBKdolky",
-		AESKey:    g.Config().GetString("dingtalk.aes-key"),    //"oUjmeWea8Ow1jsdK4UHoDthy6EMQKq3RGbM2rEeTgnm",
-		Token:     g.Config().GetString("dingtalk.token"),      //"WaasHsYk8V3wqwN5xRGsCmiiRDB",
+		CorpId:    "dinga8b316209f5ee42435c2f4657eb6378f",                             //g.Config().GetString("dingtalk.corp-id"),    //
+		AgentId:   "2384115071",                                                       // g.Config().GetString("dingtalk.agent-id"),   //
+		AppKey:    "dinguytykawticadfoht",                                             //g.Config().GetString("dingtalk.app-key"),    //
+		AppSecret: "zPlj4ZpITsUbeq2C0GrwJ78-e8knH_kIeyvznaNQacqtrSb9zbeZcOajgBKdolky", //g.Config().GetString("dingtalk.app-secret"), //
+		AESKey:    "oUjmeWea8Ow1jsdK4UHoDthy6EMQKq3RGbM2rEeTgnm",                      //g.Config().GetString("dingtalk.aes-key"),    //
+		Token:     "WaasHsYk8V3wqwN5xRGsCmiiRDB",                                      //g.Config().GetString("dingtalk.token"),      //
 	}
 	return newClient(config)
 }
@@ -81,6 +81,11 @@ func (c *ClientImpl) GetCalendar() *calendar.Calendar {
 	return calendar.NewCalendar(c.Context)
 }
 
+//GetStorage 获取Jsapi
+func (c *ClientImpl) GetStorage() *storage.Storage {
+	return storage.NewStorage(c.Context)
+}
+
 // GetDingTalkHandler 消息管理
 func (c *ClientImpl) GetDingTalkHandler(msg *message.SubsMessage) *bridge.DingTalkHandler {
 	c.Context.SubsMessage = msg

+ 17 - 4
opms_libary/plugin/dingtalk/client_test.go

@@ -3,6 +3,7 @@ package dingtalk
 import (
 	"dashoo.cn/opms_libary/plugin/dingtalk/workflow"
 	"dashoo.cn/opms_libary/utils"
+	"encoding/json"
 	"fmt"
 	"testing"
 )
@@ -17,11 +18,23 @@ func TestQuerySchemaByProcessCode(t *testing.T) {
 }
 
 func TestSign(t *testing.T) {
-	client := NewClient()
-	s := client.GetJsapi()
-	//s.Sign("", "")
+	//client := NewClient()
+	//s := client.GetStorage()
+	//resp, _ := s.QueryFileUploadInfo("21042518430", "fHJtftdpHZXwvsdOfg8skgiEiE")
+	//code, _ := s.UploadFile(resp.HeaderSignatureInfo.ResourceUrls[0], resp.HeaderSignatureInfo.Headers, "/Users/chengjian/Downloads/引物导入模板.xlsx")
+	//if code == 200 {
+	//	s.CommitFile(resp.UploadKey, "引物导入模板-1.xlsx", "21042518430", "0", "fHJtftdpHZXwvsdOfg8skgiEiE")
+	//}
+	//
+	//fmt.Println(resp)
+}
 
-	fmt.Println(s)
+func TestCommitFile(t *testing.T) {
+	client := NewClient()
+	s := client.GetStorage()
+	resp, err := s.UploadFile("21042518430", "8xljy04PZiS9iPxp5PhDnUzQiEiE", "引物导入模板-000000.xlsx", "/Users/chengjian/Downloads/引物导入模板.xlsx")
+	fmt.Println(json.Marshal(resp))
+	fmt.Println(err.Error())
 }
 
 func TestStartProcessInstance(t *testing.T) {

+ 185 - 30
opms_libary/plugin/dingtalk/storage/entity.go

@@ -1,48 +1,203 @@
 package storage
 
-import "time"
+type AddSpaceRequest struct {
+	// 可选参数
+	Option *AddSpaceRequestOption `json:"option,omitempty"`
+	// 用户id
+	UnionId *string `json:"unionId,omitempty"`
+}
+
+type AddSpaceRequestOption struct {
+	// 空间能力项, 默认表示不设置拓展能力项
+	Capabilities *AddSpaceRequestOptionCapabilities `json:"capabilities,omitempty"`
+	// 空间名称,默认无空间名称
+	Name *string `json:"name,omitempty"`
+	// owner类型, 空间Owner可以是用户或应用
+	// 如果是应用类型,需要单独授权
+	// 枚举值:
+	// 	USER: 用户类型
+	// 	APP: App类型
+	// 默认值:
+	// 	USER
+	OwnerType *string `json:"ownerType,omitempty"`
+	// 空间能使用最大容量, 默认表示无最大容量
+	Quota *int64 `json:"quota,omitempty"`
+	// 空间场景,详见 Space.scene 字段. 不指定默认值是default
+	// 只能由数字和字母组成
+	// 默认值:
+	// 	default
+	Scene *string `json:"scene,omitempty"`
+	// 空间场景Id,详见 Space.sceneId 字段. 不指定默认值是0
+	// 只能由数字和字母组成
+	// 默认值:
+	// 	0
+	SceneId *string `json:"sceneId,omitempty"`
+}
+
+type AddSpaceRequestOptionCapabilities struct {
+	// 是否进最近使用, 默认不支持
+	// 默认值:
+	// 	false
+	CanRecordRecentFile *bool `json:"canRecordRecentFile,omitempty"`
+	// 是否支持重命名空间名称, 默认不支持
+	// 默认值:
+	// 	false
+	CanRename *bool `json:"canRename,omitempty"`
+	// 是否支持搜索, 默认不支持
+	// 默认值:
+	// 	false
+	CanSearch *bool `json:"canSearch,omitempty"`
+}
+
+type AddPermissionRequestOption struct {
+	// 有效时间(秒)
+	// 最大值:
+	// 	3600
+	Duration *int64 `json:"duration,omitempty" xml:"duration,omitempty"`
+}
+
+type AddPermissionRequestMembers struct {
+	// 权限归属的企业
+	// 如果存在企业id, 对应member离职的时候会自动清理权限
+	// 如果memberType是dept类型,必须要有企业id
+	CorpId *string `json:"corpId,omitempty" xml:"corpId,omitempty"`
+	// 权限成员id
+	Id *string `json:"id,omitempty" xml:"id,omitempty"`
+	// 权限成员类型
+	// 枚举值:
+	// 	ORG: 企业
+	// 	DEPT: 部门
+	// 	TAG: 自定义tag
+	// 	CONVERSATION: 会话
+	// 	GG: 通用组
+	// 	USER: 用户
+	// 	ALL_USERS: 所有用户
+	Type *string `json:"type,omitempty" xml:"type,omitempty"`
+}
+
+type AddPermissionRequest struct {
+	// 权限成员列表
+	// 最大size:
+	// 	30
+	Members []*AddPermissionRequestMembers `json:"members,omitempty" xml:"members,omitempty" type:"Repeated"`
+	// 可选参数
+	Option *AddPermissionRequestOption `json:"option,omitempty" xml:"option,omitempty" type:"Struct"`
+	// 权限角色id
+	RoleId *string `json:"roleId,omitempty" xml:"roleId,omitempty"`
+	// 用户id
+	UnionId *string `json:"unionId,omitempty" xml:"unionId,omitempty"`
+}
+
+type AddPermissionResponse struct {
+	Success bool `json:"success"`
+}
+
+type GetFileUploadInfoRequestOptionPreCheckParam struct {
+	Md5      *string `json:"md5,omitempty" xml:"md5,omitempty"`
+	Name     *string `json:"name,omitempty" xml:"name,omitempty"`
+	ParentId *string `json:"parentId,omitempty" xml:"parentId,omitempty"`
+	Size     *int64  `json:"size,omitempty" xml:"size,omitempty"`
+}
+
+type GetFileUploadInfoRequestOption struct {
+	PreCheckParam  *GetFileUploadInfoRequestOptionPreCheckParam `json:"preCheckParam,omitempty" xml:"preCheckParam,omitempty" type:"Struct"`
+	PreferIntranet *bool                                        `json:"preferIntranet,omitempty" xml:"preferIntranet,omitempty"`
+	PreferRegion   *string                                      `json:"preferRegion,omitempty" xml:"preferRegion,omitempty"`
+	StorageDriver  *string                                      `json:"storageDriver,omitempty" xml:"storageDriver,omitempty"`
+}
+
+type GetFileUploadInfoRequest struct {
+	Multipart *bool                           `json:"multipart,omitempty" `
+	Option    *GetFileUploadInfoRequestOption `json:"option,omitempty"`
+	Protocol  *string                         `json:"protocol,omitempty" `
+	UnionId   *string                         `json:"unionId,omitempty"`
+}
 
 type QueryFileUploadInfoResponse struct {
 	UploadKey           string `json:"uploadKey"`
 	StorageDriver       string `json:"storageDriver"`
 	Protocol            string `json:"protocol"`
 	HeaderSignatureInfo struct {
-		ResourceUrls []string `json:"resourceUrls"`
-		Headers      struct {
-			Key string `json:"key"`
-		} `json:"headers"`
-		ExpirationSeconds    int      `json:"expirationSeconds"`
-		Region               string   `json:"region"`
-		InternalResourceUrls []string `json:"internalResourceUrls"`
+		ResourceUrls         []string          `json:"resourceUrls"`
+		Headers              map[string]string `json:"headers"`
+		ExpirationSeconds    int               `json:"expirationSeconds"`
+		Region               string            `json:"region"`
+		InternalResourceUrls []string          `json:"internalResourceUrls"`
 	} `json:"headerSignatureInfo"`
 }
 
+type CommitFileRequestOptionAppProperties struct {
+	// 属性名称 该属性名称在当前app下需要保证唯一,不同app间同名属性互不影响
+	Name *string `json:"name,omitempty" xml:"name,omitempty"`
+	// 属性值
+	Value *string `json:"value,omitempty" xml:"value,omitempty"`
+	// 属性可见范围
+	// 枚举值:
+	// 	PUBLIC: 该属性所有App可见
+	// 	PRIVATE: 该属性仅其归属App可见
+	Visibility *string `json:"visibility,omitempty" xml:"visibility,omitempty"`
+}
+
+type CommitFileRequestOption struct {
+	// 文件在应用上的属性, 一个应用最多只能设置3个属性
+	AppProperties []*CommitFileRequestOptionAppProperties `json:"appProperties,omitempty" xml:"appProperties,omitempty" type:"Repeated"`
+	// 文件名称冲突策略
+	// 枚举值:
+	// 	AUTO_RENAME: 自动重命名
+	// 	OVERWRITE: 覆盖
+	// 	RETURN_DENTRY_IF_EXISTS: 返回已存在文件
+	// 	RETURN_ERROR_IF_EXISTS: 文件已存在时报错
+	// 默认值:
+	// 	AUTO_RENAME
+	ConflictStrategy *string `json:"conflictStrategy,omitempty" xml:"conflictStrategy,omitempty"`
+	// 默认文件大小, 单位:Byte
+	// 如果此字段不为空,企业存储系统会校验文件实际大小是否和此字段是否一致,不一致会报错
+	Size *int64 `json:"size,omitempty" xml:"size,omitempty"`
+}
+
+type CommitFileRequest struct {
+	// 名称(文件名+后缀), 规则:
+	// 1. 头尾不能包含空格,否则会自动去除
+	// 2. 不能包含特殊字符,包括:制表符、*、"、<、>、|
+	// 3. 不能以"."结尾
+	Name *string `json:"name,omitempty" xml:"name,omitempty"`
+	// 可选参数
+	Option *CommitFileRequestOption `json:"option,omitempty" xml:"option,omitempty" type:"Struct"`
+	// 父目录id, 根目录id值为0
+	ParentId *string `json:"parentId,omitempty" xml:"parentId,omitempty"`
+	// 添加文件唯一标识,可通过DentryService.getUploadInfo来生成
+	UploadKey *string `json:"uploadKey,omitempty" xml:"uploadKey,omitempty"`
+	// 用户id
+	UnionId *string `json:"unionId,omitempty" xml:"unionId,omitempty"`
+}
+
 type CommitFileResponse struct {
 	Dentry struct {
-		Id           string    `json:"id"`
-		SpaceId      string    `json:"spaceId"`
-		ParentId     string    `json:"parentId"`
-		Type         string    `json:"type"`
-		Name         string    `json:"name"`
-		Size         int       `json:"size"`
-		Path         string    `json:"path"`
-		Version      int       `json:"version"`
-		Status       string    `json:"status"`
-		Extension    string    `json:"extension"`
-		CreatorId    string    `json:"creatorId"`
-		ModifierId   string    `json:"modifierId"`
-		CreateTime   time.Time `json:"createTime"`
-		ModifiedTime time.Time `json:"modifiedTime"`
-		Properties   struct {
-			ReadOnly bool `json:"readOnly"`
-		} `json:"properties"`
-		AppProperties []struct {
-			Name       string `json:"name"`
-			Value      string `json:"value"`
-			Visibility string `json:"visibility"`
-		} `json:"appProperties"`
+		ModifiedTime  string `json:"modifiedTime"`
+		Extension     string `json:"extension"`
+		CreatorId     string `json:"creatorId"`
+		ModifierId    string `json:"modifierId"`
+		Type          string `json:"type"`
 		Uuid          string `json:"uuid"`
 		PartitionType string `json:"partitionType"`
+		ParentId      string `json:"parentId"`
+		SpaceId       string `json:"spaceId"`
+		Path          string `json:"path"`
+		Size          int    `json:"size"`
+		CreateTime    string `json:"createTime"`
 		StorageDriver string `json:"storageDriver"`
+		Name          string `json:"name"`
+		Id            string `json:"id"`
+		Properties    struct {
+			ReadOnly bool `json:"readOnly"`
+		} `json:"properties"`
+		Status        string `json:"status"`
+		AppProperties struct {
+			EedFQcfwBC4HZvNzsES5IiOpPrfoiS3ZFw []struct {
+				Visibility string `json:"visibility"`
+				Name       string `json:"name"`
+				Value      string `json:"value"`
+			} `json:"EedFQcfwBC4hZvNzsES5iiOpPrfoiS3ZFw"`
+		} `json:"appProperties"`
 	} `json:"dentry"`
 }

+ 140 - 8
opms_libary/plugin/dingtalk/storage/storage.go

@@ -1,14 +1,23 @@
 package storage
 
 import (
-	"dashoo.cn/opms_libary/multipart"
+	"dashoo.cn/opms_libary/myerrors"
 	"dashoo.cn/opms_libary/plugin/dingtalk/base"
 	"dashoo.cn/opms_libary/plugin/dingtalk/context"
+	"dashoo.cn/opms_libary/utils"
+	"encoding/json"
+	"fmt"
+	"io"
+	"io/ioutil"
+	"net/http"
+	"os"
+	"path/filepath"
 )
 
 const (
-	FormSchemasUrl     = "/v1.0/workflow/forms/schemas/processCodes"
-	ProcessInstanceUrl = "/v1.0/workflow/processInstances"
+	AddPermissionUrl        = "/v1.0/storage/spaces/%s/dentries/0/permissions"  //添加权限
+	QueryFileUploadInfoUrl  = "/v1.0/storage/spaces/%s/files/uploadInfos/query" //获取文件上传信息
+	CommitFileUploadInfoUrl = "/v1.0/storage/spaces/%s/files/commit"            //提交文件
 )
 
 //Storage OA审批
@@ -23,20 +32,143 @@ func NewStorage(context *context.Context) *Storage {
 	return material
 }
 
+//CreateSpaces 创建空间
+func (w *Storage) CreateSpaces(spaceId, unionId string) (response QueryFileUploadInfoResponse, err error) {
+	optionCapabilities := &AddSpaceRequestOptionCapabilities{
+		CanSearch:           utils.Bool(true),
+		CanRename:           utils.Bool(true),
+		CanRecordRecentFile: utils.Bool(true),
+	}
+	option := &AddSpaceRequestOption{
+		Name:         utils.String("OMS合同"),
+		Capabilities: optionCapabilities,
+		OwnerType:    utils.String("APP"),
+	}
+	request := &AddSpaceRequest{
+		UnionId: utils.String("8xljy04PZiS9iPxp5PhDnUzQiEiE"),
+		Option:  option,
+	}
+
+	resp, _ := w.HTTPPostJSONWithAccessToken("/v1.0/storage/spaces", request)
+	fmt.Println(resp)
+	return response, err
+}
+
+//AddPermission 添加权限
+func (w *Storage) AddPermission(corpId, spaceId, unionId, roleId, memType string) (response AddPermissionResponse, err error) {
+	option := &AddPermissionRequestOption{
+		Duration: utils.Int64(3600),
+	}
+	members := &AddPermissionRequestMembers{
+		Type:   utils.String(memType),
+		Id:     utils.String(unionId),
+		CorpId: utils.String(corpId),
+	}
+	request := &AddPermissionRequest{
+		UnionId: utils.String(unionId),
+		RoleId:  utils.String(roleId),
+		Members: []*AddPermissionRequestMembers{members},
+		Option:  option,
+	}
+	resp, err := w.HTTPPostJSONWithAccessToken(fmt.Sprintf(AddPermissionUrl, spaceId), request)
+	err = json.Unmarshal(resp, &response)
+	return response, err
+}
+
 //QueryFileUploadInfo 获取文件上传信息
 func (w *Storage) QueryFileUploadInfo(spaceId, unionId string) (response QueryFileUploadInfoResponse, err error) {
-
+	option := &GetFileUploadInfoRequestOption{
+		StorageDriver:  utils.String("DINGTALK"),
+		PreferRegion:   utils.String("SHANGHAI"),
+		PreferIntranet: utils.Bool(true),
+	}
+	request := &GetFileUploadInfoRequest{
+		UnionId:   utils.String(unionId),
+		Protocol:  utils.String("HEADER_SIGNATURE"),
+		Multipart: utils.Bool(false),
+		Option:    option,
+	}
+	resp, err := w.HTTPPostJSONWithAccessToken(fmt.Sprintf(QueryFileUploadInfoUrl, spaceId), request)
+	err = json.Unmarshal(resp, &response)
 	return response, err
 }
 
 //UploadFile 使用OSS的header加签方式上传文件息
-func (w *Storage) UploadFile(url string, headers map[string]string, file *multipart.MultipartFile) (code int64, err error) {
+func (w *Storage) uploadFile(url string, headers map[string]string, filePath string) (code int, err error) {
+	count := 100
+
+	file, err := os.Open(filepath.Clean(filePath))
+	if err != nil {
+		return 0, myerrors.SysError()
+	}
+	defer file.Close()
 
-	return 0, err
+	line, err := ioutil.ReadAll(file)
+
+	pr, rw := io.Pipe()
+	go func() {
+		for i := 0; i < count; i++ {
+			rw.Write(line)
+		}
+		rw.Close()
+	}()
+	// 构造request对象
+	request, err := http.NewRequest("PUT", url, pr)
+	for key, value := range headers {
+		request.Header.Add(key, value)
+	}
+
+	// 提前计算出ContentLength
+	request.ContentLength = int64(len(line) * count)
+	resp, _ := http.DefaultClient.Do(request)
+	return resp.StatusCode, err
 }
 
 //CommitFile 提交文件
-func (w *Storage) CommitFile(uploadKey, filename, parentId string) (response CommitFileResponse, err error) {
-
+func (w *Storage) CommitFile(uploadKey, filename, spaceId, parentId, unionId string) (response CommitFileResponse, err error) {
+	optionAppProperties0 := &CommitFileRequestOptionAppProperties{
+		Name:       utils.String("System"),
+		Value:      utils.String("oms"),
+		Visibility: utils.String("PUBLIC"),
+	}
+	option := &CommitFileRequestOption{
+		//Size:             utils.Int64(size),
+		ConflictStrategy: utils.String("AUTO_RENAME"),
+		AppProperties:    []*CommitFileRequestOptionAppProperties{optionAppProperties0},
+	}
+	request := &CommitFileRequest{
+		UnionId:   utils.String(unionId),
+		UploadKey: utils.String(uploadKey),
+		Name:      utils.String(filename),
+		ParentId:  utils.String(parentId),
+		Option:    option,
+	}
+	resp, err := w.HTTPPostJSONWithAccessToken(fmt.Sprintf(CommitFileUploadInfoUrl, spaceId), request)
+	err = json.Unmarshal(resp, &response)
 	return response, err
 }
+
+func (w *Storage) UploadFile(spaceId, unionId, fileName, filePath string) (response CommitFileResponse, err error) {
+	permResp, err := w.AddPermission(w.CorpId, spaceId, unionId, "EDITOR", "USER")
+	if err != nil {
+		return response, myerrors.New(500, err, err.Error())
+	}
+
+	if !permResp.Success {
+		return response, myerrors.New(500, nil, "获取钉钉上传文件权限失败!")
+	}
+
+	infoResp, err := w.QueryFileUploadInfo(spaceId, unionId)
+	if err != nil {
+		return response, myerrors.New(500, err, err.Error())
+	}
+
+	uploadResp, err := w.uploadFile(infoResp.HeaderSignatureInfo.ResourceUrls[0], infoResp.HeaderSignatureInfo.Headers, filePath)
+	if err != nil {
+		return response, myerrors.New(500, err, err.Error())
+	}
+	if uploadResp != 200 {
+		return response, myerrors.New(500, nil, "文件上传失败!")
+	}
+	return w.CommitFile(infoResp.UploadKey, fileName, spaceId, "0", unionId)
+}

+ 1 - 1
opms_parent/app/dao/plat/internal/plat_task.go

@@ -36,7 +36,7 @@ type platTaskColumns struct {
 	IsOverdue        string // 是否超期(10否20是)
 	TaskStartDate    string // 发布时间
 	TaskEndDate      string // 要求完成时间
-	TaskDesc         string // 督办内容
+	TaskDesc         string // 任务说明
 	MainUserId       string // 负责人ID
 	OwnerUserId      string // 协办人ID
 	TaskLabel        string // 任务标签,号拼接

+ 1 - 1
opms_parent/app/dao/plat/internal/plat_task_handle.go

@@ -33,7 +33,7 @@ type platTaskHandleColumns struct {
 	TaskStatus   string // 任务状态(10打开20关闭)
 	Step         string // 步骤号(10接收  15暂存  20提交  30审批(督办人)  40评价(监办人))
 	MainUserId   string // 处理人ID
-	OwnerUserId  string // 团队成员ID
+	OwnerUserId  string // 协办人ID
 	HandleUserId string // 处理人ID
 	HandleDate   string // 处理时间
 	HandleStatus string // 处理结果(10接收20提交30审批通过40审批退回)

+ 428 - 0
opms_parent/app/dao/plat/internal/plat_user_config.go

@@ -0,0 +1,428 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	model "dashoo.cn/micro/app/model/plat"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+)
+
+// PlatUserConfigDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type PlatUserConfigDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns platUserConfigColumns
+}
+
+// PlatUserConfigColumns defines and stores column names for table plat_user_config.
+type platUserConfigColumns struct {
+	Id          string // 主键
+	UserId      string // 用户ID
+	ModuleCode  string // 模块代码
+	ConfigInfo  string // 配置信息
+	Remark      string // 备注
+	CreatedBy   string // 创建者
+	CreatedName string // 创建人
+	CreatedTime string // 创建时间
+	UpdatedBy   string // 更新者
+	UpdatedName string // 更新人
+	UpdatedTime string // 更新时间
+	DeletedTime string // 删除时间
+}
+
+var (
+	// PlatUserConfig is globally public accessible object for table plat_user_config operations.
+	PlatUserConfig = PlatUserConfigDao{
+		M:     g.DB("default").Model("plat_user_config").Safe(),
+		DB:    g.DB("default"),
+		Table: "plat_user_config",
+		Columns: platUserConfigColumns{
+			Id:          "id",
+			UserId:      "user_id",
+			ModuleCode:  "module_code",
+			ConfigInfo:  "config_info",
+			Remark:      "remark",
+			CreatedBy:   "created_by",
+			CreatedName: "created_name",
+			CreatedTime: "created_time",
+			UpdatedBy:   "updated_by",
+			UpdatedName: "updated_name",
+			UpdatedTime: "updated_time",
+			DeletedTime: "deleted_time",
+		},
+	}
+)
+
+func NewPlatUserConfigDao(tenant string) PlatUserConfigDao {
+	var dao PlatUserConfigDao
+	dao = PlatUserConfigDao{
+		M:     g.DB(tenant).Model("plat_user_config").Safe(),
+		DB:    g.DB(tenant),
+		Table: "plat_user_config",
+		Columns: platUserConfigColumns{
+			Id:          "id",
+			UserId:      "user_id",
+			ModuleCode:  "module_code",
+			ConfigInfo:  "config_info",
+			Remark:      "remark",
+			CreatedBy:   "created_by",
+			CreatedName: "created_name",
+			CreatedTime: "created_time",
+			UpdatedBy:   "updated_by",
+			UpdatedName: "updated_name",
+			UpdatedTime: "updated_time",
+			DeletedTime: "deleted_time",
+		},
+	}
+	return dao
+}
+
+// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
+// of current DB object and with given context in it.
+// Note that this returned DB object can be used only once, so do not assign it to
+// a global or package variable for long using.
+func (d *PlatUserConfigDao) Ctx(ctx context.Context) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *PlatUserConfigDao) As(as string) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *PlatUserConfigDao) TX(tx *gdb.TX) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *PlatUserConfigDao) Master() *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Master()}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *PlatUserConfigDao) Slave() *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *PlatUserConfigDao) Args(args ...interface{}) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Args(args...)}
+}
+
+// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *PlatUserConfigDao) LeftJoin(table ...string) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.LeftJoin(table...)}
+}
+
+// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *PlatUserConfigDao) RightJoin(table ...string) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.RightJoin(table...)}
+}
+
+// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *PlatUserConfigDao) InnerJoin(table ...string) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.InnerJoin(table...)}
+}
+
+// Fields sets the operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *PlatUserConfigDao) Fields(fieldNamesOrMapStruct ...interface{}) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
+}
+
+// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *PlatUserConfigDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *PlatUserConfigDao) Option(option int) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Option(option)}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *PlatUserConfigDao) OmitEmpty() *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *PlatUserConfigDao) Filter() *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Filter()}
+}
+
+// Where sets the condition statement for the model. The parameter <where> can be type of
+// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
+// multiple conditions will be joined into where statement using "AND".
+// Eg:
+// Where("uid=10000")
+// Where("uid", 10000)
+// Where("money>? AND name like ?", 99999, "vip_%")
+// Where("uid", 1).Where("name", "john")
+// Where("status IN (?)", g.Slice{1,2,3})
+// Where("age IN(?,?)", 18, 50)
+// Where(User{ Id : 1, UserName : "john"})
+func (d *PlatUserConfigDao) Where(where interface{}, args ...interface{}) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Where(where, args...)}
+}
+
+// WherePri does the same logic as M.Where except that if the parameter <where>
+// is a single condition like int/string/float/slice, it treats the condition as the primary
+// key value. That is, if primary key is "id" and given <where> parameter as "123", the
+// WherePri function treats the condition as "id=123", but M.Where treats the condition
+// as string "123".
+func (d *PlatUserConfigDao) WherePri(where interface{}, args ...interface{}) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *PlatUserConfigDao) And(where interface{}, args ...interface{}) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *PlatUserConfigDao) Or(where interface{}, args ...interface{}) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *PlatUserConfigDao) Group(groupBy string) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *PlatUserConfigDao) Order(orderBy ...string) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Order(orderBy...)}
+}
+
+// Limit sets the "LIMIT" statement for the model.
+// The parameter <limit> can be either one or two number, if passed two number is passed,
+// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
+// statement.
+func (d *PlatUserConfigDao) Limit(limit ...int) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Limit(limit...)}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *PlatUserConfigDao) Offset(offset int) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Offset(offset)}
+}
+
+// Page sets the paging number for the model.
+// The parameter <page> is started from 1 for paging.
+// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
+func (d *PlatUserConfigDao) Page(page, limit int) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *PlatUserConfigDao) Batch(batch int) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Batch(batch)}
+}
+
+// Cache sets the cache feature for the model. It caches the result of the sql, which means
+// if there's another same sql request, it just reads and returns the result from cache, it
+// but not committed and executed into the database.
+//
+// If the parameter <duration> < 0, which means it clear the cache with given <name>.
+// If the parameter <duration> = 0, which means it never expires.
+// If the parameter <duration> > 0, which means it expires after <duration>.
+//
+// The optional parameter <name> is used to bind a name to the cache, which means you can later
+// control the cache like changing the <duration> or clearing the cache with specified <name>.
+//
+// Note that, the cache feature is disabled if the model is operating on a transaction.
+func (d *PlatUserConfigDao) Cache(duration time.Duration, name ...string) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Cache(duration, name...)}
+}
+
+// Data sets the operation data for the model.
+// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
+// Eg:
+// Data("uid=10000")
+// Data("uid", 10000)
+// Data(g.Map{"uid": 10000, "name":"john"})
+// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
+func (d *PlatUserConfigDao) Data(data ...interface{}) *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Data(data...)}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.PlatUserConfig.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *PlatUserConfigDao) All(where ...interface{}) ([]*model.PlatUserConfig, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.PlatUserConfig
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// One retrieves one record from table and returns the result as *model.PlatUserConfig.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *PlatUserConfigDao) One(where ...interface{}) (*model.PlatUserConfig, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.PlatUserConfig
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindOne retrieves and returns a single Record by M.WherePri and M.One.
+// Also see M.WherePri and M.One.
+func (d *PlatUserConfigDao) FindOne(where ...interface{}) (*model.PlatUserConfig, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.PlatUserConfig
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindAll retrieves and returns Result by by M.WherePri and M.All.
+// Also see M.WherePri and M.All.
+func (d *PlatUserConfigDao) FindAll(where ...interface{}) ([]*model.PlatUserConfig, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.PlatUserConfig
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// Struct retrieves one record from table and converts it into given struct.
+// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
+// it can create the struct internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not nil.
+//
+// Eg:
+// user := new(User)
+// err  := dao.User.Where("id", 1).Struct(user)
+//
+// user := (*User)(nil)
+// err  := dao.User.Where("id", 1).Struct(&user)
+func (d *PlatUserConfigDao) Struct(pointer interface{}, where ...interface{}) error {
+	return d.M.Struct(pointer, where...)
+}
+
+// Structs retrieves records from table and converts them into given struct slice.
+// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
+// slice internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not empty.
+//
+// Eg:
+// users := ([]User)(nil)
+// err   := dao.User.Structs(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Structs(&users)
+func (d *PlatUserConfigDao) Structs(pointer interface{}, where ...interface{}) error {
+	return d.M.Structs(pointer, where...)
+}
+
+// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
+// It calls function Struct if <pointer> is type of *struct/**struct.
+// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
+//
+// Eg:
+// user  := new(User)
+// err   := dao.User.Where("id", 1).Scan(user)
+//
+// user  := (*User)(nil)
+// err   := dao.User.Where("id", 1).Scan(&user)
+//
+// users := ([]User)(nil)
+// err   := dao.User.Scan(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Scan(&users)
+func (d *PlatUserConfigDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *PlatUserConfigDao) Chunk(limit int, callback func(entities []*model.PlatUserConfig, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.PlatUserConfig
+		err = result.Structs(&entities)
+		if err == sql.ErrNoRows {
+			return false
+		}
+		return callback(entities, err)
+	})
+}
+
+// LockUpdate sets the lock for update for current operation.
+func (d *PlatUserConfigDao) LockUpdate() *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *PlatUserConfigDao) LockShared() *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *PlatUserConfigDao) Unscoped() *PlatUserConfigDao {
+	return &PlatUserConfigDao{M: d.M.Unscoped()}
+}

+ 36 - 0
opms_parent/app/dao/plat/plat_user_config.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package plat
+
+import (
+	"dashoo.cn/micro/app/dao/plat/internal"
+)
+
+// platUserConfigDao is the manager for logic model data accessing
+// and custom defined data operations functions management. You can define
+// methods on it to extend its functionality as you wish.
+type platUserConfigDao struct {
+	internal.PlatUserConfigDao
+}
+
+var (
+	// PlatUserConfig is globally public accessible object for table plat_user_config operations.
+	PlatUserConfig = platUserConfigDao{
+		internal.PlatUserConfig,
+	}
+)
+
+type PlatUserConfigDao struct {
+	internal.PlatUserConfigDao
+}
+
+func NewPlatUserConfigDao(tenant string) *PlatUserConfigDao {
+	dao := internal.NewPlatUserConfigDao(tenant)
+	return &PlatUserConfigDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 74 - 0
opms_parent/app/handler/home/home.go

@@ -0,0 +1,74 @@
+package home
+
+import (
+	"context"
+	"dashoo.cn/common_definition/comm_def"
+	model "dashoo.cn/micro/app/model/home"
+	service "dashoo.cn/micro/app/service/home"
+)
+
+type HomeHandler struct{}
+
+// SetUpHomeConfig 设置个人首页配置
+// Swagger:Home 首页 设置个人首页配置
+func (h *HomeHandler) SetUpHomeConfig(ctx context.Context, req *model.SetUpHomeConfig, rsp *comm_def.CommonMsg) error {
+	svc, err := service.NewHomeService(ctx)
+	if err != nil {
+		return err
+	}
+	err = svc.SetUpHomeReportConfig(req)
+	if err != nil {
+		return err
+	}
+	rsp.Code = 200
+	rsp.Msg = "保存成功"
+	return nil
+}
+
+// GetHomeConfig 获取首页报表配置
+// Swagger:Home 首页 获取首页报表配置
+func (h *HomeHandler) GetHomeConfig(ctx context.Context, req *model.SearchHomeConfig, rsp *comm_def.CommonMsg) error {
+	svc, err := service.NewHomeService(ctx)
+	if err != nil {
+		return err
+	}
+	config, err := svc.QueryHomeReportConfig(req.ModuleCode)
+	rsp.Code = 200
+	rsp.Msg = "查询成功"
+	rsp.Data = config
+	return nil
+}
+
+// GetHomeNumReportData 获取首页个人看板数据
+// Swagger:Home 首页 获取首页个人看板数据
+func (h *HomeHandler) GetHomeNumReportData(ctx context.Context, req *model.SearchNumReportData, rsp *comm_def.CommonMsg) error {
+	svc, err := service.NewHomeService(ctx)
+	if err != nil {
+		return err
+	}
+	resp, err := svc.QueryHomeNumReportData(req)
+	if err != nil {
+		return err
+	}
+	rsp.Code = 200
+	rsp.Msg = "查询成功"
+	rsp.Data = resp
+	return nil
+}
+
+// GetHomeDataReportData 获取首页数据报表数据
+// Swagger:Home 首页 获取首页数据报表数据
+func (h *HomeHandler) GetHomeDataReportData(ctx context.Context, req *model.SearchDataReportData, rsp *comm_def.CommonMsg) error {
+	svc, err := service.NewHomeService(ctx)
+	if err != nil {
+		return err
+	}
+	resp, err := svc.QueryHomeDataReportData(req)
+	if err != nil {
+		return err
+	}
+	rsp.Code = 200
+	rsp.Msg = "查询成功"
+	rsp.Data = resp
+	return nil
+}

+ 55 - 0
opms_parent/app/model/home/home.go

@@ -0,0 +1,55 @@
+package home
+
+type SetUpHomeConfig struct {
+	ModuleCode       string              `json:"module_code"`
+	NumReportConfig  []*NumReportConfig  `json:"num_report_config"`
+	DataReportConfig []*DataReportConfig `json:"data_report_config"`
+}
+
+type SearchHomeConfig struct {
+	ModuleCode string `json:"module_code"`
+}
+
+type SearchNumReportData struct {
+	ReportId []int64 `json:"ids"`
+}
+
+type SearchDataReportData struct {
+	ReportId int64 `json:"id"`
+	Params   map[string]interface{}
+}
+
+type NumReportConfig struct {
+	Id         int64  `json:"id"`
+	ReportIcon string `json:"report_icon"`
+	ReportCode string `json:"report_code"`
+	ReportName string `json:"report_name"`
+	ReportDesc string `json:"report_desc"`
+	Sort       int64  `json:"sort"`
+}
+
+type DataReportConfig struct {
+	Id         int64  `json:"id"`
+	ReportCode string `json:"report_code"`
+	ReportName string `json:"report_name"`
+	ReportDesc string `json:"report_desc"`
+	ReportType string `json:"report_type"`
+	LocationX  int64  `json:"location_x"`
+	LocationY  int64  `json:"location_y"`
+	SizeH      int64  `json:"size_h"`
+	SizeW      int64  `json:"size_w"`
+}
+
+type NumReportResponses struct {
+	NumReportResponse []*NumReportResponse `json:"num_report_response"`
+}
+
+type NumReportResponse struct {
+	NumReportConfig
+	Data interface{} `json:"data"`
+}
+
+type DataReportResponse struct {
+	DataReportConfig
+	Data interface{} `json:"data"`
+}

+ 1 - 1
opms_parent/app/model/plat/internal/plat_task.go

@@ -18,7 +18,7 @@ type PlatTask struct {
 	IsOverdue        string      `orm:"is_overdue"         json:"isOverdue"`        // 是否超期(10否20是)
 	TaskStartDate    *gtime.Time `orm:"task_start_date"    json:"taskStartDate"`    // 发布时间
 	TaskEndDate      *gtime.Time `orm:"task_end_date"      json:"taskEndDate"`      // 要求完成时间
-	TaskDesc         string      `orm:"task_desc"          json:"taskDesc"`         // 督办内容
+	TaskDesc         string      `orm:"task_desc"          json:"taskDesc"`         // 任务说明
 	MainUserId       int         `orm:"main_user_id"       json:"mainUserId"`       // 负责人ID
 	OwnerUserId      string      `orm:"owner_user_id"      json:"ownerUserId"`      // 协办人ID
 	TaskLabel        string      `orm:"task_label"         json:"taskLabel"`        // 任务标签,号拼接

+ 1 - 1
opms_parent/app/model/plat/internal/plat_task_handle.go

@@ -15,7 +15,7 @@ type PlatTaskHandle struct {
 	TaskStatus   string      `orm:"task_status"    json:"taskStatus"`   // 任务状态(10打开20关闭)
 	Step         int         `orm:"step"           json:"step"`         // 步骤号(10接收  15暂存  20提交  30审批(督办人)  40评价(监办人))
 	MainUserId   int         `orm:"main_user_id"   json:"mainUserId"`   // 处理人ID
-	OwnerUserId  string      `orm:"owner_user_id"  json:"ownerUserId"`  // 团队成员ID
+	OwnerUserId  string      `orm:"owner_user_id"  json:"ownerUserId"`  // 协办人ID
 	HandleUserId int         `orm:"handle_user_id" json:"handleUserId"` // 处理人ID
 	HandleDate   *gtime.Time `orm:"handle_date"    json:"handleDate"`   // 处理时间
 	HandleStatus string      `orm:"handle_status"  json:"handleStatus"` // 处理结果(10接收20提交30审批通过40审批退回)

+ 25 - 0
opms_parent/app/model/plat/internal/plat_user_config.go

@@ -0,0 +1,25 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// PlatUserConfig is the golang structure for table plat_user_config.
+type PlatUserConfig struct {
+	Id          int         `orm:"id,primary"   json:"id"`          // 主键
+	UserId      int         `orm:"user_id"      json:"userId"`      // 用户ID
+	ModuleCode  string      `orm:"module_code"  json:"moduleCode"`  // 模块代码
+	ConfigInfo  string      `orm:"config_info"  json:"configInfo"`  // 配置信息
+	Remark      string      `orm:"remark"       json:"remark"`      // 备注
+	CreatedBy   int         `orm:"created_by"   json:"createdBy"`   // 创建者
+	CreatedName string      `orm:"created_name" json:"createdName"` // 创建人
+	CreatedTime *gtime.Time `orm:"created_time" json:"createdTime"` // 创建时间
+	UpdatedBy   int         `orm:"updated_by"   json:"updatedBy"`   // 更新者
+	UpdatedName string      `orm:"updated_name" json:"updatedName"` // 更新人
+	UpdatedTime *gtime.Time `orm:"updated_time" json:"updatedTime"` // 更新时间
+	DeletedTime *gtime.Time `orm:"deleted_time" json:"deletedTime"` // 删除时间
+}

+ 4 - 3
opms_parent/app/model/plat/plat_task.go

@@ -40,14 +40,15 @@ type AddPlatTaskReq struct {
 	TaskTitle        string      `orm:"task_title"         json:"taskTitle"    v:"required#任务标题不能为空"`                     // 任务标题
 	TaskType         string      `orm:"task_type"          json:"taskType"    v:"required#任务类型不能为空"`                      // 任务类型
 	TaskStatus       string      `orm:"task_status"        json:"taskStatus"    v:"required#任务状态不能为空"`                    // 任务状态(10进行中20关闭)
+	Source           string      `orm:"source"             json:"source"`                                                 // 督办事项来源
 	IsOverdue        string      `orm:"is_overdue"         json:"isOverdue"`                                              // 是否超期(10否20是)
-	TaskStartDate    *gtime.Time `orm:"task_start_date"    json:"taskStartDate"    v:"required#任务开始时间不能为空"`               // 任务开始时间
-	TaskEndDate      *gtime.Time `orm:"task_end_date"      json:"taskEndDate"    v:"required#任务结束时间不能为空"`                 // 任务结束时间
+	TaskStartDate    *gtime.Time `orm:"task_start_date"    json:"taskStartDate"`                                          // 发布时间
+	TaskEndDate      *gtime.Time `orm:"task_end_date"      json:"taskEndDate"    v:"required#要求完成时间不能为空"`                 // 要求完成时间
 	TaskDesc         string      `orm:"task_desc"          json:"taskDesc"`                                               // 任务说明
 	SupervisorUserId int         `orm:"supervisor_user_id" json:"supervisorUserId"    v:"required|min:1#督办人不能为空|督办人不能为空"` // 督办人
 	WatchUserId      int         `orm:"watch_user_id"      json:"watchUserId"`                                            // 监办人
 	MainUserId       int         `orm:"main_user_id"       json:"mainUserId"    v:"required|min:1#负责人ID不能为空|负责人ID不能为空"`   // 负责人ID
-	OwnerUserId      string      `orm:"owner_user_id"      json:"ownerUserId"`                                            // 团队成员ID
+	OwnerUserId      string      `orm:"owner_user_id"      json:"ownerUserId"`                                            // 协办人ID
 	TaskLabel        string      `orm:"task_label"         json:"taskLabel"`                                              // 任务标签,号拼接
 	TargetId         int         `orm:"target_id"          json:"targetId"`                                               // 关联对象ID
 	TargetType       string      `orm:"target_type"        json:"targetType"`                                             // 关联对象类型(10客户,20项目,30合同,40回款)

+ 14 - 0
opms_parent/app/model/plat/plat_user_config.go

@@ -0,0 +1,14 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package plat
+
+import (
+	"dashoo.cn/micro/app/model/plat/internal"
+)
+
+// PlatUserConfig is the golang structure for table plat_user_config.
+type PlatUserConfig internal.PlatUserConfig
+
+// Fill with you ideas below.

+ 82 - 0
opms_parent/app/service/home/home.go

@@ -0,0 +1,82 @@
+package home
+
+import (
+	"context"
+	"dashoo.cn/micro/app/model/home"
+	"dashoo.cn/micro/app/model/plat"
+	"dashoo.cn/micro/app/service"
+	server "dashoo.cn/micro/app/service/plat"
+	"encoding/json"
+	"github.com/gogf/gf/util/gconv"
+)
+
+type HomeService struct {
+	*service.ContextService
+}
+
+func NewHomeService(ctx context.Context) (svc *HomeService, err error) {
+	svc = new(HomeService)
+	if svc.ContextService, err = svc.Init(ctx); err != nil {
+		return nil, err
+	}
+	return svc, nil
+}
+
+func (s *HomeService) SetUpHomeReportConfig(param *home.SetUpHomeConfig) (err error) {
+	svc, err := server.NewUserConfigService(s.Ctx)
+	config, _ := svc.QueryByUserIdAndModelCode(s.GetCxtUserId(), param.ModuleCode)
+	by, _ := json.Marshal(param)
+	if config != nil {
+		config.ConfigInfo = gconv.String(by)
+		err = svc.Edit(config)
+	} else {
+		config := new(plat.PlatUserConfig)
+		config.UserId = s.GetCxtUserId()
+		config.ModuleCode = param.ModuleCode
+		config.ConfigInfo = gconv.String(by)
+		_, err = svc.Create(config)
+	}
+	return
+}
+
+func (s *HomeService) QueryHomeReportConfig(moduleCode string) (config *plat.PlatUserConfig, err error) {
+	svc, err := server.NewUserConfigService(s.Ctx)
+	config, err = svc.QueryByUserIdAndModelCode(s.GetCxtUserId(), moduleCode)
+	return
+}
+
+func (s *HomeService) QueryHomeNumReportData(param *home.SearchNumReportData) (resp *home.NumReportResponses, err error) {
+	numConfig := make([]*home.NumReportResponse, len(param.ReportId))
+	for _, v := range param.ReportId {
+		numReport := new(home.NumReportResponse)
+		numReport.Id = v
+		value, _ := getReportData(v)
+		numReport.Data = value
+		numConfig = append(numConfig, numReport)
+	}
+
+	resp.NumReportResponse = numConfig
+
+	return
+}
+
+func (s *HomeService) QueryHomeDataReportData(param *home.SearchDataReportData) (resp *home.DataReportResponse, err error) {
+	resp.Id = param.ReportId
+	value, err := getReportData(param.ReportId)
+	if err != nil {
+		return nil, err
+	}
+
+	resp.Data = value
+	return
+}
+
+func getReportData(id int64) (interface{}, error) {
+	switch id {
+	case 0:
+		return nil, nil
+	default:
+		return nil, nil
+
+	}
+}

+ 14 - 8
opms_parent/app/service/plat/plat_task.go

@@ -139,11 +139,14 @@ func (s *taskService) Export(req *model.ExportReq) (content *model.ExportContent
 					}
 					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), data)
 				}
+				if value == "督办事项来源" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), item.Source)
+				}
 				if value == "超期" {
 					data := ""
-					if item.TaskStatus == "10" {
+					if gtime.Now().Format("Y-m-d H:i:s") <= item.TaskEndDate.Format("Y-m-d 23:59:59") {
 						data = "否"
-					} else if item.TaskStatus == "20" {
+					} else {
 						data = "是"
 					}
 					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), data)
@@ -157,7 +160,7 @@ func (s *taskService) Export(req *model.ExportReq) (content *model.ExportContent
 				if value == "负责人" {
 					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), userMap[item.MainUserId])
 				}
-				if value == "团队成员" {
+				if value == "协办人" {
 					names := ""
 					if item.OwnerUserId != "" {
 						ids := strings.Split(item.OwnerUserId, ",")
@@ -175,11 +178,11 @@ func (s *taskService) Export(req *model.ExportReq) (content *model.ExportContent
 				if value == "督办人" {
 					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), userMap[item.SupervisorUserId])
 				}
-				if value == "开始时间" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), item.TaskStartDate.Format("Y-m-d H:i:s"))
+				if value == "发布时间" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), item.TaskStartDate.Format("Y-m-d"))
 				}
-				if value == "结束时间" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), item.TaskEndDate.Format("Y-m-d H:i:s"))
+				if value == "要求完成时间" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), item.TaskEndDate.Format("Y-m-d"))
 				}
 				if value == "创建时间" {
 					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(lineNum+2), item.CreatedTime.Format("Y-m-d H:i:s"))
@@ -216,10 +219,13 @@ func (s *taskService) Create(req *model.AddPlatTaskReq) (err error) {
 	if err = gconv.Struct(req, platTask); err != nil {
 		return
 	}
+
+	// 初始数据
 	platTask.IsOverdue = "10" // 是否超期(10否20是)
-	if platTask.TaskStartDate == nil {
+	if platTask.TaskStartDate == nil || platTask.TaskStartDate.IsZero() {
 		platTask.TaskStartDate = gtime.Now()
 	}
+
 	// 填充创建信息
 	service.SetCreatedInfo(platTask, s.GetCxtUserId(), s.GetCxtUserName())
 	// 填充更新信息

+ 45 - 0
opms_parent/app/service/plat/plat_user_config.go

@@ -0,0 +1,45 @@
+package plat
+
+import (
+	"context"
+	"dashoo.cn/micro/app/dao/plat"
+	model "dashoo.cn/micro/app/model/plat"
+	"dashoo.cn/micro/app/service"
+)
+
+type UserConfigService struct {
+	*service.ContextService
+
+	Dao *plat.PlatUserConfigDao
+}
+
+func NewUserConfigService(ctx context.Context) (svc *UserConfigService, err error) {
+	svc = new(UserConfigService)
+	if svc.ContextService, err = svc.Init(ctx); err != nil {
+		return nil, err
+	}
+	svc.Dao = plat.NewPlatUserConfigDao(svc.Tenant)
+	return svc, nil
+}
+
+// QueryByUserIdAndModelCode 根据用户ID和模块编码查询
+func (s *UserConfigService) QueryByUserIdAndModelCode(userId int, moduleCode string) (config *model.PlatUserConfig, err error) {
+	return s.Dao.Where("user_id = ? and module_code = ?", s.GetCxtUserId(), moduleCode).One()
+}
+
+// Create 添加用户配置信息
+func (s *UserConfigService) Create(param *model.PlatUserConfig) (lastInsertId int64, err error) {
+	return s.Dao.InsertAndGetId(param)
+}
+
+// Edit 修改配置信息
+func (s *UserConfigService) Edit(param *model.PlatUserConfig) (err error) {
+	_, err = s.Dao.Fields(s.Dao.Columns.ConfigInfo).WherePri(param.Id).Data(param).Update()
+	return err
+}
+
+// Delete 删除配置信息
+func (s *UserConfigService) Delete(param *model.PlatUserConfig) (err error) {
+	_, err = s.Dao.WherePri(param.Id).Delete()
+	return err
+}