yinzuomei 2 years ago
parent
commit
c59a56e09b
  1. 35
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java
  2. 37
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java
  3. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java
  4. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java
  5. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java
  6. 34
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java
  7. 29
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml

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

@ -0,0 +1,35 @@
package com.epmet.dto.form.yt;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.util.Date;
/**
* @Description 下级社区账号登录次数排名入参
* @Author yzm
* @Date 2023/4/6 14:18
*/
@Data
public class CommunityLoginFormDTO extends PageFormDTO {
/**
* 所选择的组织id
*/
private String orgId;
/**
* 组织类型
*/
private String orgType;
/**
* 开始日期yyyy-MM-dd
*/
private Date startDate;
/**
* 截止日期yyyy-MM-dd
*/
private Date endDate;
}

37
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java

@ -0,0 +1,37 @@
package com.epmet.dto.result.yt;
import lombok.Data;
/**
* @Description 下级社区账号登录次数排名
* @Author yzm
* @Date 2023/4/6 14:15
*/
@Data
public class CommunityLoginResultDTO {
/**
* 组织id
*/
private String agencyId;
/**
* 组织名称
*/
private String agencyName;
/**
* 组织级别社区级community 街道:street, 区县级: district, 市级: city 省级:province
*/
private String agencyLevel;
/**
* 所属街道名称
*/
private String streetName;
/**
* 所属区县名称
*/
private String districtName;
/**
* 登录次数
*/
private Integer count;
}

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

@ -1,7 +1,10 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.yt.CommunityLoginFormDTO;
import com.epmet.dto.form.yt.LoginLogCountByLevelFormDTO; import com.epmet.dto.form.yt.LoginLogCountByLevelFormDTO;
import com.epmet.dto.result.yt.CommunityLoginResultDTO;
import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO;
import com.epmet.service.StaffLoginLogService; import com.epmet.service.StaffLoginLogService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -36,5 +39,13 @@ public class StaffLoginLogController {
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.getOrgType(), formDTO.getStartDate(), formDTO.getEndDate()));
} }
/**
* 下级社区账号登录次数排名
* @return
*/
@PostMapping("community-count")
public Result<PageData<CommunityLoginResultDTO>> communityCount(@RequestBody CommunityLoginFormDTO formDTO) {
return new Result<PageData<CommunityLoginResultDTO>>().ok(staffLoginLogService.pageCommunityCount(formDTO));
}
} }

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

@ -1,8 +1,13 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.yt.CommunityLoginResultDTO;
import com.epmet.entity.StaffLoginLogEntity; import com.epmet.entity.StaffLoginLogEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/** /**
* 工作人员登录日志表 * 工作人员登录日志表
@ -12,5 +17,15 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> { public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> {
/**
* 各社区登录总次数
* @param orgIdPath
* @param startDate
* @param endDate
* @return
*/
List<CommunityLoginResultDTO> pageCommunityCount(@Param("orgIdPath") String orgIdPath,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
} }

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

@ -1,6 +1,9 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.yt.CommunityLoginFormDTO;
import com.epmet.dto.result.yt.CommunityLoginResultDTO;
import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO;
import com.epmet.entity.StaffLoginLogEntity; import com.epmet.entity.StaffLoginLogEntity;
@ -30,4 +33,12 @@ public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> {
* @return * @return
*/ */
LoginLogCountByLevelResultDTO countLevel(String orgId, String orgType, Date startDate, Date endDate); LoginLogCountByLevelResultDTO countLevel(String orgId, String orgType, Date startDate, Date endDate);
/**
* 下级社区账号登录次数排名
*
* @param formDTO
* @return
*/
PageData<CommunityLoginResultDTO> pageCommunityCount(CommunityLoginFormDTO formDTO);
} }

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

@ -6,6 +6,7 @@ import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; 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.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
@ -13,17 +14,23 @@ import com.epmet.commons.tools.utils.SpringContextUtils;
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.result.yt.CommunityLoginResultDTO;
import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO;
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;
import com.epmet.service.StaffLoginLogService; import com.epmet.service.StaffLoginLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 工作人员登录日志表 * 工作人员登录日志表
@ -173,5 +180,32 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
return resultDTO; return resultDTO;
} }
/**
* 下级社区账号登录次数排名
*
* @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.setOrgType(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());
}
// 不分页
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(orgIdPath, formDTO.getStartDate(), formDTO.getEndDate());
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size();
return new PageData<>(list, total, total);
}
} }

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

@ -22,5 +22,32 @@
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<!-- 各社区登录总次数 -->
<select id="pageCommunityCount" parameterType="map" resultType="com.epmet.dto.result.yt.CommunityLoginResultDTO">
SELECT
l.AGENCY_ID AS agencyId,
d.ORGANIZATION_NAME AS districtName,
s.ORGANIZATION_NAME AS streetName,
ca.ORGANIZATION_NAME AS agencyName,
l.AGENCY_LEVEL AS agencyLevel,
count( 1 ) AS count
FROM
staff_login_log l
INNER JOIN customer_agency ca ON ( l.AGENCY_ID = ca.ID )
LEFT JOIN customer_agency s ON ( ca.PID = s.ID )
LEFT JOIN customer_agency d ON ( s.PID = d.ID )
WHERE
l.DEL_FLAG = '0'
AND l.ORG_ID_PATH LIKE concat( #{orgIdPath}, '%' )
AND l.AGENCY_LEVEL = 'community'
<if test ='null != startDate'>
l.LOGIN_TIME &gt;= #{startDate}
</if>
<if test ='null != endDate'>
l.LOGIN_TIME &lt;= #{endDate}
</if>
GROUP BY
l.AGENCY_ID
order by count(1) desc
</select>
</mapper> </mapper>
Loading…
Cancel
Save