jiazx0107@163.com
2023-05-17 620eab6cca2bc9ef9ea6d3067a0a5ba1deadbd1c
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.ld.igds.phone35.util;
 
import com.ld.igds.common.CoreCommonService;
import com.ld.igds.constant.Constant;
import com.ld.igds.models.Depot;
import com.ld.igds.models.DicTrigger;
import com.ld.igds.sys.service.DicTriggerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import java.util.List;
 
/**
 * @author chen
 */
@Component
public class Phone35Util {
    @Autowired
    private DicTriggerService triggerService;
 
    @Autowired
    private CoreCommonService commonService;
 
    private static final String KEY_API_PHONE_TOKEN = "KEY_API_PHONE_TOKEN";
    /**
     * 创建缓存Key
     * @param token
     * @return
     */
    public static String createKey(String token){
        return Constant.APP_NAME + ":" + KEY_API_PHONE_TOKEN + ":" + token;
    }
 
    /**
     * 获取出入库流程名称
     * @param companyId
     * @param progress
     * @return
     */
    public  String getProgressName(String companyId,String progress){
        List<DicTrigger> list = triggerService.getCacheDicByParent(
                companyId, "PROCESS_STATUS_");
        String progressName = "";
        for (DicTrigger dicTrigger : list) {
            if(dicTrigger.getCode().equals(progress)){
                progressName = dicTrigger.getName();
                break;
            }
        }
        return progressName;
    }
 
    /**
     * 获取仓库名称
     * @param companyId
     * @param depotId
     * @return
     */
    public String getDepotName(String companyId,String depotId){
        List<Depot> depotList = commonService.getCacheDepotList(companyId);
        String depotName = "";
        if(depotList != null && depotList.size() > 0){
            for (Depot depot : depotList) {
                if(depot.getId().equals(depotId)){
                    depotName = depot.getName();
                    break;
                }
            }
        }
        return depotName;
    }
}