Commit ea851a1b authored by xiachenqi's avatar xiachenqi

0928

parent a311b2cd
...@@ -62,12 +62,12 @@ ...@@ -62,12 +62,12 @@
<dependency> <dependency>
<groupId>commons-fileupload</groupId> <groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId> <artifactId>commons-fileupload</artifactId>
<version>1.3.3</version> <version>1.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId> <artifactId>poi-ooxml-schemas</artifactId>
<version>3.14</version> <version>4.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.sourceforge.jexcelapi</groupId> <groupId>net.sourceforge.jexcelapi</groupId>
......
package com.yxproject.start.api;
import com.yxproject.start.service.impl.ExtensionServiceImpl;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.ws.rs.core.MediaType;
/**
* 扩展api
*
* @author xia79
* @date 2024/09/27
*/
@RestController
@RequestMapping("extensionApi")
public class ExtensionApi {
private final ExtensionServiceImpl extensionService;
public ExtensionApi(ExtensionServiceImpl extensionService) {
this.extensionService = extensionService;
}
/**
* 解析港澳台购车人信息,判断是否办理过港澳台居住证
*/
@PostMapping(value = "analysisGAT", consumes = MediaType.MULTIPART_FORM_DATA)
public ResponseEntity<byte[]> analysisGAT(@RequestPart("file") MultipartFile file) {
// 检查文件是否为空
if (file.isEmpty()) {
throw new RuntimeException("No file uploaded");
}
// 获取文件名
String fileName = file.getOriginalFilename();
if (!fileName.endsWith("xls") && !fileName.endsWith("xlsx")) {
throw new RuntimeException("Only .xls or .xlsx files are supported");
}
// 处理文件并生成新的Excel
byte[] newExcelData = extensionService.analysisGAT(file);
// 设置响应头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(org.springframework.http.MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", "processed_" + fileName);
return new ResponseEntity<>(newExcelData, headers, HttpStatus.OK);
}
}
...@@ -362,7 +362,7 @@ public class PersonPostApi { ...@@ -362,7 +362,7 @@ public class PersonPostApi {
logger.error("Exception 刷身份证查询邮寄单信息详情异常", e); logger.error("Exception 刷身份证查询邮寄单信息详情异常", e);
} }
for (PersonPostEntity entity : list) { for (PersonPostEntity entity : list) {
if (entity.getLatticeMouthInformation().trim().equals("调用新一代接口批量获取四级分拣码失败")) { if (entity.getLatticeMouthInformation() == null || entity.getLatticeMouthInformation().trim().equals("调用新一代接口批量获取四级分拣码失败")) {
entity.setLatticeMouthInformation("获取分拣码失败"); entity.setLatticeMouthInformation("获取分拣码失败");
} }
} }
......
package com.yxproject.start.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExtensionGatAnalysisResultDto {
private boolean result;
private String message;
private List<ExtensionGatDto> extensionGatRecords;
}
package com.yxproject.start.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExtensionGatDto {
@Column(name = "NAME")
private String name;
@Column(name = "BIRTHDAY")
private String birthday;
@Column(name = "ID_NO")
private String idNo;
@Column(name = "BEGIN_DATE")
private String beginDate;
@Column(name = "EXPIRE_DATE")
private String expireDate;
@Column(name = "SIGN_TIMES")
private String signTimes;
}
package com.yxproject.start.mapper;
import com.yxproject.start.dto.ExtensionGatDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface ExtensionMapper {
@Select("SELECT\n" +
" PROD_CARD_T.NAME,\n" +
" PROD_CARD_T.BIRTHDAY,\n" +
" PROD_CARD_T.ID_NO,\n" +
" PROD_CARD_T.BEGIN_DATE,\n" +
" PROD_CARD_T.EXPIRE_DATE,\n" +
" PROD_CARD_T.SIGN_TIMES\n" +
"FROM\n" +
" PRODYD_DBA.PROD_CARD_T@PRODYD_LINK\n" +
"WHERE\n" +
" PROD_CARD_T.CARD_NO = #{cardNo}\n" +
"ORDER BY\n" +
" PROD_CARD_T.SIGN_TIMES DESC")
List<ExtensionGatDto> getProdGatCardList(@Param("cardNo") String cardNo);
@Select("SELECT\n" +
" HIS_CARD_T.NAME,\n" +
" HIS_CARD_T.BIRTHDAY,\n" +
" HIS_CARD_T.ID_NO,\n" +
" HIS_CARD_T.BEGIN_DATE,\n" +
" HIS_CARD_T.EXPIRE_DATE,\n" +
" HIS_CARD_T.SIGN_TIMES\n" +
"FROM\n" +
" HISYD_DBA.HIS_CARD_T@HISYD_LINK\n" +
"WHERE\n" +
" HIS_CARD_T.CARD_NO = #{cardNo}\n" +
"ORDER BY\n" +
" HIS_CARD_T.SIGN_TIMES DESC")
List<ExtensionGatDto> getHisGatCardList(@Param("cardNo") String cardNo);
}
...@@ -25,7 +25,7 @@ public interface TaskListMapper { ...@@ -25,7 +25,7 @@ public interface TaskListMapper {
@Select("select DISTINCT CARD_TYPE_DIC.*, ACC_GROUP_T.* ,'000000' COUNTY_CODE,'0000' COUNTYNAME from ACCYD_DBA.ACC_CARD_T@ACCUYD_LINK \n" + @Select("select DISTINCT CARD_TYPE_DIC.*, ACC_GROUP_T.* ,'000000' COUNTY_CODE,'0000' COUNTYNAME from ACCYD_DBA.ACC_CARD_T@ACCUYD_LINK \n" +
"left join ACCYD_DBA.ACC_GROUP_T@ACCUYD_LINK on substr(acc_card_t.accept_no,0,8) = ACC_GROUP_T.group_no\n" + "left join ACCYD_DBA.ACC_GROUP_T@ACCUYD_LINK on substr(acc_card_t.accept_no,0,8) = ACC_GROUP_T.group_no\n" +
"left join ACCYD_DBA.ACC_GROUP_RELATION_T@ACCUYD_LINK on ACC_GROUP_RELATION_T.group_no =ACC_GROUP_T.group_no\n" + "left join ACCYD_DBA.ACC_GROUP_RELATION_T@ACCUYD_LINK on ACC_GROUP_RELATION_T.group_no =ACC_GROUP_T.group_no\n" +
"left join CARD_TYPE_DIC on decode(substr(ORIGINAL_NO,21,1),6,5,substr(ORIGINAL_NO,21,1)) = CARD_TYPE_DIC.CARD_TYPE_ID\n" + "left join CARD_TYPE_DIC on decode(substr(ORIGINAL_NO,21,1),6,5,3,6,substr(ORIGINAL_NO,21,1)) = CARD_TYPE_DIC.CARD_TYPE_ID\n" +
"where " + "where " +
"ACC_GROUP_T.group_no not in (select group_no from group_no)\n" + "ACC_GROUP_T.group_no not in (select group_no from group_no)\n" +
"and to_char(ACC_GROUP_T.IMPORT_TIME,'yyyyMMdd')=#{submitDate} \n" + "and to_char(ACC_GROUP_T.IMPORT_TIME,'yyyyMMdd')=#{submitDate} \n" +
......
package com.yxproject.start.service.impl;
import com.yxproject.start.dto.ExtensionGatAnalysisResultDto;
import com.yxproject.start.dto.ExtensionGatDto;
import com.yxproject.start.mapper.ExtensionMapper;
import org.apache.poi.ss.usermodel.*;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* 扩展服务impl
*
* @author xia79
* @date 2024/09/27
*/
@Service
public class ExtensionServiceImpl {
private final ExtensionMapper extensionMapper;
public ExtensionServiceImpl(ExtensionMapper extensionMapper) {
this.extensionMapper = extensionMapper;
}
/**
* 解析港澳台购车人信息,判断是否办理过港澳台居住证
*
* @param file 文件
*/
public byte[] analysisGAT(MultipartFile file) {
try (InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream)) {
Sheet hkSheet = workbook.getSheetAt(0);
Sheet twSheet = workbook.getSheetAt(1);
// 分析和更新Sheet
// analysisSheet(hkSheet);
analysisSheet(twSheet);
// 将更新后的工作簿保存到字节数组
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
workbook.write(outputStream);
return outputStream.toByteArray();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* 分析表
*
* @param sheet 工作表
*/
public Sheet analysisSheet(Sheet sheet) {
for (Row row : sheet) {
if (row.getRowNum() == 10) {
break;
}
ExtensionGatAnalysisResultDto resultDto = new ExtensionGatAnalysisResultDto(false, "", null);
if (row.getRowNum() == 0) continue;
String name = "";
Cell cell = row.getCell(4);
if (cell != null && cell.getCellType() == CellType.STRING) {
name = cell.getStringCellValue();
}
String birthday = "";
cell = row.getCell(6);
if (cell != null && cell.getCellType() == CellType.STRING) {
birthday = cell.getStringCellValue();
}
String card_no = row.getCell(9).getStringCellValue();
List<ExtensionGatDto> prodRecords = extensionMapper.getProdGatCardList(card_no);
System.out.println("cardNO:" + card_no);
List<ExtensionGatDto> hisRecords = extensionMapper.getHisGatCardList(card_no);
List<ExtensionGatDto> combinedRecords = new ArrayList<>();
combinedRecords.addAll(prodRecords);
combinedRecords.addAll(hisRecords);
for (ExtensionGatDto prodRecord : combinedRecords) {
System.out.println(prodRecord);
}
if (!combinedRecords.isEmpty()) {
resultDto.setResult(true);
for (ExtensionGatDto record : combinedRecords) {
if (!name.isEmpty()) {
if (!record.getName().equals(name)) {
String message = resultDto.getMessage();
resultDto.setMessage(message + "姓名不一致 ");
}
}
if (!birthday.isEmpty()) {
if (!record.getBirthday().equals(birthday)) {
String message = resultDto.getMessage();
resultDto.setMessage(message + "出生日期不一致 ");
}
}
}
resultDto.setExtensionGatRecords(combinedRecords);
}
String resultStr = resultDto.isResult() ? "已匹配" : "未找到";
row.createCell(11, CellType.STRING).setCellValue(resultStr);
row.createCell(12, CellType.STRING).setCellValue(resultDto.getMessage());
int indexStart = 13;
if (resultDto.getExtensionGatRecords() != null && !resultDto.getExtensionGatRecords().isEmpty()) {
for (ExtensionGatDto dto : resultDto.getExtensionGatRecords()) {
row.createCell(indexStart++, CellType.STRING).setCellValue(dto.getName());
row.createCell(indexStart++, CellType.STRING).setCellValue(dto.getBirthday());
row.createCell(indexStart++, CellType.STRING).setCellValue(dto.getBeginDate());
row.createCell(indexStart++, CellType.STRING).setCellValue(dto.getExpireDate());
row.createCell(indexStart++, CellType.STRING).setCellValue(dto.getSignTimes());
}
}
}
Row row = sheet.getRow(0);
row.createCell(11, CellType.STRING).setCellValue("比对结果");
row.createCell(12, CellType.STRING).setCellValue("备注");
row.createCell(13, CellType.STRING).setCellValue("证件姓名");
row.createCell(14, CellType.STRING).setCellValue("证件出生日期");
row.createCell(15, CellType.STRING).setCellValue("证件起始日期");
row.createCell(16, CellType.STRING).setCellValue("证件截止日期");
row.createCell(17, CellType.STRING).setCellValue("办理次数");
return sheet;
}
}
...@@ -71,8 +71,8 @@ public class ImportXmlServiceImpl implements ImportXmlService { ...@@ -71,8 +71,8 @@ public class ImportXmlServiceImpl implements ImportXmlService {
Element ZWE_ZWTZSJ = PACKAGE.addElement("ZWE_ZWTZSJ"); Element ZWE_ZWTZSJ = PACKAGE.addElement("ZWE_ZWTZSJ");
ZWE_ZWTZSJ.setText(preproPersonDto.getZweZwtzsj()); ZWE_ZWTZSJ.setText(preproPersonDto.getZweZwtzsj());
boolean isGAT = personIsHk(filesEntity.getSourceFileName()) || personIsTw(filesEntity.getSourceFileName()); boolean isGAT = personIsHk(filesEntity.getSourceFileName()) || personIsTw(filesEntity.getSourceFileName());
String url = isGAT ? "C:\\TP_PATH_YD\\"+ uploadDate + "\\" + "ZAGL_GATZZ_" + filesEntity.getSourceFileName() + preproPersonDto.getNo() + ".xml" String url = isGAT ? "D:\\TP_PATH_YD\\"+ uploadDate + "\\" + "ZAGL_GATZZ_" + filesEntity.getSourceFileName() + preproPersonDto.getNo() + ".xml"
: "C:\\TP_PATH_YD\\"+ uploadDate + "\\" + "ZAGL_YDZZ_" + filesEntity.getSourceFileName() + preproPersonDto.getNo() + ".xml"; : "D:\\TP_PATH_YD\\"+ uploadDate + "\\" + "ZAGL_YDZZ_" + filesEntity.getSourceFileName() + preproPersonDto.getNo() + ".xml";
try { try {
File file = new File(url); File file = new File(url);
if(!file.exists()){ if(!file.exists()){
......
...@@ -7,6 +7,7 @@ spring: ...@@ -7,6 +7,7 @@ spring:
url: jdbc:oracle:thin:@192.168.1.16:1521:yingxin url: jdbc:oracle:thin:@192.168.1.16:1521:yingxin
username: yingxinyd username: yingxinyd
password: yingxinyd password: yingxinyd
# url: jdbc:oracle:thin:@192.168.2.164:1521:orcl
servlet: servlet:
multipart: multipart:
enabled: true enabled: true
......
...@@ -140,14 +140,14 @@ ...@@ -140,14 +140,14 @@
type="radio" type="radio"
ng-model="isGAT" ng-model="isGAT"
name="type" name="type"
value="2" value="1"
/> />
<input <input
style="margin-left: 10px" style="margin-left: 10px"
type="radio" type="radio"
ng-model="isGAT" ng-model="isGAT"
name="type" name="type"
value="1" value="0"
ng-checked="true" ng-checked="true"
/> />
</td> </td>
......
...@@ -105,8 +105,9 @@ angular ...@@ -105,8 +105,9 @@ angular
var files = document.querySelector( var files = document.querySelector(
"input#id_file_photo_for_check" "input#id_file_photo_for_check"
).files ).files
console.log("isGAT:" + $scope.isGAT)
var isGAT = $scope.isGAT == "1" ? false : true var isGAT = $scope.isGAT == "1"
console.log("isGAT:" + isGAT)
if (files.length == 0) { if (files.length == 0) {
MessageService.showAlert("请选择上传的文件...") MessageService.showAlert("请选择上传的文件...")
} else { } else {
......
...@@ -171,14 +171,14 @@ angular.module('AvatarCheck.searchCardMsg', ['ngRoute', 'AvatarCheck.http']) ...@@ -171,14 +171,14 @@ angular.module('AvatarCheck.searchCardMsg', ['ngRoute', 'AvatarCheck.http'])
if (ret == 1 || ret == 3) { if (ret == 1 || ret == 3) {
myform.name.value = document.getElementById("aaa").sName; myform.name.value = document.getElementById("aaa").sName;
myform.sex.value = document.getElementById("aaa").sSex == 1 ? '男' : '女'; myform.sex.value = document.getElementById("aaa").sSex == 1 ? '男' : '女';
myform.national.value = parseInt(document.getElementById("aaa").sNation); // myform.national.value = parseInt(document.getElementById("aaa").sNation);
var flag = false; var flag = false;
if(myform.national.value>56||myform.national.value<1){ // if(myform.national.value>56||myform.national.value<1){
MessageService.showAlert("民族代码异常 "+myform.national.value); // MessageService.showAlert("民族代码异常 "+myform.national.value);
}else{ // }else{
myform.national.value = nation_data[(parseInt(document.getElementById("aaa").sNation)) - 1].name; // myform.national.value = nation_data[(parseInt(document.getElementById("aaa").sNation)) - 1].name;
flag=true; flag=true;
} // }
myform.birthday.value = document.getElementById("aaa").sBornDate; myform.birthday.value = document.getElementById("aaa").sBornDate;
myform.address.value = document.getElementById("aaa").sAddress; myform.address.value = document.getElementById("aaa").sAddress;
myform.id.value = document.getElementById("aaa").sIDNo; myform.id.value = document.getElementById("aaa").sIDNo;
......
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