Commit 30042f5e authored by wuzhilong's avatar wuzhilong

页面调整

parent cec94096
...@@ -5,6 +5,7 @@ import com.yxproject.start.entity.PersonPostEntity; ...@@ -5,6 +5,7 @@ import com.yxproject.start.entity.PersonPostEntity;
import com.yxproject.start.service.PersonPostService; import com.yxproject.start.service.PersonPostService;
import com.yxproject.start.utils.Excel; import com.yxproject.start.utils.Excel;
import com.yxproject.start.utils.ExportExcel; import com.yxproject.start.utils.ExportExcel;
import com.yxproject.start.utils.ReadExcel;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
...@@ -114,13 +115,14 @@ public class PersonPostApi { ...@@ -114,13 +115,14 @@ public class PersonPostApi {
*/ */
@RequestMapping("uploadCancelPost") @RequestMapping("uploadCancelPost")
@Transactional @Transactional
public boolean uploadCancelPost(@RequestParam("importName") String importName,HttpServletRequest requ) { public List<Map<String, Object>> uploadCancelPost(@RequestParam("importName") String importName,HttpServletRequest requ) {
String remoteAddr = requ.getRemoteAddr(); String remoteAddr = requ.getRemoteAddr();
MDC.put("ip", remoteAddr); MDC.put("ip", remoteAddr);
String filename = ""; String filename = "";
String name = requ.getParameter("importName"); String name = requ.getParameter("importName");
DiskFileItemFactory factory = new DiskFileItemFactory(); DiskFileItemFactory factory = new DiskFileItemFactory();
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> map = new LinkedHashMap<>();
// 设置缓冲区的大小为100KB,如果不指定,那么缓冲区的大小默认是10KB // 设置缓冲区的大小为100KB,如果不指定,那么缓冲区的大小默认是10KB
factory.setSizeThreshold(1024 * 100); factory.setSizeThreshold(1024 * 100);
ServletFileUpload upload = new ServletFileUpload(factory); ServletFileUpload upload = new ServletFileUpload(factory);
...@@ -131,7 +133,7 @@ public class PersonPostApi { ...@@ -131,7 +133,7 @@ public class PersonPostApi {
upload.setSizeMax(1024 * 1024 * 4000); upload.setSizeMax(1024 * 1024 * 4000);
// 将普通属性存入map中,之后调用 // 将普通属性存入map中,之后调用
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
int rows=0;
//将当前上下文初始化给 CommonsMutipartResolver (多部分解析器) //将当前上下文初始化给 CommonsMutipartResolver (多部分解析器)
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver( CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(
requ.getServletContext()); requ.getServletContext());
...@@ -150,22 +152,37 @@ public class PersonPostApi { ...@@ -150,22 +152,37 @@ public class PersonPostApi {
try { try {
file = File.createTempFile("prefix", "_" + item.getOriginalFilename()); file = File.createTempFile("prefix", "_" + item.getOriginalFilename());
item.transferTo(file); item.transferTo(file);
list = Excel.rearXlsAndXlsx(file, filename); // list = Excel.rearXlsAndXlsx(file, filename);
for (int i = 0; i < list.size(); i++) { ReadExcel readExcel = new ReadExcel();
Map<String, Object> noteMap = list.get(i); List listStr = readExcel.readExcelInvalidOrder(file);
String uploadNo = noteMap.get("身份证受理号").toString(); int num=0;
String note = noteMap.get("审核错误类型").toString(); //直接从第3行开始
personPostService.cancelPostByAcceptNo(uploadNo, note, name); for (int i = 3; i < listStr.size(); i++) {
List lists = (List)listStr.get(i);
rows=i;
String uploadNo = lists.get(1)+"";
String note =lists.get(10)+"";
List<Map<String, Object>> resultMap=personPostService.checkPersonalPost(uploadNo);
if (resultMap.size()>0){
personPostService.cancelPostByAcceptNo(uploadNo, note, name);
num++;
}
} }
return true; int countRows=listStr.size()-3;
map.put("msg","文件成功解析 "+countRows+" 条数据,数据匹配出 "+num+" 条无效邮寄订单。");
map.put("stats",true);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return false; map.put("msg","导入异常,请检查 "+rows+" 行数据。"+e);
map.put("stats",false);
}finally {
resultList.add(map);
} }
} }
} }
} }
return false; return resultList;
} }
......
...@@ -31,7 +31,7 @@ public interface PersonPostMapper { ...@@ -31,7 +31,7 @@ public interface PersonPostMapper {
@Select("<script> " + @Select("<script> " +
"SELECT DISTINCT * FROM " + "SELECT DISTINCT B.*,substr(B.first_white,-13) FROM " +
"( " + "( " +
"SELECT A.*, ROWNUM RN " + "SELECT A.*, ROWNUM RN " +
" from (SELECT DISTINCT PERSON_POST.*" + " from (SELECT DISTINCT PERSON_POST.*" +
...@@ -51,10 +51,11 @@ public interface PersonPostMapper { ...@@ -51,10 +51,11 @@ public interface PersonPostMapper {
" <when test='getToCounty!=\"\"'> and PERSON_POST.GET_TO_COUNTY in ( ${getToCounty}) </when>" + " <when test='getToCounty!=\"\"'> and PERSON_POST.GET_TO_COUNTY in ( ${getToCounty}) </when>" +
" <when test='startDate!=\"\"'> and subStr(FILE_NAME_DIC.UPLOAD_DATE,0,8) between ${startDate} and ${endDate} </when>" + " <when test='startDate!=\"\"'> and subStr(FILE_NAME_DIC.UPLOAD_DATE,0,8) between ${startDate} and ${endDate} </when>" +
" <when test='printDate!=\"\"'> and to_char(PERSON_POST.print_Date,'yyyyMMdd') = ${printDate} </when>" + " <when test='printDate!=\"\"'> and to_char(PERSON_POST.print_Date,'yyyyMMdd') = ${printDate} </when>" +
"order by substr(PERSON_POST.first_white,10,13) ) " + "order by substr(PERSON_POST.first_white,-13) ) " +
"A" + "A" +
")" + ") B " +
"WHERE RN BETWEEN ${pageSize} AND ${firstIndex}" + "WHERE RN BETWEEN ${pageSize} AND ${firstIndex}" +
" order by rn " +
"</script>") "</script>")
public List <PersonPostEntity> findAllPersonalData( @Param("applicantName") String applicantName, @Param("orderNumber") String orderNumber, @Param("state") String state, @Param("latticeMouthInformation") String latticeMouthInformation, @Param("getToCounty") String getToCounty, @Param("startDate") String startDate,@Param("endDate") String endDate, @Param("firstIndex") long firstIndex, @Param("pageSize") long pageSize, @Param("emailNo") String emailNo, @Param("notNull") int notNull , @Param("printDate") String printDate); public List <PersonPostEntity> findAllPersonalData( @Param("applicantName") String applicantName, @Param("orderNumber") String orderNumber, @Param("state") String state, @Param("latticeMouthInformation") String latticeMouthInformation, @Param("getToCounty") String getToCounty, @Param("startDate") String startDate,@Param("endDate") String endDate, @Param("firstIndex") long firstIndex, @Param("pageSize") long pageSize, @Param("emailNo") String emailNo, @Param("notNull") int notNull , @Param("printDate") String printDate);
......
...@@ -70,6 +70,65 @@ public class ReadExcel { ...@@ -70,6 +70,65 @@ public class ReadExcel {
String cellinfo = sheet.getCell(j, i).getContents(); String cellinfo = sheet.getCell(j, i).getContents();
// if(cellinfo.isEmpty()){ // if(cellinfo.isEmpty()){
// continue; // continue;
// }
innerList.add(cellinfo);
}
outerList.add(i, innerList);
}
return outerList;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (BiffException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
// 去读Excel的方法readExcel,该方法的入口参数为一个File对象
public List readExcelInvalidOrder(File file) {
try {
// // 创建输入流,读取Excel
// InputStream is = new FileInputStream(file.getAbsolutePath());
// jxl提供的Workbook类
Workbook wb = Workbook.getWorkbook(file);
// Excel的页签数量
int sheet_size = wb.getNumberOfSheets();
for (int index = 0; index < sheet_size; index++) {
List<List> outerList=new ArrayList<List>();
// 每个页签创建一个Sheet对象
Sheet sheet = wb.getSheet(index);
// sheet.getRows()返回该页的总行数
for (int i = 0; i < sheet.getRows(); i++) {
List innerList=new ArrayList();
String columns0 = sheet.getCell(0,i).getContents();
String columns1 = sheet.getCell(1,i).getContents();
String columns2 = sheet.getCell(2,i).getContents();
String columns3 = sheet.getCell(3,i).getContents();
String columns4 = sheet.getCell(4,i).getContents();
String columns5 = sheet.getCell(5,i).getContents();
String columns6 = sheet.getCell(6,i).getContents();
String columns7 = sheet.getCell(7,i).getContents();
String columns8 = sheet.getCell(8,i).getContents();
String columns9 = sheet.getCell(9,i).getContents();
String columns10 = sheet.getCell(10,i).getContents();
String columns11 = sheet.getCell(11,i).getContents();
String columns12 = sheet.getCell(12,i).getContents();
String columns13 = sheet.getCell(13,i).getContents();
String columns14 = sheet.getCell(14,i).getContents();
String columns15 = sheet.getCell(15,i).getContents();
if (columns0.equals("")&&columns1.equals("")&&columns2.equals("")&&columns3.equals("")&&
columns4.equals("")&&columns5.equals("")&&columns6.equals("")&&columns7.equals("")&&
columns8.equals("")&&columns9.equals("")&&columns10.equals("")&&columns11.equals("")&&columns12.equals("")&&
columns13.equals("")&&columns14.equals("")&&columns15.equals("")){
continue;
}
// sheet.getColumns()返回该页的总列数
for (int j = 0; j < sheet.getColumns(); j++) {
String cellinfo = sheet.getCell(j, i).getContents();
// if(cellinfo.isEmpty()){
// continue;
// } // }
innerList.add(cellinfo); innerList.add(cellinfo);
} }
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</td> </td>
<td> <td>
<div style="float: left"> <div style="float: left">
<button class="btn btn-primary" ng-click="uploadFile()">导入</button> <button class="btn btn-primary" ng-disabled="checkThis" ng-click="uploadFile()">提交文件</button>
</div> </div>
</td> </td>
</tr> </tr>
......
...@@ -106,7 +106,6 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http']) ...@@ -106,7 +106,6 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http'])
$scope.updatemsg=data; $scope.updatemsg=data;
//重新加载数据 //重新加载数据
if (data[0].STATIC){ if (data[0].STATIC){
console.log("重新加载数据")
$scope.aselectAF(); $scope.aselectAF();
} }
}) })
...@@ -115,9 +114,10 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http']) ...@@ -115,9 +114,10 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http'])
}); });
}); });
}; };
$scope.checkThis=false;
//上传审核不通过文件 //上传审核不通过文件
$scope.uploadFile = function () { $scope.uploadFile = function () {
$scope.checkThis=true;
var importName = $rootScope.loginData.name; var importName = $rootScope.loginData.name;
var fd = new FormData(); var fd = new FormData();
var files = document.querySelector('input#fileAF').files; var files = document.querySelector('input#fileAF').files;
...@@ -132,18 +132,19 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http']) ...@@ -132,18 +132,19 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http'])
width: 600, width: 600,
cache: false, cache: false,
closeByDocument:false, closeByDocument:false,
controller: ['$scope', function ($scope) { controller: ['$scope','HttpService','MessageService',function ($scope,HttpService,MessageService) {
$scope.wrongMsg =-1; $scope.wrongMsg =-1;
$scope.msgText = "上传中,请稍等..."; $scope.msgText = "上传中,请稍等...";
console.log(fd,importName);
HttpService.uploadCancelPost(fd,importName,function (data) { HttpService.uploadCancelPost(fd,importName,function (data) {
$scope.msgText = data; $scope.checkThis=false;
console.log(data) if(data[0].stats){
// if(data){ $scope.msgText = data[0].msg;
// $scope.closeThisDialog(); //重新加载数据
// }else{ $scope.aselectAF();
// $scope.wrongMsg = '上传失败'; console.log("------")
// } }else{
$scope.wrongMsg =data[0].msg;
}
}) })
}] }]
}); });
......
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