Commit fe7c746e authored by lanbaoming's avatar lanbaoming

2024-06-27-2提交

parent 909ce935
......@@ -24,8 +24,10 @@ public class BpmOrderRetiredWarehouseResultListener extends BpmProcessInstanceRe
@Override
protected void onEvent(BpmProcessInstanceResultEvent event) {
log.info("---------------------入仓退仓回调-----------------------{},{}", event.getBusinessKey(), event.getResult());
orderWarehouseInService.rollbackApplyCallback(event.getBusinessKey(), event.getResult());
log.info("---------------------入仓退仓回调-----------------------{},{}",
event.getBusinessKey(), event.getResult());
orderWarehouseInService.rollbackApplyCallback(event.getBusinessKey(),
event.getResult());
}
}
......@@ -30,7 +30,8 @@ public class BpmOrderWarehousingModificationResultListener extends BpmProcessIns
//lanbm 2024-05-31 处理异常
log.info("-------------------入仓修改回调-------------------------{},{}",
event.getBusinessKey(), event.getResult());
orderWarehouseInService.updateApplyCallback(event.getBusinessKey(), event.getResult());
orderWarehouseInService.updateApplyCallback(event.getBusinessKey(),
event.getResult());
}
}
......@@ -169,7 +169,6 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
if (Req.getOrderfield().equals("sumvolumeV1")==true) {
Req.setOrderfield("sumvolume1");
}
if (Req.getOrdertype() != null &&
Req.getOrdertype().equals("descending")==true) {
Req.setOrdertype("desc");
......
......@@ -147,17 +147,17 @@ public class OrderLocationServiceImpl extends AbstractService<OrderLocationMappe
}
@Override
public void deleteIfPresent(Long orderId, Long orderItemId, Long warehouseInId) {
orderLocationMapper.delete(new LambdaQueryWrapperX<OrderLocationDO>().eqIfPresent(OrderLocationDO::getOrderId, orderId)
public void deleteIfPresent(Long orderId,
Long orderItemId,
Long warehouseInId) {
orderLocationMapper.delete(
new LambdaQueryWrapperX<OrderLocationDO>().
eqIfPresent(OrderLocationDO::getOrderId, orderId)
.eqIfPresent(OrderLocationDO::getOrderItemId, orderItemId)
.eqIfPresent(OrderLocationDO::getWarehouseInId, warehouseInId));
}
// private void validateOrderLocationExists(Long id) {
// if (orderLocationMapper.selectById(id) == null) {
// throw exception(ORDER_LOCATION_NOT_EXISTS);
// }
// }
@Override
public OrderLocationDO getOrderLocation(Long id) {
......@@ -237,13 +237,13 @@ public class OrderLocationServiceImpl extends AbstractService<OrderLocationMappe
@Override
public void tallyUpdate(Long orderId, List<OrderLocationCreateReqVO> orderLocationCreateReqVOList) {
if(CollectionUtil.isNotEmpty(orderLocationCreateReqVOList)) {
if (CollectionUtil.isNotEmpty(orderLocationCreateReqVOList)) {
//不修改储位时参数只传orderId
orderLocationCreateReqVOList = orderLocationCreateReqVOList.stream()
.filter(t -> t.getWareId() != null)
.collect(Collectors.toList());
//下面的逻辑会先清空储位,因此当理货未修改储位时不需要执行下面的逻辑(因为确认到仓时也会执行这个方法和理货逻辑不一样)
if(CollectionUtil.isEmpty(orderLocationCreateReqVOList)) return;
if (CollectionUtil.isEmpty(orderLocationCreateReqVOList)) return;
}
// 储位信息 删除老储位
......
......@@ -5439,7 +5439,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
*/
@Override
public void approvalOrder(String approveId, Integer result) {
OrderApprovalDO orderApprovalDO = orderApprovalMapper.selectById(approveId);
OrderApprovalDO orderApprovalDO =
orderApprovalMapper.selectById(approveId);
if (Objects.isNull(orderApprovalDO)) {
throw exception(ORDER_APPROVAL_INFO_NOT_FIND);
}
......@@ -5476,8 +5477,10 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
//批量特价申请
else if (Objects.equals(orderApprovalDO.getType(), OrderApprovalTypeEnum.DISCOUNT_APPLY_BATCH.getValue())
|| Objects.equals(orderApprovalDO.getType(), OrderApprovalTypeEnum.ADMIN_DISCOUNT_BATCH.getValue())) {
else if (Objects.equals(orderApprovalDO.getType(),
OrderApprovalTypeEnum.DISCOUNT_APPLY_BATCH.getValue())
|| Objects.equals(orderApprovalDO.getType(),
OrderApprovalTypeEnum.ADMIN_DISCOUNT_BATCH.getValue())) {
OrderSpecialBatchApplyVO specialBatchApplyVO = JSONObject.parseObject(orderApprovalDO.getDetails(), OrderSpecialBatchApplyVO.class);
specialBatchApplyVO.setApplyStatus(result);
......
......@@ -116,7 +116,8 @@ public class OrderCargoControlPickServiceImpl extends AbstractService<OrderCargo
private ParamValidatorApi paramValidatorApi;
@Override
public Long createOrderCargoControlPick(OrderCargoControlPickCreateReqVO createReqVO) {
public Long createOrderCargoControlPick(
OrderCargoControlPickCreateReqVO createReqVO) {
if (Objects.isNull(createReqVO.getPickNum()) || createReqVO.getPickNum() <= 0) {
throw exception(ORDER_CARGO_CONTROL_PICK_NUM_NOT_EQ_ZERO);
}
......@@ -131,7 +132,8 @@ public class OrderCargoControlPickServiceImpl extends AbstractService<OrderCargo
throw exception(CONSIGNEE_PHONE_IS_NOT_CHINA);
}
// if (StringUtils.isNotBlank(createReqVO.getConsigneeCountryCode()) && StringUtils.isNotBlank(createReqVO.getConsigneePhone())) {
String mobileCode = createReqVO.getConsigneeCountryCode() + StrUtil.COLON + createReqVO.getConsigneePhone();
String mobileCode = createReqVO.getConsigneeCountryCode() +
StrUtil.COLON + createReqVO.getConsigneePhone();
paramValidatorApi.validatorMobile(mobileCode);
// String phone = PhoneUtil.formatPhone(mobileCode);
// if (StringUtils.isNotBlank(phone)) {
......@@ -154,7 +156,8 @@ public class OrderCargoControlPickServiceImpl extends AbstractService<OrderCargo
int pickQuantity = 0;
BigDecimal pickVolume = BigDecimal.ZERO;
BigDecimal pickWeight = BigDecimal.ZERO;
List<OrderCargoControlPickDO> pickDOList = orderCargoControlPickMapper.selectList(new LambdaQueryWrapper<OrderCargoControlPickDO>()
List<OrderCargoControlPickDO> pickDOList =
orderCargoControlPickMapper.selectList(new LambdaQueryWrapper<OrderCargoControlPickDO>()
.eq(OrderCargoControlPickDO::getOrderId, createReqVO.getOrderId())
.in(OrderCargoControlPickDO::getStatus, Arrays.asList(1, 2, 3, 4, 5, 6))
.eq(OrderCargoControlPickDO::getDeleted, Boolean.FALSE));
......@@ -176,7 +179,8 @@ public class OrderCargoControlPickServiceImpl extends AbstractService<OrderCargo
}
OrderCargoControlDO orderCargoControlDO = orderCargoControlService.getOne(new LambdaQueryWrapper<OrderCargoControlDO>()
OrderCargoControlDO orderCargoControlDO =
orderCargoControlService.getOne(new LambdaQueryWrapper<OrderCargoControlDO>()
.eq(OrderCargoControlDO::getOrderId, createReqVO.getOrderId())
.eq(OrderCargoControlDO::getIsActual, Boolean.TRUE)
.orderByDesc(OrderCargoControlDO::getId)
......@@ -190,7 +194,8 @@ public class OrderCargoControlPickServiceImpl extends AbstractService<OrderCargo
Integer userType = loginUser != null ? loginUser.getUserType() : null;
String creator = String.valueOf(userId);
Date now = new Date();
if (StringUtils.isBlank(createReqVO.getCode()) && StringUtils.isBlank(createReqVO.getControlPassword())) {
if (StringUtils.isBlank(createReqVO.getCode()) &&
StringUtils.isBlank(createReqVO.getControlPassword())) {
throw exception(ORDER_CARGO_CONTROL_PICK_MUST_CODE_OR_PASSWORD);
}
boolean isPasswordError = false; // 是否密码错误
......@@ -210,8 +215,11 @@ public class OrderCargoControlPickServiceImpl extends AbstractService<OrderCargo
// throw exception(USER_PASSWORD_FAILED);
}
}
if (StringUtils.isNotBlank(createReqVO.getCode()) && (StringUtils.isBlank(createReqVO.getControlPassword()) || isPasswordError || isPasswordNull)) {
// 验证放货短信验证码
if (StringUtils.isNotBlank(createReqVO.getCode()) &&
(StringUtils.isBlank(createReqVO.getControlPassword()) ||
isPasswordError || isPasswordNull)) {
//验证放货短信验证码
SmsCodeUseReqDTO smsCodeSendReqDTO = new SmsCodeUseReqDTO();
smsCodeSendReqDTO.setCode(createReqVO.getCode());
smsCodeSendReqDTO.setMobile(orderCargoControlDO.getPhone());
......@@ -221,7 +229,8 @@ public class OrderCargoControlPickServiceImpl extends AbstractService<OrderCargo
isPasswordPick = false;
}
if (StringUtils.isBlank(createReqVO.getCode()) && (isPasswordError || isPasswordNull)) {
if (StringUtils.isBlank(createReqVO.getCode()) && (isPasswordError ||
isPasswordNull)) {
// 当控货人手机号没有注册web用户,或者用户没有设置控货密码时不能进行控货密码放货
if (isPasswordNull) {
throw exception(CONTROLLER_USER_NOT_SET_CONTROL_PASSWORD);
......@@ -235,7 +244,8 @@ public class OrderCargoControlPickServiceImpl extends AbstractService<OrderCargo
this.smsInternal(orderDO, createReqVO, orderCargoControlDO, now);
// 插入
OrderCargoControlPickDO orderCargoControlPick = OrderCargoControlPickConvert.INSTANCE.convert(createReqVO);
OrderCargoControlPickDO orderCargoControlPick =
OrderCargoControlPickConvert.INSTANCE.convert(createReqVO);
orderCargoControlPick.setControlNum(orderDO.getSumNum() - pickNum);
......
......@@ -2938,14 +2938,17 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
.followUpAdminId(WebFrameworkUtils.getLoginUserId())
.details(details).build();
// 创建审核单,发起审批流程
orderWarehouseApprovalService.applyAndCreate(orderWarehouseApprovalDO, WorkFlowEmus.ORDER_WAREHOUSING_MODIFICATION, updateReqVO.getCopyUserId());
orderWarehouseApprovalService.applyAndCreate(orderWarehouseApprovalDO,
WorkFlowEmus.ORDER_WAREHOUSING_MODIFICATION,
updateReqVO.getCopyUserId());
// 更新订单状态
Integer auditType = OrderApprovalTypeResultEnum.warehouse_update_processing.getType();
orderService.updateStatus(orderId, null, null, null,
null, null, auditType, OrderApprovalTypeResultEnum.typeAndResultOf(auditType, 1).getDesc(), false);
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", "提交货物入仓修改", applyInfoList);
orderBusinessService.addOrderOperateLog(orderId, "仓库操作",
"提交货物入仓修改", applyInfoList);
}
return I18nMessage.getMessage("order.warehousein.update.apply.success");
} else {
......@@ -3033,6 +3036,10 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
old.getWeight().toPlainString(), old.getQuantityAll() != null ? old.getQuantityAll() : 0,
StringUtils.isNotEmpty(old.getExpressNo()) ? old.getExpressNo() : ""));
applyInfoList.add(infoVO);
//删除储位
orderLocationService.deleteIfPresent(old.getOrderId(),
old.getOrderItemId(),old.getId());
}
}
......@@ -3047,7 +3054,6 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
if (inOld != null) {
String prodName = String.format("商品:%s - ", prodTitleZhOld);
Integer cartonsNumOld = inOld.getCartonsNum();
Integer cartonsNumNew = inNew.getCartonsNum();
if (!Objects.equals(cartonsNumOld, cartonsNumNew)) {
......@@ -3173,7 +3179,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
old.getWeight().toPlainString(), old.getQuantityAll() != null ? old.getQuantityAll() : 0,
StringUtils.isNotEmpty(old.getExpressNo()) ? old.getExpressNo() : ""));
applyInfoList.add(infoVO);
//删除储位
orderLocationService.deleteIfPresent(old.getOrderId(),
old.getOrderItemId(),old.getId());
}
}
}
}
......@@ -3388,7 +3399,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderWarehouseApprovalService.getById(bizId);
// 更新审批单状态
orderWarehouseApprovalService.callbackUpdate(orderWarehouseApprovalDO, result);
orderWarehouseApprovalService.callbackUpdate(orderWarehouseApprovalDO,
result);
long orderId = Long.parseLong(orderWarehouseApprovalDO.getOrderIds());
String processingResults = orderWarehouseApprovalDO.getProcessingResults();
......@@ -3403,18 +3415,22 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
BigDecimal sumWeightBeforeUpdate = orderDO.getSumWeight();
// 验证是否不可接受货物
this.validateProdAttrAccess(orderItemDO.getProdId(), orderDO.getOrderNo());
this.validateProdAttrAccess(orderItemDO.getProdId(),
orderDO.getOrderNo());
// 通过orderItemId查询db中的 orderWarehouseInDO
List<OrderWarehouseInDO> orderWarehouseInListOld = orderWarehouseInMapper
List<OrderWarehouseInDO> orderWarehouseInListOld =
orderWarehouseInMapper
.selectList(new LambdaQueryWrapperX<OrderWarehouseInDO>().eq(OrderWarehouseInDO::getOrderId, orderId)
.eq(OrderWarehouseInDO::getOrderItemId, orderItemId));
String details = orderWarehouseApprovalDO.getDetails();
if (StringUtils.isNotEmpty(details)) {
OrderWarehouseInUpdateApplyReqVO updateReqVO = JSON.parseObject(details, OrderWarehouseInUpdateApplyReqVO.class);
OrderWarehouseInUpdateApplyReqVO updateReqVO =
JSON.parseObject(details, OrderWarehouseInUpdateApplyReqVO.class);
// 先更新入仓
List<OrderWarehouseInItemDto> orderWarehouseInItemDtoListNew = updateReqVO.getOrderWarehouseInUpdateItemDoList();
List<OrderWarehouseInItemDto> orderWarehouseInItemDtoListNew =
updateReqVO.getOrderWarehouseInUpdateItemDoList();
ZhongPaoBestVO zhongPaoBest = getZhongPaoBest(orderDO);
BigDecimal zhongEdge = zhongPaoBest != null ? zhongPaoBest.getZhongEdge() : null;
......@@ -3427,7 +3443,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
Date inTime = orderWarehouseApprovalDO.getCreateTime();
// 1、新增 (只有新增的可能有储位,修改储位是直接调用修改接口的。)
List<OrderWarehouseInItemDto> addList = orderWarehouseInItemDtoListNew.stream().filter(t -> t.getId() == null).collect(Collectors.toList());
List<OrderWarehouseInItemDto> addList =
orderWarehouseInItemDtoListNew.stream().filter(t -> t.getId() == null).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(addList)) {
for (OrderWarehouseInItemDto orderWarehouseInItemDto : addList) {
......@@ -3446,17 +3463,23 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
}
// 2、更新 //2023-04-20 入仓修改若修改已有入仓记录,有改动(储位或其他信息修改)修改入仓记录的最新操作时间,不修改入仓时间,不修改未发生变化的入仓记录的入仓时间和最新操作时间。
// 2、更新 //2023-04-20 入仓修改若修改已有入仓记录,
// 有改动(储位或其他信息修改)修改入仓记录的最新操作时间,
// 不修改入仓时间,不修改未发生变化的入仓记录的入仓时间和最新操作时间。
if (CollectionUtil.isNotEmpty(orderWarehouseInItemDtoListNew)) {
List<OrderWarehouseInItemDto> orderWarehouseInItemDtoListUpdate = orderWarehouseInItemDtoListNew.stream().filter(t -> t.getId() != null
//更新的
List<OrderWarehouseInItemDto> orderWarehouseInItemDtoListUpdate =
orderWarehouseInItemDtoListNew.stream().filter(t -> t.getId() != null
&& orderWarehouseInListOld.stream().anyMatch(old -> old.getId().equals(t.getId()))).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(orderWarehouseInItemDtoListUpdate)) {
for (OrderWarehouseInItemDto itemDtoNew : orderWarehouseInItemDtoListUpdate) {
for (OrderWarehouseInItemDto itemDtoNew :
orderWarehouseInItemDtoListUpdate) {
OrderWarehouseInDO orderWarehouseInDONew = convertOrderWarehouseInItemDo(orderDO, orderItemId, zhongPaoBest, zhongEdge, paoEdge, itemDtoNew, inTime);
OrderWarehouseInDO orderWarehouseInDONew =
convertOrderWarehouseInItemDo(orderDO, orderItemId, zhongPaoBest, zhongEdge, paoEdge, itemDtoNew, inTime);
// 判断有无变化
OrderWarehouseInDO old = orderWarehouseInMapper.selectById(itemDtoNew.getId());
......@@ -3471,7 +3494,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
//20230821 fix: #4304 订单完成入仓后修改商品名称未更新最后入仓时间
Long warehouseInId = orderWarehouseInDONew.getId();
this.update(new LambdaUpdateWrapper<OrderWarehouseInDO>()
.set(OrderWarehouseInDO::getUpdater, WebFrameworkUtils.getLoginUserId() + "")
.set(OrderWarehouseInDO::getUpdater,
WebFrameworkUtils.getLoginUserId() + "")
.set(OrderWarehouseInDO::getUpdateTime, new Date())
.eq(OrderWarehouseInDO::getId, warehouseInId));
}
......@@ -3489,8 +3513,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 3、删除
else {
List<Long> deleteIds = orderWarehouseInListOld.stream().map(OrderWarehouseInDO::getId).collect(Collectors.toList());
List<Long> deleteIds =
orderWarehouseInListOld.stream().map(OrderWarehouseInDO::getId).collect(Collectors.toList());
orderWarehouseInMapper.deleteBatchIds(deleteIds);
//根据订单ID删除储位
orderLocationService.deleteIfPresent(orderId,null,null);
}
orderItemDO.setNum(updateReqVO.getNum());
......@@ -4198,42 +4226,51 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
@Transactional(rollbackFor = Exception.class)
public void rollbackApplyCallback(String approvalId, Integer result) {
OrderWarehouseApprovalDO orderWarehouseApprovalDO = orderWarehouseApprovalService.getById(Long.parseLong(approvalId));
OrderWarehouseApprovalDO orderWarehouseApprovalDO =
orderWarehouseApprovalService.getById(Long.parseLong(approvalId));
// 更新审核单状态
orderWarehouseApprovalService.callbackUpdate(orderWarehouseApprovalDO, result);
orderWarehouseApprovalService.callbackUpdate(orderWarehouseApprovalDO,
result);
String processingResults = orderWarehouseApprovalDO.getProcessingResults();
if (StringUtils.isNotEmpty(orderWarehouseApprovalDO.getOrderIds())) {
String[] split = orderWarehouseApprovalDO.getOrderIds().split(",");
String[] split =
orderWarehouseApprovalDO.getOrderIds().split(",");
Date date = new Date();
for (String s : split) {
long orderId = Long.parseLong(s);
if (ApprovalResultStatusEnum.pass.getValue().equals(result)) {
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", "订单退仓申请通过", "");
orderBusinessService.addOrderOperateLog(orderId,
"仓库操作", "订单退仓申请通过", "");
// 重置OrderItem记录的入仓信息
orderItemService.updateOrderItemWarehouseInInfoToNull(orderId, null);
orderItemService.updateOrderItemWarehouseInInfoToNull(orderId,
null);
// 更新订单状态 7-已退仓
Integer auditType = OrderApprovalTypeResultEnum.warehouse_rollback_pass.getType();
Integer auditType =
OrderApprovalTypeResultEnum.warehouse_rollback_pass.getType();
// 更新订单状态,同时将异常状态重置为0
orderService.updateStatus(orderId, null, OrderStatusEnum.WITHDRAWN.getValue(), 0,
OrderWarehouseInStatusEnum.rollback_finished.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(auditType, result).getDesc(), false);
// 执行退仓
orderWarehouseInMapper.delete(new LambdaQueryWrapperX<OrderWarehouseInDO>().eq(OrderWarehouseInDO::getOrderId, orderId));
orderWarehouseInMapper.delete(
new LambdaQueryWrapperX<OrderWarehouseInDO>().eq(OrderWarehouseInDO::getOrderId, orderId));
// 删除标签
orderLabelService.deleteLabelByOrderId(orderId);
// 删除储位
orderLocationService.deleteIfPresent(orderId, null, null);
//删除储位
orderLocationService.deleteIfPresent(orderId,
null, null);
// 删除订单除未报价和清关费未报价外的所有异常
List<OrderExceptionDO> pendHeavyExceptionList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderId, null, null);
List<OrderExceptionDO> pendHeavyExceptionList =
orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderId, null, null);
if (CollectionUtil.isNotEmpty(pendHeavyExceptionList)) {
pendHeavyExceptionList.stream().filter(t -> !OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION.getKey().equals(t.getOrderExceptionType()) && !OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION.getKey().equals(t.getOrderExceptionType()))
.forEach(orderExceptionDO -> orderExceptionService.deleteOrderException(orderExceptionDO.getId()));
......
......@@ -44,8 +44,10 @@ public class OrderCargoControlPickController {
@PostMapping("/create")
@ApiOperation("创建订单控货人放货记录")
@Idempotent(timeout = 5)
public CommonResult<Long> createOrderCargoControlPick(@Valid @RequestBody OrderCargoControlPickCreateReqVO createReqVO) {
return success(orderCargoControlPickService.createOrderCargoControlPick(createReqVO));
public CommonResult<Long> createOrderCargoControlPick(
@Valid @RequestBody OrderCargoControlPickCreateReqVO createReqVO) {
return success(orderCargoControlPickService.createOrderCargoControlPick(
createReqVO));
}
......
......@@ -479,7 +479,7 @@ public class ProdCostCalculation {
feeDto.setAmount(costDto.getTotalWorth());
feeDto.setCurrencyId(rmbCurrency);
feeDtoList.add(feeDto);
// TODO 是否计算总重量与体积
//TODO 是否计算总重量与体积
costDto.setFeeDtoList(feeDtoList);
dto.setCostDto(costDto);
if (CollectionUtil.isNotEmpty(couponAvailableGroupDtoList)) {
......
......@@ -53,13 +53,13 @@ public class SmsCodeServiceImpl implements SmsCodeService {
// 创建验证码
String code = createSmsCode(reqDTO.getMobile(), reqDTO.getScene(), reqDTO.getCreateIp());
// 发送验证码
smsSendService.sendSingleSms(reqDTO.getAreaCode()+reqDTO.getMobile(), null, null,
smsSendService.sendSingleSms(reqDTO.getAreaCode() + reqDTO.getMobile(), null, null,
sceneEnum.getTemplateCode(), MapUtil.of("code", code));
}
private String createSmsCode(String mobile, Integer scene, String ip) {
// 校验是否可以发送验证码,不用筛选场景
SmsCodeDO lastSmsCode = smsCodeMapper.selectLastByMobile(mobile, null,null);
SmsCodeDO lastSmsCode = smsCodeMapper.selectLastByMobile(mobile, null, null);
if (lastSmsCode != null) {
if (lastSmsCode.getTodayIndex() >= smsCodeProperties.getSendMaximumQuantityPerDay()) { // 超过当天发送的上限。
throw ServiceExceptionUtil.exception(SMS_CODE_EXCEED_SEND_MAXIMUM_QUANTITY_PER_DAY);
......@@ -83,11 +83,16 @@ public class SmsCodeServiceImpl implements SmsCodeService {
@Override
public void useSmsCode(SmsCodeUseReqDTO reqDTO) {
if (Objects.nonNull(businessProperties) && businessProperties.isDebug()){
if (Objects.equals(reqDTO.getCode(), "9999")) {
return;
}
if (Objects.nonNull(businessProperties) && businessProperties.isDebug()) {
// TODO debug业务模式下不需要生成发送验证码,固定使用9999
if (Objects.equals(reqDTO.getCode(), "9999")){
if (Objects.equals(reqDTO.getCode(), "9999")) {
return;
}else {
} else {
throw ServiceExceptionUtil.exception(SMS_CODE_NOT_FOUND);
}
}
......@@ -105,7 +110,7 @@ public class SmsCodeServiceImpl implements SmsCodeService {
public SmsCodeDO checkSmsCode0(String mobile, String code, Integer scene) {
// 校验验证码
SmsCodeDO lastSmsCode = smsCodeMapper.selectLastByMobile(mobile,code,scene);
SmsCodeDO lastSmsCode = smsCodeMapper.selectLastByMobile(mobile, code, scene);
// 若验证码不存在,抛出异常
if (lastSmsCode == null) {
throw ServiceExceptionUtil.exception(SMS_CODE_NOT_FOUND);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment