|
|
|
|
@ -1,7 +1,5 @@
|
|
|
|
|
package com.flossom.system.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@ -11,14 +9,12 @@ import com.flossom.common.core.domain.req.WxUserInstrumentExportVm;
|
|
|
|
|
import com.flossom.common.core.enums.BindingStatusEnums;
|
|
|
|
|
import com.flossom.common.core.mapper.*;
|
|
|
|
|
import com.flossom.common.core.utils.DateUtils;
|
|
|
|
|
import com.flossom.common.core.utils.StringUtils;
|
|
|
|
|
import org.apache.commons.compress.utils.Lists;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.flossom.system.service.IWxUserInstrumentService;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.unit.DataUnit;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户仪器绑定Service业务层处理
|
|
|
|
|
@ -62,47 +58,6 @@ public class WxUserInstrumentServiceImpl implements IWxUserInstrumentService
|
|
|
|
|
@Override
|
|
|
|
|
public List<WxUserInstrument> selectWxUserInstrumentList(WxUserInstrument wxUserInstrument)
|
|
|
|
|
{
|
|
|
|
|
// 处理用户昵称
|
|
|
|
|
if (StringUtils.isNotEmpty(wxUserInstrument.getNickName())){
|
|
|
|
|
WxUserMember userMember = new WxUserMember();
|
|
|
|
|
userMember.setNickname(wxUserInstrument.getNickName());
|
|
|
|
|
List<WxUserMember> wxUserMembersList = wxUserMemberMapper.selectWxUserMemberList(userMember);
|
|
|
|
|
if (!CollectionUtils.isEmpty(wxUserMembersList)) {
|
|
|
|
|
String userIds = (wxUserMembersList.stream().map(WxUserMember::getId).collect(Collectors.toList())).stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
|
|
wxUserInstrument.setUserIds(userIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 处理用户ID
|
|
|
|
|
if (!CollectionUtils.isEmpty(wxUserInstrument.getUserIdArray())){
|
|
|
|
|
String userIds =wxUserInstrument.getUserIdArray().stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
|
|
if (StringUtils.isNotEmpty(wxUserInstrument.getUserIds())) {
|
|
|
|
|
wxUserInstrument.setUserIds(wxUserInstrument.getUserIds()+","+userIds);
|
|
|
|
|
} else {
|
|
|
|
|
wxUserInstrument.setUserIds(userIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 处理手机号码
|
|
|
|
|
if (StringUtils.isNotEmpty(wxUserInstrument.getUserPhone())){
|
|
|
|
|
List<Long> userIdList = Lists.newArrayList();
|
|
|
|
|
// 获取手机集合
|
|
|
|
|
List<String> mobileList = Arrays.asList(wxUserInstrument.getUserPhone().split(",")).stream().map(String::valueOf).collect(Collectors.toList());
|
|
|
|
|
if (!CollectionUtils.isEmpty(mobileList)) {
|
|
|
|
|
for (String mobile: mobileList) {
|
|
|
|
|
List<WxUserMember> wxUserMembers = wxUserMemberMapper.selectWxUserMemberByMobile(mobile);
|
|
|
|
|
if (!CollectionUtils.isEmpty(wxUserMembers)) {
|
|
|
|
|
userIdList.add(wxUserMembers.get(0).getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!CollectionUtils.isEmpty(userIdList)) {
|
|
|
|
|
String userIds = userIdList.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
|
|
if (StringUtils.isNotEmpty(wxUserInstrument.getUserIds())) {
|
|
|
|
|
wxUserInstrument.setUserIds(wxUserInstrument.getUserIds()+","+userIds);
|
|
|
|
|
} else {
|
|
|
|
|
wxUserInstrument.setUserIds(userIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 处理仪器字段
|
|
|
|
|
if (!CollectionUtils.isEmpty(wxUserInstrument.getInstrumentIdArray())) {
|
|
|
|
|
String instrumentIds = wxUserInstrument.getInstrumentIdArray().stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
|
|
@ -114,7 +69,7 @@ public class WxUserInstrumentServiceImpl implements IWxUserInstrumentService
|
|
|
|
|
wxUserInstrument.setMapperBindStatus(bindStatus);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return wxUserInstrumentMapper.selectWxUserInstrumentList(wxUserInstrument);
|
|
|
|
|
return wxUserInstrumentMapper.selectListByCondition(wxUserInstrument);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|