提交 e61dd714 作者: 沈振路

延时客服-finish

上级 9672b5fe
...@@ -36,7 +36,7 @@ public interface MaterialCommonMapper { ...@@ -36,7 +36,7 @@ public interface MaterialCommonMapper {
/** /**
* 把封面图片列表 * 把封面图片列表
* *
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>> * @return {@link CommonOptionResponseVO}
*/ */
List<CommonOptionResponseVO> getCoverPicList(); List<CommonOptionResponseVO> getCoverPicList();
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</foreach> </foreach>
</select> </select>
<select id="getCoverPicList" resultType="com.yaoyaozw.customer.vo.CommonOptionResponseVO"> <select id="getCoverPicList" resultType="com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO">
select select
dic_value as label, dic_value as label,
dic_key as `value` dic_key as `value`
......
import com.yaoyaozw.customer.CustomerServiceApplication; 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.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.util.concurrent.TimeUnit;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author wgh * @author darker
* @date 2022/10/17 19:20 * @date 2022/10/19 14:42
*/ */
@SpringBootTest(classes = CustomerServiceApplication.class)
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
public class test { @SpringBootTest(classes = CustomerServiceApplication.class)
@Autowired public class Test {
private KanbanCommonMapper kanbanCommonMapper;
@Autowired
private RegisterUserEntityMapper registerUserEntityMapper;
@Autowired @Autowired
private RegisterUserEntityService registerUserEntityService; private RedisTemplate redisTemplate;
@org.junit.Test
@Test public void testRedis() {
public void updateSetupId(){ redisTemplate.opsForValue().set("count", 0);
redisTemplate.expire("count", 1, TimeUnit.MINUTES);
List<AuthorizerInfo> appidList = registerUserEntityMapper.existAppid(); try {
if (appidList!=null){ Thread.sleep(15000);
for (AuthorizerInfo authInfo : appidList) { } catch (InterruptedException e) {
String appid = authInfo.getAppid(); e.printStackTrace();
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()) );
} }
redisTemplate.opsForValue().increment("count");
registerUserEntityService.updateBatchById(allUser);
System.err.println("====>完成:"+authInfo.getNickName());
}
}
}
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论