| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- package com.ydtech.modules.admin.controller;
- import com.ydtech.core.page.HttpResult;
- import com.ydtech.modules.admin.model.dto.SysUserDto;
- import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
- import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementQueryDto;
- import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
- import com.ydtech.modules.admin.model.vo.SysUserLinkPtlAgreementAddVo;
- import com.ydtech.modules.admin.model.vo.SysUserLinkPtlAgreementIdsVo;
- import com.ydtech.modules.admin.model.vo.SysUserLinkPtlAgreementVo;
- import com.ydtech.modules.admin.service.SysUserLinkPtlAgreementService;
- import com.ydtech.modules.base.controller.BaseController;
- import com.ydtech.modules.order.entity.BasePageResult;
- import com.ydtech.modules.protocol.entity.po.PtlAgreement;
- import com.ydtech.modules.protocol.utils.AssertionUtils;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiOperation;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- @Api(tags = "后线人员关联协议")
- @RequestMapping("/sysUserLinkPtlAgreement")
- @RestController
- public class SysUserLinkPtlAgreementController extends BaseController {
- @Autowired
- private SysUserLinkPtlAgreementService sysUserLinkPtlAgreementService;
- @PostMapping("queryPage")
- @ApiOperation(value = "后线人员关联协议分页")
- public HttpResult<BasePageResult<SysUserLinkPtlAgreementDto>> queryPage(@RequestBody SysUserLinkPtlAgreementVo sysUserLinkPtlAgreementVo) {
- try{
- BasePageResult<SysUserLinkPtlAgreementDto> result = sysUserLinkPtlAgreementService.queryPage(sysUserLinkPtlAgreementVo);
- return HttpResult.ok("查询数据成功", result);
- }catch (Exception e){
- return HttpResult.error("查询错误"+e.getMessage());
- }
- }
- @PostMapping("addOrUpdate")
- @ApiOperation("后线人员关联协议添加修改")
- public HttpResult<Object> addOrUpdate(@RequestBody SysUserLinkPtlAgreementAddVo sysUserLinkPtlAgreementAddVo) {
- if(sysUserLinkPtlAgreementAddVo.getUserId()==null || "".equals(sysUserLinkPtlAgreementAddVo.getUserId())) {
- return HttpResult.error("后线人员id不能为空");
- }
- if(sysUserLinkPtlAgreementAddVo.getPtlAgreementIds()==null || sysUserLinkPtlAgreementAddVo.getPtlAgreementIds().size()==0) {
- return HttpResult.error("协议ids不能为空");
- }
- try{
- sysUserLinkPtlAgreementService.addOrUpdate(sysUserLinkPtlAgreementAddVo,getUser());
- return HttpResult.ok("操作成功");
- }catch (Exception e){
- return HttpResult.error("操作失败"+e.getMessage());
- }
- }
- @PostMapping("addOrUpdateAll/{userId}")
- @ApiOperation("后线人员关联协议全部添加修改")
- public HttpResult<Object> addOrUpdateAll(@PathVariable("userId") String userId) {
- AssertionUtils.isFail(StringUtils.isBlank(userId),"后线人员id不能为空!");
- sysUserLinkPtlAgreementService.addOrUpdateAll(userId,getUser());
- return HttpResult.ok();
- }
- @PostMapping("delete")
- @ApiOperation("后线人员关联协议删除")
- public HttpResult<Object> delete(@RequestBody SysUserLinkPtlAgreementIdsVo idsVo) {
- if(idsVo.getIds()==null || idsVo.getIds().size()==0){
- return HttpResult.error("后线人员关联ids不能为空");
- }
- try{
- sysUserLinkPtlAgreementService.deleteByIds(idsVo.getIds());
- return HttpResult.ok("删除成功");
- }catch (Exception e){
- return HttpResult.error("删除失败"+e.getMessage());
- }
- }
- @GetMapping("findUserList")
- @ApiOperation("查询所有的后线人员列表")
- @ApiImplicitParam(name = "userId", value = "后线人员工号", required = false)
- public HttpResult<Object> findUserList(String userId) {
- try{
- List<SysUserBaseVO> list= sysUserLinkPtlAgreementService.findUserList(userId);
- return HttpResult.ok(list);
- }catch (Exception e){
- return HttpResult.error("操作失败"+e.getMessage());
- }
- }
- /**
- * @version
- * @author: hxl
- * @Date: 2024/4/15 17:54
- * @Description: 查询审核的所有协议
- */
- @GetMapping("findPtlAgreementList")
- @ApiOperation("查询所有审核协议列表")
- public HttpResult<Object> findPtlAgreementList() {
- try{
- List<PtlAgreement> list= sysUserLinkPtlAgreementService.findPtlAgreementList();
- return HttpResult.ok(list);
- }catch (Exception e){
- return HttpResult.error("操作失败"+e.getMessage());
- }
- }
- /**
- * @version
- * @author: whp
- * @Date: 2024/07/23
- * @Description: 查询审核的所有协议 协议名称拼接
- */
- @GetMapping("findPtlAgreementListNew")
- @ApiOperation("查询所有审核协议列表")
- public HttpResult<Object> findPtlAgreementListNew(String type) {
- try{
- List<PtlAgreement> list= sysUserLinkPtlAgreementService.findPtlAgreementListNew(type);
- return HttpResult.ok(list);
- }catch (Exception e){
- return HttpResult.error("操作失败"+e.getMessage());
- }
- }
- @GetMapping("/findPtlAgreementListByUserId/{userId}")
- @ApiOperation(value = "后线人员关联协议列表")
- @ApiImplicitParam(name = "userId", value = "后线人员id", required = true)
- public HttpResult<List<PtlAgreement>> findPtlAgreementListByUserId(@PathVariable("userId") String userId) {
- if(userId==null || "".equals(userId)) {
- return HttpResult.error("后线人员id不能为空");
- }
- try{
- //List<SysUserLinkPtlAgreementDto> result = sysUserLinkPtlAgreementService.findPtlAgreementListByUserId(userId);
- List<PtlAgreement> list= sysUserLinkPtlAgreementService.findAllPtlAgreementListByUserId(userId);
- return HttpResult.ok(list);
- }catch (Exception e){
- return HttpResult.error("查询失败"+e.getMessage());
- }
- }
- /**
- * @version
- * @author: hxl
- * @Date: 2024/4/23 11:44
- * @Description: 查询所有的后线人员列表+分页
- */
- @PostMapping("findAllUserList")
- @ApiOperation("查询所有的后线人员列表+分页")
- public HttpResult<BasePageResult<SysUserBaseVO>> findUserList(@RequestBody SysUserDto sysUserDto) {
- try{
- BasePageResult<SysUserBaseVO> result = sysUserLinkPtlAgreementService.findUserListByPage(sysUserDto);
- return HttpResult.ok("查询数据成功", result);
- }catch (Exception e){
- return HttpResult.error("查询错误"+e.getMessage());
- }
- }
- /**
- * @version
- * @author: hxl
- * @Date: 2024/7/2 11:20
- * @Description: 后线人员关联协议列表+分页
- */
- @PostMapping("/findPtlAgreementPageListByUserId")
- @ApiOperation(value = "后线人员关联协议列表+分页")
- public HttpResult<BasePageResult<PtlAgreement>> findPtlAgreementPageListByUserId(@RequestBody SysUserLinkPtlAgreementQueryDto sysUserLinkPtlAgreementQueryDto) {
- if(StringUtils.isBlank(sysUserLinkPtlAgreementQueryDto.getUserId())) {
- return HttpResult.error("后线人员id不能为空");
- }
- try{
- BasePageResult<PtlAgreement> result= sysUserLinkPtlAgreementService.findPtlAgreementPageListByUserId(sysUserLinkPtlAgreementQueryDto);
- return HttpResult.ok(result);
- }catch (Exception e){
- return HttpResult.error("查询失败"+e.getMessage());
- }
- }
- }
|