提交 ea246c31 作者: 沈振路

关回接口(对接调整)

上级 473af6da
...@@ -73,8 +73,7 @@ public class FollowReplyComponent { ...@@ -73,8 +73,7 @@ public class FollowReplyComponent {
SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");
String dateStr = format.format(new Date()); String dateStr = format.format(new Date());
AuthorizerInfo authorizerInfo = authorizerInfoService.getById(referralBody.getInfoId()); handleReferralName(dateStr, referralBody.getAccountName(), referralEntity);
handleReferralName(dateStr, authorizerInfo.getNickName(), referralEntity);
} }
// 获取链接 // 获取链接
...@@ -264,7 +263,7 @@ public class FollowReplyComponent { ...@@ -264,7 +263,7 @@ public class FollowReplyComponent {
private void handleReferralName(String dateStr, String accountName, ReferralEntity referral) { private void handleReferralName(String dateStr, String accountName, ReferralEntity referral) {
Integer newsType = referral.getNewsType(); Integer newsType = referral.getNewsType();
// 书籍、活动 类型, 重新构造name // 书籍、活动 类型, 重新构造name
String name = CustomerCommonConstant.getLinkNameModel(newsType); String name = CustomerCommonConstant.getLinkNameModel(newsType, referral.getConfigName());
String newsTypeName = CustomerCommonConstant.getNewsTypeName(newsType); String newsTypeName = CustomerCommonConstant.getNewsTypeName(newsType);
name = name.replace("{newsType}", newsTypeName).replace("{accountNickName}", accountName) name = name.replace("{newsType}", newsTypeName).replace("{accountNickName}", accountName)
.replace("{storeType}", referral.getStoreTypeName()).replace("{currentDate}", dateStr); .replace("{storeType}", referral.getStoreTypeName()).replace("{currentDate}", dateStr);
...@@ -274,8 +273,11 @@ public class FollowReplyComponent { ...@@ -274,8 +273,11 @@ public class FollowReplyComponent {
} 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}", referral.getRechargeAmount().stripTrailingZeros().toPlainString()).replace("{gift}", referral.getGiftAmount().toString()); name = name.replace("{recharge}", referral.getRechargeAmount().stripTrailingZeros().toPlainString()).replace("{gift}", referral.getGiftAmount().toString());
if (StringUtils.isNotEmpty(referral.getConfigName())) {
name = name.replace("{configName}", referral.getConfigName());
}
} }
name = name.replace("客服", "关回");
referral.setName(name + "-" +System.currentTimeMillis() % 100000); referral.setName(name + "-" +System.currentTimeMillis() % 100000);
} }
......
package com.yaoyaozw.customer.constants; package com.yaoyaozw.customer.constants;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
...@@ -43,6 +44,7 @@ public class CustomerCommonConstant { ...@@ -43,6 +44,7 @@ public class CustomerCommonConstant {
public final static Integer ACTIVITY_NEWS_TYPE = 2; public final static Integer ACTIVITY_NEWS_TYPE = 2;
public final static String ACTIVITY_NEWS_TYPE_NAME = "活动"; public final static String ACTIVITY_NEWS_TYPE_NAME = "活动";
public final static String ACTIVITY_NEWS_TYPE_NAME_MODEL = "系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift}"; public final static String ACTIVITY_NEWS_TYPE_NAME_MODEL = "系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift}";
public final static String ACTIVITY_NEWS_TYPE_NAME_CONFIG_NAME_MODEL = "系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-{configName}";
public final static String CUSTOMER_TEXT_LINK_TEMPLATE = "<a href=\"{url}-\" style='color: blue'>{content}</a>"; public final static String CUSTOMER_TEXT_LINK_TEMPLATE = "<a href=\"{url}-\" style='color: blue'>{content}</a>";
...@@ -117,4 +119,22 @@ public class CustomerCommonConstant { ...@@ -117,4 +119,22 @@ public class CustomerCommonConstant {
return ""; return "";
} }
public static String getLinkNameModel(Integer code, String configName) {
if (ObjectUtil.isNull(code)) {
return "";
}
if (code.equals(BOOK_NEWS_TYPE)) {
return BOOK_NEWS_TYPE_NAME_MODEL;
}
if (code.equals(ACTIVITY_NEWS_TYPE)) {
if (StringUtils.isEmpty(configName)) {
return ACTIVITY_NEWS_TYPE_NAME_MODEL;
} else {
return ACTIVITY_NEWS_TYPE_NAME_CONFIG_NAME_MODEL;
}
}
return "";
}
} }
package com.yaoyaozw.customer.constants; package com.yaoyaozw.customer.constants;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -23,5 +25,20 @@ public class FollowReplyCommonConstant { ...@@ -23,5 +25,20 @@ public class FollowReplyCommonConstant {
return TENCENT_MEDIA_TYPE_NEWS.equals(type) || TENCENT_MEDIA_TYPE_TEXT.equals(type); return TENCENT_MEDIA_TYPE_NEWS.equals(type) || TENCENT_MEDIA_TYPE_TEXT.equals(type);
} }
public static String getTypeDesc(String type) {
if (TENCENT_MEDIA_TYPE_PIC.equals(type)) {
return "图片";
} else if (TENCENT_MEDIA_TYPE_VOICE.equals(type)) {
return "语音";
} else if (TENCENT_MEDIA_TYPE_NEWS.equals(type)) {
return "图文";
} else if (TENCENT_MEDIA_TYPE_TEXT.equals(type)) {
return "文本";
}
return "";
}
} }
...@@ -10,6 +10,7 @@ import com.yaoyaozw.customer.service.CustomerFollowReplyService; ...@@ -10,6 +10,7 @@ import com.yaoyaozw.customer.service.CustomerFollowReplyService;
import com.yaoyaozw.customer.vo.follow.FollowReplyInfoVO; import com.yaoyaozw.customer.vo.follow.FollowReplyInfoVO;
import com.yaoyaozw.customer.vo.follow.FollowReplyListVO; import com.yaoyaozw.customer.vo.follow.FollowReplyListVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
...@@ -32,7 +33,7 @@ public class FollowReplyController { ...@@ -32,7 +33,7 @@ public class FollowReplyController {
} }
@PostMapping("/create") @PostMapping("/create")
public GenericsResult<String> create(@RequestBody FollowReplySaveDTO saveDto) { public GenericsResult<String> create(@RequestBody @Validated FollowReplySaveDTO saveDto) {
return followReplyService.create(saveDto); return followReplyService.create(saveDto);
} }
......
...@@ -5,6 +5,8 @@ import com.yaoyaozw.customer.entity.CommonReferralBody; ...@@ -5,6 +5,8 @@ import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
/** /**
...@@ -16,11 +18,13 @@ public class FollowReplySaveDTO implements Serializable { ...@@ -16,11 +18,13 @@ public class FollowReplySaveDTO implements Serializable {
private Long id; private Long id;
@NotEmpty(message = "appid不能为空")
private String appid; private String appid;
@NotEmpty(message = "素材名称不能为空")
private String name; private String name;
@NotEmpty(message = "素材类型不能为空")
private String type; private String type;
private String originMediaUrl; private String originMediaUrl;
...@@ -29,6 +33,7 @@ public class FollowReplySaveDTO implements Serializable { ...@@ -29,6 +33,7 @@ public class FollowReplySaveDTO implements Serializable {
private String extendDesc; private String extendDesc;
@NotNull(message = "素材排序不能为空")
private Integer sort; private Integer sort;
private CommonReferralBody referralBody; private CommonReferralBody referralBody;
......
...@@ -47,6 +47,11 @@ public class CommonReferralBody implements Serializable { ...@@ -47,6 +47,11 @@ public class CommonReferralBody implements Serializable {
@ApiModelProperty(value="序号") @ApiModelProperty(value="序号")
private Integer sort; private Integer sort;
private String accountName;
@ApiModelProperty(value = "渠道号")
private String accountId;
@ApiModelProperty("书城") @ApiModelProperty("书城")
private String storeType; private String storeType;
...@@ -89,6 +94,9 @@ public class CommonReferralBody implements Serializable { ...@@ -89,6 +94,9 @@ public class CommonReferralBody implements Serializable {
@ApiModelProperty(value = "赠送数量") @ApiModelProperty(value = "赠送数量")
private Integer giftAmount; private Integer giftAmount;
@ApiModelProperty(value = "模板Id")
private String templateId;
public Date getStartTime() { public Date getStartTime() {
if (ObjectUtil.isNull(this.startTime) && CollectionUtil.isNotEmpty(this.dateList)) { if (ObjectUtil.isNull(this.startTime) && CollectionUtil.isNotEmpty(this.dateList)) {
return dateList.get(0); return dateList.get(0);
......
...@@ -106,7 +106,7 @@ public class CustomerFollowReply implements Serializable { ...@@ -106,7 +106,7 @@ public class CustomerFollowReply implements Serializable {
/** /**
* 创建人 * 创建人
*/ */
@TableField(value = "gmt_create", fill = FieldFill.INSERT) @TableField(value = "create_user", fill = FieldFill.INSERT)
private Long createUser; private Long createUser;
/** /**
...@@ -118,7 +118,7 @@ public class CustomerFollowReply implements Serializable { ...@@ -118,7 +118,7 @@ public class CustomerFollowReply implements Serializable {
/** /**
* 更新人 * 更新人
*/ */
@TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE) @TableField(value = "modified_user", fill = FieldFill.INSERT_UPDATE)
private Long modifiedUser; private Long modifiedUser;
/** /**
......
...@@ -208,6 +208,9 @@ public class ReferralEntity implements Serializable { ...@@ -208,6 +208,9 @@ public class ReferralEntity implements Serializable {
@ApiModelProperty(value = "infoId") @ApiModelProperty(value = "infoId")
private Long infoId; private Long infoId;
@TableField(exist = false)
private String accountName;
public static final String COL_ID = "id"; public static final String COL_ID = "id";
public static final String COL_ACCOUNT_ID = "account_id"; public static final String COL_ACCOUNT_ID = "account_id";
......
package com.yaoyaozw.customer.mapper; package com.yaoyaozw.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaoyaozw.customer.dto.follow.FollowReplyQueryDTO;
import com.yaoyaozw.customer.entity.CustomerFollowReply; import com.yaoyaozw.customer.entity.CustomerFollowReply;
import com.yaoyaozw.customer.vo.follow.FollowReplyListVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* @author darker * @author darker
* @date 2023/3/14 11:14 * @date 2023/3/14 11:14
*/ */
@Repository @Repository
public interface CustomerFollowReplyMapper extends BaseMapper<CustomerFollowReply> { public interface CustomerFollowReplyMapper extends BaseMapper<CustomerFollowReply> {
/**
* 得到列表
*
* @param queryDto 查询dto
* @return {@link List}<{@link FollowReplyListVO}>
*/
List<FollowReplyListVO> getList(@Param("queryDto") FollowReplyQueryDTO queryDto);
} }
...@@ -59,16 +59,28 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe ...@@ -59,16 +59,28 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
@Override @Override
public GenericsResult<List<FollowReplyListVO>> list(FollowReplyQueryDTO queryDto) { public GenericsResult<List<FollowReplyListVO>> list(FollowReplyQueryDTO queryDto) {
return null; List<FollowReplyListVO> list = this.baseMapper.getList(queryDto);
return new GenericsResult<>(list);
} }
@Override @Override
public GenericsResult<String> create(FollowReplySaveDTO saveDto) { public GenericsResult<String> create(FollowReplySaveDTO saveDto) {
String result = checkNecessary(saveDto);
if (StringUtils.isNotEmpty(result)) {
return new GenericsResult<>(false, result);
}
CustomerFollowReply entity = new CustomerFollowReply(); CustomerFollowReply entity = new CustomerFollowReply();
BeanUtil.copyProperties(saveDto, entity); BeanUtil.copyProperties(saveDto, entity);
CustomerFollowReply sourceEntity = this.getById(entity.getId()); CustomerFollowReply sourceEntity = null;
boolean isCreate = ObjectUtil.isNull(entity.getId()); boolean isCreate = ObjectUtil.isNull(entity.getId());
if (!isCreate) {
sourceEntity = this.getById(entity.getId());
if (ObjectUtil.isNull(sourceEntity)) {
return new GenericsResult<>(false, "");
}
}
if (isCreate) { if (isCreate) {
// 新增的id // 新增的id
entity.setId(snowflakeComponent.snowflakeId()); entity.setId(snowflakeComponent.snowflakeId());
...@@ -77,6 +89,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe ...@@ -77,6 +89,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
referralEntityService.remove(new QueryWrapper<ReferralEntity>().eq(ReferralEntity.COL_MATERIAL_GRAPHICS_ID, sourceEntity.getId())); referralEntityService.remove(new QueryWrapper<ReferralEntity>().eq(ReferralEntity.COL_MATERIAL_GRAPHICS_ID, sourceEntity.getId()));
} }
entity.setStatus(1);
// 判断是否需要上传文件(图片、语音) // 判断是否需要上传文件(图片、语音)
if (FollowReplyCommonConstant.needUpload(entity.getType())) { if (FollowReplyCommonConstant.needUpload(entity.getType())) {
// 编辑的时候,删除原来的media // 编辑的时候,删除原来的media
...@@ -105,6 +118,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe ...@@ -105,6 +118,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
throw new RuntimeException("获取链接异常: " + e.getMessage()); throw new RuntimeException("获取链接异常: " + e.getMessage());
} }
referralEntity.setMaterialGraphicsId(entity.getId()); referralEntity.setMaterialGraphicsId(entity.getId());
entity.setSourceUrl(referralEntity.getReferral());
// 保存链接数据 // 保存链接数据
if (ObjectUtil.isNull(referralEntity.getId())) { if (ObjectUtil.isNull(referralEntity.getId())) {
referralEntityService.save(referralEntity); referralEntityService.save(referralEntity);
...@@ -312,4 +326,16 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe ...@@ -312,4 +326,16 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
} }
private String checkNecessary(FollowReplySaveDTO saveDto) {
if (!FollowReplyCommonConstant.TENCENT_MEDIA_TYPE_TEXT.equals(saveDto.getType())) {
// 非文本类型的都需要文件
if (StringUtils.isEmpty(saveDto.getOriginMediaUrl())) {
return "请选择素材文件";
}
}
return null;
}
} }
...@@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -35,6 +35,7 @@ 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.annotation.Transactional;
...@@ -55,6 +56,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -55,6 +56,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
private final static String EMPTY_STR = " "; private final static String EMPTY_STR = " ";
private final static String STORE_NAME_REDIS_KEY = "STORE_NAME_MAP";
@Autowired @Autowired
private TokenManager tokenManager; private TokenManager tokenManager;
@Autowired @Autowired
...@@ -69,6 +72,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -69,6 +72,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
private CustomerServiceCommonAsyncComponent commonAsyncComponent; private CustomerServiceCommonAsyncComponent commonAsyncComponent;
@Autowired @Autowired
private MaterialCommonMapper materialCommonMapper; private MaterialCommonMapper materialCommonMapper;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Override @Override
...@@ -310,6 +315,17 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -310,6 +315,17 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
} }
List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword, keywordList, storeType, appId); List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword, keywordList, storeType, appId);
Map<Object, Object> entries = redisTemplate.opsForHash().entries(STORE_NAME_REDIS_KEY);
if (CollectionUtil.isNotEmpty(entries)) {
Map<String, String> map = new HashMap<>(entries.size());
entries.forEach((key, value) -> {
map.put(key.toString(), value.toString());
});
authList.forEach(item -> item.setStoreTypeName(map.get(item.getStoreType())));
}
return new GenericsResult<>(authList); return new GenericsResult<>(authList);
} }
......
...@@ -2,7 +2,9 @@ package com.yaoyaozw.customer.vo.follow; ...@@ -2,7 +2,9 @@ package com.yaoyaozw.customer.vo.follow;
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.FollowReplyCommonConstant;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable; import java.io.Serializable;
...@@ -16,10 +18,19 @@ public class FollowReplyListVO implements Serializable { ...@@ -16,10 +18,19 @@ public class FollowReplyListVO implements Serializable {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
private String name;
private String authName; private String authName;
private String typeDesc; private String typeDesc;
private String statusDesc;
private String type;
private Integer sort;
public String getTypeDesc() {
return FollowReplyCommonConstant.getTypeDesc(this.type);
}
} }
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yaoyaozw.customer.mapper.CustomerFollowReplyMapper">
<select id="getList" resultType="com.yaoyaozw.customer.vo.follow.FollowReplyListVO">
select
rep.id,
rep.name,
rep.type,
rep.sort,
ai.nick_name as authName,
if(rep.status = 1, '正常', '异常') as statusDesc
from customer_follow_reply rep
left join authorizer_info ai
on rep.appid = ai.appid
where rep.is_deleted = 0
and rep.appid = #{queryDto.appId}
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论