|
@@ -87,3 +87,71 @@ func (this *ChartPermissionController) Sync(c *gin.Context) {
|
|
|
}
|
|
|
resp.Ok("操作成功", c)
|
|
|
}
|
|
|
+
|
|
|
+// SyncReportMapping
|
|
|
+// @Title 同步chart_permission_chapter_mapping数据
|
|
|
+// @Description 启用/禁用品种
|
|
|
+// @Param request body crm.PermissionEnabledReq true "type json string"
|
|
|
+// @Success 200 新增成功
|
|
|
+// @router /crm/chart_permission/report/sync [post]
|
|
|
+func (this *ChartPermissionController) SyncReportMapping(c *gin.Context) {
|
|
|
+ var req crm.PermissionReportReq
|
|
|
+ err := c.Bind(&req)
|
|
|
+ if err != nil {
|
|
|
+ errs, ok := err.(validator.ValidationErrors)
|
|
|
+ if !ok {
|
|
|
+ resp.FailData("参数解析失败", "Err:"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.FailData("参数解析失败", errs.Translate(global.Trans), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.ReportId <= 0 {
|
|
|
+ resp.Fail("报告ID不能为空", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.ClassifyNameSecond == "" {
|
|
|
+ resp.Fail("报告分类不能为空", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ e, msg := crmService.SyncChartPermissionReportMapping(req)
|
|
|
+ if e != nil {
|
|
|
+ resp.FailData(msg, e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.Ok("操作成功", c)
|
|
|
+}
|
|
|
+
|
|
|
+// SyncKeywordMapping
|
|
|
+// @Title 同步chart_permission_search_key_word_mapping数据
|
|
|
+// @Description 同步chart_permission_search_key_word_mapping数据
|
|
|
+// @Param request body crm.PermissionKeywordReq true "type json string"
|
|
|
+// @Success 200 新增成功
|
|
|
+// @router /crm/chart_permission/keyword/sync [post]
|
|
|
+func (this *ChartPermissionController) SyncKeywordMapping(c *gin.Context) {
|
|
|
+ var req crm.PermissionKeywordReq
|
|
|
+ err := c.Bind(&req)
|
|
|
+ if err != nil {
|
|
|
+ errs, ok := err.(validator.ValidationErrors)
|
|
|
+ if !ok {
|
|
|
+ resp.FailData("参数解析失败", "Err:"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.FailData("参数解析失败", errs.Translate(global.Trans), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.NewKeyword == "" {
|
|
|
+ resp.Fail("新报告分类名称不能为空", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.Keyword == "" {
|
|
|
+ resp.Fail("报告分类名称不能为空", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ e := crm.UpdateChartPermissionNameFromMappingByKeyword(req.NewKeyword, req.Keyword, "rddp")
|
|
|
+ if e != nil {
|
|
|
+ resp.FailData("更新权限中的报告分类名称失败", e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.Ok("操作成功", c)
|
|
|
+}
|