Merge branch 'master' into test

pro
wj 2 years ago
commit 2169de489e

@ -292,7 +292,7 @@ public class SysUserController extends BaseController {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
// 修改角色
// userService.insertUserAuth(authAdmin.getId(), authUserSaveRequest.getRoles());
userService.insertUserAuth(authAdmin.getId(), authUserSaveRequest.getRoles());
userService.updateAuthAdmin(authAdmin);

@ -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,14 +370,15 @@ 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);
basicDownloadService.insertDownloadStatus(downloadStatus);
return ResultVOUtils.success();
return ResultVOUtils.success(log);
} 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())) {
systemParamConfigDao.insertOrUpdateBatch(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())) {
entrustReceDao.insertOrUpdateBatch(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())) {
systemPDFModuleDao.insertOrUpdateBatch(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())
systemPDFTemplateDao.insertOrUpdate(systemPDFTemplateEntity);
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())) {
sysPdfTemplateRelevanceCodeDao.insertOrUpdateBatch(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())) {
sysPdfTemplateRelevanceBizDao.insertOrUpdateBatch(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())) {
sysPdfTemplateRelevanceLabelDao.insertOrUpdateBatch(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())) {
sysPdfTemplateRelevanceStatemenDao.insertOrUpdateBatch(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())) {
basicBusTypePreDao.insertOrUpdateBatch(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())) {
basicBusTypeChangeDao.insertOrUpdateBatch(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())) {
thrDeptDao.insertOrUpdateBatch(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())) {
thrInvWarehouseDao.insertOrUpdateBatch(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())) {
thrProductsDao.insertOrUpdateBatch(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())) {
thrCorpDao.insertOrUpdateBatch(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())) {
authAdminDao.insertOrUpdateBatch(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())) {
deptDao.insertOrUpdateBatch(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())) {
deptUserDao.replaceBatch(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())) {
invWarehouseDao.insertOrUpdateBatch(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())) {
warehouseUserDao.insertOrUpdateBatch(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())) {
for (WarehouseBussinessTypeEntity warehouseBussinessTypeEntity : bean.getWarehouseBussinessTypeEntities()) {
warehouseBussinessTypeDao.insertOrUpdate(warehouseBussinessTypeEntity);
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())) {
invSpaceDao.insertOrUpdateBatch(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())) {
invBusUserDao.insertOrUpdateBatch(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())) {
basicBussinessTypeDao.insertOrUpdateBatch(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())) {
busTypeChangeDao.insertOrUpdateBatch(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())) {
thrBusTypeOriginDao.insertOrUpdateBatch(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())) {
ioCodeLostMapper.insertOrUpdateBatch(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())) {
ioCodeRelMapper.insertOrUpdateBatch(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())) {
basicHospTypeDao.insertOrUpdateBatch(bean.getHospTypeList());
String desc = "物资字典分类信息:";
try {
basicHospTypeDao.insertOrUpdateBatch(bean.getHospTypeList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getUdiRelevanceList())) {
udiRelevanceDao.insertOrUpdateBatch(bean.getUdiRelevanceList());
String desc = "物资字典主表信息:";
try {
udiRelevanceDao.insertOrUpdateBatch(bean.getUdiRelevanceList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getProductsList())) {
basicProductsDao.insertOrUpdateBatch(bean.getProductsList());
String desc = "供应商物资字典信息:";
try {
basicProductsDao.insertOrUpdateBatch(bean.getProductsList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getRelevanceList())) {
relevanceDao.insertOrUpdateBatch(bean.getRelevanceList());
String desc = "物资字典子表信息:";
try {
relevanceDao.insertOrUpdateBatch(bean.getRelevanceList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getCorpList())) {
corpDao.insertOrUpdateBatch(bean.getCorpList());
String desc = "往来单位信息:";
try {
corpDao.insertOrUpdateBatch(bean.getCorpList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupCertList())) {
supCertDao.insertOrUpdateBatch(bean.getSupCertList());
String desc = "资质证书信息:";
try {
supCertDao.insertOrUpdateBatch(bean.getSupCertList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupCertSetList())) {
supCertSetDao.insertOrUpdateBatch(bean.getSupCertSetList());
String desc = "资质证书要求设置信息:";
try {
supCertSetDao.insertOrUpdateBatch(bean.getSupCertSetList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupCompanyList())) {
supCompanyDao.insertOrUpdateBatch(bean.getSupCompanyList());
String desc = "供应商资质信息:";
try {
supCompanyDao.insertOrUpdateBatch(bean.getSupCompanyList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupManufacturerList())) {
supManufacturerDao.insertOrUpdateBatch(bean.getSupManufacturerList());
String desc = "生产企业资质信息:";
try {
supManufacturerDao.insertOrUpdateBatch(bean.getSupManufacturerList());
success.add(desc + "成功");
} catch (Exception e) {
fail.add(desc + "失败");
}
}
if (CollectionUtil.isNotEmpty(bean.getSupProductList())) {
supProductDao.insertOrUpdateBatch(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;
}

@ -198,14 +198,14 @@ public class IoChangeInoutService {
outOrder.setFromInvCode(null);
outOrder.setFromDeptCode(null);
} else if (bussinessChangeTypeEntity.getCreateType() == 3) { //寄售、预验收补单
outOrder.setCustomerId(null);
outOrder.setFromCorp(null);
outOrder.setCustomerId(corpName);
outOrder.setFromCorp(corpName);
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(Constant.INV_PRE_IN_CODE);
outOrder.setFromInvCode(invWarehouseEntity.getCode());
outOrder.setFromDeptCode(invWarehouseEntity.getParentId());
} else if (bussinessChangeTypeEntity.getCreateType() == 4) {
outOrder.setCustomerId(null);
outOrder.setFromCorp(null);
outOrder.setCustomerId(corpName);
outOrder.setFromCorp(corpName);
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(Constant.INV_PRE_CODE);
outOrder.setFromInvCode(invWarehouseEntity.getCode());
outOrder.setFromDeptCode(invWarehouseEntity.getParentId());

@ -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);
@ -356,3 +359,4 @@ ALTER TABLE `auth_dept_user`
ADD UNIQUE (`userId`, deptId);
CALL Pro_Temp_ColumnWork('sync_data_bustypes', 'id', 'bigint', 2);

Loading…
Cancel
Save