|
@ -5,19 +5,27 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; |
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
import com.epmet.dataaggre.dao.epmetmessage.InfoReceiversDao; |
|
|
import com.epmet.dataaggre.dao.epmetmessage.InfoReceiversDao; |
|
|
import com.epmet.dataaggre.dto.govorg.ReceiverDTO; |
|
|
import com.epmet.dataaggre.dto.govorg.ReceiverDTO; |
|
|
import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; |
|
|
import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; |
|
|
import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; |
|
|
import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; |
|
|
|
|
|
import com.epmet.dataaggre.dto.message.form.InfoGroupDetailFormDTO; |
|
|
|
|
|
import com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO; |
|
|
|
|
|
import com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO; |
|
|
|
|
|
import com.epmet.dataaggre.dto.message.result.StaffInfoCommonDTO; |
|
|
import com.epmet.dataaggre.entity.epmetmessage.InfoReceiversEntity; |
|
|
import com.epmet.dataaggre.entity.epmetmessage.InfoReceiversEntity; |
|
|
import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService; |
|
|
import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Collections; |
|
|
import java.util.Collections; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
@ -31,9 +39,10 @@ import java.util.stream.Collectors; |
|
|
@DataSource(DataSourceConstant.EPMET_MESSAGE) |
|
|
@DataSource(DataSourceConstant.EPMET_MESSAGE) |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
public class EpmetMessageServiceImpl implements EpmetMessageService { |
|
|
public class EpmetMessageServiceImpl implements EpmetMessageService { |
|
|
@Resource |
|
|
@Autowired |
|
|
private InfoReceiversDao infoReceiversDao; |
|
|
private InfoReceiversDao infoReceiversDao; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private CustomerStaffRedis customerStaffRedis; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @param formDTO |
|
|
* @param formDTO |
|
@ -70,4 +79,76 @@ public class EpmetMessageServiceImpl implements EpmetMessageService { |
|
|
result.setDataList(dataList); |
|
|
result.setDataList(dataList); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 我创建的群组列表 |
|
|
|
|
|
* |
|
|
|
|
|
* @param staffId |
|
|
|
|
|
* @param customerId |
|
|
|
|
|
* @return java.util.List<com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO> |
|
|
|
|
|
* @author yinzuomei |
|
|
|
|
|
* @date 2021/8/20 10:33 上午 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<MyInfoGroupResultDTO> queryMyGroupList(String staffId, String customerId) { |
|
|
|
|
|
List<MyInfoGroupResultDTO> list = infoReceiversDao.selectMyGroupList(staffId, customerId,null); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
|
|
// 2、遍历每个群组,赋值工作人员姓名列表
|
|
|
|
|
|
for (MyInfoGroupResultDTO group : list) { |
|
|
|
|
|
List<String> staffNameList = new ArrayList<>(); |
|
|
|
|
|
for (String userId : group.getStaffIdList()) { |
|
|
|
|
|
//查询每个工作人员的基本信息,获取姓名
|
|
|
|
|
|
CustomerStaffInfoCache staffInfoCache = customerStaffRedis.getStaffInfo(customerId, userId); |
|
|
|
|
|
if (null != staffInfoCache) { |
|
|
|
|
|
staffNameList.add(staffInfoCache.getRealName()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
group.setStaffNameList(staffNameList); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return list; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 发送消息-群组详情 |
|
|
|
|
|
* |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @return com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO |
|
|
|
|
|
* @author yinzuomei |
|
|
|
|
|
* @date 2021/8/20 12:59 下午 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public InfoGroupDetailResDTO queryGroupDetail(InfoGroupDetailFormDTO formDTO) { |
|
|
|
|
|
List<MyInfoGroupResultDTO> list = infoReceiversDao.selectMyGroupList(formDTO.getUserId(), formDTO.getCustomerId(),formDTO.getReceiverGroupId()); |
|
|
|
|
|
InfoGroupDetailResDTO resDTO = new InfoGroupDetailResDTO(); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
|
|
// 2、遍历每个群组,赋值工作人员姓名列表
|
|
|
|
|
|
for (MyInfoGroupResultDTO group : list) { |
|
|
|
|
|
resDTO.setReceiverGroupId(group.getReceiverGroupId()); |
|
|
|
|
|
resDTO.setName(group.getName()); |
|
|
|
|
|
List<StaffInfoCommonDTO> staffList=new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
for (String userId : group.getStaffIdList()) { |
|
|
|
|
|
//查询每个工作人员的基本信息
|
|
|
|
|
|
CustomerStaffInfoCache staffInfoCache = customerStaffRedis.getStaffInfo(formDTO.getCustomerId(), userId); |
|
|
|
|
|
if (null != staffInfoCache) { |
|
|
|
|
|
StaffInfoCommonDTO staffInfo=new StaffInfoCommonDTO(); |
|
|
|
|
|
staffInfo.setStaffId(userId); |
|
|
|
|
|
staffInfo.setStaffName(staffInfoCache.getRealName()); |
|
|
|
|
|
staffInfo.setGender(staffInfoCache.getGender().toString()); |
|
|
|
|
|
staffInfo.setHeadPhoto(StringUtils.isNotBlank(staffInfoCache.getHeadPhoto())?staffInfoCache.getHeadPhoto(): StrConstant.EPMETY_STR); |
|
|
|
|
|
// 从网格添加的,显示 XXX-网格名
|
|
|
|
|
|
// 部门添加的,显示XXX-部门名
|
|
|
|
|
|
// 组织添加的,XXX组织名-XXX组织名
|
|
|
|
|
|
String showOrgName="todo"; |
|
|
|
|
|
//todo
|
|
|
|
|
|
staffInfo.setOrgName(showOrgName); |
|
|
|
|
|
staffList.add(staffInfo); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
resDTO.setStaffList(staffList); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return resDTO; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|