大数据页面新增接口。

This commit is contained in:
Renpc-kilig 2020-12-14 21:08:01 +08:00
parent 6d8499cd3c
commit 3b4a560d7c
8 changed files with 308 additions and 10 deletions

View File

@ -108,6 +108,15 @@ public class PartyOrganizeAppController extends AbstractController {
return partyOrganizeService.listPagePartyOrganize(page);
}
@ApiOperation(value = "党组织分页列表", notes = "党组织分页列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagepartyorganize" + ISystemConstant.APP_RELEASE_SUFFIX)
public SuccessResultList<List<PartyOrganizeDTO>> listPagePartyOrganizeNoToken(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return partyOrganizeService.listPagePartyOrganize(page);
}
@ApiOperation(value = "党组织统计", notes = "党组织统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countpartyorganize")
@ -124,4 +133,24 @@ public class PartyOrganizeAppController extends AbstractController {
return partyOrganizeService.countPartyMember(params);
}
@ApiOperation(value = "该党组织中党员人数统计", notes = "该党组织中党员人数统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countpartymember" + ISystemConstant.APP_RELEASE_SUFFIX)
SuccessResultData<Integer> countPartyMemberNoToken() throws SearchException {
Map<String, Object> params = requestParams();
return partyOrganizeService.countPartyMember(params);
}
@ApiOperation(value = "大数据页面统计用(支部数,党员数,男女比例)", notes = "大数据页面统计用(支部数,党员数,男女比例)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "belongLevel", value = "所属级别", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("bigdata" + ISystemConstant.APP_RELEASE_SUFFIX)
SuccessResultData<Map<String, Object>> bigData(@RequestParam("belongLevel") String belongLevel) throws SearchException {
Map<String, Object> params = requestParams();
params.put("belongLevel", belongLevel);
return partyOrganizeService.bigData(params);
}
}

View File

@ -125,4 +125,41 @@ public class PartyOrganizeResourceController extends AbstractController {
return partyOrganizeService.countPartyMember(params);
}
@ApiOperation(value = "党组织分页列表", notes = "党组织分页列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagepartyorganize" + ISystemConstant.APP_RELEASE_SUFFIX)
public SuccessResultList<List<PartyOrganizeDTO>> listPagePartyOrganizeNoToken(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return partyOrganizeService.listPagePartyOrganize(page);
}
@ApiOperation(value = "该党组织中党员人数统计", notes = "该党组织中党员人数统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countpartymember" + ISystemConstant.APP_RELEASE_SUFFIX)
SuccessResultData<Integer> countPartyMemberNoToken() throws SearchException {
Map<String, Object> params = requestParams();
return partyOrganizeService.countPartyMember(params);
}
@ApiOperation(value = "该党组织中党员人数统计", notes = "该党组织中党员人数统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countpartymembersex" + ISystemConstant.APP_RELEASE_SUFFIX)
SuccessResultData<Map<String, Object>> countPartyMemberSexNoToken() throws SearchException {
Map<String, Object> params = requestParams();
return partyOrganizeService.countPartyMemberSex(params);
}
@ApiOperation(value = "大数据页面统计用(支部数,党员数,男女比例)", notes = "大数据页面统计用(支部数,党员数,男女比例)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "belongLevel", value = "所属级别", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("bigdata" + ISystemConstant.APP_RELEASE_SUFFIX)
SuccessResultData<Map<String, Object>> bigData(@RequestParam("belongLevel") String belongLevel) throws SearchException {
Map<String, Object> params = requestParams();
params.put("belongLevel", belongLevel);
return partyOrganizeService.bigData(params);
}
}

View File

@ -80,4 +80,10 @@ public interface IPartyMemberOrganizeDao {
*/
Integer countPartyMemberOrganize(Map<String, Object> params) throws SearchException;
/**
* 党员数大数据页面用
* @param params
* @return
*/
List<PartyMemberOrganizeDTO> listPartyMemberOrganizeForBigData(Map<String, Object> params);
}

