应付录入功能修改

This commit is contained in:
lSun 2025-09-16 15:21:24 +08:00
parent 4ad61835e8
commit e93df8f3b2
13 changed files with 92 additions and 21 deletions

View File

@ -28,4 +28,6 @@ public interface PayAccountInfoDao {
List<PayAccountInfoBean> getPayAccountInfo(Map<String, Object> params); List<PayAccountInfoBean> getPayAccountInfo(Map<String, Object> params);
PayAccountInfoBean getPayAccountInfoByName(String name); PayAccountInfoBean getPayAccountInfoByName(String name);
PayAccountInfoBean getPayAccountInfoByAccountNumber(String accountNumber);
} }

View File

@ -47,6 +47,12 @@ public class PayAccountInfoServiceImpl implements PayAccountInfoService {
@Override @Override
public void save(PayAccountInfoBean payAccountInfoBean) { public void save(PayAccountInfoBean payAccountInfoBean) {
if (payAccountInfoBean.getName() != null) {
payAccountInfoBean.setName(payAccountInfoBean.getName().trim());
}
if (payAccountInfoBean.getAccountNumber() != null) {
payAccountInfoBean.setAccountNumber(payAccountInfoBean.getAccountNumber().trim());
}
LoginUser loginUser = UserUtil.getLoginUser(); LoginUser loginUser = UserUtil.getLoginUser();
String username = loginUser.getUsername(); String username = loginUser.getUsername();
String userId = dao.getIdByName(username); String userId = dao.getIdByName(username);
@ -56,12 +62,22 @@ public class PayAccountInfoServiceImpl implements PayAccountInfoService {
if (bean != null && !bean.getId().equals(payAccountInfoBean.getId())){ if (bean != null && !bean.getId().equals(payAccountInfoBean.getId())){
throw new IllegalArgumentException("付款账户名称:"+bean.getName() +"已存在"); throw new IllegalArgumentException("付款账户名称:"+bean.getName() +"已存在");
} }
dao.update(payAccountInfoBean);
PayAccountInfoBean o = dao.getPayAccountInfoByAccountNumber(payAccountInfoBean.getAccountNumber());
if(o !=null && !o.getId().equals(payAccountInfoBean.getId())){
throw new IllegalArgumentException("付款账户:"+o.getAccountNumber() +"已存在");
}
dao.update (payAccountInfoBean);
}else { }else {
PayAccountInfoBean bean = dao.getPayAccountInfoByName(payAccountInfoBean.getName()); PayAccountInfoBean bean = dao.getPayAccountInfoByName(payAccountInfoBean.getName());
if (bean != null){ if (bean != null){
throw new IllegalArgumentException("付款账户名称:"+bean.getName() +"已存在"); throw new IllegalArgumentException("付款账户名称:"+bean.getName() +"已存在");
} }
PayAccountInfoBean o = dao.getPayAccountInfoByAccountNumber(payAccountInfoBean.getAccountNumber());
if(o !=null ){
throw new IllegalArgumentException("付款账户:"+o.getAccountNumber() +"已存在");
}
dao.add(payAccountInfoBean); dao.add(payAccountInfoBean);
} }
} }

View File

@ -210,7 +210,7 @@ public class PayableController {
// 从第二行开始读取数据跳过表头 // 从第二行开始读取数据跳过表头
for (int i = 2; i <= sheet.getLastRowNum(); i++) { for (int i = 2; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i); Row row = sheet.getRow(i);
if (row == null) { if (row == null || isRowEmpty(row)) {
continue; continue;
} }
@ -460,23 +460,49 @@ public class PayableController {
switch (cell.getCellType()) { switch (cell.getCellType()) {
case STRING: case STRING:
return cell.getStringCellValue(); return cell.getStringCellValue().trim();
case NUMERIC: case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) { if (DateUtil.isCellDateFormatted(cell)) {
return new java.text.SimpleDateFormat("yyyy-MM-dd").format(cell.getDateCellValue()); return new java.text.SimpleDateFormat("yyyy-MM-dd").format(cell.getDateCellValue()).trim();
} }
// 处理数值类型去掉可能存在的.0后缀 // 处理数值类型去掉可能存在的.0后缀
double numericValue = cell.getNumericCellValue(); double numericValue = cell.getNumericCellValue();
if (numericValue == (long) numericValue) { if (numericValue == (long) numericValue) {
return String.valueOf((long) numericValue); return String.valueOf((long) numericValue).trim();
} }
return String.valueOf(numericValue); return String.valueOf(numericValue).trim();
case BOOLEAN: case BOOLEAN:
return String.valueOf(cell.getBooleanCellValue()); return String.valueOf(cell.getBooleanCellValue()).trim();
case FORMULA: case FORMULA:
return cell.getCellFormula(); return cell.getCellFormula().trim();
default: default:
return ""; return "";
} }
} }
private boolean isRowEmpty(Row row) {
if (row == null) {
return true;
}
// 检查从第0个到第11个单元格根据你的列数调整
for (int c = 0; c < 12; c++) {
Cell cell = row.getCell(c);
if (cell != null) {
if (cell.getCellType() == CellType.STRING) {
if (cell.getStringCellValue().trim().length() > 0) {
return false;
}
} else if (cell.getCellType() == CellType.NUMERIC) {
return false; // 数字即使为0也算有值
} else if (cell.getCellType() == CellType.BOOLEAN) {
return false;
} else if (cell.getCellType() == CellType.FORMULA) {
// 公式也算有内容
return false;
}
}
}
return true;
}
} }

