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