bug修复

master
hanbo 2021-11-22 11:53:57 +08:00
parent cd627d7b2a
commit 4f5bd67a47
9 changed files with 80 additions and 48 deletions

View File

@ -8,7 +8,7 @@ import java.util.List;
public interface AdminRepository extends JpaRepository<Admin, Integer> { public interface AdminRepository extends JpaRepository<Admin, Integer> {
@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); Admin getAdminByUsername(String username);
@Query("from Admin where isDeleted=0 AND enabled=1 AND userName=?1") @Query("from Admin where isDeleted=0 AND enabled=1 AND userName=?1")
@ -35,6 +35,9 @@ public interface AdminRepository extends JpaRepository<Admin, Integer> {
@Query("from Admin where isDeleted=0 AND telephone=?1") @Query("from Admin where isDeleted=0 AND telephone=?1")
Admin findByTelephone(String phone); Admin findByTelephone(String phone);
@Query("from Admin where isDeleted=0 AND empCode=?1")
Admin findByEmpCode(String empCode);
/** /**
* *

View File

@ -111,7 +111,7 @@ public class AccountService {
BeanUtils.copyProperties(admin, oldAdmin); BeanUtils.copyProperties(admin, oldAdmin);
oldAdmin.setRealName(sysRole.getName()); oldAdmin.setRealName(admin.getRealName());
oldAdmin.setDeptName(dept.getName()); oldAdmin.setDeptName(dept.getName());
oldAdmin.setPositionName(userPosition.getPositionName()); oldAdmin.setPositionName(userPosition.getPositionName());
oldAdmin.setPassword(newPassword); oldAdmin.setPassword(newPassword);
@ -125,7 +125,7 @@ public class AccountService {
String userName = admin.getUserName(); String userName = admin.getUserName();
oldAdmin.setDeptId(admin.getDeptId()); oldAdmin.setDeptId(admin.getDeptId());
oldAdmin.setPositionId(admin.getPositionId()); oldAdmin.setPositionId(admin.getPositionId());
oldAdmin.setRealName(sysRole.getName()); oldAdmin.setRealName(admin.getRealName());
oldAdmin.setDeptName(dept.getName()); oldAdmin.setDeptName(dept.getName());
oldAdmin.setPositionName(userPosition.getPositionName()); oldAdmin.setPositionName(userPosition.getPositionName());
oldAdmin.setEmpCode(admin.getEmpCode()); oldAdmin.setEmpCode(admin.getEmpCode());
@ -167,15 +167,28 @@ public class AccountService {
return "请填写正确的电话号码!"; 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); Admin byTelephoneEquals = adminRepository.findByTelephone(phone);
if (userId == -1) { if (userId == -1) {
//新增校验手机号是否存在
if (null != byTelephoneEquals) { if (null != byTelephoneEquals) {
message = "该手机号已存在!"; message = "该手机号已存在!";
return message; return message;
} }
} else { } else {
//编辑校验手机号是否存在
if (null != byTelephoneEquals && byTelephoneEquals.getId() != userId) { if (null != byTelephoneEquals && byTelephoneEquals.getId() != userId) {
message = "该手机号已存在!"; message = "该手机号已存在!";
return message; return message;
@ -183,26 +196,34 @@ public class AccountService {
} }
if (StringUtils.isEmpty(admin.getUserName())) { if (StringUtils.isEmpty(admin.getUserName())) {
message = "亲,用户名不能为空!"; message = "登录名不能为空!";
return message; return message;
} }
Admin existAdmin = adminRepository.getAdminByUsername(admin.getUserName()); Admin existAdmin = adminRepository.getAdminByUsername(admin.getUserName());
if (userId == -1) {//只在新增时候校验 if (userId == -1) {
if (existAdmin != null) { if (existAdmin != null) {
message = "亲,该账号已存在!"; message = "该登录名称已存在!";
return message; return message;
} }
} else { } else {
if (existAdmin != null && existAdmin.getId() != userId) { if (existAdmin != null && existAdmin.getId() != userId) {
message = "亲,该账号名称已存在!"; message = "该登录名称已存在!";
return message; return message;
} }
} }
existAdmin = adminRepository.getAdminByRealName(admin.getRealName());
if (existAdmin != null && existAdmin.getId() != userId) { Admin realName = adminRepository.getAdminByRealName(admin.getRealName());
message = "亲,该账号名称已存在!"; if (userId == -1) {
if (realName != null) {
message = "该姓名已存在!";
return message; return message;
} }
} else {
if (realName != null && realName.getId() != userId) {
message = "该姓名已存在!";
return message;
}
}
return message; return message;
} }
@ -264,6 +285,7 @@ public class AccountService {
/** /**
* id * id
*
* @param id * @param id
* @return * @return
*/ */
@ -274,6 +296,7 @@ public class AccountService {
/** /**
* id * id
*
* @param roleIds * @param roleIds
* @return * @return
*/ */

View File

@ -44,7 +44,7 @@
手机号 手机号
</div> </div>
<div class="am-u-sm-6 am-u-md-6"> <div class="am-u-sm-6 am-u-md-6">
<input name="telephone" class="am-form-field am-input-sm" <input name="telephone" class="am-form-field"
data-validate-async data-validation-message="请输入正确格式手机号码!" data-validate-async data-validation-message="请输入正确格式手机号码!"
onkeyup="value=value.replace(/[^\d]/g,'')" onkeyup="value=value.replace(/[^\d]/g,'')"
type="text" id="telephone" value="${account.telephone!}" minlength="11" type="text" id="telephone" value="${account.telephone!}" minlength="11"
@ -79,10 +79,10 @@
</div> </div>
<div class="am-u-sm-6 am-u-md-6"> <div class="am-u-sm-6 am-u-md-6">
<input name="realName" class="js-ajax-validate" <input name="realName" class="js-ajax-validate"
data-validate-async data-validation-message="请输入账户名称20字符以内" data-validate-async data-validation-message="请输入姓名20字符以内"
type="text" id="realName" value="${account.realName!}" minlength="1" type="text" id="realName" value="${account.realName!}" minlength="1"
maxlength="20" <#if userId!=-1>readonly</#if> maxlength="20" <#if userId!=-1>readonly</#if>
required placeholder="请输入账户名称20字符以内"/> required placeholder="请输入姓名名称20字符以内"/>
</div> </div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div> <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div> </div>
@ -110,7 +110,6 @@
<div class="am-u-sm-8 am-u-md-10"> <div class="am-u-sm-8 am-u-md-10">
<select id="deptId" name="deptId" <select id="deptId" name="deptId"
data-am-selected="{btnSize: 'sm',maxHeight: 200,searchBox: 1}"> data-am-selected="{btnSize: 'sm',maxHeight: 200,searchBox: 1}">
<option value="-1">请选择</option>
<#if deptList?exists> <#if deptList?exists>
<#list deptList as node> <#list deptList as node>
<option value="${node.id!}" <#if account.deptId! == node.id > <option value="${node.id!}" <#if account.deptId! == node.id >
@ -144,7 +143,6 @@
<div class="am-u-sm-8 am-u-md-10"> <div class="am-u-sm-8 am-u-md-10">
<select id="positionId" name="positionId" <select id="positionId" name="positionId"
data-am-selected="{btnSize: 'sm',maxHeight: 200,searchBox: 1}"> data-am-selected="{btnSize: 'sm',maxHeight: 200,searchBox: 1}">
<option value="-1">请选择</option>
<#if positionList?exists> <#if positionList?exists>
<#list positionList as node> <#list positionList as node>
<option value="${node.id!}" <#if account.positionId! == node.id > <option value="${node.id!}" <#if account.positionId! == node.id >
@ -163,7 +161,6 @@
<div class="am-u-sm-8 am-u-md-10"> <div class="am-u-sm-8 am-u-md-10">
<select id="roleId" name="roleId" <select id="roleId" name="roleId"
data-am-selected="{btnSize: 'sm',maxHeight: 200,searchBox: 1}"> data-am-selected="{btnSize: 'sm',maxHeight: 200,searchBox: 1}">
<option value="-1">请选择</option>
<#if roleList?exists> <#if roleList?exists>
<#list roleList as node> <#list roleList as node>
<option value="${node.id!}" <#if account.roleId! == node.id > <option value="${node.id!}" <#if account.roleId! == node.id >

View File

@ -79,13 +79,13 @@
<div class="am-form am-form-inline"> <div class="am-form am-form-inline">
<div class="am-form-group am-form-icon"> <div class="am-form-group am-form-icon">
<i class="am-icon-calendar"></i> <i class="am-icon-calendar"></i>
<input type="text" class="am-form-field am-input-sm" id="startTime" <input type="text" class="am-form-field am-input-sm" id="startTime" readonly
value="${startTime!}" placeholder="开始日期" data-am-datepicker> value="${startTime!}" placeholder="开始日期" data-am-datepicker>
</div> </div>
<div class="am-form-group">至</div> <div class="am-form-group">至</div>
<div class="am-form-group am-form-icon"> <div class="am-form-group am-form-icon">
<i class="am-icon-calendar"></i> <i class="am-icon-calendar"></i>
<input type="text" class="am-form-field am-input-sm" id="endTime" <input type="text" class="am-form-field am-input-sm" id="endTime" readonly
value="${endTime!}" value="${endTime!}"
placeholder="结束日期" data-am-datepicker> placeholder="结束日期" data-am-datepicker>
</div> </div>

View File

@ -27,7 +27,7 @@
<span style="color: red;">*</span>采购类型名称</div> <span style="color: red;">*</span>采购类型名称</div>
<div class="am-u-sm-6 am-u-md-6"> <div class="am-u-sm-6 am-u-md-6">
<input class="js-ajax-validate" name="name" data-validation-message="请输入告警类型名称20字符以内" <input class="js-ajax-validate" name="name" data-validation-message="请输入告警类型名称20字符以内"
minlength="1" maxlength="20" minlength="1" maxlength="10"
value="${procurementType.name!}" type="text" required/> value="${procurementType.name!}" type="text" required/>
</div> </div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div> <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
@ -38,7 +38,6 @@
<span style="color: red;">*</span>所属大类</div> <span style="color: red;">*</span>所属大类</div>
<div class="am-u-sm-6 am-u-md-6"> <div class="am-u-sm-6 am-u-md-6">
<select data-am-selected="{btnWidth: '40%', btnSize: 'sm'" id="category" name="category"> <select data-am-selected="{btnWidth: '40%', btnSize: 'sm'" id="category" name="category">
<option value="-1" >请选择所属大类</option>
<option value="1" <#if procurementType.category! ==1>selected</#if> >设备</option> <option value="1" <#if procurementType.category! ==1>selected</#if> >设备</option>
<option value="2" <#if procurementType.category! ==2>selected</#if> >服务</option> <option value="2" <#if procurementType.category! ==2>selected</#if> >服务</option>
<option value="3" <#if procurementType.category! ==3>selected</#if> >施工</option> <option value="3" <#if procurementType.category! ==3>selected</#if> >施工</option>

View File

@ -43,14 +43,14 @@
<div class="am-form am-form-inline"> <div class="am-form am-form-inline">
<div class="am-form-group am-form-icon"> <div class="am-form-group am-form-icon">
<i class="am-icon-calendar"></i> <i class="am-icon-calendar"></i>
<input type="text" class="am-form-field am-input-sm" id="startTime" <input type="text" class="am-form-field am-input-sm" id="startTime" readonly
value="${startTime!}" placeholder="开始日期" data-am-datepicker> value="${startTime!}" placeholder="开始日期" data-am-datepicker>
</div> </div>
<div class="am-form-group">至</div> <div class="am-form-group">至</div>
<div class="am-form-group am-form-icon"> <div class="am-form-group am-form-icon">
<i class="am-icon-calendar"></i> <i class="am-icon-calendar"></i>
<input type="text" class="am-form-field am-input-sm" id="endTime" <input type="text" class="am-form-field am-input-sm" id="endTime"
value="${endTime!}" value="${endTime!}" readonly
placeholder="结束日期" data-am-datepicker> placeholder="结束日期" data-am-datepicker>
</div> </div>
</div> </div>
@ -123,7 +123,18 @@
<tr> <tr>
<td><input type="checkbox" name="ids" value="${list.id}"/></td> <td><input type="checkbox" name="ids" value="${list.id}"/></td>
<td>${list.name!}</td> <td>${list.name!}</td>
<td>${list.category!}</td> <td>
<#if list.category ==1 >
设备
<#elseif list.category ==2>
服务
<#elseif list.category ==3>
施工
<#elseif list.category ==4>
其他
</#if>
</td>
<td>${list.createdBy!}</td> <td>${list.createdBy!}</td>
<td><#if list.createdTime??>${list.createdTime?datetime}</#if></td> <td><#if list.createdTime??>${list.createdTime?datetime}</#if></td>
<td> <td>

View File

@ -23,37 +23,34 @@
<input name="tId" id="tId" type="hidden" value="${tId!}"/> <input name="tId" id="tId" type="hidden" value="${tId!}"/>
<!--验证表单元素validate) begin--> <!--验证表单元素validate) begin-->
<!--input begin--> <!--input begin-->
<div class="am-g am-form-group am-margin-top" id="threshold">
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"> <div class="am-u-sm-4 am-u-md-2 am-text-right">
<span style="color: red;">*</span> <span style="color: red;">*</span>项目贡献利润率阀值:
项目贡献利润率阀值:
</div> </div>
<div class="am-u-sm-6 am-u-md-6"> <div class="am-u-sm-6 am-u-md-6">
<input name="projectContributionProfitRateThreshold" class="js-ajax-validate" <input name="projectContributionProfitRateThreshold" class="js-ajax-validate"
data-validate-async data-validation-message="请输入项目贡献利润率阀值" data-validate-async data-validation-message="请输入项目贡献利润率阀值"
type="number" step="0.01" id="projectContributionProfitRateThreshold" type="number" id="projectContributionProfitRateThreshold" value="${projectContributionProfitRateThreshold!}"
value="${projectContributionProfitRateThreshold!}" minlength="1" minlength="1" step="0.01"
maxlength="4" oninput="if(value.length>4)value=value.slice(0,4)" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,6})?).*$/g, '$1')"
placeholder="请输入项目贡献利润率阀值" required/> maxlength="10" placeholder="请输入项目贡献利润率阀值" required/>
<p>注:请注意保留小数点后两位</p> </div>% 注:请注意保留小数点后两位
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div> <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div> </div>
<div class="am-g am-form-group am-margin-top" id="threshold"> <div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"> <div class="am-u-sm-4 am-u-md-2 am-text-right">
<span style="color: red;">*</span> <span style="color: red;">*</span>设置项目年利率:
项目年利润率:
</div> </div>
<div class="am-u-sm-6 am-u-md-6"> <div class="am-u-sm-6 am-u-md-6">
<input name="underwrittenTaxRate" class="js-ajax-validate" <input name="underwrittenTaxRate" class="js-ajax-validate"
data-validate-async data-validation-message="请输入项目年利润率" data-validate-async data-validation-message="请输入项目年利率"
type="number" step="0.01" id="underwrittenTaxRate" type="number" id="underwrittenTaxRate" value="${underwrittenTaxRate!}"
value="${underwrittenTaxRate!}" minlength="1" minlength="1" step="0.01"
maxlength="4" oninput="if(value.length>4)value=value.slice(0,4)" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,6})?).*$/g, '$1')"
placeholder="请输入项目年利润率" required/> maxlength="10" placeholder="请输入项目年利率" required/>
<p>注:请注意保留小数点后两位</p> </div>% 注:请注意保留小数点后两位
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div> <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div> </div>
</div> </div>

