Browse Source

Merge remote-tracking branch 'origin/saas-api' into saas-api

xgb 1 week ago
parent
commit
99421fecba
18 changed files with 561 additions and 20 deletions
  1. 98 3
      fs-admin-saas/src/main/java/com/fs/company/controller/CompanyVoiceRoboticController.java
  2. 160 0
      fs-admin-saas/src/main/java/com/fs/company/controller/CompanyWorkflowController.java
  3. 53 0
      fs-company/src/main/java/com/fs/company/controller/company/CompanyWxAccountController.java
  4. 36 0
      fs-company/src/main/java/com/fs/company/controller/company/WxContactController.java
  5. 36 0
      fs-company/src/main/java/com/fs/company/controller/company/WxMsgLogController.java
  6. 2 0
      fs-service/src/main/java/com/fs/company/mapper/CompanyWorkflowMapper.java
  7. 5 1
      fs-service/src/main/java/com/fs/company/service/ICompanyVoiceRoboticService.java
  8. 5 0
      fs-service/src/main/java/com/fs/company/service/ICompanyWorkflowService.java
  9. 7 0
      fs-service/src/main/java/com/fs/company/service/impl/CompanyVoiceRoboticServiceImpl.java
  10. 5 0
      fs-service/src/main/java/com/fs/company/service/impl/CompanyWorkflowServiceImpl.java
  11. 4 14
      fs-service/src/main/java/com/fs/company/service/impl/CompanyWxServiceImpl.java
  12. 1 0
      fs-service/src/main/java/com/fs/wxcid/domain/WxMsgLog.java
  13. 1 0
      fs-service/src/main/java/com/fs/wxcid/service/impl/WxMsgLogServiceImpl.java
  14. 1 0
      fs-service/src/main/java/com/fs/wxcid/vo/wxvo/WxSendResultMsgVo.java
  15. 4 0
      fs-service/src/main/resources/mapper/company/CompanyWorkflowMapper.xml
  16. 9 1
      fs-service/src/main/resources/mapper/wxcid/WxContactMapper.xml
  17. 133 0
      fs-service/src/main/resources/mapper/wxcid/WxMsgLogMapper.xml
  18. 1 1
      fs-wx-api/src/main/java/com/fs/app/websocket/service/WebSocketServer.java

+ 98 - 3
fs-admin-saas/src/main/java/com/fs/company/controller/CompanyVoiceRoboticController.java

@@ -6,7 +6,10 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.SecurityUtils;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.aicall.domain.TaskInfo;
+import com.fs.aicall.service.AiCallService;
 import com.fs.company.domain.CompanyVoiceRobotic;
 import com.fs.company.domain.CompanyVoiceRoboticCallees;
 import com.fs.company.domain.CompanyVoiceRoboticWx;
@@ -17,7 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 机器人外呼任务Controller(SaaS管理端)
@@ -38,6 +42,9 @@ public class CompanyVoiceRoboticController extends BaseController {
     @Autowired
     private ICompanyVoiceRoboticWxService companyVoiceRoboticWxService;
 
+    @Autowired
+    private AiCallService aiCallService;
+
     /**
      * 查询机器人外呼任务列表(分页)
      */
@@ -114,7 +121,7 @@ public class CompanyVoiceRoboticController extends BaseController {
     /**
      * 新增机器人外呼任务
      */
-    @PreAuthorize("@ss.hasPermi('company:companyVoiceRobotic:add')")
+    @PreAuthorize("@ss.hasPermi('system:companyVoiceRobotic:add')")
     @Log(title = "机器人外呼任务", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody CompanyVoiceRobotic companyVoiceRobotic) {
@@ -134,7 +141,7 @@ public class CompanyVoiceRoboticController extends BaseController {
     /**
      * 删除机器人外呼任务
      */
-    @PreAuthorize("@ss.hasPermi('company:companyVoiceRobotic:remove')")
+    @PreAuthorize("@ss.hasPermi('system:companyVoiceRobotic:remove')")
     @Log(title = "机器人外呼任务", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
@@ -149,4 +156,92 @@ public class CompanyVoiceRoboticController extends BaseController {
     public R companyUserList() {
         return R.ok().put("data", companyVoiceRoboticService.qwUserList());
     }
+
+    /**
+     * 启动任务(管理端适配:总后台无 LoginUser.company,通过 SecurityUtils 获取 tenantId)
+     */
+    @GetMapping("/taskRun")
+    public R taskRun(Long id) {
+        Long tenantId = SecurityUtils.getTenantId();
+        companyVoiceRoboticService.taskRun(id, tenantId);
+        return R.ok();
+    }
+
+    /**
+     * 查询任务执行记录
+     */
+    @GetMapping("/execRecords")
+    public R getExecRecords(@RequestParam Long roboticId,
+                            @RequestParam(defaultValue = "1") Integer pageNum,
+                            @RequestParam(defaultValue = "10") Integer pageSize,
+                            @RequestParam(required = false) String customerName,
+                            @RequestParam(required = false) String customerPhone,
+                            @RequestParam Boolean onlyCallNode) {
+        return R.ok(companyVoiceRoboticService.getExecRecords(roboticId, pageNum, pageSize,
+                customerName, customerPhone, onlyCallNode, null));
+    }
+
+    /**
+     * 查询外呼任务运行状态(管理端适配:通过 taskId 查 companyId 后调用 AiCallService)
+     */
+    @GetMapping("/statusList")
+    public R statusList(String ids) {
+        if (aiCallService == null) {
+            return R.error("管理后台暂不支持查询外呼状态");
+        }
+        List<String> taskIdList = Arrays.stream(ids.split(","))
+                .filter(s -> s != null && !s.isEmpty())
+                .collect(Collectors.toList());
+        Map<String, Object> resultMap = new HashMap<>();
+        for (String taskId : taskIdList) {
+            Long companyId = getCompanyIdByTaskId(taskId);
+            if (companyId != null) {
+                try {
+                    resultMap.put(taskId, aiCallService.queryCallTaskInfo(
+                            TaskInfo.builder().taskID(taskId).build(), companyId));
+                } catch (Exception ignored) {
+                }
+            }
+        }
+        return R.ok().put("data", resultMap);
+    }
+
+    /**
+     * 开启外呼任务(管理端适配)
+     */
+    @GetMapping("/startRobotic")
+    public R startRobotic(String taskId) {
+        if (aiCallService == null) {
+            return R.error("管理后台暂不支持开启外呼任务");
+        }
+        Long companyId = getCompanyIdByTaskId(taskId);
+        if (companyId == null) {
+            return R.error("未找到任务对应的公司");
+        }
+        aiCallService.startCallTask(TaskInfo.builder().taskID(taskId).build(), companyId);
+        return R.ok();
+    }
+
+    /**
+     * 停止外呼任务(管理端适配)
+     */
+    @GetMapping("/stopRobotic")
+    public R stopRobotic(String taskId) {
+        if (aiCallService == null) {
+            return R.error("管理后台暂不支持停止外呼任务");
+        }
+        Long companyId = getCompanyIdByTaskId(taskId);
+        if (companyId == null) {
+            return R.error("未找到任务对应的公司");
+        }
+        aiCallService.stopCallTask(TaskInfo.builder().taskID(taskId).build(), companyId);
+        return R.ok();
+    }
+
+    /**
+     * 通过 taskId 查询对应的 companyId
+     */
+    private Long getCompanyIdByTaskId(String taskId) {
+        return companyVoiceRoboticService.getCompanyIdByTaskId(taskId);
+    }
 }

+ 160 - 0
fs-admin-saas/src/main/java/com/fs/company/controller/CompanyWorkflowController.java

@@ -0,0 +1,160 @@
+package com.fs.company.controller;
+
+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.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.CompanyWorkflow;
+import com.fs.company.domain.CompanyWorkflowNodeType;
+import com.fs.company.param.CompanyWorkflowSaveParam;
+import com.fs.company.param.CompanyWorkflowUpdateBindWCParam;
+import com.fs.company.service.ICompanyWorkflowService;
+import com.fs.company.vo.OptionVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * AI工作流Controller(fs-admin-saas 桥接)
+ * <p>
+ * 原 CompanyWorkflowController 位于 com.fs.company.controller.company 子包下,
+ * 该子包在 fs-saasadmin 中被排除加载,本控制器在根包下提供相同的 API 端点。
+ * 总后台无 LoginUser.company 上下文,通过参数传递或 service 方法适配。
+ *
+ * @author fs
+ * @date 2026-01-06
+ */
+@RestController
+@RequestMapping("/company/companyWorkflow")
+public class CompanyWorkflowController extends BaseController {
+
+    @Autowired
+    private ICompanyWorkflowService companyWorkflowService;
+
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyWorkflow fsAiWorkflow) {
+        startPage();
+        List<CompanyWorkflow> list = companyWorkflowService.selectCompanyWorkflowList(fsAiWorkflow);
+        return getDataTable(list);
+    }
+
+    @Log(title = "AI工作流", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyWorkflow fsAiWorkflow) {
+        List<CompanyWorkflow> list = companyWorkflowService.selectCompanyWorkflowList(fsAiWorkflow);
+        ExcelUtil<CompanyWorkflow> util = new ExcelUtil<CompanyWorkflow>(CompanyWorkflow.class);
+        return util.exportExcel(list, "AI工作流数据");
+    }
+
+    @GetMapping(value = "/{workflowId}")
+    public AjaxResult getInfo(@PathVariable("workflowId") Long workflowId) {
+        return AjaxResult.success(companyWorkflowService.selectCompanyWorkflowById(workflowId));
+    }
+
+    /**
+     * 保存AI工作流(管理端适配:companyId、companyUserId 从请求体获取)
+     */
+    @Log(title = "AI工作流", businessType = BusinessType.INSERT)
+    @PostMapping("/save")
+    public AjaxResult save(@RequestBody CompanyWorkflowSaveParam param) {
+        Long workflowId = companyWorkflowService.saveCompanyWorkflow(param);
+        return AjaxResult.success(workflowId);
+    }
+
+    @Log(title = "AI工作流", businessType = BusinessType.UPDATE)
+    @PutMapping("/status/{workflowId}/{status}")
+    public AjaxResult updateStatus(@PathVariable("workflowId") Long workflowId,
+                                   @PathVariable("status") Integer status) {
+        return toAjax(companyWorkflowService.updateCompanyWorkflowStatus(workflowId, status));
+    }
+
+    @Log(title = "AI工作流", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{workflowIds}")
+    public AjaxResult remove(@PathVariable Long[] workflowIds) {
+        return toAjax(companyWorkflowService.deleteCompanyWorkflowByIds(workflowIds));
+    }
+
+    @Log(title = "AI工作流", businessType = BusinessType.INSERT)
+    @PostMapping("/copy/{workflowId}")
+    public AjaxResult copy(@PathVariable("workflowId") Long workflowId) {
+        Long newWorkflowId = companyWorkflowService.copyCompanyWorkflow(workflowId);
+        if (newWorkflowId != null) {
+            return AjaxResult.success(newWorkflowId);
+        }
+        return AjaxResult.error("复制失败,工作流不存在");
+    }
+
+    @GetMapping("/nodeTypes")
+    public AjaxResult getNodeTypes() {
+        List<CompanyWorkflowNodeType> list = companyWorkflowService.selectAllEnabledNodeTypes();
+        return AjaxResult.success(list);
+    }
+
+    @GetMapping("/exportJson/{workflowId}")
+    public AjaxResult exportJson(@PathVariable("workflowId") Long workflowId) {
+        return AjaxResult.success(companyWorkflowService.exportWorkflowJson(workflowId));
+    }
+
+    @GetMapping("/listCompanyUser")
+    public AjaxResult listCompanyUser() {
+        return AjaxResult.success(companyWorkflowService.listCompanyUser());
+    }
+
+    @GetMapping("/getCompanyUserById/{companyUserId}")
+    public AjaxResult getCompanyUserById(@PathVariable("companyUserId") Long companyUserId) {
+        return AjaxResult.success(companyWorkflowService.getCompanyUserById(companyUserId));
+    }
+
+    @GetMapping("/getBindCompanyUserByWorkflowId/{workflowId}")
+    public AjaxResult getBindCompanyUserByWorkflowId(@PathVariable("workflowId") Long workflowId) {
+        return AjaxResult.success(companyWorkflowService.getBindCompanyUserByWorkflowId(workflowId));
+    }
+
+    @PostMapping("/updateWorkflowBindCompanyUser")
+    public AjaxResult updateWorkflowBindCompanyUser(@RequestBody CompanyWorkflowUpdateBindWCParam param) {
+        return companyWorkflowService.updateWorkflowBindCompanyUser(param);
+    }
+
+    /**
+     * 获取工作流下拉列表(管理端适配)
+     * 总后台无当前公司上下文,查询全部公司的工作流。
+     * 传入 companyId 参数时可过滤指定公司。
+     */
+    @GetMapping("/optionList")
+    public R optionList(@RequestParam(required = false) Long companyId) {
+        List<OptionVO> result;
+        if (companyId == null) {
+            result = companyWorkflowService.optionListAll();
+        } else {
+            result = companyWorkflowService.optionList(companyId);
+        }
+        return R.ok().put("data", result != null ? result : new ArrayList<>());
+    }
+
+    @GetMapping("/versionList/{workflowId}")
+    public AjaxResult versionList(@PathVariable Long workflowId) {
+        return AjaxResult.success(companyWorkflowService.selectVersionListByWorkflowId(workflowId));
+    }
+
+    @GetMapping("/versionDetail/{versionId}")
+    public AjaxResult versionDetail(@PathVariable Long versionId) {
+        return AjaxResult.success(companyWorkflowService.selectVersionDetailByVersionId(versionId));
+    }
+
+    @PostMapping("/versionRollback/{versionId}")
+    public AjaxResult rollbackVersion(@PathVariable Long versionId) {
+        Long workflowId = companyWorkflowService.rollbackWorkflowVersion(versionId, null);
+        return AjaxResult.success(workflowId);
+    }
+
+    @GetMapping("/nodeTypeCodes/{workflowId}")
+    public R getNodeTypeCodes(@PathVariable("workflowId") Long workflowId) {
+        List<String> typeCodes = companyWorkflowService.selectNodeTypeCodesByWorkflowId(workflowId);
+        return R.ok().put("data", typeCodes);
+    }
+}

+ 53 - 0
fs-company/src/main/java/com/fs/company/controller/company/CompanyWxAccountController.java

@@ -214,4 +214,57 @@ public class CompanyWxAccountController extends BaseController
         companyWxAccountService.syncWx(accountId);
         return R.ok();
     }
+
+    /**
+     * 获取微信登录二维码
+     */
+    @GetMapping("/getWxQrCode")
+    public R getWxQrCode(@RequestParam("accountId") Long accountId, @RequestParam(value = "ipadOrMac", required = false) String ipadOrMac){
+        String url = companyWxAccountService.getWxQrCode(accountId, ipadOrMac);
+        return R.ok().put("data", url);
+    }
+
+    /**
+     * 获取登录状态
+     */
+    @GetMapping("/getLoginStatus")
+    public R getLoginStatus(@RequestParam("accountId") Long accountId){
+        boolean status = companyWxAccountService.getLoginStatus(accountId);
+        return R.ok().put("data", status);
+    }
+
+    /**
+     * 绑定服务(获取PAD)
+     */
+    @GetMapping("/bindService")
+    public R bindService(@RequestParam("accountId") Long accountId){
+        return companyWxAccountService.bindService(accountId);
+    }
+
+    /**
+     * 唤醒登录
+     */
+    @GetMapping("/wakeUpLogin")
+    public R wakeUpLogin(@RequestParam("accountId") Long accountId){
+        companyWxAccountService.wakeUpLogin(accountId);
+        return R.ok();
+    }
+
+    /**
+     * 更新微信信息
+     */
+    @GetMapping("/updateWxInfo")
+    public R updateWxInfo(@RequestParam("accountId") Long accountId){
+        companyWxAccountService.updateWxInfo(accountId);
+        return R.ok().put("data", true);
+    }
+
+    /**
+     * 退出微信
+     */
+    @GetMapping("/wxLoginOut")
+    public R wxLoginOut(@RequestParam("accountId") Long accountId){
+        companyWxAccountService.wxLoginOut(accountId);
+        return R.ok().put("data", true);
+    }
 }

+ 36 - 0
fs-company/src/main/java/com/fs/company/controller/company/WxContactController.java

@@ -0,0 +1,36 @@
+package com.fs.company.controller.company;
+
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.wxcid.domain.WxContact;
+import com.fs.wxcid.service.IWxContactService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 个微联系人Controller
+ *
+ * @author fs
+ */
+@RestController
+@RequestMapping("/company/wxContact")
+public class WxContactController extends BaseController
+{
+    @Autowired
+    private IWxContactService wxContactService;
+
+    /**
+     * 查询个微联系人列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(WxContact wxContact)
+    {
+        startPage();
+        List<WxContact> list = wxContactService.selectWxContactList(wxContact);
+        return getDataTable(list);
+    }
+}

+ 36 - 0
fs-company/src/main/java/com/fs/company/controller/company/WxMsgLogController.java

@@ -0,0 +1,36 @@
+package com.fs.company.controller.company;
+
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.wxcid.domain.WxMsgLog;
+import com.fs.wxcid.service.IWxMsgLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 个微聊天记录Controller
+ *
+ * @author fs
+ */
+@RestController
+@RequestMapping("/company/wxMsgLog")
+public class WxMsgLogController extends BaseController
+{
+    @Autowired
+    private IWxMsgLogService wxMsgLogService;
+
+    /**
+     * 查询聊天记录列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(WxMsgLog wxMsgLog)
+    {
+        startPage();
+        List<WxMsgLog> list = wxMsgLogService.selectWxMsgLogList(wxMsgLog);
+        return getDataTable(list);
+    }
+}

+ 2 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyWorkflowMapper.java

@@ -57,4 +57,6 @@ public interface CompanyWorkflowMapper extends BaseMapper<CompanyWorkflow>  {
     List<CompanyWorkflowNodeVoiceVo> getMyWorkflowNodes(@Param("companyUserId") Long companyUserId);
 
     List<OptionVO> optionList(@Param("companyId") Long companyId);
+
+    List<OptionVO> optionListAll();
 }

+ 5 - 1
fs-service/src/main/java/com/fs/company/service/ICompanyVoiceRoboticService.java

@@ -127,5 +127,9 @@ public interface ICompanyVoiceRoboticService extends IService<CompanyVoiceRoboti
      * @return 追加结果(成功数、重复客户信息)
      */
     R appendCustomersToRunningTask(Long taskId, List<Long> customerIds);
-    
+
+    /**
+     * 通过三方任务ID查询公司ID(管理端适配)
+     */
+    Long getCompanyIdByTaskId(String taskId);
 }

+ 5 - 0
fs-service/src/main/java/com/fs/company/service/ICompanyWorkflowService.java

@@ -108,5 +108,10 @@ public interface ICompanyWorkflowService {
 
     List<OptionVO> optionList(Long companyId);
 
+    /**
+     * 获取全部工作流下拉列表(管理端适配,不限公司)
+     */
+    List<OptionVO> optionListAll();
+
     List<String> selectNodeTypeCodesByWorkflowId(Long workflowId);
 }

+ 7 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyVoiceRoboticServiceImpl.java

@@ -2416,4 +2416,11 @@ public class CompanyVoiceRoboticServiceImpl extends ServiceImpl<CompanyVoiceRobo
             log.error("重建CONTINUE:TIMER:EXECUTE Redis key异常, instanceId={}", exec.getWorkflowInstanceId(), e);
         }
     }
+
+    @Override
+    public Long getCompanyIdByTaskId(String taskId) {
+        CompanyVoiceRobotic robotic = companyVoiceRoboticMapper.selectOne(
+                new LambdaQueryWrapper<CompanyVoiceRobotic>().eq(CompanyVoiceRobotic::getTaskId, Long.valueOf(taskId)));
+        return robotic != null ? robotic.getCompanyId() : null;
+    }
 }

+ 5 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyWorkflowServiceImpl.java

@@ -467,6 +467,11 @@ public class CompanyWorkflowServiceImpl implements ICompanyWorkflowService {
         return companyWorkflowMapper.optionList(companyId);
     }
 
+    @Override
+    public List<OptionVO> optionListAll() {
+        return companyWorkflowMapper.optionListAll();
+    }
+
 
     @Override
     public List<CompanyWorkflowVersionVo> selectVersionListByWorkflowId(Long workflowId) {

+ 4 - 14
fs-service/src/main/java/com/fs/company/service/impl/CompanyWxServiceImpl.java

@@ -264,24 +264,14 @@ public class CompanyWxServiceImpl extends ServiceImpl<CompanyWxAccountMapper, Co
         if (companyUser==null){
             return R.error("未绑定销售");
         }
-        String addressId = companyUser.getAddressId();
-        if (addressId==null || addressId.isEmpty()){
-            return R.error("请先绑定地址");
-        }
-        Long cidServerId = companyUser.getCidServerId();
-        if ( cidServerId==null ){
-            return R.error("请先绑定cid服务");
-        }
+//        Long cidServerId = companyUser.getCidServerId();
+//        if ( cidServerId==null ){
+//            return R.error("请先绑定cid服务");
+//        }
         CidIpadServer count = cidIpadServerService.getOne(new QueryWrapper<CidIpadServer>().gt("count", 0).last(" limit 1"));
         if (count==null){
             return  R.error(501,"回调服务器不足,请联系管理员");
         }
-//        CompanyAiWorkflowServer cidServer = companyAiWorkflowServerMapper.selectCompanyAiWorkflowServerById(companyUser.getCidServerId());
-//
-//        Long serverId = cidIpadServerService.selectQwIpadServerByAddressId(addressId,cidServer.getGroupNo());
-//        if (serverId==null){
-//            return  R.error(501,"该地区服务器剩余数量不足");
-//        }
         account.setServerId(count.getId());
         account.setServerStatus(1);
         updateById(account);

+ 1 - 0
fs-service/src/main/java/com/fs/wxcid/domain/WxMsgLog.java

@@ -65,6 +65,7 @@ public class WxMsgLog extends BaseEntityTow {
     /** 接收状态0收1发 */
     @Excel(name = "接收状态0收1发")
     private Integer receiveType;
+    private String wxNo;
 
 
 }

+ 1 - 0
fs-service/src/main/java/com/fs/wxcid/service/impl/WxMsgLogServiceImpl.java

@@ -78,6 +78,7 @@ public class WxMsgLogServiceImpl extends ServiceImpl<WxMsgLogMapper, WxMsgLog> i
         logs.setMsgType(vo.getType());
         logs.setContent(vo.getTxt());
         logs.setReceiveType(type);
+        logs.setWxNo(vo.getWxNo());
         save(logs);
     }
 }

