Commit 1c8b9e83 by 墨竹

fix:活码修改

parent 6793fcf3
......@@ -122,6 +122,15 @@ public interface HmQrcodeApiService {
*/
void checkStaffOpenContact(String param);
/**
* 检查员工开启联系我
*
* @param wxEnterpriseId wx企业标识
* @author mozhu
* @date 2022-07-19 15:53:37
*/
void checkStaffOpenContactByWxEnterpriseId(String wxEnterpriseId);
/**
* 活码门店ids
......
......@@ -60,7 +60,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
......@@ -600,9 +599,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
//查询出所有正常的导购
String wxEnterpriseId = tabHaobanWxEnterpris.getWxEnterpriseId();
//企微已经开启联系我
String wxUserIds = qywxUserApiService.listCorpExternalUser(tabHaobanWxEnterpris.getCorpid(), config.getWxSuiteid());
String[] split = wxUserIds.split(",");
List<String> wxUserIdsList = Arrays.asList(split);
List<String> wxUserIdsList = qywxUserApiService.listCorpExternalUser(tabHaobanWxEnterpris.getCorpid(), config.getWxSuiteid());
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listIdsByWxOpenUserIds(wxUserIdsList, wxEnterpriseId);
if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) {
logger.error("无导购关联数据");
......@@ -643,6 +640,49 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
@Override
public void checkStaffOpenContactByWxEnterpriseId(String wxEnterpriseId) {
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
//查询出所有正常的导购
//企微已经开启联系我
List<String> wxUserIdsList = qywxUserApiService.listCorpExternalUser(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid());
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listIdsByWxOpenUserIds(wxUserIdsList, wxEnterpriseId);
if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) {
logger.error("无导购关联数据");
return;
}
for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) {
//具有联系我功能的导购创建活码
staffClerkRelationService.updateOpenConcatFlagById(1, staffClerkRelationDTO.getStaffClerkRelationId());
//创建活码
HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO();
hmQrcodeQDTO.setHmType(1);
hmQrcodeQDTO.setWxEnterpriseId(wxEnterpriseId);
hmQrcodeQDTO.setEnterpriseId(staffClerkRelationDTO.getEnterpriseId());
hmQrcodeQDTO.setName(staffClerkRelationDTO.getStaffName());
hmQrcodeQDTO.setPassFlag(1);
hmQrcodeQDTO.setStoreId(staffClerkRelationDTO.getStoreId());
hmQrcodeQDTO.setClerkIdList(Collections.singletonList(staffClerkRelationDTO.getClerkId()));
add(hmQrcodeQDTO);
}
List<StaffClerkRelationDTO> relationDTOS = staffClerkRelationService.listIdsByNotInWxOpenUserIds(wxUserIdsList, wxEnterpriseId);
if (CollectionUtils.isEmpty(relationDTOS)) {
logger.error("无导购不包含关联数据");
return;
}
for (StaffClerkRelationDTO relationDTO : relationDTOS) {
//有活码,但是企微联系我功能 被关闭
String clerkId = relationDTO.getClerkId();
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, relationDTO.getWxEnterpriseId());
if (hmQrcodeBO == null) {
logger.info("导购无活码,无需处理:clerkId:{}", clerkId);
continue;
}
hmQrcodeService.updateStatusById(hmQrcodeBO.getHmId(), 3);
}
}
@Override
public List<HmQrcodeStoreDTO> getHmStoreByEnterpriseId(String enterpriseId) {
String key = "HM:STORE:" + enterpriseId;
Object cache = RedisUtil.getCache(key);
......
......@@ -51,4 +51,9 @@ public class ServiceTest {
}
@Test
public void test2() {
hmQrcodeApiService.checkStaffOpenContactByWxEnterpriseId("5bd929fd3b2c49deaa1184bcb0d669b3");
}
}
......@@ -7,6 +7,7 @@ import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.QywxXcxSendMessageQo;
......@@ -61,17 +62,12 @@ public class TestController extends WebBaseController {
private TestApiService testApiService;
@Autowired
private DepartmentApiService departmentApiService;
@Autowired
private MaidianLogApiService maidianLogApiService;
@Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired
private ExternalClerkRelatedApiService externalClerkRelatedApiService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private QywxUserApiService qywxUserApiService;
......@@ -81,6 +77,8 @@ public class TestController extends WebBaseController {
private WxApplicationApiService wxApplicationApiService;
@Autowired
private Config config;
@Autowired
private HmQrcodeApiService hmQrcodeApiService;
@RequestMapping("/send-message-test")
public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) {
......@@ -321,4 +319,11 @@ public class TestController extends WebBaseController {
List<QywxNewUseridDTO> list = qywxUserApiService.getSelfUseridToOpenuserid(corpid, secret, Arrays.asList(split));
return resultResponse(HaoBanErrCode.ERR_1, list);
}
@RequestMapping("/checkStaffOpenContactByWxEnterpriseId")
public HaobanResponse checkStaffOpenContact(String wxEnterpriseId) {
hmQrcodeApiService.checkStaffOpenContactByWxEnterpriseId(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
......@@ -126,8 +126,11 @@ public class HmQrcodeController {
if (CollectionUtils.isEmpty(storeList)) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100007.getCode()),HaoBanErrCode.ERR_100007.getMsg());
}
if (!storeList.contains("-1")) {
hmQrcodeListQO.getInFields().setStoreId(storeList);
StringBuffer stringBuffer = new StringBuffer();
storeList.forEach(c-> stringBuffer.append(c).append(","));
hmQrcodeListQO.getInFields().setStoreId(stringBuffer.toString());
}
StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_list, hmQrcodeListQO);
......
......@@ -2,7 +2,6 @@ package com.gic.haoban.manage.web.qo.hm.data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 活码(TabHaobanHmQrcode)实体类
......@@ -76,7 +75,7 @@ public class HmQrcodeListQO implements Serializable {
*/
private Long hmGroupId;
private List<String> storeId;
private String storeId;
public Long getHmId() {
return hmId;
......@@ -174,11 +173,11 @@ public class HmQrcodeListQO implements Serializable {
this.hmGroupId = hmGroupId;
}
public List<String> getStoreId() {
public String getStoreId() {
return storeId;
}
public void setStoreId(List<String> storeId) {
public void setStoreId(String storeId) {
this.storeId = storeId;
}
}
......
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