代码备份,文件导入导出优化

master
anthonyywj2 3 years ago
parent 0cf0d11579
commit 1c889b1c18

@ -8,6 +8,7 @@ import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
import com.glxp.api.admin.req.basic.UdiInfoExportRequest;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.UdiRelevanceExportJsonResponse;
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
import com.glxp.api.admin.res.basic.UdiRlDlResponse;
import com.glxp.api.admin.service.basic.UdiInfoExportLogService;
@ -145,7 +146,9 @@ public class UdiInfoExportLogController {
udiInfoExportLogEntity.setType(BasicProcessStatus.EXPORT_SMP);
udiInfoExportLogEntity.setDlCount(0);
udiInfoExportLogService.insertUdiInfoExportLog(udiInfoExportLogEntity);
basicGenExcelService.uploadProductsSmp(genKey, udiInfoExportRequest);
UdiRelevanceExportJsonResponse exportData = basicGenJsonService.paresDataJson(udiInfoExportRequest);
basicGenExcelService.uploadProductsSmpJson(genKey, exportData);
// basicGenExcelService.uploadProductsSmp(genKey, udiInfoExportRequest);
return ResultVOUtils.success("后台正在上传,请稍后刷新查看!");
}

@ -7,6 +7,7 @@ import com.glxp.api.admin.constant.ConstantStatus;
import com.glxp.api.admin.entity.basic.*;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.req.basic.*;
import com.glxp.api.admin.res.basic.UdiRelevanceExportJsonResponse;
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
import com.glxp.api.admin.service.basic.BasicUnitMaintainService;
import com.glxp.api.admin.service.basic.CorpExportLogService;
@ -222,6 +223,20 @@ public class BasicGenExcelService {
udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity);
}
@Async
public void uploadProductsSmpJson(String genKey, UdiRelevanceExportJsonResponse exportData) {
UdiInfoExportLogEntity udiInfoExportLogEntity = udiInfoExportLogService.selectByGenKey(genKey);
String response = HttpClient.uCloudPost(spsSyncUrl + "/udiwms/basic/products/upload", exportData);
BaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});
if (baseResponse.getCode() == 20000) {
udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
} else {
udiInfoExportLogEntity.setRemark(baseResponse.getMessage());
udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity);
}
@Async
public void uploadProductsSmp(String genKey, UdiInfoExportRequest udiInfoExportRequest) {

@ -80,6 +80,23 @@ public class BasicGenJsonService {
@Async
public void exportUdiInfoJson(String genKey, UdiInfoExportRequest udiInfoExportRequest) {
UdiInfoExportLogEntity udiInfoExportLogEntity = udiInfoExportLogService.selectByGenKey(genKey);
UdiRelevanceExportJsonResponse exportData = paresDataJson(udiInfoExportRequest);
File file = new File(udiInfoExportLogEntity.getFilePath());
if (!file.exists()) {
try {
file.createNewFile();
} catch (Exception e) {
log.error("导出医疗器械信息异常", e);
}
}
FileWriter writer = new FileWriter(file);
writer.write(JSONUtil.toJsonStr(exportData));
udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity);
}
public UdiRelevanceExportJsonResponse paresDataJson(UdiInfoExportRequest udiInfoExportRequest) {
UdiRelevanceExportJsonResponse exportData = new UdiRelevanceExportJsonResponse();
//选中导出
if (CollUtil.isNotEmpty(udiInfoExportRequest.getUuids())) {
@ -102,22 +119,9 @@ public class BasicGenJsonService {
parseUdiRelevanceResponses(exportData, data);
}
}
File file = new File(udiInfoExportLogEntity.getFilePath());
if (!file.exists()) {
try {
file.createNewFile();
} catch (Exception e) {
log.error("导出医疗器械信息异常", e);
}
}
FileWriter writer = new FileWriter(file);
writer.write(JSONUtil.toJsonStr(exportData));
udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity);
return exportData;
}
/**
*
*

@ -1,6 +1,7 @@
package com.glxp.api.admin.thread;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.glxp.api.admin.constant.ConstantStatus;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.BasicUnitMaintainEntity;
import com.glxp.api.admin.entity.thrsys.ThrCorpEntity;
@ -101,6 +102,7 @@ public class BasicUnitImportService {
}
basicUnitMaintainEntity.setAddr(erpUnitsResponse.getAddr());
basicUnitMaintainEntity.setCreditNo(erpUnitsResponse.getCreditNo());
basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SP);
basicUnitMaintainEntity.setContact(erpUnitsResponse.getContact());
basicUnitMaintainEntity.setMobile(erpUnitsResponse.getMobile());
basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity);

Loading…
Cancel
Save