Sfoglia il codice sorgente

直播代码 售后代码

yuhongqi 3 settimane fa
parent
commit
9722bf4be5
27 ha cambiato i file con 803 aggiunte e 27 eliminazioni
  1. 13 0
      fs-live-app/src/main/java/com/fs/app/controller/CommonController.java
  2. 105 0
      fs-live-app/src/main/java/com/fs/app/controller/LiveAfterSalesController.java
  3. 3 0
      fs-live-app/src/main/java/com/fs/app/controller/LiveCartController.java
  4. 8 1
      fs-live-app/src/main/java/com/fs/app/controller/LiveController.java
  5. 3 0
      fs-live-app/src/main/java/com/fs/app/controller/LiveDataController.java
  6. 14 0
      fs-live-app/src/main/java/com/fs/app/controller/LiveOrderController.java
  7. 1 1
      fs-service/src/main/java/com/fs/live/domain/LiveAfterSales.java
  8. 18 0
      fs-service/src/main/java/com/fs/live/dto/LiveAfterSalesProductDTO.java
  9. 30 0
      fs-service/src/main/java/com/fs/live/dto/LiveOrderItemDTO.java
  10. 27 7
      fs-service/src/main/java/com/fs/live/mapper/LiveAfterSalesMapper.java
  11. 3 0
      fs-service/src/main/java/com/fs/live/mapper/LiveGoodsMapper.java
  12. 4 0
      fs-service/src/main/java/com/fs/live/mapper/LiveOrderItemMapper.java
  13. 4 0
      fs-service/src/main/java/com/fs/live/mapper/LiveOrderPaymentMapper.java
  14. 48 0
      fs-service/src/main/java/com/fs/live/param/LiveAfterSalesApplyParam.java
  15. 16 0
      fs-service/src/main/java/com/fs/live/param/LiveAfterSalesDeliveryParam.java
  16. 13 0
      fs-service/src/main/java/com/fs/live/param/LiveAfterSalesListUParam.java
  17. 17 0
      fs-service/src/main/java/com/fs/live/param/LiveAfterSalesRevokeParam.java
  18. 21 7
      fs-service/src/main/java/com/fs/live/service/ILiveAfterSalesService.java
  19. 2 0
      fs-service/src/main/java/com/fs/live/service/ILiveGoodsService.java
  20. 3 0
      fs-service/src/main/java/com/fs/live/service/ILiveOrderItemService.java
  21. 3 1
      fs-service/src/main/java/com/fs/live/service/ILiveOrderService.java
  22. 298 8
      fs-service/src/main/java/com/fs/live/service/impl/LiveAfterSalesServiceImpl.java
  23. 5 0
      fs-service/src/main/java/com/fs/live/service/impl/LiveGoodsServiceImpl.java
  24. 6 0
      fs-service/src/main/java/com/fs/live/service/impl/LiveOrderItemServiceImpl.java
  25. 37 2
      fs-service/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java
  26. 82 0
      fs-service/src/main/java/com/fs/live/vo/LiveAfterSalesListUVO.java
  27. 19 0
      fs-service/src/main/java/com/fs/live/vo/LiveOrderItemListUVO.java

+ 13 - 0
fs-live-app/src/main/java/com/fs/app/controller/CommonController.java

@@ -10,6 +10,8 @@ import com.fs.common.core.domain.R;
 import com.fs.company.service.ICompanyWxChatService;
 import com.fs.his.domain.FsCity;
 import com.fs.his.service.IFsCityService;
+import com.fs.system.service.ISysDictDataService;
+import com.fs.system.vo.DictVO;
 import com.fs.wxUser.domain.CompanyWxUser;
 import com.fs.wxUser.service.ICompanyWxUserService;
 import com.google.common.collect.Lists;
