|
@@ -1,18 +1,15 @@
|
|
|
package cn.cslg.report.controller;
|
|
|
|
|
|
import cn.cslg.report.common.core.base.Constants;
|
|
|
-import cn.cslg.report.common.utils.Response;
|
|
|
import cn.cslg.report.common.model.dto.ProductDTO;
|
|
|
import cn.cslg.report.common.model.vo.ProductStandardVO;
|
|
|
+import cn.cslg.report.common.utils.Response;
|
|
|
import cn.cslg.report.service.impl.ProductServiceImpl;
|
|
|
-import cn.cslg.report.web.JsonResult;
|
|
|
-import cn.cslg.report.web.ServiceCode;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -37,29 +34,29 @@ public class ProductController {
|
|
|
|
|
|
@Operation(summary = "新增产品")
|
|
|
@PostMapping("/addProduct")
|
|
|
- public JsonResult addProduct(String jsons, List<MultipartFile> files) {
|
|
|
+ public String addProduct(String jsons, List<MultipartFile> files) {
|
|
|
log.info("开始处理【新增产品】的请求,参数为:{}, {}", jsons, files);
|
|
|
if (jsons != null) {
|
|
|
ProductDTO productDTO = JSONObject.parseObject(jsons, ProductDTO.class);
|
|
|
productService.addProduct(productDTO, files);
|
|
|
- return JsonResult.ok("产品新增成功");
|
|
|
+ return Response.success("产品新增成功");
|
|
|
} else {
|
|
|
- return JsonResult.fail("产品信息不能为空");
|
|
|
+ return Response.error("产品信息不能为空");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "根据报告id查询产品数据信息")
|
|
|
@GetMapping("/getProduct")
|
|
|
- public JsonResult getProduct(Integer reportId) {
|
|
|
+ public String getProduct(Integer reportId) {
|
|
|
log.info("开始处理【根据报告id查询产品数据信息】的请求,参数为:{}", reportId);
|
|
|
if (reportId != null) {
|
|
|
ProductStandardVO queryResult = productService.getProduct(reportId);
|
|
|
if (queryResult == null) {
|
|
|
- return JsonResult.fail("产品不存在");
|
|
|
+ return Response.error("产品不存在");
|
|
|
}
|
|
|
- return JsonResult.ok(queryResult);
|
|
|
+ return Response.success(queryResult);
|
|
|
} else {
|
|
|
- return JsonResult.fail("报告id不能为空");
|
|
|
+ return Response.error("报告id不能为空");
|
|
|
}
|
|
|
|
|
|
}
|