| | |
| | | import com.bstek.dorado.annotation.DataProvider; |
| | | import com.bstek.dorado.annotation.DataResolver; |
| | | import com.bstek.dorado.annotation.Expose; |
| | | import com.fzzy.igds.data.BaseResp; |
| | | import com.fzzy.igds.data.IgdsBaseParam; |
| | | 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 org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 快拍配置管理 |
| | | * Created by fzzy on 2017/5/23. |
| | | */ |
| | | @Component |
| | | public class SnapConfPR { |
| | | |
| | | @Resource |
| | | private SnapConfService snapConfService; |
| | | |
| | | |
| | | /** |
| | | * snapConfPR#listAll |
| | | * 质押列表 |
| | | * snapConfPR#selectList |
| | | * 快拍配置列表 |
| | | */ |
| | | @DataProvider |
| | | public List<SnapConf> listAll(IgdsBaseParam param) { |
| | | return snapConfService.listAll(param); |
| | | public List<SnapConf> selectList(SnapConf param) { |
| | | if (null == param) { |
| | | param = new SnapConf(); |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | } |
| | | return snapConfService.selectList(param); |
| | | } |
| | | |
| | | /** |
| | | * 保存/更新 |
| | | * snapConfPR#getConfActHour |
| | | * 默认获取第一条数据的配置信息,如果没有就返回一个空的对象 |
| | | * |
| | | * @param snapConf |
| | | * @return |
| | | */ |
| | | @Transactional |
| | | @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 BaseResp saveUpdate(SnapConf snapConf) { |
| | | if (null == snapConf.getCreateTime()) { |
| | | return snapConfService.addData(snapConf); |
| | | } else { |
| | | return snapConfService.updateData(snapConf); |
| | | 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 snapConf |
| | | * @return |
| | | * @param conf |
| | | */ |
| | | @Expose |
| | | public BaseResp delete(SnapConf snapConf) { |
| | | if (StringUtils.isNotEmpty(snapConf.getId())) return snapConfService.deleteData(snapConf); |
| | | return BaseResp.success(); |
| | | 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); |
| | | |
| | | } |
| | | } |