|
|
|
@ -5,25 +5,17 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
|
|
|
|
import com.glxp.sale.admin.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.sale.admin.dao.auth.AuthAdminDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.basic.*;
|
|
|
|
|
import com.glxp.sale.admin.dao.info.CompanyProductRelevanceDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.inout.CodesDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.inout.OrderDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.inout.OrderDetailDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.thrsys.ThrCorpDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.thrsys.ThrOrderDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.thrsys.ThrOrderDetailDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.thrsys.ThrProductsDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.inout.*;
|
|
|
|
|
import com.glxp.sale.admin.dao.thrsys.*;
|
|
|
|
|
import com.glxp.sale.admin.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.sale.admin.entity.basic.*;
|
|
|
|
|
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.inout.ErpOrderEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.inout.OrderEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.inout.*;
|
|
|
|
|
import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.ThrCorpEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.ThrOrderDetailEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.ThrOrderEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.ThrProductsEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.*;
|
|
|
|
|
import com.glxp.sale.admin.req.basic.SpsSyncDataRequest;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.SpsSyncBusResponse;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.SpsSyncDataResponse;
|
|
|
|
@ -56,13 +48,18 @@ public class SpsSyncUploadController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
SqlSessionFactory sqlSessionFactory;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
AuthAdminDao authAdminService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
@Resource
|
|
|
|
|
OrderService orderService;
|
|
|
|
|
@Resource
|
|
|
|
|
BasicBackUpdateProductService backUpdateProductService;
|
|
|
|
|
@Resource
|
|
|
|
|
WarehouseUserDao warehouseUserDao;
|
|
|
|
|
@Resource
|
|
|
|
|
WarehouseBussinessTypeDao warehouseBussinessTypeDao;
|
|
|
|
|
|
|
|
|
|
@PostMapping("sps/sync/basic/upload")
|
|
|
|
|
public BaseResponse findProductInfo(@RequestBody SpsSyncDataResponse syncDataResponse) {
|
|
|
|
@ -172,6 +169,35 @@ public class SpsSyncUploadController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//第三方仓库信息导入
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getThrInvWarehouseEntities())) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = syncDataResponse.getThrInvWarehouseEntities();
|
|
|
|
|
ThrInvWarehouseDao mapper = batchSession.getMapper(ThrInvWarehouseDao.class);
|
|
|
|
|
for (ThrInvWarehouseEntity thrInvWarehouseEntity : thrInvWarehouseEntities) {
|
|
|
|
|
thrInvWarehouseEntity.setUpdateTime(null);
|
|
|
|
|
mapper.insertThrInvWarehouse(thrInvWarehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//仓库用户表
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseUserEntities())) {
|
|
|
|
|
for (WarehouseUserEntity warehouseUserEntity : syncDataResponse.getWarehouseUserEntities()) {
|
|
|
|
|
warehouseUserDao.insertOrUpdate(warehouseUserEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//仓库单据类型表
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseBussinessTypeEntities())) {
|
|
|
|
|
for (WarehouseBussinessTypeEntity warehouseUserEntity : syncDataResponse.getWarehouseBussinessTypeEntities()) {
|
|
|
|
|
warehouseBussinessTypeDao.insertOrUpdate(warehouseUserEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//第三方产品信息导入
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getThrProductsEntities())) {
|
|
|
|
@ -230,6 +256,17 @@ public class SpsSyncUploadController {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//用户表
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getAuthAdminList())) {
|
|
|
|
|
for (AuthAdmin authAdmin : syncDataResponse.getAuthAdminList()) {
|
|
|
|
|
authAdmin.setLastModifyTime(null);
|
|
|
|
|
authAdmin.setCustomerId(110);
|
|
|
|
|
authAdminService.replaceAuthAdmin(authAdmin);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// batchSession.clearCache();
|
|
|
|
|
batchSession.close();
|
|
|
|
|
}
|
|
|
|
@ -298,36 +335,55 @@ public class SpsSyncUploadController {
|
|
|
|
|
orderEntity.setUpdateTime(null);
|
|
|
|
|
orderEntity.setFromType(ConstantStatus.FROM_UDIWMS);
|
|
|
|
|
orderEntity.setReceiveStatus(0);
|
|
|
|
|
orderEntity.setErpFk(null);
|
|
|
|
|
orderEntity.setOutChangeEnable(false);
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS);
|
|
|
|
|
orderService.deleteByOrderId(orderEntity.getId());
|
|
|
|
|
|
|
|
|
|
OrderEntity temp = orderService.findById(orderEntity.getId());
|
|
|
|
|
if (temp == null) {
|
|
|
|
|
mapper.importOrder(orderEntity);
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailEntityList())) {
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseEntityList())) {
|
|
|
|
|
try {
|
|
|
|
|
List<ErpOrderEntity> erpOrderEntities = syncDataResponse.getOrderDetailEntityList();
|
|
|
|
|
OrderDetailDao mapper = batchSession.getMapper(OrderDetailDao.class);
|
|
|
|
|
for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
|
|
|
|
|
mapper.insertErpOrder(erpOrderEntity);
|
|
|
|
|
CodesTempDao codeMappert = batchSession.getMapper(CodesTempDao.class);
|
|
|
|
|
List<WarehouseEntity> warehouseEntityList = syncDataResponse.getWarehouseEntityList();
|
|
|
|
|
for (WarehouseEntity warehouseEntity : warehouseEntityList) {
|
|
|
|
|
if (warehouseEntity.getOrderId().equals(orderEntity.getId())) {
|
|
|
|
|
codeMappert.replaceCodesTempSingle(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseEntityList())) {
|
|
|
|
|
try {
|
|
|
|
|
List<WarehouseEntity> warehouseEntityList = syncDataResponse.getWarehouseEntityList();
|
|
|
|
|
CodesDao mapper = batchSession.getMapper(CodesDao.class);
|
|
|
|
|
for (WarehouseEntity warehouseEntity : warehouseEntityList) {
|
|
|
|
|
mapper.insertWarehouse(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailEntityList())) {
|
|
|
|
|
// try {
|
|
|
|
|
// List<ErpOrderEntity> erpOrderEntities = syncDataResponse.getOrderDetailEntityList();
|
|
|
|
|
// OrderDetailDao mapper = batchSession.getMapper(OrderDetailDao.class);
|
|
|
|
|
// for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
|
|
|
|
|
// mapper.insertErpOrder(erpOrderEntity);
|
|
|
|
|
// }
|
|
|
|
|
// batchSession.commit();
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseEntityList())) {
|
|
|
|
|
// try {
|
|
|
|
|
// List<WarehouseEntity> warehouseEntityList = syncDataResponse.getWarehouseEntityList();
|
|
|
|
|
// CodesDao mapper = batchSession.getMapper(CodesDao.class);
|
|
|
|
|
// for (WarehouseEntity warehouseEntity : warehouseEntityList) {
|
|
|
|
|
// mapper.insertWarehouse(warehouseEntity);
|
|
|
|
|
// }
|
|
|
|
|
// batchSession.commit();
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
batchSession.close();
|
|
|
|
|
}
|
|
|
|
|