| | |
| | | entity.setInsureExpiredTime(parseInsuranceDate(item.getInsuranceInfo())); |
| | | entity.setAreaCode(extractAreaCode(item.getRegionCode())); |
| | | entity.setIsWithDock(item.getIsWithDock()); |
| | | entity.setCreateDept(item.getDeptId()); |
| | | entity.setCreateDept(parseDeptId(item.getDeptId())); |
| | | entity.setMaintenanceState(item.getMaintenanceState()); |
| | | entity.setDevicePayload( |
| | | Optional.ofNullable(item.getLoadList()) |
| | | .orElse(Collections.emptyList()) |
| | |
| | | entity.setInsureExpiredTime(parseInsuranceDate(item.getInsuranceInfo())); |
| | | entity.setAreaCode(extractAreaCode(item.getRegionCode())); |
| | | entity.setHeight(item.getHeight()); |
| | | entity.setCreateDept(item.getDeptId()); |
| | | entity.setCreateDept(parseDeptId(item.getDeptId())); |
| | | entity.setMaintenanceState(item.getMaintenanceState()); |
| | | return entity; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 解析部门ID字符串,处理逗号分隔的情况 |
| | | * 星图接口可能返回逗号分隔的多个部门ID,这里只取第一个 |
| | | * |
| | | * @param deptIdStr 部门ID字符串,可能包含逗号分隔的多个ID |
| | | * @return 第一个部门ID,解析失败返回null |
| | | */ |
| | | private Long parseDeptId(String deptIdStr) { |
| | | // 1. 参数校验 |
| | | if (StringUtil.isBlank(deptIdStr)) { |
| | | return null; |
| | | } |
| | | try { |
| | | // 2. 处理逗号分隔的情况,只取第一个ID |
| | | String firstDeptId = deptIdStr.split(",")[0].trim(); |
| | | // 3. 转换为Long类型 |
| | | return Long.valueOf(firstDeptId); |
| | | } catch (NumberFormatException e) { |
| | | // 4. 记录日志并返回null |
| | | log.warn("解析部门ID失败,deptIdStr: {}", deptIdStr, e); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解析星图接口返回的列表数据 |
| | | * |
| | | * @param response 接口响应 |