作者 tangxvhui

Merge branch 'dev-tangxvhui' into test

@@ -104,7 +104,7 @@ func (service *AuthService) MobileLogin(param *command.MobileLoginCommand) (map[ @@ -104,7 +104,7 @@ func (service *AuthService) MobileLogin(param *command.MobileLoginCommand) (map[
104 } 104 }
105 // 用户权限校验 105 // 用户权限校验
106 // 登录平台ID,28-绩效管理后台 29-员工绩效 106 // 登录平台ID,28-绩效管理后台 29-员工绩效
107 - userAuthReply, err := factory.BusinessAdminApi().GetUserAuth(int64(param.Muid), constant.IdPlatformUser) 107 + userAuthReply, err := factory.BusinessAdminApi().GetUserAuth(int64(param.Muid), constant.PLATFORM_FONT_ID)
108 if err != nil { 108 if err != nil {
109 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户鉴权失败") 109 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户鉴权失败")
110 } 110 }
@@ -139,7 +139,7 @@ func (service *AuthService) MobileLogin(param *command.MobileLoginCommand) (map[ @@ -139,7 +139,7 @@ func (service *AuthService) MobileLogin(param *command.MobileLoginCommand) (map[
139 CompanyId: user.CompanyId, 139 CompanyId: user.CompanyId,
140 CompanyName: company.Name, 140 CompanyName: company.Name,
141 Phone: user.Account, 141 Phone: user.Account,
142 - PlatformId: constant.IdPlatformUser, 142 + PlatformId: constant.PLATFORM_FONT_ID,
143 Name: user.Name, 143 Name: user.Name,
144 AdminType: user.AdminType, 144 AdminType: user.AdminType,
145 } 145 }
  1 +package notify
  2 +
  3 +// 手机端 ,消息通知
  4 +// 定时任务检查业务,确定是否发送短信消息
  5 +
  6 +// 关于反馈异常的消息通知;早上9点 开始检查,并确认发送的消息
  7 +func taskRecordAnomaly() (map[string]string, error) {
  8 + return nil, nil
  9 +}
  10 +
  11 +// 关于里程碑异常的消息通知;早上9点 开始检查,并确认发送的消息
  12 +func taskStageAnomaly() (map[string]string, error) {
  13 +
  14 + return nil, nil
  15 +}
@@ -13,12 +13,6 @@ var UCENTER_CHECK_ALT = "rsF0pL!6DwjBO735" @@ -13,12 +13,6 @@ var UCENTER_CHECK_ALT = "rsF0pL!6DwjBO735"
13 // 企业平台地址 13 // 企业平台地址
14 var BUSINESS_ADMIN_SERVICE_HOST = "http://suplus-business-admin-test.fjmaimaimai.com" 14 var BUSINESS_ADMIN_SERVICE_HOST = "http://suplus-business-admin-test.fjmaimaimai.com"
15 15
16 -// 绩效管理平台ID  
17 -var PLATFORM_ADMIN_ID = 28  
18 -  
19 -// 员工绩效平台ID  
20 -var PLATFORM_FONT_ID = 29  
21 -  
22 func init() { 16 func init() {
23 if os.Getenv("UCENTER_SERVICE_HOST") != "" { 17 if os.Getenv("UCENTER_SERVICE_HOST") != "" {
24 UCENTER_SERVICE_HOST = os.Getenv("UCENTER_SERVICE_HOST") 18 UCENTER_SERVICE_HOST = os.Getenv("UCENTER_SERVICE_HOST")
@@ -4,12 +4,6 @@ import "os" @@ -4,12 +4,6 @@ import "os"
4 4
5 const SERVICE_NAME = "performance" 5 const SERVICE_NAME = "performance"
6 6
7 -// 登录平台ID,28-绩效管理后台 29-员工绩效  
8 -const (  
9 - IdPlatformAdmin int = 28  
10 - IdPlatformUser int = 29  
11 -)  
12 -  
13 var LOG_LEVEL = "debug" 7 var LOG_LEVEL = "debug"
14 8
15 // 过期时间 7天时间 9 // 过期时间 7天时间
@@ -23,6 +17,14 @@ var UPLOAD_ZIP_PATH = "./uploads/zip" @@ -23,6 +17,14 @@ var UPLOAD_ZIP_PATH = "./uploads/zip"
23 // Env 判断当前环境变量 17 // Env 判断当前环境变量
24 var Env = "dev" 18 var Env = "dev"
25 19
  20 +var MMM_OPEN_API_SERVICE_HOST = "http://mmm-open-api-dev.fjmaimaimai.com"
  21 +
  22 +// 绩效管理平台ID
  23 +var PLATFORM_ADMIN_ID = 28
  24 +
  25 +// 员工绩效平台ID
  26 +var PLATFORM_FONT_ID = 29
  27 +
26 func init() { 28 func init() {
27 if os.Getenv("LOG_LEVEL") != "" { 29 if os.Getenv("LOG_LEVEL") != "" {
28 LOG_LEVEL = os.Getenv("LOG_LEVEL") 30 LOG_LEVEL = os.Getenv("LOG_LEVEL")
@@ -31,4 +33,8 @@ func init() { @@ -31,4 +33,8 @@ func init() {
31 if os.Getenv("ENV_MOD") != "" { 33 if os.Getenv("ENV_MOD") != "" {
32 Env = os.Getenv("ENV_MOD") 34 Env = os.Getenv("ENV_MOD")
33 } 35 }
  36 + //开放平台
  37 + if os.Getenv("MMM_OPEN_API_SERVICE_HOST") != "" {
  38 + MMM_OPEN_API_SERVICE_HOST = os.Getenv("MMM_OPEN_API_SERVICE_HOST")
  39 + }
34 } 40 }
@@ -427,6 +427,23 @@ func (d *TaskDao) TaskStageAnomalyByRelatedUser(relatedUserId int) ([]TaskStageD @@ -427,6 +427,23 @@ func (d *TaskDao) TaskStageAnomalyByRelatedUser(relatedUserId int) ([]TaskStageD
427 return result, err 427 return result, err
428 } 428 }
429 429
  430 +// TaskStageAnomalyAll 获取所有异常的里程碑任务
  431 +func (d TaskDao) TaskStageAnomalyAll() ([]TaskStageData, error) {
  432 + sqlStr := `select
  433 + task_stage.id,
  434 + task_stage."name" ,
  435 + task.leader ->>'name' as leader_name
  436 + from task_stage
  437 + join task on task.id=task_stage.task_id
  438 + where 1=1
  439 + and task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()) `
  440 +
  441 + result := []TaskStageData{}
  442 + tx := d.transactionContext.PgTx
  443 + _, err := tx.Query(&result, sqlStr)
  444 + return result, err
  445 +}
  446 +
430 type TaskData2 struct { 447 type TaskData2 struct {
431 Id int `pg:"id"` 448 Id int `pg:"id"`
432 Name string `pg:"name"` 449 Name string `pg:"name"`
  1 +package serviceGateway
  2 +
  3 +import (
  4 + "strings"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant"
  7 +)
  8 +
  9 +type HttplibMmmOpenApiServiceGateway struct {
  10 + httpLibBaseServiceGateway
  11 +}
  12 +
  13 +// MessageOptions 个推参数
  14 +type MessageOptions struct {
  15 + MmmType int `json:"mmmType"` // 通知类型 0:系统透传消息 1:系统通知消息 默认:系统透传
  16 + Project string `json:"project"` // 单一终端类型 项目编码 "mmm.tianlian.performance"
  17 + Projects []string `json:"projects"` // 多终端类型
  18 + Receivers []int64 `json:"receivers"` // 消息接收者uid
  19 + Title string `json:"title"` // 个推标题
  20 + Content string `json:"content"` // 个推内容
  21 +}
  22 +
  23 +// PushInfo 个推
  24 +func (serviceGateway *HttplibMmmOpenApiServiceGateway) PushInfo(msgType int, projects []string, uids []int64, title string, content string) (map[string]interface{}, error) {
  25 + url := strings.Join([]string{serviceGateway.baseURL, "v1", "push", "pushInfo"}, "/")
  26 + serviceGateway.CreateRequest("post", url)
  27 + options := &MessageOptions{
  28 + MmmType: msgType,
  29 + Projects: projects,
  30 + Receivers: uids,
  31 + Title: title,
  32 + Content: content,
  33 + }
  34 + serviceGateway.SetBody(options)
  35 + response := make(map[string]interface{})
  36 + err := serviceGateway.ToJson(&response)
  37 + return response, err
  38 +}
  39 +
  40 +func NewHttplibMmmOpenApiServiceGateway() *HttplibMmmOpenApiServiceGateway {
  41 + return &HttplibMmmOpenApiServiceGateway{
  42 + httpLibBaseServiceGateway{
  43 + baseURL: constant.MMM_OPEN_API_SERVICE_HOST,
  44 + },
  45 + }
  46 +}
@@ -8,8 +8,10 @@ import ( @@ -8,8 +8,10 @@ import (
8 8
9 func init() { 9 func init() {
10 web.Router("/login", &controllers.AuthController{}, "Post:Login") 10 web.Router("/login", &controllers.AuthController{}, "Post:Login")
11 - 11 + //手机模块登录-旧
12 web.Router("/login/mobile", &controllers.AuthController{}, "Post:MobileLogin") 12 web.Router("/login/mobile", &controllers.AuthController{}, "Post:MobileLogin")
  13 + ////手机模块登录-新
  14 + web.Router("/v1/auth/authorize", &controllers.AuthController{}, "Post:MobileLogin")
13 // 15 //
14 web.InsertFilter("/auth/admin/*", web.BeforeExec, middlewares.CheckAdminToken()) 16 web.InsertFilter("/auth/admin/*", web.BeforeExec, middlewares.CheckAdminToken())
15 web.Router("/auth/admin/user", &controllers.AuthController{}, "Get:User") 17 web.Router("/auth/admin/user", &controllers.AuthController{}, "Get:User")