Browse Source

党支部、用户分布

dev_shibei_match
zxc 5 years ago
parent
commit
c900ba7912
  1. 17
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchResultDTO.java
  2. 12
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberDistributionResultDTO.java
  3. 18
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java
  4. 12
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java
  5. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java
  6. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java
  7. 20
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerAgencyDao.java
  8. 27
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java
  9. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/AgencyService.java
  10. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/DistributionService.java
  11. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java
  12. 51
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/DistributionServiceImpl.java
  13. 36
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  14. 49
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml

17
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchResultDTO.java

@ -14,22 +14,17 @@ public class BranchResultDTO implements Serializable {
private static final long serialVersionUID = -8001714892170166320L; private static final long serialVersionUID = -8001714892170166320L;
/** /**
* 名称根据当前所在组织查询出的子级名称 * 网格ID
*/ */
private String name; private String gridId;
/** /**
* 可能是agencyId也可以是gridId 也可以是deptId * 网格名称
*/ */
private String id; private String gridName;
/** /**
* 组织agency 网格grid 部门dept * 党支部(网格)位置
*/ */
private String type; private String partyMark;
/**
* 中心点位
*/
private String centerMark;
} }

12
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberDistributionResultDTO.java

@ -16,31 +16,31 @@ public class ParymemberDistributionResultDTO implements Serializable {
/** /**
* 可能是gridId,可能是agencyId * 可能是gridId,可能是agencyId
*/ */
private String subId; private String subId = "";
/** /**
* 中心点位 * 中心点位
*/ */
private String centerMark; private String centerMark = "";
/** /**
* 党员总人数 * 党员总人数
*/ */
private Integer totalNum; private Integer totalNum = 0;
/** /**
* 坐标区域 * 坐标区域
*/ */
private String areaMarks; private String areaMarks = "";
/** /**
* 可以是网格的名称可以是组织的名称 * 可以是网格的名称可以是组织的名称
*/ */
private String subName; private String subName= "";
/** /**
* 组织agency, 网格 grid * 组织agency, 网格 grid
*/ */
private String type; private String type = "";
} }

18
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.screen.dto.result; package com.epmet.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -17,17 +18,28 @@ public class ParymemberResultDTO implements Serializable {
/** /**
* 当前所选组织 * 当前所选组织
*/ */
private String agencyId; private String agencyId = "";
/** /**
* 当前所选组织名称 * 当前所选组织名称
*/ */
private String name; private String name = "";
/** /**
* 当前所选组织的坐标区域 * 当前所选组织的坐标区域
*/ */
private String areaMarks; private String areaMarks = "";
/**
* 机关级别
* 社区级community
* 街道:street,
* 区县级: district,
* 市级: city
* 省级:province
*/
@JsonIgnore
private String level;
/** /**
* 子级用户分布 * 子级用户分布

12
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.screen.dto.result; package com.epmet.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -29,6 +30,17 @@ public class UserResultDTO implements Serializable {
*/ */
private String areaMarks; private String areaMarks;
/**
* 机关级别
* 社区级community
* 街道:street,
* 区县级: district,
* 市级: city
* 省级:province
*/
@JsonIgnore
private String level;
/** /**
* 子级用户分布 * 子级用户分布
*/ */

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java

@ -1,5 +1,7 @@
package com.epmet.datareport.controller.screen; package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
@ -35,9 +37,10 @@ public class AgencyController {
* @author zxc * @author zxc
* @date 2020/8/18 2:04 下午 * @date 2020/8/18 2:04 下午
*/ */
@ExternalAppRequestAuth
@PostMapping("tree") @PostMapping("tree")
public Result<TreeResultDTO> tree(){ public Result<TreeResultDTO> tree(ExternalAppRequestParam externalAppRequestParam){
return new Result<TreeResultDTO>().ok(agencyService.tree()); return new Result<TreeResultDTO>().ok(agencyService.tree(externalAppRequestParam));
} }
/** /**

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java

@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* 中央区相关各指标查询 * 中央区相关各指标查询
* *
@ -35,9 +37,9 @@ public class DistributionController {
* @date 2020/8/18 10:59 上午 * @date 2020/8/18 10:59 上午
*/ */
@PostMapping("branch") @PostMapping("branch")
public Result<BranchResultDTO> branch(@RequestBody BranchFormDTO formDTO){ public Result<List<BranchResultDTO>> branch(@RequestBody BranchFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, BranchFormDTO.Branch.class); ValidatorUtils.validateEntity(formDTO, BranchFormDTO.Branch.class);
return new Result<BranchResultDTO>().ok(distributionService.branch(formDTO)); return new Result<List<BranchResultDTO>>().ok(distributionService.branch(formDTO));
} }
/** /**

20
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerAgencyDao.java

@ -17,9 +17,7 @@
package com.epmet.datareport.dao.screen; package com.epmet.datareport.dao.screen;
import com.epmet.screen.dto.result.AgencyDistributionResultDTO; import com.epmet.screen.dto.result.*;
import com.epmet.screen.dto.result.CompartmentResultDTO;
import com.epmet.screen.dto.result.TreeResultDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -66,4 +64,20 @@ public interface ScreenCustomerAgencyDao {
*/ */
List<AgencyDistributionResultDTO> selectSubDistribution(@Param("agencyId")String agencyId); List<AgencyDistributionResultDTO> selectSubDistribution(@Param("agencyId")String agencyId);
/**
* @Description 查询子级用户分布机关级别
* @param parentId
* @author zxc
* @date 2020/8/19 9:33 上午
*/
List<UserDistributionResultDTO> selectUserDistributionAgency(@Param("parentId")String parentId);
/**
* @Description 查询子级党员分布机关级别
* @param parentId
* @author zxc
* @date 2020/8/19 10:30 上午
*/
List<ParymemberDistributionResultDTO> selectParymemberDistribution(@Param("parentId")String parentId);
} }

