feat:智能柜购买基本完成
This commit is contained in:
1 parent
ee47db73ba
commit
e684fe6bb1
6 files changed
+23
-11
No files matched your search
+5
@@ -40,4 +40,9 @@ public class HardDoorFlowOpenDto {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 授权id
|
||||
*/
|
||||
private Long authId;
|
||||
|
||||
}
|
||||
+2
-5
@@ -99,11 +99,7 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
|
||||
// 查询设备信息
|
||||
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByHardId(authEntity.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) throw new RuntimeException("授权信息不存在");
|
||||
HardAuthEntity updateObj = HardAuthEntity.builder()
|
||||
.id(dto.getAuthId())
|
||||
.authType(dto.getAuthStatus())
|
||||
.authTime(LocalDateTime.now())
|
||||
.build();
|
||||
HardAuthEntity updateObj = HardAuthEntity.builder().id(dto.getAuthId()).authType(dto.getAuthStatus()).authTime(LocalDateTime.now()).build();
|
||||
baseMapper.updateById(updateObj);
|
||||
if (ObjectUtil.equals(dto.getAuthStatus(), YesNoEnum.YES.getCode())) {
|
||||
// 开门
|
||||
@@ -113,6 +109,7 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
|
||||
openDoorDto.setFlowType(HardDoorFlowEnum.PAY_OPEN);
|
||||
openDoorDto.setOpenType(HardDoorOpenTypeEnum.RECORD_VIDEO);
|
||||
openDoorDto.setUserId(dto.getUserId());
|
||||
openDoorDto.setAuthId(dto.getAuthId());
|
||||
hardDoorFlowService.openDoorPay(openDoorDto, hardDoorDetail);
|
||||
}
|
||||
return dto.getAuthId();
|
||||
|
||||
+2
-1
@@ -97,6 +97,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
.requestOpenDto(JSONUtil.toJsonStr(openDto))
|
||||
.requestOpenVo(JSONUtil.toJsonStr(openVo))
|
||||
.requestOpenTime(LocalDateTime.now()).build();
|
||||
if (ObjectUtil.isNotEmpty(dto.getAuthId())) updateObj.setAuthId(dto.getAuthId());
|
||||
// 是否开门成功
|
||||
updateObj.setIsOpen(YesNoEnum.YES.getCode());
|
||||
baseMapper.updateById(updateObj);
|
||||
@@ -295,7 +296,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
return;
|
||||
}
|
||||
// 查询授权流程
|
||||
HardAuthEntity authDetail = hardAuthMapper.selectById(flowDetail.getId());
|
||||
HardAuthEntity authDetail = hardAuthMapper.selectById(flowDetail.getAuthId());
|
||||
if (ObjectUtil.isEmpty(authDetail)) {
|
||||
log.error("|{}|disposeRecognitionCallback 意外的错误,授权流程不存在dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
|
||||
+7
-3
@@ -412,14 +412,18 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
public Long createHardDoorOrder(Long userId, Long hardId) {
|
||||
// 查询用户
|
||||
UserInfo userDetail = userService.getByUserId(userId).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("创建智能柜订单,用户不存在");
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("创建智能柜订单失败,用户不存在");
|
||||
// 查询设备
|
||||
HardManagerVo hard = hardManagerService.getByHardId(hardId);
|
||||
if (ObjectUtil.isEmpty(hard)) throw new RuntimeException("创建智能柜订单,设备不存在");
|
||||
if (ObjectUtil.isEmpty(hard)) throw new RuntimeException("创建智能柜订单失败,设备不存在");
|
||||
// 查询商户
|
||||
MchManageVo mch = remoteMchService.getById(hard.getMerchantId()).getData();
|
||||
if (ObjectUtil.isEmpty(hard)) throw new RuntimeException("创建智能柜订单,商户不存在");
|
||||
if (ObjectUtil.isEmpty(hard)) throw new RuntimeException("创建智能柜订单失败,商户不存在");
|
||||
// 默认超市钱包
|
||||
WalletManageEntity wallet = remoteWalletService.getWallet(userId, WalletTypeEnum.PAY).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("创建智能柜订单失败,用户消费钱包不存在");
|
||||
HardOrderEntity orderObj = HardOrderEntity.builder()
|
||||
.walletId(wallet.getId())
|
||||
.hardId(hardId)
|
||||
.merchantType(mch.getTypes())
|
||||
.merchantId(mch.getId())
|
||||
|
||||
+1
@@ -256,6 +256,7 @@ public class HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity
|
||||
if (ObjectUtil.isNotEmpty(hardSpu.getIncrCount())) {
|
||||
HardSpuEntity entity = new HardSpuEntity();
|
||||
entity.setId(hardSpu.getHardSpuId());
|
||||
entity.setSalesCount(i.getSalesCount() + hardSpu.getIncrCount());
|
||||
entity.setRepertoryCount(i.getRepertoryCount() - hardSpu.getIncrCount());
|
||||
updateList.add(entity);
|
||||
}
|
||||
|
||||
@@ -39,10 +39,13 @@
|
||||
<sql id="whereA">
|
||||
a.del_flag = '0'
|
||||
<if test="dto.userId != null">
|
||||
and a.userId = #{dto.userId}
|
||||
and a.user_id = #{dto.userId}
|
||||
</if>
|
||||
<if test="dto.hardId != null">
|
||||
and a.hard_id = #{dto.hardId}
|
||||
</if>
|
||||
<if test="dto.authStatus != null and dto.authStatus != '' ">
|
||||
and a.authStatus = #{dto.auth_status}
|
||||
and a.auth_status = #{dto.authStatus}
|
||||
</if>
|
||||
<if test="dto.isDone != null">
|
||||
and a.is_done = #{dto.isDone}
|
||||
@@ -65,5 +68,6 @@
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
order by a.create_time desc , a.id desc
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user