Commit c257b21e authored by fangxinjiang's avatar fangxinjiang

代码优化

parent 68eed82f
......@@ -22,14 +22,14 @@ public class EmpCertificateExcelVO extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名",errorInfo = "员工姓名不可为空",maxLength = 20)
@ExcelAttribute(name = "员工姓名",isNotEmpty = true,errorInfo = "员工姓名不可为空",maxLength = 20)
@NotNull(message = "员工姓名不可为空")
@ExcelProperty(value ="员工姓名")
private String empName;
/**
* 员工身份证
*/
@ExcelAttribute(name = "身份证号",errorInfo = "员工身份证不可为空",maxLength = 20)
@ExcelAttribute(name = "身份证号",isNotEmpty = true,errorInfo = "员工身份证不可为空",maxLength = 20)
@NotNull(message = "员工身份证不可为空")
@ExcelProperty(value ="身份证号")
private String empIdcard;
......@@ -37,7 +37,7 @@ public class EmpCertificateExcelVO extends RowIndex implements Serializable {
/**
* 资格类型
*/
@ExcelAttribute(name = "资格类型",errorInfo = "资格类型不可为空",isDataId = true, dataType = "qualification_type")
@ExcelAttribute(name = "资格类型",isNotEmpty = true,errorInfo = "资格类型不可为空",isDataId = true, dataType = "qualification_type")
@NotNull(message = "资格类型不可为空")
@ExcelProperty(value ="资格类型")
private String qualificationType;
......@@ -45,7 +45,7 @@ public class EmpCertificateExcelVO extends RowIndex implements Serializable {
/**
* 资格等级
*/
@ExcelAttribute(name = "资格等级",errorInfo = "资格等级不可为空",isDataId = true, dataType = "qualification_level")
@ExcelAttribute(name = "资格等级",isNotEmpty = true,errorInfo = "资格等级不可为空",isDataId = true, dataType = "qualification_level")
@NotNull(message = "资格等级不可为空")
@ExcelProperty(value ="资格等级")
private String qualificationLevel;
......@@ -81,7 +81,7 @@ public class EmpCertificateExcelVO extends RowIndex implements Serializable {
/**
* 是否最高资格0是/1否
*/
@ExcelAttribute(name = "是否最高资格",errorInfo = "是否最高资格不可为空",readConverterExp = "0=是,1=否")
@ExcelAttribute(name = "是否最高资格",isNotEmpty = true,errorInfo = "是否最高资格不可为空",readConverterExp = "0=是,1=否")
@NotNull(message = "是否最高资格不可为空")
@ExcelProperty(value ="是否最高资格")
private String heightIdentification;
......
......@@ -24,7 +24,7 @@ public class EmpFamilyExcelVO extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名",errorInfo = "员工姓名不可为空",maxLength = 20)
@ExcelAttribute(name = "员工姓名",isNotEmpty = true,errorInfo = "员工姓名不可为空",maxLength = 20)
@NotNull(message = "员工姓名不可为空")
@ExcelProperty(value ="员工姓名")
private String empName;
......@@ -32,7 +32,7 @@ public class EmpFamilyExcelVO extends RowIndex implements Serializable {
/**
* 员工身份证
*/
@ExcelAttribute(name = "身份证号",errorInfo = "身份证号不可为空",maxLength = 20)
@ExcelAttribute(name = "身份证号",isNotEmpty = true,errorInfo = "身份证号不可为空",maxLength = 20)
@NotNull(message = "员工身份证不可为空")
@ExcelProperty(value ="身份证号")
private String empIdcard;
......@@ -40,7 +40,7 @@ public class EmpFamilyExcelVO extends RowIndex implements Serializable {
/**
* 家庭成员姓名
*/
@ExcelAttribute(name = "成员姓名",errorInfo = "成员姓名不可为空",maxLength = 20)
@ExcelAttribute(name = "成员姓名",isNotEmpty = true,errorInfo = "成员姓名不可为空",maxLength = 20)
@NotNull(message = "家庭成员姓名不可为空")
@ExcelProperty(value ="成员姓名")
private String familyName;
......
......@@ -78,7 +78,7 @@ public class EmpWorkRecordExcelVO extends RowIndex implements Serializable {
/**
* 开始工作日期
*/
@ExcelAttribute(name = "开始工作日期",errorInfo = "开始工作日期不可为空",isDate = true)
@ExcelAttribute(name = "开始工作日期",isNotEmpty = true,errorInfo = "开始工作日期不可为空",isDate = true)
@DateTimeFormat("yyyy-MM-dd")
@NotNull(message = "开始工作日期不可为空")
@ExcelProperty(value ="开始工作日期")
......
......@@ -72,7 +72,7 @@ public class TEmpFamilyController {
*/
@Operation(description = "不分页查询")
@GetMapping("/noPage" )
public R<List<TEmpFamily>> getTEmpFamilyNoPage(FamilySearchVO family) {
public R<List<TEmpFamily>> getTEmpFamilyNoPage(@RequestBody FamilySearchVO family) {
return R.ok(tEmpFamilyService.getTEmpFamilyNoPage(family));
}
......
......@@ -89,6 +89,7 @@ public class TEmpDisabilityInfoServiceImpl extends ServiceImpl<TEmpDisabilityInf
errorMessageList.add(errorMsg);
continue;
}
excel.setEmpName(emp.getEmpName());
exist = baseMapper.selectOne(Wrappers.<TEmpDisabilityInfo>query().lambda()
.eq(TEmpDisabilityInfo::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmpDisabilityInfo::getDisabilityName,excel.getDisabilityName())
......@@ -170,7 +171,7 @@ public class TEmpDisabilityInfoServiceImpl extends ServiceImpl<TEmpDisabilityInf
.eq(TEmpDisabilityInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(exist)){
R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_DISABILITY_NAME_EXISTING));
return R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_DISABILITY_NAME_EXISTING));
}
baseMapper.updateById(tEmpDisabilityInfo);
return R.ok();
......
......@@ -91,6 +91,7 @@ public class TEmpFamilyServiceImpl extends ServiceImpl<TEmpFamilyMapper, TEmpFam
errorMessageList.add(errorMsg);
continue;
}
excel.setEmpName(emp.getEmpName());
exist = baseMapper.selectOne(Wrappers.<TEmpFamily>query().lambda()
.eq(TEmpFamily::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmpFamily::getFamilyName,excel.getFamilyName())
......
......@@ -115,6 +115,7 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr
errorMessageList.add(errorMsg);
continue;
}
excel.setEmpName(emp.getEmpName());
exist = baseMapper.selectOne(Wrappers.<TEmpProfessionalQualification>query().lambda()
.eq(TEmpProfessionalQualification::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmpProfessionalQualification::getQualificationLevel,excel.getQualificationLevel())
......
......@@ -84,6 +84,7 @@ public class TEmpWorkRecordingServiceImpl extends ServiceImpl<TEmpWorkRecordingM
errorMessageList.add(errorMsg);
continue;
}
excel.setEmpName(emp.getEmpName());
exist = baseMapper.selectOne(Wrappers.<TEmpWorkRecording>query().lambda()
.eq(TEmpWorkRecording::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmpWorkRecording::getWorkUnit,excel.getWorkUnit())
......
......@@ -61,8 +61,8 @@ checks.reduce.project.error=\u5B58\u5728\u5DF2\u51CF\u9879\u7684\u9879\u76EE\uFF
checks.emp.exit.error=\u4EBA\u5458\u4E0D\u5728\u8BE5\u9879\u76EE\uFF0C\u65E0\u6CD5\u66F4\u65B0
checks.project.delete.error=\u9879\u76EE\u6863\u6848\u72B6\u6001\u4E3A\u5DF2\u5BA1\u6838\uFF0C\u7981\u6B62\u5220\u9664
archives.emp.certificate.name.existing=\u8BE5\u5458\u5DE5\u5DF2\u5B58\u5728\u5BF9\u5E94\u8EAB\u4EFD\u8BC1\u7684\u8BC1\u4E66\u4FE1\u606F
archives.emp.certificate.declare.year.error=\u7533\u8BF7\u5E74\u4EFD\u4E0D\u53EF\u4E3A\u672A\u6765\u5E74\u4EFD
archives.emp.certificate.name.existing=\u8BE5\u5458\u5DE5\u5DF2\u5B58\u5728\u5BF9\u5E94\u8D44\u683C\u7C7B\u578B\u548C\u8D44\u683C\u7B49\u7EA7\u7684\u8BC1\u4E66
archives.emp.certificate.declare.year.error=\u7533\u62A5\u5E74\u5EA6\u4E0D\u53EF\u4E3A\u672A\u6765\u5E74\u4EFD
checks.change.emp.project=\u5F85\u5212\u8F6C\u5458\u5DE5\u5DF2\u5728\u76EE\u6807\u9879\u76EE\u4E0B\u4E0D\u53EF\u5212\u8F6C
......
......@@ -107,7 +107,7 @@ public class RoleController {
@DeleteMapping("/{id:\\d+}")
@PreAuthorize("@pms.hasPermission('sys_role_del')")
public R<Boolean> removeById(@PathVariable Long id) {
return R.ok(sysRoleService.removeRoleById(id));
return sysRoleService.removeRoleById(id);
}
/**
......
......@@ -40,7 +40,7 @@ public interface SysRoleService extends IService<SysRole> {
* @param id
* @return
*/
Boolean removeRoleById(Long id);
R<Boolean> removeRoleById(Long id);
/**
* 导入角色
......
......@@ -75,19 +75,24 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
@Override
@Transactional(rollbackFor = Exception.class)
@CacheEvict(value = CacheConstants.MENU_DETAILS, allEntries = true)
public Boolean removeRoleById(Long id) {
public R<Boolean> removeRoleById(Long id) {
SysRole sysRole = this.getById(id);
if (Common.isEmpty(sysRole)){
return false;
return R.failed();
}
SysUserRole userRole =sysUserRoleMapper.selectOne(Wrappers.<SysUserRole>query().lambda()
.eq(SysUserRole::getRoleId,sysRole.getRoleId()).last(CommonConstants.LAST_ONE_SQL));
//已存在用户
Assert.state(Common.isEmpty(userRole),MsgUtils.getMessage(ErrorCodes.SYS_ROLE_DELETE_EXIST_USER));
if (!Common.isEmpty(userRole)){
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_DELETE_EXIST_USER));
}
//系统内置
Assert.state(!CommonConstants.ZERO_STRING.equals(sysRole.getSystemFlag()),MsgUtils.getMessage(ErrorCodes.SYS_ROLE_DELETE_SYSTEM));
if (CommonConstants.ZERO_STRING.equals(sysRole.getSystemFlag())){
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_DELETE_SYSTEM));
}
sysRoleMenuMapper.delete(Wrappers.<SysRoleMenu>update().lambda().eq(SysRoleMenu::getRoleId, id));
return this.removeById(id);
this.removeById(id);
return R.ok();
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment