|
@@ -99,8 +99,8 @@ public class DataMaintenanceController extends BaseController {
|
|
|
@ResponseBody
|
|
|
@RequiresPermissions("sg:settlement:import")
|
|
|
@RequestMapping(value = "importsel")
|
|
|
- public Map<String, Object> importSelect(@RequestParam("file")MultipartFile file, MaintainData maintainData, HttpServletResponse response, HttpServletRequest request, HttpSession session) throws IOException, InvalidFormatException {
|
|
|
-// try {
|
|
|
+ public Map<String, Object> importSelect(@RequestParam("file")MultipartFile file, MaintainData maintainData, HttpServletResponse response, HttpServletRequest request, HttpSession session){
|
|
|
+ try {
|
|
|
ImportExcel importExcel = new ImportExcel(file, 1, 0);
|
|
|
int lastRow = importExcel.getLastDataRowNum();
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
@@ -113,16 +113,16 @@ public class DataMaintenanceController extends BaseController {
|
|
|
}
|
|
|
String st = stringBuilder.toString();
|
|
|
String sts = st.substring(0,st.length()-1);
|
|
|
+ //把id作为key,把查询条件存入session
|
|
|
String id = UserUtils.getUser().getId();
|
|
|
session.setAttribute(id,st);
|
|
|
String[] strs = st.split(" ");
|
|
|
maintainData.setProjectIds(strs);
|
|
|
Page<MaintainData> page = dataMaintenanceService.findPage(new Page<MaintainData>(request, response), maintainData);
|
|
|
return getBootstrapData(page);
|
|
|
-// return "redirect:/a/sg/settlement/data";
|
|
|
-// }catch (Exception e){
|
|
|
-// return null;
|
|
|
-// }
|
|
|
+ }catch (Exception e){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
/**
|
|
|
* 查看,增加,编辑表单页面
|
|
@@ -253,7 +253,9 @@ public class DataMaintenanceController extends BaseController {
|
|
|
return j;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ *excel文件数据读取
|
|
|
+ */
|
|
|
private List<MaintainData> getData(ImportExcel importExcel) throws ParseException {
|
|
|
int lastRow = importExcel.getLastDataRowNum();
|
|
|
List<MaintainData> list = new ArrayList<>();
|
|
@@ -288,6 +290,9 @@ public class DataMaintenanceController extends BaseController {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *获取excel double类型的值
|
|
|
+ */
|
|
|
private double getDouble(ImportExcel importExcel,Row row,int col){
|
|
|
double d = 0.00;
|
|
|
Object o = importExcel.getCellValue(row,col);
|
|
@@ -297,7 +302,9 @@ public class DataMaintenanceController extends BaseController {
|
|
|
return d;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ *获取excel date类型的值
|
|
|
+ */
|
|
|
private Date getDate(ImportExcel importExcel,Row row,int col) throws ParseException {
|
|
|
Date d = null;
|
|
|
Object o = importExcel.getCellValue(row,col);
|