Browse Source

内测 获取所有下级AgencyId

master
zxc 5 years ago
parent
commit
4f8b998771
  1. 17
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java
  2. 33
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/TreeResultDTO.java
  3. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  4. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  5. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PartyBaseInfoService.java
  6. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java
  7. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java
  8. 60
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java
  9. 29
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  10. 12
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml

17
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java

@ -0,0 +1,17 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2020/9/22 2:19 下午
*/
public interface ScreenConstant {
String COMMUNITY = "community";
String LEVEL = "level";
String STR_NULL = "";
String ENGLISH_COMMA = ",";
}

33
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/TreeResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.screen.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/9/22 2:00 下午
*/
@Data
public class TreeResultDTO implements Serializable {
private static final long serialVersionUID = 3860368744336541373L;
/**
* 显示名称
*/
private String agencyId;
/**
* agencyId下拉框value
*/
private String pid;
private String pids;
private String level;
}

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -18,6 +18,7 @@
package com.epmet.dao.evaluationindex.screen; package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.result.TreeResultDTO;
import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO; import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -102,4 +103,20 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @return * @return
*/ */
int selectCountByCustomerId(@Param("customerId") String customerId); int selectCountByCustomerId(@Param("customerId") String customerId);
/**
* @Description 查询客户根组织ID
* @param customerId
* @author zxc
* @date 2020/9/22 2:44 下午
*/
TreeResultDTO selectRootAgencyId(@Param("customerId")String customerId,@Param("agencyId") String agencyId);
/**
* @Description 查询下级机关的 id
* @param pids
* @author zxc
* @date 2020/9/22 4:48 下午
*/
List<TreeResultDTO> selectSubAgencyList(@Param("pids") String pids);
} }

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java

@ -114,4 +114,12 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
* @Date 16:57 2020-09-03 * @Date 16:57 2020-09-03
**/ **/
List<ScreenCustomerGridDTO> selectListGridInfo(@Param("customerId")String customerId); List<ScreenCustomerGridDTO> selectListGridInfo(@Param("customerId")String customerId);
/**
* @Description 根据agencyId查询网格ID
* @param agencyId
* @author zxc
* @date 2020/9/22 2:16 下午
*/
List<String> selectGridIdByAgencyId(@Param("agencyId")String agencyId);
} }

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PartyBaseInfoService.java

@ -0,0 +1,19 @@
package com.epmet.service.evaluationindex.extract.toscreen;
/**
* @Desciption 党员基本情况
* @Author zxc
* @DateTime 2020/9/22 11:14 上午
*/
public interface PartyBaseInfoService {
/**
* @Description 统计基层党建-党员基本情况
* @param customerId
* @param dateId
* @author zxc
* @date 2020/9/22 1:22 下午
*/
Boolean statsPartyMemberBaseInfoToScreen(String customerId,String dateId);
}

29
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java

