Commit 55e54eb4 authored by dahai's avatar dahai

修改查询EXCEL格口信息

parent ad8e73a8
...@@ -194,7 +194,7 @@ public class ExportXMLApi { ...@@ -194,7 +194,7 @@ public class ExportXMLApi {
* @param str 原始字符串 * @param str 原始字符串
* @return 返回新的字符串 * @return 返回新的字符串
*/ */
public static String replaceNullString(String str) { private String replaceNullString(String str) {
if (str == null) return ""; if (str == null) return "";
else return str; else return str;
} }
......
...@@ -175,7 +175,7 @@ public class ReadExcelApi { ...@@ -175,7 +175,7 @@ public class ReadExcelApi {
*/ */
@RequestMapping("queryPersonPost") @RequestMapping("queryPersonPost")
public String queryPersonPost(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, @RequestParam("currPage") String currPage,@RequestParam("pageSize") String pageSize, HttpServletResponse resp) { public String queryPersonPost(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, @RequestParam("currPage") String currPage,@RequestParam("pageSize") String pageSize, HttpServletResponse resp) {
List<FileNameDicEntity> fileNameDicEntities = fileNameDicService.queryFileNameDic(uploadDate,fileName, Long.valueOf(analysisState), Long.valueOf(currPage), Long.valueOf(pageSize)); List<FileNameDicEntity> fileNameDicEntities = fileNameDicService.queryFileNameDic(uploadDate,replaceNullString(fileName), Long.valueOf(analysisState), Long.valueOf(currPage), Long.valueOf(pageSize));
YXJSONResponse yxjsonResponse = new YXJSONResponse(); YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(fileNameDicEntities); yxjsonResponse.outPutSuccess(fileNameDicEntities);
...@@ -191,7 +191,7 @@ public class ReadExcelApi { ...@@ -191,7 +191,7 @@ public class ReadExcelApi {
*/ */
@RequestMapping("queryPersonPostCount") @RequestMapping("queryPersonPostCount")
public String queryPersonPostCount(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, HttpServletResponse resp) { public String queryPersonPostCount(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, HttpServletResponse resp) {
int i = fileNameDicService.queryFileNameDicCount(uploadDate, fileName, Long.valueOf(analysisState)); int i = fileNameDicService.queryFileNameDicCount(uploadDate,replaceNullString(fileName), Long.valueOf(analysisState));
YXJSONResponse yxjsonResponse = new YXJSONResponse(); YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(i+""); yxjsonResponse.outPutSuccess(i+"");
...@@ -202,4 +202,15 @@ public class ReadExcelApi { ...@@ -202,4 +202,15 @@ public class ReadExcelApi {
return str.replace("-",""); return str.replace("-","");
} }
/**
* 字符串去除空格
* @param str 原始字符串
* @return 返回新的字符串
*/
private String replaceNullString(String str) {
if (str == ""){
return null;
} else return str;
}
} }
\ No newline at end of file
...@@ -158,4 +158,14 @@ public class ReadXmlApi { ...@@ -158,4 +158,14 @@ public class ReadXmlApi {
return str.replace("-",""); return str.replace("-","");
} }
/**
* 字符串去除空格
* @param str 原始字符串
* @return 返回新的字符串
*/
private String replaceNullString(String str) {
if (str == ""){
return null;
} else return str;
}
} }
...@@ -50,7 +50,7 @@ public interface FileNameDicMapper { ...@@ -50,7 +50,7 @@ public interface FileNameDicMapper {
" and FILE_NAME =#{fileName}" + " and FILE_NAME =#{fileName}" +
"</if>" + "</if>" +
" </where>" + " </where>" +
"and ROWNUM less then #{maxNum} ) where rn more then #{minNum} " + " ) where rn BETWEEN #{minNum} and #{maxNum} " +
"</script>") "</script>")
public List<FileNameDicEntity> queryFileNameDic(@Param("uploadDate")String uploadDate,@Param("fileName") String fileName, @Param("analysisState") long analysisState, @Param("maxNum") long maxNum, @Param("minNum") long minNum); public List<FileNameDicEntity> queryFileNameDic(@Param("uploadDate")String uploadDate,@Param("fileName") String fileName, @Param("analysisState") long analysisState, @Param("maxNum") long maxNum, @Param("minNum") long minNum);
...@@ -66,10 +66,10 @@ public interface FileNameDicMapper { ...@@ -66,10 +66,10 @@ public interface FileNameDicMapper {
" and STATE =#{analysisState}" + " and STATE =#{analysisState}" +
"</if>" + "</if>" +
"<if test='uploadDate !=null' >" + "<if test='uploadDate !=null' >" +
" and to_char(UPLOAD_DATE,'yyyyMMdd') =#{uploadDate}" + " and to_char(UPLOAD_DATE,'yyyyMMdd') = #{uploadDate}" +
"</if>" + "</if>" +
"<if test='fileName != null ' >" + "<if test='fileName != null ' >" +
" and FILE_NAME =#{fileName}" + " and FILE_NAME = #{fileName}" +
"</if> </where> </script>") "</if> </where> </script>")
public List<FileNameDicEntity> queryFileNameDicCount(@Param("uploadDate")String uploadDate,@Param("fileName") String fileName, @Param("analysisState") long analysisState); public List<FileNameDicEntity> queryFileNameDicCount(@Param("uploadDate")String uploadDate,@Param("fileName") String fileName, @Param("analysisState") long analysisState);
......
...@@ -25,8 +25,8 @@ public interface FilesMapper { ...@@ -25,8 +25,8 @@ public interface FilesMapper {
"<if test=\"importDate !=null\">"+ "<if test=\"importDate !=null\">"+
" and to_char(FILES.UPLOAD_DATE,'yyyyMMdd')= #{importDate}" + " and to_char(FILES.UPLOAD_DATE,'yyyyMMdd')= #{importDate}" +
"</if> "+ "</if> "+
"group by FILES.upload_date,FILES.ID) where ROWNUM less then #{maxNum} group by upload_date" + "group by FILES.upload_date,FILES.ID) group by upload_date" +
") where rn more then #{minNum} </script>") ") where rn BETWEEN #{minNum} and #{maxNum} </script>")
public List<CountDataEntity> selectFiles(@Param("importDate") String importDate,@Param("maxNum")long maxNum,@Param("minNum")long minNum); public List<CountDataEntity> selectFiles(@Param("importDate") String importDate,@Param("maxNum")long maxNum,@Param("minNum")long minNum);
@Select({"<script>"+ @Select({"<script>"+
......
...@@ -25,12 +25,12 @@ public class FileNameDicServiceImpl implements FileNameDicService { ...@@ -25,12 +25,12 @@ public class FileNameDicServiceImpl implements FileNameDicService {
@Override @Override
public List<FileNameDicEntity> queryFileNameDic(String uploadDate,String fileName, long analysisState, long currPage, long pageSize) { public List<FileNameDicEntity> queryFileNameDic(String uploadDate,String fileName, long analysisState, long currPage, long pageSize) {
fileNameDicMapper.queryFileNameDic(uploadDate, fileName, analysisState, currPage * pageSize, (currPage - 1) * pageSize + 1);
return fileNameDicMapper.queryFileNameDic(uploadDate,fileName, analysisState, currPage*pageSize,(currPage-1)*pageSize+1 ); return fileNameDicMapper.queryFileNameDic(uploadDate,fileName, analysisState, currPage*pageSize,(currPage-1)*pageSize+1 );
// return null; // return null;
} }
@Override @Override
public int queryFileNameDicCount(String uploadDate,String fileName, long analysisState) { public int queryFileNameDicCount(String uploadDate,String fileName, long analysisState) {
// return 2;
return fileNameDicMapper.queryFileNameDicCount(uploadDate,fileName, analysisState ).size(); return fileNameDicMapper.queryFileNameDicCount(uploadDate,fileName, analysisState ).size();
} }
......
...@@ -53,15 +53,58 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -53,15 +53,58 @@ public class TaskListServiceImpl implements TaskListService {
@Override @Override
public List<Object> selectByCountyAtACCU(String date) { public List<Object> selectByCountyAtACCU(String date) {
List<Map<String, Object>> maps = taskListMapper.selectByCountyAtACCU(date); List<Map<String, Object>> maps = taskListMapper.selectByCountyAtACCU(date);
List<Map<String,Object>> list = new ArrayList<>(); List list = new ArrayList();
Map<String,Object> typeMap = new LinkedHashMap<>();
for (Map o :maps){ for (Map o :maps){
//TODO 组合JSON //TODO 组合JSON
if (typeMap.containsKey(o.get("CARD_TYPE")+"")){
List<Map<String,Object>> mapList= (List<Map<String,Object>>)typeMap.get("CARD_TYPE");
mapList.add(o);
typeMap.put(o.get("CARD_TYPE")+"",mapList);
}else {
List<Map<String,Object>> mapList = new ArrayList<>();
mapList.add(o);
typeMap.put(o.get("CARD_TYPE")+"",mapList);
}
}
for (String type:typeMap.keySet()){
Map<String,Object> typeMapList = new LinkedHashMap<>();
List<Map<String,Object>> typeList = new ArrayList<>();
List<Map<String,Object>> mapList = (List<Map<String,Object>>)typeMap.get(type);
int typeSum =0;
for (Map o:mapList) {
typeSum+=Integer.valueOf(o.get("VALID_COUNT") + "");
Map<String,Object> countyMap = new LinkedHashMap<>(); Map<String,Object> countyMap = new LinkedHashMap<>();
countyMap.containsKey((Map<String,Object>)o); if (countyMap.containsKey(o.get("COUNTYNAME")+"")){
List<Map<String,Object>> countyList= (List<Map<String,Object>>)countyMap.get("CARD_TYPE");
countyList.add(o);
Integer valid_count = Integer.valueOf(o.get("VALID_COUNT") + "");
valid_count+=Integer.valueOf(countyMap.get("countyValidCount").toString());
Integer invalid_count = Integer.valueOf(o.get("INVALID_COUNT") + "");
invalid_count+=Integer.valueOf(countyMap.get("countyInvalidCount").toString());
countyMap.put(o.get("COUNTYNAME")+"",countyList);
countyMap.put("countyValidCount",valid_count);
countyMap.put("countyInvalidCount",invalid_count);
}else {
List<Map<String,Object>> countyList = new ArrayList<>();
countyList.add(o);
countyMap.put(o.get("COUNTYNAME")+"",countyList);
countyMap.put("countyValidCount",Integer.valueOf(o.get("VALID_COUNT")+""));
countyMap.put("countyInvalidCount",Integer.valueOf(o.get("INVALID_COUNT")+""));
}
countyMap.put("countyList",o);
typeList.add(countyMap);
}
typeMapList.put("typeName",type);
typeMapList.put("typeSum",typeSum);
typeMapList.put("typeList",typeList);
list.add(typeMapList);
} }
System.out.println(maps.toString()+"---------"); System.out.println(maps.toString()+"---------");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment