无关风月
2024-12-27 d0ea9b3c5897a99875de5ea18ab6cfbca6b4a5b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.jilongda.manage.controller;
 
 
import com.jilongda.common.basic.ApiResult;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.common.constants.WarehousingConstant;
import com.jilongda.common.utils.CodeGenerateUtils;
import com.jilongda.manage.authority.model.SecUser;
import com.jilongda.manage.authority.service.SecUserService;
import com.jilongda.manage.model.*;
import com.jilongda.manage.query.TOptometristQuery;
import com.jilongda.manage.query.TOrderAftersalesQuery;
import com.jilongda.manage.service.*;
import com.jilongda.manage.vo.TOptometristVO;
import com.jilongda.manage.vo.TOrderAftersalesDetailVO;
import com.jilongda.manage.vo.TOrderAftersalesVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.text.SimpleDateFormat;
import java.util.List;
 
/**
 * <p>
 * 订单售后表 前端控制器
 * </p>
 *
 * @author 无关风月
 * @since 2024-12-09
 */
@Api(tags = "订单售后管理")
@RestController
@RequestMapping("/t-order-aftersales")
public class TOrderAftersalesController {
 
 
    @Autowired
    private TOrderAftersalesService orderAftersalesService;
    @Autowired
    private TOrderService orderService;
    @Autowired
    private SecUserService secUserService;
    @Autowired
    private TStoreService tStoreService;
    @Autowired
    private TAppUserService appUserService;
    @Autowired
    private TOptometristService tOptometristService;
    @Autowired
    private TOrderGoodsService goodsService;
 
 
    @ApiOperation(value = "订单售后列表")
    @PostMapping(value = "/pageList")
    public ApiResult<PageInfo<TOrderAftersalesVO>> pageList(@RequestBody TOrderAftersalesQuery query) {
        PageInfo<TOrderAftersalesVO> orderAftersalesVOPageInfo = orderAftersalesService.pageList(query);
        return ApiResult.success(orderAftersalesVOPageInfo);
    }
 
    @ApiOperation(value = "订单售后添加")
    @PostMapping(value = "/add")
    public ApiResult<String> add(@RequestBody TOrderAftersales dto) {
        dto.setCode(WarehousingConstant.ASTER_SALES+ CodeGenerateUtils.generateVolumeSn());
        orderAftersalesService.save(dto);
        return ApiResult.success();
    }
    @ApiOperation(value = "订单售后详情")
    @GetMapping(value = "/detail")
    public ApiResult<TOrderAftersalesDetailVO> detail(Integer id) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
        TOrderAftersales byId = orderAftersalesService.getById(id);
        TOrder byId1 = orderService.getById(byId.getOrderId());
        TStore byId2 = tStoreService.getById(byId1.getStoreId());
        SecUser byId3 = secUserService.getById(byId.getSysId());
        TOptometrist byId5 = tOptometristService.getById(byId.getOptometristId());
        TOrderAftersalesDetailVO res = new TOrderAftersalesDetailVO();
        res.setOrderId(byId1.getId());
        if (byId1.getUserId()!=null){
            TAppUser byId4 = appUserService.getById(byId1);
            if (byId4!=null){
                res.setPhone(byId4.getPhone());
            }
        }
        res.setStoreName(byId2.getName());
        res.setOptometristName(byId5.getName());
        res.setSalesUser(byId3.getNickName());
        res.setOrderTime(simpleDateFormat.format(byId1.getCreateTime()));
        res.setAfterSalesTime(simpleDateFormat1.format(byId.getCreateTime()));
        List<TOrderGoods> list = goodsService.lambdaQuery().eq(TOrderGoods::getOrderId, byId1.getId()).list();
        res.setGoodsList(list);
        res.setOrderMoney(byId1.getOrderMoney());
        res.setCouponMoney(byId1.getCouponMoney());
        res.setPayMoney(byId1.getPayMoney());
        return ApiResult.success(res);
    }
 
 
}