Przeglądaj źródła

增加站点同步至飞书表格

Cyan 6 miesięcy temu
rodzic
commit
07771e4ff0
11 zmienionych plików z 525 dodań i 3 usunięć
  1. 1 1
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuGroupServiceImpl.java
  2. 1 1
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuMsgServiceImpl.java
  3. 1 1
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuSheetServiceImpl.java
  4. 162 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/controller/OkkiShopWechatGroupMsgController.java
  5. 23 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/dto/WechatGroupMsgRespDto.java
  6. 99 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/entity/OkkiShopWechatGroupMsg.java
  7. 35 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/job/SyncWechatGroupMsgJob.java
  8. 23 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/mapper/OkkiShopWechatGroupMsgMapper.java
  9. 18 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/mapper/xml/OkkiShopWechatGroupMsgMapper.xml
  10. 22 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/service/IOkkiShopWechatGroupMsgService.java
  11. 140 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/service/impl/OkkiShopWechatGroupMsgServiceImpl.java

+ 1 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuGroupServiceImpl.java

@@ -140,7 +140,7 @@ public class FeiShuGroupServiceImpl implements IFeiShuGroupService {
         }
 
         // 发送飞书消息通知
-        feiShuMsgService.sendCreateFeiShuGroupMsg(customerName, siteId, feiShuGroupName, status);
+//        feiShuMsgService.sendCreateFeiShuGroupMsg(customerName, siteId, feiShuGroupName, status);
         if (resp.success()) {
             // 业务数据处理
             log.info("********* sendCreateFeiShuGroupRequest **********:{}", Jsons.DEFAULT.toJson(resp.getData()));

+ 1 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuMsgServiceImpl.java

@@ -125,7 +125,7 @@ public class FeiShuMsgServiceImpl implements IFeiShuMsgService {
                 "        \"zh_cn\": {\n" +
                 "            \"title\": {\n" +
                 "                \"tag\": \"plain_text\",\n" +
-                "                \"content\": \"【站点同步】OMS平台同步站点至飞书表格通知\"\n" +
+                "                \"content\": \"【来客(qiě)了】新客户已同步,请及时处理\"\n" +
                 "            },\n" +
                 "            \"subtitle\": {\n" +
                 "                \"tag\": \"plain_text\",\n" +

+ 1 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuSheetServiceImpl.java

@@ -194,7 +194,7 @@ public class FeiShuSheetServiceImpl implements IFeiShuSheetService {
             status = "失败";
         }
 
-        feiShuMsgService.sendUpdateFeiShuSheetMsg(recordSheetDto.getCustomerName(), recordSheetDto.getSiteId(), recordSheetDto.getGroupName(), status);
+//        feiShuMsgService.sendUpdateFeiShuSheetMsg(recordSheetDto.getCustomerName(), recordSheetDto.getSiteId(), recordSheetDto.getGroupName(), status);
         return updateResp.success();
     }
 }

+ 162 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/controller/OkkiShopWechatGroupMsgController.java

