Commit 912bc591 by 水库浪子

更新主分支代码

1 parent d528574f
Showing 93 changed files with 773 additions and 733 deletions
......@@ -18,7 +18,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@MapperScan("com.linkwechat.*.mapper")
@ForestScan(basePackages = {"com.linkwechat.wecom.client","com.linkwechat.wecom.wxclient"})
@EnableAsync
//@EnableDiscoveryClient
@EnableDiscoveryClient
public class LinkWeChatApplication {
public static void main(String[] args) {
......
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.Tree;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeCategory;
import com.linkwechat.wecom.service.IWeCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -22,14 +25,14 @@ import java.util.List;
*/
@RestController
@RequestMapping("/wecom/category")
@Api("企业微信素材分类")
public class WeCategoryController extends BaseController {
@Autowired
private IWeCategoryService weCategoryService;
/**
* 类目树
*/
// @PreAuthorize("@ss.hasPermi('wechat:category:list')")
@GetMapping("/list")
@ApiOperation("类目树")
......@@ -44,7 +47,7 @@ public class WeCategoryController extends BaseController {
@GetMapping(value = "/{id}")
@ApiOperation("通过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 {
@PostMapping
@ApiOperation("添加类目")
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 {
@PutMapping
@ApiOperation("更新目录")
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 {
@DeleteMapping("/{ids}")
@ApiOperation("删除类目")
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;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.controller.BaseController;
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.enums.BusinessType;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -21,84 +25,76 @@ import java.util.List;
*/
@RestController
@RequestMapping("/wecom/corp")
@Api("企业id配置接口")
public class WeCorpAccountController extends BaseController
{
@Autowired
private IWeCorpAccountService weCorpAccountService;
/**
* 查询企业id相关配置列表
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:list')")
@GetMapping("/list")
@ApiOperation("查询企业id相关配置列表")
public TableDataInfo list(WeCorpAccount weCorpAccount)
{
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);
}
/**
* 获取企业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')")
@Log(title = "新增企业id相关配置", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("新增企业id相关配置")
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')")
@Log(title = "修改企业id相关配置", businessType = BusinessType.UPDATE)
@PutMapping
@ApiOperation("修改企业id相关配置")
public AjaxResult edit(@Validated @RequestBody WeCorpAccount weCorpAccount)
{
return toAjax(weCorpAccountService.updateWeCorpAccount(weCorpAccount));
weCorpAccountService.updateById(weCorpAccount);
return AjaxResult.success();
}
/**
* 启用有效企业微信账号
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:startVailWeCorpAccount')")
@Log(title = "启用有效企业微信账号", businessType = BusinessType.DELETE)
@PutMapping("/startVailWeCorpAccount/{corpId}")
@ApiOperation("启用有效企业微信账号")
public AjaxResult startWeCorpAccount(@PathVariable String corpId)
{
return toAjax(weCorpAccountService.startVailWeCorpAccount(corpId));
}
/**
* 客户流失通知开关
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:startCustomerChurnNoticeSwitch')")
@Log(title = "客户流失通知开关", businessType = BusinessType.UPDATE)
@PutMapping("/startCustomerChurnNoticeSwitch/{status}")
@ApiOperation("客户流失通知开关")
public AjaxResult startCustomerChurnNoticeSwitch(@PathVariable String status)
{
return toAjax(weCorpAccountService.startCustomerChurnNoticeSwitch(status));
weCorpAccountService.startCustomerChurnNoticeSwitch(status);
return AjaxResult.success();
}
/**
* 客户流失通知开关查询
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:getCustomerChurnNoticeSwitch')")
@Log(title = "客户流失通知开关查询", businessType = BusinessType.OTHER)
@GetMapping("/getCustomerChurnNoticeSwitch")
@ApiOperation("客户流失通知开关查询")
public AjaxResult getCustomerChurnNoticeSwitch()
{
return AjaxResult.success("操作成功",weCorpAccountService.getCustomerChurnNoticeSwitch());
......
......@@ -12,6 +12,7 @@ import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.service.IWeCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated;
......@@ -30,7 +31,9 @@ import java.util.List;
@RequestMapping("/wecom/customer")
public class WeCustomerController extends BaseController
{
@Autowired
@Lazy
private IWeCustomerService weCustomerService;
......
......@@ -51,14 +51,14 @@ public class WeCustomerPortraitController extends BaseController {
/**
* 根据客户id和当前企业员工id获取客户详细信息
* @param externalUserid
* @param userid
* @param userId
* @return
*/
@GetMapping(value = "/findWeCustomerInfo")
public AjaxResult findWeCustomerInfo(String externalUserid, String userid) throws Exception {
public AjaxResult findWeCustomerInfo(String externalUserid, String userId) throws Exception {
return AjaxResult.success(
iWeCustomerService.findCustomerByOperUseridAndCustomerId(externalUserid,userid)
iWeCustomerService.findCustomerByOperUseridAndCustomerId(externalUserid,userId)
);
}
......@@ -73,7 +73,6 @@ public class WeCustomerPortraitController extends BaseController {
iWeCustomerService.updateWeCustomerPortrait(weCustomerPortrait);
......@@ -224,4 +223,6 @@ public class WeCustomerPortraitController extends BaseController {
}
......@@ -16,9 +16,7 @@ import com.linkwechat.wecom.service.IWePosterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -44,11 +42,10 @@ public class WeMaterialController extends BaseController {
@Resource
private IWePosterService wePosterService;
/**
* 查询素材列表
*/
// @PreAuthorize("@ss.hasPermi('wecom:material:list')")
@GetMapping("/list")
@ApiOperation("查询素材列表")
public TableDataInfo list(@RequestParam(value = "categoryId", required = false) String categoryId
, @RequestParam(value = "search", required = false) String search,@RequestParam(value = "mediaType") String mediaType) {
startPage();
......@@ -69,9 +66,8 @@ public class WeMaterialController extends BaseController {
return getDataTable(list);
}
/**
* 查询素材详细信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:query')")
@GetMapping(value = "/{id}")
@ApiOperation("查询素材详细信息")
......@@ -79,9 +75,7 @@ public class WeMaterialController extends BaseController {
return AjaxResult.success(materialService.findWeMaterialById(id));
}
/**
* 添加素材信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:add')")
@Log(title = "添加素材信息", businessType = BusinessType.INSERT)
@PostMapping
......@@ -90,9 +84,7 @@ public class WeMaterialController extends BaseController {
return toAjax(materialService.insertWeMaterial(material));
}
/**
* 更新素材信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:edit')")
@Log(title = "更新素材信息", businessType = BusinessType.UPDATE)
@PutMapping
......@@ -101,9 +93,7 @@ public class WeMaterialController extends BaseController {
return toAjax(materialService.updateWeMaterial(material));
}
/**
* 删除素材信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:remove')")
@Log(title = "删除素材信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
......@@ -112,9 +102,7 @@ public class WeMaterialController extends BaseController {
return toAjax(materialService.deleteWeMaterialByIds(ids));
}
/**
* 上传素材信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:upload')")
@Log(title = "上传素材信息", businessType = BusinessType.OTHER)
@PostMapping("/upload")
......@@ -124,9 +112,7 @@ public class WeMaterialController extends BaseController {
return AjaxResult.success(weMaterialFileVO);
}
/**
* 更换分组
*/
// @PreAuthorize("@ss.hasPermi('wechat:material:resetCategory')")
@Log(title = "更换分组", businessType = BusinessType.OTHER)
@PutMapping("/resetCategory")
......@@ -147,6 +133,8 @@ public class WeMaterialController extends BaseController {
return AjaxResult.success(weMediaDto);
}
@Log(title = "上传素材图片", businessType = BusinessType.OTHER)
@PostMapping("/uploadimg")
@ApiOperation("上传素材图片")
......
......@@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
......@@ -35,6 +36,7 @@ import java.util.List;
public class WeUserController extends BaseController {
@Autowired
@Lazy
private IWeUserService weUserService;
......
......@@ -16,7 +16,37 @@ ruoyi:
captchaType: math
# 企业微信用户首次登录系统默认密码
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:
# 服务器的HTTP端口,默认为8090
......
......@@ -260,6 +260,12 @@
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.68</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
</dependencies>
</project>
\ 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
/** 企业微信账号登录系统默认密码 */
private static String weUserDefaultPwd="123456";
/**匿名访问的URL*/
private String[] anonUrl;
public String getName()
{
return name;
......@@ -132,4 +137,12 @@ public class RuoYiConfig
public void setWeUserDefaultPwd(String weUserDefaultPwd) {
RuoYiConfig.weUserDefaultPwd = weUserDefaultPwd;
}
public String[] getAnonUrl() {
return anonUrl;
}
public void setAnonUrl(String[] anonUrl) {
this.anonUrl = anonUrl;
}
}
......@@ -163,7 +163,7 @@ public class Constants
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;
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.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel;
......@@ -8,7 +11,6 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.constraints.NotBlank;
......@@ -23,11 +25,14 @@ import javax.validation.constraints.NotBlank;
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("企业id配置相关实体")
@TableName("we_corp_account")
public class WeCorpAccount extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId
@ApiModelProperty("主键")
private Long id= SnowFlakeUtil.nextId();
/** 企业名称 */
......@@ -36,12 +41,12 @@ public class WeCorpAccount extends BaseEntity
private String companyName;
/** 企业ID */
@ApiModelProperty("企业ID")
@ApiModelProperty("企业corpId")
@NotBlank(message = "企业ID不能为空")
private String corpId;
/** 应用的密钥凭证 */
@ApiModelProperty("应用的密钥凭证")
@ApiModelProperty("企业为corpSecret")
@NotBlank(message = "应用的密钥凭证不能为空")
private String corpSecret;
......@@ -75,7 +80,7 @@ public class WeCorpAccount extends BaseEntity
private String wxQrLoginRedirectUri;
@ApiModelProperty("客户流失通知开关 0:关闭 1:开启")
private String customerChurnNoticeSwitch = new String("0");
private String customerChurnNoticeSwitch = Constants.NORMAL_CODE;
@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
@Autowired
private RepeatSubmitInterceptor repeatSubmitInterceptor;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{
......@@ -66,4 +68,5 @@ public class ResourcesConfig implements WebMvcConfigurer
}
\ No newline at end of file
package com.linkwechat.framework.config;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.framework.security.filter.JwtAuthenticationTokenFilter;
import com.linkwechat.framework.security.handle.AuthenticationEntryPointImpl;
import com.linkwechat.framework.security.handle.LogoutSuccessHandlerImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
......@@ -55,6 +57,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CorsFilter corsFilter;
@Autowired
private RuoYiConfig ruoYiConfig;
/**
* 解决 无法直接注入 AuthenticationManager
*
......@@ -84,6 +91,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
*/
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
System.out.println(
StringUtils.join(ruoYiConfig.getAnonUrl(),",")
);
httpSecurity
// CSRF禁用,因为不使用session
.csrf().disable()
......@@ -93,8 +105,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
// 对于登录login 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/captchaImage", "/findWxQrLoginInfo", "/wxQrLogin").anonymous()
.antMatchers(ruoYiConfig.getAnonUrl()).anonymous()
// .antMatchers("/login", "/captchaImage", "/findWxQrLoginInfo", "/wxQrLogin").anonymous()
.antMatchers(
HttpMethod.GET,
"/*.html",
......@@ -102,34 +116,34 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/**/*.css",
"/**/*.js"
).permitAll()
.antMatchers("/profile/**").anonymous()
.antMatchers("/common/download**").anonymous()
.antMatchers("/common/download/resource**").anonymous()
.antMatchers("/common/download/url**").anonymous()
.antMatchers("/swagger-ui.html").anonymous()
.antMatchers("/swagger-resources/**").anonymous()
.antMatchers("/webjars/**").anonymous()
.antMatchers("/*/api-docs").anonymous()
.antMatchers("/druid/**").anonymous()
.antMatchers("/wecom/callback/**").anonymous()
.antMatchers("/wecom/chat/item/list").anonymous()
.antMatchers("/wecom/chat/collection/list").anonymous()
.antMatchers("/wecom/chat/collection/cancleCollection").anonymous()
.antMatchers("/wecom/chat/collection/addCollection").anonymous()
.antMatchers("/wecom/chat/side/h5List").anonymous()
.antMatchers("/wecom/ticket/**").anonymous()
.antMatchers("/wecom/user/getUserInfo").anonymous()
// .antMatchers("/common/uploadFile2Cos").anonymous()
// .antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous()
.antMatchers("/wecom/portrait/**").anonymous()
.antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*", "/wecom/reward/getRewardByFissionId/**").anonymous()
// 获取实际群活码和社群运营H5页面不需要登录
.antMatchers("/wecom/groupCode/getActualCode/**").anonymous()
.antMatchers("/wecom/community/h5/**").anonymous()
//微信授权接口
.antMatchers("/weixin/auth/**").anonymous()
// .antMatchers("/profile/**").anonymous()
// .antMatchers("/common/download**").anonymous()
// .antMatchers("/common/download/resource**").anonymous()
// .antMatchers("/common/download/url**").anonymous()
// .antMatchers("/swagger-ui.html").anonymous()
// .antMatchers("/swagger-resources/**").anonymous()
// .antMatchers("/webjars/**").anonymous()
// .antMatchers("/*/api-docs").anonymous()
// .antMatchers("/druid/**").anonymous()
// .antMatchers("/wecom/callback/**").anonymous()
//
// .antMatchers("/wecom/chat/item/list").anonymous()
// .antMatchers("/wecom/chat/collection/list").anonymous()
// .antMatchers("/wecom/chat/collection/cancleCollection").anonymous()
// .antMatchers("/wecom/chat/collection/addCollection").anonymous()
// .antMatchers("/wecom/chat/side/h5List").anonymous()
// .antMatchers("/wecom/ticket/**").anonymous()
//
// .antMatchers("/wecom/user/getUserInfo").anonymous()
// // .antMatchers("/common/uploadFile2Cos").anonymous()
//// .antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous()
// .antMatchers("/wecom/portrait/**").anonymous()
// .antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*", "/wecom/reward/getRewardByFissionId/**").anonymous()
// // 获取实际群活码和社群运营H5页面不需要登录
// .antMatchers("/wecom/groupCode/getActualCode/**").anonymous()
// .antMatchers("/wecom/community/h5/**").anonymous()
// //微信授权接口
// .antMatchers("/weixin/auth/**").anonymous()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
......@@ -141,6 +155,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 添加CORS filter
httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
String join = StringUtils.join(ruoYiConfig.getAnonUrl(), ",");
}
......@@ -159,4 +175,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
}
}
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.model.LoginUser;
import com.linkwechat.common.enums.UserStatus;
import com.linkwechat.common.exception.BaseException;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.system.mapper.SysRoleMapper;
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.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,8 +14,6 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.stream.Collectors;
/**
* 用户验证处理
*
......@@ -41,19 +30,8 @@ public class UserDetailsServiceImpl implements UserDetailsService
@Autowired
private SysPermissionService permissionService;
@Autowired
private IWeUserService iWeUserService;
@Autowired
private RuoYiConfig ruoYiConfig;
@Autowired
private SysRoleMapper roleMapper;
@Autowired
private IWeCorpAccountService iWeCorpAccountService;
@Override
......@@ -62,6 +40,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
SysUser user = userService.selectUserByUserName(username);
if (StringUtils.isNull(user))
{
log.info("登录用户:{} 不存在.", username);
throw new BaseException("对不起,您的账号:" + username + " 不存在");
// //企业管理登录
// //查询企业管理相关账号
// WeCorpAccount weCorpByAccount = iWeCorpAccountService.findWeCorpByAccount(username);
......@@ -103,9 +84,9 @@ public class UserDetailsServiceImpl implements UserDetailsService
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// .build();
// }
userService.insertUser(
user
);
// userService.insertUser(
// user
// );
}
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
......
......@@ -3,7 +3,7 @@ gen:
# 作者
author: ruoyi
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.system
packageName: com.linkwechat
# 自动去除表前缀,默认是false
autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
......
package ${packageName}.controller;
package ${packageName}.web.controller.wecom;
import java.util.List;
import java.util.Arrays;
......
package ${packageName}.domain;
package ${packageName}.wecom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......
package ${packageName}.mapper;
package ${packageName}.wecom.mapper;
import ${packageName}.domain.${ClassName};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......
package ${packageName}.service;
package ${packageName}.wecom.service;
import ${packageName}.domain.${ClassName};
import com.baomidou.mybatisplus.extension.service.IService;
......
package ${packageName}.service.impl;
package ${packageName}.wecom.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......
package ${packageName}.domain;
package ${packageName}.wecom.domain;
#foreach ($import in $subImportList)
import ${import};
......
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"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">
#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"
</select>
<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 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 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>
<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 {
*/
@Request(url = "/service/get_provider_token",
type="POST")
WeAccessTokenDtoDto getProviderToken(@Body("corpid") String corpid,@Body("provider_secret") String provider_secret);
WeAccessTokenDtoDto getProviderToken(@Body("corpid") String corpid, @Body("provider_secret") String provider_secret);
/**
......
......@@ -33,5 +33,5 @@ public interface WeAppClient {
* @return
*/
@Request(url = "/agent/set",type = "POST")
WeResultDto updateAgentById(@DataObject WeAppDetailDto weAppDetailDto,@Header("agentid")String agentid);
WeResultDto updateAgentById(@DataObject WeAppDetailDto weAppDetailDto, @Header("agentid") String agentid);
}
......@@ -49,7 +49,7 @@ public interface WeCustomerClient {
* @return
*/
@Request(url = "/externalcontact/batch/get_by_user", type = "POST")
ExternalUserList getByUser(@DataObject Map<String,Object> query);
ExternalUserList getByUser(@DataObject Map<String, Object> query);
/**
......@@ -87,7 +87,7 @@ public interface WeCustomerClient {
*/
@Request(url = "/externalcontact/unionid_to_external_userid",
type = "POST")
ExternalUserDetail unionidToExternalUserid(@DataObject ExternalUserDetail.ExternalContact unionid);
ExternalUserDetail unionidToExternalUserid(@DataObject ExternalUserDetail.ExternalContact unionid);
/**
......
......@@ -24,7 +24,7 @@ public interface WeMessagePushClient {
@Request(url = "/message/send",
type = "POST"
)
WeMessagePushResultDto sendMessageToUser(@DataObject WeMessagePushDto weMessagePushDto,@Header("agentId") String agentId);
WeMessagePushResultDto sendMessageToUser(@DataObject WeMessagePushDto weMessagePushDto, @Header("agentId") String agentId);
/**
* 应用推送消息
......
......@@ -59,7 +59,7 @@ public interface WeUserClient {
* @return
*/
@Request(url="/user/list")
WeUserListDto list(@Query("department_id") Long departmentId,@Query("fetch_child") Integer fetchChild);
WeUserListDto list(@Query("department_id") Long departmentId, @Query("fetch_child") Integer fetchChild);
/**
......@@ -100,5 +100,5 @@ public interface WeUserClient {
* @return
*/
@Request(url = "/user/getuserinfo")
WeUserInfoDto getuserinfo(@Query("code")String code,@Header("agentId")String agentId);
WeUserInfoDto getuserinfo(@Query("code") String code, @Header("agentId") String agentId);
}
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@TableName("we_category")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("素材分类")
public class WeCategory extends BaseEntity {
private Long id = SnowFlakeUtil.nextId();
/**
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本
*/
@TableId
@ApiModelProperty("素材主键")
private Long id;
@ApiModelProperty("素材分类:0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本")
private String mediaType;
/**
* 分类名称
*/
@ApiModelProperty("分类名称")
private String name;
/**
* 父分类的id
*/
@ApiModelProperty("素材上级父节点id")
private Long parentId;
@ApiModelProperty("素材状态:0 未删除 2 已删除")
private String delFlag;
}
package com.linkwechat.wecom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
......@@ -20,11 +21,14 @@ public class WeCustomerPortrait {
private String flowerCustomerRelId;
//客户昵称
private String name;
//客户性别(0-未知 1-男性 2-女性)
private Integer gender;
//客户备注
private String remark;
//备注客户手机号
private String remarkMobiles;
//客户生日
@JsonFormat(pattern="yyyy-MM-dd")
private Date birthday;
//邮箱
private String email;
......@@ -40,6 +44,8 @@ public class WeCustomerPortrait {
private String description;
//年纪
private int age;
//客户头像
private String avatar;
//客户标签
private List<WeTagGroup> weTagGroupList;
......
......@@ -36,6 +36,15 @@ public class WeCustomerTrajectory {
//处理结束时间
private Time endTime;
//0:正常;1:删除;2:完成
private String status;
//当前员工的id
private String userId;
//当前应用的id
private String agentId;
}
......@@ -10,6 +10,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
......@@ -23,7 +24,7 @@ import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@TableName("we_tag")
public class WeTag
public class WeTag implements Serializable
{
/** 标签组id */
......
......@@ -60,6 +60,12 @@ public class WeTaskFissionCompleteRecord {
@ApiModelProperty("创建时间")
private Date createTime = new Date();
@ApiModelProperty("状态 0 有效 1 无效")
private Integer status;
@ApiModelProperty("客户头像")
private String customerAvatar;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -34,7 +34,7 @@ import java.util.Date;
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeUser
public class WeUser extends BaseEntity
{
private static final long serialVersionUID = 1L;
......@@ -123,7 +123,7 @@ public class WeUser
/** 是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 */
/** 激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除 */
@ApiModelProperty("激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业,6=删除")
private Integer isActivate;
private Integer isActivate=new Integer(4);
/** 离职是否分配(1:已分配;0:未分配;) */
@ApiModelProperty("离职是否分配(1:已分配;0:未分配;)")
......
......@@ -12,4 +12,5 @@ public class WeChatUserDTO {
private String userid;
private String unionid;
private String name;
private String avatar;
}
......@@ -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.MiniprogramMessageDto;
import com.linkwechat.wecom.domain.dto.message.TextMessageDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@SuppressWarnings("all")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeMessagePushDto {
/**
......
package com.linkwechat.wecom.domain.dto.message;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TextMessageDto {
/**
......
package com.linkwechat.wecom.domain.dto.message;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeCustomerMessagePushDto {
/**
......
......@@ -123,6 +123,9 @@ public class ConversationArchiveVo {
@ApiModel
@Data
private class Content{
@ApiModelProperty("文件路径")
private String attachment;
@ApiModelProperty("文本消息内容")
private String content;
......
......@@ -36,7 +36,7 @@ public class WeCallBackDelExternalContactImpl extends WeEventStrategy {
@Override
public void eventHandle(WxCpXmlMessageVO message) {
if (message.getExternalUserId() != null) {
weCustomerService.deleteCustomersByEid(message.getExternalUserId());
//weCustomerService.deleteCustomersByEid(message.getExternalUserId());
weFlowerCustomerRelService.deleteFollowUser(message.getUserId(), message.getExternalUserId());
//增加敏感行为记录,员工删除客户
......
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.wecom.domain.*;
import com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO;
import com.linkwechat.wecom.factory.WeEventStrategy;
import com.linkwechat.wecom.service.IWeGroupCodeActualService;
import com.linkwechat.wecom.service.IWeGroupService;
import com.linkwechat.wecom.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author danmo
* @description 客户群变更事件
......@@ -23,6 +28,18 @@ public class WeCallBackUpdateGroupImpl extends WeEventStrategy {
@Autowired
private IWeGroupCodeActualService groupCodeActualService;
@Autowired
private IWeTaskFissionService taskFissionService;
@Autowired
private IWeTaskFissionRecordService taskFissionRecordService;
@Autowired
private IWeTaskFissionCompleteRecordService taskFissionCompleteRecordService;
@Autowired
private IWeGroupMemberService groupMemberService;
@Override
public void eventHandle(WxCpXmlMessageVO message) {
try {
......@@ -31,10 +48,52 @@ public class WeCallBackUpdateGroupImpl extends WeEventStrategy {
if (updateDetail.equals(CallbackEventUpdateDetail.ADD_MEMBER.getType())) {
// 添加成员,该群的实际群活码扫码次数需要加1
groupCodeActualService.updateScanTimesByChatId(message.getChatId());
ThreadUtil.execAsync(() ->{
groupFissionEnterCheck(message.getChatId());
});
}
} catch (Exception e) {
e.printStackTrace();
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;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCategory;
import org.apache.ibatis.annotations.Param;
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> {
* @param userId 用户id
* @return 结果
*/
public int dropCollection(@Param("materialId") Long materialId,@Param("userId") String userId);
public int dropCollection(@Param("materialId") Long materialId, @Param("userId") String userId);
/**
* 通过素材id和用户id查询当前素材的收藏条数
......@@ -38,7 +38,7 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id
* @return 当前素材收藏的条数
*/
public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId,@Param("userId") String userId);
public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId, @Param("userId") String userId);
/**
* 收藏列表
......@@ -46,6 +46,6 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
* @param userId 用户id
* @return {@link WeChatSideVo}s
*/
public List<WeChatSideVo> findCollections(@Param("userId") String userId,@Param("keyword") String keyword);
public List<WeChatSideVo> findCollections(@Param("userId") String userId, @Param("keyword") String keyword);
}
......@@ -39,5 +39,5 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> {
* @param keyword 关键词
* @return
*/
public List<WeChatSideVo> findChatItems(@Param("sideId") Long sideId, @Param("keyword") String keyword,@Param("mediaType") String mediaType,@Param("userId") String userId);
public List<WeChatSideVo> findChatItems(@Param("sideId") Long sideId, @Param("keyword") String keyword, @Param("mediaType") String mediaType, @Param("userId") String userId);
}
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 org.apache.ibatis.annotations.Param;
......@@ -10,47 +10,8 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi
* @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
* @param corpId
* @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>
* @param userid
* @return
*/
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(@Param("externalUserid") String externalUserid,@Param("userid") String userid);
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(@Param("externalUserid") String externalUserid, @Param("userid") String userid);
/**
......@@ -96,7 +96,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param userid 员工id
* @return
*/
WeCustomerSocialConn countSocialConn(@Param("externalUserid")String externalUserid,@Param("userid")String userid);
WeCustomerSocialConn countSocialConn(@Param("externalUserid") String externalUserid, @Param("userid") String userid);
}
......@@ -20,7 +20,7 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> {
* @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群)
* @return int
*/
int updateWeCustomerMessageActualSend(@Param("messageId") Long messageId,@Param("actualSend") Integer actualSend);
int updateWeCustomerMessageActualSend(@Param("messageId") Long messageId, @Param("actualSend") Integer actualSend);
/**
* 更新消息发送状态
......@@ -28,6 +28,6 @@ public interface WeCustomerMessageMapper extends BaseMapper<WeCustomerMessage> {
* @param status 消息发送状态 0 未发送 1 已发送
* @return int
*/
int updateWeCustomerMessageCheckStatusById(@Param("messageId") Long messageId,@Param("status") String status);
int updateWeCustomerMessageCheckStatusById(@Param("messageId") Long messageId, @Param("status") String status);
}
......@@ -25,8 +25,8 @@ public interface WeCustomerMessageOriginalMapper extends BaseMapper<WeCustomerMe
* @param endTime 结束时间
* @return {@link CustomerMessagePushVo}s
*/
public List<CustomerMessagePushVo> selectCustomerMessagePushs(@Param("sender") String sender,@Param("content") String content
,@Param("pushType") String pushType, @Param("beginTime") String beginTime,@Param("endTime") String endTime);
public List<CustomerMessagePushVo> selectCustomerMessagePushs(@Param("sender") String sender, @Param("content") String content
, @Param("pushType") String pushType, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
/**
* 群发详情
......
......@@ -26,8 +26,8 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
* @param sendTime 发送时间,发送状态为1时返回(为时间戳的形式)
* @return int
*/
int updateWeCustomerMessgaeResult(@Param("messageId") Long messageId,@Param("chatId") String chatId,@Param("externalUserid") String externalUserid
,@Param("status") String status,@Param("sendTime") String sendTime);
int updateWeCustomerMessgaeResult(@Param("messageId") Long messageId, @Param("chatId") String chatId, @Param("externalUserid") String externalUserid
, @Param("status") String status, @Param("sendTime") String sendTime);
/**
* 查询微信消息发送情况
......@@ -36,7 +36,7 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
* @param status 发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败
* @return {@link WeCustomerMessageResultVo}s
*/
List<WeCustomerMessageResultVo> customerMessagePushs(@Param("messageId") Long messageId,@Param("status") String status);
List<WeCustomerMessageResultVo> customerMessagePushs(@Param("messageId") Long messageId, @Param("status") String status);
/**
* 检查是否已经同步群发结果
......
......@@ -29,5 +29,5 @@ public interface WeGroupMapper extends BaseMapper<WeGroup> {
//
// int batchInsetWeGroup(@Param("weGroups") List<WeGroup> weGroups);
List<WeCustomerAddGroup> findWeGroupByCustomer(@Param("userId") String userId,@Param("externalUserid") String externalUserid);
List<WeCustomerAddGroup> findWeGroupByCustomer(@Param("userId") String userId, @Param("externalUserid") String externalUserid);
}
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeTaskFission;
import java.util.List;
......@@ -10,7 +11,7 @@ import java.util.List;
* @author leejoker
* @date 2021-01-20
*/
public interface WeTaskFissionMapper {
public interface WeTaskFissionMapper extends BaseMapper<WeTaskFission> {
/**
* 查询任务宝
*
......
......@@ -7,7 +7,6 @@ import com.linkwechat.wecom.domain.vo.WeAllocateCustomersVo;
import com.linkwechat.wecom.domain.vo.WeAllocateGroupsVo;
import com.linkwechat.wecom.domain.vo.WeLeaveUserVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -17,7 +16,6 @@ import java.util.List;
* @author ruoyi
* @date 2020-08-31
*/
@Repository
public interface WeUserMapper extends BaseMapper<WeUser>
{
/**
......
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.common.core.domain.Tree;
import com.linkwechat.wecom.domain.WeCategory;
import com.linkwechat.wecom.domain.vo.WeCategoryVo;
......@@ -7,39 +8,23 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IWeCategoryService {
public interface IWeCategoryService extends IService<WeCategory> {
/**
* 保存素材分类
*
* @param category 素材分类 信息
* @return {@link int}
*/
int insertWeCategory(WeCategory category);
void insertWeCategory(WeCategory 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 {
*/
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> {
* @param userId 用户id
* @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> {
* @param userId 用户id
* @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> {
* @param userId 用户id
* @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> {
* @param sideId 侧边栏id
* @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;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import java.util.List;
/**
* 企业id相关配置Service接口
*
* @author ruoyi
* @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相关配置
......@@ -42,7 +19,7 @@ public interface IWeCorpAccountService
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount);
void updateWeCorpAccount(WeCorpAccount wxCorpAccount);
......@@ -51,27 +28,27 @@ public interface IWeCorpAccountService
*
* @return 结果
*/
public WeCorpAccount findValidWeCorpAccount();
WeCorpAccount findValidWeCorpAccount();
/**
* 启用有效的企业微信账号
* @param corpId
*/
public int startVailWeCorpAccount(String corpId);
int startVailWeCorpAccount(String corpId);
/**
* 客户流失通知开关
* @param status 开关状态
* @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
* @param endTime 结束时间
* @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 {
* @param endTime 结束时间
* @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> {
* @param actualSend 实际发送消息数(客户对应多少人 客户群对应多个群)
* @return int
*/
int updateWeCustomerMessageActualSend( Long messageId, Integer actualSend);
int updateWeCustomerMessageActualSend(Long messageId, Integer actualSend);
/**
* 保存微信消息 WeCustomerMessage
......@@ -33,7 +33,7 @@ public interface IWeCustomerMessageService extends IService<WeCustomerMessage> {
* @param customerMessagePushDto
* @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> {
* @param messageId
* @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>
* @param userid
* @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;
public interface IWeCustomerTrajectoryService extends IService<WeCustomerTrajectory> {
void waitHandleMsg(String url);
}
......@@ -17,4 +17,5 @@ public interface IWeGroupMemberService extends IService<WeGroupMember> {
List<WeGroupMemberDto> selectWeGroupMemberListByChatId(String chatId);
WeGroupMember selectWeGroupMemberByUnionId(String chatId, String unionId);
}
......@@ -28,5 +28,5 @@ public interface IWeGroupService extends IService<WeGroup> {
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 {
* @param search 搜索值
* @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 {
* @param name 素材名称
* @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> {
* @param fontStyle 字体类型 0 通常 1 粗体 2 斜体
* @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>
* @param tagGroup
* @param isSync
*/
public void batchSaveOrUpdateTagGroupAndTag(List<WeCropGroupTagDto> tagGroup,Boolean isSync);
public void batchSaveOrUpdateTagGroupAndTag(List<WeCropGroupTagDto> tagGroup, Boolean isSync);
void createTagGroup(String id);
......
......@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeTaskFissionCompleteRecord;
import java.util.Date;
import java.util.List;
import java.util.Set;
/**
* 裂变任务完成记录Service接口
......@@ -63,4 +64,18 @@ public interface IWeTaskFissionCompleteRecordService extends IService<WeTaskFiss
public int deleteWeTaskFissionCompleteRecordById(Long id);
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;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeTaskFission;
import com.linkwechat.wecom.domain.dto.WeChatUserDTO;
......@@ -17,7 +18,7 @@ import java.util.List;
* @author leejoker
* @date 2021-01-20
*/
public interface IWeTaskFissionService {
public interface IWeTaskFissionService extends IService<WeTaskFission> {
/**
* 查询任务宝
*
......@@ -100,4 +101,11 @@ public interface IWeTaskFissionService {
* @return
*/
public void updateExpiredWeTaskFission();
/**
* 根据群活码id 查询任务列表
* @param groupCodeId 群活码id
* @return
*/
List<WeTaskFission> getTaskFissionListByGroupCodeId(Long groupCodeId);
}
......@@ -25,7 +25,7 @@ public interface IWeUserBehaviorDataService extends IService<WeUserBehaviorData>
* @param dateTime
* @return WeUserBehaviorDataDto
*/
WePageCountDto getCountDataByDay(String dateTime,String type);
WePageCountDto getCountDataByDay(String dateTime, String type);
/**
* 按天维度查询数据统计
......
......@@ -145,7 +145,7 @@ public interface IWeUserService extends IService<WeUser>
* @param code
* @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;
* @date 2021/4/5 22:45
**/
public interface IWxAuthService {
WxTokenDto getToken(String code,String openId);
WxTokenDto getToken(String code, String openId);
WxAuthUserInfoDto getUserInfo(String openId, String lang);
}
package com.linkwechat.wecom.service.impl;
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.exception.wecom.WeComException;
import com.linkwechat.common.utils.SnowFlakeUtil;
......@@ -10,7 +13,6 @@ import com.linkwechat.wecom.domain.vo.WeCategoryVo;
import com.linkwechat.wecom.mapper.WeCategoryMapper;
import com.linkwechat.wecom.service.IWeCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
......@@ -18,47 +20,49 @@ import java.util.List;
@Slf4j
@Service
public class WeCategoryServiceImpl implements IWeCategoryService {
public class WeCategoryServiceImpl extends ServiceImpl<WeCategoryMapper,WeCategory> implements IWeCategoryService {
@Autowired
private WeCategoryMapper weCategoryMapper;
@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) {
throw new WeComException("名称已存在!");
}
category.setCreateTime(DateUtil.date());
category.setId(SnowFlakeUtil.nextId());
return weCategoryMapper.insertWeCategory(category);
this.save(category);
}
@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) {
throw new WeComException("名称已存在!");
}
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
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<>();
weCategories.forEach(c -> {
WeCategoryVo weCategoryVo = new WeCategoryVo();
......@@ -70,10 +74,6 @@ public class WeCategoryServiceImpl implements IWeCategoryService {
return TreeUtil.build(weCategoryVos);
}
@Override
public WeCategory findWeCategoryById(Long id) {
return weCategoryMapper.findWeCategoryById(id);
}
}
package com.linkwechat.wecom.service.impl;
import java.util.List;
import java.util.Optional;
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.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.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired;
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业务层处理
......@@ -19,51 +20,14 @@ import com.linkwechat.common.core.domain.entity.WeCorpAccount;
* @date 2020-08-24
*/
@Service
public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
public class WeCorpAccountServiceImpl extends ServiceImpl<WeCorpAccountMapper,WeCorpAccount> implements IWeCorpAccountService {
@Autowired
private WeCorpAccountMapper weCorpAccountMapper;
@Autowired
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相关配置
......@@ -72,18 +36,16 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
* @return 结果
*/
@Override
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount)
public void updateWeCorpAccount(WeCorpAccount wxCorpAccount)
{
int returnCode = weCorpAccountMapper.updateWeCorpAccount(wxCorpAccount);
if(Constants.SERVICE_RETURN_SUCCESS_CODE<returnCode){
if(this.updateById(wxCorpAccount)){
iWeAccessTokenService.removeToken();
}
return returnCode;
}
......@@ -95,7 +57,10 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
*/
@Override
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 {
@Override
public int startVailWeCorpAccount(String corpId) {
int returnCode = weCorpAccountMapper.startVailWeCorpAccount(corpId);
int returnCode = this.baseMapper.startVailWeCorpAccount(corpId);
if(Constants.SERVICE_RETURN_SUCCESS_CODE<returnCode){
......@@ -120,24 +85,20 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
}
@Override
public int startCustomerChurnNoticeSwitch(String status) {
public void startCustomerChurnNoticeSwitch(String status) {
WeCorpAccount validWeCorpAccount = findValidWeCorpAccount();
validWeCorpAccount.setCustomerChurnNoticeSwitch(status);
return weCorpAccountMapper.updateWeCorpAccount(validWeCorpAccount);
this.updateWeCorpAccount(validWeCorpAccount);
}
@Override
public String getCustomerChurnNoticeSwitch() {
WeCorpAccount validWeCorpAccount = weCorpAccountMapper.findValidWeCorpAccount();
WeCorpAccount validWeCorpAccount = this.findValidWeCorpAccount();
String noticeSwitch = Optional.ofNullable(validWeCorpAccount).map(WeCorpAccount::getCustomerChurnNoticeSwitch)
.orElse(WeConstans.DEL_FOLLOW_USER_SWITCH_CLOSE);
return noticeSwitch;
}
@Override
public WeCorpAccount findWeCorpByAccount(String corpAccount) {
return weCorpAccountMapper.findWeCorpByAccount(corpAccount);
}
}
......@@ -74,17 +74,24 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
@Transactional(rollbackFor = Exception.class)
public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException {
if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime()))
&& DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) {
throw new WeComException("发送时间不能小于当前时间");
// if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime()))
// && 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("发送时间不能小于当前时间");
}
}
/*if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){
throw new WeComException("发送时间不能为空");
}*/
List<WeCustomer> customers = Lists.newArrayList();
List<WeGroup> groups = new ArrayList<>();
// 0 发给客户
......
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.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.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.service.IWeCustomerMessageService;
import com.linkwechat.wecom.service.IWeCustomerService;
import com.linkwechat.wecom.service.IWeCustomerTrajectoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
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;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeGroupMember;
import com.linkwechat.wecom.domain.dto.WeGroupMemberDto;
......@@ -29,5 +30,12 @@ public class WeGroupMemberServiceImpl extends ServiceImpl<WeGroupMemberMapper,We
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;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 裂变任务完成记录Service业务层处理
......@@ -96,4 +98,23 @@ public class WeTaskFissionCompleteRecordServiceImpl extends ServiceImpl<WeTaskFi
orderByAsc(WeTaskFissionCompleteRecord::getCreateTime);
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
@Override
public WeTaskFissionRewardVo getRewardByFissionId(String fissionId, String unionId) {
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){
throw new WeComException("任务信息不存在");
}
......@@ -128,7 +125,7 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi
});
WeTaskFissionReward fissionReward = weTaskFissionRewardMapper.selectOne(new LambdaQueryWrapper<WeTaskFissionReward>()
.eq(WeTaskFissionReward::getTaskFissionId, fissionId)
.eq(WeTaskFissionReward::getRewardUserId, customerUnionId));
.eq(WeTaskFissionReward::getRewardUserId, unionId));
weTaskFissionRewardVo.setWeTaskFissionReward(fissionReward);
//发放兑奖码之后,置为已使用
Optional.ofNullable(fissionReward).ifPresent(reward -> weTaskFissionRewardMapper.update(reward, new LambdaUpdateWrapper<WeTaskFissionReward>()
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.collect.Lists;
import com.linkwechat.common.config.CosConfig;
......@@ -52,7 +53,7 @@ import java.util.stream.Collectors;
*/
@Slf4j
@Service
public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, WeTaskFission> implements IWeTaskFissionService {
@Autowired
private WeTaskFissionMapper weTaskFissionMapper;
@Autowired
......@@ -77,10 +78,13 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
private IWeFlowerCustomerRelService weFlowerCustomerRelService;
@Autowired
private IWeTaskFissionCompleteRecordService weTaskFissionCompleteRecordService;
@Autowired
private CosConfig cosConfig;
@Value("${H5.url}")
@Value("${H5.fissionUrl}")
private String pageUrl;
@Value("${H5.fissionGroupUrl}")
private String pageGroupUrl;
/**
* 查询任务宝
......@@ -154,7 +158,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
int updateResult = weTaskFissionMapper.updateWeTaskFission(weTaskFission);
if (updateResult > 0) {
if (CollectionUtils.isNotEmpty(weTaskFission.getTaskFissionStaffs())) {
log.info("发起成员信息:【{}】",JSONObject.toJSONString(weTaskFission.getTaskFissionStaffs()));
log.info("发起成员信息:【{}】", JSONObject.toJSONString(weTaskFission.getTaskFissionStaffs()));
List<WeTaskFissionStaff> staffList = weTaskFissionStaffService.selectWeTaskFissionStaffByTaskId(weTaskFission.getId());
if (CollectionUtils.isNotEmpty(staffList)) {
weTaskFissionStaffService.deleteWeTaskFissionStaffByIds(staffList.stream().map(WeTaskFissionStaff::getId).toArray(Long[]::new));
......@@ -206,7 +210,6 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
.append("fissionTargetId=").append(fissStaffId)
.append("&")
.append("posterId=").append(weTaskFission.getPostersId());
LinkMessageDto linkMessageDto = new LinkMessageDto();
linkMessageDto.setPicurl(postersPath);
linkMessageDto.setDesc(weTaskFission.getFissInfo());
......@@ -214,7 +217,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
linkMessageDto.setUrl(pageUrlBuilder.toString());
CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto();
if (weTaskFission.getStartTime() != null){
if (weTaskFission.getStartTime() != null) {
customerMessagePushDto.setSettingTime(DateUtil.formatDateTime(weTaskFission.getStartTime()));
}
customerMessagePushDto.setLinkMessage(linkMessageDto);
......@@ -284,12 +287,12 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
WeTaskFissionCompleteRecord wfcr = new WeTaskFissionCompleteRecord();
wfcr.setTaskFissionId(taskFissionId);
wfcr.setFissionRecordId(taskFissionRecordId);
String userId = StringUtils.isBlank(weChatUserDTO.getUserid()) ? weChatUserDTO.getUnionid() : weChatUserDTO.getUserid();
wfcr.setCustomerId(userId);
wfcr.setCustomerId(weChatUserDTO.getUnionid());
wfcr.setCustomerName(weChatUserDTO.getName());
List<WeTaskFissionCompleteRecord> list = weTaskFissionCompleteRecordService.selectWeTaskFissionCompleteRecordList(wfcr);
if (CollectionUtils.isEmpty(list)) {
wfcr.setCreateTime(new Date());
wfcr.setCustomerAvatar(weChatUserDTO.getAvatar());
weTaskFissionCompleteRecordService.insertWeTaskFissionCompleteRecord(wfcr);
}
}
......@@ -311,9 +314,9 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
.eq(WeFlowerCustomerRel::getState, WeConstans.FISSION_PREFIX + weTaskFissionRecord.getId()));
List<String> eidList = Optional.ofNullable(list).orElseGet(ArrayList::new).stream()
.map(WeFlowerCustomerRel::getExternalUserid).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(eidList)){
if (CollectionUtil.isNotEmpty(eidList)) {
return weCustomerService.listByIds(eidList);
}else {
} else {
return null;
}
}
......@@ -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<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();
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 -> {
WeTaskFissionDailyDataVO v = new WeTaskFissionDailyDataVO();
v.setDay(date);
......@@ -355,24 +358,48 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
@Override
public WeTaskFissionProgressVO getCustomerTaskProgress(WeTaskFission taskFission, String unionId) {
long complete = 0L;
long total = taskFission.getFissNum();
List<WeCustomer> list = getCustomerListById(unionId, String.valueOf(taskFission.getId()));
if (CollectionUtils.isNotEmpty(list)) {
complete = list.size();
List<WeCustomer> list = new ArrayList<>();
if (taskFission.getFissionType() == 1) {
list.addAll(getCustomerListById(unionId, String.valueOf(taskFission.getId())));
} 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
*/
@Override
public void updateExpiredWeTaskFission() {
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 **************************************/
......@@ -408,11 +435,14 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
private String getGroupFissionQrcode(Long taskFissionId, WeTaskFissionRecord record, WeCustomer weCustomer) {
String qrCode = null;
if (weCustomer != null) {
String avatar = weCustomer.getAvatar();
WeMaterial file = weMaterialService.findWeMaterialById(Long.parseLong(avatar));
String avatarUrl = StringUtils.isEmpty(avatar) ? file.getMaterialUrl() : avatar;
String content = "/wecom/fission/complete/" + taskFissionId + "/records/" + record.getId();
BufferedImage bufferedImage = QREncode.crateQRCode(content, avatarUrl);
String avatarUrl = weCustomer.getAvatar();
StringBuilder contentBuilder = new StringBuilder(pageGroupUrl);
contentBuilder.append("?")
.append("fissionId=")
.append(taskFissionId)
.append("&recordId=")
.append(record.getId());
BufferedImage bufferedImage = QREncode.crateQRCode(contentBuilder.toString(), avatarUrl);
if (bufferedImage != null) {
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
ImageIO.write(bufferedImage, "png", byteArrayOutputStream);
......@@ -423,7 +453,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
throw new WeComException("生成二维码异常");
}
}
return qrCode;
return cosConfig.getImgUrlPrefix() + qrCode;
} else {
throw new WeComException("生成二维码异常,用户信息不存在");
}
......
......@@ -20,6 +20,7 @@ import com.linkwechat.wecom.service.IWeGroupService;
import com.linkwechat.wecom.service.IWeUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -102,7 +103,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
{
if(this.save(weUser)){
if(this.insertWeUserNoToWeCom(weUser) > 0){
weUserClient.createUser(
weUser.transformWeUserDto()
);
......@@ -215,6 +216,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
*/
@Override
@Transactional
@Async
public void synchWeUser(){
//同步部门
......
......@@ -3,92 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<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>
\ No newline at end of file
......@@ -3,125 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<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">
......@@ -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"
AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
<if test="status != null and status !=''">
AND wfcr.status = #{status}
</if>
<if test="tagIds != null and tagIds !=''">
<if test="tagIds.indexOf(',') != -1">
AND wt.tag_id in
......@@ -154,7 +152,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
OR wu.department=#{departmentIds}
</if>
</if>
<if test="status !=null and status !=''">
AND wfcr.status=#{status}
</if>
......@@ -317,7 +314,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wfcr.remark_corp_name,
wfcr.description,
wfcr.id as flowerCustomerRelId,
wfcr.user_id
wfcr.user_id,
wc.avatar,
wfcr.external_userid,
wc.gender
FROM
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr on wc.external_userid=wfcr.external_userid
......
......@@ -36,26 +36,26 @@
<sql id="getQrcodeByUserIdVo">
select
wec.id,
wec.code_type,
wec.skip_verify,
wec.scenario,
wec.welcome_msg,
wec.create_by,
wec.create_time,
wec.del_flag,
wec.config_id,
wec.state,
wec.qr_code,
wec.scan_times
wec.id,
wec.code_type,
wec.skip_verify,
wec.scenario,
wec.welcome_msg,
wec.create_by,
wec.create_time,
wec.del_flag,
wec.config_id,
wec.state,
wec.qr_code,
wec.scan_times
from we_emple_code wec
left join we_emple_code_use_scop wecus on wec.id = wecus.emple_code_id
and wecus.business_id_type = 2
and wecus.del_flag = 0
left join we_emple_code_use_scop wecus on wec.id = wecus.emple_code_id
and wecus.business_id_type = 2
and wecus.del_flag = 0
</sql>
<sql id="selectWeEmpleCodeLsit">
select
select
wecode.id,
wecode.code_type,
wecode.media_id,
......@@ -77,21 +77,21 @@
wecode.is_join_confirm_friends
from
we_emple_code wecode
left join (
SELECT
wecus.emple_code_id, wecus.business_id, wecus.business_name,wu.mobile
FROM
we_emple_code_use_scop wecus
LEFT JOIN we_user wu ON
wu.user_id = wecus.business_id
WHERE
wecus.del_flag = 0
) as wecusn on
wecode.id = wecusn.emple_code_id
left join we_emple_code_tag wect on
wecode.id = wect.emple_code_id
left join (
SELECT
wecus.emple_code_id, wecus.business_id, wecus.business_name,wu.mobile
FROM
we_emple_code_use_scop wecus
LEFT JOIN we_user wu ON
wu.user_id = wecus.business_id
WHERE
wecus.del_flag = 0
) as wecusn on
wecode.id = wecusn.emple_code_id
left join we_emple_code_tag wect on
wecode.id = wect.emple_code_id
where 1=1 and wecode.del_flag = 0
</sql>
</sql>
<select id="selectWeEmpleCodeList" parameterType="WeEmpleCode" resultType="com.linkwechat.wecom.domain.WeEmpleCode">
<include refid="selectWeEmpleCodeLsit"/>
......
......@@ -150,11 +150,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sum(ifnull(wgs.msg_total, 0)) msg_total,
date_format(wgs.stat_time, '%Y-%m') as finish_date
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
order by finish_date
) as tbr on tbl._date = tbr.finish_date
......
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"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">
<result property="id" column="id"/>
......@@ -11,10 +11,12 @@
<result property="customerId" column="customer_id"/>
<result property="customerName" column="customer_name"/>
<result property="createTime" column="create_time"/>
<result property="status" column="status"/>
<result property="customerAvatar" column="customer_avatar"/>
</resultMap>
<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
</sql>
......@@ -25,6 +27,7 @@
<if test="taskFissionId != null ">and task_fission_id = #{taskFissionId}</if>
<if test="fissionRecordId != null ">and fission_record_id = #{fissionRecordId}</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>
......@@ -46,6 +49,8 @@
<if test="customerId != null and customerId != ''">customer_id,</if>
<if test="customerName != null">customer_name,</if>
<if test="createTime != null">create_time,</if>
<if test="status != null">status,</if>
<if test="customerAvatar != null">customer_avatar,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskFissionId != null">#{taskFissionId},</if>
......@@ -53,6 +58,8 @@
<if test="customerId != null and customerId != ''">#{customerId},</if>
<if test="customerName != null">#{customerName},</if>
<if test="createTime != null">#{createTime},</if>
<if test="status != null">#{status},</if>
<if test="customerAvatar != null">#{customerAvatar},</if>
</trim>
</insert>
......@@ -64,6 +71,8 @@
<if test="customerId != null and customerId != ''">customer_id = #{customerId},</if>
<if test="customerName != null">customer_name = #{customerName},</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>
where id = #{id}
</update>
......
......@@ -149,11 +149,6 @@
sum(ifnull(wubd.negative_feedback_cnt, 0)) negative_feedback_cnt,
date_format(wubd.stat_time, '%Y-%m') as finish_date
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
order by finish_date
) as tbr on tbl._date = tbr.finish_date
......
......@@ -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="position != null and position != ''"> and position = #{position}</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="qqAccount != null and qqAccount != ''"> and qq_account = #{qqAccount}</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!