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(SnapConf param) {
|
if (null == param) {
|
param = new SnapConf();
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
return snapConfService.selectList(param);
|
}
|
|
/**
|
* snapConfPR#getConfActHour
|
* 默认获取第一条数据的配置信息,如果没有就返回一个空的对象
|
*
|
* @return
|
*/
|
@DataProvider
|
public SnapConf getConfActHour() {
|
SnapConf param = new SnapConf();
|
param.setCompanyId(ContextUtil.getCompanyId());
|
List<SnapConf> list = snapConfService.selectList(param);
|
if (null == list || list.isEmpty()) {
|
return new SnapConf();
|
}
|
return list.get(0);
|
}
|
|
|
/**
|
* snapConfPR#updateConf
|
*
|
* @param items
|
*/
|
@DataResolver
|
public void 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);
|
}
|
}
|
}
|
|
|
/**
|
* snapConfPR#updateActHour
|
*
|
* @param conf
|
*/
|
@Expose
|
public void updateActHour(SnapConf conf) {
|
|
if (null == conf.getCompanyId()) {
|
conf.setCompanyId(ContextUtil.getCompanyId());
|
}
|
if (null == conf.getDeptId()) {
|
conf.setDeptId(ContextUtil.subDeptId(null));
|
}
|
|
//同步更新所有的执行时间一致
|
snapConfService.updateActHour(conf);
|
|
}
|
}
|