@ -0,0 +1,29 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Desciption 党员基本情况
* @Author zxc
* @DateTime 2020/9/22 11:15 上午
*/
@Service
@Slf4j
public class PartyBaseInfoServiceImpl implements PartyBaseInfoService {
/**
* @Description 统计基层党建-党员基本情况
* @param customerId
* @param dateId
* @author zxc
* @date 2020/9/22 1:22 下午
*/
@Override
public Boolean statsPartyMemberBaseInfoToScreen(String customerId, String dateId) {
return null;
}
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java

@ -17,9 +17,7 @@
package com.epmet.service.evaluationindex.screen; package com.epmet.service.evaluationindex.screen;
import java.util.Map;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
/** /**
* 组织机构信息 * 组织机构信息
@ -27,5 +25,17 @@ import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-22 * @since v1.0.0 2020-09-22
*/ */
public interface ScreenCustomerAgencyService extends BaseService<ScreenCustomerAgencyEntity> { public interface ScreenCustomerAgencyService{
/**
* @Description 根据agencyId查询所有子级agencyId当机关的级别为 community时所有子级为gridId
* @param agencyId
* @param customerId
* map.put('机关的级别(level)','community/street/district/city/province')
* map.put('agencyId','List<String> 所有子级agencyId')
* @author zxc
* @date 2020/9/22 1:39 下午
*/
Map<String,Object> selectAllSubAgencyId(String agencyId, String customerId);
} }

60
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java

@ -17,11 +17,21 @@
package com.epmet.service.evaluationindex.screen.impl; package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.dto.screen.result.TreeResultDTO;
import com.epmet.constant.ScreenConstant;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 组织机构信息 * 组织机构信息
@ -30,6 +40,50 @@ import org.springframework.stereotype.Service;
* @since v1.0.0 2020-09-22 * @since v1.0.0 2020-09-22
*/ */
@Service @Service
public class ScreenCustomerAgencyServiceImpl extends BaseServiceImpl<ScreenCustomerAgencyDao, ScreenCustomerAgencyEntity> implements ScreenCustomerAgencyService { @Slf4j
public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyService {
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@Autowired
private ScreenCustomerGridDao screenCustomerGridDao;
/**
* @Description 根据agencyId查询所有子级agencyId当机关的级别为 community时所有子级为gridId
* @param agencyId
* @param customerId
* map.put('机关的级别(level)','community/street/district/city/province')
* map.put('agencyId','List<String> 所有子级agencyId')
* @author zxc
* @date 2020/9/22 1:39 下午
*/
@Override
public Map<String,Object> selectAllSubAgencyId(String agencyId, String customerId) {
Map<String,Object> resultMap = new HashMap<>(16);
TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId,agencyId);
if (null == rootAgency){
return new HashMap<>(16);
}
if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)){
List<String> gridIdList = screenCustomerGridDao.selectGridIdByAgencyId(agencyId);
resultMap.put(ScreenConstant.LEVEL,ScreenConstant.COMMUNITY);
resultMap.put(agencyId,gridIdList);
}else {
resultMap.put(ScreenConstant.LEVEL,rootAgency.getLevel());
resultMap.put(agencyId,getDepartmentList((ScreenConstant.STR_NULL.equals(rootAgency.getPids())||rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getAgencyId() : rootAgency.getPids().concat(ScreenConstant.ENGLISH_COMMA).concat(rootAgency.getAgencyId())));
}
return resultMap;
}
private List<String> getDepartmentList(String subAgencyPids) {
List<String> result = new ArrayList<>();
List<TreeResultDTO> subAgencyList = screenCustomerAgencyDao.selectSubAgencyList(subAgencyPids);
if (!CollectionUtils.isEmpty(subAgencyList)) {
subAgencyList.forEach(sub -> {
List<String> subAgency = getDepartmentList(sub.getPids() + "," + sub.getAgencyId());
result.addAll(subAgency);
});
}
return result;
}
} }

29
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -133,4 +133,33 @@
select count(*) from screen_customer_agency select count(*) from screen_customer_agency
where DEL_FLAG = '0' and CUSTOMER_ID = #{customerId} where DEL_FLAG = '0' and CUSTOMER_ID = #{customerId}
</select> </select>
<!-- 查询客户根组织ID -->
<select id="selectRootAgencyId" resultType="com.epmet.dto.screen.result.TreeResultDTO">
SELECT
agency_id,
pid,
pids,
level
FROM
screen_customer_agency
WHERE
del_flag = 0
AND agencyId = #{agencyId}
AND customer_id = #{customerId}
</select>
<!-- 查询下级机关的 id -->
<select id="selectSubAgencyList" resultType="com.epmet.dto.screen.result.TreeResultDTO">
SELECT
agency_id,
pids,
level
FROM
screen_customer_agency
WHERE
del_flag = '0'
AND pids = #{pids}
ORDER BY created_time DESC
</select>
</mapper> </mapper>

12
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml

@ -133,4 +133,16 @@
DEL_FLAG = '0' DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId} AND CUSTOMER_ID =#{customerId}
</select> </select>
<!-- 根据agencyId查询网格ID -->
<select id="selectGridIdByAgencyId" resultType="java.lang.String">
SELECT
grid_id
FROM
screen_customer_grid
WHERE
del_flag = '0'
AND parent_agency_id = #{agencyId}
ORDER BY created_time DESC
</select>
</mapper> </mapper>

Loading…
Cancel
Save