diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java index 711100b..e0557d0 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java @@ -1,16 +1,22 @@ package com.hnac.hzinfo.inspect.obj.feign; import com.hnac.hzinfo.inspect.Constants; +import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.vo.ContentVO; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; @FeignClient(value = Constants.APP_NAME) public interface IContentClient { String API_PREFIX = "/feign/content"; String DETAIL = API_PREFIX + "/detail"; - String SAVE_BATCH = API_PREFIX + "/saveBatch"; + String UPDATE_BATCH = API_PREFIX + "/detail"; + String SAVE_BATCH = API_PREFIX + "/updateBatch"; String LIST = API_PREFIX + "/list"; String SAVE_OR_UPDATE_BATCH = API_PREFIX + "/saveOrUpdateBatch"; @@ -22,4 +28,12 @@ public interface IContentClient { @GetMapping(DETAIL) R detail(Long id); + /** + * 批量更新巡检内容 + * @param request 巡检内容列表 + * @return + */ + @PutMapping(UPDATE_BATCH) + R updateBatch(@RequestBody List request); + } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java index 31e287e..2bb040a 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java @@ -1,5 +1,8 @@ package com.hnac.hzinfo.inspect.obj.feign; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; import com.hnac.hzinfo.inspect.obj.services.ContentService; import com.hnac.hzinfo.inspect.obj.vo.ContentVO; @@ -10,6 +13,7 @@ import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.RestController; +import java.util.List; import java.util.Optional; /** @@ -32,5 +36,11 @@ public class ContentClient extends BladeController implements IContentClient { return R.data(Optional.ofNullable(entity).map(content -> ContentWrapper.build().entityVO(content)).orElse(null)); } + @Override + public R updateBatch(List request) { + List contentList = JSONArray.parseArray(JSON.toJSONString(request), ContentEntity.class); + return R.data(contentService.updateBatchById(contentList)); + } + }