Showing
3 changed files
with
35 additions
and
50 deletions
| ... | @@ -81,6 +81,6 @@ public class SkuSellQuantity extends Model<OrderDetailDb> implements Serializabl | ... | @@ -81,6 +81,6 @@ public class SkuSellQuantity extends Model<OrderDetailDb> implements Serializabl |
| 81 | private Integer updateSource; | 81 | private Integer updateSource; |
| 82 | 82 | ||
| 83 | @TableLogic | 83 | @TableLogic |
| 84 | - private Integer isDeleted; | 84 | + private Boolean isDeleted; |
| 85 | 85 | ||
| 86 | } | 86 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -663,11 +663,13 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -663,11 +663,13 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 663 | final StreamObserver<QuerySkuSellQuantitiesByStallRpcResponse> responseStreamObserver) { | 663 | final StreamObserver<QuerySkuSellQuantitiesByStallRpcResponse> responseStreamObserver) { |
| 664 | final var builder = QuerySkuSellQuantitiesByStallRpcResponse.newBuilder(); | 664 | final var builder = QuerySkuSellQuantitiesByStallRpcResponse.newBuilder(); |
| 665 | try { | 665 | try { |
| 666 | - LambdaQueryWrapper<SkuSellQuantity> queryWrapper = new LambdaQueryWrapper<>(); | 666 | + LambdaQueryWrapper<SkuSellQuantity> queryWrapper = new LambdaQueryWrapper<>(); |
| 667 | - queryWrapper.eq(SkuSellQuantity::getEnterpriseId, request.getEnterpriseId()); | 667 | + queryWrapper.eq(SkuSellQuantity::getEnterpriseId, request.getEnterpriseId()); |
| 668 | - queryWrapper.eq(SkuSellQuantity::getStallId, request.getStallId()); | 668 | + queryWrapper.eq(SkuSellQuantity::getStallId, request.getStallId()); |
| 669 | - final var list = skuSellQuantityService.list(queryWrapper); | 669 | + final var list = skuSellQuantityService.list(queryWrapper); |
| 670 | - builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(list, SingleSkuSellQuantityRpcResponse.class)); | 670 | + if (!list.isEmpty()) { |
| 671 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(list, SingleSkuSellQuantityRpcResponse.class)); | ||
| 672 | + } | ||
| 671 | } catch (final Exception e) { | 673 | } catch (final Exception e) { |
| 672 | log.error("querySkuSellQuantitiesByStall error;", e); | 674 | log.error("querySkuSellQuantitiesByStall error;", e); |
| 673 | responseStreamObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | 675 | responseStreamObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); |
| ... | @@ -682,12 +684,14 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -682,12 +684,14 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 682 | final StreamObserver<QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse> responseStreamObserver) { | 684 | final StreamObserver<QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse> responseStreamObserver) { |
| 683 | final var builder = QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse.newBuilder(); | 685 | final var builder = QuerySkuSellQuantitiesByStallAndSkuIdsRpcResponse.newBuilder(); |
| 684 | try { | 686 | try { |
| 685 | - LambdaQueryWrapper<SkuSellQuantity> queryWrapper = new LambdaQueryWrapper<>(); | 687 | + LambdaQueryWrapper<SkuSellQuantity> queryWrapper = new LambdaQueryWrapper<>(); |
| 686 | - queryWrapper.eq(SkuSellQuantity::getEnterpriseId, request.getEnterpriseId()); | 688 | + queryWrapper.eq(SkuSellQuantity::getEnterpriseId, request.getEnterpriseId()); |
| 687 | - queryWrapper.eq(SkuSellQuantity::getStallId, request.getStallId()); | 689 | + queryWrapper.eq(SkuSellQuantity::getStallId, request.getStallId()); |
| 688 | - queryWrapper.in(SkuSellQuantity::getSkuId, request.getSkuIdsList()); | 690 | + queryWrapper.in(SkuSellQuantity::getSkuId, request.getSkuIdsList()); |
| 689 | - final var list = skuSellQuantityService.list(queryWrapper); | 691 | + final var list = skuSellQuantityService.list(queryWrapper); |
| 690 | - builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(list, SingleSkuSellQuantityRpcResponse.class)); | 692 | + if (!list.isEmpty()) { |
| 693 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(list, SingleSkuSellQuantityRpcResponse.class)); | ||
| 694 | + } | ||
| 691 | } catch (final Exception e) { | 695 | } catch (final Exception e) { |
| 692 | log.error("querySkuSellQuantitiesByStallAndSkuIds error;", e); | 696 | log.error("querySkuSellQuantitiesByStallAndSkuIds error;", e); |
| 693 | responseStreamObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | 697 | responseStreamObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); |
| ... | @@ -702,22 +706,22 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu | ... | @@ -702,22 +706,22 @@ public class OrderGrpcService extends ClientCustomerOrderServiceRpcGrpc.ClientCu |
| 702 | final StreamObserver<BatchSaveSkuSellQuantitiesRpcResponse> responseStreamObserver) { | 706 | final StreamObserver<BatchSaveSkuSellQuantitiesRpcResponse> responseStreamObserver) { |
| 703 | final var builder = BatchSaveSkuSellQuantitiesRpcResponse.newBuilder(); | 707 | final var builder = BatchSaveSkuSellQuantitiesRpcResponse.newBuilder(); |
| 704 | try { | 708 | try { |
| 705 | - List<SkuSellQuantity> skuSellQuantities = new ArrayList<>(); | 709 | + List<SkuSellQuantity> skuSellQuantities = new ArrayList<>(); |
| 706 | - for (SkuSellQuantityModification skuSellQuantityModification : request.getSkuSellQuantityModificationsList()) { | 710 | + for (SkuSellQuantityModification skuSellQuantityModification : request.getSkuSellQuantityModificationsList()) { |
| 707 | - SkuSellQuantity skuSellQuantity = new SkuSellQuantity(); | 711 | + SkuSellQuantity skuSellQuantity = new SkuSellQuantity(); |
| 708 | - skuSellQuantity.setId(skuSellQuantityModification.getId() == 0 ? null : skuSellQuantityModification.getId()); | 712 | + skuSellQuantity.setId(skuSellQuantityModification.getId() == 0 ? null : skuSellQuantityModification.getId()); |
| 709 | - skuSellQuantity.setEnterpriseId(request.getEnterpriseId()); | 713 | + skuSellQuantity.setEnterpriseId(request.getEnterpriseId()); |
| 710 | - skuSellQuantity.setStallId(skuSellQuantityModification.getStallId()); | 714 | + skuSellQuantity.setStallId(skuSellQuantityModification.getStallId()); |
| 711 | - skuSellQuantity.setSkuId(skuSellQuantityModification.getSkuId()); | 715 | + skuSellQuantity.setSkuId(skuSellQuantityModification.getSkuId()); |
| 712 | - skuSellQuantity.setMaxSellQuantity(skuSellQuantityModification.getMaxSellQuantity()); | 716 | + skuSellQuantity.setMaxSellQuantity(skuSellQuantityModification.getMaxSellQuantity()); |
| 713 | - skuSellQuantity.setCreatedBy(request.getUpdatedBy()); | 717 | + skuSellQuantity.setCreatedBy(request.getUpdatedBy()); |
| 714 | - skuSellQuantity.setCreationSource(OrderSourceEnum.STALL_VALUE); | 718 | + skuSellQuantity.setCreationSource(OrderSourceEnum.STALL_VALUE); |
| 715 | - skuSellQuantity.setUpdatedBy(request.getUpdatedBy()); | 719 | + skuSellQuantity.setUpdatedBy(request.getUpdatedBy()); |
| 716 | - skuSellQuantity.setUpdateSource(OrderSourceEnum.STALL_VALUE); | 720 | + skuSellQuantity.setUpdateSource(OrderSourceEnum.STALL_VALUE); |
| 717 | - skuSellQuantities.add(skuSellQuantity); | 721 | + skuSellQuantities.add(skuSellQuantity); |
| 718 | - } | 722 | + } |
| 719 | - final boolean saveOrUpdateBatch = skuSellQuantityService.saveOrUpdateBatch(skuSellQuantities); | 723 | + final boolean saveOrUpdateBatch = skuSellQuantityService.saveOrUpdateBatch(skuSellQuantities); |
| 720 | - builder.setIsSaved(saveOrUpdateBatch); | 724 | + builder.setIsSaved(saveOrUpdateBatch); |
| 721 | } catch (final Exception e) { | 725 | } catch (final Exception e) { |
| 722 | log.error("batchSaveSkuSellQuantities error;", e); | 726 | log.error("batchSaveSkuSellQuantities error;", e); |
| 723 | responseStreamObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | 727 | responseStreamObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ... | ... |
| 1 | package com.tianting.infoloop.utils; | 1 | package com.tianting.infoloop.utils; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.date.LocalDateTimeUtil; | 3 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 4 | -import com.fasterxml.jackson.databind.JsonNode; | ||
| 5 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 6 | import com.google.gson.Gson; | 4 | import com.google.gson.Gson; |
| 7 | import com.google.gson.GsonBuilder; | 5 | import com.google.gson.GsonBuilder; |
| 8 | import com.google.gson.TypeAdapter; | 6 | import com.google.gson.TypeAdapter; |
| ... | @@ -11,7 +9,6 @@ import com.google.gson.stream.JsonWriter; | ... | @@ -11,7 +9,6 @@ import com.google.gson.stream.JsonWriter; |
| 11 | import com.google.protobuf.Message; | 9 | import com.google.protobuf.Message; |
| 12 | import com.google.protobuf.MessageOrBuilder; | 10 | import com.google.protobuf.MessageOrBuilder; |
| 13 | import com.google.protobuf.util.JsonFormat; | 11 | import com.google.protobuf.util.JsonFormat; |
| 14 | -import com.tianting.infoloop.constants.DateFormatterConstants; | ||
| 15 | import lombok.SneakyThrows; | 12 | import lombok.SneakyThrows; |
| 16 | 13 | ||
| 17 | import java.io.IOException; | 14 | import java.io.IOException; |
| ... | @@ -19,6 +16,7 @@ import java.lang.reflect.Constructor; | ... | @@ -19,6 +16,7 @@ import java.lang.reflect.Constructor; |
| 19 | import java.time.Instant; | 16 | import java.time.Instant; |
| 20 | import java.time.LocalDate; | 17 | import java.time.LocalDate; |
| 21 | import java.time.LocalDateTime; | 18 | import java.time.LocalDateTime; |
| 19 | +import java.time.ZoneId; | ||
| 22 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
| 23 | import java.util.Collection; | 21 | import java.util.Collection; |
| 24 | import java.util.List; | 22 | import java.util.List; |
| ... | @@ -158,27 +156,10 @@ public class ProtoBeanUtil { | ... | @@ -158,27 +156,10 @@ public class ProtoBeanUtil { |
| 158 | 156 | ||
| 159 | @Override | 157 | @Override |
| 160 | public LocalDate read(JsonReader in) throws IOException { | 158 | public LocalDate read(JsonReader in) throws IOException { |
| 161 | - return LocalDate.ofInstant(Instant.ofEpochMilli(Long.parseLong(in.nextString())), DateFormatterConstants.CHINA_ZONE); | 159 | + return LocalDate.ofInstant(Instant.ofEpochMilli(Long.parseLong(in.nextString())), ZoneId.of("Asia/Shanghai")); |
| 162 | } | 160 | } |
| 163 | } | 161 | } |
| 164 | - ) | 162 | + ).create(); |
| 165 | -// .registerTypeAdapter(JsonNode.class, new TypeAdapter<JsonNode>() { | ||
| 166 | -// private final ObjectMapper objectMapper = new ObjectMapper(); | ||
| 167 | -// @Override | ||
| 168 | -// public void write(JsonWriter out, JsonNode value) throws IOException { | ||
| 169 | -// if (value!= null) { | ||
| 170 | -// out.value(value.toString()); | ||
| 171 | -// } else { | ||
| 172 | -// out.nullValue(); | ||
| 173 | -// } | ||
| 174 | -// } | ||
| 175 | -// | ||
| 176 | -// @Override | ||
| 177 | -// public JsonNode read(JsonReader in) throws IOException { | ||
| 178 | -// return objectMapper.readValue(in.nextString(), JsonNode.class); | ||
| 179 | -// } | ||
| 180 | -// }) | ||
| 181 | - .create(); | ||
| 182 | return gson; | 163 | return gson; |
| 183 | } | 164 | } |
| 184 | 165 | ... | ... |
-
Please register or login to post a comment