|
@ -9,17 +9,20 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
|
|
import com.epmet.commons.tools.utils.PidUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.SpringContextUtils; |
|
|
import com.epmet.commons.tools.utils.SpringContextUtils; |
|
|
|
|
|
import com.epmet.dao.CustomerAgencyDao; |
|
|
import com.epmet.dao.StaffLoginLogDao; |
|
|
import com.epmet.dao.StaffLoginLogDao; |
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
import com.epmet.dto.form.yt.CommunityLoginFormDTO; |
|
|
import com.epmet.dto.form.yt.CommunityLoginFormDTO; |
|
|
import com.epmet.dto.form.yt.CountActivityFormDTO; |
|
|
import com.epmet.dto.form.yt.CountActivityFormDTO; |
|
|
|
|
|
import com.epmet.dto.result.yt.AccountActivityInfo; |
|
|
import com.epmet.dto.result.yt.ActivityTatalInfo; |
|
|
import com.epmet.dto.result.yt.ActivityTatalInfo; |
|
|
import com.epmet.dto.result.yt.CommunityLoginResultDTO; |
|
|
import com.epmet.dto.result.yt.CommunityLoginResultDTO; |
|
|
import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; |
|
|
import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; |
|
|
import com.epmet.dto.result.yt.AccountActivityInfo; |
|
|
import com.epmet.entity.CustomerAgencyEntity; |
|
|
import com.epmet.entity.StaffLoginLogEntity; |
|
|
import com.epmet.entity.StaffLoginLogEntity; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.service.CustomerAgencyService; |
|
|
import com.epmet.service.CustomerAgencyService; |
|
@ -32,6 +35,7 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
@ -45,6 +49,8 @@ import java.util.List; |
|
|
public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao, StaffLoginLogEntity> implements StaffLoginLogService { |
|
|
public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao, StaffLoginLogEntity> implements StaffLoginLogService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private CustomerAgencyDao customerAgencyDao; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -242,8 +248,30 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao, |
|
|
if (StringUtils.isBlank(orgId)) { |
|
|
if (StringUtils.isBlank(orgId)) { |
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); |
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); |
|
|
orgId = staffInfoCacheResult.getAgencyId(); |
|
|
orgId = staffInfoCacheResult.getAgencyId(); |
|
|
|
|
|
level=staffInfoCacheResult.getLevel(); |
|
|
|
|
|
} |
|
|
|
|
|
if(Constant.COMMUNITY.equals(level)){ |
|
|
|
|
|
//如果是社区,返回自己
|
|
|
|
|
|
List<CommunityLoginResultDTO> list = baseDao.selectCommunityCount(orgId, startDate, endDate); |
|
|
|
|
|
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); |
|
|
|
|
|
return new PageData<CommunityLoginResultDTO>(list, total, total); |
|
|
|
|
|
} |
|
|
|
|
|
//先查询出下级组织
|
|
|
|
|
|
LambdaQueryWrapper<CustomerAgencyEntity> agencyWrapper=new LambdaQueryWrapper<>(); |
|
|
|
|
|
agencyWrapper.eq(CustomerAgencyEntity::getPid,orgId).orderByAsc(CustomerAgencyEntity::getCreatedTime); |
|
|
|
|
|
List<CustomerAgencyEntity> subAgencyList=customerAgencyDao.selectList(agencyWrapper); |
|
|
|
|
|
List<CommunityLoginResultDTO> list=new ArrayList<>(); |
|
|
|
|
|
for(CustomerAgencyEntity agencyEntity:subAgencyList){ |
|
|
|
|
|
CommunityLoginResultDTO resultDTO=new CommunityLoginResultDTO(); |
|
|
|
|
|
resultDTO.setAgencyId(agencyEntity.getId()); |
|
|
|
|
|
resultDTO.setAgencyName(agencyEntity.getOrganizationName()); |
|
|
|
|
|
resultDTO.setAgencyLevel(agencyEntity.getLevel()); |
|
|
|
|
|
String orgIdPath=PidUtils.convertPid2OrgIdPath(agencyEntity.getId(),agencyEntity.getPids()); |
|
|
|
|
|
//查询本组织及下级
|
|
|
|
|
|
resultDTO.setCount(baseDao.selectLoginTotalByPath(orgIdPath,startDate,endDate)); |
|
|
|
|
|
list.add(resultDTO); |
|
|
} |
|
|
} |
|
|
List<CommunityLoginResultDTO> list = baseDao.querySubCount(orgId, startDate, endDate); |
|
|
// List<CommunityLoginResultDTO> list = baseDao.querySubCount(orgId, startDate, endDate);
|
|
|
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); |
|
|
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); |
|
|
return new PageData<CommunityLoginResultDTO>(list, total, total); |
|
|
return new PageData<CommunityLoginResultDTO>(list, total, total); |
|
|
} |
|
|
} |
|
|