27
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java

@ -18,6 +18,9 @@
package com.epmet.datareport.dao.screen; package com.epmet.datareport.dao.screen;
import com.epmet.screen.dto.result.AgencyDistributionResultDTO; import com.epmet.screen.dto.result.AgencyDistributionResultDTO;
import com.epmet.screen.dto.result.BranchResultDTO;
import com.epmet.screen.dto.result.ParymemberDistributionResultDTO;
import com.epmet.screen.dto.result.UserDistributionResultDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -40,4 +43,28 @@ public interface ScreenCustomerGridDao {
*/ */
List<AgencyDistributionResultDTO> selectSubDistribution(@Param("agencyId")String agencyId); List<AgencyDistributionResultDTO> selectSubDistribution(@Param("agencyId")String agencyId);
/**
* @Description 查询党支部信息
* @param agencyId
* @author zxc
* @date 2020/8/19 9:13 上午
*/
List<BranchResultDTO> selectBranch(@Param("agencyId")String agencyId);
/**
* @Description 查询子级用户分布网格级别
* @param parentId
* @author zxc
* @date 2020/8/19 9:33 上午
*/
List<UserDistributionResultDTO> selectUserDistribution(@Param("parentId")String parentId);
/**
* @Description 查询子级党员分布网格级别
* @param parentId
* @author zxc
* @date 2020/8/19 10:30 上午
*/
List<ParymemberDistributionResultDTO> selectParymemberDistribution(@Param("parentId")String parentId);
} }

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/AgencyService.java

