Browse Source

解决已认证党员速度慢问题以及已认证党员跟数据分析不一致问题

feature/dangjian
曲树通 6 years ago
parent
commit
81fbe32e27
  1. 12
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyMembersController.java
  2. 22
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyMembersDao.java
  3. 9
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/PartyMembersService.java
  4. 15
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyMembersServiceImpl.java
  5. 106
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/PartyMembersDao.xml

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

@ -166,5 +166,17 @@ public class PartyMembersController {
ExcelUtils.exportExcelToTarget(response, "已认证党员", partyMembersService.exportHasMoudle(params), PartyMembersExcel.class);
}
/***
* 已认证党员优化
* @param params
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.PartyMembersDTO>>
* @author qushutong
* @date 2020/3/19 13:34
*/
@GetMapping("optimizeHasAuthenticationPartyPage")
@DataFilter(tableAlias = "eu", prefix = "AND", isPendingCreator = false)
public Result<PageData<PartyMembersDTO>> optimizeHasAuthenticationPartyPage(@RequestParam Map<String, Object> params) {
return partyMembersService.optimizeHasAuthenticationPartyPage(params);
}
}

22
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyMembersDao.java

@ -21,6 +21,8 @@ import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.PartyMembersDTO;
import com.elink.esua.epdc.entity.PartyMembersEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PathVariable;
import java.io.Serializable;
import java.util.List;
@ -62,4 +64,24 @@ public interface PartyMembersDao extends BaseDao<PartyMembersEntity> {
* @since 2020/3/7 1:20
*/
void updateGridByDeptId(String newDeptName, Long deptId);
/***
* 已认证党员查询优化
* @param
* @return java.util.List<java.lang.String>
* @author qushutong
* @date 2020/3/19 13:32
*/
List<String> optimizeHasAuthenticationPartyPage(Map<String, Object> params);
/***
* 已认证党员查询优化
* @param
* @return java.util.List<com.elink.esua.epdc.dto.PartyMembersDTO>
* @author qushutong
* @date 2020/3/19 13:33
*/
List<PartyMembersDTO> optimizeHasAuthenticationPartyPageInfo(@Param("userIdList") List<String> userIdList);
}

9
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/PartyMembersService.java

@ -100,4 +100,13 @@ public interface PartyMembersService extends BaseService<PartyMembersEntity> {
* @since 2020/3/7 1:23
*/
void modifyOrganizationInfo(OrganizationModifyDTO dto);
/***
* 已认证党员优化
* @param params
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.PartyMembersDTO>>
* @author qushutong
* @date 2020/3/19 13:36
*/
Result<PageData<PartyMembersDTO>> optimizeHasAuthenticationPartyPage(Map<String, Object> params);
}

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

