diff --git a/src/main/java/cn/com/tenlion/systembase/controller/api/school/SchoolController.java b/src/main/java/cn/com/tenlion/systembase/controller/api/school/SchoolController.java index a765314..689b88b 100644 --- a/src/main/java/cn/com/tenlion/systembase/controller/api/school/SchoolController.java +++ b/src/main/java/cn/com/tenlion/systembase/controller/api/school/SchoolController.java @@ -126,7 +126,7 @@ public class SchoolController extends DefaultBaseController { return new SuccessResultData<>(schoolService.count(params)); } - @ApiOperation(value = "导入房屋信息", notes = "导入房屋信息接口") + @ApiOperation(value = "导入教育局-请求结果数据", notes = "导入教育局-请求结果数据接口") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PostMapping("importexcel") public SuccessResultData importExcel(@RequestParam("file") MultipartFile file, HttpServletResponse response) throws Exception { @@ -155,17 +155,17 @@ public class SchoolController extends DefaultBaseController { * @param response * */ - @ApiOperation(value = "导出房屋信息失败信息", notes = "导出房屋信息失败接口") + @ApiOperation(value = "教育局-请求结果数据导入失败数据", notes = "教育局-请求结果数据导入失败数据接口") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("exportexcel") public void exportExcel(HttpServletResponse response) throws IOException { - String excelName = "出租房失败数据"; + String excelName = "教育局-请求结果数据导入失败数据"; String fileName = URLEncoder.encode(excelName, "UTF-8"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); - String [] headers = {"流水号", "批次号", "入库时间", "MD5校验码", "业务字段MD5", "分片号", + String [] headers = {"序号", "流水号", "批次号", "入库时间", "MD5校验码", "业务字段MD5", "分片号", "记录状态", "处理状态", "学校名称", "学校类型", "建筑面积", "类别", "教职工人数", - "学校地址", "行政区划", "面积", "失败原因"}; + "学校地址", "行政区划编码", "行政区划", "面积", "失败原因"}; List> listHeader = new ArrayList<>(); for(String item : headers) { List title = new ArrayList<>(); @@ -195,6 +195,7 @@ public class SchoolController extends DefaultBaseController { data.add(schoolModel.getSchoolType()); data.add(schoolModel.getWorkersCount()); data.add(schoolModel.getSchoolAddress()); + data.add(schoolModel.getAreaCode()); data.add(schoolModel.getAreaName()); data.add(schoolModel.getArea()); data.add(dto.getErrMsg()); diff --git a/src/main/java/cn/com/tenlion/systembase/pojo/model/school/SchoolModel.java b/src/main/java/cn/com/tenlion/systembase/pojo/model/school/SchoolModel.java index a133c9b..eb6d7df 100644 --- a/src/main/java/cn/com/tenlion/systembase/pojo/model/school/SchoolModel.java +++ b/src/main/java/cn/com/tenlion/systembase/pojo/model/school/SchoolModel.java @@ -39,12 +39,13 @@ public class SchoolModel { @ExcelProperty(index = 13) private String schoolAddress; @ExcelProperty(index = 14) - private String areaName; + private String areaCode; @ExcelProperty(index = 15) + private String areaName; + @ExcelProperty(index = 16) private String area; String remake; - String areaCode; private String runningTypeName; private String runningTypeCode; private String locationCode; diff --git a/src/main/java/cn/com/tenlion/systembase/service/handleimportexcel/impl/HandleImportExcelServiceImpl.java b/src/main/java/cn/com/tenlion/systembase/service/handleimportexcel/impl/HandleImportExcelServiceImpl.java index eaf7eef..a1ecb96 100644 --- a/src/main/java/cn/com/tenlion/systembase/service/handleimportexcel/impl/HandleImportExcelServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systembase/service/handleimportexcel/impl/HandleImportExcelServiceImpl.java @@ -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.pojo.dtos.excel.ImportFailDto; 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.service.handleimportexcel.IHandleImportExcelService; import cn.com.tenlion.systembase.service.school.ISchoolService; @@ -51,8 +52,8 @@ public class HandleImportExcelServiceImpl extends DefaultBaseService implements if(null != schoolModelList && schoolModelList.size() > 0) { Map params = new HashMap<>(); for(SchoolModel schoolModel: schoolModelList) { + params.remove("schoolId"); String schoolId = UUIDUtil.getUUID(); - params.put("schoolId", schoolId); params.put("dataFrom", 1); params.put("remake", schoolModel.getRemake()); params.put("schoolName", schoolModel.getSchoolName()); @@ -60,11 +61,20 @@ public class HandleImportExcelServiceImpl extends DefaultBaseService implements params.put("runningTypeCode", schoolModel.getRunningTypeCode()); params.put("runningTypeName", schoolModel.getRunningTypeName()); params.put("location", schoolModel.getAreaName()); - params.put("locationCode", schoolModel.getLocationCode()); + params.put("locationCode", schoolModel.getAreaCode()); 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); + } } } } diff --git a/src/main/java/cn/com/tenlion/systembase/util/ImportExcelHelper.java b/src/main/java/cn/com/tenlion/systembase/util/ImportExcelHelper.java index d167b93..3fa73fc 100644 --- a/src/main/java/cn/com/tenlion/systembase/util/ImportExcelHelper.java +++ b/src/main/java/cn/com/tenlion/systembase/util/ImportExcelHelper.java @@ -89,13 +89,6 @@ public class ImportExcelHelper { if(StringUtils.isEmpty(schoolModel.getAreaName())) { return "行政区划"; } - Map params = new HashMap<>(); - params.put("schoolName", schoolModel.getSchoolName()); - params.put("schoolAddress", schoolModel.getSchoolAddress()); - List schoolDTOS = schoolDao.list(params); - if(null != schoolDTOS && schoolDTOS.size() > 0) { - return "数据已存在"; - } return ""; } @@ -213,11 +206,6 @@ public class ImportExcelHelper { remake += "面积:" + schoolModel.getArea() + "\n"; schoolModel.setRemake(remake); - // 由于无法通过地区名称查找地区编码和ID,所以暂时注释掉 - /*AreaDTO areaDTO = mongoAreaService.get(schoolModel.getAreaName()); - schoolModel.setAreaName(areaDTO.getAreaName()); - schoolModel.setLocationCode(areaDTO.getAreaCode());*/ - Map params = new HashMap<>(); params.put("keywords", schoolModel.getRunningType()); params.put("dataParentId", "e5624543-4f8e-4550-a8e8-49235f23b287"); diff --git a/src/main/resources/mybatis/mapper/school/school-mapper.xml b/src/main/resources/mybatis/mapper/school/school-mapper.xml index e8a6c6c..cbd5234 100644 --- a/src/main/resources/mybatis/mapper/school/school-mapper.xml +++ b/src/main/resources/mybatis/mapper/school/school-mapper.xml @@ -290,11 +290,20 @@ FROM data_school t1 WHERE - t1.is_delete = 0 + t1.is_delete = 0 AND t1.school_id = #{schoolId} + + AND + t1.school_name = #{schoolName} + + + AND + t1.school_address = #{schoolAddress} + + LIMIT 1 diff --git a/教育局-请求结果数据_20220124180406.xls b/教育局-请求结果数据_20220124180406.xls new file mode 100644 index 0000000..a0ec959 Binary files /dev/null and b/教育局-请求结果数据_20220124180406.xls differ