package com.fzzy.igds.sys.pr;
|
|
import com.bstek.dorado.annotation.DataProvider;
|
import com.bstek.dorado.annotation.DataResolver;
|
import com.bstek.dorado.annotation.Expose;
|
import com.fzzy.igds.dzhwk.domain.Depot;
|
import com.fzzy.igds.sys.DepotService;
|
import com.fzzy.igds.util.ContextUtil;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.BeanUtils;
|
import org.springframework.stereotype.Component;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* @author jiazx
|
*/
|
@Slf4j
|
@Component
|
public class DepotPR {
|
|
@Resource
|
private DepotService depotService;
|
|
/**
|
* depotPR#getData
|
* @return
|
*/
|
@DataProvider
|
public List<Depot> getData(){
|
return depotService.getData(null, null);
|
}
|
|
/**
|
* depotPR#saveOrUpdate
|
* @param data
|
* @return
|
*/
|
@DataResolver
|
@Transactional
|
public String saveOrUpdate(Depot data) {
|
|
Depot depot = new Depot();
|
BeanUtils.copyProperties(data, depot);
|
depotService.saveDepot(depot);
|
depotService.flushCache(null);
|
return null;
|
}
|
|
/**
|
* depotPR#deleteDepot
|
* @param data
|
*/
|
@Expose
|
@Transactional
|
public void deleteDepot(Depot data) {
|
Depot depot = new Depot();
|
BeanUtils.copyProperties(data, depot);
|
depotService.deleteDepot(depot);
|
}
|
|
|
/**
|
* depotPR#flushCache
|
*/
|
@Expose
|
public void flushCache() {
|
depotService.flushCache(null);
|
}
|
|
/**
|
* ${dorado.getDataProvider("depotPR#getAllCache").getResult()}
|
* @return
|
*/
|
@DataProvider
|
public List<Depot> getAllCache() {
|
return depotService.getCacheDepotList(null, ContextUtil.subDeptId(null));
|
}
|
|
/**
|
* depotPR#ajaxGetAllCache
|
* @return
|
*/
|
@Expose
|
public List<Depot> ajaxGetAllCache() {
|
return depotService.getCacheDepotList(null, ContextUtil.subDeptId(null));
|
}
|
|
/**
|
* depotPR#getDepot 获取仓库信息
|
*
|
* @param depotId
|
* @return
|
*/
|
@Expose
|
public Depot getDepot(String depotId) {
|
return depotService.getCacheDepot(null, depotId);
|
}
|
|
/**
|
* depotPR#excelDepot
|
*/
|
@Expose
|
@Transactional
|
public AjaxResult excelDepot(Map<String, Object> param) {
|
List<Depot> list = depotService.getData(null, null);
|
ExcelUtil<Depot> util = new ExcelUtil<Depot>(Depot.class);
|
return util.exportExcel(list, "货位数据", "储备中心库货位数据");
|
}
|
}
|