提交 a1e6598d 作者: 沈振路

调整

上级 f29dae2a
......@@ -224,10 +224,10 @@
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
</dependency>-->
<dependency>
......
......@@ -19,6 +19,7 @@ import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService;
import com.yaoyaozw.customer.service.CustomerServiceCommonService;
import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.service.RegisterUserEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO;
......@@ -27,8 +28,6 @@ import com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;
......@@ -63,15 +62,13 @@ public class CustomerServiceCommonAsyncComponent {
@Autowired
private ReferralFeignClient referralFeignClient;
@Autowired
private MaterialCommonMapper materialCommonMapper;
private CustomerServiceCommonService customerServiceCommonService;
@Autowired
private CustomerGraphicsMapper customerGraphicsMapper;
@Autowired
private KanbanCommonMapper kanbanCommonMapper;
@Autowired
private CustomerGraphicsDelayMapper customerGraphicsDelayMapper;
@Autowired
private RabbitTemplate rabbitTemplate;
@Async("myExecutor")
......@@ -241,7 +238,7 @@ public class CustomerServiceCommonAsyncComponent {
LOCAL_LOG.info("当前处理书城: {}", storeType);
// 去重提取公众号
Set<String> accountSet = userVoList.stream().map(CrowdPackageUserVO::getAccountId).collect(Collectors.toSet());
List<AuthInfoVO> authInfoList = materialCommonMapper.getAuthInfoList(accountSet);
List<AuthInfoVO> authInfoList = customerServiceCommonService.getAuthInfoList(accountSet);
// 定义
List<ReferralEntity> referralEntityList = new ArrayList<>(accountSet.size());
for (AuthInfoVO authInfoVo : authInfoList) {
......@@ -308,7 +305,7 @@ public class CustomerServiceCommonAsyncComponent {
if (isLegal) {
// 去重提取公众号
Set<String> accountSet = userVoList.stream().map(CrowdPackageUserVO::getAccountId).collect(Collectors.toSet());
List<AuthInfoVO> authInfoList = materialCommonMapper.getAuthInfoList(accountSet);
List<AuthInfoVO> authInfoList = customerServiceCommonService.getAuthInfoList(accountSet);
// 定义
List<ReferralEntity> referralEntityList = new ArrayList<>(accountSet.size());
......@@ -339,12 +336,16 @@ public class CustomerServiceCommonAsyncComponent {
private void generateMessageUsualLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, ReferralEntity customerReferral) {
Map<String, String> storeEntityMap = getStoreEntityMap(storeGroupMap.keySet());
// 获取常用链接映射关系
Map<String, Map<String, String>> storeToCurrentToOriginMap = customerServiceCommonService.storeCommonLinkMap(customerReferral.getName());
storeGroupMap.forEach((storeType, userVoList) -> {
LOCAL_LOG.info("当前处理书城: {}", storeType);
// 去重提取公众号
Set<String> accountSet = userVoList.stream().map(CrowdPackageUserVO::getAccountId).collect(Collectors.toSet());
List<AuthInfoVO> authInfoList = materialCommonMapper.getAuthInfoList(accountSet);
List<AuthInfoVO> authInfoList = customerServiceCommonService.getAuthInfoList(accountSet);
Map<String, String> currentToOriginMap = storeToCurrentToOriginMap.get(storeType.replaceAll("_[0-9]", ""));
// 定义
List<ReferralEntity> referralEntityList = new ArrayList<>(accountSet.size());
......@@ -357,6 +358,13 @@ public class CustomerServiceCommonAsyncComponent {
referralEntity.setAccountId(authInfoVo.getAccountId());
referralEntity.setStoreTypeName(storeEntityMap.get(storeType));
String name = referralEntity.getName();
LOCAL_LOG.info("获取到常用链接当前key: {}", name);
String originKey = currentToOriginMap.get(name);
LOCAL_LOG.info("获取到原始常用链接key: {}", originKey);
referralEntity.setName(originKey);
// 常用链接不需要日期
getCopyReferral(null, authInfoVo, referralEntity);
referralEntityList.add(referralEntity);
......@@ -592,25 +600,7 @@ public class CustomerServiceCommonAsyncComponent {
return userEntityList;
}
public void controlSunshineFrequency() {
RegisterUserEntity registerUserEntity = new RegisterUserEntity();
registerUserEntity.setOpenId("abc");
registerUserEntity.setId(111L);
registerUserEntity.setCustomerSort(10);
String jsonStr = JSONUtil.toJsonStr(registerUserEntity);
rabbitTemplate.convertAndSend("TTL_EXCHANGE", "yg_limit", jsonStr);
}
@RabbitListener(queues = "DEATH_QUEUE")
public void handle(String message) {
RegisterUserEntity registerUserEntity = JSONUtil.toBean(message, RegisterUserEntity.class);
LOCAL_LOG.info("------------------收到消息:" + registerUserEntity);
}
}
package com.yaoyaozw.customer.configs;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -11,17 +10,15 @@ import java.util.Map;
* @author darker
* @date 2022/10/21 16:04
*/
@Configuration
//@Configuration
public class RabbitConfig {
@Bean
/* @Bean
public Queue directQueue(){
Map<String, Object> map = new HashMap<>(4);
map.put("x-dead-letter-exchange", "DEATH_EXCHANGE");
map.put("x-dead-letter-routing-key", "death");
map.put("x-max-length", 30);
map.put("x-message-ttl", 60000);
map.put("x-overflow", 60000);
return new Queue("YG_ACCESS_LIMIT", true, false, false, map);
}
......@@ -48,7 +45,7 @@ public class RabbitConfig {
@Bean
public Binding bindingDeath(){
return BindingBuilder.bind(deathQueue()).to(deathExchange()).with("death");
}
}*/
}
......@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @author darker
......@@ -31,9 +32,15 @@ public class CustomerCommonController {
}
@GetMapping("/getCoverPicList")
@ApiOperation("获取书城列表")
@ApiOperation("获取封面图列表")
public GenericsResult<List<CommonOptionResponseVO>> getCoverPicList() {
return commonService.getCoverPicList();
}
@GetMapping("/getCommonLinkList")
@ApiOperation("获取合并书城之后的常用链接列表")
public GenericsResult<List<CommonOptionResponseVO>> getCommonLinkList() {
return commonService.getCommonLinkList();
}
}
package com.yaoyaozw.customer.entity;
import lombok.Data;
import java.io.Serializable;
/**
* @author darker
* @date 2022/10/22 14:58
*/
@Data
public class CustomerCommonLink implements Serializable {
private Long id;
private String storeType;
private String originKey;
private String originName;
private String dictCurrentKey;
}
package com.yaoyaozw.customer.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.entity.CustomerCommonLink;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO;
import org.apache.ibatis.annotations.Param;
......@@ -40,4 +42,19 @@ public interface MaterialCommonMapper {
*/
List<CommonOptionResponseVO> getCoverPicList();
/**
* 让常见链接列表
*
* @return {@link List}<{@link CommonOptionResponseVO}
*/
List<CommonOptionResponseVO> getCommonLinkList();
/**
* 让共同链接映射
*
* @param currentKey 当前key
* @return {@link List}<{@link CustomerCommonLink}>
*/
List<CustomerCommonLink> getCommonLinkMapping(@Param("currentKey") String currentKey);
}
package com.yaoyaozw.customer.service;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author darker
......@@ -32,4 +35,29 @@ public interface CustomerServiceCommonService {
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
*/
GenericsResult<List<CommonOptionResponseVO>> getCoverPicList();
/**
* 让常见链接列表
*
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
*/
GenericsResult<List<CommonOptionResponseVO>> getCommonLinkList();
/**
* 让常见链接列表
*
* @param accountSet 帐户设置
* @return {@link List}<{@link AuthInfoVO}>
*/
List<AuthInfoVO> getAuthInfoList(Set<String> accountSet);
/**
* 获取书城常用链接映射
*
* @param currentKey 当前key
* @return {@link Map}<{@link String}, {@link Map}<{@link String}, {@link String}>>
*/
Map<String, Map<String, String>> storeCommonLinkMap(String currentKey);
}
......@@ -169,7 +169,7 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe
mainH5Content.append("\n").append("\n");
}
// 将链接中的占位符换成链接
customerContentVO.setContent(context.replace(CustomerCommonConstant.CUSTOMER_TEXT_URL_PLACEHOLDER + idx, "#"));
customerContentVO.setContent(context.replace(CustomerCommonConstant.CUSTOMER_TEXT_URL_PLACEHOLDER, "#"));
}
// 赋值链接信息
......
......@@ -2,15 +2,17 @@ package com.yaoyaozw.customer.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.entity.CustomerCommonLink;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
import com.yaoyaozw.customer.service.CustomerServiceCommonService;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author darker
......@@ -44,4 +46,28 @@ public class CustomerServiceCommonServiceImpl implements CustomerServiceCommonSe
return new GenericsResult<>(coverPicList);
}
@Override
public GenericsResult<List<CommonOptionResponseVO>> getCommonLinkList() {
List<CommonOptionResponseVO> commonLinkList = materialCommonMapper.getCommonLinkList();
return new GenericsResult<>(commonLinkList);
}
@Override
public List<AuthInfoVO> getAuthInfoList(Set<String> accountSet) {
return materialCommonMapper.getAuthInfoList(accountSet);
}
@Override
public Map<String, Map<String, String>> storeCommonLinkMap(String currentKey) {
List<CustomerCommonLink> commonLinkMapping = materialCommonMapper.getCommonLinkMapping(currentKey);
return commonLinkMapping.stream().collect(
Collectors.groupingBy(CustomerCommonLink::getStoreType,
// 第二层map
HashMap::new, Collectors.groupingBy(CustomerCommonLink::getDictCurrentKey,
// 处理内层list
HashMap::new, Collectors.collectingAndThen(Collectors.toList(), item -> item.get(0).getOriginKey()))));
}
}
......@@ -26,6 +26,8 @@ public class CustomerDelayListVO implements Serializable {
@ApiModelProperty("客服消息类型(图文、文本)")
private String type;
private String payType;
@ApiModelProperty("标题")
private String name;
......
......@@ -46,6 +46,7 @@
cgd.id,
cgd.name,
cgd.type,
if(cgd.is_pay = -1, '不限', if(cgd.is_pay = 0, '未支付', '已支付')) as payType,
ai.nick_name as accountName,
cgd.post_sort as postSort,
cgd.time_interval as `timestamp` ,
......
......@@ -33,4 +33,22 @@
order by sort
</select>
<select id="getCommonLinkList" resultType="com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO">
select
dic_key as `value`,
dic_value as `label`
from sys_dictionary
where is_deleted = 0
and group_id = 'CUSTOMER_COMMON_LINK'
and level = 3
order by sort
</select>
<select id="getCommonLinkMapping" resultType="com.yaoyaozw.customer.entity.CustomerCommonLink">
select * from customer_common_link
<if test="currentKey != null and currentKey != ''">
where dict_current_key = #{currentKey}
</if>
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论