学校批量导入功能修改。
This commit is contained in:
parent
336de1e196
commit
ed787d1643
@ -126,7 +126,7 @@ public class SchoolController extends DefaultBaseController {
|
|||||||
return new SuccessResultData<>(schoolService.count(params));
|
return new SuccessResultData<>(schoolService.count(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "导入房屋信息", notes = "导入房屋信息接口")
|
@ApiOperation(value = "导入教育局-请求结果数据", notes = "导入教育局-请求结果数据接口")
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@PostMapping("importexcel")
|
@PostMapping("importexcel")
|
||||||
public SuccessResultData importExcel(@RequestParam("file") MultipartFile file, HttpServletResponse response) throws Exception {
|
public SuccessResultData importExcel(@RequestParam("file") MultipartFile file, HttpServletResponse response) throws Exception {
|
||||||
@ -155,17 +155,17 @@ public class SchoolController extends DefaultBaseController {
|
|||||||
* @param response
|
* @param response
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "导出房屋信息失败信息", notes = "导出房屋信息失败接口")
|
@ApiOperation(value = "教育局-请求结果数据导入失败数据", notes = "教育局-请求结果数据导入失败数据接口")
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("exportexcel")
|
@GetMapping("exportexcel")
|
||||||
public void exportExcel(HttpServletResponse response) throws IOException {
|
public void exportExcel(HttpServletResponse response) throws IOException {
|
||||||
String excelName = "出租房失败数据";
|
String excelName = "教育局-请求结果数据导入失败数据";
|
||||||
String fileName = URLEncoder.encode(excelName, "UTF-8");
|
String fileName = URLEncoder.encode(excelName, "UTF-8");
|
||||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||||
|
|
||||||
String [] headers = {"流水号", "批次号", "入库时间", "MD5校验码", "业务字段MD5", "分片号",
|
String [] headers = {"序号", "流水号", "批次号", "入库时间", "MD5校验码", "业务字段MD5", "分片号",
|
||||||
"记录状态", "处理状态", "学校名称", "学校类型", "建筑面积", "类别", "教职工人数",
|
"记录状态", "处理状态", "学校名称", "学校类型", "建筑面积", "类别", "教职工人数",
|
||||||
"学校地址", "行政区划", "面积", "失败原因"};
|
"学校地址", "行政区划编码", "行政区划", "面积", "失败原因"};
|
||||||
List<List<String>> listHeader = new ArrayList<>();
|
List<List<String>> listHeader = new ArrayList<>();
|
||||||
for(String item : headers) {
|
for(String item : headers) {
|
||||||
List<String> title = new ArrayList<>();
|
List<String> title = new ArrayList<>();
|
||||||
@ -195,6 +195,7 @@ public class SchoolController extends DefaultBaseController {
|
|||||||
data.add(schoolModel.getSchoolType());
|
data.add(schoolModel.getSchoolType());
|
||||||
data.add(schoolModel.getWorkersCount());
|
data.add(schoolModel.getWorkersCount());
|
||||||
data.add(schoolModel.getSchoolAddress());
|
data.add(schoolModel.getSchoolAddress());
|
||||||
|
data.add(schoolModel.getAreaCode());
|
||||||
data.add(schoolModel.getAreaName());
|
data.add(schoolModel.getAreaName());
|
||||||
data.add(schoolModel.getArea());
|
data.add(schoolModel.getArea());
|
||||||
data.add(dto.getErrMsg());
|
data.add(dto.getErrMsg());
|
||||||
|
@ -39,12 +39,13 @@ public class SchoolModel {
|
|||||||
@ExcelProperty(index = 13)
|
@ExcelProperty(index = 13)
|
||||||
private String schoolAddress;
|
private String schoolAddress;
|
||||||
@ExcelProperty(index = 14)
|
@ExcelProperty(index = 14)
|
||||||
private String areaName;
|
private String areaCode;
|
||||||
@ExcelProperty(index = 15)
|
@ExcelProperty(index = 15)
|
||||||
|
private String areaName;
|
||||||
|
@ExcelProperty(index = 16)
|
||||||
private String area;
|
private String area;
|
||||||
|
|
||||||
String remake;
|
String remake;
|
||||||
String areaCode;
|
|
||||||
private String runningTypeName;
|
private String runningTypeName;
|
||||||
private String runningTypeCode;
|
private String runningTypeCode;
|
||||||
private String locationCode;
|
private String locationCode;
|
||||||
|
@ -3,6 +3,7 @@ package cn.com.tenlion.systembase.service.handleimportexcel.impl;
|
|||||||
import cn.com.tenlion.systembase.dao.school.ISchoolDao;
|
import cn.com.tenlion.systembase.dao.school.ISchoolDao;
|
||||||
import cn.com.tenlion.systembase.pojo.dtos.excel.ImportFailDto;
|
import cn.com.tenlion.systembase.pojo.dtos.excel.ImportFailDto;
|
||||||
import cn.com.tenlion.systembase.pojo.dtos.excel.ImportResultDto;
|
import cn.com.tenlion.systembase.pojo.dtos.excel.ImportResultDto;
|
||||||
|
import cn.com.tenlion.systembase.pojo.dtos.school.SchoolDTO;
|
||||||
import cn.com.tenlion.systembase.pojo.model.school.SchoolModel;
|
import cn.com.tenlion.systembase.pojo.model.school.SchoolModel;
|
||||||
import cn.com.tenlion.systembase.service.handleimportexcel.IHandleImportExcelService;
|
import cn.com.tenlion.systembase.service.handleimportexcel.IHandleImportExcelService;
|
||||||
import cn.com.tenlion.systembase.service.school.ISchoolService;
|
import cn.com.tenlion.systembase.service.school.ISchoolService;
|
||||||
@ -51,8 +52,8 @@ public class HandleImportExcelServiceImpl extends DefaultBaseService implements
|
|||||||
if(null != schoolModelList && schoolModelList.size() > 0) {
|
if(null != schoolModelList && schoolModelList.size() > 0) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
for(SchoolModel schoolModel: schoolModelList) {
|
for(SchoolModel schoolModel: schoolModelList) {
|
||||||
|
params.remove("schoolId");
|
||||||
String schoolId = UUIDUtil.getUUID();
|
String schoolId = UUIDUtil.getUUID();
|
||||||
params.put("schoolId", schoolId);
|
|
||||||
params.put("dataFrom", 1);
|
params.put("dataFrom", 1);
|
||||||
params.put("remake", schoolModel.getRemake());
|
params.put("remake", schoolModel.getRemake());
|
||||||
params.put("schoolName", schoolModel.getSchoolName());
|
params.put("schoolName", schoolModel.getSchoolName());
|
||||||
@ -60,11 +61,20 @@ public class HandleImportExcelServiceImpl extends DefaultBaseService implements
|
|||||||
params.put("runningTypeCode", schoolModel.getRunningTypeCode());
|
params.put("runningTypeCode", schoolModel.getRunningTypeCode());
|
||||||
params.put("runningTypeName", schoolModel.getRunningTypeName());
|
params.put("runningTypeName", schoolModel.getRunningTypeName());
|
||||||
params.put("location", schoolModel.getAreaName());
|
params.put("location", schoolModel.getAreaName());
|
||||||
params.put("locationCode", schoolModel.getLocationCode());
|
params.put("locationCode", schoolModel.getAreaCode());
|
||||||
params.put("schoolAddress", schoolModel.getSchoolAddress());
|
params.put("schoolAddress", schoolModel.getSchoolAddress());
|
||||||
setSaveInfo(params);
|
SchoolDTO schoolDTO = schoolDao.get(params);
|
||||||
|
if(null != schoolDTO) {
|
||||||
|
schoolId = schoolDTO.getSchoolId();
|
||||||
|
params.put("schoolId", schoolId);
|
||||||
|
setUpdateInfo(params);
|
||||||
|
schoolDao.update(params);
|
||||||
|
}else {
|
||||||
|
params.put("schoolId", schoolId);
|
||||||
|
setSaveInfo(params);
|
||||||
|
|
||||||
schoolDao.save(params);
|
schoolDao.save(params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,13 +89,6 @@ public class ImportExcelHelper {
|
|||||||
if(StringUtils.isEmpty(schoolModel.getAreaName())) {
|
if(StringUtils.isEmpty(schoolModel.getAreaName())) {
|
||||||
return "行政区划";
|
return "行政区划";
|
||||||
}
|
}
|
||||||
Map<String, Object> params = new HashMap<>();
|
|
||||||
params.put("schoolName", schoolModel.getSchoolName());
|
|
||||||
params.put("schoolAddress", schoolModel.getSchoolAddress());
|
|
||||||
List<SchoolDTO> schoolDTOS = schoolDao.list(params);
|
|
||||||
if(null != schoolDTOS && schoolDTOS.size() > 0) {
|
|
||||||
return "数据已存在";
|
|
||||||
}
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,11 +206,6 @@ public class ImportExcelHelper {
|
|||||||
remake += "面积:" + schoolModel.getArea() + "\n";
|
remake += "面积:" + schoolModel.getArea() + "\n";
|
||||||
schoolModel.setRemake(remake);
|
schoolModel.setRemake(remake);
|
||||||
|
|
||||||
// 由于无法通过地区名称查找地区编码和ID,所以暂时注释掉
|
|
||||||
/*AreaDTO areaDTO = mongoAreaService.get(schoolModel.getAreaName());
|
|
||||||
schoolModel.setAreaName(areaDTO.getAreaName());
|
|
||||||
schoolModel.setLocationCode(areaDTO.getAreaCode());*/
|
|
||||||
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("keywords", schoolModel.getRunningType());
|
params.put("keywords", schoolModel.getRunningType());
|
||||||
params.put("dataParentId", "e5624543-4f8e-4550-a8e8-49235f23b287");
|
params.put("dataParentId", "e5624543-4f8e-4550-a8e8-49235f23b287");
|
||||||
|
@ -290,11 +290,20 @@
|
|||||||
FROM
|
FROM
|
||||||
data_school t1
|
data_school t1
|
||||||
WHERE
|
WHERE
|
||||||
t1.is_delete = 0
|
t1.is_delete = 0
|
||||||
<if test="schoolId != null and schoolId != ''">
|
<if test="schoolId != null and schoolId != ''">
|
||||||
AND
|
AND
|
||||||
t1.school_id = #{schoolId}
|
t1.school_id = #{schoolId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="schoolName != null and schoolName != ''">
|
||||||
|
AND
|
||||||
|
t1.school_name = #{schoolName}
|
||||||
|
</if>
|
||||||
|
<if test="schoolAddress != null and schoolAddress != ''">
|
||||||
|
AND
|
||||||
|
t1.school_address = #{schoolAddress}
|
||||||
|
</if>
|
||||||
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 学校详情 -->
|
<!-- 学校详情 -->
|
||||||
|
BIN
教育局-请求结果数据_20220124180406.xls
Normal file
BIN
教育局-请求结果数据_20220124180406.xls
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user