作者 唐旭辉

提交保存

... ... @@ -229,12 +229,27 @@ type CategoryEditSortResponse struct {
//RequestAuditList 机会管理-获取机会列表
type RequestAuditList struct {
RequestPageInfo
ChanceTypeId int `json:"chance_type_id"` //一级分类
TempalteId int `json:"template_id"` // 二级分类
PublishStatus int `json:"publish_status"` //公开状态
ReviewStatus int `json:"review_status"` //
EnableStatus int `json:"enable_status"` //关闭状态
DepartmentID int `json:"department_id"` //提交部门
CreateTimeBegin int `json:"create_time_begin"` //
CreateTimeEnd int `json:"create_time_end"` //
Code string `json:"code"` //机会编码
}
type ResponseAuditList struct {
ResponsePageInfo
List []RspAuditList `json:"lists"`
}
type RspAuditList struct {
Id int64 `json:"id"` //机会的id
ChanceType1 string `json:"chance_type_1"` //一级分类
ChanceType2 string `json:"chance_type_2"` //二级分类
Code string `json:"code"`
ChanceType string `json:"chance_type"` //一级分类
TemplateName string `json:"template_name"` //二级分类
UserName string `json:"user_name"` // 提交人
Department string `json:"department"` //提交部门
CreateTime int64 `json:"create_time"` //提交时间
... ... @@ -242,4 +257,6 @@ type ResponseAuditList struct {
PublishStatusName string `json:"publish_status_name"` //
ReviewStatus int `json:"review_status"` //审批状态
ReviewStatusName string `json:"review_status_name"`
EnableStatus int `json:"enable_status"`
EnableStatusName int `json:"enable_status_name"`
}
... ...
package audit
func GetAuditList() error {
/*
SELECT user_id,department_id,audit_template_id,chance_type_id,publish_status,create_at
,review_status,enable_status,discovery_score,comment_total
import (
"oppmg/common/log"
"oppmg/models"
"oppmg/protocol"
"oppmg/utils"
"strings"
)
type SqlData struct {
UserId int64 `orm:"column(user_id)"`
DepartmentId int64 `orm:"column(department_id)"`
AuditTemplateId int64 `orm:"column(audit_template_id)"`
ChanceTypeId int `orm:"column(chance_type_id)"`
PublishStatus int `orm:"column(publish_status)"`
CreateAt string `orm:"column(create_at);type(timestamp)"`
ReviewStatus int `orm:"column(review_status)"`
EnableStatus int `orm:"column(enable_status)"`
DiscoveryScore string `orm:"column(discovery_score)"`
CommentTotal string `orm:"column(comment_total)"`
}
func GetAuditList(param protocol.RequestAuditList, companyid int64) (protocol.ResponseAuditList, error) {
var (
datasql = strings.Builder{}
countsql = strings.Builder{}
data []SqlData
cnt int
err error
//listdata = make([]protocol.RspAuditList, 0)
)
returnData := protocol.ResponseAuditList{
ResponsePageInfo: protocol.ResponsePageInfo{
TotalPage: 0,
CurrentPage: param.PageIndex,
},
List: make([]protocol.RspAuditList, 0),
}
dataStart := (param.PageIndex - 1) * param.PageSize
datasql.WriteString(`SELECT user_id,department_id,audit_template_id,chance_type_id
,publish_status,create_at,review_status,enable_status
,discovery_score,comment_total
FROM chance
*/
limit ?,? `)
countsql.WriteString(`SELECT count(*) FROM chance`)
err = utils.ExecuteQueryOne(&cnt, countsql.String())
if err != nil {
log.Error("EXCUTE SQL ERR:%s", err)
return returnData, nil
}
if cnt <= 0 {
return returnData, nil
}
err = utils.ExecuteQueryOne(&data, datasql.String(), dataStart, param.PageSize)
if err != nil {
log.Error("EXCUTE SQL ERR:%s", err)
return returnData, nil
}
for _, v := range data {
item := protocol.RspAuditList{}
if u, err := models.GetUserById(v.UserId); err == nil {
item.UserName = u.NickName
}
if d, err := models.GetDepartmentById(v.DepartmentId); err == nil {
item.Department = d.Name
}
if at, err := models.GetAuditTemplateById(v.AuditTemplateId); err == nil {
item.TemplateName = at.Name
item.Code = at.Code
}
if ct, err := models.GetChanceTypeById(v.ChanceTypeId); err == nil {
item.ChanceType = ct.Name
}
returnData.List = append(returnData.List, item)
return nil
}
return returnData, nil
}
... ...
... ... @@ -58,6 +58,32 @@ var routerPermission = map[string]PermissionBase{
"/v1/rbac/menu/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/menu/opportunity": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/rbac/menu/opportunity/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE_ROLE, ActionName: "default"},
"/v1/user/list": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/add": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/edit": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/delete": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/allow_forbid": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/user/info": PermissionBase{CodeName: M_ENTERPRISE_EMPLOYEE, ActionName: "default"},
"/v1/bulletin/add": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/list": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/get": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/update": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/operate": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/feedbacks": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/bulletin/exportFeedBacks": PermissionBase{CodeName: M_SYSTEM_ANNOUNCEMENT, ActionName: "default"},
"/v1/template/add": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/sortCategory": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/list": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/get": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/update": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/delete": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/editVisible": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/editEnable": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/editSort": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/operateCategory": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/template/deleteCategory": PermissionBase{CodeName: M_SYSTEM_OPPORTUNITY_TEMPLATE, ActionName: "default"},
"/v1/config/score": PermissionBase{CodeName: M_SYSTEM_RATING, ActionName: "default"},
"/v1/config/score/get": PermissionBase{CodeName: M_SYSTEM_RATING, ActionName: "default"},
}
type CodeToObject func() PermissionOptionObject
... ...