Java tutorial
package com.dayuan.action; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URLEncoder; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.dayuan.bean.BusLoanInfo; import com.dayuan.bean.BusLoanInfoController; import com.dayuan.bean.BusLoanInfoGuaranter; import com.dayuan.bean.BusLoanInfoLegal; import com.dayuan.bean.BusLoanInfoShop; import com.dayuan.bean.SysUser; import com.dayuan.form.GuaranterListForm; import com.dayuan.form.ShopListForm; import com.dayuan.model.BusLoanInfoModel; import com.dayuan.service.BusLoanInfoControllerService; import com.dayuan.service.BusLoanInfoGuaranterService; import com.dayuan.service.BusLoanInfoLegalService; import com.dayuan.service.BusLoanInfoService; import com.dayuan.service.BusLoanInfoShopService; import com.dayuan.utils.CreateWords; import com.dayuan.utils.DateUtil; import com.dayuan.utils.HtmlUtil; import com.dayuan.utils.SessionUtils; import com.dayuan.utils.StringUtil; import com.dayuan.utils.ZipUtil; @Controller @RequestMapping("/BusLoan") public class BusinessLoanAction extends BaseAction { // Service start @Autowired(required = false) //???setrequired=false? private BusLoanInfoService<BusLoanInfo> busLoanInfoService; // Service start @Autowired(required = false) private BusLoanInfoLegalService<BusLoanInfoLegal> busLoanInfoLegalService; // Service start @Autowired(required = false) private BusLoanInfoControllerService<BusLoanInfoController> busLoanInfoControllerService; // Service start ?? @Autowired(required = false) private BusLoanInfoShopService<BusLoanInfoShop> busLoanInfoShopService; // Service start ?? @Autowired(required = false) private BusLoanInfoGuaranterService<BusLoanInfoGuaranter> busLoanInfoGuaranterService; /** * loan * */ @RequestMapping("/loan") public ModelAndView loan(HttpServletRequest request) throws Exception { Map<String, Object> context = getRootMap(); SysUser user = SessionUtils.getUser(request); context.put("user", user); return forword("bus/busLoan", context); } /** * json ? * @param url * @param classifyId * @return * @throws Exception */ @ResponseBody @RequestMapping(value = "/dataList", method = RequestMethod.POST) public Map dataList(BusLoanInfoModel busLoanInfoModel, HttpServletRequest request, HttpServletResponse response) throws Exception { log.info("dataList"); Map<String, Object> map = new HashMap<String, Object>(); if (busLoanInfoModel != null) { SysUser user = SessionUtils.getUser(request); busLoanInfoModel.setuId(user.getId().toString()); //busLoanInfoModel.setuName(user.getNickName()); List<BusLoanInfo> list = busLoanInfoService.queryByList(busLoanInfoModel); map.put("total", busLoanInfoModel.getPager().getRowCount()); map.put("rows", list); //HtmlUtil.writerJson(response, map); } return map; } /** * ? * @param url * @param classifyId * @return * @throws Exception */ @RequestMapping("/save") public void save(BusLoanInfo busLoanInfo, BusLoanInfoLegal busLoanInfoLegal, BusLoanInfoController busLoanInfoController, ShopListForm shopForm, GuaranterListForm guaranterForm, HttpServletRequest request, HttpServletResponse response) throws Exception { /**for(BusLoanInfoGuaranter guaranter:guaranterForm.getGuaranter()){ System.out.println("guaranter.name="+guaranter.getGuaranterName()); }*/ busLoanInfo.setlId(1); boolean flag = false; busLoanInfo.setContent("" + busLoanInfo.getApplicationName() + ",?" + busLoanInfo.getApplicationAmount() + ",?" + busLoanInfo.getApplicationTerm() + "");// /**??*/ if (busLoanInfo.getId() == null) { int num = busLoanInfoService.save(busLoanInfo);//??? if (num == 1) { flag = true; } } else { int num = busLoanInfoService.updateReturnInfluences(busLoanInfo);//?? if (num == 1) { flag = true; } } /**??*/ if (busLoanInfoLegal.getId() == null) { busLoanInfoLegal.setBid(busLoanInfo.getId());//id int num = busLoanInfoLegalService.save(busLoanInfoLegal); if (num != 1) { flag = false; } } else { int num = busLoanInfoLegalService.updateReturnInfluences(busLoanInfoLegal); if (num != 1) { flag = false; } } /**??*/ if (busLoanInfoController.getId() == null) { busLoanInfoController.setBid(busLoanInfo.getId());//id int num = busLoanInfoControllerService.save(busLoanInfoController); if (num != 1) { flag = false; } } else { int num = busLoanInfoControllerService.updateReturnInfluences(busLoanInfoController); if (num != 1) { flag = false; } } /**??*/ for (BusLoanInfoShop shop : shopForm.getShop()) { if (shop.getId() == null) { shop.setBid(busLoanInfo.getId()); int num = busLoanInfoShopService.save(shop); if (num != 1) { flag = false; } } else { int num = busLoanInfoShopService.updateReturnInfluences(shop); if (num != 1) { flag = false; } } } /**????*/ if (busLoanInfo.getIfGuaranter().equals("")) { for (BusLoanInfoGuaranter guaranter : guaranterForm.getGuaranter()) { if (guaranter.getId() == null) { guaranter.setBid(busLoanInfo.getId()); int num = busLoanInfoGuaranterService.save(guaranter); if (num != 1) { flag = false; } } else { int num = busLoanInfoGuaranterService.updateReturnInfluences(guaranter); if (num != 1) { flag = false; } } } } if (flag) { log.info("???"); sendSuccessMessage(response, "???"); } else { log.info("??"); sendFailureMessage(response, "??"); } } /** * ?id? * @param id * @return * @throws Exception * */ @RequestMapping("/getId") public void getId(Integer id, HttpServletResponse response) throws Exception { Map<String, Object> content = getRootMap(); BusLoanInfo busLoanInfo = this.busLoanInfoService.queryById(id); if (busLoanInfo == null) { sendFailureMessage(response, "~"); return; } content.put(SUCCESS, true); content.put("data", busLoanInfo); HtmlUtil.writerJson(response, content); } /** * ?id * */ @RequestMapping("/delete") public void delete(Integer[] id, HttpServletResponse response) throws Exception { boolean flag = false; if (id != null && id.length > 0) { for (int i = 0; i < id.length; i++) { BusLoanInfo busLoanInfo = busLoanInfoService.queryById(id[i]); if (busLoanInfo != null) { int bid = busLoanInfo.getId(); busLoanInfoShopService.deleteByBid(bid); busLoanInfoLegalService.deleteByBid(bid); busLoanInfoControllerService.deleteByBid(bid); busLoanInfoGuaranterService.deleteByBid(bid); busLoanInfoService.delete(bid); flag = true; } } } if (flag) { log.info("??"); sendSuccessMessage(response, "??"); } else { log.info("?"); sendFailureMessage(response, "?"); } /** * * * ?? busLoanInfoService.delete(id); sendSuccessMessage(response,"??"); * * */ } /** * ?excel * */ @RequestMapping("/exportAllExcel") public void exportAllExcel(HttpServletRequest request, HttpServletResponse response) throws Exception { SysUser user = SessionUtils.getUser(request); BusLoanInfoModel busLoanInfoModel = new BusLoanInfoModel(); busLoanInfoModel.setuId(user.getId().toString()); busLoanInfoModel.setuName(user.getNickName()); List<BusLoanInfo> list = busLoanInfoService.queryList(busLoanInfoModel); if (list != null && list.size() > 0) { // webbookExcel HSSFWorkbook wb = new HSSFWorkbook(); // webbooksheet,Excelsheet HSSFSheet sheet = wb.createSheet("???"); // sheet0,??poiExcel?short HSSFRow row = sheet.createRow((int) 0); // ? HSSFCellStyle style = wb.createCellStyle(); // ? style.setAlignment(HSSFCellStyle.ALIGN_CENTER); HSSFCell cell = row.createCell((short) 0); cell.setCellValue("??"); cell.setCellStyle(style); cell = row.createCell((short) 1); cell.setCellValue("??"); //applicationName cell.setCellStyle(style); cell = row.createCell((short) 2); cell.setCellValue("?");//urgentCont cell.setCellStyle(style); cell = row.createCell((short) 3); cell.setCellValue(""); // relationship cell.setCellStyle(style); cell = row.createCell((short) 4); cell.setCellValue("?"); //legalPhone cell.setCellStyle(style); cell = row.createCell((short) 5); cell.setCellValue("?"); //houseAddress cell.setCellStyle(style); cell = row.createCell((short) 6); cell.setCellValue("?"); //companyName cell.setCellStyle(style); cell = row.createCell((short) 7); cell.setCellValue("?");// ?platformName cell.setCellStyle(style); cell = row.createCell((short) 8); cell.setCellValue(""); //?shopName cell.setCellStyle(style); cell = row.createCell((short) 9); cell.setCellValue("???"); //?,subAccount cell.setCellStyle(style); cell = row.createCell((short) 10); cell.setCellValue("?"); //?,sbuPassword cell.setCellStyle(style); for (int i = 0; i < list.size(); i++) { BusLoanInfo busLoanInfo = list.get(i); Integer bid = busLoanInfo.getId(); BusLoanInfoLegal busLoanInfoLegal = this.busLoanInfoLegalService.getBusLoanInfoLegal(bid); BusLoanInfoShop busLoanInfoShop = this.busLoanInfoShopService.getBusLoanInfoShop(bid); row = sheet.createRow((int) 1 + i); row.createCell((short) 0).setCellValue(i + 1); row.createCell((short) 1).setCellValue(StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); row.createCell((short) 2).setCellValue(StringUtil.getNotNullStr(busLoanInfo.getUrgentCont())); row.createCell((short) 3).setCellValue(StringUtil.getNotNullStr(busLoanInfo.getRelationship())); if (busLoanInfoLegal != null) { row.createCell((short) 4) .setCellValue(StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); row.createCell((short) 5) .setCellValue(StringUtil.getNotNullStr(busLoanInfoLegal.getHouseAddress())); row.createCell((short) 6) .setCellValue(StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); } else { row.createCell((short) 4).setCellValue(""); row.createCell((short) 5).setCellValue(""); row.createCell((short) 6).setCellValue(""); } if (busLoanInfoShop != null) { row.createCell((short) 7) .setCellValue(StringUtil.getNotNullStr(busLoanInfoShop.getPlatformName())); row.createCell((short) 8).setCellValue(StringUtil.getNotNullStr(busLoanInfoShop.getShopName())); row.createCell((short) 9) .setCellValue(StringUtil.getNotNullStr(busLoanInfoShop.getSubAccount())); row.createCell((short) 10) .setCellValue(StringUtil.getNotNullStr(busLoanInfoShop.getSbuPassword())); } else { row.createCell((short) 7).setCellValue(""); row.createCell((short) 8).setCellValue(""); row.createCell((short) 9).setCellValue(""); row.createCell((short) 10).setCellValue(""); } } String savePath = request.getSession().getServletContext().getRealPath( File.separator + "WEB-INF" + File.separator + "downloads" + File.separator + "excelfiles");//??,?? savePath = savePath + File.separator + UUID.randomUUID();//? File fileSavePath = new File(savePath); /**??*/ if (fileSavePath.exists()) { if (fileSavePath.isDirectory()) { File[] files = fileSavePath.listFiles(); for (File file : files) { file.delete(); } fileSavePath.delete(); } else { fileSavePath.delete(); } fileSavePath.mkdirs(); } else { fileSavePath.mkdirs(); } String excel = "????" + DateUtil.getNowPlusTimeMill() + ".xls";//eccel?? BufferedOutputStream fout = new BufferedOutputStream( new FileOutputStream(savePath + File.separator + excel)); // wb.write(fout); //excel? fout.flush(); fout.close(); //MIME response.setContentType(request.getSession().getServletContext().getMimeType(excel)); //Content-Disposition response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(excel, "UTF-8")); BufferedInputStream in = new BufferedInputStream( new FileInputStream(savePath + File.separator + excel));//,io? OutputStream out = new BufferedOutputStream(response.getOutputStream()); byte buffer[] = new byte[1024]; int len = 0; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len);//?response? } in.close(); out.flush(); out.close(); /***/ File file = new File(savePath + File.separator + excel); if (file != null) { if (file.exists()) { file.delete();// } file = null; } /***/ if (fileSavePath != null) { if (fileSavePath.exists()) { fileSavePath.delete(); } fileSavePath = null; } log.info("excel?"); } } /** * excel * * */ @RequestMapping("/exportExcel") public void exportExcel(Integer id, HttpServletRequest request, HttpServletResponse response) throws Exception { if (id == null || id.equals("")) { log.error("?"); return; } BusLoanInfo busLoanInfo = this.busLoanInfoService.queryById(id); if (busLoanInfo == null) { log.error("busLoanInfo?"); return; } Integer bid = busLoanInfo.getId(); if (bid == null) { log.error("busLoanInfo?"); return; } BusLoanInfoLegal busLoanInfoLegal = this.busLoanInfoLegalService.getBusLoanInfoLegal(bid); BusLoanInfoShop busLoanInfoShop = this.busLoanInfoShopService.getBusLoanInfoShop(bid); // webbookExcel HSSFWorkbook wb = new HSSFWorkbook(); // webbooksheet,Excelsheet HSSFSheet sheet = wb.createSheet("???"); // sheet0,??poiExcel?short HSSFRow row = sheet.createRow((int) 0); // ? HSSFCellStyle style = wb.createCellStyle(); // ? style.setAlignment(HSSFCellStyle.ALIGN_CENTER); HSSFCell cell = row.createCell((short) 0); cell.setCellValue("??"); cell.setCellStyle(style); cell = row.createCell((short) 1); cell.setCellValue("??"); //applicationName cell.setCellStyle(style); cell = row.createCell((short) 2); cell.setCellValue("?");//urgentCont cell.setCellStyle(style); cell = row.createCell((short) 3); cell.setCellValue(""); // relationship cell.setCellStyle(style); cell = row.createCell((short) 4); cell.setCellValue("?"); //legalPhone cell.setCellStyle(style); cell = row.createCell((short) 5); cell.setCellValue("?"); //houseAddress cell.setCellStyle(style); cell = row.createCell((short) 6); cell.setCellValue("?"); //companyName cell.setCellStyle(style); cell = row.createCell((short) 7); cell.setCellValue("?");// ?platformName cell.setCellStyle(style); cell = row.createCell((short) 8); cell.setCellValue(""); //?shopName cell.setCellStyle(style); cell = row.createCell((short) 9); cell.setCellValue("???"); //?,subAccount cell.setCellStyle(style); cell = row.createCell((short) 10); cell.setCellValue("?"); //?,sbuPassword cell.setCellStyle(style); // ? ?? try { row = sheet.createRow((int) 0 + 1); row.createCell((short) 0).setCellValue(1); row.createCell((short) 1).setCellValue(StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); row.createCell((short) 2).setCellValue(StringUtil.getNotNullStr(busLoanInfo.getUrgentCont())); row.createCell((short) 3).setCellValue(StringUtil.getNotNullStr(busLoanInfo.getRelationship())); if (busLoanInfoLegal != null) { row.createCell((short) 4).setCellValue(StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); row.createCell((short) 5) .setCellValue(StringUtil.getNotNullStr(busLoanInfoLegal.getHouseAddress())); row.createCell((short) 6).setCellValue(StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); } else { row.createCell((short) 4).setCellValue(""); row.createCell((short) 5).setCellValue(""); row.createCell((short) 6).setCellValue(""); } if (busLoanInfoShop != null) { row.createCell((short) 7).setCellValue(StringUtil.getNotNullStr(busLoanInfoShop.getPlatformName())); row.createCell((short) 8).setCellValue(StringUtil.getNotNullStr(busLoanInfoShop.getShopName())); row.createCell((short) 9).setCellValue(StringUtil.getNotNullStr(busLoanInfoShop.getSubAccount())); row.createCell((short) 10).setCellValue(StringUtil.getNotNullStr(busLoanInfoShop.getSbuPassword())); } else { row.createCell((short) 7).setCellValue(""); row.createCell((short) 8).setCellValue(""); row.createCell((short) 9).setCellValue(""); row.createCell((short) 10).setCellValue(""); } // Student stu = (Student) list.get(i); // ? // cell = row.createCell((short) 3); // cell.setCellValue(new SimpleDateFormat("yyyy-mm-dd").format(stu.getBirth())); // row.createCell((short) 10).setCellValue(busLoanInfoShop.getSbuPassword());? String savePath = request.getSession().getServletContext().getRealPath( File.separator + "WEB-INF" + File.separator + "downloads" + File.separator + "excelfiles");//??,?? savePath = savePath + File.separator + UUID.randomUUID();//? File fileSavePath = new File(savePath); /**??*/ if (fileSavePath.exists()) { if (fileSavePath.isDirectory()) { File[] files = fileSavePath.listFiles(); for (File file : files) { file.delete(); } fileSavePath.delete(); } else { fileSavePath.delete(); } fileSavePath.mkdirs(); } else { fileSavePath.mkdirs(); } String excel = "????" + DateUtil.getNowPlusTimeMill() + ".xls";//eccel?? BufferedOutputStream fout = new BufferedOutputStream( new FileOutputStream(savePath + File.separator + excel)); // wb.write(fout); //excel? fout.flush(); fout.close(); //MIME response.setContentType(request.getSession().getServletContext().getMimeType(excel)); //Content-Disposition response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(excel, "UTF-8")); //,io? BufferedInputStream in = new BufferedInputStream( new FileInputStream(savePath + File.separator + excel)); OutputStream out = new BufferedOutputStream(response.getOutputStream()); byte buffer[] = new byte[1024]; int len = 0; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len);//?response? } in.close(); out.flush(); out.close(); /***/ File file = new File(savePath + File.separator + excel); if (file != null) { if (file.exists()) { file.delete();// } file = null; } /***/ if (fileSavePath != null) { if (fileSavePath.exists()) { fileSavePath.delete(); } fileSavePath = null; } log.info("???excel?"); } catch (Exception e) { e.printStackTrace(); } } /** * ?: * @author xuanaw * @data 201611136 * */ @RequestMapping("/createWordsOnLine") public void createWordsOnLine(Integer id, String wordType, HttpServletRequest request, HttpServletResponse response) { if (id == null || wordType.equals("")) { log.error("createWordsOnLine??"); return; } boolean sign = false; String savePath = ""; try { BusLoanInfo busLoanInfo = this.busLoanInfoService.queryById(id); if (busLoanInfo == null) { log.error("busLoanInfo?"); return; } Integer bid = busLoanInfo.getId(); BusLoanInfoLegal busLoanInfoLegal = this.busLoanInfoLegalService.getBusLoanInfoLegal(bid); if (busLoanInfoLegal == null) { log.error("busLoanInfoLegal?"); return; } BusLoanInfoShop busLoanInfoShop = this.busLoanInfoShopService.getBusLoanInfoShop(bid); if (busLoanInfoShop == null) { log.error("busLoanInfoShop?"); return; } BusLoanInfoGuaranter busLoanInfoGuaranter = this.busLoanInfoGuaranterService .getBusLoanInfoGuaranter(bid); if (busLoanInfoGuaranter == null) { log.error("busLoanInfoGuaranter?"); return; } BusLoanInfoController busLoanInfoController = null; if (busLoanInfoLegal.getIfController().equals("?")) { busLoanInfoController = busLoanInfoControllerService.getBusLoanInfoController(bid); } Map<String, Object> dataMap = new HashMap<String, Object>(); String path = File.separator + "com" + File.separator + "dayuan" + File.separator + "template" + File.separator;//?? savePath = request.getSession().getServletContext() .getRealPath(File.separator + "WEB-INF" + File.separator + "downloads");//??,?? savePath = savePath + File.separator + UUID.randomUUID();//?? /** */ File fileSavePath = new File(savePath); if (fileSavePath.exists()) { if (fileSavePath.isDirectory()) { File[] files = fileSavePath.listFiles(); for (File file : files) { file.delete(); } fileSavePath.delete(); } else { fileSavePath.delete(); } fileSavePath.mkdirs(); } else { fileSavePath.mkdirs(); } CreateWords createWords = new CreateWords();//?word? String wordName = "";//??? if (wordType.equals("1")) { dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "?" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "dianshangdaihouxuzhi1.ftl", savePath + File.separator, wordName); } else if (wordType.equals("2")) { dataMap.put("companyName", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); wordName = "()?????(?)" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "chengyuanmingdan2.ftl", savePath + File.separator, wordName); } else if (wordType.equals("3")) { dataMap.put("legalPerson", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("gender", StringUtil.getNotNullStr(busLoanInfoLegal.getGender())); dataMap.put("idCard", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("companyName", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); wordName = "??" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "fadingdaibiaoren3.ftl", savePath + File.separator, wordName); } else if (wordType.equals("4")) { dataMap.put("companyName1", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); dataMap.put("companyName2", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "gudonghuijueyi4.ftl", savePath + File.separator, wordName); } else if (wordType.equals("5")) { dataMap.put("companyName", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); wordName = "" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "yuliugongzhangyangben5.ftl", savePath + File.separator, wordName); } else if (wordType.equals("61")) { dataMap.put("guaranterName", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterCard", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterCard())); dataMap.put("guaranterHouseAddress", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterHouseAddress())); dataMap.put("guaranterEmployer", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterEmployer())); dataMap.put("guaranterPhone", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterPhone())); dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "?????1" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "baozhenghetong61.ftl", savePath + File.separator, wordName); } else if (wordType.equals("62")) { dataMap.put("guaranterName", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterCard", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterCard())); dataMap.put("guaranterHouseAddress", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterHouseAddress())); dataMap.put("guaranterEmployer", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterEmployer())); dataMap.put("guaranterPhone", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterPhone())); dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "?????2" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "baozhenghetong62.ftl", savePath + File.separator, wordName); } else if (wordType.equals("71")) { dataMap.put("guaranterName", busLoanInfoGuaranter.getGuaranterName()); dataMap.put("guaranterHouseAddress", busLoanInfoGuaranter.getGuaranterHouseAddress()); dataMap.put("legalPerson", busLoanInfoLegal.getLegalPerson()); dataMap.put("legalPhone", busLoanInfoLegal.getLegalPhone()); dataMap.put("applicationName", busLoanInfo.getApplicationName()); wordName = "?????1" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "zuigaoebaozhenghetong71.ftl", savePath + File.separator, wordName); } else if (wordType.equals("72")) { dataMap.put("guaranterName", busLoanInfoGuaranter.getGuaranterName()); dataMap.put("guaranterHouseAddress", busLoanInfoGuaranter.getGuaranterHouseAddress()); dataMap.put("legalPerson", busLoanInfoLegal.getLegalPerson()); dataMap.put("legalPhone", busLoanInfoLegal.getLegalPhone()); dataMap.put("applicationName", busLoanInfo.getApplicationName()); wordName = "?????2" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "zuigaoebaozhenghetong72.ftl", savePath + File.separator, wordName); } else if (wordType.equals("8")) { dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("applicationAddress", StringUtil.getNotNullStr(busLoanInfo.getApplicationAddress())); dataMap.put("applicationPhone", StringUtil.getNotNullStr(busLoanInfo.getApplicationPhone())); dataMap.put("applicationIdCard", StringUtil.getNotNullStr(busLoanInfo.getApplicationIdCard())); dataMap.put("guaranterName1", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterName2", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterName3", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); wordName = "???????" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "jiekuanhetong8.ftl", savePath + File.separator, wordName); } else if (wordType.equals("9")) { dataMap.put("applicationName1", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("guaranterName1", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("applicationAmount1", StringUtil.getNotNullStr(busLoanInfo.getApplicationAmount())); dataMap.put("applicationName2", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("applicationAmount2", StringUtil.getNotNullStr(busLoanInfo.getApplicationAmount())); dataMap.put("guaranterName2", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("applicationName3", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("applicationAmount3", StringUtil.getNotNullStr(busLoanInfo.getApplicationAmount())); wordName = "??????" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "shouxinquerenshu9.ftl", savePath + File.separator, wordName); } else if (wordType.equals("10")) { dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "???" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "shouxinbanlishenqingshu10.ftl", savePath + File.separator, wordName); } else if (wordType.equals("11")) { dataMap.put("legalPerson1", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("idCard1", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("legalPhone1", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); dataMap.put("legalPerson2", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("legalPhone2", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); dataMap.put("legalPerson3", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("idCard2", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("legalPhone3", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); wordName = "?4?1" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "daiqianwenjian11.ftl", savePath + File.separator, wordName); } else if (wordType.equals("12")) { dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("legalPerson", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("idCard", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("idCardPeriod", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCardPeriod())); dataMap.put("idCardAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCardAddress())); dataMap.put("legalPhone", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); if (!busLoanInfo.getChannel().equals("") && busLoanInfo.getChannel().equals("??")) { wordName = "??(??)" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "rongxintongziliuliang12.ftl", savePath + File.separator, wordName); } else if (!busLoanInfo.getChannel().equals("") && busLoanInfo.getChannel().equals("?")) { wordName = "??(?)" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "rongxintongyundaituisong12.ftl", savePath + File.separator, wordName); } } else if (wordType.equals("13")) { dataMap.put("surveyOrgName", StringUtil.getNotNullStr(busLoanInfo.getSurveyOrgName())); dataMap.put("surveyPersonName", StringUtil.getNotNullStr(busLoanInfo.getSurveyPersonName())); dataMap.put("surveyPhone", StringUtil.getNotNullStr(busLoanInfo.getSurveyPhone())); dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("applicationAmount", StringUtil.getNotNullStr(busLoanInfo.getApplicationAmount())); dataMap.put("applicationTerm", StringUtil.getNotNullStr(busLoanInfo.getApplicationTerm())); dataMap.put("loanType", StringUtil.getNotNullStr(busLoanInfo.getLoanType())); dataMap.put("urgentCont", StringUtil.getNotNullStr(busLoanInfo.getUrgentCont())); dataMap.put("urgentContPhone", StringUtil.getNotNullStr(busLoanInfo.getUrgentContPhone())); dataMap.put("taobaoTreeDiamondMore", StringUtil.getNotNullStr(busLoanInfo.getTaobaoTreeDiamondMore())); dataMap.put("otherPlatform", StringUtil.getNotNullStr(busLoanInfo.getOtherPlatform())); dataMap.put("operatingPeriodMore", StringUtil.getNotNullStr(busLoanInfo.getOperatingPeriodMore())); dataMap.put("ifShopOwner", StringUtil.getNotNullStr(busLoanInfo.getIfShopOwner())); dataMap.put("haveGuarantor", StringUtil.getNotNullStr(busLoanInfo.getHaveGuarantor())); dataMap.put("shopController", StringUtil.getNotNullStr(busLoanInfo.getShopController())); dataMap.put("salesOfMore", StringUtil.getNotNullStr(busLoanInfo.getSalesOfMore())); dataMap.put("than3credit", StringUtil.getNotNullStr(busLoanInfo.getThan3credit())); dataMap.put("notOverdue", StringUtil.getNotNullStr(busLoanInfo.getNotOverdue())); dataMap.put("perNotOverdue", StringUtil.getNotNullStr(busLoanInfo.getPerNotOverdue())); dataMap.put("shopName", StringUtil.getNotNullStr(busLoanInfoShop.getShopName())); dataMap.put("platformName", StringUtil.getNotNullStr(busLoanInfoShop.getPlatformName())); dataMap.put("shopLevel", StringUtil.getNotNullStr(busLoanInfoShop.getShopLevel())); dataMap.put("operatingPeriod", StringUtil.getNotNullStr(busLoanInfoShop.getOperatingPeriod())); dataMap.put("shopOwner", StringUtil.getNotNullStr(busLoanInfoShop.getShopOwner())); dataMap.put("businessOpera", StringUtil.getNotNullStr(busLoanInfoShop.getBusinessOpera())); dataMap.put("businessAddress", StringUtil.getNotNullStr(busLoanInfoShop.getBusinessAddress())); dataMap.put("warehouseAddress", StringUtil.getNotNullStr(busLoanInfoShop.getWarehouseAddress())); dataMap.put("salesIncome", StringUtil.getNotNullStr(busLoanInfoShop.getSalesIncome())); dataMap.put("totalLiability", StringUtil.getNotNullStr(busLoanInfoShop.getTotalLiability())); dataMap.put("bankLiabilities", StringUtil.getNotNullStr(busLoanInfoShop.getBankLiabilities())); dataMap.put("netProfit", StringUtil.getNotNullStr(busLoanInfoShop.getNetProfit())); dataMap.put("legalPerson", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("idCard", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("householdRegistration", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseholdRegistration())); dataMap.put("houseAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseAddress())); dataMap.put("legalPhone", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); dataMap.put("propertyQuantity", StringUtil.getNotNullStr(busLoanInfoLegal.getPropertyQuantity())); dataMap.put("totalArea", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalArea())); dataMap.put("totalValue", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalValue())); dataMap.put("mortgage", StringUtil.getNotNullStr(busLoanInfoLegal.getMortgage())); dataMap.put("propertyAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getPropertyAddress())); dataMap.put("totalCar", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalCar())); dataMap.put("licenseNumber", StringUtil.getNotNullStr(busLoanInfoLegal.getLicenseNumber())); dataMap.put("totalCarValue", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalCarValue())); dataMap.put("otherAssets", StringUtil.getNotNullStr(busLoanInfoLegal.getOtherAssets())); dataMap.put("borrowOfBank", StringUtil.getNotNullStr(busLoanInfoLegal.getBorrowOfBank())); dataMap.put("amount", StringUtil.getNotNullStr(busLoanInfoLegal.getAmount())); dataMap.put("theTerm", StringUtil.getNotNullStr(busLoanInfoLegal.getTheTerm())); dataMap.put("ifController", StringUtil.getNotNullStr(busLoanInfoLegal.getIfController())); if (busLoanInfoController != null && busLoanInfoLegal.getIfController().equals("?")) { dataMap.put("controllerName", StringUtil.getNotNullStr(busLoanInfoController.getControllerName())); dataMap.put("controllerIdCard", StringUtil.getNotNullStr(busLoanInfoController.getControllerIdCard())); dataMap.put("controllerRegistration", StringUtil.getNotNullStr(busLoanInfoController.getControllerRegistration())); dataMap.put("controllerHouseAddress", StringUtil.getNotNullStr(busLoanInfoController.getControllerHouseAddress())); dataMap.put("controllerPhone", StringUtil.getNotNullStr(busLoanInfoController.getControllerPhone())); dataMap.put("controllerPropertyQuantity", StringUtil.getNotNullStr(busLoanInfoController.getControllerPropertyQuantity())); dataMap.put("controllerTotalArea", StringUtil.getNotNullStr(busLoanInfoController.getControllerTotalArea())); dataMap.put("controllertotalValue", StringUtil.getNotNullStr(busLoanInfoController.getControllertotalValue())); dataMap.put("contrallerMortgage", StringUtil.getNotNullStr(busLoanInfoController.getContrallerMortgage())); dataMap.put("controllerPropertyAddress", StringUtil.getNotNullStr(busLoanInfoController.getControllerPropertyAddress())); dataMap.put("controllerTotalCar", StringUtil.getNotNullStr(busLoanInfoController.getControllerTotalCar())); dataMap.put("controllerLicenseNumber", StringUtil.getNotNullStr(busLoanInfoController.getControllerLicenseNumber())); dataMap.put("controllerTotalCarValue", StringUtil.getNotNullStr(busLoanInfoController.getControllerTotalCarValue())); dataMap.put("controllerOtherAssets", StringUtil.getNotNullStr(busLoanInfoController.getControllerOtherAssets())); dataMap.put("controllerBorrowOfBank", StringUtil.getNotNullStr(busLoanInfoController.getControllerBorrowOfBank())); dataMap.put("controllerAmount", StringUtil.getNotNullStr(busLoanInfoController.getControllerAmount())); dataMap.put("controllerTheTerm", StringUtil.getNotNullStr(busLoanInfoController.getControllerTheTerm())); } else { //?? dataMap.put("controllerName", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("controllerIdCard", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("controllerRegistration", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseholdRegistration())); dataMap.put("controllerHouseAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseAddress())); dataMap.put("controllerPhone", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseAddress())); dataMap.put("controllerPropertyQuantity", StringUtil.getNotNullStr(busLoanInfoLegal.getPropertyQuantity())); dataMap.put("controllerTotalArea", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalArea())); dataMap.put("controllertotalValue", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalValue())); dataMap.put("contrallerMortgage", StringUtil.getNotNullStr(busLoanInfoLegal.getMortgage())); dataMap.put("controllerPropertyAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getPropertyAddress())); dataMap.put("controllerTotalCar", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalCar())); dataMap.put("controllerLicenseNumber", StringUtil.getNotNullStr(busLoanInfoLegal.getLicenseNumber())); dataMap.put("controllerTotalCarValue", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalCarValue())); dataMap.put("controllerOtherAssets", StringUtil.getNotNullStr(busLoanInfoLegal.getOtherAssets())); dataMap.put("controllerBorrowOfBank", StringUtil.getNotNullStr(busLoanInfoLegal.getBorrowOfBank())); dataMap.put("controllerAmount", StringUtil.getNotNullStr(busLoanInfoLegal.getAmount())); dataMap.put("controllerTheTerm", StringUtil.getNotNullStr(busLoanInfoLegal.getTheTerm())); } dataMap.put("ifGuaranter", StringUtil.getNotNullStr(busLoanInfo.getIfGuaranter())); dataMap.put("guaranterName", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterCard", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterCard())); dataMap.put("guaranterEmployer", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterEmployer())); dataMap.put("guaranterDuties", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterDuties())); dataMap.put("guaranterPhone", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterPhone())); dataMap.put("guaranterMaritalStatus", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterMaritalStatus())); dataMap.put("guaranterHouseAddress", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterHouseAddress())); dataMap.put("guaranterMonthlyIncome", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterMonthlyIncome())); dataMap.put("guaranterValues", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterValues())); dataMap.put("guaranterTotalLiabilities", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterTotalLiabilities())); dataMap.put("localPaySocialSecurity", StringUtil.getNotNullStr(busLoanInfo.getLocalPaySocialSecurity())); dataMap.put("ifCustomersVIP", StringUtil.getNotNullStr(busLoanInfo.getIfCustomersVIP())); dataMap.put("childrenIfLocally", StringUtil.getNotNullStr(busLoanInfo.getChildrenIfLocally())); dataMap.put("additionInfo", StringUtil.getNotNullStr(busLoanInfo.getAdditionInfo())); wordName = "??" + DateUtil.getNowPlusTimeMill() + ".xls"; sign = createWords.create(dataMap, path, "shangdaidiaochabiao13.ftl", savePath + File.separator, wordName); } else if (wordType.equals("0")) { //1 dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "?" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "dianshangdaihouxuzhi1.ftl", savePath + File.separator, wordName); //2 dataMap.put("companyName", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); wordName = "()?????(?)" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "chengyuanmingdan2.ftl", savePath + File.separator, wordName); //3 dataMap.put("legalPerson", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("gender", StringUtil.getNotNullStr(busLoanInfoLegal.getGender())); dataMap.put("idCard", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("companyName", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); wordName = "??" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "fadingdaibiaoren3.ftl", savePath + File.separator, wordName); //4 dataMap.put("companyName1", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); dataMap.put("companyName2", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "gudonghuijueyi4.ftl", savePath + File.separator, wordName); //5 dataMap.put("companyName", StringUtil.getNotNullStr(busLoanInfoLegal.getCompanyName())); wordName = "" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "yuliugongzhangyangben5.ftl", savePath + File.separator, wordName); //61 dataMap.put("guaranterName", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterCard", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterCard())); dataMap.put("guaranterHouseAddress", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterHouseAddress())); dataMap.put("guaranterEmployer", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterEmployer())); dataMap.put("guaranterPhone", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterPhone())); dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "?????1" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "baozhenghetong61.ftl", savePath + File.separator, wordName); //62 dataMap.put("guaranterName", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterCard", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterCard())); dataMap.put("guaranterHouseAddress", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterHouseAddress())); dataMap.put("guaranterEmployer", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterEmployer())); dataMap.put("guaranterPhone", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterPhone())); dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "?????2" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "baozhenghetong62.ftl", savePath + File.separator, wordName); //71 dataMap.put("guaranterName", busLoanInfoGuaranter.getGuaranterName()); dataMap.put("guaranterHouseAddress", busLoanInfoGuaranter.getGuaranterHouseAddress()); dataMap.put("legalPerson", busLoanInfoLegal.getLegalPerson()); dataMap.put("legalPhone", busLoanInfoLegal.getLegalPhone()); dataMap.put("applicationName", busLoanInfo.getApplicationName()); wordName = "?????1" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "zuigaoebaozhenghetong71.ftl", savePath + File.separator, wordName); //72 dataMap.put("guaranterName", busLoanInfoGuaranter.getGuaranterName()); dataMap.put("guaranterHouseAddress", busLoanInfoGuaranter.getGuaranterHouseAddress()); dataMap.put("legalPerson", busLoanInfoLegal.getLegalPerson()); dataMap.put("legalPhone", busLoanInfoLegal.getLegalPhone()); dataMap.put("applicationName", busLoanInfo.getApplicationName()); wordName = "?????2" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "zuigaoebaozhenghetong72.ftl", savePath + File.separator, wordName); //8 dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("applicationAddress", StringUtil.getNotNullStr(busLoanInfo.getApplicationAddress())); dataMap.put("applicationPhone", StringUtil.getNotNullStr(busLoanInfo.getApplicationPhone())); dataMap.put("applicationIdCard", StringUtil.getNotNullStr(busLoanInfo.getApplicationIdCard())); dataMap.put("guaranterName1", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterName2", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterName3", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); wordName = "???????" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "jiekuanhetong8.ftl", savePath + File.separator, wordName); //9 dataMap.put("applicationName1", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("guaranterName1", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("applicationAmount1", StringUtil.getNotNullStr(busLoanInfo.getApplicationAmount())); dataMap.put("applicationName2", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("applicationAmount2", StringUtil.getNotNullStr(busLoanInfo.getApplicationAmount())); dataMap.put("guaranterName2", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("applicationName3", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("applicationAmount3", StringUtil.getNotNullStr(busLoanInfo.getApplicationAmount())); wordName = "??????" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "shouxinquerenshu9.ftl", savePath + File.separator, wordName); //10 dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); wordName = "???" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "shouxinbanlishenqingshu10.ftl", savePath + File.separator, wordName); //11 dataMap.put("legalPerson1", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("idCard1", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("legalPhone1", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); dataMap.put("legalPerson2", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("legalPhone2", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); dataMap.put("legalPerson3", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("idCard2", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("legalPhone3", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); wordName = "?4?1" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "daiqianwenjian11.ftl", savePath + File.separator, wordName); //12 dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("legalPerson", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("idCard", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("idCardPeriod", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCardPeriod())); dataMap.put("idCardAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCardAddress())); dataMap.put("legalPhone", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); if (!busLoanInfo.getChannel().equals("") && busLoanInfo.getChannel().equals("??")) { wordName = "??(??)" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "rongxintongziliuliang12.ftl", savePath + File.separator, wordName); } else if (!busLoanInfo.getChannel().equals("") && busLoanInfo.getChannel().equals("?")) { wordName = "??(?)" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "rongxintongyundaituisong12.ftl", savePath + File.separator, wordName); } //13 dataMap.put("surveyOrgName", StringUtil.getNotNullStr(busLoanInfo.getSurveyOrgName())); dataMap.put("surveyPersonName", StringUtil.getNotNullStr(busLoanInfo.getSurveyPersonName())); dataMap.put("surveyPhone", StringUtil.getNotNullStr(busLoanInfo.getSurveyPhone())); dataMap.put("applicationName", StringUtil.getNotNullStr(busLoanInfo.getApplicationName())); dataMap.put("applicationAmount", StringUtil.getNotNullStr(busLoanInfo.getApplicationAmount())); dataMap.put("applicationTerm", StringUtil.getNotNullStr(busLoanInfo.getApplicationTerm())); dataMap.put("loanType", StringUtil.getNotNullStr(busLoanInfo.getLoanType())); dataMap.put("urgentCont", StringUtil.getNotNullStr(busLoanInfo.getUrgentCont())); dataMap.put("urgentContPhone", StringUtil.getNotNullStr(busLoanInfo.getUrgentContPhone())); dataMap.put("taobaoTreeDiamondMore", StringUtil.getNotNullStr(busLoanInfo.getTaobaoTreeDiamondMore())); dataMap.put("otherPlatform", StringUtil.getNotNullStr(busLoanInfo.getOtherPlatform())); dataMap.put("operatingPeriodMore", StringUtil.getNotNullStr(busLoanInfo.getOperatingPeriodMore())); dataMap.put("ifShopOwner", StringUtil.getNotNullStr(busLoanInfo.getIfShopOwner())); dataMap.put("haveGuarantor", StringUtil.getNotNullStr(busLoanInfo.getHaveGuarantor())); dataMap.put("shopController", StringUtil.getNotNullStr(busLoanInfo.getShopController())); dataMap.put("salesOfMore", StringUtil.getNotNullStr(busLoanInfo.getSalesOfMore())); dataMap.put("than3credit", StringUtil.getNotNullStr(busLoanInfo.getThan3credit())); dataMap.put("notOverdue", StringUtil.getNotNullStr(busLoanInfo.getNotOverdue())); dataMap.put("perNotOverdue", StringUtil.getNotNullStr(busLoanInfo.getPerNotOverdue())); dataMap.put("shopName", StringUtil.getNotNullStr(busLoanInfoShop.getShopName())); dataMap.put("platformName", StringUtil.getNotNullStr(busLoanInfoShop.getPlatformName())); dataMap.put("shopLevel", StringUtil.getNotNullStr(busLoanInfoShop.getShopLevel())); dataMap.put("operatingPeriod", StringUtil.getNotNullStr(busLoanInfoShop.getOperatingPeriod())); dataMap.put("shopOwner", StringUtil.getNotNullStr(busLoanInfoShop.getShopOwner())); dataMap.put("businessOpera", StringUtil.getNotNullStr(busLoanInfoShop.getBusinessOpera())); dataMap.put("businessAddress", StringUtil.getNotNullStr(busLoanInfoShop.getBusinessAddress())); dataMap.put("warehouseAddress", StringUtil.getNotNullStr(busLoanInfoShop.getWarehouseAddress())); dataMap.put("salesIncome", StringUtil.getNotNullStr(busLoanInfoShop.getSalesIncome())); dataMap.put("totalLiability", StringUtil.getNotNullStr(busLoanInfoShop.getTotalLiability())); dataMap.put("bankLiabilities", StringUtil.getNotNullStr(busLoanInfoShop.getBankLiabilities())); dataMap.put("netProfit", StringUtil.getNotNullStr(busLoanInfoShop.getNetProfit())); dataMap.put("legalPerson", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("idCard", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("householdRegistration", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseholdRegistration())); dataMap.put("houseAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseAddress())); dataMap.put("legalPhone", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPhone())); dataMap.put("propertyQuantity", StringUtil.getNotNullStr(busLoanInfoLegal.getPropertyQuantity())); dataMap.put("totalArea", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalArea())); dataMap.put("totalValue", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalValue())); dataMap.put("mortgage", StringUtil.getNotNullStr(busLoanInfoLegal.getMortgage())); dataMap.put("propertyAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getPropertyAddress())); dataMap.put("totalCar", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalCar())); dataMap.put("licenseNumber", StringUtil.getNotNullStr(busLoanInfoLegal.getLicenseNumber())); dataMap.put("totalCarValue", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalCarValue())); dataMap.put("otherAssets", StringUtil.getNotNullStr(busLoanInfoLegal.getOtherAssets())); dataMap.put("borrowOfBank", StringUtil.getNotNullStr(busLoanInfoLegal.getBorrowOfBank())); dataMap.put("amount", StringUtil.getNotNullStr(busLoanInfoLegal.getAmount())); dataMap.put("theTerm", StringUtil.getNotNullStr(busLoanInfoLegal.getTheTerm())); dataMap.put("ifController", StringUtil.getNotNullStr(busLoanInfoLegal.getIfController())); if (busLoanInfoController != null && busLoanInfoLegal.getIfController().equals("?")) { dataMap.put("controllerName", StringUtil.getNotNullStr(busLoanInfoController.getControllerName())); dataMap.put("controllerIdCard", StringUtil.getNotNullStr(busLoanInfoController.getControllerIdCard())); dataMap.put("controllerRegistration", StringUtil.getNotNullStr(busLoanInfoController.getControllerRegistration())); dataMap.put("controllerHouseAddress", StringUtil.getNotNullStr(busLoanInfoController.getControllerHouseAddress())); dataMap.put("controllerPhone", StringUtil.getNotNullStr(busLoanInfoController.getControllerPhone())); dataMap.put("controllerPropertyQuantity", StringUtil.getNotNullStr(busLoanInfoController.getControllerPropertyQuantity())); dataMap.put("controllerTotalArea", StringUtil.getNotNullStr(busLoanInfoController.getControllerTotalArea())); dataMap.put("controllertotalValue", StringUtil.getNotNullStr(busLoanInfoController.getControllertotalValue())); dataMap.put("contrallerMortgage", StringUtil.getNotNullStr(busLoanInfoController.getContrallerMortgage())); dataMap.put("controllerPropertyAddress", StringUtil.getNotNullStr(busLoanInfoController.getControllerPropertyAddress())); dataMap.put("controllerTotalCar", StringUtil.getNotNullStr(busLoanInfoController.getControllerTotalCar())); dataMap.put("controllerLicenseNumber", StringUtil.getNotNullStr(busLoanInfoController.getControllerLicenseNumber())); dataMap.put("controllerTotalCarValue", StringUtil.getNotNullStr(busLoanInfoController.getControllerTotalCarValue())); dataMap.put("controllerOtherAssets", StringUtil.getNotNullStr(busLoanInfoController.getControllerOtherAssets())); dataMap.put("controllerBorrowOfBank", StringUtil.getNotNullStr(busLoanInfoController.getControllerBorrowOfBank())); dataMap.put("controllerAmount", StringUtil.getNotNullStr(busLoanInfoController.getControllerAmount())); dataMap.put("controllerTheTerm", StringUtil.getNotNullStr(busLoanInfoController.getControllerTheTerm())); } else { //?? dataMap.put("controllerName", StringUtil.getNotNullStr(busLoanInfoLegal.getLegalPerson())); dataMap.put("controllerIdCard", StringUtil.getNotNullStr(busLoanInfoLegal.getIdCard())); dataMap.put("controllerRegistration", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseholdRegistration())); dataMap.put("controllerHouseAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseAddress())); dataMap.put("controllerPhone", StringUtil.getNotNullStr(busLoanInfoLegal.getHouseAddress())); dataMap.put("controllerPropertyQuantity", StringUtil.getNotNullStr(busLoanInfoLegal.getPropertyQuantity())); dataMap.put("controllerTotalArea", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalArea())); dataMap.put("controllertotalValue", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalValue())); dataMap.put("contrallerMortgage", StringUtil.getNotNullStr(busLoanInfoLegal.getMortgage())); dataMap.put("controllerPropertyAddress", StringUtil.getNotNullStr(busLoanInfoLegal.getPropertyAddress())); dataMap.put("controllerTotalCar", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalCar())); dataMap.put("controllerLicenseNumber", StringUtil.getNotNullStr(busLoanInfoLegal.getLicenseNumber())); dataMap.put("controllerTotalCarValue", StringUtil.getNotNullStr(busLoanInfoLegal.getTotalCarValue())); dataMap.put("controllerOtherAssets", StringUtil.getNotNullStr(busLoanInfoLegal.getOtherAssets())); dataMap.put("controllerBorrowOfBank", StringUtil.getNotNullStr(busLoanInfoLegal.getBorrowOfBank())); dataMap.put("controllerAmount", StringUtil.getNotNullStr(busLoanInfoLegal.getAmount())); dataMap.put("controllerTheTerm", StringUtil.getNotNullStr(busLoanInfoLegal.getTheTerm())); } dataMap.put("ifGuaranter", StringUtil.getNotNullStr(busLoanInfo.getIfGuaranter())); dataMap.put("guaranterName", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterName())); dataMap.put("guaranterCard", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterCard())); dataMap.put("guaranterEmployer", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterEmployer())); dataMap.put("guaranterDuties", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterDuties())); dataMap.put("guaranterPhone", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterPhone())); dataMap.put("guaranterMaritalStatus", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterMaritalStatus())); dataMap.put("guaranterHouseAddress", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterHouseAddress())); dataMap.put("guaranterMonthlyIncome", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterMonthlyIncome())); dataMap.put("guaranterValues", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterValues())); dataMap.put("guaranterTotalLiabilities", StringUtil.getNotNullStr(busLoanInfoGuaranter.getGuaranterTotalLiabilities())); dataMap.put("localPaySocialSecurity", StringUtil.getNotNullStr(busLoanInfo.getLocalPaySocialSecurity())); dataMap.put("ifCustomersVIP", StringUtil.getNotNullStr(busLoanInfo.getIfCustomersVIP())); dataMap.put("childrenIfLocally", StringUtil.getNotNullStr(busLoanInfo.getChildrenIfLocally())); dataMap.put("additionInfo", StringUtil.getNotNullStr(busLoanInfo.getAdditionInfo())); wordName = "??" + DateUtil.getNowPlusTimeMill() + ".xls"; sign = createWords.create(dataMap, path, "shangdaidiaochabiao13.ftl", savePath + File.separator, wordName); } else { log.error("??"); return; } } catch (IOException e) { log.error(":" + e.getMessage()); } catch (Exception e) { log.error("?:" + e.getMessage()); } if (sign) { String saveZipPath = request.getSession().getServletContext().getRealPath( File.separator + "WEB-INF" + File.separator + "downloads" + File.separator + "ziptemp");//zip??,?? String zipSaveName = "word" + DateUtil.getNowPlusTimeMill() + ".zip";//?? String sourceFile = ZipUtil.fileToZip(savePath, saveZipPath, zipSaveName);//??zip?+?? //File file=new File(savePath+"\\",wordName);?zip if (sourceFile != null) { File file = new File(sourceFile); if (!file.exists()) { log.error("?"); return; } try { //MIME response.setContentType(request.getSession().getServletContext().getMimeType(zipSaveName)); //Content-Disposition response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(zipSaveName, "UTF-8")); //response.setHeader("content-disposition","attachment;filename"+URLEncoder.encode(wordName,"UTF-8")); FileInputStream in = new FileInputStream(sourceFile); OutputStream out = response.getOutputStream(); byte buffer[] = new byte[1024]; int len = 0; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } in.close(); out.close(); log.info("??"); } catch (IOException e) { log.error("IO" + e.getMessage()); } catch (Exception e) { log.error("" + e.getMessage()); } finally { if (file != null) { file.delete();//zip file = null; } } } } else { //sendFailureMessage(response, "word?,???"); log.error("word?,???"); } } /** * ?:? * */ @RequestMapping("/createWords") public void createWords(Integer id, String wordType, String filePath, HttpServletRequest request, HttpServletResponse response) throws Exception { if (id == null || wordType.equals("")) { sendFailureMessage(response, "????~?"); return; } BusLoanInfo busLoanInfo = this.busLoanInfoService.queryById(id); if (busLoanInfo == null) { sendFailureMessage(response, "~?"); return; } Map<String, Object> dataMap = new HashMap<String, Object>(); //String path=request.getRealPath("/")+"wordsTemplate"+"\\daihouxuzhi.ftl"; String path = File.separator + "com" + File.separator + "dayuan" + File.separator + "template" + File.separator;//?? String outFilePath = "";//?? if (filePath.equals("")) { outFilePath = "D:" + File.separator + "createWords" + File.separator; } else { outFilePath = filePath + File.separator; } File file = new File(outFilePath); if (!file.exists()) { file.mkdirs(); } if (!file.isDirectory()) { sendFailureMessage(response, "word???"); return; } CreateWords createWords = new CreateWords(); boolean sign = false; String wordName = "";//??? if (wordType.equals("0")) { String tempName1 = ""; String tempName2 = ""; dataMap.put("xingming", busLoanInfo.getApplicationName()); dataMap.put("xingming2", busLoanInfo.getApplicationName()); dataMap.put("dianhua", busLoanInfo.getSurveyPhone()); tempName1 = "?" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "dianshangdaihouxuzhi.ftl", outFilePath, tempName1); if (dataMap.get("xingming") != null) { dataMap.remove("xingming"); } /*dataMap.put("xingming",busLoanInfo.getLegalPerson()); dataMap.put("xingbie", busLoanInfo.getGender()); dataMap.put("shenfenzheng", busLoanInfo.getIdCard()); dataMap.put("gongsimingcheng", busLoanInfo.getCompanyName());*/ dataMap.put("nian", DateUtil.getNowYear()); dataMap.put("yue", DateUtil.getNowMonth()); dataMap.put("ri", DateUtil.getNowDay()); tempName2 = "" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "qianziyangben.ftl", outFilePath, tempName2); wordName = tempName1 + "," + tempName2; } else if (wordType.equals("1")) { dataMap.put("xingming", busLoanInfo.getApplicationName()); wordName = "?" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "dianshangdaihouxuzhi.ftl", outFilePath, wordName); } else if (wordType.equals("2")) { /* dataMap.put("xingming",busLoanInfo.getLegalPerson()); dataMap.put("xingbie", busLoanInfo.getGender()); dataMap.put("shenfenzheng", busLoanInfo.getIdCard()); dataMap.put("gongsimingcheng", busLoanInfo.getCompanyName());*/ dataMap.put("nian", DateUtil.getNowYear()); dataMap.put("yue", DateUtil.getNowMonth()); dataMap.put("ri", DateUtil.getNowDay()); wordName = "" + DateUtil.getNowPlusTimeMill() + ".doc"; sign = createWords.create(dataMap, path, "qianziyangben.ftl", outFilePath, wordName); } else { sendFailureMessage(response, "??"); return; } if (file != null) { file = null; } if (sign) { sendSuccessMessage(response, "word?????" + wordName); } else { sendFailureMessage(response, "word?,???"); } System.out.println("createWords....end"); } }