Browse Source

Merge remote-tracking branch 'origin/master'

wangming 1 day ago
parent
commit
b86038001a

+ 11 - 0
yami-shop-api/src/main/java/com/yami/shop/api/controller/MyShopDetailController.java

@@ -20,6 +20,7 @@ import com.yami.shop.bean.model.ShopAuditing;
 import com.yami.shop.bean.model.ShopDetail;
 import com.yami.shop.bean.param.ShopDetailParam;
 import com.yami.shop.common.exception.GlobalException;
+import com.yami.shop.common.util.R;
 import com.yami.shop.security.api.util.SecurityUtils;
 import com.yami.shop.security.comment.model.UpdatePasswordDto;
 import com.yami.shop.security.comment.model.UsernameAndPasswordDto;
@@ -151,4 +152,14 @@ public class MyShopDetailController {
 		smsLogService.sendSms(SmsType.VALID, userId ,sendSmsParam.getMobile(), Maps.newHashMap());
 		return ResponseEntity.ok().build();
 	}
+
+	/**
+	 * 获取店铺信息
+	 */
+	@GetMapping("/info/{shopId}")
+	@ApiOperation(value = "获取店铺信息")
+	public R<ShopDetail> info(@PathVariable("shopId") Long shopId) {
+		ShopDetail shopDetailByShopId = shopDetailService.getShopDetailByShopId(shopId);
+		return R.SUCCESS(shopDetailByShopId);
+	}
 }

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

