Commit ef03706e by 水库浪子

同步开发分支代码进入主分支

1 parent 54414b93
Showing 160 changed files with 1170 additions and 638 deletions
......@@ -75,18 +75,13 @@
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.alibaba.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<groupId>io.github.leejoker</groupId>
<artifactId>linkwechat-nacos-starter</artifactId>
</dependency>
</dependencies>
......
......@@ -6,7 +6,6 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableAsync;
/**
......@@ -16,9 +15,8 @@ import org.springframework.scheduling.annotation.EnableAsync;
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class})
@MapperScan("com.linkwechat.*.mapper")
@ForestScan(basePackages = {"com.linkwechat.wecom.client","com.linkwechat.wecom.wxclient"})
@ForestScan(basePackages = {"com.linkwechat.wecom.client", "com.linkwechat.wecom.wxclient"})
@EnableAsync
@EnableDiscoveryClient
public class LinkWeChatApplication {
public static void main(String[] args) {
......
......@@ -5,19 +5,25 @@ import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.config.ServerConfig;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.FileVo;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.common.utils.file.MimeTypeUtils;
import com.linkwechat.framework.web.domain.server.SysFile;
import com.linkwechat.framework.web.service.FileService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 通用请求处理
......@@ -31,8 +37,9 @@ public class CommonController {
@Autowired
private ServerConfig serverConfig;
@Autowired
private CosConfig cosConfig;
private FileService fileService;
/**
* 通用下载请求
......@@ -114,23 +121,32 @@ public class CommonController {
* 通用上传请求
*/
@PostMapping("/common/uploadFile2Cos")
public AjaxResult uploadFile2Cos(MultipartFile file) throws Exception {
public AjaxResult uploadFile2Cos(MultipartFile file){
try {
String fileName = FileUploadUtils.upload2Cos(file, cosConfig);
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url(fileName));
return ajax;
SysFile sysFile
= fileService.upload(file);
return AjaxResult.success(
FileVo.builder()
.fileName(sysFile.getFileName())
.url(sysFile.getImgUrlPrefix()+sysFile.getFileName())
.build()
);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
return AjaxResult.error("不支持当前文件上传或文件过大建议传20MB以内的文件");
}
}
public String url(String fileName){
return "https://link-wechat-1251309172.cos.ap-nanjing.myqcloud.com/"+fileName;
/**
* 获取图片
*/
@GetMapping("/common/findImage")
public void findImage(HttpServletResponse response,String fileName){
fileService.findImage(fileName,response);
}
}
package com.linkwechat.web.controller.system;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.entity.SysMenu;
......@@ -154,19 +155,31 @@ public class SysLoginController
}
/**
* 租户登录
* 通过企业id和企业密钥登录
* @param corpId
* @param corpSecret
* @return
*/
@GetMapping("/tenantLogin")
public AjaxResult tenantLogin(String corpId,String corpSecret){
AjaxResult ajax = AjaxResult.success();
@GetMapping("/corpLogin")
public AjaxResult corpLogin(String corpId,String corpSecret){
WeCorpAccount weCorpAccount = iWxCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>()
.eq(WeCorpAccount::getCorpId, corpId)
.eq(WeCorpAccount::getCorpSecret, corpSecret)
.eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE));
return ajax;
if(weCorpAccount == null){
return AjaxResult.error("当前企业id与企业密码不匹配或不存在");
}
return AjaxResult.success(
loginService.noPwdLogin(weCorpAccount.getCorpAccount())
);
}
}
......@@ -34,8 +34,8 @@ public class WeAppController extends BaseController {
@PostMapping("/updateWeApp")
public AjaxResult updateWeApp(@RequestBody WeApp weApp){
@PutMapping("/updateWeApp")
public AjaxResult updateWeApp(@RequestBody WeApp weApp){
iWeAppService.updateWeApp(weApp);
return AjaxResult.success();
}
......@@ -47,4 +47,8 @@ public class WeAppController extends BaseController {
}
package com.linkwechat.web.controller.wecom;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.controller.BaseController;
......@@ -78,21 +79,23 @@ public class WeCategoryController extends BaseController {
/**
* 删除类目
*/
// @PreAuthorize("@ss.hasPermi('wechat:category:remove')")
// @PreAuthorize("@ss.hasPermi('wechat:category:remove')") Constants.DELETE_CODE
@Log(title = "删除类目", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@ApiOperation("删除类目")
public AjaxResult remove(@PathVariable Long[] ids) {
List<WeCategory> categorys=new ArrayList<>();
for (Long id:ids) {
categorys.add(
WeCategory.builder()
.id(id)
.delFlag(Constants.DELETE_CODE)
.build()
);
}
weCategoryService.updateBatchById(categorys);
weCategoryService.deleteWeCategoryById(ids);
// List<WeCategory> categorys=new ArrayList<>();
// for (Long id:ids) {
// categorys.add(
// WeCategory.builder()
// .id(id)
// .delFlag("55")
// .build()
// );
// }
// weCategoryService.updateBatchById(categorys);
return AjaxResult.success();
}
......
......@@ -35,7 +35,12 @@ public class WeChatCollectionController extends BaseController {
@Log(title = "添加收藏", businessType = BusinessType.INSERT)
@PostMapping("addCollection")
public AjaxResult addCollection(@RequestBody WeChatCollectionDto chatCollectionDto) {
return toAjax(weChatCollectionService.addCollection(chatCollectionDto.getMaterialId(), chatCollectionDto.getUserId()));
boolean b =
weChatCollectionService.addCollection(chatCollectionDto.getMaterialId(), chatCollectionDto.getUserId());
if(weChatCollectionService.addCollection(chatCollectionDto.getMaterialId(), chatCollectionDto.getUserId())){
return AjaxResult.success();
}
return AjaxResult.success("当前素材不可重复收藏");
}
......
......@@ -64,11 +64,13 @@ public class WeCommunityGroupSopController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:add')")
@PostMapping(path = "/")
public AjaxResult addGroupSop(@Validated @RequestBody WeGroupSopDto groupSopDto) {
if (!groupSopService.isRuleNameUnique(groupSopDto.getRuleName())) {
return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
}
WeGroupSop weGroupSop = new WeGroupSop();
BeanUtils.copyProperties(groupSopDto, weGroupSop);
if (groupSopService.isNameOccupied(weGroupSop)) {
return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
}
weGroupSop.setCreateBy(SecurityUtils.getUsername());
// 群聊id列表
List<String> groupIdList = groupSopDto.getChatIdList();
......@@ -116,14 +118,15 @@ public class WeCommunityGroupSopController extends BaseController {
if (null == groupSopService.getGroupSopById(ruleId)) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "该群SOP规则不存在");
}
WeGroupSop weGroupSop = new WeGroupSop();
weGroupSop.setRuleId(ruleId);
BeanUtils.copyProperties(groupSopDto, weGroupSop);
// 校验规则名是否可用
WeGroupSopVo original = groupSopService.getGroupSopById(ruleId);
if (!groupSopDto.getRuleName().equals(original.getRuleName()) && !groupSopService.isRuleNameUnique(groupSopDto.getRuleName())) {
if (groupSopService.isNameOccupied(weGroupSop)) {
return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
}
WeGroupSop weGroupSop = new WeGroupSop();
BeanUtils.copyProperties(groupSopDto, weGroupSop);
weGroupSop.setRuleId(ruleId);
weGroupSop.setUpdateBy(SecurityUtils.getUsername());
// 群聊id列表
List<String> groupIdList = groupSopDto.getChatIdList();
......
......@@ -6,7 +6,7 @@ import com.linkwechat.common.core.domain.entity.SysUser;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.system.service.ISysUserService;
import com.linkwechat.wecom.domain.vo.WeKeywordGroupTaskVo;
import com.linkwechat.wecom.domain.WeKeywordGroupTask;
import com.linkwechat.wecom.service.IWeCommunityKeywordToGroupService;
import com.linkwechat.wecom.service.IWeGroupSopService;
import com.linkwechat.wecom.service.IWePresTagGroupTaskService;
......@@ -106,7 +106,6 @@ public class WeCommunityH5Controller extends BaseController {
}
/**
* 用于支持H5页面的名称和关键字检索
*
......@@ -116,7 +115,7 @@ public class WeCommunityH5Controller extends BaseController {
@GetMapping(path = "/filter")
public TableDataInfo filter(@RequestParam("word") String word) {
startPage();
List<WeKeywordGroupTaskVo> taskList = keywordToGroupService.filterByNameOrKeyword(word);
List<WeKeywordGroupTask> taskList = keywordToGroupService.filterByNameOrKeyword(word);
return getDataTable(taskList);
}
}
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.constant.HttpStatus;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.domain.WeKeywordGroupTask;
import com.linkwechat.wecom.domain.dto.WeKeywordGroupTaskDto;
import com.linkwechat.wecom.domain.vo.WeKeywordGroupTaskVo;
import com.linkwechat.wecom.service.IWeCommunityKeywordToGroupService;
import com.linkwechat.wecom.service.IWeGroupCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* 关键词拉群controller
*/
@Api(tags = "关键词拉群")
@RestController
@RequestMapping(value = "/wecom/communityKeywordGroup")
public class WeCommunityKeywordGroupController extends BaseController {
@Autowired
private IWeCommunityKeywordToGroupService keywordToGroupService;
private IWeCommunityKeywordToGroupService service;
@Autowired
private IWeGroupCodeService groupCodeService;
/**
* 根据过滤条件获取关键词拉群任务列表
*
* @param taskName 任务名称
* @param createBy 创建人
* @param keyword 关键词
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 列表数据
*/
@ApiOperation(value = "获取关键词拉群任务列表")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:list')")
@GetMapping(path = "/list")
public TableDataInfo<List<WeKeywordGroupTaskVo>> list(
@RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "createBy", required = false) String createBy,
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "beginTime", required = false) String beginTime,
@RequestParam(value = "endTime", required = false) String endTime
) {
public TableDataInfo<List<WeKeywordGroupTask>> list(WeKeywordGroupTask task) {
startPage();
List<WeKeywordGroupTaskVo> taskList = keywordToGroupService
.getTaskList(taskName, createBy, keyword, beginTime, endTime);
List<WeKeywordGroupTask> taskList = service.getTaskList(task);
return getDataTable(taskList);
}
......@@ -61,35 +46,43 @@ public class WeCommunityKeywordGroupController extends BaseController {
* @param taskId 任务id
* @return 任务详情
*/
@ApiOperation(value = "获取任务详情")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:query')")
@GetMapping(path = "/{taskId}")
public AjaxResult getTask(@PathVariable("taskId") Long taskId) {
return AjaxResult.success(keywordToGroupService.getTaskById(taskId));
public AjaxResult getTask(@ApiParam("任务id") @PathVariable("taskId") Long taskId) {
return AjaxResult.success(service.getTaskById(taskId));
}
/**
* 添加新任务
*
* @param keywordToGroupDto 添加任务所需的数据
* @param task 添加任务所需的数据
* @return 结果
*/
@ApiOperation(value = "添加新任务")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:add')")
@PostMapping(path = "/")
public AjaxResult addTask(@RequestBody @Validated WeKeywordGroupTaskDto keywordToGroupDto) {
return toAjax(keywordToGroupService.addTask(keywordToGroupDto));
public AjaxResult addTask(@RequestBody @Validated WeKeywordGroupTask task) {
if (service.isNameOccupied(task)) {
return AjaxResult.error("关键词拉群任务名称"+ task.getTaskName() +"已存在");
}
task.setCreateBy(SecurityUtils.getUsername());
task.setCreateTime(new Date());
return toAjax(service.addTask(task));
}
/**
* 根据id及更新数据对指定任务进行更新
*
* @param taskId 任务id
* @param keywordToGroupDto 更新所需数据
* @return 结果
*/
@ApiOperation(value = "更新任务")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:edit')")
@PutMapping(path = "/{taskId}")
public AjaxResult updateTask(@PathVariable("taskId") Long taskId, @RequestBody @Validated WeKeywordGroupTaskDto keywordToGroupDto) {
return toAjax(keywordToGroupService.updateTask(taskId, keywordToGroupDto));
@PutMapping("/{taskId}")
public AjaxResult updateTask(
@ApiParam("任务id") @PathVariable("taskId") Long taskId, @RequestBody @Validated WeKeywordGroupTask task) {
task.setTaskId(taskId);
task.setUpdateBy(SecurityUtils.getUsername());
task.setUpdateTime(new Date());
return toAjax(service.updateTask(task));
}
/**
......@@ -98,10 +91,11 @@ public class WeCommunityKeywordGroupController extends BaseController {
* @param ids id列表
* @return 结果
*/
@ApiOperation(value = "批量删除任务")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:remove')")
@DeleteMapping(path = "/{ids}")
public AjaxResult batchDeleteTask(@PathVariable("ids") Long[] ids) {
return toAjax(keywordToGroupService.batchRemoveTaskByIds(ids));
public AjaxResult batchDeleteTask(@ApiParam("待删除任务id数组") @PathVariable("ids") Long[] ids) {
return toAjax(service.batchRemoveTaskByIds(ids));
}
}
......@@ -10,6 +10,7 @@ import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.wecom.domain.WeCommunityNewGroup;
import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto;
import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo;
......@@ -28,9 +29,8 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
......@@ -83,7 +83,6 @@ public class WeCommunityNewGroupController extends BaseController {
exc.printStackTrace();
}
});
return;
}
/**
......@@ -98,34 +97,19 @@ public class WeCommunityNewGroupController extends BaseController {
@Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
@GetMapping("/downloadBatch")
public void downloadBatch(Long[] ids, HttpServletRequest request, HttpServletResponse response) {
List<Map<String, String>> fileList = weCommunityNewGroupService
.selectWeCommunityNewGroupByIds(Arrays.asList(ids))
.stream()
.map(e -> {
WeEmpleCode code = weEmpleCodeService.getById(e.getEmplCodeId());
Map<String, String> fileMap = new HashMap<>();
fileMap.put("fileName", code.getUseUserName() + "-" + code.getScenario()+".jpg");
fileMap.put("url", code.getQrCode());
return fileMap;
})
.collect(Collectors.toList());
try {
List<WeCommunityNewGroupVo> weCommunityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupByIds(Arrays.asList(ids));
//zip输出流
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
if (CollectionUtil.isNotEmpty(weCommunityNewGroupVos)) {
for (WeCommunityNewGroupVo communityNewGroupVo : weCommunityNewGroupVos) {
// 获取改新客拉群对应员工活码的二维码
WeEmpleCode empleCode = weEmpleCodeService.selectWeEmpleCodeById(communityNewGroupVo.getEmplCodeId());
String qrCode = empleCode.getQrCode();
if (StringUtils.isEmpty(qrCode)) {
continue;
}
URL url = new URL(qrCode);
// 二维码名称使用场景
String fileName = empleCode.getScenario() + ".png";
zos.putNextEntry(new ZipEntry(fileName));
InputStream fis = url.openConnection().getInputStream();
byte[] buffer = new byte[1024];
int r = 0;
while ((r = fis.read(buffer)) != -1) {
zos.write(buffer, 0, r);
}
fis.close();
}
}
//关闭zip输出流
zos.flush();
zos.close();
FileUtils.batchDownloadFile(fileList, response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
......@@ -137,13 +121,9 @@ public class WeCommunityNewGroupController extends BaseController {
@ApiOperation(value = "查询新客自动拉群列表", httpMethod = "GET")
// @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:list')")
@GetMapping("/list")
public TableDataInfo<List<WeCommunityNewGroupVo>> list(
@RequestParam(value = "emplCodeName", required = false) String emplCodeName,
@RequestParam(value = "createBy", required = false) String createBy,
@RequestParam(value = "beginTime", required = false) String beginTime,
@RequestParam(value = "endTime", required = false) String endTime) {
public TableDataInfo<List<WeCommunityNewGroupVo>> list(WeCommunityNewGroup weCommunityNewGroup) {
startPage();
List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupList(emplCodeName, createBy, beginTime, endTime);
List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupList(weCommunityNewGroup);
return getDataTable(communityNewGroupVos);
}
......
......@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.constant.HttpStatus;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
......@@ -53,23 +54,26 @@ public class WeCommunityPresTagGroupController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:add')")
@PostMapping
public AjaxResult addTask(@RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) {
// 检测任务名是否可用
if (!taskService.checkTaskNameUnique(wePresTagGroupTaskDto.getTaskName())) {
return AjaxResult.error("任务名已存在");
}
if (null == groupCodeService.selectWeGroupCodeById(wePresTagGroupTaskDto.getGroupCodeId())) {
if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
}
// 创建新任务并保存
WePresTagGroupTask task = new WePresTagGroupTask();
BeanUtils.copyProperties(wePresTagGroupTaskDto, task);
// 检测任务名是否可用
if (taskService.isNameOccupied(task)) {
return AjaxResult.error("任务名已存在");
}
task.setCreateBy(SecurityUtils.getUsername());
List<String> tagList = wePresTagGroupTaskDto.getTagList();
List<String> scopeList = wePresTagGroupTaskDto.getScopeList();
int affectedRows = taskService.add(task, tagList, scopeList);
if (affectedRows > 0) {
// 若保存成功,则进行异步消息推送
taskService.sendMessage(task);
boolean hasScope = StringUtils.isNotEmpty(wePresTagGroupTaskDto.getScopeList());
boolean hasTag = StringUtils.isNotEmpty(wePresTagGroupTaskDto.getTagList());
List<String> externalIds = taskService
.selectExternalUserIds(task.getTaskId(), hasScope, hasTag, wePresTagGroupTaskDto.getSendScope(),
wePresTagGroupTaskDto.getCusBeginTime(), wePresTagGroupTaskDto.getCusEndTime());
taskService.sendMessage(task, externalIds);
}
return toAjax(affectedRows);
}
......@@ -93,15 +97,7 @@ public class WeCommunityPresTagGroupController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:edit')")
@PutMapping(path = "/{id}")
public AjaxResult updateTask(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) {
// 检测任务名是否可用
WePresTagGroupTaskVo original = taskService.getTaskById(id);
// 判断名称是否发生变化
boolean newName = wePresTagGroupTaskDto.getTaskName().equals(original.getTaskName());
// 新名称不能已存在
if (!taskService.checkTaskNameUnique(wePresTagGroupTaskDto.getTaskName()) && !newName) {
return AjaxResult.error("任务名已存在");
}
if (null == groupCodeService.selectWeGroupCodeById(wePresTagGroupTaskDto.getGroupCodeId())) {
if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
}
return toAjax(taskService.updateTask(id, wePresTagGroupTaskDto));
......
package com.linkwechat.web.controller.wecom;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.ConversationArchiveQuery;
......@@ -11,7 +10,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......
......@@ -13,8 +13,6 @@ import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.service.IWeCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -46,7 +44,6 @@ public class WeCustomerController extends BaseController
public TableDataInfo list(WeCustomer weCustomer)
{
startPage();
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
return getDataTable(list);
}
......@@ -111,9 +108,6 @@ public class WeCustomerController extends BaseController
@GetMapping("/synchWeCustomer")
public AjaxResult synchWeCustomer() {
try {
SecurityContext context = SecurityContextHolder.getContext();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weCustomerService.synchWeCustomer();
} catch (Exception e) {
e.printStackTrace();
......
......@@ -15,7 +15,10 @@ import com.linkwechat.wecom.service.IWeCustomerMessagePushService;
import com.linkwechat.wecom.service.IWeCustomerMessgaeResultService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
......@@ -50,8 +53,10 @@ public class WeCustomerMessagePushController extends BaseController {
@PostMapping(value = "add")
public AjaxResult add(@RequestBody CustomerMessagePushDto customerMessagePushDto) {
try {
weCustomerMessagePushService.addWeCustomerMessagePush(customerMessagePushDto);
} catch (JsonProcessingException | ParseException e) {
} catch (JsonProcessingException | ParseException | CloneNotSupportedException e) {
e.printStackTrace();
return AjaxResult.error("群发失败");
}
......
......@@ -107,7 +107,6 @@ public class WeCustomerPortraitController extends BaseController {
public AjaxResult updateWeCustomerPorTraitTag(@RequestBody WeMakeCustomerTag weMakeCustomerTag){
iWeCustomerService.makeLabel(weMakeCustomerTag);
return AjaxResult.success();
......@@ -150,16 +149,15 @@ public class WeCustomerPortraitController extends BaseController {
* @return
*/
@GetMapping(value = "/findTrajectory")
public TableDataInfo findTrajectory(Integer trajectoryType){
public TableDataInfo findTrajectory(String userId,String externalUserid,Integer trajectoryType){
startPage();
LambdaQueryWrapper<WeCustomerTrajectory> ne = new LambdaQueryWrapper<WeCustomerTrajectory>()
.ne(WeCustomerTrajectory::getStatus, Constants.DELETE_CODE);
.ne(WeCustomerTrajectory::getStatus, Constants.DELETE_CODE)
.eq(WeCustomerTrajectory::getUserId,userId)
.eq(WeCustomerTrajectory::getExternalUserid,externalUserid);
if(trajectoryType != null){
ne.eq(WeCustomerTrajectory::getTrajectoryType, trajectoryType);
}
return getDataTable(
iWeCustomerTrajectoryService.list(ne)
);
......
......@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUtils;
......@@ -23,9 +24,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
......@@ -154,38 +153,19 @@ public class WeEmpleCodeController extends BaseController {
@Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
@GetMapping("/downloadBatch")
public void downloadBatch(String ids, HttpServletRequest request, HttpServletResponse response){
List<String> idList = Arrays.stream(Optional.ofNullable(ids).orElse("").split(","))
.filter(StringUtils::isNotEmpty).collect(Collectors.toList());
List<Map<String, String>> fileList = Arrays
.stream(Optional.ofNullable(ids).orElse("").split(","))
.filter(StringUtils::isNotEmpty)
.map(id -> {
WeEmpleCode code = weEmpleCodeService.getById(id);
Map<String, String> fileMap = new HashMap<>();
fileMap.put("fileName", code.getUseUserName() + "-" + code.getScenario()+".jpg");
fileMap.put("url", code.getQrCode());
return fileMap;})
.collect(Collectors.toList());
try {
//通过员工活码id查询活码数据
List<WeEmpleCode> weEmpleCodeLsit = weEmpleCodeService.selectWeEmpleCodeByIds(idList);
//zip输出流
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
if (CollectionUtil.isNotEmpty(weEmpleCodeLsit)){
for (WeEmpleCode weEmpleCode : weEmpleCodeLsit){
String qrCode = weEmpleCode.getQrCode();
if (StringUtils.isEmpty(qrCode)){
continue;
}
URL url = new URL(qrCode);
//每个二维码名称
String fileName = weEmpleCode.getUseUserName()+"-"+weEmpleCode.getScenario()+".jpg";
zos.putNextEntry(new ZipEntry(fileName));
InputStream fis = url.openConnection().getInputStream();
byte[] buffer = new byte[1024];
int r = 0;
while ((r = fis.read(buffer)) != -1) {
zos.write(buffer, 0, r);
}
fis.close();
}
}
//关闭zip输出流
zos.flush();
zos.close();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e){
FileUtils.batchDownloadFile(fileList, response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
......@@ -196,7 +176,7 @@ public class WeEmpleCodeController extends BaseController {
public void download(String id, HttpServletRequest request, HttpServletResponse response){
WeEmpleCode weEmpleCode = weEmpleCodeService.selectWeEmpleCodeById(Long.valueOf(id));
if (StringUtils.isEmpty(weEmpleCode.getQrCode())){
return;
throw new CustomException("活码不存在");
}else {
try {
FileUtils.downloadFile(weEmpleCode.getQrCode(), response.getOutputStream());
......
......@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
......@@ -52,12 +53,12 @@ public class WeMaterialController extends BaseController {
List<WeMaterial> list;
if(StringUtils.isNotBlank(mediaType) && mediaType.equals(MediaType.POSTER.getType())){
list = wePosterService.list(StringUtils.isBlank(categoryId)?null:Long.valueOf(categoryId),search).stream().map(wePoster -> {
WeMaterial weMaterial = new WeMaterial();
weMaterial.setMaterialName(wePoster.getTitle());
weMaterial.setMaterialUrl(wePoster.getSampleImgPath());
weMaterial.setCategoryId(wePoster.getCategoryId());
weMaterial.setId(wePoster.getId());
return weMaterial;
WeMaterial weMaterial = new WeMaterial();
weMaterial.setMaterialName(wePoster.getTitle());
weMaterial.setMaterialUrl(wePoster.getSampleImgPath());
weMaterial.setCategoryId(wePoster.getCategoryId());
weMaterial.setId(wePoster.getId());
return weMaterial;
}).collect(Collectors.toList());
}else {
list = materialService.findWeMaterials(categoryId, search,mediaType);
......@@ -99,7 +100,9 @@ public class WeMaterialController extends BaseController {
@DeleteMapping("/{ids}")
@ApiOperation("删除素材信息")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(materialService.deleteWeMaterialByIds(ids));
materialService.deleteWeMaterialByIds(ids);
return AjaxResult.success();
}
......@@ -122,25 +125,58 @@ public class WeMaterialController extends BaseController {
return AjaxResult.success();
}
// //@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
// @Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
// @PostMapping("/temporaryMaterialMediaId")
// @ApiOperation("获取素材media_id")
// public AjaxResult temporaryMaterialMediaId(@RequestBody TemporaryMaterialDto temporaryMaterialDto){
// WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(temporaryMaterialDto.getUrl(),
// temporaryMaterialDto.getType()
// ,temporaryMaterialDto.getName());
// return AjaxResult.success(weMediaDto);
// }
//@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
@GetMapping("/temporaryMaterialMediaId")
@ApiOperation("H5端发送获取素材media_id")
public AjaxResult temporaryMaterialMediaId(String url,String type,String name){
WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(url,
type
,name);
return AjaxResult.success(weMediaDto);
}
//@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
@PostMapping("/temporaryMaterialMediaId")
@ApiOperation("获取素材media_id")
public AjaxResult temporaryMaterialMediaId(@RequestBody TemporaryMaterialDto temporaryMaterialDto){
@PostMapping("/temporaryMaterialMediaIdForWeb")
@ApiOperation("web端发送获取素材media_id")
public AjaxResult temporaryMaterialMediaIdForWeb(@RequestBody TemporaryMaterialDto temporaryMaterialDto){
WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(temporaryMaterialDto.getUrl(),
temporaryMaterialDto.getType()
MediaType.of( temporaryMaterialDto.getType()).get().getMediaType()
,temporaryMaterialDto.getName());
return AjaxResult.success(weMediaDto);
}
@Log(title = "上传素材图片", businessType = BusinessType.OTHER)
@PostMapping("/uploadimg")
@ApiOperation("上传素材图片")
public AjaxResult<WeMediaDto> uploadImg(MultipartFile file){
WeMediaDto weMediaDto = materialService.uploadImg(file);
weMediaDto.setFileName(file.getResource().getFilename());
public AjaxResult<WeMediaDto> uploadImg(MultipartFile file, HttpServletRequest request){
System.out.println(request.getServerName());
WeMediaDto weMediaDto=new WeMediaDto();
// WeMediaDto weMediaDto = materialService.uploadImg(file);
// weMediaDto.setFileName(file.getResource().getFilename()); weMaterialFileVO.getMaterialUrl()+
WeMaterialFileVO weMaterialFileVO = materialService.uploadWeMaterialFile(file, MediaType.IMAGE.getType());
weMediaDto.setFileName(weMaterialFileVO.getMaterialName());
weMediaDto.setUrl(weMaterialFileVO.getMaterialUrl()+weMaterialFileVO.getMaterialName());
return AjaxResult.success(weMediaDto);
}
......
......@@ -9,8 +9,9 @@ import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeSensitive;
import com.linkwechat.wecom.domain.query.WeSensitiveHitQuery;
import com.linkwechat.wecom.service.IWeSensitiveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
......@@ -26,6 +27,7 @@ import java.util.stream.Collectors;
*/
@RestController
@RequestMapping("/wecom/sensitive")
@Api(tags = "敏感词管理")
public class WeSensitiveController extends BaseController {
@Autowired
private IWeSensitiveService weSensitiveService;
......@@ -35,6 +37,7 @@ public class WeSensitiveController extends BaseController {
*/
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:list')")
@GetMapping("/list")
@ApiOperation("查询敏感词列表")
public TableDataInfo list(WeSensitive weSensitive) {
startPage();
List<WeSensitive> list = weSensitiveService.selectWeSensitiveList(weSensitive);
......@@ -46,6 +49,7 @@ public class WeSensitiveController extends BaseController {
*/
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:query')")
@GetMapping(value = "/{id}")
@ApiOperation("查询敏感词详情")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(weSensitiveService.selectWeSensitiveById(id));
}
......@@ -56,6 +60,7 @@ public class WeSensitiveController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:add')")
@Log(title = "敏感词设置", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("添加敏感词")
public AjaxResult add(@Valid @RequestBody WeSensitive weSensitive) {
return toAjax(weSensitiveService.insertWeSensitive(weSensitive));
}
......@@ -66,6 +71,7 @@ public class WeSensitiveController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:edit')")
@Log(title = "敏感词设置", businessType = BusinessType.UPDATE)
@PutMapping
@ApiOperation("修改敏感词")
public AjaxResult edit(@Valid @RequestBody WeSensitive weSensitive) {
Long id = weSensitive.getId();
WeSensitive originData = weSensitiveService.selectWeSensitiveById(id);
......@@ -81,6 +87,7 @@ public class WeSensitiveController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:remove')")
@Log(title = "敏感词设置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@ApiOperation("删除敏感词")
public AjaxResult remove(@PathVariable("ids") String ids) {
String[] id = ids.split(",");
Long[] idArray = new Long[id.length];
......@@ -93,6 +100,7 @@ public class WeSensitiveController extends BaseController {
*/
// @PreAuthorize("@ss.hasPermi('wecom:sensitivehit:list')")
@GetMapping("/hit/list")
@ApiOperation("敏感词命中查询")
public TableDataInfo hitList(WeSensitiveHitQuery query) {
return getDataTable(weSensitiveService.getHitSensitiveList(query));
}
......
......@@ -18,6 +18,8 @@ import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.poi.ExcelUtil;
import com.linkwechat.framework.web.domain.server.SysFile;
import com.linkwechat.framework.web.service.FileService;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeTaskFission;
import com.linkwechat.wecom.domain.dto.WeChatUserDTO;
......@@ -55,9 +57,13 @@ import java.util.Objects;
public class WeTaskFissionController extends BaseController {
@Autowired
private IWeTaskFissionService weTaskFissionService;
@Autowired
private CosConfig cosConfig;
@Autowired
private FileService fileService;
/**
* 查询任务宝列表
*/
......@@ -226,10 +232,13 @@ public class WeTaskFissionController extends BaseController {
@Log(title = "上传兑奖图片", businessType = BusinessType.OTHER)
@PostMapping("/upload")
@ApiOperation(value = "上传兑奖图片", httpMethod = "POST")
public AjaxResult<JSONObject> upload(@RequestParam(value = "file") MultipartFile file) throws IOException {
String url = FileUploadUtils.upload2Cos(file, cosConfig);
public AjaxResult<JSONObject> upload(@RequestParam(value = "file") MultipartFile file) throws Exception {
SysFile sysFile
= fileService.upload(file);
// String url = FileUploadUtils.upload2Cos(file, cosConfig);
JSONObject json = new JSONObject();
json.put("rewardImageUrl", cosConfig.getImgUrlPrefix()+url);
json.put("rewardImageUrl", sysFile.getImgUrlPrefix()+sysFile.getFileName());
return AjaxResult.success(json);
}
......
......@@ -164,9 +164,6 @@ public class WeUserController extends BaseController {
@GetMapping({"/synchWeUser"})
public AjaxResult synchWeUser(){
try {
SecurityContext context = SecurityContextHolder.getContext();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weUserService.synchWeUser();
} catch (Exception e) {
e.printStackTrace();
......
#spring.cloud.nacos.config.server-addr=
#spring.cloud.nacos.config.namespace=
#spring.application.name=
#spring.cloud.nacos.config.file-extension=
\ No newline at end of file
linkwechat.nacos.host=119.45.28.29
linkwechat.nacos.port=10848
linkwechat.nacos.namespace=01cf833f-249e-4483-a286-46d37f018fe7
\ No newline at end of file
......@@ -39,12 +39,6 @@
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 自定义验证注解 -->
......@@ -266,6 +260,16 @@
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
* @author Kewen
*/
@Component
@ConfigurationProperties(prefix = "cos")
//@ConfigurationProperties(prefix = "cos")
@Data
public class CosConfig {
......@@ -20,6 +20,6 @@ public class CosConfig {
private String bucketName;
private String imgUrlPrefix;
private String cosImgUrlPrefix;
}
package com.linkwechat.common.config;
import lombok.Data;
@Data
public class FileConfig {
/**是否开启云存储*/
private boolean startCosUpload=false;
/**腾讯云存储相关配置*/
private CosConfig cos;
/**文件前缀*/
private String imgUrlPrefix;
}
package com.linkwechat.common.config;
import com.linkwechat.common.utils.OsUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
......@@ -34,6 +35,13 @@ public class RuoYiConfig
private static String weUserDefaultPwd="123456";
private FileConfig file;
/**是否开启多租户*/
private boolean startTenant=false;
/**匿名访问的URL*/
private String[] anonUrl;
......@@ -80,7 +88,11 @@ public class RuoYiConfig
public static String getProfile()
{
return profile;
if(OsUtils.isWindows()){
return "D:/linkWeChat/uploadPath";
}
return "/linkWeChat/uploadPath";
}
public void setProfile(String profile)
......@@ -145,4 +157,20 @@ public class RuoYiConfig
public void setAnonUrl(String[] anonUrl) {
this.anonUrl = anonUrl;
}
public FileConfig getFile() {
return file;
}
public void setFile(FileConfig file) {
this.file = file;
}
public boolean isStartTenant() {
return startTenant;
}
public void setStartTenant(boolean startTenant) {
this.startTenant = startTenant;
}
}
......@@ -36,4 +36,7 @@ public class WeComeConfig {
/** 第三方自建应用得url*/
private String[] thirdAppUrl;
/**多租户相关表*/
private String[] needTenant=new String[]{};
}
package com.linkwechat.common.core.domain;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.SuperBuilder;
/**
* @description:
* @author: HaoN
* @create: 2021-07-13 15:25
**/
@Data
@Builder
public class FileVo {
private String fileName;
private String url;
}
......@@ -50,6 +50,9 @@ public class SysUser extends BaseEntity
/** 用户类型(00系统用户)(11:企业微信用户) */
private String userType;
/**当前微信用户对应微信端的id*/
private String weUserId;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
......
package com.linkwechat.common.enums;
public enum TrajectorySceneType {
TRAJECTORY_TYPE_XXDT_BCZL(TrajectoryType.TRAJECTORY_TYPE_XXDT.getType(),"信息动态-补充资料",1),
TRAJECTORY_TYPE_XXDT_SZBQ(TrajectoryType.TRAJECTORY_TYPE_XXDT.getType(),"信息动态-设置标签",2);
private String name;
private Integer type;
private Integer key;
TrajectorySceneType( Integer type,String name,Integer key) {
this.name = name;
this.type = type;
this.key=key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getKey() {
return key;
}
public void setKey(Integer key) {
this.key = key;
}
}
......@@ -12,7 +12,6 @@ public enum TrajectoryType {
TRAJECTORY_TYPE_XXDT(1,"信息动态"),
TRAJECTORY_TYPE_SJDT(2,"社交动态"),
TRAJECTORY_TYPE_HDGZ(3,"活动规则"),
......@@ -30,4 +29,21 @@ public enum TrajectoryType {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}
package com.linkwechat.common.utils;
/**
* 操作系统相关判断
*/
public class OsUtils {
public static boolean isWindows() {
String osName = System.getProperties().getProperty("os.name");
System.out.println("current system is " + osName);
return osName.toUpperCase().indexOf("WINDOWS") != -1;
}
}
......@@ -19,6 +19,8 @@ import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.linkwechat.common.constant.Constants;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
public class QREncode {
......@@ -186,6 +188,15 @@ public class QREncode {
}
}
public static MultipartFile getQRCodeMultipartFile(String content, String logoUrl) throws IOException {
BufferedImage bufferedImage = crateQRCode(content, logoUrl);
//读取图片转换为 BufferedImage
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write( bufferedImage, "jpg", baos );
//转换为MultipartFile
return new MockMultipartFile("groupQrCode","groupQrCode.jpg","text/plain", baos.toByteArray());
}
@SuppressWarnings({"unchecked", "rawtypes"})
public static void main(String[] args) throws Exception {
String text = "http://open.weixin.qq.com/qr/code/?username=LinkWeChat2021";
......
......@@ -56,6 +56,8 @@ public class FileUploadUtils {
return defaultBaseDir;
}
/**
* 以默认配置进行文件上传
*
......@@ -194,11 +196,10 @@ public class FileUploadUtils {
COSClient cosClient = new COSClient(cred, clientConfig);
// 指定要上传到 COS 上对象键
String key = "exampleobject";
ObjectMetadata objectMetadata = new ObjectMetadata();
PutObjectRequest putObjectRequest = new PutObjectRequest(cosConfig.getBucketName(), fileName,file.getInputStream(),objectMetadata);
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
log.info("{}","https://link-wechat-1251309172.cos.ap-nanjing.myqcloud.com/"+fileName);
log.info("{}",cosConfig.getCosImgUrlPrefix()+fileName);
log.info("腾讯cos上传信息:{}",new ObjectMapper().writeValueAsString(putObjectResult));
cosClient.shutdown();
......
package com.linkwechat.common.utils.file;
import com.alibaba.fastjson.JSONObject;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.utils.OsUtils;
import com.linkwechat.common.utils.spring.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
/**
* 文件服务
*/
@Slf4j
public class FileUtil {
private static RuoYiConfig ruoYiConfig = SpringUtils.getBean(RuoYiConfig.class);
private static final String WINDOWSFILEPATH="D:/linkWeChat/uploadPath";
private static final String LINUXFILEPATH="/linkWeChat/uploadPath";
/**
* 文件上传
* @param file
* @return
* @throws IOException
*/
public static JSONObject upload(MultipartFile file) throws Exception {
try {
FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
String fileName="";
String imgUrlPrefix="";
if(ruoYiConfig.getFile().isStartCosUpload()){//开启云上传
//开启云上传开关则云上传,不然上传本地
fileName = FileUploadUtils.upload2Cos(file, ruoYiConfig.getFile().getCos());
imgUrlPrefix = ruoYiConfig.getFile().getCos().getCosImgUrlPrefix();
}else {//本地上传
File osFile= OsUtils.isWindows()?new File(WINDOWSFILEPATH):new File(LINUXFILEPATH);
if(!osFile.exists()){
osFile.mkdirs();
}
fileName = FileUploadUtils.upload(osFile.getPath(), file);
imgUrlPrefix = ruoYiConfig.getFile().getImgUrlPrefix();
}
JSONObject reust = new JSONObject();
reust.put("fileName",fileName);
reust.put("imgUrlPrefix",imgUrlPrefix);
return reust;
}catch (Exception e){
throw e;
}
}
/**
* 获取图片(本地,或者网络图片)
* @param fileName
* @param rp
*/
public void findImage(String fileName, HttpServletResponse rp){
try {
String fileDownUrl="";
rp.setContentType("image/png");
if(ruoYiConfig.getFile().isStartCosUpload()) {//开启云上传
fileDownUrl= ruoYiConfig.getFile().getCos().getCosImgUrlPrefix();
FileUtils.downloadFile(fileDownUrl+fileName,rp.getOutputStream());
}else{
fileDownUrl=OsUtils.isWindows()?WINDOWSFILEPATH+"/"+fileName:LINUXFILEPATH+"/"+fileName;
FileUtils.writeBytes(fileDownUrl,rp.getOutputStream());
}
}catch (Exception e){
log.error("图片获取异常:"+e.getMessage());
}
}
}
package com.linkwechat.common.utils.file;
import com.linkwechat.common.utils.StringUtils;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.servlet.http.HttpServletRequest;
......@@ -75,6 +79,40 @@ public class FileUtils extends org.apache.commons.io.FileUtils
}
/**
* 批量下载文件,打包为zip。
* @param fileList 文件列表,每个元素应包含fileName、url,前者即为文件名,后者为下载所需链接
* @param os 输出流
*/
public static void batchDownloadFile(List<Map<String, String>> fileList, OutputStream os) {
try {
ZipOutputStream zos = new ZipOutputStream(os);
for (Map<String, String> fileInfo: fileList) {
String fileName = fileInfo.get("fileName");
String url = fileInfo.get("url");
// 跳过不包含指定键位的对象
if (StringUtils.isEmpty(url) || StringUtils.isEmpty(fileName)){
continue;
}
URL _url = new URL(url);
zos.putNextEntry(new ZipEntry(fileName));
InputStream fis = _url.openConnection().getInputStream();
byte[] buffer = new byte[1024];
int r = 0;
while ((r = fis.read(buffer)) != -1) {
zos.write(buffer, 0, r);
}
fis.close();
}
//关闭zip输出流
zos.flush();
zos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
*
* @param urlPath 下载路径
* @param os 输出流
......
package com.tencent.wework;
import com.linkwechat.common.utils.OsUtils;
public class Finance {
public native static long NewSdk();
......@@ -111,21 +113,17 @@ public class Finance {
public native static int IsMediaDataFinish(long mediaData);
static {
if (isWindows()) {
if (OsUtils.isWindows()) {
System.loadLibrary("libeay32");
System.loadLibrary("libprotobuf");
System.loadLibrary("ssleay32");
System.loadLibrary("libcurl");
System.loadLibrary("WeWorkFinanceSdk");
} else {
System.load("/data/jenkins_home/app/projects/libWeWorkFinanceSdk_Java.so");
System.load("/app/projects/libWeWorkFinanceSdk_Java.so");
}
}
public static boolean isWindows() {
String osName = System.getProperties().getProperty("os.name");
System.out.println("current system is " + osName);
return osName.toUpperCase().indexOf("WINDOWS") != -1;
}
}
\ No newline at end of file
......@@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicLong;
* @date 2020/12/2 16:01
**/
@Slf4j
public class FinanceUtils {
/**
* NewSdk返回的sdk指针
......@@ -100,7 +101,7 @@ public class FinanceUtils {
}
String content = Finance.GetContentFromSlice(slice);
JSONArray chatdataArr = JSONObject.parseObject(content).getJSONArray("chatdata");
log.info("开始执行数据解析:------------");
log.info("开始执行数据解析:------------"+content);
AtomicLong LocalSEQ = new AtomicLong();
if (CollectionUtil.isNotEmpty(chatdataArr)) {
chatdataArr.stream().map(data -> (JSONObject) data).forEach(data -> {
......@@ -285,7 +286,7 @@ public class FinanceUtils {
getMediaData(sdkfileid, "", "", filePath, fileName);
CosConfig cosConfig = SpringUtils.getBean(CosConfig.class);
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
StringBuilder cosUrl = new StringBuilder(cosConfig.getImgUrlPrefix());
StringBuilder cosUrl = new StringBuilder(cosConfig.getCosImgUrlPrefix());
String cosFilePath = FileUploadUtils.upload2Cos(new FileInputStream(new File(filePath, fileName)), suffix, cosConfig);
cosUrl.append(cosFilePath);
data.put("attachment", cosUrl.toString());
......
package com.linkwechat.framework.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
import com.github.pagehelper.PageInterceptor;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.config.WeComeConfig;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.utils.SecurityUtils;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.StringValue;
import org.apache.ibatis.plugin.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
/**
* Mybatis支持*匹配扫描包
......@@ -12,11 +25,65 @@ import org.springframework.context.annotation.Configuration;
* @author ruoyi
*/
@Configuration
public class MyBatisPlusConfig
{
public class MyBatisPlusConfig {
@Autowired
WeComeConfig weComeConfig;
@Autowired
RuoYiConfig ruoYiConfig;
@Bean
public Interceptor[] plugins() {
return new Interceptor[]{new PageInterceptor()};
if(ruoYiConfig.isStartTenant()){ //多租户相关
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(
new TenantLineHandler() {
// 获取租户 ID 值表达式,只支持单个 ID 值
@Override
public Expression getTenantId() {
try {
WeCorpAccount weCorpAccount
= SecurityUtils.getLoginUser().getUser().getWeCorpAccount();
if(null != weCorpAccount){
return new StringValue(weCorpAccount.getCorpId());
}
}catch (Exception e){
return null;
}
return null;
}
// 这是 default 方法,默认返回 false 表示所有表都需要拼多租户条件,
// 这里设置 role表不需要该条件
@Override
public boolean ignoreTable(String tableName) {
if(this.getTenantId()==null){
return true;
}
if (Arrays.asList(weComeConfig.getNeedTenant())
.contains(tableName)){
return false;
}
return true;
}
@Override
public String getTenantIdColumn() {
return "corp_id";
}
}));
return new Interceptor[]{interceptor,new PageInterceptor()
};
}else{
return new Interceptor[]{new PageInterceptor()};
}
}
}
\ No newline at end of file
......@@ -108,7 +108,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(ruoYiConfig.getAnonUrl()).anonymous()
// .antMatchers("/login", "/captchaImage", "/findWxQrLoginInfo", "/wxQrLogin").anonymous()
.antMatchers(
HttpMethod.GET,
"/*.html",
......@@ -116,34 +115,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/**/*.css",
"/**/*.js"
).permitAll()
// .antMatchers("/profile/**").anonymous()
// .antMatchers("/common/download**").anonymous()
// .antMatchers("/common/download/resource**").anonymous()
// .antMatchers("/common/download/url**").anonymous()
// .antMatchers("/swagger-ui.html").anonymous()
// .antMatchers("/swagger-resources/**").anonymous()
// .antMatchers("/webjars/**").anonymous()
// .antMatchers("/*/api-docs").anonymous()
// .antMatchers("/druid/**").anonymous()
// .antMatchers("/wecom/callback/**").anonymous()
//
// .antMatchers("/wecom/chat/item/list").anonymous()
// .antMatchers("/wecom/chat/collection/list").anonymous()
// .antMatchers("/wecom/chat/collection/cancleCollection").anonymous()
// .antMatchers("/wecom/chat/collection/addCollection").anonymous()
// .antMatchers("/wecom/chat/side/h5List").anonymous()
// .antMatchers("/wecom/ticket/**").anonymous()
//
// .antMatchers("/wecom/user/getUserInfo").anonymous()
// // .antMatchers("/common/uploadFile2Cos").anonymous()
//// .antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous()
// .antMatchers("/wecom/portrait/**").anonymous()
// .antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*", "/wecom/reward/getRewardByFissionId/**").anonymous()
// // 获取实际群活码和社群运营H5页面不需要登录
// .antMatchers("/wecom/groupCode/getActualCode/**").anonymous()
// .antMatchers("/wecom/community/h5/**").anonymous()
// //微信授权接口
// .antMatchers("/weixin/auth/**").anonymous()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
......
package com.linkwechat.framework.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* @description:
* @author: HaoN
* @create: 2021-06-01 17:07
**/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
.maxAge(3600)
.allowCredentials(true);
}
}
\ No newline at end of file
package com.linkwechat.framework.security.filter;
import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
......@@ -33,6 +34,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
throws ServletException, IOException
{
LoginUser loginUser = tokenService.getLoginUser(request);
if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
{
tokenService.verifyToken(loginUser);
......
package com.linkwechat.framework.web.domain.server;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 系统文件相关信息
*
* @author ruoyi
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SysFile
{
/**
......@@ -42,73 +51,17 @@ public class SysFile
*/
private double usage;
public String getDirName()
{
return dirName;
}
public void setDirName(String dirName)
{
this.dirName = dirName;
}
public String getSysTypeName()
{
return sysTypeName;
}
public void setSysTypeName(String sysTypeName)
{
this.sysTypeName = sysTypeName;
}
public String getTypeName()
{
return typeName;
}
public void setTypeName(String typeName)
{
this.typeName = typeName;
}
public String getTotal()
{
return total;
}
public void setTotal(String total)
{
this.total = total;
}
public String getFree()
{
return free;
}
public void setFree(String free)
{
this.free = free;
}
/**
* 文件名
*/
private String fileName;
public String getUsed()
{
return used;
}
public void setUsed(String used)
{
this.used = used;
}
/**
* 文件前缀
*/
private String imgUrlPrefix;
public double getUsage()
{
return usage;
}
public void setUsage(double usage)
{
this.usage = usage;
}
}
package com.linkwechat.framework.web.service;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.utils.OsUtils;
import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.common.utils.file.MimeTypeUtils;
import com.linkwechat.framework.web.domain.server.SysFile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
/**
* 文件服务
*/
@Component
@Slf4j
public class FileService {
@Autowired
private RuoYiConfig ruoYiConfig;
private static final String WINDOWSFILEPATH="D:/linkWeChat/uploadPath";
private static final String LINUXFILEPATH="/linkWeChat/uploadPath";
/**
* 文件上传
* @param file
* @return
* @throws IOException
*/
public SysFile upload(MultipartFile file) throws Exception {
try {
FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
String fileName="";
String imgUrlPrefix="";
if(ruoYiConfig.getFile().isStartCosUpload()){//开启云上传
//开启云上传开关则云上传,不然上传本地
fileName = FileUploadUtils.upload2Cos(file, ruoYiConfig.getFile().getCos());
imgUrlPrefix = ruoYiConfig.getFile().getCos().getCosImgUrlPrefix();
}else {//本地上传
File osFile=OsUtils.isWindows()?new File(WINDOWSFILEPATH):new File(LINUXFILEPATH);
if(!osFile.exists()){
osFile.mkdirs();
}
fileName = FileUploadUtils.upload(osFile.getPath(), file);
imgUrlPrefix = ruoYiConfig.getFile().getImgUrlPrefix();
}
return SysFile.builder()
.fileName(fileName)
.imgUrlPrefix(imgUrlPrefix)
.build();
}catch (Exception e){
throw e;
}
}
/**
* 获取图片(本地,或者网络图片)
* @param fileName
* @param rp
*/
public void findImage(String fileName, HttpServletResponse rp){
try {
String fileDownUrl="";
rp.setContentType("image/png");
if(ruoYiConfig.getFile().isStartCosUpload()) {//开启云上传
fileDownUrl= ruoYiConfig.getFile().getCos().getCosImgUrlPrefix();
FileUtils.downloadFile(fileDownUrl+fileName,rp.getOutputStream());
}else{
fileDownUrl=OsUtils.isWindows()?WINDOWSFILEPATH+"/"+fileName:LINUXFILEPATH+"/"+fileName;
FileUtils.writeBytes(fileDownUrl,rp.getOutputStream());
}
}catch (Exception e){
log.error("图片获取异常:"+e.getMessage());
}
}
}
package com.linkwechat.framework.web.service;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import com.linkwechat.common.config.RuoYiConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -41,6 +44,9 @@ public class TokenService
@Value("${token.expireTime}")
private int expireTime;
@Autowired
private RuoYiConfig ruoYiConfig;
protected static final long MILLIS_SECOND = 1000;
protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
......@@ -208,11 +214,19 @@ public class TokenService
*/
private String getToken(HttpServletRequest request)
{
String token = request.getHeader(header);
if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
{
token = token.replace(Constants.TOKEN_PREFIX, "");
String token = "";
//移除匿名接口中请求头的token
if(!Arrays.asList(ruoYiConfig.getAnonUrl()).contains(request.getRequestURI())){
// request.removeAttribute(header);
// request.
token = request.getHeader(header);
if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
{
token = token.replace(Constants.TOKEN_PREFIX, "");
}
}
return token;
}
......
package com.linkwechat.framework.web.service;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.domain.entity.SysRole;
import com.linkwechat.common.core.domain.entity.SysUser;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.core.domain.model.LoginUser;
import com.linkwechat.common.enums.UserStatus;
import com.linkwechat.common.exception.BaseException;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.system.service.ISysRoleService;
import com.linkwechat.system.service.ISysUserService;
import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.service.IWeCorpAccountService;
import com.linkwechat.wecom.service.IWeUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -14,6 +27,9 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户验证处理
*
......@@ -31,6 +47,22 @@ public class UserDetailsServiceImpl implements UserDetailsService
private SysPermissionService permissionService;
@Autowired
private IWeCorpAccountService iWeCorpAccountService;
@Autowired
private ISysRoleService iSysRoleService;
@Autowired
private RuoYiConfig ruoYiConfig;
@Autowired
private IWeUserService iWeUserService;
......@@ -41,52 +73,54 @@ public class UserDetailsServiceImpl implements UserDetailsService
if (StringUtils.isNull(user))
{
log.info("登录用户:{} 不存在.", username);
throw new BaseException("对不起,您的账号:" + username + " 不存在");
// //企业管理登录
// //查询企业管理相关账号
// WeCorpAccount weCorpByAccount = iWeCorpAccountService.findWeCorpByAccount(username);
// if(null != weCorpByAccount){
// //注册到we_user表中
// user=SysUser.builder()
// .userName(weCorpByAccount.getCropAccount())
// .nickName(weCorpByAccount.getCompanyName())
// .userType(Constants.USER_TYOE_CORP_ADMIN)
// .roleIds(ArrayUtil.toArray(roleMapper.selectRoleList(SysRole.builder()
// .roleKey(Constants.DEFAULT_WECOME_CORP_ADMIN)
// .build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// .build();
// }
// else{
//
// //we_user表中去查询,如果该表为空则提示用户不存在,如果不为空,则将用户记录注册到系统用户表中
// WeUser weUser
// = iWeUserService.getById(username);
// if(null == weUser){
// log.info("登录用户:{} 不存在.", username);
// throw new UsernameNotFoundException("登录用户:" + username + " 不存在");
// }
//
// //注册到we_user表中
// user=SysUser.builder()
// .userName(weUser.getUserId())
// .nickName(weUser.getName())
// .userType(Constants.USER_TYPE_WECOME)
// .email(weUser.getEmail())
// .phonenumber(weUser.getMobile())
// .sex(weUser.getGender() ==0 ? "1": weUser.getGender() .toString())
// .avatar(weUser.getAvatarMediaid())
// .roleIds(ArrayUtil.toArray(roleMapper.selectRoleList(SysRole.builder()
// .roleKey(Constants.DEFAULT_WECOME_ROLE_KEY)
// .build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// .build();
// }
// userService.insertUser(
// user
// );
//查询企业管理相关账号
WeCorpAccount weCorpByAccount = iWeCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>().eq(WeCorpAccount::getCorpAccount, username)
.eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE));
if(null != weCorpByAccount){
//注册到we_user表中
user=SysUser.builder()
.userName(weCorpByAccount.getCorpAccount())
.nickName(weCorpByAccount.getCompanyName())
.userType(Constants.USER_TYOE_CORP_ADMIN)
.roleIds(ArrayUtil.toArray(iSysRoleService.selectRoleList(SysRole.builder()
.roleKey(Constants.DEFAULT_WECOME_CORP_ADMIN)
.build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
.password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
.build();
} else{
//we_user表中去查询,如果该表为空则提示用户不存在,如果不为空,则将用户记录注册到系统用户表中
WeUser weUser=iWeUserService.getOne(new LambdaQueryWrapper<WeUser>()
.eq(WeUser::getMobile,username)
.ne(WeUser::getIsActivate,new Integer(6)));
if(null == weUser){
throw new BaseException("对不起,您的账号:" + username + " 不存在");
}
if(StrUtil.isBlank(weUser.getMobile())){
throw new BaseException("请填写当前企业员工的手机号:" + username + " 然后再登录");
}
//注册到we_user表中
user=SysUser.builder()
.userName(username)
.nickName(weUser.getName())
.userType(Constants.USER_TYPE_WECOME)
.email(weUser.getEmail())
.phonenumber(weUser.getMobile())
.sex(weUser.getGender() ==0 ? "1": weUser.getGender() .toString())
.avatar(weUser.getAvatarMediaid())
.weUserId(weUser.getUserId())
.roleIds(ArrayUtil.toArray(iSysRoleService.selectRoleList(SysRole.builder()
.roleKey(Constants.DEFAULT_WECOME_ROLE_KEY)
.build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
.password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
.build();
}
if(user != null){
userService.insertUser(
user
);
}
}
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
......@@ -99,12 +133,14 @@ public class UserDetailsServiceImpl implements UserDetailsService
throw new BaseException("对不起,您的账号:" + username + " 已停用");
}
//当前登录用户为企业管理,设置corpId和密钥相关
// if(user.getUserType().equals(Constants.USER_TYOE_CORP_ADMIN)){
// user.setWeCorpAccount(
// iWeCorpAccountService.findWeCorpByAccount(username)
// );
// }
if(Constants.USER_TYOE_CORP_ADMIN.equals(user.getUserType())){
user.setWeCorpAccount(
iWeCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>().eq(WeCorpAccount::getCorpAccount, username)
.eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE))
);
}
return createLoginUser(user);
......
......@@ -46,13 +46,7 @@ public class RyTask {
private IWeSensitiveService weSensitiveService;
@Autowired
private IWeSensitiveActHitService weSensitiveActHitService;
@Autowired
private IWeCustomerService weCustomerService;
@Autowired
private WeCustomerMessageTimeTaskMapper customerMessageTimeTaskMapper;
@Autowired
private IWeCustomerMessageService weCustomerMessageService;
@Value("${wecome.chatKey}")
private String chartKey;
......@@ -102,20 +96,20 @@ public class RyTask {
}
}
public void WeCustomers() {
//查询系统所有客户
List<WeCustomer> cacheList = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
if (CollectionUtils.isEmpty(cacheList)) {
List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
} else {
List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
List<WeCustomer> weCustomers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
if (CollectionUtils.isNotEmpty(weCustomers) && weCustomers.size() < customers.size()) {
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
}
}
}
// public void WeCustomers() {
// //查询系统所有客户
// List<WeCustomer> cacheList = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
// if (CollectionUtils.isEmpty(cacheList)) {
// List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
// redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
// } else {
// List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
// List<WeCustomer> weCustomers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
// if (CollectionUtils.isNotEmpty(weCustomers) && weCustomers.size() < customers.size()) {
// redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
// }
// }
// }
private void setRedisCacheSeqValue(AtomicLong index) {
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
......@@ -123,10 +117,13 @@ public class RyTask {
searchSourceBuilder.sort(sortBuilderPrice);
searchSourceBuilder.size(1);
List<JSONObject> searchResultList = elasticSearch.search(chartKey, searchSourceBuilder, JSONObject.class);
searchResultList.stream().findFirst().ifPresent(result -> {
index.set(result.getLong(WeConstans.CONTACT_SEQ_KEY) + 1);
});
redisCache.setCacheObject(WeConstans.CONTACT_SEQ_KEY, index);
if(CollectionUtil.isNotEmpty(searchResultList)){
searchResultList.stream().findFirst().ifPresent(result -> {
index.set(result.getLong(WeConstans.CONTACT_SEQ_KEY) + 1);
});
redisCache.setCacheObject(WeConstans.CONTACT_SEQ_KEY, index);
}
}
/**
......@@ -138,39 +135,4 @@ public class RyTask {
}
/**
* 扫描群发消息定时任务
*/
public void messageTask() {
//获的当前时间的毫秒数
long currentTime = System.currentTimeMillis();
//customerMessageTimeTaskMapper
List<WeCustomerMessageTimeTask> weCustomerMessageTimeTasks = customerMessageTimeTaskMapper.selectWeCustomerMessageTimeTaskGteSettingTime(currentTime);
final Semaphore semaphore = new Semaphore(5);
if (CollectionUtils.isNotEmpty(weCustomerMessageTimeTasks)) {
weCustomerMessageTimeTasks.forEach(
s -> {
try {
semaphore.acquire();
if (s.getMessageInfo() != null && s.getMessageId() != null || (s.getMessageInfo().getPushType().equals(WeConstans.SEND_MESSAGE_CUSTOMER)
&& CollectionUtils.isNotEmpty(s.getCustomersInfo())) || (s.getMessageInfo().getPushType().equals(WeConstans.SEND_MESSAGE_GROUP)
&& CollectionUtils.isNotEmpty(s.getGroupsInfo()))) {
weCustomerMessageService.sendMessgae(s.getMessageInfo(), s.getMessageId(), s.getCustomersInfo(), s.getGroupsInfo());
//更新消息处理状态
customerMessageTimeTaskMapper.updateTaskSolvedById(s.getTaskId());
}
semaphore.release();
} catch (JsonProcessingException | InterruptedException e) {
log.error("定时群发消息处理异常:ex:{}", e);
e.printStackTrace();
}
}
);
}
}
}
......@@ -50,7 +50,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* @return 角色数据集合信息
*/
@Override
@DataScope(deptAlias = "d")
// @DataScope(deptAlias = "d")
public List<SysRole> selectRoleList(SysRole role)
{
return roleMapper.selectRoleList(role);
......
......@@ -23,6 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="weUserId" column="we_user_id" />
<result property="userType" column="user_type"/>
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
......@@ -46,8 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
select u.user_id, u.we_user_id,u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,u.user_type,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
......@@ -56,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
select u.user_id,u.we_user_id,u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userName != null and userName != ''">
......@@ -118,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="userType != null and userType != ''">user_type,</if>
<if test="weUserId != null and weUserId != ''">we_user_id,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
......@@ -133,6 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="userType != null and userType != ''">#{userType},</if>
<if test="weUserId != null and weUserId != ''">#{weUserId},</if>
sysdate()
)
</insert>
......
......@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN
* @create: 2020-08-26 14:33
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeAccessTokenClient {
/**
* 获取token(常用token,联系人token)
......@@ -33,7 +33,7 @@ public interface WeAccessTokenClient {
*/
@Request(url = "/service/get_provider_token",
type="POST")
WeAccessTokenDtoDto getProviderToken(@Body("corpid") String corpid, @Body("provider_secret") String provider_secret);
WeAccessTokenDtoDto getProviderToken(@Body("corpid") String corpid,@Body("provider_secret") String provider_secret);
/**
......
......@@ -9,7 +9,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
/**
* 应用管理相关接口
*/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeAppClient {
/**
......@@ -33,5 +33,5 @@ public interface WeAppClient {
* @return
*/
@Request(url = "/agent/set",type = "POST")
WeResultDto updateAgentById(@DataObject WeAppDetailDto weAppDetailDto, @Header("agentid") String agentid);
WeResultDto updateAgentById(@DataObject WeAppDetailDto weAppDetailDto,@Header("agentid")String agentid);
}
......@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN
* @create: 2020-10-17 11:00
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeCropTagClient {
/**
......
......@@ -15,7 +15,7 @@ import java.util.Map;
* @author: HaoN
* @create: 2020-09-15 14:15
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeCustomerClient {
/**
......@@ -49,7 +49,7 @@ public interface WeCustomerClient {
* @return
*/
@Request(url = "/externalcontact/batch/get_by_user", type = "POST")
ExternalUserList getByUser(@DataObject Map<String, Object> query);
ExternalUserList getByUser(@DataObject Map<String,Object> query);
/**
......@@ -87,7 +87,7 @@ public interface WeCustomerClient {
*/
@Request(url = "/externalcontact/unionid_to_external_userid",
type = "POST")
ExternalUserDetail unionidToExternalUserid(@DataObject ExternalUserDetail.ExternalContact unionid);
ExternalUserDetail unionidToExternalUserid(@DataObject ExternalUserDetail.ExternalContact unionid);
/**
......
......@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN
* @create: 2020-10-20 21:50
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeCustomerGroupClient {
......
......@@ -12,7 +12,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: KeWen
* @create: 2020-10-25 21:34
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeCustomerMessagePushClient {
......@@ -27,7 +27,7 @@ public interface WeCustomerMessagePushClient {
/**
* 获取企业群发消息发送结果
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/92136">API文档地址</a>
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/93338#%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E7%BE%A4%E5%8F%91%E6%88%90%E5%91%98%E6%89%A7%E8%A1%8C%E7%BB%93%E6%9E%9C">API文档地址</a>
*
* @param queryCustomerMessageStatusResultDataObjectDto{msgid} <a href="https://work.weixin.qq.com/api/doc/90000/90135/92135">添加企业群发消息任务返回的msgid</a>
*/
......@@ -37,4 +37,7 @@ public interface WeCustomerMessagePushClient {
QueryCustomerMessageStatusResultDto queryCustomerMessageStatus(@Body QueryCustomerMessageStatusResultDataObjectDto queryCustomerMessageStatusResultDataObjectDto);
}
......@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN
* @create: 2020-08-27 16:40
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeDepartMentClient {
/**
......
......@@ -12,7 +12,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN
* @create: 2020-10-13 10:39
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeExternalContactClient {
@Request(url = "/externalcontact/add_contact_way",
......
......@@ -17,7 +17,7 @@ import java.io.InputStream;
* @Description:
* @Date: create in 2020/9/24 0024 0:14
*/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeMediaClient {
/**
* 上传图片
......
......@@ -15,7 +15,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @create: 2020-10-17 22:41
**/
@SuppressWarnings("all")
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeMessagePushClient {
/**
......@@ -24,7 +24,7 @@ public interface WeMessagePushClient {
@Request(url = "/message/send",
type = "POST"
)
WeMessagePushResultDto sendMessageToUser(@DataObject WeMessagePushDto weMessagePushDto, @Header("agentId") String agentId);
WeMessagePushResultDto sendMessageToUser(@DataObject WeMessagePushDto weMessagePushDto,@Header("agentId") String agentId);
/**
* 应用推送消息
......
......@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @description 会话存档接口
* @date 2020/12/2 16:45
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeMsgAuditClient {
/**
......
......@@ -11,7 +11,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @description h5获取签名
* @date 2021/1/6 11:51
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeTicketClient {
/**
* 获取去企业jsapi_ticket
......
......@@ -9,7 +9,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN
* @create: 2020-08-27 16:42
**/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeUserClient {
/**
......@@ -59,7 +59,7 @@ public interface WeUserClient {
* @return
*/
@Request(url="/user/list")
WeUserListDto list(@Query("department_id") Long departmentId, @Query("fetch_child") Integer fetchChild);
WeUserListDto list(@Query("department_id") Long departmentId,@Query("fetch_child") Integer fetchChild);
/**
......@@ -100,5 +100,5 @@ public interface WeUserClient {
* @return
*/
@Request(url = "/user/getuserinfo")
WeUserInfoDto getuserinfo(@Query("code") String code, @Header("agentId") String agentId);
WeUserInfoDto getuserinfo(@Query("code")String code,@Header("agentId")String agentId);
}
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
......@@ -43,5 +44,6 @@ public class WeCommunityNewGroup extends BaseEntity {
/**
* 0 未删除 1 已删除
*/
private int delFlag = 0;
@TableLogic
private int delFlag;
}
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.annotation.Excel;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -34,6 +35,7 @@ public class WeCustomer extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 外部联系人的userid
*/
......
......@@ -107,9 +107,4 @@ public class WeEmpleCode extends BaseEntity {
*/
@TableField(exist = false)
private String mobile;
/**
* 客户添加时是否需要经过确认自动成为好友 1:是 0:否
*/
private Integer isJoinConfirmFriends;
}
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -34,6 +35,7 @@ public class WeFlowerCustomerRel
/** 添加了此外部联系人的企业成员userid */
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String userId;
/** 外部联系人名称 */
......
......@@ -36,6 +36,10 @@ public class WeFlowerCustomerTagRel
/** 添加客户的企业微信用户 */
private Long flowerCustomerRelId;
/**外部联系人id(客户id) */
private String externalUserid;
/** 标签id */
private String tagId;
......
......@@ -2,13 +2,17 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List;
......@@ -33,59 +37,70 @@ public class WeGroupCode extends BaseEntity {
/**
* 活码URL
*/
@ApiModelProperty(value = "活码URL")
private String codeUrl;
/**
* 二维码的uuid
*/
private String uuid;
/**
* 活码头像
*/
private String activityHeadUrl;
@ApiModelProperty(value = "活码头像URL")
private String avatarUrl;
/**
* 活码名称
*/
@NotNull(message = "活码名称不能为空")
@ApiModelProperty(value = "活码名称")
@Size(max = 60, message = "活码名称最大长度为60个字符")
@NotBlank(message = "活码名称不能为空")
private String activityName;
/**
* 活码描述
*/
@NotNull(message = "活码描述不能为空")
@ApiModelProperty(value = "活码描述")
@Size(max = 60, message = "活码描述最大长度为60个字符")
private String activityDesc;
/**
* 场景
*/
@ApiModelProperty(value = "场景")
@Size(max = 60, message = "场景最大长度为60个字符")
// @NotBlank(message = "场景不能为空")
private String activityScene;
/**
* 加群引导语
*/
@ApiModelProperty(value = "加群引导语")
@Size(max = 100, message = "加群引导语最大长度为60个字符")
private String guide;
/**
* 进群是否提示:1:是;0:否;
*/
private Long joinGroupIsTip;
private Long showTip;
/**
* 进群提示语
*/
@ApiModelProperty(value = "进群提示语")
@Size(max = 100, message = "进群提示语最大长度为60个字符")
private String tipMsg;
/**
* 客服二维码
*/
@ApiModelProperty(value = "客服二维码")
@Size(max = 100, message = "客服二维码提示语最大长度为60个字符")
private String customerServerQrCode;
/**
* 0:正常;2:删除;
* 0:正常; 1:删除;
*/
private Long delFlag;
@JsonIgnore
@TableLogic(value = "0", delval = "1")
private Long delFlag = 0L;
/**
* 可用实际码数量
......@@ -111,4 +126,11 @@ public class WeGroupCode extends BaseEntity {
@TableField(exist = false)
private List<WeGroupCodeActual> actualList;
/**
* 实际码id列表,用于前端绑定实际群活码
*/
@JsonIgnore
@TableField(exist = false)
private List<Long> actualIdList;
}
......@@ -5,10 +5,12 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
......@@ -19,10 +21,11 @@ import javax.validation.constraints.NotNull;
* @author ruoyi
* @date 2020-10-07
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel
@Data
@TableName("we_group_code_actual")
public class WeGroupCodeActual
public class WeGroupCodeActual extends BaseEntity
{
private static final long serialVersionUID = 1L;
......
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data;
......@@ -48,4 +49,10 @@ public class WeGroupSop extends BaseEntity {
@TableField(value = "end_time")
private String stopExeTime;
/**
* 逻辑删除字段
*/
@TableLogic(value = "0", delval = "1")
private Integer delFlag;
}
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.linkwechat.wecom.domain.vo.WeGroupCodeVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* 社区运营 - 关键词拉群任务实体
*/
@Data
@Builder
@EqualsAndHashCode(callSuper = true)
@TableName("we_keyword_group")
@ApiModel("关键词拉群模型")
public class WeKeywordGroupTask extends BaseEntity {
/**
* 主键id
*/
@ApiModelProperty("id")
@TableId
private Long taskId = SnowFlakeUtil.nextId();
private Long taskId;
/**
* 任务名称
*/
@ApiModelProperty(value = "任务名称", required = true)
@Size(max = 100, message = "任务名最大长度100")
@NotNull(message = "任务名不能为空")
private String taskName;
/**
* 群活码id
*/
@ApiModelProperty(value = "群活码id", required = true)
@NotNull(message = "群活码不能为空")
private Long groupCodeId;
/**
* 加群引导语
*/
@ApiModelProperty(value = "加群引导语", required = true)
@Size(max = 255, message = "引导语过长,最大长度255")
@NotNull(message = "引导语不可为空")
private String welcomeMsg;
/**
* 关键词
*/
@ApiModelProperty(value = "关键词", required = true)
@Size(max = 255, message = "关键词长度过长。最大长度255")
@NotNull(message = "关键词不可为空")
private String keywords;
/**
* 逻辑删除
*/
@ApiModelProperty(hidden = true)
@JsonIgnore
@TableLogic
private Integer delFlag;
/**
* 群活码信息
*/
@ApiModelProperty(value = "群活码信息")
@TableField(exist = false)
private WeGroupCodeVo groupCodeInfo;
/**
* 实际群聊名称
*/
@ApiModelProperty(value = "实际群聊名称字符串")
@TableField(exist = false)
private String groupNameList;
}
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
......@@ -66,4 +67,9 @@ public class WePresTagGroupTask extends BaseEntity {
*/
private String msgid;
/**
* 逻辑删除字段
*/
@TableLogic(value = "0", delval = "1")
private Integer delFlag;
}
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -40,7 +41,6 @@ public class WeCommunityNewGroupDto {
/**
* 标签id列表
*/
@NotNull(message = "标签不能为空")
private List<String> tagList;
/**
......
......@@ -2,7 +2,9 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
......@@ -13,7 +15,8 @@ public class WeGroupSopDto {
/**
* 规则名
*/
@NotNull(message = "规则名不可为空")
@Size(max = 64, message = "规则名称不可超过64字符")
@NotBlank(message = "规则名不可为空")
private String ruleName;
/**
......@@ -25,13 +28,15 @@ public class WeGroupSopDto {
/**
* 内容标题
*/
@NotNull(message = "标题不可为空")
@Size(max = 64, message = "标题不可超过64字符")
@NotBlank(message = "标题不可为空")
private String title;
/**
* 消息内容
*/
@NotNull(message = "内容不可为空")
@Size(max = 255, message = "标题不可超过255字符")
@NotBlank(message = "内容不可为空")
private String content;
/**
......
......@@ -3,7 +3,9 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
......@@ -28,7 +30,8 @@ public class WePresTagGroupTaskDto {
/**
* 加群引导语
*/
@NotNull(message = "引导语不能为空")
@Size(max = 64, message = "引导与不能超过64字符")
@NotBlank(message = "引导语不能为空")
private String welcomeMsg;
/**
......@@ -50,7 +53,6 @@ public class WePresTagGroupTaskDto {
/**
* 发送范围 0: 全部客户 1:部分客户
*/
@NotNull(message = "发送范围不能为空")
private Integer sendScope;
/**
......
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto.message;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -9,7 +10,7 @@ import java.util.List;
*/
@SuppressWarnings("all")
@Data
public class CustomerMessagePushDto {
public class CustomerMessagePushDto implements Cloneable{
/**
* 群发类型 0 发给客户 1 发给客户群
......@@ -83,7 +84,7 @@ public class CustomerMessagePushDto {
public String content() {
if (this.getMessageType()!=null) {
// 消息类型 0 文本消息 1 图片消息 2 链接消息 3 小程序消息
// 消息类型 0 文本消息 1 图片消息 2 链接消息 3 小程序消息 4 图文
if ( this.getMessageType().equals("0")) {
return this.getTextMessage().getContent();
}
......@@ -102,10 +103,24 @@ public class CustomerMessagePushDto {
return this.getMiniprogramMessage().getTitle() + ":" + this.getMiniprogramMessage().getPage();
}
if(this.getMessageType().equals("4")){
return this.getTextMessage().getContent()+","+this.getImageMessage().getPic_url();
}
}
return null;
}
@Override
public CustomerMessagePushDto clone() throws CloneNotSupportedException {
return (CustomerMessagePushDto) super.clone();
}
}
......@@ -8,4 +8,8 @@ public class QueryCustomerMessageStatusResultDataObjectDto {
* 群发消息的id,通过<a href=“https://work.weixin.qq.com/api/doc/90000/90135/92135”>创建企业群发接口</a>返回
*/
private String msgid;
}
......@@ -17,6 +17,7 @@ public class QueryCustomerMessageStatusResultDto extends WeResultDto {
private String check_status;
}
......@@ -52,61 +52,61 @@ public class ConversationArchiveVo {
private String msgType;
@ApiModelProperty("文本消息内容")
private Content text;
private Content text=new Content();
@ApiModelProperty("图片消息内容")
private Content image;
private Content image=new Content();
@ApiModelProperty("撤回消息")
private Content revoke;
private Content revoke=new Content();
@ApiModelProperty("同意会话聊天内容")
private Content disagree;
private Content disagree=new Content();
@ApiModelProperty("语音内容")
private Content voice;
private Content voice=new Content();
@ApiModelProperty("视频内容")
private Content video;
private Content video=new Content();
@ApiModelProperty("名片")
private Content card;
private Content card=new Content();
@ApiModelProperty("位置")
private Content location;
private Content location=new Content();
@ApiModelProperty("表情")
private Content emotion;
private Content emotion=new Content();
@ApiModelProperty("文件")
private Content file;
private Content file=new Content();
@ApiModelProperty("链接")
private Content link;
private Content link=new Content();
@ApiModelProperty("小程序消息")
private Content weApp;
private Content weApp=new Content();
@ApiModelProperty("会话记录消息")
private Content chatReCord;
private Content chatReCord=new Content();
@ApiModelProperty("待办消息")
private Content todo;
private Content todo=new Content();
@ApiModelProperty("投票消息")
private Content vote;
private Content vote=new Content();
@ApiModelProperty("填表消息")
private Collect collect;
private Collect collect=new Collect();
@ApiModelProperty("红包消息")
private RedPacket redPacket;
private RedPacket redPacket=new RedPacket();
@ApiModelProperty("会议邀请消息")
private Meeting meeting;
private Meeting meeting=new Meeting();
@ApiModelProperty("在线文档消息")
private Content doc;
private Content doc=new Content();
@ApiModelProperty("MarkDown格式消息/图文消息")
private JSONObject info;
......@@ -118,7 +118,7 @@ public class ConversationArchiveVo {
private JSONObject meetingVoiceCall;
@ApiModelProperty("日程消息")
private Calendar calendar;
private Calendar calendar=new Calendar();
@ApiModel
@Data
......
......@@ -19,7 +19,5 @@ public class WeGroupCodeVo {
private Long id;
private String uuid;
private String codeUrl;
}
\ No newline at end of file
......@@ -19,6 +19,7 @@ import java.util.List;
@NoArgsConstructor
public class WeMakeCustomerTag {
private String externalUserid;
private String userId;
private List<WeTag> addTag;
}
......@@ -50,12 +50,6 @@ public class WePresTagGroupTaskVo {
@JsonIgnore
private String codeUrl;
/**
* 群活码uuid
*/
@JsonIgnore
private String CodeUuid;
@TableField(exist = false)
private WeGroupCodeVo groupCodeInfo;
......@@ -132,7 +126,7 @@ public class WePresTagGroupTaskVo {
* 设置群活码信息
*/
public void fillGroupCodeVo() {
WeGroupCodeVo groupCodeVo = new WeGroupCodeVo(this.getCodeId(), this.getCodeUuid(), this.getCodeUrl());
WeGroupCodeVo groupCodeVo = new WeGroupCodeVo(this.getCodeId(),this.getCodeUrl());
this.setGroupCodeInfo(groupCodeVo);
}
}
package com.linkwechat.wecom.domain.vo;
import com.linkwechat.wecom.domain.WeCustomer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
......@@ -15,10 +18,16 @@ import java.util.List;
* 客户任务进度和邀请列表
* </p>
*/
@ApiModel
@Data
@Builder
public class WeTaskFissionProgressVO {
@ApiModelProperty("总数")
private Long total;
@ApiModelProperty("完成数")
private Long completed;
@ApiModelProperty("客户列表")
private List<WeCustomer> customers;
}
......@@ -166,7 +166,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
// 新客拉群创建的员工活码欢迎语图片(群活码图片)
String codeUrl = weGroupCodeService.selectGroupCodeUrlByEmplCodeState(state);
if (StringUtils.isNotNull(codeUrl)) {
buildWelcomeMsgImg(weWelcomeMsgBuilder, codeUrl, codeUrl.replaceAll(cosConfig.getImgUrlPrefix(), ""));
buildWelcomeMsgImg(weWelcomeMsgBuilder, codeUrl, codeUrl.replaceAll(cosConfig.getCosImgUrlPrefix(), ""));
}
// 普通员工活码欢迎语图片
else if (StringUtils.isNotEmpty(messageMap.getCategoryId())) {
......
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.interceptor;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.dtflys.forest.config.ForestConfiguration;
import com.dtflys.forest.exceptions.ForestRuntimeException;
import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.http.ForestResponse;
......@@ -15,7 +16,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
/**
* @description: 微信token拦截器
......@@ -34,6 +38,9 @@ public class WeAccessTokenInterceptor implements Interceptor{
@Autowired
private WeComeConfig weComeConfig;
@Resource
private ForestConfiguration forestConfiguration;
/**
......@@ -41,9 +48,11 @@ public class WeAccessTokenInterceptor implements Interceptor{
*/
@Override
public boolean beforeExecute(ForestRequest request) {
String uri=request.getUrl().replace("http://","");
String weComServerUrl = String.valueOf(forestConfiguration.getVariableValue("weComServerUrl"));
String weComePrefix = String.valueOf(forestConfiguration.getVariableValue("weComePrefix"));
String uri=request.getUrl().replace(weComServerUrl+weComePrefix,"");
log.info(">>>>>>>>>>>>>>>>>>>>>>>>uri:{}",uri);
//request.setContentType("application/json");
if(!Arrays.asList(weComeConfig.getFileUplodUrl()).contains(uri)){
request.setDataType(ForestDataType.JSON);
request.setContentType("application/json");
......@@ -59,26 +68,19 @@ public class WeAccessTokenInterceptor implements Interceptor{
}else if(Arrays.asList(weComeConfig.getNeedChatTokenUrl()).contains(uri)){ //需要会话存档token
token=iWeAccessTokenService.findChatAccessToken();
}else if(Arrays.asList(weComeConfig.getThirdAppUrl()).contains(uri)){ //第三方自建应用token
token=iWeAccessTokenService.findThirdAppAccessToken(
StrUtil.isEmpty(request.getHeaderValue(WeConstans.THIRD_APP_PARAM_TIP))?(String) request.getQuery(WeConstans.THIRD_APP_PARAM_TIP):request.getHeaderValue(WeConstans.THIRD_APP_PARAM_TIP)
);
} else{
token=iWeAccessTokenService.findCommonAccessToken();
}
if (uri.contains("ticket/get")){
request.addQuery("type","agent_config");
}
request.addQuery("access_token",token);
}
//添加服务器统一请求地址
request.setUrl(weComeConfig.getServerUrl()+weComeConfig.getWeComePrefix()+uri);
// request.setUrl(weComeConfig.getServerUrl()+weComeConfig.getWeComePrefix()+uri);
return true;
}
......
......@@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface WeCategoryMapper extends BaseMapper<WeCategory> {
void deleteWeCategoryById(Long[] ids);
}
......@@ -29,7 +29,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id
* @return 结果
*/
public int dropCollection(@Param("materialId") Long materialId, @Param("userId") String userId);
public int dropCollection(@Param("materialId") Long materialId,@Param("userId") String userId);
/**
* 通过素材id和用户id查询当前素材的收藏条数
......@@ -38,7 +38,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id
* @return 当前素材收藏的条数
*/
public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId, @Param("userId") String userId);
public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId,@Param("userId") String userId);
/**
* 收藏列表
......@@ -46,6 +46,6 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id
* @return {@link WeChatSideVo}s
*/
public List<WeChatSideVo> findCollections(@Param("userId") String userId, @Param("keyword") String keyword);
public List<WeChatSideVo> findCollections(@Param("userId") String userId,@Param("keyword") String keyword);
}
......@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatContactMapping;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
......@@ -12,6 +13,7 @@ import java.util.List;
* @author ruoyi
* @date 2020-12-27
*/
@Mapper
public interface WeChatContactMappingMapper extends BaseMapper<WeChatContactMapping> {
/**
* 查询聊天关系映射
......
......@@ -39,5 +39,5 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> {
* @param keyword 关键词
* @return
*/
public List<WeChatSideVo> findChatItems(@Param("sideId") Long sideId, @Param("keyword") String keyword, @Param("mediaType") String mediaType, @Param("userId") String userId);
public List<WeChatSideVo> findChatItems(@Param("sideId") Long sideId, @Param("keyword") String keyword,@Param("mediaType") String mediaType,@Param("userId") String userId);
}
......@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCommunityNewGroup;
import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -15,7 +16,7 @@ import java.util.Optional;
* @author kewen
* @date 2021-02-19
*/
@Repository
@Mapper
public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGroup> {
/**
......@@ -27,9 +28,9 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
* @param endTime 结束时间
* @return {WeCommunityNewGroupVo}s 列表
*/
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(@Param("emplCodeName") String emplCodeName, @Param("createBy") String createBy
, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
// List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(@Param("emplCodeName") String emplCodeName, @Param("createBy") String createBy
// , @Param("beginTime") String beginTime, @Param("endTime") String endTime);
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(WeCommunityNewGroup weCommunityNewGroup);
/**
* 获取新客自动拉群详细信息
*
......@@ -60,12 +61,4 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
* @return 结果
*/
int removeWeCommunityNewGroupByEmplCodeId(@Param("emplCodeId") Long emplCodeId);
/**
* 通过群活码id逻辑删除对应新客拉群信息
* @param groupCodeId 群活码id
* @return 结果
*/
int removeWeCommunityNewGroupByGroupCodeId(@Param("groupCodeId") Long groupCodeId);
}
......@@ -71,7 +71,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param externalUserid
* @return
*/
public List<WeUser> getCustomersByUserId(@Param("externalUserid") String externalUserid);
public List<WeUser> getCustomersByUserId(@Param("externalUserid") String externalUserid,@Param("userId") String userId);
/**
* 通过标签查询客户列表
......@@ -87,7 +87,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param userid
* @return
*/
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(@Param("externalUserid") String externalUserid, @Param("userid") String userid);
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(@Param("externalUserid") String externalUserid,@Param("userid") String userid);
/**
......@@ -96,7 +96,17 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param userid 员工id
* @return
*/
WeCustomerSocialConn countSocialConn(@Param("externalUserid") String externalUserid, @Param("userid") String userid);
WeCustomerSocialConn countSocialConn(@Param("externalUserid")String externalUserid,@Param("userid")String userid);
/**
* 查询企业微信客户列表,不查询一对多关系相关数据
*
* @param weCustomer 企业微信客户
* @return 企业微信客户集合
*/
public List<WeCustomer> selectWeCustomerListNoRel(WeCustomer weCustomer);
}
......@@ -2,8 +2,11 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCustomerMessage;
import com.linkwechat.wecom.domain.dto.message.DetailMessageStatusResultDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 群发消息 微信消息表Mapper接口
*
......@@ -20,7 +23,7 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> {
* @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群)
* @return int
*/
int updateWeCustomerMessageActualSend(@Param("messageId") Long messageId, @Param("actualSend") Integer actualSend);
int updateWeCustomerMessageActualSend(@Param("messageId") Long messageId,@Param("actualSend") Integer actualSend);
/**
* 更新消息发送状态
......@@ -28,6 +31,8 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> {
* @param status 消息发送状态 0 未发送 1 已发送
* @return int
*/
int updateWeCustomerMessageCheckStatusById(@Param("messageId") Long messageId, @Param("status") String status);
int updateWeCustomerMessageCheckStatusById(@Param("messageId") Long messageId,@Param("status") String status);
}
......@@ -25,8 +25,8 @@ public interface WeCustomerMessageOriginalMapper extends BaseMapper<WeCustomerMe
* @param endTime 结束时间
* @return {@link CustomerMessagePushVo}s
*/
public List<CustomerMessagePushVo> selectCustomerMessagePushs(@Param("sender") String sender, @Param("content") String content
, @Param("pushType") String pushType, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
public List<CustomerMessagePushVo> selectCustomerMessagePushs(@Param("sender") String sender,@Param("content") String content
,@Param("pushType") String pushType, @Param("beginTime") String beginTime,@Param("endTime") String endTime);
/**
* 群发详情
......
......@@ -26,8 +26,8 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
* @param sendTime 发送时间,发送状态为1时返回(为时间戳的形式)
* @return int
*/
int updateWeCustomerMessgaeResult(@Param("messageId") Long messageId, @Param("chatId") String chatId, @Param("externalUserid") String externalUserid
, @Param("status") String status, @Param("sendTime") String sendTime);
int updateWeCustomerMessgaeResult(@Param("messageId") Long messageId,@Param("chatId") String chatId,@Param("externalUserid") String externalUserid
,@Param("status") String status,@Param("sendTime") String sendTime);
/**
* 查询微信消息发送情况
......@@ -36,7 +36,7 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
* @param status 发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败
* @return {@link WeCustomerMessageResultVo}s
*/
List<WeCustomerMessageResultVo> customerMessagePushs(@Param("messageId") Long messageId, @Param("status") String status);
List<WeCustomerMessageResultVo> customerMessagePushs(@Param("messageId") Long messageId,@Param("status") String status);
/**
* 检查是否已经同步群发结果
......
......@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.domain.dto.WeEmpleCodeDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -14,7 +15,7 @@ import java.util.List;
* @author ruoyi
* @date 2020-10-04
*/
@Repository
@Mapper
public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
{
/**
......@@ -23,14 +24,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param id 员工活码ID
* @return 员工活码
*/
public WeEmpleCode selectWeEmpleCodeById(Long id);
WeEmpleCode selectWeEmpleCodeById(Long id);
/**
* 批量查询员工活码根据id
* @param ids
* @return
*/
public List<WeEmpleCode> selectWeEmpleCodeByIds(@Param("ids") List<String> ids);
List<WeEmpleCode> selectWeEmpleCodeByIds(@Param("ids") List<String> ids);
/**
* 查询员工活码列表
......@@ -38,7 +39,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param weEmpleCode 员工活码
* @return 员工活码集合
*/
public List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode);
List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode);
/**
* 新增员工活码
......@@ -46,7 +47,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param weEmpleCode 员工活码
* @return 结果
*/
public int insertWeEmpleCode(WeEmpleCode weEmpleCode);
int insertWeEmpleCode(WeEmpleCode weEmpleCode);
/**
* 修改员工活码
......@@ -54,7 +55,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param weEmpleCode 员工活码
* @return 结果
*/
public int updateWeEmpleCode(WeEmpleCode weEmpleCode);
int updateWeEmpleCode(WeEmpleCode weEmpleCode);
/**
* 删除员工活码
......@@ -62,7 +63,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param id 员工活码ID
* @return 结果
*/
public int deleteWeEmpleCodeById(Long id);
int deleteWeEmpleCodeById(Long id);
/**
* 批量删除员工活码
......@@ -70,7 +71,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteWeEmpleCodeByIds(Long[] ids);
int deleteWeEmpleCodeByIds(Long[] ids);
/**
......@@ -79,14 +80,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param ids 需要删除的数据ID
* @return 结果
*/
public int batchRemoveWeEmpleCodeIds(@Param("ids") List<String> ids);
int batchRemoveWeEmpleCodeIds(@Param("ids") List<String> ids);
/**
* 通过活动场景获取客户欢迎语
* @param scenario 活动场景
* @return
*/
public WeEmpleCodeDto selectWelcomeMsgByScenario(@Param("scenario") String scenario, @Param("userId") String userId);
WeEmpleCodeDto selectWelcomeMsgByScenario(@Param("scenario") String scenario, @Param("userId") String userId);
/**
* 通过state定位员工活码
......
......@@ -76,7 +76,7 @@ public interface WeGroupCodeActualMapper extends BaseMapper<WeGroupCodeActual> {
* @param groupCodeId 群活码id
* @return 结果
*/
List<WeGroupCodeActual> selectActualListByGroupCodeId(Long groupCodeId);
List<WeGroupCodeActual> selectActualList(Long groupCodeId);
/**
* 通过群活码id删除实际码
......
......@@ -15,17 +15,7 @@ import org.springframework.stereotype.Repository;
* @date 2020-10-07
*/
@Mapper
@Repository
public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
{
/**
* 查询客户群活码
*
* @param id 客户群活码ID
* @return 客户群活码
*/
WeGroupCode selectWeGroupCodeById(Long id);
public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode> {
/**
* 查询客户群活码列表
*
......@@ -35,13 +25,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode);
/**
* 根据群活码id查询群活码列表
* @param ids id列表
* @return 结果
*/
List<WeGroupCode> selectWeGroupCodeListByIds(List<String> ids);
/**
* 新增客户群活码
*
* @param weGroupCode 客户群活码
......@@ -58,37 +41,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
int updateWeGroupCode(WeGroupCode weGroupCode);
/**
* 删除客户群活码
*
* @param id 客户群活码ID
* @return 结果
*/
int deleteWeGroupCodeById(Long id);
/**
* 批量删除客户群活码
*
* @param ids 需要删除的数据ID
* @return 结果
*/
int deleteWeGroupCodeByIds(Long[] ids);
/**
* 检测活码名称是否唯一
* @param activityName 活码名称
* @return 结果
*/
int checkActivityNameUnique(String activityName);
/**
* 根据 uuid获取群活码
*
* @param uuid uuid
* @return 结果
*/
WeGroupCode getWeGroupByUuid(String uuid);
/**
* 根据群活码id获取对应所有群聊信息
* @param groupCodeId 群活码id
* @return 结果
......
......@@ -29,5 +29,5 @@ public interface WeGroupMapper extends BaseMapper<WeGroup> {
//
// int batchInsetWeGroup(@Param("weGroups") List<WeGroup> weGroups);
List<WeCustomerAddGroup> findWeGroupByCustomer(@Param("userId") String userId, @Param("externalUserid") String externalUserid);
List<WeCustomerAddGroup> findWeGroupByCustomer(@Param("userId") String userId,@Param("externalUserid") String externalUserid);
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!