Browse Source

Merge branch 'yantai_zhengwu_master' into dev

master
lichao 3 years ago
parent
commit
5507b18e57
  1. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommunityCountCensusFormDTO.java
  2. 13
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterprisePageFormDTO.java
  3. 11
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityListByAgencyIdResultDTO.java
  4. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  5. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  6. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  7. 57
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  8. 35
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  9. 8
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommunityCountCensusFormDTO.java

@ -25,4 +25,8 @@ public class CommunityCountCensusFormDTO implements Serializable {
private Date timeStart;
private Date timeEnd;
private Integer pageNum;
private Integer pageSize;
}

13
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterprisePageFormDTO.java

@ -10,6 +10,19 @@ import java.io.Serializable;
*/
@Data
public class EnterprisePageFormDTO implements Serializable {
/**
* 组织id或者网格id
* 04.10添加次入参原型地址https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvzaghxlqxhe
*/
private String orgId;
/**
* 组织agency
* 网格grid
* 04.10添加次入参原型地址https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvzaghxlqxhe
*/
private String orgType;
/**
* 场所区域
*/

11
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityListByAgencyIdResultDTO.java

@ -4,6 +4,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @Description:
@ -14,11 +15,19 @@ import java.io.Serializable;
public class CommunityListByAgencyIdResultDTO implements Serializable {
private static final long serialVersionUID = -1677303397440121269L;
private String id;
private String pids;
private String name;
private String streeName;
// private String streeId;
private String districtName;
private String createTime;
// private String districtId;
private Date createTime;
}

17
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -251,6 +251,17 @@ public class CustomerAgencyController {
return new Result<StaffInAgencyListResultDTO>().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId()));
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 工作端-查询当前人员所属组织及所有下级组织到区县级
**/
@PostMapping("staffinAgencyLevelList")
public Result<StaffInAgencyListResultDTO> staffinAgencyLevelList(@LoginUser TokenDto tokenDTO) {
return new Result<StaffInAgencyListResultDTO>().ok(customerAgencyService.staffinAgencyLevelList(tokenDTO.getUserId()));
}
/**
* @Description 对外接口根据customerId返回Element UI中Tree结构的agency列表
* @param map
@ -548,9 +559,9 @@ public class CustomerAgencyController {
* @Author: lichao
* @Date: 2023/4/7 16:49
*/
@GetMapping("getCommunityList")
public Result<List<CommunityListByAgencyIdResultDTO>> getCommunityList(@RequestBody CommunityCountCensusFormDTO dto){
return new Result<List<CommunityListByAgencyIdResultDTO>>().ok(customerAgencyService.getCommunityList(dto));
@PostMapping("getCommunityList")
public Result<PageData<CommunityListByAgencyIdResultDTO>> getCommunityList(@RequestBody CommunityCountCensusFormDTO dto){
return new Result<PageData<CommunityListByAgencyIdResultDTO>>().ok(customerAgencyService.getCommunityList(dto));
}
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -108,6 +108,8 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
**/
List<AgencySubResultDTO> selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids);
List<AgencySubResultDTO> selectSubAgencyLevelList(@Param("subAgencyPids") String subAgencyPids);
/**
* 查询客户根级组织
*
@ -195,6 +197,8 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
**/
AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId);
AgencyResultDTO selectAgencyByLevelStaffId(@Param("staffId") String staffId);
/**
* @param customerId
* @param pid
@ -437,5 +441,7 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
Integer agencyStaffCount(@Param("pids") String pids);
Integer getCommunityCount(@Param("pids")String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd);
List<CommunityListByAgencyIdResultDTO> getCommunityByPidList (@Param("pids")String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd);
}

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -215,6 +215,9 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
**/
StaffInAgencyListResultDTO staffInAgencyList(String staffId);
StaffInAgencyListResultDTO staffinAgencyLevelList(String staffId);
/**
* @Description 运营端-返回element ui - tree 结构agency列表
* @param customerId
@ -386,5 +389,5 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Author: lichao
* @Date: 2023/4/7 16:49
*/
List<CommunityListByAgencyIdResultDTO> getCommunityList(CommunityCountCensusFormDTO dto);
PageData<CommunityListByAgencyIdResultDTO> getCommunityList(CommunityCountCensusFormDTO dto);
}

