Browse Source

Merge remote-tracking branch 'origin/yantai_zhengwu_master' into dev

master
yinzuomei 2 years ago
parent
commit
ea56b53a94
  1. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java
  2. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/LoginLogCountByLevelFormDTO.java
  3. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java
  4. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java
  5. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java
  6. 38
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java
  7. 26
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml

9
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java

@ -1,6 +1,7 @@
package com.epmet.dto.form.yt;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -21,18 +22,20 @@ public class CommunityLoginFormDTO extends PageFormDTO {
/**
* 组织类型
*/
private String orgType;
private String level;
/**
* 开始日期yyyy-MM-dd
*/
@DateTimeFormat(pattern="yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date startDate;
/**
* 截止日期yyyy-MM-dd
*/
@DateTimeFormat(pattern="yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date endDate;
}

9
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/LoginLogCountByLevelFormDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.form.yt;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -20,18 +21,20 @@ public class LoginLogCountByLevelFormDTO {
/**
* 组织类型
*/
private String orgType;
private String level;
/**
* 开始日期yyyy-MM-dd
*/
@DateTimeFormat(pattern="yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date startDate;
/**
* 截止日期yyyy-MM-dd
*/
@DateTimeFormat(pattern="yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date endDate;
}

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java

@ -36,7 +36,7 @@ public class StaffLoginLogController {
*/
@PostMapping("count-level")
public Result<LoginLogCountByLevelResultDTO> countLevel(@RequestBody LoginLogCountByLevelFormDTO formDTO) {
return new Result<LoginLogCountByLevelResultDTO>().ok(staffLoginLogService.countLevel(formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getStartDate(), formDTO.getEndDate()));
return new Result<LoginLogCountByLevelResultDTO>().ok(staffLoginLogService.countLevel(formDTO.getOrgId(), formDTO.getLevel(), formDTO.getStartDate(), formDTO.getEndDate()));
}
/**
@ -48,4 +48,16 @@ public class StaffLoginLogController {
return new Result<PageData<CommunityLoginResultDTO>>().ok(staffLoginLogService.pageCommunityCount(formDTO));
}
/**
* 柱状图下级组织账号登录次数汇总
*
* @param formDTO
* @return
*/
@PostMapping("sub-count")
public Result<PageData<CommunityLoginResultDTO>> querySubCount(@RequestBody LoginLogCountByLevelFormDTO formDTO) {
return new Result<PageData<CommunityLoginResultDTO>>().ok(staffLoginLogService.querySubCount(formDTO.getOrgId(), formDTO.getLevel(), formDTO.getStartDate(), formDTO.getEndDate()));
}
}

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

@ -28,4 +28,15 @@ public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> {
List<CommunityLoginResultDTO> pageCommunityCount(@Param("orgIdPath") String orgIdPath,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
/**
* 柱状图下级组织账号登录次数汇总
* @param orgId
* @param startDate
* @param endDate
* @return
*/
List<CommunityLoginResultDTO> querySubCount(@Param("orgId") String orgId,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
}

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java

@ -27,12 +27,12 @@ public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> {
* 返回市级账号登录总次数区县级账号登录总次数镇街级账号登录总次数社区级账号登录总次数
*
* @param orgId 为空时默认当前登录用户所属组织id
* @param orgType
* @param level
* @param startDate yyyy-MM-dd
* @param endDate yyyy-MM-dd
* @return
*/
LoginLogCountByLevelResultDTO countLevel(String orgId, String orgType, Date startDate, Date endDate);
LoginLogCountByLevelResultDTO countLevel(String orgId, String level, Date startDate, Date endDate);
/**
* 下级社区账号登录次数排名
@ -41,4 +41,14 @@ public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> {
* @return
*/
PageData<CommunityLoginResultDTO> pageCommunityCount(CommunityLoginFormDTO formDTO);
/**
* 柱状图下级组织账号登录次数汇总
* @param orgId
* @param level
* @param startDate
* @param endDate
* @return
*/
PageData<CommunityLoginResultDTO> querySubCount(String orgId, String level, Date startDate, Date endDate);
}

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

@ -84,21 +84,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)
@ -126,7 +126,7 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
.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);
//只展示本区县的登录情况
@ -149,7 +149,7 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
.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);
@ -166,7 +166,7 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
.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);
@ -191,14 +191,14 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
if (StringUtils.isBlank(formDTO.getOrgId())) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId());
formDTO.setOrgId(staffInfoCacheResult.getAgencyId());
formDTO.setOrgType(staffInfoCacheResult.getLevel());
formDTO.setLevel(staffInfoCacheResult.getLevel());
}
String orgIdPath = SpringContextUtils.getBean(CustomerAgencyService.class).getOrgIdPath(formDTO.getOrgId());
if (formDTO.getIsPage()) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(orgIdPath, formDTO.getStartDate(), formDTO.getEndDate());
PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
return new PageData<>(list, pageInfo.getTotal(),formDTO.getPageSize());
}
// 不分页
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(orgIdPath, formDTO.getStartDate(), formDTO.getEndDate());
@ -207,5 +207,23 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
}
/**
* 柱状图下级组织账号登录次数汇总
*
* @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);
}
}

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

@ -41,13 +41,35 @@
AND l.ORG_ID_PATH LIKE concat( #{orgIdPath}, '%' )
AND l.AGENCY_LEVEL = 'community'
<if test ='null != startDate'>
l.LOGIN_TIME &gt;= #{startDate}
and l.LOGIN_TIME &gt;= #{startDate}
</if>
<if test ='null != endDate'>
l.LOGIN_TIME &lt;= #{endDate}
and l.LOGIN_TIME &lt;= #{endDate}
</if>
GROUP BY
l.AGENCY_ID
order by count(1) desc
</select>
<!-- 柱状图:下级组织账号登录次数汇总 -->
<select id="querySubCount" parameterType="map" resultType="com.epmet.dto.result.yt.CommunityLoginResultDTO">
select
ca.ID AS agencyId,
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)
where ca.DEL_FLAG='0'
and ca.PID = #{orgId}
<if test ='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate}
</if>
<if test ='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate}
</if>
group by ca.id
order by count(l.ID) desc
</select>
</mapper>
Loading…
Cancel
Save