Commit 9699537c by xugaojun

[鸿星尔克定制开发]:回调处理,更改店员接口调用

parent a9aaddee
......@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkQwDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.commons.util.GlobalInfo;
......@@ -38,6 +39,8 @@ import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 接收企业微信或者gic推送消息进行处理
......@@ -84,6 +87,8 @@ public class MessageApiServiceImpl implements MessageApiService {
@Autowired
private WxEnterpriseRelatedService wxEnterpriseRelatedService;
@Autowired
private ClerkService clerkService;
@Override
public void gicMessageReceive(GicMessageDTO gicMessageDTO) {
......@@ -134,8 +139,8 @@ public class MessageApiServiceImpl implements MessageApiService {
return;
}
ServiceResponse response = staffApiService.getWxSaveNew(dto.getUserid(), enterprise.getWxEnterpriseId());
if (response.getCode() != 1){
log.info("添加企业员工失败参数:{}",response.getMessage());
if (response.getCode() != 1) {
log.info("添加企业员工失败:{}", response.getMessage());
return;
}
// 取第一个企业的id
......@@ -155,6 +160,14 @@ public class MessageApiServiceImpl implements MessageApiService {
// }
}
/**
* desc: 鸿星尔克定制需求校验-后期可扩展为配置形式
*
* @param dto dto
* @return : {@link boolean}
* @author : YongEn
* @date : 2022/1/25
*/
private boolean checkErkeDeal(QywxCallBackDTO dto) {
if (Objects.isNull(dto) || StringUtils.isEmpty(dto.getUserid())) {
return false;
......@@ -170,16 +183,24 @@ public class MessageApiServiceImpl implements MessageApiService {
private void doDealUser(QywxCallBackDTO dto, String enterpriseId) {
ClerkQwDTO clerkQwDTO = new ClerkQwDTO();
clerkQwDTO.setEnterpriseId(enterpriseId);
// TODO: 2022/1/24 获取部门名称
clerkQwDTO.setStoreName("");
String mainDeptId = dto.getMainDepartment();
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> departments = qywxDepartmentApiService.listDepartment(dto.getAuthCorpId(), dto.getSuiteId(), Integer.valueOf(mainDeptId));
if (CollectionUtils.isEmpty(departments)) {
log.info("通过主部门查询部门列表为空 mainDeptId:{}", mainDeptId);
return;
}
Map<Integer, com.gic.wechat.api.dto.qywx.DepartmentDTO> departmentIdMap = departments.stream()
.collect(Collectors.toMap(com.gic.wechat.api.dto.qywx.DepartmentDTO::getId, Function.identity(), (a, b) -> a));
com.gic.wechat.api.dto.qywx.DepartmentDTO mainDept = departmentIdMap.get(Integer.valueOf(mainDeptId));
clerkQwDTO.setStoreName(mainDept.getName());
clerkQwDTO.setClerkCode(dto.getUserid());
clerkQwDTO.setClerkName(dto.getUserName());
// TODO: 2022/1/24 数组第一个
clerkQwDTO.setClerkType(1);
clerkQwDTO.setClerkType(dto.getIsLeaderInDept()[0]);
clerkQwDTO.setClerkGener(dto.getGender());
clerkQwDTO.setPhoneNumber(dto.getMobile());
clerkQwDTO.setNationcode(dto.getTelephone());
// TODO: 2022/1/24 调用接口
// 调用换导购接口逻辑
clerkService.syncClerkForQw(clerkQwDTO);
}
private void dealDepartment(QywxCallBackDTO qywxCallBackDTO) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment