#
Junjie
昨天 7a546480f6ddfaee1366f280981a002a08412c11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.zy.core.config;
 
import com.alibaba.fastjson.JSON;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.WrkLastno;
import com.zy.asrs.service.WrkLastnoService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.WrkIoType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import javax.annotation.PostConstruct;
import java.util.HashMap;
 
@Component
public class FakeTaskNoAreaInitializer {
 
    @Autowired
    private RedisUtil redisUtil;
    @Autowired
    private WrkLastnoService wrkLastnoService;
 
    @PostConstruct
    public void init() {
        WrkLastno wrkLastno = wrkLastnoService.selectById(WrkIoType.FAKE_TASK_NO.id);
        if (Cools.isEmpty(wrkLastno)) {
            throw new CoolException("数据异常,请联系管理员");
        }
 
        HashMap<String, Object> map = new HashMap<>();
        map.put("start", wrkLastno.getSNo());
        map.put("end", wrkLastno.getENo());
        redisUtil.set(RedisKeyType.FAKE_TASK_NO_AREA.key, JSON.toJSONString(map));
    }
 
}