Sfoglia il codice sorgente

fix 修改订单查询bug和地址bug

chenchen 5 mesi fa
parent
commit
f94c0e6dd8

+ 4 - 4
application-webadmin/src/main/java/com/tourism/webadmin/app/wechat/controller/WechatDeliveryOrderController.java

@@ -82,11 +82,11 @@ public class WechatDeliveryOrderController {
         deliveryOrderService.maskFieldDataList(deliveryOrderList, null);
 
         //查询订单详情
-        Set<Long> orderIds = deliveryOrderList.stream().map(e -> e.getId()).collect(Collectors.toSet());
+        Set<String> orderIds = deliveryOrderList.stream().map(e -> e.getId()).collect(Collectors.toSet());
         List<DeliveryOrderItems> items = deliveryOrderItemsService.getDeliveryOrderItemsVoList(orderIds);
         List<DeliveryOrderItemsVo> deliveryOrderItemsVos = MyModelUtil.copyCollectionTo(items, DeliveryOrderItemsVo.class);
         //做成map,方便匹配
-        Map<Long, List<DeliveryOrderItemsVo>> collect1 = deliveryOrderItemsVos.stream().collect(Collectors.groupingBy(DeliveryOrderItemsVo::getOrderId));
+        Map<String, List<DeliveryOrderItemsVo>> collect1 = deliveryOrderItemsVos.stream().collect(Collectors.groupingBy(DeliveryOrderItemsVo::getOrderId));
         MyPageData<DeliveryOrderVo> pageData = MyPageUtil.makeResponseData(deliveryOrderList, DeliveryOrderVo.class);
         pageData.getDataList().forEach(e->{
             e.setItemList(collect1.get(e.getId()));
@@ -99,14 +99,14 @@ public class WechatDeliveryOrderController {
      */
 //    @SaIgnore
     @RequestMapping("/orderDetail")
-    public ResponseResult<DeliveryOrderVo> orderDetail(@RequestParam Long id) {
+    public ResponseResult<DeliveryOrderVo> orderDetail(@RequestParam String id) {
         DeliveryOrder deliveryOrder = deliveryOrderService.getByIdWithRelation(id, MyRelationParam.full());
         if (deliveryOrder == null) {
             return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
         }
         deliveryOrderService.maskFieldData(deliveryOrder, null);
         DeliveryOrderVo deliveryOrderVo = MyModelUtil.copyTo(deliveryOrder, DeliveryOrderVo.class);
-        DeliveryOrderItems build = DeliveryOrderItems.builder().orderId(Long.valueOf(deliveryOrderVo.getId())).build();
+        DeliveryOrderItems build = DeliveryOrderItems.builder().orderId(deliveryOrderVo.getId()).build();
         List<DeliveryOrderItems> items = deliveryOrderItemsService.getDeliveryOrderItemsList(build, "create_time");
         //items转为vo
         deliveryOrderVo.setItemList(MyModelUtil.copyCollectionTo(items, DeliveryOrderItemsVo.class));

+ 7 - 7
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/DeliveryOrderController.java

@@ -52,7 +52,7 @@ public class DeliveryOrderController {
     @SaCheckPermission("deliveryOrder.add")
     @OperationLog(type = SysOperationLogType.ADD)
     @PostMapping("/add")
-    public ResponseResult<Long> add(
+    public ResponseResult<String> add(
             @MyRequestBody DeliveryOrderDto deliveryOrderDto,
             @MyRequestBody List<DeliveryOrderItemsDto> deliveryOrderItemsDtoList) {
         ResponseResult<Tuple2<DeliveryOrder, JSONObject>> verifyResult =
@@ -77,7 +77,7 @@ public class DeliveryOrderController {
     @SaCheckPermission("deliveryOrder.update")
     @OperationLog(type = SysOperationLogType.UPDATE)
     @PostMapping("/update")
-    public ResponseResult<Long> update(
+    public ResponseResult<String> update(
             @MyRequestBody DeliveryOrderDto deliveryOrderDto,
             @MyRequestBody List<DeliveryOrderItemsDto> deliveryOrderItemsDtoList) {
         String errorMessage;
@@ -105,7 +105,7 @@ public class DeliveryOrderController {
     @SaCheckPermission("deliveryOrder.delete")
     @OperationLog(type = SysOperationLogType.DELETE)
     @PostMapping("/delete")
-    public ResponseResult<Void> delete(@MyRequestBody Long id) {
+    public ResponseResult<Void> delete(@MyRequestBody String id) {
         if (MyCommonUtil.existBlankArgument(id)) {
             return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
         }
@@ -121,11 +121,11 @@ public class DeliveryOrderController {
     @SaCheckPermission("deliveryOrder.delete")
     @OperationLog(type = SysOperationLogType.DELETE_BATCH)
     @PostMapping("/deleteBatch")
-    public ResponseResult<Void> deleteBatch(@MyRequestBody List<Long> idList) {
+    public ResponseResult<Void> deleteBatch(@MyRequestBody List<String> idList) {
         if (MyCommonUtil.existBlankArgument(idList)) {
             return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
         }
-        for (Long id : idList) {
+        for (String id : idList) {
             ResponseResult<Void> responseResult = this.doDelete(id);
             if (!responseResult.isSuccess()) {
                 return responseResult;
@@ -252,7 +252,7 @@ public class DeliveryOrderController {
      */
     @SaCheckPermission("deliveryOrder.view")
     @GetMapping("/view")
-    public ResponseResult<DeliveryOrderVo> view(@RequestParam Long id) {
+    public ResponseResult<DeliveryOrderVo> view(@RequestParam String id) {
         DeliveryOrder deliveryOrder = deliveryOrderService.getByIdWithRelation(id, MyRelationParam.full());
         if (deliveryOrder == null) {
             return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
@@ -299,7 +299,7 @@ public class DeliveryOrderController {
         return ResponseResult.success(new Tuple2<>(deliveryOrder, relationData));
     }
 
-    private ResponseResult<Void> doDelete(Long id) {
+    private ResponseResult<Void> doDelete(String id) {
         String errorMessage;
         // 验证关联Id的数据合法性
         DeliveryOrder originalDeliveryOrder = deliveryOrderService.getById(id);

+ 2 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/DeliveryOrderItemsController.java

@@ -50,7 +50,7 @@ public class DeliveryOrderItemsController {
     @SaCheckPermission("deliveryOrderItems.add")
     @OperationLog(type = SysOperationLogType.ADD)
     @PostMapping("/add")
-    public ResponseResult<Long> add(@MyRequestBody DeliveryOrderItemsDto deliveryOrderItemsDto) {
+    public ResponseResult<String> add(@MyRequestBody DeliveryOrderItemsDto deliveryOrderItemsDto) {
         String errorMessage = MyCommonUtil.getModelValidationError(deliveryOrderItemsDto, false);
         if (errorMessage != null) {
             return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
@@ -225,7 +225,7 @@ public class DeliveryOrderItemsController {
      */
     @SaCheckPermission("deliveryOrderItems.view")
     @GetMapping("/view")
-    public ResponseResult<DeliveryOrderItemsVo> view(@RequestParam Long id) {
+    public ResponseResult<DeliveryOrderItemsVo> view(@RequestParam String id) {
         DeliveryOrderItems deliveryOrderItems = deliveryOrderItemsService.getByIdWithRelation(id, MyRelationParam.full());
         if (deliveryOrderItems == null) {
             return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/dto/DeliveryOrderDto.java

@@ -24,7 +24,7 @@ public class DeliveryOrderDto {
      */
     @Schema(description = "主键。", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotNull(message = "数据验证失败,主键不能为空!", groups = {UpdateGroup.class})
-    private Long id;
+    private String id;
 
     /**
      * 配送时间。

+ 2 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/dto/DeliveryOrderItemsDto.java

@@ -24,7 +24,7 @@ public class DeliveryOrderItemsDto {
      */
     @Schema(description = "主键。", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotNull(message = "数据验证失败,主键不能为空!", groups = {UpdateGroup.class})
-    private Long id;
+    private String id;
 
     /**
      * 食品名称。
@@ -37,7 +37,7 @@ public class DeliveryOrderItemsDto {
      * 订单id。
      */
     @Schema(description = "订单id。")
-    private Long orderId;
+    private String orderId;
 
     /**
      * 价格。

+ 1 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/model/DeliveryOrder.java

@@ -31,7 +31,7 @@ public class DeliveryOrder extends BaseModel {
      * 主键。
      */
     @TableId(value = "id")
-    private Long id;
+    private String id;
 
     /**
      * 配送时间。

+ 2 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/model/DeliveryOrderItems.java

@@ -26,7 +26,7 @@ public class DeliveryOrderItems extends BaseModel {
      * 主键。
      */
     @TableId(value = "id")
-    private Long id;
+    private String id;
 
     /**
      * 食品名称。
@@ -38,7 +38,7 @@ public class DeliveryOrderItems extends BaseModel {
      * 订单id。
      */
     @TableField(value = "order_id")
-    private Long orderId;
+    private String orderId;
 
     /**
      * 价格。

+ 4 - 4
application-webadmin/src/main/java/com/tourism/webadmin/back/service/DeliveryOrderItemsService.java

@@ -13,7 +13,7 @@ import java.util.*;
  * @author 吃饭睡觉
  * @date 2024-09-06
  */
-public interface DeliveryOrderItemsService extends IBaseService<DeliveryOrderItems, Long> {
+public interface DeliveryOrderItemsService extends IBaseService<DeliveryOrderItems, String> {
 
     /**
      * 保存新增对象。
@@ -61,7 +61,7 @@ public interface DeliveryOrderItemsService extends IBaseService<DeliveryOrderIte
      * @param orderId 从表关联字段。
      * @return 删除数量。
      */
-    int removeByOrderId(Long orderId);
+    int removeByOrderId(String orderId);
 
     /**
      * 批量更新一对多从表的数据。
@@ -69,7 +69,7 @@ public interface DeliveryOrderItemsService extends IBaseService<DeliveryOrderIte
      * @param orderId 从表关联字段。
      * @param dataList 本次批量更新的一对多从表数据。
      */
-    void updateBatchByOrderId(Long orderId, List<DeliveryOrderItems> dataList);
+    void updateBatchByOrderId(String orderId, List<DeliveryOrderItems> dataList);
 
     /**
      * 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
@@ -103,5 +103,5 @@ public interface DeliveryOrderItemsService extends IBaseService<DeliveryOrderIte
      */
     CallResult verifyImportList(List<DeliveryOrderItems> dataList, Set<String> ignoreFieldSet);
 
-    List<DeliveryOrderItems> getDeliveryOrderItemsVoList(Set<Long> orderIds);
+    List<DeliveryOrderItems> getDeliveryOrderItemsVoList(Set<String> orderIds);
 }

+ 2 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/service/DeliveryOrderService.java

@@ -13,7 +13,7 @@ import java.util.*;
  * @author 吃饭睡觉
  * @date 2024-09-06
  */
-public interface DeliveryOrderService extends IBaseService<DeliveryOrder, Long> {
+public interface DeliveryOrderService extends IBaseService<DeliveryOrder, String> {
 
     /**
      * 保存新增对象。
@@ -72,7 +72,7 @@ public interface DeliveryOrderService extends IBaseService<DeliveryOrder, Long>
      * @param id 主键Id。
      * @return 成功返回true,否则false。
      */
-    boolean remove(Long id);
+    boolean remove(String id);
 
     /**
      * 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。

+ 5 - 5
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/DeliveryOrderItemsServiceImpl.java

@@ -36,7 +36,7 @@ import java.util.Set;
 @Slf4j
 @MyDataSource(DataSourceType.MAIN)
 @Service("deliveryOrderItemsService")
-public class DeliveryOrderItemsServiceImpl extends BaseService<DeliveryOrderItems, Long> implements DeliveryOrderItemsService {
+public class DeliveryOrderItemsServiceImpl extends BaseService<DeliveryOrderItems, String> implements DeliveryOrderItemsService {
 
     @Autowired
     private IdGeneratorWrapper idGenerator;
@@ -113,7 +113,7 @@ public class DeliveryOrderItemsServiceImpl extends BaseService<DeliveryOrderItem
 
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public int removeByOrderId(Long orderId) {
+    public int removeByOrderId(String orderId) {
         DeliveryOrderItems deletedObject = new DeliveryOrderItems();
         deletedObject.setOrderId(orderId);
         return deliveryOrderItemsMapper.delete(new QueryWrapper<>(deletedObject));
@@ -121,7 +121,7 @@ public class DeliveryOrderItemsServiceImpl extends BaseService<DeliveryOrderItem
 
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public void updateBatchByOrderId(Long orderId, List<DeliveryOrderItems> dataList) {
+    public void updateBatchByOrderId(String orderId, List<DeliveryOrderItems> dataList) {
         this.updateBatchOneToManyRelation("orderId", orderId,
                 null, null, dataList, this::saveNewBatch);
     }
@@ -148,7 +148,7 @@ public class DeliveryOrderItemsServiceImpl extends BaseService<DeliveryOrderItem
     }
 
     @Override
-    public List<DeliveryOrderItems> getDeliveryOrderItemsVoList(Set<Long> orderIds) {
+    public List<DeliveryOrderItems> getDeliveryOrderItemsVoList(Set<String> orderIds) {
         LambdaQueryWrapper<DeliveryOrderItems> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.in(DeliveryOrderItems::getOrderId, orderIds);
         List<DeliveryOrderItems> deliveryOrderItems = deliveryOrderItemsMapper.selectList(queryWrapper);
@@ -168,7 +168,7 @@ public class DeliveryOrderItemsServiceImpl extends BaseService<DeliveryOrderItem
 
     private DeliveryOrderItems buildDefaultValue(DeliveryOrderItems deliveryOrderItems) {
         if (deliveryOrderItems.getId() == null) {
-            deliveryOrderItems.setId(idGenerator.nextLongId());
+            deliveryOrderItems.setId(idGenerator.nextStringId());
         }
         MyModelUtil.fillCommonsForInsert(deliveryOrderItems);
         return deliveryOrderItems;

+ 3 - 3
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/DeliveryOrderServiceImpl.java

@@ -37,7 +37,7 @@ import java.util.Set;
 @Slf4j
 @MyDataSource(DataSourceType.MAIN)
 @Service("deliveryOrderService")
-public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrder, Long> implements DeliveryOrderService {
+public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrder, String> implements DeliveryOrderService {
 
     @Autowired
     private IdGeneratorWrapper idGenerator;
@@ -145,7 +145,7 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrder, Long> i
 
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public boolean remove(Long id) {
+    public boolean remove(String id) {
         if (deliveryOrderMapper.deleteById(id) == 0) {
             return false;
         }
@@ -170,7 +170,7 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrder, Long> i
 
     private DeliveryOrder buildDefaultValue(DeliveryOrder deliveryOrder) {
         if (deliveryOrder.getId() == null) {
-            deliveryOrder.setId(idGenerator.nextLongId());
+            deliveryOrder.setId(idGenerator.nextStringId());
         }
         MyModelUtil.fillCommonsForInsert(deliveryOrder);
         deliveryOrder.setDataState(GlobalDeletedFlag.NORMAL);

+ 2 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/DeliveryOrderItemsVo.java

@@ -23,7 +23,7 @@ public class DeliveryOrderItemsVo extends BaseVo {
      * 主键。
      */
     @Schema(description = "主键")
-    private Long id;
+    private String id;
 
     /**
      * 食品名称。
@@ -35,7 +35,7 @@ public class DeliveryOrderItemsVo extends BaseVo {
      * 订单id。
      */
     @Schema(description = "订单id")
-    private Long orderId;
+    private String orderId;
 
     /**
      * 价格。