|
@@ -243,6 +243,7 @@ public class InformationController extends BaseController {
|
|
|
return getBootstrapData(page);
|
|
|
}
|
|
|
|
|
|
+ //导出导出word
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "btnInReason")
|
|
|
public AjaxJson btnInReason(@RequestParam("file")MultipartFile file, Information information, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
@@ -409,7 +410,6 @@ public class InformationController extends BaseController {
|
|
|
String projectYear = "";
|
|
|
String firstUnits = "";
|
|
|
String secondUnits = "";
|
|
|
-
|
|
|
try {
|
|
|
projectId = request.getParameter("projectId");
|
|
|
projectName = request.getParameter("projectName");
|
|
@@ -422,7 +422,6 @@ public class InformationController extends BaseController {
|
|
|
firstUnits = new String(firstUnits.getBytes("iso8859-1"),"utf-8");
|
|
|
secondUnits= request.getParameter("secondUnits");
|
|
|
secondUnits = new String(secondUnits.getBytes("iso8859-1"),"utf-8");
|
|
|
-
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -481,11 +480,38 @@ public class InformationController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ //导出word
|
|
|
@ResponseBody
|
|
|
//@RequiresPermissions("test:onetomany:dialog:testDataMain1:export")
|
|
|
@RequestMapping(value = "exportInformation")
|
|
|
public void exportInformation(Information information,HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ String projectId = "";
|
|
|
+ String projectName = "";
|
|
|
+ String projectType = "";
|
|
|
+ String projectYear = "";
|
|
|
+ String firstUnits = "";
|
|
|
+ String secondUnits = "";
|
|
|
+ try {
|
|
|
+ projectId = request.getParameter("projectId");
|
|
|
+ projectName = request.getParameter("projectName");
|
|
|
+ projectName = new String(projectName.getBytes("iso8859-1"),"utf-8");
|
|
|
+ projectType = request.getParameter("projectType");
|
|
|
+ projectType = new String(projectType.getBytes("iso8859-1"),"utf-8");
|
|
|
+ projectYear = request.getParameter("projectYear");
|
|
|
+ projectYear = new String(projectYear.getBytes("iso8859-1"),"utf-8");
|
|
|
+ firstUnits= request.getParameter("firstUnits");
|
|
|
+ firstUnits = new String(firstUnits.getBytes("iso8859-1"),"utf-8");
|
|
|
+ secondUnits= request.getParameter("secondUnits");
|
|
|
+ secondUnits = new String(secondUnits.getBytes("iso8859-1"),"utf-8");
|
|
|
+
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ HttpSession session = request.getSession();
|
|
|
+ Object pathSession = session.getAttribute("path");
|
|
|
AjaxJson j = new AjaxJson();
|
|
|
+
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
Template template=null;
|
|
|
File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
|
|
@@ -500,18 +526,58 @@ public class InformationController extends BaseController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
Map<String,Object> data = new HashMap<>();
|
|
|
- List<Material> proId = materialService.findProId();
|
|
|
- List<Information> informationList = materialService.proIdName(proId);
|
|
|
- for (int i = 0; i < informationList.size(); i++) {
|
|
|
- stringBuilder.append(i+1 + "." +informationList.get(i).getProjectName()+"("+informationList.get(i).getProjectId()+")");
|
|
|
- Information information1 = informationList.get(i);
|
|
|
- List<Material> mateial = materialService.findMateial(information1);
|
|
|
- for (int k = 0; k < mateial.size(); k++) {
|
|
|
+ List<Information> tList = new ArrayList<>();
|
|
|
+ if (pathSession != null && pathSession != "") {
|
|
|
+ BufferedReader bufferedReader = null;
|
|
|
+ try {
|
|
|
+ bufferedReader = new BufferedReader(new FileReader(pathSession.toString()));
|
|
|
+ String string;
|
|
|
+ while ((string = bufferedReader.readLine()) != null) {
|
|
|
+ Information information1 = new Information();
|
|
|
+ information1.setProjectId(string);
|
|
|
+ tList.add(information1);
|
|
|
+ }
|
|
|
+ bufferedReader.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ List<Material> proId = materialService.findProId(tList);
|
|
|
+ List<Information> informationList = materialService.proIdName(proId);
|
|
|
+ for (int i = 0; i < informationList.size(); i++) {
|
|
|
+ stringBuilder.append(i + 1 + "." + informationList.get(i).getProjectName() + "(" + informationList.get(i).getProjectId() + ")");
|
|
|
+ Information information1 = informationList.get(i);
|
|
|
+ List<Material> mateial = materialService.findMateial(information1);
|
|
|
+ for (int k = 0; k < mateial.size(); k++) {
|
|
|
+ stringBuilder.append("<w:p></w:p>");
|
|
|
+ stringBuilder.append(k + 1 + "." + mateial.get(k).getMaterialName() + "(" + mateial.get(k).getInforId() + "),出库数量为" + mateial.get(k).getOutboundNumber() + ",审定数量为" + mateial.get(k).getAuthorizedNumber() + ",由于原因" + mateial.get(k).getStatus() + ":" + mateial.get(k).getInfo() + ",已完成甲供物资领退料。");
|
|
|
+ }
|
|
|
+ stringBuilder.append("<w:p></w:p>");
|
|
|
stringBuilder.append("<w:p></w:p>");
|
|
|
- stringBuilder.append(k+1 + "." +mateial.get(k).getMaterialName()+"("+mateial.get(k).getInforId()+"),出库数量为"+mateial.get(k).getOutboundNumber()+",审定数量为"+mateial.get(k).getAuthorizedNumber()+",由于原因"+mateial.get(k).getStatus()+":"+mateial.get(k).getInfo()+",已完成甲供物资领退料。");
|
|
|
}
|
|
|
- stringBuilder.append("<w:p></w:p>");
|
|
|
- stringBuilder.append("<w:p></w:p>");
|
|
|
+ } else {
|
|
|
+ Information infor = new Information();
|
|
|
+ infor.setProjectId(projectId);
|
|
|
+ infor.setProjectName(projectName);
|
|
|
+ infor.setProjectType(projectType);
|
|
|
+ infor.setProjectYear(projectYear);
|
|
|
+ infor.setFirstUnits(firstUnits);
|
|
|
+ infor.setSecondUnits(secondUnits);
|
|
|
+ tList.add(infor);
|
|
|
+ List<Information> idByList = informationService.findIdByList(tList);
|
|
|
+ List<Material> proId = materialService.findProId(idByList);
|
|
|
+ List<Information> informationList = materialService.proIdName(proId);
|
|
|
+ for (int i = 0; i < informationList.size(); i++) {
|
|
|
+ stringBuilder.append(i + 1 + "." + informationList.get(i).getProjectName() + "(" + informationList.get(i).getProjectId() + ")");
|
|
|
+ Information information1 = informationList.get(i);
|
|
|
+ List<Material> mateial = materialService.findMateial(information1);
|
|
|
+ for (int k = 0; k < mateial.size(); k++) {
|
|
|
+ stringBuilder.append("<w:p></w:p>");
|
|
|
+ stringBuilder.append(k + 1 + "." + mateial.get(k).getMaterialName() + "(" + mateial.get(k).getInforId() + "),出库数量为" + mateial.get(k).getOutboundNumber() + ",审定数量为" + mateial.get(k).getAuthorizedNumber() + ",由于原因" + mateial.get(k).getStatus() + ":" + mateial.get(k).getInfo() + ",已完成甲供物资领退料。");
|
|
|
+ }
|
|
|
+ stringBuilder.append("<w:p></w:p>");
|
|
|
+ stringBuilder.append("<w:p></w:p>");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
data.put("mb",stringBuilder);
|
|
|
File docFile = new File("D:/甲供物资超欠供说明.doc");
|