|
|
@@ -923,4 +923,83 @@ public class QwExternalContactController extends BaseController
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 重粉看课记录查询
|
|
|
+ */
|
|
|
+ @PostMapping("/exportRepeatExternalContact")
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:externalContact:exportRepeat')")
|
|
|
+ @Log(title = "导出重粉记录", businessType = BusinessType.EXPORT)
|
|
|
+ public AjaxResult exportRepeatExternalContact(@RequestBody QwExternalContactRepeatParam param){
|
|
|
+ List<Long> userIds = param.getUserIds();
|
|
|
+ if (userIds==null || userIds.isEmpty()){
|
|
|
+ List<QwExternalContactVO> list = null;
|
|
|
+ String type = param.getExportType();
|
|
|
+ switch (type){
|
|
|
+ case "index":
|
|
|
+ list = getIndexList(param);
|
|
|
+ break;
|
|
|
+ case "dept":
|
|
|
+ list = getDeptList(param);
|
|
|
+ break;
|
|
|
+ case "my":
|
|
|
+ list = getMyList(param);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ if (list!=null && !list.isEmpty()){
|
|
|
+ userIds = list.stream().filter(item -> (item.getFsUserId() != null && item.getFsUserId() > 0)).map(QwExternalContactVO::getFsUserId).distinct().collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ userIds = userIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ List<UserWatchLogListVo> vos = fsUserCompanyBindService.getWatchLogListByUserIds(userIds);
|
|
|
+ ExcelUtil<UserWatchLogListVo> util = new ExcelUtil<>(UserWatchLogListVo.class);
|
|
|
+ return util.exportExcel(vos, "企业微信重粉客户数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<QwExternalContactVO> getDeptList(QwExternalContactRepeatParam param) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+
|
|
|
+ List<Long> combinedList = new ArrayList<>();
|
|
|
+ //本部门
|
|
|
+ Long deptId = loginUser.getUser().getDeptId();
|
|
|
+ if (deptId!=null){
|
|
|
+ combinedList.add(deptId);
|
|
|
+ }
|
|
|
+ //本部门的下级部门
|
|
|
+ List<Long> deptList = companyDeptService.selectCompanyDeptByParentId(deptId);
|
|
|
+ if (!deptList.isEmpty()){
|
|
|
+ combinedList.addAll(deptList);
|
|
|
+ }
|
|
|
+
|
|
|
+ param.setCuDeptIdList(combinedList);
|
|
|
+ param.setUserType(loginUser.getUser().getUserType());
|
|
|
+ param.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+
|
|
|
+ return qwExternalContactService.selectQwExternalContactListVO(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<QwExternalContactVO> getMyList(QwExternalContactRepeatParam param) {
|
|
|
+ if(param.getQwUserId()==null){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ param.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ return qwExternalContactService.selectQwExternalContactListVO(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<QwExternalContactVO> getIndexList(QwExternalContactRepeatParam param) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+
|
|
|
+ param.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ if(StringUtils.isNotEmpty(param.getStatuses())){
|
|
|
+ String[] split = param.getStatuses().split(",");
|
|
|
+ param.setStatusCondition(split);
|
|
|
+ }
|
|
|
+ return qwExternalContactService.selectQwExternalContactListVO(param);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|