Commit 9df7f1b7 by 1539136324@qq.com

Merge remote-tracking branch 'origin/back_end_dev' into back_end_dev

# Conflicts:
#	linkwe-framework/src/main/java/com/linkwechat/framework/config/SecurityConfig.java
2 parents 1183ea37 26a6d31d
Showing 35 changed files with 215 additions and 225 deletions
...@@ -12,7 +12,7 @@ import com.linkwechat.framework.web.service.SysPermissionService; ...@@ -12,7 +12,7 @@ import com.linkwechat.framework.web.service.SysPermissionService;
import com.linkwechat.framework.web.service.TokenService; import com.linkwechat.framework.web.service.TokenService;
import com.linkwechat.system.service.ISysMenuService; import com.linkwechat.system.service.ISysMenuService;
import com.linkwechat.wecom.client.WeAccessTokenClient; import com.linkwechat.wecom.client.WeAccessTokenClient;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.wecom.domain.dto.WeLoginUserInfoDto; import com.linkwechat.wecom.domain.dto.WeLoginUserInfoDto;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -149,11 +149,24 @@ public class SysLoginController ...@@ -149,11 +149,24 @@ public class SysLoginController
String token = loginService.noPwdLogin(loginInfo.getUser_info().getUserid()); String token = loginService.noPwdLogin(loginInfo.getUser_info().getUserid());
ajax.put(Constants.TOKEN, token); ajax.put(Constants.TOKEN, token);
} }
return ajax; return ajax;
}
/**
* 租户登录
* @param corpId
* @param corpSecret
* @return
*/
@GetMapping("/tenantLogin")
public AjaxResult tenantLogin(String corpId,String corpSecret){
AjaxResult ajax = AjaxResult.success();
return ajax;
} }
} }
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.HttpStatus;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.CollectionUtil;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
...@@ -18,6 +19,7 @@ import org.springframework.security.core.context.SecurityContextHolder; ...@@ -18,6 +19,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -151,4 +153,25 @@ public class WeCustomerController extends BaseController ...@@ -151,4 +153,25 @@ public class WeCustomerController extends BaseController
} }
/**
* 查询企业微信客户列表(六感)
*/
// @PreAuthorize("@ss.hasPermi('customerManage:customer:list')")
@GetMapping("/listConcise")
public TableDataInfo listConcise(WeCustomer weCustomer)
{
startPage();
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
if(CollectionUtil.isNotEmpty(list)){
list.stream().forEach(k->{
k.setWeFlowerCustomerRels(new ArrayList<>());
});
}
return getDataTable(list);
}
} }
...@@ -153,11 +153,18 @@ public class WeCustomerPortraitController extends BaseController { ...@@ -153,11 +153,18 @@ public class WeCustomerPortraitController extends BaseController {
@GetMapping(value = "/findTrajectory") @GetMapping(value = "/findTrajectory")
public TableDataInfo findTrajectory(Integer trajectoryType){ public TableDataInfo findTrajectory(Integer trajectoryType){
startPage(); startPage();
LambdaQueryWrapper<WeCustomerTrajectory> ne = new LambdaQueryWrapper<WeCustomerTrajectory>()
.ne(WeCustomerTrajectory::getStatus, Constants.DELETE_CODE);
if(trajectoryType != null){
ne.eq(WeCustomerTrajectory::getTrajectoryType, trajectoryType);
}
return getDataTable( return getDataTable(
iWeCustomerTrajectoryService.list(new LambdaQueryWrapper<WeCustomerTrajectory>() iWeCustomerTrajectoryService.list(ne)
.eq(WeCustomerTrajectory::getTrajectoryType,trajectoryType)
.ne(WeCustomerTrajectory::getStatus,Constants.DELETE_CODE))
); );
} }
......
...@@ -2,7 +2,6 @@ package com.linkwechat.web.controller.wecom; ...@@ -2,7 +2,6 @@ package com.linkwechat.web.controller.wecom;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
//import com.alibaba.nacos.common.utils.CollectionUtils; //import com.alibaba.nacos.common.utils.CollectionUtils;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -152,12 +151,6 @@ public class WeTaskFissionController extends BaseController { ...@@ -152,12 +151,6 @@ public class WeTaskFissionController extends BaseController {
CopyOptions options = CopyOptions.create(); CopyOptions options = CopyOptions.create();
options.setIgnoreNullValue(true); options.setIgnoreNullValue(true);
BeanUtil.copyProperties(weTaskFission, fissionTask, options); BeanUtil.copyProperties(weTaskFission, fissionTask, options);
if (CollectionUtil.isNotEmpty(weTaskFission.getTaskFissionStaffs())) {
fissionTask.setTaskFissionStaffs(weTaskFission.getTaskFissionStaffs());
}
if (CollectionUtil.isNotEmpty(weTaskFission.getTaskFissionWeGroups())) {
fissionTask.setTaskFissionWeGroups(weTaskFission.getTaskFissionWeGroups());
}
Long id = weTaskFissionService.updateWeTaskFission(fissionTask); Long id = weTaskFissionService.updateWeTaskFission(fissionTask);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("id", id); json.put("id", id);
...@@ -229,7 +222,7 @@ public class WeTaskFissionController extends BaseController { ...@@ -229,7 +222,7 @@ public class WeTaskFissionController extends BaseController {
public AjaxResult<JSONObject> upload(@RequestParam(value = "file") MultipartFile file) throws IOException { public AjaxResult<JSONObject> upload(@RequestParam(value = "file") MultipartFile file) throws IOException {
String url = FileUploadUtils.upload2Cos(file, cosConfig); String url = FileUploadUtils.upload2Cos(file, cosConfig);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("rewardImageUrl", cosConfig.getImgUrlPrefix()+url); json.put("rewardImageUrl", url);
return AjaxResult.success(json); return AjaxResult.success(json);
} }
......
...@@ -106,9 +106,9 @@ public class WeTaskFissionRewardController extends BaseController { ...@@ -106,9 +106,9 @@ public class WeTaskFissionRewardController extends BaseController {
*/ */
@ApiOperation(value = "根据微信用户id和任务id获取任务裂变奖励详细信息",httpMethod = "GET") @ApiOperation(value = "根据微信用户id和任务id获取任务裂变奖励详细信息",httpMethod = "GET")
// @PreAuthorize("@ss.hasPermi('wecom:getRewardByFissionId:query')") // @PreAuthorize("@ss.hasPermi('wecom:getRewardByFissionId:query')")
@GetMapping(value = "/getRewardByFissionId/{fissionId}/{unionId}") @GetMapping(value = "/getRewardByFissionId/{fissionId}/{eid}")
public AjaxResult<WeTaskFissionRewardVo> getRewardByFissionId(@ApiParam("任务id") @PathVariable("fissionId") String fissionId public AjaxResult<WeTaskFissionRewardVo> getRewardByFissionId(@ApiParam("任务id") @PathVariable("fissionId") String fissionId
, @PathVariable("unionId") @ApiParam("客户id") String unionId) { , @PathVariable("eid") @ApiParam("客户id") String eid) {
return AjaxResult.success(weTaskFissionRewardService.getRewardByFissionId(fissionId,unionId)); return AjaxResult.success(weTaskFissionRewardService.getRewardByFissionId(fissionId,eid));
} }
} }
...@@ -151,10 +151,16 @@ public class Constants ...@@ -151,10 +151,16 @@ public class Constants
public static final String USER_TYPE_WECOME="11"; public static final String USER_TYPE_WECOME="11";
/** 企业管理 */
public static final String USER_TYOE_CORP_ADMIN="22";
/** 企业微信用户系统中默认用户 */ /** 企业微信用户系统中默认用户 */
public static final String DEFAULT_WECOME_ROLE_KEY="WeCome"; public static final String DEFAULT_WECOME_ROLE_KEY="WeCome";
/** 企业微信用户系统中默认用户 */
public static final String DEFAULT_WECOME_CORP_ADMIN="CROP_ADMIN_ROLE";
/**完成待办*/ /**完成待办*/
public static final String HANDLE_SUCCESS="1"; public static final String HANDLE_SUCCESS="1";
......
...@@ -105,6 +105,9 @@ public class SysUser extends BaseEntity ...@@ -105,6 +105,9 @@ public class SysUser extends BaseEntity
/** 是否具有有效得cropId */ /** 是否具有有效得cropId */
private boolean validCropId=false; private boolean validCropId=false;
private WeCorpAccount weCorpAccount;
public SysUser() public SysUser()
{ {
......
package com.linkwechat.wecom.domain; package com.linkwechat.common.core.domain.entity;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
...@@ -76,4 +76,8 @@ public class WeCorpAccount extends BaseEntity ...@@ -76,4 +76,8 @@ public class WeCorpAccount extends BaseEntity
@ApiModelProperty("客户流失通知开关 0:关闭 1:开启") @ApiModelProperty("客户流失通知开关 0:关闭 1:开启")
private String customerChurnNoticeSwitch = new String("0"); private String customerChurnNoticeSwitch = new String("0");
@ApiModelProperty("企业管理员账号")
private String cropAccount;
} }
...@@ -12,7 +12,8 @@ import com.linkwechat.common.utils.SecurityUtils; ...@@ -12,7 +12,8 @@ import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.system.mapper.SysRoleMapper; import com.linkwechat.system.mapper.SysRoleMapper;
import com.linkwechat.system.service.ISysUserService; import com.linkwechat.system.service.ISysUserService;
import com.linkwechat.wecom.domain.WeUser; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.wecom.service.IWeCorpAccountService;
import com.linkwechat.wecom.service.IWeUserService; import com.linkwechat.wecom.service.IWeUserService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -51,35 +52,57 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -51,35 +52,57 @@ public class UserDetailsServiceImpl implements UserDetailsService
private SysRoleMapper roleMapper; private SysRoleMapper roleMapper;
@Autowired
private IWeCorpAccountService iWeCorpAccountService;
@Override @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException
{ {
SysUser user = userService.selectUserByUserName(username); SysUser user = userService.selectUserByUserName(username);
if (StringUtils.isNull(user)) if (StringUtils.isNull(user))
{ {
//we_user表中去查询,如果该表为空则提示用户不存在,如果不为空,则将用户记录注册到系统用户表中 //企业管理登录
WeUser weUser //查询企业管理相关账号
= iWeUserService.getById(username); WeCorpAccount weCorpByAccount = iWeCorpAccountService.findWeCorpByAccount(username);
if(null == weUser){ if(null != weCorpByAccount){
log.info("登录用户:{} 不存在.", username); //注册到we_user表中
throw new UsernameNotFoundException("登录用户:" + username + " 不存在"); user=SysUser.builder()
.userName(weCorpByAccount.getCropAccount())
.nickName(weCorpByAccount.getCompanyName())
.userType(Constants.USER_TYOE_CORP_ADMIN)
.roleIds(ArrayUtil.toArray(roleMapper.selectRoleList(SysRole.builder()
.roleKey(Constants.DEFAULT_WECOME_CORP_ADMIN)
.build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
.password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
.build();
} }
//注册到we_user表中 // else{
user=SysUser.builder() //
.userName(weUser.getUserId()) // //we_user表中去查询,如果该表为空则提示用户不存在,如果不为空,则将用户记录注册到系统用户表中
.nickName(weUser.getName()) // WeUser weUser
.userType(Constants.USER_TYPE_WECOME) // = iWeUserService.getById(username);
.email(weUser.getEmail()) // if(null == weUser){
.phonenumber(weUser.getMobile()) // log.info("登录用户:{} 不存在.", username);
.sex(weUser.getGender() ==0 ? "1": weUser.getGender() .toString()) // throw new UsernameNotFoundException("登录用户:" + username + " 不存在");
.avatar(weUser.getAvatarMediaid()) // }
.roleIds(ArrayUtil.toArray(roleMapper.selectRoleList(SysRole.builder() //
.roleKey(Constants.DEFAULT_WECOME_ROLE_KEY) // //注册到we_user表中
.build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class)) // user=SysUser.builder()
.password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd())) // .userName(weUser.getUserId())
.build(); // .nickName(weUser.getName())
// .userType(Constants.USER_TYPE_WECOME)
// .email(weUser.getEmail())
// .phonenumber(weUser.getMobile())
// .sex(weUser.getGender() ==0 ? "1": weUser.getGender() .toString())
// .avatar(weUser.getAvatarMediaid())
// .roleIds(ArrayUtil.toArray(roleMapper.selectRoleList(SysRole.builder()
// .roleKey(Constants.DEFAULT_WECOME_ROLE_KEY)
// .build()).stream().map(SysRole::getRoleId).collect(Collectors.toList()), Long.class))
// .password(SecurityUtils.encryptPassword(ruoYiConfig.getWeUserDefaultPwd()))
// .build();
// }
userService.insertUser( userService.insertUser(
user user
); );
...@@ -95,6 +118,13 @@ public class UserDetailsServiceImpl implements UserDetailsService ...@@ -95,6 +118,13 @@ public class UserDetailsServiceImpl implements UserDetailsService
throw new BaseException("对不起,您的账号:" + username + " 已停用"); throw new BaseException("对不起,您的账号:" + username + " 已停用");
} }
//当前登录用户为企业管理,设置corpId和密钥相关
if(user.getUserType().equals(Constants.USER_TYOE_CORP_ADMIN)){
user.setWeCorpAccount(
iWeCorpAccountService.findWeCorpByAccount(username)
);
}
return createLoginUser(user); return createLoginUser(user);
} }
......
package com.linkwechat.quartz.task;
import com.linkwechat.wecom.service.IWeTaskFissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author danmo
* @description 任务状态处理
* @date 2021/4/12 14:39
**/
@Slf4j
@Component("TaskFissionStatusTask")
public class TaskFissionStatusTask {
@Autowired
private IWeTaskFissionService weTaskFissionService;
public void taskFissionExpiredStatusHandle() {
log.info("任务宝过期时间处理--------------------------start");
weTaskFissionService.updateExpiredWeTaskFission();
log.info("任务宝过期时间处理--------------------------end");
}
}
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -30,40 +29,11 @@ public class WeApp { ...@@ -30,40 +29,11 @@ public class WeApp {
/**应用id**/ /**应用id**/
private String agentId; private String agentId;
/**应用名称**/
private String agentName;
/**应用密钥**/ /**应用密钥**/
private String agentSecret; private String agentSecret;
/**应用描述**/
private String description;
/**应用图标**/
private String squareLogoUrl;
/**企业应用是否被停用(1:是;0:否)**/
private Integer close;
/**企业应用可信域名**/
private String redirectDomain;
/**企业应用是否打开地理位置上报 0:不上报;1:进入会话上报;**/
private Integer reportLocationFlag;
/**是否上报用户进入应用事件。0:不接收;1:接收**/
private Integer isreportenter;
/**应用主页url**/
private String homeUrl;
/**应用类型(1:自建应用;)**/ /**应用类型(1:自建应用;)**/
private Integer appType; private Integer appType;
...@@ -82,11 +52,6 @@ public class WeApp { ...@@ -82,11 +52,6 @@ public class WeApp {
private String status; private String status;
/**企业应用头像的mediaid,通过素材管理接口上传图片获得mediaid,上传后会自动裁剪成方形和圆形两个头像**/
@TableField(exist = false)
private String logoMediaid;
......
...@@ -29,8 +29,13 @@ public class WeCustomerTrajectory { ...@@ -29,8 +29,13 @@ public class WeCustomerTrajectory {
private String content; private String content;
//处理日期 //处理日期
private Date createDate; private Date createDate;
//处理时间
private Time createTime; //处理开始时间
private Time startTime;
//处理结束时间
private Time endTime;
//0:正常;1:删除;2:完成 //0:正常;1:删除;2:完成
private String status; private String status;
} }
...@@ -59,16 +59,16 @@ public class WeTaskFission extends BaseEntity { ...@@ -59,16 +59,16 @@ public class WeTaskFission extends BaseEntity {
/** /**
* 活动开始时间 * 活动开始时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "活动开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "活动开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "活动开始时间") @ApiModelProperty(value = "活动开始时间")
private Date startTime; private Date startTime;
/** /**
* 活动结束时间 * 活动结束时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "活动结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "活动结束时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(value = "活动结束时间") @ApiModelProperty(value = "活动结束时间")
private Date overTime; private Date overTime;
......
...@@ -3,8 +3,6 @@ package com.linkwechat.wecom.domain.dto; ...@@ -3,8 +3,6 @@ package com.linkwechat.wecom.domain.dto;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author admin * @author admin
* @date 2020-11-18 * @date 2020-11-18
...@@ -14,8 +12,6 @@ import java.util.List; ...@@ -14,8 +12,6 @@ import java.util.List;
public class WeWelcomeMsg { public class WeWelcomeMsg {
private String welcome_code; private String welcome_code;
private List attachments;
private Text text; private Text text;
private Image image; private Image image;
......
...@@ -48,15 +48,10 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy { ...@@ -48,15 +48,10 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
private IWeTaskFissionRewardService weTaskFissionRewardService; private IWeTaskFissionRewardService weTaskFissionRewardService;
@Autowired @Autowired
private IWeTaskFissionService weTaskFissionService; private IWeTaskFissionService weTaskFissionService;
private ThreadLocal<WeFlowerCustomerRel> weFlowerCustomerRelThreadLocal = new ThreadLocal<>();
@Override @Override
public void eventHandle(WxCpXmlMessageVO message) { public void eventHandle(WxCpXmlMessageVO message) {
if (message.getExternalUserId() != null) { if (message.getExternalUserId() != null) {
WeFlowerCustomerRel weFlowerCustomerRel = weFlowerCustomerRelService.getOne(new LambdaQueryWrapper<WeFlowerCustomerRel>()
.eq(WeFlowerCustomerRel::getExternalUserid, message.getExternalUserId())
.eq(WeFlowerCustomerRel::getUserId,message.getUserId()));
weFlowerCustomerRelThreadLocal.set(weFlowerCustomerRel);
weCustomerService.getCustomersInfoAndSynchWeCustomer(message.getExternalUserId()); weCustomerService.getCustomersInfoAndSynchWeCustomer(message.getExternalUserId());
} }
if (message.getState() != null && message.getWelcomeCode() != null) { if (message.getState() != null && message.getWelcomeCode() != null) {
...@@ -70,7 +65,6 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy { ...@@ -70,7 +65,6 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
//裂变任务处理 //裂变任务处理
private void taskFissionRecordHandle(String state, String wecomCode, String userId, String externalUserId) { private void taskFissionRecordHandle(String state, String wecomCode, String userId, String externalUserId) {
log.info("裂变任务处理 >>>>>>>>>>start");
//查询裂变客户任务记录 //查询裂变客户任务记录
String fissionRecordId = state.substring(WeConstans.FISSION_PREFIX.length()); String fissionRecordId = state.substring(WeConstans.FISSION_PREFIX.length());
WeTaskFissionRecord weTaskFissionRecord = weTaskFissionRecordService.selectWeTaskFissionRecordById(Long.valueOf(fissionRecordId)); WeTaskFissionRecord weTaskFissionRecord = weTaskFissionRecordService.selectWeTaskFissionRecordById(Long.valueOf(fissionRecordId));
...@@ -78,23 +72,20 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy { ...@@ -78,23 +72,20 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
//查询裂变任务详情 //查询裂变任务详情
WeTaskFission weTaskFission = weTaskFissionService WeTaskFission weTaskFission = weTaskFissionService
.selectWeTaskFissionById(weTaskFissionRecord.getTaskFissionId()); .selectWeTaskFissionById(weTaskFissionRecord.getTaskFissionId());
Long fissNum = weTaskFissionRecord.getFissNum();
if (weFlowerCustomerRelThreadLocal.get() == null){ Long fissNum = weTaskFissionRecord.getFissNum() + 1;
fissNum++; weTaskFissionRecord.setFissNum(fissNum);
weTaskFissionRecord.setFissNum(fissNum);
}
log.info("查询裂变任务详情 >>>>>>>>>>{}",JSONObject.toJSONString(weTaskFissionRecord));
if (weTaskFission != null){ if (weTaskFission != null){
//发送欢迎语 //发送欢迎语
WeWelcomeMsg.WeWelcomeMsgBuilder weWelcomeMsgBuilder = WeWelcomeMsg.builder().welcome_code(wecomCode); String welcomeMsg = weTaskFission.getWelcomeMsg();
weWelcomeMsgBuilder.text(WeWelcomeMsg.Text.builder() WeWelcomeMsg.WeWelcomeMsgBuilder weWelcomeMsgBuilder = JSONObject.parseObject(welcomeMsg, WeWelcomeMsg.WeWelcomeMsgBuilder.class);
.content(weTaskFission.getWelcomeMsg()).build()); weWelcomeMsgBuilder.welcome_code(wecomCode);
weCustomerService.sendWelcomeMsg(weWelcomeMsgBuilder.build()); weCustomerService.sendWelcomeMsg(weWelcomeMsgBuilder.build());
} }
//裂变数量完成任务处理,消费兑换码 //裂变数量完成任务处理,消费兑换码
if (fissNum >= weTaskFission.getFissNum()){ if (fissNum >= weTaskFission.getFissNum()){
log.info("裂变数量完成任务处理,消费兑换码 >>>>>>>>>>{}",fissNum);
weTaskFissionRecord.setCompleteTime(new Date()); weTaskFissionRecord.setCompleteTime(new Date());
WeTaskFissionReward reward = new WeTaskFissionReward(); WeTaskFissionReward reward = new WeTaskFissionReward();
reward.setTaskFissionId(weTaskFissionRecord.getTaskFissionId()); reward.setTaskFissionId(weTaskFissionRecord.getTaskFissionId());
...@@ -105,9 +96,8 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy { ...@@ -105,9 +96,8 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
fissionReward.setRewardUserId(weTaskFissionRecord.getCustomerId()); fissionReward.setRewardUserId(weTaskFissionRecord.getCustomerId());
weTaskFissionRewardService.updateWeTaskFissionReward(fissionReward); weTaskFissionRewardService.updateWeTaskFissionReward(fissionReward);
} }
log.info("裂变任务处理变更 >>>>>>>>>>{}",JSONObject.toJSONString(weTaskFissionRecord));
weTaskFissionRecordService.updateWeTaskFissionRecord(weTaskFissionRecord); weTaskFissionRecordService.updateWeTaskFissionRecord(weTaskFissionRecord);
log.info("裂变任务处理 >>>>>>>>>>end");
} }
} }
...@@ -157,13 +147,8 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy { ...@@ -157,13 +147,8 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
WeMediaDto weMediaDto = weMaterialService WeMediaDto weMediaDto = weMaterialService
.uploadTemporaryMaterial(messageMap.getMaterialUrl(), MediaType.IMAGE.getMediaType(),messageMap.getMaterialName()); .uploadTemporaryMaterial(messageMap.getMaterialUrl(), MediaType.IMAGE.getMediaType(),messageMap.getMaterialName());
Optional.ofNullable(weMediaDto).ifPresent(media -> { Optional.ofNullable(weMediaDto).ifPresent(media -> {
List attachments = new ArrayList(); weWelcomeMsgBuilder.image(WeWelcomeMsg.Image.builder().media_id(media.getMedia_id())
JSONObject json = new JSONObject();
json.put("msgtype",weMediaDto.getType());
json.put(weMediaDto.getType(),WeWelcomeMsg.Image.builder().media_id(media.getMedia_id())
.pic_url(media.getUrl()).build()); .pic_url(media.getUrl()).build());
attachments.add(json);
weWelcomeMsgBuilder.attachments(attachments);
}); });
} }
weCustomerService.sendWelcomeMsg(weWelcomeMsgBuilder.build()); weCustomerService.sendWelcomeMsg(weWelcomeMsgBuilder.build());
......
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.factory.impl.customer; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.factory.impl.customer;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.enums.MessageType; import com.linkwechat.common.enums.MessageType;
import com.linkwechat.wecom.client.WeMessagePushClient; import com.linkwechat.wecom.client.WeMessagePushClient;
import com.linkwechat.wecom.domain.*; import com.linkwechat.wecom.domain.*;
......
...@@ -56,20 +56,21 @@ public class WeiXinAuthInterceptor implements Interceptor { ...@@ -56,20 +56,21 @@ public class WeiXinAuthInterceptor implements Interceptor {
private String findAccessToken(String openId){ private String findAccessToken(String openId){
//获取用户token //获取用户token
WxTokenDto wxTokenDto = redisCache.getCacheObject(WeConstans.WX_AUTH_ACCESS_TOKEN + ":" + openId); String accessToken =redisCache.getCacheObject(WeConstans.WX_AUTH_ACCESS_TOKEN+":"+ openId);
if (wxTokenDto == null){ if (StringUtils.isEmpty(accessToken)){
//当用户token失效,则获取refreshToken //当用户token失效,则获取refreshToken
String refreshToken = redisCache.getCacheObject(WeConstans.WX_AUTH_REFRESH_ACCESS_TOKEN + ":" + openId); String refreshToken = redisCache.getCacheObject(WeConstans.WX_AUTH_REFRESH_ACCESS_TOKEN + ":" + openId);
if(StringUtils.isEmpty(refreshToken)){ if(StringUtils.isEmpty(refreshToken)){
throw new WeComException(1001,"token失效,请重新授权"); throw new WeComException(1001,"token失效,请重新授权");
}else { }else {
wxTokenDto = wxAuthClient.refreshToken(appId, grantType, refreshToken); WxTokenDto wxTokenDto = wxAuthClient.refreshToken(appId, secret, grantType, refreshToken);
if(wxTokenDto != null && StringUtils.isNotEmpty(wxTokenDto.getAccessToken())){ if(wxTokenDto != null && StringUtils.isNotEmpty(wxTokenDto.getAccessToken())){
redisCache.setCacheObject(WeConstans.WX_AUTH_ACCESS_TOKEN+":"+ openId, wxTokenDto, wxTokenDto.getExpiresIn(), TimeUnit.SECONDS); redisCache.setCacheObject(WeConstans.WX_AUTH_ACCESS_TOKEN+":"+ openId, wxTokenDto.getAccessToken(), wxTokenDto.getExpiresIn(), TimeUnit.SECONDS);
accessToken = wxTokenDto.getAccessToken();
} }
} }
} }
return wxTokenDto.getAccessToken(); return accessToken;
} }
......
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import java.util.List; import java.util.List;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
...@@ -59,4 +59,12 @@ public interface WeCorpAccountMapper ...@@ -59,4 +59,12 @@ public interface WeCorpAccountMapper
* @return * @return
*/ */
public int startVailWeCorpAccount(@Param("corpId") String corpId); public int startVailWeCorpAccount(@Param("corpId") String corpId);
/**
* 根据企业账号获取企业相关配置
* @param corpAccount
* @return
*/
WeCorpAccount findWeCorpByAccount(@Param("corpAccount") String corpAccount);
} }
...@@ -58,10 +58,4 @@ public interface WeTaskFissionMapper { ...@@ -58,10 +58,4 @@ public interface WeTaskFissionMapper {
* @return 结果 * @return 结果
*/ */
public int deleteWeTaskFissionByIds(Long[] ids); public int deleteWeTaskFissionByIds(Long[] ids);
/**
* 更新过期任务
* @return
*/
public void updateExpiredWeTaskFission();
} }
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import java.util.List; import java.util.List;
import com.linkwechat.wecom.domain.WeCorpAccount;
import org.apache.ibatis.annotations.Param;
/** /**
* 企业id相关配置Service接口 * 企业id相关配置Service接口
...@@ -71,4 +71,7 @@ public interface IWeCorpAccountService ...@@ -71,4 +71,7 @@ public interface IWeCorpAccountService
* 客户流失通知开关查询 * 客户流失通知开关查询
*/ */
public String getCustomerChurnNoticeSwitch(); public String getCustomerChurnNoticeSwitch();
WeCorpAccount findWeCorpByAccount(String corpAccount);
} }
...@@ -94,10 +94,4 @@ public interface IWeTaskFissionService { ...@@ -94,10 +94,4 @@ public interface IWeTaskFissionService {
WeTaskFissionStatisticVO taskFissionStatistic(Long taskFissionId, Date startTime, Date endTime); WeTaskFissionStatisticVO taskFissionStatistic(Long taskFissionId, Date startTime, Date endTime);
WeTaskFissionProgressVO getCustomerTaskProgress(WeTaskFission taskFission, String eid); WeTaskFissionProgressVO getCustomerTaskProgress(WeTaskFission taskFission, String eid);
/**
* 更新过期任务
* @return
*/
public void updateExpiredWeTaskFission();
} }
...@@ -8,7 +8,7 @@ import com.linkwechat.common.exception.wecom.WeComException; ...@@ -8,7 +8,7 @@ import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeAccessTokenClient; import com.linkwechat.wecom.client.WeAccessTokenClient;
import com.linkwechat.wecom.domain.WeApp; import com.linkwechat.wecom.domain.WeApp;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.wecom.domain.dto.WeAccessTokenDtoDto; import com.linkwechat.wecom.domain.dto.WeAccessTokenDtoDto;
import com.linkwechat.wecom.service.IWeAccessTokenService; import com.linkwechat.wecom.service.IWeAccessTokenService;
import com.linkwechat.wecom.service.IWeAppService; import com.linkwechat.wecom.service.IWeAppService;
......
...@@ -5,14 +5,12 @@ import java.util.Optional; ...@@ -5,14 +5,12 @@ import java.util.Optional;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.wecom.service.IWeAccessTokenService; import com.linkwechat.wecom.service.IWeAccessTokenService;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeCorpAccountMapper; import com.linkwechat.wecom.mapper.WeCorpAccountMapper;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 企业id相关配置Service业务层处理 * 企业id相关配置Service业务层处理
...@@ -136,5 +134,10 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService { ...@@ -136,5 +134,10 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
return noticeSwitch; return noticeSwitch;
} }
@Override
public WeCorpAccount findWeCorpByAccount(String corpAccount) {
return weCorpAccountMapper.findWeCorpByAccount(corpAccount);
}
} }
...@@ -74,15 +74,15 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -74,15 +74,15 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException { public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException {
if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime())) // if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime()))
&& DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) { // && DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) {
throw new WeComException("发送时间不能小于当前时间"); // throw new WeComException("发送时间不能小于当前时间");
} // }
/*if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){ if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){
throw new WeComException("发送时间不能为空"); throw new WeComException("发送时间不能为空");
}*/ }
List<WeCustomer> customers = Lists.newArrayList(); List<WeCustomer> customers = Lists.newArrayList();
......
...@@ -482,8 +482,6 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -482,8 +482,6 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
//客户入库 //客户入库
WeCustomer weCustomer = new WeCustomer(); WeCustomer weCustomer = new WeCustomer();
BeanUtils.copyPropertiesASM(externalUserDetail.getExternal_contact(), weCustomer); BeanUtils.copyPropertiesASM(externalUserDetail.getExternal_contact(), weCustomer);
weCustomer.setCreateTime(new Date());
weCustomer.setUpdateTime(new Date());
this.saveOrUpdate(weCustomer); this.saveOrUpdate(weCustomer);
//客户与通讯录客户关系 //客户与通讯录客户关系
......
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service.impl; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.enums.CommunityTaskType; import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.enums.ChatType; import com.linkwechat.common.enums.ChatType;
import com.linkwechat.common.enums.MediaType; import com.linkwechat.common.enums.MediaType;
import com.linkwechat.common.enums.TaskSendType; import com.linkwechat.common.enums.TaskSendType;
......
...@@ -13,7 +13,7 @@ import com.linkwechat.common.utils.DateUtils; ...@@ -13,7 +13,7 @@ import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeMessagePushClient; import com.linkwechat.wecom.client.WeMessagePushClient;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.wecom.domain.WeSensitive; import com.linkwechat.wecom.domain.WeSensitive;
import com.linkwechat.wecom.domain.WeSensitiveAuditScope; import com.linkwechat.wecom.domain.WeSensitiveAuditScope;
import com.linkwechat.wecom.domain.WeUser; import com.linkwechat.wecom.domain.WeUser;
......
...@@ -106,29 +106,27 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi ...@@ -106,29 +106,27 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi
} }
@Override @Override
public WeTaskFissionRewardVo getRewardByFissionId(String fissionId, String unionId) { public WeTaskFissionRewardVo getRewardByFissionId(String fissionId, String eid) {
WeTaskFissionRewardVo weTaskFissionRewardVo = new WeTaskFissionRewardVo(); WeTaskFissionRewardVo weTaskFissionRewardVo = new WeTaskFissionRewardVo();
WeCustomer weCustomer = weCustomerService.getOne(new LambdaQueryWrapper<WeCustomer>().eq(WeCustomer::getUnionid, unionId)); WeCustomer weCustomer = weCustomerService.getOne(new LambdaQueryWrapper<WeCustomer>().eq(WeCustomer::getExternalUserid, eid));
String customerUnionId = Optional.ofNullable(weCustomer).map(WeCustomer::getUnionid) String externalUseriId = Optional.ofNullable(weCustomer).map(WeCustomer::getExternalUserid)
.orElseThrow(() -> new WeComException("用户信息不存在")); .orElseThrow(() -> new WeComException("用户信息不存在"));
WeTaskFissionRecord record = weTaskFissionRecordService.selectWeTaskFissionRecordByIdAndCustomerId(Long.valueOf(fissionId), customerUnionId); WeTaskFissionRecord record = weTaskFissionRecordService.selectWeTaskFissionRecordByIdAndCustomerId(Long.valueOf(fissionId), externalUseriId);
if (record == null){ Date completeTime = Optional.ofNullable(record).map(WeTaskFissionRecord::getCompleteTime)
throw new WeComException("任务信息不存在"); .orElseThrow(() -> new WeComException("任务信息不存在"));
}
Date completeTime = record.getCompleteTime();
WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(Long.valueOf(fissionId)); WeTaskFission weTaskFission = weTaskFissionService.selectWeTaskFissionById(Long.valueOf(fissionId));
Optional.ofNullable(weTaskFission).ifPresent(fission -> { Optional.ofNullable(weTaskFission).ifPresent(fission -> {
weTaskFissionRewardVo.setRewardRule(fission.getRewardRule()); weTaskFissionRewardVo.setRewardRule(fission.getRewardRule());
weTaskFissionRewardVo.setRewardImageUrl(fission.getRewardImageUrl());
weTaskFissionRewardVo.setRewardUrl(fission.getRewardUrl());
}); });
if (completeTime != null) { if (completeTime != null) {
Optional.ofNullable(weTaskFission).ifPresent(fission -> {
weTaskFissionRewardVo.setRewardUrl(fission.getRewardUrl());
weTaskFissionRewardVo.setRewardImageUrl(fission.getRewardImageUrl());
});
WeTaskFissionReward fissionReward = weTaskFissionRewardMapper.selectOne(new LambdaQueryWrapper<WeTaskFissionReward>() WeTaskFissionReward fissionReward = weTaskFissionRewardMapper.selectOne(new LambdaQueryWrapper<WeTaskFissionReward>()
.eq(WeTaskFissionReward::getTaskFissionId, fissionId) .eq(WeTaskFissionReward::getTaskFissionId, fissionId)
.eq(WeTaskFissionReward::getRewardUserId, customerUnionId)); .eq(WeTaskFissionReward::getRewardUserId, externalUseriId));
weTaskFissionRewardVo.setWeTaskFissionReward(fissionReward); weTaskFissionRewardVo.setWeTaskFissionReward(fissionReward);
//发放兑奖码之后,置为已使用 //发放兑奖码之后,置为已使用
Optional.ofNullable(fissionReward).ifPresent(reward -> weTaskFissionRewardMapper.update(reward, new LambdaUpdateWrapper<WeTaskFissionReward>() Optional.ofNullable(fissionReward).ifPresent(reward -> weTaskFissionRewardMapper.update(reward, new LambdaUpdateWrapper<WeTaskFissionReward>()
......
...@@ -153,7 +153,6 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -153,7 +153,6 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
int updateResult = weTaskFissionMapper.updateWeTaskFission(weTaskFission); int updateResult = weTaskFissionMapper.updateWeTaskFission(weTaskFission);
if (updateResult > 0) { if (updateResult > 0) {
if (CollectionUtils.isNotEmpty(weTaskFission.getTaskFissionStaffs())) { if (CollectionUtils.isNotEmpty(weTaskFission.getTaskFissionStaffs())) {
log.info("发起成员信息:【{}】",JSONObject.toJSONString(weTaskFission.getTaskFissionStaffs()));
List<WeTaskFissionStaff> staffList = weTaskFissionStaffService.selectWeTaskFissionStaffByTaskId(weTaskFission.getId()); List<WeTaskFissionStaff> staffList = weTaskFissionStaffService.selectWeTaskFissionStaffByTaskId(weTaskFission.getId());
if (CollectionUtils.isNotEmpty(staffList)) { if (CollectionUtils.isNotEmpty(staffList)) {
weTaskFissionStaffService.deleteWeTaskFissionStaffByIds(staffList.stream().map(WeTaskFissionStaff::getId).toArray(Long[]::new)); weTaskFissionStaffService.deleteWeTaskFissionStaffByIds(staffList.stream().map(WeTaskFissionStaff::getId).toArray(Long[]::new));
...@@ -200,6 +199,8 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -200,6 +199,8 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
//H5生成海报页面路径 //H5生成海报页面路径
StringBuilder pageUrlBuilder = new StringBuilder(pageUrl); StringBuilder pageUrlBuilder = new StringBuilder(pageUrl);
pageUrlBuilder.append("?") pageUrlBuilder.append("?")
.append("agentId=").append("1000010")
.append("&")
.append("fissionId=").append(id) .append("fissionId=").append(id)
.append("&") .append("&")
.append("fissionTargetId=").append(fissStaffId) .append("fissionTargetId=").append(fissStaffId)
...@@ -213,9 +214,6 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -213,9 +214,6 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
linkMessageDto.setUrl(pageUrlBuilder.toString()); linkMessageDto.setUrl(pageUrlBuilder.toString());
CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto(); CustomerMessagePushDto customerMessagePushDto = new CustomerMessagePushDto();
if (weTaskFission.getStartTime() != null){
customerMessagePushDto.setSettingTime(DateUtils.dateTime(weTaskFission.getStartTime()));
}
customerMessagePushDto.setLinkMessage(linkMessageDto); customerMessagePushDto.setLinkMessage(linkMessageDto);
customerMessagePushDto.setPushType("0"); customerMessagePushDto.setPushType("0");
customerMessagePushDto.setPushRange("1"); customerMessagePushDto.setPushRange("1");
...@@ -303,18 +301,18 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -303,18 +301,18 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
.map(record -> weCustomerService.selectWeCustomerById(record.getCustomerId())) .map(record -> weCustomerService.selectWeCustomerById(record.getCustomerId()))
.filter(Objects::nonNull).collect(Collectors.toList()); .filter(Objects::nonNull).collect(Collectors.toList());
} else { } else {
WeCustomer weCustomer = weCustomerService.getOne(new LambdaQueryWrapper<WeCustomer>().eq(WeCustomer::getUnionid, unionId));
String uid = Optional.ofNullable(weCustomer).map(WeCustomer::getUnionid)
.orElseThrow(() -> new WeComException("用户信息不存在"));
weTaskFissionRecord = weTaskFissionRecordService weTaskFissionRecord = weTaskFissionRecordService
.selectWeTaskFissionRecordByIdAndCustomerId(Long.valueOf(fissionId), unionId); .selectWeTaskFissionRecordByIdAndCustomerId(Long.valueOf(fissionId), uid);
Optional.ofNullable(weTaskFissionRecord).orElseThrow(() -> new WeComException("任务记录信息不存在")); Optional.ofNullable(weTaskFissionRecord).map(WeTaskFissionRecord::getId)
.orElseThrow(() -> new WeComException("任务记录信息不存在"));
List<WeFlowerCustomerRel> list = weFlowerCustomerRelService.list(new LambdaQueryWrapper<WeFlowerCustomerRel>() List<WeFlowerCustomerRel> list = weFlowerCustomerRelService.list(new LambdaQueryWrapper<WeFlowerCustomerRel>()
.eq(WeFlowerCustomerRel::getState, WeConstans.FISSION_PREFIX + weTaskFissionRecord.getId())); .eq(WeFlowerCustomerRel::getState, WeConstans.FISSION_PREFIX + weTaskFissionRecord.getId()));
List<String> eidList = Optional.ofNullable(list).orElseGet(ArrayList::new).stream() List<String> eidList = Optional.ofNullable(list).orElseGet(ArrayList::new).stream()
.map(WeFlowerCustomerRel::getExternalUserid).collect(Collectors.toList()); .map(WeFlowerCustomerRel::getExternalUserid).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(eidList)){ return weCustomerService.listByIds(eidList);
return weCustomerService.listByIds(eidList);
}else {
return null;
}
} }
} }
...@@ -365,15 +363,6 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -365,15 +363,6 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
return WeTaskFissionProgressVO.builder().total(total).completed(complete).customers(list).build(); return WeTaskFissionProgressVO.builder().total(total).completed(complete).customers(list).build();
} }
/**
* 更新过期任务
* @return
*/
@Override
public void updateExpiredWeTaskFission() {
weTaskFissionMapper.updateExpiredWeTaskFission();
}
/*************************************** private functions **************************************/ /*************************************** private functions **************************************/
private String getPosterQRCode(String fissionTargetId, WeTaskFissionRecord record, WeCustomer weCustomer) { private String getPosterQRCode(String fissionTargetId, WeTaskFissionRecord record, WeCustomer weCustomer) {
...@@ -441,8 +430,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService { ...@@ -441,8 +430,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
WeTaskFissionRecord record = WeTaskFissionRecord.builder() WeTaskFissionRecord record = WeTaskFissionRecord.builder()
.taskFissionId(taskFissionId) .taskFissionId(taskFissionId)
.customerId(customerId) .customerId(customerId)
.customerName(customerName) .customerName(customerName).build();
.createTime(new Date()).build();
List<WeTaskFissionRecord> searchExists = weTaskFissionRecordService.selectWeTaskFissionRecordList(record); List<WeTaskFissionRecord> searchExists = weTaskFissionRecordService.selectWeTaskFissionRecordList(record);
WeTaskFissionRecord recordInfo; WeTaskFissionRecord recordInfo;
if (CollectionUtils.isNotEmpty(searchExists)) { if (CollectionUtils.isNotEmpty(searchExists)) {
......
...@@ -54,7 +54,7 @@ public class WeTaskFissionStaffServiceImpl implements IWeTaskFissionStaffService ...@@ -54,7 +54,7 @@ public class WeTaskFissionStaffServiceImpl implements IWeTaskFissionStaffService
@Override @Override
public int insertWeTaskFissionStaffList(List<WeTaskFissionStaff> weTaskFissionStaffs) { public int insertWeTaskFissionStaffList(List<WeTaskFissionStaff> weTaskFissionStaffs) {
return weTaskFissionStaffMapper.insertWeTaskFissionStaffList(weTaskFissionStaffs); return 0;
} }
/** /**
......
...@@ -39,7 +39,7 @@ public interface WxAuthClient { ...@@ -39,7 +39,7 @@ public interface WxAuthClient {
* @return * @return
*/ */
@Request(url = "/oauth2/refresh_token", type = "GET") @Request(url = "/oauth2/refresh_token", type = "GET")
WxTokenDto refreshToken(@Query("appid") String appId, @Query("grant_type") String grantType, WxTokenDto refreshToken(String id, @Query("appid") String appId, @Query("grant_type") String grantType,
@Query("refresh_token") String refreshToken); @Query("refresh_token") String refreshToken);
/** /**
......
...@@ -22,10 +22,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -22,10 +22,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="providerSecret" column="provider_secret" /> <result property="providerSecret" column="provider_secret" />
<result property="customerChurnNoticeSwitch" column="customer_churn_notice_switch" /> <result property="customerChurnNoticeSwitch" column="customer_churn_notice_switch" />
<result property="wxQrLoginRedirectUri" column="wx_qr_login_redirect_uri"/> <result property="wxQrLoginRedirectUri" column="wx_qr_login_redirect_uri"/>
<result property="corpAccount" column="corp_account"/>
</resultMap> </resultMap>
<sql id="selectWeCorpAccountVo"> <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 from we_corp_account 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> </sql>
<select id="selectWeCorpAccountList" parameterType="WeCorpAccount" resultMap="WeCorpAccountResult"> <select id="selectWeCorpAccountList" parameterType="WeCorpAccount" resultMap="WeCorpAccountResult">
...@@ -62,6 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -62,6 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch,</if> <if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch,</if>
<if test="providerSecret != null ">provider_secret,</if> <if test="providerSecret != null ">provider_secret,</if>
<if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri,</if> <if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri,</if>
<if test="corpAccount != null ">corp_account,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyName != null">#{companyName},</if> <if test="companyName != null">#{companyName},</if>
...@@ -80,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -80,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customerChurnNoticeSwitch != null ">#{customerChurnNoticeSwitch},</if> <if test="customerChurnNoticeSwitch != null ">#{customerChurnNoticeSwitch},</if>
<if test="providerSecret != null ">#{providerSecret},</if> <if test="providerSecret != null ">#{providerSecret},</if>
<if test="wxQrLoginRedirectUri != null ">#{wxQrLoginRedirectUri},</if> <if test="wxQrLoginRedirectUri != null ">#{wxQrLoginRedirectUri},</if>
<if test="corpAccount != null ">#{corpAccount},</if>
</trim> </trim>
</insert> </insert>
...@@ -103,8 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -103,8 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="providerSecret != null ">provider_secret = #{providerSecret},</if> <if test="providerSecret != null ">provider_secret = #{providerSecret},</if>
<if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri = #{wxQrLoginRedirectUri},</if> <if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri = #{wxQrLoginRedirectUri},</if>
<if test="corpAccount != null ">crop_account = #{corpAccount},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
...@@ -126,6 +131,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -126,6 +131,13 @@ 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>
......
...@@ -156,19 +156,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -156,19 +156,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<update id="updateExpiredWeTaskFission">
update we_task_fission as wtff,
(
select
id
from
we_task_fission wtf
where
wtf.fiss_status = 1
and now() &gt;= wtf.over_time
)as wtfl
set wtff.fiss_status = 2
where
wtff.id = wtfl.id
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!