提交 e1758e1d 作者: 沈振路

延时客服-finish

上级 6e87f898
......@@ -365,7 +365,7 @@ public class CustomerServiceCommonAsyncComponent {
String name = CustomerCommonConstant.getLinkNameModel(targetReferralEntity.getNewsType());
if (StringUtils.isNotBlank(name) && !CustomerCommonConstant.USUAL_LINK_NEWS_TYPE.equals(targetReferralEntity.getNewsType())) {
name = name + "-" +System.currentTimeMillis() % 10000;
name = name + "-" +System.currentTimeMillis() % 100000;
targetReferralEntity.setName(name);
}
......@@ -409,7 +409,7 @@ public class CustomerServiceCommonAsyncComponent {
targetCustomerGraphics.setSendStatus(CustomerCommonConstant.SEND_STATUS_ACTIVE);
if (StringUtils.isNotBlank(h5Context)) {
targetCustomerGraphics.setContent(h5Context.toString());
targetCustomerGraphics.setContent(h5Context.toString().replace(CustomerCommonConstant.H5_STYLE_CODE, ""));
}
LOCAL_LOG.info("保存主体数据, 主体id: {}", mainId);
customerGraphicsDelayMapper.insert(targetCustomerGraphics);
......
......@@ -27,6 +27,7 @@ public class CustomerCommonConstant {
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;
......
......@@ -30,4 +30,10 @@ public class CustomerCommonController {
return commonService.getStoreList();
}
@GetMapping("/getCoverPicList")
@ApiOperation("获取书城列表")
public GenericsResult<List<CommonOptionResponseVO>> getCoverPicList() {
return commonService.getCoverPicList();
}
}
......@@ -75,12 +75,6 @@ public class CustomerGraphicsDelay implements Serializable {
private Integer isPay;
/**
* 是否是历史遗留
*/
@TableField(value = "is_history")
private Integer isHistory;
/**
* 发送序列
*/
@TableField(value = "post_sort")
......
......@@ -34,4 +34,11 @@ public interface MaterialCommonMapper {
*/
List<AuthInfoVO> getAuthInfoList(@Param("accountSet") Set<String> accountSet);
/**
* 把封面图片列表
*
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
*/
List<CommonOptionResponseVO> getCoverPicList();
}
......@@ -96,5 +96,12 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
*/
GenericsResult<List<CommonOptionResponseVO>> getTimeIntervalList();
/**
* 客户重新排序
*
* @param appId 应用程序id
*/
void reSortCustomer(String appId);
}
......@@ -26,4 +26,11 @@ public interface CustomerServiceCommonService {
* @return {@link GenericsResult}<{@link CommonOptionResponseVO}>
*/
GenericsResult<List<CommonOptionResponseVO>> getStoreList();
/**
* 把封面图片列表
*
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
*/
GenericsResult<List<CommonOptionResponseVO>> getCoverPicList();
}
......@@ -19,6 +19,7 @@ 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;
......@@ -54,9 +55,9 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe
@Autowired
private CustomerServiceCommonAsyncComponent commonAsyncComponent;
@Autowired
private AuthorizerInfoService authorizerInfoService;
@Autowired
private KanbanCommonMapper kanbanCommonMapper;
@Autowired
private CustomerGraphicsDelayService graphicsDelayService;
@Override
public GenericsResult<String> insertCustomerDelay(CustomerDelayTextSaveDTO saveDto) {
......@@ -64,13 +65,27 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe
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 (ObjectUtil.isNull(customerGraphicsDelay.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());
}
......
......@@ -22,6 +22,7 @@ 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;
......@@ -134,6 +135,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
if (!referralResult) {
return new BaseResult().error("新增/更新 链接数据异常");
}
reSortCustomer(saveDto.getAppId());
return new BaseResult().success();
}
......@@ -180,21 +182,32 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
@Override
public BaseResult removeCustomerDelay(Long id) {
CustomerGraphicsDelay entity = super.getById(id);
boolean result = super.removeById(id);
if (result) {
referralEntityService.ultimateDeleteReferrals(id, null);
localLog.info("处理完成, 正在重新排序");
reSortCustomer(entity.getAppId());
return new BaseResult().success();
}
referralEntityService.ultimateDeleteReferrals(id, null);
return new BaseResult().error("弃用失败");
}
@Override
public BaseResult removeBatch(List<Long> idList) {
List<CustomerGraphicsDelay> list = (List<CustomerGraphicsDelay>) super.listByIds(idList);
boolean result = super.removeByIds(idList);
if (result) {
referralEntityService.ultimateDeleteReferralsBatch(idList, null);
localLog.info("处理完成, 正在重新排序");
Set<String> appIdSet = list.stream().map(CustomerGraphicsDelay::getAppId).collect(Collectors.toSet());
for (String appId : appIdSet) {
reSortCustomer(appId);
}
return new BaseResult().success();
}
referralEntityService.ultimateDeleteReferralsBatch(idList, null);
return new BaseResult().error("删除失败");
}
......@@ -267,5 +280,27 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
List<CommonOptionResponseVO> timeIntervalList = super.baseMapper.getTimeIntervalList();
return new GenericsResult<>(timeIntervalList);
}
@Override
public void reSortCustomer(String appId) {
List<CustomerGraphicsDelay> list = super.list(new QueryWrapper<CustomerGraphicsDelay>().eq("app_id", appId).orderByAsc("time_interval"));
int idx = 0;
Long previousTime = 0L;
for (CustomerGraphicsDelay item : list) {
boolean equal = previousTime.equals(item.getTimeInterval());
if (!equal) {
idx += 1;
}
item.setPostSort(idx);
previousTime = item.getTimeInterval();
}
if (CollectionUtil.isNotEmpty(list)) {
super.updateBatchById(list);
}
}
}
......@@ -37,4 +37,11 @@ public class CustomerServiceCommonServiceImpl implements CustomerServiceCommonSe
List<CommonOptionResponseVO> storeList = materialCommonMapper.getStoreList();
return new GenericsResult<>(storeList);
}
@Override
public GenericsResult<List<CommonOptionResponseVO>> getCoverPicList() {
List<CommonOptionResponseVO> coverPicList = materialCommonMapper.getCoverPicList();
return new GenericsResult<>(coverPicList);
}
}
......@@ -22,4 +22,15 @@
#{accountId}
</foreach>
</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>
\ 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论