+ 1 - 0
fs-service/src/main/java/com/fs/wxcid/vo/wxvo/WxSendResultMsgVo.java

@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
 public class WxSendResultMsgVo {
     // 备注
     private String remark;
+    private String wxNo;
     private int type;
     private String txt;
 }

+ 4 - 0
fs-service/src/main/resources/mapper/company/CompanyWorkflowMapper.xml

@@ -117,6 +117,10 @@
         select workflow_id value,workflow_name label from company_ai_workflow where company_id = #{companyId} and del_flag = 0
     </select>
 
+    <select id="optionListAll" resultType="com.fs.company.vo.OptionVO">
+        select workflow_id value,workflow_name label from company_ai_workflow where del_flag = 0 order by workflow_id
+    </select>
+
     <insert id="insertCompanyWorkflow" useGeneratedKeys="true" keyProperty="workflowId">
         insert into company_ai_workflow
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 9 - 1
fs-service/src/main/resources/mapper/wxcid/WxContactMapper.xml

@@ -19,6 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="accountId"    column="account_id"    />
         <result property="companyId"    column="company_id"    />
         <result property="companyUserId"    column="company_user_id"    />
+        <result property="customerId"    column="customer_id"    />
+        <result property="friends"    column="friends"    />
         <result property="createTime"    column="create_time"    />
         <result property="createBy"    column="create_by"    />
         <result property="updateTime"    column="update_time"    />
