|
|
@ -21,14 +21,17 @@ import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.utils.DeptEntityUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.OrganizationTypeConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.constant.SysSmsTemplateConstant; |
|
|
|
import com.elink.esua.epdc.dto.CompleteDeptDTO; |
|
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
|
import com.elink.esua.epdc.dto.UserDTO; |
|
|
|
import com.elink.esua.epdc.dto.constant.GroupConstant; |
|
|
|
import com.elink.esua.epdc.dto.constant.GroupNoticeConstant; |
|
|
@ -44,6 +47,7 @@ import com.elink.esua.epdc.dto.group.result.*; |
|
|
|
import com.elink.esua.epdc.enums.ItemHandleCategoryEnum; |
|
|
|
import com.elink.esua.epdc.modules.async.IssueOverseeResultsTask; |
|
|
|
import com.elink.esua.epdc.modules.async.NewsTask; |
|
|
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
|
|
|
import com.elink.esua.epdc.modules.feign.EventFeignClient; |
|
|
|
import com.elink.esua.epdc.modules.feign.UserFeignClient; |
|
|
|
import com.elink.esua.epdc.modules.group.dao.GroupDao; |
|
|
@ -80,6 +84,9 @@ public class GroupServiceImpl extends BaseServiceImpl<GroupDao, GroupEntity> imp |
|
|
|
@Autowired |
|
|
|
private NewsTask newsTask; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AdminFeignClient adminFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GroupTopicUserReadService groupTopicUserReadService; |
|
|
|
|
|
|
@ -145,6 +152,30 @@ public class GroupServiceImpl extends BaseServiceImpl<GroupDao, GroupEntity> imp |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void saveInterest(GroupDTO dto) { |
|
|
|
GroupEntity entity = ConvertUtils.sourceToTarget(dto, GroupEntity.class); |
|
|
|
|
|
|
|
// 查询重复
|
|
|
|
List<GroupManagementDTO> dtos = baseDao.selectInterestGroupByDept(dto.getDeptId(), dto.getCategoryCode()); |
|
|
|
if (dtos.size() > 0) { |
|
|
|
throw new RenException("该机构已经存在兴趣群"); |
|
|
|
} |
|
|
|
|
|
|
|
ParentAndAllDeptDTO parentAndAllDeptDTO = getParentAndAllDeptDTO(dto.getDeptId() + ""); |
|
|
|
// 保存机构,及其他冗余字段。
|
|
|
|
DeptEntityUtils.loadDeptInfo( |
|
|
|
ConvertUtils.sourceToTarget(parentAndAllDeptDTO, DeptEntityUtils.DeptDto.class), |
|
|
|
entity |
|
|
|
); |
|
|
|
entity.setDeptName(parentAndAllDeptDTO.getGrid()); |
|
|
|
entity.setSectionCode(GroupConstant.INTEREST_GROUP_CATEGORY_CODE); |
|
|
|
entity.setState(GroupStateEnum.GROUP_STATE_EXAMINATION_PASSED.getValue()); |
|
|
|
// entity.setTypeKey(parentAndAllDeptDTO);
|
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(GroupDTO dto) { |
|
|
@ -152,6 +183,13 @@ public class GroupServiceImpl extends BaseServiceImpl<GroupDao, GroupEntity> imp |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateInterest(GroupDTO dto) { |
|
|
|
GroupEntity entity = ConvertUtils.sourceToTarget(dto, GroupEntity.class); |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
@ -621,4 +659,23 @@ public class GroupServiceImpl extends BaseServiceImpl<GroupDao, GroupEntity> imp |
|
|
|
|
|
|
|
return groupEntities; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据网格ID获取冗余的组织机构信息 |
|
|
|
* |
|
|
|
* @param |
|
|
|
* @return com.elink.esua.epdc.dto.ParentAndAllDeptDTO |
|
|
|
* @author rongchao |
|
|
|
* @since 2019-12-19 |
|
|
|
*/ |
|
|
|
private ParentAndAllDeptDTO getParentAndAllDeptDTO(String gridId) { |
|
|
|
// 获取组织结构冗余信息
|
|
|
|
Result<ParentAndAllDeptDTO> parentAndAllDeptDTOResult = adminFeignClient.getParentAndAllDept(gridId); |
|
|
|
ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDeptDTOResult.getData(); |
|
|
|
|
|
|
|
if (!parentAndAllDeptDTOResult.success()) { |
|
|
|
throw new RenException(parentAndAllDeptDTOResult.getMsg()); |
|
|
|
} |
|
|
|
return parentAndAllDeptDTO; |
|
|
|
} |
|
|
|
} |
|
|
|