Commit 30042f5e authored by wuzhilong's avatar wuzhilong

页面调整

parent cec94096
......@@ -5,6 +5,7 @@ import com.yxproject.start.entity.PersonPostEntity;
import com.yxproject.start.service.PersonPostService;
import com.yxproject.start.utils.Excel;
import com.yxproject.start.utils.ExportExcel;
import com.yxproject.start.utils.ReadExcel;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
......@@ -114,13 +115,14 @@ public class PersonPostApi {
*/
@RequestMapping("uploadCancelPost")
@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();
MDC.put("ip", remoteAddr);
String filename = "";
String name = requ.getParameter("importName");
DiskFileItemFactory factory = new DiskFileItemFactory();
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> map = new LinkedHashMap<>();
// 设置缓冲区的大小为100KB,如果不指定,那么缓冲区的大小默认是10KB
factory.setSizeThreshold(1024 * 100);
ServletFileUpload upload = new ServletFileUpload(factory);
......@@ -131,7 +133,7 @@ public class PersonPostApi {
upload.setSizeMax(1024 * 1024 * 4000);
// 将普通属性存入map中,之后调用
List<Map<String, Object>> list = new ArrayList<>();
int rows=0;
//将当前上下文初始化给 CommonsMutipartResolver (多部分解析器)
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(
requ.getServletContext());
......@@ -150,22 +152,37 @@ public class PersonPostApi {
try {
file = File.createTempFile("prefix", "_" + item.getOriginalFilename());
item.transferTo(file);
list = Excel.rearXlsAndXlsx(file, filename);
for (int i = 0; i < list.size(); i++) {
Map<String, Object> noteMap = list.get(i);
String uploadNo = noteMap.get("身份证受理号").toString();
String note = noteMap.get("审核错误类型").toString();
personPostService.cancelPostByAcceptNo(uploadNo, note, name);
// list = Excel.rearXlsAndXlsx(file, filename);
ReadExcel readExcel = new ReadExcel();
List listStr = readExcel.readExcelInvalidOrder(file);
int num=0;
//直接从第3行开始
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) {
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 {
@Select("<script> " +
"SELECT DISTINCT * FROM " +
"SELECT DISTINCT B.*,substr(B.first_white,-13) FROM " +
"( " +
"SELECT A.*, ROWNUM RN " +
" from (SELECT DISTINCT PERSON_POST.*" +
......@@ -51,10 +51,11 @@ public interface PersonPostMapper {
" <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='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" +
")" +
") B " +
"WHERE RN BETWEEN ${pageSize} AND ${firstIndex}" +
" order by rn " +
"</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);
......
......@@ -70,6 +70,65 @@ public class ReadExcel {
String cellinfo = sheet.getCell(j, i).getContents();
// if(cellinfo.isEmpty()){
// 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);
}
......
......@@ -50,7 +50,7 @@
</td>
<td>
<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>
</td>
</tr>
......
......@@ -106,7 +106,6 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http'])
$scope.updatemsg=data;
//重新加载数据
if (data[0].STATIC){
console.log("重新加载数据")
$scope.aselectAF();
}
})
......@@ -115,9 +114,10 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http'])
});
});
};
$scope.checkThis=false;
//上传审核不通过文件
$scope.uploadFile = function () {
$scope.checkThis=true;
var importName = $rootScope.loginData.name;
var fd = new FormData();
var files = document.querySelector('input#fileAF').files;
......@@ -132,18 +132,19 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http'])
width: 600,
cache: false,
closeByDocument:false,
controller: ['$scope', function ($scope) {
controller: ['$scope','HttpService','MessageService',function ($scope,HttpService,MessageService) {
$scope.wrongMsg =-1;
$scope.msgText = "上传中,请稍等...";
console.log(fd,importName);
HttpService.uploadCancelPost(fd,importName,function (data) {
$scope.msgText = data;
console.log(data)
// if(data){
// $scope.closeThisDialog();
// }else{
// $scope.wrongMsg = '上传失败';
// }
$scope.checkThis=false;
if(data[0].stats){
$scope.msgText = data[0].msg;
//重新加载数据
$scope.aselectAF();
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