|
|
@@ -69,7 +69,7 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
|
|
|
private final XmBgrzMapper xmBgrzMapper;
|
|
|
|
|
|
@Override
|
|
|
- public boolean saveOrUpdateTechnician(TechnicianEntity technician) {
|
|
|
+ public boolean insertTechnician(TechnicianEntity technician) {
|
|
|
if (StringUtil.isBlank(technician.getYearAndMonth())) {
|
|
|
throw new ServiceException("参数yearAndMonth不能为空");
|
|
|
}
|
|
|
@@ -78,17 +78,66 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
|
|
|
}
|
|
|
|
|
|
String unicode = baseMapper.getUnicodeByNumberAndIdentityCard(technician.getNumber(), technician.getIdCard());
|
|
|
- if (unicode == null) {
|
|
|
- unicode = generateUnicode();
|
|
|
+ if (Func.notNull(unicode)) {
|
|
|
+ throw new ServiceException("工号或身份证已存在");
|
|
|
+ }
|
|
|
+// if (unicode == null) {
|
|
|
+// unicode = generateUnicode();
|
|
|
+// }
|
|
|
+ technician.setUnicode(generateUnicode());
|
|
|
+
|
|
|
+// if (Func.isNull(technician.getId())) {
|
|
|
+ //新增
|
|
|
+ return this.save(technician);
|
|
|
+// } else {
|
|
|
+// //修改technician.getYearAndMonth()及之后月份的数据
|
|
|
+// LambdaQueryWrapper<TechnicianEntity> updateWrapper = Wrappers.<TechnicianEntity>lambdaQuery().eq(TechnicianEntity::getUnicode, technician.getUnicode()).ge(TechnicianEntity::getYearAndMonth, technician.getYearAndMonth());
|
|
|
+// technician.setId(null);
|
|
|
+// technician.setTenantId(null);
|
|
|
+// technician.setUnicode(null);
|
|
|
+// technician.setYearAndMonth(null);
|
|
|
+// technician.setCreateTime(null);
|
|
|
+// technician.setCreateUser(null);
|
|
|
+// technician.setCreateDept(null);
|
|
|
+// return this.update(technician, updateWrapper);
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean updateTechnician(TechnicianEntity technician) {
|
|
|
+ if (StringUtil.isBlank(technician.getYearAndMonth())) {
|
|
|
+ throw new ServiceException("参数yearAndMonth不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(technician.getNumber()) && StringUtil.isBlank(technician.getIdCard())) {
|
|
|
+ throw new ServiceException("工号和身份证号码不能同时为空");
|
|
|
}
|
|
|
- technician.setUnicode(unicode);
|
|
|
|
|
|
- if (Func.isNull(technician.getId())) {
|
|
|
- //新增
|
|
|
- return this.save(technician);
|
|
|
- } else {
|
|
|
- return this.updateById(technician);
|
|
|
+ if(Func.isBlank(technician.getUnicode())){
|
|
|
+ throw new ServiceException("参数unicode不能为空");
|
|
|
}
|
|
|
+
|
|
|
+// String unicode = baseMapper.getUnicodeByNumberAndIdentityCard(technician.getNumber(), technician.getIdCard());
|
|
|
+//
|
|
|
+// if (unicode == null) {
|
|
|
+// unicode = generateUnicode();
|
|
|
+// }
|
|
|
+// technician.setUnicode(unicode);
|
|
|
+
|
|
|
+// if (Func.isNull(technician.getId())) {
|
|
|
+// //新增
|
|
|
+// return this.save(technician);
|
|
|
+// } else {
|
|
|
+ //修改technician.getYearAndMonth()及之后月份的数据
|
|
|
+ LambdaQueryWrapper<TechnicianEntity> updateWrapper = Wrappers.<TechnicianEntity>lambdaQuery().eq(TechnicianEntity::getUnicode, technician.getUnicode()).ge(TechnicianEntity::getYearAndMonth, technician.getYearAndMonth());
|
|
|
+ technician.setId(null);
|
|
|
+ technician.setTenantId(null);
|
|
|
+ technician.setUnicode(null);
|
|
|
+ technician.setYearAndMonth(null);
|
|
|
+ technician.setCreateTime(null);
|
|
|
+ technician.setCreateUser(null);
|
|
|
+ technician.setCreateDept(null);
|
|
|
+ return this.update(technician, updateWrapper);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -261,7 +310,7 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
|
|
|
//删除人员花名册时需判断数据是否被引入
|
|
|
//项目负责人
|
|
|
Long xmBgCount = xmBgrzMapper.selectCount(Wrappers.<XmBgrzEntity>lambdaQuery().eq(XmBgrzEntity::getZdmc, "XMFZR").eq(XmBgrzEntity::getBgqdz, dbTechnician.getId()).or().eq(XmBgrzEntity::getBghdz, dbTechnician.getId()));
|
|
|
- if(xmMapper.selectCount(Wrappers.<XmEntity>lambdaQuery().eq(XmEntity::getXmfzr, technician.getId())) > 0 || xmBgCount > 0){
|
|
|
+ if (xmMapper.selectCount(Wrappers.<XmEntity>lambdaQuery().eq(XmEntity::getXmfzr, technician.getId())) > 0 || xmBgCount > 0) {
|
|
|
throw new ServiceException("删除失败,[" + dbTechnician.getName() + "]是项目负责人");
|
|
|
}
|
|
|
|