Browse Source

9999999999

zhoulisky 5 months ago
parent
commit
d424b329d9

+ 3 - 3
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/AttendanceServiceImpl.java

@@ -209,7 +209,7 @@ public class AttendanceServiceImpl extends BaseServiceImpl<AttendanceMapper, Att
 		//获取已填报的工时,新的考勤不能小于已填报工时总和
 		//获取已填报的工时,新的考勤不能小于已填报工时总和
 		double workHoursByDay = technicianHoursMapper.sumByUnicodeAndDay(unicode, workDate);
 		double workHoursByDay = technicianHoursMapper.sumByUnicodeAndDay(unicode, workDate);
 		if(workHours<workHoursByDay){
 		if(workHours<workHoursByDay){
-			throw new ServiceException("日期【"+workDate+"】填报的出勤时长不能小于已填报的工时【"+workHoursByDay+"】,请联系管理员");
+			throw new ServiceException("日期【"+workDate+"】填报的出勤时长不能小于已填报的工时【"+workHoursByDay+"】");
 		}
 		}
 	}
 	}
 	@Override
 	@Override
@@ -389,7 +389,7 @@ public class AttendanceServiceImpl extends BaseServiceImpl<AttendanceMapper, Att
 			//获取已填报的工时的不能删除
 			//获取已填报的工时的不能删除
 			double workHoursByMonth = technicianHoursMapper.sumByUnicodeAndMonth(dto.getUnicode(), dto.getYearAndMonth());
 			double workHoursByMonth = technicianHoursMapper.sumByUnicodeAndMonth(dto.getUnicode(), dto.getYearAndMonth());
 			if(workHoursByMonth > 0){
 			if(workHoursByMonth > 0){
-				throw new ServiceException("已填报工时数据,无法清除工时数据,请联系管理员");
+				throw new ServiceException("已填报工时数据,无法清除工时数据");
 			}
 			}
 			affectNum += baseMapper.clearUnicodeAndMonthly(dto.getUnicode(), dto.getYearAndMonth());
 			affectNum += baseMapper.clearUnicodeAndMonthly(dto.getUnicode(), dto.getYearAndMonth());
 		}
 		}
@@ -431,7 +431,7 @@ public class AttendanceServiceImpl extends BaseServiceImpl<AttendanceMapper, Att
 			//获取已填报的工时的不能删除
 			//获取已填报的工时的不能删除
 			double workHoursByMonth = technicianHoursMapper.sumByUnicodeAndMonth(dto.getUnicode(), dto.getYearAndMonth());
 			double workHoursByMonth = technicianHoursMapper.sumByUnicodeAndMonth(dto.getUnicode(), dto.getYearAndMonth());
 			if(workHoursByMonth > 0){
 			if(workHoursByMonth > 0){
-				throw new ServiceException("已填报工时数据,无法删除,请联系管理员");
+				throw new ServiceException("已填报工时数据,无法删除");
 			}
 			}
 			baseMapper.deleteByUnicodeAndMonthly(dto.getUnicode(), dto.getYearAndMonth());
 			baseMapper.deleteByUnicodeAndMonthly(dto.getUnicode(), dto.getYearAndMonth());
 		}
 		}

+ 16 - 8
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/XmServiceImpl.java

@@ -106,14 +106,18 @@ public class XmServiceImpl extends BaseServiceImpl<XmMapper, XmEntity> implement
 
 
 	private void judgeXmmcAndXmbhUnique(XmDTO xm) {
 	private void judgeXmmcAndXmbhUnique(XmDTO xm) {
 		//检查项目名称是否重复(xm);
 		//检查项目名称是否重复(xm);
-		Long xmIdByXmmc = baseMapper.getXmIdByXmmcOrXmbh(null, xm.getXmmc(), null);
-		if (xmIdByXmmc != null && !xmIdByXmmc.equals(xm.getId())) {
-			throw new ServiceException("研发项目名称已存在");
+		if(Func.isNotBlank(xm.getXmmc())){
+			Long xmIdByXmmc = baseMapper.getXmIdByXmmcOrXmbh(null, xm.getXmmc(), null);
+			if (xmIdByXmmc != null && !xmIdByXmmc.equals(xm.getId())) {
+				throw new ServiceException("研发项目名称已存在");
+			}
 		}
 		}
 
 
-		Long xmIdByXmbh = baseMapper.getXmIdByXmmcOrXmbh(null, null, xm.getXmbh());
-		if (xmIdByXmbh != null && !xmIdByXmbh.equals(xm.getId())) {
-			throw new ServiceException("研发项目编号已存在");
+		if(Func.isNotBlank(xm.getXmbh())){
+			Long xmIdByXmbh = baseMapper.getXmIdByXmmcOrXmbh(null, null, xm.getXmbh());
+			if (xmIdByXmbh != null && !xmIdByXmbh.equals(xm.getId())) {
+				throw new ServiceException("研发项目编号已存在");
+			}
 		}
 		}
 	}
 	}
 
 
@@ -123,10 +127,14 @@ public class XmServiceImpl extends BaseServiceImpl<XmMapper, XmEntity> implement
 		this.judgeXmmcAvailable(xm.getXmmc());
 		this.judgeXmmcAvailable(xm.getXmmc());
 		//判断项目名称和编号是否已存在
 		//判断项目名称和编号是否已存在
 		judgeXmmcAndXmbhUnique(xm);
 		judgeXmmcAndXmbhUnique(xm);
-		if (!Func.equals(xm.getStatus(), XmStatusEnum.暂存.getCode())) {
+		if (Func.equals(xm.getStatus(), XmStatusEnum.暂存.getCode())) {
+			if(Func.isBlank(xm.getXmbh())){
+				throw new ServiceException("请填写项目编号");
+			}
+		}else {
 			List<String> validate = ValidationUtils.validate(xm);
 			List<String> validate = ValidationUtils.validate(xm);
 			if (Func.isNotEmpty(validate)) {
 			if (Func.isNotEmpty(validate)) {
-				throw new ServiceException(String.join(",", validate));
+				throw new ServiceException(String.join("\n", validate));
 			}
 			}
 			judgeXmIsOver(xm.getId(), true);
 			judgeXmIsOver(xm.getId(), true);
 			if (xm.getXmyszemx() != null) {
 			if (xm.getXmyszemx() != null) {