public void upload() throws Exception { int total = 0; int count = 0; int num = 0; response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); User user = (User) getSessionAttribute("user"); int userId = user.getId();
XlsMain xlsMain = new XlsMain(); if(!Policy.SPECIAL_STRATEGY.equals(xlsMain.getSheetName(upload.getAbsolutePath()))){ out.print("fileError;" + total + ";" + num + ";" + count); out.close(); return; }
total = strategys.size(); for (Strategys s : strategys) { if (strategyService.checkRepeatStrategyName(userId, s.getSname(), s .getStype())) {// 判断用户的策略是否重复 System.out.println("KaijiangAction === 该用户已有此同名的特殊策略"); count++; continue; } s.setUserid(userId); strategyService.saveStrategy(s); } num = total - count;
out.print("success;" + total + ";" + num + ";" + count); out.close();