@ -1,5 +1,6 @@
package com.epmet.datareport.service.screen; package com.epmet.datareport.service.screen;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.screen.dto.form.CompartmentFormDTO; import com.epmet.screen.dto.form.CompartmentFormDTO;
import com.epmet.screen.dto.result.CompartmentResultDTO; import com.epmet.screen.dto.result.CompartmentResultDTO;
@ -21,7 +22,7 @@ public interface AgencyService {
* @author zxc * @author zxc
* @date 2020/8/18 2:04 下午 * @date 2020/8/18 2:04 下午
*/ */
TreeResultDTO tree(); TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam);
/** /**
* @Description 2组织区域查询 * @Description 2组织区域查询

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/DistributionService.java

@ -7,6 +7,8 @@ import com.epmet.screen.dto.result.BranchResultDTO;
import com.epmet.screen.dto.result.ParymemberResultDTO; import com.epmet.screen.dto.result.ParymemberResultDTO;
import com.epmet.screen.dto.result.UserResultDTO; import com.epmet.screen.dto.result.UserResultDTO;
import java.util.List;
/** /**
* 中央区相关各指标查询 * 中央区相关各指标查询
* *
@ -21,7 +23,7 @@ public interface DistributionService {
* @author zxc * @author zxc
* @date 2020/8/18 10:59 上午 * @date 2020/8/18 10:59 上午
*/ */
BranchResultDTO branch(BranchFormDTO formDTO); List<BranchResultDTO> branch(BranchFormDTO formDTO);
/** /**
* @Description 2用户分布 * @Description 2用户分布

9
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.datareport.service.screen.impl; package com.epmet.datareport.service.screen.impl;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.datareport.dao.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.dao.screen.ScreenCustomerGridDao; import com.epmet.datareport.dao.screen.ScreenCustomerGridDao;
@ -35,10 +36,9 @@ public class AgencyServiceImpl implements AgencyService {
* @date 2020/8/18 2:04 下午 * @date 2020/8/18 2:04 下午
*/ */
@Override @Override
public TreeResultDTO tree() { public TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam) {
// 1. 查询客户根组织ID // 1. 查询客户根组织ID
// TODO 改成正式注解获取customerId String customerId = externalAppRequestParam.getCustomerId();
String customerId = "zxc";
TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId); TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId);
if (null == rootAgency){ if (null == rootAgency){
return new TreeResultDTO(); return new TreeResultDTO();
@ -74,6 +74,9 @@ public class AgencyServiceImpl implements AgencyService {
@Override @Override
public CompartmentResultDTO compartment(CompartmentFormDTO compartmentFormDTO) { public CompartmentResultDTO compartment(CompartmentFormDTO compartmentFormDTO) {
CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(compartmentFormDTO.getAgencyId()); CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(compartmentFormDTO.getAgencyId());
if (null == agencyAreaInfo){
return agencyAreaInfo;
}
if (agencyAreaInfo.getLevel().equals(ScreenConstant.COMMUNITY)){ if (agencyAreaInfo.getLevel().equals(ScreenConstant.COMMUNITY)){
// 当level为"community"时,查询screen_customer_grid表 // 当level为"community"时,查询screen_customer_grid表
List<AgencyDistributionResultDTO> agencyDistributionResultDTOS = screenCustomerGridDao.selectSubDistribution(compartmentFormDTO.getAgencyId()); List<AgencyDistributionResultDTO> agencyDistributionResultDTOS = screenCustomerGridDao.selectSubDistribution(compartmentFormDTO.getAgencyId());

51
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/DistributionServiceImpl.java

@ -1,14 +1,19 @@
package com.epmet.datareport.service.screen.impl; package com.epmet.datareport.service.screen.impl;
import com.epmet.datareport.dao.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.dao.screen.ScreenCustomerGridDao;
import com.epmet.screen.dto.form.BranchFormDTO; import com.epmet.screen.dto.form.BranchFormDTO;
import com.epmet.screen.dto.form.ParymemberFormDTO; import com.epmet.screen.dto.form.ParymemberFormDTO;
import com.epmet.screen.dto.form.UserFormDTO; import com.epmet.screen.dto.form.UserFormDTO;
import com.epmet.screen.dto.result.BranchResultDTO; import com.epmet.screen.dto.result.*;
import com.epmet.screen.dto.result.ParymemberResultDTO; import com.epmet.screen.constant.*;
import com.epmet.screen.dto.result.UserResultDTO;
import com.epmet.datareport.service.screen.DistributionService; import com.epmet.datareport.service.screen.DistributionService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 中央区相关各指标查询 * 中央区相关各指标查询
* *
@ -18,6 +23,11 @@ import org.springframework.stereotype.Service;
@Service @Service
public class DistributionServiceImpl implements DistributionService { public class DistributionServiceImpl implements DistributionService {
@Autowired
private ScreenCustomerGridDao screenCustomerGridDao;
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
/** /**
* @Description 1党支部 * @Description 1党支部
* @param formDTO * @param formDTO
@ -25,8 +35,9 @@ public class DistributionServiceImpl implements DistributionService {
* @date 2020/8/18 10:59 上午 * @date 2020/8/18 10:59 上午
*/ */
@Override @Override
public BranchResultDTO branch(BranchFormDTO formDTO) { public List<BranchResultDTO> branch(BranchFormDTO formDTO) {
return null; List<BranchResultDTO> branchResultDTOS = screenCustomerGridDao.selectBranch(formDTO.getAgencyId());
return branchResultDTOS;
} }
/** /**
@ -37,7 +48,20 @@ public class DistributionServiceImpl implements DistributionService {
*/ */
@Override @Override
public UserResultDTO user(UserFormDTO userFormDTO) { public UserResultDTO user(UserFormDTO userFormDTO) {
return null; UserResultDTO userResult = new UserResultDTO();
CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(userFormDTO.getAgencyId());
if (null == agencyAreaInfo){
return userResult;
}
BeanUtils.copyProperties(agencyAreaInfo,userResult);
if (userResult.getLevel().equals(ScreenConstant.COMMUNITY)){
List<UserDistributionResultDTO> userDistributionResultDTOS = screenCustomerGridDao.selectUserDistribution(userFormDTO.getAgencyId());
userResult.setUserDistribution(userDistributionResultDTOS);
}else {
List<UserDistributionResultDTO> userDistributionResultDTOS = screenCustomerAgencyDao.selectUserDistributionAgency(userFormDTO.getAgencyId());
userResult.setUserDistribution(userDistributionResultDTOS);
}
return userResult;
} }
/** /**
@ -48,6 +72,19 @@ public class DistributionServiceImpl implements DistributionService {
*/ */
@Override @Override
public ParymemberResultDTO parymember(ParymemberFormDTO parymemberFormDTO) { public ParymemberResultDTO parymember(ParymemberFormDTO parymemberFormDTO) {
return null; ParymemberResultDTO parymemberResult = new ParymemberResultDTO();
CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(parymemberFormDTO.getAgencyId());
if (null == agencyAreaInfo){
return parymemberResult;
}
BeanUtils.copyProperties(agencyAreaInfo,parymemberResult);
if (parymemberResult.getLevel().equals(ScreenConstant.COMMUNITY)){
List<ParymemberDistributionResultDTO> parymemberDistributionResultDTOS = screenCustomerGridDao.selectParymemberDistribution(parymemberFormDTO.getAgencyId());
parymemberResult.setUserDistribution(parymemberDistributionResultDTOS);
}else {
List<ParymemberDistributionResultDTO> parymemberDistributionResultDTOS = screenCustomerAgencyDao.selectParymemberDistribution(parymemberFormDTO.getAgencyId());
parymemberResult.setUserDistribution(parymemberDistributionResultDTOS);
}
return parymemberResult;
} }
} }

36
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -61,4 +61,40 @@
AND pid = #{agencyId} AND pid = #{agencyId}
</select> </select>
<!-- 查询子级用户分布【机关级别】 -->
<select id="selectUserDistributionAgency" resultType="com.epmet.screen.dto.result.UserDistributionResultDTO">
SELECT
sutd.org_id AS subId,
sca.center_mark AS centerMark,
sutd.user_total AS totalNum,
sca.area_marks AS areaMarks,
sca.agency_name AS subName,
sutd.org_type AS type
FROM
screen_user_total_data sutd
LEFT JOIN screen_customer_agency sca ON sca.agency_id = sutd.org_id
WHERE
sutd.del_flag = '0'
AND sca.del_flag = 0
AND sutd.parent_id = #{parentId}
</select>
<!-- 查询子级党员分布【机关级别】 -->
<select id="selectParymemberDistribution" resultType="com.epmet.screen.dto.result.ParymemberDistributionResultDTO">
SELECT
sutd.org_id AS subId,
sca.center_mark AS centerMark,
sutd.party_total AS totalNum,
sca.area_marks AS areaMarks,
sca.agency_name AS subName,
sutd.org_type AS type
FROM
screen_user_total_data sutd
LEFT JOIN screen_customer_agency sca ON sca.agency_id = sutd.org_id
WHERE
sutd.del_flag = '0'
AND sca.del_flag = 0
AND sutd.parent_id = #{parentId}
</select>
</mapper> </mapper>

49
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml

@ -17,4 +17,53 @@
del_flag = 0 del_flag = 0
AND parent_agency_id = #{agencyId} AND parent_agency_id = #{agencyId}
</select> </select>
<!-- 查询党支部信息 -->
<select id="selectBranch" resultType="com.epmet.screen.dto.result.BranchResultDTO">
SELECT
grid_id AS gridId,
grid_name AS gridName,
party_mark AS partyMark
FROM
screen_customer_grid
WHERE
del_flag = 0
AND parent_agency_id = #{agencyId}
</select>
<!-- 查询子级用户分布【网格级别】 -->
<select id="selectUserDistribution" resultType="com.epmet.screen.dto.result.UserDistributionResultDTO">
SELECT
sutd.org_id AS subId,
scg.center_mark AS centerMark,
sutd.user_total AS totalNum,
scg.area_marks AS areaMarks,
scg.grid_name AS subName,
sutd.org_type AS type
FROM
screen_user_total_data sutd
LEFT JOIN screen_customer_grid scg ON scg.grid_id = sutd.org_id
WHERE
sutd.del_flag = '0'
AND scg.del_flag = 0
AND sutd.parent_id = #{parentId}
</select>
<!-- 查询子级党员分布【网格级别】 -->
<select id="selectParymemberDistribution" resultType="com.epmet.screen.dto.result.ParymemberDistributionResultDTO">
SELECT
sutd.org_id AS subId,
scg.center_mark AS centerMark,
sutd.party_total AS totalNum,
scg.area_marks AS areaMarks,
scg.grid_name AS subName,
sutd.org_type AS type
FROM
screen_user_total_data sutd
LEFT JOIN screen_customer_grid scg ON scg.grid_id = sutd.org_id
WHERE
sutd.del_flag = '0'
AND scg.del_flag = 0
AND sutd.parent_id = #{parentId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save