package com.ld.igds.sys; import com.bstek.bdf2.core.model.DefaultCompany; import com.bstek.dorado.annotation.DataProvider; import com.bstek.dorado.annotation.DataResolver; import com.ld.igds.constant.Constant; import com.ld.igds.models.DicSysConf; import com.ld.igds.models.DicTrigger; import com.ld.igds.sys.service.DicTriggerServiceImpl; import com.ld.igds.sys.service.SysCompanyService; import com.ld.igds.sys.service.SysUrlService; import com.ld.igds.util.ContextUtil; import com.ld.igds.view.service.SysConfService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; /** * 组织管理 * * @author jiazx */ @Component("companyPR") public class CompanyPR { @Autowired private SysCompanyService companyService; @Autowired private SysUrlService urlService; @Autowired private DicTriggerServiceImpl dicService; @Autowired private SysConfService sysConfService; /** * 功能模块 * * ${dorado.getDataProvider("companyPR#triggerFunctionModel").getResult()} * * @return */ @DataProvider public List triggerFunctionModel() { List list = new ArrayList<>(); list.add(new DicTrigger(Constant.MODEL_GRAIN, "粮情模块")); list.add(new DicTrigger(Constant.MODEL_VERB, "通风模块")); list.add(new DicTrigger(Constant.MODEL_N2, "气调模块")); list.add(new DicTrigger(Constant.MODEL_TEMP, "内环流温控模块")); list.add(new DicTrigger(Constant.MODEL_HLXZ, "环流熏蒸")); list.add(new DicTrigger(Constant.MODEL_QUANTITY, "数量检测模块")); list.add(new DicTrigger(Constant.MODEL_INOUT, "出入库模块")); list.add(new DicTrigger(Constant.MODEL_MANAGER, "综合管理模块")); list.add(new DicTrigger(Constant.MODEL_SECURITY, "安防模块")); list.add(new DicTrigger(Constant.MODEL_ES, "能耗模块")); list.add(new DicTrigger(Constant.MODEL_SYS, "系统模块")); list.add(new DicTrigger(Constant.MODEL_WARN, "智能预警模块")); list.add(new DicTrigger(Constant.MODEL_COMMON, "通用模块")); list.add(new DicTrigger("all", "多功能模块")); list.add(new DicTrigger("group", "监管模块")); return list; } /** * companyPR#getAll 获取所有的组织信息 * * @return */ @DataProvider public List getAll() { return companyService.getAll(); } /** * compnayPR#register * * @return */ @DataResolver public String register(DefaultCompany data) throws Exception { // 同时注册了组织和系统管理员和系统部门 String msg = companyService.register(data); if (null != msg) return msg; //新增一个系统参数对象 DicSysConf sysConf = new DicSysConf(data.getId()); sysConfService.updateSysConf(sysConf); // 复制菜单 msg = urlService.copy2Target(ContextUtil.getDefaultCompanyId(), data.getId(), data.getModel()); // 复制字典表 msg = dicService.copy2Target(ContextUtil.getDefaultCompanyId(), data.getId()); return msg; } /** * companyPR#update * * @return */ @DataResolver public String update(DefaultCompany data) { companyService.updateData(data); return null; } }