Commit 280f7841 authored by 韩桐桐's avatar 韩桐桐

fix(cyl):气瓶大屏,资质附件,轮播图用

parent 93657662
...@@ -1370,19 +1370,21 @@ public class CylinderInfoController extends BaseController { ...@@ -1370,19 +1370,21 @@ public class CylinderInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "资质附件,轮播图用") @ApiOperation(httpMethod = "GET", value = "资质附件,轮播图用")
@GetMapping(value = "/getAttachmentByUnitCode") @GetMapping(value = "/getAttachmentByUnitCode")
public ResponseModel<List<String>> getAttachmentByUnitCode(@RequestParam(value = "companyId") String companyId) { public ResponseModel<List<Map<String, Object>>> getAttachmentByUnitCode(@RequestParam(value = "companyId") String companyId) {
List<String> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
String attachmentByUnitCode = cylinderInfoServiceImpl.getBaseMapper().getAttachmentByUnitCode(companyId); String attachmentByUnitCode = cylinderInfoServiceImpl.getBaseMapper().getAttachmentByUnitCode(companyId);
if (attachmentByUnitCode != null && !attachmentByUnitCode.isEmpty()) { if (attachmentByUnitCode != null && !attachmentByUnitCode.isEmpty()) {
JSONArray jsonArray = JSON.parseArray(attachmentByUnitCode); JSONArray jsonArray = JSON.parseArray(attachmentByUnitCode);
if (jsonArray != null) { if (jsonArray != null) {
jsonArray.stream() for (int i = 0; i < jsonArray.size(); i++) {
.filter(JSONObject.class::isInstance) Map<String, Object> temp = (Map<String, Object>) jsonArray.get(i);
.map(JSONObject.class::cast) HashMap<String, Object> map = new HashMap<>();
.map(obj -> obj.getString("url")) map.put("type", "img");
.filter(Objects::nonNull) map.put("key", i + 1);
.forEach(result::add); map.put("title", temp.get("name"));
map.put("url", temp.get("url"));
result.add(map);
}
} }
} }
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment