|
|
@@ -1,21 +1,25 @@
|
|
|
package com.fs.qw.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
-import com.fs.common.exception.ServiceException;
|
|
|
-import com.fs.common.utils.ServletUtils;
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
+import com.fs.qw.domain.QwContactWay;
|
|
|
import com.fs.qw.param.QwExternalContactParam;
|
|
|
import com.fs.qw.param.QwTagSearchParam;
|
|
|
import com.fs.qw.param.ResignedTransferParam;
|
|
|
import com.fs.qw.param.TransferParam;
|
|
|
+import com.fs.qw.service.IQwContactWayService;
|
|
|
import com.fs.qw.service.IQwExternalContactInfoService;
|
|
|
-import com.fs.qw.service.IQwExternalContactInfoService;
|
|
|
+import com.fs.qw.service.IQwGroupChatUserService;
|
|
|
import com.fs.qw.service.IQwTagService;
|
|
|
+import com.fs.course.service.IFsUserCompanyBindService;
|
|
|
+import com.fs.qw.param.UserWatchLogParam;
|
|
|
+import com.fs.course.vo.UserWatchLogListVo;
|
|
|
import com.fs.qw.vo.QwExternalContactUnionIdExportVO;
|
|
|
import com.fs.qw.vo.QwExternalContactVO;
|
|
|
import com.google.gson.Gson;
|
|
|
@@ -31,6 +35,7 @@ import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
@@ -57,6 +62,15 @@ public class QwExternalContactController extends BaseController
|
|
|
@Autowired
|
|
|
private IQwExternalContactInfoService qwExternalContactInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IQwContactWayService qwContactWayService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IQwGroupChatUserService qwGroupChatUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsUserCompanyBindService fsUserCompanyBindService;
|
|
|
+
|
|
|
QwExternalContactController(IQwExternalContactService qwExternalContactService,IQwTagService iQwTagService){
|
|
|
this.qwExternalContactService=qwExternalContactService;
|
|
|
this.iQwTagService=iQwTagService;
|
|
|
@@ -70,11 +84,32 @@ public class QwExternalContactController extends BaseController
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(QwExternalContactParam qwExternalContact)
|
|
|
{
|
|
|
+ if (qwExternalContact.getFsUserId() == null
|
|
|
+ && qwExternalContact.getExtId() == null
|
|
|
+ && qwExternalContact.getId() == null
|
|
|
+ && StringUtils.isEmpty(qwExternalContact.getExternalUserId())) {
|
|
|
+ return getDataTable(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ QwContactWay qwContactWay = new QwContactWay();
|
|
|
+ if (qwExternalContact.getCompanyId() != null) {
|
|
|
+ qwContactWay.setCompanyId(qwExternalContact.getCompanyId());
|
|
|
+ }
|
|
|
+ List<QwContactWay> wayList = qwContactWayService.selectQwContactWayList(qwContactWay);
|
|
|
+
|
|
|
startPage();
|
|
|
- List<QwExternalContactVO> list = qwExternalContactService.selectQwExternalContactListVONewSys(qwExternalContact);
|
|
|
- list.forEach(item->{
|
|
|
+ if (StringUtils.isNotEmpty(qwExternalContact.getStatuses())) {
|
|
|
+ String[] split = qwExternalContact.getStatuses().split(",");
|
|
|
+ qwExternalContact.setStatusCondition(split);
|
|
|
+ }
|
|
|
+ List<QwExternalContactVO> list = qwExternalContactService.selectQwExternalContactListVO(qwExternalContact);
|
|
|
+ list.forEach(item -> {
|
|
|
+ if (StringUtils.isNotEmpty(item.getExternalUserId())) {
|
|
|
+ List<String> chatNameList = qwGroupChatUserService.selectChatNameByUserId(item.getExternalUserId());
|
|
|
+ item.setChatNames(chatNameList);
|
|
|
+ }
|
|
|
|
|
|
- if (!Objects.equals(item.getTagIds(), "[]") && item.getTagIds()!=null) {
|
|
|
+ if (!Objects.equals(item.getTagIds(), "[]") && item.getTagIds() != null) {
|
|
|
QwTagSearchParam param = new QwTagSearchParam();
|
|
|
Gson gson = new Gson();
|
|
|
List<String> tagIds = gson.fromJson(
|
|
|
@@ -87,11 +122,67 @@ public class QwExternalContactController extends BaseController
|
|
|
|
|
|
item.setTagIdsName(iQwTagService.selectQwTagListByTagIds(param));
|
|
|
}
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(item.getState()) && !wayList.isEmpty()) {
|
|
|
+ item.setState(item.getState() + "-" + getContactWayNameStream(item.getState(), wayList));
|
|
|
+ }
|
|
|
});
|
|
|
+ if (StringUtils.isNotEmpty(qwExternalContact.getChatName())) {
|
|
|
+ list = list.stream()
|
|
|
+ .filter(item -> item.getChatNames() != null && !item.getChatNames().isEmpty())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ public String getContactWayNameStream(String configStr, List<QwContactWay> wayList) {
|
|
|
+ if (configStr == null || wayList == null || wayList.isEmpty()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return wayList.stream()
|
|
|
+ .filter(way -> way.getId() != null &&
|
|
|
+ way.getId().toString().equals(extractLastValue(configStr)))
|
|
|
+ .map(QwContactWay::getName)
|
|
|
+ .findFirst()
|
|
|
+ .orElse(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String extractLastValue(String input) {
|
|
|
+ if (input == null || input.isEmpty()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ int lastColonIndex = input.lastIndexOf(":");
|
|
|
+ if (lastColonIndex == -1) {
|
|
|
+ return input;
|
|
|
+ }
|
|
|
+
|
|
|
+ return input.substring(lastColonIndex + 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重粉看课记录查询
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:externalContact:list')")
|
|
|
+ @GetMapping("/getWatchLogList")
|
|
|
+ public TableDataInfo getWatchLogList(UserWatchLogParam param) {
|
|
|
+ startPage();
|
|
|
+ List<UserWatchLogListVo> list = fsUserCompanyBindService.getWatchLogList(param);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重粉看课历史 - 综合信息查询(关联销售 + 课程进度)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:externalContact:list')")
|
|
|
+ @GetMapping("/getRepeatCourseHistory")
|
|
|
+ public AjaxResult getRepeatCourseHistory(@RequestParam Long fsUserId,
|
|
|
+ @RequestParam(required = false) Long companyId) {
|
|
|
+ return AjaxResult.success(fsUserCompanyBindService.getRepeatCourseHistory(fsUserId, companyId));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 导出企业微信客户列表
|
|
|
*/
|