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));
|
}
|
|
|
}
|