赵文轩
2025-01-08 edd22f77d054237b32628a91f217fd18288b13d6
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.ltkj.web.controller.mall;
 
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ltkj.common.annotation.Log;
import com.ltkj.common.core.controller.BaseController;
import com.ltkj.common.core.domain.AjaxResult;
import com.ltkj.common.core.page.TableDataInfo;
import com.ltkj.common.enums.BusinessType;
import com.ltkj.common.utils.poi.ExcelUtil;
import com.ltkj.hosp.domain.GetPhone;
import com.ltkj.hosp.domain.Wxuser;
import com.ltkj.hosp.service.IWxuserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import sun.misc.BASE64Decoder;
 
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
 
/**
 * 微信用户Controller
 *
 * @author ltkj_赵佳豪&李格
 * @date 2023-01-16
 */
@RestController
@RequestMapping("/hosp/wxuser")
@Api(tags = "微信用户接口")
public class MalluserController extends BaseController {
    @Autowired
    private IWxuserService wxuserService;
 
    @Value("${xcx.appid}")
    private String appid;
 
    @Value("${xcx.secret}")
    private String secret;
 
 
    /**
     * 查询微信用户列表
     */
    @PreAuthorize("@ss.hasPermi('hosp:wxuser:list')")
    @GetMapping("/list")
    public TableDataInfo list(Wxuser wxuser) {
        startPage();
        List<Wxuser> list = wxuserService.selectWxuserList(wxuser);
        return getDataTable(list);
    }
 
    /**
     * 导出微信用户列表
     */
    @PreAuthorize("@ss.hasPermi('hosp:wxuser:export')")
    @Log(title = "微信用户", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Wxuser wxuser) {
        List<Wxuser> list = wxuserService.selectWxuserList(wxuser);
        ExcelUtil<Wxuser> util = new ExcelUtil<Wxuser>(Wxuser.class);
        util.exportExcel(response, list, "微信用户数据");
    }
 
    /**
     * 获取微信用户详细信息
     */
    @PreAuthorize("@ss.hasPermi('hosp:wxuser:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(wxuserService.selectWxuserById(id));
    }
 
    /**
     * 新增微信用户
     */
    @PreAuthorize("@ss.hasPermi('hosp:wxuser:add')")
    @Log(title = "微信用户", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Wxuser wxuser) {
        return toAjax(wxuserService.insertWxuser(wxuser));
    }
 
    /**
     * 修改微信用户
     */
    @PreAuthorize("@ss.hasPermi('hosp:wxuser:edit')")
    @Log(title = "微信用户", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Wxuser wxuser) {
        return toAjax(wxuserService.updateWxuser(wxuser));
    }
 
    /**
     * 删除微信用户
     */
    @PreAuthorize("@ss.hasPermi('hosp:wxuser:remove')")
    @Log(title = "微信用户", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(wxuserService.deleteWxuserByIds(ids));
    }
 
 
}