@ -445,6 +445,8 @@ public class PartyMembersServiceImpl extends BaseServiceImpl<PartyMembersDao, Pa
baseDao.updateGridByDeptId(dto.getNewDeptName(), dto.getDeptId());
}
/**
*
* 组织机构信息处理
@ -485,4 +487,17 @@ public class PartyMembersServiceImpl extends BaseServiceImpl<PartyMembersDao, Pa
return entities;
}
@Override
public Result<PageData<PartyMembersDTO>> optimizeHasAuthenticationPartyPage(Map<String, Object> params) {
IPage<String> page = getPage(params);
List<String> userIds = baseDao.optimizeHasAuthenticationPartyPage(params);
if(userIds.size()>0){
List<PartyMembersDTO> partyMembersDTOList = baseDao.optimizeHasAuthenticationPartyPageInfo(userIds);
return new Result<PageData<PartyMembersDTO>>().ok(new PageData<>(partyMembersDTOList, page.getTotal()));
}else {
return new Result<PageData<PartyMembersDTO>>().ok(new PageData<>(new ArrayList<>(), NumConstant.ZERO));
}
}
}

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

@ -88,25 +88,25 @@
<select id="hasAuthenticationPartyPage" resultType="com.elink.esua.epdc.dto.PartyMembersDTO">
SELECT
pm.CADRE_FLAG, pm.CREATED_BY,eu.CREATED_TIME, pm.DEPT_ID,
pm.ID,eu.IDENTITY_NO,eu.MOBILE,pm.POST,
pm.POST_VALUE,eu.REAL_NAME,pm.REGIST_FLAG,eu.REGISTER_TIME as registTime,
GROUP_CONCAT( ut.TAG_NAME ) TAG_NAME, eu.ALL_DEPT_NAMES as allDeptNames
pm.CADRE_FLAG, pm.CREATED_BY,eu.CREATED_TIME, pm.DEPT_ID,
pm.ID,eu.IDENTITY_NO,eu.MOBILE,pm.POST,
pm.POST_VALUE,eu.REAL_NAME,pm.REGIST_FLAG,eu.REGISTER_TIME as registTime,
GROUP_CONCAT( ut.TAG_NAME ) TAG_NAME, eu.ALL_DEPT_NAMES as allDeptNames
FROM
epdc_user eu
LEFT JOIN epdc_party_members pm on pm.IDENTITY_NO = eu.IDENTITY_NO and pm.REAL_NAME = eu.REAL_NAME
LEFT JOIN epdc_party_tag_relation pt ON pm.ID = pt.PARTY_ID
LEFT JOIN epdc_user_tag ut ON pt.TAG_ID = ut.ID
epdc_user eu
LEFT JOIN epdc_party_members pm on pm.IDENTITY_NO = eu.IDENTITY_NO and pm.REAL_NAME = eu.REAL_NAME
LEFT JOIN epdc_party_tag_relation pt ON pm.ID = pt.PARTY_ID
LEFT JOIN epdc_user_tag ut ON pt.TAG_ID = ut.ID
AND ut.DEL_FLAG = '0'
WHERE
eu.PARTY_FLAG = '1' and eu.DEL_FLAG = '0' and pm.DEL_FLAG = '0'
<if test="realName != null and realName != '' "> and pm.REAL_NAME = #{realName} </if>
<if test="mobile != null and mobile != '' "> and pm.MOBILE = #{mobile} </if>
<if test="identityNo != null and identityNo != '' "> and pm.IDENTITY_NO = #{identityNo} </if>
<if test="registFlag != null and registFlag != '' "> and pm.REGIST_FLAG = #{registFlag} </if>
<if test="postId != null and postId != '' "> and pm.POST_ID = #{postId} </if>
<if test="startTime != null and startTime != '' "> and pm.REGIST_TIME >= #{startTime} </if>
<if test="endTime != null and endTime != '' "> <![CDATA[ and pm.REGIST_TIME <= ]]> #{endTime} </if>
eu.PARTY_FLAG = '1' and eu.DEL_FLAG = '0'
<if test="realName != null and realName != '' ">and pm.REAL_NAME = #{realName}</if>
<if test="mobile != null and mobile != '' ">and pm.MOBILE = #{mobile}</if>
<if test="identityNo != null and identityNo != '' ">and pm.IDENTITY_NO = #{identityNo}</if>
<if test="registFlag != null and registFlag != '' ">and pm.REGIST_FLAG = #{registFlag}</if>
<if test="postId != null and postId != '' ">and pm.POST_ID = #{postId}</if>
<if test="startTime != null and startTime != '' ">and pm.REGIST_TIME >= #{startTime}</if>
<if test="endTime != null and endTime != '' "> <![CDATA[ and pm.REGIST_TIME <= ]]> #{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>
@ -120,7 +120,7 @@
</select>
<!--管理系统-->
<select id="selectByIdNew" resultType="com.elink.esua.epdc.dto.PartyMembersDTO">
<select id="selectByIdNew" resultType="com.elink.esua.epdc.dto.PartyMembersDTO">
SELECT
pm.*,
pm.ALL_DEPT_IDS as deptStrIds,
@ -154,4 +154,76 @@
UPDATE epdc_party_members SET GRID_NAME = #{newDeptName}, UPDATED_TIME = NOW() WHERE GRID_ID = #{deptId}
</update>
<!--已认证党员分页-->
<select id="optimizeHasAuthenticationPartyPage" resultType="String">
SELECT
eu.ID
FROM
epdc_user eu
WHERE
eu.PARTY_FLAG = '1' and 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.REGISTER_TIME >= #{startTime}</if>
<if test="endTime != null and endTime != '' "> <![CDATA[ and eu.REGISTER_TIME <= ]]> #{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>
<if test="communityId != '' and communityId != null">
AND (find_in_set(#{communityId},eu.PARENT_DEPT_IDS) OR find_in_set(#{communityId},eu.ALL_DEPT_IDS))
</if>
<if test="gridId != '' and gridId != null">
and (eu.dept_id = #{gridId} OR find_in_set(#{gridId},eu.ALL_DEPT_IDS))
</if>
ORDER BY eu.REGISTER_TIME DESC
</select>
<!--已认证党员填充数据-->
<select id="optimizeHasAuthenticationPartyPageInfo" resultType="com.elink.esua.epdc.dto.PartyMembersDTO">
SELECT
pm.CADRE_FLAG,
pm.CREATED_BY,
pm.DEPT_ID,
pm.ID,
pm.POST,
pm.POST_VALUE,
pm.REGIST_FLAG,
GROUP_CONCAT(ut.TAG_NAME) TAG_NAME,
allu.CREATED_TIME,
allu.IDENTITY_NO,
allu.MOBILE,
allu.REAL_NAME,
allu.registTime,
allu.ALL_DEPT_NAMES
FROM
(
SELECT
eu.ID,
eu.CREATED_TIME,
eu.IDENTITY_NO,
eu.MOBILE,
eu.REAL_NAME,
eu.REGISTER_TIME as registTime,
eu.ALL_DEPT_NAMES
FROM
epdc_user eu
WHERE
eu.ID IN
<foreach collection="userIdList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
) allu
LEFT JOIN epdc_party_members pm ON pm.IDENTITY_NO = allu.IDENTITY_NO
AND pm.REAL_NAME = allu.REAL_NAME
LEFT JOIN epdc_party_tag_relation pt ON pm.ID = pt.PARTY_ID
LEFT JOIN epdc_user_tag ut ON pt.TAG_ID = ut.ID
AND ut.DEL_FLAG = '0'
GROUP BY
allu.ID
ORDER BY
allu.registTime DESC
</select>
</mapper>

Loading…
Cancel
Save