Commit 90d7ec9c authored by dahai's avatar dahai

添加按条件查询制证数据

添加按条件下载制证数据包
parent 8fec9558
package com.yxproject.start.api; package com.yxproject.start.api;
import com.yxproject.start.entity.FilesEntity;
import com.yxproject.start.entity.PreproPersonEntity;
import com.yxproject.start.service.PreproPersonService; import com.yxproject.start.service.PreproPersonService;
import com.yxproject.start.utils.ExportXml;
import org.apache.commons.lang.time.DateFormatUtils; import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -12,7 +15,9 @@ import java.io.File; ...@@ -12,7 +15,9 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @auther zhangyusheng * @auther zhangyusheng
...@@ -29,15 +34,24 @@ public class ExportXMLApi { ...@@ -29,15 +34,24 @@ public class ExportXMLApi {
*/ */
@RequestMapping("printPostXmlData") @RequestMapping("printPostXmlData")
// @RequiresPermissions("userInfo.add")//权限管理; // @RequiresPermissions("userInfo.add")//权限管理;
public byte[] printXmlData(@RequestParam("date") String date, HttpServletResponse response){ public byte[] printXmlData(@RequestParam("uploadNo") String uploadNo, @RequestParam("IDCard")String IDCard,@RequestParam("oldFile") String oldFile, @RequestParam("newFile")String newFile, @RequestParam("SSXQDM")String SSXQDM, @RequestParam("cardType")String cardType, @RequestParam("state")String state, @RequestParam("uploadDate")String uploadDate, HttpServletResponse response){
response.setContentType("application/x-download"); response.setContentType("application/x-download");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
String dateTime = DateFormatUtils.format(new Date(), "yyyyMMddHH"); String dateTime = DateFormatUtils.format(new Date(), "yyyyMMddHH");
// //使用Servlet实现文件下载的时候,避免浏览器自动打开文件 // //使用Servlet实现文件下载的时候,避免浏览器自动打开文件
String fout = null; String fout = null;
//TODO List<PreproPersonEntity> preproPersonEntities = preproPersonService.selectPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, uploadDate);
// List<PersonPostAbnormalEntity> postAbnormalEntity = personPostService.getAllPersonPostAbnormalEntity(date); FilesEntity filesEntity = new FilesEntity();
// fout = ExportExcel.exportPersonPostAbnormalExcel(postAbnormalEntity); filesEntity.setVersionCode("3.00");
filesEntity.setDwdm("410600000000");
filesEntity.setDwmc("北京市公安局");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
filesEntity.setCreatTime(simpleDateFormat.format(new Date()));
try {
ExportXml.createToMakePackageXML(preproPersonEntities,filesEntity,"\\zhang\\");
} catch (IOException e) {
e.printStackTrace();
}
String outFile = dateTime + "制证数据包"; String outFile = dateTime + "制证数据包";
try { try {
FileInputStream fis = new FileInputStream(new File(fout)); FileInputStream fis = new FileInputStream(new File(fout));
......
package com.yxproject.start.api;
import com.yxproject.start.entity.PreproPersonEntity;
import com.yxproject.start.service.PreproPersonService;
import com.yxproject.start.utils.YXJSONResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @auther zhangyusheng
* 2019/3/1 13:34
*/
@RestController
@RequestMapping("queryPreproPerson")
public class queryPreproPerson {
@Autowired
private PreproPersonService preproPersonService;
/**
* 查询制证数据
*/
@RequestMapping("queryPreproPerson")
// @RequiresPermissions("userInfo.add")//权限管理;
public String printXmlData(@RequestParam("uploadNo") String uploadNo, @RequestParam("IDCard")String IDCard,@RequestParam("oldFile") String oldFile, @RequestParam("newFile")String newFile, @RequestParam("SSXQDM")String SSXQDM, @RequestParam("cardType")String cardType, @RequestParam("state")String state, @RequestParam("uploadDate")String uploadDate, HttpServletResponse response){
List<PreproPersonEntity> preproPersonEntities = preproPersonService.selectPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, uploadDate);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
response.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(preproPersonEntities);
return yxjsonResponse.toJSONString();
}
}
package com.yxproject.start.mapper; package com.yxproject.start.mapper;
import com.yxproject.start.entity.PreproPersonEntity; import com.yxproject.start.entity.PreproPersonEntity;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List; import java.util.List;
...@@ -30,8 +27,14 @@ public interface PreproPersonMapper { ...@@ -30,8 +27,14 @@ public interface PreproPersonMapper {
@Select("select * from PREPRO_PERSON \n" + @Select("select * from PREPRO_PERSON \n" +
"left join files on PREPRO_PERSON.FILE_ID = files.ID\n" + "left join files on PREPRO_PERSON.FILE_ID = files.ID\n" +
"left join NEW_FILES on PREPRO_PERSON.FILE_ID = NEW_FILES.ID " + "left join NEW_FILES on PREPRO_PERSON.FILE_ID = NEW_FILES.ID " +
"where PREPRO_PERSON.JMSFZSLH = #{uploadNo} and GMSFHM = #{IDCard}" + "where 1=1 " +
"and files.SOURCE_FILE_NAME =#{oldFile} and NEW_FILES.NEW_FILE_NAME = #{newFile}" + "<when test='uploadNo!=null'> and PREPRO_PERSON.JMSFZSLH = #{uploadNo} </when>" +
"and PREPRO_PERSON.SSXQDM =#{SSXQDM} and PREPRO_PERSON.state =#{} ") " <when test='IDCard!=null'> and GMSFHM = #{IDCard} </when> " +
public List<PreproPersonEntity> selectPreproPerson(String uploadNo,String IDCard,String oldFile,String newFile,String SSXQDM,String cardType,String state,String uploadDate); " <when test='oldFile!=null'> and files.SOURCE_FILE_NAME =#{oldFile} </when> " +
" <when test='newFile!=null'> and NEW_FILES.NEW_FILE_NAME = #{newFile} </when> " +
" <when test='SSXQDM!=null'> and PREPRO_PERSON.SSXQDM =#{SSXQDM} </when> " +
" <when test='cardType!=null'> and PREPRO_PERSON.CARD_TYPE_ID =#{cardType} </when> " +
" <when test='state!=null'> and PREPRO_PERSON.state = #{state} </when> " +
" <when test='uploadDate!=null'> and files.CREAT_TIME = #{uploadDate} </when> ")
public List<PreproPersonEntity> selectPreproPerson(@Param("uploadNo")String uploadNo, @Param("IDCard")String IDCard, @Param("oldFile")String oldFile, @Param("newFile")String newFile, @Param("SSXQDM")String SSXQDM, @Param("cardType")String cardType, @Param("state")String state, @Param("uploadDate")String uploadDate);
} }
package com.yxproject.start.service; package com.yxproject.start.service;
import com.yxproject.start.entity.PreproPersonEntity;
import java.util.List;
/** /**
* @auther zhangyusheng * @auther zhangyusheng
* 2019/3/1 11:24 * 2019/3/1 11:24
*/ */
public interface PreproPersonService { public interface PreproPersonService {
public List<PreproPersonEntity> selectPreproPerson(String uploadNo, String IDCard, String oldFile, String newFile, String SSXQDM, String cardType, String state, String uploadDate);
} }
package com.yxproject.start.service.impl; package com.yxproject.start.service.impl;
import com.yxproject.start.entity.PreproPersonEntity;
import com.yxproject.start.mapper.PreproPersonMapper; import com.yxproject.start.mapper.PreproPersonMapper;
import com.yxproject.start.service.PreproPersonService; import com.yxproject.start.service.PreproPersonService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @auther zhangyusheng * @auther zhangyusheng
* 2019/3/1 11:25 * 2019/3/1 11:25
...@@ -14,4 +17,9 @@ public class PreproPersonServiceImpl implements PreproPersonService { ...@@ -14,4 +17,9 @@ public class PreproPersonServiceImpl implements PreproPersonService {
@Autowired @Autowired
private PreproPersonMapper preproPersonMapper; private PreproPersonMapper preproPersonMapper;
@Override
public List<PreproPersonEntity> selectPreproPerson(String uploadNo, String IDCard, String oldFile, String newFile, String SSXQDM, String cardType, String state, String uploadDate) {
List<PreproPersonEntity> preproPersonEntities = preproPersonMapper.selectPreproPerson(uploadNo, IDCard, oldFile, newFile, SSXQDM, cardType, state, uploadDate);
return preproPersonEntities;
}
} }
...@@ -85,7 +85,6 @@ public class ExportXml { ...@@ -85,7 +85,6 @@ public class ExportXml {
SJR_TXDZ.setText(replaceNullString(preproPersonEntity.getSjrTxdz())); SJR_TXDZ.setText(replaceNullString(preproPersonEntity.getSjrTxdz()));
} }
YXStringUtils.saveDom2File(document, url + "\\" + "ZAGL_ZZJH_" + ".xml"); YXStringUtils.saveDom2File(document, url + "\\" + "ZAGL_ZZJH_" + ".xml");
} }
/** /**
......
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