提交 7cb3470d 编写于 作者: S sunxiwang

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

......@@ -30,7 +30,7 @@ public class WeCategoryController extends BaseController {
/**
* 类目树
*/
@PreAuthorize("@ss.hasPermi('wechat:category:list')")
// @PreAuthorize("@ss.hasPermi('wechat:category:list')")
@GetMapping("/list")
@ApiOperation("类目树")
public AjaxResult list(@RequestParam("mediaType") String mediaType) {
......@@ -40,7 +40,7 @@ public class WeCategoryController extends BaseController {
/**
* 通过id查询类目详细信息
*/
@PreAuthorize("@ss.hasPermi('wechat:category:query')")
// @PreAuthorize("@ss.hasPermi('wechat:category:query')")
@GetMapping(value = "/{id}")
@ApiOperation("通过id查询类目详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id) {
......@@ -50,7 +50,7 @@ public class WeCategoryController extends BaseController {
/**
* 添加类目
*/
@PreAuthorize("@ss.hasPermi('wechat:category:add')")
// @PreAuthorize("@ss.hasPermi('wechat:category:add')")
@Log(title = "添加类目", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("添加类目")
......@@ -61,7 +61,7 @@ public class WeCategoryController extends BaseController {
/**
* 更新目录
*/
@PreAuthorize("@ss.hasPermi('wechat:category:edit')")
// @PreAuthorize("@ss.hasPermi('wechat:category:edit')")
@Log(title = "更新目录", businessType = BusinessType.UPDATE)
@PutMapping
@ApiOperation("更新目录")
......@@ -73,7 +73,7 @@ public class WeCategoryController extends BaseController {
/**
* 删除类目
*/
@PreAuthorize("@ss.hasPermi('wechat:category:remove')")
// @PreAuthorize("@ss.hasPermi('wechat:category:remove')")
@Log(title = "删除类目", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@ApiOperation("删除类目")
......
......@@ -39,7 +39,7 @@ public class WeChatContactMappingController extends BaseController
/**
* 查询聊天关系映射列表
*/
@PreAuthorize("@ss.hasPermi('chat:mapping:list')")
// @PreAuthorize("@ss.hasPermi('chat:mapping:list')")
@GetMapping("/list")
public TableDataInfo list(WeChatContactMapping weChatContactMapping)
{
......@@ -51,7 +51,7 @@ public class WeChatContactMappingController extends BaseController
/**
* 按客户查询关系映射列表
*/
@PreAuthorize("@ss.hasPermi('chat:mapping:listByCustomer')")
// @PreAuthorize("@ss.hasPermi('chat:mapping:listByCustomer')")
@GetMapping("/listByCustomer")
public TableDataInfo listByCustomer()
{
......@@ -63,7 +63,7 @@ public class WeChatContactMappingController extends BaseController
/**
* 导出聊天关系映射列表
*/
@PreAuthorize("@ss.hasPermi('chat:mapping:export')")
// @PreAuthorize("@ss.hasPermi('chat:mapping:export')")
@Log(title = "聊天关系映射", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(WeChatContactMapping weChatContactMapping)
......@@ -76,7 +76,7 @@ public class WeChatContactMappingController extends BaseController
/**
* 获取聊天关系映射详细信息
*/
@PreAuthorize("@ss.hasPermi('chat:mapping:query')")
// @PreAuthorize("@ss.hasPermi('chat:mapping:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
......@@ -86,7 +86,7 @@ public class WeChatContactMappingController extends BaseController
/**
* 新增聊天关系映射
*/
@PreAuthorize("@ss.hasPermi('chat:mapping:add')")
// @PreAuthorize("@ss.hasPermi('chat:mapping:add')")
@Log(title = "聊天关系映射", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WeChatContactMapping weChatContactMapping)
......@@ -97,7 +97,7 @@ public class WeChatContactMappingController extends BaseController
/**
* 修改聊天关系映射
*/
@PreAuthorize("@ss.hasPermi('chat:mapping:edit')")
// @PreAuthorize("@ss.hasPermi('chat:mapping:edit')")
@Log(title = "聊天关系映射", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WeChatContactMapping weChatContactMapping)
......@@ -108,7 +108,7 @@ public class WeChatContactMappingController extends BaseController
/**
* 删除聊天关系映射
*/
@PreAuthorize("@ss.hasPermi('chat:mapping:remove')")
// @PreAuthorize("@ss.hasPermi('chat:mapping:remove')")
@Log(title = "聊天关系映射", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
......
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.wecom.domain.WeCustomerPortrait;
import com.linkwechat.wecom.domain.WeTagGroup;
import com.linkwechat.wecom.service.IWeCustomerService;
import com.linkwechat.wecom.service.IWeTagGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @description: 客户画像相关controller
* @author: HaoN
* @create: 2021-03-03 15:10
**/
@RestController
@RequestMapping("/wecom/portrait")
public class WeCustomerPortraitController extends BaseController {
@Autowired
private IWeCustomerService iWeCustomerService;
@Autowired
private IWeTagGroupService weTagGroupService;
/**
* 根据客户id和当前企业员工id获取员工详细信息
* @param externalUserid
* @param operUserid
* @return
*/
@GetMapping(value = "/findWeCustomerInfo")
public AjaxResult findWeCustomerInfo(String externalUserid, String operUserid){
return AjaxResult.success(
iWeCustomerService.findCustomerByOperUseridAndCustomerId(externalUserid,operUserid)
);
}
/**
* 客户画像资料更新
* @param weCustomerPortrait
* @return
*/
@PostMapping(value = "/updateWeCustomerInfo")
public AjaxResult updateWeCustomerInfo(@RequestBody WeCustomerPortrait weCustomerPortrait){
iWeCustomerService.updateWeCustomerPortrait(weCustomerPortrait);
return AjaxResult.success();
}
/**
* 获取当前系统所有可用标签
* @return
*/
@GetMapping(value = "/findAllTags")
public AjaxResult findAllTags(){
return AjaxResult.success(
weTagGroupService.selectWeTagGroupList(
WeTagGroup.builder()
.build()
)
);
}
}
package com.linkwechat.wecom.domain;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @description: 客户画像实体VO
* @author: HaoN
* @create: 2021-03-03 11:49
**/
@Data
public class WeCustomerPortrait {
//外部联系人id
private String externalUserid;
//企业员工id
private String operUserid;
//客户与企业员工关系id
private String flowerCustomerRelId;
//客户昵称
private String name;
//客户备注
private String remark;
//备注客户手机号
private String remarkMobiles;
//客户生日
private Date birthday;
//邮箱
private String email;
//地址
private String address;
//qq
private String qq;
//职业
private String position;
//公司
private String remarkCorpName;
//描述
private String description;
//客户标签
private List<WeTagGroup> weTagGroupList;
}
package com.linkwechat.wecom.domain;
import lombok.Data;
/**
* @description: 客户画像标签
* @author: HaoN
* @create: 2021-03-04 12:31
**/
@Data
public class WeCustomerPortraitTag {
}
......@@ -89,4 +89,23 @@ public class WeFlowerCustomerRel
@TableField(exist = false)
private String endTime;
/** 备注 */
private String remark;
/** 邮件 */
private String email;
/** qq */
private String qq;
/**地址*/
private String address;
}
......@@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerPortrait;
import com.linkwechat.wecom.domain.WeUser;
import org.apache.ibatis.annotations.Param;
......@@ -77,4 +78,17 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @return
*/
List<WeUser> getCustomerByTag(List<String> ids);
/**
* 根据外部联系人ID和企业员工ID获取当前客户信息
* @param externalUserid
* @param operUserid
* @return
*/
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(@Param("externalUserid") String externalUserid,@Param("operUserid") String operUserid);
}
......@@ -62,4 +62,16 @@ public interface WeTagGroupMapper extends BaseMapper<WeTagGroup>
* @return
*/
public int batchInsetWeTagGroup(@Param("weTagGroups") List<WeTagGroup> weTagGroups);
/**
* 根据企业员工与添加客户关系id给客户打标签
* @param flowerCustomerRelId
* @return
*/
public List<WeTagGroup> findCustomerTagByFlowerCustomerRelId(@Param("flowerCustomerRelId") String flowerCustomerRelId);
}
......@@ -2,12 +2,12 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerPortrait;
import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.dto.WeWelcomeMsg;
import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import java.util.List;
/**
......@@ -109,4 +109,22 @@ public interface IWeCustomerService extends IService<WeCustomer>
* @return
*/
public List<WeUser> getCustomerByTag(List<String> ids);
/**
* 根据外部联系人ID和企业员工ID获取当前客户信息
* @param externalUserid
* @param operUserid
* @return
*/
WeCustomerPortrait findCustomerByOperUseridAndCustomerId(String externalUserid,String operUserid);
/**
* 跟新客户画像
* @param weCustomerPortrait
*/
void updateWeCustomerPortrait(WeCustomerPortrait weCustomerPortrait);
}
package com.linkwechat.wecom.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeTagGroup;
import com.linkwechat.wecom.domain.dto.tag.WeCropGroupTagDto;
import java.util.List;
/**
* 标签组Service接口
*
......@@ -69,4 +69,13 @@ public interface IWeTagGroupService extends IService<WeTagGroup>
void deleteTagGroup(String id);
void updateTagGroup(String id);
/**
* 根据企业员工与添加客户关系id给客户打标签
* @param flowerCustomerRelId
* @return
*/
public List<WeTagGroup> findCustomerTagByFlowerCustomerRelId(String flowerCustomerRelId);
}
......@@ -626,4 +626,45 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
}
@Override
public WeCustomerPortrait findCustomerByOperUseridAndCustomerId(String externalUserid, String operUserid) {
WeCustomerPortrait weCustomerPortrait
= weCustomerMapper.findCustomerByOperUseridAndCustomerId(externalUserid, operUserid);
if(null != weCustomerPortrait){
//获取当前客户拥有得标签
weCustomerPortrait.setWeTagGroupList(
iWeTagGroupService.findCustomerTagByFlowerCustomerRelId(
weCustomerPortrait.getFlowerCustomerRelId()
)
);
}
return weCustomerPortrait;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateWeCustomerPortrait(WeCustomerPortrait weCustomerPortrait) {
WeCustomer weCustomer
= WeCustomer.builder().build();
BeanUtils.copyBeanProp(weCustomer,weCustomerPortrait);
//更新用户基本信息表
this.updateById(
weCustomer
);
WeFlowerCustomerRel weFlowerCustomerRel = WeFlowerCustomerRel.builder().build();
BeanUtils.copyBeanProp(weFlowerCustomerRel,weCustomerPortrait);
//更新企业添加人表
iWeFlowerCustomerRelService.update(weFlowerCustomerRel,new LambdaQueryWrapper<WeFlowerCustomerRel>()
.eq(WeFlowerCustomerRel::getExternalUserid,weCustomerPortrait.getExternalUserid())
.eq(WeFlowerCustomerRel::getOperUserid,weCustomerPortrait.getOperUserid()));
}
}
......@@ -337,5 +337,10 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
}
}
@Override
public List<WeTagGroup> findCustomerTagByFlowerCustomerRelId(String flowerCustomerRelId) {
return this.baseMapper.findCustomerTagByFlowerCustomerRelId(flowerCustomerRelId);
}
}
......@@ -303,4 +303,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="findCustomerByOperUseridAndCustomerId" resultType="com.linkwechat.wecom.domain.WeCustomerPortrait">
SELECT
wc.`name`,
wfcr.remark,
wfcr.remark_mobiles,
wc.birthday,
wfcr.email,
wfcr.address,
wfcr.qq,
wc.position,
wfcr.remark_corp_name,
wfcr.description,
wfcr.id as flowerCustomerRelId
FROM
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr on wc.external_userid=wfcr.external_userid
WHERE wc.external_userid=#{externalUserid} and wfcr.oper_userid=#{operUserid}
</select>
</mapper>
\ No newline at end of file
......@@ -101,5 +101,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</insert>
<select id="findCustomerTagByFlowerCustomerRelId" resultMap="WeTagGroupResult">
SELECT
wt.tag_id,
wt.`name`,
wtg.gourp_name,
wtg.group_id
FROM
we_flower_customer_tag_rel wfctr
INNER JOIN we_tag wt ON wfctr.tag_id = wt.tag_id
INNER JOIN we_tag_group wtg ON wt.group_id = wtg.group_id
WHERE wt.`status`=0 and wtg.`status`=0 and wfctr.flower_customer_rel_id=#{flowerCustomerRelId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册