|
@@ -671,6 +671,77 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
return new MyVOPage<>(sbList);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 系统管理员查询全部:查看保养条目的
|
|
|
+ *
|
|
|
+ * @param model
|
|
|
+ * @param pageNum :
|
|
|
+ * @param pageSize :
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public MyVOPage<SbInfoVO> selectVOPageStandard(SbInfoDTO model, int pageNum, int pageSize) {
|
|
|
+
|
|
|
+ // 选择该用户的设备
|
|
|
+ if (model.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == model.getFilter().intValue()) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ model.setSaveUser(userInfo.getUserId());
|
|
|
+ }
|
|
|
+ if (model.getFilter() != null && DataFilterTypeEnum.BANZU.getValue() == model.getFilter().intValue()) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ List<SysUserDept> sysUserDepts = sysUserDeptService.selectByUserId(userInfo.getUserId());
|
|
|
+ if (CollectionUtil.isEmpty(sysUserDepts)) {
|
|
|
+ throw new BusinessException("找不到该用户所属班组,请先设置,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ model.setUseGroup(sysUserDepts.get(0).getDeptId());
|
|
|
+ }
|
|
|
+ if (model.getFilter() != null && DataFilterTypeEnum.PROJECT.getValue() == model.getFilter().intValue()) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ List<SysUserDept> sysUserDepts = sysUserDeptService.selectByUserId(userInfo.getUserId());
|
|
|
+ if (CollectionUtil.isEmpty(sysUserDepts)) {
|
|
|
+ throw new BusinessException("找不到该用户所属班组,请先设置部门,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ SysDeptDTO sysDeptDTO = new SysDeptDTO();
|
|
|
+ sysDeptDTO.setDescendant(sysUserDepts.get(0).getDeptId());
|
|
|
+ sysDeptDTO.setNature(DeptNatureEnum.XIANG_MU_BU.getValue());
|
|
|
+ List<SysDeptVO> list = sysDeptService.allParentList(sysDeptDTO);
|
|
|
+ if (CollectionUtil.isEmpty(list)) {
|
|
|
+ throw new BusinessException("找不到该用户所属的项目部,请先设置项目组,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ model.setUseProject(list.get(0).getDeptId());
|
|
|
+ }
|
|
|
+ if (model.getFilter() != null && DataFilterTypeEnum.COMPANY.getValue() == model.getFilter().intValue()) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ List<SysUserDept> sysUserDepts = sysUserDeptService.selectByUserId(userInfo.getUserId());
|
|
|
+ if (CollectionUtil.isEmpty(sysUserDepts)) {
|
|
|
+ throw new BusinessException("找不到该用户所属班组,请先设置部门,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ SysDeptDTO sysDeptDTO = new SysDeptDTO();
|
|
|
+ sysDeptDTO.setDescendant(sysUserDepts.get(0).getDeptId());
|
|
|
+ sysDeptDTO.setNature(DeptNatureEnum.FEN_GONG_SI.getValue());
|
|
|
+ List<SysDeptVO> list = sysDeptService.allParentList(sysDeptDTO);
|
|
|
+ if (CollectionUtil.isEmpty(list)) {
|
|
|
+ throw new BusinessException("找不到该用户所属的分公司,请先设置项目组,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ model.setUseCompany(list.get(0).getDeptId());
|
|
|
+ }
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<SbInfoVO> sbList = mapper.selectVOListStandard(model);
|
|
|
+ if(SbInfoChildEnum.IS_PARENT.getValue().equals(model.getIsChild()) && !CollectionUtils.isEmpty(sbList)){
|
|
|
+ for(SbInfoVO vo: sbList){
|
|
|
+ if(SbInfoChildEnum.IS_PARENT.getValue().equals(vo.getIsChild())){
|
|
|
+ SbInfoDTO infoDTO = new SbInfoDTO();
|
|
|
+ infoDTO.setParentId(vo.getId());
|
|
|
+ List<SbInfoVO> childVOList = mapper.selectVOList(infoDTO);
|
|
|
+ if(!CollectionUtils.isEmpty(childVOList)){
|
|
|
+ vo.setChildren(childVOList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new MyVOPage<>(sbList);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public MyVOPage<SbInfoVO> selectVOPageByFilter(SbInfoDTO model, int pageNum, int pageSize) {
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|