提交 9672b5fe 作者: 沈振路

Merge branch 'customer_service_SZlu'

# Conflicts:
#	src/main/java/com/yaoyaozw/customer/components/CustomerServiceCommonAsyncComponent.java
#	src/main/java/com/yaoyaozw/customer/entity/CustomerGraphicsDelay.java
#	src/main/resources/mapper/KanbanCommonMapper.xml
...@@ -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;
}
/** /**
* 错误 * 错误
......
...@@ -20,12 +20,15 @@ public class CustomerCommonConstant { ...@@ -20,12 +20,15 @@ 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 String YANG_GUANG_ACCESS_LIMIT_REDIS_KEY = "YG_ACCESS_LIMIT_NUM";
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 +61,8 @@ public class CustomerCommonConstant { ...@@ -58,6 +61,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;
......
...@@ -30,4 +30,10 @@ public class CustomerCommonController { ...@@ -30,4 +30,10 @@ public class CustomerCommonController {
return commonService.getStoreList(); return commonService.getStoreList();
} }
@GetMapping("/getCoverPicList")
@ApiOperation("获取书城列表")
public GenericsResult<List<CommonOptionResponseVO>> getCoverPicList() {
return commonService.getCoverPicList();
}
} }
...@@ -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.controller;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.service.CustomerDelayTextService;
import com.yaoyaozw.customer.vo.customer.CustomerDelayTextDetailVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author darker
* @date 2022/9/15 11:13
*/
@Api(tags = "延时客服接口-文本")
@RestController
@RequestMapping("/customer-service/delay/text")
public class CustomerDelayTextController {
@Autowired
private CustomerDelayTextService textService;
@ApiOperation("新增客服主体")
@PostMapping("/insertCustomerDelay")
public GenericsResult<String> insertCustomerDelay(@RequestBody CustomerDelayTextSaveDTO saveDto) {
return textService.insertCustomerDelay(saveDto);
}
@ApiOperation("新增客服内容")
@PostMapping("/insertCustomerContent")
public GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(@RequestBody CustomerReferralDTO referralDto) {
return textService.insertCustomerContent(referralDto);
}
@ApiOperation("获取文本客服详情")
@GetMapping("/detail/{id}")
public GenericsResult<CustomerDelayTextDetailVO> getCustomerTextDetail(@PathVariable("id") Long id) {
return textService.getCustomerTextDetail(id);
}
@ApiOperation("删除单条文本内容")
@GetMapping("/removeCustomerContent/{contentId}")
public GenericsResult<CustomerDelayTextDetailVO> removeCustomerContent(@PathVariable("contentId") Long contentId) {
return textService.removeCustomerContent(contentId);
}
}
...@@ -41,6 +41,9 @@ public class CustomerDelaySaveDTO implements Serializable { ...@@ -41,6 +41,9 @@ public class CustomerDelaySaveDTO implements Serializable {
@ApiModelProperty("发文间隔时间") @ApiModelProperty("发文间隔时间")
private Long timeInterval; private Long timeInterval;
@ApiModelProperty("已支付、未支付")
private Integer isPay;
@ApiModelProperty("消息内容实体") @ApiModelProperty("消息内容实体")
private CustomerReferralDTO customerReferralDto; private CustomerReferralDTO customerReferralDto;
......
package com.yaoyaozw.customer.dto.customer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author darker
* @date 2022/10/12 16:33
*/
@Data
@ApiModel("文本类型客服保存实体")
public class CustomerDelayTextSaveDTO implements Serializable {
@ApiModelProperty("客服消息id")
private Long id;
@ApiModelProperty("公众号AppId")
private String appId;
@ApiModelProperty("标题")
private String name;
@ApiModelProperty("发文序号")
private Integer postSort;
@ApiModelProperty("发文间隔时间")
private Long timeInterval;
@ApiModelProperty("已支付、未支付")
private Integer isPay;
@ApiModelProperty("客服消息类型(图文、文本)")
private String type;
}
...@@ -33,9 +33,15 @@ public class CustomerReferralDTO implements Serializable { ...@@ -33,9 +33,15 @@ public class CustomerReferralDTO implements Serializable {
@ApiModelProperty("文本类型文本内容") @ApiModelProperty("文本类型文本内容")
private String textContent; private String textContent;
@ApiModelProperty("appId")
private String appId;
@ApiModelProperty("链接类型") @ApiModelProperty("链接类型")
private Integer newsType; private Integer newsType;
@ApiModelProperty("链接名")
private String name;
@ApiModelProperty(value="序号") @ApiModelProperty(value="序号")
private Integer sort; private Integer sort;
......
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;
...@@ -65,10 +63,16 @@ public class CustomerGraphicsDelay implements Serializable { ...@@ -65,10 +63,16 @@ 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_pay")
private Integer isHistory; private Integer isPay;
/** /**
* 发送序列 * 发送序列
...@@ -110,6 +114,7 @@ public class CustomerGraphicsDelay implements Serializable { ...@@ -110,6 +114,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)
......
...@@ -35,7 +35,7 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics ...@@ -35,7 +35,7 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics
* @param queryDto 查询dto * @param queryDto 查询dto
* @return {@link List}<{@link CustomerDelayListVO}> * @return {@link List}<{@link CustomerDelayListVO}>
*/ */
List<CustomerDelayListVO> pageList(CustomerDelayQueryDTO queryDto); List<CustomerDelayListVO> pageList(@Param("queryDto") CustomerDelayQueryDTO queryDto);
/** /**
* 得到客户账户存在 * 得到客户账户存在
...@@ -48,10 +48,13 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics ...@@ -48,10 +48,13 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics
/** /**
* 让时间间隔列表 * 让时间间隔列表
* *
* @param keyword 关键词 * @param keyword 关键词
* @param keywordList 关键词拆分
* @param storeType 书城
* @param appId 需要排除的公众号appId
* @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, @Param("appId") String appId);
/** /**
* 让时间间隔列表 * 让时间间隔列表
...@@ -60,4 +63,11 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics ...@@ -60,4 +63,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
...@@ -51,6 +51,12 @@ public interface KanbanCommonMapper { ...@@ -51,6 +51,12 @@ public interface KanbanCommonMapper {
*/ */
List<CommonOptionResponseVO> getStoreTypeEntity(@Param("storeKeySet") Set<String> storeKeySet); List<CommonOptionResponseVO> getStoreTypeEntity(@Param("storeKeySet") Set<String> storeKeySet);
/**
* @param appId 应用程序id
* @return {@link String}
*/
String getStoreTypeNameByAppId(@Param("appId") String appId);
List<CommonCostSetupVo> getWechatCostSetup(@Param("appid")String appid); List<CommonCostSetupVo> getWechatCostSetup(@Param("appid")String appid);
......
...@@ -33,4 +33,11 @@ public interface MaterialCommonMapper { ...@@ -33,4 +33,11 @@ public interface MaterialCommonMapper {
*/ */
List<AuthInfoVO> getAuthInfoList(@Param("accountSet") Set<String> accountSet); List<AuthInfoVO> getAuthInfoList(@Param("accountSet") Set<String> accountSet);
/**
* 把封面图片列表
*
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
*/
List<CommonOptionResponseVO> getCoverPicList();
} }
...@@ -21,11 +21,19 @@ public interface ReferralEntityMapper extends BaseMapper<ReferralEntity> { ...@@ -21,11 +21,19 @@ public interface ReferralEntityMapper extends BaseMapper<ReferralEntity> {
/** /**
* 物理删除素材元素 * 物理删除素材元素
* *
* @param sourceId 素材主体ID * @param sourceId 素材主体ID
* @param extraCondition 特殊条件表达式 * @param extraCondition 特殊条件表达式
*/ */
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
package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.vo.customer.CustomerDelayTextDetailVO;
/**
* @author darker
* @date 2022/10/17 16:38
*/
public interface CustomerDelayTextService extends IService<CustomerGraphicsDelay> {
/**
* 插入客户延迟
*
* @param saveDto 保存dto
* @return {@link GenericsResult}<{@link String}>
*/
GenericsResult<String> insertCustomerDelay(CustomerDelayTextSaveDTO saveDto);
/**
* 插入客户内容
*
* @param referralDto 推荐dto
* @return {@link GenericsResult}<{@link CustomerDelayTextDetailVO}>
*/
GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto);
/**
* 得到客户文本细节
*
* @param id id
* @return {@link GenericsResult}<{@link CustomerDelayTextDetailVO}>
*/
GenericsResult<CustomerDelayTextDetailVO> getCustomerTextDetail(Long id);
/**
* 删除客户内容
*
* @param contentId 内容识别
* @return {@link GenericsResult}<{@link CustomerDelayTextDetailVO}>
*/
GenericsResult<CustomerDelayTextDetailVO> removeCustomerContent(Long contentId);
}
...@@ -97,9 +97,10 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD ...@@ -97,9 +97,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);
/** /**
* 让时间间隔列表 * 让时间间隔列表
...@@ -107,5 +108,12 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD ...@@ -107,5 +108,12 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>> * @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
*/ */
GenericsResult<List<CommonOptionResponseVO>> getTimeIntervalList(); GenericsResult<List<CommonOptionResponseVO>> getTimeIntervalList();
/**
* 客户重新排序
*
* @param appId 应用程序id
*/
void reSortCustomer(String appId);
} }
...@@ -25,4 +25,11 @@ public interface CustomerServiceCommonService { ...@@ -25,4 +25,11 @@ public interface CustomerServiceCommonService {
* @return {@link GenericsResult}<{@link CommonOptionResponseVO}> * @return {@link GenericsResult}<{@link CommonOptionResponseVO}>
*/ */
GenericsResult<List<CommonOptionResponseVO>> getStoreList(); GenericsResult<List<CommonOptionResponseVO>> getStoreList();
/**
* 把封面图片列表
*
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
*/
GenericsResult<List<CommonOptionResponseVO>> getCoverPicList();
} }
...@@ -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
......
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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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;
import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.entity.AuthorizerInfo;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.service.AuthorizerInfoService;
import com.yaoyaozw.customer.service.CustomerDelayTextService;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.customer.CustomerContentVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayTextDetailVO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author darker
* @date 2022/10/17 16:39
*/
@Service
public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDelayMapper, CustomerGraphicsDelay> implements CustomerDelayTextService {
private final static Logger localLog = LoggerFactory.getLogger(CustomerDelayTextServiceImpl.class);
@Autowired
private TokenManager tokenManager;
@Autowired
private SnowflakeComponent snowflakeComponent;
@Autowired
private ReferralEntityService referralEntityService;
@Autowired
private CustomerServiceCommonAsyncComponent commonAsyncComponent;
@Autowired
private KanbanCommonMapper kanbanCommonMapper;
@Autowired
private CustomerGraphicsDelayService graphicsDelayService;
@Override
public GenericsResult<String> insertCustomerDelay(CustomerDelayTextSaveDTO saveDto) {
// 主体数据
localLog.info("处理主体数据");
CustomerGraphicsDelay customerGraphicsDelay = new CustomerGraphicsDelay();
BeanUtil.copyProperties(saveDto, customerGraphicsDelay);
boolean isCreate = ObjectUtil.isNull(customerGraphicsDelay.getId());
customerGraphicsDelay.initOperateInfo(tokenManager.getUserIdFromToken(), ObjectUtil.isNull(saveDto.getId()));
if (isCreate) {
long id = snowflakeComponent.snowflakeId();
customerGraphicsDelay.setId(id);
}
customerGraphicsDelay.setSendStatus(CustomerCommonConstant.SEND_STATUS_ACTIVE);
super.saveOrUpdate(customerGraphicsDelay);
String appId = saveDto.getAppId();
if (StringUtils.isBlank(appId)) {
// 更新的时候
CustomerGraphicsDelay entity = super.getById(saveDto.getId());
if (ObjectUtil.isNotNull(entity)) {
appId = entity.getAppId();
}
}
if (!StringUtils.isBlank(appId)) {
graphicsDelayService.reSortCustomer(appId);
}
return new GenericsResult<>(customerGraphicsDelay.getId().toString());
}
@Override
public GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto) {
// 处理活动数据
ReferralEntity referralEntity = new ReferralEntity();
BeanUtil.copyProperties(referralDto, referralEntity);
// 获取name模板
String nameModel = CustomerCommonConstant.getLinkNameModel(referralEntity.getNewsType());
localLog.info("获取name模板: {}", nameModel);
if (StringUtils.isNotBlank(nameModel)) {
referralEntity.setName(nameModel);
}
String storeTypeName = kanbanCommonMapper.getStoreTypeNameByAppId(referralDto.getAppId());
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);
return getCustomerTextDetail(referralDto.getMaterialGraphicsId());
}
@Override
public GenericsResult<CustomerDelayTextDetailVO> getCustomerTextDetail(Long id) {
// 查询主体数据
CustomerGraphicsDelay customerGraphicsDelay = super.getById(id);
if (ObjectUtil.isNull(customerGraphicsDelay)) {
return new GenericsResult<>(false, "找不到主体数据");
}
// 赋值主体数据
CustomerDelayTextDetailVO detailVO = new CustomerDelayTextDetailVO();
BeanUtil.copyProperties(customerGraphicsDelay, detailVO);
// 查询所有的链接信息
List<ReferralEntity> referralEntityList = referralEntityService.list(new QueryWrapper<ReferralEntity>().eq("material_graphics_id", id).orderByAsc("gmt_create").orderByAsc("sort"));
List<CustomerContentVO> contentList = new ArrayList<>();
StringBuilder mainH5Content = new StringBuilder();
localLog.info("根据链接重新生成H5");
// 位置计数器
int idx = 1;
for (ReferralEntity item : referralEntityList) {
item.setSort(idx);
CustomerContentVO customerContentVO = new CustomerContentVO();
// 设置主键id和h5代码段
customerContentVO.setId(item.getId());
Integer newsType = item.getNewsType();
// 处理h5文本
String context = null;
if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(newsType)) {
context = CustomerCommonConstant.CUSTOMER_TEXT_LINK_TEMPLATE.replace(CustomerCommonConstant.CUSTOMER_TEXT_CONTENT_PLACEHOLDER, item.getTextContent());
} else if (CustomerCommonConstant.COMMON_NEWS_TYPE_LIST.contains(newsType)){
context = item.getTextContent();
}
if (ObjectUtil.isNotNull(context)) {
// 拼接的要替换链接
mainH5Content.append(context.replace(CustomerCommonConstant.CUSTOMER_TEXT_URL_PLACEHOLDER, item.getReferral()));
if (idx != referralEntityList.size()) {
mainH5Content.append("\n").append("\n");
}
// 将链接中的占位符换成链接
customerContentVO.setContent(context.replace(CustomerCommonConstant.CUSTOMER_TEXT_URL_PLACEHOLDER + idx, "#"));
}
// 赋值链接信息
CustomerReferralDTO customerReferralDto = new CustomerReferralDTO();
BeanUtil.copyProperties(item, customerReferralDto);
customerContentVO.setCustomerReferralDto(customerReferralDto);
contentList.add(customerContentVO);
idx += 1;
}
customerGraphicsDelay.setContent(mainH5Content.toString().replace(CustomerCommonConstant.H5_STYLE_CODE, ""));
detailVO.setContentList(contentList);
// 公众号
AuthInfoVO authInfoVO = super.baseMapper.getCustomerDelayAuthInfo(id);
detailVO.setAuthInfoVo(authInfoVO);
// 更新连接表
localLog.info("更新连接表");
if (CollectionUtil.isNotEmpty(referralEntityList)) {
referralEntityService.updateBatchById(referralEntityList);
}
// 更新主表
localLog.info("更新主表");
customerGraphicsDelay.initOperateInfo(tokenManager.getUserIdFromToken(), false);
super.updateById(customerGraphicsDelay);
return new GenericsResult<>(detailVO);
}
@Override
public GenericsResult<CustomerDelayTextDetailVO> removeCustomerContent(Long contentId) {
ReferralEntity referralEntity = referralEntityService.getById(contentId);
if (ObjectUtil.isNull(referralEntity)) {
return new GenericsResult<>(false, "找不到主体数据");
}
boolean result = referralEntityService.removeById(contentId);
if (result) {
return getCustomerTextDetail(referralEntity.getMaterialGraphicsId());
}
return new GenericsResult<>(false, "删除失败");
}
}
...@@ -93,7 +93,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap ...@@ -93,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);
......
...@@ -65,8 +65,6 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -65,8 +65,6 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto) { public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto) {
System.out.println(referralDto);
// 处理活动数据 // 处理活动数据
ReferralEntity referralEntity = new ReferralEntity(); ReferralEntity referralEntity = new ReferralEntity();
BeanUtil.copyProperties(referralDto, referralEntity); BeanUtil.copyProperties(referralDto, referralEntity);
...@@ -111,7 +109,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -111,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);
...@@ -135,7 +133,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -135,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;
......
...@@ -37,4 +37,11 @@ public class CustomerServiceCommonServiceImpl implements CustomerServiceCommonSe ...@@ -37,4 +37,11 @@ public class CustomerServiceCommonServiceImpl implements CustomerServiceCommonSe
List<CommonOptionResponseVO> storeList = materialCommonMapper.getStoreList(); List<CommonOptionResponseVO> storeList = materialCommonMapper.getStoreList();
return new GenericsResult<>(storeList); return new GenericsResult<>(storeList);
} }
@Override
public GenericsResult<List<CommonOptionResponseVO>> getCoverPicList() {
List<CommonOptionResponseVO> coverPicList = materialCommonMapper.getCoverPicList();
return new GenericsResult<>(coverPicList);
}
} }
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);
} }
......
...@@ -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();
}
} }
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;
...@@ -29,15 +30,28 @@ public class CustomerDelayGraphicsDetailVO implements Serializable { ...@@ -29,15 +30,28 @@ public class CustomerDelayGraphicsDetailVO implements Serializable {
private String type; private String type;
@ApiModelProperty("是否支付 0-否 1-是") @ApiModelProperty("是否支付 0-否 1-是")
@JsonSerialize(using = ToStringSerializer.class)
private Integer isPay; private Integer isPay;
@ApiModelProperty("素材图片路径") @ApiModelProperty("素材图片路径")
private String coverUrl; private String coverUrl;
@ApiModelProperty("推广标题")
private String extendTitle;
@ApiModelProperty("素材文本内容") @ApiModelProperty("素材文本内容")
private String content; private String content;
@ApiModelProperty("素材文本内容")
private Integer postSort;
@ApiModelProperty("时间间隔")
@JsonSerialize(using = ToStringSerializer.class)
private Long timeInterval;
@ApiModelProperty("链接相关内容") @ApiModelProperty("链接相关内容")
private CustomerReferralDTO customerReferralDto; private CustomerReferralDTO customerReferralDto;
private AuthInfoVO authInfoVo;
} }
package com.yaoyaozw.customer.vo.customer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author darker
* @date 2022/10/12 11:30
*/
@Data
@ApiModel("文本客服详情实体")
public class CustomerDelayTextDetailVO implements Serializable {
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("标题")
private String name;
@ApiModelProperty("文本子内容")
private List<CustomerContentVO> contentList;
@ApiModelProperty("类型")
private String type;
@ApiModelProperty("发文序号")
private Integer postSort;
@ApiModelProperty("发文间隔时间")
@JsonSerialize(using = ToStringSerializer.class)
private Long timeInterval;
@ApiModelProperty("已支付、未支付")
@JsonSerialize(using = ToStringSerializer.class)
private Integer isPay;
@ApiModelProperty("appId")
private String appId;
private AuthInfoVO authInfoVo;
}
...@@ -31,7 +31,7 @@ public class CustomerMessageDetailVO implements Serializable { ...@@ -31,7 +31,7 @@ public class CustomerMessageDetailVO implements Serializable {
@ApiModelProperty("客服消息类型(图文、文本)") @ApiModelProperty("客服消息类型(图文、文本)")
private String type; private String type;
@ApiModelProperty("素材文本内容") @ApiModelProperty("推广标题")
private String extendTitle; private String extendTitle;
@ApiModelProperty("素材图片路径") @ApiModelProperty("素材图片路径")
......
...@@ -63,6 +63,13 @@ ...@@ -63,6 +63,13 @@
on s_dic.group_id = 'CUSTOMER_SEND_STATUS' on s_dic.group_id = 'CUSTOMER_SEND_STATUS'
and s_dic.dic_key = cgd.send_status and s_dic.dic_key = cgd.send_status
where cgd.is_deleted = 0
<if test="queryDto.appId != null and queryDto.appId != ''">
and cgd.app_id = #{queryDto.appId}
</if>
order by cgd.app_id, cgd.post_sort
</select> </select>
<select id="getExistCustomerAccount" resultType="com.yaoyaozw.customer.vo.AuthInfoVO"> <select id="getExistCustomerAccount" resultType="com.yaoyaozw.customer.vo.AuthInfoVO">
...@@ -103,8 +110,36 @@ ...@@ -103,8 +110,36 @@
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>
<if test="appId != null and appId != ''">
and appId != #{appId}
</if>
</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
...@@ -50,4 +50,15 @@ ...@@ -50,4 +50,15 @@
select id,app_id,cost_date from account_cost_setup where app_id =#{appid} select id,app_id,cost_date from account_cost_setup where app_id =#{appid}
</select> </select>
<select id="getStoreTypeNameByAppId" resultType="java.lang.String">
select
se.store_name
from account_entity ae
left join store_entity se
on ae.store_id = se.id
where ae.app_id = #{appId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -22,4 +22,15 @@ ...@@ -22,4 +22,15 @@
#{accountId} #{accountId}
</foreach> </foreach>
</select> </select>
<select id="getCoverPicList" resultType="com.yaoyaozw.customer.vo.CommonOptionResponseVO">
select
dic_value as label,
dic_key as `value`
from sys_dictionary
where is_deleted = 0 and level = 3
and group_id = 'CUSTOMER_PIC'
order by sort
</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
import com.yaoyaozw.customer.CustomerServiceApplication;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.concurrent.TimeUnit;
/**
* @author darker
* @date 2022/10/19 14:42
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = CustomerServiceApplication.class)
public class Test {
@Autowired
private RedisTemplate redisTemplate;
@org.junit.Test
public void testRedis() {
redisTemplate.opsForValue().set("count", 0);
redisTemplate.expire("count", 1, TimeUnit.MINUTES);
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
redisTemplate.opsForValue().increment("count");
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论