Commit 75d5fa49ba50575087834476b7bc1d269fd2d34e

Authored by fengliang
1 parent 5bf9a101

update:商品描述信息修正

etrade-order/src/main/java/com/diligrp/etrade/order/api/OrderController.java
... ... @@ -775,7 +775,7 @@ public class OrderController {
775 775 }
776 776  
777 777 /**
778   - * 查询核销状态
  778 + * 订单手动通知微信商户平台发货
779 779 * @param orderDto
780 780 * @return
781 781 */
... ... @@ -789,6 +789,19 @@ public class OrderController {
789 789 }
790 790 }
791 791  
792   -
  792 + /**
  793 + * 获取订单商品名称字符串
  794 + * @param orderDto
  795 + * @return
  796 + */
  797 + @RequestMapping(value = "/getOrderGoodesNames",method = {RequestMethod.POST},produces="application/json;charset=UTF-8")
  798 + public Message getOrderGoodesNames(@RequestBody OrderGetDto orderDto){
  799 + try{
  800 + return Message.success(orderService.getOrderGoodesNames(orderDto));
  801 + }catch (PlatformServiceException pe) {
  802 + LOGGER.warn("服务异常{}:{}",pe.getCode(), pe.getMessage());
  803 + return Message.failure("服务暂时不在线,请稍后");
  804 + }
  805 + }
793 806  
794 807 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/OrderService.java
... ... @@ -263,4 +263,11 @@ public interface OrderService {
263 263 * 获取订单状态
264 264 */
265 265 OrderDto checkOrderState(String code);
  266 +
  267 + /**
  268 + * 获取订单列表商品名称
  269 + * @param orderDto
  270 + * @return
  271 + */
  272 + String getOrderGoodesNames(OrderGetDto orderDto);
266 273 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderGoodsServiceImpl.java
... ... @@ -350,29 +350,37 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
350 350  
351 351 @Override
352 352 public String getGoodsNames(String name, List<Order> orderList) {
353   - List<Long> orderId = orderList.stream().map(Order::getId).collect(Collectors.toList());
354   - List<ProductDto> goodsNames = orderGoodsMapper.getOrderGoodsByOrderIds(orderId);
355   - StringBuffer nameBuffer = new StringBuffer();
356   - nameBuffer.append(name);
357   - boolean first = false;
358   - for(ProductDto goods : goodsNames){
359   - if(nameBuffer.length()>110){
360   - break;
361   - }
362   - if(first){
363   - nameBuffer.append(",");
364   - }else{
365   - nameBuffer.append(":");
366   - first = true;
  353 + if (orderList == null || orderList.isEmpty()) {
  354 + return name;
  355 + }
  356 +
  357 + List<Long> orderIds = orderList.stream().map(Order::getId).collect(Collectors.toList());
  358 + List<ProductDto> goodsNames = orderGoodsMapper.getOrderGoodsByOrderIds(orderIds);
  359 +
  360 + StringBuilder nameBuilder = new StringBuilder(name);
  361 + boolean isFirst = true;
  362 +
  363 + for (ProductDto goods : goodsNames) {
  364 + StringBuilder goodsInfo = new StringBuilder();
  365 + if (!isFirst) {
  366 + goodsInfo.append(",");
  367 + } else {
  368 + goodsInfo.append(":");
  369 + isFirst = false;
367 370 }
368   - String goodsInfo = goods.getProductName()+goods.getProductWeight().stripTrailingZeros()+goods.getProductUnit();
369   - if(nameBuffer.length()+goodsInfo.length() >110){
  371 +
  372 + String productWeightStr = goods.getProductWeight().stripTrailingZeros().toPlainString();
  373 + String productUnit = goods.getProductUnit() != null ? goods.getProductUnit() : "";
  374 + goodsInfo.append(goods.getProductName()).append(productWeightStr).append(productUnit);
  375 +
  376 + if (nameBuilder.length() + goodsInfo.length() > 110) {
  377 + nameBuilder.append(",等多种商品");
370 378 break;
371   - }else{
372   - nameBuffer.append(goodsInfo);
  379 + } else {
  380 + nameBuilder.append(goodsInfo);
373 381 }
374 382 }
375   - return nameBuffer.toString();
  383 + return nameBuilder.toString();
376 384 }
377 385  
378 386 private void checkShopCustomer(ShopVo shop) {
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderServiceImpl.java
... ... @@ -1050,6 +1050,14 @@ public class OrderServiceImpl implements OrderService {
1050 1050 }
1051 1051  
1052 1052 @Override
  1053 + public String getOrderGoodesNames(OrderGetDto orderDto) {
  1054 + Order order = getOneOrder(orderDto);
  1055 + List<Order> orderList = new ArrayList<>();
  1056 + orderList.add(order);
  1057 + return orderGoodsService.getGoodsNames(order.getShopName(),orderList);
  1058 + }
  1059 +
  1060 + @Override
1053 1061 public Integer checkPayStateOnLine(String paymentId, Long marketId) {
1054 1062 WeChatPayFunctionDto functionDto = new WeChatPayFunctionDto(paymentId,"online",marketId);
1055 1063 OrderPaymentCheckDto orderPaymentCheckDto = this.wxChatPayCheck(functionDto);
... ...