View File

@ -87,4 +87,18 @@ public interface IPartyOrganizeDao {
* @throws SearchException
*/
Integer countPartyMemberOfPartyOrganize(Map<String, Object> params) throws SearchException;
/**
* 党组织列表大数据页面用
* @param params
* @return
*/
List<PartyOrganizeDTO> listPartyOrganizeForBigData(Map<String, Object> params);
/**
* 某支部下党员男女比
* @param params
* @return
*/
List<String> countPartyMemberOfSex(Map<String, Object> params);
}

View File

@ -160,4 +160,18 @@ public interface IPartyOrganizeService {
* @throws SearchException
*/
SuccessResultData<Integer> countPartyMember(Map<String, Object> params) throws SearchException;
/**
* 大数据页面统计用(支部数党员数男女比例)
* @param params
* @return
*/
SuccessResultData<Map<String, Object>> bigData(Map<String, Object> params);
/**
* 某支部下党员男女比
* @param params
* @return
*/
SuccessResultData<Map<String, Object>> countPartyMemberSex(Map<String, Object> params);
}

View File

@ -10,12 +10,16 @@ import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.partybuilding.dao.partymemberorganize.IPartyMemberOrganizeDao;
import com.cm.partybuilding.dao.partyorganize.IPartyOrganizeDao;
import com.cm.partybuilding.pojo.dtos.partymemberorganize.PartyMemberOrganizeDTO;
import com.cm.partybuilding.pojo.dtos.partyorganize.PartyOrganizeDTO;
import com.cm.partybuilding.pojo.vos.partyorganize.PartyOrganizeVO;
import com.cm.partybuilding.service.partymemberorganize.IPartyMemberOrganizeService;
import com.cm.partybuilding.service.partyorganize.IPartyOrganizeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -35,6 +39,8 @@ public class PartyOrganizeServiceImpl extends AbstractService implements IPartyO
private IPartyOrganizeDao partyOrganizeDao;
@Autowired
private SecurityComponent securityComponent;
@Autowired
private IPartyMemberOrganizeDao partyMemberOrganizeDao;
@Override
public SuccessResult savePartyOrganize(PartyOrganizeVO partyOrganizeVO) throws Exception {
@ -171,8 +177,10 @@ public class PartyOrganizeServiceImpl extends AbstractService implements IPartyO
@Override
public SuccessResultList<List<PartyOrganizeDTO>> listPagePartyOrganize(ListPage page) throws SearchException {
PageHelper.startPage(page.getPage(), page.getRows());
setDataAuthorityInfo(page.getParams());
page.getParams().put("creator", securityComponent.getCurrentUser().getUserId());
if(page.getParams().get("bigData") == null) {
setDataAuthorityInfo(page.getParams());
page.getParams().put("creator", securityComponent.getCurrentUser().getUserId());
}
List<PartyOrganizeDTO> partyOrganizeDTOs = partyOrganizeDao.listPartyOrganize(page.getParams());
PageInfo<PartyOrganizeDTO> pageInfo = new PageInfo<>(partyOrganizeDTOs);
return new SuccessResultList<>(partyOrganizeDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
@ -194,6 +202,66 @@ public class PartyOrganizeServiceImpl extends AbstractService implements IPartyO
return new SuccessResultData<>(countPartyMemberOfPartyOrganize(params));
}
@Override
public SuccessResultData<Map<String, Object>> bigData(Map<String, Object> params) {
getPartyOrganizeCount(params);
getPartyOrganizeMemberCount(params);
getPartyOrganizeMemberSexCount(params);
return new SuccessResultData<>(params);
}
/**
* 获取支部数
* @param params
*/
private void getPartyOrganizeCount(Map<String, Object> params) {
List<PartyOrganizeDTO> partyOrganizeDTO = partyOrganizeDao.listPartyOrganizeForBigData(params);
partyOrganizeDTO = partyOrganizeDTO == null ? new ArrayList<>() : partyOrganizeDTO;
int count = partyOrganizeDTO == null ? 0 : partyOrganizeDTO.size();
params.put("partyOrganizeCount", count);
params.put("partyOrganizeDTOList", partyOrganizeDTO);
}
/**
* 获取支部党员数
* @param params
*/
private void getPartyOrganizeMemberCount(Map<String, Object> params) {
List<String> partyOrganizeIds = new ArrayList<>();
for(PartyOrganizeDTO partyMemberOrganizeDTO : (List<PartyOrganizeDTO>) params.get("partyOrganizeDTOList")) {
partyOrganizeIds.add(partyMemberOrganizeDTO.getPartyOrganizeId());
}
List<PartyMemberOrganizeDTO> partyMemberOrganizeDTO = null;
if(partyOrganizeIds.size() > 0) {
params.put("partyOrganizeIds", partyOrganizeIds);
partyMemberOrganizeDTO = partyMemberOrganizeDao.listPartyMemberOrganizeForBigData(params);
}
partyMemberOrganizeDTO = partyMemberOrganizeDTO == null ? new ArrayList<>() : partyMemberOrganizeDTO;
int count = partyMemberOrganizeDTO == null ? 0 : partyMemberOrganizeDTO.size();
params.put("partyMemberCount", count);
params.put("partyMemberList", partyMemberOrganizeDTO);
params.remove("partyOrganizeIds");
}
/**
* 获取支部党员男女比例
* @param params
*/
private void getPartyOrganizeMemberSexCount(Map<String, Object> params) {
int girl = 0;
int boy = 0;
for(PartyMemberOrganizeDTO partyMemberOrganizeDTO : (List<PartyMemberOrganizeDTO>) params.get("partyMemberList")) {
if(partyMemberOrganizeDTO.getSexName().equals("")) {
boy++;
}else {
girl++;
}
}
params.put("boy", boy);
params.put("girl", girl);
params.remove("partyMemberList");
}
/**
* 计算党组织中的党员数量私有方法
* @param params
@ -205,4 +273,21 @@ public class PartyOrganizeServiceImpl extends AbstractService implements IPartyO
return count == null ? 0 : count;
}
@Override
public SuccessResultData<Map<String, Object>> countPartyMemberSex(Map<String, Object> params) {
List<String> sexList = partyOrganizeDao.countPartyMemberOfSex(params);
int boy = 0;
int girl = 0;
for(String s: sexList) {
if(s.equals("")) {
boy++;
}else if(s.equals("")) {
girl++;
}
}
params.put("boy", boy);
params.put("girl", girl);
return new SuccessResultData<>(params);
}
}

View File

@ -321,8 +321,8 @@
</if>
</select>
<!-- 党员管理列表 -->
<select id="listPartyMemberOrganize" parameterType="map" resultMap="partyMemberOrganizeDTO">
<!-- 党员管理列表(大数据页面用) -->
<select id="listPartyMemberOrganizeForBigData" parameterType="map" resultMap="partyMemberOrganizeDTO">
SELECT
t1.landline,
t1.education,
@ -364,11 +364,63 @@
gen_party_member_organize t1
WHERE
t1.is_delete = 0
<if test="partyOrganizeIds != null and partyOrganizeIds.size > 0">
AND
t1.belong_party_organize IN
<foreach collection="partyOrganizeIds" index="index" open="(" separator="," close=")">
#{partyOrganizeIds[${index}]}
</foreach>
</if>
</select>
<!-- 党员管理列表 -->
<select id="listPartyMemberOrganize" parameterType="map" resultMap="partyMemberOrganizeDTO">
SELECT
t1.landline,
t1.education,
t1.education_name,
t1.id_card,
t1.registered_residence,
t1.current_address,
t1.phone,
t1.belong_party_organize,
t1.belong_party_organize_name,
t1.healthy_status,
t1.healthy_status_name,
t1.birthday,
t1.sex,
t1.sex_name,
t1.nation,
t1.nation_name,
t1.name,
t1.photo,
t1.party_member_type,
t1.party_member_type_name,
t1.monthly_salary,
t1.regular_time,
t1.join_time,
t1.email,
t1.is_flow,
t1.occupation,
t1.occupation_name,
t1.remake,
t1.user_name,
t1.user_id,
t1.marital_status,
t1.marital_status_name,
t1.is_outofcontact,
t1.party_membership_status,
t1.party_membership_status_name,
t1.party_member_organize_id
FROM
gen_party_member_organize t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
AND (
t1.name LIKE CONCAT('%', #{keywords}, '%')
<!-- 这里添加其他条件 -->
)
)
</if>
<if test="(birthday != null and birthday != '') and toNow == 'yes'">
AND t1.birthday <![CDATA[ >= ]]> #{birthday}
@ -383,11 +435,11 @@
AND t1.regular_time = #{regularTime}
</if>
<if test="startTime != null and startTime != ''">
AND
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="partyOrganizeId != null and partyOrganizeId != ''">
@ -395,10 +447,10 @@
t1.belong_party_organize = #{partyOrganizeId}
</if>
<if test="partyMemberOrganizeIds != null and partyMemberOrganizeIds.size > 0">
AND
AND
t1.party_member_organize_id IN
<foreach collection="partyMemberOrganizeIds" index="index" open="(" separator="," close=")">
#{partyMemberOrganizeIds[${index}]}
#{partyMemberOrganizeIds[${index}]}
</foreach>
</if>
<if test="data_authority != null and data_authority != ''">

View File

@ -372,6 +372,9 @@
AND
t1.party_organize_id = #{partyOrganizeId}
</if>
<if test="belongLevel != null and belongLevel != ''">
AND t1.belong_level = #{belongLevel}
</if>
<if test="partyOrganizeIds != null and partyOrganizeIds.size > 0">
AND
t1.party_organize_id IN
@ -392,6 +395,49 @@
</if>
</select>
<!-- 党组织列表(大数据页面用) -->
<select id="listPartyOrganizeForBigData" parameterType="map" resultMap="partyOrganizeDTO">
SELECT
t1.introduction,
t1.belong_company,
t1.area_measure,
t1.longitude,
t1.location,
t1.subjection_type,
t1.belong_level,
t1.latitude,
t1.link_man,
t1.type,
t1.belong_type,
t1.name,
t1.logo,
t1.area,
t1.area_name,
t1.area_city,
t1.area_city_name,
t1.area_county,
t1.area_county_name,
t1.area_rural,
t1.area_rural_name,
t1.area_street,
t1.area_street_name,
t1.phone,
t1.company_type,
t1.company_type_name,
t1.position,
t1.creat_time,
t1.remake,
t1.party_organize_id
FROM
gen_party_organize t1
WHERE
t1.is_delete = 0
<if test="belongLevel != null and belongLevel != ''">
AND t1.belong_level = #{belongLevel}
</if>
</select>
<!-- 党组织统计 -->
<select id="countPartyOrganize" parameterType="map" resultType="Integer">
SELECT
@ -400,6 +446,9 @@
gen_party_organize t1
WHERE
t1.is_delete = 0
<if test="belongLevel != null and belongLevel != ''">
t1.belong_level = #{belongLevel}
</if>
</select>
<select id="countPartyMemberOfPartyOrganize" parameterType="map" resultType="Integer">
@ -414,4 +463,16 @@
AND t1.party_organize_id = #{partyOrganizeId}
</select>
<select id="countPartyMemberOfSex" parameterType="map" resultType="String">
SELECT
t2.sex_name
FROM
gen_party_organize t1
LEFT JOIN gen_party_member_organize t2 ON t1.party_organize_id = t2.belong_party_organize
WHERE
t1.is_delete = 0
AND t2.is_delete = 0
AND t1.party_organize_id = #{partyOrganizeId}
</select>
</mapper>