提交 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;
}
/** /**
* 错误 * 错误
......
...@@ -13,10 +13,7 @@ import com.yaoyaozw.customer.constants.ApiResultConstant; ...@@ -13,10 +13,7 @@ import com.yaoyaozw.customer.constants.ApiResultConstant;
import com.yaoyaozw.customer.constants.CrowdPackageCommonConstant; import com.yaoyaozw.customer.constants.CrowdPackageCommonConstant;
import com.yaoyaozw.customer.constants.CustomerCommonConstant; import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO;
import com.yaoyaozw.customer.entity.CustomerGraphics; import com.yaoyaozw.customer.entity.*;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.entity.RegisterUserEntity;
import com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum; import com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum;
import com.yaoyaozw.customer.feigns.ReferralFeignClient; import com.yaoyaozw.customer.feigns.ReferralFeignClient;
import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper; import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper;
...@@ -24,6 +21,7 @@ import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper; ...@@ -24,6 +21,7 @@ import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper; import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.mapper.MaterialCommonMapper; import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService; import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.service.ReferralEntityService; import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.service.RegisterUserEntityService; import com.yaoyaozw.customer.service.RegisterUserEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
...@@ -71,9 +69,11 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -71,9 +69,11 @@ public class CustomerServiceCommonAsyncComponent {
private CustomerGraphicsMapper customerGraphicsMapper; private CustomerGraphicsMapper customerGraphicsMapper;
@Autowired @Autowired
private KanbanCommonMapper kanbanCommonMapper; private KanbanCommonMapper kanbanCommonMapper;
@Autowired
private CustomerGraphicsDelayMapper customerGraphicsDelayMapper;
private CustomerGraphicsDelayService graphicsDelayService;
public void setGraphicsDelayService(CustomerGraphicsDelayService graphicsDelayService) {
this.graphicsDelayService = graphicsDelayService;
}
@Async("myExecutor") @Async("myExecutor")
public void addMatchUserIntoPackage(Long packageId, Boolean needRemove) { public void addMatchUserIntoPackage(Long packageId, Boolean needRemove) {
...@@ -164,20 +164,25 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -164,20 +164,25 @@ public class CustomerServiceCommonAsyncComponent {
} }
@Async("myExecutor") @Async("myExecutor")
public void obtainDelayLink(Long materialId, CustomerGraphicsDelay customerGraphicsDelay, List<ReferralEntity> referralEntityList) { public void obtainDelayGraphicsLink(List<CustomerGraphicsDelay> sourceCustomerList, AuthorizerInfo targetAuthInfo) {
String accountName = targetAuthInfo.getNickName();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
String dateStr = dateFormat.format(new Date());
LOCAL_LOG.info("延时客服复用--公众号【{}】, 要复制客服数量: {} 条", accountName, sourceCustomerList.size());
// 遍历客服素材进行处理
for (CustomerGraphicsDelay sourceGraphics : sourceCustomerList) {
generateDelayExtendLink(dateStr, sourceGraphics, targetAuthInfo);
} }
}
/**
* 以下是客服消息模块的私有方法
*/
private void getMessageAuthListLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, CustomerGraphics customerMain, ReferralEntity customerReferral) { private void getMessageAuthListLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, CustomerGraphics customerMain, ReferralEntity customerReferral) {
Long packId = customerMain.getPackId(); Long packId = customerMain.getPackId();
LOCAL_LOG.info("开始异步处理客服链接, 客服标题: {}, 人群包主键: {}", customerMain.getName(), packId); LOCAL_LOG.info("开始异步处理客服链接, 客服标题: {}, 人群包主键: {}", customerMain.getName(), packId);
...@@ -187,18 +192,18 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -187,18 +192,18 @@ public class CustomerServiceCommonAsyncComponent {
// 一个书城一个书城地处理 // 一个书城一个书城地处理
if (newsType.equals(CustomerCommonConstant.BOOK_NEWS_TYPE)) { if (newsType.equals(CustomerCommonConstant.BOOK_NEWS_TYPE)) {
// 是推广链接 // 是推广链接
generateExtendLink(storeGroupMap, customerReferral); generateMessageExtendLink(storeGroupMap, customerReferral);
} else if (CustomerCommonConstant.ACTIVITY_NEWS_TYPE.equals(newsType)) { } else if (CustomerCommonConstant.ACTIVITY_NEWS_TYPE.equals(newsType)) {
// 是活动链接 // 是活动链接
generateActivityLink(storeGroupMap, customerReferral); generateMessageActivityLink(storeGroupMap, customerReferral);
} else if (CustomerCommonConstant.USUAL_LINK_NEWS_TYPE.equals(newsType)) { } else if (CustomerCommonConstant.USUAL_LINK_NEWS_TYPE.equals(newsType)) {
// 常用链接 // 常用链接
generateUsualLink(storeGroupMap, customerReferral); generateMessageUsualLink(storeGroupMap, customerReferral);
} }
} }
private void generateExtendLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, ReferralEntity customerReferral) { private void generateMessageExtendLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, ReferralEntity customerReferral) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
String dateStr = dateFormat.format(new Date()); String dateStr = dateFormat.format(new Date());
...@@ -233,7 +238,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -233,7 +238,7 @@ public class CustomerServiceCommonAsyncComponent {
}); });
} }
private void generateActivityLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, ReferralEntity customerReferral) { private void generateMessageActivityLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, ReferralEntity customerReferral) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
String dateStr = dateFormat.format(new Date()); String dateStr = dateFormat.format(new Date());
...@@ -304,7 +309,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -304,7 +309,7 @@ public class CustomerServiceCommonAsyncComponent {
}); });
} }
private void generateUsualLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, ReferralEntity customerReferral) { private void generateMessageUsualLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, ReferralEntity customerReferral) {
Map<String, String> storeEntityMap = getStoreEntityMap(storeGroupMap.keySet()); Map<String, String> storeEntityMap = getStoreEntityMap(storeGroupMap.keySet());
storeGroupMap.forEach((storeType, userVoList) -> { storeGroupMap.forEach((storeType, userVoList) -> {
...@@ -334,6 +339,97 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -334,6 +339,97 @@ public class CustomerServiceCommonAsyncComponent {
}); });
} }
/**
* 以下是延时客服 的方法
*/
private void generateDelayExtendLink(String dateStr, CustomerGraphicsDelay sourceGraphics, AuthorizerInfo targetAuthInfo) {
List<ReferralEntity> targetReferralEntityList = new ArrayList<>();
// 新建新主体
CustomerGraphicsDelay targetCustomerGraphics = new CustomerGraphicsDelay();
long mainId = snowflakeComponent.snowflakeId();
targetCustomerGraphics.setId(mainId);
// 遍历链接数据进行处理
List<ReferralEntity> sourceReferralList = sourceGraphics.getBelongReferralList();
for (ReferralEntity sourceReferralEntity : sourceReferralList) {
ReferralEntity targetReferralEntity = new ReferralEntity();
BeanUtil.copyProperties(sourceReferralEntity, targetReferralEntity);
// 重新生成链接主键id
targetReferralEntity.setId(snowflakeComponent.snowflakeId());
targetReferralEntity.setMaterialGraphicsId(mainId);
targetReferralEntity.setAccountId(targetAuthInfo.getAccountId());
targetReferralEntity.setStoreTypeName(targetAuthInfo.getStoreTypeName());
try {
// 获取链接
AuthInfoVO authInfoVo = new AuthInfoVO();
authInfoVo.putPropertyValue(targetAuthInfo);
getCopyReferral(dateStr, authInfoVo, targetReferralEntity);
targetCustomerGraphics.setSourceUrl(targetReferralEntity.getReferral());
} catch (Exception e) {
LOCAL_LOG.warn("公众号: {} 获取链接异常: {}", targetAuthInfo.getNickName(), e.getMessage());
}
targetReferralEntityList.add(targetReferralEntity);
}
targetCustomerGraphics.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_FINISH);
LOCAL_LOG.info("保存主体数据, 主体id: {}", mainId);
graphicsDelayService.save(targetCustomerGraphics);
LOCAL_LOG.info("准备保存, 共生成链接数据 : {} 条", targetReferralEntityList.size());
referralEntityService.saveBatch(targetReferralEntityList);
}
private void generateDelayActivityLink(String dateStr, CustomerGraphicsDelay sourceGraphics, AuthorizerInfo targetAuthInfo) {
List<ReferralEntity> targetReferralEntityList = new ArrayList<>();
// 新建新主体
CustomerGraphicsDelay targetCustomerGraphics = new CustomerGraphicsDelay();
long mainId = snowflakeComponent.snowflakeId();
targetCustomerGraphics.setId(mainId);
// 遍历链接数据进行处理
List<ReferralEntity> sourceReferralList = sourceGraphics.getBelongReferralList();
for (ReferralEntity sourceReferralEntity : sourceReferralList) {
ReferralEntity targetReferralEntity = new ReferralEntity();
BeanUtil.copyProperties(sourceReferralEntity, targetReferralEntity);
// 重新生成链接主键id
targetReferralEntity.setId(snowflakeComponent.snowflakeId());
targetReferralEntity.setMaterialGraphicsId(mainId);
targetReferralEntity.setAccountId(targetAuthInfo.getAccountId());
targetReferralEntity.setStoreTypeName(targetAuthInfo.getStoreTypeName());
try {
// 获取链接
AuthInfoVO authInfoVo = new AuthInfoVO();
authInfoVo.putPropertyValue(targetAuthInfo);
getCopyReferral(dateStr, authInfoVo, targetReferralEntity);
targetCustomerGraphics.setSourceUrl(targetReferralEntity.getReferral());
} catch (Exception e) {
LOCAL_LOG.warn("公众号: {} 获取链接异常: {}", targetAuthInfo.getNickName(), e.getMessage());
}
targetReferralEntityList.add(targetReferralEntity);
}
targetCustomerGraphics.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_FINISH);
LOCAL_LOG.info("保存主体数据, 主体id: {}", mainId);
graphicsDelayService.save(targetCustomerGraphics);
LOCAL_LOG.info("准备保存, 共生成链接数据 : {} 条", targetReferralEntityList.size());
referralEntityService.saveBatch(targetReferralEntityList);
}
private void generateDelayUsualLink() {
}
/**
* 以下是公有方法
*/
private void getCopyReferral(String dateStr, AuthInfoVO authInfoVo, ReferralEntity referralEntity) { private void getCopyReferral(String dateStr, AuthInfoVO authInfoVo, ReferralEntity referralEntity) {
referralEntity.setStoreType(authInfoVo.getStoreType()); referralEntity.setStoreType(authInfoVo.getStoreType());
// 非常用链接类型的name需要处理 // 非常用链接类型的name需要处理
......
...@@ -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) {
// 构造目标公众号的信息
AuthorizerInfo targetAuthInfo = authMap.get(targetAppId);
if (ObjectUtil.isNull(targetAuthInfo)) {
localLog.info("appId: {} 找不到对应公众号", targetAppId);
// 执行下一个公众号
continue;
}
targetAuthInfo.setStoreTypeName(storeTypeName);
// 遍历要复用的素材 // 遍历要复用的素材
for (CustomerGraphicsDelay item : sourceCustomerList) { for (CustomerGraphicsDelay item : sourceCustomerList) {
// 设置所属链接 // 设置所属链接
item.setBelongReferralList(referralGroupMap.get(item.getId())); item.setBelongReferralList(referralGroupMap.get(item.getId()));
// 为公众号设置书城名 // 为公众号设置书城名
item.setAuthorizerInfo(sourceAuthInfo); item.setAuthorizerInfo(sourceAuthInfo);
// 执行复用
} }
for (String targetAppId : targetAppList) {
// 构造目标公众号的信息
AuthorizerInfo targetAuthInfo = authMap.get(targetAppId);
targetAuthInfo.setStoreTypeName(storeTypeName);
// 异步复用
commonAsyncComponent.obtainDelayGraphicsLink(sourceCustomerList, targetAuthInfo);
} }
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
<where>
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
where nick_name like concat('%', #{keyword}, '%') and nick_name like concat('%', #{keyword}, '%')
</if> </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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论