feat(order): 添加送水订单配送时间和完整下单流程
- 在GltTicketOrder实体中新增sendTime字段用于记录配送时间 - 移除送水订单查询接口的权限验证要求,开放查询功能 - 实现完整的下单流程:验证登录用户、扣减水票、写入核销记录、创建订单 - 新增createWithWriteOff方法处理事务性下单操作,确保数据一致性 - 添加数据库行锁机制防止并发扣减问题 - 优化水票相关接口描述,明确为可用水票总数 - 移除水票日志添加接口的权限验证和操作日志注解
This commit is contained in:
@@ -87,11 +87,13 @@
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 我的水票总数(sum(total_qty)) -->
|
||||
<select id="sumTotalQtyByUserId" resultType="java.lang.Integer">
|
||||
SELECT IFNULL(SUM(total_qty), 0)
|
||||
<!-- 我的可用水票总数(sum(available_qty)) -->
|
||||
<select id="sumAvailableQtyByUserId" resultType="java.lang.Integer">
|
||||
SELECT IFNULL(SUM(available_qty), 0)
|
||||
FROM glt_user_ticket
|
||||
WHERE user_id = #{userId}
|
||||
AND tenant_id = #{tenantId}
|
||||
AND status = 0
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
|
||||
@@ -40,11 +40,12 @@ public interface GltUserTicketService extends IService<GltUserTicket> {
|
||||
GltUserTicket getByIdRel(Integer id);
|
||||
|
||||
/**
|
||||
* 统计指定用户水票总数量(sum(total_qty))
|
||||
* 统计指定用户可用水票总数(sum(available_qty))
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 总数量(无记录返回0)
|
||||
* @param tenantId 租户ID
|
||||
* @return 可用总数(无记录返回0)
|
||||
*/
|
||||
Integer sumTotalQtyByUserId(Integer userId);
|
||||
Integer sumAvailableQtyByUserId(Integer userId, Integer tenantId);
|
||||
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ public class GltUserTicketServiceImpl extends ServiceImpl<GltUserTicketMapper, G
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer sumTotalQtyByUserId(Integer userId) {
|
||||
Integer totalQty = baseMapper.sumTotalQtyByUserId(userId);
|
||||
return totalQty == null ? 0 : totalQty;
|
||||
public Integer sumAvailableQtyByUserId(Integer userId, Integer tenantId) {
|
||||
Integer availableQty = baseMapper.sumAvailableQtyByUserId(userId, tenantId);
|
||||
return availableQty == null ? 0 : availableQty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user