luodangjia
2024-04-18 0c13dd6a75be38f540a6080b706e6cdeaab62d3e
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package cn.stylefeng.guns.modular.business.controller;
 
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.guns.modular.business.dto.CounsellingOrderReservationRequestDTO;
import cn.stylefeng.guns.modular.business.entity.CounsellingOrderReservation;
import cn.stylefeng.guns.modular.business.service.ICounsellingOrderReservationService;
import cn.stylefeng.guns.modular.business.service.ICounsellingOrderService;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog;
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
import cn.stylefeng.roses.kernel.rule.pojo.response.ErrorResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * 咨询订单预约记录管理类
 * @author guo
 */
@RestController
@Api(tags = "咨询订单预约记录管理类")
@ApiResource(name = "咨询订单预约记录管理类", resBizType = ResBizTypeEnum.BUSINESS)
@RequestMapping("/business")
public class CounsellingOrderReservationController  {
 
    @Resource
    private ICounsellingOrderReservationService counsellingOrderReservationService;
 
    /**
     * 添加咨询订单预约记录
     */
    @ApiOperation("添加咨询订单预约记录")
    @PostResource(name = "添加咨询订单预约记录", path = "/counsellingOrderReservation/add")
    @BusinessLog
    public ResponseData<?> add(@RequestBody CounsellingOrderReservation counsellingOrderReservation) {
        this.counsellingOrderReservationService.save(counsellingOrderReservation);
        return new SuccessResponseData<>();
    }
 
    /**
     * 删除咨询订单预约记录
     */
    @ApiOperation("删除咨询订单预约记录")
    @PostResource(name = "删除咨询订单预约记录", path = "/counsellingOrderReservation/delete")
    @BusinessLog
    public ResponseData<?> delete(@RequestParam String ids) {
        if (StrUtil.isBlank(ids)){
            return new ErrorResponseData<>("500","id不能为空");
        }
        LambdaUpdateWrapper<CounsellingOrderReservation> lambdaUpdateWrapper = new LambdaUpdateWrapper<CounsellingOrderReservation>();
        lambdaUpdateWrapper.in(CounsellingOrderReservation::getId, ListUtil.toList(ids.split(",")));
        this.counsellingOrderReservationService.update(lambdaUpdateWrapper);
        return new SuccessResponseData<>();
    }
 
    /**
     * 修改咨询订单预约记录
     */
    @ApiOperation("修改咨询订单预约记录")
    @PostResource(name = "修改咨询订单预约记录", path = "/counsellingOrderReservation/edit")
    @BusinessLog
    public ResponseData<?> edit(@RequestBody CounsellingOrderReservation counsellingOrderReservation) {
        this.counsellingOrderReservationService.updateById(counsellingOrderReservation);
        return new SuccessResponseData<>();
    }
 
 
 
    @Autowired
    private ICounsellingOrderService counsellingOrderService;
 
    /**
     * 修改咨询订单预约记录状态
     */
    @ApiOperation("修改咨询订单预约记录状态 预约状态 1-待审批,2-待服务,3-服务中,4-已完成,5-已取消,6-已拒绝")
    @PostResource(name = "修改咨询订单预约记录状态 预约状态 1-待审批,2-待服务,3-服务中,4-已完成,5-已取消,6-已拒绝", path = "/counsellingOrderReservation/updateStatus")
    @BusinessLog
    public ResponseData<?> updateStatus(String ids, Integer status,String remark) {
        if (StrUtil.isBlank(ids)){
            return new ErrorResponseData<>("500","id不能为空");
        }
        LambdaUpdateWrapper<CounsellingOrderReservation> lambdaUpdateWrapper = new LambdaUpdateWrapper<CounsellingOrderReservation>();
        lambdaUpdateWrapper.in(CounsellingOrderReservation::getId, ListUtil.toList(ids.split(",")))
                .set(CounsellingOrderReservation::getUpdateUser, LoginContext.me().getLoginUser().getUserId())
                .set(CounsellingOrderReservation::getStauts,status)
                .set(CounsellingOrderReservation::getRemark,remark);
        this.counsellingOrderReservationService.update(lambdaUpdateWrapper);
 
 
 
 
 
        return new SuccessResponseData<>();
    }
 
    /**
     * 获取咨询订单预约记录详情
     */
    @ApiOperation("获取咨询订单预约记录详情")
    @GetResource(name = "获取咨询订单预约记录详情", path = "/counsellingOrderReservation/detail/{id}", requiredPermission = false)
    public ResponseData<CounsellingOrderReservation> detail(@PathVariable("id") Long id) {
        CounsellingOrderReservation counsellingOrderReservation = this.counsellingOrderReservationService.getById(id);
        return new SuccessResponseData<>(counsellingOrderReservation);
    }
 
    /**
     * 获取咨询订单预约记录列表
     *
     */
    @ApiOperation("获取咨询订单预约记录列表")
    @GetResource(name = "获取咨询订单预约记录列表", path = "/counsellingOrderReservation/list", requiredPermission = false)
    public ResponseData<List<CounsellingOrderReservation>> list(CounsellingOrderReservation counsellingOrderReservation) {
          LambdaQueryWrapper<CounsellingOrderReservation> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingOrderReservation>()
                        .orderByDesc(CounsellingOrderReservation::getId);
        return new SuccessResponseData<>(counsellingOrderReservationService.list(lambdaQueryWrapper));
    }
 
    /**
     * 获取咨询订单预约记录列表(分页)
     */
    @ApiOperation("查看日程(分页)")
    @GetResource(name = "查看日程(分页)", path = "/counsellingOrderReservation/page", requiredPermission = false)
    public ResponseData<PageResult<CounsellingOrderReservation>> page(CounsellingOrderReservationRequestDTO counsellingOrderReservationRequestDTO) {
        Page<CounsellingOrderReservation> page = this.counsellingOrderReservationService.findPage(PageFactory.defaultPage(), counsellingOrderReservationRequestDTO);
        return new SuccessResponseData<>(PageResultFactory.createPageResult(page));
    }
 
}