Commit 9699537c by xugaojun

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

parent a9aaddee
...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.out.impl; ...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkQwDTO; 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.EntityUtil;
import com.gic.commons.util.GICMQClientUtil; import com.gic.commons.util.GICMQClientUtil;
import com.gic.commons.util.GlobalInfo; import com.gic.commons.util.GlobalInfo;
...@@ -38,6 +39,8 @@ import org.springframework.stereotype.Service; ...@@ -38,6 +39,8 @@ import org.springframework.stereotype.Service;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* 接收企业微信或者gic推送消息进行处理 * 接收企业微信或者gic推送消息进行处理
...@@ -84,6 +87,8 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -84,6 +87,8 @@ public class MessageApiServiceImpl implements MessageApiService {
@Autowired @Autowired
private WxEnterpriseRelatedService wxEnterpriseRelatedService; private WxEnterpriseRelatedService wxEnterpriseRelatedService;
@Autowired
private ClerkService clerkService;
@Override @Override
public void gicMessageReceive(GicMessageDTO gicMessageDTO) { public void gicMessageReceive(GicMessageDTO gicMessageDTO) {
...@@ -134,8 +139,8 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -134,8 +139,8 @@ public class MessageApiServiceImpl implements MessageApiService {
return; return;
} }
ServiceResponse response = staffApiService.getWxSaveNew(dto.getUserid(), enterprise.getWxEnterpriseId()); ServiceResponse response = staffApiService.getWxSaveNew(dto.getUserid(), enterprise.getWxEnterpriseId());
if (response.getCode() != 1){ if (response.getCode() != 1) {
log.info("添加企业员工失败参数:{}",response.getMessage()); log.info("添加企业员工失败:{}", response.getMessage());
return; return;
} }
// 取第一个企业的id // 取第一个企业的id
...@@ -155,6 +160,14 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -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) { private boolean checkErkeDeal(QywxCallBackDTO dto) {
if (Objects.isNull(dto) || StringUtils.isEmpty(dto.getUserid())) { if (Objects.isNull(dto) || StringUtils.isEmpty(dto.getUserid())) {
return false; return false;
...@@ -170,16 +183,24 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -170,16 +183,24 @@ public class MessageApiServiceImpl implements MessageApiService {
private void doDealUser(QywxCallBackDTO dto, String enterpriseId) { private void doDealUser(QywxCallBackDTO dto, String enterpriseId) {
ClerkQwDTO clerkQwDTO = new ClerkQwDTO(); ClerkQwDTO clerkQwDTO = new ClerkQwDTO();
clerkQwDTO.setEnterpriseId(enterpriseId); clerkQwDTO.setEnterpriseId(enterpriseId);
// TODO: 2022/1/24 获取部门名称 String mainDeptId = dto.getMainDepartment();
clerkQwDTO.setStoreName(""); 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.setClerkCode(dto.getUserid());
clerkQwDTO.setClerkName(dto.getUserName()); clerkQwDTO.setClerkName(dto.getUserName());
// TODO: 2022/1/24 数组第一个 clerkQwDTO.setClerkType(dto.getIsLeaderInDept()[0]);
clerkQwDTO.setClerkType(1);
clerkQwDTO.setClerkGener(dto.getGender()); clerkQwDTO.setClerkGener(dto.getGender());
clerkQwDTO.setPhoneNumber(dto.getMobile()); clerkQwDTO.setPhoneNumber(dto.getMobile());
clerkQwDTO.setNationcode(dto.getTelephone()); clerkQwDTO.setNationcode(dto.getTelephone());
// TODO: 2022/1/24 调用接口 // 调用换导购接口逻辑
clerkService.syncClerkForQw(clerkQwDTO);
} }
private void dealDepartment(QywxCallBackDTO qywxCallBackDTO) { 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