Skip to content

Commit

Permalink
Merge pull request #41 from lianluoyi/dev
Browse files Browse the repository at this point in the history
V1.32.0版本更新
  • Loading branch information
lianluoyi authored Sep 11, 2023
2 parents 5029935 + e801062 commit cdc15bf
Show file tree
Hide file tree
Showing 120 changed files with 5,977 additions and 401 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.easyink.common.constant.Constants;
import com.easyink.common.core.domain.AjaxResult;
import com.easyink.common.core.domain.FileVo;
import com.easyink.common.exception.CustomException;
import com.easyink.common.utils.StringUtils;
import com.easyink.common.utils.file.FileUploadUtils;
import com.easyink.common.utils.file.FileUtils;
Expand All @@ -26,7 +25,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.regex.Pattern;

/**
* 类名: CommonController
Expand Down Expand Up @@ -170,15 +168,11 @@ public AjaxResult uploadFile2Cos(@ApiParam("资源文件") MultipartFile file,St
FileUploadUtils.fileSuffixVerify(fileName, ruoYiConfig.getFile().getAllowUploadExtensionList());
try {
SysFile sysFile;
if (StringUtils.isNotBlank(fileName)) {
sysFile = fileService.upload2Cos(file, fileName);
} else {
sysFile = fileService.upload(file);
}
sysFile = fileService.upload2CosV2(file, fileName);
return AjaxResult.success(
FileVo.builder()
.fileName(sysFile.getFileName())
.url(sysFile.getImgUrlPrefix() + sysFile.getFileName())
.url(sysFile.getImgUrlPrefix())
.build()
);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
import com.easyink.common.core.domain.wecom.WeUser;
import com.easyink.common.enums.BusinessType;
import com.easyink.common.enums.MediaType;
import com.easyink.common.exception.file.InvalidExtensionException;
import com.easyink.common.service.ISysUserService;
import com.easyink.common.token.TokenService;
import com.easyink.common.utils.SecurityUtils;
import com.easyink.common.utils.ServletUtils;
import com.easyink.common.utils.file.FileUploadUtils;
import com.easyink.common.utils.file.MimeTypeUtils;
import com.easyink.wecom.client.WeMediaClient;
import com.easyink.wecom.client.WeUserClient;
import com.easyink.wecom.domain.dto.WeMediaDTO;
Expand Down Expand Up @@ -118,13 +120,14 @@ public AjaxResult updatePwd(String oldPassword, String newPassword) {
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
@ApiOperation("头像上传")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file, String fileName) throws IOException {
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file, String fileName) throws IOException, InvalidExtensionException {
if (!file.isEmpty()) {
FileUploadUtils.fileSuffixVerify(fileName, ruoYiConfig.getFile().getAllowUploadExtensionList());
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
//判断是系统用户(超管)还是企微用户
if (loginUser.isSuperAdmin()) {
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
// 获取资源映射前缀
String avatar = FileUploadUtils.uploadV2(fileName, file, MimeTypeUtils.getDefaultAllowedExtension());
userService.updateUserAvatar(loginUser.getUsername(), avatar);
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
package com.easyink.web.controller.wecom;

import com.easyink.common.core.controller.BaseController;
import com.easyink.common.core.domain.AjaxResult;
import com.easyink.common.core.page.PageDomain;
import com.easyink.common.core.page.TableDataInfo;
import com.easyink.common.core.page.TableSupport;
import com.easyink.common.enums.EmployCodeSourceEnum;
import com.easyink.common.utils.PageInfoUtil;
import com.easyink.wecom.domain.dto.emplecode.*;
import com.easyink.wecom.domain.vo.*;
import com.easyink.wecom.domain.vo.emple.*;
import com.easyink.wecom.login.util.LoginTokenService;
import com.easyink.wecom.service.CustomerAssistantService;
import com.easyink.wecom.service.WeEmpleCodeChannelService;
import com.easyink.wecom.service.WeEmpleCodeService;
import com.easyink.wecom.service.WeEmpleCodeWarnConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
* 获客助手相关Controller
*
* @author lichaoyu
* @date 2023/8/15 17:04
*/
@RestController
@RequestMapping("/wecom/customerAssistant")
@Slf4j
@Api(tags = "获客助手Controller")
public class CustomerAssistantController extends BaseController {

private final WeEmpleCodeService weEmpleCodeService;
private final CustomerAssistantService customerAssistantService;
private final WeEmpleCodeWarnConfigService weEmpleCodeWarnConfigService;
private final WeEmpleCodeChannelService weEmpleCodeChannelService;


public CustomerAssistantController(WeEmpleCodeService weEmpleCodeService, CustomerAssistantService customerAssistantService, WeEmpleCodeWarnConfigService weEmpleCodeWarnConfigService, WeEmpleCodeChannelService weEmpleCodeChannelService) {
this.weEmpleCodeService = weEmpleCodeService;
this.customerAssistantService = customerAssistantService;
this.weEmpleCodeWarnConfigService = weEmpleCodeWarnConfigService;
this.weEmpleCodeChannelService = weEmpleCodeChannelService;
}

@PreAuthorize("@ss.hasPermi('customer:assistant:add')")
@PostMapping("/add")
@ApiOperation("新增获客链接")
public AjaxResult<Integer> add(@RequestBody AddWeEmpleCodeDTO addWeEmpleCodeDTO) {
addWeEmpleCodeDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
addWeEmpleCodeDTO.setSource(EmployCodeSourceEnum.CUSTOMER_ASSISTANT.getSource());
return toAjax(customerAssistantService.insertCustomerAssistant(addWeEmpleCodeDTO));
}

@GetMapping("/list")
@ApiOperation("查询获客链接列表")
public TableDataInfo<WeEmpleCodeVO> list(FindAssistantDTO findAssistantDTO) {
findAssistantDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
startPage();
findAssistantDTO.setSource(EmployCodeSourceEnum.CUSTOMER_ASSISTANT.getSource());
List<WeEmpleCodeVO> list = weEmpleCodeService.selectAssistantList(findAssistantDTO);
return getDataTable(list);
}

@GetMapping(value = "/{id}")
@ApiOperation("获取获客链接详细信息")
public AjaxResult<WeEmpleCodeVO> getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(customerAssistantService.selectCustomerAssistantById(id, LoginTokenService.getLoginUser().getCorpId()));
}

