Commit d468c921 by ext.shengxiyong1

相关代码合并

1 parent 8e0c6be7
Showing 287 changed files with 2409 additions and 865 deletions
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging> <packaging>jar</packaging>
<artifactId>linkwe-admin</artifactId> <artifactId>linkwe-admin-dev</artifactId>
<description> <description>
web服务入口 web服务入口
...@@ -89,6 +89,8 @@ ...@@ -89,6 +89,8 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId> <artifactId>jaxb-api</artifactId>
......
...@@ -135,76 +135,76 @@ public class SysLoginController ...@@ -135,76 +135,76 @@ public class SysLoginController
return AjaxResult.success(menuService.buildMenus(menus)); return AjaxResult.success(menuService.buildMenus(menus));
} }
/** // /**
* 获取企业扫码登录相关参数 // * 获取企业扫码登录相关参数
* @return // * @return
*/ // */
@GetMapping("/findWxQrLoginInfo") // @GetMapping("/findWxQrLoginInfo")
public AjaxResult findQrLoginParm(){ // public AjaxResult findQrLoginParm(){
//
WeCorpAccount validWeCorpAccount // WeCorpAccount validWeCorpAccount
= iWxCorpAccountService.findValidWeCorpAccount(); // = iWxCorpAccountService.findValidWeCorpAccount();
if(null != validWeCorpAccount){ // if(null != validWeCorpAccount){
validWeCorpAccount.setContactSecret(null); // validWeCorpAccount.setContactSecret(null);
validWeCorpAccount.setCorpSecret(null); // validWeCorpAccount.setCorpSecret(null);
validWeCorpAccount.setProviderSecret(null); // validWeCorpAccount.setProviderSecret(null);
} // }
//
return AjaxResult.success(validWeCorpAccount); // return AjaxResult.success(validWeCorpAccount);
} // }
/** // /**
* 扫码登录微信端回调 // * 扫码登录微信端回调
* @param auth_code 授权code // * @param auth_code 授权code
* @param agentId 应用id // * @param agentId 应用id
* @return // * @return
*/ // */
@GetMapping("/wxQrLogin") // @GetMapping("/wxQrLogin")
public AjaxResult wxQrLogin(String auth_code, String agentId){ // public AjaxResult wxQrLogin(String auth_code, String agentId){
//
AjaxResult ajax = AjaxResult.success(); // AjaxResult ajax = AjaxResult.success();
//
WeUserInfoDto userInfo = weUserClient.getUserInfo(auth_code, agentId); // WeUserInfoDto userInfo = weUserClient.getUserInfo(auth_code, agentId);
if( null != userInfo){ // if( null != userInfo){
SysUser sysUser = sysUserService.selectUserByCorpUserId(userInfo.getUserId()); // SysUser sysUser = sysUserService.selectUserByCorpUserId(userInfo.getUserId());
if (null != sysUser){ // if (null != sysUser){
String token = loginService.noPwdLogin(sysUser.getUserName()); // String token = loginService.noPwdLogin(sysUser.getUserName());
ajax.put(Constants.TOKEN, token); // ajax.put(Constants.TOKEN, token);
}else { // }else {
return AjaxResult.error("请绑定后再登录"); // return AjaxResult.error("请绑定后再登录");
} // }
} // }
return ajax; // return ajax;
} // }
/** // /**
* 通过企业id和企业密钥登录 // * 通过企业id和企业密钥登录
* @param corpId // * @param corpId
* @param corpSecret // * @param corpSecret
* @return // * @return
*/ // */
@GetMapping("/corpLogin") // @GetMapping("/corpLogin")
public AjaxResult corpLogin(String corpId,String corpSecret){ // public AjaxResult corpLogin(String corpId,String corpSecret){
//
WeCorpAccount weCorpAccount = iWxCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>() // WeCorpAccount weCorpAccount = iWxCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>()
.eq(WeCorpAccount::getCorpId, corpId) // .eq(WeCorpAccount::getCorpId, corpId)
.eq(WeCorpAccount::getCorpSecret, corpSecret) // .eq(WeCorpAccount::getCorpSecret, corpSecret)
.eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE)); // .eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE));
//
//
if(weCorpAccount == null){ // if(weCorpAccount == null){
//
return AjaxResult.error("当前企业id与企业密码不匹配或不存在"); // return AjaxResult.error("当前企业id与企业密码不匹配或不存在");
} // }
//
return AjaxResult.success( // return AjaxResult.success(
loginService.noPwdLogin(weCorpAccount.getCorpAccount()) // loginService.noPwdLogin(weCorpAccount.getCorpAccount())
); // );
} // }
} }
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.utils.Threads; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.utils.wecom.WxCryptUtil; import com.linkwechat.common.utils.wecom.WxCryptUtil;
import com.linkwechat.web.controller.common.CommonController; import com.linkwechat.web.controller.common.CommonController;
import com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO; import com.linkwechat.wecom.service.IWeCorpAccountService;
import com.linkwechat.wecom.factory.WeCallBackEventFactory; import com.linkwechat.wecom.service.event.WeEventPublisherService;
import com.linkwechat.wecom.factory.WeEventHandle;
import com.linkwechat.wecom.factory.impl.customer.WeCallBackAddExternalContactImpl;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.security.AnyTypePermission;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;
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.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
...@@ -33,36 +26,20 @@ import javax.servlet.http.HttpServletRequest; ...@@ -33,36 +26,20 @@ import javax.servlet.http.HttpServletRequest;
@RequestMapping("/wecom/callback") @RequestMapping("/wecom/callback")
public class WeCallBackController extends CommonController { public class WeCallBackController extends CommonController {
@Autowired @Autowired
private WeEventHandle weEventHandle; private WeEventPublisherService weEventPublisherService;
@Value("${wecome.callBack.appIdOrCorpId}")
private String appIdOrCorpId;
@Value("${wecome.callBack.token}")
private String token;
@Value("${wecome.callBack.encodingAesKey}")
private String encodingAesKey;
@Autowired
private IWeCorpAccountService weCorpAccountService;
@ApiModelProperty("post数据接收") @ApiModelProperty("post数据接收")
@PostMapping(value = "/recive") @PostMapping(value = "/recive/{corpId}")
public String recive(@RequestBody String msg, @RequestParam(name = "msg_signature") String signature, public String recive(@RequestBody String msg, @RequestParam(name = "msg_signature") String signature,
String timestamp, String nonce) { String timestamp, String nonce,@PathVariable("corpId") String corpId) {
WxCryptUtil wxCryptUtil = new WxCryptUtil(token, encodingAesKey, appIdOrCorpId); WeCorpAccount corpAccount = weCorpAccountService.getCorpAccountByCorpId(corpId);
WxCryptUtil wxCryptUtil = new WxCryptUtil(corpAccount.getToken(), corpAccount.getEncodingAesKey(), corpId);
try { try {
String decrypt = wxCryptUtil.decrypt(signature, timestamp, nonce, msg); String decrypt = wxCryptUtil.decrypt(signature, timestamp, nonce, msg);
WxCpXmlMessageVO wxCpXmlMessage = StrXmlToBean(decrypt); weEventPublisherService.register(decrypt);
log.info("企微回调通知接口 wxCpXmlMessage:{}", JSONObject.toJSONString(wxCpXmlMessage));
try {
// ;
WeCallBackEventFactory factory = weEventHandle.factory(wxCpXmlMessage.getEvent());
if (factory !=null){
Threads.SINGLE_THREAD_POOL.submit(() -> factory.eventHandle(wxCpXmlMessage));
}
} catch (Exception e) {
e.printStackTrace();
}
return decrypt; return decrypt;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();; e.printStackTrace();;
...@@ -72,8 +49,8 @@ public class WeCallBackController extends CommonController { ...@@ -72,8 +49,8 @@ public class WeCallBackController extends CommonController {
} }
@ApiModelProperty("get数据校验") @ApiModelProperty("get数据校验")
@GetMapping(value = "/recive") @GetMapping(value = "/recive/{corpId}")
public String recive(HttpServletRequest request) { public String recive(HttpServletRequest request,@PathVariable("corpId") String corpId) {
// 微信加密签名 // 微信加密签名
String sVerifyMsgSig = request.getParameter("msg_signature"); String sVerifyMsgSig = request.getParameter("msg_signature");
// 时间戳 // 时间戳
...@@ -83,25 +60,12 @@ public class WeCallBackController extends CommonController { ...@@ -83,25 +60,12 @@ public class WeCallBackController extends CommonController {
// 随机字符串 // 随机字符串
String sVerifyEchoStr = request.getParameter("echostr"); String sVerifyEchoStr = request.getParameter("echostr");
WxCryptUtil wxCryptUtil = new WxCryptUtil(token, encodingAesKey, appIdOrCorpId); WeCorpAccount corpAccount = weCorpAccountService.getCorpAccountByCorpId(corpId);
WxCryptUtil wxCryptUtil = new WxCryptUtil(corpAccount.getToken(), corpAccount.getEncodingAesKey(), corpId);
try { try {
return wxCryptUtil.verifyURL(sVerifyMsgSig, sVerifyTimeStamp, sVerifyNonce, sVerifyEchoStr); return wxCryptUtil.verifyURL(sVerifyMsgSig, sVerifyTimeStamp, sVerifyNonce, sVerifyEchoStr);
} catch (Exception e) { } catch (Exception e) {
return "error"; return "error";
} }
} }
private WxCpXmlMessageVO StrXmlToBean(String xmlStr){
XStream xstream = XStreamInitializer.getInstance();
xstream.addPermission(AnyTypePermission.ANY);
xstream.processAnnotations(WxCpXmlMessage.class);
xstream.processAnnotations(WxCpXmlMessageVO.class);
xstream.processAnnotations(WxCpXmlMessageVO.ScanCodeInfo.class);
xstream.processAnnotations(WxCpXmlMessageVO.SendPicsInfo.class);
xstream.processAnnotations(WxCpXmlMessageVO.SendPicsInfo.Item.class);
xstream.processAnnotations(WxCpXmlMessageVO.SendLocationInfo.class);
xstream.processAnnotations(WxCpXmlMessageVO.BatchJob.class);
WxCpXmlMessageVO wxCpXmlMessage = (WxCpXmlMessageVO)xstream.fromXML(xmlStr);
return wxCpXmlMessage;
}
} }
...@@ -8,11 +8,13 @@ import com.linkwechat.common.core.domain.AjaxResult; ...@@ -8,11 +8,13 @@ import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.Tree; import com.linkwechat.common.core.domain.Tree;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeCategory; import com.linkwechat.wecom.domain.WeCategory;
import com.linkwechat.wecom.domain.vo.WeCategoryVo;
import com.linkwechat.wecom.service.IWeCategoryService; import com.linkwechat.wecom.service.IWeCategoryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; 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.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -26,7 +28,7 @@ import java.util.List; ...@@ -26,7 +28,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/wecom/category") @RequestMapping("/wecom/category")
@Api("企业微信素材分类") @Api(tags = "企业微信素材分类")
public class WeCategoryController extends BaseController { public class WeCategoryController extends BaseController {
@Autowired @Autowired
...@@ -37,7 +39,7 @@ public class WeCategoryController extends BaseController { ...@@ -37,7 +39,7 @@ public class WeCategoryController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wechat:category:list')") // @PreAuthorize("@ss.hasPermi('wechat:category:list')")
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("类目树") @ApiOperation("类目树")
public AjaxResult list(@RequestParam("mediaType") String mediaType) { public AjaxResult<WeCategoryVo> list(@RequestParam("mediaType") String mediaType) {
return AjaxResult.success(weCategoryService.findWeCategoryByMediaType(mediaType)); return AjaxResult.success(weCategoryService.findWeCategoryByMediaType(mediaType));
} }
...@@ -47,7 +49,7 @@ public class WeCategoryController extends BaseController { ...@@ -47,7 +49,7 @@ public class WeCategoryController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wechat:category:query')") // @PreAuthorize("@ss.hasPermi('wechat:category:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
@ApiOperation("通过id查询类目详细信息") @ApiOperation("通过id查询类目详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id) { public AjaxResult<WeCategoryVo> getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(weCategoryService.getById(id)); return AjaxResult.success(weCategoryService.getById(id));
} }
...@@ -58,7 +60,7 @@ public class WeCategoryController extends BaseController { ...@@ -58,7 +60,7 @@ public class WeCategoryController extends BaseController {
@Log(title = "添加类目", businessType = BusinessType.INSERT) @Log(title = "添加类目", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@ApiOperation("添加类目") @ApiOperation("添加类目")
public AjaxResult add(@RequestBody WeCategory category) { public AjaxResult add(@Validated @RequestBody WeCategory category) {
weCategoryService.insertWeCategory(category); weCategoryService.insertWeCategory(category);
return AjaxResult.success(); return AjaxResult.success();
} }
...@@ -70,7 +72,7 @@ public class WeCategoryController extends BaseController { ...@@ -70,7 +72,7 @@ public class WeCategoryController extends BaseController {
@Log(title = "更新目录", businessType = BusinessType.UPDATE) @Log(title = "更新目录", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
@ApiOperation("更新目录") @ApiOperation("更新目录")
public AjaxResult edit(@RequestBody WeCategory category) { public AjaxResult edit(@Validated @RequestBody WeCategory category) {
weCategoryService.updateWeCategory(category); weCategoryService.updateWeCategory(category);
return AjaxResult.success(); return AjaxResult.success();
} }
...@@ -99,4 +101,6 @@ public class WeCategoryController extends BaseController { ...@@ -99,4 +101,6 @@ public class WeCategoryController extends BaseController {
return AjaxResult.success(); return AjaxResult.success();
} }
} }
...@@ -27,16 +27,16 @@ import java.util.List; ...@@ -27,16 +27,16 @@ import java.util.List;
public class WeCommunityH5Controller extends BaseController { public class WeCommunityH5Controller extends BaseController {
@Autowired @Autowired
IWePresTagGroupTaskService tagGroupTaskService; private IWePresTagGroupTaskService tagGroupTaskService;
@Autowired @Autowired
IWeGroupSopService sopService; private IWeGroupSopService sopService;
@Autowired @Autowired
IWeCommunityKeywordToGroupService keywordToGroupService; private IWeCommunityKeywordToGroupService keywordToGroupService;
@Autowired @Autowired
ISysUserService userService; private ISysUserService userService;
/** /**
* 获取任务对应的执行人列表 * 获取任务对应的执行人列表
...@@ -65,8 +65,8 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -65,8 +65,8 @@ public class WeCommunityH5Controller extends BaseController {
AjaxResult res = AjaxResult.success(); AjaxResult res = AjaxResult.success();
if (type.equals(CommunityTaskType.TAG.getType())) { if (type.equals(CommunityTaskType.TAG.getType())) {
// 老客标签建群数据 // 老客标签建群数据
res.put("todo", tagGroupTaskService.getFollowerTaskList(emplId, 0)); res.put("todo", tagGroupTaskService.getEmplTaskList(emplId, false));
res.put("done", tagGroupTaskService.getFollowerTaskList(emplId, 1)); res.put("done", tagGroupTaskService.getEmplTaskList(emplId, true));
} else if (type.equals(CommunityTaskType.SOP.getType())) { } else if (type.equals(CommunityTaskType.SOP.getType())) {
// 群SOP数据 // 群SOP数据
res.put("todo", sopService.getEmplTaskList(emplId, false)); res.put("todo", sopService.getEmplTaskList(emplId, false));
...@@ -75,10 +75,10 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -75,10 +75,10 @@ public class WeCommunityH5Controller extends BaseController {
// 全部数据 // 全部数据
List todoList = new ArrayList(); List todoList = new ArrayList();
List doneList = new ArrayList(); List doneList = new ArrayList();
todoList.addAll(tagGroupTaskService.getFollowerTaskList(emplId, 0)); todoList.addAll(tagGroupTaskService.getEmplTaskList(emplId, false));
todoList.addAll(sopService.getEmplTaskList(emplId, false)); todoList.addAll(sopService.getEmplTaskList(emplId, false));
res.put("todo", todoList); res.put("todo", todoList);
doneList.addAll(tagGroupTaskService.getFollowerTaskList(emplId, 1)); doneList.addAll(tagGroupTaskService.getEmplTaskList(emplId, true));
doneList.addAll(sopService.getEmplTaskList(emplId, true)); doneList.addAll(sopService.getEmplTaskList(emplId, true));
res.put("done", doneList); res.put("done", doneList);
} }
...@@ -99,11 +99,11 @@ public class WeCommunityH5Controller extends BaseController { ...@@ -99,11 +99,11 @@ public class WeCommunityH5Controller extends BaseController {
@GetMapping("/changeStatus") @GetMapping("/changeStatus")
public AjaxResult changeStatus(@RequestParam("taskId") Long taskId, @RequestParam("emplId") String emplId, @RequestParam("type") Integer type) { public AjaxResult changeStatus(@RequestParam("taskId") Long taskId, @RequestParam("emplId") String emplId, @RequestParam("type") Integer type) {
if (type.equals(0)) { if (type.equals(0)) {
return toAjax(tagGroupTaskService.updateEmplTaskStatus(taskId, emplId));
return toAjax(tagGroupTaskService.updateFollowerTaskStatus(taskId, emplId));
} else { } else {
return toAjax(sopService.updateChatSopStatus(taskId, emplId)); return toAjax(sopService.updateChatSopStatus(taskId, emplId));
} }
} }
/** /**
......
...@@ -37,7 +37,7 @@ import java.util.zip.ZipOutputStream; ...@@ -37,7 +37,7 @@ import java.util.zip.ZipOutputStream;
* @author kewen * @author kewen
* @date 2021-02-19 * @date 2021-02-19
*/ */
@Api(description = "新客自动拉群 Controller") @Api(tags = "新客自动拉群 Controller")
@RestController @RestController
@RequestMapping(value = "/wecom/communityNewGroup") @RequestMapping(value = "/wecom/communityNewGroup")
public class WeCommunityNewGroupController extends BaseController { public class WeCommunityNewGroupController extends BaseController {
......
...@@ -2,49 +2,50 @@ package com.linkwechat.web.controller.wecom; ...@@ -2,49 +2,50 @@ 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;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.domain.WePresTagGroupTask; import com.linkwechat.wecom.domain.WePresTagGroupTask;
import com.linkwechat.wecom.domain.WePresTagGroupTaskStat; import com.linkwechat.wecom.domain.dto.WePresTagGroupTaskDto;
import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskStatVo;
import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo; import com.linkwechat.wecom.domain.vo.WePresTagGroupTaskVo;
import com.linkwechat.wecom.domain.vo.WePresTagTaskListVO;
import com.linkwechat.wecom.service.IWePresTagGroupTaskService; import com.linkwechat.wecom.service.IWePresTagGroupTaskService;
import io.swagger.annotations.Api; import com.linkwechat.wecom.service.IWeGroupCodeService;
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.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;
@Api("老客标签建群接口")
@RestController @RestController
@RequestMapping(value = "/wecom/communityPresTagGroup") @RequestMapping(value = "/wecom/communityPresTagGroup")
public class WeCommunityPresTagGroupController extends BaseController { public class WeCommunityPresTagGroupController extends BaseController {
@Autowired @Autowired
IWePresTagGroupTaskService taskService; private IWePresTagGroupTaskService taskService;
@Autowired
private IWeGroupCodeService groupCodeService;
/** /**
* 获取老客标签建群列表数据 * 获取老客标签建群列表数据
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:list')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:list')")
@GetMapping(path = "/list") @GetMapping(path = "/list")
@ApiOperation(value = "获取老客标签建群任务分页数据", httpMethod = "GET") public TableDataInfo<List<WePresTagGroupTaskVo>> getList(
public TableDataInfo<List<WePresTagTaskListVO>> getPage(
@RequestParam(value = "taskName", required = false) String taskName, @RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "sendType", required = false) Integer sendType, @RequestParam(value = "sendType", required = false) Integer sendType,
@RequestParam(value = "createBy", required = false) String createBy, @RequestParam(value = "createBy", required = false) String createBy,
@RequestParam(value = "beginTime", required = false) String beginTime, @RequestParam(value = "beginTime", required = false) String beginTime,
@RequestParam(value = "endTime", required = false) String endTime) { @RequestParam(value = "endTime", required = false) String endTime) {
startPage(); startPage();
List<WePresTagTaskListVO> result = taskService.selectTaskList(taskName, sendType, createBy, beginTime, endTime); List<WePresTagGroupTaskVo> wePresTagGroupTaskVoList = taskService.selectTaskList(taskName, sendType, createBy, beginTime, endTime);
return getDataTable(result); return getDataTable(wePresTagGroupTaskVoList);
} }
/** /**
...@@ -52,16 +53,28 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -52,16 +53,28 @@ public class WeCommunityPresTagGroupController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:add')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:add')")
@PostMapping @PostMapping
@ApiOperation(value = "新建老客标签建群任务", httpMethod = "POST") public AjaxResult addTask(@RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) {
public AjaxResult add(@RequestBody @Validated WePresTagGroupTask task) { if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
}
WePresTagGroupTask task = new WePresTagGroupTask();
BeanUtils.copyProperties(wePresTagGroupTaskDto, task);
// 检测任务名是否可用 // 检测任务名是否可用
if (taskService.isNameOccupied(task)) { if (taskService.isNameOccupied(task)) {
return AjaxResult.error("任务名已存在"); return AjaxResult.error("任务名已存在");
} }
task.setCreateBy(SecurityUtils.getUsername()); task.setCreateBy(SecurityUtils.getUsername());
int affectedRows = taskService.add(task); List<String> tagList = wePresTagGroupTaskDto.getTagList();
// 再发送消息 List<String> scopeList = wePresTagGroupTaskDto.getScopeList();
if (affectedRows > 0) taskService.sendMessage(task); int affectedRows = taskService.add(task, tagList, scopeList);
if (affectedRows > 0) {
boolean hasScope = StringUtils.isNotEmpty(wePresTagGroupTaskDto.getScopeList());
boolean hasTag = StringUtils.isNotEmpty(wePresTagGroupTaskDto.getTagList());
List<String> externalIds = taskService
.selectExternalUserIds(task.getTaskId(), hasScope, hasTag, wePresTagGroupTaskDto.getSendScope(),
wePresTagGroupTaskDto.getCusBeginTime(), wePresTagGroupTaskDto.getCusEndTime());
taskService.sendMessage(task, externalIds);
}
return toAjax(affectedRows); return toAjax(affectedRows);
} }
...@@ -70,8 +83,7 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -70,8 +83,7 @@ public class WeCommunityPresTagGroupController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')")
@GetMapping(path = "/{id}") @GetMapping(path = "/{id}")
@ApiOperation(value = "根据获取任务详细信息", httpMethod = "GET") public AjaxResult getTask(@PathVariable("id") Long id) {
public AjaxResult getInfo(@PathVariable("id") Long id) {
WePresTagGroupTaskVo taskVo = taskService.getTaskById(id); WePresTagGroupTaskVo taskVo = taskService.getTaskById(id);
if (StringUtils.isNull(taskVo)) { if (StringUtils.isNull(taskVo)) {
return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在"); return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
...@@ -84,15 +96,11 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -84,15 +96,11 @@ public class WeCommunityPresTagGroupController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:edit')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:edit')")
@PutMapping(path = "/{id}") @PutMapping(path = "/{id}")
@ApiOperation(value = "更新任务信息", httpMethod = "PUT") public AjaxResult updateTask(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTaskDto wePresTagGroupTaskDto) {
public AjaxResult update(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTask task) { if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
// 保存新任务 return AjaxResult.error(HttpStatus.NOT_FOUND, "群活码不存在");
task.setTaskId(id); }
task.setUpdateBy(SecurityUtils.getUsername()); return toAjax(taskService.updateTask(id, wePresTagGroupTaskDto));
task.setUpdateTime(new Date());
int rows = taskService.updateTask(task);
if (rows > 0) taskService.sendMessage(task);
return toAjax(rows);
} }
/** /**
...@@ -100,8 +108,7 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -100,8 +108,7 @@ public class WeCommunityPresTagGroupController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:remove')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:remove')")
@DeleteMapping(path = "/{ids}") @DeleteMapping(path = "/{ids}")
@ApiOperation(value = "批量删除老客标签建群任务", httpMethod = "DELETE") public AjaxResult batchRemoveTask(@PathVariable("ids") Long[] ids) {
public AjaxResult batchRemove(@PathVariable("ids") Long[] ids) {
return toAjax(taskService.batchRemoveTaskByIds(ids)); return toAjax(taskService.batchRemoveTaskByIds(ids));
} }
...@@ -110,17 +117,16 @@ public class WeCommunityPresTagGroupController extends BaseController { ...@@ -110,17 +117,16 @@ public class WeCommunityPresTagGroupController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')") // @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')")
@GetMapping(path = "/stat/{id}") @GetMapping(path = "/stat/{id}")
public TableDataInfo<List<WePresTagGroupTaskStat>> getStatInfo( public TableDataInfo<List<WePresTagGroupTaskStatVo>> getStatInfo(
@PathVariable("id") Long id, @PathVariable("id") Long id,
@RequestParam(value = "customerName", required = false) String customerName, @RequestParam(value = "customerName", required = false) String customerName,
@RequestParam(value = "isInGroup", required = false) Integer isInGroup, @RequestParam(value = "isInGroup", required = false) Integer isInGroup,
@RequestParam(value = "isSent", required = false) Integer isSent @RequestParam(value = "isSent", required = false) Integer isSent
) { ) {
WePresTagGroupTask task = taskService.getById(id);
startPage(); startPage();
List<WePresTagGroupTaskStat> stats = taskService.getTaskStat(id, customerName, isInGroup, isSent, task.getSendType()); List<WePresTagGroupTaskStatVo> statVoList = taskService.getStatByTaskId(id);
return getDataTable(stats); return getDataTable(statVoList);
} }
......
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.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.entity.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 企业id相关配置Controller
*
* @author ruoyi
* @date 2020-08-24
*/
@RestController @RestController
@RequestMapping("/wecom/corp") @RequestMapping(value = "/wecom/corp")
@Api("企业id配置接口") public class WeCorpAccountController {
public class WeCorpAccountController extends BaseController
{
@Autowired
private IWeCorpAccountService weCorpAccountService;
@Autowired
private IWeCorpAccountService iWeCorpAccountService;
// @PreAuthorize("@ss.hasPermi('wechat:corp:list')")
@GetMapping("/list")
@ApiOperation("查询企业id相关配置列表")
public TableDataInfo list(WeCorpAccount weCorpAccount)
{
startPage();
List<WeCorpAccount> list = weCorpAccountService.list(new LambdaQueryWrapper<WeCorpAccount>()
.eq(WeCorpAccount::getDelFlag,Constants.NORMAL_CODE)
.like(WeCorpAccount::getCompanyName,weCorpAccount.getCompanyName()));
return getDataTable(list);
}
/**
* 获取当前企业可用密钥
* @return
*/
@GetMapping("/findCurrentCorpAccount")
public AjaxResult findCurrentCorpAccount(){
return AjaxResult.success(
iWeCorpAccountService.findValidWeCorpAccount()
);
}
// @PreAuthorize("@ss.hasPermi('wechat:corp:add')") /**
@Log(title = "新增企业id相关配置", businessType = BusinessType.INSERT) * 新增或更新企业配置相关
@PostMapping * @param weCorpAccount
@ApiOperation("新增企业id相关配置") * @return
public AjaxResult add(@Validated @RequestBody WeCorpAccount weCorpAccount) */
@Log(title = "新增或更新企业配置相关", businessType = BusinessType.INSERT)
@PostMapping("/addOrUpdate")
public AjaxResult addOrUpdate(@RequestBody WeCorpAccount weCorpAccount)
{ {
weCorpAccountService.save(weCorpAccount); iWeCorpAccountService.saveOrUpdate(weCorpAccount);
return AjaxResult.success();
}
// @PreAuthorize("@ss.hasPermi('wechat:corp:edit')")
@Log(title = "修改企业id相关配置", businessType = BusinessType.UPDATE)
@PutMapping
@ApiOperation("修改企业id相关配置")
public AjaxResult edit(@Validated @RequestBody WeCorpAccount weCorpAccount)
{
weCorpAccountService.updateById(weCorpAccount);
return AjaxResult.success(); return AjaxResult.success();
} }
// @PreAuthorize("@ss.hasPermi('wechat:corp:startVailWeCorpAccount')") /**
@Log(title = "启用有效企业微信账号", businessType = BusinessType.DELETE) * 客户流失通知开关
@PutMapping("/startVailWeCorpAccount/{corpId}") * @param status
@ApiOperation("启用有效企业微信账号") * @return
public AjaxResult startWeCorpAccount(@PathVariable String corpId) */
{
return toAjax(weCorpAccountService.startVailWeCorpAccount(corpId));
}
// @PreAuthorize("@ss.hasPermi('wechat:corp:startCustomerChurnNoticeSwitch')")
@Log(title = "客户流失通知开关", businessType = BusinessType.UPDATE) @Log(title = "客户流失通知开关", businessType = BusinessType.UPDATE)
@PutMapping("/startCustomerChurnNoticeSwitch/{status}") @PutMapping("/startCustomerChurnNoticeSwitch/{status}")
@ApiOperation("客户流失通知开关")
public AjaxResult startCustomerChurnNoticeSwitch(@PathVariable String status) public AjaxResult startCustomerChurnNoticeSwitch(@PathVariable String status)
{ {
weCorpAccountService.startCustomerChurnNoticeSwitch(status); iWeCorpAccountService.startCustomerChurnNoticeSwitch(status);
return AjaxResult.success(); return AjaxResult.success();
} }
// @PreAuthorize("@ss.hasPermi('wechat:corp:getCustomerChurnNoticeSwitch')") /**
* 客户流失通知开关查询
* @return
*/
@Log(title = "客户流失通知开关查询", businessType = BusinessType.OTHER) @Log(title = "客户流失通知开关查询", businessType = BusinessType.OTHER)
@GetMapping("/getCustomerChurnNoticeSwitch") @GetMapping("/getCustomerChurnNoticeSwitch")
@ApiOperation("客户流失通知开关查询")
public AjaxResult getCustomerChurnNoticeSwitch() public AjaxResult getCustomerChurnNoticeSwitch()
{ {
return AjaxResult.success("操作成功",weCorpAccountService.getCustomerChurnNoticeSwitch()); return AjaxResult.success("操作成功",iWeCorpAccountService.getCustomerChurnNoticeSwitch());
} }
} }
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.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.wecom.domain.WeCustomerPortrait; import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.WeCustomerTrajectory;
import com.linkwechat.wecom.domain.WeFlowerCustomerTagRel;
import com.linkwechat.wecom.domain.WeTagGroup;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.service.*; import com.linkwechat.wecom.service.*;
import org.aspectj.weaver.loadtime.Aj; import org.aspectj.weaver.loadtime.Aj;
...@@ -36,6 +35,10 @@ public class WeCustomerPortraitController extends BaseController { ...@@ -36,6 +35,10 @@ public class WeCustomerPortraitController extends BaseController {
@Autowired @Autowired
private IWeTagService iWeTagService;
@Autowired
private IWeUserService iWeUserService; private IWeUserService iWeUserService;
...@@ -81,23 +84,65 @@ public class WeCustomerPortraitController extends BaseController { ...@@ -81,23 +84,65 @@ public class WeCustomerPortraitController extends BaseController {
/** /**
* 获取当前系统所有可用标签 * 获取当前系统所有可用标签
* @param groupTagType 标签分组类型(1:客户标签;2:群标签)
* @param userId 员工id
* @return * @return
*/ */
@GetMapping(value = "/findAllTags") @GetMapping(value = "/findAllTags")
public AjaxResult findAllTags(){ public AjaxResult findAllTags(Integer groupTagType,String userId){
return AjaxResult.success( return AjaxResult.success(
weTagGroupService.selectWeTagGroupList( weTagGroupService.selectWeTagGroupList(
WeTagGroup.builder() WeTagGroup.builder()
.groupTagType(groupTagType)
.owner(userId)
.build() .build()
) )
); );
}
/**
* 客户画像个人标签库新增
* @param weTagGroup
* @return
*/
@PostMapping("/addOrUpdatePersonTags")
public AjaxResult addOrUpdatePersonTags(@RequestBody WeTagGroup weTagGroup){
if(weTagGroupService.saveOrUpdate(weTagGroup)){
List<WeTag> weTags = weTagGroup.getWeTags();
if(CollectionUtil.isNotEmpty(weTags)){
weTags.stream().forEach(k->{
k.setGroupId(weTagGroup.getGroupId());
k.setTagType(new Integer(3));
});
iWeTagService.saveOrUpdateBatch(weTags);
}
}
return AjaxResult.success();
}
/**
* 个人标签删除
* @param ids
* @return
*/
@DeleteMapping("/deletePersonTag/{ids}")
public AjaxResult deletePersonTag(@PathVariable String[] ids){
iWeTagService.removeByIds(CollectionUtil.newArrayList(ids));
return AjaxResult.success();
} }
/** /**
* 更新客户画像标签 * 更新客户画像标签
* @param weMakeCustomerTag * @param weMakeCustomerTag
......
package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.poi.ExcelUtil;
import com.linkwechat.wecom.domain.WeCustomerSeas;
import com.linkwechat.wecom.domain.vo.CustomerSeasRecordVo;
import com.linkwechat.wecom.service.IWeCustomerMessagePushService;
import com.linkwechat.wecom.service.IWeCustomerSeasService;
import com.linkwechat.wecom.service.IWeMessagePushService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.text.MessageFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* 客户公海相关
*/
@RestController
@RequestMapping("/wecom/seas")
public class WeCustomerSeasController extends BaseController {
@Autowired
private IWeCustomerSeasService iWeCustomerSeasService;
/**
* 客户公海模版下载
* @return
*/
@GetMapping("/importTemplate")
public AjaxResult importTemplate()
{
ExcelUtil<WeCustomerSeas> util = new ExcelUtil<WeCustomerSeas>(WeCustomerSeas.class);
return util.importTemplateExcel( DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD)+"_客户公海");
}
/**
* 导入公海数据
* @param file
* @param weCustomerSea
* @return
*/
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, WeCustomerSeas weCustomerSea) throws Exception {
ExcelUtil<WeCustomerSeas> util = new ExcelUtil<WeCustomerSeas>(WeCustomerSeas.class);
List<WeCustomerSeas> weCustomerSeas = util.importExcel(file.getInputStream());
String tip=new String("成功导入{0}条,去重复{1}条");
if(CollectionUtil.isNotEmpty(weCustomerSeas)){
if(StringUtils.isEmpty(weCustomerSea.getAddUserName())&&StringUtils.isEmpty(weCustomerSea.getAddUserId())){
return AjaxResult.error("分配人不可为空!");
}
//过滤字段为空的数据
List<WeCustomerSeas> deduplicationSeas = weCustomerSeas.stream().filter(s -> StringUtils.isNotEmpty(s.getCustomerName())
|| StringUtils.isNotEmpty(s.getPhone())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(deduplicationSeas)){
return AjaxResult.error("导入用户数据不能为空!");
}
//根据手机号去重(去除excel中重复的号码)
List<WeCustomerSeas> deduplicationSeasNoRepeat=deduplicationSeas.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(WeCustomerSeas :: getPhone))), ArrayList::new));
//根据手机号去除数据库与excel中重复号码
List<WeCustomerSeas> dbExist = iWeCustomerSeasService.list(new LambdaQueryWrapper<WeCustomerSeas>()
.in(WeCustomerSeas::getPhone, deduplicationSeasNoRepeat.stream()
.map(WeCustomerSeas::getPhone).collect(Collectors.toList())));
if(CollectionUtil.isNotEmpty(dbExist)){
List<WeCustomerSeas> noRepetWeCustomerSeas
= deduplicationSeasNoRepeat.stream().filter(item ->
!dbExist.stream().map(e->e.getPhone()).collect(Collectors.toList())
.contains(item.getPhone())).collect(Collectors.toList());
deduplicationSeasNoRepeat.clear();
deduplicationSeasNoRepeat.addAll(
noRepetWeCustomerSeas
);
}
if(CollectionUtil.isNotEmpty(deduplicationSeasNoRepeat)){
Long tabaleExcelId= SnowFlakeUtil.nextId();
List<String> userIds = ListUtil.toList(weCustomerSea.getAddUserId().split(","));
List<String> userNames = ListUtil.toList(weCustomerSea.getAddUserName().split(","));
IntStream.range(0,deduplicationSeasNoRepeat.size()).forEach(i->{
WeCustomerSeas k = deduplicationSeasNoRepeat.get(i);
if(Objects.nonNull(k)){
k.setTagIds(weCustomerSea.getTagIds());
k.setTagNames(weCustomerSea.getTagNames());
k.setAddUserId( userIds.get(Math.floorMod(i, userIds.size())));
k.setAddUserName(userNames.get(Math.floorMod(i, userNames.size())));
k.setTableExcelName(file.getOriginalFilename());
k.setTableExcelId(tabaleExcelId);
}
});
if(iWeCustomerSeasService.saveBatch(deduplicationSeasNoRepeat)){
//发送提醒
deduplicationSeasNoRepeat.stream().collect(Collectors.groupingBy(WeCustomerSeas::getAddUserId)).forEach((k,v)->{
iWeCustomerSeasService.remidUser(ListUtil.toList(k),v.size());
});
}
tip = MessageFormat.format(tip, new Object[]{new Integer(deduplicationSeasNoRepeat.size()).toString(),
new Integer( weCustomerSeas.size()-deduplicationSeasNoRepeat.size()).toString()});
}else{
tip = MessageFormat.format(tip, new Object[] { "0",weCustomerSeas.size() });
}
;
}else{
return AjaxResult.error("导入用户数据不能为空!");
}
return AjaxResult.success(tip);
}
/**
* 获取公海客户列表
* @param weCustomerSea
* @return
*/
@GetMapping("list")
public TableDataInfo list(WeCustomerSeas weCustomerSea){
startPage();
List<WeCustomerSeas> weCustomerSeas = iWeCustomerSeasService.list(
new LambdaQueryWrapper<WeCustomerSeas>()
.like(StringUtils.isNotEmpty(weCustomerSea.getPhone()),WeCustomerSeas::getPhone,weCustomerSea.getPhone())
.like(StringUtils.isNotEmpty(weCustomerSea.getCustomerName()),WeCustomerSeas::getCustomerName,weCustomerSea.getCustomerName())
.like(StringUtils.isNotEmpty(weCustomerSea.getAddUserName()),WeCustomerSeas::getAddUserName,weCustomerSea.getAddUserName())
.eq(weCustomerSea.getAddState() !=null ,WeCustomerSeas::getAddState,weCustomerSea.getAddState())
.orderByDesc(WeCustomerSeas::getCreateTime)
);
return getDataTable(weCustomerSeas);
}
/**
* 删除公海客户
* @param ids
* @return
*/
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
iWeCustomerSeasService.removeByIds(
ListUtil.toList(ids)
);
return AjaxResult.success();
}
/**
* 提醒员工
* @param ids
* @return
*/
@PostMapping("/remidUser/{ids}")
public AjaxResult remidUser(@PathVariable Long[] ids){
List<WeCustomerSeas> weCustomerSeas
= iWeCustomerSeasService.listByIds(ListUtil.toList(ids));
if(CollectionUtil.isNotEmpty(weCustomerSeas)){
weCustomerSeas.stream().collect(Collectors.groupingBy(WeCustomerSeas::getAddUserId)).forEach((k,v)->{
iWeCustomerSeasService.remidUser(ListUtil.toList(k),v.size());
});
}
return AjaxResult.success();
}
/**
* 获取指定员工所拥有的状态(移动端)
* @param userId
* @param addState
* @return
*/
@GetMapping("/findEmployeeCustomer")
public TableDataInfo findEmployeeCustomer(String userId,Integer addState){
startPage();
List<WeCustomerSeas> weCustomerSeas = iWeCustomerSeasService.list(new LambdaQueryWrapper<WeCustomerSeas>()
.eq(StringUtils.isNotEmpty(userId),WeCustomerSeas::getAddUserId, userId)
.eq(addState != null,WeCustomerSeas::getAddState, addState));
return getDataTable(weCustomerSeas);
}
/**
* 详情头部统计
* @return
*/
@GetMapping("/countCustomerSeas")
public AjaxResult countCustomerSeas(){
return AjaxResult.success(
iWeCustomerSeasService.countCustomerSeas()
);
}
/**
* 导入记录或员工添加统计
* @param groupByType 1:获取导入记录数据 2:员工添加统计
* @return
*/
@GetMapping("/findSeasRecord")
public TableDataInfo findSeasRecord(@RequestParam(defaultValue = "1") Integer groupByType){
startPage();
List<CustomerSeasRecordVo> seasRecord = iWeCustomerSeasService.findSeasRecord(groupByType);
return getDataTable(seasRecord);
}
}
...@@ -190,7 +190,7 @@ public class WeEmpleCodeController extends BaseController { ...@@ -190,7 +190,7 @@ public class WeEmpleCodeController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:code:getUserAddCustomerStat')") // @PreAuthorize("@ss.hasPermi('wecom:code:getUserAddCustomerStat')")
@Log(title = "成员添加客户统计", businessType = BusinessType.OTHER) @Log(title = "成员添加客户统计", businessType = BusinessType.OTHER)
@GetMapping("/getUserAddCustomerStat") @GetMapping("/getUserAddCustomerStat")
public AjaxResult getUserAddCustomerStat(String codeId,String beginTime,String endTime){ public AjaxResult getUserAddCustomerStat(WeFlowerCustomerRel weFlowerCustomerRel){
return AjaxResult.success(weFlowerCustomerRelService.getUserAddCustomerStat(codeId, beginTime, endTime)); return AjaxResult.success(weFlowerCustomerRelService.getUserAddCustomerStat(weFlowerCustomerRel));
} }
} }
...@@ -3,8 +3,13 @@ package com.linkwechat.web.controller.wecom; ...@@ -3,8 +3,13 @@ package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
/** /**
* @author danmo * @author danmo
...@@ -20,6 +25,17 @@ public class WeExceptionController { ...@@ -20,6 +25,17 @@ public class WeExceptionController {
return AjaxResult.error(ex.getCode(),ex.getMessage()); return AjaxResult.error(ex.getCode(),ex.getMessage());
} }
@ExceptionHandler({MethodArgumentNotValidException.class})
public AjaxResult customException(MethodArgumentNotValidException e) {
// 获取参数校验失败信息
List<ObjectError> list = e.getBindingResult().getAllErrors();
StringBuilder errorMsg = new StringBuilder();
for (ObjectError error : list){
errorMsg.append(error.getDefaultMessage()).append("\n");
}
return AjaxResult.error(errorMsg.toString());
}
@ExceptionHandler(Exception.class) @ExceptionHandler(Exception.class)
public AjaxResult runtimeException(Exception ex){ public AjaxResult runtimeException(Exception ex){
log.error("接口异常拦截 ex:{}",ex); log.error("接口异常拦截 ex:{}",ex);
......
...@@ -73,9 +73,9 @@ public class WeGroupCodeActualController extends BaseController { ...@@ -73,9 +73,9 @@ public class WeGroupCodeActualController extends BaseController {
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody WeGroupCodeActual weGroupCodeActual) { public AjaxResult add(@Validated @RequestBody WeGroupCodeActual weGroupCodeActual) {
// 唯一性检查 // 唯一性检查
// if (!weGroupCodeActualService.checkChatIdUnique(weGroupCodeActual)) { if (!weGroupCodeActualService.checkChatIdUnique(weGroupCodeActual)) {
// return AjaxResult.error("新增实际群码失败, 该群聊二维码已存在"); return AjaxResult.error("新增实际群码失败, 该群聊二维码已存在");
// } }
return toAjax(weGroupCodeActualService.insertWeGroupCodeActual(weGroupCodeActual)); return toAjax(weGroupCodeActualService.insertWeGroupCodeActual(weGroupCodeActual));
} }
...@@ -86,15 +86,15 @@ public class WeGroupCodeActualController extends BaseController { ...@@ -86,15 +86,15 @@ public class WeGroupCodeActualController extends BaseController {
@Log(title = "实际群码", businessType = BusinessType.UPDATE) @Log(title = "实际群码", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WeGroupCodeActual weGroupCodeActual) { public AjaxResult edit(@RequestBody WeGroupCodeActual weGroupCodeActual) {
// WeGroupCodeActual original = weGroupCodeActualService.selectWeGroupCodeActualById(weGroupCodeActual.getId()); WeGroupCodeActual original = weGroupCodeActualService.selectWeGroupCodeActualById(weGroupCodeActual.getId());
// if (StringUtils.isNull(original)) { if (StringUtils.isNull(original)) {
// return AjaxResult.error(HttpStatus.NOT_FOUND, "数据不存在"); return AjaxResult.error(HttpStatus.NOT_FOUND, "数据不存在");
// } }
// // 实际码对应客户群变化时,检查其唯一性 // 实际码对应客户群变化时,检查其唯一性
// if (!original.getChatId().equals(weGroupCodeActual.getChatId()) && if (!original.getChatId().equals(weGroupCodeActual.getChatId()) &&
// !weGroupCodeActualService.checkChatIdUnique(weGroupCodeActual)) { !weGroupCodeActualService.checkChatIdUnique(weGroupCodeActual)) {
// return AjaxResult.error("修改实际群码失败, 该群聊二维码已存在"); return AjaxResult.error("修改实际群码失败, 该群聊二维码已存在");
// } }
return toAjax(weGroupCodeActualService.updateWeGroupCodeActual(weGroupCodeActual)); return toAjax(weGroupCodeActualService.updateWeGroupCodeActual(weGroupCodeActual));
} }
......
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.constant.WeConstans; 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;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.wecom.constants.SynchRecordConstants;
import com.linkwechat.wecom.domain.WeGroup; import com.linkwechat.wecom.domain.WeGroup;
import com.linkwechat.wecom.domain.WeGroupMember; import com.linkwechat.wecom.domain.WeGroupMember;
import com.linkwechat.wecom.domain.vo.WeMakeGroupTagVo; import com.linkwechat.wecom.domain.vo.WeMakeGroupTagVo;
import com.linkwechat.wecom.service.IWeGroupMemberService; import com.linkwechat.wecom.service.IWeGroupMemberService;
import com.linkwechat.wecom.service.IWeGroupService; import com.linkwechat.wecom.service.IWeGroupService;
import com.linkwechat.wecom.service.IWeGroupTagRelService; import com.linkwechat.wecom.service.IWeGroupTagRelService;
import com.linkwechat.wecom.service.IWeSynchRecordService;
import io.swagger.annotations.ApiOperation; 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.security.access.prepost.PreAuthorize;
...@@ -40,15 +44,51 @@ public class WeGroupController extends BaseController { ...@@ -40,15 +44,51 @@ public class WeGroupController extends BaseController {
@Autowired @Autowired
private IWeGroupTagRelService iWeGroupTagRelService; private IWeGroupTagRelService iWeGroupTagRelService;
@Autowired
private IWeSynchRecordService iWeSynchRecordService;
// @PreAuthorize("@ss.hasPermi('customerManage:group:list')") // @PreAuthorize("@ss.hasPermi('customerManage:group:list')")
@GetMapping({"/list"}) @GetMapping({"/list"})
public TableDataInfo list(WeGroup weGroup) { public TableDataInfo list(WeGroup weGroup) {
startPage(); startPage();
List<WeGroup> list = this.weGroupService.selectWeGroupList(weGroup); List<WeGroup> list = this.weGroupService.selectWeGroupList(weGroup);
return getDataTable(list); TableDataInfo dataTable = getDataTable(list);
dataTable.setLastSyncTime(
iWeSynchRecordService.findUpdateLatestTime(SynchRecordConstants.SYNCH_CUSTOMER_GROUP)
);//最近同步时间
return dataTable;
} }
/**
* 群详情
* @param chatId
* @return
*/
@GetMapping("/chatDetail/{chatId}")
public AjaxResult chatDetail(@PathVariable String chatId){
List<WeGroup> weGroups = this.weGroupService.selectWeGroupList(WeGroup.builder()
.chatId(chatId)
.build());
if(CollectionUtil.isNotEmpty(weGroups)){
return AjaxResult.success(weGroups.stream().findFirst().get());
}
return AjaxResult.success();
}
/**
* 获取所有群接口(不分页)
* @param weGroup
* @return
*/
@GetMapping({"/allList"})
public AjaxResult allList(WeGroup weGroup) {
return AjaxResult.success(
this.weGroupService.selectWeGroupList(weGroup)
);
}
// @PreAuthorize("@ss.hasPermi('customerManage:group:view')") // @PreAuthorize("@ss.hasPermi('customerManage:group:view')")
@GetMapping({"/members"}) @GetMapping({"/members"})
...@@ -65,13 +105,11 @@ public class WeGroupController extends BaseController { ...@@ -65,13 +105,11 @@ public class WeGroupController extends BaseController {
// @PreAuthorize("@ss.hasPermi('customerManage:group:sync')") // @PreAuthorize("@ss.hasPermi('customerManage:group:sync')")
@GetMapping({"/synchWeGroup"}) @GetMapping({"/synchWeGroup"})
public AjaxResult synchWeGroup(){ public AjaxResult synchWeGroup(){
try { try {
SecurityContext context = SecurityContextHolder.getContext();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weGroupService.synchWeGroup(); weGroupService.synchWeGroup();
} catch (Exception e) { }catch (CustomException e){
e.printStackTrace(); return AjaxResult.error(e.getMessage());
} }
return AjaxResult.success(WeConstans.SYNCH_TIP); return AjaxResult.success(WeConstans.SYNCH_TIP);
} }
......
...@@ -63,7 +63,7 @@ public class WeGroupMessageTemplateController extends BaseController { ...@@ -63,7 +63,7 @@ public class WeGroupMessageTemplateController extends BaseController {
@ApiOperation(value = "新增群发消息模板", httpMethod = "POST") @ApiOperation(value = "新增群发消息模板", httpMethod = "POST")
@Log(title = "群发消息模板", businessType = BusinessType.INSERT) @Log(title = "群发消息模板", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
public AjaxResult addGroupMsgTemplate(@RequestBody WeAddGroupMessageQuery query) { public AjaxResult addGroupMsgTemplate(@RequestBody WeAddGroupMessageQuery query) throws Exception {
iWeGroupMessageTemplateService.addGroupMsgTemplate(query); iWeGroupMessageTemplateService.addGroupMsgTemplate(query);
return AjaxResult.success(); return AjaxResult.success();
} }
...@@ -106,10 +106,10 @@ public class WeGroupMessageTemplateController extends BaseController { ...@@ -106,10 +106,10 @@ public class WeGroupMessageTemplateController extends BaseController {
} }
/** /**
* 群发成员执行结果列表 * 群发成员发送任务列表
*/ */
//@PreAuthorize("@ss.hasPermi('linkwechat:template:remove')") //@PreAuthorize("@ss.hasPermi('linkwechat:template:remove')")
@ApiOperation(value = "群发成员执行结果列表", httpMethod = "GET") @ApiOperation(value = "群发成员发送任务列表", httpMethod = "GET")
@Log(title = "群发消息模板", businessType = BusinessType.SELECT) @Log(title = "群发消息模板", businessType = BusinessType.SELECT)
@GetMapping("/send/result/list") @GetMapping("/send/result/list")
public TableDataInfo<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult) { public TableDataInfo<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult) {
......
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import cn.hutool.core.collection.CollectionUtil;
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;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.exception.CustomException;
import com.linkwechat.wecom.domain.WeMessagePush; import com.linkwechat.wecom.client.WeMomentsClient;
import com.linkwechat.wecom.constants.SynchRecordConstants;
import com.linkwechat.wecom.domain.WeMoments; import com.linkwechat.wecom.domain.WeMoments;
import com.linkwechat.wecom.domain.dto.moments.MomentsCreateResultDto;
import com.linkwechat.wecom.service.IWeMomentsService; import com.linkwechat.wecom.service.IWeMomentsService;
import com.linkwechat.wecom.service.IWeSynchRecordService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
...@@ -25,6 +28,14 @@ public class WeMomentsController extends BaseController { ...@@ -25,6 +28,14 @@ public class WeMomentsController extends BaseController {
@Autowired @Autowired
IWeMomentsService iWeMomentsService; IWeMomentsService iWeMomentsService;
@Autowired
IWeSynchRecordService iWeSynchRecordService;
@Autowired
WeMomentsClient weMomentsClient;
/** /**
* 获取朋友圈列表 * 获取朋友圈列表
...@@ -34,24 +45,37 @@ public class WeMomentsController extends BaseController { ...@@ -34,24 +45,37 @@ public class WeMomentsController extends BaseController {
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(WeMoments weMoments) { public TableDataInfo list(WeMoments weMoments) {
startPage(); startPage();
return getDataTable( List<WeMoments> moments = iWeMomentsService.findMoments(weMoments);
iWeMomentsService.list( TableDataInfo dataTable = getDataTable(moments);
new LambdaQueryWrapper<WeMoments>() dataTable.setLastSyncTime(
.eq(StringUtils.isNotEmpty(weMoments.getCreateBy()), WeMoments::getCreateBy iWeSynchRecordService.findUpdateLatestTime( weMoments.getType().equals(new Integer(0))?
, weMoments.getCreateBy()) SynchRecordConstants.SYNCH_CUSTOMER_ENTERPRISE_MOMENTS:SynchRecordConstants.SYNCH_CUSTOMER_PERSON_MOMENTS)
.apply(weMoments.getBeginTime() != null, "to_date(create_time::text,'YYYY-MM-DD') >= to_date('" + weMoments.getBeginTime() + "','YYYY-MM-DD')") );//最近同步时间
.apply(weMoments.getEndTime() != null, "to_date(create_time::text,'YYYY-MM-DD') <= to_date('" + weMoments.getEndTime() + "','YYYY-MM-DD')")
) return dataTable;
);
} }
/** /**
* 获取朋友圈详情
* @param momentId
* @return
*/
@GetMapping("/findMomentsDetail/{momentId}")
public AjaxResult findMomentsDetail(@PathVariable String momentId){
return AjaxResult.success(
iWeMomentsService.findMomentsDetail(momentId)
);
}
/**
* 新增或者编辑朋友圈 * 新增或者编辑朋友圈
* @return * @return
*/ */
@PostMapping("/addOrUpdate") @PostMapping("/addOrUpdate")
public AjaxResult addOrUpdate(@RequestBody WeMoments weMoments){ public AjaxResult addOrUpdate(@RequestBody WeMoments weMoments) throws InterruptedException {
iWeMomentsService.addOrUpdateMoments(weMoments); iWeMomentsService.addOrUpdateMoments(weMoments);
...@@ -60,6 +84,42 @@ public class WeMomentsController extends BaseController { ...@@ -60,6 +84,42 @@ public class WeMomentsController extends BaseController {
} }
/**
* 朋友圈同步
* @param filterType 0:企业朋友圈;1:个人朋友圈
* @return
*/
@GetMapping("/synchMoments")
public AjaxResult synchMoments(@RequestParam(defaultValue = "0") Integer filterType){
try {
if(filterType.equals(new Integer(0))){
iWeMomentsService.synchEnterpriseMoments(filterType);
}else if(filterType.equals(new Integer(1))){
iWeMomentsService.synchPersonMoments(filterType);
}
}catch (CustomException e){
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success(WeConstans.SYNCH_TIP);
}
/**
* 个人朋友圈互动数据同步
* @param userIds
* @return
*/
@GetMapping("/synchMomentsInteracte/{userIds}")
public AjaxResult synchMomentsInteracte(@PathVariable String[] userIds){
iWeMomentsService.synchMomentsInteracte(CollectionUtil.newArrayList(userIds));
return AjaxResult.success(WeConstans.SYNCH_TIP);
}
......
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom; import cn.hutool.core.collection.CollectionUtil;import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;import com.linkwechat.common.annotation.Log;import com.linkwechat.common.core.controller.BaseController;import com.linkwechat.common.core.domain.AjaxResult;import com.linkwechat.common.core.page.TableDataInfo;import com.linkwechat.common.enums.BusinessType;import com.linkwechat.common.utils.StringUtils;import com.linkwechat.wecom.domain.WeMsgTlp;import com.linkwechat.wecom.service.IWeMsgTlpService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.*; /** * 欢迎语模板Controller * * @author ruoyi * @date 2020-10-04 */@RestController@RequestMapping("/wecom/tlp")public class WeMsgTlpController extends BaseController{ @Autowired private IWeMsgTlpService weMsgTlpService; /** * 查询欢迎语模板列表 */ // @PreAuthorize("@ss.hasPermi('wecom:tlp:list')") @GetMapping("/list") public TableDataInfo list(WeMsgTlp weMsgTlp) { startPage(); return getDataTable(weMsgTlpService.list( new LambdaQueryWrapper<WeMsgTlp>() .like(StringUtils.isNotEmpty(weMsgTlp.getWelcomeMsg()),WeMsgTlp::getWelcomeMsg,weMsgTlp.getWelcomeMsg()) .eq(weMsgTlp.getWelcomeMsgTplType() !=null,WeMsgTlp::getWelcomeMsgTplType,weMsgTlp.getWelcomeMsgTplType()) .like(StringUtils.isNotEmpty(weMsgTlp.getUserIds()),WeMsgTlp::getUserIds,weMsgTlp.getUserIds()) )); } /** * 新增欢迎语模板 */ // @PreAuthorize("@ss.hasPermi('wecom:tlp:add')") @Log(title = "新增欢迎语模板", businessType = BusinessType.INSERT) @PostMapping(value = "/addorUpdate") public AjaxResult addorUpdate(@RequestBody WeMsgTlp weMsgTlp) { weMsgTlpService.addorUpdate(weMsgTlp); return AjaxResult.success(); } /** * 删除欢迎语模板 */ // @PreAuthorize("@ss.hasPermi('wecom:tlp:remove')") @Log(title = "删除欢迎语模板", businessType = BusinessType.DELETE) @DeleteMapping("/remove/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { weMsgTlpService.removeByIds(CollectionUtil.toList(ids)); return AjaxResult.success(); } }
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeMsgTlp;
import com.linkwechat.wecom.domain.WeMsgTlpScope;
import com.linkwechat.wecom.service.IWeMsgTlpScopeService;
import com.linkwechat.wecom.service.IWeMsgTlpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
/**
* 欢迎语模板Controller
*
* @author ruoyi
* @date 2020-10-04
*/
@RestController
@RequestMapping("/wecom/tlp")
public class WeMsgTlpController extends BaseController
{
@Autowired
private IWeMsgTlpService weMsgTlpService;
@Autowired
private IWeMsgTlpScopeService iWeMsgTlpScopeService;
/**
* 查询欢迎语模板列表
*/
// @PreAuthorize("@ss.hasPermi('wecom:tlp:list')")
@GetMapping("/list")
public TableDataInfo list(WeMsgTlp weMsgTlp)
{
startPage();
List<WeMsgTlp> list = weMsgTlpService.selectWeMsgTlpList(weMsgTlp);
return getDataTable(list);
}
/**
* 获取欢迎语模板详细信息
*/
// @PreAuthorize("@ss.hasPermi('wecom:tlp:query')")
@GetMapping(value = "/scop/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(
iWeMsgTlpScopeService.selectWeMsgTlpScopeList(WeMsgTlpScope.builder().msgTlpId(id).build())
);
}
/**
* 新增欢迎语模板
*/
// @PreAuthorize("@ss.hasPermi('wecom:tlp:add')")
@Log(title = "新增欢迎语模板", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WeMsgTlp weMsgTlp)
{
return toAjax(weMsgTlpService.insertWeMsgTlp(weMsgTlp));
}
/**
* 修改欢迎语模板
*/
// @PreAuthorize("@ss.hasPermi('wecom:tlp:edit')")
@Log(title = "修改欢迎语模板", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WeMsgTlp weMsgTlp)
{
return toAjax(weMsgTlpService.updateWeMsgTlp(weMsgTlp));
}
/**
* 删除欢迎语模板
*/
// @PreAuthorize("@ss.hasPermi('wecom:tlp:remove')")
@Log(title = "删除欢迎语模板", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(weMsgTlpService.batchRemoveByids(Arrays.asList(ids)));
}
}
\ No newline at end of file \ No newline at end of file
......
...@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom; ...@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.redis.RedisCache; import com.linkwechat.common.core.redis.RedisCache;
import com.linkwechat.quartz.task.PageHomeDataTask;
import com.linkwechat.wecom.domain.dto.WePageStaticDataDto; import com.linkwechat.wecom.domain.dto.WePageStaticDataDto;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
import com.linkwechat.wecom.service.IWeUserService; import com.linkwechat.wecom.service.IWeUserService;
...@@ -21,13 +22,15 @@ import java.util.List; ...@@ -21,13 +22,15 @@ import java.util.List;
* @description 首页统计 * @description 首页统计
* @date 2021/2/23 15:30 * @date 2021/2/23 15:30
**/ **/
@Api(description = "首页统计contraller") @Api(tags = "首页统计")
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("wecom/page/") @RequestMapping("wecom/page/")
public class WePageDateContraller { public class WePageDateContraller {
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
private PageHomeDataTask pageHomeDataTask;
/** /**
* *
...@@ -42,8 +45,15 @@ public class WePageDateContraller { ...@@ -42,8 +45,15 @@ public class WePageDateContraller {
@ApiOperation(value = "实时数据controller",httpMethod = "GET") @ApiOperation(value = "实时数据controller",httpMethod = "GET")
// @PreAuthorize("@ss.hasPermi('wecom:page:getCorpRealTimeData')") // @PreAuthorize("@ss.hasPermi('wecom:page:getCorpRealTimeData')")
@GetMapping("/getCorpRealTimeData") @GetMapping("/getCorpRealTimeData")
public AjaxResult getCorpRealTimeData(){ public AjaxResult<WePageStaticDataDto> getCorpRealTimeData(){
WePageStaticDataDto wePageStaticDataDto = redisCache.getCacheObject("getCorpRealTimeData"); WePageStaticDataDto wePageStaticDataDto = redisCache.getCacheObject("getCorpRealTimeData");
return AjaxResult.success(wePageStaticDataDto); return AjaxResult.success(wePageStaticDataDto);
} }
@ApiOperation(value = "实时数据刷新",httpMethod = "GET")
@GetMapping("/refresh")
public AjaxResult refresh(){
pageHomeDataTask.getPageHomeDataData();
return AjaxResult.success();
}
} }
package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.CollectionUtil;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.domain.query.qr.WeQrAddQuery;
import com.linkwechat.wecom.domain.query.qr.WeQrCodeListQuery;
import com.linkwechat.wecom.domain.vo.qr.WeQrCodeDetailVo;
import com.linkwechat.wecom.domain.vo.qr.WeQrCodeScanCountVo;
import com.linkwechat.wecom.domain.vo.qr.WeQrScopeUserVo;
import com.linkwechat.wecom.domain.vo.qr.WeQrScopeVo;
import com.linkwechat.wecom.service.IWeQrCodeService;
import com.linkwechat.wecom.service.event.WeEventPublisherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author danmo
* @description 活码管理
* @date 2021/11/12 18:22
**/
@RestController
@RequestMapping(value = "wecom/qr/")
@Api(tags = "活码管理")
public class WeQrCodeController extends BaseController {
@Autowired
private IWeQrCodeService weQrCodeService;
@ApiOperation(value = "新增活码", httpMethod = "POST")
@Log(title = "活码管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult addQrCode(@RequestBody @Validated WeQrAddQuery weQrAddQuery) {
weQrCodeService.addQrCode(weQrAddQuery);
return AjaxResult.success();
}
@ApiOperation(value = "修改活码", httpMethod = "POST")
@Log(title = "活码管理", businessType = BusinessType.UPDATE)
@PutMapping("/update")
public AjaxResult updateQrCode(@RequestBody @Validated WeQrAddQuery weQrAddQuery) {
weQrCodeService.updateQrCode(weQrAddQuery);
return AjaxResult.success();
}
@ApiOperation(value = "获取活码详情", httpMethod = "GET")
@Log(title = "活码管理", businessType = BusinessType.SELECT)
@GetMapping("/get/{id}")
public AjaxResult<WeQrCodeDetailVo> getQrDetail(@PathVariable("id") Long Id) {
WeQrCodeDetailVo qrDetail = weQrCodeService.getQrDetail(Id);
return AjaxResult.success(qrDetail);
}
@ApiOperation(value = "获取活码列表", httpMethod = "GET")
@Log(title = "活码管理", businessType = BusinessType.SELECT)
@GetMapping("/list")
public TableDataInfo<WeQrCodeDetailVo> getQrCodeList(WeQrCodeListQuery qrCodeListQuery) {
startPage();
PageInfo<WeQrCodeDetailVo> qrCodeList = weQrCodeService.getQrCodeList(qrCodeListQuery);
return getDataTable(qrCodeList);
}
@ApiOperation(value = "删除活码", httpMethod = "DELETE")
@Log(title = "活码管理", businessType = BusinessType.SELECT)
@DeleteMapping("/del/{ids}")
public AjaxResult<WeQrCodeDetailVo> delQrCode(@PathVariable("ids") List<Long> ids) {
weQrCodeService.delQrCode(ids);
return AjaxResult.success();
}
@ApiOperation(value = "获取活码统计", httpMethod = "GET")
@Log(title = "活码管理", businessType = BusinessType.SELECT)
@GetMapping("/scan/count")
public AjaxResult<WeQrCodeScanCountVo> getWeQrCodeScanCount(WeQrCodeListQuery qrCodeListQuery) {
WeQrCodeScanCountVo weQrCodeScanCount = weQrCodeService.getWeQrCodeScanCount(qrCodeListQuery);
return AjaxResult.success(weQrCodeScanCount);
}
/**
* 员工活码批量下载
*
* @param ids 员工活码ids
* @param request 请求
* @param response 输出
* @throws Exception
*/
@ApiOperation(value = "员工活码批量下载", httpMethod = "GET")
@Log(title = "活码管理", businessType = BusinessType.OTHER)
@GetMapping("/batch/download")
public void batchDownload(@RequestParam("ids") List<Long> ids, HttpServletRequest request, HttpServletResponse response) throws IOException {
List<WeQrCodeDetailVo> qrCodeList = weQrCodeService.getQrDetailByQrIds(ids);
if(CollectionUtil.isNotEmpty(qrCodeList)){
List<Map<String, String>> fileList = qrCodeList.stream().map(item -> {
Map<String, String> fileMap = new HashMap<>();
List<WeQrScopeUserVo> userVoList = item.getQrUserInfos().stream().map(WeQrScopeVo::getWeQrUserList).flatMap(Collection::stream).collect(Collectors.toList());
String fileName = userVoList.stream().map(WeQrScopeUserVo::getUserName).collect(Collectors.joining(","));
fileMap.put("fileName", fileName + ".jpg");
fileMap.put("url", item.getQrCode());
return fileMap;
}).collect(Collectors.toList());
FileUtils.batchDownloadFile(fileList, response.getOutputStream());
}
}
/**
* 员工活码下载
*
* @param id 员工活码id
* @param request 请求
* @param response 输出
* @throws Exception
*/
@ApiOperation(value = "员工活码下载", httpMethod = "GET")
@Log(title = "活码管理", businessType = BusinessType.OTHER)
@GetMapping("/download")
public void download(@RequestParam("id") Long id, HttpServletRequest request, HttpServletResponse response) throws IOException {
WeQrCodeDetailVo qrDetail = weQrCodeService.getQrDetail(id);
if (StringUtils.isEmpty(qrDetail.getQrCode())){
throw new CustomException("活码不存在");
}else {
FileUtils.downloadFile(qrDetail.getQrCode(), response.getOutputStream());
}
}
}
...@@ -9,8 +9,11 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -9,8 +9,11 @@ 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.utils.Threads; import com.linkwechat.common.utils.Threads;
import com.linkwechat.wecom.constants.SynchRecordConstants;
import com.linkwechat.wecom.domain.WeTag; import com.linkwechat.wecom.domain.WeTag;
import com.linkwechat.wecom.service.IWeSynchRecordService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContext;
...@@ -41,21 +44,41 @@ public class WeTagGroupController extends BaseController ...@@ -41,21 +44,41 @@ public class WeTagGroupController extends BaseController
@Autowired @Autowired
private IWeTagGroupService weTagGroupService; private IWeTagGroupService weTagGroupService;
@Autowired
private IWeSynchRecordService iWeSynchRecordService;
/** /**
* 查询标签组列表 * 查询标签组列表(分页)
*/ */
// @PreAuthorize("@ss.hasPermi('customerManage:tag:list')") // @PreAuthorize("@ss.hasPermi('customerManage:tag:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(WeTagGroup weTagGroup) public TableDataInfo list(WeTagGroup weTagGroup)
{ {
startPage(); startPage();
return getDataTable(
TableDataInfo dataTable = getDataTable(weTagGroupService.selectWeTagGroupList(weTagGroup));
dataTable.setLastSyncTime(
iWeSynchRecordService.findUpdateLatestTime(SynchRecordConstants.SYNCH_CUSTOMER)
);//最近同步时间
return dataTable;
}
/**
* 查询标签组列表(不分页)
* @param weTagGroup
* @return
*/
@GetMapping("/allList")
public AjaxResult allList(WeTagGroup weTagGroup)
{
return AjaxResult.success(
weTagGroupService.selectWeTagGroupList(weTagGroup) weTagGroupService.selectWeTagGroupList(weTagGroup)
); );
} }
/** /**
* 新增标签组 * 新增标签组
*/ */
...@@ -113,16 +136,12 @@ public class WeTagGroupController extends BaseController ...@@ -113,16 +136,12 @@ public class WeTagGroupController extends BaseController
@GetMapping("/synchWeTags") @GetMapping("/synchWeTags")
public AjaxResult synchWeTags(){ public AjaxResult synchWeTags(){
SecurityContext securityContext = SecurityContextHolder.getContext(); try {
//异步同步一下标签库,解决标签不同步问题
Threads.SINGLE_THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
SecurityContextHolder.setContext(securityContext);
weTagGroupService.synchWeTags(); weTagGroupService.synchWeTags();
}catch (CustomException e){
return AjaxResult.error(e.getMessage());
} }
});
return AjaxResult.success(WeConstans.SYNCH_TIP); return AjaxResult.success(WeConstans.SYNCH_TIP);
} }
......
...@@ -32,7 +32,6 @@ import com.linkwechat.wecom.service.IWeTaskFissionService; ...@@ -32,7 +32,6 @@ import com.linkwechat.wecom.service.IWeTaskFissionService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -52,7 +51,6 @@ import java.util.Objects; ...@@ -52,7 +51,6 @@ import java.util.Objects;
* @author leejoker * @author leejoker
* @date 2021-01-20 * @date 2021-01-20
*/ */
@Slf4j
@Api("任务宝Controller") @Api("任务宝Controller")
@RestController @RestController
@RequestMapping("/wecom/fission") @RequestMapping("/wecom/fission")
...@@ -189,7 +187,7 @@ public class WeTaskFissionController extends BaseController { ...@@ -189,7 +187,7 @@ public class WeTaskFissionController extends BaseController {
// @PreAuthorize("@ss.hasPermi('wecom:fission:send')") // @PreAuthorize("@ss.hasPermi('wecom:fission:send')")
@Log(title = "发送裂变任务", businessType = BusinessType.OTHER) @Log(title = "发送裂变任务", businessType = BusinessType.OTHER)
@GetMapping("/send/{id}") @GetMapping("/send/{id}")
public AjaxResult send(@PathVariable Long id) { public AjaxResult send(@PathVariable Long id) throws Exception {
weTaskFissionService.sendWeTaskFission(id); weTaskFissionService.sendWeTaskFission(id);
return AjaxResult.success(); return AjaxResult.success();
} }
...@@ -220,7 +218,6 @@ public class WeTaskFissionController extends BaseController { ...@@ -220,7 +218,6 @@ public class WeTaskFissionController extends BaseController {
@Log(title = "生成带二维码的海报", businessType = BusinessType.OTHER) @Log(title = "生成带二维码的海报", businessType = BusinessType.OTHER)
@PostMapping("/poster") @PostMapping("/poster")
public AjaxResult<JSONObject> posterGenerate(@RequestBody WeTaskFissionPosterDTO weTaskFissionPosterDTO) { public AjaxResult<JSONObject> posterGenerate(@RequestBody WeTaskFissionPosterDTO weTaskFissionPosterDTO) {
log.info("获取任务所有参与客户的完成情况 入参params:{}",JSONObject.toJSONString(weTaskFissionPosterDTO));
String posterUrl = weTaskFissionService.fissionPosterGenerate(weTaskFissionPosterDTO); String posterUrl = weTaskFissionService.fissionPosterGenerate(weTaskFissionPosterDTO);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("posterUrl", posterUrl); json.put("posterUrl", posterUrl);
...@@ -253,7 +250,6 @@ public class WeTaskFissionController extends BaseController { ...@@ -253,7 +250,6 @@ public class WeTaskFissionController extends BaseController {
@Log(title = "根据任务id获取参与任务客户列表", businessType = BusinessType.OTHER) @Log(title = "根据任务id获取参与任务客户列表", businessType = BusinessType.OTHER)
@GetMapping("/getCustomerListById/{id}") @GetMapping("/getCustomerListById/{id}")
public AjaxResult<List<WeCustomer>> getCustomerListById(@ApiParam("任务id") @PathVariable("id") String id) { public AjaxResult<List<WeCustomer>> getCustomerListById(@ApiParam("任务id") @PathVariable("id") String id) {
log.info("根据任务id获取参与任务客户列表 入参id:{}",id);
return AjaxResult.success(weTaskFissionService.getCustomerListById(null, id)); return AjaxResult.success(weTaskFissionService.getCustomerListById(null, id));
} }
...@@ -267,7 +263,6 @@ public class WeTaskFissionController extends BaseController { ...@@ -267,7 +263,6 @@ public class WeTaskFissionController extends BaseController {
@GetMapping("/{id}/progress/{unionId}") @GetMapping("/{id}/progress/{unionId}")
public AjaxResult<WeTaskFissionProgressVO> getCustomerProgress(@ApiParam("任务id") @PathVariable("id") Long id public AjaxResult<WeTaskFissionProgressVO> getCustomerProgress(@ApiParam("任务id") @PathVariable("id") Long id
, @PathVariable("unionId") @ApiParam("客户id") String unionId) { , @PathVariable("unionId") @ApiParam("客户id") String unionId) {
log.info("获取客户邀请列表和任务进度 入参id:{},unionId:{}",id,unionId);
WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(id); WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(id);
if (weTaskFission != null) { if (weTaskFission != null) {
return AjaxResult.success(weTaskFissionService.getCustomerTaskProgress(weTaskFission, unionId)); return AjaxResult.success(weTaskFissionService.getCustomerTaskProgress(weTaskFission, unionId));
...@@ -284,7 +279,6 @@ public class WeTaskFissionController extends BaseController { ...@@ -284,7 +279,6 @@ public class WeTaskFissionController extends BaseController {
@Log(title = "获取任务所有参与客户的完成情况", businessType = BusinessType.OTHER) @Log(title = "获取任务所有参与客户的完成情况", businessType = BusinessType.OTHER)
@GetMapping("/{id}/progress") @GetMapping("/{id}/progress")
public AjaxResult<List<WeTaskFissionTotalProgressVO>> getAllCustomerProgress(@ApiParam("任务id") @PathVariable("id") Long id) { public AjaxResult<List<WeTaskFissionTotalProgressVO>> getAllCustomerProgress(@ApiParam("任务id") @PathVariable("id") Long id) {
log.info("获取任务所有参与客户的完成情况 入参id:{}",id);
WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(id); WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(id);
List<WeTaskFissionTotalProgressVO> list = Lists.newArrayList(); List<WeTaskFissionTotalProgressVO> list = Lists.newArrayList();
if (weTaskFission != null) { if (weTaskFission != null) {
......
...@@ -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.wecom.domain.WeUser; import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.vo.*; import com.linkwechat.wecom.domain.vo.*;
import com.linkwechat.wecom.service.IWeUserService; import com.linkwechat.wecom.service.IWeUserService;
...@@ -13,11 +14,8 @@ import io.swagger.annotations.Api; ...@@ -13,11 +14,8 @@ 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.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.*;
import java.util.List; import java.util.List;
...@@ -39,23 +37,36 @@ public class WeUserController extends BaseController { ...@@ -39,23 +37,36 @@ public class WeUserController extends BaseController {
/** /**
* 查询通讯录相关客户列表 * 查询通讯录相关客户列表
*/ */
//@PreAuthorize("@ss.hasPermi('contacts:organization:query')")
@Log(title = "查询通讯录相关客户列表", businessType = BusinessType.SELECT) @Log(title = "查询通讯录相关客户列表", businessType = BusinessType.SELECT)
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "获取通讯录人员列表", httpMethod = "GET") @ApiOperation(value = "获取通讯录人员列表", httpMethod = "GET")
public TableDataInfo<List<WeUser>> list(WeUser weUser) { public TableDataInfo<List<WeUser>> list(WeUser weUser) {
startPage(); startPage();
List<WeUser> list = weUserService.getList(weUser); return getDataTable(weUserService.getList(weUser));
return getDataTable(list);
} }
/** /**
* 获取所有员工接口(不分页)
* @param weUser
* @return
*/
@GetMapping("/findAllWeUser")
public AjaxResult findAllWeUser(WeUser weUser){
return AjaxResult.success(
weUserService.getList(weUser)
);
}
/**
* 获取通讯录相关客户详细信息 * 获取通讯录相关客户详细信息
* *
* @return * @return
*/ */
//@PreAuthorize("@ss.hasPermi('contacts:organization:view')")
@Log(title = "获取通讯录相关客户详细信息", businessType = BusinessType.SELECT) @Log(title = "获取通讯录相关客户详细信息", businessType = BusinessType.SELECT)
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
@ApiOperation(value = "获取通讯录相关客户详细信息", httpMethod = "GET") @ApiOperation(value = "获取通讯录相关客户详细信息", httpMethod = "GET")
...@@ -66,7 +77,6 @@ public class WeUserController extends BaseController { ...@@ -66,7 +77,6 @@ public class WeUserController extends BaseController {
/** /**
* 新增通讯录相关客户 * 新增通讯录相关客户
*/ */
//@PreAuthorize("@ss.hasPermi('contacts:organization:addMember')")
@Log(title = "通讯录相关客户", businessType = BusinessType.INSERT) @Log(title = "通讯录相关客户", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@ApiOperation("新增通讯录客户") @ApiOperation("新增通讯录客户")
...@@ -78,7 +88,6 @@ public class WeUserController extends BaseController { ...@@ -78,7 +88,6 @@ public class WeUserController extends BaseController {
/** /**
* 修改通讯录相关客户 * 修改通讯录相关客户
*/ */
//@PreAuthorize("@ss.hasPermi('contacts:organization:edit')")
@Log(title = "更新通讯录客户", businessType = BusinessType.UPDATE) @Log(title = "更新通讯录客户", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
@ApiOperation("更新通讯录客户") @ApiOperation("更新通讯录客户")
...@@ -94,7 +103,6 @@ public class WeUserController extends BaseController { ...@@ -94,7 +103,6 @@ public class WeUserController extends BaseController {
* @param weUser * @param weUser
* @return * @return
*/ */
//@PreAuthorize("@ss.hasPermi('contacts:organization:forbidden')")
@Log(title = "启用禁用用户", businessType = BusinessType.UPDATE) @Log(title = "启用禁用用户", businessType = BusinessType.UPDATE)
@PutMapping("/startOrStop") @PutMapping("/startOrStop")
@ApiOperation("是否启用(1表示启用成员,0表示禁用成员)") @ApiOperation("是否启用(1表示启用成员,0表示禁用成员)")
...@@ -110,13 +118,12 @@ public class WeUserController extends BaseController { ...@@ -110,13 +118,12 @@ public class WeUserController extends BaseController {
* @param weLeaveUserVo * @param weLeaveUserVo
* @return * @return
*/ */
// @PreAuthorize("@ss.hasPermi('customerManage:dimission:filter')")
@ApiOperation("离职已分配") @ApiOperation("离职已分配")
@Log(title = "离职已分配", businessType = BusinessType.SELECT) @Log(title = "离职已分配", businessType = BusinessType.SELECT)
@GetMapping({"/leaveUserAllocateList"}) @GetMapping({"/leaveUserAllocateList"})
public TableDataInfo<List<WeLeaveUserVo>> leaveUserAllocateList(WeLeaveUserVo weLeaveUserVo) { public TableDataInfo<List<WeLeaveUserVo>> leaveUserAllocateList(WeLeaveUserVo weLeaveUserVo) {
startPage(); startPage();
weLeaveUserVo.setIsActivate(WeConstans.WE_USER_IS_LEAVE); weLeaveUserVo.setIsActivate(WeConstans.corpUserEnum.ACTIVE_STATE_FIVE.getKey());
weLeaveUserVo.setIsAllocate(WeConstans.LEAVE_ALLOCATE_STATE); weLeaveUserVo.setIsAllocate(WeConstans.LEAVE_ALLOCATE_STATE);
List<WeLeaveUserVo> list = this.weUserService.leaveAllocateUserList(weLeaveUserVo); List<WeLeaveUserVo> list = this.weUserService.leaveAllocateUserList(weLeaveUserVo);
return getDataTable(list); return getDataTable(list);
...@@ -129,13 +136,12 @@ public class WeUserController extends BaseController { ...@@ -129,13 +136,12 @@ public class WeUserController extends BaseController {
* @param weLeaveUserVo * @param weLeaveUserVo
* @return * @return
*/ */
// @PreAuthorize("@ss.hasPermi('customerManage:dimission:query')")
@ApiOperation("离职未分配") @ApiOperation("离职未分配")
@Log(title = "离职未分配", businessType = BusinessType.SELECT) @Log(title = "离职未分配", businessType = BusinessType.SELECT)
@GetMapping({"/leaveUserNoAllocateList"}) @GetMapping({"/leaveUserNoAllocateList"})
public TableDataInfo<List<WeLeaveUserVo>> leaveUserNoAllocateList(WeLeaveUserVo weLeaveUserVo) { public TableDataInfo<List<WeLeaveUserVo>> leaveUserNoAllocateList(WeLeaveUserVo weLeaveUserVo) {
startPage(); startPage();
weLeaveUserVo.setIsActivate(WeConstans.WE_USER_IS_LEAVE); weLeaveUserVo.setIsActivate(WeConstans.corpUserEnum.ACTIVE_STATE_FIVE.getKey());
weLeaveUserVo.setIsAllocate(WeConstans.LEAVE_NO_ALLOCATE_STATE); weLeaveUserVo.setIsAllocate(WeConstans.LEAVE_NO_ALLOCATE_STATE);
List<WeLeaveUserVo> list = weUserService.leaveNoAllocateUserList(weLeaveUserVo); List<WeLeaveUserVo> list = weUserService.leaveNoAllocateUserList(weLeaveUserVo);
return getDataTable(list); return getDataTable(list);
...@@ -148,12 +154,11 @@ public class WeUserController extends BaseController { ...@@ -148,12 +154,11 @@ public class WeUserController extends BaseController {
* @param weLeaveUserInfoAllocateVo * @param weLeaveUserInfoAllocateVo
* @return * @return
*/ */
// @PreAuthorize("@ss.hasPermi('customerManage:dimission:allocate')")
@ApiOperation("离职分配") @ApiOperation("离职分配")
@Log(title = "离职分配", businessType = BusinessType.UPDATE) @Log(title = "离职分配", businessType = BusinessType.UPDATE)
@PutMapping({"/allocateLeaveUserAboutData"}) @PutMapping({"/allocateLeaveUserAboutData"})
public AjaxResult allocateLeaveUserAboutData(@RequestBody WeLeaveUserInfoAllocateVo weLeaveUserInfoAllocateVo) { public AjaxResult allocateLeaveUserAboutData(@RequestBody WeLeaveUserInfoAllocateVo weLeaveUserInfoAllocateVo) {
weLeaveUserInfoAllocateVo.setExtentType(new Integer(0));
weUserService.allocateLeaveUserAboutData(weLeaveUserInfoAllocateVo); weUserService.allocateLeaveUserAboutData(weLeaveUserInfoAllocateVo);
return AjaxResult.success("离职分配成功"); return AjaxResult.success("离职分配成功");
...@@ -165,15 +170,16 @@ public class WeUserController extends BaseController { ...@@ -165,15 +170,16 @@ public class WeUserController extends BaseController {
* *
* @return * @return
*/ */
// @PreAuthorize("@ss.hasPermi('contacts:organization:sync')")
@ApiOperation("同步成员") @ApiOperation("同步成员")
@Log(title = "同步成员", businessType = BusinessType.OTHER) @Log(title = "同步成员", businessType = BusinessType.OTHER)
@GetMapping({"/synchWeUser"}) @GetMapping({"/synchWeUser"})
public AjaxResult synchWeUser() { public AjaxResult synchWeUser() {
SecurityContext context = SecurityContextHolder.getContext(); try {
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weUserService.synchWeUser(); weUserService.synchWeUser();
}catch (CustomException e){
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success(WeConstans.SYNCH_TIP); return AjaxResult.success(WeConstans.SYNCH_TIP);
} }
...@@ -182,7 +188,6 @@ public class WeUserController extends BaseController { ...@@ -182,7 +188,6 @@ public class WeUserController extends BaseController {
* *
* @return * @return
*/ */
// @PreAuthorize("@ss.hasPermi('contacts:organization:removeMember')")
@ApiOperation("删除用户") @ApiOperation("删除用户")
@Log(title = "删除用户", businessType = BusinessType.DELETE) @Log(title = "删除用户", businessType = BusinessType.DELETE)
@DeleteMapping({"/{ids}"}) @DeleteMapping({"/{ids}"})
......
...@@ -17,20 +17,22 @@ ruoyi: ...@@ -17,20 +17,22 @@ ruoyi:
imgUrlPrefix: /lwImg imgUrlPrefix: /lwImg
#腾讯云对象存储 #腾讯云对象存储
cos: cos:
secretId: AKIDQRCizIeUGl13vakkDQMH0VkjhPr1rBBv secretId:
secretKey: e3D8oFetseC0f8OX9XeV7UcTDiyyQ8cr secretKey:
#link-wechat-1251309172.cos.ap-nanjing.myqcloud.com #link-wechat-1251309172.cos.ap-nanjing.myqcloud.com
region: ap-nanjing region:
bucketName: link-wechat-1251309172 bucketName:
cosImgUrlPrefix: https://link-wechat-1251309172.cos.ap-nanjing.myqcloud.com/ cosImgUrlPrefix:
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /app/project/pic) # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /app/project/pic)
#profile: /data/jenkins_home/app/project/ profile: /app/pic
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: true addressEnabled: true
# 验证码类型 math 数组计算 char 字符验证 # 验证码类型 math 数组计算 char 字符验证
captchaType: math captchaType: math
# 企业微信用户首次登录系统默认密码 # 企业微信用户首次登录系统默认密码
weUserDefaultPwd: 123456 weUserDefaultPwd: 123456
noSyncWeUser:
- 45DuXiangShangQingXie
#匿名访问的URL #匿名访问的URL
anonUrl: anonUrl:
- /login - /login
...@@ -64,11 +66,14 @@ ruoyi: ...@@ -64,11 +66,14 @@ ruoyi:
- /weixin/auth/** - /weixin/auth/**
- /wecom/material/temporaryMaterialMediaId - /wecom/material/temporaryMaterialMediaId
- /common/findFile - /common/findFile
- /wecom/seas/findEmployeeCustomer
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口,默认为8090 # 服务器的HTTP端口,默认为8090
port: 8090 port: 8070
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
...@@ -103,7 +108,7 @@ spring: ...@@ -103,7 +108,7 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:p6spy:mysql://127.0.0.1:3306/linkwechat?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:p6spy:mysql://127.0.0.1:10179/link-wechat-dev2.0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
username: root username: root
password: root password: root
# 从库数据源 # 从库数据源
...@@ -148,7 +153,7 @@ spring: ...@@ -148,7 +153,7 @@ spring:
# 慢SQL记录 # 慢SQL记录
log-slow-sql: true log-slow-sql: true
slow-sql-millis: 1000 slow-sql-millis: 1000
merge-sql: true merge-sql: false
wall: wall:
config: config:
multi-statement-allow: true multi-statement-allow: true
...@@ -204,11 +209,11 @@ mybatis-plus: ...@@ -204,11 +209,11 @@ mybatis-plus:
mapper-locations: classpath*:mapper/**/*Mapper.xml mapper-locations: classpath*:mapper/**/*Mapper.xml
type-aliases-package: com.linkwechat.**.domain type-aliases-package: com.linkwechat.**.domain
type-handlers-package: com.linkwechat.framework.handler.GenericTypeHandler,com.linkwechat.framework.handler.StringArrayJoinTypeHandler type-handlers-package: com.linkwechat.framework.handler.GenericTypeHandler,com.linkwechat.framework.handler.StringArrayJoinTypeHandler
global-config: #global-config:
db-config: #db-config:
logic-delete-field: delFlag #logic-delete-field: delFlag
logic-delete-value: 1 #logic-delete-value: 1
logic-not-delete-value: 0 #logic-not-delete-value: 0
mpp: mpp:
entityBasePath: com.linkwechat.**.domain entityBasePath: com.linkwechat.**.domain
...@@ -245,41 +250,34 @@ xss: ...@@ -245,41 +250,34 @@ xss:
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*
# elasticsearch配置 # elasticsearch配置
#elasticsearch: elasticsearch:
# schema: http schema: http
# address: 47.112.117.15:7200,47.112.117.15:7201,47.112.117.15:7202 address:
# userName: "elastic" userName: "elastic"
# password: "0p-0p-0p-" password: "0p-0p-0p-"
# connectTimeout: 10000 connectTimeout: 10000
# socketTimeout: 10000 socketTimeout: 10000
# connectionRequestTimeout: 10000 connectionRequestTimeout: 10000
# maxConnectNum: 100 maxConnectNum: 100
# maxConnectPerRoute: 100 maxConnectPerRoute: 100
# forest配置 # forest配置
forest: forest:
backend: httpclient backend: httpclient
max-retry-count: 3 # 请求失败后重试次数,默认为0次不重试 retry-count: 1 # 请求失败后重试次数,默认为0次不重试
max-retry-interval: 1000 #重试间隔时间 max-retry-interval: 1000 #重试间隔时间
connect-timeout: 3000 #链接超时时间 connect-timeout: 3000 #链接超时时间
timeout: 3000 # 请求超时时间 timeout: 3000 # 请求超时时间
## 日志总开关,打开/关闭Forest请求/响应日志(默认为 true)
log-enabled: true
## 打开/关闭Forest请求日志(默认为 true)
log-request: true
## 打开/关闭Forest响应状态日志(默认为 true)
log-response-status: true
## 打开/关闭Forest响应内容日志(默认为 false)
log-response-content: true
variables: variables:
weComServerUrl: https://qyapi.weixin.qq.com/ weComServerUrl: https://qyapi.weixin.qq.com/
weComePrefix: cgi-bin weComePrefix: cgi-bin
wxServerUrl: https://api.weixin.qq.com/ wxServerUrl: https://api.weixin.qq.com/
wxPrefix: sns wxPrefix: sns
wecome: wecome:
weNeedRetryErrorCodes: -1,42001,42009,40082,40014 chatKey: finance_new
serverUrl: https://qyapi.weixin.qq.com/
weComePrefix: cgi-bin
noAccessTokenUrl: noAccessTokenUrl:
- /gettoken - /gettoken
- /service/get_provider_token - /service/get_provider_token
...@@ -313,6 +311,8 @@ wecome: ...@@ -313,6 +311,8 @@ wecome:
- /externalcontact/groupchat/statistic - /externalcontact/groupchat/statistic
- /externalcontact/groupchat/statistic_group_by_day - /externalcontact/groupchat/statistic_group_by_day
fileUplodUrl: /media/upload,/media/uploadimg fileUplodUrl: /media/upload,/media/uploadimg
needProviderTokenUrl:
- /service/get_login_info
needChatTokenUrl: needChatTokenUrl:
- /msgaudit/get_permit_user_list - /msgaudit/get_permit_user_list
- /msgaudit/check_single_agree - /msgaudit/check_single_agree
...@@ -338,14 +338,14 @@ wecome: ...@@ -338,14 +338,14 @@ wecome:
- we_tag - we_tag
#企微回调通知配置 #企微回调通知配置
callBack: callBack:
appIdOrCorpId: ww38152475d1bca752 appIdOrCorpId:
token: Fm05d6n0NpuFrvOlgVxIbeSXtjgz token:
encodingAesKey: laevP8xCEG7BUqv5GuYXfg9HaRecxe4MU5F5cmnAI7n encodingAesKey:
# JS SDK 身份校验url # JS SDK 身份校验url
authorizeUrl: https://open.weixin.qq.com/connect/oauth2/authorize #authorizeUrl: https://open.weixin.qq.com/connect/oauth2/authorize
# JS SDK身份校验成功后的redirect url # JS SDK身份校验成功后的redirect url
authorizeRedirectUrl: http://linkwechat.cn/mobile/#/task #authorizeRedirectUrl: http://www.linkwechat.cn/mobile/#/task
weixin: weixin:
appid: wxa57479bcd3f15461
secret: f23f4becdcac9819f292a3754fd8f84e
\ No newline at end of file \ No newline at end of file
appid:
secret:
\ No newline at end of file \ No newline at end of file
#linkwechat.nacos.host=
#linkwechat.nacos.port=
#linkwechat.nacos.namespace=
#linkwechat.nacos.username=
#linkwechat.nacos.password=
\ No newline at end of file \ No newline at end of file
linkwechat.nacos.host=
linkwechat.nacos.port=
linkwechat.nacos.namespace=
linkwechat.nacos.username=
linkwechat.nacos.password=
\ No newline at end of file \ No newline at end of file
...@@ -276,6 +276,21 @@ ...@@ -276,6 +276,21 @@
<artifactId>spring-test</artifactId> <artifactId>spring-test</artifactId>
</dependency> </dependency>
<!-- mp3文件支持(如语音时长)-->
<dependency>
<groupId>org</groupId>
<artifactId>jaudiotagger</artifactId>
<version>2.0.1</version>
</dependency>
<!-- mp4文件支持(如语音时长)-->
<dependency>
<groupId>com.googlecode.mp4parser</groupId>
<artifactId>isoparser</artifactId>
<version>1.1.22</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
...@@ -100,7 +100,7 @@ public class RuoYiConfig ...@@ -100,7 +100,7 @@ public class RuoYiConfig
return "D:/linkWeChat/uploadPath"; return "D:/linkWeChat/uploadPath";
} }
return "/linkWeChat/uploadPath"; return "/Users/robin/work/sr_project/lw";
} }
public void setProfile(String profile) public void setProfile(String profile)
......
...@@ -46,4 +46,6 @@ public class WeComeConfig { ...@@ -46,4 +46,6 @@ public class WeComeConfig {
* 需要进行重试的企业微信请求错误码 * 需要进行重试的企业微信请求错误码
*/ */
private List<Integer> weNeedRetryErrorCodes; private List<Integer> weNeedRetryErrorCodes;
} }
...@@ -60,6 +60,11 @@ public class WeConstans { ...@@ -60,6 +60,11 @@ public class WeConstans {
public static final String WE_EMPLE_CODE_KEY = "we_emple_code_key"; public static final String WE_EMPLE_CODE_KEY = "we_emple_code_key";
/**
* 活码前缀
*/
public static final String WE_QR_CODE_PREFIX = "we_qr";
/** /**
* 企业微信接口返回成功code * 企业微信接口返回成功code
...@@ -276,23 +281,7 @@ public class WeConstans { ...@@ -276,23 +281,7 @@ public class WeConstans {
public static final String AppTicketKey = "ticket:AppGet"; public static final String AppTicketKey = "ticket:AppGet";
public static final String AgentTicketKey = "ticket:AgentGet"; public static final String AgentTicketKey = "ticket:AgentGet";
/** public static final String corpAccountKey = "we:corpAccount:{}";
* 企微回调事件类型路由
*/
public final static Map<String, String> eventRoute = new HashMap<String, String>() {
{
//成员事件
put("change_contact", "weEventChangeContactImpl");
//异步任务完成通知
put("batch_job_result", "weEventBatchJobResultImpl");
//外部联系人事件
put("change_external_contact", "weEventChangeExternalContactImpl");
//客户群事件
put("change_external_chat", "weEventChangeExternalChatImpl");
//客户标签事件
put("change_external_tag", "weEventChangeExternalTagImpl");
}
};
//性别,1表示男性,2表示女性 //性别,1表示男性,2表示女性
//表示所在部门是否为上级,0-否,1-是,顺序与Department字段的部门逐一对应 //表示所在部门是否为上级,0-否,1-是,顺序与Department字段的部门逐一对应
...@@ -418,9 +407,4 @@ public class WeConstans { ...@@ -418,9 +407,4 @@ public class WeConstans {
* 群发消息任务开关 * 群发消息任务开关
*/ */
public static Boolean WEGROUPMSGTIMEDTASK_SWITCH = true; public static Boolean WEGROUPMSGTIMEDTASK_SWITCH = true;
/**
* 老客标签建群企业群发消息模板
*/
public static final String MSG_TEMPLATE = "你有一个新社群运营任务,<a href='%s?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect'>请点击此链接查看详情</a>";
} }
...@@ -74,6 +74,8 @@ public class BaseController ...@@ -74,6 +74,8 @@ public class BaseController
return rspData; return rspData;
} }
/** /**
* 响应请求分页数据 * 响应请求分页数据
*/ */
......
package com.linkwechat.common.core.domain; package com.linkwechat.common.core.domain;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ApiModel
@Data @Data
public class Tree<T> { public class Tree<T> {
...@@ -20,6 +22,12 @@ public class Tree<T> { ...@@ -20,6 +22,12 @@ public class Tree<T> {
private String name; private String name;
/** /**
* 名称
*/
@ApiModelProperty("可删除标识 0 可删除 1 不可删除")
private Integer flag;
/**
* 父的叶子信息 * 父的叶子信息
*/ */
@ApiModelProperty(name = "children", value = "父的叶子信息") @ApiModelProperty(name = "children", value = "父的叶子信息")
......
...@@ -24,7 +24,6 @@ import javax.validation.constraints.NotBlank; ...@@ -24,7 +24,6 @@ import javax.validation.constraints.NotBlank;
@SuperBuilder @SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel("企业id配置相关实体")
@TableName("we_corp_account") @TableName("we_corp_account")
public class WeCorpAccount extends BaseEntity public class WeCorpAccount extends BaseEntity
{ {
...@@ -32,59 +31,135 @@ public class WeCorpAccount extends BaseEntity ...@@ -32,59 +31,135 @@ public class WeCorpAccount extends BaseEntity
/** $column.columnComment */ /** $column.columnComment */
@TableId @TableId
@ApiModelProperty("主键") private Long id;
private Long id= SnowFlakeUtil.nextId();
/** 企业名称 */ /***********************************************
@ApiModelProperty("企业名称") *******************企业配置start****************
@NotBlank(message = "企业名称不能为空") **********************************************/
private String companyName;
/** 企业ID */ /** 企业ID */
@ApiModelProperty("企业corpId")
@NotBlank(message = "企业ID不能为空") @NotBlank(message = "企业ID不能为空")
private String corpId; private String corpId;
/** 应用的密钥凭证 */
@ApiModelProperty("企业为corpSecret") /** 企业名称 */
@NotBlank(message = "应用的密钥凭证不能为空") @NotBlank(message = "企业名称不能为空")
private String companyName;
/***********************************************
*******************企业配置end****************
**********************************************/
/***********************************************
*******************通讯录配置start**************
**********************************************/
/** 通讯录Secret */
@NotBlank(message = "通讯录Secret不可为空")
private String corpSecret; private String corpSecret;
/** 帐号状态(0正常 1停用) */ /***********************************************
@ApiModelProperty("帐号状态(0正常 1停用)") *******************通讯录配置end****************
private String status; **********************************************/
/** 删除标志(0代表存在 2代表删除) */
@ApiModelProperty("删除标志(0代表存在 2代表删除)")
private String delFlag=new String("0");
@ApiModelProperty("外部联系人密钥") /***********************************************
@NotBlank(message = "外部联系人密钥凭证不能为空") *******************客户联系配置start*************
**********************************************/
@NotBlank(message = "客户联系Secret不可为空")
private String contactSecret; private String contactSecret;
@ApiModelProperty("应用id")
/***********************************************
*******************客户联系配置end***************
**********************************************/
/***********************************************
*******************应用配置start****************
**********************************************/
/**消息应用ID*/
@NotBlank(message = "消息应用ID不可为空")
private String agentId; private String agentId;
@ApiModelProperty("应用密钥") /**消息应用Secret*/
@NotBlank(message = "消息应用Secret不可为空")
private String agentSecret; private String agentSecret;
@ApiModelProperty("服务商密钥")
private String providerSecret;
@ApiModelProperty("会话存档密钥") /**会话私钥Secret*/
private String chatSecret; private String chatSecret;
@ApiModelProperty("企业微信扫码登陆回调地址") /**会话存档密钥*/
private String wxQrLoginRedirectUri; private String financePrivateKey;
/***********************************************
*******************应用配置end****************
**********************************************/
/***********************************************
*******************接收事件服务器start***********
**********************************************/
/**回调url*/
//private String backOffUrl;
/**回调token*/
private String token;
@ApiModelProperty("客户流失通知开关 0:关闭 1:开启") /**回调EncodingAESKey*/
private String encodingAesKey;
/***********************************************
*******************接收事件服务器end*************
**********************************************/
/***********************************************
*******************H5跳转start******************
**********************************************/
/**JS SDK 身份校验url*/
private String authorizeUrl;
/**群sop和老客标签建群,跳转链接*/
private String sopTagRedirectUrl;
/**客户公海,跳转链接*/
private String seasRedirectUrl;
/***********************************************
*******************H5跳转end*******************
**********************************************/
/**客服密钥*/
private String kfSecret;
/** 删除标志(0代表存在 1代表删除) */
private Integer delFlag;
/**客户流失通知开关 0:关闭 1:开启*/
private String customerChurnNoticeSwitch = Constants.NORMAL_CODE; private String customerChurnNoticeSwitch = Constants.NORMAL_CODE;
@ApiModelProperty("会话存档私钥")
private String financePrivateKey;
@ApiModelProperty("企业管理员账号")
private String corpAccount;
} }
package com.linkwechat.common.core.page; package com.linkwechat.common.core.page;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -24,6 +27,13 @@ public class TableDataInfo<T> implements Serializable ...@@ -24,6 +27,13 @@ public class TableDataInfo<T> implements Serializable
/** 消息内容 */ /** 消息内容 */
private String msg; private String msg;
/**最后同步时间*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastSyncTime;
/**去重复客户数*/
private long noRepeatCustomerTotal;
/** /**
* 表格数据对象 * 表格数据对象
*/ */
...@@ -82,4 +92,20 @@ public class TableDataInfo<T> implements Serializable ...@@ -82,4 +92,20 @@ public class TableDataInfo<T> implements Serializable
{ {
this.msg = msg; this.msg = msg;
} }
public Date getLastSyncTime() {
return lastSyncTime;
}
public void setLastSyncTime(Date lastSyncTime) {
this.lastSyncTime = lastSyncTime;
}
public long getNoRepeatCustomerTotal() {
return noRepeatCustomerTotal;
}
public void setNoRepeatCustomerTotal(long noRepeatCustomerTotal) {
this.noRepeatCustomerTotal = noRepeatCustomerTotal;
}
} }
package com.linkwechat.common.enums;
import java.util.stream.Stream;
/**
* 客户分配的状态
*/
public enum AllocateCustomerStatus {
JOB_EXTENDS_SUCCESS(0,"成功发起转接"),
JOB_EXTENDS_JTWB(1,"接替完毕"),
JOB_EXTENDS_DDJT(2,"等待接替"),
JOB_EXTENDS_KHJJ(3,"客户拒绝"),
JOB_EXTENDS_DDSX(4,"接替成员客户达到上限"),
JOB_EXTENDS_WJTJL(5,"无接替记录"),
JOB_EXTENDS_BKJC(6,"当前客户已被继承");
private final Integer code;
private final String info;
AllocateCustomerStatus(Integer code, String info)
{
this.code = code;
this.info = info;
}
public Integer getCode() {
return code;
}
public String getInfo() {
return info;
}
public static AllocateCustomerStatus of(Integer type){
return Stream.of(values()).filter(s->s.getCode().equals(type)).findFirst().orElseGet(null);
}
}
...@@ -3,7 +3,7 @@ package com.linkwechat.common.enums; ...@@ -3,7 +3,7 @@ package com.linkwechat.common.enums;
import lombok.Getter; import lombok.Getter;
/** /**
* 社群运营H5列表页数据类型 * H5列表页数据类型
* @Author Hang * @Author Hang
* @Date 2021/3/24 11:02 * @Date 2021/3/24 11:02
*/ */
...@@ -12,6 +12,8 @@ public enum CommunityTaskType { ...@@ -12,6 +12,8 @@ public enum CommunityTaskType {
TAG(1, "老客标签建群"), TAG(1, "老客标签建群"),
SEAS(3, "客户公海"),
SOP(2, "群sop"); SOP(2, "群sop");
......
...@@ -22,7 +22,28 @@ public enum MediaType { ...@@ -22,7 +22,28 @@ public enum MediaType {
/** /**
* 海报字体 * 海报字体
*/ */
POSTER_FONT("6", "poster_font"); POSTER_FONT("6", "poster_font"),
/**
* 图文
*/
IMAGE_TEXT("7","image_text"),
/**
* 链接
*/
LINK("8","link"),
/**
* 小程序
*/
APPLET("9","applet"),
/**
* 文字
*/
TEXT("10","text");
/** /**
* 媒体类型 * 媒体类型
...@@ -30,7 +51,7 @@ public enum MediaType { ...@@ -30,7 +51,7 @@ public enum MediaType {
String mediaType; String mediaType;
/** /**
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报 6 海报字体 * 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报 6 海报字体 7 图文 8 链接 9 小程序
*/ */
String type; String type;
......
...@@ -15,63 +15,63 @@ public enum MessageType { ...@@ -15,63 +15,63 @@ public enum MessageType {
/** /**
* 文本消息 * 文本消息
*/ */
TEXT("0", "text"), TEXT("0", "text", "文本"),
/** /**
* 图片消息 * 图片消息
*/ */
IMAGE("1", "image"), IMAGE("1", "image", "图片"),
/** /**
* 语音消息 * 语音消息
*/ */
VOICE("2", "voice"), VOICE("2", "voice", "语音"),
/** /**
* 视频消息 * 视频消息
*/ */
VIDEO("3", "video"), VIDEO("3", "video", "视频"),
/** /**
* 文件消息 * 文件消息
*/ */
FILE("4", "file"), FILE("4", "file", "文件"),
/** /**
* 文本卡片消息 * 文本卡片消息
*/ */
TEXTCARD("5", "textcard"), TEXTCARD("5", "textcard", "文本卡片"),
/** /**
* 图文消息 * 图文消息
*/ */
NEWS("6", "news"), NEWS("6", "news", "图文"),
/** /**
* 图文消息(mpnews) * 图文消息(mpnews)
*/ */
MPNEWS("7", "mpnews"), MPNEWS("7", "mpnews", "图文"),
/** /**
* markdown消息 * markdown消息
*/ */
MARKDOWN("8", "markdown"), MARKDOWN("8", "markdown", "markdown"),
/** /**
* 小程序通知消息 * 小程序通知消息
*/ */
MINIPROGRAM_NOTICE("9", "miniprogram_notice"), MINIPROGRAM_NOTICE("9", "miniprogram_notice", "小程序"),
/** /**
* 任务卡片消息 * 任务卡片消息
*/ */
TASKCARD("10", "taskcard"), TASKCARD("10", "taskcard", "任务卡片"),
/** /**
* 群发图文消息 * 群发图文消息
*/ */
LINK("11", "link"), LINK("11", "link","链接"),
/** /**
* 群发小程序 * 群发小程序
*/ */
MINIPROGRAM("12", "miniprogram"), MINIPROGRAM("12", "miniprogram", "小程序"),
; ;
/** /**
...@@ -80,13 +80,19 @@ public enum MessageType { ...@@ -80,13 +80,19 @@ public enum MessageType {
String messageType; String messageType;
/** /**
* 媒体名称
*/
String name;
/**
* 数据值 * 数据值
*/ */
String type; String type;
MessageType(String type, String messageType) { MessageType(String type, String messageType, String name) {
this.type = type; this.type = type;
this.messageType = messageType; this.messageType = messageType;
this.name = name;
} }
public static Optional<MessageType> of(String type) { public static Optional<MessageType> of(String type) {
......
package com.linkwechat.common.enums;
import lombok.Getter;
/**
* 老客标签建群任务群发类型
* @Author Hang
* @Date 2021/3/24 9:56
*/
@Getter
public enum TaskSendType {
/**
* 个人群发
*/
CROP(0, "企业群发"),
/**
* 企业群发
*/
SINGLE(1, "个人群发");
private final String name;
private final Integer type;
TaskSendType(Integer type, String name) {
this.name = name;
this.type = type;
}
}
...@@ -3,6 +3,9 @@ package com.linkwechat.common.utils; ...@@ -3,6 +3,9 @@ package com.linkwechat.common.utils;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
...@@ -373,5 +376,45 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils ...@@ -373,5 +376,45 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
} }
/**
* 当前时间向推几小时
* @param ihour 小时
* @return String
*/
public static String getBeforeByHourTime(int ihour){
String returnstr = "";
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - ihour);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
returnstr = df.format(calendar.getTime());
return returnstr;
}
/**
* 当前时间向推N天
* @param day 小时
* @return String
*/
public static String getBeforeByDayTime(int day){
LocalDateTime now = LocalDateTime.now();
now = now.minus(-day, ChronoUnit.DAYS);
return now.toString();
}
/**
* 当前时间向推N天
* 获取时间戳
* @param day 小时
* @return String
*/
public static Long getBeforeByDayLongTime(int day){
LocalDateTime now = LocalDateTime.now();
now = now.minus(-day, ChronoUnit.DAYS);
return now.toEpochSecond(ZoneOffset.of("+8"));
}
} }
package com.linkwechat.common.utils.file;
import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.audio.mp3.MP3AudioHeader;
import org.jaudiotagger.audio.mp3.MP3File;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import java.io.File;
public class AudioUtil {
/**
* 获取语音文件播放时长(秒) 支持wav 格式
* @param filePath
* @return
*/
public static Float getDuration(String filePath){
try{
File destFile = new File(filePath);
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(destFile);
AudioFormat format = audioInputStream.getFormat();
long audioFileLength = destFile.length();
int frameSize = format.getFrameSize();
float frameRate = format.getFrameRate();
float durationInSeconds = (audioFileLength / (frameSize * frameRate));
return durationInSeconds;
}catch (Exception e){
e.printStackTrace();
return 0f;
}
}
/**
* 获取mp3语音文件播放时长(秒) mp3
* @param filePath
* @return
*/
public static Float getMp3Duration(String filePath){
try {
File mp3File = new File(filePath);
MP3File f = (MP3File) AudioFileIO.read(mp3File);
MP3AudioHeader audioHeader = (MP3AudioHeader)f.getAudioHeader();
return Float.parseFloat(audioHeader.getTrackLength()+"");
} catch(Exception e) {
e.printStackTrace();
return 0f;
}
}
/**
* 获取mp3语音文件播放时长(秒)
* @param mp3File
* @return
*/
public static Float getMp3Duration(File mp3File){
try {
//File mp3File = new File(filePath);
MP3File f = (MP3File) AudioFileIO.read(mp3File);
MP3AudioHeader audioHeader = (MP3AudioHeader)f.getAudioHeader();
return Float.parseFloat(audioHeader.getTrackLength()+"");
} catch(Exception e) {
e.printStackTrace();
return 0f;
}
}
/**
* 得到pcm文件的毫秒数
*
* pcm文件音频时长计算
* 同图像bmp文件一样,pcm文件保存的是未压缩的音频信息。 16bits 编码是指,每次采样的音频信息用2个字节保存。可以对比下bmp文件用分别用2个字节保存RGB颜色的信息。 16000采样率 是指 1秒钟采样 16000次。常见的音频是44100HZ,即一秒采样44100次。 单声道: 只有一个声道。
*
* 根据这些信息,我们可以计算: 1秒的16000采样率音频文件大小是 2*16000 = 32000字节 ,约为32K 1秒的8000采样率音频文件大小是 2*8000 = 16000字节 ,约为 16K
*
* 如果已知录音时长,可以根据文件的大小计算采样率是否正常。
* @param filePath
* @return
*/
public static long getPCMDurationMilliSecond(String filePath) {
File file = new File(filePath);
//得到多少秒
long second = file.length() / 32000 ;
long milliSecond = Math.round((file.length() % 32000) / 32000.0 * 1000 ) ;
return second * 1000 + milliSecond;
}
}
...@@ -212,6 +212,7 @@ public class FileUploadUtils { ...@@ -212,6 +212,7 @@ public class FileUploadUtils {
// 指定要上传到 COS 上对象键 // 指定要上传到 COS 上对象键
ObjectMetadata objectMetadata = new ObjectMetadata(); ObjectMetadata objectMetadata = new ObjectMetadata();
InputStream inputStream = file.getInputStream();
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("{}",cosConfig.getCosImgUrlPrefix()+fileName); log.info("{}",cosConfig.getCosImgUrlPrefix()+fileName);
......
package com.linkwechat.common.utils.file; package com.linkwechat.common.utils.file;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
...@@ -241,4 +242,47 @@ public class FileUtils extends org.apache.commons.io.FileUtils ...@@ -241,4 +242,47 @@ public class FileUtils extends org.apache.commons.io.FileUtils
} }
return filename; return filename;
} }
/**
* MultipartFile 转化为file
* @param multiFile
* @return
*/
public static File MultipartFileToFile(MultipartFile multiFile) {
// 获取文件名
String fileName = multiFile.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// 若需要防止生成的临时文件重复,可以在文件名后添加随机码
try {
File file = File.createTempFile(fileName, prefix);
multiFile.transferTo(file);
return file;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 获取视频或者语音时长
* @param multiFile
* @return
* @throws IOException
*/
public static long getVideoOrVoice(MultipartFile multiFile) throws IOException {
long duration_new =0;
// 将MultipartFile file转换成为File
File f_file = MultipartFileToFile(multiFile);
String path = f_file.getCanonicalPath();
duration_new = VideoUtil.getDuration(path);
f_file.delete();
return duration_new;
}
} }
package com.linkwechat.common.utils.file;
import com.coremedia.iso.IsoFile;
import java.io.IOException;
class VideoUtil{
/**
* 获取视频文件的播放长度(mp4、mov格式)
* @param videoPath
* @return 单位为毫秒
*/
public static long getMp4Duration(String videoPath) throws IOException {
IsoFile isoFile = new IsoFile(videoPath);
long lengthInSeconds =
isoFile.getMovieBox().getMovieHeaderBox().getDuration() /
isoFile.getMovieBox().getMovieHeaderBox().getTimescale();
return lengthInSeconds;
}
/**
* 得到语音或视频文件时长,单位秒
* @param filePath
* @return
* @throws IOException
*/
public static long getDuration(String filePath) throws IOException {
String format = getVideoFormat(filePath);
long result = 0;
if("wav".equals(format)){
result = AudioUtil.getDuration(filePath).intValue();
}else if("mp3".equals(format)){
result = AudioUtil.getMp3Duration(filePath).intValue();
}else if("m4a".equals(format)) {
result = VideoUtil.getMp4Duration(filePath);
}else if("mov".equals(format)){
result = VideoUtil.getMp4Duration(filePath);
}else if("mp4".equals(format)){
result = VideoUtil.getMp4Duration(filePath);
}
return result;
}
/**
* 得到语音或视频文件时长,单位秒
* @param filePath
* @return
* @throws IOException
*/
public static long getDuration(String filePath,String format) throws IOException {
long result = 0;
if("wav".equals(format)){
result = AudioUtil.getDuration(filePath).intValue();
}else if("mp3".equals(format)){
result = AudioUtil.getMp3Duration(filePath).intValue();
}else if("m4a".equals(format)) {
result = VideoUtil.getMp4Duration(filePath);
}else if("mov".equals(format)){
result = VideoUtil.getMp4Duration(filePath);
}else if("mp4".equals(format)){
result = VideoUtil.getMp4Duration(filePath);
}
return result;
}
/**
* 得到文件格式
* @param path
* @return
*/
public static String getVideoFormat(String path){
return path.toLowerCase().substring(path.toLowerCase().lastIndexOf(".") + 1);
}
}
package com.linkwechat.common.utils.img; package com.linkwechat.common.utils.img;
import com.qcloud.cos.utils.IOUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
...@@ -8,14 +15,17 @@ import java.awt.*; ...@@ -8,14 +15,17 @@ import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.*; import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.stream.Stream; import java.util.stream.Stream;
@Slf4j
public class ImageUtils { public class ImageUtils {
private final static JLabel J_LABEL = new JLabel(); private final static JLabel J_LABEL = new JLabel();
...@@ -677,5 +687,92 @@ public class ImageUtils { ...@@ -677,5 +687,92 @@ public class ImageUtils {
this.value = value; this.value = value;
} }
} }
/**
* 根据url 拉取文件
* @param url
* @return
* @throws Exception
*/
public static File getFile(String url) throws Exception {
//对本地文件命名
String fileName = url.substring(url.lastIndexOf("."),url.length());
File file = null;
URL urlfile;
InputStream inStream = null;
OutputStream os = null;
try {
file = File.createTempFile("fwj_url", fileName);
//下载
urlfile = new URL(url);
inStream = urlfile.openStream();
os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = inStream.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != os) {
os.close();
}
if (null != inStream) {
inStream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return file;
}
/**
* 根据url获取图片并转换为multipartFile类型
* @param url
* @return
*/
public static MultipartFile getMultipartFile(String url) {
FileInputStream inputStream = null;
OutputStream outputStream = null;
try {
File file = getFile(url);
System.out.println(file.toPath());
FileItem fileItem = new DiskFileItem("formFieldName",//form表单文件控件的名字随便起
Files.probeContentType(file.toPath()),//文件类型
false, //是否是表单字段
file.getName(),//原始文件名
(int) file.length(),//Interger的最大值可以存储两部1G的电影
file.getParentFile());//文件会在哪个目录创建
//为DiskFileItem的OutputStream赋值
inputStream = new FileInputStream(file);
outputStream = fileItem.getOutputStream();
IOUtils.copy(inputStream, outputStream);
return new CommonsMultipartFile(fileItem);
} catch (Exception e) {
log.error("文件类型转换失败" + e.getMessage());
return null;
} finally {
try {
if (null != inputStream) {
inputStream.close();
}
if (null != outputStream) {
outputStream.close();
}
} catch (IOException e) {
log.error(">>文件流关闭失败" + e.getMessage());
}
}
}
} }
...@@ -9,17 +9,11 @@ import java.lang.reflect.Field; ...@@ -9,17 +9,11 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import org.apache.commons.io.IOUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
...@@ -54,6 +48,12 @@ import com.linkwechat.common.exception.CustomException; ...@@ -54,6 +48,12 @@ import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.DictUtils; import com.linkwechat.common.utils.DictUtils;
import com.linkwechat.common.utils.reflect.ReflectUtils; import com.linkwechat.common.utils.reflect.ReflectUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.ResourceLoader;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
/** /**
* Excel相关处理 * Excel相关处理
...@@ -732,7 +732,8 @@ public class ExcelUtil<T> ...@@ -732,7 +732,8 @@ public class ExcelUtil<T>
*/ */
public String encodingFilename(String filename) public String encodingFilename(String filename)
{ {
filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx"; // filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx";
filename = filename + ".xlsx";
return filename; return filename;
} }
...@@ -933,4 +934,26 @@ public class ExcelUtil<T> ...@@ -933,4 +934,26 @@ public class ExcelUtil<T>
} }
return val; return val;
} }
public static void downloadExcel(HttpServletResponse httpServletResponse,String fileName) throws Exception {
InputStream inputStream = new ClassPathResource("/excel/seas.xlsx").getInputStream();
//设置响应类型
httpServletResponse.setContentType("multipart/form-data;charset=utf-8");
httpServletResponse.addHeader("Content-Disposition",
" attachment;filename=" + new String(fileName.getBytes(), "iso-8859-1"));
if(Objects.nonNull(inputStream)){
try(ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream()){
IOUtils.copy(inputStream, servletOutputStream);
httpServletResponse.flushBuffer();
}catch (Exception e){
log.error("模版下载失败"+fileName+":"+e.getMessage());
}
}
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -32,6 +32,7 @@ public class WeMetaObjectHandler implements MetaObjectHandler { ...@@ -32,6 +32,7 @@ public class WeMetaObjectHandler implements MetaObjectHandler {
String userName = getUserName(); String userName = getUserName();
this.setFieldValByName(CREATE_BY, userName, metaObject); this.setFieldValByName(CREATE_BY, userName, metaObject);
this.setFieldValByName(UPDATE_BY, userName, metaObject); this.setFieldValByName(UPDATE_BY, userName, metaObject);
} }
@Override @Override
...@@ -43,6 +44,7 @@ public class WeMetaObjectHandler implements MetaObjectHandler { ...@@ -43,6 +44,7 @@ public class WeMetaObjectHandler implements MetaObjectHandler {
} }
private String getUserName() { private String getUserName() {
String userName; String userName;
try { try {
userName = SecurityUtils.getUsername(); userName = SecurityUtils.getUsername();
......
...@@ -96,12 +96,12 @@ public class ChatMsgCheckListener implements MessageListener { ...@@ -96,12 +96,12 @@ public class ChatMsgCheckListener implements MessageListener {
allSensitiveRules.forEach(weSensitive -> { allSensitiveRules.forEach(weSensitive -> {
List<String> patternWords = Arrays.asList(weSensitive.getPatternWords().split(",")); List<String> patternWords = Arrays.asList(weSensitive.getPatternWords().split(","));
List<String> users = weSensitiveService.getScopeUsers(weSensitive.getAuditUserScope()); List<String> users = weSensitiveService.getScopeUsers(weSensitive.getAuditUserScope());
log.info("handleSensitiveHit: >>>>>>>>>>>>>>>>>>>>>>finalContent:{}, patternWords:{},users:{},from:{}", finalContent, JSONObject.toJSONString(patternWords), JSONObject.toJSONString(users), fromId); //log.info("handleSensitiveHit: >>>>>>>>>>>>>>>>>>>>>>finalContent:{}, patternWords:{},users:{},from:{}", finalContent, JSONObject.toJSONString(patternWords), JSONObject.toJSONString(users), fromId);
if (StringUtils.isNotBlank(finalContent) if (StringUtils.isNotBlank(finalContent)
&& !CollectionUtils.isEmpty(users) && !CollectionUtils.isEmpty(users)
&& users.stream().anyMatch(fromId::equals)) { && users.stream().anyMatch(fromId::equals)) {
WeChatContactSensitiveMsg wccsm = hitSensitive(patternWords, fromId, finalContent); WeChatContactSensitiveMsg wccsm = hitSensitive(patternWords, fromId, finalContent);
log.info("handleSensitiveHit: >>>>>>>>>>>>>>>>>>>>>> wccsm:{}",JSONObject.toJSONString(wccsm)); //log.info("handleSensitiveHit: >>>>>>>>>>>>>>>>>>>>>> wccsm:{}",JSONObject.toJSONString(wccsm));
if (wccsm != null) { if (wccsm != null) {
wccsm.setMsgId(msgId); wccsm.setMsgId(msgId);
wccsm.setFromId(fromId); wccsm.setFromId(fromId);
...@@ -119,7 +119,7 @@ public class ChatMsgCheckListener implements MessageListener { ...@@ -119,7 +119,7 @@ public class ChatMsgCheckListener implements MessageListener {
private WeChatContactSensitiveMsg hitSensitive(List<String> patternWords, String user, String content) { private WeChatContactSensitiveMsg hitSensitive(List<String> patternWords, String user, String content) {
WeChatContactSensitiveMsg weChatContactSensitiveMsg = new WeChatContactSensitiveMsg(); WeChatContactSensitiveMsg weChatContactSensitiveMsg = new WeChatContactSensitiveMsg();
String patternWordStr = patternWords.stream().filter(content.trim()::contains).collect(Collectors.joining(",")); String patternWordStr = patternWords.stream().filter(content.trim()::contains).collect(Collectors.joining(","));
log.info("hitSensitive: >>>>>>>>>>>>>>>>>>>>>> patternWordStr:{}",patternWordStr); //log.info("hitSensitive: >>>>>>>>>>>>>>>>>>>>>> patternWordStr:{}",patternWordStr);
if (StringUtils.isNotEmpty(patternWordStr)) { if (StringUtils.isNotEmpty(patternWordStr)) {
weChatContactSensitiveMsg.setContent(content); weChatContactSensitiveMsg.setContent(content);
weChatContactSensitiveMsg.setSendStatus(0); weChatContactSensitiveMsg.setSendStatus(0);
......
...@@ -28,7 +28,7 @@ public class EmpleCodeExpiredListener extends KeyExpirationEventMessageListener ...@@ -28,7 +28,7 @@ public class EmpleCodeExpiredListener extends KeyExpirationEventMessageListener
public void onMessage(Message message, byte[] pattern) { public void onMessage(Message message, byte[] pattern) {
System.out.println("过期key:" + message.toString()); System.out.println("过期key:" + message.toString());
if(message.toString().contains(WeConstans.WE_EMPLE_CODE_KEY)){ if(message.toString().contains(WeConstans.WE_EMPLE_CODE_KEY)){
weExternalContactClient.delContactWay(message.toString().split(":")[1]); //weExternalContactClient.delContactWay(message.toString().split(":")[1]);
} }
} }
} }
...@@ -64,4 +64,10 @@ public class SysFile ...@@ -64,4 +64,10 @@ public class SysFile
private String imgUrlPrefix; private String imgUrlPrefix;
/**
* 语音或者视频时长
*/
private Long timeLong;
} }
...@@ -3,6 +3,7 @@ package com.linkwechat.framework.web.service; ...@@ -3,6 +3,7 @@ package com.linkwechat.framework.web.service;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.config.RuoYiConfig; import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.exception.file.InvalidExtensionException;
import com.linkwechat.common.utils.OsUtils; import com.linkwechat.common.utils.OsUtils;
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;
...@@ -43,7 +44,7 @@ public class FileService { ...@@ -43,7 +44,7 @@ public class FileService {
* @return * @return
* @throws IOException * @throws IOException
*/ */
public SysFile upload(MultipartFile file) throws Exception { public SysFile upload(MultipartFile file) throws IOException, InvalidExtensionException {
try { try {
FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
...@@ -61,9 +62,15 @@ public class FileService { ...@@ -61,9 +62,15 @@ public class FileService {
fileName = FileUploadUtils.upload(osFile.getPath(), file); fileName = FileUploadUtils.upload(osFile.getPath(), file);
imgUrlPrefix = ruoYiConfig.getFile().getImgUrlPrefix(); imgUrlPrefix = ruoYiConfig.getFile().getImgUrlPrefix();
} }
return SysFile.builder() return SysFile.builder()
.fileName(fileName) .fileName(fileName)
.imgUrlPrefix(imgUrlPrefix) .imgUrlPrefix(imgUrlPrefix)
// .timeLong(
// FileUploadUtils.isAllowedExtension(FileUploadUtils.getExtension(file),
// MimeTypeUtils.MEDIA_EXTENSION
// )?FileUtils.getVideoOrVoice(file):new Long(0)
// )
.build(); .build();
}catch (Exception e){ }catch (Exception e){
......
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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.config.RuoYiConfig; import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.constant.Constants; 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.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.ISysRoleService;
import com.linkwechat.system.service.ISysUserService; import com.linkwechat.system.service.ISysUserService;
...@@ -27,9 +23,6 @@ import org.springframework.security.core.userdetails.UserDetailsService; ...@@ -27,9 +23,6 @@ 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;
/** /**
* 用户验证处理 * 用户验证处理
* *
...@@ -73,21 +66,6 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -73,21 +66,6 @@ public class UserDetailsServiceImpl implements UserDetailsService
if (StringUtils.isNull(user)) if (StringUtils.isNull(user))
{ {
//查询企业管理相关账号
WeCorpAccount weCorpByAccount = iWeCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>().eq(WeCorpAccount::getCorpAccount, username)
.eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE));
if(null != weCorpByAccount){
//注册到we_user表中
user=SysUser.builder()
.userName(weCorpByAccount.getCorpAccount())
.nickName(weCorpByAccount.getCompanyName())
.userType(Constants.USER_TYOE_CORP_ADMIN)
.roleIds(ArrayUtil.toArray(iSysRoleService.selectRoleList(SysRole.builder()
.roleKey(Constants.DEFAULT_WECOME_CORP_ADMIN)
.build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
.password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
.build();
} else{
//we_user表中去查询,如果该表为空则提示用户不存在,如果不为空,则将用户记录注册到系统用户表中 //we_user表中去查询,如果该表为空则提示用户不存在,如果不为空,则将用户记录注册到系统用户表中
WeUser weUser=iWeUserService.getOne(new LambdaQueryWrapper<WeUser>() WeUser weUser=iWeUserService.getOne(new LambdaQueryWrapper<WeUser>()
.eq(WeUser::getMobile,username) .eq(WeUser::getMobile,username)
...@@ -95,32 +73,58 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -95,32 +73,58 @@ public class UserDetailsServiceImpl implements UserDetailsService
if(null == weUser){ if(null == weUser){
throw new BaseException("对不起,您的账号:" + username + " 不存在"); throw new BaseException("对不起,您的账号:" + username + " 不存在");
} }
if(StrUtil.isBlank(weUser.getMobile())){ // if(StrUtil.isBlank(weUser.getMobile())){
throw new BaseException("请填写当前企业员工的手机号:" + username + " 然后再登录"); // throw new BaseException("请填写当前企业员工的手机号:" + username + " 然后再登录");
} // }
//注册到we_user表中
user=SysUser.builder() // //查询企业管理相关账号
.userName(username) // WeCorpAccount weCorpByAccount = iWeCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>().eq(WeCorpAccount::getCorpAccount, username)
.nickName(weUser.getName()) // .eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE));
.userType(Constants.USER_TYPE_WECOME) // if(null != weCorpByAccount){
.email(weUser.getEmail()) // //注册到we_user表中
.phonenumber(weUser.getMobile()) // user=SysUser.builder()
.sex(weUser.getGender() ==0 ? "1": weUser.getGender() .toString()) // .userName(weCorpByAccount.getCorpAccount())
.avatar(weUser.getHeadImageUrl()) // .nickName(weCorpByAccount.getCompanyName())
.weUserId(weUser.getUserId()) // .userType(Constants.USER_TYOE_CORP_ADMIN)
.roleIds(ArrayUtil.toArray(iSysRoleService.selectRoleList(SysRole.builder() // .roleIds(ArrayUtil.toArray(iSysRoleService.selectRoleList(SysRole.builder()
.roleKey(Constants.DEFAULT_WECOME_ROLE_KEY) // .roleKey(Constants.DEFAULT_WECOME_CORP_ADMIN)
.build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class)) // .build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
.password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd())) // .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
.build(); // .build();
// } else{
} // //we_user表中去查询,如果该表为空则提示用户不存在,如果不为空,则将用户记录注册到系统用户表中
// WeUser weUser=iWeUserService.getOne(new LambdaQueryWrapper<WeUser>()
if(user != null){ // .eq(WeUser::getMobile,username)
userService.insertUser( // .ne(WeUser::getIsActivate,new Integer(6)));
user // if(null == weUser){
); // throw new BaseException("对不起,您的账号:" + username + " 不存在");
} // }
// if(StrUtil.isBlank(weUser.getMobile())){
// throw new BaseException("请填写当前企业员工的手机号:" + username + " 然后再登录");
// }
// //注册到we_user表中
// user=SysUser.builder()
// .userName(username)
// .nickName(weUser.getName())
// .userType(Constants.USER_TYPE_WECOME)
// .email(weUser.getEmail())
// .phonenumber(weUser.getMobile())
// .sex(weUser.getGender() ==0 ? "1": weUser.getGender() .toString())
// .avatar(weUser.getHeadImageUrl())
// .weUserId(weUser.getUserId())
// .roleIds(ArrayUtil.toArray(iSysRoleService.selectRoleList(SysRole.builder()
// .roleKey(Constants.DEFAULT_WECOME_ROLE_KEY)
// .build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// .build();
//
// }
//
// if(user != null){
// userService.insertUser(
// user
// );
// }
} }
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{ {
...@@ -134,13 +138,13 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -134,13 +138,13 @@ public class UserDetailsServiceImpl implements UserDetailsService
} }
//当前登录用户为企业管理,设置corpId和密钥相关 // //当前登录用户为企业管理,设置corpId和密钥相关
if(Constants.USER_TYOE_CORP_ADMIN.equals(user.getUserType())){ // if(Constants.USER_TYOE_CORP_ADMIN.equals(user.getUserType())){
user.setWeCorpAccount( // user.setWeCorpAccount(
iWeCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>().eq(WeCorpAccount::getCorpAccount, username) // iWeCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>().eq(WeCorpAccount::getCorpAccount, username)
.eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE)) // .eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE))
); // );
} // }
return createLoginUser(user); return createLoginUser(user);
......
package com.linkwechat.quartz.task; package com.linkwechat.quartz.task;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.utils.bean.BeanUtils; import com.linkwechat.common.utils.bean.BeanUtils;
...@@ -46,8 +47,8 @@ public class GroupChatStatisticTask { ...@@ -46,8 +47,8 @@ public class GroupChatStatisticTask {
List<WeGroupStatistic> weGroupStatisticList = new ArrayList<>(); List<WeGroupStatistic> weGroupStatisticList = new ArrayList<>();
GroupChatStatisticQuery query = new GroupChatStatisticQuery(); GroupChatStatisticQuery query = new GroupChatStatisticQuery();
//前一天的数据 //前一天的数据
Long startTime = strToDate(-1, 0); Long startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(),-1)).getTime()/1000;
Long endTime = strToDate(-1, 1); Long endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(),-1)).getTime()/1000;
query.setDay_begin_time(startTime); query.setDay_begin_time(startTime);
query.setDay_end_time(endTime); query.setDay_end_time(endTime);
weGroupList.forEach(weGroup -> { weGroupList.forEach(weGroup -> {
......
package com.linkwechat.quartz.task; package com.linkwechat.quartz.task;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dtflys.forest.exceptions.ForestRuntimeException; import com.dtflys.forest.exceptions.ForestRuntimeException;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
...@@ -58,8 +59,8 @@ public class UserBehaviorDataTak { ...@@ -58,8 +59,8 @@ public class UserBehaviorDataTak {
List<WeUserBehaviorData> dataList = new ArrayList<>(); List<WeUserBehaviorData> dataList = new ArrayList<>();
UserBehaviorDataQuery query = new UserBehaviorDataQuery(); UserBehaviorDataQuery query = new UserBehaviorDataQuery();
//前一天的数据 //前一天的数据
Long startTime = strToDate(-1, 0); Long startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(),-1)).getTime()/1000;
Long endTime = strToDate(-1, 1); Long endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(),-1)).getTime()/1000;
query.setStart_time(startTime); query.setStart_time(startTime);
query.setEnd_time(endTime); query.setEnd_time(endTime);
list.forEach(weUser -> { list.forEach(weUser -> {
...@@ -86,28 +87,4 @@ public class UserBehaviorDataTak { ...@@ -86,28 +87,4 @@ public class UserBehaviorDataTak {
} }
} }
private Long strToDate(int days, Integer type) {
Long time = null;
DateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
Calendar cale = Calendar.getInstance();
cale.add(Calendar.DATE, days);
String tarday = new SimpleDateFormat("yyyy-MM-dd").format(cale.getTime());
if (type.equals(0)) {
tarday += " 00:00:00";
} else {
tarday += " 23:59:59";
}
// String转Date
try {
date = format2.parse(tarday);
System.out.println(date.getTime());
time = date.getTime() / 1000;
System.out.println(time.toString());
} catch (ParseException e) {
e.printStackTrace();
}
return time;
}
} }
package com.linkwechat.quartz.task;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.Week;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeExternalContactClient;
import com.linkwechat.wecom.domain.WeQrCode;
import com.linkwechat.wecom.domain.dto.WeContactWayDto;
import com.linkwechat.wecom.domain.dto.WeExternalContactDto;
import com.linkwechat.wecom.domain.vo.qr.WeQrScopePartyVo;
import com.linkwechat.wecom.domain.vo.qr.WeQrScopeUserVo;
import com.linkwechat.wecom.domain.vo.qr.WeQrScopeVo;
import com.linkwechat.wecom.service.IWeQrCodeService;
import com.linkwechat.wecom.service.IWeQrScopeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author danmo
* @description 活码使用范围修改任务
* @date 2021/11/13 23:02
**/
@Slf4j
@Component("weQrCodeUpdateTask")
public class WeQrCodeUpdateTask {
@Autowired
private IWeQrScopeService weQrScopeService;
@Autowired
private IWeQrCodeService weQrCodeService;
@Autowired
private WeExternalContactClient externalContactClient;
public void qrCodeUpdateTask() {
List<WeQrScopeVo> weQrScopeList = weQrScopeService.getWeQrScopeByTime(DateUtil.formatDateTime(new Date()));
log.info("活码使用范围修改任务 weQrScopeList {}", JSONObject.toJSONString(weQrScopeList));
if (CollectionUtil.isNotEmpty(weQrScopeList)) {
Map<Long, List<WeQrScopeVo>> qrCodeMap = weQrScopeList.stream().collect(Collectors.groupingBy(WeQrScopeVo::getQrId));
qrCodeMap.forEach((qrId,scopeList) ->{
WeQrCode weQrCode = weQrCodeService.getById(qrId);
WeQrScopeVo weCustomizeQrScope = weQrScopeList.stream()
.filter(item -> ObjectUtil.equal(1, item.getType())).findFirst().orElse(null);
if(weCustomizeQrScope != null){
extracted(weCustomizeQrScope,weQrCode.getConfigId());
}else {
WeQrScopeVo weDefaultQrScope = weQrScopeList.stream()
.filter(item -> ObjectUtil.equal(0, item.getType())).findFirst().orElse(null);
extracted(weDefaultQrScope,weQrCode.getConfigId());
}
});
}
}
private void extracted(WeQrScopeVo weQrScope, String configId) {
log.info("extracted ->>>>>>>>>>weQrScope:{}",JSONObject.toJSONString(weQrScope));
WeExternalContactDto query = new WeExternalContactDto();
query.setConfig_id(configId);
WeContactWayDto contactWay = externalContactClient.getContactWay(query);
if (contactWay != null && ObjectUtil.equal(0, contactWay.getErrcode())) {
String userIds = "";
String partys = "";
String qrUserIds = "";
String qrPartys = "";
if (CollectionUtil.isNotEmpty(contactWay.getContactWay().getUser())) {
userIds = String.join(",", contactWay.getContactWay().getUser());
}
if (CollectionUtil.isNotEmpty(contactWay.getContactWay().getParty())) {
partys = contactWay.getContactWay().getParty().stream().map(String::valueOf).collect(Collectors.joining(","));
}
if (CollectionUtil.isNotEmpty(weQrScope.getWeQrUserList())) {
qrUserIds = weQrScope.getWeQrUserList().stream().map(WeQrScopeUserVo::getUserId).collect(Collectors.joining(","));
}
if (CollectionUtil.isNotEmpty(weQrScope.getWeQrPartyList())) {
qrPartys = weQrScope.getWeQrPartyList().stream().map(WeQrScopePartyVo::getParty).collect(Collectors.joining(","));
}
if (!ObjectUtil.equal(qrUserIds, userIds) || !ObjectUtil.equal(qrPartys, partys)) {
WeExternalContactDto.WeContactWay weContactWay = new WeExternalContactDto.WeContactWay();
weContactWay.setConfig_id(configId);
if (StringUtils.isNotEmpty(qrUserIds)) {
weContactWay.setUser(qrUserIds.split(","));
}
if (StringUtils.isNotEmpty(qrPartys)) {
Long[] qrPartyList = Arrays.stream(qrPartys.split(","))
.map(s -> Long.parseLong(s.trim())).toArray(Long[]::new);
weContactWay.setParty(qrPartyList);
}
externalContactClient.updateContactWay(weContactWay);
}
}
}
}
package com.linkwechat.wecom.annotation;
import java.lang.annotation.*;
/**
* 同步记录注解
*/
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SynchRecord {
int synchType(); //1:默认客户模块;2:通讯录(员工与部门);3:客户群
}
package com.linkwechat.wecom.aspectj;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.wecom.annotation.SynchRecord;
import com.linkwechat.wecom.domain.WeSynchRecord;
import com.linkwechat.wecom.service.IWeSynchRecordService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.List;
/**
* 回调接口调用记录
*/
@Aspect
@Component
@SuppressWarnings({"unused"})
public class SynchRecordAop {
@Autowired
private IWeSynchRecordService iWeSynchRecordService;
@Pointcut("@annotation(com.linkwechat.wecom.annotation.SynchRecord)")
public void annotationPointcut() {
}
@Around("annotationPointcut()")
public void doBefore(ProceedingJoinPoint joinPoint) throws Throwable {
SynchRecord annotationLog = getAnnotationLog(joinPoint);
if(null != annotationLog){
List<WeSynchRecord> weSynchRecords = iWeSynchRecordService.list(new LambdaQueryWrapper<WeSynchRecord>()
.eq(WeSynchRecord::getSynchType,annotationLog.synchType())
.between(WeSynchRecord::getSynchTime,DateUtils.getBeforeByHourTime(2)
,DateUtils.getBeforeByHourTime(0)));
if(CollectionUtil.isEmpty(weSynchRecords)||weSynchRecords.size()<1){
joinPoint.proceed();
}else{
throw new CustomException("由于企业微信开放平台的限制,两小时内不得重复同步操作");
}
}
}
@After("annotationPointcut()")
public void doAfter(JoinPoint joinPoint) throws Throwable {
SynchRecord annotationLog = getAnnotationLog(joinPoint);
if(null != annotationLog){
iWeSynchRecordService.save(
WeSynchRecord.builder()
.synchTime(new Date())
.synchType(annotationLog.synchType())
.build()
);
}
}
/**
* 是否存在注解,如果存在就获取
*/
private SynchRecord getAnnotationLog(JoinPoint joinPoint) throws Exception
{
Signature signature = joinPoint.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
if (method != null)
{
return method.getAnnotation(SynchRecord.class);
}
return null;
}
}
package com.linkwechat.wecom.client; package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.*; import com.dtflys.forest.annotation.*;
import com.linkwechat.wecom.domain.dto.GroupWelcomeTplDto;
import com.linkwechat.wecom.domain.dto.WeResultDto;
import com.linkwechat.wecom.domain.dto.customer.CustomerGroupDetail; import com.linkwechat.wecom.domain.dto.customer.CustomerGroupDetail;
import com.linkwechat.wecom.domain.dto.customer.CustomerGroupList; import com.linkwechat.wecom.domain.dto.customer.CustomerGroupList;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
...@@ -36,4 +38,22 @@ public interface WeCustomerGroupClient { ...@@ -36,4 +38,22 @@ public interface WeCustomerGroupClient {
type = "POST" type = "POST"
) )
CustomerGroupDetail groupChatDetail(@JSONBody CustomerGroupDetail.Params params); CustomerGroupDetail groupChatDetail(@JSONBody CustomerGroupDetail.Params params);
/**
* 添加入群欢迎语模版
* @param groupWelcomeTplDto
* @return
*/
@Post(url = "/externalcontact/group_welcome_template/add")
GroupWelcomeTplDto addGroupWelcomeTpl(@JSONBody GroupWelcomeTplDto groupWelcomeTplDto);
/**
* 编辑入群欢迎语模版
* @param groupWelcomeTplDto
* @return
*/
@Post(url = "/externalcontact/group_welcome_template/edit")
WeResultDto updateGroupWelcomeTpl(@JSONBody GroupWelcomeTplDto groupWelcomeTplDto);
} }
\ No newline at end of file \ No newline at end of file
package com.linkwechat.wecom.client; package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.*; import com.dtflys.forest.annotation.*;
import com.linkwechat.wecom.domain.dto.WeContactWayDto;
import com.linkwechat.wecom.domain.dto.WeExternalContactDto; import com.linkwechat.wecom.domain.dto.WeExternalContactDto;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
import com.linkwechat.wecom.retry.WeCommonRetryWhen; import com.linkwechat.wecom.retry.WeCommonRetryWhen;
...@@ -23,8 +24,8 @@ public interface WeExternalContactClient { ...@@ -23,8 +24,8 @@ public interface WeExternalContactClient {
WeExternalContactDto updateContactWay(@JSONBody WeExternalContactDto.WeContactWay weContactWay); WeExternalContactDto updateContactWay(@JSONBody WeExternalContactDto.WeContactWay weContactWay);
@Request(url = "/externalcontact/del_contact_way", type = "POST") @Request(url = "/externalcontact/del_contact_way", type = "POST")
WeExternalContactDto delContactWay(@Query("configId") String configId); WeExternalContactDto delContactWay(@JSONBody WeExternalContactDto query);
@Request(url = "/externalcontact/get_contact_way", type = "POST") @Request(url = "/externalcontact/get_contact_way", type = "POST")
WeExternalContactDto getContactWay(@Query("configId") String configId); WeContactWayDto getContactWay(@JSONBody WeExternalContactDto query);
} }
...@@ -2,7 +2,9 @@ package com.linkwechat.wecom.client; ...@@ -2,7 +2,9 @@ package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.*; import com.dtflys.forest.annotation.*;
import com.dtflys.forest.http.ForestResponse; import com.dtflys.forest.http.ForestResponse;
import com.linkwechat.wecom.domain.dto.GroupWelcomeTplDto;
import com.linkwechat.wecom.domain.dto.WeMediaDto; import com.linkwechat.wecom.domain.dto.WeMediaDto;
import com.linkwechat.wecom.interceptor.WeAccessTokenFileInterceptor;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
import com.linkwechat.wecom.retry.WeCommonRetryWhen; import com.linkwechat.wecom.retry.WeCommonRetryWhen;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -16,8 +18,7 @@ import java.io.InputStream; ...@@ -16,8 +18,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(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenFileInterceptor.class)
@Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = WeCommonRetryWhen.class)
public interface WeMediaClient { public interface WeMediaClient {
/** /**
* 上传图片 * 上传图片
...@@ -36,6 +37,20 @@ public interface WeMediaClient { ...@@ -36,6 +37,20 @@ public interface WeMediaClient {
@Post(url = "/media/upload") @Post(url = "/media/upload")
WeMediaDto upload(@DataFile(value = "media", fileName = "${1}") InputStream file, String filename, @Query("type") String type); WeMediaDto upload(@DataFile(value = "media", fileName = "${1}") InputStream file, String filename, @Query("type") String type);
/**
* 上传附件资源
* Inputstream 对象
* 使用byte数组和Inputstream对象时一定要定义fileName属性
*/
@Post(url = "/media/upload_attachment")
WeMediaDto uploadAttachment(@DataFile(value = "media", fileName = "${1}") InputStream file, String filename, @Query("media_type") String mediaType, @Query("attachment_type") Integer attachmentType);
/** /**
* 获取临时素材 * 获取临时素材
* *
...@@ -44,4 +59,13 @@ public interface WeMediaClient { ...@@ -44,4 +59,13 @@ public interface WeMediaClient {
*/ */
@GetRequest(url = "/media/get") @GetRequest(url = "/media/get")
ForestResponse getMediaToResponse(@Query("media_id") String mediaId); ForestResponse getMediaToResponse(@Query("media_id") String mediaId);
/**
* 下载临时素材
* Inputstream 对象
*
*/
@Get(url = "/media/get")
InputStream mediaGet(@Query("media_id") String media_id);
} }
package com.linkwechat.wecom.client; package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.BaseRequest; import com.dtflys.forest.annotation.*;
import com.dtflys.forest.annotation.JSONBody;
import com.dtflys.forest.annotation.PostRequest;
import com.dtflys.forest.annotation.Retry;
import com.linkwechat.wecom.domain.dto.WeResultDto; import com.linkwechat.wecom.domain.dto.WeResultDto;
import com.linkwechat.wecom.domain.dto.moments.MomentsParamDto; import com.linkwechat.wecom.domain.dto.moments.*;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeAppAccessTokenInterceptor;
import com.linkwechat.wecom.retry.WeCommonRetryWhen; import com.linkwechat.wecom.retry.WeCommonRetryWhen;
/** /**
* 朋友圈 * 朋友圈
*/ */
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}",retryer = WeCommonRetryWhen.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}",interceptor = WeAccessTokenInterceptor.class)
@Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = WeCommonRetryWhen.class) @Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = WeCommonRetryWhen.class)
public interface WeMomentsClient { public interface WeMomentsClient {
...@@ -24,6 +23,51 @@ public interface WeMomentsClient { ...@@ -24,6 +23,51 @@ public interface WeMomentsClient {
* @return * @return
*/ */
@PostRequest("/externalcontact/add_moment_task") @PostRequest("/externalcontact/add_moment_task")
WeResultDto addMomentTask(@JSONBody MomentsParamDto momentsParamDto); MomentsResultDto addMomentTask(@JSONBody MomentsParamDto momentsParamDto);
/**
* 获取任务创建结果
* @param jobid
* @return
*/
@GetRequest("/externalcontact/get_moment_task_result")
MomentsCreateResultDto getMomentTaskResult(@Query("jobid") String jobid);
/**
* 朋友圈详情数据获取
* @param momentsListDetailParamDto
* @return
*/
@PostRequest("/externalcontact/get_moment_list")
MomentsListDetailResultDto get_moment_list(@JSONBody MomentsListDetailParamDto momentsListDetailParamDto);
/**
* 朋友圈互动数据获取
* @param momentsInteracteParamDto
* @return
*/
@PostRequest("/externalcontact/get_moment_comments")
MomentsInteracteResultDto get_moment_comments(@JSONBody MomentsInteracteParamDto momentsInteracteParamDto);
/**
* 获取客户朋友圈企业发表的列表
* @param momentsParamDto
* @return
*/
@PostRequest("/externalcontact/get_moment_task")
MomentsResultDto get_moment_task(@JSONBody MomentsParamDto momentsParamDto);
/**
* 获取客户朋友圈发表时选择的可见范围
* @param momentsParamDto
* @return
*/
@PostRequest("/externalcontact/get_moment_customer_list")
MomentsResultDto get_moment_customer_list(@JSONBody MomentsParamDto momentsParamDto);
} }
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.client; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.*; import com.dtflys.forest.annotation.*;
import com.linkwechat.wecom.domain.dto.*; import com.linkwechat.wecom.domain.dto.*;
import com.linkwechat.wecom.domain.dto.customer.JobExtendsCustomer;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeAppAccessTokenInterceptor; import com.linkwechat.wecom.interceptor.WeAppAccessTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeCommonAccessTokenInterceptor; import com.linkwechat.wecom.interceptor.WeCommonAccessTokenInterceptor;
...@@ -12,7 +13,7 @@ import com.linkwechat.wecom.retry.WeCommonRetryWhen; ...@@ -12,7 +13,7 @@ import com.linkwechat.wecom.retry.WeCommonRetryWhen;
* @author: HaoN * @author: HaoN
* @create: 2020-08-27 16:42 * @create: 2020-08-27 16:42
**/ **/
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeCommonAccessTokenInterceptor.class) @BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeAccessTokenInterceptor.class)
@Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = WeCommonRetryWhen.class) @Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = WeCommonRetryWhen.class)
public interface WeUserClient { public interface WeUserClient {
...@@ -72,13 +73,34 @@ public interface WeUserClient { ...@@ -72,13 +73,34 @@ public interface WeUserClient {
/** /**
* 分配客户 * 分配客户(离职继承分配客户)
* @return * @return
*/ */
@Request(url="/externalcontact/resigned/transfer_customer", type = "POST") @Request(url="/externalcontact/resigned/transfer_customer", type = "POST")
WeResultDto allocateCustomer(@JSONBody AllocateWeCustomerDto allocateWeCustomerDto); WeResultDto allocateCustomer(@JSONBody AllocateWeCustomerDto allocateWeCustomerDto);
/**
* 在职继承分配客户(在职继承)
* @param allocateWeCustomerDto
* @return
*/
@Request(url = "/externalcontact/transfer_customer", type = "POST")
JobExtendsCustomer transferCustomer(@JSONBody AllocateWeCustomerDto allocateWeCustomerDto);
/**
* 查询客户接替状态
* @param jobExtendsParam
* @return
*/
@Post(url = "externalcontact/transfer_result")
JobExtendsCustomer transferResult(@JSONBody JobExtendsCustomer.JobExtendsParam jobExtendsParam);
/** /**
* 分配成员群 * 分配成员群
* @return * @return
......
package com.linkwechat.wecom.constants;
import lombok.Data;
@Data
public class SynchRecordConstants {
public static final int SYNCH_CUSTOMER=1;//客户同步
public static final int SYNCH_MAIL_LIST=2;//通讯录同步(组织架构和员工)
public static final int SYNCH_CUSTOMER_GROUP=3;//客户群同步
public static final int SYNCH_CUSTOMER_PERSON_MOMENTS=4;//个人朋友圈
public static final int SYNCH_CUSTOMER_ENTERPRISE_MOMENTS=5;//企业朋友圈
public static final int SYNCH_CUSTOMER_TAG=6;//企业标签同步
}
...@@ -55,4 +55,10 @@ public class WeAllocateCustomer ...@@ -55,4 +55,10 @@ public class WeAllocateCustomer
* 失败原因 * 失败原因
*/ */
private String failReason; private String failReason;
/**
* 0:离职继承;1:在职继承;
*/
private Integer extentType;
} }
...@@ -11,6 +11,9 @@ import lombok.experimental.SuperBuilder; ...@@ -11,6 +11,9 @@ import lombok.experimental.SuperBuilder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@Data @Data
@TableName("we_category") @TableName("we_category")
@SuperBuilder @SuperBuilder
...@@ -25,12 +28,13 @@ public class WeCategory extends BaseEntity { ...@@ -25,12 +28,13 @@ public class WeCategory extends BaseEntity {
private Long id; private Long id;
@ApiModelProperty("素材分类:0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本") @ApiModelProperty("素材分类:0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报 6 活码")
private String mediaType; private String mediaType;
@ApiModelProperty("分类名称") @ApiModelProperty("分类名称")
@NotEmpty(message = "分类名称不能为空")
private String name; private String name;
...@@ -38,7 +42,8 @@ public class WeCategory extends BaseEntity { ...@@ -38,7 +42,8 @@ public class WeCategory extends BaseEntity {
@ApiModelProperty("素材上级父节点id") @ApiModelProperty("素材上级父节点id")
private Long parentId; private Long parentId;
@ApiModelProperty("可删除标识 0 可删除 1 不可删除")
private Integer flag;
@ApiModelProperty("素材状态:0 未删除 2 已删除") @ApiModelProperty("素材状态:0 未删除 2 已删除")
private String delFlag; private String delFlag;
......
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
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.annotation.Excel;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 企业微信客户对象 we_customer * 企业微信客户对象 we_customer
...@@ -34,177 +27,86 @@ public class WeCustomer extends BaseEntity { ...@@ -34,177 +27,86 @@ public class WeCustomer extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//客户id
/**
* 外部联系人的userid
*/
@NotBlank(message = "外部联系人的id不可为空")
@ApiModelProperty("外部联系人的userid")
private String externalUserid; private String externalUserid;
/** //客户名称
* 首位添加人 @TableField(value = "name")
*/ private String customerName;
private String firstUserId;
/** //客户类型
* 外部联系人名称 private Integer customerType;
*/
@Excel(name = "客户")
@ApiModelProperty("外部联系人名称")
private String name;
/**
* 外部联系人头像 //头像
*/
@ApiModelProperty("外部联系人头像")
private String avatar; private String avatar;
/**
* 外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户
*/
@ApiModelProperty("外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户")
@Excel(name = "客户类型", readConverterExp = "1=微信,2=企业微信")
private Integer type;
/** //0-未知 1-男性 2-女性
* 外部联系人性别 0-未知 1-男性 2-女性
*/
@ApiModelProperty("外部联系人性别 0-未知 1-男性 2-女性")
@Excel(name = "性别", readConverterExp = "0=未知,1=男性,2=女性")
private Integer gender; private Integer gender;
/**
* 外部联系人在微信开放平台的唯一身份标识,通过此字段企业可将外部联系人与公众号/小程序用户关联起来。
*/
@ApiModelProperty("外部联系人在微信开放平台的唯一身份标识,通过此字段企业可将外部联系人与公众号/小程序用户关联起来")
private String unionid; private String unionid;
/**
* 生日
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("生日")
private Date birthday; private Date birthday;
/**
* 客户企业简称
*/
@ApiModelProperty("客户企业简称")
@Excel(name = "公司名称")
private String corpName; private String corpName;
/**
* 客户企业全称
*/
@ApiModelProperty("客户企业全称")
private String corpFullName;
/**
* 职位
*/
@ApiModelProperty("职位")
private String position; private String position;
/**
* 是否开启会话存档 0:关闭 1:开启
*/
@ApiModelProperty("是否开启会话存档 0:关闭 1:开启")
private Integer isOpenChat; private Integer isOpenChat;
/**
* 添加人员
*/
@TableField(exist = false)
private List<WeFlowerCustomerRel> weFlowerCustomerRels;
/** private String firstUserId;
* 添加人id
*/
@TableField(exist = false)
private String userIds;
/** @JsonFormat(pattern = "yyyy-MM-dd")
* 标签 private Date firstAddTime;
*/
@TableField(exist = false)
private String tagIds;
@TableField(exist = false)
@JSONField(defaultValue = "0")
private Integer status;
/** private Integer trackState;
* 部门
*/
@TableField(exist = false)
private String departmentIds;
/**
* 添加人名称
*/
@TableField(exist = false)
private String userName;
/** private String trackContent;
* 员工id
*/
@TableField(exist = false)
private String userId;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date trackTime;
/**
* 创建者
*/
@ApiModelProperty(hidden = true)
@TableField(exist = false)
private String createBy;
/**
* 更新者
*/
@ApiModelProperty(hidden = true)
@TableField(exist = false)
private String updateBy;
private String phone;
/** 企业自定义的state参数,用于区分客户具体是通过哪个「联系我」添加,由企业通过创建「联系我」方式指定 */ private String email;
private String state;
private String qq;
private String otherDescr;
private String address;
private Integer addMethod;
/**
* 首位添加时间 private Integer delFlag;
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date firstAddTime; private String state;
private String takeoverUserId;
//qq
private String qq;
//邮箱
private String email;
//地址
private String address;
//手机号
private String phone;
/**
* 0:正常;1:删除
*/
// @TableLogic
private Integer delFlag;
//添加方式
private Integer addMethod;
} }
...@@ -24,4 +24,5 @@ public class WeCustomerAddGroup { ...@@ -24,4 +24,5 @@ public class WeCustomerAddGroup {
//是否共同群 0:不是共同群;1:是共同群 //是否共同群 0:不是共同群;1:是共同群
private Integer commonGroup; private Integer commonGroup;
} }
package com.linkwechat.wecom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Builder;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 客户详情
*/
@Data
public class WeCustomerDetail {
//头像
private String avatar;
//客户名称
private String customerName;
//客户类型
private Integer customerType;
//客户标签,多个用逗号隔开
private String tagNames;
//跟进员工
private List<TrackUser> trackUsers;
//所在客群
private List<Groups> groups;
private String commonGroupChat;
private String phone;
private String address;
private int age;
private String qq;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday;
private String position;
private String email;
private String corpName;
private String otherDescr;
//0-未知 1-男性 2-女性
private Integer gender;
private List<CompanyOrPersonTag> companyTags;
private List<CompanyOrPersonTag> personTags;
private List<TrackStates> trackStates;
@Data
@Builder
public static class TrackUser {
//添加员工名称
private String userName;
//添加方式
private Integer addMethod;
//跟进人id
private String trackUserId;
//添加时间
@JsonFormat(pattern = "yyyy-MM-dd")
private Date firstAddTime;
//跟进状态
private Integer trackState;
}
@Data
public static class Groups{
//群id
private String chatId;
//群名
private String groupName;
//加入时间
@JsonFormat(pattern = "yyyy-MM-dd")
private Date joinTime;
//群主
private String leaderName;
//入群方式入群方式。
//1 - 由群成员邀请入群(直接邀请入群)
//2 - 由群成员邀请入群(通过邀请链接入群)
//3 - 通过扫描群二维码入群
private Integer joinScene;
}
//企业或个人标签
@Data
@Builder
public static class CompanyOrPersonTag{
private String userName;
private String tagsNames;
private String tagIds;
}
@Data
@Builder
public static class TrackStates{
//跟进人
private String userName;
//跟进状态列表
private List<WeCustomerTrajectory> trackStateList;
}
}
...@@ -21,15 +21,21 @@ public class WeCustomerList { ...@@ -21,15 +21,21 @@ public class WeCustomerList {
//客户名称 //客户名称
private String customerName; private String customerName;
//客户类型 //客户类型 1:微信用户,2:企业用户
private Integer customerType; private Integer customerType;
//查询标签id //查询标签id(企业标签id)
private String tagIds; private String tagIds;
//标签名称,使用逗号隔开 //标签名称,使用逗号隔开(企业标签名)
private String tagNames; private String tagNames;
//个人标签id
private String personTagIds;
//个人标签名
private String personTagNames;
//跟进人名称 //跟进人名称
private String userName; private String userName;
...@@ -68,8 +74,6 @@ public class WeCustomerList { ...@@ -68,8 +74,6 @@ public class WeCustomerList {
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday; private Date birthday;
...@@ -89,6 +93,8 @@ public class WeCustomerList { ...@@ -89,6 +93,8 @@ public class WeCustomerList {
private String departmentIds; private String departmentIds;
//0正常;1:删除; //0正常;1:删除;
private Integer delFlag=new Integer(0); private Integer delFlag=new Integer(0);
} }
...@@ -49,8 +49,6 @@ public class WeCustomerPortrait { ...@@ -49,8 +49,6 @@ public class WeCustomerPortrait {
//客户头像 //客户头像
private String avatar; private String avatar;
//客户标签
private List<WeTagGroup> weTagGroupList;
//客户社交关系 //客户社交关系
private WeCustomerSocialConn socialConn; private WeCustomerSocialConn socialConn;
...@@ -59,4 +57,17 @@ public class WeCustomerPortrait { ...@@ -59,4 +57,17 @@ public class WeCustomerPortrait {
private String tagIds; private String tagIds;
//个人标签名
private String personTagNames;
//个人标签id
private String personTagIds;
//当前跟进状态:1:待跟进;2:跟进中;3:已成交;4:无意向;5:已流失
private Integer trackState;
//客户类型 1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户
private Integer customerType;
} }
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.annotation.Excel;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 客户公海实体
*/
@Data
@TableName("we_customer_seas")
public class WeCustomerSeas extends BaseEntity {
//主键
@TableId
private Long id;
//手机号
@Excel(name = "手机号")
private String phone;
//客户备注名称
@Excel(name = "客户名称")
private String customerName;
//标签名,多个使用逗号隔开
private String tagNames;
//标签id,多个使用逗号隔开
private String tagIds;
//添加人名称,多个使用逗号隔开
private String addUserName;
//添加人id,多个使用逗号隔开
private String addUserId;
//导入的excel的名称
private String tableExcelName;
//导入的excel的同一批次下的id
private Long tableExcelId;
//当前状态:0:待添加;1:已添加;3:待通过
private Integer addState;
@TableLogic
private Integer delFlag;
}
...@@ -23,7 +23,7 @@ import java.util.Date; ...@@ -23,7 +23,7 @@ import java.util.Date;
public class WeCustomerTrajectory extends BaseEntity { public class WeCustomerTrajectory extends BaseEntity {
@TableId @TableId
private String id; private String id;
//轨迹类型(1:信息动态;2:社交动态;3:活动规则;4:待办动态) //轨迹类型(1:信息动态;2:社交动态;3:跟进动态;4:待办动态)
private Integer trajectoryType; private Integer trajectoryType;
//外部联系人id //外部联系人id
private String externalUserid; private String externalUserid;
......
...@@ -53,4 +53,7 @@ public class WeFlowerCustomerTagRel ...@@ -53,4 +53,7 @@ public class WeFlowerCustomerTagRel
@TableLogic @TableLogic
private Integer delFlag; private Integer delFlag;
//是否是企业标签:1:是;0:否
private Boolean isCompanyTag;
} }
...@@ -116,6 +116,19 @@ public class WeGroup extends BaseEntity{ ...@@ -116,6 +116,19 @@ public class WeGroup extends BaseEntity{
*/ */
private String adminUserId; private String adminUserId;
/**
* 客户数量
*/
@TableField(exist = false)
private Integer customerNum;
/**
* 今日进群数
*/
@TableField(exist = false)
private Integer toDayMemberNum;
@TableLogic @TableLogic
private Integer delFlag=new Integer(0); private Integer delFlag=new Integer(0);
} }
...@@ -77,18 +77,4 @@ public class WeGroupMessageTask extends BaseEntity{ ...@@ -77,18 +77,4 @@ public class WeGroupMessageTask extends BaseEntity{
@ApiModelProperty("企业服务人员名称") @ApiModelProperty("企业服务人员名称")
@TableField(exist = false) @TableField(exist = false)
private String userName; private String userName;
/**
* 预计发送数量
*/
@ApiModelProperty("预计发送数量")
@TableField(exist = false)
private Integer total;
/**
* 实际发送数量
*/
@ApiModelProperty("实际发送数量")
@TableField(exist = false)
private Integer already;
} }
...@@ -71,8 +71,4 @@ public class WeGroupMessageTemplate extends BaseEntity { ...@@ -71,8 +71,4 @@ public class WeGroupMessageTemplate extends BaseEntity {
@ApiModelProperty("状态 -1:失败 0:未执行 1:完成 2:取消") @ApiModelProperty("状态 -1:失败 0:未执行 1:完成 2:取消")
@Excel(name = "是否执行 -1:失败 0:未执行 1:完成 2:取消") @Excel(name = "是否执行 -1:失败 0:未执行 1:完成 2:取消")
private Integer status; private Integer status;
@ApiModelProperty("同步时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date refreshTime;
} }
...@@ -39,15 +39,15 @@ public class WeMaterial extends BaseEntity { ...@@ -39,15 +39,15 @@ public class WeMaterial extends BaseEntity {
private String content; private String content;
/** /**
* 图片名称 * 素材标题
*/ */
@ApiModelProperty("图片名称") @ApiModelProperty("素材标题【小程序标题】")
private String materialName; private String materialName;
/** /**
* 摘要 * 摘要
*/ */
@ApiModelProperty("摘要") @ApiModelProperty("摘要【小程序id用改字段】")
private String digest; private String digest;
/** /**
...@@ -69,4 +69,6 @@ public class WeMaterial extends BaseEntity { ...@@ -69,4 +69,6 @@ public class WeMaterial extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private Boolean isCheck=false; private Boolean isCheck=false;
} }
...@@ -10,22 +10,30 @@ import lombok.AllArgsConstructor; ...@@ -10,22 +10,30 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.Date;
import java.util.List;
/** /**
* 朋友圈 * 朋友圈
*/ */
@Data @Data
@TableName("we_moments") @TableName(value ="we_moments",autoResultMap = true)
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class WeMoments extends BaseEntity { public class WeMoments extends BaseEntity {
@TableId
private Long id;
/**可见类型:1:全部;2:部分;*/ /**可见类型:0:部分可见;1:公开;*/
private Integer scopeType; private Integer scopeType;
/**朋友圈类型:1:企业动态;2:个人动态*/ /**朋友圈类型:0:企业动态;1:个人动态*/
private Integer type; private Integer type=new Integer(0);
/**内容类型*/
private String contentType;
/**客户标签,多个使用逗号隔开*/ /**客户标签,多个使用逗号隔开*/
private String customerTag; private String customerTag;
...@@ -34,42 +42,88 @@ public class WeMoments extends BaseEntity { ...@@ -34,42 +42,88 @@ public class WeMoments extends BaseEntity {
private String addUser; private String addUser;
/**发送员工名称,使用逗号隔开*/ /**发送员工名称,使用逗号隔开*/
@TableField(exist = false)
private String addUserName; private String addUserName;
/**未发送员工,使用逗号隔开*/ /**未发送员工,使用逗号隔开*/
private String noAddUser; private String noAddUser;
/**未发送员工名称,使用逗号隔开*/ /**未发送员工名称,使用逗号隔开*/
@TableField(exist = false)
private String noAddUserName; private String noAddUserName;
/**文字内容*/ /**列表展示*/
private String textContent; private String content;
/**创建人*/
private String creator;
/**附件*/ /**附件*/
@TableField(typeHandler = GenericTypeHandler.class) @TableField(typeHandler = GenericTypeHandler.class)
private OtherContent otherContent; private List<OtherContent> otherContent;
@TableLogic @TableLogic
private Integer delFlag; private Integer delFlag;
/**异步任务id,最大长度为64字节,24小时有效;可使用获取发表朋友圈任务结果查询任务状态*/
private String jobId; /**是否是在lw平台发布的:1:是;0:否; */
private Boolean isLwPush;
@TableId
private String momentId;
//发布时间
private Date pushTime;
/**评论数*/
@TableField(exist = false)
private Integer commentNum;
/**点赞数*/
@TableField(exist = false)
private Integer pointNum;
//评论员工名
@TableField(exist = false)
private String momentUserName;
//点赞员工名
@TableField(exist = false)
private String pointUserName;
//评论客户名
@TableField(exist = false)
private String momentCustomerName;
//点赞客户名
@TableField(exist = false)
private String pointCustomerName;
@Data @Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class OtherContent{ public static class OtherContent{
//附件类型:1:图片 2:视频 3:网页 //附件类型:1:image 2:video 3:link 4:text
private Integer annexType; private String annexType;
//多个资源url,使用逗号隔开 //资源url
private String annexUrl; private String annexUrl;
//多个媒体id,使用逗号隔开 //资源id
private String annexMediaid; // private String annexMediaid;
//如视频封面,图文标题,文字内容
private String other;
} }
} }
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@TableName("we_moments_interacte")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeMomentsInteracte {
private String interacteUserId;
private Integer interacteUserType;
private Integer interacteType;
private Date interacteTime;
private String momentId;
}
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.TableLogic;import com.baomidou.mybatisplus.annotation.TableName;import com.linkwechat.common.core.domain.BaseEntity;import com.linkwechat.common.utils.SnowFlakeUtil;import com.linkwechat.wecom.handler.GenericTypeHandler;import io.swagger.models.auth.In;import lombok.Data; import java.util.List; /** * 欢迎语模板对象 we_msg_tlp * * @author ruoyi * @date 2020-10-04 */@Data@TableName(value = "we_msg_tlp",autoResultMap = true)public class WeMsgTlp extends BaseEntity{ private static final long serialVersionUID = 1L; /** $column.columnComment */ @TableId private Long id; /** 欢迎语 */ private String welcomeMsg; /**图片url*/ private String picUrl; /**图文*/ @TableField(typeHandler = GenericTypeHandler.class) private List<ImageText> imageText; /**小程序*/ @TableField(typeHandler = GenericTypeHandler.class) private List<Applet> applet; /** 0:正常;1:删除; */ @TableLogic private Integer delFlag; /** 欢迎语模板类型:1:活码欢迎语;2:员工欢迎语;3:入群欢迎语 */ private Integer welcomeMsgTplType; /**用户名 */ private String userNames; /**用户id,用逗号隔开*/ private String userIds; /**群欢迎语模版id*/ private String templateId; @Data public static class Applet{ //小程序标题 private String appTile; //小程序id private String appId; //小程序路径 private String appPath; //小程序图片 private String appPic; } @Data public static class ImageText{ //图文标题 private String imageTextTile; //图文url private String imageTextUrl; } }
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.models.auth.In;
import lombok.Data;
import java.util.List;
/**
* 欢迎语模板对象 we_msg_tlp
*
* @author ruoyi
* @date 2020-10-04
*/
@Data
public class WeMsgTlp extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id= SnowFlakeUtil.nextId();
/** 欢迎语 */
private String welcomeMsg;
/** 素材的id */
private Long mediaId;
/** 0:正常;1:删除; */
private Integer delFlag=new Integer(0);
/** 欢迎语模板类型:1:员工欢迎语;2:部门员工欢迎语;3:客户群欢迎语 */
private Long welcomeMsgTplType;
/** 欢迎语模板使用范围 */
private List<WeMsgTlpScope> weMsgTlpScopes;
private String materialUrl;
}
\ No newline at end of file \ No newline at end of file
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!