|
@@ -19,12 +19,15 @@ import org.jeecg.modules.report.service.IFabricLossService;
|
|
|
import org.jeecg.modules.report.service.IFabricOmOrderService;
|
|
|
import org.jeecg.modules.report.service.IFabricPoOrderService;
|
|
|
import org.jeecg.modules.report.service.ISyFabricLossReportService;
|
|
|
+import org.jeecg.modules.system.controller.CommonController;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.Collection;
|
|
@@ -63,6 +66,9 @@ public class FabricLossController {
|
|
|
private IFabricOmOrderService fabricOmOrderService;
|
|
|
@Autowired
|
|
|
private ISyFabricLossReportService syFabricLossReportService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CommonController commonController;
|
|
|
/**
|
|
|
*面料损耗
|
|
|
* @param csocode 计划号
|
|
@@ -137,6 +143,9 @@ public class FabricLossController {
|
|
|
builder.header("Content-Disposition",
|
|
|
"attacher;filename*=UTF-8''" + filename);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return builder.body(content);
|
|
|
|
|
|
}
|
|
@@ -297,4 +306,57 @@ public class FabricLossController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @AutoLog(value = "附件上传直接保存到数据库")
|
|
|
+ @ApiOperation(value="附件上传直接保存到数据库", notes="附件上传直接保存到数据库")
|
|
|
+ @PostMapping(value = "/addFile")
|
|
|
+ public Result<String> addFile(HttpServletRequest request, HttpServletResponse response,
|
|
|
+ FabricLoss fabricLoss){
|
|
|
+
|
|
|
+ Result<String> result = new Result<String>();
|
|
|
+
|
|
|
+ String fileName = commonController.upload(request,response).getMessage();
|
|
|
+ if(oConvertUtils.isEmpty(fabricLoss.getName())){
|
|
|
+ result.setMessage("没有获取到文件,上传失败!");
|
|
|
+ result.setResult("没有获取到文件,上传失败!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ int i = fabricLossService.addFile(fabricLoss.getCode(),fileName);
|
|
|
+ if(i>0){
|
|
|
+ result.setMessage("上传成功!");
|
|
|
+ result.setResult(fileName);
|
|
|
+ result.setSuccess(true);
|
|
|
+ }else{
|
|
|
+ result.setMessage("上传失败!");
|
|
|
+ result.setResult(fileName);
|
|
|
+ result.setSuccess(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @AutoLog(value = "附件直接删除")
|
|
|
+ @ApiOperation(value="附件直接删除", notes="附件直接删除")
|
|
|
+ @DeleteMapping(value = "/deleteFile")
|
|
|
+ public Result<String> deleteFile(HttpServletRequest request, HttpServletResponse response,
|
|
|
+ FabricLoss fabricLoss){
|
|
|
+
|
|
|
+ Result<String> result = new Result<String>();
|
|
|
+
|
|
|
+ int i = fabricLossService.deleteFile(fabricLoss.getCode(),fabricLoss.getName());
|
|
|
+ if(i>0){
|
|
|
+ result.setMessage("删除成功!");
|
|
|
+ result.setResult(fabricLoss.getName());
|
|
|
+ result.setSuccess(true);
|
|
|
+ }else{
|
|
|
+ result.setMessage("删除成功!");
|
|
|
+ result.setResult(fabricLoss.getName());
|
|
|
+ result.setSuccess(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|