@PreAuthorize("@ss.hasPermi('customer:assistant:edit')")
@PutMapping("/edit")
@ApiOperation("修改获客链接")
public AjaxResult<Integer> edit(@RequestBody AddWeEmpleCodeDTO customerAssistant) {
customerAssistant.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return toAjax(customerAssistantService.updateCustomerAssistant(customerAssistant));
}

@PreAuthorize("@ss.hasPermi('customer:assistant:delete')")
@DeleteMapping("/delete/{ids}")
@ApiOperation("删除/批量删除获客链接")
public AjaxResult<Integer> delete(@PathVariable("ids") String ids) {
String corpId = LoginTokenService.getLoginUser().getCorpId();
return toAjax(customerAssistantService.batchRemoveCustomerAssistant(corpId, ids));
}

@PostMapping("/warnConfig")
@ApiOperation("获客链接告警设置")
public AjaxResult<Integer> config(@RequestBody EmpleWarnConfigDTO warnConfigDTO) {
warnConfigDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return toAjax(weEmpleCodeWarnConfigService.saveOrUpdateConfig(warnConfigDTO));
}

@GetMapping("/warnConfig")
@ApiOperation("获客链接告警设置查询")
public AjaxResult<WeEmpleCodeWarnConfigVO> getConfig() {
return AjaxResult.success(weEmpleCodeWarnConfigService.getConfig(LoginTokenService.getLoginUser().getCorpId()));
}

@PostMapping("/channel/add")
@ApiOperation("新增自定义渠道")
public AjaxResult<Integer> addChannel(@RequestBody AddCustomChannelDTO addCustomChannelDTO) {
addCustomChannelDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return toAjax(weEmpleCodeChannelService.addChannel(addCustomChannelDTO));
}

@PutMapping("/channel/edit")
@ApiOperation("编辑自定义渠道")
public AjaxResult<Integer> editChannel(@RequestBody EditCustomerChannelDTO editCustomerChannelDTO) {
editCustomerChannelDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return toAjax(weEmpleCodeChannelService.editChannel(editCustomerChannelDTO));
}

@GetMapping("/channel/list")
@ApiOperation("查询自定义渠道列表")
public TableDataInfo<WeEmpleCodeChannelVO> listChannel(AddCustomChannelDTO addCustomChannelDTO) {
addCustomChannelDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return getDataTable(weEmpleCodeChannelService.listChannel(addCustomChannelDTO));
}

@DeleteMapping("/channel/delete/{channelId}")
@ApiOperation("删除自定义渠道")
public AjaxResult<Integer> deleteChannel(@PathVariable("channelId") String channelId) {
return toAjax(weEmpleCodeChannelService.delChannel(channelId));
}

@PreAuthorize("@ss.hasPermi('customer:assistant:situation')")
@GetMapping("/situation")
@ApiOperation("主页获客情况查询")
public AjaxResult<WeEmpleCodeSituationVO> situation() {
return AjaxResult.success(customerAssistantService.listSituation(LoginTokenService.getLoginUser().getCorpId()));
}

@GetMapping("/situation/sync")
@ApiOperation("同步主页获客情况")
public AjaxResult<Integer> syncSituation() {
return AjaxResult.success(customerAssistantService.syncSituation(LoginTokenService.getLoginUser().getCorpId()));
}

