Browse Source

【居民管理党员管理】【统计数量确保一直】-王公峰-2020-05-22

feature/dangjian
wanggongfeng 5 years ago
parent
commit
a0971b262a
  1. 2
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/result/GridOpeningResultDTO.java
  2. 2
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/result/UserDataRankResultDTO.java
  3. 21
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/UserAnalysisDao.java
  4. 35
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/UserAnalysisServiceImpl.java
  5. 293
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml
  6. 2
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/dao/ItemDao.java
  7. 2
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyMembersController.java
  8. 6
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserController.java
  9. 32
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/UserDao.java
  10. 2
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyAuthenticationFailedServiceImpl.java
  11. 4
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyMembersServiceImpl.java
  12. 15
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java
  13. 26
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/PartyMembersDao.xml
  14. 418
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserDao.xml

2
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/result/GridOpeningResultDTO.java

@ -26,7 +26,7 @@ public class GridOpeningResultDTO implements Serializable {
*/
private int registerCount = 0;
/**
* 居民数包括认证成功和认证失败的居民
* 居民数包括认证成功和党员认证失败的居民
*/
private int residentCount = 0;

2
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/result/UserDataRankResultDTO.java

@ -38,7 +38,7 @@ public class UserDataRankResultDTO {
*/
private Integer unknownSexCount;
/**
* 居民数包括认证成功和认证失败的居民
* 居民数包括认证成功和党员认证居民失败的居民
*/
private Integer residentCount;
/**

21
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/UserAnalysisDao.java

@ -7,7 +7,6 @@ import com.elink.esua.epdc.dto.user.form.UserCountDTO;
import com.elink.esua.epdc.dto.user.form.UserSortRankFormDTO;
import com.elink.esua.epdc.dto.user.result.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -242,5 +241,25 @@ public interface UserAnalysisDao extends BaseMapper<UserAnalysisDTO> {
*/
List<ExportOperationDataResultDTO> selectExportEnterpriseCount(ExportOperationFormDTO exportOperationFormDTO);
/**
* 查询党员数据排行
*
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO>
* @author wanggongfeng
* @date 2020/5/20 14:48
*/
List<UserDataRankResultDTO> selectListUserDataRankByParty(Map<String, Object> params);
/**
* 查询居民数据排行
*
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO>
* @author wanggongfeng
* @date 2020/5/20 14:48
*/
List<UserDataRankResultDTO> selectListUserDataRankByUser(Map<String, Object> params);
}

35
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/UserAnalysisServiceImpl.java

@ -82,7 +82,7 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
// 注册数,认证党员数,认证居民数
List<GridOpeningResultDTO> registerDataList = baseDao.selectListReigistData(params);
// 未认证用户数
List<GridOpeningResultDTO> unAuthCountList = baseDao.selectListUnAuthorizedCountByGridId(params);
//List<GridOpeningResultDTO> unAuthCountList = baseDao.selectListUnAuthorizedCountByGridId(params);
// 新闻数 通知数 议题数
List<GridOpeningResultDTO> nneCountList = baseDao.selectListNewsNoticeEventCount(params);
// 项目数,项目结案数,项目好评数
@ -93,8 +93,14 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
for (GridOpeningResultDTO resultDto : list) {
for (GridOpeningResultDTO registerData : registerDataList) {
if (resultDto.getGridId().equals(registerData.getGridId())) {
// 用户数
resultDto.setRegisterCount(registerData.getRegisterCount());
// 党员数
resultDto.setPartyCount(registerData.getPartyCount());
// 居民书
resultDto.setResidentCount(registerData.getResidentCount());
// 未注册居民
resultDto.setUnAuthorizedCount(registerData.getRegisterCount()- registerData.getPartyCount() - registerData.getResidentCount());
break;
}
}
@ -122,13 +128,13 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
break;
}
}
for (GridOpeningResultDTO unAuthCountData : unAuthCountList) {
/* for (GridOpeningResultDTO unAuthCountData : unAuthCountList) {
if (resultDto.getGridId().equals(unAuthCountData.getGridId())) {
resultDto.setUnAuthorizedCount(unAuthCountData.getUnAuthorizedCount());
break;
}
}
resultDto.setRegisterCount(resultDto.getResidentCount() + resultDto.getPartyCount() + resultDto.getUnAuthorizedCount());
}*/
//resultDto.setRegisterCount(resultDto.getResidentCount() + resultDto.getPartyCount() + resultDto.getUnAuthorizedCount());
}
}
return list;
@ -145,7 +151,7 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
}
private List<UserDataRankResultDTO> getListUserDataRankResultDro(Map<String, Object> params) {
List<UserDataRankResultDTO> list = baseDao.selectListUserDataRank(params);
/*List<UserDataRankResultDTO> list = baseDao.selectListUserDataRank(params);
if (CollUtil.isNotEmpty(list)) {
List<String> streetIdList = Lists.newArrayList();
@ -179,6 +185,19 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
}
}
}
return list;*/
// 页码设置为1,则下面几次查询不会拼接分页
params.put("page", NumConstant.ONE);
String partyFlag = MapUtil.getStr(params, "partyFlag");
List<UserDataRankResultDTO> list = new ArrayList<UserDataRankResultDTO>();
// 党员排行列表
if (StringUtils.isNotBlank(partyFlag) && YesOrNoEnum.YES.value().equals(partyFlag)) {
list = baseDao.selectListUserDataRankByParty(params);
} else {
list = baseDao.selectListUserDataRankByUser(params);
}
return list;
}
@ -295,7 +314,7 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
//用户相关
List<ExportOperationDataResultDTO> exportOperationDataResultDTOS = baseDao.selectExportUserCount(exportOperationFormDTO);
// 未认证用户
List<ExportOperationDataResultDTO> unAuthorizedResultDTOS = baseDao.selectExportunAuthorizedCount(exportOperationFormDTO);
//List<ExportOperationDataResultDTO> unAuthorizedResultDTOS = baseDao.selectExportunAuthorizedCount(exportOperationFormDTO);
List<ExportOperationDataResultDTO> newsResultDTOS = baseDao.selectExportNewsCount(exportOperationFormDTO);
// 议题
@ -313,13 +332,13 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
List<ExportOperationDataResultDTO> enterpriseDataResultDTOS = baseDao.selectExportEnterpriseCount(exportOperationFormDTO);
//居民数
for (int i = 0; i < exportOperationDataResultDTOS.size(); i++) {
for (ExportOperationDataResultDTO item : unAuthorizedResultDTOS) {
/*for (ExportOperationDataResultDTO item : unAuthorizedResultDTOS) {
if (exportOperationDataResultDTOS.get(i).getStreetName().equals(item.getStreetName())) {
exportOperationDataResultDTOS.get(i).setRegisterCount(exportOperationDataResultDTOS.get(i).getRegisterCount() + item.getUnAuthorizedCount());
} else {
exportOperationDataResultDTOS.get(i).setRegisterCount(exportOperationDataResultDTOS.get(i).getRegisterCount());
}
}
}*/
exportOperationDataResultDTOS.get(i).setNewsCount(newsResultDTOS.get(i).getNewsCount());
exportOperationDataResultDTOS.get(i).setItemCount(itemDataResultDTOS.get(i).getItemCount());
exportOperationDataResultDTOS.get(i).setItemCloseCount(itemDataResultDTOS.get(i).getItemCloseCount());

293
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml

@ -60,6 +60,7 @@
<when test='category != null and category == "6"'>order by residentCount desc </when>
<otherwise> order by t1.streetId asc </otherwise>
</choose>
</select>
<select id="selectListPartyAuthFailureCountByStreetId" resultType="com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO">
@ -329,7 +330,7 @@
</select>
<select id="selectListReigistData" resultType="com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO">
SELECT
<!--SELECT
t.DEPT_ID gridId, COUNT( t.ID ) registerCount,
COUNT(t.PARTY_FLAG = '0' OR NULL) residentCount,
COUNT(t.PARTY_FLAG = '1' OR NULL) partyCount
@ -348,6 +349,54 @@
</if>
AND uu.DEPT_ID IS NOT NULL
) t
GROUP BY t.DEPT_ID-->
SELECT
t.DEPT_ID gridId, COUNT( t.ID ) registerCount,
COUNT(((t.AUTHENTICATED_TYPE='0' and t.AUTHENTICATED_FLAG = '1') or (t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '0' AND t.HistoryCount > 0)) OR NULL) residentCount,
COUNT((t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '1') OR NULL) partyCount
FROM (
SELECT
uu.ID, uu.DEPT_ID , uu.STATE, uu.PARTY_FLAG,
HISTORY.AUTHENTICATED_TYPE,HISTORY.AUTHENTICATED_FLAG,HISCOUNT.HistoryCount
FROM
esua_epdc_user.epdc_user uu
LEFT JOIN (
SELECT MAX( CREATED_TIME ) AS CREATED_TIME, USER_ID
FROM esua_epdc_user.epdc_user_authenticate_history
WHERE DEL_FLAG = '0' AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = uu.ID
LEFT JOIN esua_epdc_user.epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
LEFT JOIN (
SELECT
count(id) AS HistoryCount,
USER_ID
FROM
esua_epdc_user.epdc_user_authenticate_history
WHERE
DEL_FLAG = '0'
AND AUTHENTICATED_TYPE IN ( '0', '1' )
AND AUTHENTICATED_FLAG= '1'
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) HISCOUNT ON HISCOUNT.USER_ID = uu.ID
WHERE
uu.DEL_FLAG = '0'
<if test="gridIdList != null and gridIdList.size() > 0">
AND uu.DEPT_ID in <include refid="foreachGridIdList"></include>
</if>
<if test="startTime != null and endTime != null and endTime != ''">
AND DATE_FORMAT(uu.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
AND uu.DEPT_ID IS NOT NULL
) t
GROUP BY t.DEPT_ID
</select>
@ -434,34 +483,70 @@
<!--运营导出数据相关-->
<select id="selectExportUserCount" resultType="com.elink.esua.epdc.dto.user.result.ExportOperationDataResultDTO" parameterType="com.elink.esua.epdc.dto.user.form.ExportOperationFormDTO">
select
tab.streetName,
(tab.userTotal - tab.partyCount) as registerCount,
tab.partyCount
from (
SELECT
t0.`name` streetName,
count(uu.PARTY_FLAG = '0'OR NULL)AS registerCount,
count(uu.PARTY_FLAG = '1'OR NULL) AS partyCount
count(uu.id) userTotal,
count((HISTORY.AUTHENTICATED_TYPE='1' and HISTORY.AUTHENTICATED_FLAG = '1') or null ) AS partyCount
FROM
esua_epdc_user.epdc_user uu
LEFT JOIN (
SELECT MIN( CREATED_TIME ) AS CREATED_TIME,
USER_ID FROM esua_epdc_user.epdc_user_grid_relation
WHERE
DEL_FLAG = '0'
GROUP BY
USER_ID
) MINRELA
ON MINRELA.USER_ID = uu.ID
LEFT JOIN esua_epdc_user.epdc_user_grid_relation RELATION ON RELATION.USER_ID = MINRELA.USER_ID AND RELATION.DEL_FLAG = '0' AND MINRELA.CREATED_TIME = RELATION.CREATED_TIME
inner JOIN
(
SELECT
ad.id,
ad.`name`,
ad.pid
FROM
esua_epdc_admin.sys_dept ad
WHERE
ad.id IN <include refid="foreachAllDeptIdsShow"></include>
AND ad.del_flag = 0
SELECT
ad.id,
ad.`name`,
ad.pid
FROM
esua_epdc_admin.sys_dept ad
WHERE
ad.id IN <include refid="foreachAllDeptIdsShow"></include>
AND ad.del_flag = 0
) t0
LEFT JOIN esua_epdc_user.epdc_user uu ON find_in_set(t0.id, uu.ALL_DEPT_IDS)
AND uu.DEL_FLAG = '0'
ON find_in_set(t0.id, IFNULL(uu.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS))
LEFT JOIN (
SELECT MAX( CREATED_TIME ) AS CREATED_TIME, USER_ID
FROM esua_epdc_user.epdc_user_authenticate_history
WHERE DEL_FLAG = '0' AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="operationEndTime != null and operationEndTime != ''">
AND DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{operationEndTime}
</if>
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = uu.ID
LEFT JOIN esua_epdc_user.epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
where uu.DEL_FLAG = '0'
<if test="operationStartTime != null and operationEndTime != null and operationEndTime != ''">
AND uu.CREATED_TIME BETWEEN #{operationStartTime} AND #{operationEndTime}
AND DATE_FORMAT(uu.CREATED_TIME,'%Y-%m-%d') BETWEEN #{operationStartTime} AND #{operationEndTime}
</if>
<if test="endTime != null and endTime != ''">
and uu.CREATED_TIME &lt;=#{endTime}
and DATE_FORMAT(uu.CREATED_TIME,'%Y-%m-%d') &lt;=#{endTime}
</if>
GROUP BY
t0.id
ORDER BY
t0.id ASC
t0.id ASC) tab
</select>
<select id="selectExportunAuthorizedCount" resultType="com.elink.esua.epdc.dto.user.result.ExportOperationDataResultDTO">
@ -731,4 +816,178 @@
#{item}
</foreach>
</sql>
<select id="selectListUserDataRankByParty" resultType="com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO">
SELECT
t1.*,
t1.oldCount / t1.partyMemberCount oldPercent,
t1.youngCount / t1.partyMemberCount youngPercent
FROM (
SELECT
t.streetName, t.streetId,
count( (t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '1' and t.SEX = '1') OR NULL ) maleCount,
count( (t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '1' and t.SEX = '0') OR NULL ) femaleCount,
count( (t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '1' and t.SEX = '2') OR NULL ) unknownSexCount,
COUNT( (t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '1') OR NULL ) partyMemberCount,
count((t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '0' ) or null ) partyAuthFailureCount,
COUNT( (t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '1' and t.age > 50) OR NULL ) oldCount,
COUNT( (t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '1' and t.age &lt;= 50 AND t.age > 0 ) OR NULL ) youngCount
FROM (
SELECT
uu.ID AS userId,
CASE WHEN uu.SEX is null or uu.SEX != '0' AND uu.SEX != '1' THEN '2' ELSE uu.SEX END AS SEX,
uu.STATE, uu.PARTY_FLAG, uu.DEPT_ID,
IFNULL( TIMESTAMPDIFF( YEAR, uu.BIRTHDAY, CURDATE()), 0 ) age,
ad2.`name` streetName, ad2.id streetId,
HISTORY.AUTHENTICATED_TYPE,
HISTORY.AUTHENTICATED_FLAG
FROM
esua_epdc_user.epdc_user uu
LEFT JOIN (SELECT MIN( CREATED_TIME ) AS CREATED_TIME, USER_ID FROM esua_epdc_user.epdc_user_grid_relation WHERE DEL_FLAG = '0' GROUP BY USER_ID ) MINRELA ON MINRELA.USER_ID = uu.ID
LEFT JOIN esua_epdc_user.epdc_user_grid_relation RELATION ON RELATION.USER_ID = MINRELA.USER_ID AND RELATION.DEL_FLAG = '0' AND MINRELA.CREATED_TIME = RELATION.CREATED_TIME
LEFT JOIN esua_epdc_admin.sys_dept ad ON IFNULL(uu.DEPT_ID,RELATION.GRID_ID) = ad.ID AND ad.type_key = 'grid_party'
<include refid="joinCommunityStreet"></include>
LEFT JOIN (
SELECT MAX( CREATED_TIME ) AS CREATED_TIME, USER_ID
FROM esua_epdc_user.epdc_user_authenticate_history
WHERE DEL_FLAG = '0' AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = uu.ID
LEFT JOIN esua_epdc_user.epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
WHERE uu.DEL_FLAG = '0'
<choose>
<when test="gridId != null and gridId != ''">AND ad2.ID = #{gridId}</when>
<otherwise>
<if test="deptIdList != null and deptIdList.size() > 0">
AND ad2.ID in
<foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">#{deptId}</foreach>
</if>
</otherwise>
</choose>
<if test="startTime != null and endTime != null and endTime != ''">
AND DATE_FORMAT(uu.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
AND ad2.id is NOT NULL
AND ad.id IS NOT NULL
) t GROUP BY t.streetId
) t1
<choose>
<when test='category != null and category == "0"'> order by t1.oldCount desc </when>
<when test='category != null and category == "1"'> order by t1.youngCount desc </when>
<when test='category != null and category == "2"'> order by t1.oldCount asc </when>
<when test='category != null and category == "3"'> order by t1.youngCount asc </when>
<when test='category != null and category == "7"'>order by t1.userCount desc </when>
<when test='category != null and category == "8"'>order by t1.userCount asc </when>
<when test='category != null and category == "4"'>order by t1.userCount desc </when>
<when test='category != null and category == "5"'>order by t1.partyMemberCount desc </when>
<when test='category != null and category == "6"'>order by residentCount desc </when>
<otherwise> order by t1.streetId asc </otherwise>
</choose>
</select>
<select id="selectListUserDataRankByUser" resultType="com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO">
SELECT
t1.*,
(t1.userCount - t1.partyMemberCount - t1.residentCount) unAuthorizedCount,
t1.oldCount / (t1.userCount - t1.partyMemberCount) oldPercent,
t1.youngCount / (t1.userCount - t1.partyMemberCount) youngPercent
FROM (
SELECT
t.streetName, t.streetId,
count(t.userId) userCount,
count( (t.AUTHENTICATED_TYPE!='1' or t.AUTHENTICATED_FLAG != '1' and t.SEX = '1') OR NULL ) maleCount,
count( (t.AUTHENTICATED_TYPE!='1' or t.AUTHENTICATED_FLAG != '1' and t.SEX = '0') OR NULL ) femaleCount,
count( (t.AUTHENTICATED_TYPE!='1' or t.AUTHENTICATED_FLAG != '1' and t.SEX = '2') OR NULL ) unknownSexCount,
COUNT( (t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '1') OR NULL ) partyMemberCount,
count( ((t.AUTHENTICATED_TYPE='0' and t.AUTHENTICATED_FLAG = '1') or (t.AUTHENTICATED_TYPE='1' and t.AUTHENTICATED_FLAG = '0' AND t.HistoryCount > 0)) or null ) residentCount,
COUNT( (t.AUTHENTICATED_TYPE!='1' or t.AUTHENTICATED_FLAG != '1' and t.age > 50) OR NULL ) oldCount,
COUNT( (t.AUTHENTICATED_TYPE!='1' or t.AUTHENTICATED_FLAG != '1' and t.age &lt;= 50 AND t.age > 0 ) OR NULL ) youngCount
FROM (
SELECT
uu.ID AS userId,
CASE WHEN uu.SEX is null or uu.SEX != '0' AND uu.SEX != '1' THEN '2' ELSE uu.SEX END AS SEX,
uu.STATE, uu.PARTY_FLAG, uu.DEPT_ID,
IFNULL( TIMESTAMPDIFF( YEAR, uu.BIRTHDAY, CURDATE()), 0 ) age,
ad2.`name` streetName, ad2.id streetId,
HISTORY.AUTHENTICATED_TYPE,
HISTORY.AUTHENTICATED_FLAG,
HISCOUNT.HistoryCount
FROM
esua_epdc_user.epdc_user uu
LEFT JOIN (SELECT MIN( CREATED_TIME ) AS CREATED_TIME, USER_ID FROM esua_epdc_user.epdc_user_grid_relation WHERE DEL_FLAG = '0' GROUP BY USER_ID ) MINRELA ON MINRELA.USER_ID = uu.ID
LEFT JOIN esua_epdc_user.epdc_user_grid_relation RELATION ON RELATION.USER_ID = MINRELA.USER_ID AND RELATION.DEL_FLAG = '0' AND MINRELA.CREATED_TIME = RELATION.CREATED_TIME
LEFT JOIN esua_epdc_admin.sys_dept ad ON IFNULL(uu.DEPT_ID,RELATION.GRID_ID) = ad.ID AND ad.type_key = 'grid_party'
<include refid="joinCommunityStreet"></include>
LEFT JOIN (
SELECT MAX( CREATED_TIME ) AS CREATED_TIME, USER_ID
FROM esua_epdc_user.epdc_user_authenticate_history
WHERE DEL_FLAG = '0' AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = uu.ID
LEFT JOIN esua_epdc_user.epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
LEFT JOIN (
SELECT
count(id) AS HistoryCount,
USER_ID
FROM
esua_epdc_user.epdc_user_authenticate_history
WHERE
DEL_FLAG = '0'
AND AUTHENTICATED_TYPE IN ( '0', '1' )
AND AUTHENTICATED_FLAG= '1'
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) HISCOUNT ON HISCOUNT.USER_ID = uu.ID
WHERE uu.DEL_FLAG = '0'
<choose>
<when test="gridId != null and gridId != ''">AND ad2.ID = #{gridId}</when>
<otherwise>
<if test="deptIdList != null and deptIdList.size() > 0">
AND ad2.ID in
<foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">#{deptId}</foreach>
</if>
</otherwise>
</choose>
<if test="startTime != null and endTime != null and endTime != ''">
AND DATE_FORMAT(uu.CREATED_TIME,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
AND ad2.id is NOT NULL
AND ad.id IS NOT NULL
) t GROUP BY t.streetId
) t1
<choose>
<when test='category != null and category == "0"'> order by t1.oldCount desc </when>
<when test='category != null and category == "1"'> order by t1.youngCount desc </when>
<when test='category != null and category == "2"'> order by t1.oldCount asc </when>
<when test='category != null and category == "3"'> order by t1.youngCount asc </when>
<when test='category != null and category == "7"'>order by t1.userCount desc </when>
<when test='category != null and category == "8"'>order by t1.userCount asc </when>
<when test='category != null and category == "4"'>order by t1.userCount desc </when>
<when test='category != null and category == "5"'>order by t1.partyMemberCount desc </when>
<when test='category != null and category == "6"'>order by residentCount desc </when>
<otherwise> order by t1.streetId asc </otherwise>
</choose>
</select>
</mapper>

2
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/dao/ItemDao.java

@ -187,7 +187,7 @@ public interface ItemDao extends BaseDao<ItemEntity> {
* @author liuchuang
* @since 2019/10/30 13:28
*/
int selectCountOfItemDeptNotice(Long deptId, int state);
int selectCountOfItemDeptNotice(@Param("deptId") Long deptId, @Param("state") int state);
/**
* 根据吹哨部门ID统计吹哨部门待处理项目数量

2
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyMembersController.java

@ -171,7 +171,7 @@ public class PartyMembersController {
* @date 2020/3/19 13:34
*/
@GetMapping("optimizeHasAuthenticationPartyPage")
@DataFilter(tableAlias = "eu", prefix = "AND", isPendingCreator = false)
// @DataFilter(tableAlias = "eu", prefix = "AND", isPendingCreator = false)
public Result<PageData<PartyMembersDTO>> optimizeHasAuthenticationPartyPage(@RequestParam Map<String, Object> params) {
return partyMembersService.optimizeHasAuthenticationPartyPage(params);
}

6
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserController.java

@ -56,7 +56,7 @@ public class UserController {
private UserService userService;
@GetMapping("page")
@DataFilter(tableAlias = "ug", isPendingCreator = false, deptId = "GRID_ID", prefix = "AND")
// @DataFilter(tableAlias = "ug", isPendingCreator = false, deptId = "GRID_ID", prefix = "AND")
public Result<PageData<UserDTO>> page(@RequestParam Map<String, Object> params) {
PageData<UserDTO> page = userService.page(params);
return new Result<PageData<UserDTO>>().ok(page);
@ -72,7 +72,7 @@ public class UserController {
* @since 2020/3/24 15:47
*/
@GetMapping("waitPartyPage")
@DataFilter(tableAlias = "u", isPendingCreator = false, deptId = "DEPT_ID", prefix = "AND")
// @DataFilter(tableAlias = "u", isPendingCreator = false, deptId = "DEPT_ID", prefix = "AND")
public Result<PageData<UserDTO>> waitPartyPage(@RequestParam Map<String, Object> params) {
PageData<UserDTO> page = userService.waitPartyPage(params);
return new Result<PageData<UserDTO>>().ok(page);
@ -278,7 +278,7 @@ public class UserController {
* @date 2020/3/16 16:54
*/
@GetMapping("authenticatedpage")
@DataFilter(tableAlias = "u", isPendingCreator = false, deptId = "DEPT_ID", prefix = "AND")
// @DataFilter(tableAlias = "u", isPendingCreator = false, deptId = "DEPT_ID", prefix = "AND")
public Result<PageData<UserDTO>> authenticatedpage(@RequestParam Map<String, Object> params) {
PageData<UserDTO> page = userService.authenticatedpage(params);
return new Result<PageData<UserDTO>>().ok(page);

32
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/UserDao.java

@ -20,7 +20,6 @@ package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.CachingUserInfoDTO;
import com.elink.esua.epdc.dto.UserDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcAppQueryUserInfoFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcUnauthorizedAmountFromDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcUserGroupInviteFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcWorkUserFromDTO;
@ -241,4 +240,35 @@ public interface UserDao extends BaseDao<UserEntity> {
*/
List<UserDTO> selectWaitAuthenticatedListUserDto(Map<String, Object> params);
/***
* 已认证居民
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.UserDTO>
* @author wanggongfeng
* @date 2020/5/22 13:18
*/
List<UserDTO> selectAuthenticatedListUserDtoByList(Map<String, Object> params);
/***
* 未认证居民
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.UserDTO>
* @author wanggongfeng
* @date 2020/5/22 13:18
*/
List<UserDTO> selectListUserDtoByList(Map<String, Object> params);
/**
*
* 认证失败居民
*
* @params [params]
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.UserDTO>
* @author wanggongfeng
* @date 2020/5/22 13:18
*/
List<UserDTO> selectFaildAuthenticatedListUserDto(Map<String, Object> params);
}

2
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyAuthenticationFailedServiceImpl.java

@ -22,6 +22,7 @@ import com.elink.esua.epdc.commons.dynamic.datasource.annotation.DataSource;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.dao.PartyAuthenticationFailedDao;
import com.elink.esua.epdc.datasources.DataSourceNames;
@ -63,6 +64,7 @@ public class PartyAuthenticationFailedServiceImpl extends BaseServiceImpl<PartyA
paramKeys = new String[]{"realName", "identityNo", "mobile"};
params = AppUserUtils.trimParamValue(params, paramKeys);
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
IPage<PartyAuthenticationFailedEntity> page = this.getPage(params);
List<PartyAuthenticationFailedDTO> list = baseDao.selectListDto(params);
return new PageData<>(list, page.getTotal());

4
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyMembersServiceImpl.java

@ -24,14 +24,13 @@ import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.dynamic.datasource.annotation.DataSource;
import com.elink.esua.epdc.async.PartyTask;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
@ -509,6 +508,7 @@ public class PartyMembersServiceImpl extends BaseServiceImpl<PartyMembersDao, Pa
@Override
public Result<PageData<PartyMembersDTO>> optimizeHasAuthenticationPartyPage(Map<String, Object> params) {
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
IPage<String> page = getPage(params);
List<String> userIds = baseDao.optimizeHasAuthenticationPartyPage(params);
if (userIds.size() > 0) {

15
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java

@ -145,14 +145,16 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
}
this.verifyParams(params);
// 查询当前用户所具有的的数据权限
params.put("deptIdList",SecurityUser.getUser().getDeptIdList());
IPage<UserDTO> iPage = this.getPage(params);
List<UserDTO> userDtoList = this.baseDao.selectListUserDto(params);
List<UserDTO> userDtoList = this.baseDao.selectListUserDtoByList(params);
return new PageData<>(userDtoList, iPage.getTotal());
}
@Override
public PageData<UserDTO> waitPartyPage(Map<String, Object> params) {
this.verifyParams(params);
params.put("deptIdList",SecurityUser.getUser().getDeptIdList());
IPage<UserDTO> iPage = this.getPage(params);
List<UserDTO> userDtoList = this.baseDao.selectListOfWaitPartyUserDto(params);
return new PageData<>(userDtoList, iPage.getTotal());
@ -1551,14 +1553,23 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
}
this.verifyParams(params);
// 查询当前用户所具有的的数据权限
params.put("deptIdList",SecurityUser.getUser().getDeptIdList());
if (NumConstant.ONE_STR.equals(params.get("state").toString())) {
// 待认证
IPage<UserDTO> iPage = this.getPage(params);
List<UserDTO> userDtoList = this.baseDao.selectWaitAuthenticatedListUserDto(params);
return new PageData<>(userDtoList, iPage.getTotal());
} else if (NumConstant.THREE_STR.equals(params.get("state").toString())){
// 已认证
IPage<UserDTO> iPage = this.getPage(params);
List<UserDTO> userDtoList = this.baseDao.selectAuthenticatedListUserDtoByList(params);
return new PageData<>(userDtoList, iPage.getTotal());
} else {
// 认证失败
IPage<UserDTO> iPage = this.getPage(params);
List<UserDTO> userDtoList = this.baseDao.selectAuthenticatedListUserDto(params);
List<UserDTO> userDtoList = this.baseDao.selectFaildAuthenticatedListUserDto(params);
return new PageData<>(userDtoList, iPage.getTotal());
}
}

26
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/PartyMembersDao.xml

@ -160,14 +160,29 @@
eu.ID
FROM
epdc_user eu
LEFT JOIN (
SELECT
MAX( CREATED_TIME ) AS CREATED_TIME,
USER_ID
FROM
epdc_user_authenticate_history
WHERE
DEL_FLAG = '0'
AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = eu.ID
LEFT JOIN epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
WHERE
eu.PARTY_FLAG = '1' and eu.DEL_FLAG = '0'
eu.DEL_FLAG = '0'
<if test="realName != null and realName != '' ">and eu.REAL_NAME = #{realName}</if>
<if test="mobile != null and mobile != '' ">and eu.MOBILE = #{mobile}</if>
<if test="identityNo != null and identityNo != '' ">and eu.IDENTITY_NO = #{identityNo}</if>
<if test="registFlag != null and registFlag != '' ">and eu.REGIST_FLAG = #{registFlag}</if>
<if test="startTime != null and startTime != '' ">and eu.CREATED_TIME >= #{startTime}</if>
<if test="endTime != null and endTime != '' "> <![CDATA[ and eu.CREATED_TIME <= ]]> #{endTime}</if>
<if test="startTime != null and startTime != '' ">and DATE_FORMAT(eu.CREATED_TIME,'%Y-%m-%d') >= #{startTime}</if>
<if test="endTime != null and endTime != '' "> <![CDATA[ and DATE_FORMAT(eu.CREATED_TIME,'%Y-%m-%d') <= ]]> #{endTime}</if>
<if test="streetId != '' and streetId != null">
AND (find_in_set(#{streetId},eu.PARENT_DEPT_IDS) OR find_in_set(#{streetId},eu.ALL_DEPT_IDS))
</if>
@ -177,6 +192,11 @@
<if test="gridId != '' and gridId != null">
and (eu.dept_id = #{gridId} OR find_in_set(#{gridId},eu.ALL_DEPT_IDS))
</if>
AND eu.DEPT_ID IN
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
and (HISTORY.AUTHENTICATED_TYPE='1' and HISTORY.AUTHENTICATED_FLAG = '1')
ORDER BY eu.REGISTER_TIME DESC

418
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserDao.xml

@ -102,44 +102,7 @@
u.ID
ORDER BY
u.register_time desc
</select>
<select id="selectListOfWaitPartyUserDto" resultType="com.elink.esua.epdc.dto.UserDTO">
SELECT
u.id,
u.REAL_NAME,
u.NICKNAME,
u.MOBILE,
u.REGISTER_TIME,
u.CREATED_TIME,
u.UPDATED_TIME,
u.IDENTITY_NO,
u.ADDRESS,
u.STATE,
u.PARTY_FLAG,
u.ALL_DEPT_NAMES
FROM
epdc_user u
where
u.del_flag = '0'
and u.IDENTITY_NO is not null
and u.state = '1'
<![CDATA[ AND u.IDENTITY_NO != '' ]]>
<if test="startTime != '' and endTime != ''">and u.CREATED_TIME between #{startTime} and #{endTime}</if>
<if test="realName != '' and realName != null">and u.real_name like '%${realName}%'</if>
<if test="mobile != '' and mobile != null">and u.mobile like '%${mobile}%'</if>
<if test="streetId != '' and streetId != null">
AND (find_in_set(#{streetId},u.PARENT_DEPT_IDS)
OR find_in_set(#{streetId},u.ALL_DEPT_IDS))
</if>
<if test="communityId != '' and communityId != null">
AND (find_in_set(#{communityId},u.PARENT_DEPT_IDS)
OR find_in_set(#{communityId},u.ALL_DEPT_IDS))
</if>
<if test="gridId != '' and gridId != null">
and find_in_set(#{gridId},u.ALL_DEPT_IDS)
</if>
ORDER BY
u.register_time desc
</select>
<!-- 根据userId获取居民详情(已认证或待认证(提交信息待审核)的居民用户) -->
<resultMap id="EpdcResidentDetailResultDtoMap"
@ -578,9 +541,84 @@
ORDER BY
u.register_time desc
</select>
<select id="selectAuthenticatedListUserDtoByList" resultType="com.elink.esua.epdc.dto.UserDTO">
SELECT
u.id,
u.REAL_NAME,
u.NICKNAME,
u.MOBILE,
u.REGISTER_TIME,
u.CREATED_TIME,
IDENTITY_NO,
u.ADDRESS,
STATE,
PARTY_FLAG,
u.ALL_DEPT_NAMES,
u.FACE_IMG
FROM
epdc_user u
LEFT JOIN (
SELECT
MAX( CREATED_TIME ) AS CREATED_TIME,
USER_ID
FROM
epdc_user_authenticate_history
WHERE
DEL_FLAG = '0'
AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = u.ID
LEFT JOIN epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
LEFT JOIN (
SELECT
count(id) AS HistoryCount,
USER_ID
FROM
epdc_user_authenticate_history
WHERE
DEL_FLAG = '0'
AND AUTHENTICATED_TYPE IN ( '0', '1' )
AND AUTHENTICATED_FLAG= '1'
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY
USER_ID
) HISCOUNT ON HISCOUNT.USER_ID = u.ID
where
u.del_flag = '0'
<if test="startTime != '' and endTime != ''">and DATE_FORMAT(u.CREATED_TIME,'%Y-%m-%d') between #{startTime} and #{endTime}</if>
<!--<if test="state != '' and state != null">and u.state = #{state}</if>-->
<if test="realName != '' and realName != null">and u.real_name like '%${realName}%'</if>
<if test="nickname != '' and nickname != null">and u.NICKNAME like '%${nickname}%'</if>
<if test="mobile != '' and mobile != null">and u.mobile like '%${mobile}%'</if>
<if test="identityNo != '' and identityNo != null">and u.identity_no like '%${identityNo}%'</if>
<if test="streetId != '' and streetId != null">
AND (find_in_set(#{streetId},u.PARENT_DEPT_IDS)
OR find_in_set(#{streetId},u.ALL_DEPT_IDS))
</if>
<if test="communityId != '' and communityId != null">
AND (find_in_set(#{communityId},u.PARENT_DEPT_IDS)
OR find_in_set(#{communityId},u.ALL_DEPT_IDS))
</if>
<if test="gridId != '' and gridId != null">
AND
find_in_set(#{gridId},u.ALL_DEPT_IDS)
</if>
AND u.DEPT_ID IN
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
and ((HISTORY.AUTHENTICATED_TYPE='0' and HISTORY.AUTHENTICATED_FLAG = '1') or (HISTORY.AUTHENTICATED_TYPE='1' and HISTORY.AUTHENTICATED_FLAG = '0' AND HISCOUNT.HistoryCount > 0))
ORDER BY
u.register_time desc
</select>
<select id="selectWaitAuthenticatedListUserDto" resultType="com.elink.esua.epdc.dto.UserDTO">
SELECT
<!--SELECT
u.id,
u.REAL_NAME,
u.NICKNAME,
@ -618,6 +656,306 @@
find_in_set(#{gridId},u.ALL_DEPT_IDS)
</if>
ORDER BY
u.register_time desc
u.register_time desc-->
SELECT
u.id,
u.REAL_NAME,
u.NICKNAME,
u.MOBILE,
u.REGISTER_TIME,
u.CREATED_TIME,
u.UPDATED_TIME,
IDENTITY_NO,
u.ADDRESS,
STATE,
PARTY_FLAG,
RELATION.ALL_DEPT_NAMES,
u.FACE_IMG
FROM
epdc_user u
LEFT JOIN (
SELECT
MAX( CREATED_TIME ) AS CREATED_TIME,
USER_ID
FROM
epdc_user_authenticate_history
WHERE
DEL_FLAG = '0'
AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = u.ID
LEFT JOIN epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
LEFT JOIN (
SELECT MIN( ug.CREATED_TIME ) AS CREATED_TIME,
ug.USER_ID FROM epdc_user_grid_relation ug
WHERE
ug.DEL_FLAG = '0'
GROUP BY USER_ID
) MINRELA ON MINRELA.USER_ID = u.ID
LEFT JOIN epdc_user_grid_relation RELATION ON RELATION.USER_ID = MINRELA.USER_ID AND RELATION.DEL_FLAG = '0' AND MINRELA.CREATED_TIME = RELATION.CREATED_TIME
where u.del_flag = '0'
<if test="startTime != '' and endTime != ''">and DATE_FORMAT(u.CREATED_TIME,'%Y-%m-%d') between #{startTime} and #{endTime}</if>
<if test="realName != '' and realName != null">and u.real_name like '%${realName}%'</if>
<if test="nickname != '' and nickname != null">and u.NICKNAME like '%${nickname}%'</if>
<if test="mobile != '' and mobile != null">and u.mobile like '%${mobile}%'</if>
<if test="identityNo != '' and identityNo != null">and u.identity_no like '%${identityNo}%'</if>
AND IFNULL(u.dept_id,RELATION.GRID_ID) IN
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
<if test="streetId != '' and streetId != null">
AND (find_in_set(#{streetId},IFNULL(u.PARENT_DEPT_IDS,RELATION.PARENT_DEPT_IDS))
OR find_in_set(#{streetId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
<if test="communityId != '' and communityId != null">
AND (find_in_set(#{communityId},IFNULL(u.PARENT_DEPT_IDS,RELATION.PARENT_DEPT_IDS))
OR find_in_set(#{communityId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
<if test="gridId != '' and gridId != null">
and (IFNULL(u.dept_id,RELATION.GRID_ID) = #{gridId}
OR find_in_set(#{gridId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
and HISTORY.AUTHENTICATED_TYPE='0' and HISTORY.AUTHENTICATED_FLAG = '2'
GROUP BY u.ID
ORDER BY u.register_time desc
</select>
<select id="selectListUserDtoByList" resultType="com.elink.esua.epdc.dto.UserDTO">
SELECT
u.id,
u.REAL_NAME,
u.NICKNAME,
u.MOBILE,
u.REGISTER_TIME,
u.CREATED_TIME,
u.UPDATED_TIME,
IDENTITY_NO,
u.ADDRESS,
STATE,
PARTY_FLAG,
RELATION.ALL_DEPT_NAMES,
u.FACE_IMG
FROM
epdc_user u
LEFT JOIN (
SELECT
MAX( CREATED_TIME ) AS CREATED_TIME,
USER_ID
FROM
epdc_user_authenticate_history
WHERE
DEL_FLAG = '0'
AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = u.ID
LEFT JOIN epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
LEFT JOIN (
SELECT MIN( ug.CREATED_TIME ) AS CREATED_TIME,
ug.USER_ID FROM epdc_user_grid_relation ug
WHERE
ug.DEL_FLAG = '0'
GROUP BY USER_ID
) MINRELA ON MINRELA.USER_ID = u.ID
LEFT JOIN epdc_user_grid_relation RELATION ON RELATION.USER_ID = MINRELA.USER_ID AND RELATION.DEL_FLAG = '0' AND MINRELA.CREATED_TIME = RELATION.CREATED_TIME
where u.del_flag = '0'
<if test="startTime != '' and endTime != ''">and DATE_FORMAT(u.CREATED_TIME,'%Y-%m-%d') between #{startTime} and #{endTime}</if>
<if test="realName != '' and realName != null">and u.real_name like '%${realName}%'</if>
<if test="nickname != '' and nickname != null">and u.NICKNAME like '%${nickname}%'</if>
<if test="mobile != '' and mobile != null">and u.mobile like '%${mobile}%'</if>
<if test="identityNo != '' and identityNo != null">and u.identity_no like '%${identityNo}%'</if>
AND IFNULL(u.dept_id,RELATION.GRID_ID) IN
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
<if test="streetId != '' and streetId != null">
AND (find_in_set(#{streetId},IFNULL(u.PARENT_DEPT_IDS,RELATION.PARENT_DEPT_IDS))
OR find_in_set(#{streetId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
<if test="communityId != '' and communityId != null">
AND (find_in_set(#{communityId},IFNULL(u.PARENT_DEPT_IDS,RELATION.PARENT_DEPT_IDS))
OR find_in_set(#{communityId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
<if test="gridId != '' and gridId != null">
and (IFNULL(u.dept_id,RELATION.GRID_ID) = #{gridId}
OR find_in_set(#{gridId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
and HISTORY.id is null
GROUP BY u.ID
ORDER BY u.register_time desc
</select>
<select id="selectFaildAuthenticatedListUserDto" resultType="com.elink.esua.epdc.dto.UserDTO">
SELECT
u.id,
u.REAL_NAME,
u.NICKNAME,
u.MOBILE,
u.REGISTER_TIME,
u.CREATED_TIME,
u.UPDATED_TIME,
IDENTITY_NO,
u.ADDRESS,
STATE,
PARTY_FLAG,
RELATION.ALL_DEPT_NAMES,
u.FACE_IMG
FROM
epdc_user u
LEFT JOIN (
SELECT
MAX( CREATED_TIME ) AS CREATED_TIME,
USER_ID
FROM
epdc_user_authenticate_history
WHERE
DEL_FLAG = '0'
AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = u.ID
LEFT JOIN epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
LEFT JOIN (
SELECT MIN( ug.CREATED_TIME ) AS CREATED_TIME,
ug.USER_ID FROM epdc_user_grid_relation ug
WHERE
ug.DEL_FLAG = '0'
GROUP BY USER_ID
) MINRELA ON MINRELA.USER_ID = u.ID
LEFT JOIN epdc_user_grid_relation RELATION ON RELATION.USER_ID = MINRELA.USER_ID AND RELATION.DEL_FLAG = '0' AND MINRELA.CREATED_TIME = RELATION.CREATED_TIME
where u.del_flag = '0'
<if test="startTime != '' and endTime != ''">and DATE_FORMAT(u.CREATED_TIME,'%Y-%m-%d') between #{startTime} and #{endTime}</if>
<if test="realName != '' and realName != null">and u.real_name like '%${realName}%'</if>
<if test="nickname != '' and nickname != null">and u.NICKNAME like '%${nickname}%'</if>
<if test="mobile != '' and mobile != null">and u.mobile like '%${mobile}%'</if>
<if test="identityNo != '' and identityNo != null">and u.identity_no like '%${identityNo}%'</if>
AND IFNULL(u.dept_id,RELATION.GRID_ID) IN
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
<if test="streetId != '' and streetId != null">
AND (find_in_set(#{streetId},IFNULL(u.PARENT_DEPT_IDS,RELATION.PARENT_DEPT_IDS))
OR find_in_set(#{streetId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
<if test="communityId != '' and communityId != null">
AND (find_in_set(#{communityId},IFNULL(u.PARENT_DEPT_IDS,RELATION.PARENT_DEPT_IDS))
OR find_in_set(#{communityId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
<if test="gridId != '' and gridId != null">
and (IFNULL(u.dept_id,RELATION.GRID_ID) = #{gridId}
OR find_in_set(#{gridId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
and HISTORY.AUTHENTICATED_TYPE='0' and HISTORY.AUTHENTICATED_FLAG = '0'
GROUP BY u.ID
ORDER BY u.register_time desc
</select>
<select id="selectListOfWaitPartyUserDto" resultType="com.elink.esua.epdc.dto.UserDTO">
<!--SELECT
u.id,
u.REAL_NAME,
u.NICKNAME,
u.MOBILE,
u.REGISTER_TIME,
u.CREATED_TIME,
u.UPDATED_TIME,
u.IDENTITY_NO,
u.ADDRESS,
u.STATE,
u.PARTY_FLAG,
u.ALL_DEPT_NAMES
FROM
epdc_user u
where
u.del_flag = '0'
and u.IDENTITY_NO is not null
and u.state = '1'
<![CDATA[ AND u.IDENTITY_NO != '' ]]>
<if test="startTime != '' and endTime != ''">and u.CREATED_TIME between #{startTime} and #{endTime}</if>
<if test="realName != '' and realName != null">and u.real_name like '%${realName}%'</if>
<if test="mobile != '' and mobile != null">and u.mobile like '%${mobile}%'</if>
<if test="streetId != '' and streetId != null">
AND (find_in_set(#{streetId},u.PARENT_DEPT_IDS)
OR find_in_set(#{streetId},u.ALL_DEPT_IDS))
</if>
<if test="communityId != '' and communityId != null">
AND (find_in_set(#{communityId},u.PARENT_DEPT_IDS)
OR find_in_set(#{communityId},u.ALL_DEPT_IDS))
</if>
<if test="gridId != '' and gridId != null">
and find_in_set(#{gridId},u.ALL_DEPT_IDS)
</if>
ORDER BY
u.register_time desc-->
SELECT
u.id,
u.REAL_NAME,
u.NICKNAME,
u.MOBILE,
u.REGISTER_TIME,
u.CREATED_TIME,
u.UPDATED_TIME,
IDENTITY_NO,
u.ADDRESS,
STATE,
PARTY_FLAG,
RELATION.ALL_DEPT_NAMES,
u.FACE_IMG
FROM
epdc_user u
LEFT JOIN (
SELECT
MAX( CREATED_TIME ) AS CREATED_TIME,
USER_ID
FROM
epdc_user_authenticate_history
WHERE
DEL_FLAG = '0'
AND AUTHENTICATED_TYPE IN ( '0', '1' )
<if test="endTime != ''">
and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') &lt;= #{endTime}
</if>
GROUP BY USER_ID
) MAXHIS ON MAXHIS.USER_ID = u.ID
LEFT JOIN epdc_user_authenticate_history HISTORY ON HISTORY.USER_ID = MAXHIS.USER_ID AND HISTORY.CREATED_TIME = MAXHIS.CREATED_TIME AND HISTORY.DEL_FLAG = '0'
LEFT JOIN (
SELECT MIN( ug.CREATED_TIME ) AS CREATED_TIME,
ug.USER_ID FROM epdc_user_grid_relation ug
WHERE
ug.DEL_FLAG = '0'
GROUP BY USER_ID
) MINRELA ON MINRELA.USER_ID = u.ID
LEFT JOIN epdc_user_grid_relation RELATION ON RELATION.USER_ID = MINRELA.USER_ID AND RELATION.DEL_FLAG = '0' AND MINRELA.CREATED_TIME = RELATION.CREATED_TIME
where u.del_flag = '0'
<if test="startTime != '' and endTime != ''">and DATE_FORMAT(u.CREATED_TIME,'%Y-%m-%d') between #{startTime} and #{endTime}</if>
<if test="realName != '' and realName != null">and u.real_name like '%${realName}%'</if>
<if test="nickname != '' and nickname != null">and u.NICKNAME like '%${nickname}%'</if>
<if test="mobile != '' and mobile != null">and u.mobile like '%${mobile}%'</if>
<if test="identityNo != '' and identityNo != null">and u.identity_no like '%${identityNo}%'</if>
AND IFNULL(u.dept_id,RELATION.GRID_ID) IN
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
<if test="streetId != '' and streetId != null">
AND (find_in_set(#{streetId},IFNULL(u.PARENT_DEPT_IDS,RELATION.PARENT_DEPT_IDS))
OR find_in_set(#{streetId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
<if test="communityId != '' and communityId != null">
AND (find_in_set(#{communityId},IFNULL(u.PARENT_DEPT_IDS,RELATION.PARENT_DEPT_IDS))
OR find_in_set(#{communityId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
<if test="gridId != '' and gridId != null">
and (IFNULL(u.dept_id,RELATION.GRID_ID) = #{gridId}
OR find_in_set(#{gridId},IFNULL(u.ALL_DEPT_IDS,RELATION.ALL_DEPT_IDS)))
</if>
and HISTORY.AUTHENTICATED_TYPE='1' and HISTORY.AUTHENTICATED_FLAG = '0'
GROUP BY u.ID
ORDER BY u.register_time desc
</select>
</mapper>

Loading…
Cancel
Save