manailin
2022-09-21 d6aabd981bf80cd57c09819f42b1c4e79f1904f9
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
package com.panzhihua.service_community.api;
 
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.sanshuo.ComSanshuoExpertDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.service_community.entity.ComSanshuoExpert;
import com.panzhihua.service_community.service.ComSanShuoExpertService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.xml.crypto.Data;
import java.util.Date;
 
/**
 * 三说会堂调解专家控制器
 * */
@RestController
@RequestMapping("/sanshuo/expert")
public class ComSanShuoExpertApi extends BaseController {
 
    @Resource
    private ComSanShuoExpertService comSanShuoExpertService;
    @Resource
    private UserService userService;
 
    /**
     * 添加专家
     * */
    @PostMapping
    public R add(@RequestBody ComSanshuoExpertDTO comSanshuoExpertDTO){
        comSanshuoExpertDTO.setCreateBy(this.getLoginUserInfo().getName());
        return comSanShuoExpertService.addExpert(comSanshuoExpertDTO);
    }
 
    @GetMapping("/detail")
    public R detail(@RequestParam Long id){
        return R.ok(comSanShuoExpertService.getById(id));
    }
 
    /**
     * 小程序获取可选择专家
     * */
    @GetMapping("/appletsList")
    public R appList(){
        comSanShuoExpertService.selectExpertList();
        return R.ok(comSanShuoExpertService.list(new QueryWrapper<ComSanshuoExpert>().eq("status",1).eq("del_flag",1)));
    }
 
    /**
     * 修改专家
     * */
    @PutMapping
    public R update(@RequestBody ComSanshuoExpertDTO comSanshuoExpertDTO){
        ComSanshuoExpert expert=new ComSanshuoExpert();
        BeanUtil.copyProperties(comSanshuoExpertDTO,expert);
        expert.setUpdateTime(new Date());
        return R.ok(comSanShuoExpertService.updateById(expert));
    }
 
    /**
     * 后台获取列表
     * */
    @GetMapping("/backstageList")
    public R backList(@RequestParam(value = "keyWord",required = false) String keyWord,
                      @RequestParam(value = "page",required = false)Integer page,
                      @RequestParam(value = "size",required = false)Integer size){
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        return comSanShuoExpertService.expertPage(keyWord,page,size,loginUserInfo);
    }
 
    /**
     * 删除
     * */
    @DeleteMapping("/remove")
    public R remove(@RequestParam("id")Long id){
        //TODO 是否有为解决事件
        ComSanshuoExpert expert = comSanShuoExpertService.getById(id);
        expert.setStatus(0);
        expert.setDelFlag(0);
        return R.ok(comSanShuoExpertService.updateById(expert));
    }
 
    /**
     * 重置密码
     * */
    @PostMapping("/resetPassword")
    public R resetPassword(@RequestBody ComSanshuoExpertDTO comSanshuoExpertDTO){
        ComSanshuoExpert expert = comSanShuoExpertService.getById(comSanshuoExpertDTO.getId());
        expert.setPassword(comSanshuoExpertDTO.getPassword());
        return R.ok(comSanShuoExpertService.updateById(expert));
    }
 
    /**
     * 专家风采
     * */
    @GetMapping("/expertShow")
    public R expertShow(){
        return comSanShuoExpertService.expertShow();
    }
 
 
    /**
     * 专家范围
     * */
    @GetMapping("/expertRange")
    public R expertRange(){
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        return comSanShuoExpertService.expertRange(loginUserInfo);
    }
}