Commit cd8c0876 by xinlaa

Merge branch 'master' of https://gitee.com/LinkWeChat/link-wechat into master

2 parents bf57f925 38de8408
Showing 73 changed files with 2196 additions and 358 deletions
......@@ -8,8 +8,8 @@
<div align="center">
![GVP Stars](http://img.shields.io/badge/GPV%20Stars-400+-yellow)
![GVP Forks](http://img.shields.io/badge/GPV%20Forks-150+-yellow)
![GVP Stars](http://img.shields.io/badge/GPV%20Stars-500+-yellow)
![GVP Forks](http://img.shields.io/badge/GPV%20Forks-190+-yellow)
![license](http://img.shields.io/badge/license-GPL%203.0-green)
</div>
......
......@@ -24,6 +24,12 @@
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<!-- swagger2-->
<dependency>
<groupId>io.springfox</groupId>
......
......@@ -3,6 +3,7 @@ package com.linkwechat.web.controller.wecom;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.api.R;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.core.domain.ConversationArchiveQuery;
import com.linkwechat.wecom.service.IWeConversationArchiveService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -11,8 +12,6 @@ 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;
/**
* @author sxw
* @description 会话存档controller
......@@ -26,13 +25,33 @@ public class WeConversationArchiveController {
private IWeConversationArchiveService weConversationArchiveService;
/**
* 获取内部联系人列表
* 获取单聊会话数据接口
*
* @param query 入参
* @param /fromId 发送人id
* @param /reveiceId 接收人id
* @return
*/
@PreAuthorize("@ss.hasPermi('conversationArchive:chatContact:list')")
@GetMapping("/getChatContactList")
public R<PageInfo<JSONObject>> getChatContactList(ConversationArchiveQuery query) {
return R.ok(weConversationArchiveService.getChatContactList(query));
}
/**
* 获取群聊会话数据接口
*
* @param query 入参
* @param /fromId 发送人id
* @param /room 接收人id
* @return
*/
@PreAuthorize("@ss.hasPermi('conversationArchive:InternalContact:list')")
@GetMapping("/getInternalContactList")
public R<List<JSONObject>> getInternalContactList(String userId) {
return R.ok(weConversationArchiveService.getInternalContactList(userId));
@PreAuthorize("@ss.hasPermi('conversationArchive:chatRoomContact:list')")
@GetMapping("/getChatRoomContactList")
public R<PageInfo<JSONObject>> getChatRoomContactList(ConversationArchiveQuery query) {
return R.ok(weConversationArchiveService.getChatRoomContactList(query));
}
}
......@@ -6,10 +6,12 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
import com.linkwechat.wecom.domain.vo.CustomerMessagePushVo;
import com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo;
import com.linkwechat.wecom.service.IWeCustomerMessageOriginalService;
import com.linkwechat.wecom.service.IWeCustomerMessagePushService;
import com.linkwechat.wecom.service.IWeCustomerMessgaeResultService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
......@@ -31,13 +33,20 @@ public class WeCustomerMessagePushController extends BaseController {
@Autowired
private IWeCustomerMessagePushService weCustomerMessagePushService;
@Autowired
private IWeCustomerMessageOriginalService weCustomerMessageOriginalService;
@Autowired
private IWeCustomerMessgaeResultService weCustomerMessgaeResultService;
/**
* 新增群发消息发送
*/
@PreAuthorize("@ss.hasPermi('system:push:add')")
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:add')")
@Log(title = "新增群发消息发送", businessType = BusinessType.INSERT)
@PostMapping(value = "add")
public AjaxResult add(@RequestBody CustomerMessagePushDto customerMessagePushDto) {
public AjaxResult add(@RequestBody CustomerMessagePushDto customerMessagePushDto) {
try {
weCustomerMessagePushService.addWeCustomerMessagePush(customerMessagePushDto);
} catch (JsonProcessingException e) {
......@@ -51,16 +60,37 @@ public class WeCustomerMessagePushController extends BaseController {
/**
* 群发消息列表
*/
@PreAuthorize("@ss.hasPermi('system:push:list')")
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:list')")
@GetMapping(value = "/list")
public TableDataInfo list(@RequestParam(value = "sender",required = false) String sender
,@RequestParam(value = "content",required = false) String content
,@RequestParam(value = "pushType",required = false) String pushType
,@RequestParam(value = "beginTime",required = false) String beginTime
,@RequestParam(value = "endTime",required = false) String endTime) {
public TableDataInfo list(@RequestParam(value = "sender", required = false) String sender
, @RequestParam(value = "content", required = false) String content
, @RequestParam(value = "pushType", required = false) String pushType
, @RequestParam(value = "beginTime", required = false) String beginTime
, @RequestParam(value = "endTime", required = false) String endTime) {
startPage();
List<CustomerMessagePushVo> list = weCustomerMessagePushService.customerMessagePushs(sender,content,pushType,beginTime,endTime);
List<CustomerMessagePushVo> list = weCustomerMessagePushService.customerMessagePushs(sender, content, pushType, beginTime, endTime);
return getDataTable(list);
}
/**
* 群发消息详情
*/
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:view')")
@GetMapping(value = "/getInfo")
public AjaxResult getInfo(@RequestParam(value = "messageId") Long messageId) {
CustomerMessagePushVo customerMessagePushVo = weCustomerMessageOriginalService.CustomerMessagePushDetail(messageId);
return AjaxResult.success(customerMessagePushVo);
}
/**
* 群发消息结果列表
*/
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:pushResults')")
@GetMapping(value = "/pushResults")
public TableDataInfo customerMessagePushResult(@RequestParam(value = "messageId") Long messageId,@RequestParam(value = "status") String status){
startPage();
List<WeCustomerMessageResultVo> weCustomerMessageResuls = weCustomerMessgaeResultService.customerMessagePushs(messageId, status);
return getDataTable(weCustomerMessageResuls);
}
}
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.HttpStatus;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeSensitive;
import com.linkwechat.wecom.service.IWeSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 敏感词设置Controller
*
* @author ruoyi
* @date 2020-12-29
*/
@RestController
@RequestMapping("/wecom/sensitive")
public class WeSensitiveController extends BaseController {
@Autowired
private IWeSensitiveService weSensitiveService;
/**
* 查询敏感词设置列表
*/
@PreAuthorize("@ss.hasPermi('wecom:sensitive:list')")
@GetMapping("/list")
public TableDataInfo list(WeSensitive weSensitive) {
startPage();
List<WeSensitive> list = weSensitiveService.selectWeSensitiveList(weSensitive);
return getDataTable(list);
}
/**
* 获取敏感词设置详细信息
*/
@PreAuthorize("@ss.hasPermi('wecom:sensitive:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(weSensitiveService.selectWeSensitiveById(id));
}
/**
* 新增敏感词设置
*/
@PreAuthorize("@ss.hasPermi('wecom:sensitive:add')")
@Log(title = "敏感词设置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Valid @RequestBody WeSensitive weSensitive) {
return toAjax(weSensitiveService.insertWeSensitive(weSensitive));
}
/**
* 修改敏感词设置
*/
@PreAuthorize("@ss.hasPermi('wecom:sensitive:edit')")
@Log(title = "敏感词设置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Valid @RequestBody WeSensitive weSensitive) {
Long id = weSensitive.getId();
WeSensitive originData = weSensitiveService.selectWeSensitiveById(id);
if (originData == null) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "数据不存在");
}
return toAjax(weSensitiveService.updateWeSensitive(weSensitive));
}
/**
* 删除敏感词设置
*/
@PreAuthorize("@ss.hasPermi('wecom:sensitive:remove')")
@Log(title = "敏感词设置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable("ids") String ids) {
String[] id = ids.split(",");
Long[] idArray = new Long[id.length];
Arrays.stream(id).map(Long::parseLong).collect(Collectors.toList()).toArray(idArray);
return toAjax(weSensitiveService.destroyWeSensitiveByIds(idArray));
}
}
......@@ -132,7 +132,7 @@ xss:
# elasticsearch配置
elasticsearch:
schema: http
address: 129.211.173.127:9200
address: localhost
connectTimeout: 10000
socketTimeout: 10000
connectionRequestTimeout: 10000
......@@ -169,11 +169,15 @@ wecome:
- /externalcontact/groupchat/transfer
- /externalcontact/get_unassigned_list
- /externalcontact/send_welcome_msg
- /msgaudit/get_permit_user_list
- /externalcontact/unionid_to_external_userid
fileUplodUrl: /media/upload,/media/uploadimg
needProviderTokenUrl:
- /service/get_login_info
needChatTokenUrl:
- /msgaudit/get_permit_user_list
- /msgaudit/check_single_agree
- /msgaudit/check_room_agree
- /msgaudit/groupchat/get
#企微回调通知配置
callBack:
appIdOrCorpId:
......
......@@ -30,4 +30,7 @@ public class WeComeConfig {
/** 需要供应商token的url*/
private String[] needProviderTokenUrl;
/** 会话存档所需token 的url */
private String[] needChatTokenUrl;
}
......@@ -29,6 +29,11 @@ public class WeConstans {
*/
public static final String WE_PROVIDER_ACCESS_TOKEN = "we_provider_access_token";
/**
* 会话存档相关token
*/
public static final String WE_CHAT_ACCESS_TOKEN = "we_chat_access_token";
/**
* 企业微信接口返回成功code
......
package com.linkwechat.common.core.domain;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
/**
* @author sxw
* @description 会话存档接口入参实体
* @date 2020/12/29 14:23
**/
@Data
public class ConversationArchiveQuery extends BaseEntity {
/** 发送人Id */
private String fromId;
/** 接收人Id */
private String receiveId;
/** 群聊Id */
private String roomId;
/** 类型 */
private String msgType;
@JSONField(defaultValue = "1")
private Integer pageSize;
@JSONField(defaultValue = "10")
private Integer pageNum;
}
package com.linkwechat.common.core.elasticsearch;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.core.domain.elastic.ElasticSearchEntity;
import lombok.extern.slf4j.Slf4j;
......@@ -89,7 +90,7 @@ public class ElasticSearch {
public void createIndex2(String idxName, XContentBuilder builder) {
try {
if (!this.indexExist(idxName)) {
log.error(" idxName={} 已经存在,idxSql={}", idxName, builder);
//log.error(" idxName={} 已经存在,idxSql={}", idxName, builder);
return;
}
CreateIndexRequest request = new CreateIndexRequest(idxName);
......@@ -265,6 +266,8 @@ public class ElasticSearch {
res.add(JSON.parseObject(hit.getSourceAsString(), c));
}
// 封装分页
PageHelper.startPage(1,2);
PageInfo<T> page = new PageInfo<>();
page.setList(res);
page.setPageNum(pageNum);
......
......@@ -74,7 +74,7 @@ public class FinanceUtils {
}
String content = Finance.GetContentFromSlice(slice);
JSONArray chatdataArr = JSONObject.parseObject(content).getJSONArray("chatdata");
log.info("开始执行数据解析:------------" + chatdataArr.toJSONString());
log.info("开始执行数据解析:------------");
if (CollectionUtil.isNotEmpty(chatdataArr)) {
chatdataArr.stream().map(data -> (JSONObject) data).forEach(data -> {
try {
......@@ -82,6 +82,9 @@ public class FinanceUtils {
long LocalSEQ = data.getLong("seq");
JSONObject jsonObject = decryptChatRecord(sdk, data.getString("encrypt_random_key"),
data.getString("encrypt_chat_msg"), privateKey);
if (jsonObject ==null){
return;
}
jsonObject.put("seq", LocalSEQ);
elasticSearchEntity.setData(jsonObject);
elasticSearchEntity.setId(jsonObject.getString("msgid"));
......
......@@ -57,16 +57,12 @@ public class RyTask {
//创建索引
elasticSearch.createIndex2(WeConstans.WECOM_FINANCE_INDEX,elasticSearch.getFinanceMapping());
//从缓存中获取消息标识
AtomicLong index = new AtomicLong((Long) Optional.ofNullable(redisCache.getCacheObject(WeConstans.CONTACT_SEQ_KEY)).orElse(0L));
Object seqObject = Optional.ofNullable(redisCache.getCacheObject(WeConstans.CONTACT_SEQ_KEY)).orElse(0L);
Long seqLong = Long.valueOf(String.valueOf(seqObject));
AtomicLong index = new AtomicLong(seqLong);
if (index.get() == 0){
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
SortBuilder<?> sortBuilderPrice = SortBuilders.fieldSort(WeConstans.CONTACT_SEQ_KEY).order( SortOrder.DESC);
searchSourceBuilder.sort(sortBuilderPrice);
List<JSONObject> searchResultList = elasticSearch.search(WeConstans.WECOM_FINANCE_INDEX, searchSourceBuilder, JSONObject.class);
searchResultList.stream().findFirst().ifPresent(result ->{
index.set(result.getLong(WeConstans.CONTACT_SEQ_KEY) + 1);
});
redisCache.setCacheObject(WeConstans.CONTACT_SEQ_KEY,index);
setRedisCacheSeqValue(index);
}
log.info(">>>>>>>seq:{}",index.get());
......@@ -81,8 +77,21 @@ public class RyTask {
} catch (Exception e) {
log.error("消息处理异常:ex:{}", e);
e.printStackTrace();
}finally {
setRedisCacheSeqValue(index);
}
index.incrementAndGet();
}
}
private void setRedisCacheSeqValue(AtomicLong index){
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
SortBuilder<?> sortBuilderPrice = SortBuilders.fieldSort(WeConstans.CONTACT_SEQ_KEY).order( SortOrder.DESC);
searchSourceBuilder.sort(sortBuilderPrice);
searchSourceBuilder.size(1);
List<JSONObject> searchResultList = elasticSearch.search(WeConstans.WECOM_FINANCE_INDEX, searchSourceBuilder, JSONObject.class);
searchResultList.stream().findFirst().ifPresent(result ->{
index.set(result.getLong(WeConstans.CONTACT_SEQ_KEY) + 1);
});
redisCache.setCacheObject(WeConstans.CONTACT_SEQ_KEY,index);
}
}
package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.Body;
import com.dtflys.forest.annotation.DataObject;
import com.dtflys.forest.annotation.Query;
import com.dtflys.forest.annotation.Request;
import com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultDataObjectDto;
import com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultDto;
import com.linkwechat.wecom.domain.dto.message.SendMessageResultDto;
import com.linkwechat.wecom.domain.dto.message.WeCustomerMessagePushDto;
......@@ -22,18 +24,18 @@ public interface WeCustomerMessagePushClient {
@Request(url = "/externalcontact/add_msg_template",
type = "POST"
)
SendMessageResultDto sendCustomerMessageToUser(@DataObject WeCustomerMessagePushDto customerMessagePushDto);
SendMessageResultDto sendCustomerMessageToUser(@Body WeCustomerMessagePushDto customerMessagePushDto);
/**
* 获取企业群发消息发送结果
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/92136">API文档地址</a>
*
* @param msgid <a href="https://work.weixin.qq.com/api/doc/90000/90135/92135">添加企业群发消息任务返回的msgid</a>
* @param queryCustomerMessageStatusResultDataObjectDto{msgid} <a href="https://work.weixin.qq.com/api/doc/90000/90135/92135">添加企业群发消息任务返回的msgid</a>
*/
@Request(url = "/externalcontact/get_group_msg_result",
type = "POST"
)
QueryCustomerMessageStatusResultDto queryCustomerMessageStatus(@Query(value = "msgid") String msgid);
QueryCustomerMessageStatusResultDto queryCustomerMessageStatus(@Body QueryCustomerMessageStatusResultDataObjectDto queryCustomerMessageStatusResultDataObjectDto);
}
package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.DataObject;
import com.dtflys.forest.annotation.DataVariable;
import com.dtflys.forest.annotation.Request;
import com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto;
import com.linkwechat.wecom.domain.vo.WeMsgAuditVo;
/**
* @author sxw
......@@ -17,7 +19,7 @@ public interface WeMsgAuditClient {
@Request(url = "/msgaudit/get_permit_user_list",
type = "POST"
)
WeMsgAuditDto getPermitUserList(@DataObject WeMsgAuditDto msgAuditDto);
WeMsgAuditDto getPermitUserList(@DataVariable WeMsgAuditDto msgAuditDto);
/**
* 单聊 获取会话中外部成员的同意情况
......@@ -27,7 +29,7 @@ public interface WeMsgAuditClient {
@Request(url = "/msgaudit/check_single_agree",
type = "POST"
)
WeMsgAuditDto checkSingleAgree(@DataObject WeMsgAuditDto msgAuditDto);
WeMsgAuditDto checkSingleAgree(@DataVariable WeMsgAuditDto msgAuditDto);
/**
* 群聊 获取群会话中外部成员的同意情况
......@@ -37,15 +39,15 @@ public interface WeMsgAuditClient {
@Request(url = "/msgaudit/check_room_agree",
type = "POST"
)
WeMsgAuditDto checkRoomAgree(@DataObject WeMsgAuditDto msgAuditDto);
WeMsgAuditDto checkRoomAgree(@DataVariable WeMsgAuditDto msgAuditDto);
/**
* 获取会话内容存档内部群信息
* @param msgAuditDto
* @param weMsgAuditVo
* @return
*/
@Request(url = "/msgaudit/groupchat/get",
type = "POST"
)
WeMsgAuditDto getGroupChat(@DataObject WeMsgAuditDto msgAuditDto);
WeMsgAuditDto getGroupChat(@DataVariable WeMsgAuditVo weMsgAuditVo);
}
package com.linkwechat.wecom.domain;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.linkwechat.common.annotation.Excel;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
......@@ -14,7 +14,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @date 2020-12-27
*/
@Data
public class WeChatContactMapping extends BaseEntity
public class WeChatContactMapping
{
private static final long serialVersionUID = 1L;
......@@ -25,53 +25,35 @@ public class WeChatContactMapping extends BaseEntity
@Excel(name = "发送人id")
private String fromId;
/** 发送人头像 */
@Excel(name = "发送人头像")
private String fromAvatar;
/** 发送人姓名 */
@Excel(name = "发送人姓名")
private String fromName;
/** 发送人性别 0-未知 1-男性 2-女性 */
@Excel(name = "发送人性别 0-未知 1-男性 2-女性")
private Integer fromGender;
/** 接收人头像 */
@Excel(name = "接收人头像")
private String reviceAvatar;
/** 接收人姓名 */
@Excel(name = "接收人姓名")
private String reviceName;
/** 接收人性别 0-未知 1-男性 2-女性 */
@Excel(name = "接收人性别 0-未知 1-男性 2-女性")
private Integer reviceGender;
/** 接收人id */
@Excel(name = "接收人id")
private String reviceId;
private String receiveId;
/** 群聊id */
@Excel(name = "群聊id")
private String roomId;
/** 是否为客户 0-成员 1-客户 */
@Excel(name = "是否为客户 0-成员 1-客户")
/** 是否为客户 0-成员 1-客户 2-机器人*/
@Excel(name = "是否为客户 0-成员 1-客户 2-机器人")
private Integer isCustom;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("fromId", getFromId())
.append("reviceAvatar", getReviceAvatar())
.append("reviceName", getReviceName())
.append("reviceGender", getReviceGender())
.append("reviceId", getReviceId())
.append("roomId", getRoomId())
.append("isCustom", getIsCustom())
.toString();
}
/** 是否为客户 0-内部 1-外部 2-群聊*/
@TableField(exist = false)
private Integer searchType;
/** 内部接收人信息 */
@TableField(exist = false)
private WeUser weUser;
/** 外部接收人信息 */
@TableField(exist = false)
private WeCustomer weCustomer;
/** 群信息 */
@TableField(exist = false)
private WeMsgAuditDto roomInfo;
/** 最后一条聊天数据 */
@TableField(exist = false)
private JSONObject finalChatContext;
}
......@@ -65,6 +65,9 @@ public class WeCorpAccount extends BaseEntity
@ApiModelProperty("服务商密钥")
private String providerSecret;
@ApiModelProperty("会话存档密钥")
private String chatSecret;
@ApiModelProperty("企业微信扫码登陆回调地址")
private String wxQrLoginRedirectUri;
......
......@@ -95,5 +95,17 @@ public class WeCustomer extends BaseEntity
@TableField(exist = false)
private String departmentIds;
/**
* 添加人名称
*/
@TableField(exist = false)
private String userName;
/**
* 员工id
*/
@TableField(exist = false)
private String userId;
}
......@@ -57,20 +57,29 @@ public class WeCustomerMessage extends BaseEntity {
private String msgid;
/**
* 发送情况
* ps:显示样式
*
* 1)定时任务 发送时间:2020-12-25 10:00:00
* 2) 预计发送3190人,已成功发送0人
* 3)预计发送2个群,已成功发送0个群
*
* 消息内容
*/
private String sendInfo;
private String content;
/**
* 消息内容
* 发送时间
*/
private String content;
private String settingTime;
/**
* 预计发送消息数(客户对应多少人 客户群对应多个群)
*/
private Integer expectSend;
/**
* 实际发送消息数(客户对应多少人 客户群对应多个群)
*/
private Integer actualSend;
/**
* 是否定时任务 0 常规 1 定时发送
*/
private Integer timedTask;
/**
* 0 未删除 1 已删除
......
......@@ -41,6 +41,11 @@ public class WeCustomerMessgaeResult extends BaseEntity {
private String chatId;
/**
* 外部客户群名称
*/
private String chatName;
/**
* 企业服务人员的userid
*/
private String userid;
......@@ -56,6 +61,26 @@ public class WeCustomerMessgaeResult extends BaseEntity {
private String sendTime;
/**
* 外部联系人名称
*/
private String externalName;
/**
* 企业服务人员的名称
*/
private String userName;
/**
* 0 定时发送 1 发给客户 2 发给客户群
*/
private String sendType;
/**
* 定时发送时间
*/
private String settingTime;
/**
* 0 未删除 1 已删除
*/
private int delFlag;
......
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 群发消息 群发消息 子消息表(包括 文本消息、图片消息、链接消息、小程序消息) we_customer_seedMessage
*
* @author kewen
* @date 2020-12-28
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("we_customer_seedMessage")
public class WeCustomerSeedMessage extends BaseEntity {
/**
* 主键id
*/
private Long seedMessageId;
/**
* 微信消息表id
*/
private Long messageId;
/**
* 消息文本内容,最多4000个字节
*/
private String content;
/**
* 图片消息:图片的media_id,可以通过 <a href="https://work.weixin.qq.com/api/doc/90000/90135/90253">素材管理接口</a>获得'
*/
private String mediaId;
/**
* 图片消息:图片的链接,仅可使用<a href="https://work.weixin.qq.com/api/doc/90000/90135/90256">上传图片接口</a>得到的链接'
*/
private String picUrl;
/**
* 链接消息:图文消息标题
*/
private String linkTitle;
/**
* 链接消息:图文消息封面的url
*/
private String linkPicurl;
/**
* 链接消息:图文消息的描述,最多512个字节
*/
private String linDesc;
/**
* 链接消息:图文消息的链接
*/
private String linkUrl;
/**
* 小程序消息标题,最多64个字节
*/
private String miniprogramTitle;
/**
* 小程序消息封面的mediaid,封面图建议尺寸为520*416
*/
private String miniprogramMediaId;
/**
* 小程序appid,必须是关联到企业的小程序应用
*/
private String appid;
/**
* 小程序page路径
*/
private String page;
}
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 敏感词实体
*
* @author leejoker <1056650571@qq.com>
* @version 1.0
* @date 2020/12/28 13:29
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName(value = "we_sensitive")
@ApiModel(value = "敏感词")
public class WeSensitive extends BaseEntity {
/**
* id
*/
@TableId
@ApiModelProperty(value = "敏感词设置id")
private Long id;
/**
* 策略名称
*/
@TableField(value = "strategy_name")
@NotBlank(message = "策略名称不能为空")
@ApiModelProperty(value = "策略名称")
private String strategyName;
/**
* 匹配词
*/
@TableField(value = "pattern_words")
@ApiModelProperty(value = "匹配词,逗号分隔")
@NotBlank(message = "匹配词不能为空")
private String patternWords;
/**
* 审计范围,敏感词审计需要覆盖的用户或机构
*/
@NotEmpty(message = "审计范围不能为空")
@TableField(exist = false)
@ApiModelProperty(value = "审计范围")
private List<WeSensitiveAuditScope> auditUserScope;
/**
* 审计人id
*/
@TableField(value = "audit_user_id")
@ApiModelProperty(value = "审计人id")
@NotNull(message = "审计人id不能为空")
private Long auditUserId;
/**
* 审计人姓名
*/
@TableField(value = "audit_user_name")
@ApiModelProperty(value = "审计人姓名")
@NotBlank(message = "审计人不能为空")
private String auditUserName;
/**
* 消息通知
*/
@TableField(value = "alert_flag")
@ApiModelProperty(value = "1 开启 0 关闭")
private Integer alertFlag;
/**
* 删除状态
*/
@TableField(value = "del_flag")
@TableLogic
@ApiModelProperty(value = "1 已删除 0 未删除")
private Integer delFlag;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("strategyName", getStrategyName())
.append("patternWords", getPatternWords())
.append("auditUserId", getAuditUserId())
.append("alertFlag", getAlertFlag())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
/**
* @author leejoker <1056650571@qq.com>
* @version 1.0
* @date 2020/12/28 14:07
*/
@Data
@TableName(value = "we_sensitive_audit_scope")
@ApiModel(value = "敏感词审计范围")
public class WeSensitiveAuditScope implements Serializable {
private static final long serialVersionUID = 7696067707890730540L;
@TableId
@ApiModelProperty(value = "审计范围id")
private Long id;
@TableField(value = "sensitive_id")
@ApiModelProperty(value = "敏感词表主键")
private Long sensitiveId;
/**
* 1:组织机构id,2:成员id
*/
@TableField(value = "scope_type")
@ApiModelProperty(value = "审计范围类型, 1 组织机构 2 成员")
private Integer scopeType;
/**
* 审计对象id
*/
@TableField(value = "audit_scope_id")
@ApiModelProperty(value = "审计对象id")
private Long auditScopeId;
/**
* 审计对象名称
*/
@TableField(value = "audit_scope_name")
@ApiModelProperty(value = "审计对象名称")
private String auditScopeName;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("scopeType", getScopeType())
.append("auditScopeId", getAuditScopeId())
.append("auditScopeName", getAuditScopeName())
.toString();
}
}
......@@ -68,4 +68,39 @@ public class CustomerMessagePushDto {
*/
private MiniprogramMessageDto miniprogramMessage;
/**
* 消息内容
*
* @param customerMessagePushDto
* @return
*/
public String content() {
if (this.getMessageType()!=null) {
// 消息类型 0 文本消息 1 图片消息 2 链接消息 3 小程序消息
if ( this.getMessageType().equals("0")) {
return this.getTextMessage().getContent();
}
if (this.getMessageType().equals("1")) {
return this.getImageMessage().getPic_url();
}
if (this.getMessageType().equals("2")) {
return this.getLinkMessage().getTitle() + ":" + this.getLinkMessage().getPicurl()
+ ":" + this.getLinkMessage().getUrl() + "" + this.getLinkMessage().getDesc();
}
if (this.getMessageType().equals("3")) {
return this.getMiniprogramMessage().getTitle() + ":" + this.getMiniprogramMessage().getPage();
}
}
return null;
}
}
......@@ -5,12 +5,12 @@ import lombok.Data;
@Data
public class DetailMessageStatusResultDto {
/**
* 外部联系人userid
* 外部联系人userid,群发消息到企业的客户群不吐出该字段
*/
private String external_userid;
/**
* 外部客户群id
* 外部客户群id,群发消息到客户不吐出该字段
*/
private String chat_id;
......
package com.linkwechat.wecom.domain.dto.message;
import lombok.Data;
@Data
public class QueryCustomerMessageStatusResultDataObjectDto {
/**
* 群发消息的id,通过<a href=“https://work.weixin.qq.com/api/doc/90000/90135/92135”>创建企业群发接口</a>返回
*/
private String msgid;
}
......@@ -22,6 +22,12 @@ public class CustomerMessagePushVo {
private String messageType;
/**
* 群发任务的类型,默认为single,表示发送给客户,group表示发送给客户群
* 0 发送给客户 1 发送给客户群
*/
private String chatType;
/**
* 消息内容
*/
private String content;
......@@ -47,17 +53,30 @@ public class CustomerMessagePushVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date sendTime;
/**
* msgid 可以用于获取发送结果
*/
private String msgid;
/**
* 发送时间
*/
private String settingTime;
/**
* 预计发送消息数(客户对应多少人 客户群对应多个群)
*/
private Integer expectSend;
/**
* 实际发送消息数(客户对应多少人 客户群对应多个群)
*/
private Integer actualSend;
/**
* 发送情况
* ps:显示样式
*
* 1)定时任务 发送时间:2020-12-25 10:00:00
* 2) 预计发送3190人,已成功发送0人
* 3)预计发送2个群,已成功发送0个群
*
* 是否定时任务 0 常规 1 定时发送
*/
private String sendInfo;
private Integer timedTask;
}
package com.linkwechat.wecom.domain.vo;
import lombok.Data;
/**
* 消息发送结果
*/
@Data
public class WeCustomerMessageResultVo {
/**
* 发送员工名称
*/
private String userName;
/**
* 客户名称列表,通过`、`进行分隔
*/
private String customers;
}
......@@ -60,6 +60,8 @@ public class WeAccessTokenInterceptor implements Interceptor{
token=iWeAccessTokenService.findContactAccessToken();
}else if(Arrays.asList(weComeConfig.getNeedProviderTokenUrl()).contains(uri)){ //需要供应商token
token=iWeAccessTokenService.findProviderAccessToken();
}else if(Arrays.asList(weComeConfig.getNeedChatTokenUrl()).contains(uri)){ //需要会话存档token
token=iWeAccessTokenService.findChatAccessToken();
}else{
token=iWeAccessTokenService.findCommonAccessToken();
}
......
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCustomerMessage;
import org.apache.ibatis.annotations.Param;
/**
* 群发消息 微信消息表Mapper接口
......@@ -10,4 +11,14 @@ import com.linkwechat.wecom.domain.WeCustomerMessage;
* @date 2020-12-08
*/
public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> {
int updateWeCustomerMessageMsgIdById(WeCustomerMessage customerMessage);
/**
*
* @param messageId 微信消息表主键id
* @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群)
* @return int
*/
int updateWeCustomerMessageActualSend(@Param("messageId") Long messageId,@Param("actualSend") Integer actualSend);
}
......@@ -28,4 +28,11 @@ public interface WeCustomerMessageOriginalMapper extends BaseMapper<WeCustomerMe
public List<CustomerMessagePushVo> selectCustomerMessagePushs(@Param("sender") String sender,@Param("content") String content
,@Param("pushType") String pushType, @Param("beginTime") String beginTime,@Param("endTime") String endTime);
/**
* 群发详情
* @param messageId 微信群发id
* @return {@link CustomerMessagePushVo} 群发详情
*/
public CustomerMessagePushVo findCustomerMessagePushDetail(@Param("messageId") Long messageId);
}
......@@ -2,6 +2,10 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCustomerMessgaeResult;
import com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 群发消息 微信消息发送结果表 Mapper接口
......@@ -10,4 +14,28 @@ import com.linkwechat.wecom.domain.WeCustomerMessgaeResult;
* @date 2020-12-08
*/
public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMessgaeResult> {
/**
* 更新群发消息结果
*
* @param messageId 微信消息表id
* @param chatId 外部客户群id
* @param externalUserid 外部联系人userid
* @param status 发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败
* @param sendTime 发送时间,发送状态为1时返回(为时间戳的形式)
* @return int
*/
int updateWeCustomerMessgaeResult(@Param("messageId") Long messageId,@Param("chatId") String chatId,@Param("externalUserid") String externalUserid
,@Param("status") String status,@Param("sendTime") String sendTime);
/**
* 查询微信消息发送情况
*
* @param messageId 微信消息表id
* @param status 发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败
* @return {@link WeCustomerMessageResultVo}s
*/
List<WeCustomerMessageResultVo> customerMessagePushs(@Param("messageId") Long messageId,@Param("status") String status);
}
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCustomerSeedMessage;
/**
* 群发消息 群发消息 子消息表(包括 文本消息、图片消息、链接消息、小程序消息) Mapper接口
*
* @author kewen
* @date 2020-12-28
*/
public interface WeCustomerSeedMessageMapper extends BaseMapper<WeCustomerSeedMessage> {
}
package com.linkwechat.wecom.mapper;
import com.linkwechat.wecom.domain.WeSensitiveAuditScope;
import java.util.List;
/**
* 敏感词审计范围Mapper接口
*
* @author ruoyi
* @date 2020-12-29
*/
public interface WeSensitiveAuditScopeMapper {
/**
* 查询敏感词审计范围
*
* @param id 敏感词审计范围ID
* @return 敏感词审计范围
*/
public WeSensitiveAuditScope selectWeSensitiveAuditScopeById(Long id);
/**
* 查询敏感词审计范围列表
*
* @param weSensitiveAuditScope 敏感词审计范围
* @return 敏感词审计范围集合
*/
public List<WeSensitiveAuditScope> selectWeSensitiveAuditScopeList(WeSensitiveAuditScope weSensitiveAuditScope);
/**
* 新增敏感词审计范围
*
* @param weSensitiveAuditScope 敏感词审计范围
* @return 结果
*/
public int insertWeSensitiveAuditScope(WeSensitiveAuditScope weSensitiveAuditScope);
/**
* 批量新增敏感词审计范围
*
* @param weSensitiveAuditScopeList 敏感词审计范围List
* @return 结果
*/
public int insertWeSensitiveAuditScopeList(List<WeSensitiveAuditScope> weSensitiveAuditScopeList);
/**
* 修改敏感词审计范围
*
* @param weSensitiveAuditScope 敏感词审计范围
* @return 结果
*/
public int updateWeSensitiveAuditScope(WeSensitiveAuditScope weSensitiveAuditScope);
/**
* 删除敏感词审计范围
*
* @param id 敏感词审计范围ID
* @return 结果
*/
public int deleteWeSensitiveAuditScopeById(Long id);
/**
* 批量删除敏感词审计范围
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteWeSensitiveAuditScopeByIds(Long[] ids);
/**
* 根据敏感词表id删除关联数据
*
* @param sensitiveId
* @return
*/
public int deleteAuditScopeBySensitiveId(Long sensitiveId);
public int deleteAuditScopeBySensitiveIds(Long[] sensitiveIds);
}
package com.linkwechat.wecom.mapper;
import com.linkwechat.wecom.domain.WeSensitive;
import java.util.List;
/**
* 敏感词设置Mapper接口
*
* @author ruoyi
* @date 2020-12-29
*/
public interface WeSensitiveMapper {
/**
* 查询敏感词设置
*
* @param id 敏感词设置ID
* @return 敏感词设置
*/
public WeSensitive selectWeSensitiveById(Long id);
public List<WeSensitive> selectWeSensitiveByIds(Long[] ids);
/**
* 查询敏感词设置列表
*
* @param weSensitive 敏感词设置
* @return 敏感词设置集合
*/
public List<WeSensitive> selectWeSensitiveList(WeSensitive weSensitive);
/**
* 新增敏感词设置
*
* @param weSensitive 敏感词设置
* @return 结果
*/
public int insertWeSensitive(WeSensitive weSensitive);
/**
* 修改敏感词设置
*
* @param weSensitive 敏感词设置
* @return 结果
*/
public int updateWeSensitive(WeSensitive weSensitive);
public int batchUpdateWeSensitive(List<WeSensitive> weSensitiveList);
/**
* 删除敏感词设置
*
* @param id 敏感词设置ID
* @return 结果
*/
public int deleteWeSensitiveById(Long id);
/**
* 批量删除敏感词设置
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteWeSensitiveByIds(Long[] ids);
}
......@@ -15,5 +15,7 @@ public interface IWeAccessTokenService {
public String findProviderAccessToken();
public String findChatAccessToken();
public void removeToken();
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.core.domain.ConversationArchiveQuery;
import java.util.List;
......@@ -13,9 +14,29 @@ import java.util.List;
public interface IWeConversationArchiveService {
/**
* 根据用户ID 获取对应内部联系人列表
*
* @param userId
* @param query 入参
* @param /fromId 发送人id
* @param /reveiceId 接收人id
* @return
*/
List<JSONObject> getInternalContactList(String userId);
PageInfo<JSONObject> getChatContactList(ConversationArchiveQuery query);
PageInfo<JSONObject> getChatRoomContactList(ConversationArchiveQuery query);
/**
* 查询最早聊天记录
* @param fromId
* @param receiveId
* @return
*/
JSONObject getFinalChatContactInfo(String fromId, String receiveId);
/**
* 查询最早群聊记录
* @param fromId
* @param roomId
* @return
*/
JSONObject getFinalChatRoomContactInfo(String fromId, String roomId);
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomerImageMessage;
public interface IWeCustomerImageMessageService extends IService<WeCustomerImageMessage> {
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomerLinkMessage;
public interface IWeCustomerLinkMessageService extends IService<WeCustomerLinkMessage> {
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.linkwechat.wecom.domain.WeCustomerMessageOriginal;
import com.linkwechat.wecom.domain.vo.CustomerMessagePushVo;
......@@ -32,4 +33,11 @@ public interface IWeCustomerMessageOriginalService extends IService<WeCustomerMe
*/
List<CustomerMessagePushVo> customerMessagePushs(String sender,String content,String pushType,String beginTime,String endTime);
/**
* 群发详情
* @param messageId 微信群发id
* @return {@link CustomerMessagePushVo} 群发详情
*/
CustomerMessagePushVo CustomerMessagePushDetail(Long messageId);
}
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomerMessage;
import org.apache.ibatis.annotations.Param;
/**
* 群发消息 微信消息表service接口
......@@ -10,4 +11,20 @@ import com.linkwechat.wecom.domain.WeCustomerMessage;
* @date 2020-12-12
*/
public interface IWeCustomerMessageService extends IService<WeCustomerMessage> {
/**
* @param customerMessage
* @return
*/
int updateWeCustomerMessageMsgId(WeCustomerMessage customerMessage);
/**
*
* @param messageId 微信消息表主键id
* @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群)
* @return int
*/
int updateWeCustomerMessageActualSend( Long messageId, Integer actualSend);
}
......@@ -2,6 +2,10 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomerMessgaeResult;
import com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 群发消息 微信消息发送结果表 we_customer_messgaeResult
......@@ -10,4 +14,14 @@ import com.linkwechat.wecom.domain.WeCustomerMessgaeResult;
* @date 2020-12-12
*/
public interface IWeCustomerMessgaeResultService extends IService<WeCustomerMessgaeResult> {
/**
* 查询微信消息发送情况
*
* @param messageId 微信消息表id
* @param status 发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败
* @return {@link WeCustomerMessageResultVo}s
*/
List<WeCustomerMessageResultVo> customerMessagePushs(Long messageId, String status);
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomerMiniprogramMessage;
public interface IWeCustomerMiniprogramMessageService extends IService<WeCustomerMiniprogramMessage> {
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomerSeedMessage;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
/**
* 群发消息 子消息表(包括 文本消息、图片消息、链接消息、小程序消息) we_customer_seedMessage
*
* @author kewen
* @date 2020-12-28
*/
public interface IWeCustomerSeedMessageService extends IService<WeCustomerSeedMessage> {
/**
* 各分类消息表
*
* @param customerMessagePushDto 群发消息
* @param messageId 消息id
*/
void saveSeedMessage(CustomerMessagePushDto customerMessagePushDto, long messageId);
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomerTextMessag;
public interface IWeCustomerTextMessagService extends IService<WeCustomerTextMessag> {
}
package com.linkwechat.wecom.service;
import com.linkwechat.wecom.domain.WeSensitiveAuditScope;
import java.util.List;
/**
* 敏感词审计范围Service接口
*
* @author ruoyi
* @date 2020-12-29
*/
public interface IWeSensitiveAuditScopeService {
/**
* 查询敏感词审计范围
*
* @param id 敏感词审计范围ID
* @return 敏感词审计范围
*/
public WeSensitiveAuditScope selectWeSensitiveAuditScopeById(Long id);
/**
* 查询敏感词审计范围列表
*
* @param weSensitiveAuditScope 敏感词审计范围
* @return 敏感词审计范围集合
*/
public List<WeSensitiveAuditScope> selectWeSensitiveAuditScopeList(WeSensitiveAuditScope weSensitiveAuditScope);
/**
* 新增敏感词审计范围
*
* @param weSensitiveAuditScope 敏感词审计范围
* @return 结果
*/
public int insertWeSensitiveAuditScope(WeSensitiveAuditScope weSensitiveAuditScope);
/**
* 批量新增
*
* @param weSensitiveAuditScopeList
* @return
*/
public int insertWeSensitiveAuditScopeList(List<WeSensitiveAuditScope> weSensitiveAuditScopeList);
/**
* 修改敏感词审计范围
*
* @param weSensitiveAuditScope 敏感词审计范围
* @return 结果
*/
public int updateWeSensitiveAuditScope(WeSensitiveAuditScope weSensitiveAuditScope);
/**
* 批量删除敏感词审计范围
*
* @param ids 需要删除的敏感词审计范围ID
* @return 结果
*/
public int deleteWeSensitiveAuditScopeByIds(Long[] ids);
/**
* 删除敏感词审计范围信息
*
* @param id 敏感词审计范围ID
* @return 结果
*/
public int deleteWeSensitiveAuditScopeById(Long id);
public int deleteAuditScopeBySensitiveId(Long sensitiveId);
public int deleteAuditScopeBySensitiveIds(Long[] sensitiveIds);
}
package com.linkwechat.wecom.service;
import com.linkwechat.wecom.domain.WeSensitive;
import java.util.List;
/**
* 敏感词设置Service接口
*
* @author ruoyi
* @date 2020-12-29
*/
public interface IWeSensitiveService {
/**
* 查询敏感词设置
*
* @param id 敏感词设置ID
* @return 敏感词设置
*/
public WeSensitive selectWeSensitiveById(Long id);
/**
* 查询敏感词设置列表
*
* @param weSensitive 敏感词设置
* @return 敏感词设置集合
*/
public List<WeSensitive> selectWeSensitiveList(WeSensitive weSensitive);
/**
* 新增敏感词设置
*
* @param weSensitive 敏感词设置
* @return 结果
*/
public int insertWeSensitive(WeSensitive weSensitive);
/**
* 修改敏感词设置
*
* @param weSensitive 敏感词设置
* @return 结果
*/
public int updateWeSensitive(WeSensitive weSensitive);
/**
* 批量删除敏感词设置
*
* @param ids 需要删除的敏感词设置ID
* @return 结果
*/
public int deleteWeSensitiveByIds(Long[] ids);
/**
* 批量删除敏感词设置信息
*
* @param ids 敏感词设置ID
* @return 结果
*/
public int destroyWeSensitiveByIds(Long[] ids);
}
......@@ -67,7 +67,10 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService {
return findAccessToken(WeConstans.WE_PROVIDER_ACCESS_TOKEN);
}
@Override
public String findChatAccessToken() {
return findAccessToken(WeConstans.WE_CHAT_ACCESS_TOKEN);
}
private String findAccessToken(String accessTokenKey){
......@@ -94,6 +97,10 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService {
WeAccessTokenDtoDto providerToken = accessTokenClient.getProviderToken(wxCorpAccount.getCorpId(), wxCorpAccount.getProviderSecret());
token=providerToken.getProvider_access_token();
expires_in=providerToken.getExpires_in();
}else if (WeConstans.WE_CHAT_ACCESS_TOKEN.equals(accessTokenKey)){
WeAccessTokenDtoDto weAccessTokenDtoDto = accessTokenClient.getToken(wxCorpAccount.getCorpId(),wxCorpAccount.getChatSecret());
token=weAccessTokenDtoDto.getAccess_token();
expires_in=weAccessTokenDtoDto.getExpires_in();
}
if(StringUtils.isNotEmpty(token)){
......
......@@ -8,21 +8,22 @@ import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.domain.elastic.ElasticSearchEntity;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeCustomerClient;
import com.linkwechat.wecom.client.WeMsgAuditClient;
import com.linkwechat.wecom.client.WeUserClient;
import com.linkwechat.wecom.domain.WeChatContactMapping;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.dto.WeUserDto;
import com.linkwechat.wecom.domain.dto.customer.ExternalUserDetail;
import com.linkwechat.wecom.domain.vo.WeMsgAuditVo;
import com.linkwechat.wecom.mapper.WeChatContactMappingMapper;
import com.linkwechat.wecom.mapper.WeCustomerMapper;
import com.linkwechat.wecom.mapper.WeUserMapper;
import com.linkwechat.wecom.service.IWeChatContactMappingService;
import com.linkwechat.wecom.service.IWeConversationArchiveService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
* 聊天关系映射Service业务层处理
......@@ -43,6 +44,10 @@ public class WeChatContactMappingServiceImpl implements IWeChatContactMappingSer
private WeUserClient weUserClient;
@Autowired
private WeCustomerClient weCustomerClient;
@Autowired
private WeMsgAuditClient weMsgAuditClient;
@Autowired
private IWeConversationArchiveService weConversationArchiveService;
/**
* 查询聊天关系映射
......@@ -63,7 +68,30 @@ public class WeChatContactMappingServiceImpl implements IWeChatContactMappingSer
*/
@Override
public List<WeChatContactMapping> selectWeChatContactMappingList(WeChatContactMapping weChatContactMapping) {
return weChatContactMappingMapper.selectWeChatContactMappingList(weChatContactMapping);
List<WeChatContactMapping> weChatMappingList = weChatContactMappingMapper.selectWeChatContactMappingList(weChatContactMapping);
Optional.ofNullable(weChatMappingList).ifPresent(weChatMappingListVo -> {
weChatMappingListVo.stream().forEach(item -> {
if (StringUtils.isNotEmpty(item.getReceiveId())) {
if (WeConstans.ID_TYPE_USER.equals(item.getIsCustom())) {
//成员信息
item.setWeUser(weUserMapper.selectOne(new LambdaQueryWrapper<WeUser>().eq(WeUser::getUserId, item.getReceiveId())));
} else if (WeConstans.ID_TYPE_EX.equals(item.getIsCustom())) {
//获取外部联系人信息
item.setWeCustomer(weCustomerMapper.selectWeCustomerById(item.getReceiveId()));
} else if (WeConstans.ID_TYPE_MACHINE.equals(item.getIsCustom())) {
//拉去机器人信息暂不处理
}
item.setFinalChatContext(weConversationArchiveService.getFinalChatContactInfo(item.getFromId(), item.getReceiveId()));
} else if (StringUtils.isNotEmpty(item.getRoomId())) {
//获取群信息
WeMsgAuditVo weMsgAuditVo = new WeMsgAuditVo();
weMsgAuditVo.setRoomid(item.getRoomId());
item.setRoomInfo(weMsgAuditClient.getGroupChat(weMsgAuditVo));
item.setFinalChatContext(weConversationArchiveService.getFinalChatRoomContactInfo(item.getFromId(), item.getRoomId()));
}
});
});
return weChatMappingList;
}
/**
......@@ -74,7 +102,7 @@ public class WeChatContactMappingServiceImpl implements IWeChatContactMappingSer
*/
@Override
public int insertWeChatContactMapping(WeChatContactMapping weChatContactMapping) {
List<WeChatContactMapping> list = selectWeChatContactMappingList(weChatContactMapping);
List<WeChatContactMapping> list = weChatContactMappingMapper.selectWeChatContactMappingList(weChatContactMapping);
if (CollectionUtil.isEmpty(list)) {
return weChatContactMappingMapper.insertWeChatContactMapping(weChatContactMapping);
}
......@@ -128,12 +156,7 @@ public class WeChatContactMappingServiceImpl implements IWeChatContactMappingSer
String fromId = chatData.getString("from");
int fromType = StringUtils.weCustomTypeJudgment(fromId);
JSONObject fromData = getUserOrCustomInfo(fromId, fromType);
fromWeChatContactMapping.setFromId(fromId);
fromWeChatContactMapping.setFromAvatar(fromData.getString("avatar"));
fromWeChatContactMapping.setFromName(fromData.getString("name"));
fromWeChatContactMapping.setFromGender(fromData.getInteger("gender"));
JSONArray tolist = chatData.getJSONArray("tolist");
if (CollectionUtil.isNotEmpty(tolist)) {
......@@ -141,11 +164,7 @@ public class WeChatContactMappingServiceImpl implements IWeChatContactMappingSer
if (StringUtils.isEmpty(chatData.getString("roomid"))) {
String idStr = String.valueOf(tolist.get(0));
int reveiceType = StringUtils.weCustomTypeJudgment(idStr);
JSONObject reveiceData = getUserOrCustomInfo(idStr, reveiceType);
fromWeChatContactMapping.setReviceId(idStr);
fromWeChatContactMapping.setReviceAvatar(reveiceData.getString("avatar"));
fromWeChatContactMapping.setReviceName(reveiceData.getString("name"));
fromWeChatContactMapping.setReviceGender(reveiceData.getInteger("gender"));
fromWeChatContactMapping.setReceiveId(idStr);
fromWeChatContactMapping.setIsCustom(reveiceType);
} else {
fromWeChatContactMapping.setRoomId(chatData.getString("roomid"));
......@@ -172,55 +191,10 @@ public class WeChatContactMappingServiceImpl implements IWeChatContactMappingSer
if (StringUtils.isNotEmpty(fromWeChatContactMapping.getRoomId())) {
reveiceWeChatContactMapping.setFromId(fromWeChatContactMapping.getRoomId());
} else {
reveiceWeChatContactMapping.setFromId(fromWeChatContactMapping.getReviceId());
reveiceWeChatContactMapping.setFromAvatar(fromWeChatContactMapping.getReviceAvatar());
reveiceWeChatContactMapping.setFromName(fromWeChatContactMapping.getReviceName());
reveiceWeChatContactMapping.setFromGender(fromWeChatContactMapping.getReviceGender());
reveiceWeChatContactMapping.setFromId(fromWeChatContactMapping.getReceiveId());
}
reveiceWeChatContactMapping.setReviceId(fromWeChatContactMapping.getFromId());
reveiceWeChatContactMapping.setReviceAvatar(fromWeChatContactMapping.getFromAvatar());
reveiceWeChatContactMapping.setReviceName(fromWeChatContactMapping.getFromName());
reveiceWeChatContactMapping.setReviceGender(fromWeChatContactMapping.getFromGender());
reveiceWeChatContactMapping.setReceiveId(fromWeChatContactMapping.getFromId());
reveiceWeChatContactMapping.setIsCustom(fromType);
return reveiceWeChatContactMapping;
}
/**
* 获取成员或者客户详情
*
* @param id 用户id
* @param type
* @return
*/
private JSONObject getUserOrCustomInfo(String id, int type) {
JSONObject tempData = new JSONObject();
if (WeConstans.ID_TYPE_USER.equals(type)) {
WeUser weUser = weUserMapper.selectOne(new LambdaQueryWrapper<WeUser>().eq(WeUser::getUserId, id));
if (weUser == null) {
WeUserDto userDto = weUserClient.getUserByUserId(id);
tempData.put("avatar", userDto.getAvatar());
tempData.put("name", userDto.getName());
tempData.put("gender", userDto.getGender());
} else {
tempData.put("avatar", weUser.getAvatarMediaid());
tempData.put("name", weUser.getName());
tempData.put("gender", weUser.getGender());
}
} else if (WeConstans.ID_TYPE_EX.equals(type)) {
WeCustomer weCustomer = weCustomerMapper.selectWeCustomerById(id);
if (weCustomer == null) {
ExternalUserDetail externalUserDetail = weCustomerClient.get(id);
tempData.put("avatar", externalUserDetail.getExternal_contact().getAvatar());
tempData.put("name", externalUserDetail.getExternal_contact().getName());
tempData.put("gender", externalUserDetail.getExternal_contact().getGender());
} else {
tempData.put("avatar", weCustomer.getAvatar());
tempData.put("name", weCustomer.getName());
tempData.put("gender", weCustomer.getGender());
}
} else if (WeConstans.ID_TYPE_MACHINE.equals(type)) {
}
return tempData;
}
}
package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.domain.ConversationArchiveQuery;
import com.linkwechat.common.core.elasticsearch.ElasticSearch;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.service.IWeConversationArchiveService;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.index.query.BoolQueryBuilder;
......@@ -13,11 +17,8 @@ import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @author sxw
......@@ -33,25 +34,122 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS
/**
* 根据用户ID 获取对应内部联系人列表
*
* @param userId
* @param query 入参
* @return
*/
@Override
public List<JSONObject> getInternalContactList(String userId) {
public PageInfo<JSONObject> getChatContactList(ConversationArchiveQuery query) {
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.size(1000);
int from = (query.getPageSize() - 1) * query.getPageNum();
builder.size(query.getPageNum());
builder.from(from);
builder.sort("msgtime", SortOrder.ASC);
BoolQueryBuilder fromBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", ""))
.must(QueryBuilders.matchQuery("from", query.getFromId()))
.must(QueryBuilders.matchQuery("tolist.keyword", query.getReceiveId()));
BoolQueryBuilder toLsitBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", ""))
.must(QueryBuilders.matchQuery("from", query.getReceiveId()))
.must(QueryBuilders.matchQuery("tolist.keyword", query.getFromId()));
//查询聊天类型
if (StringUtils.isNotEmpty(query.getMsgType())) {
fromBuilder.must(QueryBuilders.termQuery("msgtype", query.getMsgType()));
toLsitBuilder.must(QueryBuilders.termQuery("msgtype", query.getMsgType()));
}
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery()
.should(fromBuilder)
.should(toLsitBuilder)
.minimumShouldMatch(1);
//时间范围查询
if (StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime())) {
Date beginTime = DateUtils.dateTime(query.getBeginTime(), DateUtils.YYYY_MM_DD);
Date endTime = DateUtils.dateTime(query.getEndTime(), DateUtils.YYYY_MM_DD);
boolQueryBuilder.filter(QueryBuilders.rangeQuery("msgtime").gte(beginTime).lte(endTime));
}
builder.query(boolQueryBuilder);
return elasticSearch.searchPage(WeConstans.WECOM_FINANCE_INDEX, builder, query.getPageNum(), query.getPageSize(), JSONObject.class);
}
@Override
public PageInfo<JSONObject> getChatRoomContactList(ConversationArchiveQuery query) {
SearchSourceBuilder builder = new SearchSourceBuilder();
int from = (query.getPageSize() - 1) * query.getPageNum();
builder.size(query.getPageNum());
builder.from(from);
builder.sort("msgtime", SortOrder.ASC);
BoolQueryBuilder fromBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", query.getRoomId()))
.must(QueryBuilders.matchQuery("from", query.getFromId()));
BoolQueryBuilder roomidBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", query.getRoomId()))
.must(QueryBuilders.matchQuery("tolist.keyword", query.getFromId()));
//查询聊天类型
if (StringUtils.isNotEmpty(query.getMsgType())) {
fromBuilder.must(QueryBuilders.termQuery("msgtype", query.getMsgType()));
roomidBuilder.must(QueryBuilders.termQuery("msgtype", query.getMsgType()));
}
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery()
.should(fromBuilder)
.should(roomidBuilder);
//时间范围查询
if (StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime())) {
Date beginTime = DateUtils.dateTime(query.getBeginTime(), DateUtils.YYYY_MM_DD);
Date endTime = DateUtils.dateTime(query.getEndTime(), DateUtils.YYYY_MM_DD);
boolQueryBuilder.filter(QueryBuilders.rangeQuery("msgtime").gte(beginTime).lte(endTime));
}
builder.query(boolQueryBuilder);
return elasticSearch.searchPage(WeConstans.WECOM_FINANCE_INDEX, builder, query.getPageNum(), query.getPageSize(), JSONObject.class);
}
@Override
public JSONObject getFinalChatContactInfo(String fromId, String receiveId) {
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.sort("msgtime", SortOrder.ASC);
builder.size(1);
BoolQueryBuilder fromBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", ""))
.must(QueryBuilders.matchQuery("from", fromId))
.must(QueryBuilders.matchQuery("tolist.keyword", receiveId));
BoolQueryBuilder toLsitBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", ""))
.must(QueryBuilders.matchQuery("from", receiveId))
.must(QueryBuilders.matchQuery("tolist.keyword", fromId));
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery()
.should(fromBuilder)
.should(toLsitBuilder)
.minimumShouldMatch(1);
builder.query(boolQueryBuilder);
List<JSONObject> resultList = elasticSearch.search(WeConstans.WECOM_FINANCE_INDEX, builder, JSONObject.class);
if (CollectionUtil.isNotEmpty(resultList)) {
return resultList.get(0);
} else {
return null;
}
}
@Override
public JSONObject getFinalChatRoomContactInfo(String fromId, String roomId) {
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.sort("msgtime", SortOrder.ASC);
builder.size(1);
BoolQueryBuilder fromBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", roomId))
.must(QueryBuilders.matchQuery("from", fromId));
BoolQueryBuilder roomidBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", roomId))
.must(QueryBuilders.matchQuery("tolist.keyword", fromId));
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery()
.should(QueryBuilders.termQuery("tolist.keyword", userId))
.should(QueryBuilders.termQuery("from",userId))
.minimumShouldMatch(1)
.must(QueryBuilders.termQuery("type",1))
.must(QueryBuilders.termQuery("roomid", ""));
.should(fromBuilder)
.should(roomidBuilder);
builder.query(boolQueryBuilder);
List<JSONObject> searchList = elasticSearch.search(WeConstans.WECOM_FINANCE_INDEX, builder, JSONObject.class);
Map<String, List<JSONObject>> from = Optional.ofNullable(searchList)
.orElseGet(ArrayList::new).stream()
.collect(Collectors.groupingBy(item -> item.getString("from")));
return null;
List<JSONObject> resultList = elasticSearch.search(WeConstans.WECOM_FINANCE_INDEX, builder, JSONObject.class);
if (CollectionUtil.isNotEmpty(resultList)) {
return resultList.get(0);
} else {
return null;
}
}
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeCustomerImageMessage;
import com.linkwechat.wecom.mapper.WeCustomerImageMessageMapper;
import com.linkwechat.wecom.service.IWeCustomerImageMessageService;
import org.springframework.stereotype.Service;
/**
* 群发消息 图片消息表 we_customer_imageMessage
*
* @author kewen
* @date 2020-12-12
*/
@Service
public class WeCustomerImageMessageServiceImpl extends ServiceImpl<WeCustomerImageMessageMapper, WeCustomerImageMessage> implements IWeCustomerImageMessageService {
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeCustomerLinkMessage;
import com.linkwechat.wecom.mapper.WeCustomerLinkMessageMapper;
import com.linkwechat.wecom.service.IWeCustomerLinkMessageService;
import org.springframework.stereotype.Service;
/**
* 群发消息 链接消息表 we_customer_linkMessage
*
* @author kewen
* @date 2020-12-13
*/
@Service
public class WeCustomerLinkMessageServiceImpl extends ServiceImpl<WeCustomerLinkMessageMapper, WeCustomerLinkMessage> implements IWeCustomerLinkMessageService {
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
import com.linkwechat.wecom.domain.WeCustomerMessageOriginal;
import com.linkwechat.wecom.domain.dto.message.DetailMessageStatusResultDto;
import com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultDataObjectDto;
import com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultDto;
import com.linkwechat.wecom.domain.vo.CustomerMessagePushVo;
import com.linkwechat.wecom.mapper.WeCustomerMessageOriginalMapper;
import com.linkwechat.wecom.mapper.WeCustomerMessgaeResultMapper;
import com.linkwechat.wecom.service.IWeCustomerMessageOriginalService;
import com.linkwechat.wecom.service.IWeCustomerMessageService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 群发消息 原始数据信息表 we_customer_messageOriginal
......@@ -22,6 +36,18 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer
@Autowired
private WeCustomerMessageOriginalMapper weCustomerMessageOriginalMapper;
@Autowired
private WeCustomerMessagePushClient weCustomerMessagePushClient;
@Autowired
private WeCustomerMessgaeResultMapper weCustomerMessgaeResultMapper;
@Autowired
private IWeCustomerMessageService weCustomerMessageService;
@Autowired
private ObjectMapper objectMapper;
@Override
public int saveWeCustomerMessageOriginal(WeCustomerMessageOriginal weCustomerMessageOriginal) {
return weCustomerMessageOriginalMapper.insert(weCustomerMessageOriginal);
......@@ -32,5 +58,74 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer
return weCustomerMessageOriginalMapper.selectCustomerMessagePushs(sender, content, pushType, beginTime, endTime);
}
@Override
public CustomerMessagePushVo CustomerMessagePushDetail(Long messageId) {
CustomerMessagePushVo customerMessagePushDetail = weCustomerMessageOriginalMapper.findCustomerMessagePushDetail(messageId);
AtomicInteger atomicInteger=new AtomicInteger();
//拉取消息发送结果
CompletableFuture.runAsync(()->{
String msgid = customerMessagePushDetail.getMsgid();
if(StringUtils.isNotEmpty(msgid)){
List<String> msgIds = null;
try {
msgIds = objectMapper.readValue(msgid,new TypeReference<List<String>>() { });
} catch (JsonProcessingException e) {
e.printStackTrace();
}
if(CollectionUtils.isNotEmpty(msgIds)){
msgIds.forEach(m->{
QueryCustomerMessageStatusResultDataObjectDto dataObjectDto=new QueryCustomerMessageStatusResultDataObjectDto();
dataObjectDto.setMsgid(m);
//拉取发送结果
QueryCustomerMessageStatusResultDto queryCustomerMessageStatusResultDto = weCustomerMessagePushClient.queryCustomerMessageStatus(dataObjectDto);
if (WeConstans.WE_SUCCESS_CODE.equals(queryCustomerMessageStatusResultDto.getErrcode())) {
List<DetailMessageStatusResultDto> detailList = queryCustomerMessageStatusResultDto.getDetail_list();
detailList.forEach(d-> {
if(d.getStatus().equals("1")){
atomicInteger.incrementAndGet();
}
weCustomerMessgaeResultMapper.updateWeCustomerMessgaeResult(messageId,d.getChat_id(),d.getExternal_userid(),d.getStatus(),d.getSend_time());
});
}
});
}
}
//更新微信实际发送条数
weCustomerMessageService.updateWeCustomerMessageActualSend(messageId,atomicInteger.get());
});
return customerMessagePushDetail;
}
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeCustomerMessage;
import com.linkwechat.wecom.mapper.WeCustomerMessageMapper;
import com.linkwechat.wecom.service.IWeCustomerMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
......@@ -14,4 +15,17 @@ import org.springframework.stereotype.Service;
*/
@Service
public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageMapper, WeCustomerMessage> implements IWeCustomerMessageService {
@Autowired
private WeCustomerMessageMapper weCustomerMessageMapper;
@Override
public int updateWeCustomerMessageMsgId(WeCustomerMessage customerMessage) {
return weCustomerMessageMapper.updateWeCustomerMessageMsgIdById(customerMessage);
}
@Override
public int updateWeCustomerMessageActualSend(Long messageId, Integer actualSend) {
return weCustomerMessageMapper.updateWeCustomerMessageActualSend(messageId, actualSend);
}
}
......@@ -2,10 +2,14 @@ package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeCustomerMessgaeResult;
import com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo;
import com.linkwechat.wecom.mapper.WeCustomerMessgaeResultMapper;
import com.linkwechat.wecom.service.IWeCustomerMessgaeResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 群发消息 微信消息发送结果表 we_customer_messgaeResult
*
......@@ -14,4 +18,13 @@ import org.springframework.stereotype.Service;
*/
@Service
public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMessgaeResultMapper, WeCustomerMessgaeResult> implements IWeCustomerMessgaeResultService {
@Autowired
private WeCustomerMessgaeResultMapper customerMessgaeResultMapper;
@Override
public List<WeCustomerMessageResultVo> customerMessagePushs(Long messageId, String status) {
return customerMessgaeResultMapper.customerMessagePushs(messageId, status);
}
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeCustomerMiniprogramMessage;
import com.linkwechat.wecom.mapper.WeCustomerMiniprogramMessageMapper;
import com.linkwechat.wecom.service.IWeCustomerMiniprogramMessageService;
import org.springframework.stereotype.Service;
/**
* 群发消息 小程序消息表 we_customer_miniprogramMessage
*
* @author kewen
* @date 2020-12-12
*/
@Service
public class WeCustomerMiniprogramMessageServiceImpl extends ServiceImpl<WeCustomerMiniprogramMessageMapper, WeCustomerMiniprogramMessage> implements IWeCustomerMiniprogramMessageService {
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.domain.WeCustomerSeedMessage;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
import com.linkwechat.wecom.mapper.WeCustomerSeedMessageMapper;
import com.linkwechat.wecom.service.IWeCustomerSeedMessageService;
import org.springframework.stereotype.Service;
/**
* 群发消息 子消息表(包括 文本消息、图片消息、链接消息、小程序消息) we_customer_seedMessage
*
* @author kewen
* @date 2020-12-28
*/
@Service
public class WeCustomerSeedMessageServiceImpl extends ServiceImpl<WeCustomerSeedMessageMapper, WeCustomerSeedMessage> implements IWeCustomerSeedMessageService {
@Override
public void saveSeedMessage(CustomerMessagePushDto customerMessagePushDto, long messageId) {
WeCustomerSeedMessage customerSeedMessage=new WeCustomerSeedMessage();
customerSeedMessage.setSeedMessageId(SnowFlakeUtil.nextId());
customerSeedMessage.setMessageId(messageId);
//文本消息
customerSeedMessage.setContent(customerMessagePushDto.getTextMessage()!=null ?customerMessagePushDto.getTextMessage().getContent():null);
//图片消息
customerSeedMessage.setMediaId(customerMessagePushDto.getImageMessage()!=null ?customerMessagePushDto.getImageMessage().getMedia_id():null);
customerSeedMessage.setPicUrl(customerMessagePushDto.getImageMessage()!=null ?customerMessagePushDto.getImageMessage().getPic_url():null);
//链接消息
customerSeedMessage.setLinkUrl(customerMessagePushDto.getLinkMessage()!=null ?customerMessagePushDto.getLinkMessage().getUrl():null);
customerSeedMessage.setLinkTitle(customerMessagePushDto.getLinkMessage()!=null ?customerMessagePushDto.getLinkMessage().getTitle():null);
customerSeedMessage.setLinkPicurl(customerMessagePushDto.getLinkMessage()!=null ?customerMessagePushDto.getLinkMessage().getPicurl():null);
customerSeedMessage.setLinDesc(customerMessagePushDto.getLinkMessage()!=null ?customerMessagePushDto.getLinkMessage().getDesc():null);
//小程序消息
customerSeedMessage.setMiniprogramTitle(customerMessagePushDto.getMiniprogramMessage()!=null ?customerMessagePushDto.getMiniprogramMessage().getTitle():null);
customerSeedMessage.setMiniprogramMediaId(customerMessagePushDto.getMiniprogramMessage()!=null ?customerMessagePushDto.getMiniprogramMessage().getPic_media_id():null);
customerSeedMessage.setAppid(customerMessagePushDto.getMiniprogramMessage()!=null ?customerMessagePushDto.getMiniprogramMessage().getAppid():null);
customerSeedMessage.setPage(customerMessagePushDto.getMiniprogramMessage()!=null ?customerMessagePushDto.getMiniprogramMessage().getPage():null);
this.save(customerSeedMessage);
}
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeCustomerTextMessag;
import com.linkwechat.wecom.mapper.WeCustomerTextMessagMapper;
import com.linkwechat.wecom.service.IWeCustomerTextMessagService;
import org.springframework.stereotype.Service;
/**
* 群发消息 文本消息表 we_customer_textMessage
*
* @author kewen
* @date 2020-12-12
*/
@Service
public class WeCustomerTextMessagServiceImpl extends ServiceImpl<WeCustomerTextMessagMapper, WeCustomerTextMessag> implements IWeCustomerTextMessagService {
}
package com.linkwechat.wecom.service.impl;
import com.linkwechat.wecom.domain.WeSensitiveAuditScope;
import com.linkwechat.wecom.mapper.WeSensitiveAuditScopeMapper;
import com.linkwechat.wecom.service.IWeSensitiveAuditScopeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 敏感词审计范围Service业务层处理
*
* @author ruoyi
* @date 2020-12-29
*/
@Service
public class WeSensitiveAuditScopeServiceImpl implements IWeSensitiveAuditScopeService {
@Autowired
private WeSensitiveAuditScopeMapper weSensitiveAuditScopeMapper;
/**
* 查询敏感词审计范围
*
* @param id 敏感词审计范围ID
* @return 敏感词审计范围
*/
@Override
public WeSensitiveAuditScope selectWeSensitiveAuditScopeById(Long id) {
return weSensitiveAuditScopeMapper.selectWeSensitiveAuditScopeById(id);
}
/**
* 查询敏感词审计范围列表
*
* @param weSensitiveAuditScope 敏感词审计范围
* @return 敏感词审计范围
*/
@Override
public List<WeSensitiveAuditScope> selectWeSensitiveAuditScopeList(WeSensitiveAuditScope weSensitiveAuditScope) {
return weSensitiveAuditScopeMapper.selectWeSensitiveAuditScopeList(weSensitiveAuditScope);
}
/**
* 新增敏感词审计范围
*
* @param weSensitiveAuditScope 敏感词审计范围
* @return 结果
*/
@Override
public int insertWeSensitiveAuditScope(WeSensitiveAuditScope weSensitiveAuditScope) {
return weSensitiveAuditScopeMapper.insertWeSensitiveAuditScope(weSensitiveAuditScope);
}
@Override
public int insertWeSensitiveAuditScopeList(List<WeSensitiveAuditScope> weSensitiveAuditScopeList) {
return weSensitiveAuditScopeMapper.insertWeSensitiveAuditScopeList(weSensitiveAuditScopeList);
}
/**
* 修改敏感词审计范围
*
* @param weSensitiveAuditScope 敏感词审计范围
* @return 结果
*/
@Override
public int updateWeSensitiveAuditScope(WeSensitiveAuditScope weSensitiveAuditScope) {
return weSensitiveAuditScopeMapper.updateWeSensitiveAuditScope(weSensitiveAuditScope);
}
/**
* 批量删除敏感词审计范围
*
* @param ids 需要删除的敏感词审计范围ID
* @return 结果
*/
@Override
public int deleteWeSensitiveAuditScopeByIds(Long[] ids) {
return weSensitiveAuditScopeMapper.deleteWeSensitiveAuditScopeByIds(ids);
}
/**
* 删除敏感词审计范围信息
*
* @param id 敏感词审计范围ID
* @return 结果
*/
@Override
public int deleteWeSensitiveAuditScopeById(Long id) {
return weSensitiveAuditScopeMapper.deleteWeSensitiveAuditScopeById(id);
}
@Override
public int deleteAuditScopeBySensitiveId(Long sensitiveId) {
return weSensitiveAuditScopeMapper.deleteAuditScopeBySensitiveId(sensitiveId);
}
@Override
public int deleteAuditScopeBySensitiveIds(Long[] sensitiveIds) {
return weSensitiveAuditScopeMapper.deleteAuditScopeBySensitiveIds(sensitiveIds);
}
}
package com.linkwechat.wecom.service.impl;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.wecom.domain.WeSensitive;
import com.linkwechat.wecom.mapper.WeSensitiveMapper;
import com.linkwechat.wecom.service.IWeSensitiveAuditScopeService;
import com.linkwechat.wecom.service.IWeSensitiveService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 敏感词设置Service业务层处理
*
* @author ruoyi
* @date 2020-12-29
*/
@Service
public class WeSensitiveServiceImpl implements IWeSensitiveService {
@Autowired
private WeSensitiveMapper weSensitiveMapper;
@Autowired
private IWeSensitiveAuditScopeService sensitiveAuditScopeService;
/**
* 查询敏感词设置
*
* @param id 敏感词设置ID
* @return 敏感词设置
*/
@Override
public WeSensitive selectWeSensitiveById(Long id) {
return weSensitiveMapper.selectWeSensitiveById(id);
}
/**
* 查询敏感词设置列表
*
* @param weSensitive 敏感词设置
* @return 敏感词设置
*/
@Override
public List<WeSensitive> selectWeSensitiveList(WeSensitive weSensitive) {
return weSensitiveMapper.selectWeSensitiveList(weSensitive);
}
/**
* 新增敏感词设置
*
* @param weSensitive 敏感词设置
* @return 结果
*/
@Override
@Transactional
public int insertWeSensitive(WeSensitive weSensitive) {
weSensitive.setCreateBy(SecurityUtils.getUsername());
weSensitive.setCreateTime(DateUtils.getNowDate());
int insertResult = weSensitiveMapper.insertWeSensitive(weSensitive);
if (insertResult > 0) {
if (CollectionUtils.isNotEmpty(weSensitive.getAuditUserScope())) {
if (weSensitive.getId() != null) {
weSensitive.getAuditUserScope().forEach(scope -> {
scope.setSensitiveId(weSensitive.getId());
});
sensitiveAuditScopeService.insertWeSensitiveAuditScopeList(weSensitive.getAuditUserScope());
}
}
}
return insertResult;
}
/**
* 修改敏感词设置
*
* @param weSensitive 敏感词设置
* @return 结果
*/
@Override
@Transactional
public int updateWeSensitive(WeSensitive weSensitive) {
weSensitive.setUpdateBy(SecurityUtils.getUsername());
weSensitive.setUpdateTime(DateUtils.getNowDate());
int updateResult = weSensitiveMapper.updateWeSensitive(weSensitive);
if (updateResult > 0 && weSensitive.getAuditUserScope() != null) {
//删除原有关联信息
sensitiveAuditScopeService.deleteAuditScopeBySensitiveId(weSensitive.getId());
if (CollectionUtils.isNotEmpty(weSensitive.getAuditUserScope())) {
weSensitive.getAuditUserScope().forEach(scope -> {
scope.setSensitiveId(weSensitive.getId());
});
sensitiveAuditScopeService.insertWeSensitiveAuditScopeList(weSensitive.getAuditUserScope());
}
}
return updateResult;
}
/**
* 批量删除敏感词设置
*
* @param ids 需要删除的敏感词设置ID
* @return 结果
*/
@Override
public int deleteWeSensitiveByIds(Long[] ids) {
List<WeSensitive> sensitiveList = weSensitiveMapper.selectWeSensitiveByIds(ids);
sensitiveList.forEach(sensitive -> {
sensitive.setDelFlag(1);
sensitive.setUpdateBy(SecurityUtils.getUsername());
sensitive.setUpdateTime(DateUtils.getNowDate());
});
return weSensitiveMapper.batchUpdateWeSensitive(sensitiveList);
}
/**
* 批量删除敏感词配置数据
*
* @param ids 敏感词设置ID
* @return 结果
*/
@Override
@Transactional
public int destroyWeSensitiveByIds(Long[] ids) {
int deleteResult = weSensitiveMapper.deleteWeSensitiveByIds(ids);
if (deleteResult > 0) {
//删除关联数据
sensitiveAuditScopeService.deleteAuditScopeBySensitiveIds(ids);
}
return deleteResult;
}
}
......@@ -7,34 +7,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="WeChatContactMapping" id="WeChatContactMappingResult">
<result property="id" column="id" />
<result property="fromId" column="from_id" />
<result property="fromAvatar" column="from_avatar" />
<result property="fromName" column="from_name" />
<result property="fromGender" column="from_gender" />
<result property="reviceAvatar" column="revice_avatar" />
<result property="reviceName" column="revice_name" />
<result property="reviceGender" column="revice_gender" />
<result property="reviceId" column="revice_id" />
<result property="receiveId" column="receive_id" />
<result property="roomId" column="room_id" />
<result property="isCustom" column="is_custom" />
</resultMap>
<sql id="selectWeChatContactMappingVo">
select id, from_id, from_avatar, from_name, from_gender, revice_avatar, revice_name, revice_gender, revice_id, room_id, is_custom from we_chat_contact_mapping
select id, from_id, receive_id, room_id, is_custom from we_chat_contact_mapping
</sql>
<select id="selectWeChatContactMappingList" parameterType="WeChatContactMapping" resultMap="WeChatContactMappingResult">
<include refid="selectWeChatContactMappingVo"/>
<where>
<if test="fromId != null and fromId != ''"> and from_id = #{fromId}</if>
<if test="fromAvatar != null and fromAvatar != ''"> and from_avatar = #{fromAvatar}</if>
<if test="fromName != null and fromName != ''"> and from_name like concat('%', #{fromName}, '%')</if>
<if test="fromGender != null "> and from_gender = #{fromGender}</if>
<if test="reviceAvatar != null and reviceAvatar != ''"> and revice_avatar = #{reviceAvatar}</if>
<if test="reviceName != null and reviceName != ''"> and revice_name like concat('%', #{reviceName}, '%')</if>
<if test="reviceGender != null "> and revice_gender = #{reviceGender}</if>
<if test="reviceId != null and reviceId != ''"> and revice_id = #{reviceId}</if>
<if test="receiveId != null and receiveId != ''"> and receive_id = #{receiveId}</if>
<if test="roomId != null and roomId != ''"> and room_id = #{roomId}</if>
<if test="isCustom != null "> and is_custom = #{isCustom}</if>
<choose>
<when test="searchType != null and searchType == 0">
and is_custom = 0
</when>
<when test="searchType != null and searchType == 1">
and is_custom in (1,2)
</when>
<when test="searchType != null and searchType == 2">
and room_id is not null
</when>
<when test="searchType != null and searchType == 3">
and is_custom in (0,1,2)
</when>
</choose>
</where>
</select>
......@@ -47,25 +48,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into we_chat_contact_mapping
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fromId != null and fromId != ''">from_id,</if>
<if test="fromAvatar != null">from_avatar,</if>
<if test="fromName != null">from_name,</if>
<if test="fromGender != null">from_gender,</if>
<if test="reviceAvatar != null">revice_avatar,</if>
<if test="reviceName != null">revice_name,</if>
<if test="reviceGender != null">revice_gender,</if>
<if test="reviceId != null and reviceId != ''">revice_id,</if>
<if test="receiveId != null and receiveId != ''">receive_id,</if>
<if test="roomId != null">room_id,</if>
<if test="isCustom != null">is_custom,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fromId != null and fromId != ''">#{fromId},</if>
<if test="fromAvatar != null">#{fromAvatar},</if>
<if test="fromName != null">#{fromName},</if>
<if test="fromGender != null">#{fromGender},</if>
<if test="reviceAvatar != null">#{reviceAvatar},</if>
<if test="reviceName != null">#{reviceName},</if>
<if test="reviceGender != null">#{reviceGender},</if>
<if test="reviceId != null and reviceId != ''">#{reviceId},</if>
<if test="receiveId != null and receiveId != ''">#{receiveId},</if>
<if test="roomId != null">#{roomId},</if>
<if test="isCustom != null">#{isCustom},</if>
</trim>
......@@ -75,13 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update we_chat_contact_mapping
<trim prefix="SET" suffixOverrides=",">
<if test="fromId != null and fromId != ''">from_id = #{fromId},</if>
<if test="fromAvatar != null">from_avatar = #{fromAvatar},</if>
<if test="fromName != null">from_name = #{fromName},</if>
<if test="fromGender != null">from_gender = #{fromGender},</if>
<if test="reviceAvatar != null">revice_avatar = #{reviceAvatar},</if>
<if test="reviceName != null">revice_name = #{reviceName},</if>
<if test="reviceGender != null">revice_gender = #{reviceGender},</if>
<if test="reviceId != null and reviceId != ''">revice_id = #{reviceId},</if>
<if test="receiveId != null and receiveId != ''">receive_id = #{receiveId},</if>
<if test="roomId != null">room_id = #{roomId},</if>
<if test="isCustom != null">is_custom = #{isCustom},</if>
</trim>
......
......@@ -17,13 +17,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="contactSecret" column="contact_secret" />
<result property="agentId" column="agent_id" />
<result property="chatSecret" column="chat_secret" />
<result property="providerSecret" column="provider_secret" />
<result property="customerChurnNoticeSwitch" column="customer_churn_notice_switch" />
<result property="wxQrLoginRedirectUri" column="wx_qr_login_redirect_uri"/>
</resultMap>
<sql id="selectWeCorpAccountVo">
select id,provider_secret,company_name, corp_id, corp_secret,agent_id ,status, del_flag, create_by, create_time, update_by, update_time,contact_secret, customer_churn_notice_switch,wx_qr_login_redirect_uri from we_corp_account
select id,chat_secret,provider_secret,company_name, corp_id, corp_secret,agent_id ,status, del_flag, create_by, create_time, update_by, update_time,contact_secret, customer_churn_notice_switch,wx_qr_login_redirect_uri from we_corp_account
</sql>
<select id="selectWeCorpAccountList" parameterType="WeCorpAccount" resultMap="WeCorpAccountResult">
......@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="contactSecret != null ">contact_secret,</if>
<if test="chatSecret != null ">chat_secret,</if>
<if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
......@@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="contactSecret != null ">#{contactSecret},</if>
<if test="chatSecret != null ">#{chatSecret},</if>
<if test="customerChurnNoticeSwitch != null ">#{customerChurnNoticeSwitch},</if>
</trim>
</insert>
......@@ -84,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="contactSecret != null ">contact_secret = #{contactSecret},</if>
<if test="chatSecret != null ">chat_secret = #{chatSecret},</if>
<if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch = #{customerChurnNoticeSwitch},</if>
</trim>
where id = #{id}
......
<?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.linkwechat.wecom.mapper.WeCustomerLinkMessageMapper">
</mapper>
......@@ -15,6 +15,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="corpName" column="corp_name" />
<result property="corpFullName" column="corp_full_name" />
<result property="position" column="position" />
<result property="userName" column="user_name" />
<result property="userId" column="user_id" />
<collection property="weFlowerCustomerRels" ofType="com.linkwechat.wecom.domain.WeFlowerCustomerRel">
<result property="id" column="wfcrId" />
<result property="userId" column="user_id" />
......@@ -159,7 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWeCustomerById" parameterType="String" resultMap="WeCustomerResult">
<select id="selectWeCustomerById" parameterType="String" resultType="WeCustomer">
<include refid="selectWeCustomerVo"/>
where external_userid = #{externalUserId}
</select>
......
......@@ -3,4 +3,23 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeCustomerMessageMapper">
<update id="updateWeCustomerMessageMsgIdById">
UPDATE we_customer_message
<set>
msgid=#{msgid}
</set>
<where>
message_id=#{messageId}
</where>
</update>
<update id="updateWeCustomerMessageActualSend">
UPDATE we_customer_message
<set>
actual_send=#{actualSend}
</set>
<where>
message_id=#{messageId}
</where>
</update>
</mapper>
......@@ -28,4 +28,27 @@
</if>
</where>
</select>
<select id="findCustomerMessagePushDetail"
resultType="com.linkwechat.wecom.domain.vo.CustomerMessagePushVo">
SELECT
wcmo.push_type,
wcmo.message_type,
wcmo.push_range,
wcm.create_by sender,
wcmo.create_time sendTime,
wcm.message_id,
wcm.content,
wcm.msgid,
wcm.chat_type,
wcm.setting_time,
wcm.expect_send,
wcm.actual_send,
wcm.timed_task
FROM
we_customer_messageOriginal wcmo
LEFT JOIN we_customer_message wcm ON wcmo.message_original_Id = wcm.original_id
<where>
wcm.message_id=#{messageId}
</where>
</select>
</mapper>
\ No newline at end of file
<?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.linkwechat.wecom.mapper.WeCustomerMessgaeResultMapper">
<update id="updateWeCustomerMessgaeResult">
UPDATE we_customer_messgaeResult
<set>
<if test="sendTime!=null and sendTime!=''">
send_time=#{sendTime},
</if>
<if test="status!=null and status!=''">
status=#{status}
</if>
</set>
<where>
message_id=#{messageId}
<if test="chatId!=null and chatId!=''">
AND chat_id=#{chatId}
</if>
<if test="externalUserid!=null and externalUserid!=''">
AND external_userid=#{externalUserid}
</if>
</where>
</update>
<select id="customerMessagePushs" resultType="com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo">
SELECT
user_name,
GROUP_CONCAT(external_name SEPARATOR '、') customers
FROM
we_customer_messgaeResult
<where>
message_id=#{messageId}
<if test="status!=null">
AND `status`=#{status}
</if>
</where>
GROUP BY user_name
</select>
</mapper>
\ No newline at end of file
<?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.linkwechat.wecom.mapper.WeCustomerMiniprogramMessageMapper">
</mapper>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeCustomerImageMessageMapper">
</mapper>
<mapper namespace="com.linkwechat.wecom.mapper.WeCustomerSeedMessageMapper">
</mapper>
\ No newline at end of file
<?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.linkwechat.wecom.mapper.WeCustomerTextMessagMapper">
</mapper>
\ No newline at end of file
<?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.linkwechat.wecom.mapper.WeSensitiveAuditScopeMapper">
<resultMap type="WeSensitiveAuditScope" id="WeSensitiveAuditScopeResult">
<result property="id" column="id"/>
<result property="sensitiveId" column="sensitive_id"/>
<result property="scopeType" column="scope_type"/>
<result property="auditScopeId" column="audit_scope_id"/>
<result property="auditScopeName" column="audit_scope_name"/>
</resultMap>
<sql id="selectWeSensitiveAuditScopeVo">
select id, sensitive_id, scope_type, audit_scope_id, audit_scope_name from we_sensitive_audit_scope
</sql>
<select id="selectWeSensitiveAuditScopeList" parameterType="WeSensitiveAuditScope"
resultMap="WeSensitiveAuditScopeResult">
<include refid="selectWeSensitiveAuditScopeVo"/>
<where>
<if test="sensitiveId != null ">and sensitive_id = #{sensitiveId}</if>
<if test="scopeType != null ">and scope_type = #{scopeType}</if>
<if test="auditScopeId != null ">and audit_scope_id = #{auditScopeId}</if>
<if test="auditScopeName != null and auditScopeName != ''">and audit_scope_name like concat('%',
#{auditScopeName}, '%')
</if>
</where>
</select>
<select id="selectWeSensitiveAuditScopeById" parameterType="Long" resultMap="WeSensitiveAuditScopeResult">
<include refid="selectWeSensitiveAuditScopeVo"/>
where id = #{id}
</select>
<insert id="insertWeSensitiveAuditScope" parameterType="WeSensitiveAuditScope" useGeneratedKeys="true"
keyProperty="id">
insert into we_sensitive_audit_scope
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sensitiveId != null ">sensitive_id,</if>
<if test="scopeType != null">scope_type,</if>
<if test="auditScopeId != null">audit_scope_id,</if>
<if test="auditScopeName != null and auditScopeName != ''">audit_scope_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sensitiveId != null ">#{sensitiveId},</if>
<if test="scopeType != null">#{scopeType},</if>
<if test="auditScopeId != null">#{auditScopeId},</if>
<if test="auditScopeName != null and auditScopeName != ''">#{auditScopeName},</if>
</trim>
</insert>
<insert id="insertWeSensitiveAuditScopeList" parameterType="java.util.List" useGeneratedKeys="true"
keyProperty="id">
insert into we_sensitive_audit_scope(sensitive_id,scope_type,audit_scope_id,audit_scope_name)
values
<foreach collection="list" item="item" separator=",">
(#{item.sensitiveId},#{item.scopeType},#{item.auditScopeId},#{item.auditScopeName})
</foreach>
</insert>
<update id="updateWeSensitiveAuditScope" parameterType="WeSensitiveAuditScope">
update we_sensitive_audit_scope
<trim prefix="SET" suffixOverrides=",">
<if test="sensitiveId != null ">sensitive_id = #{sensitiveId},</if>
<if test="scopeType != null">scope_type = #{scopeType},</if>
<if test="auditScopeId != null">audit_scope_id = #{auditScopeId},</if>
<if test="auditScopeName != null and auditScopeName != ''">audit_scope_name = #{auditScopeName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWeSensitiveAuditScopeById" parameterType="Long">
delete from we_sensitive_audit_scope where id = #{id}
</delete>
<delete id="deleteAuditScopeBySensitiveId" parameterType="Long">
delete from we_sensitive_audit_scope where sensitive_id = #{sensitiveId}
</delete>
<delete id="deleteWeSensitiveAuditScopeByIds">
delete from we_sensitive_audit_scope where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteAuditScopeBySensitiveIds">
delete from we_sensitive_audit_scope where sensitive_id in
<foreach item="sensitiveId" collection="array" open="(" separator="," close=")">
#{sensitiveId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.linkwechat.wecom.mapper.WeSensitiveMapper">
<resultMap type="WeSensitive" id="WeSensitiveResult">
<result property="id" column="id"/>
<result property="strategyName" column="strategy_name"/>
<result property="patternWords" column="pattern_words"/>
<result property="auditUserId" column="audit_user_id"/>
<result property="auditUserName" column="audit_user_name"/>
<result property="alertFlag" column="alert_flag"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<collection property="auditUserScope" ofType="com.linkwechat.wecom.domain.WeSensitiveAuditScope">
<result property="scopeType" column="scope_type"/>
<result property="auditScopeId" column="audit_scope_id"/>
<result property="auditScopeName" column="audit_scope_name"/>
</collection>
</resultMap>
<sql id="selectWeSensitiveVo">
select id, strategy_name, pattern_words, audit_user_id, audit_user_name, alert_flag, del_flag, create_by,
create_time, update_by, update_time from we_sensitive
</sql>
<sql id="selectWeSensitiveList">
select a.*,b.audit_scope_id,b.audit_scope_name,b.scope_type from we_sensitive a left join we_sensitive_audit_scope b on a.id
= b.sensitive_id
</sql>
<select id="selectWeSensitiveList" parameterType="WeSensitive" resultMap="WeSensitiveResult">
<include refid="selectWeSensitiveList"/>
<where>
<if test="strategyName != null and strategyName != ''">and a.strategy_name like concat('%',
#{strategyName}, '%')
</if>
<if test="patternWords != null and patternWords != ''">and a.pattern_words like concat('%',
#{patternWords}, '%')
</if>
<if test="auditUserId != null ">and a.audit_user_id = #{auditUserId}</if>
<if test="auditUserName != null and auditUserName != ''">and a.audit_user_name like concat('%',
#{auditUserName}, '%')
</if>
</where>
</select>
<select id="selectWeSensitiveById" parameterType="Long" resultMap="WeSensitiveResult">
<include refid="selectWeSensitiveList"/>
where a.id = #{id}
</select>
<select id="selectWeSensitiveByIds" parameterType="String" resultMap="WeSensitiveResult">
<include refid="selectWeSensitiveList"/>
where a.id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertWeSensitive" parameterType="WeSensitive" useGeneratedKeys="true" keyProperty="id">
insert into we_sensitive
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="strategyName != null and strategyName != ''">strategy_name,</if>
<if test="patternWords != null and patternWords != ''">pattern_words,</if>
<if test="auditUserId != null">audit_user_id,</if>
<if test="auditUserName != null and auditUserName != ''">audit_user_name,</if>
<if test="alertFlag != null">alert_flag,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="strategyName != null and strategyName != ''">#{strategyName},</if>
<if test="patternWords != null and patternWords != ''">#{patternWords},</if>
<if test="auditUserId != null">#{auditUserId},</if>
<if test="auditUserName != null and auditUserName != ''">#{auditUserName},</if>
<if test="alertFlag != null">#{alertFlag},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateWeSensitive" parameterType="WeSensitive">
update we_sensitive
<trim prefix="SET" suffixOverrides=",">
<if test="strategyName != null and strategyName != ''">strategy_name = #{strategyName},</if>
<if test="patternWords != null and patternWords != ''">pattern_words = #{patternWords},</if>
<if test="auditUserId != null">audit_user_id = #{auditUserId},</if>
<if test="auditUserName != null">audit_user_name = #{auditUserName},</if>
<if test="alertFlag != null">alert_flag = #{alertFlag},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<update id="batchUpdateWeSensitive" parameterType="java.util.List">
update we_sensitive
<trim prefix="SET" suffixOverrides=",">
<trim prefix="strategy_name = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.strategyName != null and item.strategyName != ''">
when id = #{item.id} then #{item.strategyName}
</if>
</foreach>
</trim>
<trim prefix="pattern_words = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.patternWords != null and item.patternWords != ''">
when id = #{item.id} then #{item.patternWords}
</if>
</foreach>
</trim>
<trim prefix="audit_user_id = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.auditUserId != null">
when id = #{item.id} then #{item.auditUserId}
</if>
</foreach>
</trim>
<trim prefix="audit_user_name = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.auditUserName != null and item.auditUserName != ''">
when id = #{item.id} then #{item.auditUserName}
</if>
</foreach>
</trim>
<trim prefix="alert_flag = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.alertFlag != null">
when id = #{item.id} then #{item.alertFlag}
</if>
</foreach>
</trim>
<trim prefix="del_flag = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.delFlag != null">
when id = #{item.id} then #{item.delFlag}
</if>
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.createBy != null and item.createBy != ''">
when id = #{item.id} then #{item.createBy}
</if>
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.createTime != null">
when id = #{item.id} then #{item.createTime}
</if>
</foreach>
</trim>
<trim prefix="update_by = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.updateBy != null and item.updateBy != ''">
when id = #{item.id} then #{item.updateBy}
</if>
</foreach>
</trim>
<trim prefix="update_time = case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.updateTime != null">
when id = #{item.id} then #{item.updateTime}
</if>
</foreach>
</trim>
</trim>
WHERE id in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<delete id="deleteWeSensitiveById" parameterType="Long">
delete from we_sensitive where id = #{id}
</delete>
<delete id="deleteWeSensitiveByIds">
delete from we_sensitive where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -10,7 +10,7 @@ Target Server Type : MYSQL
Target Server Version : 50718
File Encoding : 65001
Date: 2020-12-25 14:01:49
Date: 2020-12-30 10:16:02
*/
SET FOREIGN_KEY_CHECKS=0;
......@@ -5678,6 +5678,24 @@ CREATE TABLE `we_category` (
-- ----------------------------
-- ----------------------------
-- Table structure for we_chat_contact_mapping
-- ----------------------------
DROP TABLE IF EXISTS `we_chat_contact_mapping`;
CREATE TABLE `we_chat_contact_mapping` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`from_id` varchar(32) NOT NULL COMMENT '发送人id',
`receive_id` varchar(32) DEFAULT NULL COMMENT '接收人id',
`room_id` varchar(32) DEFAULT NULL COMMENT '群聊id',
`is_custom` tinyint(4) DEFAULT NULL COMMENT '接收人是否为客户 0-成员 1-客户 2-机器人',
PRIMARY KEY (`id`),
KEY `we_chat_contact_mapping_from_id_IDX` (`from_id`,`is_custom`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Records of we_chat_contact_mapping
-- ----------------------------
-- ----------------------------
-- Table structure for we_config
-- ----------------------------
DROP TABLE IF EXISTS `we_config`;
......@@ -5705,6 +5723,7 @@ CREATE TABLE `we_corp_account` (
`contact_secret` varchar(64) DEFAULT NULL COMMENT '外部联系人密钥',
`wx_qr_login_redirect_uri` varchar(64) DEFAULT NULL COMMENT '企业微信扫码登陆系统回调地址',
`provider_secret` varchar(64) DEFAULT NULL,
`chat_secret` varchar(64) DEFAULT NULL COMMENT '会话存档密钥',
`agent_id` varchar(64) DEFAULT NULL COMMENT '应用id',
`status` char(1) DEFAULT '1' COMMENT '帐号状态(0正常 1停用)',
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
......@@ -5798,6 +5817,8 @@ CREATE TABLE `we_customer_message` (
`sender` varchar(255) DEFAULT NULL COMMENT '发送企业群发消息的成员userid,当类型为发送给客户群时必填(和企微客户沟通后确认是群主id)',
`check_status` varchar(2) DEFAULT NULL COMMENT '消息发送状态 0 未发送 1 已发送',
`msgid` varchar(100) DEFAULT NULL COMMENT '企业群发消息的id,可用于<a href="https://work.weixin.qq.com/api/doc/90000/90135/92136">获取群发消息发送结果</a>',
`content` text COMMENT '消息内容',
`send_info` varchar(255) DEFAULT NULL COMMENT '发送情况 ps:显示样式 1)定时任务 发送时间:2020-12-25 10:00:00 2) 预计发送3190人,已成功发送0人 3)预计发送2个群,已成功发送0个群 ',
`create_by` varchar(64) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
`update_by` varchar(64) DEFAULT NULL,
......@@ -5847,11 +5868,16 @@ CREATE TABLE `we_customer_messgaeResult` (
`userid` varchar(100) DEFAULT NULL COMMENT '企业服务人员的userid',
`status` varchar(2) DEFAULT NULL COMMENT '发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败',
`send_time` varchar(40) DEFAULT NULL,
`external_name` varchar(100) DEFAULT NULL COMMENT '外部联系人名称',
`user_name` varchar(100) DEFAULT NULL COMMENT '企业服务人员的名称',
`send_type` varchar(1) DEFAULT NULL COMMENT '0 发给客户 1 发给客户群 2 定时发送',
`setting_time` varchar(40) DEFAULT NULL COMMENT '定时发送时间',
`create_by` varchar(64) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
`update_by` varchar(64) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`del_flag` int(2) DEFAULT '0',
`chat_name` varchar(255) DEFAULT NULL COMMENT '外部客户群名称',
PRIMARY KEY (`messgae_result_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='群发消息 微信消息发送结果';
......@@ -5883,6 +5909,37 @@ CREATE TABLE `we_customer_miniprogramMessage` (
-- ----------------------------
-- ----------------------------
-- Table structure for we_customer_seedMessage
-- ----------------------------
DROP TABLE IF EXISTS `we_customer_seedMessage`;
CREATE TABLE `we_customer_seedMessage` (
`image_message_id` bigint(64) DEFAULT NULL,
`message_id` bigint(64) DEFAULT NULL COMMENT '微信消息表id',
`content` text COMMENT '消息文本内容,最多4000个字节',
`media_id` varchar(100) DEFAULT NULL COMMENT '图片消息:图片的media_id,可以通过 <a href="https://work.weixin.qq.com/api/doc/90000/90135/90253">素材管理接口</a>获得',
`pic_url` varchar(100) DEFAULT NULL COMMENT '图片消息:图片的链接,仅可使用<a href="https://work.weixin.qq.com/api/doc/90000/90135/90256">上传图片接口</a>得到的链接',
`link_title` varchar(100) DEFAULT NULL COMMENT '链接消息:图文消息标题',
`link_picurl` varchar(255) DEFAULT NULL COMMENT '链接消息:图文消息封面的url',
`lin_desc` varchar(1000) DEFAULT NULL COMMENT '链接消息:图文消息的描述,最多512个字节',
`link_url` varchar(1000) DEFAULT NULL COMMENT '链接消息:图文消息的链接',
`miniprogram_title` varchar(255) DEFAULT NULL COMMENT '小程序消息标题,最多64个字节',
`miniprogram_media_id` varchar(100) DEFAULT NULL COMMENT '小程序消息封面的mediaid,封面图建议尺寸为520*416',
`appid` varchar(100) DEFAULT NULL COMMENT '小程序appid,必须是关联到企业的小程序应用',
`page` varchar(255) DEFAULT NULL COMMENT '小程序page路径',
`create_by` varchar(64) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
`update_by` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`del_flag` int(1) DEFAULT '0',
`seed_message_id` bigint(20) NOT NULL,
PRIMARY KEY (`seed_message_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
-- ----------------------------
-- Records of we_customer_seedMessage
-- ----------------------------
-- ----------------------------
-- Table structure for we_customer_textMessage
-- ----------------------------
DROP TABLE IF EXISTS `we_customer_textMessage`;
......@@ -6190,17 +6247,19 @@ CREATE TABLE `we_msg_tlp_scope` (
DROP TABLE IF EXISTS `we_poster`;
CREATE TABLE `we_poster` (
`id` bigint(20) NOT NULL,
`del_flag` tinyint(255) DEFAULT NULL,
`del_flag` tinyint(255) DEFAULT NULL COMMENT '0 正常 1 删除',
`create_by` varchar(50) DEFAULT NULL,
`create_time` timestamp NULL DEFAULT NULL,
`update_by` varchar(50) DEFAULT NULL,
`update_time` timestamp NULL DEFAULT NULL,
`title` varchar(30) DEFAULT NULL,
`background_img_path` varchar(255) DEFAULT NULL,
`sample_img_path` varchar(255) DEFAULT NULL,
`type` bigint(255) DEFAULT NULL,
`width` int(255) DEFAULT NULL,
`height` int(11) DEFAULT NULL,
`title` varchar(30) DEFAULT NULL COMMENT '图片标题',
`background_img_path` varchar(255) DEFAULT NULL COMMENT '背景图层图片地址',
`sample_img_path` varchar(255) DEFAULT NULL COMMENT '示例图',
`type` bigint(255) DEFAULT NULL COMMENT '类型 1 通用海报',
`width` int(255) DEFAULT NULL COMMENT '背景图片宽',
`height` int(11) DEFAULT NULL COMMENT '背景图片高',
`media_type` varchar(255) DEFAULT NULL,
`category_id` bigint(20) DEFAULT NULL COMMENT '分类id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
......@@ -6222,6 +6281,8 @@ CREATE TABLE `we_poster_font` (
`create_time` timestamp NULL DEFAULT NULL,
`update_by` varchar(50) DEFAULT NULL,
`update_time` timestamp NULL DEFAULT NULL,
`media_type` int(11) DEFAULT NULL,
`category_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
......@@ -6243,15 +6304,18 @@ CREATE TABLE `we_poster_subassembly` (
`poster_id` bigint(20) DEFAULT NULL COMMENT '海报id',
`left` int(255) DEFAULT NULL,
`top` int(255) DEFAULT NULL,
`width` int(11) DEFAULT NULL,
`height` int(11) DEFAULT NULL,
`type` int(255) DEFAULT NULL,
`font_size` int(11) DEFAULT NULL,
`font_color` varchar(10) DEFAULT NULL,
`img_path` varchar(255) DEFAULT NULL,
`font_id` bigint(20) DEFAULT NULL,
`font_text_align` int(255) DEFAULT NULL,
`width` int(11) DEFAULT NULL COMMENT '宽',
`height` int(11) DEFAULT NULL COMMENT '高',
`type` int(255) DEFAULT NULL COMMENT '1 文本 2 图片 3 二维码',
`font_size` int(11) DEFAULT NULL COMMENT '字体大小',
`font_color` varchar(10) DEFAULT NULL COMMENT '字体颜色',
`img_path` varchar(255) DEFAULT NULL COMMENT '图片地址',
`font_id` bigint(20) DEFAULT NULL COMMENT '字体id',
`font_text_align` int(255) DEFAULT NULL COMMENT '水平对齐',
`content` varchar(255) DEFAULT NULL COMMENT '内容',
`vertical_type` tinyint(255) DEFAULT NULL COMMENT '垂直对齐方式',
`word_space` int(255) DEFAULT NULL COMMENT '字间距',
`line_space` int(255) DEFAULT NULL COMMENT '行间距',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
......@@ -6327,3 +6391,35 @@ CREATE TABLE `we_user` (
-- ----------------------------
-- Records of we_user
-- ----------------------------
-- ----------------------------
-- Table structure for we_sensitive
-- ----------------------------
DROP TABLE IF EXISTS `we_sensitive`;
CREATE TABLE `we_sensitive` (
id BIGINT auto_increment NOT NULL COMMENT '主键',
strategy_name varchar(100) NOT NULL COMMENT '策略名称',
pattern_words TEXT NOT NULL COMMENT '匹配词',
audit_user_id BIGINT NOT NULL COMMENT '审计人id',
audit_user_name varchar(30) NOT NULL COMMENT '审计人',
alert_flag TINYINT DEFAULT 1 NOT NULL COMMENT '消息通知,1 开启 0 关闭',
del_flag TINYINT DEFAULT 0 NOT NULL COMMENT '删除标识,1 已删除 0 未删除',
create_by varchar(64) NULL COMMENT '创建人',
create_time DATETIME NULL COMMENT '创建时间',
update_by varchar(64) NULL COMMENT '更新人',
update_time DATETIME NULL COMMENT '更新时间',
CONSTRAINT we_sensitive_pk PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='敏感词设置表';
-- ----------------------------
-- Table structure for we_sensitive_audit_scope
-- ----------------------------
DROP TABLE IF EXISTS `we_sensitive_audit_scope`;
CREATE TABLE `we_sensitive_audit_scope` (
id BIGINT auto_increment NOT NULL COMMENT '主键',
sensitive_id BIGINT NOT NULL COMMENT '敏感词表主键',
scope_type TINYINT NOT NULL COMMENT '审计范围类型, 1 组织机构 2 成员',
audit_scope_id BIGINT NOT NULL COMMENT '审计对象id',
audit_scope_name varchar(64) NOT NULL COMMENT '审计对象名称',
CONSTRAINT we_sensitive_audit_scope_pk PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='敏感词审计范围';
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!