@Override public void showImportObject(String filePath) throws Exception { // TODO Auto-generated method stub String path = filePath.replace("\\", "\\\\").replace("C:\\\\fakepath", "D:\\kjcoutput"); Workbook workbook = Workbook.getWorkbook(new File(path)); Sheet sheet = workbook.getSheet(0); int rows = sheet.getRows(); for (int i = 1; i < rows; i++) { Wqwqxkzxq1 wqwqxkzxq1 = new Wqwqxkzxq1(); wqwqxkzxq1.setXh(sheet.getCell(0, i).getContents()); wqwqxkzxq1.setZymc(sheet.getCell(1, i).getContents()); wqwqxkzxq1.setBz(sheet.getCell(2, i).getContents()); wqwqxkzxq1.setJlnf(sheet.getCell(3, i).getContents()); // xzxzgzb.setJlnf(sheet.getCell(13, i).getContents()); wqwqxkzxq1.setUsername(formListTemp.get(0).getUsername()); wqwqxkzxq1.setGxsj(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); wqwqxkzxq1.setSubmit(0); // xzxzgzb.setUsername(); wqwqxkzxq1Dao.save(wqwqxkzxq1); } workbook.close(); }
public void saveObject(Wqwqxkzxq1Form wqwqxkzxq1Form, String username) { Wqwqxkzxq1 wqwqxkzxq1 = new Wqwqxkzxq1(); wqwqxkzxq1.setXh(wqwqxkzxq1Form.getXh()); wqwqxkzxq1.setZymc(wqwqxkzxq1Form.getZymc()); wqwqxkzxq1.setBz(wqwqxkzxq1Form.getBz()); wqwqxkzxq1.setJlnf(String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); wqwqxkzxq1.setUsername(username); wqwqxkzxq1.setGxsj(new Date().toString()); wqwqxkzxq1.setSubmit(0); wqwqxkzxq1Dao.save(wqwqxkzxq1); }