Commit 76676182 by danmo

修复新增活码接口bug

1 parent c20ddfb3
...@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.WeMessageTemplate; import com.linkwechat.wecom.domain.WeMessageTemplate;
import com.linkwechat.wecom.domain.WeQrCode; import com.linkwechat.wecom.domain.WeQrCode;
import com.linkwechat.wecom.domain.dto.WeExternalContactDto; import com.linkwechat.wecom.domain.dto.WeExternalContactDto;
...@@ -14,11 +15,12 @@ import io.swagger.annotations.ApiModel; ...@@ -14,11 +15,12 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author danmo * @author danmo
...@@ -84,13 +86,15 @@ public class WeQrAddQuery { ...@@ -84,13 +86,15 @@ public class WeQrAddQuery {
if (CollectionUtil.isNotEmpty(qrUserInfos)) { if (CollectionUtil.isNotEmpty(qrUserInfos)) {
//员工列表 //员工列表
String[] userIdArr = qrUserInfos.stream().filter(item -> String[] userIdArr = qrUserInfos.stream().filter(item ->
ObjectUtil.equal(1, item.getType())).map(WeQrUserInfoQuery::getUserIds).toArray(String[]::new); ObjectUtil.equal(1, item.getType()) && CollectionUtil.isNotEmpty(item.getUserIds()))
.map(WeQrUserInfoQuery::getUserIds).flatMap(Collection::stream).toArray(String[]::new);
if (userIdArr.length > 0) { if (userIdArr.length > 0) {
weContactWay.setUser(userIdArr); weContactWay.setUser(userIdArr);
} }
//部门列表 //部门列表
Long[] partyArr = qrUserInfos.stream().filter(item -> Long[] partyArr = qrUserInfos.stream().filter(item ->
ObjectUtil.equal(1, item.getType())).map(WeQrUserInfoQuery::getPartys).toArray(Long[]::new); ObjectUtil.equal(1, item.getType()) && CollectionUtil.isNotEmpty(item.getPartys()))
.map(WeQrUserInfoQuery::getPartys).flatMap(Collection::stream).toArray(Long[]::new);
if (partyArr.length > 0) { if (partyArr.length > 0) {
weContactWay.setParty(partyArr); weContactWay.setParty(partyArr);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!