增加执行信息

master
wj 2 years ago
parent 9434f89b5c
commit 98c0b2ed30

@ -66,8 +66,10 @@ import javax.validation.Valid;
import java.io.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@Api(tags = "同步下载相关")
@ -333,28 +335,28 @@ public class SpsSyncDownloadController {
@ApiOperation("上传同步数据")
@PostMapping("sps/sync/upload/data")
@Transactional
public Object uploadData(@RequestBody SyncUpLoadRequest upLoadRequest) {
try {
JSONObject obj = JSONUtil.parseObj(upLoadRequest.getData());
String log = "";
switch (upLoadRequest.getExportType()) {
case BASIC_DATA:
saveUploadBasicData(JSONUtil.toBean(obj, SpsSyncBasicDataResponse.class));
log = saveUploadBasicData(JSONUtil.toBean(obj, SpsSyncBasicDataResponse.class));
break;
case OTHER_DATA:
saveUploadOtherData(JSONUtil.toBean(obj, SpsSyncOtherDataResponse.class));
log = saveUploadOtherData(JSONUtil.toBean(obj, SpsSyncOtherDataResponse.class));
break;
case DOCUMENT_TYPE_DATA:
saveUploadDocumentTypeData(JSONUtil.toBean(obj, SpsSyncBusResponse.class));
log = saveUploadDocumentTypeData(JSONUtil.toBean(obj, SpsSyncBusResponse.class));
break;
case USER_DATA:
saveUploadUserData(JSONUtil.toBean(obj, SpsSyncDataResponse.class));
log = saveUploadUserData(JSONUtil.toBean(obj, SpsSyncDataResponse.class));
break;
case THIRD_DATA:
saveUploadThrData(JSONUtil.toBean(obj, SpsSyncThrDataResponse.class));
log = saveUploadThrData(JSONUtil.toBean(obj, SpsSyncThrDataResponse.class));
break;
case SYS_SET_DATA:
saveUploadSysSettingData(JSONUtil.toBean(obj, SpsSyncSysSettingResponse.class));
log = saveUploadSysSettingData(JSONUtil.toBean(obj, SpsSyncSysSettingResponse.class));
break;
}
String taskId = obj.getStr("taskId");
@ -368,6 +370,7 @@ public class SpsSyncDownloadController {
.type(upLoadRequest.getExportType().getRemark())
.idDatas(upLoadRequest.getExportType().getKey())
.scheduleType(1)
.execInfo(log)
.build();
String fileFullPath = writeFile(filePrefix, upLoadRequest.getExportType().getRemark(), JSONUtil.toJsonStr(upLoadRequest.getData()));
downloadStatus.setCacheFilePath(fileFullPath);
@ -375,7 +378,7 @@ public class SpsSyncDownloadController {
return ResultVOUtils.success();
} catch (Exception e) {
e.printStackTrace();
return ResultVOUtils.error(ResultEnum.NOT_NETWORK, e.getMessage());
return ResultVOUtils.error(ResultEnum.NOT_NETWORK.getCode(), e.getMessage());
}
}
@ -413,40 +416,120 @@ public class SpsSyncDownloadController {
private final BasicBusTypeChangeDao basicBusTypeChangeDao;
private void saveUploadSysSettingData(SpsSyncSysSettingResponse bean) {
private String saveUploadSysSettingData(SpsSyncSysSettingResponse bean) {
List<String> success = new ArrayList<>();
List<String> fail = new ArrayList<>();
if (CollectionUtil.isNotEmpty(bean.getSystemParamConfigEntities())) {
String desc = "运行参数设置信息:";
try {
systemParamConfigDao.insertOrUpdateBatch(bean.getSystemParamConfigEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getEntrustReceEntities())) {
String desc = "委托验收设置信息:";
try {
entrustReceDao.insertOrUpdateBatch(bean.getEntrustReceEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSystemPDFModuleEntities())) {
String desc = "系统模板模块信息:";
try {
systemPDFModuleDao.insertOrUpdateBatch(bean.getSystemPDFModuleEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSystemPDFTemplateEntities())) {
for (SystemPDFTemplateEntity systemPDFTemplateEntity : bean.getSystemPDFTemplateEntities())
String desc = "模板信息:";
boolean flag = true;
int failCount = 0;
try {
for (SystemPDFTemplateEntity systemPDFTemplateEntity : bean.getSystemPDFTemplateEntities()) {
try {
systemPDFTemplateDao.insertOrUpdate(systemPDFTemplateEntity);
} catch (Exception e) {
e.printStackTrace();
flag = false;
failCount++;
}
}
success.add(desc + "成功" + (bean.getSystemPDFTemplateEntities().size() - failCount) + "条");
} catch (Exception e) {
fail.add(desc + "失败" + failCount + "条");
}
}
if (CollectionUtil.isNotEmpty(bean.getSysPdfTemplateRelevanceCodeEntities())) {
String desc = "扫码单据关联模板信息:";
try {
sysPdfTemplateRelevanceCodeDao.insertOrUpdateBatch(bean.getSysPdfTemplateRelevanceCodeEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSysPdfTemplateRelevanceBizEntities())) {
String desc = "业务单据关联模板信息:";
try {
sysPdfTemplateRelevanceBizDao.insertOrUpdateBatch(bean.getSysPdfTemplateRelevanceBizEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSysPdfTemplateRelevanceLabelEntities())) {
String desc = "标签关联模板信息:";
try {
sysPdfTemplateRelevanceLabelDao.insertOrUpdateBatch(bean.getSysPdfTemplateRelevanceLabelEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSysPdfTemplateRelevanceStatemenEntities())) {
String desc = "报表关联模板信息:";
try {
sysPdfTemplateRelevanceStatemenDao.insertOrUpdateBatch(bean.getSysPdfTemplateRelevanceStatemenEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getBasicBusTypePreEntities())) {
String desc = "出入库单自动补单设置信息:";
try {
basicBusTypePreDao.insertOrUpdateBatch(bean.getBasicBusTypePreEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getBasicBusTypeChangeEntities())) {
String desc = "业务单自动补单设置信息:";
try {
basicBusTypeChangeDao.insertOrUpdateBatch(bean.getBasicBusTypeChangeEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
success.addAll(fail);
return String.join(",", success);
}
@ -455,50 +538,147 @@ public class SpsSyncDownloadController {
private final ThrProductsDao thrProductsDao;
private final ThrCorpDao thrCorpDao;
private void saveUploadThrData(SpsSyncThrDataResponse bean) {
private String saveUploadThrData(SpsSyncThrDataResponse bean) {
List<String> success = new ArrayList<>();
List<String> fail = new ArrayList<>();
if (CollectionUtil.isNotEmpty(bean.getDeptEntities())) {
String desc = "第三方部门信息:";
try {
thrDeptDao.insertOrUpdateBatch(bean.getDeptEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getInvWarehouseEntities())) {
String desc = "第三方仓库信息:";
try {
thrInvWarehouseDao.insertOrUpdateBatch(bean.getInvWarehouseEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getProductsEntityList())) {
String desc = "第三方产品信息:";
try {
thrProductsDao.insertOrUpdateBatch(bean.getProductsEntityList());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getCorpEntities())) {
String desc = "第三方往来信息:";
try {
thrCorpDao.insertOrUpdateBatch(bean.getCorpEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
success.addAll(fail);
return String.join(",", success);
}
private void saveUploadUserData(SpsSyncDataResponse bean) {
private String saveUploadUserData(SpsSyncDataResponse bean) {
List<String> success = new ArrayList<>();
List<String> fail = new ArrayList<>();
if (CollectionUtil.isNotEmpty(bean.getAuthAdminList())) {
String desc = "系统用户信息:";
try {
authAdminDao.insertOrUpdateBatch(bean.getAuthAdminList());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getDeptEntityList())) {
String desc = "部门信息:";
try {
deptDao.insertOrUpdateBatch(bean.getDeptEntityList());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getDeptUserEntities())) {
String desc = "部门用户信息:";
try {
deptUserDao.replaceBatch(bean.getDeptUserEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getInvWarehouseEntities())) {
String desc = "仓库字典信息:";
try {
invWarehouseDao.insertOrUpdateBatch(bean.getInvWarehouseEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getWarehouseUserEntities())) {
String desc = "仓库用户信息:";
try {
warehouseUserDao.insertOrUpdateBatch(bean.getWarehouseUserEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getWarehouseBussinessTypeEntities())) {
String desc = "仓库单据类型信息:";
boolean flag = true;
int failCount = 0;
try {
for (WarehouseBussinessTypeEntity warehouseBussinessTypeEntity : bean.getWarehouseBussinessTypeEntities()) {
try {
warehouseBussinessTypeDao.insertOrUpdate(warehouseBussinessTypeEntity);
} catch (Exception e) {
e.printStackTrace();
flag = false;
failCount++;
}
}
success.add(desc + "成功" + (bean.getWarehouseBussinessTypeEntities().size() - failCount) + "条");
} catch (Exception e) {
fail.add(desc + "失败" + failCount + "条");
}
}
if (CollectionUtil.isNotEmpty(bean.getInvSpaces())) {
String desc = "货位信息:";
try {
invSpaceDao.insertOrUpdateBatch(bean.getInvSpaces());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getInvBusUserEntities())) {
String desc = "用户关联单据信息:";
try {
invBusUserDao.insertOrUpdateBatch(bean.getInvBusUserEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
success.addAll(fail);
return String.join(",", success);
}
private final BasicBussinessTypeDao basicBussinessTypeDao;
@ -511,16 +691,41 @@ public class SpsSyncDownloadController {
*
* @param bean
*/
private void saveUploadDocumentTypeData(SpsSyncBusResponse bean) {
private String saveUploadDocumentTypeData(SpsSyncBusResponse bean) {
List<String> success = new ArrayList<>();
List<String> fail = new ArrayList<>();
if (CollectionUtil.isNotEmpty(bean.getBussinessTypeEntities())) {
String desc = "扫码单据类型信息:";
try {
basicBussinessTypeDao.insertOrUpdateBatch(bean.getBussinessTypeEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getBusTypeChangeEntities())) {
String desc = "业务单据类型:";
try {
busTypeChangeDao.insertOrUpdateBatch(bean.getBusTypeChangeEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getThrBusTypeOriginEntities())) {
String desc = "第三方单据类型信息:";
try {
thrBusTypeOriginDao.insertOrUpdateBatch(bean.getThrBusTypeOriginEntities());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
success.addAll(fail);
return String.join(",", success);
}
@ -532,14 +737,31 @@ public class SpsSyncDownloadController {
*
* @param bean
*/
private void saveUploadOtherData(SpsSyncOtherDataResponse bean) {
private String saveUploadOtherData(SpsSyncOtherDataResponse bean) {
List<String> success = new ArrayList<>();
List<String> fail = new ArrayList<>();
if (CollectionUtil.isNotEmpty(bean.getIoCodeLostList())) {
String desc = "UDI码补齐信息";
try {
ioCodeLostMapper.insertOrUpdateBatch(bean.getIoCodeLostList());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getIoCodeRelList())) {
String desc = "UDI码关联关系";
try {
ioCodeRelMapper.insertOrUpdateBatch(bean.getIoCodeRelList());
success.add(desc + "成功");
} catch (Exception e) {
e.printStackTrace();
fail.add(desc + "失败");
}
}
success.addAll(fail);
return String.join(",", success);
}
private final BasicHospTypeDao basicHospTypeDao;
@ -558,37 +780,101 @@ public class SpsSyncDownloadController {
*
* @param bean
*/
private void saveUploadBasicData(SpsSyncBasicDataResponse bean) {
private String saveUploadBasicData(SpsSyncBasicDataResponse bean) {
List<String> success = new ArrayList<>();
List<String> fail = new ArrayList<>();
if (CollectionUtil.isNotEmpty(bean.getHospTypeList())) {
String desc = "物资字典分类信息:";
try {
basicHospTypeDao.insertOrUpdateBatch(bean.getHospTypeList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getUdiRelevanceList())) {
String desc = "物资字典主表信息:";
try {
udiRelevanceDao.insertOrUpdateBatch(bean.getUdiRelevanceList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getProductsList())) {
String desc = "供应商物资字典信息:";
try {
basicProductsDao.insertOrUpdateBatch(bean.getProductsList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getRelevanceList())) {
String desc = "物资字典子表信息:";
try {
relevanceDao.insertOrUpdateBatch(bean.getRelevanceList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getCorpList())) {
String desc = "往来单位信息:";
try {
corpDao.insertOrUpdateBatch(bean.getCorpList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupCertList())) {
String desc = "资质证书信息:";
try {
supCertDao.insertOrUpdateBatch(bean.getSupCertList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupCertSetList())) {
String desc = "资质证书要求设置信息:";
try {
supCertSetDao.insertOrUpdateBatch(bean.getSupCertSetList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupCompanyList())) {
String desc = "供应商资质信息:";
try {
supCompanyDao.insertOrUpdateBatch(bean.getSupCompanyList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupManufacturerList())) {
String desc = "生产企业资质信息:";
try {
supManufacturerDao.insertOrUpdateBatch(bean.getSupManufacturerList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupProductList())) {
String desc = "配送产品资质信息:";
try {
supProductDao.insertOrUpdateBatch(bean.getSupProductList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
success.addAll(fail);
return String.join(",", success);
}
@Resource

@ -35,4 +35,5 @@ public class BasicDownloadStatusEntity {
private String remark;
@TableField(value = "cacheFilePath")
private String cacheFilePath;
private String execInfo;
}

@ -1,5 +1,8 @@
# 字段新增 表名字段名字段类型修改方式1新增2修改3删除
CALL Pro_Temp_ColumnWork('basic_download_status', 'execInfo',
'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('basic_download_status', 'cacheFilePath',
'varchar(255) ', 1);

Loading…
Cancel
Save