master
parent
1c07cc9fb8
commit
a3b2804c00
@ -1,20 +0,0 @@
|
||||
package com.zh.project0512.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zh
|
||||
* @since 2022-06-07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/qywx-department")
|
||||
public class QywxDepartmentController {
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.zh.project0512.controller.manage;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.zh.project0512.annotation.tokenValid;
|
||||
import com.zh.project0512.model.QywxDepartmentUserLink;
|
||||
import com.zh.project0512.model.User;
|
||||
import com.zh.project0512.service.IQywxDepartmentService;
|
||||
import com.zh.project0512.service.IQywxDepartmentUserLinkService;
|
||||
import com.zh.project0512.service.IUserService;
|
||||
import com.zh.project0512.utils.HttpUtil;
|
||||
import com.zh.project0512.utils.JwtUtil;
|
||||
import com.zh.project0512.utils.result.HttpStatusEnum;
|
||||
import com.zh.project0512.utils.result.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "企业微信管理")
|
||||
@RestController
|
||||
@RequestMapping("/manage/qywx")
|
||||
public class QYWXController {
|
||||
@Autowired
|
||||
private HttpUtil httpUtil;
|
||||
@Autowired
|
||||
private IQywxDepartmentService qywxDepartmentService;
|
||||
|
||||
@Operation(summary = "刷新企业部门信息")
|
||||
@PostMapping("/departmentRefresh")
|
||||
public Result departmentRefresh() {
|
||||
String access_token = httpUtil.qywxGetToken();
|
||||
JSONObject res = httpUtil.qywxDepartmentList(access_token);
|
||||
List department = res.getJSONArray("department");
|
||||
qywxDepartmentService.remove(new QueryWrapper<>());
|
||||
qywxDepartmentService.updateAll(department);
|
||||
return Result.success(res.getJSONArray("department"));
|
||||
}
|
||||
}
|
Loading…
Reference in new issue