jiazx0107
2026-02-08 e7ab049344b954b044fc474992c378fcbbeeba33
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
package com.fzzy.igds;
 
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;
import com.fzzy.igds.domain.SnapConf;
import com.fzzy.igds.service.SnapConfService;
import com.fzzy.igds.utils.ContextUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * 快拍配置管理
 * Created by fzzy on 2017/5/23.
 */
@Component
public class SnapConfPR {
 
    @Resource
    private SnapConfService snapConfService;
 
    /**
     * snapConfPR#selectList
     * 快拍配置列表
     */
    @DataProvider
    public List<SnapConf> selectList(String deptId) {
        return snapConfService.selectList(deptId);
    }
 
    /**
     * snapConfPR#getConfActHour
     * 默认获取第一条数据的配置信息,如果没有就返回一个空的对象
     *
     * @return
     */
    @DataProvider
    public SnapConf getConfActHour(String deptId) {
 
        List<SnapConf> list = snapConfService.selectList(deptId);
        if (null == list || list.isEmpty()) {
            SnapConf conf = new SnapConf();
            conf.setDeptId(deptId);
            return conf;
        }
        return list.get(0);
    }
 
 
    /**
     * snapConfPR#updateConf
     *
     * @param items
     */
    @DataResolver
    public String updateConf(List<SnapConf> items) {
        if (null == items || items.isEmpty()) {
            return "数据为空,保存失败";
        }
        for (SnapConf conf : items) {
            if (StringUtils.isEmpty(conf.getId())) {
                snapConfService.insertData(conf);
            } else {
                snapConfService.updateData(conf);
            }
        }
        return null;
    }
 
 
    /**
     * snapConfPR#updateActHour
     *
     * @param conf
     */
    @Expose
    public String updateActHour(SnapConf conf) {
 
        if (null == conf.getCompanyId()) {
            conf.setCompanyId(ContextUtil.getCompanyId());
        }
        if (null == conf.getDeptId()) {
            conf.setDeptId(ContextUtil.subDeptId(null));
        }
        if (null == conf.getId()) {
            snapConfService.insertData(conf);
        }else {
            //同步更新所有的执行时间一致
            snapConfService.updateActHour(conf);
        }
        return null;
    }
}