|
|
@ -4,14 +4,24 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.dao.CustomerAgencyDao; |
|
|
|
import com.epmet.dao.CustomerCommunityManageUserDao; |
|
|
|
import com.epmet.dao.CustomerStaffAgencyDao; |
|
|
|
import com.epmet.dto.CustomerCommunityManageUserDTO; |
|
|
|
import com.epmet.dto.CustomerStaffAgencyDTO; |
|
|
|
import com.epmet.dto.form.CustomerCommunityManageUserListFormDTO; |
|
|
|
import com.epmet.dto.result.CustomerGridManageUserListDTO; |
|
|
|
import com.epmet.entity.CustomerAgencyEntity; |
|
|
|
import com.epmet.entity.CustomerCommunityManageUserEntity; |
|
|
|
import com.epmet.entity.CustomerGridManageUserEntity; |
|
|
|
import com.epmet.redis.CustomerCommunityManageUserRedis; |
|
|
|
import com.epmet.service.CustomerCommunityManageUserService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -20,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 社区治理人员 |
|
|
@ -32,14 +43,51 @@ public class CustomerCommunityManageUserServiceImpl extends BaseServiceImpl<Cust |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private CustomerCommunityManageUserRedis customerCommunityManageUserRedis; |
|
|
|
@Autowired |
|
|
|
private CustomerStaffAgencyDao customerStaffAgencyDao; |
|
|
|
@Autowired |
|
|
|
private CustomerAgencyDao customerAgencyDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<CustomerCommunityManageUserDTO> page(Map<String, Object> params) { |
|
|
|
IPage<CustomerCommunityManageUserEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
getWrapper(params) |
|
|
|
); |
|
|
|
return getPageData(page, CustomerCommunityManageUserDTO.class); |
|
|
|
public PageData<CustomerCommunityManageUserDTO> page(CustomerCommunityManageUserListFormDTO dto) { |
|
|
|
|
|
|
|
CustomerStaffAgencyDTO customerStaffAgencyDTO = customerStaffAgencyDao.selectLatestCustomerByStaff(dto.getStaffId()); |
|
|
|
if (customerStaffAgencyDTO == null ){ |
|
|
|
throw new EpmetException("未查询到工作人员信息"+dto.getStaffId()); |
|
|
|
} |
|
|
|
|
|
|
|
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectById(customerStaffAgencyDTO.getAgencyId()); |
|
|
|
|
|
|
|
LambdaQueryWrapper<CustomerCommunityManageUserEntity> resultLQ = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
if (customerAgencyEntity.getLevel().equals("community")){ |
|
|
|
|
|
|
|
resultLQ.eq(CustomerCommunityManageUserEntity::getCommunityId,customerAgencyEntity.getId()); |
|
|
|
|
|
|
|
}else{ |
|
|
|
LambdaQueryWrapper<CustomerAgencyEntity> agencyLq = new LambdaQueryWrapper<CustomerAgencyEntity>() |
|
|
|
.like(CustomerAgencyEntity::getPids,customerAgencyEntity.getId()).eq(CustomerAgencyEntity::getLevel,"community"); |
|
|
|
List<String> agencyListIds = customerAgencyDao.selectList(agencyLq).stream().map(CustomerAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
resultLQ.in(CustomerCommunityManageUserEntity::getCommunityId,agencyListIds); |
|
|
|
} |
|
|
|
|
|
|
|
if (dto.getCommunityId()!=null){ |
|
|
|
resultLQ.eq(CustomerCommunityManageUserEntity::getCommunityId,dto.getCommunityId()); |
|
|
|
} |
|
|
|
if (dto.getName()!=null){ |
|
|
|
resultLQ.like(CustomerCommunityManageUserEntity::getName,dto.getName()); |
|
|
|
} |
|
|
|
if (dto.getType()!=null){ |
|
|
|
resultLQ.eq(CustomerCommunityManageUserEntity::getType,dto.getType()); |
|
|
|
} |
|
|
|
|
|
|
|
PageHelper.startPage(dto.getPageNo(),dto.getPageSize()); |
|
|
|
|
|
|
|
List<CustomerCommunityManageUserEntity> list = baseDao.selectList(resultLQ); |
|
|
|
PageInfo<CustomerCommunityManageUserEntity> resultPage = new PageInfo<>(list); |
|
|
|
List<CustomerCommunityManageUserDTO> result = ConvertUtils.sourceToTarget(list,CustomerCommunityManageUserDTO.class); |
|
|
|
|
|
|
|
return new PageData<>(result,resultPage.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|