Commit ef03706e by 水库浪子

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

1 parent 54414b93
Showing 160 changed files with 1260 additions and 654 deletions
...@@ -75,18 +75,13 @@ ...@@ -75,18 +75,13 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <artifactId>jaxb-api</artifactId>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>com.alibaba.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>io.github.leejoker</groupId>
<artifactId>jaxb-api</artifactId> <artifactId>linkwechat-nacos-starter</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -6,7 +6,6 @@ import org.mybatis.spring.annotation.MapperScan; ...@@ -6,7 +6,6 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
/** /**
...@@ -16,9 +15,8 @@ import org.springframework.scheduling.annotation.EnableAsync; ...@@ -16,9 +15,8 @@ import org.springframework.scheduling.annotation.EnableAsync;
*/ */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class}) @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class})
@MapperScan("com.linkwechat.*.mapper") @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 @EnableAsync
@EnableDiscoveryClient
public class LinkWeChatApplication { public class LinkWeChatApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -5,19 +5,25 @@ import com.linkwechat.common.config.RuoYiConfig; ...@@ -5,19 +5,25 @@ import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.config.ServerConfig; import com.linkwechat.common.config.ServerConfig;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.AjaxResult; 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.StringUtils;
import com.linkwechat.common.utils.file.FileUploadUtils; import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.file.FileUtils; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; 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.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/** /**
* 通用请求处理 * 通用请求处理
...@@ -31,8 +37,9 @@ public class CommonController { ...@@ -31,8 +37,9 @@ public class CommonController {
@Autowired @Autowired
private ServerConfig serverConfig; private ServerConfig serverConfig;
@Autowired @Autowired
private CosConfig cosConfig; private FileService fileService;
/** /**
* 通用下载请求 * 通用下载请求
...@@ -114,23 +121,32 @@ public class CommonController { ...@@ -114,23 +121,32 @@ public class CommonController {
* 通用上传请求 * 通用上传请求
*/ */
@PostMapping("/common/uploadFile2Cos") @PostMapping("/common/uploadFile2Cos")
public AjaxResult uploadFile2Cos(MultipartFile file) throws Exception { public AjaxResult uploadFile2Cos(MultipartFile file){
try { try {
String fileName = FileUploadUtils.upload2Cos(file, cosConfig); SysFile sysFile
= fileService.upload(file);
AjaxResult ajax = AjaxResult.success(); return AjaxResult.success(
ajax.put("fileName", fileName); FileVo.builder()
ajax.put("url", url(fileName)); .fileName(sysFile.getFileName())
return ajax; .url(sysFile.getImgUrlPrefix()+sysFile.getFileName())
.build()
);
} catch (Exception e) { } 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; package com.linkwechat.web.controller.system;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.entity.SysMenu; import com.linkwechat.common.core.domain.entity.SysMenu;
...@@ -154,19 +155,31 @@ public class SysLoginController ...@@ -154,19 +155,31 @@ public class SysLoginController
} }
/** /**
* 租户登录 * 通过企业id和企业密钥登录
* @param corpId * @param corpId
* @param corpSecret * @param corpSecret
* @return * @return
*/ */
@GetMapping("/tenantLogin") @GetMapping("/corpLogin")
public AjaxResult tenantLogin(String corpId,String corpSecret){ public AjaxResult corpLogin(String corpId,String corpSecret){
AjaxResult ajax = AjaxResult.success();
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,7 +34,7 @@ public class WeAppController extends BaseController { ...@@ -34,7 +34,7 @@ public class WeAppController extends BaseController {
@PostMapping("/updateWeApp") @PutMapping("/updateWeApp")
public AjaxResult updateWeApp(@RequestBody WeApp weApp){ public AjaxResult updateWeApp(@RequestBody WeApp weApp){
iWeAppService.updateWeApp(weApp); iWeAppService.updateWeApp(weApp);
return AjaxResult.success(); return AjaxResult.success();
...@@ -47,4 +47,8 @@ public class WeAppController extends BaseController { ...@@ -47,4 +47,8 @@ public class WeAppController extends BaseController {
} }
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
...@@ -78,21 +79,23 @@ public class WeCategoryController extends 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) @Log(title = "删除类目", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
@ApiOperation("删除类目") @ApiOperation("删除类目")
public AjaxResult remove(@PathVariable Long[] ids) { public AjaxResult remove(@PathVariable Long[] ids) {
List<WeCategory> categorys=new ArrayList<>(); weCategoryService.deleteWeCategoryById(ids);
for (Long id:ids) { // List<WeCategory> categorys=new ArrayList<>();
categorys.add( // for (Long id:ids) {
WeCategory.builder() // categorys.add(
.id(id) // WeCategory.builder()
.delFlag(Constants.DELETE_CODE) // .id(id)
.build() // .delFlag("55")
); // .build()
} // );
weCategoryService.updateBatchById(categorys); // }
// weCategoryService.updateBatchById(categorys);
return AjaxResult.success(); return AjaxResult.success();
} }
......
...@@ -35,7 +35,12 @@ public class WeChatCollectionController extends BaseController { ...@@ -35,7 +35,12 @@ public class WeChatCollectionController extends BaseController {
@Log(title = "添加收藏", businessType = BusinessType.INSERT) @Log(title = "添加收藏", businessType = BusinessType.INSERT)
@PostMapping("addCollection") @PostMapping("addCollection")
public AjaxResult addCollection(@RequestBody WeChatCollectionDto chatCollectionDto) { 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 { ...@@ -64,11 +64,13 @@ public class WeCommunityGroupSopController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:add')") // @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:add')")
@PostMapping(path = "/") @PostMapping(path = "/")
public AjaxResult addGroupSop(@Validated @RequestBody WeGroupSopDto groupSopDto) { public AjaxResult addGroupSop(@Validated @RequestBody WeGroupSopDto groupSopDto) {
if (!groupSopService.isRuleNameUnique(groupSopDto.getRuleName())) {
return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
}
WeGroupSop weGroupSop = new WeGroupSop(); WeGroupSop weGroupSop = new WeGroupSop();
BeanUtils.copyProperties(groupSopDto, weGroupSop); BeanUtils.copyProperties(groupSopDto, weGroupSop);
if (groupSopService.isNameOccupied(weGroupSop)) {
return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
}
weGroupSop.setCreateBy(SecurityUtils.getUsername()); weGroupSop.setCreateBy(SecurityUtils.getUsername());
// 群聊id列表 // 群聊id列表
List<String> groupIdList = groupSopDto.getChatIdList(); List<String> groupIdList = groupSopDto.getChatIdList();
...@@ -116,14 +118,15 @@ public class WeCommunityGroupSopController extends BaseController { ...@@ -116,14 +118,15 @@ public class WeCommunityGroupSopController extends BaseController {
if (null == groupSopService.getGroupSopById(ruleId)) { if (null == groupSopService.getGroupSopById(ruleId)) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "该群SOP规则不存在"); return AjaxResult.error(HttpStatus.NOT_FOUND, "该群SOP规则不存在");
} }
WeGroupSop weGroupSop = new WeGroupSop();
weGroupSop.setRuleId(ruleId);
BeanUtils.copyProperties(groupSopDto, weGroupSop);
// 校验规则名是否可用 // 校验规则名是否可用
WeGroupSopVo original = groupSopService.getGroupSopById(ruleId); if (groupSopService.isNameOccupied(weGroupSop)) {
if (!groupSopDto.getRuleName().equals(original.getRuleName()) && !groupSopService.isRuleNameUnique(groupSopDto.getRuleName())) {
return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在"); return AjaxResult.error(HttpStatus.BAD_REQUEST, "规则名称已存在");
} }
WeGroupSop weGroupSop = new WeGroupSop();
BeanUtils.copyProperties(groupSopDto, weGroupSop);
weGroupSop.setRuleId(ruleId);
weGroupSop.setUpdateBy(SecurityUtils.getUsername()); weGroupSop.setUpdateBy(SecurityUtils.getUsername());
// 群聊id列表 // 群聊id列表
List<String> groupIdList = groupSopDto.getChatIdList(); List<String> groupIdList = groupSopDto.getChatIdList();
......
...@@ -6,7 +6,7 @@ import com.linkwechat.common.core.domain.entity.SysUser; ...@@ -6,7 +6,7 @@ import com.linkwechat.common.core.domain.entity.SysUser;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.CommunityTaskType; import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.system.service.ISysUserService; 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.IWeCommunityKeywordToGroupService;
import com.linkwechat.wecom.service.IWeGroupSopService; import com.linkwechat.wecom.service.IWeGroupSopService;
import com.linkwechat.wecom.service.IWePresTagGroupTaskService; import com.linkwechat.wecom.service.IWePresTagGroupTaskService;
...@@ -106,7 +106,6 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -106,7 +106,6 @@ public class WeCommunityH5Controller extends BaseController {
} }
/** /**
* 用于支持H5页面的名称和关键字检索 * 用于支持H5页面的名称和关键字检索
* *
...@@ -116,7 +115,7 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -116,7 +115,7 @@ public class WeCommunityH5Controller extends BaseController {
@GetMapping(path = "/filter") @GetMapping(path = "/filter")
public TableDataInfo filter(@RequestParam("word") String word) { public TableDataInfo filter(@RequestParam("word") String word) {
startPage(); startPage();
List<WeKeywordGroupTaskVo> taskList = keywordToGroupService.filterByNameOrKeyword(word); List<WeKeywordGroupTask> taskList = keywordToGroupService.filterByNameOrKeyword(word);
return getDataTable(taskList); return getDataTable(taskList);
} }
} }
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.constant.HttpStatus;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.domain.WeKeywordGroupTask; 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.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.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 关键词拉群controller * 关键词拉群controller
*/ */
@Api(tags = "关键词拉群")
@RestController @RestController
@RequestMapping(value = "/wecom/communityKeywordGroup") @RequestMapping(value = "/wecom/communityKeywordGroup")
public class WeCommunityKeywordGroupController extends BaseController { public class WeCommunityKeywordGroupController extends BaseController {
@Autowired @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')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:list')")
@GetMapping(path = "/list") @GetMapping(path = "/list")
public TableDataInfo<List<WeKeywordGroupTaskVo>> list( public TableDataInfo<List<WeKeywordGroupTask>> list(WeKeywordGroupTask task) {
@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
) {
startPage(); startPage();
List<WeKeywordGroupTaskVo> taskList = keywordToGroupService List<WeKeywordGroupTask> taskList = service.getTaskList(task);
.getTaskList(taskName, createBy, keyword, beginTime, endTime);
return getDataTable(taskList); return getDataTable(taskList);
} }
...@@ -61,35 +46,43 @@ public class WeCommunityKeywordGroupController extends BaseController { ...@@ -61,35 +46,43 @@ public class WeCommunityKeywordGroupController extends BaseController {
* @param taskId 任务id * @param taskId 任务id
* @return 任务详情 * @return 任务详情
*/ */
@ApiOperation(value = "获取任务详情")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:query')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:query')")
@GetMapping(path = "/{taskId}") @GetMapping(path = "/{taskId}")
public AjaxResult getTask(@PathVariable("taskId") Long taskId) { public AjaxResult getTask(@ApiParam("任务id") @PathVariable("taskId") Long taskId) {
return AjaxResult.success(keywordToGroupService.getTaskById(taskId)); return AjaxResult.success(service.getTaskById(taskId));
} }
/** /**
* 添加新任务 * 添加新任务
* *
* @param keywordToGroupDto 添加任务所需的数据 * @param task 添加任务所需的数据
* @return 结果 * @return 结果
*/ */
@ApiOperation(value = "添加新任务")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:add')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:add')")
@PostMapping(path = "/") @PostMapping(path = "/")
public AjaxResult addTask(@RequestBody @Validated WeKeywordGroupTaskDto keywordToGroupDto) { public AjaxResult addTask(@RequestBody @Validated WeKeywordGroupTask task) {
return toAjax(keywordToGroupService.addTask(keywordToGroupDto)); if (service.isNameOccupied(task)) {
return AjaxResult.error("关键词拉群任务名称"+ task.getTaskName() +"已存在");
}
task.setCreateBy(SecurityUtils.getUsername());
task.setCreateTime(new Date());
return toAjax(service.addTask(task));
} }
/** /**
* 根据id及更新数据对指定任务进行更新 * 根据id及更新数据对指定任务进行更新
*
* @param taskId 任务id
* @param keywordToGroupDto 更新所需数据
* @return 结果
*/ */
@ApiOperation(value = "更新任务")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:edit')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:edit')")
@PutMapping(path = "/{taskId}") @PutMapping("/{taskId}")
public AjaxResult updateTask(@PathVariable("taskId") Long taskId, @RequestBody @Validated WeKeywordGroupTaskDto keywordToGroupDto) { public AjaxResult updateTask(
return toAjax(keywordToGroupService.updateTask(taskId, keywordToGroupDto)); @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 { ...@@ -98,10 +91,11 @@ public class WeCommunityKeywordGroupController extends BaseController {
* @param ids id列表 * @param ids id列表
* @return 结果 * @return 结果
*/ */
@ApiOperation(value = "批量删除任务")
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:remove')") // @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:remove')")
@DeleteMapping(path = "/{ids}") @DeleteMapping(path = "/{ids}")
public AjaxResult batchDeleteTask(@PathVariable("ids") Long[] ids) { public AjaxResult batchDeleteTask(@ApiParam("待删除任务id数组") @PathVariable("ids") Long[] ids) {
return toAjax(keywordToGroupService.batchRemoveTaskByIds(ids)); return toAjax(service.batchRemoveTaskByIds(ids));
} }
} }
...@@ -10,6 +10,7 @@ import com.linkwechat.common.enums.BusinessType; ...@@ -10,6 +10,7 @@ import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUtils; import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.wecom.domain.WeCommunityNewGroup;
import com.linkwechat.wecom.domain.WeEmpleCode; import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto; import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto;
import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo; import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo;
...@@ -28,9 +29,8 @@ import javax.servlet.http.HttpServletResponse; ...@@ -28,9 +29,8 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.Arrays; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Optional;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -83,7 +83,6 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -83,7 +83,6 @@ public class WeCommunityNewGroupController extends BaseController {
exc.printStackTrace(); exc.printStackTrace();
} }
}); });
return;
} }
/** /**
...@@ -98,34 +97,19 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -98,34 +97,19 @@ public class WeCommunityNewGroupController extends BaseController {
@Log(title = "员工活码批量下载", businessType = BusinessType.OTHER) @Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
@GetMapping("/downloadBatch") @GetMapping("/downloadBatch")
public void downloadBatch(Long[] ids, HttpServletRequest request, HttpServletResponse response) { 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 { try {
List<WeCommunityNewGroupVo> weCommunityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupByIds(Arrays.asList(ids)); FileUtils.batchDownloadFile(fileList, response.getOutputStream());
//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();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -137,13 +121,9 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -137,13 +121,9 @@ public class WeCommunityNewGroupController extends BaseController {
@ApiOperation(value = "查询新客自动拉群列表", httpMethod = "GET") @ApiOperation(value = "查询新客自动拉群列表", httpMethod = "GET")
// @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:list')") // @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo<List<WeCommunityNewGroupVo>> list( public TableDataInfo<List<WeCommunityNewGroupVo>> list(WeCommunityNewGroup weCommunityNewGroup) {
@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) {
startPage(); startPage();
List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupList(emplCodeName, createBy, beginTime, endTime); List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupList(weCommunityNewGroup);
return getDataTable(communityNewGroupVos); return getDataTable(communityNewGroupVos);
} }
......
...@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom; ...@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.constant.HttpStatus; import com.linkwechat.common.constant.HttpStatus;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
...@@ -53,23 +54,26 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -53,23 +54,26 @@ public class WeCommunityPresTagGroupController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:add')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:add')")
@PostMapping @PostMapping
public AjaxResult addTask(@RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) { public AjaxResult addTask(@RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) {
// 检测任务名是否可用 if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
if (!taskService.checkTaskNameUnique(wePresTagGroupTaskDto.getTaskName())) {
return AjaxResult.error("任务名已存在");
}
if (null == groupCodeService.selectWeGroupCodeById(wePresTagGroupTaskDto.getGroupCodeId())) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在"); return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
} }
// 创建新任务并保存
WePresTagGroupTask task = new WePresTagGroupTask(); WePresTagGroupTask task = new WePresTagGroupTask();
BeanUtils.copyProperties(wePresTagGroupTaskDto, task); BeanUtils.copyProperties(wePresTagGroupTaskDto, task);
// 检测任务名是否可用
if (taskService.isNameOccupied(task)) {
return AjaxResult.error("任务名已存在");
}
task.setCreateBy(SecurityUtils.getUsername()); task.setCreateBy(SecurityUtils.getUsername());
List<String> tagList = wePresTagGroupTaskDto.getTagList(); List<String> tagList = wePresTagGroupTaskDto.getTagList();
List<String> scopeList = wePresTagGroupTaskDto.getScopeList(); List<String> scopeList = wePresTagGroupTaskDto.getScopeList();
int affectedRows = taskService.add(task, tagList, scopeList); int affectedRows = taskService.add(task, tagList, scopeList);
if (affectedRows > 0) { if (affectedRows > 0) {
// 若保存成功,则进行异步消息推送 boolean hasScope = StringUtils.isNotEmpty(wePresTagGroupTaskDto.getScopeList());
taskService.sendMessage(task); 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); return toAjax(affectedRows);
} }
...@@ -93,15 +97,7 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -93,15 +97,7 @@ public class WeCommunityPresTagGroupController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:edit')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:edit')")
@PutMapping(path = "/{id}") @PutMapping(path = "/{id}")
public AjaxResult updateTask(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) { public AjaxResult updateTask(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) {
// 检测任务名是否可用 if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
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())) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在"); return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
} }
return toAjax(taskService.updateTask(id, wePresTagGroupTaskDto)); return toAjax(taskService.updateTask(id, wePresTagGroupTaskDto));
......
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.ConversationArchiveQuery; import com.linkwechat.common.core.domain.ConversationArchiveQuery;
...@@ -11,7 +10,6 @@ import io.swagger.annotations.Api; ...@@ -11,7 +10,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; 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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
......
...@@ -13,8 +13,6 @@ import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; ...@@ -13,8 +13,6 @@ import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.service.IWeCustomerService; import com.linkwechat.wecom.service.IWeCustomerService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; 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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -46,7 +44,6 @@ public class WeCustomerController extends BaseController ...@@ -46,7 +44,6 @@ public class WeCustomerController extends BaseController
public TableDataInfo list(WeCustomer weCustomer) public TableDataInfo list(WeCustomer weCustomer)
{ {
startPage(); startPage();
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer); List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
return getDataTable(list); return getDataTable(list);
} }
...@@ -111,9 +108,6 @@ public class WeCustomerController extends BaseController ...@@ -111,9 +108,6 @@ public class WeCustomerController extends BaseController
@GetMapping("/synchWeCustomer") @GetMapping("/synchWeCustomer")
public AjaxResult synchWeCustomer() { public AjaxResult synchWeCustomer() {
try { try {
SecurityContext context = SecurityContextHolder.getContext();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weCustomerService.synchWeCustomer(); weCustomerService.synchWeCustomer();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -15,7 +15,10 @@ import com.linkwechat.wecom.service.IWeCustomerMessagePushService; ...@@ -15,7 +15,10 @@ import com.linkwechat.wecom.service.IWeCustomerMessagePushService;
import com.linkwechat.wecom.service.IWeCustomerMessgaeResultService; import com.linkwechat.wecom.service.IWeCustomerMessgaeResultService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize; 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 org.springframework.web.bind.annotation.*;
import java.text.ParseException; import java.text.ParseException;
...@@ -50,8 +53,10 @@ public class WeCustomerMessagePushController extends BaseController { ...@@ -50,8 +53,10 @@ public class WeCustomerMessagePushController extends BaseController {
@PostMapping(value = "add") @PostMapping(value = "add")
public AjaxResult add(@RequestBody CustomerMessagePushDto customerMessagePushDto) { public AjaxResult add(@RequestBody CustomerMessagePushDto customerMessagePushDto) {
try { try {
weCustomerMessagePushService.addWeCustomerMessagePush(customerMessagePushDto); weCustomerMessagePushService.addWeCustomerMessagePush(customerMessagePushDto);
} catch (JsonProcessingException | ParseException e) {
} catch (JsonProcessingException | ParseException | CloneNotSupportedException e) {
e.printStackTrace(); e.printStackTrace();
return AjaxResult.error("群发失败"); return AjaxResult.error("群发失败");
} }
......
...@@ -107,7 +107,6 @@ public class WeCustomerPortraitController extends BaseController { ...@@ -107,7 +107,6 @@ public class WeCustomerPortraitController extends BaseController {
public AjaxResult updateWeCustomerPorTraitTag(@RequestBody WeMakeCustomerTag weMakeCustomerTag){ public AjaxResult updateWeCustomerPorTraitTag(@RequestBody WeMakeCustomerTag weMakeCustomerTag){
iWeCustomerService.makeLabel(weMakeCustomerTag); iWeCustomerService.makeLabel(weMakeCustomerTag);
return AjaxResult.success(); return AjaxResult.success();
...@@ -150,16 +149,15 @@ public class WeCustomerPortraitController extends BaseController { ...@@ -150,16 +149,15 @@ public class WeCustomerPortraitController extends BaseController {
* @return * @return
*/ */
@GetMapping(value = "/findTrajectory") @GetMapping(value = "/findTrajectory")
public TableDataInfo findTrajectory(Integer trajectoryType){ public TableDataInfo findTrajectory(String userId,String externalUserid,Integer trajectoryType){
startPage(); startPage();
LambdaQueryWrapper<WeCustomerTrajectory> ne = new LambdaQueryWrapper<WeCustomerTrajectory>() 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){ if(trajectoryType != null){
ne.eq(WeCustomerTrajectory::getTrajectoryType, trajectoryType); ne.eq(WeCustomerTrajectory::getTrajectoryType, trajectoryType);
} }
return getDataTable( return getDataTable(
iWeCustomerTrajectoryService.list(ne) iWeCustomerTrajectoryService.list(ne)
); );
......
...@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUtils; import com.linkwechat.common.utils.file.FileUtils;
...@@ -23,9 +24,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -23,9 +24,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -154,38 +153,19 @@ public class WeEmpleCodeController extends BaseController { ...@@ -154,38 +153,19 @@ public class WeEmpleCodeController extends BaseController {
@Log(title = "员工活码批量下载", businessType = BusinessType.OTHER) @Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
@GetMapping("/downloadBatch") @GetMapping("/downloadBatch")
public void downloadBatch(String ids, HttpServletRequest request, HttpServletResponse response){ public void downloadBatch(String ids, HttpServletRequest request, HttpServletResponse response){
List<String> idList = Arrays.stream(Optional.ofNullable(ids).orElse("").split(",")) List<Map<String, String>> fileList = Arrays
.filter(StringUtils::isNotEmpty).collect(Collectors.toList()); .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 { try {
//通过员工活码id查询活码数据 FileUtils.batchDownloadFile(fileList, response.getOutputStream());
List<WeEmpleCode> weEmpleCodeLsit = weEmpleCodeService.selectWeEmpleCodeByIds(idList); } catch (Exception e) {
//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){
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -196,7 +176,7 @@ public class WeEmpleCodeController extends BaseController { ...@@ -196,7 +176,7 @@ public class WeEmpleCodeController extends BaseController {
public void download(String id, HttpServletRequest request, HttpServletResponse response){ public void download(String id, HttpServletRequest request, HttpServletResponse response){
WeEmpleCode weEmpleCode = weEmpleCodeService.selectWeEmpleCodeById(Long.valueOf(id)); WeEmpleCode weEmpleCode = weEmpleCodeService.selectWeEmpleCodeById(Long.valueOf(id));
if (StringUtils.isEmpty(weEmpleCode.getQrCode())){ if (StringUtils.isEmpty(weEmpleCode.getQrCode())){
return; throw new CustomException("活码不存在");
}else { }else {
try { try {
FileUtils.downloadFile(weEmpleCode.getQrCode(), response.getOutputStream()); FileUtils.downloadFile(weEmpleCode.getQrCode(), response.getOutputStream());
......
...@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -99,7 +100,9 @@ public class WeMaterialController extends BaseController { ...@@ -99,7 +100,9 @@ public class WeMaterialController extends BaseController {
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
@ApiOperation("删除素材信息") @ApiOperation("删除素材信息")
public AjaxResult remove(@PathVariable Long[] ids) { 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 { ...@@ -122,25 +125,58 @@ public class WeMaterialController extends BaseController {
return AjaxResult.success(); 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')") //@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER) @Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
@PostMapping("/temporaryMaterialMediaId") @PostMapping("/temporaryMaterialMediaIdForWeb")
@ApiOperation("获取素材media_id") @ApiOperation("web端发送获取素材media_id")
public AjaxResult temporaryMaterialMediaId(@RequestBody TemporaryMaterialDto temporaryMaterialDto){ public AjaxResult temporaryMaterialMediaIdForWeb(@RequestBody TemporaryMaterialDto temporaryMaterialDto){
WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(temporaryMaterialDto.getUrl(), WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(temporaryMaterialDto.getUrl(),
temporaryMaterialDto.getType() MediaType.of( temporaryMaterialDto.getType()).get().getMediaType()
,temporaryMaterialDto.getName()); ,temporaryMaterialDto.getName());
return AjaxResult.success(weMediaDto); return AjaxResult.success(weMediaDto);
} }
@Log(title = "上传素材图片", businessType = BusinessType.OTHER) @Log(title = "上传素材图片", businessType = BusinessType.OTHER)
@PostMapping("/uploadimg") @PostMapping("/uploadimg")
@ApiOperation("上传素材图片") @ApiOperation("上传素材图片")
public AjaxResult<WeMediaDto> uploadImg(MultipartFile file){ public AjaxResult<WeMediaDto> uploadImg(MultipartFile file, HttpServletRequest request){
WeMediaDto weMediaDto = materialService.uploadImg(file); System.out.println(request.getServerName());
weMediaDto.setFileName(file.getResource().getFilename()); 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); return AjaxResult.success(weMediaDto);
} }
......
...@@ -9,8 +9,9 @@ import com.linkwechat.common.enums.BusinessType; ...@@ -9,8 +9,9 @@ import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeSensitive; import com.linkwechat.wecom.domain.WeSensitive;
import com.linkwechat.wecom.domain.query.WeSensitiveHitQuery; import com.linkwechat.wecom.domain.query.WeSensitiveHitQuery;
import com.linkwechat.wecom.service.IWeSensitiveService; 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.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
...@@ -26,6 +27,7 @@ import java.util.stream.Collectors; ...@@ -26,6 +27,7 @@ import java.util.stream.Collectors;
*/ */
@RestController @RestController
@RequestMapping("/wecom/sensitive") @RequestMapping("/wecom/sensitive")
@Api(tags = "敏感词管理")
public class WeSensitiveController extends BaseController { public class WeSensitiveController extends BaseController {
@Autowired @Autowired
private IWeSensitiveService weSensitiveService; private IWeSensitiveService weSensitiveService;
...@@ -35,6 +37,7 @@ public class WeSensitiveController extends BaseController { ...@@ -35,6 +37,7 @@ public class WeSensitiveController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:list')") // @PreAuthorize("@ss.hasPermi('wecom:sensitive:list')")
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("查询敏感词列表")
public TableDataInfo list(WeSensitive weSensitive) { public TableDataInfo list(WeSensitive weSensitive) {
startPage(); startPage();
List<WeSensitive> list = weSensitiveService.selectWeSensitiveList(weSensitive); List<WeSensitive> list = weSensitiveService.selectWeSensitiveList(weSensitive);
...@@ -46,6 +49,7 @@ public class WeSensitiveController extends BaseController { ...@@ -46,6 +49,7 @@ public class WeSensitiveController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:query')") // @PreAuthorize("@ss.hasPermi('wecom:sensitive:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
@ApiOperation("查询敏感词详情")
public AjaxResult getInfo(@PathVariable("id") Long id) { public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(weSensitiveService.selectWeSensitiveById(id)); return AjaxResult.success(weSensitiveService.selectWeSensitiveById(id));
} }
...@@ -56,6 +60,7 @@ public class WeSensitiveController extends BaseController { ...@@ -56,6 +60,7 @@ public class WeSensitiveController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:add')") // @PreAuthorize("@ss.hasPermi('wecom:sensitive:add')")
@Log(title = "敏感词设置", businessType = BusinessType.INSERT) @Log(title = "敏感词设置", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@ApiOperation("添加敏感词")
public AjaxResult add(@Valid @RequestBody WeSensitive weSensitive) { public AjaxResult add(@Valid @RequestBody WeSensitive weSensitive) {
return toAjax(weSensitiveService.insertWeSensitive(weSensitive)); return toAjax(weSensitiveService.insertWeSensitive(weSensitive));
} }
...@@ -66,6 +71,7 @@ public class WeSensitiveController extends BaseController { ...@@ -66,6 +71,7 @@ public class WeSensitiveController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:edit')") // @PreAuthorize("@ss.hasPermi('wecom:sensitive:edit')")
@Log(title = "敏感词设置", businessType = BusinessType.UPDATE) @Log(title = "敏感词设置", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
@ApiOperation("修改敏感词")
public AjaxResult edit(@Valid @RequestBody WeSensitive weSensitive) { public AjaxResult edit(@Valid @RequestBody WeSensitive weSensitive) {
Long id = weSensitive.getId(); Long id = weSensitive.getId();
WeSensitive originData = weSensitiveService.selectWeSensitiveById(id); WeSensitive originData = weSensitiveService.selectWeSensitiveById(id);
...@@ -81,6 +87,7 @@ public class WeSensitiveController extends BaseController { ...@@ -81,6 +87,7 @@ public class WeSensitiveController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:sensitive:remove')") // @PreAuthorize("@ss.hasPermi('wecom:sensitive:remove')")
@Log(title = "敏感词设置", businessType = BusinessType.DELETE) @Log(title = "敏感词设置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
@ApiOperation("删除敏感词")
public AjaxResult remove(@PathVariable("ids") String ids) { public AjaxResult remove(@PathVariable("ids") String ids) {
String[] id = ids.split(","); String[] id = ids.split(",");
Long[] idArray = new Long[id.length]; Long[] idArray = new Long[id.length];
...@@ -93,6 +100,7 @@ public class WeSensitiveController extends BaseController { ...@@ -93,6 +100,7 @@ public class WeSensitiveController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:sensitivehit:list')") // @PreAuthorize("@ss.hasPermi('wecom:sensitivehit:list')")
@GetMapping("/hit/list") @GetMapping("/hit/list")
@ApiOperation("敏感词命中查询")
public TableDataInfo hitList(WeSensitiveHitQuery query) { public TableDataInfo hitList(WeSensitiveHitQuery query) {
return getDataTable(weSensitiveService.getHitSensitiveList(query)); return getDataTable(weSensitiveService.getHitSensitiveList(query));
} }
......
...@@ -18,6 +18,8 @@ import com.linkwechat.common.utils.DateUtils; ...@@ -18,6 +18,8 @@ import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUploadUtils; import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.poi.ExcelUtil; 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.WeCustomer;
import com.linkwechat.wecom.domain.WeTaskFission; import com.linkwechat.wecom.domain.WeTaskFission;
import com.linkwechat.wecom.domain.dto.WeChatUserDTO; import com.linkwechat.wecom.domain.dto.WeChatUserDTO;
...@@ -55,9 +57,13 @@ import java.util.Objects; ...@@ -55,9 +57,13 @@ import java.util.Objects;
public class WeTaskFissionController extends BaseController { public class WeTaskFissionController extends BaseController {
@Autowired @Autowired
private IWeTaskFissionService weTaskFissionService; private IWeTaskFissionService weTaskFissionService;
@Autowired @Autowired
private CosConfig cosConfig; private CosConfig cosConfig;
@Autowired
private FileService fileService;
/** /**
* 查询任务宝列表 * 查询任务宝列表
*/ */
...@@ -226,10 +232,13 @@ public class WeTaskFissionController extends BaseController { ...@@ -226,10 +232,13 @@ public class WeTaskFissionController extends BaseController {
@Log(title = "上传兑奖图片", businessType = BusinessType.OTHER) @Log(title = "上传兑奖图片", businessType = BusinessType.OTHER)
@PostMapping("/upload") @PostMapping("/upload")
@ApiOperation(value = "上传兑奖图片", httpMethod = "POST") @ApiOperation(value = "上传兑奖图片", httpMethod = "POST")
public AjaxResult<JSONObject> upload(@RequestParam(value = "file") MultipartFile file) throws IOException { public AjaxResult<JSONObject> upload(@RequestParam(value = "file") MultipartFile file) throws Exception {
String url = FileUploadUtils.upload2Cos(file, cosConfig);
SysFile sysFile
= fileService.upload(file);
// String url = FileUploadUtils.upload2Cos(file, cosConfig);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("rewardImageUrl", cosConfig.getImgUrlPrefix()+url); json.put("rewardImageUrl", sysFile.getImgUrlPrefix()+sysFile.getFileName());
return AjaxResult.success(json); return AjaxResult.success(json);
} }
......
...@@ -164,9 +164,6 @@ public class WeUserController extends BaseController { ...@@ -164,9 +164,6 @@ public class WeUserController extends BaseController {
@GetMapping({"/synchWeUser"}) @GetMapping({"/synchWeUser"})
public AjaxResult synchWeUser(){ public AjaxResult synchWeUser(){
try { try {
SecurityContext context = SecurityContextHolder.getContext();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weUserService.synchWeUser(); weUserService.synchWeUser();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -6,12 +6,23 @@ ruoyi: ...@@ -6,12 +6,23 @@ ruoyi:
version: 3.1.0 version: 3.1.0
# 版权年份 # 版权年份
copyrightYear: 2019 copyrightYear: 2019
startTenant: false
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
file:
startCosUpload: true
#腾讯云对象存储
cos:
secretId:
secretKey:
#link-wechat-1251309172.cos.ap-nanjing.myqcloud.com
region:
bucketName:
cosImgUrlPrefix:
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /app/project/pic) # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /app/project/pic)
profile: /app/project/pic #profile: /data/jenkins_home/app/project/
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: true
# 验证码类型 math 数组计算 char 字符验证 # 验证码类型 math 数组计算 char 字符验证
captchaType: math captchaType: math
# 企业微信用户首次登录系统默认密码 # 企业微信用户首次登录系统默认密码
...@@ -41,16 +52,19 @@ ruoyi: ...@@ -41,16 +52,19 @@ ruoyi:
- /wecom/user/getUserInfo - /wecom/user/getUserInfo
- /wecom/portrait/** - /wecom/portrait/**
- /wecom/fission/poster - /wecom/fission/poster
- /wecom/fission/complete/**
- /wecom/fission/*/progress/* - /wecom/fission/*/progress/*
- /wecom/reward/getRewardByFissionId/** - /wecom/reward/getRewardByFissionId/**
- /wecom/groupCode/getActualCode/** - /wecom/groupCode/getActualCode/**
- /wecom/community/h5/** - /wecom/community/h5/**
- /weixin/auth/** - /weixin/auth/**
- /wecom/material/temporaryMaterialMediald - /wecom/material/temporaryMaterialMediaId
- /common/findFile
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口,默认为8090 # 服务器的HTTP端口,默认为8090
port: ${APP_PORT:8090} port: 8090
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
...@@ -73,16 +87,71 @@ path: ...@@ -73,16 +87,71 @@ path:
#H5地址路径 #H5地址路径
H5: H5:
url: www.baidu.com domainPrefix: http://linkwechat.cn/
url: http://h5.linkwechat.cn/index.html
fissionUrl: http://h5.linkwechat.cn/index.html
fissionGroupUrl: http://h5.linkwechat.cn/fission.html
# Spring配置 # Spring配置
spring: spring:
# 资源信息 # 资源信息
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
profiles: datasource:
active: druid type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://127.0.0.1:10179/link-wechat-prod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: root
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username:
login-password:
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
...@@ -122,7 +191,6 @@ spring: ...@@ -122,7 +191,6 @@ spring:
max-wait: -1ms max-wait: -1ms
# token配置 # token配置
token: token:
# 令牌自定义标识 # 令牌自定义标识
...@@ -144,6 +212,14 @@ mybatis-plus: ...@@ -144,6 +212,14 @@ mybatis-plus:
logic-delete-value: 1 logic-delete-value: 1
logic-not-delete-value: 0 logic-not-delete-value: 0
## MyBatis配置
#mybatis:
# # 搜索指定包别名
# typeAliasesPackage: com.linkwechat.**.domain
# # 配置mapper的扫描,找到所有的mapper.xml映射文件
# mapperLocations: classpath*:mapper/**/*Mapper.xml
# # 加载全局的配置文件
# configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件 # PageHelper分页插件
pagehelper: pagehelper:
...@@ -171,7 +247,7 @@ xss: ...@@ -171,7 +247,7 @@ xss:
# elasticsearch配置 # elasticsearch配置
elasticsearch: elasticsearch:
schema: http schema: http
address: 127.0.0.1 address:
userName: "" userName: ""
password: "" password: ""
connectTimeout: 10000 connectTimeout: 10000
...@@ -182,16 +258,19 @@ elasticsearch: ...@@ -182,16 +258,19 @@ elasticsearch:
# forest配置 # forest配置
forest: forest:
# interceptors: com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor
backend: httpclient backend: httpclient
retry-count: 1 # 请求失败后重试次数,默认为0次不重试 retry-count: 1 # 请求失败后重试次数,默认为0次不重试
max-retry-interval: 1000 #重试间隔时间 max-retry-interval: 1000 #重试间隔时间
connect-timeout: 3000 #链接超时时间 connect-timeout: 3000 #链接超时时间
timeout: 3000 # 请求超时时间 timeout: 3000 # 请求超时时间
variables: #全局变量 企微和微信接口地址
weComServerUrl: https://qyapi.weixin.qq.com/
weComePrefix: cgi-bin
wxServerUrl: https://api.weixin.qq.com/
wxPrefix: sns
wecome: wecome:
chatKey: finance chatKey: finance_new
serverUrl: https://qyapi.weixin.qq.com/ serverUrl: https://qyapi.weixin.qq.com/
weComePrefix: cgi-bin weComePrefix: cgi-bin
noAccessTokenUrl: noAccessTokenUrl:
...@@ -225,6 +304,7 @@ wecome: ...@@ -225,6 +304,7 @@ wecome:
- /externalcontact/get_group_msg_result - /externalcontact/get_group_msg_result
- /externalcontact/get_user_behavior_data - /externalcontact/get_user_behavior_data
- /externalcontact/groupchat/statistic - /externalcontact/groupchat/statistic
- /externalcontact/groupchat/statistic_group_by_day
fileUplodUrl: /media/upload,/media/uploadimg fileUplodUrl: /media/upload,/media/uploadimg
needProviderTokenUrl: needProviderTokenUrl:
- /service/get_login_info - /service/get_login_info
...@@ -237,36 +317,30 @@ wecome: ...@@ -237,36 +317,30 @@ wecome:
- /user/getuserinfo - /user/getuserinfo
- /get_jsapi_ticket - /get_jsapi_ticket
- /ticket/get - /ticket/get
- /agent/list
- /message/send - /message/send
- /agent/get
- /agent/set
needTenant:
- we_department
- we_user
- we_customer
- we_flower_customer_rel
- we_flower_customer_tag_rel
- we_group
- we_group_member
- we_tag_group
- we_tag
#企微回调通知配置 #企微回调通知配置
callBack: callBack:
appIdOrCorpId: appIdOrCorpId:
token: token:
encodingAesKey: encodingAesKey:
# JS SDK 身份校验url # JS SDK 身份校验url
authorizeUrl: authorizeUrl: https://open.weixin.qq.com/connect/oauth2/authorize
# JS SDK身份校验成功后的redirect url # JS SDK身份校验成功后的redirect url
authorizeRedirectUrl: authorizeRedirectUrl:
#腾讯云对象存储
cos:
#id
secretId:
#密钥
secretKey:
#地区
region:
#区块空间
bucketName:
#访问前缀
imgUrlPrefix:
#微信公众号配置
weixin: weixin:
appid: appid:
secret: secret:
\ No newline at end of file \ No newline at end of file
#H5地址路径
H5:
url:
fissionUrl:
fissionGroupUrl:
#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 \ 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 \ No newline at end of file
...@@ -39,12 +39,6 @@ ...@@ -39,12 +39,6 @@
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId> <artifactId>pagehelper-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- 自定义验证注解 --> <!-- 自定义验证注解 -->
...@@ -266,6 +260,16 @@ ...@@ -266,6 +260,16 @@
<artifactId>spring-boot-starter-aop</artifactId> <artifactId>spring-boot-starter-aop</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component; ...@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
* @author Kewen * @author Kewen
*/ */
@Component @Component
@ConfigurationProperties(prefix = "cos") //@ConfigurationProperties(prefix = "cos")
@Data @Data
public class CosConfig { public class CosConfig {
...@@ -20,6 +20,6 @@ public class CosConfig { ...@@ -20,6 +20,6 @@ public class CosConfig {
private String bucketName; 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; package com.linkwechat.common.config;
import com.linkwechat.common.utils.OsUtils;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -34,6 +35,13 @@ public class RuoYiConfig ...@@ -34,6 +35,13 @@ public class RuoYiConfig
private static String weUserDefaultPwd="123456"; private static String weUserDefaultPwd="123456";
private FileConfig file;
/**是否开启多租户*/
private boolean startTenant=false;
/**匿名访问的URL*/ /**匿名访问的URL*/
private String[] anonUrl; private String[] anonUrl;
...@@ -80,7 +88,11 @@ public class RuoYiConfig ...@@ -80,7 +88,11 @@ public class RuoYiConfig
public static String getProfile() public static String getProfile()
{ {
return profile; if(OsUtils.isWindows()){
return "D:/linkWeChat/uploadPath";
}
return "/linkWeChat/uploadPath";
} }
public void setProfile(String profile) public void setProfile(String profile)
...@@ -145,4 +157,20 @@ public class RuoYiConfig ...@@ -145,4 +157,20 @@ public class RuoYiConfig
public void setAnonUrl(String[] anonUrl) { public void setAnonUrl(String[] anonUrl) {
this.anonUrl = 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 { ...@@ -36,4 +36,7 @@ public class WeComeConfig {
/** 第三方自建应用得url*/ /** 第三方自建应用得url*/
private String[] thirdAppUrl; 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 ...@@ -50,6 +50,9 @@ public class SysUser extends BaseEntity
/** 用户类型(00系统用户)(11:企业微信用户) */ /** 用户类型(00系统用户)(11:企业微信用户) */
private String userType; private String userType;
/**当前微信用户对应微信端的id*/
private String weUserId;
/** 用户邮箱 */ /** 用户邮箱 */
@Excel(name = "用户邮箱") @Excel(name = "用户邮箱")
private String email; 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 { ...@@ -12,7 +12,6 @@ public enum TrajectoryType {
TRAJECTORY_TYPE_XXDT(1,"信息动态"), TRAJECTORY_TYPE_XXDT(1,"信息动态"),
TRAJECTORY_TYPE_SJDT(2,"社交动态"), TRAJECTORY_TYPE_SJDT(2,"社交动态"),
TRAJECTORY_TYPE_HDGZ(3,"活动规则"), TRAJECTORY_TYPE_HDGZ(3,"活动规则"),
...@@ -30,4 +29,21 @@ public enum TrajectoryType { ...@@ -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; ...@@ -19,6 +19,8 @@ import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter; import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
public class QREncode { public class QREncode {
...@@ -186,6 +188,15 @@ 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"}) @SuppressWarnings({"unchecked", "rawtypes"})
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String text = "http://open.weixin.qq.com/qr/code/?username=LinkWeChat2021"; String text = "http://open.weixin.qq.com/qr/code/?username=LinkWeChat2021";
......
...@@ -56,6 +56,8 @@ public class FileUploadUtils { ...@@ -56,6 +56,8 @@ public class FileUploadUtils {
return defaultBaseDir; return defaultBaseDir;
} }
/** /**
* 以默认配置进行文件上传 * 以默认配置进行文件上传
* *
...@@ -194,11 +196,10 @@ public class FileUploadUtils { ...@@ -194,11 +196,10 @@ public class FileUploadUtils {
COSClient cosClient = new COSClient(cred, clientConfig); COSClient cosClient = new COSClient(cred, clientConfig);
// 指定要上传到 COS 上对象键 // 指定要上传到 COS 上对象键
String key = "exampleobject";
ObjectMetadata objectMetadata = new ObjectMetadata(); ObjectMetadata objectMetadata = new ObjectMetadata();
PutObjectRequest putObjectRequest = new PutObjectRequest(cosConfig.getBucketName(), fileName,file.getInputStream(),objectMetadata); PutObjectRequest putObjectRequest = new PutObjectRequest(cosConfig.getBucketName(), fileName,file.getInputStream(),objectMetadata);
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest); 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)); log.info("腾讯cos上传信息:{}",new ObjectMapper().writeValueAsString(putObjectResult));
cosClient.shutdown(); 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; package com.linkwechat.common.utils.file;
import com.linkwechat.common.utils.StringUtils;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -75,6 +79,40 @@ public class FileUtils extends org.apache.commons.io.FileUtils ...@@ -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 urlPath 下载路径
* @param os 输出流 * @param os 输出流
......
package com.tencent.wework; package com.tencent.wework;
import com.linkwechat.common.utils.OsUtils;
public class Finance { public class Finance {
public native static long NewSdk(); public native static long NewSdk();
...@@ -111,21 +113,17 @@ public class Finance { ...@@ -111,21 +113,17 @@ public class Finance {
public native static int IsMediaDataFinish(long mediaData); public native static int IsMediaDataFinish(long mediaData);
static { static {
if (isWindows()) { if (OsUtils.isWindows()) {
System.loadLibrary("libeay32"); System.loadLibrary("libeay32");
System.loadLibrary("libprotobuf"); System.loadLibrary("libprotobuf");
System.loadLibrary("ssleay32"); System.loadLibrary("ssleay32");
System.loadLibrary("libcurl"); System.loadLibrary("libcurl");
System.loadLibrary("WeWorkFinanceSdk"); System.loadLibrary("WeWorkFinanceSdk");
} else { } 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 \ No newline at end of file
...@@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicLong; ...@@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicLong;
* @date 2020/12/2 16:01 * @date 2020/12/2 16:01
**/ **/
@Slf4j @Slf4j
public class FinanceUtils { public class FinanceUtils {
/** /**
* NewSdk返回的sdk指针 * NewSdk返回的sdk指针
...@@ -100,7 +101,7 @@ public class FinanceUtils { ...@@ -100,7 +101,7 @@ public class FinanceUtils {
} }
String content = Finance.GetContentFromSlice(slice); String content = Finance.GetContentFromSlice(slice);
JSONArray chatdataArr = JSONObject.parseObject(content).getJSONArray("chatdata"); JSONArray chatdataArr = JSONObject.parseObject(content).getJSONArray("chatdata");
log.info("开始执行数据解析:------------"); log.info("开始执行数据解析:------------"+content);
AtomicLong LocalSEQ = new AtomicLong(); AtomicLong LocalSEQ = new AtomicLong();
if (CollectionUtil.isNotEmpty(chatdataArr)) { if (CollectionUtil.isNotEmpty(chatdataArr)) {
chatdataArr.stream().map(data -> (JSONObject) data).forEach(data -> { chatdataArr.stream().map(data -> (JSONObject) data).forEach(data -> {
...@@ -285,7 +286,7 @@ public class FinanceUtils { ...@@ -285,7 +286,7 @@ public class FinanceUtils {
getMediaData(sdkfileid, "", "", filePath, fileName); getMediaData(sdkfileid, "", "", filePath, fileName);
CosConfig cosConfig = SpringUtils.getBean(CosConfig.class); CosConfig cosConfig = SpringUtils.getBean(CosConfig.class);
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); 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); String cosFilePath = FileUploadUtils.upload2Cos(new FileInputStream(new File(filePath, fileName)), suffix, cosConfig);
cosUrl.append(cosFilePath); cosUrl.append(cosFilePath);
data.put("attachment", cosUrl.toString()); data.put("attachment", cosUrl.toString());
......
package com.linkwechat.framework.config; 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.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.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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
/** /**
* Mybatis支持*匹配扫描包 * Mybatis支持*匹配扫描包
...@@ -12,11 +25,65 @@ import org.springframework.context.annotation.Configuration; ...@@ -12,11 +25,65 @@ import org.springframework.context.annotation.Configuration;
* @author ruoyi * @author ruoyi
*/ */
@Configuration @Configuration
public class MyBatisPlusConfig public class MyBatisPlusConfig {
{ @Autowired
WeComeConfig weComeConfig;
@Autowired
RuoYiConfig ruoYiConfig;
@Bean @Bean
public Interceptor[] plugins() { public Interceptor[] plugins() {
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()}; return new Interceptor[]{new PageInterceptor()};
} }
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -108,7 +108,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -108,7 +108,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(ruoYiConfig.getAnonUrl()).anonymous() .antMatchers(ruoYiConfig.getAnonUrl()).anonymous()
// .antMatchers("/login", "/captchaImage", "/findWxQrLoginInfo", "/wxQrLogin").anonymous()
.antMatchers( .antMatchers(
HttpMethod.GET, HttpMethod.GET,
"/*.html", "/*.html",
...@@ -116,34 +115,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -116,34 +115,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/**/*.css", "/**/*.css",
"/**/*.js" "/**/*.js"
).permitAll() ).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() .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 \ No newline at end of file
package com.linkwechat.framework.security.filter; package com.linkwechat.framework.security.filter;
import java.io.IOException; import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -33,6 +34,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter ...@@ -33,6 +34,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
throws ServletException, IOException throws ServletException, IOException
{ {
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
{ {
tokenService.verifyToken(loginUser); tokenService.verifyToken(loginUser);
......
package com.linkwechat.framework.web.domain.server; package com.linkwechat.framework.web.domain.server;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/** /**
* 系统文件相关信息 * 系统文件相关信息
* *
* @author ruoyi * @author ruoyi
*/ */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SysFile public class SysFile
{ {
/** /**
...@@ -42,73 +51,17 @@ public class SysFile ...@@ -42,73 +51,17 @@ public class SysFile
*/ */
private double usage; 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; */
} private String fileName;
public String getFree()
{
return free;
}
public void setFree(String free)
{
this.free = free;
}
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; package com.linkwechat.framework.web.service;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.linkwechat.common.config.RuoYiConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -41,6 +44,9 @@ public class TokenService ...@@ -41,6 +44,9 @@ public class TokenService
@Value("${token.expireTime}") @Value("${token.expireTime}")
private int expireTime; private int expireTime;
@Autowired
private RuoYiConfig ruoYiConfig;
protected static final long MILLIS_SECOND = 1000; protected static final long MILLIS_SECOND = 1000;
protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
...@@ -208,11 +214,19 @@ public class TokenService ...@@ -208,11 +214,19 @@ public class TokenService
*/ */
private String getToken(HttpServletRequest request) private String getToken(HttpServletRequest request)
{ {
String token = request.getHeader(header); 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)) if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
{ {
token = token.replace(Constants.TOKEN_PREFIX, ""); token = token.replace(Constants.TOKEN_PREFIX, "");
} }
}
return token; return token;
} }
......
package com.linkwechat.framework.web.service; 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.SysUser;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.core.domain.model.LoginUser; import com.linkwechat.common.core.domain.model.LoginUser;
import com.linkwechat.common.enums.UserStatus; import com.linkwechat.common.enums.UserStatus;
import com.linkwechat.common.exception.BaseException; import com.linkwechat.common.exception.BaseException;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.system.service.ISysRoleService;
import com.linkwechat.system.service.ISysUserService; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -14,6 +27,9 @@ import org.springframework.security.core.userdetails.UserDetailsService; ...@@ -14,6 +27,9 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* 用户验证处理 * 用户验证处理
* *
...@@ -31,6 +47,22 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -31,6 +47,22 @@ public class UserDetailsServiceImpl implements UserDetailsService
private SysPermissionService permissionService; 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 ...@@ -41,52 +73,54 @@ public class UserDetailsServiceImpl implements UserDetailsService
if (StringUtils.isNull(user)) if (StringUtils.isNull(user))
{ {
log.info("登录用户:{} 不存在.", username); //查询企业管理相关账号
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 + " 不存在"); throw new BaseException("对不起,您的账号:" + username + " 不存在");
// //企业管理登录 }
// //查询企业管理相关账号 if(StrUtil.isBlank(weUser.getMobile())){
// WeCorpAccount weCorpByAccount = iWeCorpAccountService.findWeCorpByAccount(username); throw new BaseException("请填写当前企业员工的手机号:" + username + " 然后再登录");
// if(null != weCorpByAccount){ }
// //注册到we_user表中 //注册到we_user表中
// user=SysUser.builder() user=SysUser.builder()
// .userName(weCorpByAccount.getCropAccount()) .userName(username)
// .nickName(weCorpByAccount.getCompanyName()) .nickName(weUser.getName())
// .userType(Constants.USER_TYOE_CORP_ADMIN) .userType(Constants.USER_TYPE_WECOME)
// .roleIds(ArrayUtil.toArray(roleMapper.selectRoleList(SysRole.builder() .email(weUser.getEmail())
// .roleKey(Constants.DEFAULT_WECOME_CORP_ADMIN) .phonenumber(weUser.getMobile())
// .build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class)) .sex(weUser.getGender() ==0 ? "1": weUser.getGender() .toString())
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd())) .avatar(weUser.getAvatarMediaid())
// .build(); .weUserId(weUser.getUserId())
// } .roleIds(ArrayUtil.toArray(iSysRoleService.selectRoleList(SysRole.builder()
.roleKey(Constants.DEFAULT_WECOME_ROLE_KEY)
// else{ .build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// //we_user表中去查询,如果该表为空则提示用户不存在,如果不为空,则将用户记录注册到系统用户表中 .build();
// WeUser weUser
// = iWeUserService.getById(username); }
// if(null == weUser){
// log.info("登录用户:{} 不存在.", username); if(user != null){
// throw new UsernameNotFoundException("登录用户:" + username + " 不存在"); userService.insertUser(
// } user
// );
// //注册到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
// );
} }
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{ {
...@@ -99,12 +133,14 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -99,12 +133,14 @@ public class UserDetailsServiceImpl implements UserDetailsService
throw new BaseException("对不起,您的账号:" + username + " 已停用"); throw new BaseException("对不起,您的账号:" + username + " 已停用");
} }
//当前登录用户为企业管理,设置corpId和密钥相关 //当前登录用户为企业管理,设置corpId和密钥相关
// if(user.getUserType().equals(Constants.USER_TYOE_CORP_ADMIN)){ if(Constants.USER_TYOE_CORP_ADMIN.equals(user.getUserType())){
// user.setWeCorpAccount( user.setWeCorpAccount(
// iWeCorpAccountService.findWeCorpByAccount(username) iWeCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>().eq(WeCorpAccount::getCorpAccount, username)
// ); .eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE))
// } );
}
return createLoginUser(user); return createLoginUser(user);
......
...@@ -46,13 +46,7 @@ public class RyTask { ...@@ -46,13 +46,7 @@ public class RyTask {
private IWeSensitiveService weSensitiveService; private IWeSensitiveService weSensitiveService;
@Autowired @Autowired
private IWeSensitiveActHitService weSensitiveActHitService; private IWeSensitiveActHitService weSensitiveActHitService;
@Autowired
private IWeCustomerService weCustomerService;
@Autowired
private WeCustomerMessageTimeTaskMapper customerMessageTimeTaskMapper;
@Autowired
private IWeCustomerMessageService weCustomerMessageService;
@Value("${wecome.chatKey}") @Value("${wecome.chatKey}")
private String chartKey; private String chartKey;
...@@ -102,20 +96,20 @@ public class RyTask { ...@@ -102,20 +96,20 @@ public class RyTask {
} }
} }
public void WeCustomers() { // public void WeCustomers() {
//查询系统所有客户 // //查询系统所有客户
List<WeCustomer> cacheList = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY); // List<WeCustomer> cacheList = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
if (CollectionUtils.isEmpty(cacheList)) { // if (CollectionUtils.isEmpty(cacheList)) {
List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null); // List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers); // redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
} else { // } else {
List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null); // List<WeCustomer> customers = weCustomerService.selectWeCustomerList(null);
List<WeCustomer> weCustomers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY); // List<WeCustomer> weCustomers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
if (CollectionUtils.isNotEmpty(weCustomers) && weCustomers.size() < customers.size()) { // if (CollectionUtils.isNotEmpty(weCustomers) && weCustomers.size() < customers.size()) {
redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers); // redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
} // }
} // }
} // }
private void setRedisCacheSeqValue(AtomicLong index) { private void setRedisCacheSeqValue(AtomicLong index) {
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -123,12 +117,15 @@ public class RyTask { ...@@ -123,12 +117,15 @@ public class RyTask {
searchSourceBuilder.sort(sortBuilderPrice); searchSourceBuilder.sort(sortBuilderPrice);
searchSourceBuilder.size(1); searchSourceBuilder.size(1);
List<JSONObject> searchResultList = elasticSearch.search(chartKey, searchSourceBuilder, JSONObject.class); List<JSONObject> searchResultList = elasticSearch.search(chartKey, searchSourceBuilder, JSONObject.class);
if(CollectionUtil.isNotEmpty(searchResultList)){
searchResultList.stream().findFirst().ifPresent(result -> { searchResultList.stream().findFirst().ifPresent(result -> {
index.set(result.getLong(WeConstans.CONTACT_SEQ_KEY) + 1); index.set(result.getLong(WeConstans.CONTACT_SEQ_KEY) + 1);
}); });
redisCache.setCacheObject(WeConstans.CONTACT_SEQ_KEY, index); redisCache.setCacheObject(WeConstans.CONTACT_SEQ_KEY, index);
} }
}
/** /**
* @param corpId 企业id * @param corpId 企业id
* @param secret 会话密钥 * @param secret 会话密钥
...@@ -138,39 +135,4 @@ public class RyTask { ...@@ -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 ...@@ -50,7 +50,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* @return 角色数据集合信息 * @return 角色数据集合信息
*/ */
@Override @Override
@DataScope(deptAlias = "d") // @DataScope(deptAlias = "d")
public List<SysRole> selectRoleList(SysRole role) public List<SysRole> selectRoleList(SysRole role)
{ {
return roleMapper.selectRoleList(role); return roleMapper.selectRoleList(role);
......
...@@ -23,6 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -23,6 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <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" /> <association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> <collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap> </resultMap>
...@@ -46,8 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -46,8 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectUserVo"> <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, 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, 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 r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
...@@ -56,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -56,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> <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 left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0' where u.del_flag = '0'
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
...@@ -118,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -118,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="userType != null and userType != ''">user_type,</if> <if test="userType != null and userType != ''">user_type,</if>
<if test="weUserId != null and weUserId != ''">we_user_id,</if>
create_time create_time
)values( )values(
<if test="userId != null and userId != ''">#{userId},</if> <if test="userId != null and userId != ''">#{userId},</if>
...@@ -133,6 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -133,6 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="userType != null and userType != ''">#{userType},</if> <if test="userType != null and userType != ''">#{userType},</if>
<if test="weUserId != null and weUserId != ''">#{weUserId},</if>
sysdate() sysdate()
) )
</insert> </insert>
......
...@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; ...@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN * @author: HaoN
* @create: 2020-08-26 14:33 * @create: 2020-08-26 14:33
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeAccessTokenClient { public interface WeAccessTokenClient {
/** /**
* 获取token(常用token,联系人token) * 获取token(常用token,联系人token)
...@@ -33,7 +33,7 @@ public interface WeAccessTokenClient { ...@@ -33,7 +33,7 @@ public interface WeAccessTokenClient {
*/ */
@Request(url = "/service/get_provider_token", @Request(url = "/service/get_provider_token",
type="POST") 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; ...@@ -9,7 +9,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
/** /**
* 应用管理相关接口 * 应用管理相关接口
*/ */
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeAppClient { public interface WeAppClient {
/** /**
...@@ -33,5 +33,5 @@ public interface WeAppClient { ...@@ -33,5 +33,5 @@ public interface WeAppClient {
* @return * @return
*/ */
@Request(url = "/agent/set",type = "POST") @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; ...@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN * @author: HaoN
* @create: 2020-10-17 11:00 * @create: 2020-10-17 11:00
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeCropTagClient { public interface WeCropTagClient {
/** /**
......
...@@ -15,7 +15,7 @@ import java.util.Map; ...@@ -15,7 +15,7 @@ import java.util.Map;
* @author: HaoN * @author: HaoN
* @create: 2020-09-15 14:15 * @create: 2020-09-15 14:15
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeCustomerClient { public interface WeCustomerClient {
/** /**
...@@ -49,7 +49,7 @@ public interface WeCustomerClient { ...@@ -49,7 +49,7 @@ public interface WeCustomerClient {
* @return * @return
*/ */
@Request(url = "/externalcontact/batch/get_by_user", type = "POST") @Request(url = "/externalcontact/batch/get_by_user", type = "POST")
ExternalUserList getByUser(@DataObject Map<String, Object> query); ExternalUserList getByUser(@DataObject Map<String,Object> query);
/** /**
......
...@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; ...@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN * @author: HaoN
* @create: 2020-10-20 21:50 * @create: 2020-10-20 21:50
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeCustomerGroupClient { public interface WeCustomerGroupClient {
......
...@@ -12,7 +12,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; ...@@ -12,7 +12,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: KeWen * @author: KeWen
* @create: 2020-10-25 21:34 * @create: 2020-10-25 21:34
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeCustomerMessagePushClient { public interface WeCustomerMessagePushClient {
...@@ -27,7 +27,7 @@ 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> * @param queryCustomerMessageStatusResultDataObjectDto{msgid} <a href="https://work.weixin.qq.com/api/doc/90000/90135/92135">添加企业群发消息任务返回的msgid</a>
*/ */
...@@ -37,4 +37,7 @@ public interface WeCustomerMessagePushClient { ...@@ -37,4 +37,7 @@ public interface WeCustomerMessagePushClient {
QueryCustomerMessageStatusResultDto queryCustomerMessageStatus(@Body QueryCustomerMessageStatusResultDataObjectDto queryCustomerMessageStatusResultDataObjectDto); QueryCustomerMessageStatusResultDto queryCustomerMessageStatus(@Body QueryCustomerMessageStatusResultDataObjectDto queryCustomerMessageStatusResultDataObjectDto);
} }
...@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; ...@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN * @author: HaoN
* @create: 2020-08-27 16:40 * @create: 2020-08-27 16:40
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeDepartMentClient { public interface WeDepartMentClient {
/** /**
......
...@@ -12,7 +12,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; ...@@ -12,7 +12,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN * @author: HaoN
* @create: 2020-10-13 10:39 * @create: 2020-10-13 10:39
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeExternalContactClient { public interface WeExternalContactClient {
@Request(url = "/externalcontact/add_contact_way", @Request(url = "/externalcontact/add_contact_way",
......
...@@ -17,7 +17,7 @@ import java.io.InputStream; ...@@ -17,7 +17,7 @@ import java.io.InputStream;
* @Description: * @Description:
* @Date: create in 2020/9/24 0024 0:14 * @Date: create in 2020/9/24 0024 0:14
*/ */
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeMediaClient { public interface WeMediaClient {
/** /**
* 上传图片 * 上传图片
......
...@@ -15,7 +15,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; ...@@ -15,7 +15,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @create: 2020-10-17 22:41 * @create: 2020-10-17 22:41
**/ **/
@SuppressWarnings("all") @SuppressWarnings("all")
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeMessagePushClient { public interface WeMessagePushClient {
/** /**
...@@ -24,7 +24,7 @@ public interface WeMessagePushClient { ...@@ -24,7 +24,7 @@ public interface WeMessagePushClient {
@Request(url = "/message/send", @Request(url = "/message/send",
type = "POST" 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; ...@@ -13,7 +13,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @description 会话存档接口 * @description 会话存档接口
* @date 2020/12/2 16:45 * @date 2020/12/2 16:45
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeMsgAuditClient { public interface WeMsgAuditClient {
/** /**
......
...@@ -11,7 +11,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; ...@@ -11,7 +11,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @description h5获取签名 * @description h5获取签名
* @date 2021/1/6 11:51 * @date 2021/1/6 11:51
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeTicketClient { public interface WeTicketClient {
/** /**
* 获取去企业jsapi_ticket * 获取去企业jsapi_ticket
......
...@@ -9,7 +9,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; ...@@ -9,7 +9,7 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
* @author: HaoN * @author: HaoN
* @create: 2020-08-27 16:42 * @create: 2020-08-27 16:42
**/ **/
@BaseRequest(interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
public interface WeUserClient { public interface WeUserClient {
/** /**
...@@ -59,7 +59,7 @@ public interface WeUserClient { ...@@ -59,7 +59,7 @@ public interface WeUserClient {
* @return * @return
*/ */
@Request(url="/user/list") @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 { ...@@ -100,5 +100,5 @@ public interface WeUserClient {
* @return * @return
*/ */
@Request(url = "/user/getuserinfo") @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; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
...@@ -43,5 +44,6 @@ public class WeCommunityNewGroup extends BaseEntity { ...@@ -43,5 +44,6 @@ public class WeCommunityNewGroup extends BaseEntity {
/** /**
* 0 未删除 1 已删除 * 0 未删除 1 已删除
*/ */
private int delFlag = 0; @TableLogic
private int delFlag;
} }
...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.annotation.Excel; import com.linkwechat.common.annotation.Excel;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -34,6 +35,7 @@ public class WeCustomer extends BaseEntity { ...@@ -34,6 +35,7 @@ public class WeCustomer extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 外部联系人的userid * 外部联系人的userid
*/ */
......
...@@ -107,9 +107,4 @@ public class WeEmpleCode extends BaseEntity { ...@@ -107,9 +107,4 @@ public class WeEmpleCode extends BaseEntity {
*/ */
@TableField(exist = false) @TableField(exist = false)
private String mobile; private String mobile;
/**
* 客户添加时是否需要经过确认自动成为好友 1:是 0:否
*/
private Integer isJoinConfirmFriends;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -34,6 +35,7 @@ public class WeFlowerCustomerRel ...@@ -34,6 +35,7 @@ public class WeFlowerCustomerRel
/** 添加了此外部联系人的企业成员userid */ /** 添加了此外部联系人的企业成员userid */
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String userId; private String userId;
/** 外部联系人名称 */ /** 外部联系人名称 */
......
...@@ -36,6 +36,10 @@ public class WeFlowerCustomerTagRel ...@@ -36,6 +36,10 @@ public class WeFlowerCustomerTagRel
/** 添加客户的企业微信用户 */ /** 添加客户的企业微信用户 */
private Long flowerCustomerRelId; private Long flowerCustomerRelId;
/**外部联系人id(客户id) */
private String externalUserid;
/** 标签id */ /** 标签id */
private String tagId; private String tagId;
......
...@@ -2,13 +2,17 @@ package com.linkwechat.wecom.domain; ...@@ -2,13 +2,17 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List; import java.util.List;
...@@ -33,59 +37,70 @@ public class WeGroupCode extends BaseEntity { ...@@ -33,59 +37,70 @@ public class WeGroupCode extends BaseEntity {
/** /**
* 活码URL * 活码URL
*/ */
@ApiModelProperty(value = "活码URL")
private String codeUrl; 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; private String activityName;
/** /**
* 活码描述 * 活码描述
*/ */
@NotNull(message = "活码描述不能为空") @ApiModelProperty(value = "活码描述")
@Size(max = 60, message = "活码描述最大长度为60个字符")
private String activityDesc; private String activityDesc;
/** /**
* 场景 * 场景
*/ */
@ApiModelProperty(value = "场景")
@Size(max = 60, message = "场景最大长度为60个字符")
// @NotBlank(message = "场景不能为空")
private String activityScene; private String activityScene;
/** /**
* 加群引导语 * 加群引导语
*/ */
@ApiModelProperty(value = "加群引导语")
@Size(max = 100, message = "加群引导语最大长度为60个字符")
private String guide; private String guide;
/** /**
* 进群是否提示:1:是;0:否; * 进群是否提示:1:是;0:否;
*/ */
private Long joinGroupIsTip; private Long showTip;
/** /**
* 进群提示语 * 进群提示语
*/ */
@ApiModelProperty(value = "进群提示语")
@Size(max = 100, message = "进群提示语最大长度为60个字符")
private String tipMsg; private String tipMsg;
/** /**
* 客服二维码 * 客服二维码
*/ */
@ApiModelProperty(value = "客服二维码")
@Size(max = 100, message = "客服二维码提示语最大长度为60个字符")
private String customerServerQrCode; 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 { ...@@ -111,4 +126,11 @@ public class WeGroupCode extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private List<WeGroupCodeActual> actualList; private List<WeGroupCodeActual> actualList;
/**
* 实际码id列表,用于前端绑定实际群活码
*/
@JsonIgnore
@TableField(exist = false)
private List<Long> actualIdList;
} }
...@@ -5,10 +5,12 @@ import java.util.Date; ...@@ -5,10 +5,12 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
...@@ -19,10 +21,11 @@ import javax.validation.constraints.NotNull; ...@@ -19,10 +21,11 @@ import javax.validation.constraints.NotNull;
* @author ruoyi * @author ruoyi
* @date 2020-10-07 * @date 2020-10-07
*/ */
@EqualsAndHashCode(callSuper = true)
@ApiModel @ApiModel
@Data @Data
@TableName("we_group_code_actual") @TableName("we_group_code_actual")
public class WeGroupCodeActual public class WeGroupCodeActual extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data; import lombok.Data;
...@@ -48,4 +49,10 @@ public class WeGroupSop extends BaseEntity { ...@@ -48,4 +49,10 @@ public class WeGroupSop extends BaseEntity {
@TableField(value = "end_time") @TableField(value = "end_time")
private String stopExeTime; private String stopExeTime;
/**
* 逻辑删除字段
*/
@TableLogic(value = "0", delval = "1")
private Integer delFlag;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.wecom.domain.vo.WeGroupCodeVo;
import lombok.Builder; import io.swagger.annotations.ApiModel;
import lombok.Data; import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode; import lombok.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/** /**
* 社区运营 - 关键词拉群任务实体 * 社区运营 - 关键词拉群任务实体
*/ */
@Data @Data
@Builder
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("we_keyword_group") @TableName("we_keyword_group")
@ApiModel("关键词拉群模型")
public class WeKeywordGroupTask extends BaseEntity { public class WeKeywordGroupTask extends BaseEntity {
/** /**
* 主键id * 主键id
*/ */
@ApiModelProperty("id")
@TableId @TableId
private Long taskId = SnowFlakeUtil.nextId(); private Long taskId;
/** /**
* 任务名称 * 任务名称
*/ */
@ApiModelProperty(value = "任务名称", required = true)
@Size(max = 100, message = "任务名最大长度100")
@NotNull(message = "任务名不能为空")
private String taskName; private String taskName;
/** /**
* 群活码id * 群活码id
*/ */
@ApiModelProperty(value = "群活码id", required = true)
@NotNull(message = "群活码不能为空")
private Long groupCodeId; private Long groupCodeId;
/** /**
* 加群引导语 * 加群引导语
*/ */
@ApiModelProperty(value = "加群引导语", required = true)
@Size(max = 255, message = "引导语过长,最大长度255")
@NotNull(message = "引导语不可为空")
private String welcomeMsg; 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; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
...@@ -66,4 +67,9 @@ public class WePresTagGroupTask extends BaseEntity { ...@@ -66,4 +67,9 @@ public class WePresTagGroupTask extends BaseEntity {
*/ */
private String msgid; private String msgid;
/**
* 逻辑删除字段
*/
@TableLogic(value = "0", delval = "1")
private Integer delFlag;
} }
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -40,7 +41,6 @@ public class WeCommunityNewGroupDto { ...@@ -40,7 +41,6 @@ public class WeCommunityNewGroupDto {
/** /**
* 标签id列表 * 标签id列表
*/ */
@NotNull(message = "标签不能为空")
private List<String> tagList; private List<String> tagList;
/** /**
......
...@@ -2,7 +2,9 @@ package com.linkwechat.wecom.domain.dto; ...@@ -2,7 +2,9 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List; import java.util.List;
/** /**
...@@ -13,7 +15,8 @@ public class WeGroupSopDto { ...@@ -13,7 +15,8 @@ public class WeGroupSopDto {
/** /**
* 规则名 * 规则名
*/ */
@NotNull(message = "规则名不可为空") @Size(max = 64, message = "规则名称不可超过64字符")
@NotBlank(message = "规则名不可为空")
private String ruleName; private String ruleName;
/** /**
...@@ -25,13 +28,15 @@ public class WeGroupSopDto { ...@@ -25,13 +28,15 @@ public class WeGroupSopDto {
/** /**
* 内容标题 * 内容标题
*/ */
@NotNull(message = "标题不可为空") @Size(max = 64, message = "标题不可超过64字符")
@NotBlank(message = "标题不可为空")
private String title; private String title;
/** /**
* 消息内容 * 消息内容
*/ */
@NotNull(message = "内容不可为空") @Size(max = 255, message = "标题不可超过255字符")
@NotBlank(message = "内容不可为空")
private String content; private String content;
/** /**
......
...@@ -3,7 +3,9 @@ package com.linkwechat.wecom.domain.dto; ...@@ -3,7 +3,9 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List; import java.util.List;
/** /**
...@@ -28,7 +30,8 @@ public class WePresTagGroupTaskDto { ...@@ -28,7 +30,8 @@ public class WePresTagGroupTaskDto {
/** /**
* 加群引导语 * 加群引导语
*/ */
@NotNull(message = "引导语不能为空") @Size(max = 64, message = "引导与不能超过64字符")
@NotBlank(message = "引导语不能为空")
private String welcomeMsg; private String welcomeMsg;
/** /**
...@@ -50,7 +53,6 @@ public class WePresTagGroupTaskDto { ...@@ -50,7 +53,6 @@ public class WePresTagGroupTaskDto {
/** /**
* 发送范围 0: 全部客户 1:部分客户 * 发送范围 0: 全部客户 1:部分客户
*/ */
@NotNull(message = "发送范围不能为空")
private Integer sendScope; private Integer sendScope;
/** /**
......
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto.message; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto.message;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -9,7 +10,7 @@ import java.util.List; ...@@ -9,7 +10,7 @@ import java.util.List;
*/ */
@SuppressWarnings("all") @SuppressWarnings("all")
@Data @Data
public class CustomerMessagePushDto { public class CustomerMessagePushDto implements Cloneable{
/** /**
* 群发类型 0 发给客户 1 发给客户群 * 群发类型 0 发给客户 1 发给客户群
...@@ -83,7 +84,7 @@ public class CustomerMessagePushDto { ...@@ -83,7 +84,7 @@ public class CustomerMessagePushDto {
public String content() { public String content() {
if (this.getMessageType()!=null) { if (this.getMessageType()!=null) {
// 消息类型 0 文本消息 1 图片消息 2 链接消息 3 小程序消息 // 消息类型 0 文本消息 1 图片消息 2 链接消息 3 小程序消息 4 图文
if ( this.getMessageType().equals("0")) { if ( this.getMessageType().equals("0")) {
return this.getTextMessage().getContent(); return this.getTextMessage().getContent();
} }
...@@ -102,10 +103,24 @@ public class CustomerMessagePushDto { ...@@ -102,10 +103,24 @@ public class CustomerMessagePushDto {
return this.getMiniprogramMessage().getTitle() + ":" + this.getMiniprogramMessage().getPage(); return this.getMiniprogramMessage().getTitle() + ":" + this.getMiniprogramMessage().getPage();
} }
if(this.getMessageType().equals("4")){
return this.getTextMessage().getContent()+","+this.getImageMessage().getPic_url();
}
} }
return null; return null;
} }
@Override
public CustomerMessagePushDto clone() throws CloneNotSupportedException {
return (CustomerMessagePushDto) super.clone();
}
} }
...@@ -8,4 +8,8 @@ public class QueryCustomerMessageStatusResultDataObjectDto { ...@@ -8,4 +8,8 @@ public class QueryCustomerMessageStatusResultDataObjectDto {
* 群发消息的id,通过<a href=“https://work.weixin.qq.com/api/doc/90000/90135/92135”>创建企业群发接口</a>返回 * 群发消息的id,通过<a href=“https://work.weixin.qq.com/api/doc/90000/90135/92135”>创建企业群发接口</a>返回
*/ */
private String msgid; private String msgid;
} }
...@@ -17,6 +17,7 @@ public class QueryCustomerMessageStatusResultDto extends WeResultDto { ...@@ -17,6 +17,7 @@ public class QueryCustomerMessageStatusResultDto extends WeResultDto {
private String check_status; private String check_status;
} }
...@@ -52,61 +52,61 @@ public class ConversationArchiveVo { ...@@ -52,61 +52,61 @@ public class ConversationArchiveVo {
private String msgType; private String msgType;
@ApiModelProperty("文本消息内容") @ApiModelProperty("文本消息内容")
private Content text; private Content text=new Content();
@ApiModelProperty("图片消息内容") @ApiModelProperty("图片消息内容")
private Content image; private Content image=new Content();
@ApiModelProperty("撤回消息") @ApiModelProperty("撤回消息")
private Content revoke; private Content revoke=new Content();
@ApiModelProperty("同意会话聊天内容") @ApiModelProperty("同意会话聊天内容")
private Content disagree; private Content disagree=new Content();
@ApiModelProperty("语音内容") @ApiModelProperty("语音内容")
private Content voice; private Content voice=new Content();
@ApiModelProperty("视频内容") @ApiModelProperty("视频内容")
private Content video; private Content video=new Content();
@ApiModelProperty("名片") @ApiModelProperty("名片")
private Content card; private Content card=new Content();
@ApiModelProperty("位置") @ApiModelProperty("位置")
private Content location; private Content location=new Content();
@ApiModelProperty("表情") @ApiModelProperty("表情")
private Content emotion; private Content emotion=new Content();
@ApiModelProperty("文件") @ApiModelProperty("文件")
private Content file; private Content file=new Content();
@ApiModelProperty("链接") @ApiModelProperty("链接")
private Content link; private Content link=new Content();
@ApiModelProperty("小程序消息") @ApiModelProperty("小程序消息")
private Content weApp; private Content weApp=new Content();
@ApiModelProperty("会话记录消息") @ApiModelProperty("会话记录消息")
private Content chatReCord; private Content chatReCord=new Content();
@ApiModelProperty("待办消息") @ApiModelProperty("待办消息")
private Content todo; private Content todo=new Content();
@ApiModelProperty("投票消息") @ApiModelProperty("投票消息")
private Content vote; private Content vote=new Content();
@ApiModelProperty("填表消息") @ApiModelProperty("填表消息")
private Collect collect; private Collect collect=new Collect();
@ApiModelProperty("红包消息") @ApiModelProperty("红包消息")
private RedPacket redPacket; private RedPacket redPacket=new RedPacket();
@ApiModelProperty("会议邀请消息") @ApiModelProperty("会议邀请消息")
private Meeting meeting; private Meeting meeting=new Meeting();
@ApiModelProperty("在线文档消息") @ApiModelProperty("在线文档消息")
private Content doc; private Content doc=new Content();
@ApiModelProperty("MarkDown格式消息/图文消息") @ApiModelProperty("MarkDown格式消息/图文消息")
private JSONObject info; private JSONObject info;
...@@ -118,7 +118,7 @@ public class ConversationArchiveVo { ...@@ -118,7 +118,7 @@ public class ConversationArchiveVo {
private JSONObject meetingVoiceCall; private JSONObject meetingVoiceCall;
@ApiModelProperty("日程消息") @ApiModelProperty("日程消息")
private Calendar calendar; private Calendar calendar=new Calendar();
@ApiModel @ApiModel
@Data @Data
......
...@@ -19,7 +19,5 @@ public class WeGroupCodeVo { ...@@ -19,7 +19,5 @@ public class WeGroupCodeVo {
private Long id; private Long id;
private String uuid;
private String codeUrl; private String codeUrl;
} }
\ No newline at end of file \ No newline at end of file
...@@ -19,6 +19,7 @@ import java.util.List; ...@@ -19,6 +19,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class WeMakeCustomerTag { public class WeMakeCustomerTag {
private String externalUserid; private String externalUserid;
private String userId;
private List<WeTag> addTag; private List<WeTag> addTag;
} }
...@@ -50,12 +50,6 @@ public class WePresTagGroupTaskVo { ...@@ -50,12 +50,6 @@ public class WePresTagGroupTaskVo {
@JsonIgnore @JsonIgnore
private String codeUrl; private String codeUrl;
/**
* 群活码uuid
*/
@JsonIgnore
private String CodeUuid;
@TableField(exist = false) @TableField(exist = false)
private WeGroupCodeVo groupCodeInfo; private WeGroupCodeVo groupCodeInfo;
...@@ -132,7 +126,7 @@ public class WePresTagGroupTaskVo { ...@@ -132,7 +126,7 @@ public class WePresTagGroupTaskVo {
* 设置群活码信息 * 设置群活码信息
*/ */
public void fillGroupCodeVo() { public void fillGroupCodeVo() {
WeGroupCodeVo groupCodeVo = new WeGroupCodeVo(this.getCodeId(), this.getCodeUuid(), this.getCodeUrl()); WeGroupCodeVo groupCodeVo = new WeGroupCodeVo(this.getCodeId(),this.getCodeUrl());
this.setGroupCodeInfo(groupCodeVo); this.setGroupCodeInfo(groupCodeVo);
} }
} }
package com.linkwechat.wecom.domain.vo; package com.linkwechat.wecom.domain.vo;
import com.linkwechat.wecom.domain.WeCustomer; 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.Builder;
import lombok.Data; import lombok.Data;
...@@ -15,10 +18,16 @@ import java.util.List; ...@@ -15,10 +18,16 @@ import java.util.List;
* 客户任务进度和邀请列表 * 客户任务进度和邀请列表
* </p> * </p>
*/ */
@ApiModel
@Data @Data
@Builder @Builder
public class WeTaskFissionProgressVO { public class WeTaskFissionProgressVO {
@ApiModelProperty("总数")
private Long total; private Long total;
@ApiModelProperty("完成数")
private Long completed; private Long completed;
@ApiModelProperty("客户列表")
private List<WeCustomer> customers; private List<WeCustomer> customers;
} }
...@@ -166,7 +166,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy { ...@@ -166,7 +166,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
// 新客拉群创建的员工活码欢迎语图片(群活码图片) // 新客拉群创建的员工活码欢迎语图片(群活码图片)
String codeUrl = weGroupCodeService.selectGroupCodeUrlByEmplCodeState(state); String codeUrl = weGroupCodeService.selectGroupCodeUrlByEmplCodeState(state);
if (StringUtils.isNotNull(codeUrl)) { if (StringUtils.isNotNull(codeUrl)) {
buildWelcomeMsgImg(weWelcomeMsgBuilder, codeUrl, codeUrl.replaceAll(cosConfig.getImgUrlPrefix(), "")); buildWelcomeMsgImg(weWelcomeMsgBuilder, codeUrl, codeUrl.replaceAll(cosConfig.getCosImgUrlPrefix(), ""));
} }
// 普通员工活码欢迎语图片 // 普通员工活码欢迎语图片
else if (StringUtils.isNotEmpty(messageMap.getCategoryId())) { else if (StringUtils.isNotEmpty(messageMap.getCategoryId())) {
......
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.interceptor; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.interceptor;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.dtflys.forest.config.ForestConfiguration;
import com.dtflys.forest.exceptions.ForestRuntimeException; import com.dtflys.forest.exceptions.ForestRuntimeException;
import com.dtflys.forest.http.ForestRequest; import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.http.ForestResponse; import com.dtflys.forest.http.ForestResponse;
...@@ -15,7 +16,10 @@ import lombok.extern.slf4j.Slf4j; ...@@ -15,7 +16,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
/** /**
* @description: 微信token拦截器 * @description: 微信token拦截器
...@@ -34,6 +38,9 @@ public class WeAccessTokenInterceptor implements Interceptor{ ...@@ -34,6 +38,9 @@ public class WeAccessTokenInterceptor implements Interceptor{
@Autowired @Autowired
private WeComeConfig weComeConfig; private WeComeConfig weComeConfig;
@Resource
private ForestConfiguration forestConfiguration;
/** /**
...@@ -41,9 +48,11 @@ public class WeAccessTokenInterceptor implements Interceptor{ ...@@ -41,9 +48,11 @@ public class WeAccessTokenInterceptor implements Interceptor{
*/ */
@Override @Override
public boolean beforeExecute(ForestRequest request) { 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); log.info(">>>>>>>>>>>>>>>>>>>>>>>>uri:{}",uri);
//request.setContentType("application/json");
if(!Arrays.asList(weComeConfig.getFileUplodUrl()).contains(uri)){ if(!Arrays.asList(weComeConfig.getFileUplodUrl()).contains(uri)){
request.setDataType(ForestDataType.JSON); request.setDataType(ForestDataType.JSON);
request.setContentType("application/json"); request.setContentType("application/json");
...@@ -59,26 +68,19 @@ public class WeAccessTokenInterceptor implements Interceptor{ ...@@ -59,26 +68,19 @@ public class WeAccessTokenInterceptor implements Interceptor{
}else if(Arrays.asList(weComeConfig.getNeedChatTokenUrl()).contains(uri)){ //需要会话存档token }else if(Arrays.asList(weComeConfig.getNeedChatTokenUrl()).contains(uri)){ //需要会话存档token
token=iWeAccessTokenService.findChatAccessToken(); token=iWeAccessTokenService.findChatAccessToken();
}else if(Arrays.asList(weComeConfig.getThirdAppUrl()).contains(uri)){ //第三方自建应用token }else if(Arrays.asList(weComeConfig.getThirdAppUrl()).contains(uri)){ //第三方自建应用token
token=iWeAccessTokenService.findThirdAppAccessToken( 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) 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{ } else{
token=iWeAccessTokenService.findCommonAccessToken(); token=iWeAccessTokenService.findCommonAccessToken();
} }
if (uri.contains("ticket/get")){ if (uri.contains("ticket/get")){
request.addQuery("type","agent_config"); request.addQuery("type","agent_config");
} }
request.addQuery("access_token",token); request.addQuery("access_token",token);
} }
//添加服务器统一请求地址 //添加服务器统一请求地址
request.setUrl(weComeConfig.getServerUrl()+weComeConfig.getWeComePrefix()+uri); // request.setUrl(weComeConfig.getServerUrl()+weComeConfig.getWeComePrefix()+uri);
return true; return true;
} }
......
...@@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Param; ...@@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface WeCategoryMapper extends BaseMapper<WeCategory> { public interface WeCategoryMapper extends BaseMapper<WeCategory> {
void deleteWeCategoryById(Long[] ids);
} }
...@@ -29,7 +29,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> { ...@@ -29,7 +29,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return 结果 * @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查询当前素材的收藏条数 * 通过素材id和用户id查询当前素材的收藏条数
...@@ -38,7 +38,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> { ...@@ -38,7 +38,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return 当前素材收藏的条数 * @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> { ...@@ -46,6 +46,6 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return {@link WeChatSideVo}s * @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; ...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatContactMapping; import com.linkwechat.wecom.domain.WeChatContactMapping;
import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
...@@ -12,6 +13,7 @@ import java.util.List; ...@@ -12,6 +13,7 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2020-12-27 * @date 2020-12-27
*/ */
@Mapper
public interface WeChatContactMappingMapper extends BaseMapper<WeChatContactMapping> { public interface WeChatContactMappingMapper extends BaseMapper<WeChatContactMapping> {
/** /**
* 查询聊天关系映射 * 查询聊天关系映射
......
...@@ -39,5 +39,5 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> { ...@@ -39,5 +39,5 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> {
* @param keyword 关键词 * @param keyword 关键词
* @return * @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; ...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCommunityNewGroup; import com.linkwechat.wecom.domain.WeCommunityNewGroup;
import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo; import com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -15,7 +16,7 @@ import java.util.Optional; ...@@ -15,7 +16,7 @@ import java.util.Optional;
* @author kewen * @author kewen
* @date 2021-02-19 * @date 2021-02-19
*/ */
@Repository @Mapper
public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGroup> { public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGroup> {
/** /**
...@@ -27,9 +28,9 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou ...@@ -27,9 +28,9 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
* @param endTime 结束时间 * @param endTime 结束时间
* @return {WeCommunityNewGroupVo}s 列表 * @return {WeCommunityNewGroupVo}s 列表
*/ */
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(@Param("emplCodeName") String emplCodeName, @Param("createBy") String createBy // List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(@Param("emplCodeName") String emplCodeName, @Param("createBy") String createBy
, @Param("beginTime") String beginTime, @Param("endTime") String endTime); // , @Param("beginTime") String beginTime, @Param("endTime") String endTime);
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(WeCommunityNewGroup weCommunityNewGroup);
/** /**
* 获取新客自动拉群详细信息 * 获取新客自动拉群详细信息
* *
...@@ -60,12 +61,4 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou ...@@ -60,12 +61,4 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
* @return 结果 * @return 结果
*/ */
int removeWeCommunityNewGroupByEmplCodeId(@Param("emplCodeId") Long emplCodeId); 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> ...@@ -71,7 +71,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param externalUserid * @param externalUserid
* @return * @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> ...@@ -87,7 +87,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param userid * @param userid
* @return * @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> ...@@ -96,7 +96,17 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param userid 员工id * @param userid 员工id
* @return * @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; ...@@ -2,8 +2,11 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCustomerMessage; import com.linkwechat.wecom.domain.WeCustomerMessage;
import com.linkwechat.wecom.domain.dto.message.DetailMessageStatusResultDto;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 群发消息 微信消息表Mapper接口 * 群发消息 微信消息表Mapper接口
* *
...@@ -20,7 +23,7 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> { ...@@ -20,7 +23,7 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> {
* @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群) * @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群)
* @return int * @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> { ...@@ -28,6 +31,8 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> {
* @param status 消息发送状态 0 未发送 1 已发送 * @param status 消息发送状态 0 未发送 1 已发送
* @return int * @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 ...@@ -25,8 +25,8 @@ public interface WeCustomerMessageOriginalMapper extends BaseMapper<WeCustomerMe
* @param endTime 结束时间 * @param endTime 结束时间
* @return {@link CustomerMessagePushVo}s * @return {@link CustomerMessagePushVo}s
*/ */
public List<CustomerMessagePushVo> selectCustomerMessagePushs(@Param("sender") String sender, @Param("content") String content public List<CustomerMessagePushVo> selectCustomerMessagePushs(@Param("sender") String sender,@Param("content") String content
, @Param("pushType") String pushType, @Param("beginTime") String beginTime, @Param("endTime") String endTime); ,@Param("pushType") String pushType, @Param("beginTime") String beginTime,@Param("endTime") String endTime);
/** /**
* 群发详情 * 群发详情
......
...@@ -26,8 +26,8 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess ...@@ -26,8 +26,8 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
* @param sendTime 发送时间,发送状态为1时返回(为时间戳的形式) * @param sendTime 发送时间,发送状态为1时返回(为时间戳的形式)
* @return int * @return int
*/ */
int updateWeCustomerMessgaeResult(@Param("messageId") Long messageId, @Param("chatId") String chatId, @Param("externalUserid") String externalUserid int updateWeCustomerMessgaeResult(@Param("messageId") Long messageId,@Param("chatId") String chatId,@Param("externalUserid") String externalUserid
, @Param("status") String status, @Param("sendTime") String sendTime); ,@Param("status") String status,@Param("sendTime") String sendTime);
/** /**
* 查询微信消息发送情况 * 查询微信消息发送情况
...@@ -36,7 +36,7 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess ...@@ -36,7 +36,7 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
* @param status 发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败 * @param status 发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败
* @return {@link WeCustomerMessageResultVo}s * @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; ...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeEmpleCode; import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.domain.dto.WeEmpleCodeDto; import com.linkwechat.wecom.domain.dto.WeEmpleCodeDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -14,7 +15,7 @@ import java.util.List; ...@@ -14,7 +15,7 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2020-10-04 * @date 2020-10-04
*/ */
@Repository @Mapper
public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
{ {
/** /**
...@@ -23,14 +24,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -23,14 +24,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param id 员工活码ID * @param id 员工活码ID
* @return 员工活码 * @return 员工活码
*/ */
public WeEmpleCode selectWeEmpleCodeById(Long id); WeEmpleCode selectWeEmpleCodeById(Long id);
/** /**
* 批量查询员工活码根据id * 批量查询员工活码根据id
* @param ids * @param ids
* @return * @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> ...@@ -38,7 +39,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 员工活码集合 * @return 员工活码集合
*/ */
public List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode); List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode);
/** /**
* 新增员工活码 * 新增员工活码
...@@ -46,7 +47,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -46,7 +47,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 结果 * @return 结果
*/ */
public int insertWeEmpleCode(WeEmpleCode weEmpleCode); int insertWeEmpleCode(WeEmpleCode weEmpleCode);
/** /**
* 修改员工活码 * 修改员工活码
...@@ -54,7 +55,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -54,7 +55,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 结果 * @return 结果
*/ */
public int updateWeEmpleCode(WeEmpleCode weEmpleCode); int updateWeEmpleCode(WeEmpleCode weEmpleCode);
/** /**
* 删除员工活码 * 删除员工活码
...@@ -62,7 +63,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -62,7 +63,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param id 员工活码ID * @param id 员工活码ID
* @return 结果 * @return 结果
*/ */
public int deleteWeEmpleCodeById(Long id); int deleteWeEmpleCodeById(Long id);
/** /**
* 批量删除员工活码 * 批量删除员工活码
...@@ -70,7 +71,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -70,7 +71,7 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int deleteWeEmpleCodeByIds(Long[] ids); int deleteWeEmpleCodeByIds(Long[] ids);
/** /**
...@@ -79,14 +80,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode> ...@@ -79,14 +80,14 @@ public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int batchRemoveWeEmpleCodeIds(@Param("ids") List<String> ids); int batchRemoveWeEmpleCodeIds(@Param("ids") List<String> ids);
/** /**
* 通过活动场景获取客户欢迎语 * 通过活动场景获取客户欢迎语
* @param scenario 活动场景 * @param scenario 活动场景
* @return * @return
*/ */
public WeEmpleCodeDto selectWelcomeMsgByScenario(@Param("scenario") String scenario, @Param("userId") String userId); WeEmpleCodeDto selectWelcomeMsgByScenario(@Param("scenario") String scenario, @Param("userId") String userId);
/** /**
* 通过state定位员工活码 * 通过state定位员工活码
......
...@@ -76,7 +76,7 @@ public interface WeGroupCodeActualMapper extends BaseMapper<WeGroupCodeActual> { ...@@ -76,7 +76,7 @@ public interface WeGroupCodeActualMapper extends BaseMapper<WeGroupCodeActual> {
* @param groupCodeId 群活码id * @param groupCodeId 群活码id
* @return 结果 * @return 结果
*/ */
List<WeGroupCodeActual> selectActualListByGroupCodeId(Long groupCodeId); List<WeGroupCodeActual> selectActualList(Long groupCodeId);
/** /**
* 通过群活码id删除实际码 * 通过群活码id删除实际码
......
...@@ -15,17 +15,7 @@ import org.springframework.stereotype.Repository; ...@@ -15,17 +15,7 @@ import org.springframework.stereotype.Repository;
* @date 2020-10-07 * @date 2020-10-07
*/ */
@Mapper @Mapper
@Repository public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode> {
public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
{
/**
* 查询客户群活码
*
* @param id 客户群活码ID
* @return 客户群活码
*/
WeGroupCode selectWeGroupCodeById(Long id);
/** /**
* 查询客户群活码列表 * 查询客户群活码列表
* *
...@@ -35,13 +25,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode> ...@@ -35,13 +25,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode); List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode);
/** /**
* 根据群活码id查询群活码列表
* @param ids id列表
* @return 结果
*/
List<WeGroupCode> selectWeGroupCodeListByIds(List<String> ids);
/**
* 新增客户群活码 * 新增客户群活码
* *
* @param weGroupCode 客户群活码 * @param weGroupCode 客户群活码
...@@ -58,37 +41,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode> ...@@ -58,37 +41,6 @@ public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
int updateWeGroupCode(WeGroupCode 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获取对应所有群聊信息 * 根据群活码id获取对应所有群聊信息
* @param groupCodeId 群活码id * @param groupCodeId 群活码id
* @return 结果 * @return 结果
......
...@@ -29,5 +29,5 @@ public interface WeGroupMapper extends BaseMapper<WeGroup> { ...@@ -29,5 +29,5 @@ public interface WeGroupMapper extends BaseMapper<WeGroup> {
// //
// int batchInsetWeGroup(@Param("weGroups") List<WeGroup> weGroups); // 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!