Commit a1d7c95d by 水库浪子

更新主分支代码

1 parent a7cc4d91
Showing 93 changed files with 740 additions and 700 deletions
...@@ -18,7 +18,7 @@ import org.springframework.scheduling.annotation.EnableAsync; ...@@ -18,7 +18,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@MapperScan("com.linkwechat.*.mapper") @MapperScan("com.linkwechat.*.mapper")
@ForestScan(basePackages = {"com.linkwechat.wecom.client","com.linkwechat.wecom.wxclient"}) @ForestScan(basePackages = {"com.linkwechat.wecom.client","com.linkwechat.wecom.wxclient"})
@EnableAsync @EnableAsync
//@EnableDiscoveryClient @EnableDiscoveryClient
public class LinkWeChatApplication { public class LinkWeChatApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
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.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; 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.service.IWeCategoryService; import com.linkwechat.wecom.service.IWeCategoryService;
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.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -22,14 +25,14 @@ import java.util.List; ...@@ -22,14 +25,14 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/wecom/category") @RequestMapping("/wecom/category")
@Api("企业微信素材分类")
public class WeCategoryController extends BaseController { public class WeCategoryController extends BaseController {
@Autowired @Autowired
private IWeCategoryService weCategoryService; private IWeCategoryService weCategoryService;
/**
* 类目树
*/
// @PreAuthorize("@ss.hasPermi('wechat:category:list')") // @PreAuthorize("@ss.hasPermi('wechat:category:list')")
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("类目树") @ApiOperation("类目树")
...@@ -44,7 +47,7 @@ public class WeCategoryController extends BaseController { ...@@ -44,7 +47,7 @@ public class WeCategoryController extends BaseController {
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
@ApiOperation("通过id查询类目详细信息") @ApiOperation("通过id查询类目详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id) { public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(weCategoryService.findWeCategoryById(id)); return AjaxResult.success(weCategoryService.getById(id));
} }
/** /**
...@@ -55,7 +58,8 @@ public class WeCategoryController extends BaseController { ...@@ -55,7 +58,8 @@ public class WeCategoryController extends BaseController {
@PostMapping @PostMapping
@ApiOperation("添加类目") @ApiOperation("添加类目")
public AjaxResult add(@RequestBody WeCategory category) { public AjaxResult add(@RequestBody WeCategory category) {
return toAjax(weCategoryService.insertWeCategory(category)); weCategoryService.insertWeCategory(category);
return AjaxResult.success();
} }
/** /**
...@@ -66,7 +70,8 @@ public class WeCategoryController extends BaseController { ...@@ -66,7 +70,8 @@ public class WeCategoryController extends BaseController {
@PutMapping @PutMapping
@ApiOperation("更新目录") @ApiOperation("更新目录")
public AjaxResult edit(@RequestBody WeCategory category) { public AjaxResult edit(@RequestBody WeCategory category) {
return toAjax(weCategoryService.updateWeCategory(category)); weCategoryService.updateWeCategory(category);
return AjaxResult.success();
} }
...@@ -78,7 +83,17 @@ public class WeCategoryController extends BaseController { ...@@ -78,7 +83,17 @@ public class WeCategoryController extends BaseController {
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
@ApiOperation("删除类目") @ApiOperation("删除类目")
public AjaxResult remove(@PathVariable Long[] ids) { public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(weCategoryService.deleteWeCategoryByIds(ids)); List<WeCategory> categorys=new ArrayList<>();
for (Long id:ids) {
categorys.add(
WeCategory.builder()
.id(id)
.delFlag(Constants.DELETE_CODE)
.build()
);
}
weCategoryService.updateBatchById(categorys);
return AjaxResult.success();
} }
} }
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.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.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.core.domain.entity.WeCorpAccount;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -21,84 +25,76 @@ import java.util.List; ...@@ -21,84 +25,76 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/wecom/corp") @RequestMapping("/wecom/corp")
@Api("企业id配置接口")
public class WeCorpAccountController extends BaseController public class WeCorpAccountController extends BaseController
{ {
@Autowired @Autowired
private IWeCorpAccountService weCorpAccountService; private IWeCorpAccountService weCorpAccountService;
/**
* 查询企业id相关配置列表
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:list')") // @PreAuthorize("@ss.hasPermi('wechat:corp:list')")
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("查询企业id相关配置列表")
public TableDataInfo list(WeCorpAccount weCorpAccount) public TableDataInfo list(WeCorpAccount weCorpAccount)
{ {
startPage(); startPage();
List<WeCorpAccount> list = weCorpAccountService.selectWeCorpAccountList(weCorpAccount); List<WeCorpAccount> list = weCorpAccountService.list(new LambdaQueryWrapper<WeCorpAccount>()
.eq(WeCorpAccount::getDelFlag,Constants.NORMAL_CODE)
.like(WeCorpAccount::getCompanyName,weCorpAccount.getCompanyName()));
return getDataTable(list); return getDataTable(list);
} }
/**
* 获取企业id相关配置详细信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(weCorpAccountService.selectWeCorpAccountById(id));
}
/**
* 新增企业id相关配置
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:add')") // @PreAuthorize("@ss.hasPermi('wechat:corp:add')")
@Log(title = "新增企业id相关配置", businessType = BusinessType.INSERT) @Log(title = "新增企业id相关配置", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@ApiOperation("新增企业id相关配置")
public AjaxResult add(@Validated @RequestBody WeCorpAccount weCorpAccount) public AjaxResult add(@Validated @RequestBody WeCorpAccount weCorpAccount)
{ {
return toAjax(weCorpAccountService.insertWeCorpAccount(weCorpAccount)); weCorpAccountService.save(weCorpAccount);
return AjaxResult.success();
} }
/**
* 修改企业id相关配置
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:edit')") // @PreAuthorize("@ss.hasPermi('wechat:corp:edit')")
@Log(title = "修改企业id相关配置", businessType = BusinessType.UPDATE) @Log(title = "修改企业id相关配置", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
@ApiOperation("修改企业id相关配置")
public AjaxResult edit(@Validated @RequestBody WeCorpAccount weCorpAccount) public AjaxResult edit(@Validated @RequestBody WeCorpAccount weCorpAccount)
{ {
return toAjax(weCorpAccountService.updateWeCorpAccount(weCorpAccount)); weCorpAccountService.updateById(weCorpAccount);
return AjaxResult.success();
} }
/**
* 启用有效企业微信账号
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:startVailWeCorpAccount')") // @PreAuthorize("@ss.hasPermi('wechat:corp:startVailWeCorpAccount')")
@Log(title = "启用有效企业微信账号", businessType = BusinessType.DELETE) @Log(title = "启用有效企业微信账号", businessType = BusinessType.DELETE)
@PutMapping("/startVailWeCorpAccount/{corpId}") @PutMapping("/startVailWeCorpAccount/{corpId}")
@ApiOperation("启用有效企业微信账号")
public AjaxResult startWeCorpAccount(@PathVariable String corpId) public AjaxResult startWeCorpAccount(@PathVariable String corpId)
{ {
return toAjax(weCorpAccountService.startVailWeCorpAccount(corpId)); return toAjax(weCorpAccountService.startVailWeCorpAccount(corpId));
} }
/**
* 客户流失通知开关
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:startCustomerChurnNoticeSwitch')") // @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)
{ {
return toAjax(weCorpAccountService.startCustomerChurnNoticeSwitch(status)); weCorpAccountService.startCustomerChurnNoticeSwitch(status);
return AjaxResult.success();
} }
/**
* 客户流失通知开关查询
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:getCustomerChurnNoticeSwitch')") // @PreAuthorize("@ss.hasPermi('wechat:corp:getCustomerChurnNoticeSwitch')")
@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("操作成功",weCorpAccountService.getCustomerChurnNoticeSwitch());
......
...@@ -12,6 +12,7 @@ import com.linkwechat.wecom.domain.WeCustomer; ...@@ -12,6 +12,7 @@ import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.service.IWeCustomerService; import com.linkwechat.wecom.service.IWeCustomerService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -30,7 +31,9 @@ import java.util.List; ...@@ -30,7 +31,9 @@ import java.util.List;
@RequestMapping("/wecom/customer") @RequestMapping("/wecom/customer")
public class WeCustomerController extends BaseController public class WeCustomerController extends BaseController
{ {
@Autowired @Autowired
@Lazy
private IWeCustomerService weCustomerService; private IWeCustomerService weCustomerService;
......
...@@ -51,14 +51,14 @@ public class WeCustomerPortraitController extends BaseController { ...@@ -51,14 +51,14 @@ public class WeCustomerPortraitController extends BaseController {
/** /**
* 根据客户id和当前企业员工id获取客户详细信息 * 根据客户id和当前企业员工id获取客户详细信息
* @param externalUserid * @param externalUserid
* @param userid * @param userId
* @return * @return
*/ */
@GetMapping(value = "/findWeCustomerInfo") @GetMapping(value = "/findWeCustomerInfo")
public AjaxResult findWeCustomerInfo(String externalUserid, String userid) throws Exception { public AjaxResult findWeCustomerInfo(String externalUserid, String userId) throws Exception {
return AjaxResult.success( return AjaxResult.success(
iWeCustomerService.findCustomerByOperUseridAndCustomerId(externalUserid,userid) iWeCustomerService.findCustomerByOperUseridAndCustomerId(externalUserid,userId)
); );
} }
...@@ -73,7 +73,6 @@ public class WeCustomerPortraitController extends BaseController { ...@@ -73,7 +73,6 @@ public class WeCustomerPortraitController extends BaseController {
iWeCustomerService.updateWeCustomerPortrait(weCustomerPortrait); iWeCustomerService.updateWeCustomerPortrait(weCustomerPortrait);
...@@ -224,4 +223,6 @@ public class WeCustomerPortraitController extends BaseController { ...@@ -224,4 +223,6 @@ public class WeCustomerPortraitController extends BaseController {
} }
...@@ -16,9 +16,7 @@ import com.linkwechat.wecom.service.IWePosterService; ...@@ -16,9 +16,7 @@ import com.linkwechat.wecom.service.IWePosterService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -44,11 +42,10 @@ public class WeMaterialController extends BaseController { ...@@ -44,11 +42,10 @@ public class WeMaterialController extends BaseController {
@Resource @Resource
private IWePosterService wePosterService; private IWePosterService wePosterService;
/**
* 查询素材列表
*/
// @PreAuthorize("@ss.hasPermi('wecom:material:list')") // @PreAuthorize("@ss.hasPermi('wecom:material:list')")
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("查询素材列表")
public TableDataInfo list(@RequestParam(value = "categoryId", required = false) String categoryId public TableDataInfo list(@RequestParam(value = "categoryId", required = false) String categoryId
, @RequestParam(value = "search", required = false) String search,@RequestParam(value = "mediaType") String mediaType) { , @RequestParam(value = "search", required = false) String search,@RequestParam(value = "mediaType") String mediaType) {
startPage(); startPage();
...@@ -69,9 +66,8 @@ public class WeMaterialController extends BaseController { ...@@ -69,9 +66,8 @@ public class WeMaterialController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询素材详细信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:query')") // @PreAuthorize("@ss.hasPermi('wechat:material:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
@ApiOperation("查询素材详细信息") @ApiOperation("查询素材详细信息")
...@@ -79,9 +75,7 @@ public class WeMaterialController extends BaseController { ...@@ -79,9 +75,7 @@ public class WeMaterialController extends BaseController {
return AjaxResult.success(materialService.findWeMaterialById(id)); return AjaxResult.success(materialService.findWeMaterialById(id));
} }
/**
* 添加素材信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:add')") // @PreAuthorize("@ss.hasPermi('wechat:material:add')")
@Log(title = "添加素材信息", businessType = BusinessType.INSERT) @Log(title = "添加素材信息", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
...@@ -90,9 +84,7 @@ public class WeMaterialController extends BaseController { ...@@ -90,9 +84,7 @@ public class WeMaterialController extends BaseController {
return toAjax(materialService.insertWeMaterial(material)); return toAjax(materialService.insertWeMaterial(material));
} }
/**
* 更新素材信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:edit')") // @PreAuthorize("@ss.hasPermi('wechat:material:edit')")
@Log(title = "更新素材信息", businessType = BusinessType.UPDATE) @Log(title = "更新素材信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
...@@ -101,9 +93,7 @@ public class WeMaterialController extends BaseController { ...@@ -101,9 +93,7 @@ public class WeMaterialController extends BaseController {
return toAjax(materialService.updateWeMaterial(material)); return toAjax(materialService.updateWeMaterial(material));
} }
/**
* 删除素材信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:remove')") // @PreAuthorize("@ss.hasPermi('wechat:material:remove')")
@Log(title = "删除素材信息", businessType = BusinessType.DELETE) @Log(title = "删除素材信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
...@@ -112,9 +102,7 @@ public class WeMaterialController extends BaseController { ...@@ -112,9 +102,7 @@ public class WeMaterialController extends BaseController {
return toAjax(materialService.deleteWeMaterialByIds(ids)); return toAjax(materialService.deleteWeMaterialByIds(ids));
} }
/**
* 上传素材信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:upload')") // @PreAuthorize("@ss.hasPermi('wechat:material:upload')")
@Log(title = "上传素材信息", businessType = BusinessType.OTHER) @Log(title = "上传素材信息", businessType = BusinessType.OTHER)
@PostMapping("/upload") @PostMapping("/upload")
...@@ -124,9 +112,7 @@ public class WeMaterialController extends BaseController { ...@@ -124,9 +112,7 @@ public class WeMaterialController extends BaseController {
return AjaxResult.success(weMaterialFileVO); return AjaxResult.success(weMaterialFileVO);
} }
/**
* 更换分组
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:resetCategory')") // @PreAuthorize("@ss.hasPermi('wechat:material:resetCategory')")
@Log(title = "更换分组", businessType = BusinessType.OTHER) @Log(title = "更换分组", businessType = BusinessType.OTHER)
@PutMapping("/resetCategory") @PutMapping("/resetCategory")
...@@ -147,6 +133,8 @@ public class WeMaterialController extends BaseController { ...@@ -147,6 +133,8 @@ public class WeMaterialController extends BaseController {
return AjaxResult.success(weMediaDto); return AjaxResult.success(weMediaDto);
} }
@Log(title = "上传素材图片", businessType = BusinessType.OTHER) @Log(title = "上传素材图片", businessType = BusinessType.OTHER)
@PostMapping("/uploadimg") @PostMapping("/uploadimg")
@ApiOperation("上传素材图片") @ApiOperation("上传素材图片")
......
...@@ -13,6 +13,7 @@ import io.swagger.annotations.Api; ...@@ -13,6 +13,7 @@ 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.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
...@@ -35,6 +36,7 @@ import java.util.List; ...@@ -35,6 +36,7 @@ import java.util.List;
public class WeUserController extends BaseController { public class WeUserController extends BaseController {
@Autowired @Autowired
@Lazy
private IWeUserService weUserService; private IWeUserService weUserService;
......
...@@ -16,7 +16,37 @@ ruoyi: ...@@ -16,7 +16,37 @@ ruoyi:
captchaType: math captchaType: math
# 企业微信用户首次登录系统默认密码 # 企业微信用户首次登录系统默认密码
weUserDefaultPwd: 123456 weUserDefaultPwd: 123456
#匿名访问的URL
anonUrl:
- /login
- /captchaImage
- /findWxQrLoginInfo
- /wxQrLogin
- /profile/**
- /common/download**
- /common/download/resource**
- /common/download/url**
- /swagger-ui.html
- /swagger-resources/**
- /webjars/**
- /*/api-docs
- /druid/**
- /wecom/callback/**
- /wecom/chat/item/list
- /wecom/chat/collection/list
- /wecom/chat/collection/cancleCollection
- /wecom/chat/collection/addCollection
- /wecom/chat/side/h5List
- /wecom/ticket/**
- /wecom/user/getUserInfo
- /wecom/portrait/**
- /wecom/fission/poster
- /wecom/fission/*/progress/*
- /wecom/reward/getRewardByFissionId/**
- /wecom/groupCode/getActualCode/**
- /wecom/community/h5/**
- /weixin/auth/**
- /wecom/material/temporaryMaterialMediald
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口,默认为8090 # 服务器的HTTP端口,默认为8090
......
...@@ -260,6 +260,12 @@ ...@@ -260,6 +260,12 @@
<artifactId>bcpkix-jdk15on</artifactId> <artifactId>bcpkix-jdk15on</artifactId>
<version>1.68</version> <version>1.68</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
package com.linkwechat.common.aop;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Component;
/**
* @description: 客户轨迹记录AOP
* @author: HaoN
* @create: 2021-05-02 22:51
**/
@Aspect
@Component
public class CustomerTrajectoryAop {
@Pointcut("@annotation(com.linkwechat.wecom.annotation.CustomerTrajectoryRecord)")
public void customerTrajectoryPointCut(){}
/**
* 记录轨迹
* @param joinPoint
*/
@Around("customerTrajectoryPointCut()")
public void customerTrajectoryRecord(ProceedingJoinPoint joinPoint){
}
}
...@@ -33,6 +33,11 @@ public class RuoYiConfig ...@@ -33,6 +33,11 @@ public class RuoYiConfig
/** 企业微信账号登录系统默认密码 */ /** 企业微信账号登录系统默认密码 */
private static String weUserDefaultPwd="123456"; private static String weUserDefaultPwd="123456";
/**匿名访问的URL*/
private String[] anonUrl;
public String getName() public String getName()
{ {
return name; return name;
...@@ -132,4 +137,12 @@ public class RuoYiConfig ...@@ -132,4 +137,12 @@ public class RuoYiConfig
public void setWeUserDefaultPwd(String weUserDefaultPwd) { public void setWeUserDefaultPwd(String weUserDefaultPwd) {
RuoYiConfig.weUserDefaultPwd = weUserDefaultPwd; RuoYiConfig.weUserDefaultPwd = weUserDefaultPwd;
} }
public String[] getAnonUrl() {
return anonUrl;
}
public void setAnonUrl(String[] anonUrl) {
this.anonUrl = anonUrl;
}
} }
...@@ -163,7 +163,7 @@ public class Constants ...@@ -163,7 +163,7 @@ public class Constants
public static final String DEFAULT_WECOME_CORP_ADMIN="CROP_ADMIN_ROLE"; public static final String DEFAULT_WECOME_CORP_ADMIN="CROP_ADMIN_ROLE";
/**完成待办*/ /**完成待办*/
public static final String HANDLE_SUCCESS="1"; public static final String HANDLE_SUCCESS="3";
......
package com.linkwechat.common.core.domain.entity; package com.linkwechat.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -8,7 +11,6 @@ import lombok.AllArgsConstructor; ...@@ -8,7 +11,6 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
...@@ -23,11 +25,14 @@ import javax.validation.constraints.NotBlank; ...@@ -23,11 +25,14 @@ import javax.validation.constraints.NotBlank;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel("企业id配置相关实体") @ApiModel("企业id配置相关实体")
@TableName("we_corp_account")
public class WeCorpAccount extends BaseEntity public class WeCorpAccount extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
@TableId
@ApiModelProperty("主键")
private Long id= SnowFlakeUtil.nextId(); private Long id= SnowFlakeUtil.nextId();
/** 企业名称 */ /** 企业名称 */
...@@ -36,12 +41,12 @@ public class WeCorpAccount extends BaseEntity ...@@ -36,12 +41,12 @@ public class WeCorpAccount extends BaseEntity
private String companyName; private String companyName;
/** 企业ID */ /** 企业ID */
@ApiModelProperty("企业ID") @ApiModelProperty("企业corpId")
@NotBlank(message = "企业ID不能为空") @NotBlank(message = "企业ID不能为空")
private String corpId; private String corpId;
/** 应用的密钥凭证 */ /** 应用的密钥凭证 */
@ApiModelProperty("应用的密钥凭证") @ApiModelProperty("企业为corpSecret")
@NotBlank(message = "应用的密钥凭证不能为空") @NotBlank(message = "应用的密钥凭证不能为空")
private String corpSecret; private String corpSecret;
...@@ -75,7 +80,7 @@ public class WeCorpAccount extends BaseEntity ...@@ -75,7 +80,7 @@ public class WeCorpAccount extends BaseEntity
private String wxQrLoginRedirectUri; private String wxQrLoginRedirectUri;
@ApiModelProperty("客户流失通知开关 0:关闭 1:开启") @ApiModelProperty("客户流失通知开关 0:关闭 1:开启")
private String customerChurnNoticeSwitch = new String("0"); private String customerChurnNoticeSwitch = Constants.NORMAL_CODE;
@ApiModelProperty("企业管理员账号") @ApiModelProperty("企业管理员账号")
......
package com.linkwechat.common.enums;
import lombok.Getter;
import java.util.stream.Stream;
/**
* 客户轨迹枚举
*/
@Getter
public enum TrajectoryType {
TRAJECTORY_TYPE_XXDT(1,"信息动态"),
TRAJECTORY_TYPE_SJDT(2,"社交动态"),
TRAJECTORY_TYPE_HDGZ(3,"活动规则"),
TRAJECTORY_TYPE_DBDT(4,"待办动态");
private String name;
private Integer type;
TrajectoryType( Integer type,String name) {
this.name = name;
this.type = type;
}
}
...@@ -24,6 +24,8 @@ public class ResourcesConfig implements WebMvcConfigurer ...@@ -24,6 +24,8 @@ public class ResourcesConfig implements WebMvcConfigurer
@Autowired @Autowired
private RepeatSubmitInterceptor repeatSubmitInterceptor; private RepeatSubmitInterceptor repeatSubmitInterceptor;
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) public void addResourceHandlers(ResourceHandlerRegistry registry)
{ {
...@@ -66,4 +68,5 @@ public class ResourcesConfig implements WebMvcConfigurer ...@@ -66,4 +68,5 @@ public class ResourcesConfig implements WebMvcConfigurer
} }
\ No newline at end of file \ No newline at end of file
package com.linkwechat.framework.config; package com.linkwechat.framework.config;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.framework.security.filter.JwtAuthenticationTokenFilter; import com.linkwechat.framework.security.filter.JwtAuthenticationTokenFilter;
import com.linkwechat.framework.security.handle.AuthenticationEntryPointImpl; import com.linkwechat.framework.security.handle.AuthenticationEntryPointImpl;
import com.linkwechat.framework.security.handle.LogoutSuccessHandlerImpl; import com.linkwechat.framework.security.handle.LogoutSuccessHandlerImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
...@@ -55,6 +57,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -55,6 +57,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired @Autowired
private CorsFilter corsFilter; private CorsFilter corsFilter;
@Autowired
private RuoYiConfig ruoYiConfig;
/** /**
* 解决 无法直接注入 AuthenticationManager * 解决 无法直接注入 AuthenticationManager
* *
...@@ -84,6 +91,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -84,6 +91,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
*/ */
@Override @Override
protected void configure(HttpSecurity httpSecurity) throws Exception { protected void configure(HttpSecurity httpSecurity) throws Exception {
System.out.println(
StringUtils.join(ruoYiConfig.getAnonUrl(),",")
);
httpSecurity httpSecurity
// CSRF禁用,因为不使用session // CSRF禁用,因为不使用session
.csrf().disable() .csrf().disable()
...@@ -93,8 +105,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -93,8 +105,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求 // 过滤请求
.authorizeRequests() .authorizeRequests()
// 对于登录login 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/captchaImage", "/findWxQrLoginInfo", "/wxQrLogin").anonymous() .antMatchers(ruoYiConfig.getAnonUrl()).anonymous()
// .antMatchers("/login", "/captchaImage", "/findWxQrLoginInfo", "/wxQrLogin").anonymous()
.antMatchers( .antMatchers(
HttpMethod.GET, HttpMethod.GET,
"/*.html", "/*.html",
...@@ -102,34 +116,34 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -102,34 +116,34 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/**/*.css", "/**/*.css",
"/**/*.js" "/**/*.js"
).permitAll() ).permitAll()
.antMatchers("/profile/**").anonymous() // .antMatchers("/profile/**").anonymous()
.antMatchers("/common/download**").anonymous() // .antMatchers("/common/download**").anonymous()
.antMatchers("/common/download/resource**").anonymous() // .antMatchers("/common/download/resource**").anonymous()
.antMatchers("/common/download/url**").anonymous() // .antMatchers("/common/download/url**").anonymous()
.antMatchers("/swagger-ui.html").anonymous() // .antMatchers("/swagger-ui.html").anonymous()
.antMatchers("/swagger-resources/**").anonymous() // .antMatchers("/swagger-resources/**").anonymous()
.antMatchers("/webjars/**").anonymous() // .antMatchers("/webjars/**").anonymous()
.antMatchers("/*/api-docs").anonymous() // .antMatchers("/*/api-docs").anonymous()
.antMatchers("/druid/**").anonymous() // .antMatchers("/druid/**").anonymous()
.antMatchers("/wecom/callback/**").anonymous() // .antMatchers("/wecom/callback/**").anonymous()
//
.antMatchers("/wecom/chat/item/list").anonymous() // .antMatchers("/wecom/chat/item/list").anonymous()
.antMatchers("/wecom/chat/collection/list").anonymous() // .antMatchers("/wecom/chat/collection/list").anonymous()
.antMatchers("/wecom/chat/collection/cancleCollection").anonymous() // .antMatchers("/wecom/chat/collection/cancleCollection").anonymous()
.antMatchers("/wecom/chat/collection/addCollection").anonymous() // .antMatchers("/wecom/chat/collection/addCollection").anonymous()
.antMatchers("/wecom/chat/side/h5List").anonymous() // .antMatchers("/wecom/chat/side/h5List").anonymous()
.antMatchers("/wecom/ticket/**").anonymous() // .antMatchers("/wecom/ticket/**").anonymous()
//
.antMatchers("/wecom/user/getUserInfo").anonymous() // .antMatchers("/wecom/user/getUserInfo").anonymous()
// .antMatchers("/common/uploadFile2Cos").anonymous() // // .antMatchers("/common/uploadFile2Cos").anonymous()
// .antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous() //// .antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous()
.antMatchers("/wecom/portrait/**").anonymous() // .antMatchers("/wecom/portrait/**").anonymous()
.antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*", "/wecom/reward/getRewardByFissionId/**").anonymous() // .antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*", "/wecom/reward/getRewardByFissionId/**").anonymous()
// 获取实际群活码和社群运营H5页面不需要登录 // // 获取实际群活码和社群运营H5页面不需要登录
.antMatchers("/wecom/groupCode/getActualCode/**").anonymous() // .antMatchers("/wecom/groupCode/getActualCode/**").anonymous()
.antMatchers("/wecom/community/h5/**").anonymous() // .antMatchers("/wecom/community/h5/**").anonymous()
//微信授权接口 // //微信授权接口
.antMatchers("/weixin/auth/**").anonymous() // .antMatchers("/weixin/auth/**").anonymous()
// 除上面外的所有请求全部需要鉴权认证 // 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated() .anyRequest().authenticated()
...@@ -141,6 +155,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -141,6 +155,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 添加CORS filter // 添加CORS filter
httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class); httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class); httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
String join = StringUtils.join(ruoYiConfig.getAnonUrl(), ",");
} }
...@@ -159,4 +175,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -159,4 +175,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(AuthenticationManagerBuilder auth) throws Exception { protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
} }
} }
package com.linkwechat.framework.web.service; package com.linkwechat.framework.web.service;
import cn.hutool.core.util.ArrayUtil;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.constant.Constants;
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.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.mapper.SysRoleMapper;
import com.linkwechat.system.service.ISysUserService; import com.linkwechat.system.service.ISysUserService;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.wecom.service.IWeCorpAccountService;
import com.linkwechat.wecom.service.IWeUserService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -23,8 +14,6 @@ import org.springframework.security.core.userdetails.UserDetailsService; ...@@ -23,8 +14,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.stream.Collectors;
/** /**
* 用户验证处理 * 用户验证处理
* *
...@@ -41,19 +30,8 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -41,19 +30,8 @@ public class UserDetailsServiceImpl implements UserDetailsService
@Autowired @Autowired
private SysPermissionService permissionService; private SysPermissionService permissionService;
@Autowired
private IWeUserService iWeUserService;
@Autowired
private RuoYiConfig ruoYiConfig;
@Autowired
private SysRoleMapper roleMapper;
@Autowired
private IWeCorpAccountService iWeCorpAccountService;
@Override @Override
...@@ -62,6 +40,9 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -62,6 +40,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
SysUser user = userService.selectUserByUserName(username); SysUser user = userService.selectUserByUserName(username);
if (StringUtils.isNull(user)) if (StringUtils.isNull(user))
{ {
log.info("登录用户:{} 不存在.", username);
throw new BaseException("对不起,您的账号:" + username + " 不存在");
// //企业管理登录 // //企业管理登录
// //查询企业管理相关账号 // //查询企业管理相关账号
// WeCorpAccount weCorpByAccount = iWeCorpAccountService.findWeCorpByAccount(username); // WeCorpAccount weCorpByAccount = iWeCorpAccountService.findWeCorpByAccount(username);
...@@ -103,9 +84,9 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -103,9 +84,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd())) // .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// .build(); // .build();
// } // }
userService.insertUser( // userService.insertUser(
user // user
); // );
} }
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{ {
......
...@@ -3,7 +3,7 @@ gen: ...@@ -3,7 +3,7 @@ gen:
# 作者 # 作者
author: ruoyi author: ruoyi
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.system packageName: com.linkwechat
# 自动去除表前缀,默认是false # 自动去除表前缀,默认是false
autoRemovePre: false autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔) # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
......
package ${packageName}.controller; package ${packageName}.web.controller.wecom;
import java.util.List; import java.util.List;
import java.util.Arrays; import java.util.Arrays;
......
package ${packageName}.domain; package ${packageName}.wecom.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
......
package ${packageName}.mapper; package ${packageName}.wecom.mapper;
import ${packageName}.domain.${ClassName}; import ${packageName}.domain.${ClassName};
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......
package ${packageName}.service; package ${packageName}.wecom.service;
import ${packageName}.domain.${ClassName}; import ${packageName}.domain.${ClassName};
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
......
package ${packageName}.service.impl; package ${packageName}.wecom.service.impl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......
package ${packageName}.domain; package ${packageName}.wecom.domain;
#foreach ($import in $subImportList) #foreach ($import in $subImportList)
import ${import}; import ${import};
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${packageName}.mapper.${ClassName}Mapper"> <mapper namespace="${packageName}.wecom.mapper.${ClassName}Mapper">
<resultMap type="${ClassName}" id="${ClassName}Result"> <resultMap type="${ClassName}" id="${ClassName}Result">
#foreach ($column in $columns) #foreach ($column in $columns)
......
package com.linkwechat.quartz.task;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @description: 客户画像
* @author: HaoN
* @create: 2021-05-02 21:08
**/
@Slf4j
@Component("customerPortraitTask")
public class CustomerPortraitTask {
}
...@@ -92,15 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -92,15 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="checkUserNameUnique" parameterType="String" resultType="int"> <select id="checkUserNameUnique" parameterType="String" resultType="int">
select count(1) from sys_user where user_name = #{userName} limit 1 select count(1) from sys_user where user_name = #{userName} and del_flag='0' limit 1
</select> </select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1 select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag='0' limit 1
</select> </select>
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} limit 1 select user_id, email from sys_user where email = #{email} and del_flag='0' limit 1
</select> </select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
......
package com.linkwechat.wecom.annotation;
import java.lang.annotation.*;
/**
* 客户轨迹记录相关注解
*/
@Target({ElementType.PARAMETER,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface CustomerTrajectoryRecord {
int trajectoryType();
}
...@@ -33,7 +33,7 @@ public interface WeAccessTokenClient { ...@@ -33,7 +33,7 @@ public interface WeAccessTokenClient {
*/ */
@Request(url = "/service/get_provider_token", @Request(url = "/service/get_provider_token",
type="POST") type="POST")
WeAccessTokenDtoDto getProviderToken(@Body("corpid") String corpid,@Body("provider_secret") String provider_secret); WeAccessTokenDtoDto getProviderToken(@Body("corpid") String corpid, @Body("provider_secret") String provider_secret);
/** /**
......
...@@ -33,5 +33,5 @@ public interface WeAppClient { ...@@ -33,5 +33,5 @@ public interface WeAppClient {
* @return * @return
*/ */
@Request(url = "/agent/set",type = "POST") @Request(url = "/agent/set",type = "POST")
WeResultDto updateAgentById(@DataObject WeAppDetailDto weAppDetailDto,@Header("agentid")String agentid); WeResultDto updateAgentById(@DataObject WeAppDetailDto weAppDetailDto, @Header("agentid") String agentid);
} }
...@@ -49,7 +49,7 @@ public interface WeCustomerClient { ...@@ -49,7 +49,7 @@ public interface WeCustomerClient {
* @return * @return
*/ */
@Request(url = "/externalcontact/batch/get_by_user", type = "POST") @Request(url = "/externalcontact/batch/get_by_user", type = "POST")
ExternalUserList getByUser(@DataObject Map<String,Object> query); ExternalUserList getByUser(@DataObject Map<String, Object> query);
/** /**
......
...@@ -24,7 +24,7 @@ public interface WeMessagePushClient { ...@@ -24,7 +24,7 @@ public interface WeMessagePushClient {
@Request(url = "/message/send", @Request(url = "/message/send",
type = "POST" type = "POST"
) )
WeMessagePushResultDto sendMessageToUser(@DataObject WeMessagePushDto weMessagePushDto,@Header("agentId") String agentId); WeMessagePushResultDto sendMessageToUser(@DataObject WeMessagePushDto weMessagePushDto, @Header("agentId") String agentId);
/** /**
* 应用推送消息 * 应用推送消息
......
...@@ -59,7 +59,7 @@ public interface WeUserClient { ...@@ -59,7 +59,7 @@ public interface WeUserClient {
* @return * @return
*/ */
@Request(url="/user/list") @Request(url="/user/list")
WeUserListDto list(@Query("department_id") Long departmentId,@Query("fetch_child") Integer fetchChild); WeUserListDto list(@Query("department_id") Long departmentId, @Query("fetch_child") Integer fetchChild);
/** /**
...@@ -100,5 +100,5 @@ public interface WeUserClient { ...@@ -100,5 +100,5 @@ public interface WeUserClient {
* @return * @return
*/ */
@Request(url = "/user/getuserinfo") @Request(url = "/user/getuserinfo")
WeUserInfoDto getuserinfo(@Query("code")String code,@Header("agentId")String agentId); WeUserInfoDto getuserinfo(@Query("code") String code, @Header("agentId") String agentId);
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
@Data @Data
@TableName("we_category")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("素材分类")
public class WeCategory extends BaseEntity { public class WeCategory extends BaseEntity {
private Long id = SnowFlakeUtil.nextId();
/** @TableId
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 @ApiModelProperty("素材主键")
*/ private Long id;
@ApiModelProperty("素材分类:0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本")
private String mediaType; private String mediaType;
/**
* 分类名称
*/ @ApiModelProperty("分类名称")
private String name; private String name;
/**
* 父分类的id
*/ @ApiModelProperty("素材上级父节点id")
private Long parentId; private Long parentId;
@ApiModelProperty("素材状态:0 未删除 2 已删除")
private String delFlag;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
...@@ -20,11 +21,14 @@ public class WeCustomerPortrait { ...@@ -20,11 +21,14 @@ public class WeCustomerPortrait {
private String flowerCustomerRelId; private String flowerCustomerRelId;
//客户昵称 //客户昵称
private String name; private String name;
//客户性别(0-未知 1-男性 2-女性)
private Integer gender;
//客户备注 //客户备注
private String remark; private String remark;
//备注客户手机号 //备注客户手机号
private String remarkMobiles; private String remarkMobiles;
//客户生日 //客户生日
@JsonFormat(pattern="yyyy-MM-dd")
private Date birthday; private Date birthday;
//邮箱 //邮箱
private String email; private String email;
...@@ -40,6 +44,8 @@ public class WeCustomerPortrait { ...@@ -40,6 +44,8 @@ public class WeCustomerPortrait {
private String description; private String description;
//年纪 //年纪
private int age; private int age;
//客户头像
private String avatar;
//客户标签 //客户标签
private List<WeTagGroup> weTagGroupList; private List<WeTagGroup> weTagGroupList;
......
...@@ -36,6 +36,15 @@ public class WeCustomerTrajectory { ...@@ -36,6 +36,15 @@ public class WeCustomerTrajectory {
//处理结束时间 //处理结束时间
private Time endTime; private Time endTime;
//0:正常;1:删除;2:完成 //0:正常;1:删除;2:完成
private String status; private String status;
//当前员工的id
private String userId;
//当前应用的id
private String agentId;
} }
...@@ -10,6 +10,7 @@ import lombok.Builder; ...@@ -10,6 +10,7 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
...@@ -23,7 +24,7 @@ import java.util.Date; ...@@ -23,7 +24,7 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName("we_tag") @TableName("we_tag")
public class WeTag public class WeTag implements Serializable
{ {
/** 标签组id */ /** 标签组id */
......
...@@ -60,6 +60,12 @@ public class WeTaskFissionCompleteRecord { ...@@ -60,6 +60,12 @@ public class WeTaskFissionCompleteRecord {
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private Date createTime = new Date(); private Date createTime = new Date();
@ApiModelProperty("状态 0 有效 1 无效")
private Integer status;
@ApiModelProperty("客户头像")
private String customerAvatar;
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -34,7 +34,7 @@ import java.util.Date; ...@@ -34,7 +34,7 @@ import java.util.Date;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class WeUser public class WeUser extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -123,7 +123,7 @@ public class WeUser ...@@ -123,7 +123,7 @@ public class WeUser
/** 是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 */ /** 是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 */
/** 激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除 */ /** 激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除 */
@ApiModelProperty("激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除") @ApiModelProperty("激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除")
private Integer isActivate; private Integer isActivate=new Integer(4);
/** 离职是否分配(1:已分配;0:未分配;) */ /** 离职是否分配(1:已分配;0:未分配;) */
@ApiModelProperty("离职是否分配(1:已分配;0:未分配;)") @ApiModelProperty("离职是否分配(1:已分配;0:未分配;)")
......
...@@ -12,4 +12,5 @@ public class WeChatUserDTO { ...@@ -12,4 +12,5 @@ public class WeChatUserDTO {
private String userid; private String userid;
private String unionid; private String unionid;
private String name; private String name;
private String avatar;
} }
...@@ -4,12 +4,18 @@ import com.linkwechat.wecom.domain.dto.message.ImageMessageDto; ...@@ -4,12 +4,18 @@ import com.linkwechat.wecom.domain.dto.message.ImageMessageDto;
import com.linkwechat.wecom.domain.dto.message.LinkMessageDto; import com.linkwechat.wecom.domain.dto.message.LinkMessageDto;
import com.linkwechat.wecom.domain.dto.message.MiniprogramMessageDto; import com.linkwechat.wecom.domain.dto.message.MiniprogramMessageDto;
import com.linkwechat.wecom.domain.dto.message.TextMessageDto; import com.linkwechat.wecom.domain.dto.message.TextMessageDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
@SuppressWarnings("all") @SuppressWarnings("all")
@Data @Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeMessagePushDto { public class WeMessagePushDto {
/** /**
......
package com.linkwechat.wecom.domain.dto.message; package com.linkwechat.wecom.domain.dto.message;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
@Data @Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TextMessageDto { public class TextMessageDto {
/** /**
......
package com.linkwechat.wecom.domain.dto.message; package com.linkwechat.wecom.domain.dto.message;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
@Data @Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeCustomerMessagePushDto { public class WeCustomerMessagePushDto {
/** /**
......
...@@ -123,6 +123,9 @@ public class ConversationArchiveVo { ...@@ -123,6 +123,9 @@ public class ConversationArchiveVo {
@ApiModel @ApiModel
@Data @Data
private class Content{ private class Content{
@ApiModelProperty("文件路径")
private String attachment;
@ApiModelProperty("文本消息内容") @ApiModelProperty("文本消息内容")
private String content; private String content;
......
...@@ -36,7 +36,7 @@ public class WeCallBackDelExternalContactImpl extends WeEventStrategy { ...@@ -36,7 +36,7 @@ public class WeCallBackDelExternalContactImpl extends WeEventStrategy {
@Override @Override
public void eventHandle(WxCpXmlMessageVO message) { public void eventHandle(WxCpXmlMessageVO message) {
if (message.getExternalUserId() != null) { if (message.getExternalUserId() != null) {
weCustomerService.deleteCustomersByEid(message.getExternalUserId()); //weCustomerService.deleteCustomersByEid(message.getExternalUserId());
weFlowerCustomerRelService.deleteFollowUser(message.getUserId(), message.getExternalUserId()); weFlowerCustomerRelService.deleteFollowUser(message.getUserId(), message.getExternalUserId());
//增加敏感行为记录,员工删除客户 //增加敏感行为记录,员工删除客户
......
package com.linkwechat.wecom.factory.impl.customergroup; package com.linkwechat.wecom.factory.impl.customergroup;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.thread.ThreadUtil;
import com.linkwechat.common.enums.CallbackEventUpdateDetail; import com.linkwechat.common.enums.CallbackEventUpdateDetail;
import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO; import com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO;
import com.linkwechat.wecom.factory.WeEventStrategy; import com.linkwechat.wecom.factory.WeEventStrategy;
import com.linkwechat.wecom.service.IWeGroupCodeActualService; import com.linkwechat.wecom.service.*;
import com.linkwechat.wecom.service.IWeGroupService;
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.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author danmo * @author danmo
* @description 客户群变更事件 * @description 客户群变更事件
...@@ -23,6 +28,18 @@ public class WeCallBackUpdateGroupImpl extends WeEventStrategy { ...@@ -23,6 +28,18 @@ public class WeCallBackUpdateGroupImpl extends WeEventStrategy {
@Autowired @Autowired
private IWeGroupCodeActualService groupCodeActualService; private IWeGroupCodeActualService groupCodeActualService;
@Autowired
private IWeTaskFissionService taskFissionService;
@Autowired
private IWeTaskFissionRecordService taskFissionRecordService;
@Autowired
private IWeTaskFissionCompleteRecordService taskFissionCompleteRecordService;
@Autowired
private IWeGroupMemberService groupMemberService;
@Override @Override
public void eventHandle(WxCpXmlMessageVO message) { public void eventHandle(WxCpXmlMessageVO message) {
try { try {
...@@ -31,10 +48,52 @@ public class WeCallBackUpdateGroupImpl extends WeEventStrategy { ...@@ -31,10 +48,52 @@ public class WeCallBackUpdateGroupImpl extends WeEventStrategy {
if (updateDetail.equals(CallbackEventUpdateDetail.ADD_MEMBER.getType())) { if (updateDetail.equals(CallbackEventUpdateDetail.ADD_MEMBER.getType())) {
// 添加成员,该群的实际群活码扫码次数需要加1 // 添加成员,该群的实际群活码扫码次数需要加1
groupCodeActualService.updateScanTimesByChatId(message.getChatId()); groupCodeActualService.updateScanTimesByChatId(message.getChatId());
ThreadUtil.execAsync(() ->{
groupFissionEnterCheck(message.getChatId());
});
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("update>>>>>>>>>param:{},ex:{}",message.getChatId(),e); log.error("update>>>>>>>>>param:{},ex:{}",message.getChatId(),e);
} }
} }
/**
* 群裂变客户入群校验
* @param chatId
*/
private void groupFissionEnterCheck(String chatId){
log.info("群裂变客户入群校验>>>>>>>>>>>>>>>>>>>>>start");
WeGroupCodeActual weGroupCodeActual = groupCodeActualService.selectActualCodeByChatId(chatId);
//查询群活码id
Long groupCodeId = Optional.ofNullable(weGroupCodeActual).map(WeGroupCodeActual::getGroupCodeId).orElse(0L);
//根据群活码id 查询任务列表
List<WeTaskFission> taskFissionList = taskFissionService.getTaskFissionListByGroupCodeId(groupCodeId);
if(CollectionUtil.isNotEmpty(taskFissionList)){
Set<Long> taskFissionIdSet = taskFissionList.stream().map(WeTaskFission::getId).collect(Collectors.toSet());
Map<Long, Long> taskFissionIdNumMap = taskFissionList.stream().collect(Collectors.toMap(WeTaskFission::getId, WeTaskFission::getFissNum));
//根据任务id查询裂变任务完成无效哦记录列表
List<WeTaskFissionCompleteRecord> completeRecordList = taskFissionCompleteRecordService.getListByTaskIds(taskFissionIdSet);
if(CollectionUtil.isNotEmpty(completeRecordList)){
completeRecordList.forEach(completeRecord ->{
//查询该成员是否入群
WeGroupMember weGroupMember = groupMemberService.selectWeGroupMemberByUnionId(chatId,completeRecord.getCustomerId());
if (weGroupMember != null){
completeRecord.setStatus(0);
if(taskFissionCompleteRecordService.updateWeTaskFissionCompleteRecord(completeRecord) > 0){
WeTaskFissionRecord record = taskFissionRecordService.selectWeTaskFissionRecordById(completeRecord.getFissionRecordId());
if(record != null){
Long fissNum = record.getFissNum() + 1;
if (fissNum >= taskFissionIdNumMap.get(record.getTaskFissionId())){
record.setCompleteTime(new Date());
}
record.setFissNum(fissNum);
taskFissionRecordService.updateWeTaskFissionRecord(record);
}
}
}
});
}
}
}
} }
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCategory; import com.linkwechat.wecom.domain.WeCategory;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface WeCategoryMapper { public interface WeCategoryMapper extends BaseMapper<WeCategory> {
/**
* 保存素材分类
*
* @param category 素材分类 信息
* @return {@link int}
*/
int insertWeCategory(WeCategory category);
/**
* 保存素材分类
*
* @param category 素材分类 信息
* @return {@link int}
*/
int updateWeCategory(WeCategory category);
/**
* 删除分类信息
*
* @param id 主键id
* @return {@link int}
*/
int deleteWeCategoryById(@Param("id") Long id);
/**
* 批量删除
*
* @param ids id列表
* @return {@link int}
*/
int deleteWeCategoryByIds(Long[] ids);
/**
* 通过类型查询对应类目的分类信息列表
*
* @param mediaType 类型
* @return {@link WeCategory}s
*/
List<WeCategory> findWeCategoryByMediaType(@Param("mediaType") String mediaType);
/**
* 通过id查询分类信息
*
* @param id 主键id
* @return {@link WeCategory}
*/
WeCategory findWeCategoryById(@Param("id") Long id);
/**
* 通过类型和名称查询类目信息
*
* @param mediaType 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本
* @param name 分类名称
* @return {@link WeCategory}
*/
WeCategory findWeCategoryByMediaTypeAndName(@Param("mediaType") String mediaType, @Param("name") String name);
} }
...@@ -29,7 +29,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> { ...@@ -29,7 +29,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return 结果 * @return 结果
*/ */
public int dropCollection(@Param("materialId") Long materialId,@Param("userId") String userId); public int dropCollection(@Param("materialId") Long materialId, @Param("userId") String userId);
/** /**
* 通过素材id和用户id查询当前素材的收藏条数 * 通过素材id和用户id查询当前素材的收藏条数
...@@ -38,7 +38,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> { ...@@ -38,7 +38,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return 当前素材收藏的条数 * @return 当前素材收藏的条数
*/ */
public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId,@Param("userId") String userId); public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId, @Param("userId") String userId);
/** /**
* 收藏列表 * 收藏列表
...@@ -46,6 +46,6 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> { ...@@ -46,6 +46,6 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return {@link WeChatSideVo}s * @return {@link WeChatSideVo}s
*/ */
public List<WeChatSideVo> findCollections(@Param("userId") String userId,@Param("keyword") String keyword); public List<WeChatSideVo> findCollections(@Param("userId") String userId, @Param("keyword") String keyword);
} }
...@@ -39,5 +39,5 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> { ...@@ -39,5 +39,5 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> {
* @param keyword 关键词 * @param keyword 关键词
* @return * @return
*/ */
public List<WeChatSideVo> findChatItems(@Param("sideId") Long sideId, @Param("keyword") String keyword,@Param("mediaType") String mediaType,@Param("userId") String userId); public List<WeChatSideVo> findChatItems(@Param("sideId") Long sideId, @Param("keyword") String keyword, @Param("mediaType") String mediaType, @Param("userId") String userId);
} }
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.common.core.domain.entity.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -10,47 +10,8 @@ import org.apache.ibatis.annotations.Param; ...@@ -10,47 +10,8 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi * @author ruoyi
* @date 2020-08-24 * @date 2020-08-24
*/ */
public interface WeCorpAccountMapper public interface WeCorpAccountMapper extends BaseMapper<WeCorpAccount>
{ {
/**
* 查询企业id相关配置
*
* @param id 企业id相关配置ID
* @return 企业id相关配置
*/
public WeCorpAccount selectWeCorpAccountById(Long id);
/**
* 查询企业id相关配置列表
*
* @param wxCorpAccount 企业id相关配置
* @return 企业id相关配置集合
*/
public List<WeCorpAccount> selectWeCorpAccountList(WeCorpAccount wxCorpAccount);
/**
* 新增企业id相关配置
*
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
public int insertWeCorpAccount(WeCorpAccount wxCorpAccount);
/**
* 修改企业id相关配置
*
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount);
/**
* 获取有效cropid
* @return
*/
public WeCorpAccount findValidWeCorpAccount();
/** /**
...@@ -58,13 +19,7 @@ public interface WeCorpAccountMapper ...@@ -58,13 +19,7 @@ public interface WeCorpAccountMapper
* @param corpId * @param corpId
* @return * @return
*/ */
public int startVailWeCorpAccount(@Param("corpId") String corpId); int startVailWeCorpAccount(@Param("corpId") String corpId);
/**
* 根据企业账号获取企业相关配置
* @param corpAccount
* @return
*/
WeCorpAccount findWeCorpByAccount(@Param("corpAccount") String corpAccount);
} }
...@@ -87,7 +87,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer> ...@@ -87,7 +87,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param userid * @param userid
* @return * @return
*/ */
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(@Param("externalUserid") String externalUserid,@Param("userid") String userid); WeCustomerPortrait findCustomerByOperUseridAndCustomerId(@Param("externalUserid") String externalUserid, @Param("userid") String userid);
/** /**
...@@ -96,7 +96,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer> ...@@ -96,7 +96,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param userid 员工id * @param userid 员工id
* @return * @return
*/ */
WeCustomerSocialConn countSocialConn(@Param("externalUserid")String externalUserid,@Param("userid")String userid); WeCustomerSocialConn countSocialConn(@Param("externalUserid") String externalUserid, @Param("userid") String userid);
} }
...@@ -20,7 +20,7 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> { ...@@ -20,7 +20,7 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> {
* @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群) * @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群)
* @return int * @return int
*/ */
int updateWeCustomerMessageActualSend(@Param("messageId") Long messageId,@Param("actualSend") Integer actualSend); int updateWeCustomerMessageActualSend(@Param("messageId") Long messageId, @Param("actualSend") Integer actualSend);
/** /**
* 更新消息发送状态 * 更新消息发送状态
...@@ -28,6 +28,6 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> { ...@@ -28,6 +28,6 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> {
* @param status 消息发送状态 0 未发送 1 已发送 * @param status 消息发送状态 0 未发送 1 已发送
* @return int * @return int
*/ */
int updateWeCustomerMessageCheckStatusById(@Param("messageId") Long messageId,@Param("status") String status); int updateWeCustomerMessageCheckStatusById(@Param("messageId") Long messageId, @Param("status") String status);
} }
...@@ -25,8 +25,8 @@ public interface WeCustomerMessageOriginalMapper extends BaseMapper<WeCustomerMe ...@@ -25,8 +25,8 @@ public interface WeCustomerMessageOriginalMapper extends BaseMapper<WeCustomerMe
* @param endTime 结束时间 * @param endTime 结束时间
* @return {@link CustomerMessagePushVo}s * @return {@link CustomerMessagePushVo}s
*/ */
public List<CustomerMessagePushVo> selectCustomerMessagePushs(@Param("sender") String sender,@Param("content") String content public List<CustomerMessagePushVo> selectCustomerMessagePushs(@Param("sender") String sender, @Param("content") String content
,@Param("pushType") String pushType, @Param("beginTime") String beginTime,@Param("endTime") String endTime); , @Param("pushType") String pushType, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
/** /**
* 群发详情 * 群发详情
......
...@@ -26,8 +26,8 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess ...@@ -26,8 +26,8 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
* @param sendTime 发送时间,发送状态为1时返回(为时间戳的形式) * @param sendTime 发送时间,发送状态为1时返回(为时间戳的形式)
* @return int * @return int
*/ */
int updateWeCustomerMessgaeResult(@Param("messageId") Long messageId,@Param("chatId") String chatId,@Param("externalUserid") String externalUserid int updateWeCustomerMessgaeResult(@Param("messageId") Long messageId, @Param("chatId") String chatId, @Param("externalUserid") String externalUserid
,@Param("status") String status,@Param("sendTime") String sendTime); , @Param("status") String status, @Param("sendTime") String sendTime);
/** /**
* 查询微信消息发送情况 * 查询微信消息发送情况
...@@ -36,7 +36,7 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess ...@@ -36,7 +36,7 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
* @param status 发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败 * @param status 发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败
* @return {@link WeCustomerMessageResultVo}s * @return {@link WeCustomerMessageResultVo}s
*/ */
List<WeCustomerMessageResultVo> customerMessagePushs(@Param("messageId") Long messageId,@Param("status") String status); List<WeCustomerMessageResultVo> customerMessagePushs(@Param("messageId") Long messageId, @Param("status") String status);
/** /**
* 检查是否已经同步群发结果 * 检查是否已经同步群发结果
......
...@@ -29,5 +29,5 @@ public interface WeGroupMapper extends BaseMapper<WeGroup> { ...@@ -29,5 +29,5 @@ public interface WeGroupMapper extends BaseMapper<WeGroup> {
// //
// int batchInsetWeGroup(@Param("weGroups") List<WeGroup> weGroups); // int batchInsetWeGroup(@Param("weGroups") List<WeGroup> weGroups);
List<WeCustomerAddGroup> findWeGroupByCustomer(@Param("userId") String userId,@Param("externalUserid") String externalUserid); List<WeCustomerAddGroup> findWeGroupByCustomer(@Param("userId") String userId, @Param("externalUserid") String externalUserid);
} }
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeTaskFission; import com.linkwechat.wecom.domain.WeTaskFission;
import java.util.List; import java.util.List;
...@@ -10,7 +11,7 @@ import java.util.List; ...@@ -10,7 +11,7 @@ import java.util.List;
* @author leejoker * @author leejoker
* @date 2021-01-20 * @date 2021-01-20
*/ */
public interface WeTaskFissionMapper { public interface WeTaskFissionMapper extends BaseMapper<WeTaskFission> {
/** /**
* 查询任务宝 * 查询任务宝
* *
......
...@@ -7,7 +7,6 @@ import com.linkwechat.wecom.domain.vo.WeAllocateCustomersVo; ...@@ -7,7 +7,6 @@ import com.linkwechat.wecom.domain.vo.WeAllocateCustomersVo;
import com.linkwechat.wecom.domain.vo.WeAllocateGroupsVo; import com.linkwechat.wecom.domain.vo.WeAllocateGroupsVo;
import com.linkwechat.wecom.domain.vo.WeLeaveUserVo; import com.linkwechat.wecom.domain.vo.WeLeaveUserVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -17,7 +16,6 @@ import java.util.List; ...@@ -17,7 +16,6 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2020-08-31 * @date 2020-08-31
*/ */
@Repository
public interface WeUserMapper extends BaseMapper<WeUser> public interface WeUserMapper extends BaseMapper<WeUser>
{ {
/** /**
......
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.common.core.domain.Tree; import com.linkwechat.common.core.domain.Tree;
import com.linkwechat.wecom.domain.WeCategory; import com.linkwechat.wecom.domain.WeCategory;
import com.linkwechat.wecom.domain.vo.WeCategoryVo; import com.linkwechat.wecom.domain.vo.WeCategoryVo;
...@@ -7,39 +8,23 @@ import org.apache.ibatis.annotations.Param; ...@@ -7,39 +8,23 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface IWeCategoryService { public interface IWeCategoryService extends IService<WeCategory> {
/** /**
* 保存素材分类 * 保存素材分类
* *
* @param category 素材分类 信息 * @param category 素材分类 信息
* @return {@link int}
*/ */
int insertWeCategory(WeCategory category); void insertWeCategory(WeCategory category);
/** /**
* 保存素材分类 * 保存素材分类
* *
* @param category 素材分类 信息 * @param category 素材分类 信息
* @return {@link int}
*/ */
int updateWeCategory(WeCategory category); void updateWeCategory(WeCategory category);
/**
* 删除分类信息
*
* @param id 主键id
* @return {@link int}
*/
int deleteWeCategoryById(Long id);
/**
* 批量删除
*
* @param ids id列表
* @return {@link int}
*/
int deleteWeCategoryByIds(Long[] ids);
/** /**
* 通过类型查询对应类目的分类信息列表 * 通过类型查询对应类目的分类信息列表
...@@ -49,12 +34,6 @@ public interface IWeCategoryService { ...@@ -49,12 +34,6 @@ public interface IWeCategoryService {
*/ */
List<? extends Tree<?>> findWeCategoryByMediaType(@Param("mediaType") String mediaType); List<? extends Tree<?>> findWeCategoryByMediaType(@Param("mediaType") String mediaType);
/**
* 通过id查询分类信息
*
* @param id 主键id
* @return {@link WeCategory}
*/
WeCategory findWeCategoryById(@Param("id") Long id);
} }
...@@ -20,7 +20,7 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> { ...@@ -20,7 +20,7 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return 结果 * @return 结果
*/ */
public int addCollection( Long materialId, String userId); public int addCollection(Long materialId, String userId);
/** /**
* 取消收藏 * 取消收藏
...@@ -29,7 +29,7 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> { ...@@ -29,7 +29,7 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return 结果 * @return 结果
*/ */
public int cancleCollection( Long materialId, String userId); public int cancleCollection(Long materialId, String userId);
/** /**
* 收藏列表 * 收藏列表
...@@ -37,6 +37,6 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> { ...@@ -37,6 +37,6 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return {@link WeChatSideVo}s * @return {@link WeChatSideVo}s
*/ */
public List<WeChatSideVo> collections(String userId,String keyword); public List<WeChatSideVo> collections(String userId, String keyword);
} }
...@@ -27,6 +27,6 @@ public interface IWeChatItemService extends IService<WeChatItem> { ...@@ -27,6 +27,6 @@ public interface IWeChatItemService extends IService<WeChatItem> {
* @param sideId 侧边栏id * @param sideId 侧边栏id
* @return * @return
*/ */
public List<WeChatSideVo> chatItems(Long sideId,String keyword,String mediaType,String userId); public List<WeChatSideVo> chatItems(Long sideId, String keyword, String mediaType, String userId);
} }
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.common.core.domain.entity.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import java.util.List;
/** /**
* 企业id相关配置Service接口 * 企业id相关配置Service接口
* *
* @author ruoyi * @author ruoyi
* @date 2020-08-24 * @date 2020-08-24
*/ */
public interface IWeCorpAccountService public interface IWeCorpAccountService extends IService<WeCorpAccount>
{ {
/**
* 查询企业id相关配置
*
* @param id 企业id相关配置ID
* @return 企业id相关配置
*/
public WeCorpAccount selectWeCorpAccountById(Long id);
/**
* 查询企业id相关配置列表
*
* @param wxCorpAccount 企业id相关配置
* @return 企业id相关配置集合
*/
public List<WeCorpAccount> selectWeCorpAccountList(WeCorpAccount wxCorpAccount);
/**
* 新增企业id相关配置
*
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
public int insertWeCorpAccount(WeCorpAccount wxCorpAccount);
/** /**
* 修改企业id相关配置 * 修改企业id相关配置
...@@ -42,7 +19,7 @@ public interface IWeCorpAccountService ...@@ -42,7 +19,7 @@ public interface IWeCorpAccountService
* @param wxCorpAccount 企业id相关配置 * @param wxCorpAccount 企业id相关配置
* @return 结果 * @return 结果
*/ */
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount); void updateWeCorpAccount(WeCorpAccount wxCorpAccount);
...@@ -51,27 +28,27 @@ public interface IWeCorpAccountService ...@@ -51,27 +28,27 @@ public interface IWeCorpAccountService
* *
* @return 结果 * @return 结果
*/ */
public WeCorpAccount findValidWeCorpAccount(); WeCorpAccount findValidWeCorpAccount();
/** /**
* 启用有效的企业微信账号 * 启用有效的企业微信账号
* @param corpId * @param corpId
*/ */
public int startVailWeCorpAccount(String corpId); int startVailWeCorpAccount(String corpId);
/** /**
* 客户流失通知开关 * 客户流失通知开关
* @param status 开关状态 * @param status 开关状态
* @return * @return
*/ */
public int startCustomerChurnNoticeSwitch(String status); void startCustomerChurnNoticeSwitch(String status);
/** /**
* 客户流失通知开关查询 * 客户流失通知开关查询
*/ */
public String getCustomerChurnNoticeSwitch(); String getCustomerChurnNoticeSwitch();
WeCorpAccount findWeCorpByAccount(String corpAccount);
} }
...@@ -28,7 +28,7 @@ public interface IWeCustomerMessageOriginalService extends IService<WeCustomerMe ...@@ -28,7 +28,7 @@ public interface IWeCustomerMessageOriginalService extends IService<WeCustomerMe
* @param endTime 结束时间 * @param endTime 结束时间
* @return {@link CustomerMessagePushVo}s * @return {@link CustomerMessagePushVo}s
*/ */
List<CustomerMessagePushVo> customerMessagePushs(String sender,String content,String pushType,String beginTime,String endTime); List<CustomerMessagePushVo> customerMessagePushs(String sender, String content, String pushType, String beginTime, String endTime);
/** /**
* 群发详情 * 群发详情
......
...@@ -32,6 +32,6 @@ public interface IWeCustomerMessagePushService { ...@@ -32,6 +32,6 @@ public interface IWeCustomerMessagePushService {
* @param endTime 结束时间 * @param endTime 结束时间
* @return {@link CustomerMessagePushVo}s * @return {@link CustomerMessagePushVo}s
*/ */
public List<CustomerMessagePushVo> customerMessagePushs(String sender,String content,String pushType,String beginTime,String endTime); public List<CustomerMessagePushVo> customerMessagePushs(String sender, String content, String pushType, String beginTime, String endTime);
} }
...@@ -24,7 +24,7 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> { ...@@ -24,7 +24,7 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> {
* @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群) * @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群)
* @return int * @return int
*/ */
int updateWeCustomerMessageActualSend( Long messageId, Integer actualSend); int updateWeCustomerMessageActualSend(Long messageId, Integer actualSend);
/** /**
* 保存微信消息 WeCustomerMessage * 保存微信消息 WeCustomerMessage
...@@ -33,7 +33,7 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> { ...@@ -33,7 +33,7 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> {
* @param customerMessagePushDto * @param customerMessagePushDto
* @param size * @param size
*/ */
void saveWeCustomerMessage(long messageId, long messageOriginalId, CustomerMessagePushDto customerMessagePushDto, int size,String content); void saveWeCustomerMessage(long messageId, long messageOriginalId, CustomerMessagePushDto customerMessagePushDto, int size, String content);
/** /**
* *
...@@ -50,6 +50,6 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> { ...@@ -50,6 +50,6 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> {
* @param messageId * @param messageId
* @throws JsonProcessingException * @throws JsonProcessingException
*/ */
public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId,List<WeCustomer> customers,List<WeGroup> groups) throws JsonProcessingException; public void sendMessgae(CustomerMessagePushDto customerMessagePushDto, long messageId, List<WeCustomer> customers, List<WeGroup> groups) throws JsonProcessingException;
} }
...@@ -118,7 +118,7 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -118,7 +118,7 @@ public interface IWeCustomerService extends IService<WeCustomer>
* @param userid * @param userid
* @return * @return
*/ */
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(String externalUserid,String userid) throws Exception; WeCustomerPortrait findCustomerByOperUseridAndCustomerId(String externalUserid, String userid) throws Exception;
/** /**
......
...@@ -5,4 +5,6 @@ import com.linkwechat.wecom.domain.WeCustomerTrajectory; ...@@ -5,4 +5,6 @@ import com.linkwechat.wecom.domain.WeCustomerTrajectory;
public interface IWeCustomerTrajectoryService extends IService<WeCustomerTrajectory> { public interface IWeCustomerTrajectoryService extends IService<WeCustomerTrajectory> {
void waitHandleMsg(String url);
} }
...@@ -17,4 +17,5 @@ public interface IWeGroupMemberService extends IService<WeGroupMember> { ...@@ -17,4 +17,5 @@ public interface IWeGroupMemberService extends IService<WeGroupMember> {
List<WeGroupMemberDto> selectWeGroupMemberListByChatId(String chatId); List<WeGroupMemberDto> selectWeGroupMemberListByChatId(String chatId);
WeGroupMember selectWeGroupMemberByUnionId(String chatId, String unionId);
} }
...@@ -28,5 +28,5 @@ public interface IWeGroupService extends IService<WeGroup> { ...@@ -28,5 +28,5 @@ public interface IWeGroupService extends IService<WeGroup> {
void deleteWeGroup(String chatId); void deleteWeGroup(String chatId);
List<WeCustomerAddGroup> findWeGroupByCustomer(String userId,String externalUserid); List<WeCustomerAddGroup> findWeGroupByCustomer(String userId, String externalUserid);
} }
...@@ -73,7 +73,7 @@ public interface IWeMaterialService { ...@@ -73,7 +73,7 @@ public interface IWeMaterialService {
* @param search 搜索值 * @param search 搜索值
* @return {@link WeMaterial}s * @return {@link WeMaterial}s
*/ */
List<WeMaterial> findWeMaterials(String categoryId, String search,String mediaType); List<WeMaterial> findWeMaterials(String categoryId, String search, String mediaType);
/** /**
* 更换分组 * 更换分组
...@@ -92,7 +92,7 @@ public interface IWeMaterialService { ...@@ -92,7 +92,7 @@ public interface IWeMaterialService {
* @param name 素材名称 * @param name 素材名称
* @return * @return
*/ */
public WeMediaDto uploadTemporaryMaterial(String url, String type,String name); public WeMediaDto uploadTemporaryMaterial(String url, String type, String name);
/** /**
* 上传素材图片 * 上传素材图片
......
...@@ -18,6 +18,6 @@ public interface IWePosterFontService extends IService<WePosterFont> { ...@@ -18,6 +18,6 @@ public interface IWePosterFontService extends IService<WePosterFont> {
* @param fontStyle 字体类型 0 通常 1 粗体 2 斜体 * @param fontStyle 字体类型 0 通常 1 粗体 2 斜体
* @return * @return
*/ */
public Font getFont(Long id,Integer size,Integer fontStyle); public Font getFont(Long id, Integer size, Integer fontStyle);
} }
...@@ -62,7 +62,7 @@ public interface IWeTagGroupService extends IService<WeTagGroup> ...@@ -62,7 +62,7 @@ public interface IWeTagGroupService extends IService<WeTagGroup>
* @param tagGroup * @param tagGroup
* @param isSync * @param isSync
*/ */
public void batchSaveOrUpdateTagGroupAndTag(List<WeCropGroupTagDto> tagGroup,Boolean isSync); public void batchSaveOrUpdateTagGroupAndTag(List<WeCropGroupTagDto> tagGroup, Boolean isSync);
void createTagGroup(String id); void createTagGroup(String id);
......
...@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeTaskFissionCompleteRecord; ...@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeTaskFissionCompleteRecord;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 裂变任务完成记录Service接口 * 裂变任务完成记录Service接口
...@@ -63,4 +64,18 @@ public interface IWeTaskFissionCompleteRecordService extends IService<WeTaskFiss ...@@ -63,4 +64,18 @@ public interface IWeTaskFissionCompleteRecordService extends IService<WeTaskFiss
public int deleteWeTaskFissionCompleteRecordById(Long id); public int deleteWeTaskFissionCompleteRecordById(Long id);
public List<WeTaskFissionCompleteRecord> statisticCompleteRecords(Long taskFissionId, Date startTime, Date endTime); public List<WeTaskFissionCompleteRecord> statisticCompleteRecords(Long taskFissionId, Date startTime, Date endTime);
/**
* 根据任务id查询裂变任务完成记录列表
* @param taskFissionIds 任务id
* @return
*/
List<WeTaskFissionCompleteRecord> getListByTaskIds(Set<Long> taskFissionIds);
/**
* 根据任务id查询裂变任务完成记录列表
* @param taskFissionId
* @return
*/
List<WeTaskFissionCompleteRecord> getCompleteListByTaskId(Long taskFissionId);
} }
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeTaskFission; import com.linkwechat.wecom.domain.WeTaskFission;
import com.linkwechat.wecom.domain.dto.WeChatUserDTO; import com.linkwechat.wecom.domain.dto.WeChatUserDTO;
...@@ -17,7 +18,7 @@ import java.util.List; ...@@ -17,7 +18,7 @@ import java.util.List;
* @author leejoker * @author leejoker
* @date 2021-01-20 * @date 2021-01-20
*/ */
public interface IWeTaskFissionService { public interface IWeTaskFissionService extends IService<WeTaskFission> {
/** /**
* 查询任务宝 * 查询任务宝
* *
...@@ -100,4 +101,11 @@ public interface IWeTaskFissionService { ...@@ -100,4 +101,11 @@ public interface IWeTaskFissionService {
* @return * @return
*/ */
public void updateExpiredWeTaskFission(); public void updateExpiredWeTaskFission();
/**
* 根据群活码id 查询任务列表
* @param groupCodeId 群活码id
* @return
*/
List<WeTaskFission> getTaskFissionListByGroupCodeId(Long groupCodeId);
} }
...@@ -25,7 +25,7 @@ public interface IWeUserBehaviorDataService extends IService<WeUserBehaviorData> ...@@ -25,7 +25,7 @@ public interface IWeUserBehaviorDataService extends IService<WeUserBehaviorData>
* @param dateTime * @param dateTime
* @return WeUserBehaviorDataDto * @return WeUserBehaviorDataDto
*/ */
WePageCountDto getCountDataByDay(String dateTime,String type); WePageCountDto getCountDataByDay(String dateTime, String type);
/** /**
* 按天维度查询数据统计 * 按天维度查询数据统计
......
...@@ -145,7 +145,7 @@ public interface IWeUserService extends IService<WeUser> ...@@ -145,7 +145,7 @@ public interface IWeUserService extends IService<WeUser>
* @param code * @param code
* @return * @return
*/ */
WeUserInfoVo getUserInfo(String code,String agentId); WeUserInfoVo getUserInfo(String code, String agentId);
/** /**
......
...@@ -9,7 +9,7 @@ import com.linkwechat.wecom.domain.weixin.dto.WxTokenDto; ...@@ -9,7 +9,7 @@ import com.linkwechat.wecom.domain.weixin.dto.WxTokenDto;
* @date 2021/4/5 22:45 * @date 2021/4/5 22:45
**/ **/
public interface IWxAuthService { public interface IWxAuthService {
WxTokenDto getToken(String code,String openId); WxTokenDto getToken(String code, String openId);
WxAuthUserInfoDto getUserInfo(String openId, String lang); WxAuthUserInfoDto getUserInfo(String openId, String lang);
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.Tree; import com.linkwechat.common.core.domain.Tree;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
...@@ -10,7 +13,6 @@ import com.linkwechat.wecom.domain.vo.WeCategoryVo; ...@@ -10,7 +13,6 @@ import com.linkwechat.wecom.domain.vo.WeCategoryVo;
import com.linkwechat.wecom.mapper.WeCategoryMapper; import com.linkwechat.wecom.mapper.WeCategoryMapper;
import com.linkwechat.wecom.service.IWeCategoryService; import com.linkwechat.wecom.service.IWeCategoryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -18,47 +20,49 @@ import java.util.List; ...@@ -18,47 +20,49 @@ import java.util.List;
@Slf4j @Slf4j
@Service @Service
public class WeCategoryServiceImpl implements IWeCategoryService { public class WeCategoryServiceImpl extends ServiceImpl<WeCategoryMapper,WeCategory> implements IWeCategoryService {
@Autowired
private WeCategoryMapper weCategoryMapper;
@Override @Override
public int insertWeCategory(WeCategory category) { public void insertWeCategory(WeCategory category) {
//判断是否存在相同的名称 //判断是否存在相同的名称
WeCategory weCategory = weCategoryMapper.findWeCategoryByMediaTypeAndName(category.getMediaType(), category.getName()); WeCategory weCategory =this.getOne(new LambdaQueryWrapper<WeCategory>()
.eq(WeCategory::getMediaType,category.getMediaType())
.eq(WeCategory::getName,category.getName())
.eq(WeCategory::getDelFlag, Constants.NORMAL_CODE));
if (null != weCategory) { if (null != weCategory) {
throw new WeComException("名称已存在!"); throw new WeComException("名称已存在!");
} }
category.setCreateTime(DateUtil.date()); category.setCreateTime(DateUtil.date());
category.setId(SnowFlakeUtil.nextId()); category.setId(SnowFlakeUtil.nextId());
return weCategoryMapper.insertWeCategory(category); this.save(category);
} }
@Override @Override
public int updateWeCategory(WeCategory category) { public void updateWeCategory(WeCategory category) {
//判断是否存在相同的名称 //判断是否存在相同的名称
WeCategory weCategory = weCategoryMapper.findWeCategoryByMediaTypeAndName(category.getMediaType(), category.getName()); WeCategory weCategory =this.getOne(new LambdaQueryWrapper<WeCategory>()
.eq(WeCategory::getMediaType,category.getMediaType())
.eq(WeCategory::getName,category.getName())
.eq(WeCategory::getDelFlag, Constants.NORMAL_CODE));
if (null != weCategory) { if (null != weCategory) {
throw new WeComException("名称已存在!"); throw new WeComException("名称已存在!");
} }
category.setUpdateTime(DateUtil.date()); category.setUpdateTime(DateUtil.date());
return weCategoryMapper.updateWeCategory(category); this.updateById(category);
} }
@Override
public int deleteWeCategoryById(Long id) {
return weCategoryMapper.deleteWeCategoryById(id);
}
@Override
public int deleteWeCategoryByIds(Long[] ids) {
return weCategoryMapper.deleteWeCategoryByIds(ids);
}
@Override @Override
public List<? extends Tree<?>> findWeCategoryByMediaType(String mediaType) { public List<? extends Tree<?>> findWeCategoryByMediaType(String mediaType) {
List<WeCategory> weCategories = weCategoryMapper.findWeCategoryByMediaType(mediaType); List<WeCategory> weCategories = this.list(new LambdaQueryWrapper<WeCategory>()
.eq(WeCategory::getMediaType,mediaType)
.eq(WeCategory::getDelFlag,Constants.NORMAL_CODE));
List<WeCategoryVo> weCategoryVos = new ArrayList<>(); List<WeCategoryVo> weCategoryVos = new ArrayList<>();
weCategories.forEach(c -> { weCategories.forEach(c -> {
WeCategoryVo weCategoryVo = new WeCategoryVo(); WeCategoryVo weCategoryVo = new WeCategoryVo();
...@@ -70,10 +74,6 @@ public class WeCategoryServiceImpl implements IWeCategoryService { ...@@ -70,10 +74,6 @@ public class WeCategoryServiceImpl implements IWeCategoryService {
return TreeUtil.build(weCategoryVos); return TreeUtil.build(weCategoryVos);
} }
@Override
public WeCategory findWeCategoryById(Long id) {
return weCategoryMapper.findWeCategoryById(id);
}
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.Optional; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.wecom.mapper.WeCorpAccountMapper;
import com.linkwechat.wecom.service.IWeAccessTokenService; import com.linkwechat.wecom.service.IWeAccessTokenService;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeCorpAccountMapper;
import com.linkwechat.common.core.domain.entity.WeCorpAccount; import java.util.Optional;
/** /**
* 企业id相关配置Service业务层处理 * 企业id相关配置Service业务层处理
...@@ -19,51 +20,14 @@ import com.linkwechat.common.core.domain.entity.WeCorpAccount; ...@@ -19,51 +20,14 @@ import com.linkwechat.common.core.domain.entity.WeCorpAccount;
* @date 2020-08-24 * @date 2020-08-24
*/ */
@Service @Service
public class WeCorpAccountServiceImpl implements IWeCorpAccountService { public class WeCorpAccountServiceImpl extends ServiceImpl<WeCorpAccountMapper,WeCorpAccount> implements IWeCorpAccountService {
@Autowired
private WeCorpAccountMapper weCorpAccountMapper;
@Autowired @Autowired
private IWeAccessTokenService iWeAccessTokenService; private IWeAccessTokenService iWeAccessTokenService;
/**
* 查询企业id相关配置
*
* @param id 企业id相关配置ID
* @return 企业id相关配置
*/
@Override
public WeCorpAccount selectWeCorpAccountById(Long id)
{
return weCorpAccountMapper.selectWeCorpAccountById(id);
}
/**
* 查询企业id相关配置列表
*
* @param wxCorpAccount 企业id相关配置
* @return 企业id相关配置
*/
@Override
public List<WeCorpAccount> selectWeCorpAccountList(WeCorpAccount wxCorpAccount)
{
return weCorpAccountMapper.selectWeCorpAccountList(wxCorpAccount);
}
/**
* 新增企业id相关配置
*
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
@Override
public int insertWeCorpAccount(WeCorpAccount wxCorpAccount)
{
return weCorpAccountMapper.insertWeCorpAccount(wxCorpAccount);
}
/** /**
* 修改企业id相关配置 * 修改企业id相关配置
...@@ -72,18 +36,16 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService { ...@@ -72,18 +36,16 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount) public void updateWeCorpAccount(WeCorpAccount wxCorpAccount)
{ {
int returnCode = weCorpAccountMapper.updateWeCorpAccount(wxCorpAccount); if(this.updateById(wxCorpAccount)){
if(Constants.SERVICE_RETURN_SUCCESS_CODE<returnCode){
iWeAccessTokenService.removeToken(); iWeAccessTokenService.removeToken();
} }
return returnCode;
} }
...@@ -95,7 +57,10 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService { ...@@ -95,7 +57,10 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
*/ */
@Override @Override
public WeCorpAccount findValidWeCorpAccount() { public WeCorpAccount findValidWeCorpAccount() {
return weCorpAccountMapper.findValidWeCorpAccount();
return this.getOne(new LambdaQueryWrapper<WeCorpAccount>()
.eq(WeCorpAccount::getDelFlag,Constants.NORMAL_CODE)
.eq(WeCorpAccount::getStatus,Constants.NORMAL_CODE));
} }
...@@ -106,7 +71,7 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService { ...@@ -106,7 +71,7 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
@Override @Override
public int startVailWeCorpAccount(String corpId) { public int startVailWeCorpAccount(String corpId) {
int returnCode = weCorpAccountMapper.startVailWeCorpAccount(corpId); int returnCode = this.baseMapper.startVailWeCorpAccount(corpId);
if(Constants.SERVICE_RETURN_SUCCESS_CODE<returnCode){ if(Constants.SERVICE_RETURN_SUCCESS_CODE<returnCode){
...@@ -120,24 +85,20 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService { ...@@ -120,24 +85,20 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
} }
@Override @Override
public int startCustomerChurnNoticeSwitch(String status) { public void startCustomerChurnNoticeSwitch(String status) {
WeCorpAccount validWeCorpAccount = findValidWeCorpAccount(); WeCorpAccount validWeCorpAccount = findValidWeCorpAccount();
validWeCorpAccount.setCustomerChurnNoticeSwitch(status); validWeCorpAccount.setCustomerChurnNoticeSwitch(status);
return weCorpAccountMapper.updateWeCorpAccount(validWeCorpAccount); this.updateWeCorpAccount(validWeCorpAccount);
} }
@Override @Override
public String getCustomerChurnNoticeSwitch() { public String getCustomerChurnNoticeSwitch() {
WeCorpAccount validWeCorpAccount = weCorpAccountMapper.findValidWeCorpAccount(); WeCorpAccount validWeCorpAccount = this.findValidWeCorpAccount();
String noticeSwitch = Optional.ofNullable(validWeCorpAccount).map(WeCorpAccount::getCustomerChurnNoticeSwitch) String noticeSwitch = Optional.ofNullable(validWeCorpAccount).map(WeCorpAccount::getCustomerChurnNoticeSwitch)
.orElse(WeConstans.DEL_FOLLOW_USER_SWITCH_CLOSE); .orElse(WeConstans.DEL_FOLLOW_USER_SWITCH_CLOSE);
return noticeSwitch; return noticeSwitch;
} }
@Override
public WeCorpAccount findWeCorpByAccount(String corpAccount) {
return weCorpAccountMapper.findWeCorpByAccount(corpAccount);
}
} }
...@@ -74,17 +74,24 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -74,17 +74,24 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException { public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException {
if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime())) // if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime()))
&& DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) { // && DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) {
// throw new WeComException("发送时间不能小于当前时间");
// }
if(StrUtil.isNotBlank(customerMessagePushDto.getSettingTime())){
if(DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0){
throw new WeComException("发送时间不能小于当前时间"); throw new WeComException("发送时间不能小于当前时间");
} }
}
/*if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){ /*if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){
throw new WeComException("发送时间不能为空"); throw new WeComException("发送时间不能为空");
}*/ }*/
List<WeCustomer> customers = Lists.newArrayList(); List<WeCustomer> customers = Lists.newArrayList();
List<WeGroup> groups = new ArrayList<>(); List<WeGroup> groups = new ArrayList<>();
// 0 发给客户 // 0 发给客户
......
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.enums.MediaType;
import com.linkwechat.common.enums.MessageType;
import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
import com.linkwechat.wecom.client.WeMessagePushClient;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerTrajectory; import com.linkwechat.wecom.domain.WeCustomerTrajectory;
import com.linkwechat.wecom.domain.dto.WeMessagePushDto;
import com.linkwechat.wecom.domain.dto.message.TextMessageDto;
import com.linkwechat.wecom.domain.dto.message.WeCustomerMessagePushDto;
import com.linkwechat.wecom.mapper.WeCustomerTrajectoryMapper; import com.linkwechat.wecom.mapper.WeCustomerTrajectoryMapper;
import com.linkwechat.wecom.service.IWeCustomerMessageService;
import com.linkwechat.wecom.service.IWeCustomerService;
import com.linkwechat.wecom.service.IWeCustomerTrajectoryService; import com.linkwechat.wecom.service.IWeCustomerTrajectoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class WeCustomerTrajectoryServiceImpl extends ServiceImpl<WeCustomerTrajectoryMapper, WeCustomerTrajectory> implements IWeCustomerTrajectoryService { public class WeCustomerTrajectoryServiceImpl extends ServiceImpl<WeCustomerTrajectoryMapper, WeCustomerTrajectory> implements IWeCustomerTrajectoryService {
@Autowired
private WeMessagePushClient weMessagePushClient;
@Autowired
private IWeCustomerService iWeCustomerService;
/**
* 待办理处理通知
*/
@Override
public void waitHandleMsg(String url) {
//获取所有满足时间的通知
List<WeCustomerTrajectory> trajectories = this.list(new LambdaQueryWrapper<WeCustomerTrajectory>()
.ne(WeCustomerTrajectory::getStatus, Constants.DELETE_CODE)
.last(" AND concat_ws(' ',create_date,start_time) <= DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s')" +
" AND concat_ws(' ',create_date,end_time) >= DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s')"));
if(CollectionUtil.isNotEmpty(trajectories)){
List<WeCustomer> weCustomers = iWeCustomerService.listByIds(
trajectories.stream().map(WeCustomerTrajectory::getExternalUserid).collect(Collectors.toList())
);
Map<String, WeCustomer> weCustomerMap
= weCustomers.stream().collect(Collectors.toMap(WeCustomer::getExternalUserid, a -> a, (k1, k2) -> k1));
//给员工发送通知
trajectories.stream().forEach(k->{
weMessagePushClient.sendMessageToUser(WeMessagePushDto.builder()
.touser(k.getUserId())
.msgtype(MessageType.TEXT.getMessageType())
.agentid(Integer.parseInt(k.getAgentId()))
.text(TextMessageDto.builder()
.content("您有一项关于客户"+weCustomerMap.get(k.getExternalUserid()).getName()+"的待办任务提醒,请尽快处理,\n<a href="+url+">点击查看客户详情。</a>")
.build())
.build(),
String.valueOf(1000012)
);
});
}
}
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeGroupMember; import com.linkwechat.wecom.domain.WeGroupMember;
import com.linkwechat.wecom.domain.dto.WeGroupMemberDto; import com.linkwechat.wecom.domain.dto.WeGroupMemberDto;
...@@ -29,5 +30,12 @@ public class WeGroupMemberServiceImpl extends ServiceImpl<WeGroupMemberMapper,We ...@@ -29,5 +30,12 @@ public class WeGroupMemberServiceImpl extends ServiceImpl<WeGroupMemberMapper,We
return this.baseMapper.selectWeGroupMemberListByChatId(chatId); return this.baseMapper.selectWeGroupMemberListByChatId(chatId);
} }
@Override
public WeGroupMember selectWeGroupMemberByUnionId(String chatId, String unionId) {
return this.getOne(new LambdaQueryWrapper<WeGroupMember>()
.eq(WeGroupMember::getChatId,chatId)
.eq(WeGroupMember::getUnionId,unionId));
}
} }
...@@ -9,7 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,7 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 裂变任务完成记录Service业务层处理 * 裂变任务完成记录Service业务层处理
...@@ -96,4 +98,23 @@ public class WeTaskFissionCompleteRecordServiceImpl extends ServiceImpl<WeTaskFi ...@@ -96,4 +98,23 @@ public class WeTaskFissionCompleteRecordServiceImpl extends ServiceImpl<WeTaskFi
orderByAsc(WeTaskFissionCompleteRecord::getCreateTime); orderByAsc(WeTaskFissionCompleteRecord::getCreateTime);
return weTaskFissionCompleteRecordMapper.selectList(wrapper); return weTaskFissionCompleteRecordMapper.selectList(wrapper);
} }
/**
* 根据任务id查询裂变任务完成记录列表
* @param taskFissionIds 任务id
* @return
*/
@Override
public List<WeTaskFissionCompleteRecord> getListByTaskIds(Set<Long> taskFissionIds) {
return this.list(new LambdaQueryWrapper<WeTaskFissionCompleteRecord>()
.in(WeTaskFissionCompleteRecord::getTaskFissionId,taskFissionIds)
.eq(WeTaskFissionCompleteRecord::getStatus,1));
}
@Override
public List<WeTaskFissionCompleteRecord> getCompleteListByTaskId(Long taskFissionId) {
return this.list(new LambdaQueryWrapper<WeTaskFissionCompleteRecord>()
.eq(WeTaskFissionCompleteRecord::getTaskFissionId,taskFissionId)
.eq(WeTaskFissionCompleteRecord::getStatus,0));
}
} }
...@@ -108,11 +108,8 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi ...@@ -108,11 +108,8 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi
@Override @Override
public WeTaskFissionRewardVo getRewardByFissionId(String fissionId, String unionId) { public WeTaskFissionRewardVo getRewardByFissionId(String fissionId, String unionId) {
WeTaskFissionRewardVo weTaskFissionRewardVo = new WeTaskFissionRewardVo(); WeTaskFissionRewardVo weTaskFissionRewardVo = new WeTaskFissionRewardVo();
WeCustomer weCustomer = weCustomerService.getOne(new LambdaQueryWrapper<WeCustomer>().eq(WeCustomer::getUnionid, unionId));
String customerUnionId = Optional.ofNullable(weCustomer).map(WeCustomer::getUnionid)
.orElseThrow(() -> new WeComException("用户信息不存在"));
WeTaskFissionRecord record = weTaskFissionRecordService.selectWeTaskFissionRecordByIdAndCustomerId(Long.valueOf(fissionId), customerUnionId); WeTaskFissionRecord record = weTaskFissionRecordService.selectWeTaskFissionRecordByIdAndCustomerId(Long.valueOf(fissionId), unionId);
if (record == null){ if (record == null){
throw new WeComException("任务信息不存在"); throw new WeComException("任务信息不存在");
} }
...@@ -128,7 +125,7 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi ...@@ -128,7 +125,7 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi
}); });
WeTaskFissionReward fissionReward = weTaskFissionRewardMapper.selectOne(new LambdaQueryWrapper<WeTaskFissionReward>() WeTaskFissionReward fissionReward = weTaskFissionRewardMapper.selectOne(new LambdaQueryWrapper<WeTaskFissionReward>()
.eq(WeTaskFissionReward::getTaskFissionId, fissionId) .eq(WeTaskFissionReward::getTaskFissionId, fissionId)
.eq(WeTaskFissionReward::getRewardUserId, customerUnionId)); .eq(WeTaskFissionReward::getRewardUserId, unionId));
weTaskFissionRewardVo.setWeTaskFissionReward(fissionReward); weTaskFissionRewardVo.setWeTaskFissionReward(fissionReward);
//发放兑奖码之后,置为已使用 //发放兑奖码之后,置为已使用
Optional.ofNullable(fissionReward).ifPresent(reward -> weTaskFissionRewardMapper.update(reward, new LambdaUpdateWrapper<WeTaskFissionReward>() Optional.ofNullable(fissionReward).ifPresent(reward -> weTaskFissionRewardMapper.update(reward, new LambdaUpdateWrapper<WeTaskFissionReward>()
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.linkwechat.common.config.CosConfig; import com.linkwechat.common.config.CosConfig;
...@@ -52,7 +53,7 @@ import java.util.stream.Collectors; ...@@ -52,7 +53,7 @@ import java.util.stream.Collectors;
*/ */
@Slf4j @Slf4j
@Service @Service
public class WeTaskFissionServiceImpl implements IWeTaskFissionService { public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, WeTaskFission> implements IWeTaskFissionService {
@Autowired @Autowired
private WeTaskFissionMapper weTaskFissionMapper; private WeTaskFissionMapper weTaskFissionMapper;
@Autowired @Autowired
...@@ -77,10 +78,13 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -77,10 +78,13 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
private IWeFlowerCustomerRelService weFlowerCustomerRelService; private IWeFlowerCustomerRelService weFlowerCustomerRelService;
@Autowired @Autowired
private IWeTaskFissionCompleteRecordService weTaskFissionCompleteRecordService; private IWeTaskFissionCompleteRecordService weTaskFissionCompleteRecordService;
@Autowired @Autowired
private CosConfig cosConfig; private CosConfig cosConfig;
@Value("${H5.url}") @Value("${H5.fissionUrl}")
private String pageUrl; private String pageUrl;
@Value("${H5.fissionGroupUrl}")
private String pageGroupUrl;
/** /**
* 查询任务宝 * 查询任务宝
...@@ -154,7 +158,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -154,7 +158,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
int updateResult = weTaskFissionMapper.updateWeTaskFission(weTaskFission); int updateResult = weTaskFissionMapper.updateWeTaskFission(weTaskFission);
if (updateResult > 0) { if (updateResult > 0) {
if (CollectionUtils.isNotEmpty(weTaskFission.getTaskFissionStaffs())) { if (CollectionUtils.isNotEmpty(weTaskFission.getTaskFissionStaffs())) {
log.info("发起成员信息:【{}】",JSONObject.toJSONString(weTaskFission.getTaskFissionStaffs())); log.info("发起成员信息:【{}】", JSONObject.toJSONString(weTaskFission.getTaskFissionStaffs()));
List<WeTaskFissionStaff> staffList = weTaskFissionStaffService.selectWeTaskFissionStaffByTaskId(weTaskFission.getId()); List<WeTaskFissionStaff> staffList = weTaskFissionStaffService.selectWeTaskFissionStaffByTaskId(weTaskFission.getId());
if (CollectionUtils.isNotEmpty(staffList)) { if (CollectionUtils.isNotEmpty(staffList)) {
weTaskFissionStaffService.deleteWeTaskFissionStaffByIds(staffList.stream().map(WeTaskFissionStaff::getId).toArray(Long[]::new)); weTaskFissionStaffService.deleteWeTaskFissionStaffByIds(staffList.stream().map(WeTaskFissionStaff::getId).toArray(Long[]::new));
...@@ -206,7 +210,6 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -206,7 +210,6 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
.append("fissionTargetId=").append(fissStaffId) .append("fissionTargetId=").append(fissStaffId)
.append("&") .append("&")
.append("posterId=").append(weTaskFission.getPostersId()); .append("posterId=").append(weTaskFission.getPostersId());
LinkMessageDto linkMessageDto = new LinkMessageDto(); LinkMessageDto linkMessageDto = new LinkMessageDto();
linkMessageDto.setPicurl(postersPath); linkMessageDto.setPicurl(postersPath);
linkMessageDto.setDesc(weTaskFission.getFissInfo()); linkMessageDto.setDesc(weTaskFission.getFissInfo());
...@@ -214,7 +217,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -214,7 +217,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
linkMessageDto.setUrl(pageUrlBuilder.toString()); linkMessageDto.setUrl(pageUrlBuilder.toString());
CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto(); CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto();
if (weTaskFission.getStartTime() != null){ if (weTaskFission.getStartTime() != null) {
customerMessagePushDto.setSettingTime(DateUtil.formatDateTime(weTaskFission.getStartTime())); customerMessagePushDto.setSettingTime(DateUtil.formatDateTime(weTaskFission.getStartTime()));
} }
customerMessagePushDto.setLinkMessage(linkMessageDto); customerMessagePushDto.setLinkMessage(linkMessageDto);
...@@ -284,12 +287,12 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -284,12 +287,12 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
WeTaskFissionCompleteRecord wfcr = new WeTaskFissionCompleteRecord(); WeTaskFissionCompleteRecord wfcr = new WeTaskFissionCompleteRecord();
wfcr.setTaskFissionId(taskFissionId); wfcr.setTaskFissionId(taskFissionId);
wfcr.setFissionRecordId(taskFissionRecordId); wfcr.setFissionRecordId(taskFissionRecordId);
String userId = StringUtils.isBlank(weChatUserDTO.getUserid()) ? weChatUserDTO.getUnionid() : weChatUserDTO.getUserid(); wfcr.setCustomerId(weChatUserDTO.getUnionid());
wfcr.setCustomerId(userId);
wfcr.setCustomerName(weChatUserDTO.getName()); wfcr.setCustomerName(weChatUserDTO.getName());
List<WeTaskFissionCompleteRecord> list = weTaskFissionCompleteRecordService.selectWeTaskFissionCompleteRecordList(wfcr); List<WeTaskFissionCompleteRecord> list = weTaskFissionCompleteRecordService.selectWeTaskFissionCompleteRecordList(wfcr);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
wfcr.setCreateTime(new Date()); wfcr.setCreateTime(new Date());
wfcr.setCustomerAvatar(weChatUserDTO.getAvatar());
weTaskFissionCompleteRecordService.insertWeTaskFissionCompleteRecord(wfcr); weTaskFissionCompleteRecordService.insertWeTaskFissionCompleteRecord(wfcr);
} }
} }
...@@ -311,9 +314,9 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -311,9 +314,9 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
.eq(WeFlowerCustomerRel::getState, WeConstans.FISSION_PREFIX + weTaskFissionRecord.getId())); .eq(WeFlowerCustomerRel::getState, WeConstans.FISSION_PREFIX + weTaskFissionRecord.getId()));
List<String> eidList = Optional.ofNullable(list).orElseGet(ArrayList::new).stream() List<String> eidList = Optional.ofNullable(list).orElseGet(ArrayList::new).stream()
.map(WeFlowerCustomerRel::getExternalUserid).collect(Collectors.toList()); .map(WeFlowerCustomerRel::getExternalUserid).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(eidList)){ if (CollectionUtil.isNotEmpty(eidList)) {
return weCustomerService.listByIds(eidList); return weCustomerService.listByIds(eidList);
}else { } else {
return null; return null;
} }
} }
...@@ -333,7 +336,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -333,7 +336,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
Map<String, List<WeTaskFissionCompleteRecord>> completeRecordsMap = weTaskFissionCompleteRecordService.statisticCompleteRecords(taskFissionId, startTime, endTime).parallelStream().filter(Objects::nonNull).collect(Collectors.groupingBy(item -> DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, item.getCreateTime()))); Map<String, List<WeTaskFissionCompleteRecord>> completeRecordsMap = weTaskFissionCompleteRecordService.statisticCompleteRecords(taskFissionId, startTime, endTime).parallelStream().filter(Objects::nonNull).collect(Collectors.groupingBy(item -> DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, item.getCreateTime())));
Map<String, List<WeTaskFissionRecord>> recordsMap = weTaskFissionRecordService.statisticRecords(taskFissionId, startTime, endTime).parallelStream().filter(Objects::nonNull).collect(Collectors.groupingBy(item -> DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, item.getCreateTime()))); Map<String, List<WeTaskFissionRecord>> recordsMap = weTaskFissionRecordService.statisticRecords(taskFissionId, startTime, endTime).parallelStream().filter(Objects::nonNull).collect(Collectors.groupingBy(item -> DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, item.getCreateTime())));
List<WeTaskFissionDailyDataVO> dailyDataList = Lists.newArrayList(); List<WeTaskFissionDailyDataVO> dailyDataList = Lists.newArrayList();
DateUtils.findDates(startTime, endTime).parallelStream().map(d -> DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, d)) DateUtils.findDates(startTime, endTime).stream().map(d -> DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, d))
.forEach(date -> { .forEach(date -> {
WeTaskFissionDailyDataVO v = new WeTaskFissionDailyDataVO(); WeTaskFissionDailyDataVO v = new WeTaskFissionDailyDataVO();
v.setDay(date); v.setDay(date);
...@@ -355,19 +358,28 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -355,19 +358,28 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
@Override @Override
public WeTaskFissionProgressVO getCustomerTaskProgress(WeTaskFission taskFission, String unionId) { public WeTaskFissionProgressVO getCustomerTaskProgress(WeTaskFission taskFission, String unionId) {
long complete = 0L;
long total = taskFission.getFissNum(); long total = taskFission.getFissNum();
List<WeCustomer> list = getCustomerListById(unionId, String.valueOf(taskFission.getId())); List<WeCustomer> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(list)) { if (taskFission.getFissionType() == 1) {
complete = list.size(); list.addAll(getCustomerListById(unionId, String.valueOf(taskFission.getId())));
} else { } else {
list = new ArrayList<>(); List<WeTaskFissionCompleteRecord> completeRecordList = weTaskFissionCompleteRecordService.getCompleteListByTaskId(taskFission.getId());
if (CollectionUtil.isNotEmpty(completeRecordList)) {
completeRecordList.forEach(completeRecord -> {
WeCustomer weCustomer = new WeCustomer();
weCustomer.setAvatar(completeRecord.getCustomerAvatar());
weCustomer.setUnionid(completeRecord.getCustomerId());
weCustomer.setName(completeRecord.getCustomerName());
list.add(weCustomer);
});
} }
return WeTaskFissionProgressVO.builder().total(total).completed(complete).customers(list).build(); }
return WeTaskFissionProgressVO.builder().total(total).completed(new Long(list.size())).customers(list).build();
} }
/** /**
* 更新过期任务 * 更新过期任务
*
* @return * @return
*/ */
@Override @Override
...@@ -375,6 +387,21 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -375,6 +387,21 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
weTaskFissionMapper.updateExpiredWeTaskFission(); weTaskFissionMapper.updateExpiredWeTaskFission();
} }
/**
* 根据群活码id 查询任务列表
*
* @param groupCodeId 群活码id
* @return
*/
@Override
public List<WeTaskFission> getTaskFissionListByGroupCodeId(Long groupCodeId) {
return this.list(new LambdaQueryWrapper<WeTaskFission>()
.eq(WeTaskFission::getFissionTargetId, groupCodeId)
.eq(WeTaskFission::getFissionType, 2)
.eq(WeTaskFission::getFissStatus, 1));
}
/*************************************** private functions **************************************/ /*************************************** private functions **************************************/
private String getPosterQRCode(String fissionTargetId, WeTaskFissionRecord record, WeCustomer weCustomer) { private String getPosterQRCode(String fissionTargetId, WeTaskFissionRecord record, WeCustomer weCustomer) {
...@@ -408,11 +435,14 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -408,11 +435,14 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
private String getGroupFissionQrcode(Long taskFissionId, WeTaskFissionRecord record, WeCustomer weCustomer) { private String getGroupFissionQrcode(Long taskFissionId, WeTaskFissionRecord record, WeCustomer weCustomer) {
String qrCode = null; String qrCode = null;
if (weCustomer != null) { if (weCustomer != null) {
String avatar = weCustomer.getAvatar(); String avatarUrl = weCustomer.getAvatar();
WeMaterial file = weMaterialService.findWeMaterialById(Long.parseLong(avatar)); StringBuilder contentBuilder = new StringBuilder(pageGroupUrl);
String avatarUrl = StringUtils.isEmpty(avatar) ? file.getMaterialUrl() : avatar; contentBuilder.append("?")
String content = "/wecom/fission/complete/" + taskFissionId + "/records/" + record.getId(); .append("fissionId=")
BufferedImage bufferedImage = QREncode.crateQRCode(content, avatarUrl); .append(taskFissionId)
.append("&recordId=")
.append(record.getId());
BufferedImage bufferedImage = QREncode.crateQRCode(contentBuilder.toString(), avatarUrl);
if (bufferedImage != null) { if (bufferedImage != null) {
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
ImageIO.write(bufferedImage, "png", byteArrayOutputStream); ImageIO.write(bufferedImage, "png", byteArrayOutputStream);
...@@ -423,7 +453,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -423,7 +453,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
throw new WeComException("生成二维码异常"); throw new WeComException("生成二维码异常");
} }
} }
return qrCode; return cosConfig.getImgUrlPrefix() + qrCode;
} else { } else {
throw new WeComException("生成二维码异常,用户信息不存在"); throw new WeComException("生成二维码异常,用户信息不存在");
} }
......
...@@ -20,6 +20,7 @@ import com.linkwechat.wecom.service.IWeGroupService; ...@@ -20,6 +20,7 @@ import com.linkwechat.wecom.service.IWeGroupService;
import com.linkwechat.wecom.service.IWeUserService; import com.linkwechat.wecom.service.IWeUserService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -102,7 +103,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen ...@@ -102,7 +103,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
{ {
if(this.save(weUser)){ if(this.insertWeUserNoToWeCom(weUser) > 0){
weUserClient.createUser( weUserClient.createUser(
weUser.transformWeUserDto() weUser.transformWeUserDto()
); );
...@@ -215,6 +216,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen ...@@ -215,6 +216,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
*/ */
@Override @Override
@Transactional @Transactional
@Async
public void synchWeUser(){ public void synchWeUser(){
//同步部门 //同步部门
......
...@@ -3,92 +3,6 @@ ...@@ -3,92 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeCategoryMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WeCategoryMapper">
<resultMap id="categoryMap" type="com.linkwechat.wecom.domain.WeCategory">
<id property="id" column="id"/>
<result property="mediaType" column="media_type"/>
<result property="name" column="name"/>
<result property="parentId" column="parent_id"/>
</resultMap>
<insert id="insertWeCategory">
INSERT INTO we_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="mediaType != null">media_type,</if>
<if test="name != null">name,</if>
<if test="parentId != null">parent_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="mediaType != null">#{mediaType},</if>
<if test="name != null">#{name},</if>
<if test="parentId != null">#{parentId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateWeCategory">
UPDATE we_category
<trim prefix="set" suffixOverrides=",">
<if test="mediaType != null">media_type=#{mediaType},</if>
<if test="name != null">name=#{name},</if>
<if test="parentId != null">parent_id=#{parentId},</if>
<if test="createBy != null">create_by=#{createBy},</if>
<if test="createTime != null">create_time=#{createTime},</if>
<if test="updateBy != null">update_by=#{updateBy},</if>
<if test="updateTime != null">update_time=#{updateTime},</if>
</trim>
<where>
id=#{id}
</where>
</update>
<delete id="deleteWeCategoryById">
UPDATE we_category
set del_flag=1
<where>
id=#{id}
</where>
</delete>
<delete id="deleteWeCategoryByIds">
UPDATE we_category
set del_flag=1
<where>
id in
<foreach collection="array" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</where>
</delete>
<select id="findWeCategoryByMediaType" resultType="com.linkwechat.wecom.domain.WeCategory">
SELECT
<include refid="categoryVo"/>
FROM we_category
<where>
media_type=#{mediaType} and del_flag=0
</where>
</select>
<select id="findWeCategoryById" resultType="com.linkwechat.wecom.domain.WeCategory">
SELECT
<include refid="categoryVo"/>
FROM we_category
<where>
id=#{id} and del_flag=0
</where>
</select>
<select id="findWeCategoryByMediaTypeAndName" resultType="com.linkwechat.wecom.domain.WeCategory">
SELECT
<include refid="categoryVo"/>
FROM we_category
<where>
media_type=#{mediaType} and del_flag=0 and `name`=#{name}
</where>
</select>
<sql id="categoryVo">
id,media_type,parent_id,`name`
</sql>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -4,124 +4,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -4,124 +4,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeCorpAccountMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WeCorpAccountMapper">
<resultMap type="WeCorpAccount" id="WeCorpAccountResult">
<result property="id" column="id" />
<result property="companyName" column="company_name" />
<result property="corpId" column="corp_id" />
<result property="corpSecret" column="corp_secret" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="contactSecret" column="contact_secret" />
<result property="agentId" column="agent_id" />
<result property="agentSecret" column="agent_secret" />
<result property="chatSecret" column="chat_secret" />
<result property="providerSecret" column="provider_secret" />
<result property="customerChurnNoticeSwitch" column="customer_churn_notice_switch" />
<result property="wxQrLoginRedirectUri" column="wx_qr_login_redirect_uri"/>
<result property="corpAccount" column="corp_account"/>
</resultMap>
<sql id="selectWeCorpAccountVo">
select id,chat_secret,provider_secret,company_name, corp_id, corp_secret,agent_id, agent_secret, status, del_flag, create_by, create_time, update_by, update_time,contact_secret, customer_churn_notice_switch,wx_qr_login_redirect_uri,
corp_account
from we_corp_account
</sql>
<select id="selectWeCorpAccountList" parameterType="WeCorpAccount" resultMap="WeCorpAccountResult">
<include refid="selectWeCorpAccountVo"/>
<where>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="corpId != null and corpId != ''"> and corp_id = #{corpId}</if>
<if test="corpSecret != null and corpSecret != ''"> and corp_secret = #{corpSecret}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectWeCorpAccountById" parameterType="Long" resultMap="WeCorpAccountResult">
<include refid="selectWeCorpAccountVo"/>
where id = #{id}
</select>
<insert id="insertWeCorpAccount" parameterType="WeCorpAccount" useGeneratedKeys="true" keyProperty="id">
insert into we_corp_account
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyName != null">company_name,</if>
<if test="corpId != null">corp_id,</if>
<if test="corpSecret != null">corp_secret,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="contactSecret != null ">contact_secret,</if>
<if test="chatSecret != null ">chat_secret,</if>
<if test="agentId != null ">agent_id,</if>
<if test="agentSecret != null ">agent_secret,</if>
<if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch,</if>
<if test="providerSecret != null ">provider_secret,</if>
<if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri,</if>
<if test="corpAccount != null ">corp_account,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyName != null">#{companyName},</if>
<if test="corpId != null">#{corpId},</if>
<if test="corpSecret != null">#{corpSecret},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="contactSecret != null ">#{contactSecret},</if>
<if test="chatSecret != null ">#{chatSecret},</if>
<if test="agentId != null ">#{agentId},</if>
<if test="agentSecret != null ">#{agentSecret},</if>
<if test="customerChurnNoticeSwitch != null ">#{customerChurnNoticeSwitch},</if>
<if test="providerSecret != null ">#{providerSecret},</if>
<if test="wxQrLoginRedirectUri != null ">#{wxQrLoginRedirectUri},</if>
<if test="corpAccount != null ">#{corpAccount},</if>
</trim>
</insert>
<update id="updateWeCorpAccount" parameterType="WeCorpAccount">
update we_corp_account
<trim prefix="SET" suffixOverrides=",">
<if test="companyName != null">company_name = #{companyName},</if>
<if test="corpId != null">corp_id = #{corpId},</if>
<if test="corpSecret != null">corp_secret = #{corpSecret},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="contactSecret != null ">contact_secret = #{contactSecret},</if>
<if test="chatSecret != null ">chat_secret = #{chatSecret},</if>
<if test="agentId != null ">agent_id = #{agentId},</if>
<if test="agentSecret != null ">agent_secret =#{agentSecret},</if>
<if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch = #{customerChurnNoticeSwitch},</if>
<if test="providerSecret != null ">provider_secret = #{providerSecret},</if>
<if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri = #{wxQrLoginRedirectUri},</if>
<if test="corpAccount != null ">crop_account = #{corpAccount},</if>
</trim>
where id = #{id}
</update>
<select id="findValidWeCorpAccount" resultMap="WeCorpAccountResult">
<include refid="selectWeCorpAccountVo"/>
WHERE
del_flag = 0
AND STATUS = 0
</select>
<update id="startVailWeCorpAccount"> <update id="startVailWeCorpAccount">
...@@ -131,12 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -131,12 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findWeCorpByAccount" resultMap="WeCorpAccountResult">
<include refid="selectWeCorpAccountVo"/>
WHERE
del_flag = 0
AND corp_account = #{corpAccount}
</select>
......
...@@ -129,9 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -129,9 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if> </if>
<if test="status != null and status !=''">
AND wfcr.status = #{status}
</if>
<if test="tagIds != null and tagIds !=''"> <if test="tagIds != null and tagIds !=''">
<if test="tagIds.indexOf(',') != -1"> <if test="tagIds.indexOf(',') != -1">
AND wt.tag_id in AND wt.tag_id in
...@@ -154,7 +152,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -154,7 +152,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
OR wu.department=#{departmentIds} OR wu.department=#{departmentIds}
</if> </if>
</if> </if>
<if test="status !=null and status !=''"> <if test="status !=null and status !=''">
AND wfcr.status=#{status} AND wfcr.status=#{status}
</if> </if>
...@@ -317,7 +314,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -317,7 +314,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wfcr.remark_corp_name, wfcr.remark_corp_name,
wfcr.description, wfcr.description,
wfcr.id as flowerCustomerRelId, wfcr.id as flowerCustomerRelId,
wfcr.user_id wfcr.user_id,
wc.avatar,
wfcr.external_userid,
wc.gender
FROM FROM
we_customer wc we_customer wc
LEFT JOIN we_flower_customer_rel wfcr on wc.external_userid=wfcr.external_userid LEFT JOIN we_flower_customer_rel wfcr on wc.external_userid=wfcr.external_userid
......
...@@ -150,11 +150,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -150,11 +150,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sum(ifnull(wgs.msg_total, 0)) msg_total, sum(ifnull(wgs.msg_total, 0)) msg_total,
date_format(wgs.stat_time, '%Y-%m') as finish_date date_format(wgs.stat_time, '%Y-%m') as finish_date
from we_group_statistic wgs from we_group_statistic wgs
where
str_to_date(date_format(wgs.stat_time, '%Y-%m'), '%Y-%m') &gt;=
str_to_date(date_format(date_sub(current_date, interval #{few} month), '%Y-%m'), '%Y-%m')
and str_to_date(date_format(wgs.stat_time, '%Y-%m'), '%Y-%m') &lt;=
str_to_date(date_format(current_date, '%Y-%m'), '%Y-%m')
group by finish_date group by finish_date
order by finish_date order by finish_date
) as tbr on tbl._date = tbr.finish_date ) as tbr on tbl._date = tbr.finish_date
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.WeTaskFissionCompleteRecordMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WeTaskFissionCompleteRecordMapper">
<resultMap type="WeTaskFissionCompleteRecord" id="WeTaskFissionCompleteRecordResult"> <resultMap type="WeTaskFissionCompleteRecord" id="WeTaskFissionCompleteRecordResult">
<result property="id" column="id"/> <result property="id" column="id"/>
...@@ -11,10 +11,12 @@ ...@@ -11,10 +11,12 @@
<result property="customerId" column="customer_id"/> <result property="customerId" column="customer_id"/>
<result property="customerName" column="customer_name"/> <result property="customerName" column="customer_name"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="status" column="status"/>
<result property="customerAvatar" column="customer_avatar"/>
</resultMap> </resultMap>
<sql id="selectWeTaskFissionCompleteRecordVo"> <sql id="selectWeTaskFissionCompleteRecordVo">
select id, task_fission_id, fission_record_id, customer_id, customer_name, create_time from select id, task_fission_id, fission_record_id, customer_id, customer_name, create_time, status, customer_avatar from
we_task_fission_complete_record we_task_fission_complete_record
</sql> </sql>
...@@ -25,6 +27,7 @@ ...@@ -25,6 +27,7 @@
<if test="taskFissionId != null ">and task_fission_id = #{taskFissionId}</if> <if test="taskFissionId != null ">and task_fission_id = #{taskFissionId}</if>
<if test="fissionRecordId != null ">and fission_record_id = #{fissionRecordId}</if> <if test="fissionRecordId != null ">and fission_record_id = #{fissionRecordId}</if>
<if test="customerId != null and customerId != ''">and customer_id = #{customerId}</if> <if test="customerId != null and customerId != ''">and customer_id = #{customerId}</if>
<if test="status != null">and status = #{status}</if>
<if test="customerName != null and customerName != ''">and customer_name like concat('%', #{customerName}, <if test="customerName != null and customerName != ''">and customer_name like concat('%', #{customerName},
'%') '%')
</if> </if>
...@@ -46,6 +49,8 @@ ...@@ -46,6 +49,8 @@
<if test="customerId != null and customerId != ''">customer_id,</if> <if test="customerId != null and customerId != ''">customer_id,</if>
<if test="customerName != null">customer_name,</if> <if test="customerName != null">customer_name,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="status != null">status,</if>
<if test="customerAvatar != null">customer_avatar,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskFissionId != null">#{taskFissionId},</if> <if test="taskFissionId != null">#{taskFissionId},</if>
...@@ -53,6 +58,8 @@ ...@@ -53,6 +58,8 @@
<if test="customerId != null and customerId != ''">#{customerId},</if> <if test="customerId != null and customerId != ''">#{customerId},</if>
<if test="customerName != null">#{customerName},</if> <if test="customerName != null">#{customerName},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="status != null">#{status},</if>
<if test="customerAvatar != null">#{customerAvatar},</if>
</trim> </trim>
</insert> </insert>
...@@ -64,6 +71,8 @@ ...@@ -64,6 +71,8 @@
<if test="customerId != null and customerId != ''">customer_id = #{customerId},</if> <if test="customerId != null and customerId != ''">customer_id = #{customerId},</if>
<if test="customerName != null">customer_name = #{customerName},</if> <if test="customerName != null">customer_name = #{customerName},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="status != null">status = #{status},</if>
<if test="customerAvatar != null">customer_avatar = #{customerAvatar},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
...@@ -149,11 +149,6 @@ ...@@ -149,11 +149,6 @@
sum(ifnull(wubd.negative_feedback_cnt, 0)) negative_feedback_cnt, sum(ifnull(wubd.negative_feedback_cnt, 0)) negative_feedback_cnt,
date_format(wubd.stat_time, '%Y-%m') as finish_date date_format(wubd.stat_time, '%Y-%m') as finish_date
from we_user_behavior_data wubd from we_user_behavior_data wubd
where
str_to_date(date_format(wubd.stat_time, '%Y-%m'), '%Y-%m') &gt;=
str_to_date(date_format(date_sub(current_date, interval #{few} month), '%Y-%m'), '%Y-%m')
and str_to_date(date_format(wubd.stat_time, '%Y-%m'), '%Y-%m') &lt;=
str_to_date(date_format(current_date, '%Y-%m'), '%Y-%m')
group by finish_date group by finish_date
order by finish_date order by finish_date
) as tbr on tbl._date = tbr.finish_date ) as tbr on tbl._date = tbr.finish_date
......
...@@ -47,7 +47,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -47,7 +47,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="departmentStr != null and departmentStr != '' "> and FIND_IN_SET(#{departmentStr},department)</if> <if test="departmentStr != null and departmentStr != '' "> and FIND_IN_SET(#{departmentStr},department)</if>
<if test="position != null and position != ''"> and position = #{position}</if> <if test="position != null and position != ''"> and position = #{position}</if>
<if test="isLeaderInDept != null "> and is_leader_in_dept = #{isLeaderInDept}</if> <if test="isLeaderInDept != null "> and is_leader_in_dept = #{isLeaderInDept}</if>
<if test="joinTime != null "> and join_time = #{joinTime}</if> <if test="beginTime != null and beginTime !='' and endTime !=null and endTime !=''">
and DATE_FORMAT(join_time,'%Y-%m-%d') BETWEEN #{beginTime} AND #{endTime}
</if>
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if> <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="qqAccount != null and qqAccount != ''"> and qq_account = #{qqAccount}</if> <if test="qqAccount != null and qqAccount != ''"> and qq_account = #{qqAccount}</if>
<if test="telephone != null and telephone != ''"> and telephone = #{telephone}</if> <if test="telephone != null and telephone != ''"> and telephone = #{telephone}</if>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!