@@ -671,7 +671,7 @@ public class OrderRefundController {
      */
     @GetMapping("/info")
     @ApiOperation(value = "查看退款订单详情", notes = "查看退款订单详情")
-    public R<ApiOrderRefundDto> info(String refundSn) {
+    public ResponseEntity<ApiOrderRefundDto> info(String refundSn) {
         // 查询详情
         OrderRefundDto orderRefundDto = orderRefundService.getOrderRefundByRefundSn(refundSn);
 
@@ -681,7 +681,7 @@ public class OrderRefundController {
 
         ApiOrderRefundDto apiOrderRefundDto = mapperFacade.map(orderRefundDto, ApiOrderRefundDto.class);
 
-        return R.SUCCESS(apiOrderRefundDto);
+        return ResponseEntity.ok(apiOrderRefundDto);
     }
 
     /**

+ 26 - 15
yami-shop-api/src/main/java/com/yami/shop/api/controller/RefundAddrApiController.java

@@ -7,8 +7,9 @@ import com.yami.shop.bean.model.RefundAddr;
 import com.yami.shop.common.annotation.SysLog;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
-import com.yami.shop.security.api.util.SecurityUtils;
 import com.yami.shop.service.RefundAddrService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
@@ -19,6 +20,7 @@ import java.util.List;
 
 @RestController
 @AllArgsConstructor
+@Api(tags = "商家退货地址管理")
 @RequestMapping("/p/refundAddr")
 public class RefundAddrApiController {
 
@@ -32,22 +34,27 @@ public class RefundAddrApiController {
      * @return 分页数据
      */
     @GetMapping("/page")
-    public ResponseEntity<IPage<RefundAddr>> getRefundAddrPage(PageParam<RefundAddr> page, RefundAddr refundAddr) {
-        return ResponseEntity.ok(refundAddrService.page(page, new LambdaQueryWrapper<RefundAddr>()
+    @ApiOperation("分页查询")
+    public R<IPage<RefundAddr>> getRefundAddrPage(PageParam<RefundAddr> page, RefundAddr refundAddr) {
+        return R.SUCCESS(refundAddrService.page(page, new LambdaQueryWrapper<RefundAddr>()
                 .ne(RefundAddr::getStatus, -1)));
     }
 
 
     /**
-     * 通过id查询
+     * 通过店铺id查询收货地址
      *
-     * @param refundAddrId id
+     * @param shop id
      * @return 单个数据
      */
-    @GetMapping("/info/{refundAddrId}")
-    public ResponseEntity<RefundAddr> getById(@PathVariable("refundAddrId") Long refundAddrId) {
-        RefundAddr refundAddr = refundAddrService.getById(refundAddrId);
-        return ResponseEntity.ok(refundAddr);
+    @GetMapping("/info/{shop}")
+    @ApiOperation("通过店铺id查询收货地址")
+    public R<RefundAddr> getById(@PathVariable("shop") Long shop) {
+        RefundAddr refundAddr = refundAddrService.getOne(new LambdaQueryWrapper<RefundAddr>()
+        .eq(RefundAddr::getShopId, shop)
+        .eq(RefundAddr::getDefaultAddr, 1)
+        .eq(RefundAddr::getStatus, 1));
+        return R.SUCCESS(refundAddr);
     }
 
     /**
@@ -57,6 +64,7 @@ public class RefundAddrApiController {
      * @return 是否新增成功
      */
     @SysLog("新增")
+    @ApiOperation("新增")
     @PostMapping
     public R<String> save(@RequestBody @Valid RefundAddr refundAddr) {
         Date now = new Date();
@@ -73,11 +81,12 @@ public class RefundAddrApiController {
      * @return 是否修改成功
      */
     @SysLog("修改")
+    @ApiOperation("修改")
     @PutMapping
-    public ResponseEntity<String> updateById(@RequestBody @Valid RefundAddr refundAddr) {
+    public R<String> updateById(@RequestBody @Valid RefundAddr refundAddr) {
         refundAddr.setUpdateTime(new Date());
         refundAddrService.updateById( refundAddr);
-        return ResponseEntity.ok().body("修改成功");
+        return R.SUCCESS("修改成功");
     }
 
     /**
@@ -87,20 +96,22 @@ public class RefundAddrApiController {
      * @return 是否删除成功
      */
     @SysLog("删除")
+    @ApiOperation("通过id删除")
     @DeleteMapping("/{refundAddrId}")
-    public ResponseEntity<Boolean> removeById(@PathVariable Long refundAddrId) {
-        return ResponseEntity.ok(refundAddrService.removeById(refundAddrId));
+    public R<Boolean> removeById(@PathVariable Long refundAddrId) {
+        return R.SUCCESS(refundAddrService.removeById(refundAddrId));
     }
 
     /**
      * 获取店铺的所有收获地址
      */
     @GetMapping("/list")
-    public ResponseEntity<List<RefundAddr>> list() {
+    @ApiOperation("获取店铺的所有收获地址")
+    public R<List<RefundAddr>> list() {
         List<RefundAddr> list = refundAddrService.list(new LambdaQueryWrapper<RefundAddr>()
                 .eq(RefundAddr::getStatus, 1)
                 .orderByDesc(RefundAddr::getUpdateTime));
-        return ResponseEntity.ok(list);
+        return R.SUCCESS(list);
     }
 
 }

+ 31 - 30
yami-shop-api/src/main/java/com/yami/shop/api/controller/RefundDeliveryController.java

@@ -3,15 +3,14 @@ package com.yami.shop.api.controller;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.yami.shop.bean.model.OrderRefund;
-import com.yami.shop.bean.model.OrderRefundRecord;
-import com.yami.shop.bean.model.RefundDelivery;
-import com.yami.shop.bean.model.ShopDetail;
+import com.yami.shop.bean.model.*;
 import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.common.util.PageParam;
+import com.yami.shop.common.util.R;
 import com.yami.shop.dao.OrderRefundRecordMapper;
 import com.yami.shop.dao.ShopDetailMapper;
 import com.yami.shop.service.OrderRefundService;
+import com.yami.shop.service.RefundAddrService;
 import com.yami.shop.service.RefundDeliveryService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -33,6 +32,7 @@ import java.util.Date;
 public class RefundDeliveryController {
 
     private final RefundDeliveryService refundDeliveryService;
+    private final RefundAddrService refundAddrService;
     private final OrderRefundService orderRefundService;
     private final OrderRefundRecordMapper orderRefundRecordMapper;
     private final ShopDetailMapper shopDetailMapper;
@@ -42,9 +42,9 @@ public class RefundDeliveryController {
      */
     @GetMapping("/page")
     @ApiOperation("分页获取退货物流信息列表")
-    public ResponseEntity<IPage<RefundDelivery>> page(PageParam<RefundDelivery> pageParam, RefundDelivery refundDelivery) {
+    public R<IPage<RefundDelivery>> page(PageParam<RefundDelivery> pageParam, RefundDelivery refundDelivery) {
         IPage<RefundDelivery> refundDeliveryPage = refundDeliveryService.page(pageParam, new LambdaQueryWrapper<RefundDelivery>());
-        return ResponseEntity.ok(refundDeliveryPage);
+        return R.SUCCESS(refundDeliveryPage);
     }
 
     /**
@@ -52,12 +52,12 @@ public class RefundDeliveryController {
      */
     @GetMapping("/getByRefundSn/{refundSn}")
     @ApiOperation("根据退款编号获取退货物流信息")
-    public ResponseEntity<RefundDelivery> getByRefundSn(@PathVariable("refundSn") String refundSn) {
+    public R<RefundDelivery> getByRefundSn(@PathVariable("refundSn") String refundSn) {
         RefundDelivery refundDelivery = refundDeliveryService.getOne(new LambdaQueryWrapper<RefundDelivery>().eq(RefundDelivery::getRefundSn, refundSn));
         if (ObjectUtil.isEmpty(refundDelivery)){
-            return ResponseEntity.ok(new RefundDelivery());
+            return R.SUCCESS(new RefundDelivery());
         }
-        return ResponseEntity.ok(refundDelivery);
+        return R.SUCCESS(refundDelivery);
     }
 
     /**
@@ -65,9 +65,9 @@ public class RefundDeliveryController {
      */
     @GetMapping("/getById/{id}")
     @ApiOperation("根据ID获取退货物流信息")
-    public ResponseEntity<RefundDelivery> getById(@PathVariable Long id) {
+    public R<RefundDelivery> getById(@PathVariable Long id) {
         RefundDelivery refundDelivery = refundDeliveryService.getById(id);
-        return ResponseEntity.ok(refundDelivery);
+        return R.SUCCESS(refundDelivery);
     }
 
     /**
@@ -76,21 +76,22 @@ public class RefundDeliveryController {
     @PostMapping("/save")
     @ApiOperation("保存退货物流信息")
     @Transactional(rollbackFor = Exception.class)
-    public ResponseEntity<?> save(@Valid @RequestBody RefundDelivery refundDelivery) {
+    public R<?> save(@Valid @RequestBody RefundDelivery refundDelivery) {
 
 
         //获取门店信息
-        ShopDetail shopDetail = shopDetailMapper.selectById(refundDelivery.getShopId());
-        if (ObjectUtil.isEmpty(shopDetail)){
-            throw new GlobalException("门店信息不存在");
+        RefundAddr refundAddr = refundAddrService.getOne(new LambdaQueryWrapper<RefundAddr>()
+        .eq(RefundAddr::getShopId, refundDelivery.getShopId())
+        .eq(RefundAddr::getDefaultAddr, 1)
+        .eq(RefundAddr::getStatus, 1));
+        if (ObjectUtil.isNotEmpty(refundAddr)) {
+            //门店信息获取地址
+            String shopAddress = refundAddr.getProvince() + refundAddr.getCity() + refundAddr.getArea() + refundAddr.getAddr();
+            refundDelivery.setReceiverAddr(shopAddress);
+            refundDelivery.setReceiverName(refundAddr.getReceiverName());
+            refundDelivery.setReceiverMobile(refundAddr.getReceiverMobile());
+            refundDeliveryService.save(refundDelivery);
         }
-        //门店信息获取地址
-        String shopAddress = shopDetail.getProvince() + shopDetail.getCity() + shopDetail.getArea() + shopDetail.getShopAddress();
-        refundDelivery.setReceiverAddr(shopAddress);
-        refundDelivery.setReceiverName(shopDetail.getTel());
-        refundDelivery.setReceiverMobile(shopDetail.getShopOwner());
-        refundDelivery.setReceiverTelephone(shopDetail.getMobile());
-        refundDeliveryService.save(refundDelivery);
         //添加填写物流信息轨迹
         OrderRefund orderRefund = orderRefundService.getOne(new LambdaQueryWrapper<OrderRefund>().eq(OrderRefund::getRefundSn, refundDelivery.getRefundSn()));
 
@@ -99,7 +100,7 @@ public class RefundDeliveryController {
         }
 
         orderRefund.setIsReturnLogistics(true);
-        orderRefundService.updateById( orderRefund);
+        orderRefundService.updateById(orderRefund);
 
         OrderRefundRecord orderRefundRecord = new OrderRefundRecord();
         orderRefundRecord.setOrderRefundId(orderRefund.getRefundId());
@@ -110,7 +111,7 @@ public class RefundDeliveryController {
         orderRefundRecord.setAuditStatus(7);
         orderRefundRecord.setSort(5);
         orderRefundRecordMapper.insert(orderRefundRecord);
-        return ResponseEntity.ok().build();
+        return R.SUCCESS("添加成功");
     }
 
     /**
@@ -118,14 +119,14 @@ public class RefundDeliveryController {
      */
     @PutMapping("/update")
     @ApiOperation("更新退货物流信息")
-    public ResponseEntity<String> update(@Valid @RequestBody RefundDelivery refundDelivery) {
+    public R<String> update(@Valid @RequestBody RefundDelivery refundDelivery) {
         RefundDelivery dbRefundDelivery = refundDeliveryService.getById(refundDelivery.getRefundDeliveryId());
         if (dbRefundDelivery == null) {
-            return ResponseEntity.badRequest().body("退货物流信息不存在");
+            return R.FAIL("退货物流信息不存在");
         }
 
         refundDeliveryService.updateById(refundDelivery);
-        return ResponseEntity.ok("更新成功");
+        return R.SUCCESS("更新成功");
     }
 
 
@@ -134,13 +135,13 @@ public class RefundDeliveryController {
      */
     @DeleteMapping("/delete/{id}")
     @ApiOperation("删除退货物流信息")
-    public ResponseEntity<String> delete(@PathVariable Long id) {
+    public R<String> delete(@PathVariable Long id) {
         RefundDelivery refundDelivery = refundDeliveryService.getById(id);
         if (refundDelivery == null) {
-            return ResponseEntity.badRequest().body("退货物流信息不存在");
+            return R.FAIL("退货物流信息不存在");
         }
 
         refundDeliveryService.removeById(id);
-        return ResponseEntity.ok("删除成功");
+        return R.SUCCESS("删除成功");
     }
 }

+ 6 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/app/dto/ApiOrderRefundDto.java

@@ -109,6 +109,12 @@ public class ApiOrderRefundDto {
     @ApiModelProperty("true:可以取消退款  false:不可以取消退款")
     private Boolean isCancel;
 
+    /**
+     * 是否填写了退货物流信息(1:已填写,0:未填写)
+     */
+    private Boolean isReturnLogistics;
+
+
     @ApiModelProperty("卖家备注")
     private String sellerMsg;
 

+ 3 - 3
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/hb/StoreManagementController.java

@@ -30,10 +30,10 @@ public class StoreManagementController {
     private final IStoreManagementService storeManagementService;
 
     /**
-     * 海博修改门店信息-回调
+     * 海博新增门店信息-回调
      *
-     * @param HBRequest 门店变更请求参数
-     * @return 门店变更响应
+     * @param HBRequest 门店新增请求参数
+     * @return 门店新增响应
      */
     @PostMapping("/add")
     public HBR addRegisterStore(@RequestBody JSONObject HBRequest) {

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

@@ -49,6 +49,7 @@ public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter
                 .antMatchers(
                         "/p/delivery/getDeliveryList",
                         "/p/order/orderNumber",
+                        "/p/refundAddr/**",
                         "/p/orderRefund/**"
                         ).permitAll()
                 .and()

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

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yami.shop.bean.dto.hb.HBBaseReq;
 import com.yami.shop.bean.dto.hb.HBStoreBaseInfoReq;
 import com.yami.shop.bean.dto.hb.StoreRegister;
+import com.yami.shop.bean.model.RefundAddr;
 import com.yami.shop.bean.model.ShopDetail;
 import com.yami.shop.bean.model.Transport2;
 import com.yami.shop.common.util.PageParam;
@@ -15,6 +16,7 @@ import com.yami.shop.common.util.R;
 import com.yami.shop.common.util.hb.HBR;
 import com.yami.shop.dao.HBTransport2Mapper;
 import com.yami.shop.dao.ShopDetailMapper;
+import com.yami.shop.service.RefundAddrService;
 import com.yami.shop.service.hb.IStoreManagementService;
 import com.yami.shop.utils.HBSignUtil;
 import lombok.AllArgsConstructor;
@@ -44,6 +46,7 @@ public class StoreManagementService implements IStoreManagementService {
     private final ShopDetailMapper shopDetailMapper;
     private final HBSignUtil hbSignUtil;
     private final HBTransport2Mapper transport2Mapper;
+    private final RefundAddrService refundAddrService;
 
 
     /**
@@ -187,6 +190,32 @@ public class StoreManagementService implements IStoreManagementService {
                 transport2.setShopId(shopDetailInfo.getShopId());
                 transport2Mapper.insert(transport2);
             }
+
+
+            //添加商家退货地址
+            int count = refundAddrService.count(new LambdaQueryWrapper<RefundAddr>()
+                    .eq(RefundAddr::getShopId, shopDetailInfo.getShopId())
+                    .eq(RefundAddr::getStatus, 1));
+            if (count>0){
+                log.info("门店存在退货地址无需添加!");
+            }else {
+                log.info("门店不存在退货地址,添加默认地址!");
+                RefundAddr refundAddr = new RefundAddr();
+                refundAddr.setShopId(shopDetailInfo.getShopId());
+                refundAddr.setReceiverName(shopDetail.getShopOwner());
+                refundAddr.setReceiverMobile(shopDetail.getTel());
+                refundAddr.setProvince(shopDetail.getProvince());
+                refundAddr.setCity(shopDetail.getCity());
+                refundAddr.setArea(shopDetail.getArea());
+                refundAddr.setAddr(shopDetail.getShopAddress());
+                refundAddr.setDefaultAddr(1);
+                refundAddr.setStatus(1);
+                refundAddr.setCreateTime(new Date());
+                refundAddr.setUpdateTime(new Date());
+                refundAddrService.save(refundAddr);
+            }
+
+
             return HBR.success();
         } catch (Exception e) {
             log.error("门店变更失败:{}", e.getMessage(), e);

+ 4 - 1
yami-shop-service/src/main/java/com/yami/shop/service/impl/OrderServiceImpl.java

@@ -1153,13 +1153,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             orderRefund.setOffsetPoints(refundScore);
             orderRefund.setHandler(Boolean.TRUE);
             orderRefund.setRefundExpiredScore(refundExpiredScore);
+            log.info("退款单修改状态和积分{}",orderRefund);
             orderRefundMapper.updateById(orderRefund);
 
             //生成待商家审核记录
             OrderRefundRecord orderRefundRecord = new OrderRefundRecord();
             orderRefundRecord.setOrderRefundId(orderRefund.getRefundId());
             orderRefundRecord.setInstructions("已完成退款,具体到账时间请查询支付账户");
-            orderRefundRecord.setUpdateTime(new Date());
+            Date date = new Date();
+            orderRefundRecord.setCreateTime(date);
+            orderRefundRecord.setUpdateTime(date);
             orderRefundRecord.setAuditStatus(5);
             orderRefundRecord.setSort(4);
             orderRefundRecordMapper.insert(orderRefundRecord);

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

@@ -111,6 +111,7 @@
         <result column="refund_amount" property="refundAmount"/>
         <result column="apply_type" property="applyType"/>
         <result column="is_receiver" property="isReceiver"/>
+        <result column="is_return_logistics" property="isReturnLogistics"/>
         <result column="buyer_desc" property="buyerDesc"/>
         <result column="platform_refund_amount" property="platformRefundAmount"/>
         <result column="buyer_reason" property="buyerReason"/>