修复客户轨迹相关bug

1 parent a6515e3f
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
...@@ -8,6 +9,8 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -8,6 +9,8 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.enums.TrackState;
import com.linkwechat.common.enums.TrajectoryType;
import com.linkwechat.common.exception.CustomException; import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.constants.SynchRecordConstants; import com.linkwechat.wecom.constants.SynchRecordConstants;
...@@ -210,12 +213,8 @@ public class WeCustomerController extends BaseController ...@@ -210,12 +213,8 @@ public class WeCustomerController extends BaseController
List<WeCustomerTrajectory> weCustomerTrajectories = iWeCustomerTrajectoryService List<WeCustomerTrajectory> weCustomerTrajectories = iWeCustomerTrajectoryService
.followUpRecord(externalUserid, userId, trajectoryType); .followUpRecord(externalUserid, userId, trajectoryType);
// TableDataInfo dataTable = getDataTable(weCustomerTrajectories);
// dataTable.setLastSyncTime(
// iWeSynchRecordService.findUpdateLatestTime(SynchRecordConstants.SYNCH_MOMENTS_INTERACTE)
// );//最近同步时间
return getDataTable(weCustomerTrajectories); return getDataTable(weCustomerTrajectories);
} }
......
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
...@@ -23,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -23,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -132,10 +134,11 @@ public class WeMaterialController extends BaseController { ...@@ -132,10 +134,11 @@ public class WeMaterialController extends BaseController {
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER) @Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
@GetMapping("/temporaryMaterialMediaId") @GetMapping("/temporaryMaterialMediaId")
@ApiOperation("H5端发送获取素材media_id") @ApiOperation("H5端发送获取素材media_id")
public AjaxResult temporaryMaterialMediaId(String url,String type,String name){ public AjaxResult temporaryMaterialMediaId(String url,String type,String name) throws UnsupportedEncodingException {
WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(url, WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(url,
type type
,name); ,new String(name.getBytes(),"UTF-8"));
return AjaxResult.success(weMediaDto); return AjaxResult.success(weMediaDto);
} }
......
linkwechat.nacos.host=119.45.28.29 linkwechat.nacos.host=120.79.64.17
linkwechat.nacos.port=10848 linkwechat.nacos.port=10848
linkwechat.nacos.namespace=01cf833f-249e-4483-a286-46d37f018fe7 linkwechat.nacos.namespace=1cc3943c-fed8-46e6-907e-2d52b72044a5
linkwechat.nacos.username=prod linkwechat.nacos.username=nacos
linkwechat.nacos.password=prod@admin123 linkwechat.nacos.password=0p-0p-0p-
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -14,6 +15,7 @@ import lombok.Data; ...@@ -14,6 +15,7 @@ import lombok.Data;
**/ **/
@ApiModel @ApiModel
@Data @Data
@TableName("we_material")
public class WeMaterial extends BaseEntity { public class WeMaterial extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeMaterial; import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.dto.WeMediaDto; import com.linkwechat.wecom.domain.dto.WeMediaDto;
import com.linkwechat.wecom.domain.vo.WeMaterialFileVO; import com.linkwechat.wecom.domain.vo.WeMaterialFileVO;
...@@ -15,7 +16,7 @@ import java.util.List; ...@@ -15,7 +16,7 @@ import java.util.List;
* @author KEWEN * @author KEWEN
* @date 2020-10-08 * @date 2020-10-08
*/ */
public interface IWeMaterialService { public interface IWeMaterialService extends IService<WeMaterial> {
/** /**
* 上传素材信息 * 上传素材信息
......
...@@ -494,12 +494,14 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -494,12 +494,14 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
}else{//为空,取消当前客户所有标签 }else{//为空,取消当前客户所有标签
List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels = iWeFlowerCustomerTagRelService.list(new LambdaQueryWrapper<WeFlowerCustomerTagRel>() List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels = iWeFlowerCustomerTagRelService.list(new LambdaQueryWrapper<WeFlowerCustomerTagRel>()
.eq(WeFlowerCustomerTagRel::getExternalUserid, weMakeCustomerTag.getExternalUserid()) .eq(WeFlowerCustomerTagRel::getExternalUserid, weMakeCustomerTag.getExternalUserid())
.eq(WeFlowerCustomerTagRel::getUserId, weMakeCustomerTag.getUserId())); .eq(WeFlowerCustomerTagRel::getUserId, weMakeCustomerTag.getUserId())
.eq(WeFlowerCustomerTagRel::getIsCompanyTag,weMakeCustomerTag.getIsCompanyTag()));
if(CollectionUtil.isNotEmpty(weFlowerCustomerTagRels)){ if(CollectionUtil.isNotEmpty(weFlowerCustomerTagRels)){
if(iWeFlowerCustomerTagRelService.remove( if(iWeFlowerCustomerTagRelService.remove(
new LambdaQueryWrapper<WeFlowerCustomerTagRel>() new LambdaQueryWrapper<WeFlowerCustomerTagRel>()
.eq(WeFlowerCustomerTagRel::getExternalUserid, weMakeCustomerTag.getExternalUserid()) .eq(WeFlowerCustomerTagRel::getExternalUserid, weMakeCustomerTag.getExternalUserid())
.eq(WeFlowerCustomerTagRel::getUserId, weMakeCustomerTag.getUserId()))){ .eq(WeFlowerCustomerTagRel::getUserId, weMakeCustomerTag.getUserId())
.eq(WeFlowerCustomerTagRel::getIsCompanyTag,weMakeCustomerTag.getIsCompanyTag()))){
if(weMakeCustomerTag.getIsCompanyTag()){ if(weMakeCustomerTag.getIsCompanyTag()){
//同步企业微信端 //同步企业微信端
weCustomerClient.makeCustomerLabel( weCustomerClient.makeCustomerLabel(
...@@ -767,13 +769,37 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -767,13 +769,37 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
weCustomerList.stream().forEach(k->{ weCustomerList.stream().forEach(k->{
//检索当前员工对应的客户有没有带跟进状态,如果没有插入
List<WeCustomerTrajectory> weCustomerTrajectories = iWeCustomerTrajectoryService.list(new LambdaQueryWrapper<WeCustomerTrajectory>()
.eq(WeCustomerTrajectory::getExternalUserid, k.getExternalUserid())
.eq(WeCustomerTrajectory::getUserId, k.getFirstUserId())
.eq(WeCustomerTrajectory::getTrajectoryType, TrajectoryType.TRAJECTORY_TYPE_DBDT.getType())
.eq(WeCustomerTrajectory::getTrackState,TrackState.STATE_DGJ.getType()));
if(CollectionUtil.isEmpty(weCustomerTrajectories)){
iWeCustomerTrajectoryService.save(
WeCustomerTrajectory.builder()
.externalUserid(k.getExternalUserid())
.trajectoryType(TrajectoryType.TRAJECTORY_TYPE_DBDT.getType())
.userId(k.getFirstUserId())
.trackState(TrackState.STATE_DGJ.getType())
.trackTime(k.getFirstAddTime())
.title("新增成员")
.content("新增待跟进")
.build()
);
}
trackStates.add(WeCustomerDetail.TrackStates trackStates.add(WeCustomerDetail.TrackStates
.builder() .builder()
.userName(k.getUserName()) .userName(k.getUserName())
.trackStateList(iWeCustomerTrajectoryService.list(new LambdaQueryWrapper<WeCustomerTrajectory>() .trackStateList(iWeCustomerTrajectoryService.list(new LambdaQueryWrapper<WeCustomerTrajectory>()
.eq(WeCustomerTrajectory::getExternalUserid, k.getExternalUserid()) .eq(WeCustomerTrajectory::getExternalUserid, k.getExternalUserid())
.eq(WeCustomerTrajectory::getUserId, k.getFirstUserId()))) .eq(WeCustomerTrajectory::getUserId, k.getFirstUserId())
.eq(WeCustomerTrajectory::getTrajectoryType, TrajectoryType.TRAJECTORY_TYPE_DBDT.getType())
.orderByAsc(WeCustomerTrajectory::getTrackTime)))
.build()); .build());
trackUsers.add( trackUsers.add(
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dtflys.forest.http.ForestResponse; import com.dtflys.forest.http.ForestResponse;
import com.linkwechat.common.config.CosConfig; import com.linkwechat.common.config.CosConfig;
import com.linkwechat.common.config.RuoYiConfig; import com.linkwechat.common.config.RuoYiConfig;
...@@ -46,7 +47,7 @@ import java.util.Optional; ...@@ -46,7 +47,7 @@ import java.util.Optional;
*/ */
@Slf4j @Slf4j
@Service @Service
public class WeMaterialServiceImpl implements IWeMaterialService { public class WeMaterialServiceImpl extends ServiceImpl<WeMaterialMapper,WeMaterial> implements IWeMaterialService {
@Autowired @Autowired
private WeMaterialMapper weMaterialMapper; private WeMaterialMapper weMaterialMapper;
......
...@@ -137,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -137,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wc.track_content as content wc.track_content as content
FROM FROM
we_customer wc we_customer wc
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.user_id = wc.first_user_id AND wfcrf.del_flag=0 LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.user_id = wc.first_user_id AND wfcrf.external_userid=wc.external_userid AND wfcrf.del_flag=0
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
WHERE wc.external_userid=#{externalUserid} and wc.first_user_id=#{userid} WHERE wc.external_userid=#{externalUserid} and wc.first_user_id=#{userid}
</select> </select>
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
<select id="filterByNameOrKeyword" parameterType="String" resultMap="WeKeywordGroupTaskResult"> <select id="filterByNameOrKeyword" parameterType="String" resultMap="WeKeywordGroupTaskResult">
<include refid="selectTaskVo" /> <include refid="selectTaskVo" />
WHERE wkg.task_name LIKE CONCAT("%",#{word},"%") WHERE wkg.del_flag=0 and wkg.task_name LIKE CONCAT("%",#{word},"%")
OR FIND_IN_SET(#{word}, wkg.keywords) OR FIND_IN_SET(#{word}, wkg.keywords)
GROUP BY wkg.task_id GROUP BY wkg.task_id
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!