提交 bafae4e0 编写于 作者: 1 1539136324@qq.com

上传应用管理相关接口;CRM客户详情接口增加age字段,动态计算客户年龄;

上级 23b09718
......@@ -55,7 +55,7 @@ public class WeCustomerPortraitController extends BaseController {
* @return
*/
@GetMapping(value = "/findWeCustomerInfo")
public AjaxResult findWeCustomerInfo(String externalUserid, String userid){
public AjaxResult findWeCustomerInfo(String externalUserid, String userid) throws Exception {
return AjaxResult.success(
iWeCustomerService.findCustomerByOperUseridAndCustomerId(externalUserid,userid)
......
......@@ -195,4 +195,33 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
long millionSeconds = sdf.parse(date).getTime();//毫秒
return millionSeconds;
}
public static int getAge(Date birthDay) throws Exception {
Calendar cal = Calendar.getInstance();
if (cal.before(birthDay)) { //出生日期晚于当前时间,无法计算
throw new IllegalArgumentException(
"The birthDay is before Now.It's unbelievable!");
}
int yearNow = cal.get(Calendar.YEAR); //当前年份
int monthNow = cal.get(Calendar.MONTH); //当前月份
int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH); //当前日期
cal.setTime(birthDay);
int yearBirth = cal.get(Calendar.YEAR);
int monthBirth = cal.get(Calendar.MONTH);
int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
int age = yearNow - yearBirth; //计算整岁数
if (monthNow <= monthBirth) {
if (monthNow == monthBirth) {
if (dayOfMonthNow < dayOfMonthBirth) age--;//当前日期在生日之前,年龄减一
}else{
age--;//当前月份在生日之前,年龄减一
} }
return age;
}
}
package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.DataObject;
import com.dtflys.forest.annotation.Query;
import com.dtflys.forest.annotation.Request;
import com.linkwechat.wecom.domain.dto.WeAppDetailDto;
import com.linkwechat.wecom.domain.dto.WeAppDto;
import com.linkwechat.wecom.domain.dto.WeResultDto;
/**
* 应用管理相关接口
*/
public interface WeAppClient {
/**
* 获取企业应用列表
* @return
*/
@Request(url = "/agent/list")
WeAppDto findAgentList();
/**
* 根据应用id获取应用详情
* @param agentid
* @return
*/
@Request(url = "/agent/get")
WeAppDetailDto findAgentById(@Query("agentid") Integer agentid);
/**
* 设置应用
* @param weAppDetailDto
* @return
*/
@Request(url = "/agent/set")
WeResultDto updateAgentById(@DataObject WeAppDetailDto weAppDetailDto);
}
......@@ -38,6 +38,8 @@ public class WeCustomerPortrait {
private String remarkCorpName;
//描述
private String description;
//年纪
private int age;
//客户标签
private List<WeTagGroup> weTagGroupList;
......
package com.linkwechat.wecom.domain.dto;
import lombok.Data;
/**
* 企业应用详情接口
*/
@Data
public class WeAppDetailDto extends WeResultDto{
//企业应用id
private Long agentid;
//企业应用名称
private String name;
//企业应用方形头像
private String square_logo_url;
//企业应用详情
private String description;
//企业应用是否被停用
private Boolean close;
//企业应用可信域名
private String redirect_domain;
//企业应用是否打开地理位置上报 0:不上报;1:进入会话上报;
private Integer report_location_flag;
//是否上报用户进入应用事件。0:不接收;1:接收
private Integer isreportenter;
//应用主页url
private String home_url;
//企业应用头像的mediaid,通过素材管理接口上传图片获得mediaid,上传后会自动裁剪成方形和圆形两个头像
private String logo_mediaid;
}
package com.linkwechat.wecom.domain.dto;
import lombok.Data;
import java.util.List;
@Data
public class WeAppDto extends WeResultDto{
private List<Agent> agentlist;
@Data
public class Agent{
//企业应用id
private Long agentid;
//企业应用名称
private String name;
//企业应用方形头像url
private String square_logo_url;
}
}
......@@ -118,7 +118,7 @@ public interface IWeCustomerService extends IService<WeCustomer>
* @param userid
* @return
*/
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(String externalUserid,String userid);
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(String externalUserid,String userid) throws Exception;
/**
......
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.google.common.collect.Lists;
import com.linkwechat.common.exception.wecom.WeComException;
......@@ -72,7 +73,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
//保存新客自动拉群信息
WeCommunityNewGroup communityNewGroup = new WeCommunityNewGroup();
communityNewGroup.setNewGroupId(weGroupCode.getId());
communityNewGroup.setGroupCodeId(weGroupCode.getId());
communityNewGroup.setEmpleCodeName(communityNewGroupDto.getActivityScene());
communityNewGroup.setDelFlag(0);
communityNewGroup.setCreateTime(new Date());
......@@ -117,6 +118,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
@Override
public List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(String empleCodeName, String createBy, String beginTime, String endTime) {
List<WeCommunityNewGroupVo> weCommunityNewGroupVos = weCommunityNewGroupMapper.selectWeCommunityNewGroupList(empleCodeName, createBy, beginTime, endTime);
if (CollectionUtil.isNotEmpty(weCommunityNewGroupVos)) {
List<Long> newGroupIdList = weCommunityNewGroupVos.stream().map(WeCommunityNewGroupVo::getNewGroupId).collect(Collectors.toList());
List<WeEmpleCodeUseScop> useScopList = iWeEmpleCodeUseScopService.selectWeEmpleCodeUseScopListByIds(newGroupIdList);
......@@ -166,13 +168,15 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
//检查群活码是否存在
WeGroupCode weGroupCode = weGroupCodeMapper.selectWeGroupCodeById(communityNewGroupDto.getGroupCodeId());
if (null != weGroupCode) {
if (null == weGroupCode) {
throw new WeComException("群活码不存在!");
}
//查询新客自动拉群信息
WeCommunityNewGroup communityNewGroup = weCommunityNewGroupMapper.selectById(communityNewGroupDto.getGroupCodeId());
if (null != communityNewGroup) {
WeCommunityNewGroup communityNewGroup = weCommunityNewGroupMapper.selectOne(new LambdaQueryWrapper<WeCommunityNewGroup>()
.eq(WeCommunityNewGroup::getGroupCodeId,communityNewGroupDto.getGroupCodeId()));
// WeCommunityNewGroup communityNewGroup = weCommunityNewGroupMapper.selectById(communityNewGroupDto.getGroupCodeId());
if (null == communityNewGroup) {
throw new WeComException("信息不存在!");
}
......@@ -180,6 +184,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGr
WeEmpleCode weEmpleCode = getWeEmpleCode(communityNewGroupDto);
WeExternalContactDto.WeContactWay weContactWay = weEmpleCodeService.getWeContactWay(weEmpleCode);
try {
weExternalContactClient.updateContactWay(weContactWay);
} catch (Exception e) {
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.common.utils.StringUtils;
......@@ -627,11 +628,16 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
@Override
public WeCustomerPortrait findCustomerByOperUseridAndCustomerId(String externalUserid, String userid) {
public WeCustomerPortrait findCustomerByOperUseridAndCustomerId(String externalUserid, String userid) throws Exception {
WeCustomerPortrait weCustomerPortrait
= weCustomerMapper.findCustomerByOperUseridAndCustomerId(externalUserid, userid);
if(null != weCustomerPortrait){
if(weCustomerPortrait.getBirthday() != null){
weCustomerPortrait.setAge(DateUtils.getAge(weCustomerPortrait.getBirthday()));
}
//获取当前客户拥有得标签
weCustomerPortrait.setWeTagGroupList(
iWeTagGroupService.findCustomerTagByFlowerCustomerRelId(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册