|
|
@@ -136,10 +136,12 @@ public class ProjectTaskServiceImpl implements ProjectTaskService {
|
|
|
throw new ServiceException("创建年份不能为空");
|
|
|
}
|
|
|
// 验证是否存在这个用户
|
|
|
- ProjectTask projectTask = projectTaskMapper.selectByPrimaryKey(p.getId());
|
|
|
+ ProjectTask projectTask = projectTaskMapper.selectByProjectNumber(p.getProjectNumber(),company);
|
|
|
if (StringUtils.isNull(projectTask)){
|
|
|
BeanValidators.validateWithException(validator, p);
|
|
|
-
|
|
|
+ if (checkProjectNumber(p)){
|
|
|
+ throw new ServiceException(String.format("项目编号[%s]已存在", p.getProjectNumber()));
|
|
|
+ }
|
|
|
if(StringUtils.isNotBlank(p.getAdminName())) {
|
|
|
SysUser sysUser = userMapper.selectByNikeName(p.getAdminName(),company);
|
|
|
if (sysUser == null) {
|
|
|
@@ -234,7 +236,8 @@ public class ProjectTaskServiceImpl implements ProjectTaskService {
|
|
|
|
|
|
@Override
|
|
|
public boolean checkProjectNumber(ProjectTask projectTask) {
|
|
|
- ProjectTask projectTask1 = projectTaskMapper.selectByProjectNumber(projectTask.getProjectNumber());
|
|
|
+ Long companyId = deptService.selectCompanyByDeptId();
|
|
|
+ ProjectTask projectTask1 = projectTaskMapper.selectByProjectNumber(projectTask.getProjectNumber(),companyId);
|
|
|
if (projectTask.getId()==null){
|
|
|
if (projectTask1!=null){
|
|
|
return true;
|