package com.ld.igds.phone.util;
|
|
import com.ld.igds.common.CoreCommonService;
|
import com.ld.igds.common.CoreDicService;
|
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 PhoneUtil {
|
|
@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;
|
}
|
}
|