提交 6e87f898 作者: 沈振路

延时客服-文本-finish

上级 b09ed005
...@@ -10,9 +10,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -10,9 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.yaoyaozw.customer.common.R; import com.yaoyaozw.customer.common.R;
import com.yaoyaozw.customer.constants.ApiResultConstant; import com.yaoyaozw.customer.constants.ApiResultConstant;
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.entity.*; import com.yaoyaozw.customer.entity.*;
import com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum; import com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum;
import com.yaoyaozw.customer.feigns.ReferralFeignClient; import com.yaoyaozw.customer.feigns.ReferralFeignClient;
...@@ -21,7 +19,6 @@ import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper; ...@@ -21,7 +19,6 @@ 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;
...@@ -35,7 +32,6 @@ import org.springframework.data.redis.core.RedisTemplate; ...@@ -35,7 +32,6 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -149,7 +145,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -149,7 +145,7 @@ public class CustomerServiceCommonAsyncComponent {
for (ReferralEntity referralEntity : referralEntityList) { for (ReferralEntity referralEntity : referralEntityList) {
// 获取链接 // 获取链接
if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(referralEntity.getNewsType())) { if (CustomerCommonConstant.REMOTE_LINK_NEWS_TYPE_LIST.contains(referralEntity.getNewsType())) {
LOCAL_LOG.info("异步获取图文客服链接"); LOCAL_LOG.info("异步获取图文客服链接");
getMessageAuthListLink(storeGroupMap, customerGraphics, referralEntity); getMessageAuthListLink(storeGroupMap, customerGraphics, referralEntity);
} else { } else {
...@@ -157,7 +153,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -157,7 +153,7 @@ public class CustomerServiceCommonAsyncComponent {
} }
} }
// 处理完之后将状态改为待发送 // 处理完之后将状态改为待发送
customerGraphics.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_FINISH); customerGraphics.setSendStatus(CustomerCommonConstant.SEND_STATUS_ACTIVE);
customerGraphicsMapper.updateById(customerGraphics); customerGraphicsMapper.updateById(customerGraphics);
} }
...@@ -355,7 +351,6 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -355,7 +351,6 @@ public class CustomerServiceCommonAsyncComponent {
// 构造h5 // 构造h5
StringBuilder h5Context = new StringBuilder(); StringBuilder h5Context = new StringBuilder();
Integer postSort = sourceGraphics.getPostSort();
// 遍历处理客服链接 // 遍历处理客服链接
int idx = 1; int idx = 1;
for (ReferralEntity sourceReferralEntity : sourceReferralList) { for (ReferralEntity sourceReferralEntity : sourceReferralList) {
...@@ -369,11 +364,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -369,11 +364,8 @@ public class CustomerServiceCommonAsyncComponent {
targetReferralEntity.setStoreTypeName(targetAuthInfo.getStoreTypeName()); targetReferralEntity.setStoreTypeName(targetAuthInfo.getStoreTypeName());
String name = CustomerCommonConstant.getLinkNameModel(targetReferralEntity.getNewsType()); String name = CustomerCommonConstant.getLinkNameModel(targetReferralEntity.getNewsType());
if (StringUtils.isNotBlank(name)) { if (StringUtils.isNotBlank(name) && !CustomerCommonConstant.USUAL_LINK_NEWS_TYPE.equals(targetReferralEntity.getNewsType())) {
name = name + "-" + postSort; name = name + "-" +System.currentTimeMillis() % 10000;
if (ObjectUtil.isNotNull(targetReferralEntity.getSort())) {
name = name + "-" + targetReferralEntity.getSort();
}
targetReferralEntity.setName(name); targetReferralEntity.setName(name);
} }
...@@ -398,7 +390,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -398,7 +390,7 @@ public class CustomerServiceCommonAsyncComponent {
if (type.equals(CustomerCommonConstant.CUSTOMER_TYPE_VALUE_TEXT)) { if (type.equals(CustomerCommonConstant.CUSTOMER_TYPE_VALUE_TEXT)) {
// 文本类型替换h5链接 // 文本类型替换h5链接
String context = null; String context = null;
if (CustomerCommonConstant.LINK_NEWS_TYPE_LIST.contains(newsType)) { if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(newsType)) {
context = CustomerCommonConstant.CUSTOMER_TEXT_LINK_TEMPLATE.replace(CustomerCommonConstant.CUSTOMER_TEXT_CONTENT_PLACEHOLDER, targetReferralEntity.getTextContent()); context = CustomerCommonConstant.CUSTOMER_TEXT_LINK_TEMPLATE.replace(CustomerCommonConstant.CUSTOMER_TEXT_CONTENT_PLACEHOLDER, targetReferralEntity.getTextContent());
} else if (CustomerCommonConstant.COMMON_NEWS_TYPE_LIST.contains(newsType)){ } else if (CustomerCommonConstant.COMMON_NEWS_TYPE_LIST.contains(newsType)){
context = targetReferralEntity.getTextContent(); context = targetReferralEntity.getTextContent();
...@@ -415,7 +407,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -415,7 +407,7 @@ public class CustomerServiceCommonAsyncComponent {
} }
} }
targetCustomerGraphics.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_FINISH); targetCustomerGraphics.setSendStatus(CustomerCommonConstant.SEND_STATUS_ACTIVE);
if (StringUtils.isNotBlank(h5Context)) { if (StringUtils.isNotBlank(h5Context)) {
targetCustomerGraphics.setContent(h5Context.toString()); targetCustomerGraphics.setContent(h5Context.toString());
} }
...@@ -516,6 +508,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -516,6 +508,8 @@ public class CustomerServiceCommonAsyncComponent {
} else if (newsType.equals(CustomerCommonConstant.ACTIVITY_NEWS_TYPE)) { } else if (newsType.equals(CustomerCommonConstant.ACTIVITY_NEWS_TYPE)) {
// 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift} // 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift}
name = name.replace("{recharge}", referralEntity.getRechargeAmount().stripTrailingZeros().toPlainString()).replace("{gift}", referralEntity.getGiftAmount().toString()); name = name.replace("{recharge}", referralEntity.getRechargeAmount().stripTrailingZeros().toPlainString()).replace("{gift}", referralEntity.getGiftAmount().toString());
String tempId = CustomerStoreTemplateEnum.getTempId(referralEntity.getStoreType());
referralEntity.setTemplateId(tempId);
} }
referralEntity.setName(name); referralEntity.setName(name);
} }
......
...@@ -20,12 +20,14 @@ public class CustomerCommonConstant { ...@@ -20,12 +20,14 @@ public class CustomerCommonConstant {
public final static String ERROR_LABEL = "error"; public final static String ERROR_LABEL = "error";
public final static List<Integer> LINK_NEWS_TYPE_LIST = Arrays.asList(1, 2, 3, -1); public final static List<Integer> REPLACE_LINK_NEWS_TYPE_LIST = Arrays.asList(1, 2, 3, -1);
public final static List<Integer> REPLACE_LINK_NEWS_TYPE_LIST = Arrays.asList(1, 2, 3); public final static List<Integer> REMOTE_LINK_NEWS_TYPE_LIST = Arrays.asList(1, 2, 3);
public final static List<Integer> COMMON_NEWS_TYPE_LIST = Collections.singletonList(4); public final static List<Integer> COMMON_NEWS_TYPE_LIST = Collections.singletonList(4);
public final static String YW_LINK_LIMIT_REDIS_KEY = "YW_REFERRAL";
public final static Integer BOOK_NEWS_TYPE = 1; public final static Integer BOOK_NEWS_TYPE = 1;
public final static String BOOK_NEWS_TYPE_NAME = "推广"; public final static String BOOK_NEWS_TYPE_NAME = "推广";
...@@ -58,6 +60,8 @@ public class CustomerCommonConstant { ...@@ -58,6 +60,8 @@ public class CustomerCommonConstant {
public final static Integer SEND_STATUS_LINK_FINISH = 2; public final static Integer SEND_STATUS_LINK_FINISH = 2;
public final static Integer SEND_STATUS_ACTIVE = 9;
public final static Integer SEND_STATUS_SENT_SUCCESS = 3; public final static Integer SEND_STATUS_SENT_SUCCESS = 3;
public final static Integer SEND_STATUS_SENT_FAIL = 4; public final static Integer SEND_STATUS_SENT_FAIL = 4;
......
...@@ -39,6 +39,9 @@ public class CustomerReferralDTO implements Serializable { ...@@ -39,6 +39,9 @@ public class CustomerReferralDTO implements Serializable {
@ApiModelProperty("链接类型") @ApiModelProperty("链接类型")
private Integer newsType; private Integer newsType;
@ApiModelProperty("链接名")
private String name;
@ApiModelProperty(value="序号") @ApiModelProperty(value="序号")
private Integer sort; private Integer sort;
......
...@@ -62,4 +62,11 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics ...@@ -62,4 +62,11 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics
*/ */
List<CommonOptionResponseVO> getTimeIntervalList(); List<CommonOptionResponseVO> getTimeIntervalList();
/**
* 获取延时客服主体的公众号
* @param customerId 延时客服主键
* @return 公众号
*/
AuthInfoVO getCustomerDelayAuthInfo(@Param("customerId") Long customerId);
} }
\ No newline at end of file
...@@ -27,5 +27,13 @@ public interface ReferralEntityMapper extends BaseMapper<ReferralEntity> { ...@@ -27,5 +27,13 @@ public interface ReferralEntityMapper extends BaseMapper<ReferralEntity> {
void ultimateDeleteReferrals(@Param("sourceId") Long sourceId, @Param("extraCondition") String extraCondition); void ultimateDeleteReferrals(@Param("sourceId") Long sourceId, @Param("extraCondition") String extraCondition);
List<ReferralEntityVo> findByMaterialGraphicsId(@Param("graphicsId")Long graphicsId); List<ReferralEntityVo> findByMaterialGraphicsId(@Param("graphicsId") Long graphicsId);
/**
* 物理删除素材元素
*
* @param sourceIdList 素材主体ID
* @param extraCondition 特殊条件表达式
*/
void ultimateDeleteReferralsBatch(@Param("sourceIdList") List<Long> sourceIdList, @Param("extraCondition") String extraCondition);
} }
\ No newline at end of file
...@@ -22,6 +22,14 @@ public interface ReferralEntityService extends IService<ReferralEntity> { ...@@ -22,6 +22,14 @@ public interface ReferralEntityService extends IService<ReferralEntity> {
void ultimateDeleteReferrals(Long sourceId, String extraCondition); void ultimateDeleteReferrals(Long sourceId, String extraCondition);
/** /**
* 物理删除素材元素
*
* @param sourceIdList 素材主体ID
* @param extraCondition 特殊条件表达式
*/
void ultimateDeleteReferralsBatch(List<Long> sourceIdList, String extraCondition);
/**
* 根据客服id找链接 * 根据客服id找链接
* @param graphicsId 客服主体id * @param graphicsId 客服主体id
* @return * @return
......
...@@ -27,8 +27,8 @@ import org.apache.commons.lang3.StringUtils; ...@@ -27,8 +27,8 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -89,6 +89,14 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe ...@@ -89,6 +89,14 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe
String storeTypeName = kanbanCommonMapper.getStoreTypeNameByAppId(referralDto.getAppId()); String storeTypeName = kanbanCommonMapper.getStoreTypeNameByAppId(referralDto.getAppId());
referralEntity.setStoreTypeName(storeTypeName); referralEntity.setStoreTypeName(storeTypeName);
// 获取链接
// 日期
String format = new SimpleDateFormat("yyyy/MM/dd").format(new Date());
// 公众号
AuthInfoVO authInfoVO = super.baseMapper.getCustomerDelayAuthInfo(referralDto.getMaterialGraphicsId());
if (CustomerCommonConstant.REMOTE_LINK_NEWS_TYPE_LIST.contains(referralEntity.getNewsType())) {
commonAsyncComponent.getCopyReferral(format, authInfoVO, referralEntity);
}
// 保存链接数据 // 保存链接数据
referralEntityService.saveOrUpdate(referralEntity); referralEntityService.saveOrUpdate(referralEntity);
...@@ -100,41 +108,32 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe ...@@ -100,41 +108,32 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe
// 查询主体数据 // 查询主体数据
CustomerGraphicsDelay customerGraphicsDelay = super.getById(id); CustomerGraphicsDelay customerGraphicsDelay = super.getById(id);
if (ObjectUtil.isNull(customerGraphicsDelay)) { if (ObjectUtil.isNull(customerGraphicsDelay)) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return new GenericsResult<>(false, "找不到主体数据"); return new GenericsResult<>(false, "找不到主体数据");
} }
// 赋值主体数据 // 赋值主体数据
CustomerDelayTextDetailVO detailVO = new CustomerDelayTextDetailVO(); CustomerDelayTextDetailVO detailVO = new CustomerDelayTextDetailVO();
BeanUtil.copyProperties(customerGraphicsDelay, detailVO); BeanUtil.copyProperties(customerGraphicsDelay, detailVO);
// 合并链接中的h5代码 // 查询所有的链接信息
List<ReferralEntity> referralEntityList = referralEntityService.list(new QueryWrapper<ReferralEntity>().eq("material_graphics_id", id).isNull("account_id").orderByAsc("gmt_create")); List<ReferralEntity> referralEntityList = referralEntityService.list(new QueryWrapper<ReferralEntity>().eq("material_graphics_id", id).orderByAsc("gmt_create").orderByAsc("sort"));
List<CustomerContentVO> contentList = new ArrayList<>(); List<CustomerContentVO> contentList = new ArrayList<>();
// 位置计数器
StringBuilder mainH5Content = new StringBuilder(); StringBuilder mainH5Content = new StringBuilder();
// 日期
String format = new SimpleDateFormat("yyyy/MM/dd").format(new Date());
// 公众号
AuthorizerInfo authorizerInfo = authorizerInfoService.getOne(new QueryWrapper<AuthorizerInfo>().eq("appid", customerGraphicsDelay.getAppId()));
AuthInfoVO authInfoVO = new AuthInfoVO();
authInfoVO.putPropertyValue(authorizerInfo);
localLog.info("根据链接重新生成H5"); localLog.info("根据链接重新生成H5");
// 位置计数器
int idx = 1; int idx = 1;
for (ReferralEntity item : referralEntityList) { for (ReferralEntity item : referralEntityList) {
item.setSort(idx); item.setSort(idx);
CustomerContentVO customerContentVO = new CustomerContentVO(); CustomerContentVO customerContentVO = new CustomerContentVO();
// 设置主键id和h5代码段 // 设置主键id和h5代码段
customerContentVO.setId(item.getId()); customerContentVO.setId(item.getId());
// 获取链接
commonAsyncComponent.getCopyReferral(format, authInfoVO, item);
Integer newsType = item.getNewsType();
// 处理h5文本
String context = null; String context = null;
if (CustomerCommonConstant.LINK_NEWS_TYPE_LIST.contains(item.getNewsType())) { if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(newsType)) {
context = CustomerCommonConstant.CUSTOMER_TEXT_LINK_TEMPLATE.replace(CustomerCommonConstant.CUSTOMER_TEXT_CONTENT_PLACEHOLDER, item.getTextContent()); context = CustomerCommonConstant.CUSTOMER_TEXT_LINK_TEMPLATE.replace(CustomerCommonConstant.CUSTOMER_TEXT_CONTENT_PLACEHOLDER, item.getTextContent());
} else if (CustomerCommonConstant.COMMON_NEWS_TYPE_LIST.contains(item.getNewsType())){ } else if (CustomerCommonConstant.COMMON_NEWS_TYPE_LIST.contains(newsType)){
context = item.getTextContent(); context = item.getTextContent();
} }
if (ObjectUtil.isNotNull(context)) { if (ObjectUtil.isNotNull(context)) {
...@@ -158,6 +157,10 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe ...@@ -158,6 +157,10 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe
} }
customerGraphicsDelay.setContent(mainH5Content.toString().replace(CustomerCommonConstant.H5_STYLE_CODE, "")); customerGraphicsDelay.setContent(mainH5Content.toString().replace(CustomerCommonConstant.H5_STYLE_CODE, ""));
detailVO.setContentList(contentList); detailVO.setContentList(contentList);
// 公众号
AuthInfoVO authInfoVO = super.baseMapper.getCustomerDelayAuthInfo(id);
detailVO.setAuthInfoVo(authInfoVO);
// 更新连接表 // 更新连接表
localLog.info("更新连接表"); localLog.info("更新连接表");
if (CollectionUtil.isNotEmpty(referralEntityList)) { if (CollectionUtil.isNotEmpty(referralEntityList)) {
......
...@@ -29,6 +29,7 @@ import com.yaoyaozw.customer.vo.CommonOptionResponseVO; ...@@ -29,6 +29,7 @@ import com.yaoyaozw.customer.vo.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -81,31 +82,33 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -81,31 +82,33 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
@Override @Override
public BaseResult insertCustomerDelay(CustomerDelaySaveDTO saveDto) { public BaseResult insertCustomerDelay(CustomerDelaySaveDTO saveDto) {
boolean isCreate = false;
CustomerGraphicsDelay customerGraphicsDelay = new CustomerGraphicsDelay(); CustomerGraphicsDelay customerGraphicsDelay = new CustomerGraphicsDelay();
BeanUtil.copyProperties(saveDto, customerGraphicsDelay); BeanUtil.copyProperties(saveDto, customerGraphicsDelay);
// 初始化操作信息 // 初始化操作信息
customerGraphicsDelay.initOperateInfo(tokenManager.getUserIdFromToken(), ObjectUtil.isNull(saveDto.getId())); customerGraphicsDelay.initOperateInfo(tokenManager.getUserIdFromToken(), ObjectUtil.isNull(saveDto.getId()));
if (ObjectUtil.isNull(customerGraphicsDelay.getId())) { if (ObjectUtil.isNull(customerGraphicsDelay.getId())) {
isCreate = true;
long id = snowflakeComponent.snowflakeId(); long id = snowflakeComponent.snowflakeId();
localLog.info("是新增, 新生成ID: {}", id); localLog.info("是新增, 新生成ID: {}", id);
customerGraphicsDelay.setId(id); customerGraphicsDelay.setId(id);
} }
customerGraphicsDelay.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_GETTING);
localLog.info("生成referral数据"); localLog.info("生成referral数据");
ReferralEntity referralEntity = new ReferralEntity(); ReferralEntity referralEntity = new ReferralEntity();
BeanUtil.copyProperties(saveDto.getCustomerReferralDto(), referralEntity); BeanUtil.copyProperties(saveDto.getCustomerReferralDto(), referralEntity);
referralEntity.setMaterialGraphicsId(customerGraphicsDelay.getId()); referralEntity.setMaterialGraphicsId(customerGraphicsDelay.getId());
// 非自定义获取链接 // 非自定义获取链接
if (!referralEntity.getNewsType().equals(-1)) { if (isCreate && !referralEntity.getNewsType().equals(-1)) {
try { try {
customerGraphicsDelay.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_GETTING);
localLog.info("准备获取链接"); localLog.info("准备获取链接");
String linkNameModel = CustomerCommonConstant.getLinkNameModel(referralEntity.getNewsType()); String linkNameModel = CustomerCommonConstant.getLinkNameModel(referralEntity.getNewsType());
if (StringUtils.isNotBlank(linkNameModel)) {
localLog.info("获取链接name模板: {}", linkNameModel); localLog.info("获取链接name模板: {}", linkNameModel);
referralEntity.setName(linkNameModel); referralEntity.setName(linkNameModel);
}
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());
...@@ -113,7 +116,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -113,7 +116,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
AuthInfoVO authInfoVO = new AuthInfoVO(); AuthInfoVO authInfoVO = new AuthInfoVO();
authInfoVO.putPropertyValue(authorizerInfo); authInfoVO.putPropertyValue(authorizerInfo);
commonAsyncComponent.getCopyReferral(dateStr, authInfoVO, referralEntity); commonAsyncComponent.getCopyReferral(dateStr, authInfoVO, referralEntity);
customerGraphicsDelay.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_FINISH); customerGraphicsDelay.setSendStatus(CustomerCommonConstant.SEND_STATUS_ACTIVE);
localLog.info("链接获取完成"); localLog.info("链接获取完成");
} catch (Exception e) { } catch (Exception e) {
localLog.info("获取链接异常"); localLog.info("获取链接异常");
...@@ -154,6 +157,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -154,6 +157,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
BeanUtil.copyProperties(referralEntity, customerReferralDto); BeanUtil.copyProperties(referralEntity, customerReferralDto);
customerDelayGraphicsDetailVO.setCustomerReferralDto(customerReferralDto); customerDelayGraphicsDetailVO.setCustomerReferralDto(customerReferralDto);
AuthInfoVO authInfoVO = super.baseMapper.getCustomerDelayAuthInfo(id);
customerDelayGraphicsDetailVO.setAuthInfoVo(authInfoVO);
return new GenericsResult<>(customerDelayGraphicsDetailVO); return new GenericsResult<>(customerDelayGraphicsDetailVO);
} }
...@@ -175,12 +180,22 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -175,12 +180,22 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
@Override @Override
public BaseResult removeCustomerDelay(Long id) { public BaseResult removeCustomerDelay(Long id) {
return null; boolean result = super.removeById(id);
if (result) {
return new BaseResult().success();
}
referralEntityService.ultimateDeleteReferrals(id, null);
return new BaseResult().error("弃用失败");
} }
@Override @Override
public BaseResult removeBatch(List<Long> idList) { public BaseResult removeBatch(List<Long> idList) {
return null; boolean result = super.removeByIds(idList);
if (result) {
return new BaseResult().success();
}
referralEntityService.ultimateDeleteReferralsBatch(idList, null);
return new BaseResult().error("删除失败");
} }
@Override @Override
...@@ -199,7 +214,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -199,7 +214,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).orderByAsc("gmt_create").orderByAsc("sort"));
Map<Long, List<ReferralEntity>> referralGroupMap = referralEntityList.stream().collect(Collectors.groupingBy(ReferralEntity::getMaterialGraphicsId)); Map<Long, List<ReferralEntity>> referralGroupMap = referralEntityList.stream().collect(Collectors.groupingBy(ReferralEntity::getMaterialGraphicsId));
// 遍历处理 // 遍历处理
......
...@@ -2,24 +2,14 @@ package com.yaoyaozw.customer.service.impl; ...@@ -2,24 +2,14 @@ package com.yaoyaozw.customer.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sun.xml.internal.bind.v2.TODO;
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.common.R;
import com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent; 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.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.CustomerMessageQueryDTO; import com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO;
...@@ -30,15 +20,10 @@ import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; ...@@ -30,15 +20,10 @@ import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.entity.CrowdPackageCondition; import com.yaoyaozw.customer.entity.CrowdPackageCondition;
import com.yaoyaozw.customer.entity.CrowdPackageConditionMatch; import com.yaoyaozw.customer.entity.CrowdPackageConditionMatch;
import com.yaoyaozw.customer.entity.ReferralEntity; import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum;
import com.yaoyaozw.customer.feigns.ReferralFeignClient;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper; import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService; import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService;
import com.yaoyaozw.customer.service.CrowdPackageConditionService; import com.yaoyaozw.customer.service.CrowdPackageConditionService;
import com.yaoyaozw.customer.service.ReferralEntityService; import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.*; import com.yaoyaozw.customer.vo.customer.*;
import com.yaoyaozw.customer.service.*; import com.yaoyaozw.customer.service.*;
import com.yaoyaozw.customer.service.wechat.service.WeChatService; import com.yaoyaozw.customer.service.wechat.service.WeChatService;
...@@ -54,9 +39,6 @@ import java.util.*; ...@@ -54,9 +39,6 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.List; import java.util.List;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaoyaozw.customer.entity.CustomerGraphics; import com.yaoyaozw.customer.entity.CustomerGraphics;
...@@ -111,7 +93,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap ...@@ -111,7 +93,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
customerGraphics.setId(id); customerGraphics.setId(id);
} }
// 设置链接数 // 设置链接数
if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(saveDto.getCustomerReferralDto().getNewsType())) { if (CustomerCommonConstant.REMOTE_LINK_NEWS_TYPE_LIST.contains(saveDto.getCustomerReferralDto().getNewsType())) {
customerGraphics.setReferralSize(1); customerGraphics.setReferralSize(1);
} }
super.saveOrUpdate(customerGraphics); super.saveOrUpdate(customerGraphics);
......
...@@ -109,7 +109,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -109,7 +109,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
// 设置主键id和h5代码段 // 设置主键id和h5代码段
customerContentVO.setId(item.getId()); customerContentVO.setId(item.getId());
String context = null; String context = null;
if (CustomerCommonConstant.LINK_NEWS_TYPE_LIST.contains(item.getNewsType())) { if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(item.getNewsType())) {
context = CustomerCommonConstant.CUSTOMER_TEXT_LINK_TEMPLATE context = CustomerCommonConstant.CUSTOMER_TEXT_LINK_TEMPLATE
.replace(CustomerCommonConstant.CUSTOMER_TEXT_CONTENT_PLACEHOLDER, item.getTextContent()) .replace(CustomerCommonConstant.CUSTOMER_TEXT_CONTENT_PLACEHOLDER, item.getTextContent())
.replace(CustomerCommonConstant.CUSTOMER_TEXT_URL_PLACEHOLDER, CustomerCommonConstant.CUSTOMER_TEXT_URL_PLACEHOLDER + idx); .replace(CustomerCommonConstant.CUSTOMER_TEXT_URL_PLACEHOLDER, CustomerCommonConstant.CUSTOMER_TEXT_URL_PLACEHOLDER + idx);
...@@ -133,7 +133,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -133,7 +133,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
contentList.add(customerContentVO); contentList.add(customerContentVO);
// 统计referralSize // 统计referralSize
if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(item.getNewsType())) { if (CustomerCommonConstant.REMOTE_LINK_NEWS_TYPE_LIST.contains(item.getNewsType())) {
replaceLinkTypeNum += 1; replaceLinkTypeNum += 1;
} }
idx += 1; idx += 1;
......
package com.yaoyaozw.customer.service.impl; package com.yaoyaozw.customer.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaoyaozw.customer.entity.ReferralEntity; import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.mapper.ReferralEntityMapper; import com.yaoyaozw.customer.mapper.ReferralEntityMapper;
...@@ -18,10 +20,21 @@ public class ReferralEntityServiceImpl extends ServiceImpl<ReferralEntityMapper, ...@@ -18,10 +20,21 @@ public class ReferralEntityServiceImpl extends ServiceImpl<ReferralEntityMapper,
@Override @Override
public void ultimateDeleteReferrals(Long materialId, String extraCondition) { public void ultimateDeleteReferrals(Long materialId, String extraCondition) {
if (ObjectUtil.isNull(materialId)) {
return;
}
super.baseMapper.ultimateDeleteReferrals(materialId, extraCondition); super.baseMapper.ultimateDeleteReferrals(materialId, extraCondition);
} }
@Override @Override
public void ultimateDeleteReferralsBatch(List<Long> sourceIdList, String extraCondition) {
if (CollectionUtil.isEmpty(sourceIdList)) {
return;
}
super.baseMapper.ultimateDeleteReferralsBatch(sourceIdList, extraCondition);
}
@Override
public List<ReferralEntityVo> findReferralByCustomerGraphicsId(Long graphicsId) { public List<ReferralEntityVo> findReferralByCustomerGraphicsId(Long graphicsId) {
return baseMapper.findByMaterialGraphicsId(graphicsId); return baseMapper.findByMaterialGraphicsId(graphicsId);
} }
......
package com.yaoyaozw.customer.vo.customer; package com.yaoyaozw.customer.vo.customer;
import cn.hutool.core.util.ObjectUtil;
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.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable; import java.io.Serializable;
...@@ -25,4 +28,14 @@ public class CustomerContentVO implements Serializable { ...@@ -25,4 +28,14 @@ public class CustomerContentVO implements Serializable {
@ApiModelProperty("链接相关内容") @ApiModelProperty("链接相关内容")
private CustomerReferralDTO customerReferralDto; private CustomerReferralDTO customerReferralDto;
@ApiModelProperty("是否可编辑")
private Boolean editable;
public Boolean getEditable() {
if (ObjectUtil.isNull(this.customerReferralDto)) {
return true;
}
// 如果是需要远程获取链接的,并且链接已经生成的,则不能再进行编辑
return !(CustomerCommonConstant.REMOTE_LINK_NEWS_TYPE_LIST.contains(this.customerReferralDto.getNewsType()) && StringUtils.isNotBlank(this.customerReferralDto.getReferral()));
}
} }
...@@ -3,6 +3,7 @@ package com.yaoyaozw.customer.vo.customer; ...@@ -3,6 +3,7 @@ package com.yaoyaozw.customer.vo.customer;
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.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -51,4 +52,6 @@ public class CustomerDelayGraphicsDetailVO implements Serializable { ...@@ -51,4 +52,6 @@ public class CustomerDelayGraphicsDetailVO implements Serializable {
@ApiModelProperty("链接相关内容") @ApiModelProperty("链接相关内容")
private CustomerReferralDTO customerReferralDto; private CustomerReferralDTO customerReferralDto;
private AuthInfoVO authInfoVo;
} }
...@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.vo.customer; ...@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.vo.customer;
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.vo.AuthInfoVO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -38,10 +39,13 @@ public class CustomerDelayTextDetailVO implements Serializable { ...@@ -38,10 +39,13 @@ public class CustomerDelayTextDetailVO implements Serializable {
private Long timeInterval; private Long timeInterval;
@ApiModelProperty("已支付、未支付") @ApiModelProperty("已支付、未支付")
@JsonSerialize(using = ToStringSerializer.class)
private Integer isPay; private Integer isPay;
@ApiModelProperty("appId") @ApiModelProperty("appId")
private String appId; private String appId;
private AuthInfoVO authInfoVo;
} }
...@@ -122,4 +122,18 @@ ...@@ -122,4 +122,18 @@
</if> </if>
</where> </where>
</select> </select>
<select id="getCustomerDelayAuthInfo" resultType="com.yaoyaozw.customer.vo.AuthInfoVO">
select
ai.id,
ai.account_id as accountId,
ai.appid as appId,
ai.nick_name as accountName,
ai.store_type as storeType
from customer_graphics_delay cgd
left join authorizer_info ai
on cgd.app_id = ai.appid
where cgd.id = #{customerId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -48,4 +48,15 @@ ...@@ -48,4 +48,15 @@
</select> </select>
<delete id="ultimateDeleteReferralsBatch">
delete from referral_entity
where material_graphics_id in
<foreach collection="sourceIdList" item="sourceId" separator="," open="(" close=")">
#{sourceId}
</foreach>
<if test="extraCondition != null and extraCondition != ''">
${extraCondition}
</if>
</delete>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论