Commit f28ad3d2 by 墨竹

fix:活码定时任务修改

parent f8bf5610
...@@ -204,6 +204,18 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -204,6 +204,18 @@ public interface TabHaobanStaffClerkRelationMapper {
List<String> listWxUserIdByClerkIds(@Param("clerkIds") List<String> clerkIds, List<String> listWxUserIdByClerkIds(@Param("clerkIds") List<String> clerkIds,
@Param("wxEnterpriseId") String wxEnterpriseId); @Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 根据导购查询wxopenuserid
*
* @param clerkIds 职员id
* @param wxEnterpriseId wx企业标识
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-08-09 00:42:31
*/
List<String> listWxOpenUserIdByClerkIds(@Param("clerkIds") List<String> clerkIds,
@Param("wxEnterpriseId") String wxEnterpriseId);
/** /**
* 通过userId 查询id * 通过userId 查询id
......
...@@ -8,6 +8,7 @@ import com.gic.haoban.base.api.common.BasePageInfo; ...@@ -8,6 +8,7 @@ import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.enums.BindTypeEnum; import com.gic.haoban.manage.api.enums.BindTypeEnum;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum; import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
...@@ -57,6 +58,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -57,6 +58,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
private StaffService staffService; private StaffService staffService;
@Autowired @Autowired
private HmClerkRelationApiService hmClerkRelationApiService; private HmClerkRelationApiService hmClerkRelationApiService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Override @Override
public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) { public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) {
...@@ -322,6 +325,11 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -322,6 +325,11 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
if (CollectionUtils.isEmpty(clerkList)) { if (CollectionUtils.isEmpty(clerkList)) {
return null; return null;
} }
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
String corpid = wxEnterpriseDTO.getCorpid();
if (corpid.length() > 20) {
return mapper.listWxOpenUserIdByClerkIds(clerkList, wxEnterpriseId);
}
return mapper.listWxUserIdByClerkIds(clerkList, wxEnterpriseId); return mapper.listWxUserIdByClerkIds(clerkList, wxEnterpriseId);
} }
......
...@@ -142,13 +142,14 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -142,13 +142,14 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
qywxExternalcontactDTO.setRemark(hmQrcodeQDTO.getName()); qywxExternalcontactDTO.setRemark(hmQrcodeQDTO.getName());
qywxExternalcontactDTO.setSkipVerify(hmQrcodeQDTO.getPassFlag() == 1); qywxExternalcontactDTO.setSkipVerify(hmQrcodeQDTO.getPassFlag() == 1);
qywxExternalcontactDTO.setState("HM" + hmId); qywxExternalcontactDTO.setState("HM" + hmId);
String corpid = wxEnterpriseDTO.getCorpid();
List<String> userIds = staffClerkRelationService.listWxUserIdByClerkIds(clerkIdList, wxEnterpriseId); List<String> userIds = staffClerkRelationService.listWxUserIdByClerkIds(clerkIdList, wxEnterpriseId);
if (CollectionUtils.isEmpty(userIds)) { if (CollectionUtils.isEmpty(userIds)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办"); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办");
} }
qywxExternalcontactDTO.setUser(userIds); qywxExternalcontactDTO.setUser(userIds);
logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO)); logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO));
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO); QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(corpid, config.getWxSuiteid(), qywxExternalcontactDTO);
if (qywxExternalcontactResultDTO.getErrcode() != 0) { if (qywxExternalcontactResultDTO.getErrcode() != 0) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()), "创建活码失败:" + qywxExternalcontactResultDTO.getErrmsg()); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()), "创建活码失败:" + qywxExternalcontactResultDTO.getErrmsg());
} }
......
...@@ -466,8 +466,21 @@ ...@@ -466,8 +466,21 @@
<select id="listWxUserIdByClerkIds" resultType="string"> <select id="listWxUserIdByClerkIds" resultType="string">
select select
a.wx_user_id wxUserId DISTINCT b.wx_user_id
from tab_haoban_staff_clerk_relation a from tab_haoban_staff_clerk_relation a
left join tab_haoban_staff b on a.staff_id = b.staff_id
where a.status_flag=1 and a.wx_enterprise_id = #{wxEnterpriseId}
and a.clerk_id in
<foreach collection="clerkIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</select>
<select id="listWxOpenUserIdByClerkIds" resultType="string">
select
DISTINCT b.wx_open_user_id
from tab_haoban_staff_clerk_relation a
left join tab_haoban_staff b on a.staff_id = b.staff_id
where a.status_flag=1 and a.wx_enterprise_id = #{wxEnterpriseId} where a.status_flag=1 and a.wx_enterprise_id = #{wxEnterpriseId}
and a.clerk_id in and a.clerk_id in
<foreach collection="clerkIds" item="id" index="index" open="(" close=")" separator=","> <foreach collection="clerkIds" item="id" index="index" open="(" close=")" separator=",">
......
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