|
@@ -4,10 +4,8 @@ import com.rongwei.bscommon.sys.service.QcsMainCostService;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -56,4 +54,20 @@ public class QcsMainCostController {
|
|
|
return R.error();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //数据导入
|
|
|
+ @RequestMapping("/importMainCost")
|
|
|
+ @ResponseBody
|
|
|
+ public R importMainCost(@RequestParam MultipartFile file, String costType, String unitId) {
|
|
|
+ try {
|
|
|
+ if (file == null) {
|
|
|
+ return R.error("文件解析失败");
|
|
|
+ }
|
|
|
+ return qcsMainCostService.importMainCost(file, costType, unitId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.info("数据导入异常..." + e.getMessage());
|
|
|
+ return R.error();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|