Commit 9cbe1780 by fudahua

门店分组绑定校验

parent 3891599d
......@@ -100,6 +100,15 @@ public interface TabHaobanStaffClerkRelationMapper {
List<TabHaobanStaffClerkRelation> listBindByStoreIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("storeIds") Set<String> storeIds);
/**
* 授权绑定的列表
*
* @param wxEnterpriseId
* @param storeIds
* @return
*/
List<TabHaobanStaffClerkRelation> listBindNotInStoreIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId, @Param("storeIds") Set<String> storeIds);
/**
* 删除绑定根据门店
*
* @param storeIds
......
......@@ -35,6 +35,16 @@ public interface StaffClerkRelationService {
public boolean delBindByStoreIds(String wxEnterpriseId, Set<String> storeIds, String optStaffId, int chanelCode);
/**
* 删除绑定
*
* @param wxEnterpriseId 可以不传
* @param enterpriseId
* @param storeIds 解除除了这些门店之外的绑定的门店
* @return
*/
public boolean delBindNotInStoreIds(String wxEnterpriseId, String enterpriseId, Set<String> storeIds, String optStaffId, int chanelCode);
/**
* 绑定
* @param dto
* @return
......
......@@ -113,6 +113,26 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
return true;
}
@Override
public boolean delBindNotInStoreIds(String wxEnterpriseId, String enterpriseId, Set<String> storeIds, String optStaffId, int chanelCode) {
if (CollectionUtils.isEmpty(storeIds)) {
logger.info("没有传门店列表:{}", wxEnterpriseId);
return true;
}
List<TabHaobanStaffClerkRelation> needUnbind = mapper.listBindNotInStoreIds(wxEnterpriseId, enterpriseId, storeIds);
if (CollectionUtils.isEmpty(needUnbind)) {
logger.info("没有门店绑定了需要解绑的:{}", wxEnterpriseId);
}
Set<String> needDelStoreIds = needUnbind.stream().map(tab -> tab.getStoreId()).collect(Collectors.toSet());
//清除绑定
mapper.delByStoreIds(needDelStoreIds);
List<String> need = needUnbind.stream().map(tab -> tab.getStaffClerkRelationId()).collect(Collectors.toList());
//放入队列
staffClerkBindLogService.pushToMqBatch(optStaffId, BindTypeEnum.UNBIND.getVal(), chanelCode, need);
return true;
}
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation) {
if (staffClerkRelation == null) {
logger.info("staffClerkRelation为空");
......
......@@ -397,6 +397,21 @@
</if>
and status_flag =1
</select>
<select id="listBindNotInStoreIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
where store_id NOT in
<foreach collection="storeIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
<if test="wxEnterpriseId!=null">
and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</if>
and enterprise_id=#{enterpriseId}
and status_flag =1
</select>
<update id="delByStoreIds">
UPDATE
tab_haoban_staff_clerk_relation
......
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