Commit 02299408 authored by 韩桐桐's avatar 韩桐桐

bugfix

parent 4d92df65
......@@ -306,7 +306,7 @@ public class TzBaseEnterpriseInfoDto extends BaseDto {
private String cityCode;
@ApiModelProperty(value = "创建时间")
protected Date createDate;
protected String createDate;
/**
......
......@@ -36,8 +36,15 @@
<select id="page"
resultType="com.yeejoin.amos.boot.module.jczs.api.dto.TzBaseEnterpriseInfoDto">
SELECT
*,
SELECT "sequence_nbr","use_unit_code","supervise_code","use_unit_certificate","unit_type","use_code","use_unit","supervise_org_code",
"supervise_org_name","key_unit","class_places","province","city","district","street","community",
"address","legal_person","legal_phone","use_contact","contact_phone","safety_one","safety_one_id","safety_one_phone",
"safety_two","safety_two_id","safety_two_phone","longitude","latitude","sync_date","sync_state","app_id","rec_date","rec_user_id",
"governing_body","data_sources","industry","registration_authority","approval_time","operating_status","mainten_person","mainten_telephone",
"sqa","quality_person","quality_telephone","technical_person","is_delete","rec_user_name","equip_category","unit_business_license","unit_exequatur",
"safety_two_photo","safety_one_photo","sqa_phone","qr_code","industry_supervisor","regulatory_labels",
"register_type","other_accessories","status" ,"org_code","office_region","office_address",
DATE_FORMAT(create_date,'%Y-%m-%d') as createDate,
CONCAT(province,'/',city,'/',district) AS region,
CONCAT(street,'/',address) AS full_address
FROM
......@@ -87,8 +94,15 @@
<select id="pageList"
resultType="com.yeejoin.amos.boot.module.jczs.api.dto.TzBaseEnterpriseInfoDto">
SELECT
*,
SELECT "sequence_nbr","use_unit_code","supervise_code","use_unit_certificate","unit_type","use_code","use_unit","supervise_org_code",
"supervise_org_name","key_unit","class_places","province","city","district","street","community",
"address","legal_person","legal_phone","use_contact","contact_phone","safety_one","safety_one_id","safety_one_phone",
"safety_two","safety_two_id","safety_two_phone","longitude","latitude","sync_date","sync_state","app_id","rec_date","rec_user_id",
"governing_body","data_sources","industry","registration_authority","approval_time","operating_status","mainten_person","mainten_telephone",
"sqa","quality_person","quality_telephone","technical_person","is_delete","rec_user_name","equip_category","unit_business_license","unit_exequatur",
"safety_two_photo","safety_one_photo","sqa_phone","qr_code","industry_supervisor","regulatory_labels",
"register_type","other_accessories","status" ,"org_code","office_region","office_address",
DATE_FORMAT(create_date,'%Y-%m-%d') as createDate,
CONCAT(province,'/',city,'/',district) AS region,
CONCAT(street,'/',address) AS full_address
FROM
......@@ -164,7 +178,7 @@
<if test="sort != null">
${sort.field} ${sort.sortType},
</if>
rec_date DESC,sequence_nbr DESC
create_date DESC,sequence_nbr DESC
</select>
<select id="queryBaseEnterpriseInIds" resultType="com.yeejoin.amos.boot.module.jczs.api.vo.BaseEnterpriseVo">
......
......@@ -1487,52 +1487,55 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}).headRowNumber(2).sheet(sheetNo, sheetName).doRead();
}
}
// 存在检验不通过的数据则返回错误信息,不在向下写入库
if (!sheetError.isEmpty()) {
sendErrorContext(sheetError);
}
// 3.数据入库
dataList.forEach(data -> {
TzsUserInfoDto dto = new TzsUserInfoDto();
BeanUtils.copyProperties(data, dto);
dto.setCreateDate(new Date());
try {
this.saveUserInfo(dto);
} catch (Exception e) {
sheetError.add(dto.getName() + "-" + dto.getCertificateNum() + ":" + e.getMessage());
}
});
// 第二次捕获save中的异常
if (!sheetError.isEmpty()) {
sendErrorContext(sheetError);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
// 存在检验不通过的数据则返回错误信息,不在向下写入库
if (!sheetError.isEmpty()) {
sendErrorContext(sheetError);
}
// 3.数据入库
dataList.forEach(data -> {
TzsUserInfoDto dto = new TzsUserInfoDto();
BeanUtils.copyProperties(data, dto);
dto.setCreateDate(new Date());
try {
this.saveUserInfo(dto);
} catch (Exception e) {
sheetError.add(dto.getName() + "-" + dto.getCertificateNum() + ":" + e.getMessage());
}
});
// 第二次捕获save中的异常
if (!sheetError.isEmpty()) {
sendErrorContext(sheetError);
}
return ResponseHelper.buildResponse("success");
}
private void sendErrorContext(ArrayList<String> sheetError) throws IOException {
private void sendErrorContext(ArrayList<String> sheetError) {
// 发送错误文件
String uuid = UUID.randomUUID().toString();
startDownLoadMsg("人员导入错误文件", uuid);
File tempFile = File.createTempFile("errors", ".txt");
try (FileWriter writer = new FileWriter(tempFile)) {
for (String error : sheetError) {
writer.write(error + System.lineSeparator());
try {
String uuid = UUID.randomUUID().toString();
startDownLoadMsg("人员导入错误文件", uuid);
File tempFile = File.createTempFile("errors", ".txt");
try (FileWriter writer = new FileWriter(tempFile)) {
for (String error : sheetError) {
writer.write(error + System.lineSeparator());
}
}
byte[] fileContent = Files.readAllBytes(tempFile.toPath());
MultipartFile mockMultipartFile = new MockMultipartFile("errors.txt", "errors.txt", "text/plain", fileContent);
String urlString = this.uploadExcelFile(mockMultipartFile);
sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "人员导入错误文件")
.fluentPut("url", urlString)
.fluentPut("time", new Date().getTime()));
tempFile.delete();
} finally {
throw new BadRequest("数据校验错误,详见人员导入错误文件!");
}
byte[] fileContent = Files.readAllBytes(tempFile.toPath());
MultipartFile mockMultipartFile = new MockMultipartFile("errors.txt", "errors.txt", "text/plain", fileContent);
String urlString = this.uploadExcelFile(mockMultipartFile);
sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid)
.fluentPut("status", "done")
.fluentPut("fileName", "人员导入错误文件")
.fluentPut("url", urlString)
.fluentPut("time", new Date().getTime()));
tempFile.delete();
throw new BadRequest("校验出错,请查看错误文件!");
}
private void companyUserCheckField(ArrayList<String> sheetError, String sheetName, List<CompanyUserImportDto> dataList,
......@@ -2203,7 +2206,12 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
Map.Entry<String, JsonNode> entry = fields.next();
String postCode = entry.getKey();// 主岗位
JsonNode subPostCode = entry.getValue();// 子岗位
allPostUnderTheUnit.put(postCode, subPostCode);
// 确保最大范围包含子类型
if (subPostCode.isEmpty()){
allPostUnderTheUnit.put(postCode, subPostCode);
}else {
allPostUnderTheUnit.putIfAbsent(postCode, subPostCode);
}
}
}
});
......
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