View File

@ -28,8 +28,8 @@
<div class="am-u-sm-6 am-u-md-6"> <div class="am-u-sm-6 am-u-md-6">
<input name="roleName" class="js-ajax-validate" <input name="roleName" class="js-ajax-validate"
data-validate-async data-validation-message="请输入角色名称100字符以内" data-validate-async data-validation-message="请输入角色名称100字符以内"
type="text" id="roleName" value="${roleName!}" minlength="1" maxlength="100" type="text" id="roleName" value="${roleName!}" minlength="1" maxlength="20"
placeholder="请输入角色名称(100字符以内" required onblur="checkRoleName($(this));" onKeyUp="clearValidInfo()" /> placeholder="请输入角色名称(20字符以内" required onblur="checkRoleName($(this));" onKeyUp="clearValidInfo()" />
</div> </div>
<div class="am-u-sm-2 am-u-md-4 input-msg" id="role_name_valid"></div> <div class="am-u-sm-2 am-u-md-4 input-msg" id="role_name_valid"></div>
</div> </div>

View File

@ -98,6 +98,7 @@
编辑 编辑
</button> </button>
</@shiro.hasPermission> </@shiro.hasPermission>
<#if list.id != 1>
<div class="am-btn-group am-btn-group-xs"> <div class="am-btn-group am-btn-group-xs">
<div class="switch-button"> <div class="switch-button">
<#--是否启用0禁用1启用--> <#--是否启用0禁用1启用-->
@ -106,6 +107,7 @@
<#if list.isEnable==1 >checked</#if>/> <#if list.isEnable==1 >checked</#if>/>
</div> </div>
</div> </div>
</#if>
</div> </div>
</div> </div>
</td> </td>