1 // 判断日期类型 2 boolean flagDate = false; 3 if (CollectionUtils.isNotEmpty(ruleVO.getDateTypeList())) { 4 for (DateTypeVO dateTypeVO : ruleVO.getDateTypeList()) { 5 if (dateTypeVO.getSelected()) { 6 flagDate = true; 7 break; 8 } 9 } 10 } 11 if (!flagDate) { 12 throw new BusinessException("日期类型不能为空"); 13 } 14 // 判断服务车组 15 boolean flagCar = false; 16 if (CollectionUtils.isNotEmpty(ruleVO.getCarGroupList())) { 17 for (CarGroupVO carGroupVO : ruleVO.getCarGroupList()) { 18 if (carGroupVO.getSelected()) { 19 flagCar = true; 20 break; 21 } 22 } 23 } 24 if (!flagCar) { 25 throw new BusinessException("服务车组不能为空"); 26 }
1 public class DateTypeVO { 2 /** 3 * 日期类型编号 4 */ 5 private String code; 6 /** 7 * 日期类型名称 8 */ 9 private String name; 10 /** 11 * 是否选中 12 */ 13 private Boolean selected; 14 }
public class CarGroupVO { /** * 车组id */ private Integer groupId; /** * 车组名称 */ private String groupName; /** * 是否选中 */ private Boolean selected; }
public interface ISelectVo { Boolean getSelected(); }
public <T extends ISelectVo> void checkIsSelected(List<T> list, String msg) throws BusinessException { boolean flagItem = false; if (CollectionUtils.isNotEmpty(list)) { for (T itemVO : list) { if (itemVO.getSelected()) { flagItem = true; break; } } } if (!flagItem) { throw new BusinessException(msg); } }
public <T extends BaseDomain> void setModifyInfo(T object) { object.setModifyEmp(Long.valueOf(AuthorityUtils.getUserId())); object.setModifyEmpName(AuthorityUtils.getUserName()); object.setModifyTime(new Date()); object.setCreateEmp(Long.valueOf(AuthorityUtils.getUserId())); object.setCreateEmpName(AuthorityUtils.getUserName()); object.setCreateTime(new Date()); }
原文:https://www.cnblogs.com/wisterias/p/12768375.html