浏览代码

海博正式环境配置

fubojin 2 天之前
父节点
当前提交
c669079713

+ 6 - 4
yami-shop-api/src/main/java/com/yami/shop/api/controller/MyOrderController.java

@@ -26,6 +26,7 @@ import com.yami.shop.config.ShopConfig;
 import com.yami.shop.dao.PointsRecordMapper;
 import com.yami.shop.security.api.util.SecurityUtils;
 import com.yami.shop.service.*;
+import com.yami.shop.service.hb.IHBOrderService;
 import com.yami.shop.utils.CullenUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -33,6 +34,7 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import ma.glasnost.orika.MapperFacade;
+import org.springframework.core.annotation.OrderUtils;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
@@ -68,6 +70,7 @@ public class MyOrderController {
     private final ShopDetailService shopDetailService;
 
     private final OrderItemService orderItemService;
+    private final IHBOrderService ihbOrderService;
 
     private final OrderRefundService orderRefundService;
     private final PointsRecordMapper pointsRecordMapper;
@@ -341,10 +344,9 @@ public class MyOrderController {
         // 确认收货
         orderService.receiptOrder(Collections.singletonList(order));
 
-        for (OrderItem orderItem : orderItems) {
-            productService.removeProductCacheByProdId(orderItem.getProdId());
-            skuService.removeSkuCacheBySkuId(orderItem.getSkuId(), orderItem.getProdId());
-        }
+        //海博订单完成
+        ihbOrderService.changeOrderStatus(order.getOrderNumber(), OrderStatus.SUCCESS.value());
+
         return ResponseEntity.ok().build();
     }
 

+ 6 - 0
yami-shop-api/src/main/java/com/yami/shop/api/controller/OrderRefundController.java

@@ -538,6 +538,12 @@ public class OrderRefundController {
         orderRefund.setUpdateTime(new Date());
 
         orderRefundService.submitExpress(orderRefund, refundDelivery);
+
+
+        //海博退款单状态同步65
+        log.info("客户填写完成快递信息后海博退款单状态同步65");
+        orderRefundService.changeStatus(orderRefund.getRefundSn(), ReturnMoneyStsType.RECEIVE.value());
+
         return ResponseEntity.ok("提交成功");
     }
 

+ 3 - 3
yami-shop-api/src/main/java/com/yami/shop/api/controller/PayController.java

@@ -52,9 +52,9 @@ public class PayController {
     @ApiOperation(value = "测试退款")
     public ResponseEntity<?> refund() {
         RefundInfoPo po = new RefundInfoPo();
-        po.setOutTradeNo("");
-        po.setTotal(0);
-        po.setRefundMoney(0);
+        po.setOutTradeNo("1981204768344903680");
+        po.setTotal(310);
+        po.setRefundMoney(310);
         return ResponseEntity.ok(wxProviderService.refundOrder(po));
     }
 

+ 1 - 0
yami-shop-platform/src/main/resources/application.yml

@@ -9,6 +9,7 @@ spring:
     multipart:
       max-file-size: 100MB
       max-request-size: 100MB
+
       enabled: true
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss

+ 2 - 1
yami-shop-security/yami-shop-security-api/src/main/java/com/yami/shop/security/api/config/ResourceServerConfiguration.java

@@ -47,7 +47,8 @@ public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter
 
                 .authorizeRequests()
                 .antMatchers(
-                        "/p/delivery/getDeliveryList"
+                        "/p/delivery/getDeliveryList",
+                        "/p/order/refund"
                         ).permitAll()
                 .and()
 

+ 11 - 13
yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/HBFrontCategoryService.java

@@ -75,18 +75,6 @@ public class HBFrontCategoryService implements IHBFrontCategoryService {
                 frontCategory.setPic(jsonObjectInfo.getString("https://zswl-shop.oss-cn-chengdu.aliyuncs.com/2025/09/fe56414a161b498b8f263d3e6afdab92.png"));
                 log.info("添加前台类目信息{}", frontCategory);
 
-//                if (ObjectUtils.isNotEmpty(jsonObjectInfo.getString("parentCode")) && !jsonObjectInfo.getString("parentCode").equals("0")) {
-//                    frontCategoryMapper.selectOne(new LambdaQueryWrapper<FrontCategory>().
-//                            eq(FrontCategory::getParentCode, frontCategory.getParentCode())
-//                            .eq(FrontCategory::getIsDelete, 0));
-//                    if (frontCategory.getParentCode() == null) {
-//                        FrontCategory frontCategory1 = new FrontCategory();
-//                        frontCategory1.setCode(jsonObjectInfo.getString("parentCode"));
-//                        frontCategory1.setName(jsonObjectInfo.getString("parentName"));
-//                        frontCategory1.setIsDelete(0);
-//                        frontCategoryMapper.insert(frontCategory1);
-//                    }
-//                }
                 FrontCategory frontCategory1 = frontCategoryMapper.selectOne(new LambdaQueryWrapper<FrontCategory>().
                         eq(FrontCategory::getCode, frontCategory.getCode())
                         .eq(FrontCategory::getIsDelete, 0));
@@ -95,6 +83,16 @@ public class HBFrontCategoryService implements IHBFrontCategoryService {
                 } else {
                     frontCategory.setId(frontCategory1.getId());
                     frontCategoryMapper.updateById(frontCategory);
+
+                    //修改门店分类里面对应的
+                    List<ShopCategory> shopCategory = shopCategoryMapper.selectList(new LambdaQueryWrapper<ShopCategory>().eq(ShopCategory::getCode, frontCategory.getCode())
+                    .eq(ShopCategory::getIsDelete, 0));
+                    for (ShopCategory shopCategory1 : shopCategory) {
+                        shopCategory1.setName(frontCategory.getName());
+                        shopCategoryMapper.updateById(shopCategory1);
+                    }
+
+
                 }
                 // 3. 保存门店信息
 //                frontCategoryMapper.insert(frontCategory);
@@ -129,7 +127,7 @@ public class HBFrontCategoryService implements IHBFrontCategoryService {
         for (Object code : codeList) {
 
             log.info("前台类目删除,body:{}", code.toString());
-            FrontCategory frontCategory = frontCategoryMapper.selectOne(new LambdaQueryWrapper<FrontCategory>().eq(FrontCategory::getCode, Long.getLong(code.toString())));
+            FrontCategory frontCategory = frontCategoryMapper.selectOne(new LambdaQueryWrapper<FrontCategory>().eq(FrontCategory::getCode, Long.valueOf(code.toString())));
             frontCategory.setIsDelete(1);
             frontCategoryMapper.updateById(frontCategory);
 

+ 21 - 31
yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/HBGoodsService.java

@@ -306,38 +306,28 @@ public class HBGoodsService implements IHBGoodsService {
 
     @Override
     public void deleteGoods(JSONObject hbRequest) {
-        String bodyStr = hbRequest.getString("body");
-        log.info("商品删除,body:{}", bodyStr);
-
-        JSONObject bodyJson = JSON.parseObject(bodyStr);
-
-        String spuId = bodyJson.getString("spuId");
-        Product product;
-        if (ObjectUtil.isEmpty(spuId)) {
-            product = productMapper.selectOne(new LambdaQueryWrapper<Product>()
-                    .eq(Product::getChannelCode, bodyJson.getString("channelCode"))
-                    .eq(Product::getIsDelete, 0));
-        } else {
-            product = productMapper.selectByHbSpuId(spuId);
-        }
-        if (!ObjectUtil.isEmpty(product)) {
-            product.setIsDelete(1);
-            productMapper.updateById(product);
-            skuMapper.deleteByProdId(product.getProdId());
+        JSONObject body = hbRequest.getJSONObject("body");
+        log.info("商品删除,body:{}", body);
+
+        JSONArray productList = body.getJSONArray("productList");
+        for (Object hbProductObject : productList) {
+            JSONObject hbProduct = JSON.parseObject(hbProductObject.toString());
+
+            String spuId = hbProduct.getString("spuId");
+            String skuId = hbProduct.getString("skuId");
+            Product product;
+            if (ObjectUtil.isNotEmpty(spuId)) {
+                product = productMapper.selectByHbSpuId(spuId);
+            } else {
+                Sku sku = skuMapper.selectByHbSkuId(skuId);
+                product = productMapper.selectByHbSpuId(sku.getHbSpuId());
+            }
+            if (!ObjectUtil.isEmpty(product)) {
+                product.setIsDelete(1);
+                productMapper.updateById(product);
+                skuMapper.deleteByProdId(product.getProdId());
+            }
         }
-
-//        JSONArray requestList = bodyJson.getJSONArray("productList");
-//        for (Object request : requestList) {
-//            JSONObject jsonObject = JSON.parseObject(request.toString());
-//            String skuId = jsonObject.getString("skuId");
-//            Sku sku = skuMapper.selectByHbSkuId(skuId);
-//            if (ObjectUtil.isEmpty(sku)) {
-//                log.error("系统找不到删除对应商品(单品):{}", skuId);
-//                return;
-//            }
-//            sku.setIsDelete(1);
-//            skuMapper.updateById(sku);
-//        }
     }
 
     @Override

+ 1 - 11
yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/HBOrderService.java

@@ -144,7 +144,6 @@ public class HBOrderService implements IHBOrderService {
 
     @Override
     public String changeOrderStatus(String channelOrderId, Integer type) {
-
         HBBaseReq<Object> build = HBBaseReq.create();
         build.setAppId(hbSignUtil.getAppId());
 
@@ -163,14 +162,6 @@ public class HBOrderService implements IHBOrderService {
         log.info("post 订单推送单号参数:{}", JSON.toJSONString(build));
         String post = post(hbSignUtil.getHBHost() + "/api/order/changeOrderStatus", build);
         log.info("post 订单推送结果:{}", post);
-
-
-        //TODO 具体看是退钱还是退积分
-        if (type == 70) {//退款
-
-        }
-
-
         return post;
     }
 
@@ -257,7 +248,6 @@ public class HBOrderService implements IHBOrderService {
         String channelOrderId = body.getString("channelOrderId");
         Long changeTime = body.getLong("changeTime");
         Integer logisticStatus = body.getInteger("logisticStatus");
-        String operator = body.getString("operator");
         Order order = orderMapper.getOrderAndOrderItemByOrderNumber(channelOrderId);
         order.setHbLogisticStatus(logisticStatus);
         order.setUpdateTime(new Date(changeTime));
@@ -292,7 +282,7 @@ public class HBOrderService implements IHBOrderService {
     @Override
     public void deliveryMsg(JSONObject hBRequest) {
         String bodyStr = hBRequest.getString("body");
-        log.info("订单息,body:{}", bodyStr);
+        log.info("订单-发货消息,body:{}", bodyStr);
         JSONObject bodyJson = JSON.parseObject(bodyStr);
         Order order = orderMapper.getOrderAndOrderItemByOrderNumber(bodyJson.getString("channelOrderId"));
 

+ 2 - 2
yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/StoreManagementService.java

@@ -137,8 +137,8 @@ public class StoreManagementService implements IStoreManagementService {
             shopDetailInfo.setCity(resultData.getString("city"));
             shopDetailInfo.setArea(resultData.getString("district"));
             shopDetailInfo.setShopOwner(resultData.getString("contacts"));
-            shopDetailInfo.setShopLat(resultData.getString("longitude"));
-            shopDetailInfo.setShopLng(resultData.getString("latitude"));
+            shopDetailInfo.setShopLat(resultData.getString("latitude"));
+            shopDetailInfo.setShopLng(resultData.getString("longitude"));
             shopDetailInfo.setThirdPartyCode(resultData.getString("stationId"));
             shopDetailInfo.setNotice(resultData.getString("notice"));
             shopDetailInfo.setTel(resultData.getString("phone"));

+ 19 - 6
yami-shop-service/src/main/java/com/yami/shop/service/impl/OrderServiceImpl.java

@@ -26,6 +26,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.yami.shop.bean.app.dto.OrderCountData;
 import com.yami.shop.bean.app.dto.ShopCartOrderMergerDto;
@@ -867,12 +868,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 //            }
 
             // 待发货状态-最后一件商品进行退款,退款金额 =  商品金额 + 订单运费金额
-//            if (Objects.equals(order.getHbOrderStatus(), OrderStatus.PADYED.value()) && order.getFreightAmount() > 0) {
-//                int orderItenCount = orderItemService.count(new LambdaQueryWrapper<OrderItem>().eq(OrderItem::getOrderNumber, order.getOrderNumber()));
-//                if (Objects.equals(orderRefunds.size(), orderItenCount - 1)) {
-//                    newOrderRefund.setRefundAmount(Arith.add(newOrderRefund.getRefundAmount(), order.getFreightAmount()));
-//                }
-//            }
+            if ((Objects.equals(order.getHbOrderStatus(), OrderStatus.PADYED.value())||
+                    Objects.equals(order.getHbOrderStatus(), OrderStatus.CONSIGNMENT.value())) && order.getFreightAmount() > 0) {
+                int orderItenCount = orderItemService.count(new LambdaQueryWrapper<OrderItem>().eq(OrderItem::getOrderNumber, order.getOrderNumber()));
+                if (Objects.equals(orderRefunds.size(), orderItenCount - 1)) {
+                    newOrderRefund.setRefundAmount(Arith.add(newOrderRefund.getRefundAmount(), order.getFreightAmount()));
+                    newOrderRefund.setFreightAmount(order.getFreightAmount());
+                }
+            }
         }
 
         newOrderRefund.setShopId(order.getShopId());
@@ -897,8 +900,18 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         newOrderRefund.setReturnMoneySts(rReturnMoneySts);
         newOrderRefund.setApplyTime(new Date());
         newOrderRefund.setUpdateTime(new Date());
+
+        //TODO 待完善 积分
         log.info("生成退款单:{}", newOrderRefund);
 
+        List<OrderRefundAmountParam> sukList = Lists.newArrayList();
+        orderRefundParam.getOrderRefundSkuList().forEach(c -> {
+            OrderRefundAmountParam orderRefundAmountParam = new OrderRefundAmountParam();
+            orderRefundAmountParam.setSkuId(c.getSkuId());
+            orderRefundAmountParam.setProdCount(c.getProductCount());
+            sukList.add(orderRefundAmountParam);
+        });
+
         // 生成退款单
         orderRefundMapper.insert(newOrderRefund);
         // 更新订单状态

+ 1 - 1
yami-shop-service/src/main/resources/mapper/OrderMapper.xml

@@ -224,7 +224,7 @@
     </update>
 
     <update id="receiptOrder">
-        update tz_order set `hb_order_status`=80,finally_time = NOW(),update_time=NOW() where order_id in
+        update tz_order set `hb_order_status`= 80,finally_time = NOW(),update_time=NOW() where order_id in
         <foreach collection="orders" item="order" open="(" close=")" separator=",">
             #{order.orderId}
         </foreach>

+ 1 - 1
yami-shop-wx/src/main/java/com/yami/shop/wx/po/RefundInfoPo.java

@@ -17,7 +17,7 @@ import javax.validation.constraints.NotNull;
 @NoArgsConstructor
 public class RefundInfoPo {
 
-    @ApiModelProperty(value = "订单号")
+    @ApiModelProperty(value = "订单结算表pay_no支付单号")
     @NotNull(message = "订单号不能为空...")
     private String outTradeNo;