@@ -0,0 +1,162 @@
+package org.jeecg.modules.okki.wechatgroup.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.okki.wechatgroup.entity.OkkiShopWechatGroupMsg;
+import org.jeecg.modules.okki.wechatgroup.service.IOkkiShopWechatGroupMsgService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+ /**
+ * @Description: okki_shop_wechat_group_msg
+ * @Author: jeecg-boot
+ * @Date:   2024-09-09
+ * @Version: V1.0
+ */
+@Api(tags="okki_shop_wechat_group_msg")
+@RestController
+@RequestMapping("/okki/okkiShopWechatGroupMsg")
+@Slf4j
+public class OkkiShopWechatGroupMsgController extends JeecgController<OkkiShopWechatGroupMsg, IOkkiShopWechatGroupMsgService> {
+	@Autowired
+	private IOkkiShopWechatGroupMsgService okkiShopWechatGroupMsgService;
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param okkiShopWechatGroupMsg
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "okki_shop_wechat_group_msg-分页列表查询")
+	@ApiOperation(value="okki_shop_wechat_group_msg-分页列表查询", notes="okki_shop_wechat_group_msg-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<OkkiShopWechatGroupMsg>> queryPageList(OkkiShopWechatGroupMsg okkiShopWechatGroupMsg,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<OkkiShopWechatGroupMsg> queryWrapper = QueryGenerator.initQueryWrapper(okkiShopWechatGroupMsg, req.getParameterMap());
+		Page<OkkiShopWechatGroupMsg> page = new Page<OkkiShopWechatGroupMsg>(pageNo, pageSize);
+		IPage<OkkiShopWechatGroupMsg> pageList = okkiShopWechatGroupMsgService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   添加
+	 *
+	 * @param okkiShopWechatGroupMsg
+	 * @return
+	 */
+	@AutoLog(value = "okki_shop_wechat_group_msg-添加")
+	@ApiOperation(value="okki_shop_wechat_group_msg-添加", notes="okki_shop_wechat_group_msg-添加")
+	@RequiresPermissions("okki:okki_shop_wechat_group_msg:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody OkkiShopWechatGroupMsg okkiShopWechatGroupMsg) {
+		okkiShopWechatGroupMsgService.save(okkiShopWechatGroupMsg);
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 *  编辑
+	 *
+	 * @param okkiShopWechatGroupMsg
+	 * @return
+	 */
+	@AutoLog(value = "okki_shop_wechat_group_msg-编辑")
+	@ApiOperation(value="okki_shop_wechat_group_msg-编辑", notes="okki_shop_wechat_group_msg-编辑")
+	@RequiresPermissions("okki:okki_shop_wechat_group_msg:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody OkkiShopWechatGroupMsg okkiShopWechatGroupMsg) {
+		okkiShopWechatGroupMsgService.updateById(okkiShopWechatGroupMsg);
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "okki_shop_wechat_group_msg-通过id删除")
+	@ApiOperation(value="okki_shop_wechat_group_msg-通过id删除", notes="okki_shop_wechat_group_msg-通过id删除")
+	@RequiresPermissions("okki:okki_shop_wechat_group_msg:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		okkiShopWechatGroupMsgService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "okki_shop_wechat_group_msg-批量删除")
+	@ApiOperation(value="okki_shop_wechat_group_msg-批量删除", notes="okki_shop_wechat_group_msg-批量删除")
+	@RequiresPermissions("okki:okki_shop_wechat_group_msg:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.okkiShopWechatGroupMsgService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "okki_shop_wechat_group_msg-通过id查询")
+	@ApiOperation(value="okki_shop_wechat_group_msg-通过id查询", notes="okki_shop_wechat_group_msg-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<OkkiShopWechatGroupMsg> queryById(@RequestParam(name="id",required=true) String id) {
+		OkkiShopWechatGroupMsg okkiShopWechatGroupMsg = okkiShopWechatGroupMsgService.getById(id);
+		if(okkiShopWechatGroupMsg==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(okkiShopWechatGroupMsg);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param okkiShopWechatGroupMsg
+    */
+    @RequiresPermissions("okki:okki_shop_wechat_group_msg:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, OkkiShopWechatGroupMsg okkiShopWechatGroupMsg) {
+        return super.exportXls(request, okkiShopWechatGroupMsg, OkkiShopWechatGroupMsg.class, "okki_shop_wechat_group_msg");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    @RequiresPermissions("okki:okki_shop_wechat_group_msg:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, OkkiShopWechatGroupMsg.class);
+    }
+
+}

+ 23 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/dto/WechatGroupMsgRespDto.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.okki.wechatgroup.dto;
+
+import lombok.Data;
+import org.jeecg.modules.okki.wechatgroup.entity.OkkiShopWechatGroupMsg;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author Chen
+ */
+@Data
+public class WechatGroupMsgRespDto implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer code;
+
+    private String msg;
+
+    private String now;
+
+    private List<OkkiShopWechatGroupMsg> data;
+}

+ 99 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/entity/OkkiShopWechatGroupMsg.java

@@ -0,0 +1,99 @@
+package org.jeecg.modules.okki.wechatgroup.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: okki_shop_wechat_group_msg
+ * @Author: jeecg-boot
+ * @Date:   2024-09-09
+ * @Version: V1.0
+ */
+@Data
+@TableName("okki_shop_wechat_group_msg")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="okki_shop_wechat_group_msg对象", description="okki_shop_wechat_group_msg")
+public class OkkiShopWechatGroupMsg implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**id*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+	/**消息id*/
+	@Excel(name = "消息id", width = 15)
+    @ApiModelProperty(value = "消息id")
+    private String msgId;
+	/**群id*/
+	@Excel(name = "群id", width = 15)
+    @ApiModelProperty(value = "群id")
+    private String roomId;
+	/**seq*/
+	@Excel(name = "seq", width = 15)
+    @ApiModelProperty(value = "seq")
+    private Integer seq;
+	/**目前有send(发送消息)/recall(撤回消息)/switch(切换企业日志)三种类型*/
+	@Excel(name = "目前有send(发送消息)/recall(撤回消息)/switch(切换企业日志)三种类型", width = 15)
+    @ApiModelProperty(value = "目前有send(发送消息)/recall(撤回消息)/switch(切换企业日志)三种类型")
+    private String action;
+	/**消息发送方id。同一企业内容为userid,非相同企业为external_userid*/
+	@Excel(name = "消息发送方id。同一企业内容为userid,非相同企业为external_userid", width = 15)
+    @ApiModelProperty(value = "消息发送方id。同一企业内容为userid,非相同企业为external_userid")
+    private String fromId;
+	/**消息接收方列表,可能是多个,同一个企业内容为userid,非相同企业为external_userid*/
+	@Excel(name = "消息接收方列表,可能是多个,同一个企业内容为userid,非相同企业为external_userid", width = 15)
+    @ApiModelProperty(value = "消息接收方列表,可能是多个,同一个企业内容为userid,非相同企业为external_userid")
+    private String tolist;
+	/**消息发送时间*/
+	@Excel(name = "消息发送时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "消息发送时间")
+    private Date msgTime;
+	/**消息类型*/
+	@Excel(name = "消息类型", width = 15)
+    @ApiModelProperty(value = "消息类型")
+    private String msgType;
+	/**消息内容*/
+	@Excel(name = "消息内容", width = 15)
+    @ApiModelProperty(value = "消息内容")
+    private String content;
+	/**clientId*/
+	@Excel(name = "clientId", width = 15)
+    @ApiModelProperty(value = "clientId")
+    private Integer clientId;
+	/**siteId*/
+	@Excel(name = "siteId", width = 15)
+    @ApiModelProperty(value = "siteId")
+    private Integer siteId;
+	/**createTime*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+	/**updateTime*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+
+    /**消息发送方id。同一企业内容为userid,非相同企业为external_userid*/
+    @TableField(exist = false)
+    private String form;
+    /**消息接收方列表,可能是多个,同一个企业内容为userid,非相同企业为external_userid*/
+}

+ 35 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/job/SyncWechatGroupMsgJob.java

@@ -0,0 +1,35 @@
+package org.jeecg.modules.okki.wechatgroup.job;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.okki.wechatgroup.service.IOkkiShopWechatGroupMsgService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import javax.annotation.Resource;
+
+/**
+ * @author Chen
+ */
+@Slf4j
+public class SyncWechatGroupMsgJob implements Job {
+
+    @Resource
+    private IOkkiShopWechatGroupMsgService okkiShopWechatGroupMsgService;
+
+    private String parameter;
+
+    public void setParameter(String parameter) {
+        this.parameter = parameter;
+    }
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        long start = System.currentTimeMillis();
+        log.info(String.format("开始同步站点-企业微信群组消息-普通定时任务 SyncWechatGroupMsgJob !  时间:" + DateUtils.now()));
+        okkiShopWechatGroupMsgService.getSiteWechatMsgMaxSeq(this.parameter);
+        long end = System.currentTimeMillis();
+        log.info("请求同步站点-企业微信群组消息-普通定时任务 SyncWechatGroupMsgJob !结束,耗时:{}s", (end - start) / 1000);
+    }
+}

+ 23 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/mapper/OkkiShopWechatGroupMsgMapper.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.okki.wechatgroup.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.okki.wechatgroup.entity.OkkiShopWechatGroupMsg;
+
+import java.util.List;
+
+/**
+ * @Description: okki_shop_wechat_group_msg
+ * @Author: jeecg-boot
+ * @Date: 2024-09-09
+ * @Version: V1.0
+ */
+public interface OkkiShopWechatGroupMsgMapper extends BaseMapper<OkkiShopWechatGroupMsg> {
+
+    /**
+     * 获取站点列表
+     *
+     * @param siteId
+     * @return
+     */
+    public List<OkkiShopWechatGroupMsg> getSiteWechatMsgList(String siteId);
+}

+ 18 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/mapper/xml/OkkiShopWechatGroupMsgMapper.xml

@@ -0,0 +1,18 @@
+<?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="org.jeecg.modules.okki.wechatgroup.mapper.OkkiShopWechatGroupMsgMapper">
+
+    <select id="getSiteWechatMsgList" resultType="org.jeecg.modules.okki.wechatgroup.entity.OkkiShopWechatGroupMsg">
+        SELECT
+            t1.site_id,
+            IFNULL( t2.seq, 0 ) AS seq
+        FROM
+            okki_site t1
+                LEFT JOIN ( SELECT site_id, MAX( seq ) AS seq FROM `okki_shop_wechat_group_msg` GROUP BY site_id ) t2 ON t2.site_id = t1.site_id
+        WHERE
+            t1.del_flag =0
+        <if test="siteId != null and siteId != ''">
+            AND t1.site_id = #{siteId}
+        </if>
+    </select>
+</mapper>

+ 22 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/service/IOkkiShopWechatGroupMsgService.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.okki.wechatgroup.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.okki.wechatgroup.entity.OkkiShopWechatGroupMsg;
+
+import java.util.List;
+
+/**
+ * @Description: okki_shop_wechat_group_msg
+ * @Author: jeecg-boot
+ * @Date: 2024-09-09
+ * @Version: V1.0
+ */
+public interface IOkkiShopWechatGroupMsgService extends IService<OkkiShopWechatGroupMsg> {
+
+    /**
+     * 获取企业微信群消息
+     *
+     * @param siteId
+     */
+    public void getSiteWechatMsgMaxSeq(String siteId);
+}

+ 140 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/wechatgroup/service/impl/OkkiShopWechatGroupMsgServiceImpl.java

@@ -0,0 +1,140 @@
+package org.jeecg.modules.okki.wechatgroup.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import io.swagger.models.auth.In;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.util.FastJsonUtil;
+import org.jeecg.modules.okki.site.entity.OkkiSite;
+import org.jeecg.modules.okki.site.service.IOkkiSiteService;
+import org.jeecg.modules.okki.utils.HttpClientUtils;
+import org.jeecg.modules.okki.wechatgroup.dto.WechatGroupMsgRespDto;
+import org.jeecg.modules.okki.wechatgroup.entity.OkkiShopWechatGroupMsg;
+import org.jeecg.modules.okki.wechatgroup.mapper.OkkiShopWechatGroupMsgMapper;
+import org.jeecg.modules.okki.wechatgroup.service.IOkkiShopWechatGroupMsgService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import java.util.*;
+
+/**
+ * @Description: okki_shop_wechat_group_msg
+ * @Author: jeecg-boot
+ * @Date: 2024-09-09
+ * @Version: V1.0
+ */
+@Service
+@Slf4j
+public class OkkiShopWechatGroupMsgServiceImpl extends ServiceImpl<OkkiShopWechatGroupMsgMapper, OkkiShopWechatGroupMsg> implements IOkkiShopWechatGroupMsgService {
+
+    @Value("${OKKI.BASE_URL}")
+    private String URL;
+
+    @Value("${OKKI.CLIENT_SECRET}")
+    private String CLIENT_SECRET;
+
+    @Autowired
+    private IOkkiSiteService okkiSiteService;
+
+    @Autowired
+    private OkkiShopWechatGroupMsgMapper okkiShopWechatGroupMsgMapper;
+
+    /**
+     * 获取站点信息
+     *
+     * @param siteId
+     * @return
+     */
+    @Override
+    public void getSiteWechatMsgMaxSeq(String siteId) {
+        List<OkkiShopWechatGroupMsg> shopWechatGroupMsgs = okkiShopWechatGroupMsgMapper.getSiteWechatMsgList(siteId);
+        log.info("一共有:{}个站点,需要企业微信群消息", shopWechatGroupMsgs.size());
+        for (int i = 0; i < shopWechatGroupMsgs.size(); i++) {
+            OkkiShopWechatGroupMsg okkiShopWechatGroupMsg = shopWechatGroupMsgs.get(i);
+            int maxSeq = okkiShopWechatGroupMsg.getSeq() == 0 ? 1 : okkiShopWechatGroupMsg.getSeq();
+            log.info("开始处理第{}个,站点ID为:{},seq为:{},企业微信群消息", i + 1, okkiShopWechatGroupMsg.getSiteId(), maxSeq);
+            saveWechatGroupMsg(String.valueOf(okkiShopWechatGroupMsg.getSiteId()), maxSeq);
+        }
+    }
+
+    /**
+     * 保存企业微信群消息
+     *
+     * @param siteId
+     * @param minSeq
+     */
+    public void saveWechatGroupMsg(String siteId, Integer minSeq) {
+        List<OkkiShopWechatGroupMsg> wechatGroupMsgList = sendWechatGroupMsgRequest(siteId, minSeq);
+        log.info("本次请求企业微信群消息数据:{}", FastJsonUtil.toJSONString(wechatGroupMsgList));
+        List<OkkiShopWechatGroupMsg> shopWechatGroupMsgs = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(wechatGroupMsgList)) {
+            wechatGroupMsgList.forEach(c -> {
+                OkkiShopWechatGroupMsg shopWechatGroupMsg = new OkkiShopWechatGroupMsg();
+                shopWechatGroupMsg.setMsgId(c.getMsgId());
+                shopWechatGroupMsg.setRoomId(c.getRoomId());
+                shopWechatGroupMsg.setSeq(c.getSeq());
+                shopWechatGroupMsg.setAction(c.getAction());
+                shopWechatGroupMsg.setFromId(StringUtils.isNotBlank(c.getForm()) ? c.getForm() : "");
+                shopWechatGroupMsg.setTolist(c.getTolist());
+                shopWechatGroupMsg.setMsgType(c.getMsgType());
+                shopWechatGroupMsg.setMsgTime(c.getMsgTime());
+                shopWechatGroupMsg.setContent(c.getContent());
+                shopWechatGroupMsg.setClientId(c.getClientId());
+                shopWechatGroupMsg.setSiteId(c.getSiteId());
+                shopWechatGroupMsg.setCreateTime(c.getCreateTime());
+                shopWechatGroupMsg.setUpdateTime(c.getUpdateTime());
+                shopWechatGroupMsgs.add(shopWechatGroupMsg);
+            });
+            this.saveBatch(shopWechatGroupMsgs);
+
+            //获取下一页数据
+            OkkiShopWechatGroupMsg lastWechatGroupMsg = shopWechatGroupMsgs.get(shopWechatGroupMsgs.size() - 1);
+            saveWechatGroupMsg(siteId, lastWechatGroupMsg.getSeq());
+        }
+    }
+
+    /**
+     * 发送获取企业微信群消息请求
+     *
+     * @param siteId
+     */
+    public List<OkkiShopWechatGroupMsg> sendWechatGroupMsgRequest(String siteId, Integer minSeq) {
+        List<OkkiShopWechatGroupMsg> okkiShopWechatGroupMsgs = new ArrayList<>();
+        // 请求okki平台接口
+        Map<String, String> query = new TreeMap<>();
+        query.put("sign_method", "hmac-md5");
+        query.put("timestamp", String.valueOf(System.currentTimeMillis()));
+        query.put("site_id", String.valueOf(siteId));
+        query.put("method", "query_wechat_group_msg");
+
+        Map<String, Object> postData = new HashMap<>();
+        postData.put("page", 1);
+        postData.put("page_size", 10);
+        postData.put("min_seq", minSeq);
+        try {
+            String queryStr = HttpClientUtils.buildQueryString(query);
+            String body = HttpClientUtils.toJsonString(postData);
+            String signStr = queryStr + body;
+            query.put("signature", HttpClientUtils.generateHmacMD5(signStr, CLIENT_SECRET));
+            String okkiUrl = URL + "?" + HttpClientUtils.buildQueryString(query);
+            log.info("url:" + okkiUrl + ",body:" + body);
+            String msgResult = HttpClientUtils.doPost(okkiUrl, body);
+            // {"code":0,"msg":"success","now":"2024-09-09 09:42:28","data":[]}
+            WechatGroupMsgRespDto wechatGroupMsgRespDto = JSONObject.parseObject(msgResult, WechatGroupMsgRespDto.class);
+            log.info("wechatGroupMsgRespDto:{}", FastJsonUtil.toJSONString(wechatGroupMsgRespDto));
+            if (wechatGroupMsgRespDto.getCode() != 0) {
+                throw new RuntimeException(wechatGroupMsgRespDto.getMsg());
+            }
+            okkiShopWechatGroupMsgs = wechatGroupMsgRespDto.getData();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return okkiShopWechatGroupMsgs;
+    }
+
+}