提交 42445d1d 作者: 沈振路

延时客服

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