提交 42445d1d 作者: 沈振路

延时客服

上级 b79b3207
......@@ -3,6 +3,7 @@ package com.yaoyaozw.customer.common;
import cn.hutool.core.util.ObjectUtil;
import com.yaoyaozw.customer.constants.ApiResultConstant;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
/**
* @author darker
......@@ -37,6 +38,14 @@ public class BaseResult {
}
return this;
}
public BaseResult success(String message) {
this.success = Boolean.TRUE;
this.code = ApiResultConstant.SUCCESS_CODE;
if (ObjectUtil.isNull(this.message)) {
this.message = StringUtils.isBlank(message) ? ApiResultConstant.SUCCESS_MSG : message;
}
return this;
}
/**
* 错误
......
......@@ -74,8 +74,8 @@ public class CustomerDelayGraphicsController {
@ApiOperation("所有公众号")
@GetMapping("/getAuthList")
public GenericsResult<List<AuthInfoVO>> getAuthList(@RequestParam(required = false) String keyword) {
return customerGraphicsDelayService.getAuthList(keyword);
public GenericsResult<List<AuthInfoVO>> getAuthList(@RequestParam(required = false) String keyword, @RequestParam(required = false) String appId) {
return customerGraphicsDelayService.getAuthList(keyword, appId);
}
@ApiOperation("时间间隔")
......
package com.yaoyaozw.customer.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
......@@ -60,6 +58,12 @@ public class CustomerGraphicsDelay implements Serializable {
private Integer sendStatus;
/**
* 原文链接
*/
@TableField(value = "source_url")
private String sourceUrl;
/**
* 是否是历史遗留
*/
@TableField(value = "is_history")
......@@ -105,6 +109,7 @@ public class CustomerGraphicsDelay implements Serializable {
* 逻辑删除
*/
@TableField(value = "is_deleted")
@TableLogic
private Integer isDeleted;
@TableField(exist = false)
......
......@@ -48,9 +48,11 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics
* 让时间间隔列表
*
* @param keyword 关键词
* @param keywordList 关键词拆分
* @param storeType 书城
* @return {@link List}<{@link AuthInfoVO}>
*/
List<AuthInfoVO> getAuthList(@Param("keyword") String keyword);
List<AuthInfoVO> getAuthList(@Param("keyword") String keyword, @Param("keywordList") List<String> keywordList, @Param("storeType") String storeType);
/**
* 让时间间隔列表
......
......@@ -85,9 +85,10 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD
* 获得认证列表
*
* @param keyword 关键字
* @param appId 公众号id
* @return {@link GenericsResult}<{@link List}<{@link AuthInfoVO}>>
*/
GenericsResult<List<AuthInfoVO>> getAuthList(String keyword);
GenericsResult<List<AuthInfoVO>> getAuthList(String keyword, String appId);
/**
* 让时间间隔列表
......
......@@ -3,15 +3,13 @@ package com.yaoyaozw.customer.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent;
import com.yaoyaozw.customer.components.SnowflakeComponent;
import com.yaoyaozw.customer.components.TokenManager;
import com.yaoyaozw.customer.constants.CustomerCommonConstant;
......@@ -51,6 +49,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
private final static Logger localLog = LoggerFactory.getLogger(CustomerGraphicsDelayServiceImpl.class);
private final static String EMPTY_STR = " ";
@Autowired
private TokenManager tokenManager;
@Autowired
......@@ -61,6 +61,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
private AuthorizerInfoService authorizerInfoService;
@Autowired
private KanbanCommonMapper kanbanCommonMapper;
@Autowired
private CustomerServiceCommonAsyncComponent commonAsyncComponent;
@Override
......@@ -174,7 +176,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
// 找到号下面的所有的客服素材
List<CustomerGraphicsDelay> sourceCustomerList = super.list(new QueryWrapper<CustomerGraphicsDelay>().eq("app_id", appId));
List<Long> sourceMainIdList = sourceCustomerList.stream().map(CustomerGraphicsDelay::getId).collect(Collectors.toList());
// 获取原始链接素材
// 获取原始链接素材 图文只有一条、文本有多条
List<ReferralEntity> referralEntityList = referralEntityService.list(new QueryWrapper<ReferralEntity>().in("material_graphics_id", sourceMainIdList));
Map<Long, List<ReferralEntity>> referralGroupMap = referralEntityList.stream().collect(Collectors.groupingBy(ReferralEntity::getMaterialGraphicsId));
......@@ -186,36 +188,40 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
localLog.info("当前复用书城: {}", storeTypeName);
sourceAuthInfo.setStoreTypeName(storeTypeName);
for (String targetAppId : targetAppList) {
// 遍历要复用的素材
for (CustomerGraphicsDelay item : sourceCustomerList) {
// 设置所属链接
item.setBelongReferralList(referralGroupMap.get(item.getId()));
// 为公众号设置书城名
item.setAuthorizerInfo(sourceAuthInfo);
}
for (String targetAppId : targetAppList) {
// 构造目标公众号的信息
AuthorizerInfo targetAuthInfo = authMap.get(targetAppId);
if (ObjectUtil.isNull(targetAuthInfo)) {
localLog.info("appId: {} 找不到对应公众号", targetAppId);
// 执行下一个公众号
continue;
}
targetAuthInfo.setStoreTypeName(storeTypeName);
// 遍历要复用的素材
for (CustomerGraphicsDelay item : sourceCustomerList) {
// 设置所属链接
item.setBelongReferralList(referralGroupMap.get(item.getId()));
// 为公众号设置书城名
item.setAuthorizerInfo(sourceAuthInfo);
// 执行复用
}
// 异步复用
commonAsyncComponent.obtainDelayGraphicsLink(sourceCustomerList, targetAuthInfo);
}
return null;
return new BaseResult().success("复用进行中, 请等待");
}
@Override
public GenericsResult<List<AuthInfoVO>> getAuthList(String keyword) {
List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword);
public GenericsResult<List<AuthInfoVO>> getAuthList(String keyword, String appId) {
String storeType = null;
if (ObjectUtil.isNotNull(appId)) {
AuthorizerInfo authInfo = authorizerInfoService.getOne(new QueryWrapper<AuthorizerInfo>().eq("appid", appId));
storeType = authInfo.getStoreType();
}
List<String> keywordList = null;
// 拆分多关键词
if (ObjectUtil.isNotNull(keyword) && keyword.contains(EMPTY_STR)) {
String[] keywordSplit = keyword.split(EMPTY_STR);
keywordList = Arrays.asList(keywordSplit);
keyword = null;
}
List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword, keywordList, storeType);
return new GenericsResult<>(authList);
}
......
......@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yaoyaozw.customer.entity.AuthorizerInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -33,4 +34,13 @@ public class AuthInfoVO implements Serializable {
@ApiModelProperty("书城名")
private String storeTypeName;
public void putPropertyValue(AuthorizerInfo authorizerInfo) {
this.id = authorizerInfo.getId();
this.accountId = authorizerInfo.getAccountId();
this.appId = authorizerInfo.getAppid();
this.accountName = authorizerInfo.getNickName();
this.storeType = authorizerInfo.getStoreType();
this.storeTypeName = authorizerInfo.getStoreTypeName();
}
}
......@@ -97,8 +97,19 @@
nick_name as accountName,
store_type as storeType
from authorizer_info
<if test="keyword != null and keyword != ''">
where nick_name like concat('%', #{keyword}, '%')
</if>
<where>
<if test="keyword != null and keyword != ''">
and nick_name like concat('%', #{keyword}, '%')
</if>
<if test="keywordList != null and keywordList.size() != 0">
and nick_name in
<foreach collection="keywordList" separator="," open="(" close=")" item="splitKeyword">
#{splitKeyword}
</foreach>
</if>
<if test="storeType != null and storeType != ''">
and store_type = #{storeType}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论