|
@@ -406,6 +406,7 @@ func (this *ReportOpenController) ReportApprove() {
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
go func() {
|
|
go func() {
|
|
|
|
+ // 审批通过,将摘要加入知识资源库观点中
|
|
var classifyId int
|
|
var classifyId int
|
|
if v.ClassifyIdThird > 0 {
|
|
if v.ClassifyIdThird > 0 {
|
|
classifyId = v.ClassifyIdThird
|
|
classifyId = v.ClassifyIdThird
|
|
@@ -416,6 +417,10 @@ func (this *ReportOpenController) ReportApprove() {
|
|
}
|
|
}
|
|
|
|
|
|
classifyId, err := services.ReportKnowledgeResourceClassifyCheckAndSave(classifyId)
|
|
classifyId, err := services.ReportKnowledgeResourceClassifyCheckAndSave(classifyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ utils.FileLog.Error(fmt.Sprintf("ReportKnowledgeResourceClassifyCheckAndSave-报告分类保存失败,reportId:%d,classifyId:%d,err: %v", v.Id, classifyId, err))
|
|
|
|
+ return
|
|
|
|
+ }
|
|
msg, err := services.ViewPointSave(0, v.AdminId, v.AdminRealName, v.Title, v.Abstract, "市场信息研究所", "", classifyId, &v.ApproveTime)
|
|
msg, err := services.ViewPointSave(0, v.AdminId, v.AdminRealName, v.Title, v.Abstract, "市场信息研究所", "", classifyId, &v.ApproveTime)
|
|
if err != nil {
|
|
if err != nil {
|
|
utils.FileLog.Error(fmt.Sprintf("ViewPointSave-报告摘要知识资源库添加失败,reportId:%d,msg:%s,err: %v", v.Id, msg, err))
|
|
utils.FileLog.Error(fmt.Sprintf("ViewPointSave-报告摘要知识资源库添加失败,reportId:%d,msg:%s,err: %v", v.Id, msg, err))
|
|
@@ -517,8 +522,15 @@ func (this *ReportOpenController) ReportApprove() {
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
go func() {
|
|
go func() {
|
|
-
|
|
|
|
|
|
+ // 审批通过,将摘要加入知识资源库观点中
|
|
|
|
+ if v.Abstract == "" {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
classifyId, err := services.ReportKnowledgeResourceClassifyCheckAndSave(v.ClassifyId)
|
|
classifyId, err := services.ReportKnowledgeResourceClassifyCheckAndSave(v.ClassifyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ utils.FileLog.Error(fmt.Sprintf("ReportKnowledgeResourceClassifyCheckAndSave-PPT分类保存失败,pptId:%d,classifyId:%d,err: %v", v.PptId, v.ClassifyId, err))
|
|
|
|
+ return
|
|
|
|
+ }
|
|
msg, err := services.ViewPointSave(0, v.AdminId, v.AdminRealName, v.Title, v.Abstract, "市场信息研究所", "", classifyId, &v.ApproveTime)
|
|
msg, err := services.ViewPointSave(0, v.AdminId, v.AdminRealName, v.Title, v.Abstract, "市场信息研究所", "", classifyId, &v.ApproveTime)
|
|
if err != nil {
|
|
if err != nil {
|
|
utils.FileLog.Error(fmt.Sprintf("ViewPointSave-ppt摘要知识库添加失败,pptId:%d,msg:%s,err: %v", v.PptId, msg, err))
|
|
utils.FileLog.Error(fmt.Sprintf("ViewPointSave-ppt摘要知识库添加失败,pptId:%d,msg:%s,err: %v", v.PptId, msg, err))
|
|
@@ -666,7 +678,7 @@ func (this *ReportOpenController) ReportRemove() {
|
|
// @Description 观点保存
|
|
// @Description 观点保存
|
|
// @Param request body models.ReportViewPointReq true "type json string"
|
|
// @Param request body models.ReportViewPointReq true "type json string"
|
|
// @Success 200 string "操作成功"
|
|
// @Success 200 string "操作成功"
|
|
-// @Router /viewpoint/save [post]
|
|
|
|
|
|
+// @router /viewpoint/save [post]
|
|
func (this *ReportOpenController) ViewPointSave() {
|
|
func (this *ReportOpenController) ViewPointSave() {
|
|
br := new(models.BaseResponse).Init()
|
|
br := new(models.BaseResponse).Init()
|
|
defer func() {
|
|
defer func() {
|
|
@@ -676,7 +688,7 @@ func (this *ReportOpenController) ViewPointSave() {
|
|
this.Data["json"] = br
|
|
this.Data["json"] = br
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
}()
|
|
}()
|
|
- var req *models.ReportViewPointReq
|
|
|
|
|
|
+ var req *models.ReportViewPointSaveReq
|
|
if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
br.Msg = "参数解析异常"
|
|
br.Msg = "参数解析异常"
|
|
br.ErrMsg = fmt.Sprintf("参数解析失败,%v", e)
|
|
br.ErrMsg = fmt.Sprintf("参数解析失败,%v", e)
|
|
@@ -697,12 +709,16 @@ func (this *ReportOpenController) ViewPointSave() {
|
|
br.Msg = "观点分类不能为空"
|
|
br.Msg = "观点分类不能为空"
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if req.DataDate == nil {
|
|
|
|
|
|
+ if req.DataDate == "" {
|
|
br.Msg = "观点日期不能为空"
|
|
br.Msg = "观点日期不能为空"
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
- msg, err := services.ViewPointSave(req.Id, 0, "", req.Title, req.Content, req.DataSource, req.Category, 0, req.DataDate)
|
|
|
|
|
|
+ dataDate, err := time.Parse(utils.FormatDateTime, req.DataDate)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "观点日期格式不正确"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ msg, err := services.ViewPointSave(req.Id, 0, "", req.Title, req.Content, req.DataSource, req.Category, 0, &dataDate)
|
|
if err != nil {
|
|
if err != nil {
|
|
if msg == "" {
|
|
if msg == "" {
|
|
msg = "保存观点失败"
|
|
msg = "保存观点失败"
|
|
@@ -716,3 +732,51 @@ func (this *ReportOpenController) ViewPointSave() {
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// @Title 观点删除
|
|
|
|
+// @Description 观点删除
|
|
|
|
+// @Param request body models.ReportViewPointReq true "type json string"
|
|
|
|
+// @Success 200 string "操作成功"
|
|
|
|
+// @router /viewpoint/delete [post]
|
|
|
|
+func (this *ReportOpenController) ViewPointDelete() {
|
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
|
+ defer func() {
|
|
|
|
+ if br.ErrMsg == "" {
|
|
|
|
+ br.IsSendEmail = false
|
|
|
|
+ }
|
|
|
|
+ this.Data["json"] = br
|
|
|
|
+ this.ServeJSON()
|
|
|
|
+ }()
|
|
|
|
+ var req *models.ReportViewPointDeleteRep
|
|
|
|
+ if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
|
|
+ br.Msg = "参数解析异常"
|
|
|
|
+ br.ErrMsg = fmt.Sprintf("参数解析失败,%v", e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if req.Id == nil {
|
|
|
|
+ br.Msg = "观点ID不能为空"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ obj := new(models.KnowledgeResource)
|
|
|
|
+ obj, err := obj.GetKnowledgeResourceByOutId(*req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ if utils.IsErrNoRow(err) {
|
|
|
|
+ br.Msg = "观点不存在"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ br.Msg = "删除观点失败"
|
|
|
|
+ br.ErrMsg = fmt.Sprintf("删除观点失败, %v", err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ obj.IsDelete = 1
|
|
|
|
+ if err = obj.Update([]string{"IsDelete"}); err != nil {
|
|
|
|
+ br.Msg = "删除观点失败"
|
|
|
|
+ br.ErrMsg = fmt.Sprintf("删除观点失败, %v", err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ br.Msg = "删除观点成功"
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Ret = 200
|
|
|
|
+}
|