...
|
...
|
@@ -17,7 +17,7 @@ import ( |
|
|
"time"
|
|
|
)
|
|
|
|
|
|
//点赞/收藏列表
|
|
|
// 点赞/收藏列表
|
|
|
func Favorite(header *protocol.RequestHeader, request *protocol.FavoriteRequest) (rsp *protocol.FavoriteResponse, err error) {
|
|
|
var (
|
|
|
favorites []*models.ChanceFavorite
|
...
|
...
|
@@ -59,7 +59,7 @@ func Favorite(header *protocol.RequestHeader, request *protocol.FavoriteRequest) |
|
|
return
|
|
|
}
|
|
|
|
|
|
//点赞/收藏 取消点赞/收藏
|
|
|
// 点赞/收藏 取消点赞/收藏
|
|
|
func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyActionRequest) (rsp *protocol.SympathyActionResponse, err error) {
|
|
|
var (
|
|
|
exists bool
|
...
|
...
|
@@ -181,7 +181,7 @@ END: |
|
|
return
|
|
|
}
|
|
|
|
|
|
//机会类型
|
|
|
// 机会类型
|
|
|
func ChanceType(header *protocol.RequestHeader, request *protocol.ChanceTypeRequest) (rsp *protocol.ChanceTypeResponse, err error) {
|
|
|
var (
|
|
|
list []*models.ChanceType
|
...
|
...
|
@@ -216,7 +216,7 @@ func ChanceType(header *protocol.RequestHeader, request *protocol.ChanceTypeRequ |
|
|
return
|
|
|
}
|
|
|
|
|
|
//机会储备类型
|
|
|
// 机会储备类型
|
|
|
func ChanceReserveType(header *protocol.RequestHeader, request *protocol.ChanceReserveTypeRequest) (rsp *protocol.ChanceReserveTypeResponse, err error) {
|
|
|
var (
|
|
|
v []*models.ChanceReserveType
|
...
|
...
|
@@ -229,7 +229,7 @@ func ChanceReserveType(header *protocol.RequestHeader, request *protocol.ChanceR |
|
|
return
|
|
|
}
|
|
|
|
|
|
//获取机会对应的模板列表
|
|
|
// 获取机会对应的模板列表
|
|
|
func Templates(header *protocol.RequestHeader, request *protocol.TemplatesRequest) (rsp *protocol.TemplatesResponse, err error) {
|
|
|
var (
|
|
|
templates []*models.AuditTemplate
|
...
|
...
|
@@ -290,7 +290,7 @@ func Templates(header *protocol.RequestHeader, request *protocol.TemplatesReques |
|
|
return
|
|
|
}
|
|
|
|
|
|
//模板详情
|
|
|
// 模板详情
|
|
|
func Template(header *protocol.RequestHeader, request *protocol.TemplateRequest) (rsp *protocol.TemplateResponse, err error) {
|
|
|
var (
|
|
|
templates *models.AuditTemplate
|
...
|
...
|
@@ -414,7 +414,7 @@ func checkTemplateIsVisible(header *protocol.RequestHeader, template *models.Aud |
|
|
return
|
|
|
}
|
|
|
|
|
|
//模板示例
|
|
|
// 模板示例
|
|
|
func ChanceExample(header *protocol.RequestHeader, request *protocol.ChanceExampleRequest) (rsp *protocol.ChanceExampleResponse, err error) {
|
|
|
var (
|
|
|
example string
|
...
|
...
|
@@ -435,7 +435,7 @@ func ChanceExample(header *protocol.RequestHeader, request *protocol.ChanceExamp |
|
|
return
|
|
|
}
|
|
|
|
|
|
//提交机会
|
|
|
// 提交机会
|
|
|
func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmitRequest) (rsp *protocol.ChanceSubmitResponse, err error) {
|
|
|
var (
|
|
|
template *models.AuditTemplate
|
...
|
...
|
@@ -575,7 +575,7 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit |
|
|
return
|
|
|
}
|
|
|
|
|
|
//设置机会自动通过
|
|
|
// 设置机会自动通过
|
|
|
func setChanceAutoPass(header *protocol.RequestHeader, chance *models.Chance, orm orm.Ormer, chanceType *models.ChanceType) (err error) {
|
|
|
var (
|
|
|
approveData protocol.ApproveData
|
...
|
...
|
@@ -604,7 +604,7 @@ func setChanceAutoPass(header *protocol.RequestHeader, chance *models.Chance, or |
|
|
return
|
|
|
}
|
|
|
|
|
|
//机会编辑
|
|
|
// 机会编辑
|
|
|
func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdateRequest) (rsp *protocol.ChanceUpdateResponse, err error) {
|
|
|
var (
|
|
|
template *models.AuditTemplate
|
...
|
...
|
@@ -820,7 +820,7 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate |
|
|
return
|
|
|
}
|
|
|
|
|
|
//检查机会更新
|
|
|
// 检查机会更新
|
|
|
func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, request *protocol.ChanceUpdateRequest) {
|
|
|
defer func() {
|
|
|
if p := recover(); p != nil {
|
...
|
...
|
@@ -992,7 +992,7 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
|
}
|
|
|
}
|
|
|
|
|
|
//保存机会变更日志
|
|
|
// 保存机会变更日志
|
|
|
func SaveChanceReviseLog(header *protocol.RequestHeader, chance *models.Chance, modifyLog protocol.ChanceReviseLog) (err error) {
|
|
|
var (
|
|
|
chanceReviseLog *models.ChanceReviseLog
|
...
|
...
|
@@ -1041,7 +1041,7 @@ func SaveChanceReviseLog(header *protocol.RequestHeader, chance *models.Chance, |
|
|
return
|
|
|
}
|
|
|
|
|
|
//修改公开状态
|
|
|
// 修改公开状态
|
|
|
func ChanceChangePublish(header *protocol.RequestHeader, request *protocol.ChanceChangePublishRequest) (rsp *protocol.ChanceChangePublishResponse, err error) {
|
|
|
var (
|
|
|
chance *models.Chance
|
...
|
...
|
@@ -1106,7 +1106,7 @@ func ChanceChangePublish(header *protocol.RequestHeader, request *protocol.Chanc |
|
|
return
|
|
|
}
|
|
|
|
|
|
//发送审核日志
|
|
|
// 发送审核日志
|
|
|
func saveApproveMsgChangePublic(header *protocol.RequestHeader, orm orm.Ormer, chance *models.Chance, approveData protocol.PublicData) (err error) {
|
|
|
var (
|
|
|
parames = make([]interface{}, 0)
|
...
|
...
|
@@ -1131,7 +1131,7 @@ func saveApproveMsgChangePublic(header *protocol.RequestHeader, orm orm.Ormer, c |
|
|
return
|
|
|
}
|
|
|
|
|
|
//修改评分
|
|
|
// 修改评分
|
|
|
func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceChangeScoreRequest) (rsp *protocol.ChanceChangeScoreResponse, err error) {
|
|
|
var (
|
|
|
chance *models.Chance
|
...
|
...
|
@@ -1191,7 +1191,7 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC |
|
|
return
|
|
|
}
|
|
|
|
|
|
//计算发现分
|
|
|
// 计算发现分
|
|
|
func ChanceCalculateScore(header *protocol.RequestHeader, request *protocol.ChanceCalculateScoreRequest) (rsp *protocol.ChanceCalculateScoreResponse, err error) {
|
|
|
var (
|
|
|
config *models.SysConfig
|
...
|
...
|
@@ -1250,7 +1250,7 @@ func ChanceCalculateScore(header *protocol.RequestHeader, request *protocol.Chan |
|
|
return
|
|
|
}
|
|
|
|
|
|
//计算默认发现分
|
|
|
// 计算默认发现分
|
|
|
func ChanceCalculateDefautlScore(header *protocol.RequestHeader) (rsp protocol.Score, err error) {
|
|
|
var (
|
|
|
config *models.SysConfig
|
...
|
...
|
@@ -1293,7 +1293,7 @@ func ChanceCalculateDefautlScore(header *protocol.RequestHeader) (rsp protocol.S |
|
|
// return
|
|
|
//}
|
|
|
|
|
|
//生成审批流-提交记录
|
|
|
// 生成审批流-提交记录
|
|
|
func GenAuditFlowProcess_Submit(userId, chanceId int64, templateId int64, reviewStatus int) (v *models.AuditFlowProcess) {
|
|
|
v = &models.AuditFlowProcess{
|
|
|
Id: idgen.Next(),
|
...
|
...
|
@@ -1315,7 +1315,7 @@ func GenAuditFlowProcess_Submit(userId, chanceId int64, templateId int64, review |
|
|
return
|
|
|
}
|
|
|
|
|
|
//生成审批流
|
|
|
// 生成审批流
|
|
|
func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, relatedDeparmentId int64, templateId int64, auditConfig *protocol.AuditConfig) (v []*models.AuditFlowProcess, err error) {
|
|
|
var (
|
|
|
configs []*models.AuditFlowConfig
|
...
|
...
|
@@ -1504,7 +1504,7 @@ func resolveActionType(t uint) string { |
|
|
return fmt.Sprintf("%v", t)
|
|
|
}
|
|
|
|
|
|
//获取部门长用户列表
|
|
|
// 获取部门长用户列表
|
|
|
func getDepartmentors(header *protocol.RequestHeader, relatedDeparmentId int64) (ids []int64, err error) {
|
|
|
var (
|
|
|
departments *models.Department
|
...
|
...
|
@@ -1559,7 +1559,7 @@ func getDepartmentors(header *protocol.RequestHeader, relatedDeparmentId int64) |
|
|
return
|
|
|
}
|
|
|
|
|
|
//获取角色ids
|
|
|
// 获取角色ids
|
|
|
func getRoleUsers(header *protocol.RequestHeader, roleId int) (ids []int64, err error) {
|
|
|
var (
|
|
|
userRole []*models.UserRole
|
...
|
...
|
@@ -1580,7 +1580,7 @@ func getRoleUsers(header *protocol.RequestHeader, roleId int) (ids []int64, err |
|
|
return
|
|
|
}
|
|
|
|
|
|
//递归寻找上一级部门长
|
|
|
// 递归寻找上一级部门长
|
|
|
func getParentDepartmentors(pid int64) (ids []int64) {
|
|
|
var (
|
|
|
department *models.Department
|
...
|
...
|
@@ -1601,9 +1601,9 @@ func getParentDepartmentors(pid int64) (ids []int64) { |
|
|
return getParentDepartmentors(department.ParentId)
|
|
|
}
|
|
|
|
|
|
//首页机会池统计
|
|
|
// 首页机会池统计
|
|
|
func ChanceStatistics(header *protocol.RequestHeader, request *protocol.ChanceStatisticsRequest) (rsp *protocol.ChanceStatisticsResponse, err error) {
|
|
|
var (
|
|
|
/*var (
|
|
|
chanceType []*models.ChanceType
|
|
|
total int
|
|
|
sum int
|
...
|
...
|
@@ -1611,9 +1611,9 @@ func ChanceStatistics(header *protocol.RequestHeader, request *protocol.ChanceSt |
|
|
if chanceType, err = models.GetChanceTypeAll(header.CompanyId); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
}*/
|
|
|
rsp = &protocol.ChanceStatisticsResponse{}
|
|
|
for i := range chanceType {
|
|
|
/*for i := range chanceType {
|
|
|
item := chanceType[i]
|
|
|
if total, err = agg.GetChancePool(header.UserId, header.CompanyId, models.NewChancePoolOption(item.Id, []int{}, models.ChancePool, 0), 0, false, 0, 0, nil); err != nil {
|
|
|
log.Error(err)
|
...
|
...
|
@@ -1629,11 +1629,11 @@ func ChanceStatistics(header *protocol.RequestHeader, request *protocol.ChanceSt |
|
|
Total: total,
|
|
|
})
|
|
|
}
|
|
|
rsp.ChanceTotal = sum
|
|
|
rsp.ChanceTotal = sum*/
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//我提交的机会
|
|
|
// 我提交的机会
|
|
|
func MySubmitChance(header *protocol.RequestHeader, request *protocol.MySubmitChanceRequest) (rsp *protocol.MySubmitChanceResponse, err error) {
|
|
|
var (
|
|
|
ormItems []protocol.CommChanceItemOrm
|
...
|
...
|
@@ -1673,7 +1673,7 @@ func MySubmitChance(header *protocol.RequestHeader, request *protocol.MySubmitCh |
|
|
return
|
|
|
}
|
|
|
|
|
|
//机会池
|
|
|
// 机会池
|
|
|
func ChancePool(header *protocol.RequestHeader, request *protocol.ChancePoolRequest) (rsp *protocol.ChancePoolResponse, err error) {
|
|
|
var (
|
|
|
chanceItems []protocol.ChancePoolItemOrm
|
...
|
...
|
@@ -1737,7 +1737,7 @@ func ChancePool(header *protocol.RequestHeader, request *protocol.ChancePoolRequ |
|
|
return
|
|
|
}
|
|
|
|
|
|
//我审核的机会
|
|
|
// 我审核的机会
|
|
|
func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApproveChanceRequest) (rsp *protocol.MyApproveChanceResponse, err error) {
|
|
|
var (
|
|
|
ormItems []protocol.ChanceApproveItemOrm
|
...
|
...
|
@@ -1868,7 +1868,7 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect |
|
|
return
|
|
|
}
|
|
|
|
|
|
//我点赞的机会
|
|
|
// 我点赞的机会
|
|
|
func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUpChanceRequest) (rsp *protocol.MyThumbUpChanceResponse, err error) {
|
|
|
var (
|
|
|
ormItems []protocol.ChanceThumbUpItemOrm
|
...
|
...
|
@@ -1929,7 +1929,7 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp |
|
|
return
|
|
|
}
|
|
|
|
|
|
//我的评论
|
|
|
// 我的评论
|
|
|
func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentRequest) (rsp *protocol.MyCommentResponse, err error) {
|
|
|
var (
|
|
|
ormItems []protocol.ChanceCommentItemOrm
|
...
|
...
|
@@ -1979,7 +1979,7 @@ func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentReques |
|
|
return
|
|
|
}
|
|
|
|
|
|
//获取机会点赞/收藏状态
|
|
|
// 获取机会点赞/收藏状态
|
|
|
func getChanceMarkFlag(header *protocol.RequestHeader, chanceId int64) (isThumbsUp, isCollect bool, err error) {
|
|
|
var flag int
|
|
|
if flag, err = agg.GetChanceMarkData(header.UserId, header.CompanyId, chanceId); err != nil {
|
...
|
...
|
@@ -1991,7 +1991,7 @@ func getChanceMarkFlag(header *protocol.RequestHeader, chanceId int64) (isThumbs |
|
|
return
|
|
|
}
|
|
|
|
|
|
//获取机会点赞/收藏状态
|
|
|
// 获取机会点赞/收藏状态
|
|
|
func getMarkFlag(header *protocol.RequestHeader, sourceId int64, sourceType int) (isThumbsUp, isCollect bool, err error) {
|
|
|
var flag int
|
|
|
if flag, err = agg.GetMarkData(header.UserId, header.CompanyId, sourceId, sourceType); err != nil {
|
...
|
...
|
@@ -2003,7 +2003,7 @@ func getMarkFlag(header *protocol.RequestHeader, sourceId int64, sourceType int) |
|
|
return
|
|
|
}
|
|
|
|
|
|
//获取模板
|
|
|
// 获取模板
|
|
|
func getTemplate(templateId int) protocol.NameItem {
|
|
|
if template, e := models.GetAuditTemplateById(int64(templateId)); e == nil {
|
|
|
item := protocol.NameItem{
|
...
|
...
|
@@ -2017,7 +2017,7 @@ func getTemplate(templateId int) protocol.NameItem { |
|
|
return protocol.NameItem{}
|
|
|
}
|
|
|
|
|
|
//获取机会一级分类
|
|
|
// 获取机会一级分类
|
|
|
func getChanceType(chanceTypeId int) protocol.NameItem {
|
|
|
if template, e := models.GetChanceTypeById(chanceTypeId); e == nil {
|
|
|
item := protocol.NameItem{
|
...
|
...
|
@@ -2040,7 +2040,7 @@ func jsonUnmarshal(jsonData string, v interface{}) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
//清楚未填写的表单数据
|
|
|
// 清楚未填写的表单数据
|
|
|
func clearEmptyForm(inputFormList []*protocol.Form) (FormList []*protocol.Form) {
|
|
|
if len(inputFormList) == 0 {
|
|
|
return
|
...
|
...
|
@@ -2054,7 +2054,7 @@ func clearEmptyForm(inputFormList []*protocol.Form) (FormList []*protocol.Form) |
|
|
return
|
|
|
}
|
|
|
|
|
|
//机会详情
|
|
|
// 机会详情
|
|
|
func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetailRequest) (rsp *protocol.ChanceDetailResponse, err error) {
|
|
|
var (
|
|
|
chance *models.Chance
|
...
|
...
|
@@ -2208,7 +2208,7 @@ func ChanceDraftDetail(header *protocol.RequestHeader, request *protocol.ChanceD |
|
|
return
|
|
|
}
|
|
|
|
|
|
//机会删除
|
|
|
// 机会删除
|
|
|
func ChanceDelete(header *protocol.RequestHeader, request *protocol.ChanceDeleteRequest) (rsp *protocol.ChanceDeleteResponse, err error) {
|
|
|
var (
|
|
|
chance *models.Chance
|
...
|
...
|
@@ -2260,7 +2260,7 @@ func ChanceDelete(header *protocol.RequestHeader, request *protocol.ChanceDelete |
|
|
return
|
|
|
}
|
|
|
|
|
|
//用户机会权限
|
|
|
// 用户机会权限
|
|
|
func Permission(header *protocol.RequestHeader, request *protocol.PermissionRequest) (rsp *protocol.PermissionResponse, err error) {
|
|
|
var (
|
|
|
op *agg.OptionOpportunity
|
...
|
...
|
@@ -2396,7 +2396,7 @@ func Permission(header *protocol.RequestHeader, request *protocol.PermissionRequ |
|
|
return
|
|
|
}
|
|
|
|
|
|
//机会补充详情
|
|
|
// 机会补充详情
|
|
|
func ChanceReviseDetail(header *protocol.RequestHeader, request *protocol.ChanceReviseDetailRequest) (rsp *protocol.ChanceReviseDetailResponse, err error) {
|
|
|
var (
|
|
|
detail *models.ChanceReviseLog
|
...
|
...
|
@@ -2427,7 +2427,7 @@ func ChanceReviseDetail(header *protocol.RequestHeader, request *protocol.Chance |
|
|
return
|
|
|
}
|
|
|
|
|
|
//自查问题列表
|
|
|
// 自查问题列表
|
|
|
func CheckQuestions(header *protocol.RequestHeader, request *protocol.CheckQuestionsRequest) (rsp *protocol.CheckQuestionsResponse, err error) {
|
|
|
var ()
|
|
|
rsp = &protocol.CheckQuestionsResponse{}
|
...
|
...
|
@@ -2458,7 +2458,7 @@ func CheckQuestions(header *protocol.RequestHeader, request *protocol.CheckQuest |
|
|
return
|
|
|
}
|
|
|
|
|
|
//机会保存到草稿箱
|
|
|
// 机会保存到草稿箱
|
|
|
func DraftSaveChance(header *protocol.RequestHeader, request *protocol.DraftSaveChanceRequest) (rsp *protocol.DraftSaveChanceResponse, err error) {
|
|
|
var (
|
|
|
template *models.AuditTemplate
|
...
|
...
|
@@ -2549,7 +2549,7 @@ func DraftSaveChance(header *protocol.RequestHeader, request *protocol.DraftSave |
|
|
return
|
|
|
}
|
|
|
|
|
|
//草稿删除(清空)
|
|
|
// 草稿删除(清空)
|
|
|
func DraftDelete(header *protocol.RequestHeader, request *protocol.DraftDeleteRequest) (rsp *protocol.DraftDeleteResponse, err error) {
|
|
|
var (
|
|
|
sql string
|
...
|
...
|
@@ -2567,7 +2567,7 @@ func DraftDelete(header *protocol.RequestHeader, request *protocol.DraftDeleteRe |
|
|
return
|
|
|
}
|
|
|
|
|
|
//草稿箱-机会列表
|
|
|
// 草稿箱-机会列表
|
|
|
func DraftByChance(header *protocol.RequestHeader, request *protocol.DraftByChanceRequest) (rsp *protocol.DraftByChanceResponse, err error) {
|
|
|
var (
|
|
|
ormItems []protocol.DraftChanceItemOrm
|
...
|
...
|
@@ -2608,7 +2608,7 @@ func DraftByChance(header *protocol.RequestHeader, request *protocol.DraftByChan |
|
|
return
|
|
|
}
|
|
|
|
|
|
//获取最新的表单列表
|
|
|
// 获取最新的表单列表
|
|
|
func GetNewestFormList(header *protocol.RequestHeader, chanceType, tpId int, old []*protocol.Form) []*protocol.Form {
|
|
|
var (
|
|
|
new []*protocol.Form
|
...
|
...
|
@@ -2634,7 +2634,7 @@ func getNewestFormList(new []*protocol.Form, old []*protocol.Form) []*protocol.F |
|
|
return new
|
|
|
}
|
|
|
|
|
|
//获取最新的自查列表
|
|
|
// 获取最新的自查列表
|
|
|
func GetNewestCheckQuestions(tpId int64, old []protocol.SelfCheck) []*protocol.CheckQuestion {
|
|
|
var rsp = []*protocol.CheckQuestion{}
|
|
|
if questions, err := agg.GetCheckQuestionsByTemplateId(tpId); err != nil {
|
...
|
...
|
|