提交 ee47fc32 作者: 沈振路

延时客服-图文-finish

上级 42445d1d
......@@ -41,6 +41,9 @@ public class CustomerDelaySaveDTO implements Serializable {
@ApiModelProperty("发文间隔时间")
private Long timeInterval;
@ApiModelProperty("已支付、未支付")
private Integer isPay;
@ApiModelProperty("消息内容实体")
private CustomerReferralDTO customerReferralDto;
......
......@@ -44,6 +44,11 @@ public class CustomerGraphicsDelay implements Serializable {
@TableField(value = "extend_title")
private String extendTitle;
/**
* 封面图片地址
*/
@TableField(value = "cover_url")
private String coverUrl;
/**
* 文本内容
......@@ -64,6 +69,12 @@ public class CustomerGraphicsDelay implements Serializable {
private String sourceUrl;
/**
* 是否支付
*/
@TableField(value = "is_pay")
private Integer isPay;
/**
* 是否是历史遗留
*/
@TableField(value = "is_history")
......
......@@ -47,12 +47,13 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics
/**
* 让时间间隔列表
*
* @param keyword 关键词
* @param keyword 关键词
* @param keywordList 关键词拆分
* @param storeType 书城
* @param storeType 书城
* @param appId 需要排除的公众号appId
* @return {@link List}<{@link AuthInfoVO}>
*/
List<AuthInfoVO> getAuthList(@Param("keyword") String keyword, @Param("keywordList") List<String> keywordList, @Param("storeType") String storeType);
List<AuthInfoVO> getAuthList(@Param("keyword") String keyword, @Param("keywordList") List<String> keywordList, @Param("storeType") String storeType, @Param("appId") String appId);
/**
* 让时间间隔列表
......
......@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -78,7 +79,6 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
}
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResult insertCustomerDelay(CustomerDelaySaveDTO saveDto) {
CustomerGraphicsDelay customerGraphicsDelay = new CustomerGraphicsDelay();
......@@ -92,23 +92,45 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
}
customerGraphicsDelay.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_GETTING);
localLog.info("生成referral数据");
ReferralEntity referralEntity = new ReferralEntity();
BeanUtil.copyProperties(saveDto.getCustomerReferralDto(), referralEntity);
referralEntity.setMaterialGraphicsId(customerGraphicsDelay.getId());
// 非自定义获取链接
if (!referralEntity.getNewsType().equals(-1)) {
try {
localLog.info("准备获取链接");
String linkNameModel = CustomerCommonConstant.getLinkNameModel(referralEntity.getNewsType());
localLog.info("获取链接name模板: {}", linkNameModel);
referralEntity.setName(linkNameModel);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
String dateStr = dateFormat.format(new Date());
AuthorizerInfo authorizerInfo = authorizerInfoService.getOne(new QueryWrapper<AuthorizerInfo>().eq("appid", saveDto.getAppId()));
AuthInfoVO authInfoVO = new AuthInfoVO();
authInfoVO.putPropertyValue(authorizerInfo);
commonAsyncComponent.getCopyReferral(dateStr, authInfoVO, referralEntity);
customerGraphicsDelay.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_FINISH);
localLog.info("链接获取完成");
} catch (Exception e) {
localLog.info("获取链接异常");
return new BaseResult().error("获取链接异常");
}
}
customerGraphicsDelay.setSourceUrl(referralEntity.getReferral());
boolean mainResult = super.saveOrUpdate(customerGraphicsDelay);
if (!mainResult) {
localLog.info("主体数据生成异常");
return new BaseResult().error("新增/更新 主体数据异常");
}
localLog.info("生成referral数据");
ReferralEntity referralEntity = new ReferralEntity();
referralEntity.setMaterialGraphicsId(customerGraphicsDelay.getId());
BeanUtil.copyProperties(referralEntity, saveDto.getCustomerReferralDto());
boolean referralResult = referralEntityService.saveOrUpdate(referralEntity);
if (!referralResult) {
localLog.info("referral数据生成异常, 回滚事务");
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return new BaseResult().error("新增/更新 链接数据异常");
}
// TODO: 2022/10/14 生成链接
return new BaseResult().success();
}
......@@ -221,7 +243,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
keyword = null;
}
List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword, keywordList, storeType);
List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword, keywordList, storeType, appId);
return new GenericsResult<>(authList);
}
......
......@@ -29,14 +29,25 @@ public class CustomerDelayGraphicsDetailVO implements Serializable {
private String type;
@ApiModelProperty("是否支付 0-否 1-是")
@JsonSerialize(using = ToStringSerializer.class)
private Integer isPay;
@ApiModelProperty("素材图片路径")
private String coverUrl;
@ApiModelProperty("推广标题")
private String extendTitle;
@ApiModelProperty("素材文本内容")
private String content;
@ApiModelProperty("素材文本内容")
private Integer postSort;
@ApiModelProperty("时间间隔")
@JsonSerialize(using = ToStringSerializer.class)
private Long timeInterval;
@ApiModelProperty("链接相关内容")
private CustomerReferralDTO customerReferralDto;
......
......@@ -31,7 +31,7 @@ public class CustomerMessageDetailVO implements Serializable {
@ApiModelProperty("客服消息类型(图文、文本)")
private String type;
@ApiModelProperty("素材文本内容")
@ApiModelProperty("推广标题")
private String extendTitle;
@ApiModelProperty("素材图片路径")
......
......@@ -110,6 +110,9 @@
<if test="storeType != null and storeType != ''">
and store_type = #{storeType}
</if>
<if test="appId != null and appId != ''">
and appId != #{appId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论