Browse Source

进线 添加uninid/绑定企业微信 自动授权key

三七 15 hours ago
parent
commit
1db3447233

+ 103 - 0
fs-company/src/main/java/com/fs/company/controller/qw/FsUserCompanyUserQwController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller.qw;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.course.domain.FsUserCompanyUserQw;
+import com.fs.course.service.IFsUserCompanyUserQwService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 微信用户和销售关系-企业微信自动的Controller
+ *
+ * @author fs
+ * @date 2025-10-23
+ */
+@RestController
+@RequestMapping("/qw/fsUserCompanyUserQw")
+public class FsUserCompanyUserQwController extends BaseController
+{
+    @Autowired
+    private IFsUserCompanyUserQwService fsUserCompanyUserQwService;
+
+    /**
+     * 查询微信用户和销售关系-企业微信自动的列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:fsUserCompanyUserQw:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsUserCompanyUserQw fsUserCompanyUserQw)
+    {
+        startPage();
+        List<FsUserCompanyUserQw> list = fsUserCompanyUserQwService.selectFsUserCompanyUserQwList(fsUserCompanyUserQw);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出微信用户和销售关系-企业微信自动的列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:fsUserCompanyUserQw:export')")
+    @Log(title = "微信用户和销售关系-企业微信自动的", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsUserCompanyUserQw fsUserCompanyUserQw)
+    {
+        List<FsUserCompanyUserQw> list = fsUserCompanyUserQwService.selectFsUserCompanyUserQwList(fsUserCompanyUserQw);
+        ExcelUtil<FsUserCompanyUserQw> util = new ExcelUtil<FsUserCompanyUserQw>(FsUserCompanyUserQw.class);
+        return util.exportExcel(list, "微信用户和销售关系-企业微信自动的数据");
+    }
+
+    /**
+     * 获取微信用户和销售关系-企业微信自动的详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('qw:fsUserCompanyUserQw:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(fsUserCompanyUserQwService.selectFsUserCompanyUserQwById(id));
+    }
+
+    /**
+     * 新增微信用户和销售关系-企业微信自动的
+     */
+    @PreAuthorize("@ss.hasPermi('qw:fsUserCompanyUserQw:add')")
+    @Log(title = "微信用户和销售关系-企业微信自动的", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsUserCompanyUserQw fsUserCompanyUserQw)
+    {
+        return toAjax(fsUserCompanyUserQwService.insertFsUserCompanyUserQw(fsUserCompanyUserQw));
+    }
+
+    /**
+     * 修改微信用户和销售关系-企业微信自动的
+     */
+    @PreAuthorize("@ss.hasPermi('qw:fsUserCompanyUserQw:edit')")
+    @Log(title = "微信用户和销售关系-企业微信自动的", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsUserCompanyUserQw fsUserCompanyUserQw)
+    {
+        return toAjax(fsUserCompanyUserQwService.updateFsUserCompanyUserQw(fsUserCompanyUserQw));
+    }
+
+    /**
+     * 删除微信用户和销售关系-企业微信自动的
+     */
+    @PreAuthorize("@ss.hasPermi('qw:fsUserCompanyUserQw:remove')")
+    @Log(title = "微信用户和销售关系-企业微信自动的", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(fsUserCompanyUserQwService.deleteFsUserCompanyUserQwByIds(ids));
+    }
+}

+ 5 - 0
fs-company/src/main/java/com/fs/company/controller/qw/QwUserController.java

@@ -1,5 +1,6 @@
 package com.fs.company.controller.qw;
 package com.fs.company.controller.qw;
 
 
+import cn.hutool.core.util.IdUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.fs.common.annotation.Log;
 import com.fs.common.annotation.Log;
 import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.annotation.RepeatSubmit;
@@ -672,6 +673,10 @@ public class QwUserController extends BaseController
                     qu.setCompanyUserId(qwUserParam.getCompanyUserId());
                     qu.setCompanyUserId(qwUserParam.getCompanyUserId());
                     qu.setStatus(1);
                     qu.setStatus(1);
                     qu.setCompanyId(companyUser.getCompanyId());
                     qu.setCompanyId(companyUser.getCompanyId());
+
+                    String snowKey = IdUtil.getSnowflake(0, 0).nextIdStr();
+                    qu.setAppKey(StringUtil.strIsNullOrEmpty(qu.getAppKey())? snowKey:qu.getAppKey());
+                    qu.setQwHookId(StringUtil.strIsNullOrEmpty(qu.getAppKey())? snowKey:qu.getAppKey());
                     qwUserService.updateQwUser(qu);
                     qwUserService.updateQwUser(qu);
 
 
                 }
                 }

+ 1 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -2462,6 +2462,7 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                 qwExternalContact.setType(externalContact.getType()); // 设置外部联系人类型(1微信用户,2企业微信用户)
                 qwExternalContact.setType(externalContact.getType()); // 设置外部联系人类型(1微信用户,2企业微信用户)
                 qwExternalContact.setGender(externalContact.getGender()); // 设置性别 (0-未知, 1-男性, 2-女性)
                 qwExternalContact.setGender(externalContact.getGender()); // 设置性别 (0-未知, 1-男性, 2-女性)
                 qwExternalContact.setDescription(followUser.getDescription()); // 设置描述信息
                 qwExternalContact.setDescription(followUser.getDescription()); // 设置描述信息
+                qwExternalContact.setUnionid(externalContact.getUnionid());
                 List<Tag> tags = followUser.getTags();
                 List<Tag> tags = followUser.getTags();
                 Set<String> combinedTagsSet = new HashSet<>();
                 Set<String> combinedTagsSet = new HashSet<>();