CZT
2023-09-14 db72a27d10fdc4de0926fb8c7cc411ec0d4ea51b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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<DicTrigger> triggerFunctionModel() {
        List<DicTrigger> 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<DefaultCompany> 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;
    }
 
}