提交 e61dd714 作者: 沈振路

延时客服-finish

上级 9672b5fe
......@@ -36,7 +36,7 @@ public interface MaterialCommonMapper {
/**
* 把封面图片列表
*
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
* @return {@link CommonOptionResponseVO}
*/
List<CommonOptionResponseVO> getCoverPicList();
......
......@@ -23,7 +23,7 @@
</foreach>
</select>
<select id="getCoverPicList" resultType="com.yaoyaozw.customer.vo.CommonOptionResponseVO">
<select id="getCoverPicList" resultType="com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO">
select
dic_value as label,
dic_key as `value`
......
import com.yaoyaozw.customer.CustomerServiceApplication;
import com.yaoyaozw.customer.entity.AuthorizerInfo;
import com.yaoyaozw.customer.entity.RegisterUserEntity;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.mapper.RegisterUserEntityMapper;
import com.yaoyaozw.customer.service.RegisterUserEntityService;
import com.yaoyaozw.customer.vo.kanban.CommonCostSetupVo;
import org.junit.Test;
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.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.concurrent.TimeUnit;
/**
* @author wgh
* @date 2022/10/17 19:20
* @author darker
* @date 2022/10/19 14:42
*/
@SpringBootTest(classes = CustomerServiceApplication.class)
@RunWith(SpringRunner.class)
public class test {
@Autowired
private KanbanCommonMapper kanbanCommonMapper;
@Autowired
private RegisterUserEntityMapper registerUserEntityMapper;
@SpringBootTest(classes = CustomerServiceApplication.class)
public class Test {
@Autowired
private RegisterUserEntityService registerUserEntityService;
@Test
public void updateSetupId(){
List<AuthorizerInfo> appidList = registerUserEntityMapper.existAppid();
if (appidList!=null){
for (AuthorizerInfo authInfo : appidList) {
String appid = authInfo.getAppid();
System.err.println("开始:"+authInfo.getNickName());
List<CommonCostSetupVo> wechatCostSetup = kanbanCommonMapper.getWechatCostSetup(appid);
if (wechatCostSetup!=null){
Map<Date, Long> setupMap = wechatCostSetup.stream().collect(Collectors.toMap(CommonCostSetupVo::getCostDate, CommonCostSetupVo::getId, (v1, v2) -> v1));
List<RegisterUserEntity> allUser = registerUserEntityMapper.findAllUserWithoutSetupId(appid);
System.err.println("总计:"+allUser.size());
for (RegisterUserEntity user :allUser){
user.setSetupId(setupMap.get( user.getFormatDate()) );
}
registerUserEntityService.updateBatchById(allUser);
System.err.println("====>完成:"+authInfo.getNickName());
}
}
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论