|
|
@@ -0,0 +1,523 @@
|
|
|
+package com.fs.company.controller.aiAddwxSop;
|
|
|
+
|
|
|
+import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.common.utils.ServletUtils;
|
|
|
+import com.fs.common.utils.poi.ExcelUtil;
|
|
|
+import com.fs.company.domain.*;
|
|
|
+import com.fs.company.param.InitAddWxSopTestParam;
|
|
|
+import com.fs.company.service.*;
|
|
|
+import com.fs.framework.security.LoginUser;
|
|
|
+import com.fs.framework.service.TokenService;
|
|
|
+import com.fs.qw.domain.QwExternalContact;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * AI添加微信SOP工作流Controller
|
|
|
+ *
|
|
|
+ * @author fs
|
|
|
+ * @date 2026-06-24
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/aiAddwxSop")
|
|
|
+public class AiAddwxSopController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAiAddwxSopTemplateService templateService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAiAddwxSopTemplateNodeService templateNodeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAiAddwxSopUserWorkflowService userWorkflowService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAiAddwxSopUserNodeService userNodeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAiAddwxSopExecLogService execLogService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAiAddwxSopTemplateNodeRuleService templateNodeRuleService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAiAddwxSopUserNodeRuleService userNodeRuleService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAiAddwxSopTagTemplateBindService tagTemplateBindService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
+
|
|
|
+ // ==================== 模板管理 ====================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询模板列表
|
|
|
+ */
|
|
|
+ @GetMapping("/template/list")
|
|
|
+ public TableDataInfo templateList(AiAddwxSopTemplate template) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ template.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ startPage();
|
|
|
+ List<AiAddwxSopTemplate> list = templateService.selectAiAddwxSopTemplateList(template);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取模板详情(含节点列表)
|
|
|
+ */
|
|
|
+ @GetMapping("/template/{templateId}")
|
|
|
+ public AjaxResult templateDetail(@PathVariable Long templateId) {
|
|
|
+ AiAddwxSopTemplate template = templateService.selectAiAddwxSopTemplateById(templateId);
|
|
|
+ if (template == null) {
|
|
|
+ return AjaxResult.error("模板不存在");
|
|
|
+ }
|
|
|
+ List<AiAddwxSopTemplateNode> nodes = templateNodeService.selectAiAddwxSopTemplateNodeByTemplateId(templateId);
|
|
|
+ AjaxResult result = AjaxResult.success(template);
|
|
|
+ result.put("nodes", nodes);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增模板
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/template")
|
|
|
+ public AjaxResult addTemplate(@RequestBody AiAddwxSopTemplate template) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ template.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ template.setDelFlag(0);
|
|
|
+ template.setVersion(1);
|
|
|
+ Long templateId = templateService.insertAiAddwxSopTemplate(template);
|
|
|
+ return AjaxResult.success(templateId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改模板
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/template")
|
|
|
+ public AjaxResult editTemplate(@RequestBody AiAddwxSopTemplate template) {
|
|
|
+ templateService.updateAiAddwxSopTemplate(template);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除模板
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/template/{templateIds}")
|
|
|
+ public AjaxResult removeTemplate(@PathVariable Long[] templateIds) {
|
|
|
+ templateService.deleteAiAddwxSopTemplateByIds(templateIds);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存模板及节点(含节点增删改)
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/template/saveWithNodes")
|
|
|
+ public AjaxResult saveTemplateWithNodes(@RequestBody AiAddwxSopTemplate template) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ template.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ // nodes通过请求体中的额外字段传入,此处简化处理
|
|
|
+ Long templateId = templateService.saveTemplateWithNodes(template, null);
|
|
|
+ return AjaxResult.success(templateId);
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 模板节点管理 ====================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询模板节点列表
|
|
|
+ */
|
|
|
+ @GetMapping("/templateNode/list/{templateId}")
|
|
|
+ public AjaxResult templateNodeList(@PathVariable Long templateId) {
|
|
|
+ List<AiAddwxSopTemplateNode> list = templateNodeService.selectAiAddwxSopTemplateNodeByTemplateId(templateId);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取模板节点详情
|
|
|
+ */
|
|
|
+ @GetMapping("/templateNode/{nodeId}")
|
|
|
+ public AjaxResult templateNodeDetail(@PathVariable Long nodeId) {
|
|
|
+ return AjaxResult.success(templateNodeService.selectAiAddwxSopTemplateNodeById(nodeId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增模板节点
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板节点", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/templateNode")
|
|
|
+ public AjaxResult addTemplateNode(@RequestBody AiAddwxSopTemplateNode node) {
|
|
|
+ templateNodeService.insertAiAddwxSopTemplateNode(node);
|
|
|
+ return AjaxResult.success(node.getNodeId());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改模板节点
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板节点", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/templateNode")
|
|
|
+ public AjaxResult editTemplateNode(@RequestBody AiAddwxSopTemplateNode node) {
|
|
|
+ templateNodeService.updateAiAddwxSopTemplateNode(node);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除模板节点
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板节点", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/templateNode/{nodeId}")
|
|
|
+ public AjaxResult removeTemplateNode(@PathVariable Long nodeId) {
|
|
|
+ templateNodeService.deleteAiAddwxSopTemplateNodeById(nodeId);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 模板节点规则管理 ====================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询节点规则列表
|
|
|
+ */
|
|
|
+ @GetMapping("/templateNodeRule/list/{nodeId}")
|
|
|
+ public AjaxResult templateNodeRuleList(@PathVariable Long nodeId) {
|
|
|
+ List<AiAddwxSopTemplateNodeRule> list = templateNodeRuleService.selectAiAddwxSopTemplateNodeRuleByNodeId(nodeId);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取节点规则详情
|
|
|
+ */
|
|
|
+ @GetMapping("/templateNodeRule/{ruleId}")
|
|
|
+ public AjaxResult templateNodeRuleDetail(@PathVariable Long ruleId) {
|
|
|
+ return AjaxResult.success(templateNodeRuleService.selectAiAddwxSopTemplateNodeRuleById(ruleId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增节点规则
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板节点规则", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/templateNodeRule")
|
|
|
+ public AjaxResult addTemplateNodeRule(@RequestBody AiAddwxSopTemplateNodeRule rule) {
|
|
|
+ templateNodeRuleService.insertAiAddwxSopTemplateNodeRule(rule);
|
|
|
+ return AjaxResult.success(rule.getRuleId());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改节点规则
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板节点规则", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/templateNodeRule")
|
|
|
+ public AjaxResult editTemplateNodeRule(@RequestBody AiAddwxSopTemplateNodeRule rule) {
|
|
|
+ templateNodeRuleService.updateAiAddwxSopTemplateNodeRule(rule);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除节点规则
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP模板节点规则", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/templateNodeRule/{ruleId}")
|
|
|
+ public AjaxResult removeTemplateNodeRule(@PathVariable Long ruleId) {
|
|
|
+ templateNodeRuleService.deleteAiAddwxSopTemplateNodeRuleById(ruleId);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 个人工作流管理 ====================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询个人工作流列表
|
|
|
+ */
|
|
|
+ @GetMapping("/userWorkflow/list")
|
|
|
+ public TableDataInfo userWorkflowList(AiAddwxSopUserWorkflow userWorkflow) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ userWorkflow.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ startPage();
|
|
|
+ List<AiAddwxSopUserWorkflow> list = userWorkflowService.selectAiAddwxSopUserWorkflowList(userWorkflow);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取个人工作流详情(含节点树)
|
|
|
+ */
|
|
|
+ @GetMapping("/userWorkflow/{userWorkflowId}")
|
|
|
+ public AjaxResult userWorkflowDetail(@PathVariable Long userWorkflowId) {
|
|
|
+ AiAddwxSopUserWorkflow workflow = userWorkflowService.selectAiAddwxSopUserWorkflowById(userWorkflowId);
|
|
|
+ if (workflow == null) {
|
|
|
+ return AjaxResult.error("工作流不存在");
|
|
|
+ }
|
|
|
+ List<AiAddwxSopUserNode> nodes = userWorkflowService.selectUserNodesByWorkflowId(userWorkflowId);
|
|
|
+ AjaxResult result = AjaxResult.success(workflow);
|
|
|
+ result.put("nodes", nodes);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据模板创建个人工作流
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP个人工作流", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/userWorkflow/createFromTemplate")
|
|
|
+ public AjaxResult createFromTemplate(@RequestParam Long templateId
|
|
|
+// , @RequestParam Long businessKey
|
|
|
+ ) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long companyUserId = loginUser.getUser().getUserId();
|
|
|
+ Long companyId = loginUser.getCompany().getCompanyId();
|
|
|
+ Long userWorkflowId = userWorkflowService.createUserWorkflowFromTemplate(templateId, companyUserId, companyId
|
|
|
+// , businessKey
|
|
|
+ );
|
|
|
+ return AjaxResult.success(userWorkflowId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 推进工作流到下一节点
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP个人工作流", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/userWorkflow/advance")
|
|
|
+ public AjaxResult advanceWorkflow(@RequestParam Long userWorkflowId, @RequestParam Long currentNodeId) {
|
|
|
+ userWorkflowService.advanceToNextNode(userWorkflowId, currentNodeId);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改个人工作流
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP个人工作流", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/userWorkflow")
|
|
|
+ public AjaxResult editUserWorkflow(@RequestBody AiAddwxSopUserWorkflow userWorkflow) {
|
|
|
+ userWorkflowService.updateAiAddwxSopUserWorkflow(userWorkflow);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除个人工作流
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP个人工作流", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/userWorkflow/{userWorkflowIds}")
|
|
|
+ public AjaxResult removeUserWorkflow(@PathVariable Long[] userWorkflowIds) {
|
|
|
+ userWorkflowService.deleteAiAddwxSopUserWorkflowByIds(userWorkflowIds);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 个人节点管理 ====================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询个人节点列表
|
|
|
+ */
|
|
|
+ @GetMapping("/userNode/list/{userWorkflowId}")
|
|
|
+ public AjaxResult userNodeList(@PathVariable Long userWorkflowId) {
|
|
|
+ List<AiAddwxSopUserNode> list = userNodeService.selectAiAddwxSopUserNodeByWorkflowId(userWorkflowId);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取个人节点详情
|
|
|
+ */
|
|
|
+ @GetMapping("/userNode/{userNodeId}")
|
|
|
+ public AjaxResult userNodeDetail(@PathVariable Long userNodeId) {
|
|
|
+ return AjaxResult.success(userNodeService.selectAiAddwxSopUserNodeById(userNodeId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改个人节点(含提示词、条件等)
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP个人节点", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/userNode")
|
|
|
+ public AjaxResult editUserNode(@RequestBody AiAddwxSopUserNode userNode) {
|
|
|
+ userNodeService.updateAiAddwxSopUserNode(userNode);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新节点状态
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP个人节点", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/userNode/status")
|
|
|
+ public AjaxResult updateNodeStatus(@RequestParam Long userNodeId, @RequestParam Integer status) {
|
|
|
+ userNodeService.updateNodeStatus(userNodeId, status);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 个人节点规则管理 ====================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询个人节点规则列表
|
|
|
+ */
|
|
|
+ @GetMapping("/userNodeRule/list/{userNodeId}")
|
|
|
+ public AjaxResult userNodeRuleList(@PathVariable Long userNodeId) {
|
|
|
+ List<AiAddwxSopUserNodeRule> list = userNodeRuleService.selectAiAddwxSopUserNodeRuleByUserNodeId(userNodeId);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取个人节点规则详情
|
|
|
+ */
|
|
|
+ @GetMapping("/userNodeRule/{userNodeRuleId}")
|
|
|
+ public AjaxResult userNodeRuleDetail(@PathVariable Long userNodeRuleId) {
|
|
|
+ return AjaxResult.success(userNodeRuleService.selectAiAddwxSopUserNodeRuleById(userNodeRuleId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增个人节点规则
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP个人节点规则", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/userNodeRule")
|
|
|
+ public AjaxResult addUserNodeRule(@RequestBody AiAddwxSopUserNodeRule rule) {
|
|
|
+ userNodeRuleService.insertAiAddwxSopUserNodeRule(rule);
|
|
|
+ return AjaxResult.success(rule.getUserNodeRuleId());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改个人节点规则
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP个人节点规则", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/userNodeRule")
|
|
|
+ public AjaxResult editUserNodeRule(@RequestBody AiAddwxSopUserNodeRule rule) {
|
|
|
+ userNodeRuleService.updateAiAddwxSopUserNodeRule(rule);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除个人节点规则
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP个人节点规则", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/userNodeRule/{userNodeRuleId}")
|
|
|
+ public AjaxResult removeUserNodeRule(@PathVariable Long userNodeRuleId) {
|
|
|
+ userNodeRuleService.deleteAiAddwxSopUserNodeRuleById(userNodeRuleId);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 执行日志管理 ====================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询执行日志列表
|
|
|
+ */
|
|
|
+ @GetMapping("/execLog/list")
|
|
|
+ public TableDataInfo execLogList(AiAddwxSopExecLog execLog) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ execLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ startPage();
|
|
|
+ List<AiAddwxSopExecLog> list = execLogService.selectAiAddwxSopExecLogList(execLog);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据工作流ID查询执行日志
|
|
|
+ */
|
|
|
+ @GetMapping("/execLog/workflow/{userWorkflowId}")
|
|
|
+ public AjaxResult execLogByWorkflow(@PathVariable Long userWorkflowId) {
|
|
|
+ List<AiAddwxSopExecLog> list = execLogService.selectAiAddwxSopExecLogByWorkflowId(userWorkflowId);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据节点ID查询执行日志
|
|
|
+ */
|
|
|
+ @GetMapping("/execLog/node/{userNodeId}")
|
|
|
+ public AjaxResult execLogByNode(@PathVariable Long userNodeId) {
|
|
|
+ List<AiAddwxSopExecLog> list = execLogService.selectAiAddwxSopExecLogByNodeId(userNodeId);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取执行日志详情
|
|
|
+ */
|
|
|
+ @GetMapping("/execLog/{logId}")
|
|
|
+ public AjaxResult execLogDetail(@PathVariable Long logId) {
|
|
|
+ return AjaxResult.success(execLogService.selectAiAddwxSopExecLogById(logId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出执行日志
|
|
|
+ */
|
|
|
+ @Log(title = "AI添加微信SOP执行日志", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/execLog/export")
|
|
|
+ public AjaxResult exportExecLog(AiAddwxSopExecLog execLog) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ execLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ List<AiAddwxSopExecLog> list = execLogService.selectAiAddwxSopExecLogList(execLog);
|
|
|
+ ExcelUtil<AiAddwxSopExecLog> util = new ExcelUtil<>(AiAddwxSopExecLog.class);
|
|
|
+ return util.exportExcel(list, "执行日志数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 标签模板绑定管理 ====================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询标签模板绑定列表
|
|
|
+ */
|
|
|
+ @GetMapping("/tagTemplateBind/list")
|
|
|
+ public TableDataInfo tagTemplateBindList(AiAddwxSopTagTemplateBind bind) {
|
|
|
+ startPage();
|
|
|
+ List<AiAddwxSopTagTemplateBind> list = tagTemplateBindService.selectAiAddwxSopTagTemplateBindList(bind);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据标签ID查询绑定
|
|
|
+ */
|
|
|
+ @GetMapping("/tagTemplateBind/byTag/{qwTagId}")
|
|
|
+ public AjaxResult tagTemplateBindByTag(@PathVariable Long qwTagId) {
|
|
|
+ AiAddwxSopTagTemplateBind bind = tagTemplateBindService.selectAiAddwxSopTagTemplateBindByTagId(qwTagId);
|
|
|
+ return AjaxResult.success(bind);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增标签模板绑定(一个标签只能绑定一个模板,如已存在则更新)
|
|
|
+ */
|
|
|
+ @Log(title = "标签模板绑定", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/tagTemplateBind")
|
|
|
+ public AjaxResult addTagTemplateBind(@RequestBody AiAddwxSopTagTemplateBind bind) {
|
|
|
+ // 检查该标签是否已绑定
|
|
|
+ AiAddwxSopTagTemplateBind exist = tagTemplateBindService.selectTagBindBytagIdAndTemplateId(bind);
|
|
|
+// AiAddwxSopTagTemplateBind exist = tagTemplateBindService.selectAiAddwxSopTagTemplateBindByTagId(bind.getQwTagId());
|
|
|
+ if (exist != null) {
|
|
|
+// // 已存在则更新
|
|
|
+// bind.setBindId(exist.getBindId());
|
|
|
+// tagTemplateBindService.updateAiAddwxSopTagTemplateBind(bind);
|
|
|
+ return AjaxResult.error("已存在该标签与该模板绑定关系");
|
|
|
+ }
|
|
|
+ tagTemplateBindService.insertAiAddwxSopTagTemplateBind(bind);
|
|
|
+ return AjaxResult.success(bind.getBindId());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改标签模板绑定
|
|
|
+ */
|
|
|
+ @Log(title = "标签模板绑定", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/tagTemplateBind")
|
|
|
+ public AjaxResult editTagTemplateBind(@RequestBody AiAddwxSopTagTemplateBind bind) {
|
|
|
+ tagTemplateBindService.updateAiAddwxSopTagTemplateBind(bind);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除标签模板绑定
|
|
|
+ */
|
|
|
+ @Log(title = "标签模板绑定", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/tagTemplateBind/{bindIds}")
|
|
|
+ public AjaxResult removeTagTemplateBind(@PathVariable Long[] bindIds) {
|
|
|
+ for (Long bindId : bindIds) {
|
|
|
+ tagTemplateBindService.deleteAiAddwxSopTagTemplateBindById(bindId);
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 测试
|
|
|
+
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/initAddWxSop")
|
|
|
+ public AjaxResult initAddWxSop(@RequestBody InitAddWxSopTestParam params){
|
|
|
+ templateService.initAddWxSop(params.getContacts(),params.getTagIds());
|
|
|
+
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+}
|