Commit 053af0c5 authored by wuzhilong's avatar wuzhilong

不合格邮寄订单下载

parent 3e6b5362
......@@ -538,7 +538,7 @@ public class PersonPostApi {
HSSFRow row = sheet.createRow(i + 1);
PersonPostEntity personPostEntity = records.get(i);
HSSFCell cell = row.createCell(0);
cell.setCellValue(personPostEntity.getId());
cell.setCellValue(personPostEntity.getOrderNumber());
cell = row.createCell(1);
cell.setCellValue("人口管理总队");
cell = row.createCell(2);
......@@ -716,4 +716,120 @@ public class PersonPostApi {
logger.error("Exception 创建报表异常", e);
}
}
@RequestMapping("downLoadInvalidOrder")
public void exportInvalidOrderExcel(HttpServletRequest request, HttpServletResponse response,
@RequestParam("beginDate") String beginDate,@RequestParam("endDate") String endDate) throws Exception {
String remoteAddr = request.getRemoteAddr();
MDC.put("ip", remoteAddr);
JSONArray jsonArray = new JSONArray();
try {
List<Map<String,Object>> list = personPostService.selectCancelPost(replaceDate(beginDate),replaceDate(endDate));
exportInvalidOrder(request, response, list);
} catch (Exception e) {
logger.error("起始日期:" + beginDate + endDate + "截至日期" + endDate );
logger.error("Exception 下载无效订单Excel异常", e);
}
}
/**
* 创建错误订单模板
*/
private void exportInvalidOrder(HttpServletRequest request, HttpServletResponse response,List<Map<String,Object>> records) throws Exception {
String remoteAddr = request.getRemoteAddr();
MDC.put("ip", remoteAddr);
try {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("不合格订单");
HSSFCellStyle style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
HSSFRow firstRow = sheet.createRow(0);
String[] rowTitle = {"NO.","订单号", "上传受理号", "取消原因", "申请人", "出生日期", "收件人","收件人电话", "内件信息", "提交人", "提交时间", "收件地址"};
for (int i = 0; i < rowTitle.length; i++) {
HSSFCell cell = firstRow.createCell(i);
cell.setCellValue(rowTitle[i]);
cell.setCellStyle(style);
}
sheet.setColumnWidth(0, (int) ((6.67 + 0.72) * 256));
sheet.setColumnWidth(1, (int) ((12.36 + 0.72) * 256));
sheet.setColumnWidth(2, (int) ((24 + 0.72) * 256));
sheet.setColumnWidth(3, (int) ((44 + 0.72) * 256));
sheet.setColumnWidth(4, (int) ((10.55 + 0.72) * 256));
sheet.setColumnWidth(5, (int) ((12.36 + 0.72) * 256));
sheet.setColumnWidth(6, (int) ((10.55 + 0.72) * 256));
sheet.setColumnWidth(7, (int) ((14.64 + 0.72) * 256));
sheet.setColumnWidth(8, (int) ((28 + 0.72) * 256));
sheet.setColumnWidth(9, (int) ((7 + 0.72) * 256));
sheet.setColumnWidth(10, (int) ((19 + 0.72) * 256));
sheet.setColumnWidth(11, (int) ((55 + 0.72) * 256));
for (int i = 0; i < records.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
Map<String,Object> map = records.get(i);
HSSFCell cell = row.createCell(0);
cell.setCellValue(i+1);
cell = row.createCell(1);
cell.setCellValue(map.get("ORDER_NUMBER").toString());
cell = row.createCell(2);
cell.setCellValue(map.get("UPLOAD_NO").toString());
cell = row.createCell(3);
cell.setCellValue(map.get("REMARKS").toString());
cell = row.createCell(4);
cell.setCellValue(map.get("APPLICANT_NAME").toString());
cell = row.createCell(5);
cell.setCellValue(map.get("BIRTH_DATE").toString());
cell = row.createCell(6);
cell.setCellValue(map.get("RECIPIENT_NAME").toString());
cell = row.createCell(7);
cell.setCellValue(map.get("RECIPIENT_PHONE").toString());
cell = row.createCell(8);
cell.setCellValue(map.get("NATURE_OF_THE_INFORMATION").toString());
cell = row.createCell(9);
cell.setCellValue(map.get("NAME").toString());
cell = row.createCell(10);
cell.setCellValue(map.get("UP_TIUME").toString());
cell = row.createCell(11);
cell.setCellValue(map.get("RECIPIENT_ADDRESS").toString());
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日不合格订单导出");
String fileName = simpleDateFormat.format(new Date()) + ".xls";
String rtn = "";
fileName = URLEncoder.encode(fileName, "UTF8");
String userAgent = request.getHeader("User-Agent");
/*针对IE或者以IE为内核的浏览器:*/
if (userAgent != null) {
userAgent = userAgent.toLowerCase();
/*IE浏览器,只能采用URLEncoder编码*/
if (userAgent.contains("msie")) {
rtn = "filename=\"" + fileName + "\"";
}
/*Opera浏览器只能采用filename**/
else if (userAgent.contains("opera")) {
rtn = "filename*=UTF-8''" + fileName;
}
/*Safari浏览器,只能采用ISO编码的中文输出*/
else if (userAgent.contains("safari")) {
rtn = "filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), "ISO8859-1") + "\"";
}
/*Chrome浏览器,只能采用MimeUtility编码或ISO编码的中文输出*/
// else if (userAgent.indexOf("applewebkit") != -1) {
// fileName = MimeUtility.encodeText(fileName, "UTF8", "B");
// rtn = "filename=\"" + fileName + "\"";
// }
/* FireFox浏览器,可以使用MimeUtility或filename*或ISO编码的中文输出*/
else if (userAgent.contains("mozilla")) {
rtn = "filename*=UTF-8''" + fileName;
}
}
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;" + rtn);
response.setCharacterEncoding("UTF-8");
OutputStream outputStream = response.getOutputStream();
wb.write(outputStream);
outputStream.flush();
outputStream.close();
} catch (Exception e) {
logger.error("个人邮寄信息:" + records);
logger.error("Exception 创建不合格订单异常", e);
}
}
}
......@@ -153,7 +153,8 @@ public interface PersonPostMapper {
@Select("SELECT af.*,pp.APPLICANT_NAME,pp.NATURE_OF_THE_INFORMATION,pp.RECIPIENT_NAME,pp.RECIPIENT_ADDRESS,pp.RECIPIENT_PHONE,pp.ORDER_NUMBER,pp.BIRTH_DATE FROM AUDLIT_FAILURE af\n" +
"left join PERSON_POST pp \n" +
"on af.UPLOAD_NO=pp.FIRST_WHITE " +
"WHERE TO_CHAR(UP_TIUME,'yyyyMMdd') BETWEEN #{beginDate} AND #{endDate}")
"WHERE TO_CHAR(UP_TIUME,'yyyyMMdd') BETWEEN #{beginDate} AND #{endDate}" +
" order by af.ID")
public List<Map<String, Object>> selectCancelPost(@Param("beginDate")String beginDate,@Param("endDate") String endDate);
@Select("SELECT * FROM PERSON_POST WHERE FIRST_WHITE = #{acceptNo}")
......@@ -199,4 +200,27 @@ public interface PersonPostMapper {
" where FILE_ID=#{fileID})")
public int findBackWaybillNumber( @Param("fileID") String fileID);
@Select("<script> " +
"SELECT af.*,pp.APPLICANT_NAME,pp.NATURE_OF_THE_INFORMATION,pp.RECIPIENT_NAME,pp.RECIPIENT_ADDRESS,pp.RECIPIENT_PHONE,pp.ORDER_NUMBER,pp.BIRTH_DATE\n" +
" FROM AUDLIT_FAILURE af \n" +
" left join PERSON_POST pp on af.UPLOAD_NO=pp.FIRST_WHITE\n" +
" LEFT JOIN FILE_NAME_DIC ON FILE_NAME_DIC.FILE_ID=pp.FILE_ID " +
" WHERE 1=1" +
" <when test='sqrxm!=\"\"'> and pp.APPLICANT_NAME = #{sqrxm} </when>" +
" <when test='ddh!=\"\"'> and pp.ORDER_NUMBER=#{ddh} </when>" +
// " <when test='hasPrinted!=\"\"'> and PERSON_POST.STATE=#{hasPrinted} </when>" +
" <when test='hasPrinted== 0 '> and pp.print_date is null </when>" +
" <when test='hasPrinted== 1 '> and pp.print_date is not null </when>" +
" <when test='gkxx!=\"\"'> and pp.LATTICE_MOUTH_INFORMATION=#{gkxx} </when>" +
" <when test='emailNo!=\"\"'> and pp.WAYBILL_NUMBER=TO_NUMBER(#{emailNo}) </when>" +
" <when test='str!=\"\"'> and pp.GET_TO_COUNTY in ( ${str} ) </when>" +
" <when test='startDate!=\"\"'> and subStr(FILE_NAME_DIC.UPLOAD_DATE,0,8) between #{startDate} and #{endDate} </when>" +
" <when test='printDate!=\"\"'> and to_char(pp.print_Date,'yyyyMMdd')=${printDate} </when>" +
" <when test='notNull!=\"\"'> and pp.state1=${notNull} </when>" +
" order by pp.ORDER_NUMBER " +
"</script>")
public List<Map<String,Object>> findAllPoarInvalidOrder( @Param("sqrxm") String sqrxm, @Param("ddh") String ddh, @Param("hasPrinted") String hasPrinted,
@Param("gkxx") String gkxx, @Param("str") String str, @Param("startDate") String startDate,@Param("endDate") String endDate, @Param("emailNo") String emailNo,@Param("printDate") String printDate,@Param("notNull") String notNull );
}
......@@ -60,4 +60,7 @@ public interface PersonPostService {
public int findWaybillNumber( @Param("fileID") String fileID);
public int findBackWaybillNumber( @Param("fileID") String fileID);
public List<Map<String,Object>> downLoadInvalidOrder(HttpServletRequest request,HttpServletResponse response,String sqrxm, String ddh, String hasPrinted, String gkxx, JSONArray jsonArray,String starDate,String endDate,String emailNo,String printDate,String notNull);
}
......@@ -31,7 +31,7 @@ public class PersonPostServiceImpl implements PersonPostService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean savePersonPost(List<PersonPostEntity> personPostEntities) {
for (PersonPostEntity personPostEntity: personPostEntities) {
for (PersonPostEntity personPostEntity : personPostEntities) {
personPostMapper.savePersonPost(personPostEntity);
}
return true;
......@@ -39,6 +39,7 @@ public class PersonPostServiceImpl implements PersonPostService {
/**
* 文件解析 修改解析状态
*
* @param fileId
* @param creatTime
* @return
......@@ -47,36 +48,36 @@ public class PersonPostServiceImpl implements PersonPostService {
@Transactional(rollbackFor = Exception.class)
public boolean updateIsPost(String fileId, String creatTime) {
fileNameDicMapper.updataState(fileId);
personPostMapper.updateIsPost(fileId,creatTime);
personPostMapper.updateIsPost(fileId, creatTime);
return true;
}
@Override
public List<PersonPostEntity> findPersonalData(String applicantName,String orderNumber,String state,String latticeMouthInformation,List<String> getToCounty,String startDate,String endDate,String firstIndex,String pageSize,String emailNo,int notNull,String printDate){
public List<PersonPostEntity> findPersonalData(String applicantName, String orderNumber, String state, String latticeMouthInformation, List<String> getToCounty, String startDate, String endDate, String firstIndex, String pageSize, String emailNo, int notNull, String printDate) {
String str = "";
long firstIndexLong= Long.valueOf(firstIndex);
long firstIndexLong = Long.valueOf(firstIndex);
long pageSizeLong = Long.valueOf(pageSize);
for (int i = 0;i<getToCounty.size();i++){
if (i==getToCounty.size()-1){
str+="'"+getToCounty.get(i)+"'";
}else {
str+="'"+getToCounty.get(i)+"',";
for (int i = 0; i < getToCounty.size(); i++) {
if (i == getToCounty.size() - 1) {
str += "'" + getToCounty.get(i) + "'";
} else {
str += "'" + getToCounty.get(i) + "',";
}
}
List<PersonPostEntity> list = personPostMapper.findAllPersonalData(applicantName,orderNumber,state,latticeMouthInformation,str,startDate,endDate,firstIndexLong * pageSizeLong,(firstIndexLong - 1) * pageSizeLong + 1,emailNo,notNull,printDate);
List<PersonPostEntity> list = personPostMapper.findAllPersonalData(applicantName, orderNumber, state, latticeMouthInformation, str, startDate, endDate, firstIndexLong * pageSizeLong, (firstIndexLong - 1) * pageSizeLong + 1, emailNo, notNull, printDate);
return list;
}
@Override
public boolean deletePersonalData(String applicantName, String orderNumber, String state, String latticeMouthInformation, List<String> getToCounty, String starDate,String endDate) {
personPostMapper.deleteAllPersonalData(applicantName,orderNumber,state,latticeMouthInformation,getToCounty,starDate,endDate);
public boolean deletePersonalData(String applicantName, String orderNumber, String state, String latticeMouthInformation, List<String> getToCounty, String starDate, String endDate) {
personPostMapper.deleteAllPersonalData(applicantName, orderNumber, state, latticeMouthInformation, getToCounty, starDate, endDate);
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deletePersonalDataByImportDate(String startDate, String endDate) {
int id = personPostMapper.selectFileIdByImportDate(startDate,endDate);
personPostMapper.deleteNoPrintPersonPostByFileId(id+"");
int id = personPostMapper.selectFileIdByImportDate(startDate, endDate);
personPostMapper.deleteNoPrintPersonPostByFileId(id + "");
return true;
}
......@@ -90,41 +91,41 @@ public class PersonPostServiceImpl implements PersonPostService {
@Override
public boolean printPostList(int id, Date printDateTime) {
personPostMapper.updateIsPrint(id,printDateTime);
personPostMapper.updateIsPrint(id, printDateTime);
return true;
}
@Override
public int findPersonalDataCount(@Param("applicantName") String applicantName,@Param("orderNumber") String orderNumber,@Param("state") String state,@Param("latticeMouthInformation") String latticeMouthInformation,@Param("getToCounty") List<String> getToCounty,@Param("startDate") String startDate,@Param("endDate") String endDate,String emailNo,String notNull,String printDate) {
public int findPersonalDataCount(@Param("applicantName") String applicantName, @Param("orderNumber") String orderNumber, @Param("state") String state, @Param("latticeMouthInformation") String latticeMouthInformation, @Param("getToCounty") List<String> getToCounty, @Param("startDate") String startDate, @Param("endDate") String endDate, String emailNo, String notNull, String printDate) {
String str = "";
for (int i = 0;i<getToCounty.size();i++){
if (i==getToCounty.size()-1){
str+="'"+getToCounty.get(i)+"'";
}else {
str+="'"+getToCounty.get(i)+"',";
for (int i = 0; i < getToCounty.size(); i++) {
if (i == getToCounty.size() - 1) {
str += "'" + getToCounty.get(i) + "'";
} else {
str += "'" + getToCounty.get(i) + "',";
}
}
int count=personPostMapper.findPersonalDataCount(applicantName,orderNumber,state,latticeMouthInformation,str,startDate,endDate,emailNo,notNull,printDate);
int count = personPostMapper.findPersonalDataCount(applicantName, orderNumber, state, latticeMouthInformation, str, startDate, endDate, emailNo, notNull, printDate);
return count;
}
@Override
public int findPersonalDataCountByImportDate(String starDate,String endDate) {
int count = personPostMapper.selectPersonalDataCountByImportDate(starDate,endDate);
public int findPersonalDataCountByImportDate(String starDate, String endDate) {
int count = personPostMapper.selectPersonalDataCountByImportDate(starDate, endDate);
return count;
}
@Override
public List<PersonPostEntity> downLoadReportForm(HttpServletRequest request,HttpServletResponse response,String sqrxm, String ddh, String hasPrinted, String gkxx, JSONArray jsonArray, String starDate,String endDate,String emailNo,String printDate,String notNull) {
public List<PersonPostEntity> downLoadReportForm(HttpServletRequest request, HttpServletResponse response, String sqrxm, String ddh, String hasPrinted, String gkxx, JSONArray jsonArray, String starDate, String endDate, String emailNo, String printDate, String notNull) {
String str = "";
for (int i = 0;i<jsonArray.size();i++){
if (i==jsonArray.size()-1){
str+="'"+jsonArray.get(i)+"'";
}else {
str+="'"+jsonArray.get(i)+"',";
for (int i = 0; i < jsonArray.size(); i++) {
if (i == jsonArray.size() - 1) {
str += "'" + jsonArray.get(i) + "'";
} else {
str += "'" + jsonArray.get(i) + "',";
}
}
List<PersonPostEntity> list = personPostMapper.findAllPersonalDataNoPage(sqrxm,ddh,hasPrinted,gkxx,str,starDate,endDate,emailNo,printDate,notNull);
List<PersonPostEntity> list = personPostMapper.findAllPersonalDataNoPage(sqrxm, ddh, hasPrinted, gkxx, str, starDate, endDate, emailNo, printDate, notNull);
return list;
}
......@@ -137,25 +138,25 @@ public class PersonPostServiceImpl implements PersonPostService {
@Override
public boolean addNote(String uploadNo, String note) {
personPostMapper.addNote(uploadNo, note);
personPostMapper.addNote(uploadNo, note);
return true;
}
@Override
public List<Map<String, Object>> checkPersonalPost(String uploadNo) {
public List<Map<String, Object>> checkPersonalPost(String uploadNo) {
return personPostMapper.checkPersonalPost(uploadNo);
}
@Override
public boolean cancelPostByAcceptNo(String uploadNo, String remarks, String name) {
personPostMapper.cancelPostByAcceptNo(uploadNo,remarks,name);
personPostMapper.addNote(uploadNo, remarks);
return true;
personPostMapper.cancelPostByAcceptNo(uploadNo, remarks, name);
personPostMapper.addNote(uploadNo, remarks);
return true;
}
@Override
public List<Map<String, Object>> selectCancelPost(String beginDate, String endDate) {
return personPostMapper.selectCancelPost(beginDate,endDate);
return personPostMapper.selectCancelPost(beginDate, endDate);
}
@Override
......@@ -163,17 +164,17 @@ public class PersonPostServiceImpl implements PersonPostService {
return personPostMapper.findPersonalDataByAcceptNo(acceptNo);
}
@Override
public List<Map<String, Object>> downloadUploadInfo(HttpServletRequest request,HttpServletResponse response,String strDate,String endDate){
List<Map<String, Object>> list = personPostMapper.downloadUploadInfo(strDate,endDate);
public List<Map<String, Object>> downloadUploadInfo(HttpServletRequest request, HttpServletResponse response, String strDate, String endDate) {
List<Map<String, Object>> list = personPostMapper.downloadUploadInfo(strDate, endDate);
return list;
}
@Override
public int findWaybillNumber(String fileID){
public int findWaybillNumber(String fileID) {
int mum = personPostMapper.findWaybillNumber(fileID);
return mum;
}
@Override
public int findBackWaybillNumber(String fileID){
public int findBackWaybillNumber(String fileID) {
int mum = personPostMapper.findBackWaybillNumber(fileID);
return mum;
}
......@@ -190,4 +191,18 @@ public class PersonPostServiceImpl implements PersonPostService {
//// List<FileNameDicEntity> fileNameDicEntities = fileNameDicMapper.queryFileNameDic(fileName, analysisState, currPage, pageSize);
// return fileNameDicEntities;
// }
@Override
public List<Map<String, Object>> downLoadInvalidOrder(HttpServletRequest request, HttpServletResponse response, String sqrxm, String ddh, String hasPrinted, String gkxx, JSONArray jsonArray, String starDate, String endDate, String emailNo, String printDate, String notNull) {
String str = "";
for (int i = 0; i < jsonArray.size(); i++) {
if (i == jsonArray.size() - 1) {
str += "'" + jsonArray.get(i) + "'";
} else {
str += "'" + jsonArray.get(i) + "',";
}
}
List<Map<String, Object>> list = personPostMapper.findAllPoarInvalidOrder(sqrxm, ddh, hasPrinted, gkxx, str, starDate, endDate, emailNo, printDate, notNull);
return list;
}
}
......@@ -42,7 +42,7 @@
<tr>
<td style="text-align:left;"><strong>内件信息:</strong>{{item.natureOfTheInformation}}</td>
<td style="text-align:left;"><strong>申请人姓名:</strong>{{item.applicantName}}</td>
<td style="text-align:left;"><strong>出生日期:</strong>{{item.birthDate|date:'yyyy-MM-dd'}}</td>
<td style="text-align:left;"><strong>出生日期:</strong>{{item.birthDate}}</td>
</tr>
<tr>
<td colspan="3" style="text-align:left;"><strong>备注:</strong><h4>{{item.note}}</h4></td>
......
......@@ -135,6 +135,7 @@
<button class="btn btn-primary" ng-click="aselectAF()">查询</button>
</div>
</td>
<td><button type="submit" class="btn btn-info" style="margin-right: 7px;" ng-click="downloadInvalidOrderExcel()"> 不合格订单Excel模板</button></td>
</tr>
</table>
<div class="box-info" style="padding: 7px;padding-top: 0px;">
......
......@@ -150,5 +150,22 @@ angular.module('AvatarCheck.addAuditFailure', ['ngRoute', 'AvatarCheck.http'])
});
}
};
//下载不合格订单excel
$scope.downloadInvalidOrderExcel = function(){
var begDate = $('#datepicker1').val();
var endDate = $('#datepicker2').val();
if(begDate==""){
begDate=$scope.choseDate1;
}
if(endDate==""){
endDate=$scope.choseDate;
}
var url = '../personPostApi/downLoadInvalidOrder?beginDate='+begDate+'&endDate='+endDate;
var a = document.createElement("a");
document.body.appendChild(a);
a.href = encodeURI(url);
a.click();
}
});
\ No newline at end of file
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