|
|
|
@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.zh.project0512.annotation.AdminTokenValid;
|
|
|
|
|
import com.zh.project0512.model.*;
|
|
|
|
|
import com.zh.project0512.service.IQywxDepartmentGroupLinkService;
|
|
|
|
|
import com.zh.project0512.service.IQywxDepartmentGroupService;
|
|
|
|
|
import com.zh.project0512.service.IQywxDepartmentService;
|
|
|
|
|
import com.zh.project0512.service.IUserService;
|
|
|
|
|
import com.zh.project0512.service.*;
|
|
|
|
|
import com.zh.project0512.utils.ExcelUtil;
|
|
|
|
|
import com.zh.project0512.utils.HttpUtil;
|
|
|
|
|
import com.zh.project0512.utils.MybatisPlusUtil;
|
|
|
|
@ -65,6 +62,9 @@ public class UserController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IQywxDepartmentGroupLinkService qywxDepartmentGroupLinkService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IUserPointsRecordsService userPointsRecordsService;
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
|
static class UParam {
|
|
|
|
|
private Integer pageNum;
|
|
|
|
@ -81,10 +81,10 @@ public class UserController {
|
|
|
|
|
public Result addTag(@Validated @RequestBody UParam param) {
|
|
|
|
|
QueryWrapper<User> qw = new QueryWrapper<>();
|
|
|
|
|
qw
|
|
|
|
|
.and(param.getDepartment() !=null,q -> q.like( "t2.name",param.getDepartment())
|
|
|
|
|
.or(o -> o.like( "t3.name",param.getDepartment())))
|
|
|
|
|
.like(param.getName() !=null, "t1.name",param.getName());
|
|
|
|
|
return Result.success(userService.pageList(MybatisPlusUtil.SetNumPage(param.getPageNum(),param.getPageSize()),qw));
|
|
|
|
|
.and(param.getDepartment() != null, q -> q.like("t2.name", param.getDepartment())
|
|
|
|
|
.or(o -> o.like("t3.name", param.getDepartment())))
|
|
|
|
|
.like(param.getName() != null, "t1.name", param.getName());
|
|
|
|
|
return Result.success(userService.pageList(MybatisPlusUtil.SetNumPage(param.getPageNum(), param.getPageSize()), qw));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "导出excel", description = "成员导出")
|
|
|
|
@ -92,16 +92,16 @@ public class UserController {
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public void excel(HttpServletResponse response, @Validated @RequestBody UParam param) throws IOException {
|
|
|
|
|
//这是表头及格式
|
|
|
|
|
String[][] array ={
|
|
|
|
|
{"员工","部门","上级部门","手机号","积分","历史积分","创建时间","上次登录"},
|
|
|
|
|
{"name", "main_departmentName","sub_departmentName","tel","points","historyPoints","creatAt","lastLoginAt"},
|
|
|
|
|
{"String", "String","String","String","int","int","LocalDateTime","LocalDateTime"}
|
|
|
|
|
String[][] array = {
|
|
|
|
|
{"员工", "部门", "上级部门", "手机号", "积分", "历史积分", "创建时间", "上次登录"},
|
|
|
|
|
{"name", "main_departmentName", "sub_departmentName", "tel", "points", "historyPoints", "creatAt", "lastLoginAt"},
|
|
|
|
|
{"String", "String", "String", "String", "int", "int", "LocalDateTime", "LocalDateTime"}
|
|
|
|
|
};
|
|
|
|
|
QueryWrapper<User> qw = new QueryWrapper<>();
|
|
|
|
|
qw
|
|
|
|
|
.and(param.getDepartment() !=null,q -> q.like( "t2.name",param.getDepartment())
|
|
|
|
|
.or(o -> o.like( "t3.name",param.getDepartment())))
|
|
|
|
|
.like(param.getName() !=null, "t1.name",param.getName());
|
|
|
|
|
.and(param.getDepartment() != null, q -> q.like("t2.name", param.getDepartment())
|
|
|
|
|
.or(o -> o.like("t3.name", param.getDepartment())))
|
|
|
|
|
.like(param.getName() != null, "t1.name", param.getName());
|
|
|
|
|
IPage<Map> iPage = userService.pageList(MybatisPlusUtil.SetNumPage(1, 10000), qw);
|
|
|
|
|
|
|
|
|
|
Workbook wb = ExcelUtil.writeToExcelByList(array, iPage.getRecords());
|
|
|
|
@ -134,12 +134,14 @@ public class UserController {
|
|
|
|
|
@Schema(title = "备注")
|
|
|
|
|
private String remarks;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "修改积分")
|
|
|
|
|
@PostMapping("/pointsTran")
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public Result pointsTran(@Validated @RequestBody PTParam param) {
|
|
|
|
|
UserPointsRecords userPointsRecords = new UserPointsRecords();
|
|
|
|
|
return Result.success(userPointsRecords.setPoints(param.getPoints()).setUserId(param.getUserId()).setSettlementMethod(param.getSettlementMethod()).setRemarks(param.getRemarks()).setCreateDate(LocalDateTime.now()),"操作完成");
|
|
|
|
|
userPointsRecordsService.save(userPointsRecords.setPoints(param.getPoints()).setUserId(param.getUserId()).setSettlementMethod(param.getSettlementMethod()).setRemarks(param.getRemarks()).setCreateDate(LocalDateTime.now()));
|
|
|
|
|
return Result.success(null, "操作完成");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "部门列表")
|
|
|
|
@ -149,7 +151,7 @@ public class UserController {
|
|
|
|
|
return Result.success(qywxDepartmentService.list(MybatisPlusUtil.SetPage(obj)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "刷新企业部门信息",description = "当企业微信架构改动更新时,需手动触发同步信息")
|
|
|
|
|
@Operation(summary = "刷新企业部门信息", description = "当企业微信架构改动更新时,需手动触发同步信息")
|
|
|
|
|
@PostMapping("/departmentRefresh")
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public Result departmentRefresh() {
|
|
|
|
@ -195,7 +197,7 @@ public class UserController {
|
|
|
|
|
@PostMapping("/delDepartmentGroup")
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public Result delDepartmentGroup(@Validated @RequestBody DelDGParam param) {
|
|
|
|
|
return MybatisPlusUtil.sqlResult(qywxDepartmentGroupService.removeById(param.getId()),"删除");
|
|
|
|
|
return MybatisPlusUtil.sqlResult(qywxDepartmentGroupService.removeById(param.getId()), "删除");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
@ -214,8 +216,8 @@ public class UserController {
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public Result departmentGroup(@Validated @RequestBody UpdDGParam param) {
|
|
|
|
|
UpdateWrapper<QywxDepartmentGroup> up = new UpdateWrapper<>();
|
|
|
|
|
up.eq("id",param.getId()).set("name",param.getName()).set("updateAt",LocalDateTime.now());
|
|
|
|
|
return MybatisPlusUtil.sqlResult(qywxDepartmentGroupService.update(up),"修改");
|
|
|
|
|
up.eq("id", param.getId()).set("name", param.getName()).set("updateAt", LocalDateTime.now());
|
|
|
|
|
return MybatisPlusUtil.sqlResult(qywxDepartmentGroupService.update(up), "修改");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
@ -225,16 +227,16 @@ public class UserController {
|
|
|
|
|
@Schema(title = "部门级别id")
|
|
|
|
|
private Integer id;
|
|
|
|
|
@NotNull(message = "部门id列表不能为空")
|
|
|
|
|
@Schema(title = "部门id列表",description = "格式为[1,...,2]")
|
|
|
|
|
@Schema(title = "部门id列表", description = "格式为[1,...,2]")
|
|
|
|
|
private List<Integer> departmentIdList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "部门级别添加部门",description = "批量添加部门id")
|
|
|
|
|
@Operation(summary = "部门级别添加部门", description = "批量添加部门id")
|
|
|
|
|
@PostMapping("/departmentGroupAdd")
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public Result departmentGroupAdd(@Validated @RequestBody dgAddParam param) {
|
|
|
|
|
qywxDepartmentGroupLinkService.groupAddDepartment(param.getId(),param.getDepartmentIdList(),LocalDateTime.now());
|
|
|
|
|
return Result.success("添加完成");
|
|
|
|
|
qywxDepartmentGroupLinkService.groupAddDepartment(param.getId(), param.getDepartmentIdList(), LocalDateTime.now());
|
|
|
|
|
return Result.success("添加完成");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "部门级别详情")
|
|
|
|
@ -251,13 +253,13 @@ public class UserController {
|
|
|
|
|
return Result.success(qywxDepartmentGroupLinkService.departmentList2(param.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "部门级别删除部门",description = "批量删除部门id")
|
|
|
|
|
@Operation(summary = "部门级别删除部门", description = "批量删除部门id")
|
|
|
|
|
@PostMapping("/departmentGroupDel")
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public Result departmentGroupDel(@Validated @RequestBody dgAddParam param) {
|
|
|
|
|
QueryWrapper<QywxDepartmentGroupLink> qw = new QueryWrapper<>();
|
|
|
|
|
qw.eq("groupId",param.getId());
|
|
|
|
|
qw.in("departmentId",param.getDepartmentIdList());
|
|
|
|
|
qw.eq("groupId", param.getId());
|
|
|
|
|
qw.in("departmentId", param.getDepartmentIdList());
|
|
|
|
|
qywxDepartmentGroupLinkService.remove(qw);
|
|
|
|
|
return Result.success("删除完成");
|
|
|
|
|
}
|
|
|
|
|