|
|
|
@ -1,33 +1,33 @@
|
|
|
|
|
package com.glxp.sale.admin.controller.basic;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
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.*;
|
|
|
|
|
import com.glxp.sale.admin.dao.inout.CodesTempDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.inout.OrderDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.inout.WarehouseBussinessTypeDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.inout.WarehouseUserDao;
|
|
|
|
|
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.*;
|
|
|
|
|
import com.glxp.sale.admin.entity.inout.OrderEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.inout.WarehouseBussinessTypeEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.inout.WarehouseUserEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity;
|
|
|
|
|
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;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.SpsSyncOrderResponse;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.BasicUnitMaintainService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.BasicDownloadService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.BussinessChangeTypeService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.EntrustReceService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.UdiRelevanceService;
|
|
|
|
|
import com.glxp.sale.admin.service.info.CompanyProductRelevanceService;
|
|
|
|
|
import com.glxp.sale.admin.service.inout.OrderService;
|
|
|
|
|
import com.glxp.sale.admin.service.inventory.InvWarehouseService;
|
|
|
|
|
import com.glxp.sale.admin.service.thrsys.*;
|
|
|
|
|
import com.glxp.sale.admin.thread.BasicBackUpdateProductService;
|
|
|
|
|
import com.glxp.sale.admin.util.BeanUtils;
|
|
|
|
|
import com.glxp.sale.common.res.BaseResponse;
|
|
|
|
@ -36,13 +36,13 @@ import org.apache.ibatis.session.ExecutorType;
|
|
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
|
|
import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
|
|
import org.apache.ibatis.session.TransactionIsolationLevel;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@ -66,6 +66,8 @@ public class SpsSyncUploadController {
|
|
|
|
|
BussinessChangeTypeService bussinessChangeTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
EntrustReceService entrustReceService;
|
|
|
|
|
@Resource
|
|
|
|
|
private BasicDownloadService basicDownloadService;
|
|
|
|
|
|
|
|
|
|
@PostMapping("sps/sync/basic/upload")
|
|
|
|
|
public BaseResponse findProductInfo(@RequestBody SpsSyncDataResponse syncDataResponse) {
|
|
|
|
@ -109,6 +111,18 @@ public class SpsSyncUploadController {
|
|
|
|
|
|
|
|
|
|
public void dlAllData(SpsSyncDataResponse syncDataResponse) {
|
|
|
|
|
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
|
|
|
|
|
|
|
|
|
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
|
|
|
|
|
basicDownloadStatusEntity.setId(syncDataResponse.getTaskId());
|
|
|
|
|
basicDownloadStatusEntity.setStartTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_BASIC_DATA);
|
|
|
|
|
basicDownloadStatusEntity.setStatus(0);
|
|
|
|
|
basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_DATA);
|
|
|
|
|
basicDownloadStatusEntity.setScheduleType(1);
|
|
|
|
|
|
|
|
|
|
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
|
|
|
|
|
|
//仓库字典导入
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getInvWarehouseEntities())) {
|
|
|
|
|
|
|
|
|
@ -120,6 +134,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
invWarehouseService.importInvWarehouse(syncDataResponse.getInvWarehouseEntities());
|
|
|
|
|
remark.append("仓库字典:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//仓库用户表
|
|
|
|
@ -175,6 +190,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
mapper.importBasicUnitMaintain(basicUnitMaintainEntity);
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("往来单位:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -204,10 +220,27 @@ public class SpsSyncUploadController {
|
|
|
|
|
mapper.insertThrInvWarehouse(thrInvWarehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("第三方仓库:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//仓库用户表
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseUserEntities())) {
|
|
|
|
|
for (WarehouseUserEntity warehouseUserEntity : syncDataResponse.getWarehouseUserEntities()) {
|
|
|
|
|
warehouseUserDao.insertOrUpdate(warehouseUserEntity);
|
|
|
|
|
}
|
|
|
|
|
remark.append("仓库用户:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//仓库单据类型表
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseBussinessTypeEntities())) {
|
|
|
|
|
for (WarehouseBussinessTypeEntity warehouseUserEntity : syncDataResponse.getWarehouseBussinessTypeEntities()) {
|
|
|
|
|
warehouseBussinessTypeDao.insertOrUpdate(warehouseUserEntity);
|
|
|
|
|
}
|
|
|
|
|
remark.append("仓库单据:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//第三方产品信息导入
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getThrProductsEntities())) {
|
|
|
|
@ -220,6 +253,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
mapper.insertThrProducts(thrProductsEntity);
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("第三方产品信息:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -235,6 +269,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
mapper.importThrCorp(thrCorpEntity);
|
|
|
|
|
});
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("第三方往来单位:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -249,6 +284,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
mapper.importThrOrder(thrOrderEntity);
|
|
|
|
|
});
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("第三方业务单据:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -263,6 +299,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
mapper.importThrOrderDetail(thrOrderDetailEntity);
|
|
|
|
|
});
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("第三方业务单据详情:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -274,17 +311,34 @@ public class SpsSyncUploadController {
|
|
|
|
|
authAdmin.setLastModifyTime(null);
|
|
|
|
|
authAdmin.setCustomerId(110);
|
|
|
|
|
authAdminService.replaceAuthAdmin(authAdmin);
|
|
|
|
|
remark.append("用户信息:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// batchSession.clearCache();
|
|
|
|
|
batchSession.close();
|
|
|
|
|
|
|
|
|
|
basicDownloadStatusEntity.setStatus(1);
|
|
|
|
|
basicDownloadStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setEndTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setRemark(remark.toString());
|
|
|
|
|
basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void dlAllBus(SpsSyncBusResponse syncDataResponse) {
|
|
|
|
|
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
|
|
|
|
|
|
|
|
|
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
|
|
|
|
|
basicDownloadStatusEntity.setId(syncDataResponse.getTaskId());
|
|
|
|
|
basicDownloadStatusEntity.setStartTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_BUS_TYPE);
|
|
|
|
|
basicDownloadStatusEntity.setStatus(0);
|
|
|
|
|
basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_BUS);
|
|
|
|
|
basicDownloadStatusEntity.setScheduleType(1);
|
|
|
|
|
|
|
|
|
|
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getBussinessTypeEntities())) {
|
|
|
|
|
try {
|
|
|
|
|
List<BussinessTypeEntity> bussinessTypeEntities = syncDataResponse.getBussinessTypeEntities();
|
|
|
|
@ -294,6 +348,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
mapper.insertBussinessType(bussinessTypeEntity);
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("扫码单据类型:").append(syncDataResponse.getBussinessTypeEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -318,6 +373,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("业务单据类型:").append(syncDataResponse.getBussinessTypeEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -331,6 +387,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
mapper.insertBusOriginType(bussinessTypeEntity);
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("第三方单据类型:").append(syncDataResponse.getBussinessTypeEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -344,12 +401,28 @@ public class SpsSyncUploadController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
batchSession.close();
|
|
|
|
|
|
|
|
|
|
basicDownloadStatusEntity.setStatus(1);
|
|
|
|
|
basicDownloadStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setEndTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setRemark(remark.toString());
|
|
|
|
|
basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void dlAllOrder(SpsSyncOrderResponse syncDataResponse) {
|
|
|
|
|
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
|
|
|
|
|
|
|
|
|
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
|
|
|
|
|
basicDownloadStatusEntity.setId(syncDataResponse.getTaskId());
|
|
|
|
|
basicDownloadStatusEntity.setStartTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_SCAN_ORDER);
|
|
|
|
|
basicDownloadStatusEntity.setStatus(0);
|
|
|
|
|
basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_ORDER);
|
|
|
|
|
basicDownloadStatusEntity.setScheduleType(1);
|
|
|
|
|
|
|
|
|
|
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderEntities())) {
|
|
|
|
|
try {
|
|
|
|
|
List<OrderEntity> orderEntities = syncDataResponse.getOrderEntities();
|
|
|
|
@ -382,6 +455,7 @@ public class SpsSyncUploadController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
remark.append("单据:").append(syncDataResponse.getOrderEntities().size()).append("条\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -409,5 +483,11 @@ public class SpsSyncUploadController {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
batchSession.close();
|
|
|
|
|
|
|
|
|
|
basicDownloadStatusEntity.setStatus(1);
|
|
|
|
|
basicDownloadStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setEndTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setRemark(remark.toString());
|
|
|
|
|
basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|