Browse Source

Merge branch 'yantai_zhengwu_master' into dev

master
lichao 2 years ago
parent
commit
b0d3343851
  1. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java
  2. 32
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java
  3. 4
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  4. 40
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java

@ -33,6 +33,9 @@ public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> {
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
List<CommunityLoginResultDTO> selectCommunityCount(@Param("orgId") String orgId,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
/**
* 柱状图下级组织账号登录次数汇总
*
@ -72,4 +75,8 @@ public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> {
ActivityTatalInfo selectOneActivityTotal(CountActivityFormDTO formDTO);
Integer selectLoginTotalByPath(@Param("orgIdPath") String orgIdPath,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
}

32
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java

@ -9,17 +9,20 @@ 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.PidUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dao.CustomerAgencyDao;
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.AccountActivityInfo;
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.CustomerAgencyEntity;
import com.epmet.entity.StaffLoginLogEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.CustomerAgencyService;
@ -32,6 +35,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -45,6 +49,8 @@ import java.util.List;
public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao, StaffLoginLogEntity> implements StaffLoginLogService {
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
@Autowired
private CustomerAgencyDao customerAgencyDao;
/**
@ -242,8 +248,30 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
if (StringUtils.isBlank(orgId)) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId());
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();
return new PageData<CommunityLoginResultDTO>(list, total, total);
}

4
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -890,10 +890,10 @@
where DEL_FLAG = 0
and PIDS like concat(#{pids},'%')
<if test="timeStart != null">
and agency.UPDATED_TIME &gt;= #{timeStart}
and UPDATED_TIME &gt;= #{timeStart}
</if>
<if test="timeEnd != null">
and agency.UPDATED_TIME &lt;= #{timeEnd}
and UPDATED_TIME &lt;= #{timeEnd}
</if>
group by level

40
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml

@ -51,6 +51,33 @@
GROUP BY ca.id
order by count(l.id) desc,ca.CREATED_TIME desc
</select>
<!-- 查询某一个社区的登录次数 -->
<select id="selectCommunityCount" parameterType="map" resultType="com.epmet.dto.result.yt.CommunityLoginResultDTO">
SELECT
ca.id AS agencyId,
d.ORGANIZATION_NAME AS districtName,
s.ORGANIZATION_NAME AS streetName,
ca.ORGANIZATION_NAME AS agencyName,
ca.`LEVEL` AS agencyLevel,
count( l.id ) AS count
FROM customer_agency ca
left JOIN staff_login_log l
ON ( ca.ID =l.AGENCY_ID and l.DEL_FLAG = '0')
LEFT JOIN customer_agency s
ON ( ca.PID = s.ID )
LEFT JOIN customer_agency d
ON ( s.PID = d.ID )
WHERE ca.DEL_FLAG = '0'
AND ca.id = #{orgId}
<if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate}
</if>
<if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate}
</if>
</select>
<!--社区活跃列表-->
<select id="selectListActivityInfo" resultType="com.epmet.dto.result.yt.AccountActivityInfo">
SELECT
@ -186,4 +213,17 @@
) t;
</select>
<select id="selectLoginTotalByPath" parameterType="map" resultType="java.lang.Integer">
select
count(l.id)
from staff_login_log l
where l.ORG_ID_PATH like concat(#{orgIdPath},'%')
<if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate}
</if>
<if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate}
</if>
</select>
</mapper>
Loading…
Cancel
Save