班组管理

This commit is contained in:
jjLv 2024-07-22 10:09:57 +08:00
parent bb582c76c2
commit 20771acd03
3 changed files with 439 additions and 0 deletions

View File

@ -0,0 +1,151 @@
package com.bonus.aqgqj.basis.controller;
import com.bonus.aqgqj.annotation.DecryptAndVerify;
import com.bonus.aqgqj.annotation.LogAnnotation;
import com.bonus.aqgqj.basis.dao.CustomDao;
import com.bonus.aqgqj.basis.service.CustomService;
import com.bonus.aqgqj.basis.entity.vo.BaseCustom;
import com.bonus.aqgqj.model.SysUser;
import com.bonus.aqgqj.system.vo.EncryptedReq;
import com.bonus.aqgqj.system.vo.UserDto;
import com.bonus.aqgqj.task.entity.TaskVo;
import com.bonus.aqgqj.utils.ServerResponse;
import com.bonus.aqgqj.utils.StringHelper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 用户相关接口
*/
@Api(tags = "用户")
@RestController
@RequestMapping("/customs/")
public class CustomController {
private static final Logger log = LoggerFactory.getLogger("adminLogger");
@Autowired
private CustomService customService;
@Resource
private CustomDao customDao;
@PostMapping(value = "getList")
@DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-客户管理", operation = "查询用列表", operDesc = "系统级事件",operType="查询")
@PreAuthorize("@pms.hasPermission('base:custom:query')" )
public ServerResponse listCustoms(EncryptedReq<BaseCustom> data) {
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
try {
List<BaseCustom> list = customService.list(data.getData());
PageInfo<BaseCustom> pageInfo = new PageInfo<>(list);
return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit());
} catch (Exception e) {
log.error(e.toString(),e);
}
return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit());
}
@PostMapping(value = "getCustomId")
@DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
@PreAuthorize("@pms.hasPermission('base:custom:query')" )
public ServerResponse getCustomId(EncryptedReq<BaseCustom> data) {
return customService.getCustomId(data.getData());
}
// @PostMapping(value = "addCustom")
// @DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
// @LogAnnotation(operModul = "系统管理-任务管理", operation = "新增任务", operDesc = "业务级事件",operType="新增")
// @PreAuthorize("@pms.hasPermission('sys:task:update')")
// public ServerResponse addCustom(EncryptedReq<BaseCustom> data) {
// return customService.addCustom(data.getData());
// }
@PostMapping(value = "updateCustom")
@DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-客户管理", operation = "修改客户", operDesc = "系统级事件",operType="修改")
@PreAuthorize("@pms.hasPermission('base:custom:add')")
public ServerResponse updateCustom(EncryptedReq<BaseCustom> data) {
try {
// int status = data.getData().getCustomStatus();
BaseCustom u = customService.getCustom(data.getData().getCustomName(),data.getData().getCustomId());
if (u != null) {
return ServerResponse.createErroe("客户名称 “"+data.getData().getCustomName() + "” 已存在");
}
// if(StringHelper.isNotEmpty(data.getData().getCustomPhone())){
// BaseCustom u2 = customService.getCustomPhone(data.getData().getCustomPhone(),data.getData().getCustomId());
// if (u2 != null ) {
// return ServerResponse.createErroe("手机号"+data.getData().getCustomPhone() + "已存在");
// }
// }
customService.updateCustom(data.getData());
return ServerResponse.createBySuccessMsg("操作成功");
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("操作失败");
}
@PostMapping(value = "addCustom")
@DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-客户管理", operation = "新增客户", operDesc = "系统级事件",operType="新增")
@PreAuthorize("@pms.hasPermission('base:custom:add')")
public ServerResponse addCustom(EncryptedReq<BaseCustom> data) {
try {
BaseCustom u = customService.getAdd(data.getData().getCustomName());
if (u != null) {
return ServerResponse.createErroe("客户名称 “"+data.getData().getCustomName() + "” 已存在");
}
customService.add(data.getData());
return ServerResponse.createBySuccessMsg("操作成功");
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("操作失败");
}
@PostMapping(value = "delById")
@DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-客户管理", operation = "注销客户", operDesc = "系统级事件",operType="删除")
@PreAuthorize("@pms.hasPermission('base:custom:del')")
public ServerResponse delCustom(EncryptedReq<BaseCustom> data) {
try {
if (customService.delCustom(data.getData().getCustomId())== 1){
return ServerResponse.createBySuccessMsg("注销成功");
}else {
return ServerResponse.createErroe("注销失败");
}
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("操作失败");
}
@PostMapping(value = "updateCustomStatus")
@DecryptAndVerify(decryptedClass = BaseCustom.class)
@LogAnnotation(operModul = "基础管理-客户管理", operation = "修改状态", operDesc = "业务级事件",operType="查询")
@PreAuthorize("@pms.hasPermission('base:custom:update')" )
public ServerResponse updaetCustomStatus(EncryptedReq<BaseCustom> data){
try{
return customService.updateCustomStatus(data.getData());
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("参数异常,请稍后重试");
}
}

View File

@ -0,0 +1,152 @@
package com.bonus.aqgqj.basis.controller;
import com.bonus.aqgqj.annotation.DecryptAndVerify;
import com.bonus.aqgqj.annotation.LogAnnotation;
import com.bonus.aqgqj.basis.dao.CustomDao;
import com.bonus.aqgqj.basis.dao.TeamConfigDao;
import com.bonus.aqgqj.basis.entity.vo.BaseTeam;
import com.bonus.aqgqj.basis.entity.vo.BaseTeamConfig;
import com.bonus.aqgqj.basis.entity.vo.BaseTeamConfigDto;
import com.bonus.aqgqj.basis.entity.vo.BaseTeamDto;
import com.bonus.aqgqj.basis.service.TeamConfigService;
import com.bonus.aqgqj.basis.service.TeamService;
import com.bonus.aqgqj.model.Role;
import com.bonus.aqgqj.system.vo.EncryptedReq;
import com.bonus.aqgqj.utils.ServerResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* 用户相关接口
*/
@Api(tags = "用户")
@RestController
@RequestMapping("/teamconfigs/")
public class TeamConfigController {
private static final Logger log = LoggerFactory.getLogger("adminLogger");
@Autowired
private TeamConfigService teamconfigService;
@Resource
private TeamConfigDao teamconfigDao;
@PostMapping(value = "getList")
@DecryptAndVerify(decryptedClass = BaseTeamConfigDto.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-班组成员配置", operation = "查询用列表", operDesc = "系统级事件",operType="查询")
@PreAuthorize("@pms.hasPermission('base:teamconfig:query')" )
public ServerResponse listTeams(EncryptedReq<BaseTeamConfigDto> data) {
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
try {
List<BaseTeamConfig> list = teamconfigService.list(String.valueOf(data.getData().getKeyWord()),data.getData().getTeamId());
PageInfo<BaseTeamConfig> pageInfo = new PageInfo<>(list);
return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit());
} catch (Exception e) {
log.error(e.toString(),e);
}
return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit());
}
//
// @PostMapping(value = "getTeamId")
// @DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理
// @PreAuthorize("@pms.hasPermission('base:team:query')" )
// public ServerResponse getTeamId(EncryptedReq<BaseTeam> data) {
// return teamService.getTeamId(data.getData());
// }
//// @PostMapping(value = "addCustom")
//// @DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
//// @LogAnnotation(operModul = "系统管理-任务管理", operation = "新增任务", operDesc = "业务级事件",operType="新增")
//// @PreAuthorize("@pms.hasPermission('sys:task:update')")
//// public ServerResponse addCustom(EncryptedReq<BaseCustom> data) {
//// return customService.addCustom(data.getData());
//// }
//
//
// @PostMapping(value = "updateTeam")
// @DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理
// @LogAnnotation(operModul = "基础管理-班组管理", operation = "修改班组", operDesc = "系统级事件",operType="修改")
// @PreAuthorize("@pms.hasPermission('base:team:add')")
// public ServerResponse updateTeam(EncryptedReq<BaseTeam> data) {
// try {
// // int status = data.getData().getCustomStatus();
// BaseTeam u = teamService.getTeam(data.getData().getTeamName(),data.getData().getTeamId());
// if (u != null) {
// return ServerResponse.createErroe("班组名称 “"+data.getData().getTeamName() + "” 已存在");
// }
// if(StringHelper.isNotEmpty(data.getData().getCustomPhone())){
// BaseCustom u2 = customService.getCustomPhone(data.getData().getCustomPhone(),data.getData().getCustomId());
// if (u2 != null ) {
// return ServerResponse.createErroe("手机号"+data.getData().getCustomPhone() + "已存在");
// }
// }
// teamService.updateTeam(data.getData());
// return ServerResponse.createBySuccessMsg("操作成功");
// }catch (Exception e){
// log.error(e.toString(),e);
// }
// return ServerResponse.createErroe("操作失败");
// }
// @PostMapping(value = "addTeam")
// @DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理
// @LogAnnotation(operModul = "基础管理-班组管理", operation = "新增班组", operDesc = "系统级事件",operType="新增")
// @PreAuthorize("@pms.hasPermission('base:team:add')")
// public ServerResponse addTeam(EncryptedReq<BaseTeam> data) {
// try {
// BaseTeam u = teamService.getAdd(data.getData().getTeamName());
// if (u != null) {
// return ServerResponse.createErroe("客户名称 “"+data.getData().getTeamName() + "” 已存在");
// }
// teamService.add(data.getData());
// return ServerResponse.createBySuccessMsg("操作成功");
// }catch (Exception e){
// log.error(e.toString(),e);
// }
// return ServerResponse.createErroe("操作失败");
// }
//
// @PostMapping(value = "delById")
// @DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理
// @LogAnnotation(operModul = "基础管理-客户管理", operation = "注销客户", operDesc = "系统级事件",operType="删除")
// @PreAuthorize("@pms.hasPermission('base:team:del')")
// public ServerResponse delTeam(EncryptedReq<BaseTeam> data) {
// try {
// if (teamService.delTeam(data.getData().getTeamId())== 1){
// return ServerResponse.createBySuccessMsg("注销成功");
// }else {
// return ServerResponse.createErroe("注销失败");
// }
// }catch (Exception e){
// log.error(e.toString(),e);
// }
// return ServerResponse.createErroe("操作失败");
// }
@PostMapping(value = "all")
@LogAnnotation(operModul = "班组成员配置", operation = "查询所有班组", operDesc = "系统级事件",operType="查询")
@PreAuthorize("@pms.hasPermission('base:teamconfig:query')" )
public ServerResponse getAll() {
try {
List<BaseTeam> list = teamconfigService.teamList("");
return ServerResponse.createSuccess(list);
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("操作失败");
}
}

View File

@ -0,0 +1,136 @@
package com.bonus.aqgqj.basis.controller;
import com.bonus.aqgqj.annotation.DecryptAndVerify;
import com.bonus.aqgqj.annotation.LogAnnotation;
import com.bonus.aqgqj.basis.dao.CustomDao;
import com.bonus.aqgqj.basis.entity.vo.BaseCustom;
import com.bonus.aqgqj.basis.entity.vo.BaseTeam;
import com.bonus.aqgqj.basis.entity.vo.BaseTeamDto;
import com.bonus.aqgqj.basis.service.CustomService;
import com.bonus.aqgqj.basis.service.TeamService;
import com.bonus.aqgqj.system.vo.EncryptedReq;
import com.bonus.aqgqj.utils.ServerResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* 用户相关接口
*/
@Api(tags = "用户")
@RestController
@RequestMapping("/teams/")
public class TeamController {
private static final Logger log = LoggerFactory.getLogger("adminLogger");
@Autowired
private TeamService teamService;
@Resource
private CustomDao customDao;
@PostMapping(value = "getList")
@DecryptAndVerify(decryptedClass = BaseTeamDto.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-客户管理", operation = "查询用列表", operDesc = "系统级事件",operType="查询")
@PreAuthorize("@pms.hasPermission('base:team:query')" )
public ServerResponse listTeams(EncryptedReq<BaseTeamDto> data) {
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
try {
List<BaseTeam> list = teamService.list(String.valueOf(data.getData().getKeyWord()));
PageInfo<BaseTeam> pageInfo = new PageInfo<>(list);
return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit());
} catch (Exception e) {
log.error(e.toString(),e);
}
return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit());
}
@PostMapping(value = "getTeamId")
@DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理
@PreAuthorize("@pms.hasPermission('base:team:query')" )
public ServerResponse getTeamId(EncryptedReq<BaseTeam> data) {
return teamService.getTeamId(data.getData());
}
//// @PostMapping(value = "addCustom")
//// @DecryptAndVerify(decryptedClass = BaseCustom.class)//加解密统一管理
//// @LogAnnotation(operModul = "系统管理-任务管理", operation = "新增任务", operDesc = "业务级事件",operType="新增")
//// @PreAuthorize("@pms.hasPermission('sys:task:update')")
//// public ServerResponse addCustom(EncryptedReq<BaseCustom> data) {
//// return customService.addCustom(data.getData());
//// }
//
//
@PostMapping(value = "updateTeam")
@DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-班组管理", operation = "修改班组", operDesc = "系统级事件",operType="修改")
@PreAuthorize("@pms.hasPermission('base:team:add')")
public ServerResponse updateTeam(EncryptedReq<BaseTeam> data) {
try {
// int status = data.getData().getCustomStatus();
BaseTeam u = teamService.getTeam(data.getData().getTeamName(),data.getData().getTeamId());
if (u != null) {
return ServerResponse.createErroe("班组名称 “"+data.getData().getTeamName() + "” 已存在");
}
// if(StringHelper.isNotEmpty(data.getData().getCustomPhone())){
// BaseCustom u2 = customService.getCustomPhone(data.getData().getCustomPhone(),data.getData().getCustomId());
// if (u2 != null ) {
// return ServerResponse.createErroe("手机号"+data.getData().getCustomPhone() + "已存在");
// }
// }
teamService.updateTeam(data.getData());
return ServerResponse.createBySuccessMsg("操作成功");
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("操作失败");
}
@PostMapping(value = "addTeam")
@DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-班组管理", operation = "新增班组", operDesc = "系统级事件",operType="新增")
@PreAuthorize("@pms.hasPermission('base:team:add')")
public ServerResponse addTeam(EncryptedReq<BaseTeam> data) {
try {
BaseTeam u = teamService.getAdd(data.getData().getTeamName());
if (u != null) {
return ServerResponse.createErroe("客户名称 “"+data.getData().getTeamName() + "” 已存在");
}
teamService.add(data.getData());
return ServerResponse.createBySuccessMsg("操作成功");
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("操作失败");
}
@PostMapping(value = "delById")
@DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-客户管理", operation = "注销客户", operDesc = "系统级事件",operType="删除")
@PreAuthorize("@pms.hasPermission('base:team:del')")
public ServerResponse delTeam(EncryptedReq<BaseTeam> data) {
try {
if (teamService.delTeam(data.getData().getTeamId())== 1){
return ServerResponse.createBySuccessMsg("注销成功");
}else {
return ServerResponse.createErroe("注销失败");
}
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createErroe("操作失败");
}
}