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

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

parent 93657662
......@@ -1370,19 +1370,21 @@ public class CylinderInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "资质附件,轮播图用")
@GetMapping(value = "/getAttachmentByUnitCode")
public ResponseModel<List<String>> getAttachmentByUnitCode(@RequestParam(value = "companyId") String companyId) {
List<String> result = new ArrayList<>();
public ResponseModel<List<Map<String, Object>>> getAttachmentByUnitCode(@RequestParam(value = "companyId") String companyId) {
List<Map<String, Object>> result = new ArrayList<>();
String attachmentByUnitCode = cylinderInfoServiceImpl.getBaseMapper().getAttachmentByUnitCode(companyId);
if (attachmentByUnitCode != null && !attachmentByUnitCode.isEmpty()) {
JSONArray jsonArray = JSON.parseArray(attachmentByUnitCode);
if (jsonArray != null) {
jsonArray.stream()
.filter(JSONObject.class::isInstance)
.map(JSONObject.class::cast)
.map(obj -> obj.getString("url"))
.filter(Objects::nonNull)
.forEach(result::add);
for (int i = 0; i < jsonArray.size(); i++) {
Map<String, Object> temp = (Map<String, Object>) jsonArray.get(i);
HashMap<String, Object> map = new HashMap<>();
map.put("type", "img");
map.put("key", i + 1);
map.put("title", temp.get("name"));
map.put("url", temp.get("url"));
result.add(map);
}
}
}
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