|
|
@ -12,15 +12,14 @@ import com.ccsens.carbasics.bean.po.*; |
|
|
|
import com.ccsens.carbasics.bean.vo.AccountVo; |
|
|
|
import com.ccsens.carbasics.bean.vo.ManagementVo; |
|
|
|
import com.ccsens.carbasics.persist.dao.*; |
|
|
|
import com.ccsens.carbasics.persist.mapper.OrganizationLevelMapper; |
|
|
|
import com.ccsens.carbasics.persist.mapper.OrganizationPositionTypeRelationMapper; |
|
|
|
import com.ccsens.carbasics.util.Constant; |
|
|
|
import com.ccsens.carbasics.util.DefaultCodeError; |
|
|
|
import com.ccsens.cloudutil.bean.tall.dto.ProjectDto; |
|
|
|
import com.ccsens.cloudutil.feign.Tall3FeignClient; |
|
|
|
import com.ccsens.common.bean.po.ConstantExample; |
|
|
|
import com.ccsens.common.persist.mapper.ConstantMapper; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Repository; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -52,6 +51,10 @@ public class ManagementService implements IManagementService { |
|
|
|
@Resource |
|
|
|
private OrganizationPositionTypeRelationDao positionTypeRelationDao; |
|
|
|
@Resource |
|
|
|
private OrganizationMemberPositionDao memberPositionDao; |
|
|
|
@Resource |
|
|
|
private Tall3FeignClient tall3FeignClient; |
|
|
|
@Resource |
|
|
|
private Snowflake snowflake; |
|
|
|
|
|
|
|
@Override |
|
|
@ -169,6 +172,11 @@ public class ManagementService implements IManagementService { |
|
|
|
BeanUtil.copyProperties(param,organization); |
|
|
|
organizationDao.updateByPrimaryKeySelective(organization); |
|
|
|
//TODO 同步修改tall项目名称
|
|
|
|
ProjectDto.SaveProjectDto saveProjectDto = new ProjectDto.SaveProjectDto(); |
|
|
|
saveProjectDto.setId(param.getId()); |
|
|
|
saveProjectDto.setName(organization.getName()); |
|
|
|
log.info("调用feign修改项目名称:{}",saveProjectDto); |
|
|
|
tall3FeignClient.saveProjectList(saveProjectDto); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -200,10 +208,29 @@ public class ManagementService implements IManagementService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void delDepartment(ManagementDto.DelDepartment param, Long userId) { |
|
|
|
OrganizationDepartmentParentExample departmentParentExample = new OrganizationDepartmentParentExample(); |
|
|
|
departmentParentExample.createCriteria().andParentIdEqualTo(param.getDid()); |
|
|
|
List<OrganizationDepartmentParent> departmentParentList = departmentParentDao.selectByExample(departmentParentExample); |
|
|
|
if (CollectionUtil.isNotEmpty(departmentParentList)) { |
|
|
|
throw new BaseException(DefaultCodeError.HAVE_SON_NOT_DEL); |
|
|
|
} |
|
|
|
ManagementVo.HospitalData sonDepartmentData = organizationDao.querySonDepartmentData(param.getDid()); |
|
|
|
if (ObjectUtil.isNull(sonDepartmentData)) { |
|
|
|
throw new BaseException(DefaultCodeError.NOT_HAVE_DEPARTMENT); |
|
|
|
} |
|
|
|
if (CollectionUtil.isNotEmpty(sonDepartmentData.getPositionInfoList())) { |
|
|
|
throw new BaseException(DefaultCodeError.DEPARTMENT_HAVE_POSITION); |
|
|
|
} |
|
|
|
OrganizationDepartment department = new OrganizationDepartment(); |
|
|
|
department.setId(param.getDid()); |
|
|
|
department.setRecStatus((byte) 2); |
|
|
|
departmentDao.updateByPrimaryKeySelective(department); |
|
|
|
//删除父子级
|
|
|
|
OrganizationDepartmentParentExample delDepartmentParentExample = new OrganizationDepartmentParentExample(); |
|
|
|
delDepartmentParentExample.createCriteria().andDepartmentIdEqualTo(param.getDid()); |
|
|
|
OrganizationDepartmentParent departmentParent = new OrganizationDepartmentParent(); |
|
|
|
departmentParent.setRecStatus((byte) 2); |
|
|
|
departmentParentDao.updateByExampleSelective(departmentParent,delDepartmentParentExample); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -219,6 +246,13 @@ public class ManagementService implements IManagementService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void delPosition(ManagementDto.DelPosition param, Long userId) { |
|
|
|
OrganizationMemberPositionExample memberPositionExample = new OrganizationMemberPositionExample(); |
|
|
|
memberPositionExample.createCriteria().andPositionIdEqualTo(param.getPositionId()); |
|
|
|
List<OrganizationMemberPosition> memberPositionList = memberPositionDao.selectByExample(memberPositionExample); |
|
|
|
if (CollectionUtil.isNotEmpty(memberPositionList)) { |
|
|
|
throw new BaseException(DefaultCodeError.POSITION_HAVE_MEMBER); |
|
|
|
} |
|
|
|
|
|
|
|
OrganizationPosition position = new OrganizationPosition(); |
|
|
|
position.setId(param.getPositionId()); |
|
|
|
position.setRecStatus((byte) 2); |
|
|
|