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> queryPage(@RequestBody SysUserLinkPtlAgreementVo sysUserLinkPtlAgreementVo) { try{ BasePageResult result = sysUserLinkPtlAgreementService.queryPage(sysUserLinkPtlAgreementVo); return HttpResult.ok("查询数据成功", result); }catch (Exception e){ return HttpResult.error("查询错误"+e.getMessage()); } } @PostMapping("addOrUpdate") @ApiOperation("后线人员关联协议添加修改") public HttpResult 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 addOrUpdateAll(@PathVariable("userId") String userId) { AssertionUtils.isFail(StringUtils.isBlank(userId),"后线人员id不能为空!"); sysUserLinkPtlAgreementService.addOrUpdateAll(userId,getUser()); return HttpResult.ok(); } @PostMapping("delete") @ApiOperation("后线人员关联协议删除") public HttpResult 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 findUserList(String userId) { try{ List 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 findPtlAgreementList() { try{ List 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 findPtlAgreementListNew(String type) { try{ List 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> findPtlAgreementListByUserId(@PathVariable("userId") String userId) { if(userId==null || "".equals(userId)) { return HttpResult.error("后线人员id不能为空"); } try{ //List result = sysUserLinkPtlAgreementService.findPtlAgreementListByUserId(userId); List 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> findUserList(@RequestBody SysUserDto sysUserDto) { try{ BasePageResult 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> findPtlAgreementPageListByUserId(@RequestBody SysUserLinkPtlAgreementQueryDto sysUserLinkPtlAgreementQueryDto) { if(StringUtils.isBlank(sysUserLinkPtlAgreementQueryDto.getUserId())) { return HttpResult.error("后线人员id不能为空"); } try{ BasePageResult result= sysUserLinkPtlAgreementService.findPtlAgreementPageListByUserId(sysUserLinkPtlAgreementQueryDto); return HttpResult.ok(result); }catch (Exception e){ return HttpResult.error("查询失败"+e.getMessage()); } } }