@@ -27,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectWxContactVo">
-        select id, user_name, nick_name, quan_pin, sex, alias, phone, head_img_url, encrypt_user_name, province, city, account_id, company_id, company_user_id, create_time, create_by, update_time, update_by, remark from wx_contact
+        select id, user_name, nick_name, quan_pin, sex, alias, phone, head_img_url, encrypt_user_name, province, city, account_id, company_id, company_user_id, customer_id, friends, create_time, create_by, update_time, update_by, remark from wx_contact
     </sql>
 
     <select id="selectWxContactList" resultMap="WxContactResult">
@@ -70,6 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="accountId != null">account_id,</if>
             <if test="companyId != null">company_id,</if>
             <if test="companyUserId != null">company_user_id,</if>
+            <if test="customerId != null">customer_id,</if>
+            <if test="friends != null">friends,</if>
             <if test="createTime != null">create_time,</if>
             <if test="createBy != null">create_by,</if>
             <if test="updateTime != null">update_time,</if>
@@ -90,6 +94,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="accountId != null">#{accountId},</if>
             <if test="companyId != null">#{companyId},</if>
             <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="customerId != null">#{customerId},</if>
+            <if test="friends != null">#{friends},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
@@ -114,6 +120,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="accountId != null">account_id = #{accountId},</if>
             <if test="companyId != null">company_id = #{companyId},</if>
             <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+            <if test="customerId != null">customer_id = #{customerId},</if>
