基础信息往来信息代码提交

master
郑明梁 2 years ago
parent fcbc217750
commit fed0fcf9d2

@ -108,7 +108,7 @@ public class BasicCorpExportLogController {
//往来单位导出生成Excel并创建生成记录
@PostMapping("/udiwms/corps/importLog/export")
public BaseResponse excelDownload(@RequestBody BasicCorpsExportRequest basicCorpsExportRequest) {
String fileName = "D:\\udiwms\\exportFile\\" + "往来单位信息导出" + System.currentTimeMillis() + ".udi";
String fileName = "D:\\udiwms\\exportFile\\" + "往来单位信息导出" + System.currentTimeMillis() + ".UpperIn";
BasicCorpsExportLogEntity corpExportLogEntity = new BasicCorpsExportLogEntity();
corpExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
String genKey = CustomUtil.getId();

@ -14,6 +14,7 @@ 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;
@ -37,6 +38,8 @@ public class BasicCorpImportLogController {
BasicCorpImportDetailService basicCorpImportDetailService;
@Resource
ThrSystemService thrSystemService;
@Resource
CustomerService customerService;
@GetMapping("/udiwms/corps/importLog/filter")
@ -122,7 +125,7 @@ public class BasicCorpImportLogController {
//解析数据
try {
String fileType = fileName.substring(fileName.lastIndexOf("."));
if (".udi".equalsIgnoreCase(fileType)) {
if (".udi".equalsIgnoreCase(fileType) || ".LowerIn".equalsIgnoreCase(fileType)) {
String jsonData = IoUtil.read(file.getInputStream()).toString();
BasicCorpExportLogResponse data = JSONUtil.toBean(jsonData, BasicCorpExportLogResponse.class);
@ -131,6 +134,10 @@ public class BasicCorpImportLogController {
String genKey = CustomUtil.getId();
corpImportLogEntity.setGenKey(genKey);
corpImportLogEntity.setFromType("文件导入");
corpImportLogEntity.setUpdateTime(new Date());
corpImportLogEntity.setCreateTime(new Date());
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);
@ -138,7 +145,7 @@ public class BasicCorpImportLogController {
corpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
basicCorpImportLogService.updateImportLog(corpImportLogEntity);
} else {
return ResultVOUtils.error(500, "请上传udi文件");
return ResultVOUtils.error(500, "请上传udi文件或者LowerIn文件");
}
} catch (Exception e) {
log.error("导入往来单位信息错误,文件名为:{}", fileName);
@ -147,42 +154,4 @@ public class BasicCorpImportLogController {
return ResultVOUtils.success("上传成功");
}
//往来单位信息接口上传
@PostMapping("/udiwms/basic/corps/upload")
public BaseResponse postUdiInfo(@RequestBody PostBasicCorpRequest postBasicCorpRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
String genKey = postBasicCorpRequest.getGenKey();
if (genKey == null) {
genKey = CustomUtil.getId();
}
BasicCorpsImportLogEntity corpImportLogEntity = basicCorpImportLogService.selectByGenKey(genKey);
List<BasicCorpsImportDetailEntity> corpImportDetailEntities = postBasicCorpRequest.getDatas();
if (corpImportDetailEntities != null) {
for (BasicCorpsImportDetailEntity corpImportDetailEntity : corpImportDetailEntities) {
corpImportDetailEntity.setGenKeyFk(genKey);
corpImportDetailEntity.setImportStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_UNPROCESS);
corpImportDetailEntity.setUpdateTime(new Date());
basicCorpImportDetailService.insertCorpImport(corpImportDetailEntity);
}
}
if (corpImportLogEntity == null) {
corpImportLogEntity = new BasicCorpsImportLogEntity();
corpImportLogEntity.setGenKey(genKey);
corpImportLogEntity.setFromType("接口上传");
corpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS);
corpImportLogEntity.setUpdateTime(new Date(System.currentTimeMillis()));
basicCorpImportLogService.insertImportLog(corpImportLogEntity);
} else {
corpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS);
basicCorpImportLogService.updateImportLog(corpImportLogEntity);
}
basicCorpImportLogService.importCorps(genKey);
return ResultVOUtils.success("上传成功");
}
}

@ -127,6 +127,10 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService
*/
@Async
public void importJsonData(BasicCorpExportLogResponse importData) {
if (null != importData) {
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
if (CollUtil.isNotEmpty(importData.getCorpList())) {

Loading…
Cancel
Save