|
@@ -2,18 +2,23 @@ package com.ydtech.modules.admin.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
|
|
+import com.ydtech.modules.admin.dao.SysUserMapper;
|
|
|
import com.ydtech.modules.admin.model.SysDept;
|
|
import com.ydtech.modules.admin.model.SysDept;
|
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
|
|
|
+import com.ydtech.modules.admin.model.dto.SysUserDto;
|
|
|
import com.ydtech.modules.admin.model.po.SysOrganizationQuotation;
|
|
import com.ydtech.modules.admin.model.po.SysOrganizationQuotation;
|
|
|
import com.ydtech.modules.admin.model.po.SysQuotationTheme;
|
|
import com.ydtech.modules.admin.model.po.SysQuotationTheme;
|
|
|
import com.ydtech.modules.admin.model.vo.SysQuotationThemeVo;
|
|
import com.ydtech.modules.admin.model.vo.SysQuotationThemeVo;
|
|
|
|
|
+import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
|
|
|
import com.ydtech.modules.admin.service.SysDeptService;
|
|
import com.ydtech.modules.admin.service.SysDeptService;
|
|
|
import com.ydtech.modules.admin.service.SysOrganizationQuotationService;
|
|
import com.ydtech.modules.admin.service.SysOrganizationQuotationService;
|
|
|
import com.ydtech.modules.admin.service.SysQuotationThemeService;
|
|
import com.ydtech.modules.admin.service.SysQuotationThemeService;
|
|
|
import com.ydtech.modules.admin.service.SysUserService;
|
|
import com.ydtech.modules.admin.service.SysUserService;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
|
|
+import com.ydtech.modules.base.model.dto.PageDto;
|
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -41,9 +46,6 @@ public class SysQuotationController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SysUserService sysUserService;
|
|
private SysUserService sysUserService;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private SysDeptService sysDeptService;
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "分页查询报价单")
|
|
@ApiOperation(value = "分页查询报价单")
|
|
|
@PostMapping(value = "page")
|
|
@PostMapping(value = "page")
|
|
@@ -98,87 +100,50 @@ public class SysQuotationController extends BaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- @ApiOperation(value = "获取树结构")
|
|
|
|
|
- @GetMapping(value = "/findTree")
|
|
|
|
|
- public HttpResult<List<SysDept>> findTree(String deptId, String managementSource) {
|
|
|
|
|
- //获取主题报价单关联数据
|
|
|
|
|
- List<SysOrganizationQuotation> quotations = sysOrganizationQuotationService.list();
|
|
|
|
|
- //获取主题数据
|
|
|
|
|
- List<SysQuotationTheme> quotationThemes = sysQuotationThemeService.list();
|
|
|
|
|
- //获取机构数据
|
|
|
|
|
- List<SysDept> Depts = sysDeptService.findTree(deptId, managementSource);
|
|
|
|
|
- List<SysDept> DeptList = sysOrganizationQuotationService.findTree(quotations, quotationThemes, Depts);
|
|
|
|
|
- return HttpResult.ok(DeptList);
|
|
|
|
|
|
|
+ @ApiOperation(value = "用户查询分页")
|
|
|
|
|
+ @PostMapping(value = "/findUserList")
|
|
|
|
|
+ public HttpResult findUserList(@RequestBody PageDto<SysUserDto> pageDto) {
|
|
|
|
|
+ if (pageDto.getDto().getDeptId() == null) {
|
|
|
|
|
+ BaseController baseController = new BaseController();
|
|
|
|
|
+ pageDto.getDto().setDeptId(baseController.getDeptId());
|
|
|
|
|
+ }
|
|
|
|
|
+ IPage<SysUserBaseVO> userList = sysUserService.findUserList(pageDto);
|
|
|
|
|
+ if (userList.getRecords().size() != 0) {
|
|
|
|
|
+ sysOrganizationQuotationService.findUserList(userList);
|
|
|
|
|
+ }
|
|
|
|
|
+ return HttpResult.ok(userList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- @ApiOperation(value = "报价单授权批量编辑")
|
|
|
|
|
- @PostMapping(value = "/batch")
|
|
|
|
|
- public HttpResult<SysOrganizationQuotation> batch(@RequestBody SysOrganizationQuotation sysOrganizationQuotation) {
|
|
|
|
|
- if (sysOrganizationQuotation.getOrganizationIds().size() == 0) {
|
|
|
|
|
- return HttpResult.error("编辑失败,未选中修改机构");
|
|
|
|
|
|
|
+ @ApiOperation(value = "报价单配置")
|
|
|
|
|
+ @PostMapping(value = "/config")
|
|
|
|
|
+ public HttpResult<SysOrganizationQuotation> config(@RequestBody SysOrganizationQuotation sysOrganizationQuotation) {
|
|
|
|
|
+ if (sysOrganizationQuotation.getAuthorizationIds().size() == 0) {
|
|
|
|
|
+ return HttpResult.error("配置失败,未选中用户");
|
|
|
}
|
|
}
|
|
|
- // 构造查询条件,根据提供的组织ID集合查询出对应的报价单授权信息,然后进行删除
|
|
|
|
|
|
|
+ // 构造查询条件,根据提供的用户ID集合查询出对应的报价单授权信息,然后进行删除
|
|
|
LambdaQueryWrapper<SysOrganizationQuotation> removeWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<SysOrganizationQuotation> removeWrapper = new LambdaQueryWrapper<>();
|
|
|
- removeWrapper.in(SysOrganizationQuotation::getOrganizationId, sysOrganizationQuotation.getOrganizationIds());
|
|
|
|
|
|
|
+ removeWrapper.in(SysOrganizationQuotation::getAuthorizationId, sysOrganizationQuotation.getAuthorizationIds());
|
|
|
sysOrganizationQuotationService.remove(removeWrapper);
|
|
sysOrganizationQuotationService.remove(removeWrapper);
|
|
|
- List<String> organizationIds = sysOrganizationQuotation.getOrganizationIds();
|
|
|
|
|
- // 遍历组织ID集合,为每个组织ID构造新的报价单授权信息,并添加到待保存的列表中
|
|
|
|
|
- ArrayList<SysOrganizationQuotation> quotations = new ArrayList<>();
|
|
|
|
|
- for (String organizationId : organizationIds) {
|
|
|
|
|
- SysOrganizationQuotation quotation = new SysOrganizationQuotation();
|
|
|
|
|
- quotation.setOrganizationId(organizationId);
|
|
|
|
|
- quotation.setThemeId(sysOrganizationQuotation.getThemeId());
|
|
|
|
|
- quotation.setThemeCode(sysOrganizationQuotation.getThemeCode());
|
|
|
|
|
- quotation.setUserId(getUserId());
|
|
|
|
|
- quotation.setCreateTime(new Date());
|
|
|
|
|
- quotations.add(quotation);
|
|
|
|
|
|
|
+ List<String> authorizationIds = sysOrganizationQuotation.getAuthorizationIds();
|
|
|
|
|
+ List<String> themecodes = sysOrganizationQuotation.getThemecodes();
|
|
|
|
|
+ // 遍历用户ID集合,为每个用户ID构造新的报价单授权信息,并添加到待保存的列表中
|
|
|
|
|
+ List<SysOrganizationQuotation> quotations = new ArrayList<>();
|
|
|
|
|
+ for (String authorizationId : authorizationIds) {
|
|
|
|
|
+ for (String themecode : themecodes) {
|
|
|
|
|
+ SysOrganizationQuotation quotation = new SysOrganizationQuotation();
|
|
|
|
|
+ quotation.setAuthorizationId(authorizationId);
|
|
|
|
|
+ quotation.setThemeCode(themecode);
|
|
|
|
|
+ quotation.setUserId(getUserId());
|
|
|
|
|
+ quotation.setCreateTime(new Date());
|
|
|
|
|
+ quotations.add(quotation);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
// 批量保存新的报价单授权信息
|
|
// 批量保存新的报价单授权信息
|
|
|
boolean saveBatch = sysOrganizationQuotationService.saveBatch(quotations);
|
|
boolean saveBatch = sysOrganizationQuotationService.saveBatch(quotations);
|
|
|
// 断言添加操作成功,若失败则抛出异常
|
|
// 断言添加操作成功,若失败则抛出异常
|
|
|
- AssertionUtils.isSucceed(saveBatch, "添加失败");
|
|
|
|
|
- return HttpResult.ok("添加成功");
|
|
|
|
|
|
|
+ AssertionUtils.isSucceed(saveBatch, "配置失败");
|
|
|
|
|
+ return HttpResult.ok("配置成功");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @ApiOperation(value = "报价单授权编辑")
|
|
|
|
|
- @PostMapping(value = "/redact")
|
|
|
|
|
- public HttpResult<SysOrganizationQuotation> redact(@RequestBody SysOrganizationQuotation sysOrganizationQuotation) {
|
|
|
|
|
- // 构造查询条件,删除与新报价单组织ID相同的旧报价单
|
|
|
|
|
- LambdaQueryWrapper<SysOrganizationQuotation> removeWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- removeWrapper.eq(SysOrganizationQuotation::getOrganizationId, sysOrganizationQuotation.getOrganizationId());
|
|
|
|
|
- sysOrganizationQuotationService.remove(removeWrapper);
|
|
|
|
|
- // 设置新报价单信息,包括用户ID和创建时间
|
|
|
|
|
- sysOrganizationQuotation.setUserId(getUserId());
|
|
|
|
|
- sysOrganizationQuotation.setCreateTime(new Date());
|
|
|
|
|
- // 保存新的报价单信息
|
|
|
|
|
- boolean save = sysOrganizationQuotationService.save(sysOrganizationQuotation);
|
|
|
|
|
- // 断言新增操作成功
|
|
|
|
|
- AssertionUtils.isSucceed(save, "添加失败");
|
|
|
|
|
- return HttpResult.ok("添加成功");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation(value = "报价单授权编辑回填")
|
|
|
|
|
- @GetMapping(value = "/get/{id}")
|
|
|
|
|
- public HttpResult<SysOrganizationQuotation> getSysOrganizationQuotation(@PathVariable String id) {
|
|
|
|
|
- LambdaQueryWrapper<SysOrganizationQuotation> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- queryWrapper.eq(SysOrganizationQuotation::getOrganizationId, id);
|
|
|
|
|
- SysOrganizationQuotation serviceOne = sysOrganizationQuotationService.getOne(queryWrapper);
|
|
|
|
|
- return HttpResult.ok(serviceOne);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation(value = "获取用户对应报价单")
|
|
|
|
|
- @GetMapping(value = "/getThemeByUserId")
|
|
|
|
|
- public HttpResult<SysOrganizationQuotation> getThemeByUserId() {
|
|
|
|
|
- SysUser user = getUser();
|
|
|
|
|
- String deptId = user.getDeptId();
|
|
|
|
|
- LambdaQueryWrapper<SysOrganizationQuotation> oQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- oQueryWrapper.eq(SysOrganizationQuotation::getOrganizationId, deptId);
|
|
|
|
|
- SysOrganizationQuotation quotationServiceOne = sysOrganizationQuotationService.getOne(oQueryWrapper);
|
|
|
|
|
- if (quotationServiceOne == null) {
|
|
|
|
|
- quotationServiceOne = new SysOrganizationQuotation();
|
|
|
|
|
- quotationServiceOne.setThemeCode("QD");
|
|
|
|
|
- }
|
|
|
|
|
- return HttpResult.ok(quotationServiceOne);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|