|
|
|
@ -8,16 +8,22 @@ import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.BasicProcessStatus;
|
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.api.controller.purchase.PurOrderController;
|
|
|
|
|
import com.glxp.api.dao.inout.IoCodeTempDao;
|
|
|
|
|
import com.glxp.api.dao.inout.IoOrderDao;
|
|
|
|
|
import com.glxp.api.dao.inout.IoOrderDetailBizDao;
|
|
|
|
|
import com.glxp.api.dao.inout.IoOrderDetailCodeDao;
|
|
|
|
|
import com.glxp.api.dao.purchase.PurOrderDao;
|
|
|
|
|
import com.glxp.api.dao.purchase.PurOrderDetailDao;
|
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
|
import com.glxp.api.entity.purchase.PurOrderDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.purchase.PurOrderEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.BasicDownloadStatusEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.BasicExportStatusEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.SyncDataBustypeEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.SyncDataSetEntity;
|
|
|
|
|
import com.glxp.api.req.sync.SpsSyncDataRequest;
|
|
|
|
|
import com.glxp.api.res.sync.SpsSyncBusOrderResponse;
|
|
|
|
|
import com.glxp.api.res.sync.SpsSyncOrderResponse;
|
|
|
|
|
import com.glxp.api.res.system.SyncDataSetResponse;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
@ -166,5 +172,67 @@ public class SpsSyncDownloadController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 接收中级服务,UDI管理系统上传业务单据
|
|
|
|
|
@AuthRuleAnnotation("/sps/sync/busOrder/upload")
|
|
|
|
|
@PostMapping("/sps/sync/busOrder/upload")
|
|
|
|
|
public BaseResponse busOrderSava(@RequestBody @Valid SpsSyncBusOrderResponse spsSyncBusOrderResponse) {
|
|
|
|
|
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
|
|
|
|
|
basicDownloadStatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
basicDownloadStatusEntity.setTaskId(spsSyncBusOrderResponse.getTaskId());
|
|
|
|
|
basicDownloadStatusEntity.setStartTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_SCAN_ORDER);
|
|
|
|
|
basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_WAIT); //下载中
|
|
|
|
|
basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_BUS_ORDER);
|
|
|
|
|
basicDownloadStatusEntity.setScheduleType(1);
|
|
|
|
|
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
|
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
|
|
|
|
if (CollUtil.isNotEmpty(spsSyncBusOrderResponse.getPurOrderEntities())) {
|
|
|
|
|
try {
|
|
|
|
|
List<PurOrderEntity> orderEntities = spsSyncBusOrderResponse.getPurOrderEntities();
|
|
|
|
|
PurOrderDao mapper = batchSession.getMapper(PurOrderDao.class);
|
|
|
|
|
for (PurOrderEntity orderEntity : orderEntities) {
|
|
|
|
|
orderEntity.setUpdateTime(null);
|
|
|
|
|
IoOrderEntity temp = orderService.findById(orderEntity.getBillNo());
|
|
|
|
|
if (temp == null) {
|
|
|
|
|
orderEntity.setId(null);
|
|
|
|
|
mapper.insert(orderEntity);
|
|
|
|
|
if (CollUtil.isNotEmpty(spsSyncBusOrderResponse.getPurOrderDetailEntities())) {
|
|
|
|
|
PurOrderDetailDao codeMappert = batchSession.getMapper(PurOrderDetailDao.class);
|
|
|
|
|
List<PurOrderDetailEntity> warehouseEntityList = spsSyncBusOrderResponse.getPurOrderDetailEntities();
|
|
|
|
|
for (PurOrderDetailEntity warehouseEntity : warehouseEntityList) {
|
|
|
|
|
PurOrderDetailEntity codeTempEntity = new PurOrderDetailEntity();
|
|
|
|
|
BeanUtils.copyProperties(warehouseEntity, codeTempEntity);
|
|
|
|
|
codeTempEntity.setId(null);
|
|
|
|
|
codeMappert.insert(codeTempEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
|
|
|
|
|
String logs = "";
|
|
|
|
|
if (CollUtil.isNotEmpty(spsSyncBusOrderResponse.getPurOrderEntities()))
|
|
|
|
|
logs = logs + "单据:" + spsSyncBusOrderResponse.getPurOrderEntities().size() + "条\n";
|
|
|
|
|
if (CollUtil.isNotEmpty(spsSyncBusOrderResponse.getPurOrderDetailEntities()))
|
|
|
|
|
logs = logs + "单据详情:" + spsSyncBusOrderResponse.getPurOrderDetailEntities().size() + "条\n";
|
|
|
|
|
remark.append(logs);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
batchSession.close();
|
|
|
|
|
basicDownloadStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setEndTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setRemark(remark.toString());
|
|
|
|
|
basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_SUCCESS);
|
|
|
|
|
basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("上传成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|