修复客户轨迹相关bug

1 parent a6515e3f
package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.WeConstans;
......@@ -8,6 +9,8 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
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.utils.StringUtils;
import com.linkwechat.wecom.constants.SynchRecordConstants;
......@@ -210,12 +213,8 @@ public class WeCustomerController extends BaseController
List<WeCustomerTrajectory> weCustomerTrajectories = iWeCustomerTrajectoryService
.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;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
......@@ -23,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
......@@ -132,10 +134,11 @@ public class WeMaterialController extends BaseController {
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
@GetMapping("/temporaryMaterialMediaId")
@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,
type
,name);
,new String(name.getBytes(),"UTF-8"));
return AjaxResult.success(weMediaDto);
}
......
linkwechat.nacos.host=119.45.28.29
linkwechat.nacos.host=120.79.64.17
linkwechat.nacos.port=10848
linkwechat.nacos.namespace=01cf833f-249e-4483-a286-46d37f018fe7
linkwechat.nacos.username=prod
linkwechat.nacos.password=prod@admin123
linkwechat.nacos.namespace=1cc3943c-fed8-46e6-907e-2d52b72044a5
linkwechat.nacos.username=nacos
linkwechat.nacos.password=0p-0p-0p-
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel;
......@@ -14,6 +15,7 @@ import lombok.Data;
**/
@ApiModel
@Data
@TableName("we_material")
public class WeMaterial extends BaseEntity {
private static final long serialVersionUID = 1L;
......
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.dto.WeMediaDto;
import com.linkwechat.wecom.domain.vo.WeMaterialFileVO;
......@@ -15,7 +16,7 @@ import java.util.List;
* @author KEWEN
* @date 2020-10-08
*/
public interface IWeMaterialService {
public interface IWeMaterialService extends IService<WeMaterial> {
/**
* 上传素材信息
......
......@@ -494,12 +494,14 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
}else{//为空,取消当前客户所有标签
List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels = iWeFlowerCustomerTagRelService.list(new LambdaQueryWrapper<WeFlowerCustomerTagRel>()
.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(iWeFlowerCustomerTagRelService.remove(
new LambdaQueryWrapper<WeFlowerCustomerTagRel>()
.eq(WeFlowerCustomerTagRel::getExternalUserid, weMakeCustomerTag.getExternalUserid())
.eq(WeFlowerCustomerTagRel::getUserId, weMakeCustomerTag.getUserId()))){
.eq(WeFlowerCustomerTagRel::getUserId, weMakeCustomerTag.getUserId())
.eq(WeFlowerCustomerTagRel::getIsCompanyTag,weMakeCustomerTag.getIsCompanyTag()))){
if(weMakeCustomerTag.getIsCompanyTag()){
//同步企业微信端
weCustomerClient.makeCustomerLabel(
......@@ -767,13 +769,37 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
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
.builder()
.userName(k.getUserName())
.trackStateList(iWeCustomerTrajectoryService.list(new LambdaQueryWrapper<WeCustomerTrajectory>()
.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());
trackUsers.add(
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dtflys.forest.http.ForestResponse;
import com.linkwechat.common.config.CosConfig;
import com.linkwechat.common.config.RuoYiConfig;
......@@ -46,7 +47,7 @@ import java.util.Optional;
*/
@Slf4j
@Service
public class WeMaterialServiceImpl implements IWeMaterialService {
public class WeMaterialServiceImpl extends ServiceImpl<WeMaterialMapper,WeMaterial> implements IWeMaterialService {
@Autowired
private WeMaterialMapper weMaterialMapper;
......
......@@ -137,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wc.track_content as content
FROM
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
WHERE wc.external_userid=#{externalUserid} and wc.first_user_id=#{userid}
</select>
......
......@@ -101,7 +101,7 @@
<select id="filterByNameOrKeyword" parameterType="String" resultMap="WeKeywordGroupTaskResult">
<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)
GROUP BY wkg.task_id
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!