57
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -45,6 +45,7 @@ import com.epmet.constant.CustomerGridConstant;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.region.LogOperationResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerDepartmentEntity;
@ -58,6 +59,8 @@ import com.epmet.feign.OperCrmFeignClient;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.CustomerAgencyService;
import com.epmet.util.ModuleConstant;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -683,6 +686,17 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return subAgencyList;
}
private List<AgencySubResultDTO> getDepartmentLevelList(String subAgencyPids) {
List<AgencySubResultDTO> subAgencyList = baseDao.selectSubAgencyLevelList(subAgencyPids);
if (subAgencyList.size() > NumConstant.ZERO) {
for (AgencySubResultDTO sub : subAgencyList) {
List<AgencySubResultDTO> subAgency = getDepartmentLevelList(sub.getPids() + ":" + sub.getAgencyId());
sub.setSubAgencyList(subAgency);
}
}
return subAgencyList;
}
/**
* @param staffId
* @return
@ -1054,6 +1068,24 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return resultDTO;
}
@Override
public StaffInAgencyListResultDTO staffinAgencyLevelList(String staffId) {
StaffInAgencyListResultDTO resultDTO = new StaffInAgencyListResultDTO();
//1.查询工作人员所属组织信息
AgencyResultDTO agencyList = baseDao.selectAgencyByStaffId(staffId);
if (null == agencyList) {
logger.error(String.format("查询工作人员所属组织信息失败,staffId->%s", staffId));
throw new RenException(CustomerAgencyConstant.SELECT_STAFF_AGENCY_EXCEPTION);
}
resultDTO.setAgencyList(agencyList);
//2.递归查询所有下级组织信息
List<AgencySubResultDTO> subAgencyList = getDepartmentLevelList(("".equals(agencyList.getPids()) ? "" : agencyList.getPids() + ":") + agencyList.getAgencyId());
resultDTO.setSubAgencyList(subAgencyList);
return resultDTO;
}
/**
* @param customerId
* @return com.epmet.dto.result.AgencyElementTreeResultDTO
@ -1689,20 +1721,41 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
}
@Override
public List<CommunityListByAgencyIdResultDTO> getCommunityList(CommunityCountCensusFormDTO dto) {
public PageData<CommunityListByAgencyIdResultDTO> getCommunityList(CommunityCountCensusFormDTO dto) {
CustomerAgencyEntity customerAgency = baseDao.selectById(dto.getAgencyId());
if (customerAgency!=null){
String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids());
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
List<CommunityListByAgencyIdResultDTO> entityList = baseDao.getCommunityByPidList(pids,dto.getTimeStart(),dto.getTimeEnd());
entityList.forEach(
entity->{
String[] pidArray = entity.getPids().split(":");
LambdaQueryWrapper<CustomerAgencyEntity> queryWrapper = new LambdaQueryWrapper<CustomerAgencyEntity>().in(CustomerAgencyEntity::getId,pidArray);
List<CustomerAgencyEntity> customerAgencyEntities = baseDao.selectList(queryWrapper);
for (CustomerAgencyEntity customerAgencyEntity : customerAgencyEntities) {
if (customerAgencyEntity.getLevel().equals("district")){
entity.setDistrictName(customerAgencyEntity.getOrganizationName());
}
if (customerAgencyEntity.getLevel().equals("street")){
entity.setStreeName(customerAgencyEntity.getOrganizationName());
}
}
}
);
PageInfo<CommunityListByAgencyIdResultDTO> pageInfo = new PageInfo<>(entityList);
return new PageData<>(entityList, pageInfo.getTotal(),dto.getPageSize());
}else {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常");
}
return null;
}
}

35
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -210,6 +210,26 @@
ORDER BY ca.created_time DESC
</select>
<select id="selectSubAgencyLevelList" resultType="com.epmet.dto.result.AgencySubResultDTO">
SELECT
ca.id AS "agencyId",
ca.organization_name AS "agencyName",
ca.pids AS "pids",
ca.level level,
IFNULL(ca.longitude, cc.longitude) longitude,
IFNULL(ca.latitude, cc.latitude) latitude,
(
case when ca.pid is null or ca.pid='0' or ca.pid='' then ca.id
else concat(ca.pids,':',ca.id)
end)as orgIdPath
FROM customer_agency ca
INNER JOIN customer_agency cc ON cc.pid = '0' AND ca.customer_id = cc.customer_id
WHERE ca.del_flag = '0'
AND ca.pids = #{subAgencyPids}
AND (ca.LEVEL = 'city' or ca.LEVEL = 'district')
ORDER BY ca.created_time DESC
</select>
<select id="getCustomerRootAgency" resultType="com.epmet.dto.CustomerAgencyDTO">
SELECT *
FROM customer_agency ca
@ -1198,4 +1218,19 @@
and agency.CREATED_TIME &lt;= #{timeEnd}
</if>
</select>
<select id="getCommunityByPidList" resultType="com.epmet.dto.result.CommunityListByAgencyIdResultDTO">
SELECT
ID,ORGANIZATION_NAME as name,CREATED_TIME as createTime,PIDS as pids
FROM customer_agency
WHERE DEL_FLAG = '0'
AND `LEVEL` = 'community'
AND PIDS LIKE CONCAT(#{agencyId},'%')
<if test="timeStart != null">
and CREATED_TIME &gt;= #{timeStart}
</if>
<if test="timeEnd != null">
and CREATED_TIME &lt;= #{timeEnd}
</if>
</select>
</mapper>

8
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml

@ -66,10 +66,18 @@
LEFT JOIN ic_enterprise_patrol_record r ON ( ie.id = r.ENTERPRISE_ID AND r.DEL_FLAG = '0' )
WHERE
ie.DEL_FLAG = '0'
<if test='"grid" == orgType'>
AND ie.GRID_ID = #{orgId}
</if>
<if test='"agency" == orgType'>
AND (ie.AGENCY_ID = #{orgId} or ie.AGENCY_PIDS like concat('%',#{orgId},'%'))
</if>
<if test='null==orgType or "" == orgType'>
AND (
ie.AGENCY_ID = #{staffAgencyId}
OR ie.AGENCY_PIDS LIKE concat( '%', #{staffAgencyId}, '%' )
)
</if>
<if test='null != gridId and "" != gridId'>
AND ie.GRID_ID = #{gridId}
</if>

Loading…
Cancel
Save