|
|
@ -24,6 +24,8 @@ import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
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.security.user.SecurityUser; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
@ -110,6 +112,9 @@ public class ActivityPartyServiceImpl extends BaseServiceImpl<ActivityPartyDao, |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(ActivityPartyDTO dto) { |
|
|
|
if (dto.getAllDeptIds().length == 0) { |
|
|
|
setDeptId(dto); |
|
|
|
} |
|
|
|
ActivityPartyEntity entity = ConvertUtils.sourceToTarget(dto, ActivityPartyEntity.class); |
|
|
|
if (null != dto.getReportPartyIds()) { |
|
|
|
String[] partyIds = dto.getReportPartyIds(); |
|
|
@ -129,6 +134,8 @@ public class ActivityPartyServiceImpl extends BaseServiceImpl<ActivityPartyDao, |
|
|
|
if (StringUtils.isNotEmpty(String.valueOf(dto.getDeptId()))) { |
|
|
|
entity.setDeptId(String.valueOf(dto.getDeptId())); |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(dto.getDeptId())); |
|
|
|
} else { |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(dto.getDeptId())); |
|
|
|
} |
|
|
|
if (!parentResult.success() || parentResult.getData() == null) { |
|
|
|
throw new RenException("获取部门信息失败"); |
|
|
@ -145,6 +152,9 @@ public class ActivityPartyServiceImpl extends BaseServiceImpl<ActivityPartyDao, |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(ActivityPartyDTO dto) { |
|
|
|
if (dto.getAllDeptIds().length == 0) { |
|
|
|
setDeptId(dto); |
|
|
|
} |
|
|
|
ActivityPartyEntity entity = ConvertUtils.sourceToTarget(dto, ActivityPartyEntity.class); |
|
|
|
if (null != dto.getReportPartyIds()) { |
|
|
|
String[] partyIds = dto.getReportPartyIds(); |
|
|
@ -164,6 +174,8 @@ public class ActivityPartyServiceImpl extends BaseServiceImpl<ActivityPartyDao, |
|
|
|
if (StringUtils.isNotEmpty(String.valueOf(dto.getDeptId()))) { |
|
|
|
entity.setDeptId(String.valueOf(dto.getDeptId())); |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(dto.getDeptId())); |
|
|
|
} else { |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(dto.getDeptId())); |
|
|
|
} |
|
|
|
if (!parentResult.success() || parentResult.getData() == null) { |
|
|
|
throw new RenException("获取部门信息失败"); |
|
|
@ -184,4 +196,11 @@ public class ActivityPartyServiceImpl extends BaseServiceImpl<ActivityPartyDao, |
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
private void setDeptId(ActivityPartyDTO dto) { |
|
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
|
String deptId = String.valueOf(user.getDeptId()); |
|
|
|
dto.setDeptId(user.getDeptId()); |
|
|
|
dto.setAllDeptIds(new String[]{deptId}); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|