|
|
|
@ -1,18 +1,27 @@
|
|
|
|
|
package com.glxp.udi.admin.service.product;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.glxp.udi.admin.dao.product.StackCodeDao;
|
|
|
|
|
import com.glxp.udi.admin.dao.product.StackOrderDao;
|
|
|
|
|
import com.glxp.udi.admin.entity.product.StackCode;
|
|
|
|
|
import com.glxp.udi.admin.entity.product.StackOrder;
|
|
|
|
|
import com.glxp.udi.admin.req.product.StackOrderFilterRequest;
|
|
|
|
|
import com.glxp.udi.admin.req.product.StackUploadRequest;
|
|
|
|
|
import com.glxp.udi.admin.util.IdUtil;
|
|
|
|
|
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.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@ -24,6 +33,8 @@ public class StackOrderService {
|
|
|
|
|
private IdUtil idUtil;
|
|
|
|
|
@Resource
|
|
|
|
|
private StackCodeDao stackCodeDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private SqlSessionFactory sqlSessionFactory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IPage<StackOrder> filterList(StackOrderFilterRequest stackOrderFilterRequest) {
|
|
|
|
@ -40,8 +51,25 @@ public class StackOrderService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void updateOrder(StackOrder stackOrderEntity) {
|
|
|
|
|
stackOrderDao.updateById(stackOrderEntity);
|
|
|
|
|
public void updateOrder(StackUploadRequest stackUploadRequest) {
|
|
|
|
|
//更新垛数据
|
|
|
|
|
stackOrderDao.updateById(stackUploadRequest.getStackOrderEntity());
|
|
|
|
|
//更新码详情
|
|
|
|
|
if (CollUtil.isNotEmpty(stackUploadRequest.getStackCodeEntityList())) {
|
|
|
|
|
stackUploadRequest.getStackCodeEntityList().forEach(stackCode -> {stackCode.setOrderIdFk(stackUploadRequest.getStackOrderEntity().getOrderId());});
|
|
|
|
|
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
|
|
|
|
StackCodeDao mapper = batchSession.getMapper(StackCodeDao.class);
|
|
|
|
|
List<StackCode> stackCodeEntityList = stackUploadRequest.getStackCodeEntityList();
|
|
|
|
|
for (StackCode stackCode : stackCodeEntityList) {
|
|
|
|
|
if (null != stackCode.getId()) {
|
|
|
|
|
mapper.updateById(stackCode);
|
|
|
|
|
} else {
|
|
|
|
|
mapper.insert(stackCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
batchSession.commit();
|
|
|
|
|
batchSession.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isExit(String orderId) {
|
|
|
|
@ -51,6 +79,9 @@ public class StackOrderService {
|
|
|
|
|
public String insertOrder(StackOrder stackOrderEntity) {
|
|
|
|
|
String stackId = idUtil.getStackId(stackOrderEntity.getCustomerId());
|
|
|
|
|
stackOrderEntity.setOrderId(stackId);
|
|
|
|
|
if (null == stackOrderEntity.getCreateTime()) {
|
|
|
|
|
stackOrderEntity.setCreateTime(new Date());
|
|
|
|
|
}
|
|
|
|
|
stackOrderDao.insert(stackOrderEntity);
|
|
|
|
|
return stackId;
|
|
|
|
|
}
|
|
|
|
|