Commit 2839fb90 by linkwechat8856@163.com

Merge branch 'master' into back_end_dev_2.0

2 parents 23f4fc15 eb685fd1
Showing 33 changed files with 298 additions and 323 deletions
......@@ -58,6 +58,24 @@ public class WeCustomerController extends BaseController
/**
* 查询企业微信客户列表
*/
// @PreAuthorize("@ss.hasPermi('customerManage:customer:list')")
@GetMapping("/findWeCustomerList")
@ApiOperation("查询企业微信客户列表(重构版)")
public TableDataInfo findWeCustomerList(WeCustomerList weCustomerList)
{
startPage();
List<WeCustomerList> list = weCustomerService.findWeCustomerList(weCustomerList);
return getDataTable(list);
}
/**
* 根据员工ID获取客户
* @return
*/
......@@ -70,19 +88,7 @@ public class WeCustomerController extends BaseController
}
/**
* 查询企业微信客户列表(重构版)
*/
// @PreAuthorize("@ss.hasPermi('customerManage:customer:list')")
@GetMapping("/findWeCustomerList")
@ApiOperation("查询企业微信客户列表(重构版)")
public TableDataInfo findWeCustomerList(WeCustomerList weCustomerList)
{
startPage();
List<WeCustomerList> list = weCustomerService.findWeCustomerList(weCustomerList);
return getDataTable(list);
}
// /**
......
......@@ -5,6 +5,8 @@ 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.WeGroupMessageSendResult;
import com.linkwechat.wecom.domain.WeGroupMessageTask;
import com.linkwechat.wecom.domain.WeGroupMessageTemplate;
import com.linkwechat.wecom.domain.query.WeAddGroupMessageQuery;
import com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo;
......@@ -89,4 +91,30 @@ public class WeGroupMessageTemplateController extends BaseController {
iWeGroupMessageTemplateService.cancelByIds(Arrays.asList(ids));
return AjaxResult.success();
}
/**
* 群发成员发送任务列表
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:remove')")
@ApiOperation(value = "群发成员发送任务列表", httpMethod = "GET")
@Log(title = "群发消息模板", businessType = BusinessType.SELECT)
@GetMapping("/task/list")
public TableDataInfo<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task) {
startPage();
List<WeGroupMessageTask> messageTaskList = iWeGroupMessageTemplateService.groupMsgTaskList(task);
return getDataTable(messageTaskList);
}
/**
* 群发成员发送任务列表
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:remove')")
@ApiOperation(value = "群发成员发送任务列表", httpMethod = "GET")
@Log(title = "群发消息模板", businessType = BusinessType.SELECT)
@GetMapping("/send/result/list")
public TableDataInfo<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult) {
startPage();
List<WeGroupMessageSendResult> sendResultList = iWeGroupMessageTemplateService.groupMsgSendResultList(sendResult);
return getDataTable(sendResultList);
}
}
......@@ -24,5 +24,5 @@ outagedetection=true
outagedetectioninterval=2
#开启日志过滤
filter=true
#排序sql包含QRTZ的sql
exclude=QRTZ
\ No newline at end of file
#排序sql包含QRTZ的sql 多个逗号隔离
exclude=QRTZ,sys_oper_log
\ No newline at end of file
......@@ -2,9 +2,8 @@ package com.linkwechat.framework.handler;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeGroup;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
......@@ -22,7 +21,7 @@ import java.util.List;
//支持的java对象
@SuppressWarnings("all")
@Slf4j
@MappedTypes(value = {WeCustomer.class,WeGroup.class})
@MappedTypes(value = {WeGroup.class, WeCustomerList.class})
@MappedJdbcTypes({JdbcType.VARCHAR})
public class ListTypeHandler<T extends Object> implements TypeHandler<List<T>> {
......@@ -33,7 +32,7 @@ public class ListTypeHandler<T extends Object> implements TypeHandler<List<T>> {
}
if(filedName!=null && "customers_info".equals(filedName)){
return JSONObject.parseArray(content, WeCustomer.class);
return JSONObject.parseArray(content, WeCustomerList.class);
}
if(filedName!=null && "groups_info".equals(filedName)){
......
......@@ -30,8 +30,8 @@ public class GroupMessageTask {
*/
public void messageTask() {
//获的当前时间的毫秒数
List<WeCustomerMessageTimeTask> weCustomerMessageTimeTasks = customerMessageTimeTaskMapper.selectWeCustomerMessageTimeTaskGteSettingTime(DateUtils.getDateTime().getTime(),System.currentTimeMillis());
//customerMessageTimeTaskMapper
List<WeCustomerMessageTimeTask> weCustomerMessageTimeTasks = customerMessageTimeTaskMapper.selectWeCustomerMessageTimeTaskGteSettingTime(System.currentTimeMillis());
if (CollectionUtils.isNotEmpty(weCustomerMessageTimeTasks)) {
weCustomerMessageTimeTasks.forEach(
s -> {
......
package com.linkwechat.quartz.task;
import com.linkwechat.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 定时任务调度测试
*
* @author ruoyi
*/
@Slf4j
@Component("ryTask")
public class RyTask {
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
}
public void ryParams(String params) {
System.out.println("执行有参方法:" + params);
}
public void ryNoParams() {
System.out.println("执行无参方法");
}
}
......@@ -193,16 +193,10 @@ export default {
v-hasPermi="['enterpriseWechat:view']"
size="mini"
type="text"
icon="el-icon-view"
@click="handleRemove(scope.row.ruleId)"
>删除</el-button
>
<el-button
v-hasPermi="['enterpriseWechat:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="goRoute(scope.row.ruleId)"
<el-button v-hasPermi="['enterpriseWechat:edit']" size="mini" type="text" @click="goRoute(scope.row.ruleId)"
>编辑</el-button
>
</template>
......
......@@ -186,14 +186,7 @@ export default {
</div>
</div>
<el-form
ref="queryForm"
:inline="true"
:model="query"
label-width="100px"
class="top-search"
size="small"
>
<el-form ref="queryForm" :inline="true" :model="query" label-width="100px" class="top-search" size="small">
<el-form-item label="活码名称" prop="taskName">
<el-input v-model="query.taskName" placeholder="请输入"></el-input>
</el-form-item>
......@@ -216,18 +209,8 @@ export default {
></el-date-picker>
</el-form-item>
<el-form-item label=" ">
<el-button
v-hasPermi="['customerManage:customer:query']"
type="primary"
@click="getList(1)"
>查询</el-button
>
<el-button
v-hasPermi="['customerManage:customer:query']"
type="success"
@click="resetQuery()"
>重置</el-button
>
<el-button v-hasPermi="['customerManage:customer:query']" type="primary" @click="getList(1)">查询</el-button>
<el-button v-hasPermi="['customerManage:customer:query']" type="success" @click="resetQuery()">重置</el-button>
</el-form-item>
</el-form>
......@@ -247,18 +230,9 @@ export default {
</div>
</div>
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column
label="活码名称"
align="center"
prop="taskName"
:show-overflow-tooltip="true"
/>
<el-table-column label="活码名称" align="center" prop="taskName" :show-overflow-tooltip="true" />
<el-table-column label="群活码" align="center" width="130">
<template #default="{ row }">
<el-popover placement="bottom" trigger="hover">
......@@ -267,21 +241,13 @@ export default {
:src="(row.groupCodeInfo && row.groupCodeInfo.codeUrl) || ''"
class="code-image--small"
></el-image>
<el-image
:src="(row.groupCodeInfo && row.groupCodeInfo.codeUrl) || ''"
class="code-image"
></el-image>
<el-image :src="(row.groupCodeInfo && row.groupCodeInfo.codeUrl) || ''" class="code-image"></el-image>
</el-popover>
</template>
</el-table-column>
<el-table-column label="关键词" align="center" width="120">
<template #default="{ row }">
<el-popover
placement="bottom"
width="200"
trigger="hover"
:content="row.keywords"
>
<el-popover placement="bottom" width="200" trigger="hover" :content="row.keywords">
<div slot="reference" class="table-desc overflow-ellipsis">
<!-- {{ getDisplayKeywords(row) }} -->
{{ row.keywords }}
......@@ -291,12 +257,7 @@ export default {
</el-table-column>
<el-table-column label="实际群聊" align="center" width="120">
<template #default="{ row }">
<el-popover
placement="bottom"
width="200"
trigger="hover"
:content="row.groupNameList"
>
<el-popover placement="bottom" width="200" trigger="hover" :content="row.groupNameList">
<div slot="reference" class="table-desc overflow-ellipsis">
<!-- {{ getDisplayRealGroups(row) }} -->
{{ row.groupNameList }}
......@@ -305,31 +266,13 @@ export default {
</template>
</el-table-column>
<el-table-column
label="创建人"
align="center"
prop="createBy"
></el-table-column>
<el-table-column label="创建人" align="center" prop="createBy"></el-table-column>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
></el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime"></el-table-column>
<el-table-column
label="操作"
align="center"
width="180"
class-name="small-padding fixed-width"
>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-hasPermi="['enterpriseWechat:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="goRoute(scope.row.taskId)"
<el-button v-hasPermi="['enterpriseWechat:edit']" size="mini" type="text" @click="goRoute(scope.row.taskId)"
>编辑</el-button
>
<!-- <el-button
......@@ -343,7 +286,6 @@ export default {
v-hasPermi="['enterpriseWechat:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleRemove(scope.row.taskId)"
>删除</el-button
>
......@@ -359,35 +301,23 @@ export default {
@pagination="getList()"
/>
<el-dialog
title="配置方法"
:visible.sync="dialogHowToConfig"
width="500px"
style="margin-bottom: 7vh;"
>
<el-dialog title="配置方法" :visible.sync="dialogHowToConfig" width="500px" style="margin-bottom: 7vh;">
<div class="help">
<div class="step">
<p>
1、登录企业微信官方后台,进入应用管理,点击
LinkWeChat,再点击【配置到聊天工具栏】。
1、登录企业微信官方后台,进入应用管理,点击 LinkWeChat,再点击【配置到聊天工具栏】。
</p>
<el-image
:src="require('@/assets/example/keywordHelp1.png')"
></el-image>
<el-image :src="require('@/assets/example/keywordHelp1.png')"></el-image>
</div>
<div class="step">
<p>2、点击【配置】后,进入配置页面。</p>
<el-image
:src="require('@/assets/example/keywordHelp2.png')"
></el-image>
<el-image :src="require('@/assets/example/keywordHelp2.png')"></el-image>
</div>
<div class="step">
<p>
3、点击【配置页面】后,在弹窗中,输入页面名称及链接,并确定即可。进入配置页面。
</p>
<el-image
:src="require('@/assets/example/keywordHelp3.png')"
></el-image>
<el-image :src="require('@/assets/example/keywordHelp3.png')"></el-image>
</div>
</div>
<div slot="footer">
......
......@@ -128,7 +128,7 @@ export default {
// 获取显示用tag字符串
getDisplayTags(row) {
if (!(row && row.length > 0)) return ''
const tags = row.tagList.map((t) => t && t.name ? t.name : '')
const tags = row.tagList.map((t) => (t && t.name ? t.name : ''))
return tags.join(' ')
},
......@@ -183,21 +183,10 @@ export default {
customerFilter() {
const l = []
for (let data of this.customerList) {
if (
this.customerQuery.customerName !== '' &&
!this.customerQuery.customerName.includes(data.customerName)
)
continue
if (
this.customerQuery.isInGroup !== '' &&
this.customerQuery.isInGroup !== data.isInGroup
)
continue
if (
this.customerQuery.isSent !== '' &&
this.customerQuery.isSent !== data.isSent
)
if (this.customerQuery.customerName !== '' && !this.customerQuery.customerName.includes(data.customerName))
continue
if (this.customerQuery.isInGroup !== '' && this.customerQuery.isInGroup !== data.isInGroup) continue
if (this.customerQuery.isSent !== '' && this.customerQuery.isSent !== data.isSent) continue
l.push(data)
}
......@@ -226,13 +215,7 @@ export default {
<template>
<div>
<div class="top-search">
<el-form
inline
label-position="right"
:model="query"
label-width="100px"
ref="queryForm"
>
<el-form inline label-position="right" :model="query" label-width="100px" ref="queryForm">
<el-form-item label="任务名称" prop="taskName">
<el-input v-model="query.taskName" placeholder="请输入"></el-input>
</el-form-item>
......@@ -270,41 +253,20 @@ export default {
<div class="mid-action">
<div>
<el-button
type="primary"
v-hasPermi="['enterpriseWechat:add']"
@click="goRoute()"
>
<el-button type="primary" v-hasPermi="['enterpriseWechat:add']" @click="goRoute()">
新建任务
</el-button>
</div>
<div>
<el-button
:disabled="multiSelect.length === 0"
@click="handleBulkRemove"
type="cyan"
>
<el-button :disabled="multiSelect.length === 0" @click="handleBulkRemove" type="cyan">
批量删除
</el-button>
</div>
</div>
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="50"
align="center"
></el-table-column>
<el-table-column
label="任务名称"
align="center"
prop="taskName"
:show-overflow-tooltip="true"
></el-table-column>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column label="任务名称" align="center" prop="taskName" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="sendType" label="发送方式" align="center">
<template #default="{ row }">
{{ parseInt(row.sendType) === 0 ? '企业群发' : '个人群发' }}
......@@ -319,12 +281,7 @@ export default {
</el-table-column>
<el-table-column label="客户标签" align="center" width="120">
<template #default="{ row }">
<el-popover
placement="bottom"
width="200"
trigger="hover"
:content="getDisplayTags(row)"
>
<el-popover placement="bottom" width="200" trigger="hover" :content="getDisplayTags(row)">
<div slot="reference" class="table-desc overflow-ellipsis">
{{ getDisplayTags(row) }}
</div>
......@@ -332,39 +289,19 @@ export default {
</template>
</el-table-column>
<el-table-column
prop="createBy"
label="创建人"
align="center"
></el-table-column>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="160"
></el-table-column>
<el-table-column prop="createBy" label="创建人" align="center"></el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="160"></el-table-column>
<el-table-column
label="操作"
align="center"
width="180"
class-name="small-padding fixed-width"
>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-hasPermi="['enterpriseWechat:view']"
size="mini"
type="text"
icon="el-icon-view"
@click="handleRemove(scope.row.taskId)"
>删除</el-button
>
<el-button
v-hasPermi="['enterpriseWechat:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="goRoute(scope.row.taskId)"
<el-button v-hasPermi="['enterpriseWechat:edit']" size="mini" type="text" @click="goRoute(scope.row.taskId)"
>编辑</el-button
>
</template>
......@@ -382,25 +319,12 @@ export default {
<el-dialog title="客户统计" :visible.sync="dialogVisible">
<div>
<div class="top-search">
<el-form
inline
label-position="right"
:model="customerQuery"
label-width="80px"
ref="customerForm"
>
<el-form inline label-position="right" :model="customerQuery" label-width="80px" ref="customerForm">
<el-form-item prop="customerName">
<el-input
v-model="customerQuery.customerName"
placeholder="请输入客户名称"
></el-input>
<el-input v-model="customerQuery.customerName" placeholder="请输入客户名称"></el-input>
</el-form-item>
<el-form-item prop="isInGroup">
<el-select
v-model="customerQuery.isInGroup"
placeholder="全部"
size="small"
>
<el-select v-model="customerQuery.isInGroup" placeholder="全部" size="small">
<el-option
v-for="(inGroup, index) in inGroupOptions"
:label="inGroup.label"
......@@ -410,11 +334,7 @@ export default {
</el-select>
</el-form-item>
<el-form-item prop="isSent">
<el-select
v-model="customerQuery.isSent"
placeholder="全部状态"
size="small"
>
<el-select v-model="customerQuery.isSent" placeholder="全部状态" size="small">
<el-option
v-for="(status, index) in sendStatusOptions"
:label="status.label"
......@@ -430,11 +350,7 @@ export default {
</el-form>
</div>
<el-table v-loading="customerLoading" :data="customerList">
<el-table-column
label="客户名"
align="center"
prop="customerName"
></el-table-column>
<el-table-column label="客户名" align="center" prop="customerName"></el-table-column>
<el-table-column prop="sent" label="送达状态" align="center">
<template #default="{ row }">
<template v-if="row.sent">
......
......@@ -12,7 +12,7 @@ import com.linkwechat.wecom.retry.WeCommonRetryWhen;
* @author: HaoN
* @create: 2020-08-27 16:42
**/
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeCommonAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
@Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = WeCommonRetryWhen.class)
public interface WeUserClient {
......
package com.linkwechat.wecom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeCustomerList {
//客户唯一id
private String externalUserid;
//首位添加人id
private String firstUserId;
//头像
private String avatar;
//客户名称
private String customerName;
//首位添加人姓名
//客户类型
private Integer customerType;
//查询标签id
private String tagIds;
//标签名称,使用逗号隔开
private String tagNames;
//跟进人名称
private String userName;
//客户id
private String externalUserid;
//跟进人id
private String firstUserId;
//跟踪状态
private Integer trackState;
//首位添加人时间
//添加方式
private Integer addMethod;
//添加时间
@JsonFormat(pattern = "yyyy-MM-dd")
private Date firstAddTime;
//标签名称,使用逗号隔开
private String tagNames;
//是否可以被继承 1:是;0:否
private Boolean isTransfer;
//0-未知 1-男性 2-女性
private Integer gender;
//所属部门
private String departmentName;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday;
......@@ -38,8 +82,10 @@ public class WeCustomerList {
private String beginTime;
//查询结束时间
private String endTime;
//查询标签id
private String tagIds;
//所属部门id,多个用逗号隔开
private String departmentIds;
//0正常;1:删除;
private Integer delFlag=new Integer(0);
......
......@@ -7,6 +7,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
......@@ -17,7 +18,7 @@ import java.util.List;
@TableName("we_customer_messageTimeTask")
public class WeCustomerMessageTimeTask extends BaseEntity {
public WeCustomerMessageTimeTask(Long messageId, CustomerMessagePushDto messageInfo, List<WeCustomer> customersInfo, List<WeGroup> groupsInfo, Long settingTime) {
public WeCustomerMessageTimeTask(Long messageId, CustomerMessagePushDto messageInfo, List<WeCustomerList> customersInfo, List<WeGroup> groupsInfo, Long settingTime) {
this.messageId = messageId;
this.messageInfo = messageInfo;
this.customersInfo = customersInfo;
......@@ -46,7 +47,7 @@ public class WeCustomerMessageTimeTask extends BaseEntity {
/**
* 客户信息列表
*/
private List<WeCustomer> customersInfo;
private List<WeCustomerList> customersInfo;
/**
* 客户群组信息列表
......
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
......@@ -26,6 +27,7 @@ public class WeEmpleCode extends BaseEntity {
/**
* $column.columnComment
*/
@TableId
private Long id = SnowFlakeUtil.nextId();
/**
......
......@@ -23,7 +23,7 @@ public class WeEmpleCodeTag
/** $column.columnComment */
@TableId
private Long id;
private Long id=SnowFlakeUtil.nextId();
/** 标签id */
@ApiModelProperty("标签id")
......
......@@ -87,6 +87,7 @@ public class WeUser extends BaseEntity
@ApiModelProperty("用户所属部门")
private String department;
/** 职务 */
@ApiModelProperty("职务")
private String position;
......
......@@ -25,7 +25,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
/**
* 查询企业微信客户列表
*
*
* @param weCustomer 企业微信客户
* @return 企业微信客户集合
*/
......@@ -122,7 +122,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param weCustomerList
* @return
*/
List<WeCustomerList> findWeCustomerList(WeCustomerList weCustomerList);
List<WeCustomerList> findWeCustomerList(@Param("weCustomerList") WeCustomerList weCustomerList);
/**
......
......@@ -21,7 +21,7 @@ public interface WeCustomerMessageTimeTaskMapper extends BaseMapper<WeCustomerMe
* @param timeMillis 当前时间毫秒数
* @return {@link WeCustomerMessageTimeTask}s
*/
List<WeCustomerMessageTimeTask> selectWeCustomerMessageTimeTaskGteSettingTime(@Param("beginTime") Long beginTime,@Param("endTime") Long endTime);
List<WeCustomerMessageTimeTask> selectWeCustomerMessageTimeTaskGteSettingTime(@Param("timeMillis") long timeMillis);
/**
* 保存群发任务
......
......@@ -3,6 +3,7 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessage;
import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
......@@ -50,6 +51,6 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> {
* @param messageId
* @throws JsonProcessingException
*/
public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId,List<WeCustomer> customers,List<WeGroup> groups) throws JsonProcessingException;
public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers, List<WeGroup> groups) throws JsonProcessingException;
}
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessgaeResult;
import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
......@@ -34,6 +35,6 @@ public interface IWeCustomerMessgaeResultService extends IService<WeCustomerMess
* @param messageId
* @return
*/
int workerMappingCustomer(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomer> customers, List<WeGroup> groups);
int workerMappingCustomer(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers, List<WeGroup> groups);
}
......@@ -37,10 +37,10 @@ public interface IWeCustomerService extends IService<WeCustomer>
// */
// @Override
// public boolean saveOrUpdate(WeCustomer weCustomer);
//
/**
* 查询企业微信客户列表
*
*
* @param weCustomer 企业微信客户
* @return 企业微信客户集合
*/
......
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.enums.WeEmpleCodeType;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto;
......@@ -215,6 +216,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
WeEmpleCode weEmpleCode = new WeEmpleCode();
weEmpleCode.setId(SnowFlakeUtil.nextId());
// 设置员工和扫码标签
setScopsAndTags(weEmpleCode, communityNewGroupDto);
......
......@@ -14,6 +14,7 @@ import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessageTimeTask;
import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.WeMediaDto;
......@@ -114,7 +115,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
}
List<WeCustomer> customers = Lists.newArrayList();
List<WeCustomerList> customers = Lists.newArrayList();
List<WeGroup> groups = new ArrayList<>();
// 0 发给客户
if (customerMessagePushDto.getPushType().equals(WeConstans.SEND_MESSAGE_CUSTOMER)) {
......@@ -165,7 +166,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
private void sendMessage(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomer> customers,List<WeGroup> groups ) throws ParseException, JsonProcessingException {
private void sendMessage(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers,List<WeGroup> groups ) throws ParseException, JsonProcessingException {
//发送群发消息
//调用微信api发送消息
......@@ -176,6 +177,9 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
} else {
WeCustomerMessageTimeTask timeTask = new WeCustomerMessageTimeTask(messageId, customerMessagePushDto, customers, groups
, DateUtils.getMillionSceondsBydate(customerMessagePushDto.getSettingTime()));
customerMessageTimeTaskMapper.saveWeCustomerMessageTimeTask(timeTask);
}
......@@ -197,34 +201,53 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
* @param tag 客户标签id列表
* @return {@link List}s 客户的外部联系人id列表
*/
public List<WeCustomer> externalUserIds(String pushRange, String staffId, String department, String tag) {
public List<WeCustomerList> externalUserIds(String pushRange, String staffId, String department, String tag) {
if (pushRange.equals(WeConstans.SEND_MESSAGE_CUSTOMER_ALL)) {
//从redis中读取数据
List<WeCustomer> customers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
if (CollectionUtils.isEmpty(customers)) {
WeCustomer weCustomer = new WeCustomer();
weCustomer.setUserIds(staffId);
weCustomer.setDepartmentIds(department);
customers = weCustomerService.selectWeCustomerAllList(weCustomer);
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
redisCache.expire(WeConstans.WECUSTOMERS_KEY,2 * 60L);
}else{
return customers;
}
// List<WeCustomer> customers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
// if (CollectionUtils.isEmpty(customers)) {
// WeCustomer weCustomer = new WeCustomer();
// weCustomer.setUserIds(staffId);
// weCustomer.setDepartmentIds(department);
// customers = weCustomerService.selectWeCustomerAllList(weCustomer);
// redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
// redisCache.expire(WeConstans.WECUSTOMERS_KEY,2 * 60L);
// }else{
// return customers;
// }
//
// WeCustomer weCustomer = new WeCustomer();
// weCustomer.setUserIds(staffId);
// weCustomer.setDepartmentIds(department);
// return weCustomerService.selectWeCustomerListNoRel(weCustomer);
return weCustomerService.findWeCustomerList(WeCustomerList.builder()
.userIds(staffId)
.departmentIds(department)
.build());
WeCustomer weCustomer = new WeCustomer();
weCustomer.setUserIds(staffId);
weCustomer.setDepartmentIds(department);
return weCustomerService.selectWeCustomerListNoRel(weCustomer);
} else {
//按条件查询客户
//通过部门id查询所有的员工
//通过员工列表查询该员工的外部联系人列表
WeCustomer weCustomer = new WeCustomer();
weCustomer.setUserIds(staffId);
weCustomer.setTagIds(tag);
weCustomer.setDepartmentIds(department);
return weCustomerService.selectWeCustomerListNoRel(weCustomer);
return weCustomerService.findWeCustomerList(WeCustomerList.builder()
.userIds(staffId)
.tagIds(tag)
.departmentIds(department)
.build());
// WeCustomer weCustomer = new WeCustomer();
// weCustomer.setUserIds(staffId);
// weCustomer.setTagIds(tag);
// weCustomer.setDepartmentIds(department);
//
//
//
// return weCustomerService.selectWeCustomerListNoRel(weCustomer);
}
}
......
......@@ -14,6 +14,7 @@ import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessage;
import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.WeMediaDto;
......@@ -94,13 +95,14 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
}
@Override
public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId,List<WeCustomer> customers,List<WeGroup> groups) throws JsonProcessingException {
public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers, List<WeGroup> groups) throws JsonProcessingException {
List<String> msgid = new ArrayList<>();
//发给客户
if(CollectionUtils.isNotEmpty(customers)){
customers.stream().collect(Collectors.groupingBy(WeCustomer::getFirstUserId)).forEach((k,v)->{
customers.stream().filter(customer -> StringUtils.isNotEmpty(customer.getFirstUserId()))
.collect(Collectors.groupingBy(WeCustomerList::getFirstUserId)).forEach((k,v)->{
customerMessagePushDto.setStaffId(k);
//发送群发消息
......@@ -110,7 +112,7 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
WeCustomerMessagePushDto messagePushDto = new WeCustomerMessagePushDto();
messagePushDto.setChat_type(ChatType.of(customerMessagePushDto.getPushType()).getName());
List<String> externalUserIds = v.stream().map(WeCustomer::getExternalUserid).collect(Collectors.toList());
List<String> externalUserIds = v.stream().map(WeCustomerList::getExternalUserid).collect(Collectors.toList());
messagePushDto.setExternal_userid(externalUserIds);
messagePushDto.setSender(customerMessagePushDto.getStaffId());
......
......@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerList;
import com.linkwechat.wecom.domain.WeCustomerMessgaeResult;
import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto;
......@@ -36,7 +37,7 @@ public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMe
}
@Override
public int workerMappingCustomer(CustomerMessagePushDto customerMessagePushDto, long messageId,List<WeCustomer> customers,List<WeGroup> groups) {
public int workerMappingCustomer(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomerList> customers, List<WeGroup> groups) {
int size = 0;
// 0 发给客户
......@@ -57,7 +58,7 @@ public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMe
customerMessgaeResult.setSendType(customerMessgaeResult.getSettingTime() == null ? customerMessagePushDto.getPushType() : "2");
customerMessgaeResult.setExternalUserid(customer.getExternalUserid());
customerMessgaeResult.setExternalName(customer.getName());
customerMessgaeResult.setUserid(customer.getUserId());
customerMessgaeResult.setUserid(customer.getFirstUserId());
customerMessgaeResult.setUserName(customer.getUserName());
customerMessgaeResult.setStatus("0");
customerMessgaeResult.setSettingTime(customerMessagePushDto.getSettingTime());
......
......@@ -10,6 +10,7 @@ import com.google.common.collect.Lists;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.enums.TrajectorySceneType;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils;
......@@ -77,6 +78,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
@Autowired
private IWeCustomerTrajectoryService iWeCustomerTrajectoryService;
@Autowired
private IWeTagService iWeTagService;
// /**
......@@ -231,7 +235,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
* @param weLeaveUserInfoAllocateVo
*/
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public void allocateWeCustomer(WeLeaveUserInfoAllocateVo weLeaveUserInfoAllocateVo) {
//所需分配的客户
......@@ -291,6 +295,21 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
List<WeTag> addTag = weMakeCustomerTag.getAddTag();
if(CollectionUtil.isNotEmpty(addTag)){
//校验是否有标签在库里不存在
List<WeTag> weTagList = iWeTagService.list(
new LambdaQueryWrapper<WeTag>()
.in(WeTag::getTagId, addTag.stream().map(WeTag::getTagId).collect(Collectors.toList()))
);
if(CollectionUtil.isNotEmpty(weTagList)){
if(addTag.size()!=weTagList.size()){
new WeComException("部门标签不存在");
}
}else{
new WeComException("部门标签不存在");
}
CutomerTagEdit cutomerTagEdit = CutomerTagEdit.builder()
.external_userid(weMakeCustomerTag.getExternalUserid())
......
......@@ -29,8 +29,6 @@ public class WeMsgTlpServiceImpl implements IWeMsgTlpService
@Autowired
private WeMsgTlpMapper weMsgTlpMapper;
@Autowired
private IWeMsgTlpScopeService iWeMsgTlpScopeService;
/**
* 查询欢迎语模板
......
......@@ -75,6 +75,9 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
//个人标签同步,企业微信
if(weTagGroup.getGroupTagType().equals(new Integer(1))){
weTagGroup.setAddWeTags(
weTags
);
WeCropGropTagDtlDto weCropGropTagDtlDto = weCropTagClient.addCorpTag(WeCropGroupTagDto.transformAddTag(weTagGroup));
if (weCropGropTagDtlDto.getErrcode().equals(WeConstans.WE_SUCCESS_CODE)) {
this.batchSaveOrUpdateTagGroupAndTag(ListUtil.toList(weCropGropTagDtlDto.getTag_group()), false);
......
package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -210,10 +211,13 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
linkMessageDto.setUrl(pageUrlBuilder.toString());
CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto();
// if (weTaskFission.getStartTime() != null) {
// customerMessagePushDto.setSettingTime(DateUtil.formatDateTime(weTaskFission.getStartTime()));
// }
customerMessagePushDto.setSendNow(true);
if (weTaskFission.getStartTime() != null && weTaskFission.getStartTime().getTime() <= System.currentTimeMillis()) {
customerMessagePushDto.setSendNow(true);
customerMessagePushDto.setSettingTime(null);
}else {
customerMessagePushDto.setSendNow(false);
customerMessagePushDto.setSettingTime(DateUtil.formatDateTime(weTaskFission.getStartTime()));
}
customerMessagePushDto.setLinkMessage(linkMessageDto);
customerMessagePushDto.setPushType("0");
customerMessagePushDto.setPushRange("1");
......
......@@ -37,7 +37,7 @@
where FIND_IN_SET(#{fromId}, to_list) and is_external = 0 and room_id = ''
order by msg_time desc
) as msg group by receiver order by msg.msg_time desc) t
inner join we_customer wc on t.receiver = wc.external_userid;
inner join we_customer wc on t.receiver = wc.external_userid and wc.first_user_id=#{fromId};
</select>
<select id="selectAloneChatList" resultType="com.linkwechat.wecom.domain.vo.WeChatContactMsgVo">
......
......@@ -268,40 +268,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findWeCustomerList" resultType="com.linkwechat.wecom.domain.WeCustomerList">
SELECT
wc.external_userid,
wc.`name` as customerName,
wc.first_user_id,
wu.user_name,
wc.first_add_time,
GROUP_CONCAT(wt.`name`) as tagNames,
GROUP_CONCAT(wt.`tag_id`) as tagIds,
wc.birthday
wc.avatar,
wc.`name` as customerName,
wc.customer_type,
GROUP_CONCAT(wt.`tag_id`) as tagIds,
GROUP_CONCAT(wt.`name`) as tagNames,
wu.user_name,
wc.external_userid,
wc.first_user_id,
wc.track_state,
wc.add_method,
wc.first_add_time,
wc.birthday,
wc.gender,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id in (wu.department)) as departmentName
FROM
we_customer wc
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.del_flag=0 AND wfctr.external_userid=wc.external_userid AND wfctr.user_id=wc.first_user_id
LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
<where>
<if test="delFlag != null">
wc.del_flag = #{delFlag}
<if test="weCustomerList.gender !=null">
AND wc.gender=#{weCustomerList.gender}
</if>
<if test="name != null and name !=''">
AND wc.`name` like concat('%',#{name,jdbcType=VARCHAR},'%')
<if test="weCustomerList.departmentIds != null and weCustomerList.departmentIds !=''">
<if test="weCustomerList.departmentIds.indexOf(',') != -1">
OR wu.department in
<foreach item="item" index="index" collection="weCustomerList.departmentIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="weCustomerList.delFlag != null">
wc.del_flag = #{weCustomerList.delFlag}
</if>
<if test="weCustomerList.name != null and weCustomerList.name !=''">
AND wc.`name` like concat('%',#{weCustomerList.name,jdbcType=VARCHAR},'%')
</if>
<if test="userIds !=null and userIds !=''">
<if test="weCustomerList.userIds !=null and weCustomerList.userIds !=''">
AND wc.first_user_id in
<foreach collection="userIds.split(',')" item="item" index="index" open="(" close=")" separator=",">
<foreach collection="weCustomerList.userIds.split(',')" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="tagIds !=null and tagIds !=''">
<if test="weCustomerList.tagIds !=null and weCustomerList.tagIds !=''">
AND wt.tag_id in
<foreach collection="tagIds.split(',')" item="item" index="index" open="(" close=")" separator=",">
<foreach collection="weCustomerList.tagIds.split(',')" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="beginTime !=null and beginTime != '' and endTime !='' and endTime != null">
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{beginTime} AND #{endTime}
<if test="weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null">
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.beginTime.endTime}
</if>
</where>
GROUP BY wc.external_userid,wc.first_user_id
......@@ -457,7 +477,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP_CONCAT(wt.`tag_id`) as tagIds
FROM
we_customer wc
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.user_id = wc.first_user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.user_id = wc.first_user_id AND wfcrf.del_flag=0
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
WHERE wc.external_userid=#{externalUserid} and wc.first_user_id=#{userid}
</select>
......
......@@ -52,6 +52,7 @@
</where>
</update>
<select id="selectWeCustomerMessageTimeTaskGteSettingTime" resultMap="tasks">
SELECT
task_id,
......@@ -62,7 +63,9 @@
setting_time
FROM
we_customer_messageTimeTask
WHERE solved=0 and setting_time BETWEEN #{beginTime} AND #{endTime}
<where>
setting_time <![CDATA[<=]]> #{timeMillis} AND solved=0
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="welcomeMsgTplType !=null "> and wmt.welcome_msg_tpl_type = #{welcomeMsgTplType}</if>
and wmt.del_flag = 0
</where>
ORDER BY wmt.create_time DESC
</select>
......@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag,</if>
<if test="welcomeMsgTplType != null">welcome_msg_tpl_type,</if>
<if test="createBy != null ">create_by,</if>
<if test="createTime !=null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
......@@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">#{delFlag},</if>
<if test="welcomeMsgTplType != null">#{welcomeMsgTplType},</if>
<if test="createBy != null ">#{createBy},</if>
<if test="createTime !=null">#{createTime},</if>
</trim>
</insert>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!