View File

@ -46,6 +46,10 @@
<if test="params.name != null and params.name !='' "> <if test="params.name != null and params.name !='' ">
and cbpai.name like concat ('%',#{params.name},'%') and cbpai.name like concat ('%',#{params.name},'%')
</if> </if>
<if test="params.accountNumber != null and params.accountNumber !='' ">
and cbpai.account_number like concat ('%',#{params.accountNumber},'%')
</if>
<if test="params.openingAccountDate != null and params.openingAccountDate !='' "> <if test="params.openingAccountDate != null and params.openingAccountDate !='' ">
and cbpai.opening_account_date like concat ('%',#{params.openingAccountDate},'%') and cbpai.opening_account_date like concat ('%',#{params.openingAccountDate},'%')
</if> </if>
@ -96,4 +100,11 @@
from ca_bm_pay_account_info from ca_bm_pay_account_info
where is_active = '1' and name = #{name} where is_active = '1' and name = #{name}
</select> </select>
<select id="getPayAccountInfoByAccountNumber"
resultType="com.bonus.boot.manager.ca.bm.entity.PayAccountInfoBean">
select *
from ca_bm_pay_account_info
where is_active = '1' and account_number = #{accountNumber}
</select>
</mapper> </mapper>

View File

@ -58,7 +58,7 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
/** /**
* 部门下拉树 * 部门下拉树
*/ */
loadOrgTree(); // loadOrgTree();
/** /**
* 点击除了部门输入框和下拉树范围之外的地方,关闭下拉树列表 * 点击除了部门输入框和下拉树范围之外的地方,关闭下拉树列表
*/ */
@ -99,7 +99,7 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
} //设定异步数据接口的额外参数 } //设定异步数据接口的额外参数
}); });
$("#keyWord").val(oldKeyWord); $("#keyWord").val(oldKeyWord);
loadOrgTree(); // loadOrgTree();
break; break;
case "addBtn": case "addBtn":
openForm("",'新增'); openForm("",'新增');
@ -164,7 +164,7 @@ function resetPassword(id){
/** 树的方法开始 */ /** 树的方法开始 */
var machines = new Set(); //专业容器 /*var machines = new Set(); //专业容器
var size = 1; //序号 var size = 1; //序号
var map =[]; var map =[];
var mapinfo={}; var mapinfo={};
@ -180,7 +180,7 @@ function loadOrgTree(){
}},data.obj); }},data.obj);
// 获取树对象 // 获取树对象
var treeObj = $.fn.zTree.getZTreeObj("departmentTree"); var treeObj = $.fn.zTree.getZTreeObj("departmentTree");
/* 获取所有树节点 */ /!* 获取所有树节点 *!/
var nodes = treeObj.transformToArray(treeObj.getNodes()); var nodes = treeObj.transformToArray(treeObj.getNodes());
//展开第一级树 //展开第一级树
treeObj.expandNode(nodes[1], true); treeObj.expandNode(nodes[1], true);
@ -189,7 +189,7 @@ function loadOrgTree(){
alert("未连接到服务器,请检查网络!"); alert("未连接到服务器,请检查网络!");
} }
}); });
} }*/
/** /**
* 专业的选择 * 专业的选择

View File

@ -97,7 +97,7 @@
success : function(data) { success : function(data) {
parent.table.reload('menuTable'); parent.table.reload('menuTable');
parent.layer.closeAll(); parent.layer.closeAll();
top.layer.close(addLoadingMsg); //再执行关闭 top.layer.close(); //再执行关闭
parent.layer.msg('成功', {icon: 1, time: 2000}); parent.layer.msg('成功', {icon: 1, time: 2000});
}, },
}); });

View File

@ -250,7 +250,7 @@
success : function(data) { success : function(data) {
parent.table.reload('menuTable'); parent.table.reload('menuTable');
parent.layer.closeAll(); parent.layer.closeAll();
top.layer.close(addLoadingMsg); //再执行关闭 top.layer.close(); //再执行关闭
parent.layer.msg('成功', {icon: 1, time: 2000}); parent.layer.msg('成功', {icon: 1, time: 2000});
}, },
}); });

View File

@ -26,7 +26,7 @@
</div> </div>
<div class="layui-input-inline"style="float: left;width: 50%;margin-top: 2%;margin-left: 20%" > <div class="layui-input-inline"style="float: left;width: 50%;margin-top: 2%;margin-left: 20%" >
<label class="layui-form-label" style="width: 30%">账户:</label> <label class="layui-form-label" style="width: 30%"><i class="tip-required" style="color: red;font-size: 20px">*</i>账户:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input style="width: 85%" type="text" name="accountNumber" id="accountNumber" maxlength="50" lay-verify="required" class="layui-input"> <input style="width: 85%" type="text" name="accountNumber" id="accountNumber" maxlength="50" lay-verify="required" class="layui-input">
</div> </div>
@ -113,6 +113,12 @@
layer.msg("请输入账户名称!",{icon:0,time:2000}) layer.msg("请输入账户名称!",{icon:0,time:2000})
return false; return false;
} }
if (isNull($("#accountNumber").val())){
layer.msg("请输入账户!",{icon:0,time:2000})
return false;
}
var formdata = $("#form"); var formdata = $("#form");
if (id == "0"){ if (id == "0"){
formdata.id = ""; formdata.id = "";
@ -133,7 +139,7 @@
success : function(data) { success : function(data) {
parent.table.reload('menuTable'); parent.table.reload('menuTable');
parent.layer.closeAll(); parent.layer.closeAll();
top.layer.close(addLoadingMsg); //再执行关闭 top.layer.close(); //再执行关闭
parent.layer.msg('成功', {icon: 1, time: 2000}); parent.layer.msg('成功', {icon: 1, time: 2000});
}, },
}); });

View File

@ -196,7 +196,7 @@
success : function(data) { success : function(data) {
parent.table.reload('menuTable'); parent.table.reload('menuTable');
parent.layer.closeAll(); parent.layer.closeAll();
top.layer.close(addLoadingMsg); //再执行关闭 top.layer.close(); //再执行关闭
parent.layer.msg('成功', {icon: 1, time: 2000}); parent.layer.msg('成功', {icon: 1, time: 2000});
}, },
}); });

View File

@ -39,6 +39,14 @@
placeholder="请输入账户名称"> placeholder="请输入账户名称">
</div> </div>
</div> </div>
<div class="layui-inline">
<div class="layui-input-inline">
<input id="accountNumber" type="text" class="layui-input" style="width: 200px"
placeholder="请输入付款账号">
</div>
</div>
<div class="layui-inline"> <div class="layui-inline">
<div class="layui-input-inline"> <div class="layui-input-inline">
<input id="openingAccountDate" name="openingAccountDate" type="text" class="layui-input" style="border: 1px solid #D2D2D2; width: 100%" readonly placeholder="开户日期"> <input id="openingAccountDate" name="openingAccountDate" type="text" class="layui-input" style="border: 1px solid #D2D2D2; width: 100%" readonly placeholder="开户日期">
@ -117,6 +125,7 @@
, defaultToolbar: [] , defaultToolbar: []
, where: { , where: {
name: $('#name').val(), name: $('#name').val(),
accountNumber: $('#accountNumber').val(),
openingAccountDate: $('#openingAccountDate').val() openingAccountDate: $('#openingAccountDate').val()
} //post请求必须加where post请求需要的参数 } //post请求必须加where post请求需要的参数
, cellMinWidth: 80 , cellMinWidth: 80
@ -207,6 +216,7 @@
, page: true , page: true
, where: { , where: {
name: $('#name').val(), name: $('#name').val(),
accountNumber: $('#accountNumber').val(),
openingAccountDate: $('#openingAccountDate').val() openingAccountDate: $('#openingAccountDate').val()
} //设定异步数据接口的额外参数 } //设定异步数据接口的额外参数
}); });

View File

@ -214,7 +214,7 @@
success : function(data) { success : function(data) {
parent.example.ajax.reload(); parent.example.ajax.reload();
parent.layer.closeAll(); parent.layer.closeAll();
top.layer.close(addLoadingMsg); //再执行关闭 top.layer.close(); //再执行关闭
parent.layer.msg('成功', {icon: 1, time: 2000}); parent.layer.msg('成功', {icon: 1, time: 2000});
}, },
}); });

View File

@ -186,7 +186,7 @@
success : function(data) { success : function(data) {
parent.example.ajax.reload(); parent.example.ajax.reload();
parent.layer.closeAll(); parent.layer.closeAll();
top.layer.close(addLoadingMsg); //再执行关闭 top.layer.close(); //再执行关闭
parent.layer.msg('成功', {icon: 1, time: 2000}); parent.layer.msg('成功', {icon: 1, time: 2000});
}, },
}); });

View File

@ -171,7 +171,7 @@
/** /**
* 判断是否高职---展示或隐藏特殊岗位标签 * 判断是否高职---展示或隐藏特殊岗位标签
*/ */
isSpecial('higherJob'); // isSpecial('higherJob');
/** /**
* 点击除了部门输入框和下拉树范围之外的地方,关闭下拉树列表 * 点击除了部门输入框和下拉树范围之外的地方,关闭下拉树列表