+            <if test="friends != null">friends = #{friends},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>

+ 133 - 0
fs-service/src/main/resources/mapper/wxcid/WxMsgLogMapper.xml

@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.wxcid.mapper.WxMsgLogMapper">
+    
+    <resultMap type="WxMsgLog" id="WxMsgLogResult">
+        <result property="id"    column="id"    />
+        <result property="accountId"    column="account_id"    />
+        <result property="authKey"    column="auth_key"    />
+        <result property="type"    column="type"    />
+        <result property="msgId"    column="msg_id"    />
+        <result property="fromUserName"    column="from_user_name"    />
+        <result property="toUserName"    column="to_user_name"    />
+        <result property="msgType"    column="msg_type"    />
+        <result property="content"    column="content"    />
+        <result property="imgStatus"    column="img_status"    />
+        <result property="imgBuf"    column="img_buf"    />
+        <result property="pushContent"    column="push_content"    />
+        <result property="newMsgId"    column="new_msg_id"    />
+        <result property="receiveType"    column="receive_type"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectWxMsgLogVo">
+        select id, account_id, auth_key, type, msg_id, from_user_name, to_user_name, msg_type, content, img_status, img_buf, push_content, new_msg_id, receive_type, create_time, create_by, update_time, update_by, remark from wx_msg_log
+    </sql>
+
+    <select id="selectWxMsgLogList" resultMap="WxMsgLogResult">
+        <include refid="selectWxMsgLogVo"/>
+        <where>  
+            <if test="accountId != null "> and account_id = #{accountId}</if>
+            <if test="authKey != null  and authKey != ''"> and auth_key = #{authKey}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="msgId != null "> and msg_id = #{msgId}</if>
+            <if test="searchValue != null and searchValue != ''"> and (from_user_name = #{searchValue} OR to_user_name = #{searchValue})</if>
+            <if test="fromUserName != null  and fromUserName != ''"> and from_user_name = #{fromUserName}</if>
+            <if test="toUserName != null  and toUserName != ''"> and to_user_name = #{toUserName}</if>
+            <if test="msgType != null "> and msg_type = #{msgType}</if>
+            <if test="receiveType != null "> and receive_type = #{receiveType}</if>
+        </where>
+        order by create_time asc
+    </select>
+    
+    <select id="selectWxMsgLogById" resultMap="WxMsgLogResult">
+        <include refid="selectWxMsgLogVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertWxMsgLog" useGeneratedKeys="true" keyProperty="id">
+        insert into wx_msg_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="accountId != null">account_id,</if>
+            <if test="authKey != null">auth_key,</if>
+            <if test="type != null">type,</if>
+            <if test="msgId != null">msg_id,</if>
+            <if test="fromUserName != null">from_user_name,</if>
+            <if test="toUserName != null">to_user_name,</if>
+            <if test="msgType != null">msg_type,</if>
+            <if test="content != null">content,</if>
+            <if test="imgStatus != null">img_status,</if>
+            <if test="imgBuf != null">img_buf,</if>
+            <if test="pushContent != null">push_content,</if>
+            <if test="newMsgId != null">new_msg_id,</if>
+            <if test="receiveType != null">receive_type,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="accountId != null">#{accountId},</if>
+            <if test="authKey != null">#{authKey},</if>
+            <if test="type != null">#{type},</if>
+            <if test="msgId != null">#{msgId},</if>
+            <if test="fromUserName != null">#{fromUserName},</if>
+            <if test="toUserName != null">#{toUserName},</if>
+            <if test="msgType != null">#{msgType},</if>
+            <if test="content != null">#{content},</if>
+            <if test="imgStatus != null">#{imgStatus},</if>
+            <if test="imgBuf != null">#{imgBuf},</if>
+            <if test="pushContent != null">#{pushContent},</if>
+            <if test="newMsgId != null">#{newMsgId},</if>
+            <if test="receiveType != null">#{receiveType},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateWxMsgLog">
+        update wx_msg_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="accountId != null">account_id = #{accountId},</if>
+            <if test="authKey != null">auth_key = #{authKey},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="msgId != null">msg_id = #{msgId},</if>
+            <if test="fromUserName != null">from_user_name = #{fromUserName},</if>
+            <if test="toUserName != null">to_user_name = #{toUserName},</if>
+            <if test="msgType != null">msg_type = #{msgType},</if>
+            <if test="content != null">content = #{content},</if>
+            <if test="imgStatus != null">img_status = #{imgStatus},</if>
+            <if test="imgBuf != null">img_buf = #{imgBuf},</if>
+            <if test="pushContent != null">push_content = #{pushContent},</if>
+            <if test="newMsgId != null">new_msg_id = #{newMsgId},</if>
+            <if test="receiveType != null">receive_type = #{receiveType},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteWxMsgLogById">
+        delete from wx_msg_log where id = #{id}
+    </delete>
+
+    <delete id="deleteWxMsgLogByIds">
+        delete from wx_msg_log where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 1 - 1
fs-wx-api/src/main/java/com/fs/app/websocket/service/WebSocketServer.java

@@ -191,7 +191,7 @@ public class WebSocketServer {
                         break;
                     case SEND_MSG:
                         log.info("发送返回:{}", msg);
-                        wxMsgLogService.insertLog(JSON.parseObject(msg.getDataJson(), WxSendResultMsgVo.class), companyWxAccount, 0);
+                        wxMsgLogService.insertLog(JSON.parseObject(msg.getDataJson(), WxSendResultMsgVo.class), companyWxAccount, 1);
                         break;
                     case SEND_RESULT:
                         log.info("接收消息:{}", msg);