package com.fzzy.igds.app.v1.util;
|
|
import com.fzzy.igds.constant.Constant;
|
import com.fzzy.igds.domain.Depot;
|
import com.fzzy.igds.service.DepotService;
|
import com.fzzy.igds.service.DicService;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
/**
|
* @author chen
|
*/
|
@Component
|
public class PhoneUtil {
|
@Autowired
|
private DicService triggerService;
|
@Resource
|
private DepotService depotService;
|
|
|
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<SysDictData> list = triggerService.getDictDataByType(companyId, "PROCESS_STATUS_");
|
String progressName = "";
|
for (SysDictData dicTrigger : list) {
|
if (dicTrigger.getDictValue().equals(progress)) {
|
progressName = dicTrigger.getDictLabel();
|
break;
|
}
|
}
|
return progressName;
|
}
|
|
/**
|
* 获取仓库名称
|
*
|
* @param companyId
|
* @param depotId
|
* @return
|
*/
|
public String getDepotName(String companyId, String depotId) {
|
Depot depot = depotService.getCacheDepot(companyId,depotId);
|
return depot.getName();
|
}
|
|
/**
|
* 获取指定仓库的信息
|
*
|
* @param companyId
|
* @param depotId
|
* @return
|
*/
|
public Depot getDepot(String companyId, String depotId) {
|
List<Depot> depotList = depotService.getCacheDepotList(companyId);
|
Depot depots = new Depot();
|
if (depotList != null && depotList.size() > 0) {
|
for (Depot depot : depotList) {
|
if (depot.getId().equals(depotId)) {
|
depots = depot;
|
break;
|
}
|
}
|
}
|
return depots;
|
}
|
}
|