|
@@ -8,6 +8,7 @@ import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.excel.utils.DateUtil;
|
|
import com.sckw.excel.utils.DateUtil;
|
|
|
|
|
+import com.sckw.transport.common.enums.LogisticsOrderEnum;
|
|
|
import com.sckw.transport.dao.*;
|
|
import com.sckw.transport.dao.*;
|
|
|
import com.sckw.transport.model.*;
|
|
import com.sckw.transport.model.*;
|
|
|
import com.sckw.transport.model.param.LogisticsConsignmentParam;
|
|
import com.sckw.transport.model.param.LogisticsConsignmentParam;
|
|
@@ -45,6 +46,12 @@ public class LogisticsConsignmentService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
public KwtLogisticsOrderAddressMapper kwtLogisticsOrderAddressMapper;
|
|
public KwtLogisticsOrderAddressMapper kwtLogisticsOrderAddressMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ public KwtLogisticsOrderTrackMapper kwtLogisticsOrderTrackMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ public KwtLogisticsOrderUnitMapper kwtLogisticsOrderUnitMapper;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public HttpResult purchaseLogisticsConsignment(LogisticsConsignmentParam bo) {
|
|
public HttpResult purchaseLogisticsConsignment(LogisticsConsignmentParam bo) {
|
|
@@ -75,21 +82,95 @@ public class LogisticsConsignmentService {
|
|
|
order.setSubcontractAmount(new BigDecimal(NumberConstant.ZERO));
|
|
order.setSubcontractAmount(new BigDecimal(NumberConstant.ZERO));
|
|
|
}
|
|
}
|
|
|
String waybillNo = "";
|
|
String waybillNo = "";
|
|
|
- insertLogisticsGoods(bo,waybillNo);
|
|
|
|
|
- insertLogisticsOrder(bo,waybillNo,order,tradeOrder);
|
|
|
|
|
|
|
+ insertLogisticsGoods(bo, waybillNo);
|
|
|
|
|
+ insertLogisticsOrder(bo, waybillNo, order, tradeOrder);
|
|
|
insertLogisticsOrderContract(bo);
|
|
insertLogisticsOrderContract(bo);
|
|
|
- insertOrderAddress(bo, waybillNo);
|
|
|
|
|
|
|
+ insertLogisticsOrderUnit(bo,waybillNo);
|
|
|
|
|
+ insertLogisticsOrderAddress(bo, waybillNo);
|
|
|
|
|
+ insertLogisticsOrderTrack(bo, waybillNo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 物流订单-企业信息
|
|
|
|
|
+ * @param bo
|
|
|
|
|
+ * @param waybillNo
|
|
|
|
|
+ */
|
|
|
|
|
+ private void insertLogisticsOrderUnit(LogisticsConsignmentParam bo, String waybillNo) {
|
|
|
|
|
+ KwtLogisticsOrderUnit checkUnit = new KwtLogisticsOrderUnit()
|
|
|
|
|
+ .setOrderId(Long.parseLong(waybillNo))
|
|
|
|
|
+ .setId(new IdWorker(NumberConstant.ONE).nextId())
|
|
|
|
|
+ .setUnitType(NumberConstant.ONE)
|
|
|
|
|
+ .setFirmName(bo.getCheckCompany())
|
|
|
|
|
+ .setRemark(bo.getRemark())
|
|
|
|
|
+ .setEntId(Long.parseLong(bo.getCheckCompanyId()))
|
|
|
|
|
+ .setContacts(bo.getCheckContacts())
|
|
|
|
|
+ .setPhone(bo.getCheckContactPhone())
|
|
|
|
|
+ .setCreateBy(LoginUserHolder.getUserId())
|
|
|
|
|
+ .setCreateTime(new Date())
|
|
|
|
|
+ .setUpdateBy(LoginUserHolder.getUserId())
|
|
|
|
|
+ .setUpdateTime(new Date());
|
|
|
|
|
+ kwtLogisticsOrderUnitMapper.insert(checkUnit);
|
|
|
|
|
+
|
|
|
|
|
+ KwtLogisticsOrderUnit consignUnit = new KwtLogisticsOrderUnit()
|
|
|
|
|
+ .setOrderId(Long.parseLong(waybillNo))
|
|
|
|
|
+ .setId(new IdWorker(NumberConstant.ONE).nextId())
|
|
|
|
|
+ .setUnitType(NumberConstant.TWO)
|
|
|
|
|
+ .setFirmName(bo.getConsignCompany())
|
|
|
|
|
+ .setRemark(bo.getRemark())
|
|
|
|
|
+ .setEntId(Long.parseLong(bo.getConsignCompanyId()))
|
|
|
|
|
+ .setContacts(bo.getConsignContacts())
|
|
|
|
|
+ .setPhone(bo.getConsignContactPhone())
|
|
|
|
|
+ .setCreateBy(LoginUserHolder.getUserId())
|
|
|
|
|
+ .setCreateTime(new Date())
|
|
|
|
|
+ .setUpdateBy(LoginUserHolder.getUserId())
|
|
|
|
|
+ .setUpdateTime(new Date());
|
|
|
|
|
+ kwtLogisticsOrderUnitMapper.insert(consignUnit);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 物流订单-状态
|
|
|
|
|
+ * @param bo
|
|
|
|
|
+ * @param waybillNo
|
|
|
|
|
+ */
|
|
|
|
|
+ private void insertLogisticsOrderTrack(LogisticsConsignmentParam bo, String waybillNo) {
|
|
|
|
|
+ KwtLogisticsOrderTrack entity = new KwtLogisticsOrderTrack();
|
|
|
|
|
+ entity.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
|
|
+ entity.setOrderId(Long.parseLong(waybillNo));
|
|
|
|
|
+ entity.setStatus(LogisticsOrderEnum.PENDING_ORDER.getCode());
|
|
|
|
|
+ entity.setCreateTime(new Date());
|
|
|
|
|
+ entity.setUpdateTime(new Date());
|
|
|
|
|
+ entity.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+ entity.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+ entity.setRemark(bo.getRemark());
|
|
|
|
|
+ kwtLogisticsOrderTrackMapper.insert(entity);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 物流订单-商品信息
|
|
|
|
|
+ * @param bo
|
|
|
|
|
+ * @param waybillNo
|
|
|
|
|
+ */
|
|
|
private void insertLogisticsGoods(LogisticsConsignmentParam bo, String waybillNo) {
|
|
private void insertLogisticsGoods(LogisticsConsignmentParam bo, String waybillNo) {
|
|
|
KwtLogisticsOrderGoods kwtLogisticsOrderGoods = new KwtLogisticsOrderGoods();
|
|
KwtLogisticsOrderGoods kwtLogisticsOrderGoods = new KwtLogisticsOrderGoods();
|
|
|
kwtLogisticsOrderGoods.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
kwtLogisticsOrderGoods.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
- kwtLogisticsOrderGoods.setGoodsId(45646565L);
|
|
|
|
|
|
|
+ kwtLogisticsOrderGoods.setGoodsId(Long.parseLong(bo.getGoodsId()));
|
|
|
|
|
+ kwtLogisticsOrderGoods.setSkuId(Long.parseLong(bo.getSkuId()));
|
|
|
kwtLogisticsOrderGoods.setLOrderId(Long.parseLong(bo.getLOrderId()));
|
|
kwtLogisticsOrderGoods.setLOrderId(Long.parseLong(bo.getLOrderId()));
|
|
|
- kwtLogisticsOrderGoods.setLOrderNo(bo.getLOrderNo());
|
|
|
|
|
|
|
+ kwtLogisticsOrderGoods.setLOrderNo(waybillNo);
|
|
|
|
|
+ kwtLogisticsOrderGoods.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+ kwtLogisticsOrderGoods.setUpdateTime(new Date());
|
|
|
|
|
+ kwtLogisticsOrderGoods.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+ kwtLogisticsOrderGoods.setCreateTime(new Date());
|
|
|
kwtLogisticsOrderGoodsMapper.insert(kwtLogisticsOrderGoods);
|
|
kwtLogisticsOrderGoodsMapper.insert(kwtLogisticsOrderGoods);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 物流订单-主体
|
|
|
|
|
+ * @param bo
|
|
|
|
|
+ * @param waybillNo
|
|
|
|
|
+ * @param order
|
|
|
|
|
+ * @param tradeOrder
|
|
|
|
|
+ */
|
|
|
private void insertLogisticsOrder(LogisticsConsignmentParam bo, String waybillNo, KwtLogisticsOrder order, KwoTradeOrder tradeOrder) {
|
|
private void insertLogisticsOrder(LogisticsConsignmentParam bo, String waybillNo, KwtLogisticsOrder order, KwoTradeOrder tradeOrder) {
|
|
|
order.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
order.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
order.setEntId(LoginUserHolder.getEntId());
|
|
order.setEntId(LoginUserHolder.getEntId());
|
|
@@ -118,6 +199,10 @@ public class LogisticsConsignmentService {
|
|
|
kwtLogisticsOrderMapper.insert(order);
|
|
kwtLogisticsOrderMapper.insert(order);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 物流订单-合同
|
|
|
|
|
+ * @param bo
|
|
|
|
|
+ */
|
|
|
private void insertLogisticsOrderContract(LogisticsConsignmentParam bo) {
|
|
private void insertLogisticsOrderContract(LogisticsConsignmentParam bo) {
|
|
|
KwtLogisticsOrderContract kwtLogisticsOrderContract = new KwtLogisticsOrderContract();
|
|
KwtLogisticsOrderContract kwtLogisticsOrderContract = new KwtLogisticsOrderContract();
|
|
|
kwtLogisticsOrderContract.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
kwtLogisticsOrderContract.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
@@ -131,7 +216,12 @@ public class LogisticsConsignmentService {
|
|
|
kwtLogisticsOrderContractMapper.insert(kwtLogisticsOrderContract);
|
|
kwtLogisticsOrderContractMapper.insert(kwtLogisticsOrderContract);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void insertOrderAddress(LogisticsConsignmentParam bo, String waybillNo) {
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 物流订单-装修货地址
|
|
|
|
|
+ * @param bo
|
|
|
|
|
+ * @param waybillNo
|
|
|
|
|
+ */
|
|
|
|
|
+ private void insertLogisticsOrderAddress(LogisticsConsignmentParam bo, String waybillNo) {
|
|
|
KwtLogisticsOrderAddress loadOrderAddress = new KwtLogisticsOrderAddress();
|
|
KwtLogisticsOrderAddress loadOrderAddress = new KwtLogisticsOrderAddress();
|
|
|
KwtLogisticsOrderAddress unloadOrderAddress = new KwtLogisticsOrderAddress();
|
|
KwtLogisticsOrderAddress unloadOrderAddress = new KwtLogisticsOrderAddress();
|
|
|
KwoTradeOrderAddress loadkwoTradeOrderAddress = kwoTradeOrderAddressMapper.selectOne(new LambdaQueryWrapper<KwoTradeOrderAddress>()
|
|
KwoTradeOrderAddress loadkwoTradeOrderAddress = kwoTradeOrderAddressMapper.selectOne(new LambdaQueryWrapper<KwoTradeOrderAddress>()
|