@GetMapping("/detail/total/{empleCodeId}")
@ApiOperation("获客链接详情-数据总览")
public AjaxResult<CustomerAssistantDetailTotalVO> detailTotal(@PathVariable("empleCodeId") String empleCodeId) {
return AjaxResult.success(customerAssistantService.detailTotal(empleCodeId, LoginTokenService.getLoginUser().getCorpId()));
}

@GetMapping("/detail/getNewAndLossCustomerCnt")
@ApiOperation("获客链接详情-趋势图查询")
public AjaxResult<ChannelDetailChartVO> detailChart(FindChannelRangeChartDTO findChannelRangeChartDTO) {
findChannelRangeChartDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return AjaxResult.success(customerAssistantService.detailChart(findChannelRangeChartDTO));
}

@GetMapping("/detail/channel/range")
@ApiOperation("获客链接详情-渠道新增客户数排行查询")
public AjaxResult<ChannelDetailRangeVO> detailRange(FindChannelRangeChartDTO findChannelRangeChartDTO) {
findChannelRangeChartDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return AjaxResult.success(customerAssistantService.detailRange(findChannelRangeChartDTO));
}

@GetMapping("/detail/statistic/customer")
@ApiOperation("获客链接详情-数据统计-客户维度")
public TableDataInfo<AssistantDetailStatisticCustomerVO> detailStatisticByCustomer(FindAssistantDetailStatisticCustomerDTO findAssistantDetailStatisticCustomerDTO) {
findAssistantDetailStatisticCustomerDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
PageInfoUtil.setPage();
return getDataTable(customerAssistantService.detailStatisticByCustomer(findAssistantDetailStatisticCustomerDTO));
}

@GetMapping("/detail/statistic/channel")
@ApiOperation("获客链接详情-数据统计-渠道维度")
public TableDataInfo<AssistantDetailStatisticChannelVO> detailStatisticByChannel(FindAssistantDetailStatisticCustomerDTO dto) {
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
PageInfoUtil.setPage();
return getDataTable(customerAssistantService.detailStatisticByChannel(dto));
}

