package com.ld.igds.sys;
|
|
import com.bstek.bdf2.core.model.DefaultDept;
|
import com.bstek.dorado.annotation.DataProvider;
|
import com.bstek.dorado.annotation.DataResolver;
|
import com.bstek.dorado.annotation.Expose;
|
import com.ld.igds.models.DicTrigger;
|
import com.ld.igds.sys.service.SysDeptService;
|
import com.ld.igds.util.ContextUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.*;
|
|
/**
|
*
|
* @author Andy
|
*
|
*/
|
@Component("deptPR")
|
public class DeptPR {
|
|
@Autowired
|
private SysDeptService sysDeptService;
|
|
/**
|
* 单位类型
|
* ${dorado.getDataProvider("deptPR#triggerCompanyType").getResult()}
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<DicTrigger> triggerCompanyType() {
|
List<DicTrigger> list = new ArrayList<DicTrigger>();
|
list.add(new DicTrigger("1", "粮食仓储企业"));
|
list.add(new DicTrigger("11", "中央直属储备粮库"));
|
list.add(new DicTrigger("12", "中谷粮油集团"));
|
list.add(new DicTrigger("13", "省级储备粮库"));
|
list.add(new DicTrigger("14", "地市级储备粮库"));
|
list.add(new DicTrigger("15", "县级储备粮库"));
|
list.add(new DicTrigger("19", "其他仓储企业"));
|
list.add(new DicTrigger("2", "粮食购销企业"));
|
list.add(new DicTrigger("3", "粮食加工企业"));
|
list.add(new DicTrigger("4", "粮食设备制造企业"));
|
list.add(new DicTrigger("9", "其他粮食企业"));
|
|
return list;
|
}
|
|
/**
|
* 单位性质
|
* ${dorado.getDataProvider("deptPR#triggerNature").getResult()}
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<DicTrigger> triggerNature() {
|
List<DicTrigger> list = new ArrayList<DicTrigger>();
|
list.add(new DicTrigger("1", "国有企业"));
|
list.add(new DicTrigger("2", "民营企业"));
|
list.add(new DicTrigger("3", "事业单位"));
|
list.add(new DicTrigger("9", "其他内资企业"));
|
list.add(new DicTrigger("10", "港澳台商投资企业"));
|
list.add(new DicTrigger("11", "外商投资企业"));
|
|
return list;
|
}
|
|
/**
|
* 库区产权
|
* ${dorado.getDataProvider("deptPR#triggerPropertyRight").getResult()}
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<DicTrigger> triggerPropertyRight() {
|
List<DicTrigger> list = new ArrayList<DicTrigger>();
|
list.add(new DicTrigger("1", "自有"));
|
list.add(new DicTrigger("2", "租赁"));
|
list.add(new DicTrigger("9", "其他"));
|
|
return list;
|
}
|
|
/**
|
* 是否代储
|
* ${dorado.getDataProvider("deptPR#triggerActingReserve").getResult()}
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<DicTrigger> triggerActingReserve() {
|
List<DicTrigger> list = new ArrayList<DicTrigger>();
|
list.add(new DicTrigger("1", "是"));
|
list.add(new DicTrigger("0", "否"));
|
|
return list;
|
}
|
|
/**
|
*
|
* 更新分库的部门信息,存放到缓存中
|
*/
|
@Expose
|
public List<DefaultDept> flushSubDeptCache() {
|
String companyId = ContextUtil.getCompanyId();
|
return sysDeptService.flushDeptCache(companyId);
|
}
|
|
/**
|
* ${dorado.getDataProvider("deptPR#loadParents").getResult()}
|
* 获取分库列表,父编码为组织编码
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<DefaultDept> loadParents() {
|
return sysDeptService.getCacheDept(ContextUtil.getCompanyId());
|
}
|
|
/**
|
* deptPR#loadDepts
|
*
|
* @param parentId
|
* @return
|
* @throws Exception
|
*/
|
@DataProvider
|
public List<DefaultDept> loadDepts(String parentId) throws Exception {
|
return sysDeptService.loadDeptByParentId(parentId, ContextUtil.getCompanyId());
|
}
|
|
/**
|
* deptPR#saveDepts
|
*
|
* @param depts
|
*/
|
@DataResolver
|
public void saveDepts(Collection<DefaultDept> depts) {
|
String companyId = ContextUtil.getCompanyId();
|
sysDeptService.saveDept(depts, companyId);
|
flushSubDeptCache();
|
}
|
|
@Expose
|
public int countChildren(String parentId) {
|
return sysDeptService.countChildren(parentId);
|
}
|
}
|