diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataPriceController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataPriceController.java index eb4c2d601..2a7fc4efb 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataPriceController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataPriceController.java @@ -23,6 +23,8 @@ import com.logpm.basicdata.vo.BasicdataPriceBasicUpdateVO; import com.logpm.basicdata.vo.BasicdataPricePageVO; import com.logpm.basicdata.vo.PriceVO; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; @@ -32,12 +34,16 @@ import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; import javax.validation.Valid; +import java.io.InputStream; /** * 基础价格表 控制器 @@ -90,12 +96,30 @@ public class BasicdataPriceController extends BladeController { * 基础价格表 修改 */ @PutMapping - @ApiOperationSupport(order = 3) + @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入basicdataPrice") public R update(@Valid @RequestBody PriceVO vo) { Boolean res = basicdataPriceService.updatePrice(vo); return R.status(res); } + /** + * 基础价格表 导入 + */ + @PostMapping("upload") + @ApiOperationSupport(order = 6) + @ApiOperation(value = "导入", notes = "导入") + @ApiImplicitParams({ + @ApiImplicitParam(name = "file", value = "文件", dataType = "MultipartFile") + }) + public R upload(@RequestPart("file") MultipartFile file) { + try (InputStream inputStream = file.getInputStream()) { + String res = basicdataPriceService.upload(inputStream); + return R.data(res); + } catch (Exception e) { + e.printStackTrace(); + } + return R.data("上传失败"); + } } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataPriceService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataPriceService.java index d01808f7a..b1d37d20e 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataPriceService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataPriceService.java @@ -26,7 +26,9 @@ import com.logpm.basicdata.vo.BasicdataPricePageVO; import com.logpm.basicdata.vo.PriceClientVO; import com.logpm.basicdata.vo.PriceVO; import org.springblade.core.mp.base.BaseService; +import org.springframework.web.multipart.MultipartFile; +import java.io.InputStream; import java.util.List; /** @@ -68,4 +70,12 @@ public interface IBasicdataPriceService extends BaseService> fullMap, Map> basicMap, Map> warehouseMap, Map> dispatchMap, Map> generalMap) { // 获取整车数据 List list = fullVehicleService.list(Wrappers.lambdaQuery() @@ -737,7 +755,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl fullVehicleVOS = fullVehicleEntities.stream().map(item -> { BasicdataPriceFullVehicleVO basicdataPriceFullVehicleVO = new BasicdataPriceFullVehicleVO(); BeanUtil.copyProperties(item, basicdataPriceFullVehicleVO);