@GetMapping("/detail/statistic/date")
@ApiOperation("获客链接详情-数据统计-日期维度")
public TableDataInfo<AssistantDetailStatisticDateVO> detailStatisticByDate(FindAssistantDetailStatisticCustomerDTO dto) {
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
PageDomain pageDomain = TableSupport.buildPageRequest();
List<AssistantDetailStatisticDateVO> list = customerAssistantService.detailStatisticByDate(dto);
return PageInfoUtil.getDataTable(list, pageDomain.getPageNum(), pageDomain.getPageSize());
}
@PreAuthorize("@ss.hasPermi('customer:assistant:export')")
@GetMapping("/export/detail/statistic/customer")
@ApiOperation("导出获客链接详情-数据统计-客户维度")
public AjaxResult exportDetailStatisticByCustomer(FindAssistantDetailStatisticCustomerDTO dto) {
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return AjaxResult.success(customerAssistantService.exportDetailStatisticByCustomer(dto));
}
@PreAuthorize("@ss.hasPermi('customer:assistant:export')")
@GetMapping("/export/detail/statistic/channel")
@ApiOperation("导出获客链接详情-数据统计-渠道维度")
public AjaxResult exportDetailStatisticByChannel(FindAssistantDetailStatisticCustomerDTO dto) {
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return AjaxResult.success(customerAssistantService.exportDetailStatisticByChannel(dto));
}
@PreAuthorize("@ss.hasPermi('customer:assistant:export')")
@GetMapping("/export/detail/statistic/date")
@ApiOperation("导出获客链接详情-数据统计-日期维度")
public AjaxResult exportDetailStatisticByDate(FindAssistantDetailStatisticCustomerDTO dto) {
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return AjaxResult.success(customerAssistantService.exportDetailStatisticByDate(dto));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,13 @@ public AjaxResult listEmpleTotal(@RequestBody EmpleCodeStatisticDTO dto) {
@ApiOperation("活码统计-员工维度")
public TableDataInfo<EmpleCodeUserVO> listEmpleUser(@RequestBody EmpleCodeStatisticDTO dto) {
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
startPage();
// 预设置分页参数
PageInfoUtil.setPage();
List<EmpleCodeUserVO> list = weEmpleCodeStatisticService.listEmpleUser(dto);
return getDataTable(list);
}

@PreAuthorize("@ss.hasPermi('stastistic:codeStatistics:export')")
@PreAuthorize("@ss.hasPermi('stastistic:channelStatistics:export')")
@PostMapping("/emplecode/user/export")
@ApiOperation("活码统计-员工维度-导出报表")
public AjaxResult exportEmpleUser(@RequestBody EmpleCodeStatisticDTO dto) {
Expand All @@ -273,12 +274,12 @@ public AjaxResult exportEmpleUser(@RequestBody EmpleCodeStatisticDTO dto) {
@ApiOperation(("活码统计-活码维度"))
public TableDataInfo<EmpleCodeVO> listEmple(@RequestBody EmpleCodeStatisticDTO dto) {
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
startPage();
PageInfoUtil.setPage();
List<EmpleCodeVO> list = weEmpleCodeStatisticService.listEmple(dto);
return getDataTable(list);
}

@PreAuthorize("@ss.hasPermi('stastistic:codeStatistics:export')")
@PreAuthorize("@ss.hasPermi('stastistic:channelStatistics:export')")
@PostMapping("/emplecode/emple/export")
@ApiOperation("活码统计-活码维度-导出报表")
public AjaxResult exportEmple(@RequestBody EmpleCodeStatisticDTO dto) {
Expand All @@ -293,7 +294,7 @@ public TableDataInfo<EmpleCodeDateVO> listEmpleDate(@RequestBody EmpleCodeStatis
return getDataTable(weEmpleCodeStatisticService.listEmpleDate(dto));
}

@PreAuthorize("@ss.hasPermi('stastistic:codeStatistics:export')")
@PreAuthorize("@ss.hasPermi('stastistic:channelStatistics:export')")
@PostMapping("/emplecode/date/export")
@ApiOperation("活码统计-日期维度-导出报表")
public AjaxResult exportEmpleDate(@RequestBody EmpleCodeStatisticDTO dto) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.easyink.web.controller.wecom;

import cn.hutool.core.util.PageUtil;
import com.dtflys.forest.annotation.Get;
import com.easyink.common.annotation.Log;
import com.easyink.common.constant.WeConstans;
import com.easyink.common.core.controller.BaseController;
Expand All @@ -11,24 +9,19 @@
import com.easyink.common.enums.BusinessType;
import com.easyink.common.utils.PageInfoUtil;
import com.easyink.common.utils.StringUtils;
import com.easyink.common.utils.sql.SqlUtil;
import com.easyink.wecom.domain.dto.WeCustomerSearchDTO;
import com.easyink.wecom.domain.vo.AllocateWeCustomerResp;
import com.easyink.wecom.domain.WeCustomer;
import com.easyink.wecom.domain.dto.WeCustomerSearchDTO;
import com.easyink.wecom.domain.dto.customer.EditCustomerDTO;
import com.easyink.wecom.domain.dto.tag.RemoveWeCustomerTagDTO;
import com.easyink.wecom.domain.entity.WeCustomerExportDTO;
import com.easyink.wecom.domain.vo.WeLeaveAllocateVO;
import com.easyink.wecom.domain.vo.WeMakeCustomerTagVO;
import com.easyink.wecom.domain.vo.customer.WeCustomerSumVO;
import com.easyink.wecom.domain.vo.customer.WeCustomerUserListVO;
import com.easyink.wecom.domain.vo.customer.WeCustomerVO;
import com.easyink.wecom.login.util.LoginTokenService;
import com.easyink.wecom.service.WeCustomerService;
import com.github.pagehelper.PageHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
Expand All @@ -37,7 +30,6 @@
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
Expand Down Expand Up @@ -122,7 +114,12 @@ public AjaxResult<List<WeCustomerVO>> getCustomersByUserIdV2(@PathVariable Strin
@ApiOperation("导出企业微信客户列表")
public <T> AjaxResult<T> export(@RequestBody WeCustomerExportDTO dto) {
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
return weCustomerService.export(dto);
log.info("[导出客户]开始导出,corpId:{}", dto.getCorpId());
long startTime = System.currentTimeMillis();
AjaxResult<T> export = weCustomerService.export(dto);
long endTime = System.currentTimeMillis();
log.info("[导出客户]导出完成,corpId:{} , time:{} ", dto.getCorpId(), ( endTime - startTime) / 1000.00D);
return export;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public TableDataInfo<FormUserSendRecordVO> getUserSendRecord(@ApiParam("表单id

@ApiOperation("获取表单详情")
@GetMapping("/getFormResult")
public AjaxResult<FormOperRecordDetailVO> getFormResult(@ApiParam("表单id") @RequestParam("formId") @NotNull Long formId) {
return AjaxResult.success(weFormOperRecordService.getFormResult(formId));
public AjaxResult<FormOperRecordDetailVO> getFormResult(@ApiParam("表单id") @RequestParam("formId") @NotNull Long formId, @ApiParam("点击渠道") @RequestParam("channelType") Integer channelType) {
return AjaxResult.success(weFormOperRecordService.getFormResult(formId, channelType));
}

@ApiOperation("导出客户操作记录")
Expand Down
Loading

0 comments on commit cdc15bf

Please sign in to comment.