| | |
| | | import com.ruoyi.common.core.domain.entity.TDept; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.AddAssetHouseInspection; |
| | |
| | | private TDeptService deptService; |
| | | @Autowired |
| | | private AssetMainService assetMainService; |
| | | |
| | | @Autowired |
| | | private AssetTypeService assetTypeService; |
| | | @Autowired |
| | |
| | | String deptId = tokenService.getLoginUser().getDeptId(); |
| | | TDept dept = deptService.getById(tokenService.getLoginUser().getDeptId()); |
| | | List<Integer> deptIds = deptService.getAllSubDeptIds(deptId); |
| | | AssetType assetType = assetTypeService.lambdaQuery().like(AssetType::getTypeName, "不动"). |
| | | AssetType assetType = assetTypeService.lambdaQuery().like(AssetType::getTypeName, "房屋"). |
| | | last("limit 1").one(); |
| | | if (dept.getDeptName().contains("资产管理")){ |
| | | Map<Integer, String> map = assetPropertyExtService.lambdaQuery().isNotNull(AssetPropertyExt::getRoomNumber).list() |
| | | .stream().collect(Collectors.toMap(AssetPropertyExt::getAssetMainId, AssetPropertyExt::getRoomNumber)); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | if (!SecurityUtils.isAdmin(userId)) { |
| | | if (dept.getDeptName().contains("资产管理") || dept.getDeptName().contains("董事长") || dept.getDeptName().contains("总经理")) { |
| | | List<AssetMain> list = assetMainService.lambdaQuery() |
| | | .eq(AssetMain::getAssetTypeId, assetType.getId()) |
| | | .list(); |
| | | for (AssetMain assetMain : list) { |
| | | assetMain.setRoomNumber(map.get(assetMain.getId())); |
| | | } |
| | | return R.ok(list); |
| | | } else { |
| | | if (deptIds.isEmpty()) { |
| | | return R.ok(new ArrayList<>()); |
| | | } else { |
| | | List<AssetMain> list = assetMainService.lambdaQuery() |
| | | .eq(AssetMain::getAssetTypeId, assetType.getId()) |
| | | .in(AssetMain::getOwnershipDeptId, deptIds).list(); |
| | | for (AssetMain assetMain : list) { |
| | | assetMain.setRoomNumber(map.get(assetMain.getId())); |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | } |
| | | }else{ |
| | | List<AssetMain> list = assetMainService.lambdaQuery() |
| | | .eq(AssetMain::getAssetTypeId, assetType.getId()) |
| | | .list(); |
| | | return R.ok(list); |
| | | }else{ |
| | | if (deptIds.isEmpty()){ |
| | | return R.ok(new ArrayList<>()); |
| | | }else{ |
| | | List<AssetMain> list = assetMainService.lambdaQuery() |
| | | .eq(AssetMain::getAssetTypeId, assetType.getId()) |
| | | .in(AssetMain::getOwnershipDeptId, deptIds).list(); |
| | | return R.ok(list); |
| | | } |
| | | for (AssetMain assetMain : list) { |
| | | assetMain.setRoomNumber(map.get(assetMain.getId())); |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | } |
| | | @ApiOperation(value = "巡检子项树状结构") |
| | |
| | | assetHouseInspectionRecord.setRoomNumber(assetPropertyExt.getRoomNumber()); |
| | | } |
| | | if (StringUtils.hasLength(assetHouseInspectionImport.getInspectionDate())){ |
| | | LocalDate parse = LocalDate.parse(assetHouseInspectionImport.getInspectionDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | String s = assetHouseInspectionImport.getInspectionDate().replaceAll("\\.", "-"); |
| | | String s1 = assetHouseInspectionImport.getInspectionDate().replaceAll("/", "-"); |
| | | LocalDate parse = LocalDate.parse(s1, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | assetHouseInspectionRecord.setInspectionDate(parse); |
| | | }else{ |
| | | result.append("未填写巡检日期:[", "未填写巡检日期"+"]"); |