123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package com.malk.kuaikeli.controller;
- import com.alibaba.excel.EasyExcel;
- import com.alibaba.fastjson.JSONObject;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.malk.kuaikeli.entity.SupplierMaterial;
- import com.malk.kuaikeli.listener.SupplierMaterialDataListener;
- import com.malk.kuaikeli.mapper.SupplierMaterialMapper;
- import com.malk.kuaikeli.service.SupplierMaterialService;
- import com.malk.server.common.McR;
- import com.malk.server.common.Page;
- import com.malk.utils.PublicUtil;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import java.io.IOException;
- import java.util.List;
- import java.util.Map;
- /***
- * 供应商原材料
- */
- @RestController
- @RequestMapping("/suppliermaterial")
- public class SupplierMaterialController {
- @Autowired
- private SupplierMaterialService supplierMaterialService;
- @PostMapping("/upload")
- public McR upload(@RequestParam(value="file")MultipartFile file) throws IOException {
- if(file.isEmpty()||file.getSize()<1){
- return McR.errorParam("文件不存在!");
- }
- if(!file.getOriginalFilename().endsWith("xlsx")&&!file.getOriginalFilename().endsWith("xls")) {
- return McR.errorParam("文件格式错误!");
- }
- supplierMaterialService.uploadData(file);
- return McR.success();
- }
- @GetMapping("/sync")
- public McR sync(){
- supplierMaterialService.sync();
- return McR.success();
- }
- @PostMapping("/projectSupplierChange")
- public McR projectSupplierChange(@RequestBody JSONObject param) throws IOException {
- if(PublicUtil.isNull(param,"projectId","oldId","newId","newName")){
- return McR.errorNullPointer();
- }
- supplierMaterialService.projectSupplierChange(param.getString("projectId"),param.getString("oldId"),param.getString("newId"),param.getString("newName"));
- return McR.success();
- }
- @GetMapping("/getList")
- public McR selectList(@RequestParam(defaultValue = "1") Integer current,
- @RequestParam(defaultValue = "10") Integer size){
- return supplierMaterialService.getList(current,size);
- }
- }
|