|
@@ -1,9 +1,12 @@
|
|
|
package com.fs.company.controller.qw;
|
|
|
|
|
|
import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.constant.HttpStatus;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
+import com.fs.common.core.page.PageDomain;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.common.core.page.TableSupport;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
@@ -25,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -73,16 +77,6 @@ public class QwUserVoiceLogController extends BaseController
|
|
|
@PostMapping("/newList")
|
|
|
public TableDataInfo newList(@RequestBody QwUserVoiceLogVo qwUserVoiceLog)
|
|
|
{
|
|
|
- if(qwUserVoiceLog.getCompanyUserId() == null && qwUserVoiceLog.getDeptId() != null){
|
|
|
- //获取部门下的所有用户
|
|
|
- CompanyUser usermap=new CompanyUser();
|
|
|
- usermap.setDeptId(qwUserVoiceLog.getDeptId());
|
|
|
- List<CompanyUser> users = userService.getUserListByDeptId(usermap);
|
|
|
- List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
|
|
|
- if (!userIds.isEmpty()) {
|
|
|
- qwUserVoiceLog.setCompanyUserIds(userIds.toArray(new Long[0]));
|
|
|
- }
|
|
|
- }
|
|
|
PageHelper.startPage(qwUserVoiceLog.getPageNum(), qwUserVoiceLog.getPageSize());
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
qwUserVoiceLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
@@ -154,34 +148,88 @@ public class QwUserVoiceLogController extends BaseController
|
|
|
@GetMapping("/totalList")
|
|
|
public TableDataInfo totalList(QwUserVoiceLogTotalVo qwUserVoiceLog)
|
|
|
{
|
|
|
- startPage();
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
qwUserVoiceLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
qwUserVoiceLog.setQwUserId(1L);
|
|
|
List<QwUserVoiceLogTotalVo> list = qwUserVoiceLogService.selectQwUserVoiceLogTotalList(qwUserVoiceLog);
|
|
|
- return getDataTable(list);
|
|
|
+ list.forEach(item->{
|
|
|
+ if(item.getQwExternalContact() != null){
|
|
|
+ if (item.getQwExternalContact().getTagIds() != null && !Objects.equals(item.getQwExternalContact().getTagIds(), "[]")) {
|
|
|
+ QwTagSearchParam param = new QwTagSearchParam();
|
|
|
+ Gson gson = new Gson();
|
|
|
+ List<String> tagIds = gson.fromJson(
|
|
|
+ item.getQwExternalContact().getTagIds(),
|
|
|
+ new TypeToken<List<String>>() {
|
|
|
+ }.getType()
|
|
|
+ );
|
|
|
+ param.setTagIds(tagIds);
|
|
|
+ item.setTagIdsName(iQwTagService.selectQwTagListByTagIds(param));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 获取分页参数
|
|
|
+ PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
+ Integer pageNum = pageDomain.getPageNum();
|
|
|
+ Integer pageSize = pageDomain.getPageSize();
|
|
|
+
|
|
|
+ int total = list.size();
|
|
|
+ // 在内存中进行分页处理
|
|
|
+ if (pageNum != null && pageSize != null) {
|
|
|
+ int fromIndex = (pageNum - 1) * pageSize;
|
|
|
+ int toIndex = Math.min(fromIndex + pageSize, total);
|
|
|
+
|
|
|
+ // 确保索引不越界
|
|
|
+ if (fromIndex < total) {
|
|
|
+ list = list.subList(fromIndex, toIndex);
|
|
|
+ } else {
|
|
|
+ list = new ArrayList<>(); // 返回空列表
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构造返回结果
|
|
|
+ TableDataInfo rspData = new TableDataInfo();
|
|
|
+ rspData.setCode(HttpStatus.SUCCESS);
|
|
|
+ rspData.setMsg("查询成功");
|
|
|
+ rspData.setRows(list);
|
|
|
+ rspData.setTotal(total);
|
|
|
+ return rspData;
|
|
|
}
|
|
|
|
|
|
|
|
|
@GetMapping("/sellTotalList")
|
|
|
public TableDataInfo sellTotalList(QwUserVoiceLogTotalVo qwUserVoiceLog)
|
|
|
{
|
|
|
- if(qwUserVoiceLog.getCompanyUserId() == null && qwUserVoiceLog.getDeptId() != null){
|
|
|
- //获取部门下的所有用户
|
|
|
- CompanyUser usermap=new CompanyUser();
|
|
|
- usermap.setDeptId(qwUserVoiceLog.getDeptId());
|
|
|
- List<CompanyUser> users = userService.getUserListByDeptId(usermap);
|
|
|
- List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
|
|
|
- if (!userIds.isEmpty()) {
|
|
|
- qwUserVoiceLog.setCompanyUserIds(userIds.toArray(new Long[0]));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- startPage();
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
qwUserVoiceLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
List<QwUserVoiceLogTotalVo> list = qwUserVoiceLogService.selectQwUserVoiceLogTotalList(qwUserVoiceLog);
|
|
|
- return getDataTable(list);
|
|
|
+
|
|
|
+ // 获取分页参数
|
|
|
+ PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
+ Integer pageNum = pageDomain.getPageNum();
|
|
|
+ Integer pageSize = pageDomain.getPageSize();
|
|
|
+
|
|
|
+ int total = list.size();
|
|
|
+ // 在内存中进行分页处理
|
|
|
+ if (pageNum != null && pageSize != null) {
|
|
|
+ int fromIndex = (pageNum - 1) * pageSize;
|
|
|
+ int toIndex = Math.min(fromIndex + pageSize, total);
|
|
|
+
|
|
|
+ // 确保索引不越界
|
|
|
+ if (fromIndex < total) {
|
|
|
+ list = list.subList(fromIndex, toIndex);
|
|
|
+ } else {
|
|
|
+ list = new ArrayList<>(); // 返回空列表
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构造返回结果
|
|
|
+ TableDataInfo rspData = new TableDataInfo();
|
|
|
+ rspData.setCode(HttpStatus.SUCCESS);
|
|
|
+ rspData.setMsg("查询成功");
|
|
|
+ rspData.setRows(list);
|
|
|
+ rspData.setTotal(total);
|
|
|
+ return rspData;
|
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('qw:qwUserVoiceLog:sellTotalExport')")
|
|
@@ -189,16 +237,6 @@ public class QwUserVoiceLogController extends BaseController
|
|
|
@GetMapping("/sellTotalExport")
|
|
|
public AjaxResult sellTotalExport(QwUserVoiceLogTotalVo qwUserVoiceLog)
|
|
|
{
|
|
|
- if(qwUserVoiceLog.getCompanyUserId() == null && qwUserVoiceLog.getDeptId() != null){
|
|
|
- //获取部门下的所有用户
|
|
|
- CompanyUser usermap=new CompanyUser();
|
|
|
- usermap.setDeptId(qwUserVoiceLog.getDeptId());
|
|
|
- List<CompanyUser> users = userService.getUserListByDeptId(usermap);
|
|
|
- List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
|
|
|
- if (!userIds.isEmpty()) {
|
|
|
- qwUserVoiceLog.setCompanyUserIds(userIds.toArray(new Long[0]));
|
|
|
- }
|
|
|
- }
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
qwUserVoiceLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
List<QwUserVoiceLogTotalVo> list = qwUserVoiceLogService.selectQwUserVoiceLogTotalList(qwUserVoiceLog);
|