diff --git a/src/main/java/com/glxp/api/controller/basic/BasicCorpExportLogController.java b/src/main/java/com/glxp/api/controller/basic/BasicCorpExportLogController.java index ce234021..b76d10ef 100644 --- a/src/main/java/com/glxp/api/controller/basic/BasicCorpExportLogController.java +++ b/src/main/java/com/glxp/api/controller/basic/BasicCorpExportLogController.java @@ -110,12 +110,14 @@ public class BasicCorpExportLogController { public BaseResponse excelDownload(@RequestBody BasicCorpsExportRequest basicCorpsExportRequest) { String fileName = "D:\\udiwms\\exportFile\\" + "往来单位信息导出" + System.currentTimeMillis() + ".UpperIn"; BasicCorpsExportLogEntity corpExportLogEntity = new BasicCorpsExportLogEntity(); + List ids=basicCorpsExportRequest.getIds(); corpExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS); String genKey = CustomUtil.getId(); corpExportLogEntity.setGenKey(genKey); corpExportLogEntity.setFilePath(fileName); corpExportLogEntity.setUpdateTime(new Date()); corpExportLogEntity.setDlCount(0); + corpExportLogEntity.setRemark("本次导出数据"+ids.size()+"条"); corpExportLogEntity.setType(BasicProcessStatus.EXPORT_JSON); basicCorpExportLogService.insertCorpExportLog(corpExportLogEntity); //basicGenExcelService.exportCorp(genKey, corpsExportRequest); diff --git a/src/main/java/com/glxp/api/controller/basic/BasicCorpImportLogController.java b/src/main/java/com/glxp/api/controller/basic/BasicCorpImportLogController.java index 7ceffd69..a110c3fc 100644 --- a/src/main/java/com/glxp/api/controller/basic/BasicCorpImportLogController.java +++ b/src/main/java/com/glxp/api/controller/basic/BasicCorpImportLogController.java @@ -10,12 +10,10 @@ import com.glxp.api.constant.BasicProcessStatus; import com.glxp.api.entity.basic.BasicCorpsImportDetailEntity; import com.glxp.api.entity.basic.BasicCorpsImportLogEntity; import com.glxp.api.req.basic.FilterCorpImportLogRequest; -import com.glxp.api.req.basic.PostBasicCorpRequest; import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.basic.BasicCorpExportLogResponse; import com.glxp.api.service.auth.CustomerService; -import com.glxp.api.service.basic.BasicCorpImportDetailService; import com.glxp.api.service.basic.BasicCorpImportLogService; import com.glxp.api.service.thrsys.ThrSystemService; import com.glxp.api.util.CustomUtil; @@ -35,8 +33,6 @@ public class BasicCorpImportLogController { @Resource BasicCorpImportLogService basicCorpImportLogService; @Resource - BasicCorpImportDetailService basicCorpImportDetailService; - @Resource ThrSystemService thrSystemService; @Resource CustomerService customerService; @@ -59,23 +55,6 @@ public class BasicCorpImportLogController { return ResultVOUtils.success(pageSimpleResponse); } - @GetMapping("/udiwms/corps/importLog/filterDetail") - public BaseResponse filterDetail(FilterCorpImportLogRequest filterCorpImportLogRequest, - BindingResult bindingResult) { - - if (bindingResult.hasErrors()) { - return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); - } - List corpImportDetailEntities = basicCorpImportDetailService.filterCorpImport(filterCorpImportLogRequest); - PageInfo pageInfo; - pageInfo = new PageInfo<>(corpImportDetailEntities); - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); - pageSimpleResponse.setTotal(pageInfo.getTotal()); - pageSimpleResponse.setList(corpImportDetailEntities); - return ResultVOUtils.success(pageSimpleResponse); - } - - @PostMapping("/udiwms/corps/importLog/deleteLog") public BaseResponse deleteLog(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { @@ -89,25 +68,11 @@ public class BasicCorpImportLogController { if (corpImportLogEntities != null && corpImportLogEntities.size() > 0) { BasicCorpsImportLogEntity corpImportLogEntity = corpImportLogEntities.get(0); basicCorpImportLogService.deleteById(corpImportLogEntity.getId() + ""); - basicCorpImportDetailService.deleteByGenkey(corpImportLogEntity.getGenKey()); } return ResultVOUtils.success("删除成功"); } - @PostMapping("/udiwms/corps/importLog/delete") - public BaseResponse delete(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { - - if (bindingResult.hasErrors()) { - return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); - } - if (basicCorpImportDetailService.deleteById(deleteRequest.getId())) - return ResultVOUtils.success("删除成功"); - else - return ResultVOUtils.error(500, "删除成功"); - } - - //往来单位信息文件导入 @PostMapping("/udiwms/corps/importLog/upload") public BaseResponse uploadCorp(@RequestParam("file") List files, @RequestParam("thirdSys") String thirdSys) { @@ -136,12 +101,12 @@ public class BasicCorpImportLogController { corpImportLogEntity.setFromType("文件导入"); corpImportLogEntity.setUpdateTime(new Date()); corpImportLogEntity.setCreateTime(new Date()); - corpImportLogEntity.setCreateUser(String.valueOf(customerService.getUserId())); - corpImportLogEntity.setUpdateUser(String.valueOf(customerService.getUserId())); +// corpImportLogEntity.setCreateUser(String.valueOf(customerService.getUserId())); +// corpImportLogEntity.setUpdateUser(String.valueOf(customerService.getUserId())); corpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS); corpImportLogEntity.setUpdateTime(new Date(System.currentTimeMillis())); basicCorpImportLogService.insertImportLog(corpImportLogEntity); - basicCorpImportLogService.importJsonData(data); + basicCorpImportLogService.importJsonData(data,corpImportLogEntity.getGenKey()); corpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS); basicCorpImportLogService.updateImportLog(corpImportLogEntity); } else { diff --git a/src/main/java/com/glxp/api/service/basic/BasicCorpImportLogService.java b/src/main/java/com/glxp/api/service/basic/BasicCorpImportLogService.java index 0d73f872..f9f2235a 100644 --- a/src/main/java/com/glxp/api/service/basic/BasicCorpImportLogService.java +++ b/src/main/java/com/glxp/api/service/basic/BasicCorpImportLogService.java @@ -20,10 +20,9 @@ public interface BasicCorpImportLogService { boolean deleteById(@Param("id") String id); - void importCorps(String genKey); - void importJsonData(BasicCorpExportLogResponse importData); + void importJsonData(BasicCorpExportLogResponse importData,String genKey); diff --git a/src/main/java/com/glxp/api/service/basic/impl/BasicCorpImportLogServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/BasicCorpImportLogServiceImpl.java index 1c7f7e2c..9bf64498 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/BasicCorpImportLogServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/BasicCorpImportLogServiceImpl.java @@ -14,9 +14,9 @@ import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest; import com.glxp.api.req.basic.FilterCorpImportLogRequest; import com.glxp.api.res.basic.BasicCorpExportLogResponse; import com.glxp.api.res.thrsys.ThrCorpsResponse; -import com.glxp.api.service.basic.BasicCorpImportDetailService; import com.glxp.api.service.basic.BasicCorpImportLogService; import com.glxp.api.service.basic.BasicUnitMaintainService; +import com.glxp.api.util.IpUtils; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.session.ExecutorType; import org.apache.ibatis.session.SqlSession; @@ -36,12 +36,8 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService @Resource BasicCorpImportLogDao basicCorpImportLogDao; - - @Resource - BasicCorpImportDetailService basicCorpImportDetailService; - @Resource - BasicUnitMaintainService basicUnitMaintainService; + BasicCorpImportLogService basicCorpImportLogService; @Resource SqlSessionFactory sqlSessionFactory; @@ -85,40 +81,6 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService return basicCorpImportLogDao.deleteById(id); } - @Async - @Override - public void importCorps(String genKey) { - - BasicCorpsImportLogEntity corpImportLogEntity =selectByGenKey(genKey); - if (corpImportLogEntity != null && corpImportLogEntity.getStatus() == BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS) { - FilterCorpImportLogRequest filterUdiIpLogRequest = new FilterCorpImportLogRequest(); - filterUdiIpLogRequest.setGenKey(genKey); - List corpImportDetailEntities - = basicCorpImportDetailService.filterCorpImport(filterUdiIpLogRequest); - if (corpImportDetailEntities != null) { - for (BasicCorpsImportDetailEntity corpImportDetailEntity : corpImportDetailEntities) { - BasicCorpEntity basicCorpEntity = new BasicCorpEntity(); - BeanUtils.copyProperties(corpImportDetailEntity, basicCorpEntity); - BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest = new BasicUnitMaintainFilterRequest(); - BeanUtils.copyProperties(corpImportDetailEntity, basicUnitMaintainFilterRequest); - List basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest); - if (basicUnitMaintainEntities != null && basicUnitMaintainEntities.size() > 0) { - basicUnitMaintainService.insertBasicUnitMaintain(basicCorpEntity); - corpImportDetailEntity.setImportStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_SUCESS); - } else { - corpImportDetailEntity.setImportStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL); - corpImportDetailEntity.setRemark("重复导入!"); - } - basicCorpImportDetailService.updateCorpImport(corpImportDetailEntity); - - } - } - corpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS); - updateImportLog(corpImportLogEntity); - } - - - } /** * 导入上传文件中的往来单位信息 @@ -126,10 +88,7 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService * @param */ @Async - public void importJsonData(BasicCorpExportLogResponse importData) { - - - + public void importJsonData(BasicCorpExportLogResponse importData,String genKey) { if (null != importData) { SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED); @@ -142,8 +101,16 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService } batchSession.commit(); log.info("导入往来单位数据成功,导入数量为:{} 条", corpList.size()); + BasicCorpsImportLogEntity basicCorpsImportLogEntity=new BasicCorpsImportLogEntity(); + basicCorpsImportLogEntity.setGenKey(genKey); + basicCorpsImportLogEntity.setRemark("导入数据成功,导入数量为:"+ corpList.size()+"条"); + basicCorpImportLogService.updateImportLog(basicCorpsImportLogEntity); } catch (Exception e) { log.error("导入往来单位信息异常", e); + BasicCorpsImportLogEntity basicCorpsImportLogEntity=new BasicCorpsImportLogEntity(); + basicCorpsImportLogEntity.setGenKey(genKey); + basicCorpsImportLogEntity.setRemark("导入数据失败"); + basicCorpImportLogService.updateImportLog(basicCorpsImportLogEntity); } }