diff --git a/src/main/java/cn/palmte/work/model/AdminRepository.java b/src/main/java/cn/palmte/work/model/AdminRepository.java index d4891cb..ef280c6 100644 --- a/src/main/java/cn/palmte/work/model/AdminRepository.java +++ b/src/main/java/cn/palmte/work/model/AdminRepository.java @@ -8,7 +8,7 @@ import java.util.List; public interface AdminRepository extends JpaRepository { - @Query("from Admin where isDeleted=0 AND enabled=1 AND userName=?1") + @Query("from Admin where isDeleted=0 AND userName=?1") Admin getAdminByUsername(String username); @Query("from Admin where isDeleted=0 AND enabled=1 AND userName=?1") @@ -35,6 +35,9 @@ public interface AdminRepository extends JpaRepository { @Query("from Admin where isDeleted=0 AND telephone=?1") Admin findByTelephone(String phone); + @Query("from Admin where isDeleted=0 AND empCode=?1") + Admin findByEmpCode(String empCode); + /** * 查询所有未删除启用的账号 diff --git a/src/main/java/cn/palmte/work/service/AccountService.java b/src/main/java/cn/palmte/work/service/AccountService.java index e7577f9..3738a4f 100644 --- a/src/main/java/cn/palmte/work/service/AccountService.java +++ b/src/main/java/cn/palmte/work/service/AccountService.java @@ -111,7 +111,7 @@ public class AccountService { BeanUtils.copyProperties(admin, oldAdmin); - oldAdmin.setRealName(sysRole.getName()); + oldAdmin.setRealName(admin.getRealName()); oldAdmin.setDeptName(dept.getName()); oldAdmin.setPositionName(userPosition.getPositionName()); oldAdmin.setPassword(newPassword); @@ -125,7 +125,7 @@ public class AccountService { String userName = admin.getUserName(); oldAdmin.setDeptId(admin.getDeptId()); oldAdmin.setPositionId(admin.getPositionId()); - oldAdmin.setRealName(sysRole.getName()); + oldAdmin.setRealName(admin.getRealName()); oldAdmin.setDeptName(dept.getName()); oldAdmin.setPositionName(userPosition.getPositionName()); oldAdmin.setEmpCode(admin.getEmpCode()); @@ -167,15 +167,28 @@ public class AccountService { return "请填写正确的电话号码!"; } + //工号重复校验 + Admin empCode = adminRepository.findByEmpCode(admin.getEmpCode()); + if (userId == -1) { + if (null != empCode) { + message = "该工号已存在!"; + return message; + } + } else { + if (null != empCode && empCode.getId() != userId) { + message = "该工号已存在!"; + return message; + } + } + + //手机号重复校验 Admin byTelephoneEquals = adminRepository.findByTelephone(phone); if (userId == -1) { - //新增校验手机号是否存在 if (null != byTelephoneEquals) { message = "该手机号已存在!"; return message; } } else { - //编辑校验手机号是否存在 if (null != byTelephoneEquals && byTelephoneEquals.getId() != userId) { message = "该手机号已存在!"; return message; @@ -183,25 +196,33 @@ public class AccountService { } if (StringUtils.isEmpty(admin.getUserName())) { - message = "亲,用户名不能为空!"; + message = "登录名不能为空!"; return message; } Admin existAdmin = adminRepository.getAdminByUsername(admin.getUserName()); - if (userId == -1) {//只在新增时候校验 + if (userId == -1) { if (existAdmin != null) { - message = "亲,该账号已存在!"; + message = "该登录名称已存在!"; return message; } } else { if (existAdmin != null && existAdmin.getId() != userId) { - message = "亲,该账号名称已存在!"; + message = "该登录名称已存在!"; return message; } } - existAdmin = adminRepository.getAdminByRealName(admin.getRealName()); - if (existAdmin != null && existAdmin.getId() != userId) { - message = "亲,该账号名称已存在!"; - return message; + + Admin realName = adminRepository.getAdminByRealName(admin.getRealName()); + if (userId == -1) { + if (realName != null) { + message = "该姓名已存在!"; + return message; + } + } else { + if (realName != null && realName.getId() != userId) { + message = "该姓名已存在!"; + return message; + } } return message; } @@ -264,6 +285,7 @@ public class AccountService { /** * 通过id查询姓名 + * * @param id * @return */ @@ -274,6 +296,7 @@ public class AccountService { /** * 通过角色id查询用户姓名列表 + * * @param roleIds * @return */ diff --git a/src/main/resources/templates/admin/account_input.ftl b/src/main/resources/templates/admin/account_input.ftl index 4c127a5..e0231d0 100644 --- a/src/main/resources/templates/admin/account_input.ftl +++ b/src/main/resources/templates/admin/account_input.ftl @@ -44,7 +44,7 @@ 手机号
-
readonly - required placeholder="请输入账户名称(20字符以内)"/> + required placeholder="请输入姓名名称(20字符以内)"/>
@@ -110,7 +110,6 @@
- <#if positionList?exists> <#list positionList as node>
@@ -38,7 +38,6 @@ *所属大类
@@ -123,7 +123,18 @@ ${list.name!} - ${list.category!} + + <#if list.category ==1 > + 设备 + <#elseif list.category ==2> + 服务 + <#elseif list.category ==3> + 施工 + <#elseif list.category ==4> + 其他 + + + ${list.createdBy!} <#if list.createdTime??>${list.createdTime?datetime} diff --git a/src/main/resources/templates/admin/profit_marfin_config_input.ftl b/src/main/resources/templates/admin/profit_marfin_config_input.ftl index 53a26f7..b81f1ad 100644 --- a/src/main/resources/templates/admin/profit_marfin_config_input.ftl +++ b/src/main/resources/templates/admin/profit_marfin_config_input.ftl @@ -23,37 +23,34 @@ -
+ +
- * - 项目贡献利润率阀值: + *项目贡献利润率阀值:
-

注:请注意保留小数点后两位

-
+ type="number" id="projectContributionProfitRateThreshold" value="${projectContributionProfitRateThreshold!}" + minlength="1" step="0.01" + oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,6})?).*$/g, '$1')" + maxlength="10" placeholder="请输入项目贡献利润率阀值" required/> +
% 注:请注意保留小数点后两位
-
+
- * - 项目年利润率: + *设置项目年利率:
-

注:请注意保留小数点后两位

-
+ data-validate-async data-validation-message="请输入项目年利率" + type="number" id="underwrittenTaxRate" value="${underwrittenTaxRate!}" + minlength="1" step="0.01" + oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,6})?).*$/g, '$1')" + maxlength="10" placeholder="请输入项目年利率" required/> +
% 注:请注意保留小数点后两位
diff --git a/src/main/resources/templates/admin/role_input.ftl b/src/main/resources/templates/admin/role_input.ftl index 040dbd4..9026a71 100644 --- a/src/main/resources/templates/admin/role_input.ftl +++ b/src/main/resources/templates/admin/role_input.ftl @@ -28,8 +28,8 @@
+ type="text" id="roleName" value="${roleName!}" minlength="1" maxlength="20" + placeholder="请输入角色名称(20字符以内)" required onblur="checkRoleName($(this));" onKeyUp="clearValidInfo()" />
diff --git a/src/main/resources/templates/admin/role_list.ftl b/src/main/resources/templates/admin/role_list.ftl index 7bed83b..72130e8 100644 --- a/src/main/resources/templates/admin/role_list.ftl +++ b/src/main/resources/templates/admin/role_list.ftl @@ -98,7 +98,8 @@ 编辑 -
+ <#if list.id != 1> +
<#--是否启用:0禁用,1启用--> checked/>
+