|
|
|
@ -31,7 +31,6 @@ import com.elink.esua.epdc.dto.DeptLevelAndLeaderDTO; |
|
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
|
import com.elink.esua.epdc.dto.constant.GroupConstant; |
|
|
|
import com.elink.esua.epdc.dto.enums.GroupStateEnum; |
|
|
|
import com.elink.esua.epdc.dto.group.GroupListDTO; |
|
|
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
|
|
|
import com.elink.esua.epdc.modules.group.dao.GroupDao; |
|
|
|
import com.elink.esua.epdc.modules.group.entity.GroupEntity; |
|
|
|
@ -106,7 +105,11 @@ public class PoliceServiceImpl extends BaseServiceImpl<PoliceDao, PoliceEntity> |
|
|
|
PoliceEntity entity = ConvertUtils.sourceToTarget(dto, PoliceEntity.class); |
|
|
|
// 先查询该社区下有没有网格群,没有就同时创建民警和群,有就表示已经创建过。
|
|
|
|
List<DeptLevelAndLeaderDTO> deptList = adminFeignClient.listChildDeptLevelById(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, entity.getDeptId()).getData(); |
|
|
|
List<GroupListDTO> groupList = groupDao.selectListOfGroupByDeptIds(deptList); |
|
|
|
// 社区下没有网格
|
|
|
|
if (deptList.size() == 0 || dto.getDeptId() == null) { |
|
|
|
return new Result().error("新增失败"); |
|
|
|
} |
|
|
|
List<DeptLevelAndLeaderDTO> groupList = groupDao.selectListOfGroupByDeptId(entity.getDeptId() + ""); |
|
|
|
if (groupList.size() == 0) { |
|
|
|
ParentAndAllDeptDTO parentAndAllDeptDTO = getParentAndAllDeptDTO(dto.getDeptId() + ""); |
|
|
|
|
|
|
|
@ -129,7 +132,7 @@ public class PoliceServiceImpl extends BaseServiceImpl<PoliceDao, PoliceEntity> |
|
|
|
groupEntity.setReferenceBusinessId(entity.getId()); |
|
|
|
groupEntity.setState(GroupStateEnum.GROUP_STATE_EXAMINATION_PASSED.getValue()); |
|
|
|
groupEntity.setGroupAvatar(GroupConstant.PROPERTY_GROUP_AVATAR); |
|
|
|
groupEntity.setGroupName(entity.getDeptName() + "警民群"); |
|
|
|
groupEntity.setGroupName(dept.getDeptName() + "警民群"); |
|
|
|
groupEntity.setGroupCategory(GroupConstant.POLICE_GROUP_CATEGORY); |
|
|
|
groupEntity.setGrid(dept.getDeptName()); |
|
|
|
groupEntity.setGridId(dept.getDeptId()); |
|
|
|
@ -137,7 +140,7 @@ public class PoliceServiceImpl extends BaseServiceImpl<PoliceDao, PoliceEntity> |
|
|
|
}); |
|
|
|
return new Result(); |
|
|
|
} else { |
|
|
|
return new Result().error(); |
|
|
|
return new Result().error("新增失败,社区内已有民警"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|