|
@@ -1,13 +1,19 @@
|
|
|
package com.miniframe.mdo.controller;
|
|
|
|
|
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
import com.miniframe.core.ext.UtilTools;
|
|
|
+import com.miniframe.httpserver.HttpServerTransFile;
|
|
|
+import com.miniframe.mdo.excel.ProVarM;
|
|
|
import com.miniframe.mdo.service.FileService;
|
|
|
import com.miniframe.mdo.service.factory.FileProcessorFactory;
|
|
|
import com.miniframe.mdo.service.processor.FileProcessor;
|
|
|
import com.miniframe.mdo.utils.FileUtils;
|
|
|
import com.miniframe.model.mdo.MdoProFfd;
|
|
|
+import com.miniframe.model.mdo.MdoProjectVariate;
|
|
|
+import com.miniframe.model.mdo.MdoProjectVariateSQLBuilder;
|
|
|
import com.miniframe.model.mdo.dao.MdoProFfdMapper;
|
|
|
+import com.miniframe.model.mdo.dao.MdoProjectVariateMapper;
|
|
|
import com.miniframe.model.system.SysFile;
|
|
|
import com.miniframe.model.system.dao.SysFileMapper;
|
|
|
import com.miniframe.tools.XIFileUtils;
|
|
@@ -15,8 +21,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.ResourceUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
import java.io.File;
|
|
|
+import java.io.OutputStream;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
@@ -46,4 +58,31 @@ public class GeoInfoExtractController {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+ @RequestMapping("/mdofiledown")
|
|
|
+ public void mdofiledown(@RequestParam("pid") String pid, HttpServletResponse response) throws Exception {
|
|
|
+ MdoProjectVariateMapper vdao = UtilTools.getBean(MdoProjectVariateMapper.class);
|
|
|
+ MdoProjectVariateSQLBuilder vsb = new MdoProjectVariateSQLBuilder();
|
|
|
+ MdoProjectVariateSQLBuilder.Criteria vsc = vsb.createCriteria();;
|
|
|
+ vsc.andPidEqualTo(pid);
|
|
|
+ vsb.setOrderByClause("name asc");
|
|
|
+ List<MdoProjectVariate> vs = vdao.selectByExample(vsb);
|
|
|
+ List<ProVarM> ms = new ArrayList<>();
|
|
|
+ for (MdoProjectVariate v:vs) {
|
|
|
+ ProVarM m = new ProVarM();
|
|
|
+ m.setId(v.getId());
|
|
|
+ m.setName(v.getName());
|
|
|
+ m.setUpper(v.getUpper());
|
|
|
+ m.setLower(v.getLower());
|
|
|
+ m.setPid(v.getPid());
|
|
|
+ m.setReference(v.getReference());
|
|
|
+ ms.add(m);
|
|
|
+ }
|
|
|
+ OutputStream os = response.getOutputStream();
|
|
|
+ EasyExcel.write(os, ProVarM.class).sheet("sheet1").doWrite(ms);
|
|
|
+ response.reset();
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setCharacterEncoding("UTF-8");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(pid+".xlsx", "UTF-8"));
|
|
|
+
|
|
|
+ }
|
|
|
}
|