|
|
@@ -0,0 +1,117 @@
|
|
|
+package com.ydtech.modules.admin.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.ydtech.core.page.HttpResult;
|
|
|
+import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
|
|
|
+import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
|
|
|
+import com.ydtech.modules.admin.model.vo.SysUserLinkPtlAgreementAddVo;
|
|
|
+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 io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+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("delete")
|
|
|
+ @ApiOperation("前线人员关联协议删除")
|
|
|
+ @ApiImplicitParam(name = "ids", value = "关联协议ids数组", required = true)
|
|
|
+ public HttpResult<Object> delete(@RequestParam("ids") List<Long> ids) {
|
|
|
+ if(ids==null || ids.size()==0){
|
|
|
+ return HttpResult.error("前线人员关联ids不能为空");
|
|
|
+ }
|
|
|
+ try{
|
|
|
+ sysUserLinkPtlAgreementService.deleteByIds(ids);
|
|
|
+ return HttpResult.ok("删除成功");
|
|
|
+ }catch (Exception e){
|
|
|
+ return HttpResult.error("删除失败"+e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("findUserList")
|
|
|
+ @ApiOperation("查询所有的前线人员列表")
|
|
|
+ public HttpResult<Object> findUserList() {
|
|
|
+ try{
|
|
|
+ List<SysUserBaseVO> list= sysUserLinkPtlAgreementService.findUserList();
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/findPtlAgreementListByUserId/{userId}")
|
|
|
+ @ApiOperation(value = "前线人员关联协议列表")
|
|
|
+ @ApiImplicitParam(name = "userId", value = "前线人员id", required = true)
|
|
|
+ public HttpResult<List<SysUserLinkPtlAgreementDto>> findPtlAgreementListByUserId(@PathVariable("userId") String userId) {
|
|
|
+ if(userId==null || "".equals(userId)) {
|
|
|
+ return HttpResult.error("前线人员id不能为空");
|
|
|
+ }
|
|
|
+ try{
|
|
|
+ List<SysUserLinkPtlAgreementDto> result = sysUserLinkPtlAgreementService.findPtlAgreementListByUserId(userId);
|
|
|
+ return HttpResult.ok(result);
|
|
|
+ }catch (Exception e){
|
|
|
+ return HttpResult.error("查询失败"+e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|