@@ -41,6 +43,9 @@ public class CommonController {
     @Autowired
     private IFsCityService cityService;
 
+    @Autowired
+    private ISysDictDataService dictDataService;
+
     @GetMapping("/testSend")
     public R testSend(Long userId, String msg) throws Exception{
         return R.ok();
@@ -68,5 +73,13 @@ public class CommonController {
 
     }
 
+    @ApiOperation("获取数据字典")
+    @GetMapping("/getDictByKey")
+    @Cacheable(value="dicts", key="#key")
+    public R getDictByKey(@RequestParam(value = "key", required = false) String key){
+        List<DictVO> dicts=dictDataService.selectDictDataListByType(key);
+        return R.ok().put("data",dicts);
+    }
+
 
 }

+ 105 - 0
fs-live-app/src/main/java/com/fs/app/controller/LiveAfterSalesController.java

@@ -0,0 +1,105 @@
+package com.fs.app.controller;
+
+
+import com.fs.app.annotation.Login;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ParseUtils;
+import com.fs.live.domain.LiveAfterSales;
+import com.fs.live.domain.LiveAfterSalesItem;
+import com.fs.live.domain.LiveOrder;
+import com.fs.live.param.LiveAfterSalesApplyParam;
+import com.fs.live.param.LiveAfterSalesDeliveryParam;
+import com.fs.live.param.LiveAfterSalesListUParam;
+import com.fs.live.param.LiveAfterSalesRevokeParam;
+import com.fs.live.service.ILiveAfterSalesItemService;
+import com.fs.live.service.ILiveAfterSalesService;
+import com.fs.live.service.ILiveOrderItemService;
+import com.fs.live.service.ILiveOrderService;
+import com.fs.live.vo.LiveAfterSalesListUVO;
+import com.fs.live.vo.LiveOrderItemListUVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
+import java.util.List;
+
+
+@Api("售后接口")
+@RestController
+@RequestMapping(value="/app/live/storeAfterSales")
+public class LiveAfterSalesController extends  AppBaseController {
+
+    @Autowired
+    private ILiveAfterSalesService storeAfterSalesService;
+
+    @Autowired
+    private ILiveAfterSalesItemService salesItemService;
+    @Autowired
+    private ILiveOrderItemService itemService;
+    @Autowired
+    private ILiveOrderService orderService;
+    @Login
+    @ApiOperation("获取订单项列表")
+    @GetMapping("/getStoreOrderItems")
+    public R getStoreOrderItems(@RequestParam("orderId") Long orderId, HttpServletRequest request){
+        List<LiveOrderItemListUVO> list=itemService.selectLiveOrderItemListUVOByOrderId(orderId);
+        LiveOrder order=orderService.selectLiveOrderByOrderId(String.valueOf(orderId));
+        order.setUserPhone(ParseUtils.parsePhone(order.getUserPhone()));
+        order.setUserAddress(ParseUtils.parseIdCard(order.getUserAddress()));
+        return R.ok().put("order", order).put("items",list);
+    }
+
+
+    @Login
+    @PostMapping("/applyAfterSales")
+    @ApiOperation(value = "申请售后", notes = "申请售后")
+    @RepeatSubmit
+    public R applyAfterSales(@RequestBody LiveAfterSalesApplyParam param) {
+        return storeAfterSalesService.applyAfterSales(getUserId(), param);
+    }
+    @Login
+    @PostMapping("/revoke")
+    @ApiOperation(value = "撤销售后", notes = "撤销售后")
+    @RepeatSubmit
+    public R revoke(@RequestBody LiveAfterSalesRevokeParam param) throws ParseException {
+        return storeAfterSalesService.revoke(getUserId(), param);
+    }
+    @Login
+    @PostMapping("/addDelivery")
+    @ApiOperation(value = "提交物流信息", notes = "提交物流信息")
+    public R addDelivery(@Validated @RequestBody LiveAfterSalesDeliveryParam param) {
+        param.setUserId(Long.parseLong(getUserId()));
+        return storeAfterSalesService.addDelivery(param);
+    }
+
+
+    @Login
+    @GetMapping("/getStoreAfterSalesList")
+    @ApiOperation(value = "获取售后列表", notes = "获取售后列表")
+    public R getStoreAfterSalesList(LiveAfterSalesListUParam param) {
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        param.setUserId(Long.parseLong(getUserId()));
+        List<LiveAfterSalesListUVO> list=storeAfterSalesService.selectLiveAfterSalesListUVO(param);
+        PageInfo<LiveAfterSalesListUVO> listPageInfo=new PageInfo<>(list);
+        return R.ok().put("data",listPageInfo);
+    }
+    @Login
+    @GetMapping("/getStoreAfterSalesById")
+    @ApiOperation(value = "获取售后详情", notes = "获取售后详情")
+    public R getStoreAfterSalesById(@RequestParam("id") Long id) {
+        LiveAfterSales sales=storeAfterSalesService.selectLiveAfterSalesById(id);
+        LiveAfterSalesItem map=new LiveAfterSalesItem();
+        map.setAfterSalesId(id);
+        List<LiveAfterSalesItem>  items=salesItemService.selectLiveAfterSalesItemList(map);
+        LiveOrder order=orderService.selectLiveOrderByOrderId(String.valueOf(sales.getOrderId()));
+        return R.ok().put("sales",sales).put("items", items).put("order",order);
+    }
+
+}

+ 3 - 0
fs-live-app/src/main/java/com/fs/app/controller/LiveCartController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.fs.app.annotation.Login;
 import com.fs.common.annotation.Excel;
 import com.fs.common.annotation.Log;
+import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
@@ -88,6 +89,7 @@ public class LiveCartController extends AppBaseController
     @PostMapping
     @ApiOperation("新增购物车")
     @Login
+    @RepeatSubmit
     public AjaxResult add(@RequestBody @ApiParam("购物车信息") LiveCart liveCart)
     {
         liveCart.setUserId(String.valueOf(getUserId()));
@@ -101,6 +103,7 @@ public class LiveCartController extends AppBaseController
     @PostMapping("/update")
     @ApiOperation("修改购物车")
     @Login
+    @RepeatSubmit
     public AjaxResult edit(@RequestBody @ApiParam("购物车信息") LiveCart liveCart)
     {
         liveCart.setUserId(String.valueOf(getUserId()));

+ 8 - 1
fs-live-app/src/main/java/com/fs/app/controller/LiveController.java

@@ -10,12 +10,14 @@ import com.fs.app.vo.LiveInfoVo;
 import com.fs.app.vo.LiveVo;
 import com.fs.app.websocket.bean.SendMsgVo;
 import com.fs.app.websocket.service.WebSocketServer;
+import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.domain.BaseEntity;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.utils.bean.BeanUtils;
 import com.fs.live.domain.Live;
 import com.fs.live.domain.LiveMsg;
+import com.fs.live.service.ILiveGoodsService;
 import com.fs.live.service.ILiveMsgService;
 import com.fs.live.service.ILiveService;
 import io.swagger.annotations.Api;
@@ -52,6 +54,9 @@ public class LiveController extends AppBaseController {
 	@Autowired
 	private WebSocketServer webSocketServer;
 
+	@Autowired
+	private ILiveGoodsService liveGoodsService;
+
 	@ApiOperation("直播封面信息")
 	@GetMapping("/liveInfo")
 	@ApiResponse(code = 200, message = "", response = LiveInfoVo.class)
@@ -75,6 +80,7 @@ public class LiveController extends AppBaseController {
 		Live live = liveService.selectLiveByLiveId(id);
 		if(live == null) return R.error("未找到直播");
 		if(live.getIsShow() == 2) return R.error("直播未开放");
+		Long storeId = liveGoodsService.getStoreIdByLiveId(live.getLiveId());
 		LiveVo liveVo = new LiveVo();
 		BeanUtils.copyProperties(live, liveVo);
 		liveVo.setNowDuration(200L);
@@ -85,7 +91,7 @@ public class LiveController extends AppBaseController {
 //		if(liveVo.getNowDuration() != null){
 //			liveVo.setNowPri(BigDecimal.valueOf(liveVo.getDuration()).divide(BigDecimal.valueOf(liveVo.getNowDuration()), 20, RoundingMode.UP));
 //		}
-		return R.ok().put("data", liveVo);
+		return R.ok().put("data", liveVo).put("storeId", storeId);
 	}
 
 	@Login
@@ -108,6 +114,7 @@ public class LiveController extends AppBaseController {
 	}
 
 	@PostMapping("/create")
+	@RepeatSubmit
 	public R createRoom(@RequestBody Map<String, Object> payload) {
 		if (!payload.containsKey("liveId")) {
 			return R.error("直播间id缺失");

+ 3 - 0
fs-live-app/src/main/java/com/fs/app/controller/LiveDataController.java

@@ -1,6 +1,7 @@
 package com.fs.app.controller;
 
 import com.fs.app.annotation.Login;
+import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.domain.R;
 import com.fs.live.domain.LiveData;
 import com.fs.live.service.ILiveDataService;
@@ -72,6 +73,7 @@ public class LiveDataController extends AppBaseController{
      * */
     @Login
     @PostMapping("/collectStore")
+    @RepeatSubmit
     public R collectStore(@RequestParam Long storeId) {
         return R.ok(liveDataService.collectStore(Long.parseLong(getUserId()), storeId));
     }
@@ -81,6 +83,7 @@ public class LiveDataController extends AppBaseController{
      * */
     @Login
     @PostMapping("/collectGoods")
+    @RepeatSubmit
     public R collectProduct(@RequestParam Long goodId) {
         return R.ok(liveDataService.collectProduct(Long.parseLong(getUserId()), goodId));
     }

+ 14 - 0
fs-live-app/src/main/java/com/fs/app/controller/LiveOrderController.java

@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
 import com.fs.app.annotation.Login;
 import com.fs.app.utils.JwtUtils;
 import com.fs.common.annotation.Log;
+import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
@@ -101,6 +102,7 @@ public class LiveOrderController extends AppBaseController
     @PostMapping("/buy")
     @ApiOperation("购物车购买")
     @Login
+    @RepeatSubmit
     public R buy(@RequestBody LiveOrder liveOrder)
     {
         liveOrder.setUserId(getUserId());
@@ -113,6 +115,7 @@ public class LiveOrderController extends AppBaseController
     @Login
     @Log(title = "订单", businessType = BusinessType.INSERT)
     @PostMapping("/create")
+    @RepeatSubmit
     public R add(@RequestBody LiveOrder liveOrder)
     {
         liveOrder.setUserId(getUserId());
@@ -125,6 +128,7 @@ public class LiveOrderController extends AppBaseController
     @Login
     @Log(title = "订单", businessType = BusinessType.UPDATE)
     @PutMapping("/update")
+    @RepeatSubmit
     public R edit(@RequestBody LiveOrder liveOrder)
     {
         return R.ok().put("orderId",liveOrder.getOrderId());
@@ -181,6 +185,7 @@ public class LiveOrderController extends AppBaseController
     @Login
     @ApiOperation("支付宝支付")
     @PostMapping("/aliPayment")
+    @RepeatSubmit
     public R aliPayment(@Validated @RequestBody FsUserLiveOrderPayUParam param)
     {
         param.setUserId(Long.parseLong(getUserId()));
@@ -190,6 +195,7 @@ public class LiveOrderController extends AppBaseController
     @Login
     @ApiOperation("微信支付")
     @PostMapping("/weChatPayment")
+    @RepeatSubmit
     public R payment(@Validated @RequestBody FsUserLiveOrderPayUParam param)
     {
         param.setUserId(Long.parseLong(getUserId()));
@@ -201,6 +207,7 @@ public class LiveOrderController extends AppBaseController
      * */
     @Login
     @GetMapping(value = "/updateConfirm/{orderId}/{type}")
+    @RepeatSubmit
     public R cancelConfirm(@PathVariable String orderId,@PathVariable String type)
     {
         LiveOrder byId = liveOrderService.getById(orderId);
@@ -231,6 +238,13 @@ public class LiveOrderController extends AppBaseController
 
     }
 
+    @Login
+    @ApiOperation("完成订单")
+    @PostMapping("/finishOrder")
+    public R finishOrder(@Validated @RequestBody LiveOrderCancelParam param, HttpServletRequest request){
+        return liveOrderService.finishOrder(param.getOrderId());
+    }
+
 
 
 }

+ 1 - 1
fs-service/src/main/java/com/fs/live/domain/LiveAfterSales.java

@@ -79,7 +79,7 @@ public class LiveAfterSales{
 
     /** 逻辑删除 */
     @Excel(name = "逻辑删除")
-    private String isDel;
+    private Integer isDel;
 
     /** 用户id */
     @Excel(name = "用户id")

+ 18 - 0
fs-service/src/main/java/com/fs/live/dto/LiveAfterSalesProductDTO.java

@@ -0,0 +1,18 @@
+package com.fs.live.dto;
+
+import lombok.*;
+
+import java.io.Serializable;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+
+@Data
+public class LiveAfterSalesProductDTO implements Serializable {
+    private Long productId;
+    private Integer num;
+
+}

+ 30 - 0
fs-service/src/main/java/com/fs/live/dto/LiveOrderItemDTO.java

@@ -0,0 +1,30 @@
+package com.fs.live.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class LiveOrderItemDTO implements Serializable {
+    /** 商品ID */
+    private Long productId;
+
+    private String sku;
+
+    private String barCode;
+
+    String productName;
+
+    String image;
+
+    BigDecimal price;
+
+    Long num;
+
+    private BigDecimal brokerage;
+
+    private BigDecimal brokerageTwo;
+
+    private BigDecimal brokerageThree;
+}

+ 27 - 7
fs-service/src/main/java/com/fs/live/mapper/LiveAfterSalesMapper.java

@@ -3,17 +3,21 @@ package com.fs.live.mapper;
 import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.live.domain.LiveAfterSales;
+import com.fs.live.param.LiveAfterSalesListUParam;
+import com.fs.live.vo.LiveAfterSalesListUVO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 /**
  * 售后记录Mapper接口
- * 
+ *
  * @author fs
  * @date 2025-07-08
  */
 public interface LiveAfterSalesMapper extends BaseMapper<LiveAfterSales>{
     /**
      * 查询售后记录
-     * 
+     *
      * @param id 售后记录主键
      * @return 售后记录
      */
@@ -21,7 +25,7 @@ public interface LiveAfterSalesMapper extends BaseMapper<LiveAfterSales>{
 
     /**
      * 查询售后记录列表
-     * 
+     *
      * @param liveAfterSales 售后记录
      * @return 售后记录集合
      */
@@ -29,7 +33,7 @@ public interface LiveAfterSalesMapper extends BaseMapper<LiveAfterSales>{
 
     /**
      * 新增售后记录
-     * 
+     *
      * @param liveAfterSales 售后记录
      * @return 结果
      */
@@ -37,7 +41,7 @@ public interface LiveAfterSalesMapper extends BaseMapper<LiveAfterSales>{
 
     /**
      * 修改售后记录
-     * 
+     *
      * @param liveAfterSales 售后记录
      * @return 结果
      */
@@ -45,7 +49,7 @@ public interface LiveAfterSalesMapper extends BaseMapper<LiveAfterSales>{
 
     /**
      * 删除售后记录
-     * 
+     *
      * @param id 售后记录主键
      * @return 结果
      */
@@ -53,9 +57,25 @@ public interface LiveAfterSalesMapper extends BaseMapper<LiveAfterSales>{
 
     /**
      * 批量删除售后记录
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     int deleteLiveAfterSalesByIds(Long[] ids);
+
+    @Select({"<script> " +
+            "select s.*,o.order_code  from live_after_sales s left join live_order o on o.order_id=s.order_id  " +
+            "where s.is_del=0 " +
+            "<if test = 'maps.status != null and maps.status ==1   '> " +
+            "and s.sales_status = 0 " +
+            "</if>" +
+            "<if test = 'maps.status != null and maps.status ==2   '> " +
+            "and s.sales_status = 3 " +
+            "</if>" +
+            "<if test = 'maps.userId != null'> " +
+            "and s.user_id = #{maps.userId} " +
+            "</if>" +
+            "order by s.create_time desc "+
+            "</script>"})
+    List<LiveAfterSalesListUVO> selectLiveAfterSalesListUVO(@Param("maps") LiveAfterSalesListUParam param);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveGoodsMapper.java

@@ -119,4 +119,7 @@ public interface LiveGoodsMapper extends BaseMapper<LiveGoods>{
      * 根据店铺ID查询商品列表
      */
     List<LiveGoodsVo> selectLiveGoodsListByStoreId(@Param("params") Map<String, Object> params);
+
+    @Select("select store_id from live_goods where live_id = #{liveId} limit 1")
+    Long getStoreIdByLiveId(Long liveId);
 }

+ 4 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveOrderItemMapper.java

@@ -3,6 +3,7 @@ package com.fs.live.mapper;
 import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.live.domain.LiveOrderItem;
+import com.fs.live.vo.LiveOrderItemListUVO;
 import com.fs.live.vo.LiveOrderItemVo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -71,4 +72,7 @@ public interface LiveOrderItemMapper extends BaseMapper<LiveOrderItem>{
 
 
     List<LiveOrderItemVo> selectCheckedByUserId(@Param("userId") String userId);
+
+    @Select("select product_id,json_info,num from live_order_item where order_id=#{orderId}")
+    List<LiveOrderItemListUVO> selectLiveOrderItemListUVOByOrderId(Long orderId);
 }

+ 4 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveOrderPaymentMapper.java

@@ -3,6 +3,7 @@ package com.fs.live.mapper;
 import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.live.domain.LiveOrderPayment;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 
@@ -63,4 +64,7 @@ public interface LiveOrderPaymentMapper extends BaseMapper<LiveOrderPayment>{
 
     @Select("select * from live_order_payment where pay_code=#{payCode}")
     LiveOrderPayment selectLiveOrderPaymentByPaymentCode(String payCode);
+
+    @Select("select * from live_order_payment where business_type=#{type} and  business_id=#{businessId} and status=1")
+    List<LiveOrderPayment> selectLiveOrderPaymentByPay(@Param("type")int type, @Param("businessId") Long businessId);
 }

+ 48 - 0
fs-service/src/main/java/com/fs/live/param/LiveAfterSalesApplyParam.java

@@ -0,0 +1,48 @@
+package com.fs.live.param;
+
+import com.fs.live.dto.LiveAfterSalesProductDTO;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class LiveAfterSalesApplyParam {
+    /**
+     * 订单号
+     */
+    @NotNull
+    private Long orderId;
+
+    /**
+     * 服务类型 0仅退款1退货退款
+     */
+    @NotBlank
+    private Integer refundType;
+
+    /**
+     * 申请原因
+     */
+    @NotBlank
+    private String reasons;
+
+    /**
+     * 申请说明
+     */
+    private String explains;
+
+    /**
+     * 申请说明图片
+     */
+    private String explainImg;
+
+    private BigDecimal refundAmount;
+
+
+    @NotBlank
+    private List<LiveAfterSalesProductDTO> productList;
+
+
+}

+ 16 - 0
fs-service/src/main/java/com/fs/live/param/LiveAfterSalesDeliveryParam.java

@@ -0,0 +1,16 @@
+package com.fs.live.param;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+public class LiveAfterSalesDeliveryParam {
+    private Long userId;
+    private Long id;
+    @NotBlank(message = "物流单号不能为空")
+    private String deliverySn;
+    @NotBlank(message = "物流公司不能为空")
+    private String deliveryName;
+
+}

+ 13 - 0
fs-service/src/main/java/com/fs/live/param/LiveAfterSalesListUParam.java

@@ -0,0 +1,13 @@
+package com.fs.live.param;
+
+import com.fs.his.param.BaseParam;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class LiveAfterSalesListUParam extends BaseParam implements Serializable {
+    private Integer status;
+    private Long userId;
+
+}

+ 17 - 0
fs-service/src/main/java/com/fs/live/param/LiveAfterSalesRevokeParam.java

@@ -0,0 +1,17 @@
+package com.fs.live.param;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+public class LiveAfterSalesRevokeParam {
+    /**
+     * 订单号
+     */
+    @NotNull
+    private Long id;
+
+
+
+}

+ 21 - 7
fs-service/src/main/java/com/fs/live/service/ILiveAfterSalesService.java

@@ -2,18 +2,24 @@ package com.fs.live.service;
 
 import java.util.List;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.common.core.domain.R;
 import com.fs.live.domain.LiveAfterSales;
+import com.fs.live.param.LiveAfterSalesApplyParam;
+import com.fs.live.param.LiveAfterSalesDeliveryParam;
+import com.fs.live.param.LiveAfterSalesListUParam;
+import com.fs.live.param.LiveAfterSalesRevokeParam;
+import com.fs.live.vo.LiveAfterSalesListUVO;
 
 /**
  * 售后记录Service接口
- * 
+ *
  * @author fs
  * @date 2025-07-08
  */
 public interface ILiveAfterSalesService extends IService<LiveAfterSales>{
     /**
      * 查询售后记录
-     * 
+     *
      * @param id 售后记录主键
      * @return 售后记录
      */
@@ -21,7 +27,7 @@ public interface ILiveAfterSalesService extends IService<LiveAfterSales>{
 
     /**
      * 查询售后记录列表
-     * 
+     *
      * @param liveAfterSales 售后记录
      * @return 售后记录集合
      */
@@ -29,7 +35,7 @@ public interface ILiveAfterSalesService extends IService<LiveAfterSales>{
 
     /**
      * 新增售后记录
-     * 
+     *
      * @param liveAfterSales 售后记录
      * @return 结果
      */
@@ -37,7 +43,7 @@ public interface ILiveAfterSalesService extends IService<LiveAfterSales>{
 
     /**
      * 修改售后记录
-     * 
+     *
      * @param liveAfterSales 售后记录
      * @return 结果
      */
@@ -45,7 +51,7 @@ public interface ILiveAfterSalesService extends IService<LiveAfterSales>{
 
     /**
      * 批量删除售后记录
-     * 
+     *
      * @param ids 需要删除的售后记录主键集合
      * @return 结果
      */
@@ -53,9 +59,17 @@ public interface ILiveAfterSalesService extends IService<LiveAfterSales>{
 
     /**
      * 删除售后记录信息
-     * 
+     *
      * @param id 售后记录主键
      * @return 结果
      */
     int deleteLiveAfterSalesById(Long id);
+
+    R applyAfterSales(String userId, LiveAfterSalesApplyParam param);
+
+    R revoke(String userId, LiveAfterSalesRevokeParam param);
+
+    R addDelivery(LiveAfterSalesDeliveryParam param);
+
+    List<LiveAfterSalesListUVO> selectLiveAfterSalesListUVO(LiveAfterSalesListUParam param);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/live/service/ILiveGoodsService.java

@@ -107,4 +107,6 @@ public interface ILiveGoodsService extends IService<LiveGoods>{
      * 根据店铺ID查询商品列表
      */
     List<LiveGoodsVo> selectLiveGoodsListByMap(Map<String, Object> params);
+
+    Long getStoreIdByLiveId(Long liveId);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/live/service/ILiveOrderItemService.java

@@ -4,6 +4,7 @@ import java.util.List;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.live.domain.LiveOrder;
 import com.fs.live.domain.LiveOrderItem;
+import com.fs.live.vo.LiveOrderItemListUVO;
 import com.fs.live.vo.LiveOrderItemVo;
 
 /**
@@ -62,4 +63,6 @@ public interface ILiveOrderItemService extends IService<LiveOrderItem>{
     int deleteLiveOrderItemByItemId(String itemId);
 
     List<LiveOrderItemVo> selectCheckedByUserId(LiveOrder liveOrder);
+
+    List<LiveOrderItemListUVO> selectLiveOrderItemListUVOByOrderId(Long orderId);
 }

+ 3 - 1
fs-service/src/main/java/com/fs/live/service/ILiveOrderService.java

@@ -62,7 +62,7 @@ public interface ILiveOrderService extends IService<LiveOrder>{
     /**
      * 删除订单信息
      *
-     * @param  订单主键
+     * @param
      * @return 结果
      */
     //int deleteLiveOrderByOrderId(String orderId);
@@ -147,4 +147,6 @@ public interface ILiveOrderService extends IService<LiveOrder>{
     List<LiveOrderListVo> selectLiveOrderListVo(LiveOrder liveOrder);
 
     R buy(LiveOrder liveOrder);
+
+    R finishOrder(Long orderId);
 }

+ 298 - 8
fs-service/src/main/java/com/fs/live/service/impl/LiveAfterSalesServiceImpl.java

@@ -1,26 +1,94 @@
 package com.fs.live.service.impl;
 
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.Collections;
+import java.util.Date;
 import java.util.List;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateTime;
+import com.fs.common.core.domain.R;
+import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.common.utils.StringUtils;
+import com.fs.core.utils.OrderCodeUtils;
+import com.fs.erp.dto.BaseResponse;
+import com.fs.erp.dto.ErpRefundUpdateRequest;
+import com.fs.erp.service.IErpOrderService;
+import com.fs.his.config.FsSysConfig;
+import com.fs.his.domain.*;
+import com.fs.his.dto.FsStoreAfterSalesProductDTO;
+import com.fs.his.enums.FsStoreAfterSalesStatusEnum;
+import com.fs.his.enums.FsStoreOrderStatusEnum;
+import com.fs.his.service.IFsUserService;
+import com.fs.his.utils.ConfigUtil;
+import com.fs.his.vo.FsStoreAfterSalesListUVO;
+import com.fs.live.domain.*;
+import com.fs.live.dto.LiveAfterSalesProductDTO;
+import com.fs.live.enums.LiveAfterSalesStatusEnum;
+import com.fs.live.mapper.LiveAfterSalesItemMapper;
+import com.fs.live.mapper.LiveAfterSalesLogsMapper;
+import com.fs.live.mapper.LiveOrderPaymentMapper;
+import com.fs.live.param.LiveAfterSalesApplyParam;
+import com.fs.live.param.LiveAfterSalesDeliveryParam;
+import com.fs.live.param.LiveAfterSalesListUParam;
+import com.fs.live.param.LiveAfterSalesRevokeParam;
+import com.fs.live.service.ILiveOrderItemService;
+import com.fs.live.service.ILiveOrderService;
+import com.fs.live.vo.LiveAfterSalesListUVO;
+import com.fs.live.vo.LiveOrderItemListUVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 import com.fs.live.mapper.LiveAfterSalesMapper;
-import com.fs.live.domain.LiveAfterSales;
 import com.fs.live.service.ILiveAfterSalesService;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 /**
  * 售后记录Service业务层处理
- * 
+ *
  * @author fs
  * @date 2025-07-08
  */
 @Service
 public class LiveAfterSalesServiceImpl extends ServiceImpl<LiveAfterSalesMapper, LiveAfterSales> implements ILiveAfterSalesService {
 
+    @Autowired
+    private ILiveOrderService liveOrderService;
+
+    @Autowired
+    private ILiveOrderItemService liveOrderItemService;
+
+    @Autowired
+    private LiveAfterSalesMapper liveAfterSalesMapper;
+
+    @Autowired
+    private LiveAfterSalesLogsMapper liveAfterSalesLogsMapper;
+
+    @Autowired
+    private LiveAfterSalesItemMapper liveAfterSalesItemMapper;
+
+    @Autowired
+    private ConfigUtil configUtil;
+
+    @Autowired
+    private IFsUserService userService;
+
+    @Autowired
+    private IErpOrderService erpOrderService;
+    @Autowired
+    @Qualifier("hzOMSErpOrderServiceImpl")
+    private IErpOrderService hzOMSerpOrderService;
+
+    @Autowired
+    private LiveOrderPaymentMapper liveOrderPaymentMapper;
+
     /**
      * 查询售后记录
-     * 
+     *
      * @param id 售后记录主键
      * @return 售后记录
      */
@@ -32,7 +100,7 @@ public class LiveAfterSalesServiceImpl extends ServiceImpl<LiveAfterSalesMapper,
 
     /**
      * 查询售后记录列表
-     * 
+     *
      * @param liveAfterSales 售后记录
      * @return 售后记录
      */
@@ -44,7 +112,7 @@ public class LiveAfterSalesServiceImpl extends ServiceImpl<LiveAfterSalesMapper,
 
     /**
      * 新增售后记录
-     * 
+     *
      * @param liveAfterSales 售后记录
      * @return 结果
      */
@@ -57,7 +125,7 @@ public class LiveAfterSalesServiceImpl extends ServiceImpl<LiveAfterSalesMapper,
 
     /**
      * 修改售后记录
-     * 
+     *
      * @param liveAfterSales 售后记录
      * @return 结果
      */
@@ -69,7 +137,7 @@ public class LiveAfterSalesServiceImpl extends ServiceImpl<LiveAfterSalesMapper,
 
     /**
      * 批量删除售后记录
-     * 
+     *
      * @param ids 需要删除的售后记录主键
      * @return 结果
      */
@@ -81,7 +149,7 @@ public class LiveAfterSalesServiceImpl extends ServiceImpl<LiveAfterSalesMapper,
 
     /**
      * 删除售后记录信息
-     * 
+     *
      * @param id 售后记录主键
      * @return 结果
      */
@@ -90,4 +158,226 @@ public class LiveAfterSalesServiceImpl extends ServiceImpl<LiveAfterSalesMapper,
     {
         return baseMapper.deleteLiveAfterSalesById(id);
     }
+
+    @Override
+    public List<LiveAfterSalesListUVO> selectLiveAfterSalesListUVO(LiveAfterSalesListUParam param) {
+        List<LiveAfterSalesListUVO> list = liveAfterSalesMapper.selectLiveAfterSalesListUVO(param);
+        for (LiveAfterSalesListUVO vo : list) {
+            LiveAfterSalesItem map = new LiveAfterSalesItem();
+            map.setAfterSalesId(vo.getId());
+            List<LiveAfterSalesItem> items = liveAfterSalesItemMapper.selectLiveAfterSalesItemList(map);
+            vo.setItems(items);
+        }
+        return list;
+    }
+
+    @Override
+    public R addDelivery(LiveAfterSalesDeliveryParam param) {
+        LiveAfterSales storeAfterSales = liveAfterSalesMapper.selectLiveAfterSalesById(param.getId());
+        if (storeAfterSales == null) {
+            throw new CustomException("未查询到售后订单信息");
+        }
+        if (!storeAfterSales.getStatus().equals(FsStoreAfterSalesStatusEnum.STATUS_1.getValue())) {
+            throw new CustomException("未审核订单不能提交物流信息");
+        }
+        storeAfterSales.setStatus(2);
+        storeAfterSales.setDeliverySn(param.getDeliverySn());
+        storeAfterSales.setDeliveryName(param.getDeliveryName());
+
+        //操作记录
+        LiveAfterSalesLogs logs = new LiveAfterSalesLogs();
+        logs.setChangeTime(new DateTime());
+        logs.setChangeType(2);
+        FsUser user = userService.selectFsUserByUserId(storeAfterSales.getUserId());
+        logs.setOperator(user.getNickName());
+        logs.setStoreAfterSalesId(storeAfterSales.getId());
+        logs.setChangeMessage(FsStoreAfterSalesStatusEnum.STATUS_2.getDesc());
+        liveAfterSalesLogsMapper.insertLiveAfterSalesLogs(logs);
+
+        liveAfterSalesMapper.updateLiveAfterSales(storeAfterSales);
+        return R.ok();
+    }
+
+
+
+    @Override
+    @Transactional
+    public R applyAfterSales(String uesrId, LiveAfterSalesApplyParam param) {
+        LiveOrder order = liveOrderService.selectLiveOrderByOrderId(String.valueOf(param.getOrderId()));
+        if (!order.getUserId().equals(uesrId)) {
+            throw new CustomException("非法操作");
+        }
+        if (order.getStatus() == 0) {
+            return R.error("未支付订单不能申请售后");
+        }
+        if (order.getStatus() == FsStoreOrderStatusEnum.STATUS_NE3.getValue()) {
+            return R.error("已取消订单不能申请售后");
+        }
+        if (order.getStatus() == FsStoreOrderStatusEnum.STATUS_NE2.getValue()) {
+            return R.error("已退款订单不能申请售后");
+        }
+        if (order.getStatus() == FsStoreOrderStatusEnum.STATUS_NE1.getValue()) {
+            return R.error("已提交申请,等待处理");
+        }
+        if (Integer.valueOf(order.getPayType()) == 3 && order.getStatus() >= FsStoreOrderStatusEnum.STATUS_3.getValue()) {
+            return R.error("货到付款已发货订单,不支持申请售后");
+        }
+        if (order.getIsAfterSales() == 0) {
+            return R.error("此订单已超过售后时间,不能提交售后");
+        }
+        LiveOrderItem liveOrderItem = new LiveOrderItem();
+        liveOrderItem.setOrderId(param.getOrderId());
+        List<LiveOrderItem> orderItems = liveOrderItemService.selectLiveOrderItemList(liveOrderItem);
+        for (LiveOrderItem item : orderItems) {
+            LiveAfterSalesProductDTO prosuctParam = param.getProductList().stream().filter(p -> p.getProductId().equals(item.getProductId())).findFirst().orElse(new LiveAfterSalesProductDTO());
+            if (prosuctParam.getProductId() != null) {
+//                //商品优惠前总金额
+//                BigDecimal totalAmountOfGoods = NumberUtil.mul(cartInfo.getPrice(), item.getNum());
+//                //商品优惠总金额
+//                BigDecimal commodityDiscountAmount = NumberUtil.mul(NumberUtil.div(totalAmountOfGoods, NumberUtil.sub(order.getTotalPrice(), order.getPayPostage())), order.getCouponPrice());
+//                //商品优惠后总金额
+//                totalPrice = NumberUtil.add(totalPrice, NumberUtil.sub(totalAmountOfGoods, commodityDiscountAmount));
+                item.setIsAfterSales(1);
+                LiveOrderItem orderItem = new LiveOrderItem();
+                BeanUtil.copyProperties(item, orderItem);
+                liveOrderItemService.updateLiveOrderItem(orderItem);
+
+            }
+        }
+        //更新订单状态
+        Integer orderStatus = order.getStatus();
+        order.setStatus(FsStoreOrderStatusEnum.STATUS_NE1.getValue());
+        order.setRefundStatus(FsStoreOrderStatusEnum.REFUND_STATUS_1.getValue().toString());
+        order.setRefundReason(param.getReasons());
+        order.setRefundExplain(param.getExplains());
+        order.setRefundTime(new Date());
+        liveOrderService.updateLiveOrder(order);
+        //生成售后订单
+        LiveAfterSales storeAfterSales = new LiveAfterSales();
+        storeAfterSales.setOrderId(order.getOrderId());
+        storeAfterSales.setStoreId(order.getStoreId());
+        storeAfterSales.setDeptId(order.getDeptId());
+        storeAfterSales.setRefundAmount(param.getRefundAmount());
+        storeAfterSales.setRefundType(param.getRefundType());
+        storeAfterSales.setReasons(param.getReasons());
+        storeAfterSales.setExplains(param.getExplains());
+        storeAfterSales.setExplainImg(param.getExplainImg());
+        storeAfterSales.setStatus(FsStoreAfterSalesStatusEnum.STATUS_0.getValue());
+        storeAfterSales.setSalesStatus(0);
+        storeAfterSales.setCreateTime(Timestamp.valueOf(LocalDateTime.now()));
+        storeAfterSales.setIsDel(0);
+        storeAfterSales.setUserId(Long.valueOf(uesrId));
+        storeAfterSales.setOrderStatus(orderStatus);
+        storeAfterSales.setCompanyId(order.getCompanyId());
+        storeAfterSales.setCompanyUserId(order.getCompanyUserId());
+        liveAfterSalesMapper.insertLiveAfterSales(storeAfterSales);
+        //售后商品详情
+        for (LiveAfterSalesProductDTO productParam : param.getProductList()) {
+            LiveOrderItem item = orderItems.stream().filter(p -> p.getProductId().equals(productParam.getProductId())).findFirst().orElse(new LiveOrderItem());
+            LiveAfterSalesItem storeAfterSalesItem = new LiveAfterSalesItem();
+            storeAfterSalesItem.setAfterSalesId(storeAfterSales.getId());
+            storeAfterSalesItem.setProductId(item.getProductId());
+            storeAfterSalesItem.setJsonInfo(item.getJsonInfo());
+            storeAfterSalesItem.setIsDel(0);
+            liveAfterSalesItemMapper.insertLiveAfterSalesItem(storeAfterSalesItem);
+        }
+        //操作记录
+        LiveAfterSalesLogs logs = new LiveAfterSalesLogs();
+        logs.setChangeTime(new DateTime());
+        logs.setChangeType(0);
+        FsUser user = userService.selectFsUserByUserId(Long.valueOf(order.getUserId()));
+        logs.setOperator(user.getNickName());
+        logs.setStoreAfterSalesId(storeAfterSales.getId());
+        logs.setChangeMessage(LiveAfterSalesStatusEnum.STATUS_0.getDesc());
+        liveAfterSalesLogsMapper.insertLiveAfterSalesLogs(logs);
+        if (order.getExtendOrderId() != null) {
+            ErpRefundUpdateRequest request = new ErpRefundUpdateRequest();
+            request.setTid(order.getOrderCode());
+            request.setOid(order.getOrderCode());
+            request.setRefund_state(1);
+            request.setStoreAfterSalesId(storeAfterSales.getId());
+            FsSysConfig sysConfig = configUtil.getSysConfig();
+            Integer erpType = sysConfig.getErpType();
+            BaseResponse response = null;
+            if (erpType == 1) {
+                response =  erpOrderService.refundUpdate(request);
+            } else if (erpType == 3) {
+                //瀚智
+                response =  hzOMSerpOrderService.refundUpdate(request);
+            }
+            if (response.getSuccess()) {
+                return R.ok();
+            } else {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return R.error(response.getErrorDesc());
+            }
+        }
+        //更新OMS
+        return R.ok();
+    }
+
+    @Override
+    public R revoke(String userId, LiveAfterSalesRevokeParam param) {
+        LiveAfterSales storeAfterSales = baseMapper.selectLiveAfterSalesById(param.getId());
+        if (storeAfterSales == null) {
+            throw new CustomException("未查询到售后订单信息");
+        }
+        if (storeAfterSales.getSalesStatus() != 0) {
+            throw new CustomException("非法操作");
+        }
+        if (storeAfterSales.getStatus().equals(LiveAfterSalesStatusEnum.STATUS_2.getValue()) || storeAfterSales.getStatus().equals(LiveAfterSalesStatusEnum.STATUS_3.getValue()) || storeAfterSales.getStatus().equals(FsStoreAfterSalesStatusEnum.STATUS_4.getValue())) {
+            throw new CustomException("已发货退款单不能撤销");
+        }
+        //只有未发货的可以撤销,
+        if (!storeAfterSales.getOrderStatus().equals(FsStoreOrderStatusEnum.STATUS_2.getValue())) {
+            throw new CustomException("只有未发货的订单可以撤销售后");
+        }
+        storeAfterSales.setSalesStatus(1);
+        LiveOrder order = liveOrderService.selectLiveOrderByOrderId(String.valueOf(storeAfterSales.getOrderId()));
+        order.setStatus(storeAfterSales.getOrderStatus());
+        order.setRefundStatus(FsStoreOrderStatusEnum.REFUND_STATUS_0.getValue().toString());
+        liveOrderService.updateLiveOrder(order);
+        //操作记录
+        LiveAfterSalesLogs logs = new LiveAfterSalesLogs();
+        logs.setChangeTime(new DateTime());
+        logs.setChangeType(5);
+        FsUser user = userService.selectFsUserByUserId(Long.valueOf(order.getUserId()));
+        logs.setOperator(user.getNickName());
+        logs.setStoreAfterSalesId(storeAfterSales.getId());
+        logs.setChangeMessage(FsStoreAfterSalesStatusEnum.STATUS_5.getDesc());
+        liveAfterSalesLogsMapper.insertLiveAfterSalesLogs(logs);
+        if (storeAfterSales.getOrderStatus().equals(FsStoreOrderStatusEnum.STATUS_2.getValue())) {
+            if (StringUtils.isNotEmpty(order.getExtendOrderId())) {
+                //更新订单code
+                String orderSn = OrderCodeUtils.getOrderSn();
+                if (StringUtils.isEmpty(orderSn)) {
+                    return R.error("订单生成失败,请重试");
+                }
+                LiveOrder orderMap = new LiveOrder();
+                orderMap.setOrderId(order.getOrderId());
+                orderMap.setOrderCode(orderSn);
+                liveOrderService.updateLiveOrder(orderMap);
+                //生成新的订单
+
+                List<LiveOrderPayment> payments = liveOrderPaymentMapper.selectLiveOrderPaymentByPay(2, order.getOrderId());
+                for (LiveOrderPayment payment : payments) {
+                    LiveOrderPayment livePayment = new LiveOrderPayment();
+                    livePayment.setPaymentId(payment.getPaymentId());
+                    livePayment.setBusinessCode(orderSn);
+                    liveOrderPaymentMapper.updateLiveOrderPayment(livePayment);
+                }
+
+
+                try {
+                    liveOrderService.pushLiveOrder(order);
+                } catch (Exception e) {
+                }
+            }
+        }
+        liveAfterSalesMapper.updateLiveAfterSales(storeAfterSales);
+        return R.ok();
+
+    }
+
+
 }

+ 5 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveGoodsServiceImpl.java

@@ -230,4 +230,9 @@ public class LiveGoodsServiceImpl extends ServiceImpl<LiveGoodsMapper, LiveGoods
     public List<LiveGoodsVo> selectLiveGoodsListByMap(Map<String, Object> params) {
         return baseMapper.selectLiveGoodsListByStoreId(params);
     }
+
+    @Override
+    public Long getStoreIdByLiveId(Long liveId) {
+        return baseMapper.getStoreIdByLiveId(liveId);
+    }
 }

+ 6 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveOrderItemServiceImpl.java

@@ -4,6 +4,7 @@ import java.util.Collections;
 import java.util.List;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.live.domain.LiveOrder;
+import com.fs.live.vo.LiveOrderItemListUVO;
 import com.fs.live.vo.LiveOrderItemVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -96,4 +97,9 @@ public class LiveOrderItemServiceImpl extends ServiceImpl<LiveOrderItemMapper, L
     public List<LiveOrderItemVo> selectCheckedByUserId(LiveOrder liveOrder) {
         return baseMapper.selectCheckedByUserId(liveOrder.getUserId());
     }
+
+    @Override
+    public List<LiveOrderItemListUVO> selectLiveOrderItemListUVOByOrderId(Long orderId) {
+        return baseMapper.selectLiveOrderItemListUVOByOrderId(orderId);
+    }
 }

+ 37 - 2
fs-service/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java

@@ -61,6 +61,7 @@ import com.fs.huifuPay.domain.HuiFuCreateOrder;
 import com.fs.huifuPay.domain.HuifuCreateOrderResult;
 import com.fs.huifuPay.service.HuiFuService;
 import com.fs.live.domain.*;
+import com.fs.live.dto.LiveOrderItemDTO;
 import com.fs.live.mapper.*;
 import com.fs.live.param.LiveOrderConfirmParam;
 import com.fs.live.service.ILiveOrderLogsService;
@@ -750,11 +751,12 @@ public class LiveOrderServiceImpl extends ServiceImpl<LiveOrderMapper, LiveOrder
             totalPrice = totalPrice.add(product.getPrice().multiply(new BigDecimal(item.getCartNum())));
 
             // 订单商品详情
-            FsStoreOrderItemDTO dto=new FsStoreOrderItemDTO();
+            LiveOrderItemDTO dto=new LiveOrderItemDTO();
             dto.setImage(product.getImgUrl());
             dto.setSku(String.valueOf(product.getStoreId()));
             dto.setBarCode(product.getBarCode());
             dto.setPrice(product.getPrice());
+            dto.setProductName(product.getProductName());
             dto.setNum(Long.valueOf(item.getCartNum()));
 
             LiveOrderItem liveOrderItem = new LiveOrderItem();
@@ -796,6 +798,38 @@ public class LiveOrderServiceImpl extends ServiceImpl<LiveOrderMapper, LiveOrder
         }
     }
 
+    @Override
+    public synchronized R finishOrder(Long orderId) {
+        return finishStoreOrder(orderId);
+    }
+
+    @Transactional
+    public R finishStoreOrder(Long orderId){
+        LiveOrder order= baseMapper.selectLiveOrderByOrderId(String.valueOf(orderId));
+        if(order.getStatus()==FsStoreOrderStatusEnum.STATUS_3.getValue()){
+            order.setFinishTime(new Date());
+            order.setStatus(4);
+            baseMapper.updateLiveOrder(order);
+            liveOrderLogsService.create(order.getOrderId(), FsStoreOrderLogEnum.FINISH_ORDER.getValue(),
+                    FsStoreOrderLogEnum.FINISH_ORDER.getDesc());
+
+            //模板消息支付成功发布事件
+//            TemplateBean templateBean = TemplateBean.builder()
+//                    .orderId(order.getOrderId().toString())
+//                    .title(order.getOrderCode().toString())
+//                    .remark("您的订单已签收成功")
+//                    .time(order.getFinishTime())
+//                    .uid(order.getUserId())
+//                    .templateType(TemplateListenEnum.TYPE_3.getValue())
+//                    .build();
+//            publisher.publishEvent(new TemplateEvent(this, templateBean));
+            return R.ok("操作成功");
+        }
+        else {
+            return R.error("非法操作");
+        }
+    }
+
     /**
      * 新增订单
      *
@@ -1070,11 +1104,12 @@ public class LiveOrderServiceImpl extends ServiceImpl<LiveOrderMapper, LiveOrder
         liveOrder.setPayMoney(liveOrder.getTotalPrice());
         try {
             if (baseMapper.insertLiveOrder(liveOrder) > 0) {
-                FsStoreOrderItemDTO dto=new FsStoreOrderItemDTO();
+                LiveOrderItemDTO dto=new LiveOrderItemDTO();
                 dto.setImage(fsStoreProduct.getImgUrl());
                 dto.setSku(String.valueOf(fsStoreProduct.getStoreId()));
                 dto.setBarCode(fsStoreProduct.getBarCode());
                 dto.setPrice(fsStoreProduct.getPrice());
+                dto.setProductName(fsStoreProduct.getProductName());
                 dto.setNum(Long.valueOf(liveOrder.getTotalNum()));
 
                 LiveOrderItem liveOrderItem = new LiveOrderItem();

+ 82 - 0
fs-service/src/main/java/com/fs/live/vo/LiveAfterSalesListUVO.java

@@ -0,0 +1,82 @@
+package com.fs.live.vo;
+
+import com.fs.common.annotation.Excel;
+import com.fs.his.domain.FsStoreAfterSalesItem;
+import com.fs.live.domain.LiveAfterSalesItem;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class LiveAfterSalesListUVO implements Serializable {
+
+    private Long id;
+
+    /** 订单号 */
+    private Long orderId;
+
+    /** 退款金额 */
+    private BigDecimal refundAmount;
+
+    @Excel(name = "服务类型0仅退款1退货退款")
+    private Integer refundType;
+
+    /** 申请原因 */
+    @Excel(name = "申请原因")
+    private String reasons;
+
+    /** 说明 */
+    @Excel(name = "说明")
+    private String explains;
+
+    /** 说明图片->多个用逗号分割 */
+    @Excel(name = "说明图片->多个用逗号分割")
+    private String explainImg;
+
+    /** 物流公司编码 */
+    @Excel(name = "物流公司编码")
+    private String shipperCode;
+
+    /** 物流单号 */
+    @Excel(name = "物流单号")
+    private String deliverySn;
+
+    /** 物流名称 */
+    @Excel(name = "物流名称")
+    private String deliveryName;
+
+    /** 状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3退款成功 */
+    private Integer status;
+
+    /** 售后状态-0正常1用户取消2商家拒绝 */
+    @Excel(name = "售后状态-0正常1用户取消2商家拒绝")
+    private Integer salesStatus;
+
+    @Excel(name = "订单当前状态")
+    private Integer orderStatus;
+
+    /** 逻辑删除 */
+    private Integer isDel;
+
+    /** 用户id */
+    private Long userId;
+
+    /** 商家收货人 */
+    @Excel(name = "商家收货人")
+    private String consignee;
+
+    /** 商家手机号 */
+    @Excel(name = "商家手机号")
+    private String phoneNumber;
+
+    /** 商家地址 */
+    @Excel(name = "商家地址")
+    private String address;
+
+    private String orderCode;
+
+    List<LiveAfterSalesItem> items;
+
+}

+ 19 - 0
fs-service/src/main/java/com/fs/live/vo/LiveOrderItemListUVO.java

@@ -0,0 +1,19 @@
+package com.fs.live.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class LiveOrderItemListUVO implements Serializable {
+
+    /** 商品ID */
+    private Long productId;
+
+    private String jsonInfo;
+
+    /** 数量 */
+    private Long num;
+
+
+}