|
|
@ -6,6 +6,7 @@ import com.epmet.commons.tools.constant.Constant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
@ -13,17 +14,26 @@ import com.epmet.commons.tools.utils.SpringContextUtils; |
|
|
|
import com.epmet.dao.StaffLoginLogDao; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
|
import com.epmet.dto.form.yt.CommunityLoginFormDTO; |
|
|
|
import com.epmet.dto.form.yt.CountActivityFormDTO; |
|
|
|
import com.epmet.dto.result.yt.ActivityTatalInfo; |
|
|
|
import com.epmet.dto.result.yt.CommunityLoginResultDTO; |
|
|
|
import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; |
|
|
|
import com.epmet.dto.result.yt.AccountActivityInfo; |
|
|
|
import com.epmet.entity.StaffLoginLogEntity; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.service.CustomerAgencyService; |
|
|
|
import com.epmet.service.StaffLoginLogService; |
|
|
|
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; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* 工作人员登录日志表 |
|
|
@ -77,21 +87,21 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao, |
|
|
|
* 返回市级账号登录总次数、区县级账号登录总次数、镇街级账号登录总次数、社区级账号登录总次数 |
|
|
|
* |
|
|
|
* @param orgId 为空时,默认当前登录用户所属组织id |
|
|
|
* @param orgType :组织级别(社区级:community, 乡(镇、街道)级:street,区县级: district,市级: city;省级:province) |
|
|
|
* @param level :组织级别(社区级:community, 乡(镇、街道)级:street,区县级: district,市级: city;省级:province) |
|
|
|
* @param startDate yyyy-MM-dd |
|
|
|
* @param endDate yyyy-MM-dd |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public LoginLogCountByLevelResultDTO countLevel(String orgId, String orgType, Date startDate, Date endDate) { |
|
|
|
public LoginLogCountByLevelResultDTO countLevel(String orgId, String level, Date startDate, Date endDate) { |
|
|
|
if (StringUtils.isBlank(orgId)) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); |
|
|
|
orgId = staffInfoCacheResult.getAgencyId(); |
|
|
|
orgType = staffInfoCacheResult.getLevel(); |
|
|
|
level = staffInfoCacheResult.getLevel(); |
|
|
|
} |
|
|
|
String orgIdPath = SpringContextUtils.getBean(CustomerAgencyService.class).getOrgIdPath(orgId); |
|
|
|
LoginLogCountByLevelResultDTO resultDTO = new LoginLogCountByLevelResultDTO(); |
|
|
|
if (Constant.CITY.equals(orgType)) { |
|
|
|
if (Constant.CITY.equals(level)) { |
|
|
|
//市级账号登录
|
|
|
|
LambdaQueryWrapper<StaffLoginLogEntity> cityWrapper = new LambdaQueryWrapper<>(); |
|
|
|
cityWrapper.eq(StaffLoginLogEntity::getAgencyId, orgId) |
|
|
@ -101,25 +111,25 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao, |
|
|
|
// 市下面区县账号
|
|
|
|
LambdaQueryWrapper<StaffLoginLogEntity> districtWrapper = new LambdaQueryWrapper<>(); |
|
|
|
districtWrapper.eq(StaffLoginLogEntity::getPid, orgId) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.DISTRICT) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel, Constant.DISTRICT) |
|
|
|
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); |
|
|
|
resultDTO.setDistrictCount(baseDao.selectCount(districtWrapper)); |
|
|
|
|
|
|
|
// 市级下面所有街道
|
|
|
|
LambdaQueryWrapper<StaffLoginLogEntity> streetWrapper = new LambdaQueryWrapper<>(); |
|
|
|
streetWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.STREET) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel, Constant.STREET) |
|
|
|
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); |
|
|
|
resultDTO.setStreetCount(baseDao.selectCount(streetWrapper)); |
|
|
|
|
|
|
|
// 市级下面所有社区
|
|
|
|
LambdaQueryWrapper<StaffLoginLogEntity> communityWrapper = new LambdaQueryWrapper<>(); |
|
|
|
communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.COMMUNITY) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel, Constant.COMMUNITY) |
|
|
|
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); |
|
|
|
resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); |
|
|
|
|
|
|
|
} else if (Constant.DISTRICT.equals(orgType)) { |
|
|
|
} else if (Constant.DISTRICT.equals(level)) { |
|
|
|
resultDTO.setCityCount(NumConstant.ONE_NEG); |
|
|
|
|
|
|
|
//只展示本区县的登录情况
|
|
|
@ -131,18 +141,18 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao, |
|
|
|
// 区县下所有的街道
|
|
|
|
LambdaQueryWrapper<StaffLoginLogEntity> streetWrapper = new LambdaQueryWrapper<>(); |
|
|
|
streetWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.STREET) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel, Constant.STREET) |
|
|
|
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); |
|
|
|
resultDTO.setStreetCount(baseDao.selectCount(streetWrapper)); |
|
|
|
|
|
|
|
// 去线下所有社区
|
|
|
|
LambdaQueryWrapper<StaffLoginLogEntity> communityWrapper = new LambdaQueryWrapper<>(); |
|
|
|
communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.COMMUNITY) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel, Constant.COMMUNITY) |
|
|
|
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); |
|
|
|
resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); |
|
|
|
|
|
|
|
} else if (Constant.STREET.equals(orgType)) { |
|
|
|
} else if (Constant.STREET.equals(level)) { |
|
|
|
resultDTO.setCityCount(NumConstant.ONE_NEG); |
|
|
|
resultDTO.setDistrictCount(NumConstant.ONE_NEG); |
|
|
|
|
|
|
@ -152,14 +162,15 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao, |
|
|
|
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); |
|
|
|
resultDTO.setStreetCount(baseDao.selectCount(streetWrapper)); |
|
|
|
|
|
|
|
|
|
|
|
// 街道下所有社区
|
|
|
|
LambdaQueryWrapper<StaffLoginLogEntity> communityWrapper = new LambdaQueryWrapper<>(); |
|
|
|
communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.COMMUNITY) |
|
|
|
.eq(StaffLoginLogEntity::getAgencyLevel, Constant.COMMUNITY) |
|
|
|
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); |
|
|
|
resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); |
|
|
|
|
|
|
|
} else if (Constant.COMMUNITY.equals(orgType)) { |
|
|
|
} else if (Constant.COMMUNITY.equals(level)) { |
|
|
|
resultDTO.setCityCount(NumConstant.ONE_NEG); |
|
|
|
resultDTO.setDistrictCount(NumConstant.ONE_NEG); |
|
|
|
resultDTO.setStreetCount(NumConstant.ONE_NEG); |
|
|
@ -173,5 +184,121 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao, |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<AccountActivityInfo> getAccountActivityInfo(CountActivityFormDTO formDTO) { |
|
|
|
List<AccountActivityInfo> accountActivityInfos = baseDao.selectListActivityInfo(formDTO); |
|
|
|
int total = CollectionUtils.isEmpty(accountActivityInfos) ? NumConstant.ZERO : accountActivityInfos.size(); |
|
|
|
return new PageData<>(accountActivityInfos, total); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ActivityTatalInfo getActivityTotal(CountActivityFormDTO formDTO) { |
|
|
|
return baseDao.selectOneActivityTotal(formDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 下级社区账号登录次数排名 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<CommunityLoginResultDTO> pageCommunityCount(CommunityLoginFormDTO formDTO) { |
|
|
|
if (StringUtils.isBlank(formDTO.getOrgId())) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); |
|
|
|
formDTO.setOrgId(staffInfoCacheResult.getAgencyId()); |
|
|
|
formDTO.setLevel(staffInfoCacheResult.getLevel()); |
|
|
|
} |
|
|
|
if (formDTO.getIsPage()) { |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); |
|
|
|
PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
return new PageData<>(list, pageInfo.getTotal(), formDTO.getPageSize()); |
|
|
|
} |
|
|
|
// 不分页
|
|
|
|
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); |
|
|
|
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); |
|
|
|
return new PageData<>(list, total, total); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 柱状图:下级组织账号登录次数汇总 |
|
|
|
* |
|
|
|
* @param orgId |
|
|
|
* @param level |
|
|
|
* @param startDate |
|
|
|
* @param endDate |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<CommunityLoginResultDTO> querySubCount(String orgId, String level, Date startDate, Date endDate) { |
|
|
|
if (StringUtils.isBlank(orgId)) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); |
|
|
|
orgId = staffInfoCacheResult.getAgencyId(); |
|
|
|
} |
|
|
|
List<CommunityLoginResultDTO> list = baseDao.querySubCount(orgId, startDate, endDate); |
|
|
|
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); |
|
|
|
return new PageData<CommunityLoginResultDTO>(list, total, total); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查看区县 |
|
|
|
* |
|
|
|
* @param orgId |
|
|
|
* @param level |
|
|
|
* @param startDate |
|
|
|
* @param endDate |
|
|
|
* @param isPage |
|
|
|
* @param pageNo |
|
|
|
* @param pageSize |
|
|
|
* @return 返回agencyId,agencyName,count |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<CommunityLoginResultDTO> pageDistrictCount(String orgId, String level, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize) { |
|
|
|
if (StringUtils.isBlank(orgId)) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); |
|
|
|
orgId = staffInfoCacheResult.getAgencyId(); |
|
|
|
} |
|
|
|
if (isPage) { |
|
|
|
PageHelper.startPage(pageNo, pageSize); |
|
|
|
List<CommunityLoginResultDTO> list = baseDao.pageDistrictCount(orgId, startDate, endDate); |
|
|
|
PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
return new PageData<>(list, pageInfo.getTotal(), pageSize); |
|
|
|
} |
|
|
|
// 不分页
|
|
|
|
List<CommunityLoginResultDTO> list = baseDao.pageDistrictCount(orgId, startDate, endDate); |
|
|
|
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); |
|
|
|
return new PageData<>(list, total, total); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查看街镇 |
|
|
|
* |
|
|
|
* @param orgId |
|
|
|
* @param startDate |
|
|
|
* @param endDate |
|
|
|
* @param isPage |
|
|
|
* @param pageNo |
|
|
|
* @param pageSize |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<CommunityLoginResultDTO> streetCount(String orgId, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize) { |
|
|
|
if (StringUtils.isBlank(orgId)) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); |
|
|
|
orgId = staffInfoCacheResult.getAgencyId(); |
|
|
|
} |
|
|
|
if (isPage) { |
|
|
|
PageHelper.startPage(pageNo, pageSize); |
|
|
|
List<CommunityLoginResultDTO> list = baseDao.pageStreetCount(orgId, startDate, endDate); |
|
|
|
PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
return new PageData<>(list, pageInfo.getTotal(), pageSize); |
|
|
|
} |
|
|
|
// 不分页
|
|
|
|
List<CommunityLoginResultDTO> list = baseDao.pageStreetCount(orgId, startDate, endDate); |
|
|
|
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); |
|
|
|
return new PageData<>(list, total, total); |
|
|
|
} |
|
|
|
} |