|
|
@@ -29,10 +29,7 @@ import com.kxs.store.api.vo.kxsapp.userOrder.UserApplyMachineDetailVO;
|
|
|
import com.kxs.store.api.vo.kxsapp.userOrder.UserApplyMahineListVO;
|
|
|
import com.kxs.store.biz.constant.StoreConstants;
|
|
|
import com.kxs.store.biz.constant.enums.*;
|
|
|
-import com.kxs.store.biz.mapper.KxsMachineAdvanceInfoMapper;
|
|
|
-import com.kxs.store.biz.mapper.KxsMachineApplyDetailMapper;
|
|
|
-import com.kxs.store.biz.mapper.KxsMachineApplyMapper;
|
|
|
-import com.kxs.store.biz.mapper.KxsWarehouseMapper;
|
|
|
+import com.kxs.store.biz.mapper.*;
|
|
|
import com.kxs.store.biz.service.*;
|
|
|
import com.kxs.system.api.feign.RemoteUserMsgService;
|
|
|
import com.kxs.system.api.model.KxsUserMsg;
|
|
|
@@ -182,34 +179,34 @@ public class KxsMachineApplyServiceImpl extends ServiceImpl<KxsMachineApplyMappe
|
|
|
.getData()
|
|
|
.orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.SN_FIND_NULL.getDescription()));
|
|
|
//查询预发机
|
|
|
- KxsMachineAdvanceInfo kxsMachineAdvance = kxsMachineAdvanceInfoMapper.selectOne(Wrappers.<KxsMachineAdvanceInfo>lambdaQuery()
|
|
|
+ KxsMachineAdvanceInfo kxsMachineAdvanceInfo = kxsMachineAdvanceInfoMapper.selectOne(Wrappers.<KxsMachineAdvanceInfo>lambdaQuery()
|
|
|
.eq(KxsMachineAdvanceInfo::getPosSn, advanceSn));
|
|
|
+
|
|
|
if (adMachine == null){
|
|
|
throw new GlobalCustomerException(StoreErrorTypeEnum.MACHINE_IS_NULL.getDescription());
|
|
|
}
|
|
|
- if (kxsMachineAdvance == null ) {
|
|
|
+ if (kxsMachineAdvanceInfo == null ) {
|
|
|
throw new GlobalCustomerException(StoreErrorTypeEnum.ADVANCE_MACHINE_NOT_FIND.getDescription());
|
|
|
}
|
|
|
- if (kxsMachineAdvance.getIsConfirm() != 1) {
|
|
|
+ if (kxsMachineAdvanceInfo.getIsConfirm() != 1) {
|
|
|
throw new GlobalCustomerException(StoreErrorTypeEnum.ADVANCE_MACHINE_NOT_CONFIRM.getDescription());
|
|
|
}
|
|
|
- if (kxsMachineAdvance.getIsApply() != 0) {
|
|
|
+ if (kxsMachineAdvanceInfo.getIsApply() != 0) {
|
|
|
throw new GlobalCustomerException(StoreErrorTypeEnum.ADVANCE_MACHINE_ERROR.getDescription());
|
|
|
}
|
|
|
- if (kxsMachineAdvance.getIsReturn() != 0) {
|
|
|
+ if (kxsMachineAdvanceInfo.getIsReturn() != 0) {
|
|
|
throw new GlobalCustomerException(StoreErrorTypeEnum.ADVANCE_MACHINE_RETURN.getDescription());
|
|
|
}
|
|
|
-
|
|
|
//占用自己的预发额度
|
|
|
- if (kxsMachineAdvance.getIsUseAmount() == 1) {
|
|
|
+ if (kxsMachineAdvanceInfo.getIsUseAmount() == 1) {
|
|
|
//小分仓减少已用额度 刷新可用额度
|
|
|
Integer price = EnumUtil.getFieldBy(BrandTypeEnum::getType, BrandTypeEnum::getDescription, String.valueOf(brand.getBrandType()));
|
|
|
kxsWarehouseLimitService.refreshUserAmount(userId.intValue(), price, KindTypeEnum.SUB.getType());
|
|
|
}
|
|
|
//已经添加到预扣款
|
|
|
- if (kxsMachineAdvance.getAdvanceId() != null && kxsMachineAdvance.getAdvanceId() > 0) {
|
|
|
+ if (kxsMachineAdvanceInfo.getAdvanceId() != null && kxsMachineAdvanceInfo.getAdvanceId() > 0) {
|
|
|
//查询当前的预扣款
|
|
|
- R<KxsUserAdvance> advanceResult = remoteKxsUserService.loadByAdvanceId(kxsMachineAdvance.getAdvanceId(), SecurityConstants.FROM_IN);
|
|
|
+ R<KxsUserAdvance> advanceResult = remoteKxsUserService.loadByAdvanceId(kxsMachineAdvanceInfo.getAdvanceId(), SecurityConstants.FROM_IN);
|
|
|
KxsUserAdvance advance = RetOps.of(advanceResult)
|
|
|
.getData()
|
|
|
.orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.DATA_ERROR.getDescription()));
|
|
|
@@ -254,8 +251,8 @@ public class KxsMachineApplyServiceImpl extends ServiceImpl<KxsMachineApplyMappe
|
|
|
}
|
|
|
}
|
|
|
//修改预发机状态
|
|
|
- kxsMachineAdvance.setIsApply(1);
|
|
|
- kxsMachineAdvanceInfoMapper.updateById(kxsMachineAdvance);
|
|
|
+ kxsMachineAdvanceInfo.setIsApply(1);
|
|
|
+ kxsMachineAdvanceInfoMapper.updateById(kxsMachineAdvanceInfo);
|
|
|
|
|
|
//订单详情添加机具号
|
|
|
orderDetail.setPosSn(adMachine.getPosSn());
|
|
|
@@ -264,14 +261,6 @@ public class KxsMachineApplyServiceImpl extends ServiceImpl<KxsMachineApplyMappe
|
|
|
kxsMachineApplyDetailMapper.insert(orderDetail);
|
|
|
}
|
|
|
|
|
|
- if(param.getIsAdvance() == 1){
|
|
|
- //申请的预发机 修改仓库库存
|
|
|
- KxsWarehouseStock warehouseStock = kxsWarehouseStockService.updateDeliveryStock(order.getWarehouseId(), snList.size());
|
|
|
- //新增仓库日志记录
|
|
|
- kxsWarehouseStockLogService.addKxsWarehouseStockLog(order.getWarehouseId(), order.getBrandId(), warehouseStock, KindTypeEnum.SUB.getType(), 1, snList.size());
|
|
|
- //发货统计
|
|
|
- kxsSendTotalService.shipmentStatistics(param.getSnList().size(), order.getWarehouseId(), order.getBrandId());
|
|
|
- }
|
|
|
|
|
|
return R.ok();
|
|
|
}
|