This commit is contained in:
jinbooks_dev
2025-06-10 16:17:11 +08:00
5 changed files with 33 additions and 33 deletions

View File

@ -37,7 +37,7 @@
<el-cascader
style="width: 100%"
filterable
v-model="scope.row.subjectId"
v-model="scope.row.subjectCode"
:options="deptOptions"
:props="defaultProps"
/>
@ -121,7 +121,7 @@ const props: any = defineProps({
const defaultProps: any = ref({
expandTrigger: 'hover',
label: 'name',
value: 'id',
value: 'code',
children: 'children',
checkStrictly: false,
emitPath: false,
@ -145,7 +145,7 @@ interface VoucherItem {
id: null;
summary: string;
direction: string;
subjectId: number | null;
subjectCode: string | null;
selectedValue: string;
// 其他可能的字段...
[key: string]: any; // 这允许添加其他可能从后端返回的字段
@ -193,7 +193,7 @@ function reset(): any {
id: null,
summary: summaryTemplate,
direction: "1",
subjectId: props.deptOptions?.[0]?.id || null,
subjectCode: props.deptOptions?.[0]?.code || null,
selectedValue: salary_values.value[0].value,
}]
@ -209,7 +209,7 @@ function addRecord() {
id: null,
summary: summaryTemplate,
direction: "1",
subjectId: props.deptOptions?.[0]?.id || null,
subjectCode: props.deptOptions?.[0]?.code || null,
selectedValue: salary_values.value[0].value,
});
}

View File

@ -1,12 +1,12 @@
/*
* Copyright [2025] [JinBooks of copyright http://www.jinbooks.com]
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.jinbooks.entity.hr;
@ -46,8 +46,6 @@ public class EmployeeSalaryVoucherRule extends BaseEntity {
private String direction;
private String subjectId;
private String templateId;
private String selectedValue;
@ -55,6 +53,5 @@ public class EmployeeSalaryVoucherRule extends BaseEntity {
@TableField(exist = false)
private String subjectName;
@TableField(exist = false)
private String subjectCode;
}

View File

@ -1,12 +1,12 @@
/*
* Copyright [2025] [JinBooks of copyright http://www.jinbooks.com]
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.jinbooks.entity.hr.dto;
@ -39,8 +39,8 @@ public class SalaryTemplateDetailDto {
@NotEmpty(message = "借贷方向不能为空", groups = {AddGroup.class, EditGroup.class})
private String direction;
@NotEmpty(message = "科目不能为空", groups = {AddGroup.class, EditGroup.class})
private String subjectId;
@NotEmpty(message = "科目编码不能为空", groups = {AddGroup.class, EditGroup.class})
private String subjectCode;
@NotEmpty(message = "取值不能为空", groups = {AddGroup.class, EditGroup.class})
private String selectedValue;

View File

@ -1,12 +1,12 @@
/*
* Copyright [2025] [JinBooks of copyright http://www.jinbooks.com]
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.jinbooks.persistence.service.impl;
@ -80,7 +80,7 @@ public class EmployeeSalarySummaryServiceImpl extends ServiceImpl<EmployeeSalary
@Autowired
BookSubjectMapper bookSubjectMapper;
@Autowired
ConfigSysService configSysService;
@ -182,7 +182,7 @@ public class EmployeeSalarySummaryServiceImpl extends ServiceImpl<EmployeeSalary
};
boolean isDebit = "1".equals(rule.getDirection());
voucherItems.add(createVoucherItemDto(rule, isDebit, amount));
voucherItems.add(createVoucherItemDto(bookId, rule, isDebit, amount));
if (isDebit) {
debitAmount = debitAmount.add(amount);
@ -259,14 +259,17 @@ public class EmployeeSalarySummaryServiceImpl extends ServiceImpl<EmployeeSalary
/**
* Creates a voucher item dto based on rule and direction
*/
private VoucherItemChangeDto createVoucherItemDto(
private VoucherItemChangeDto createVoucherItemDto(String bookId,
EmployeeSalaryVoucherRule rule, boolean isDebit, BigDecimal amount) {
BookSubject bookSubject = bookSubjectMapper.selectById(rule.getSubjectId());
LambdaQueryWrapper<BookSubject> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookSubject::getBookId, bookId);
wrapper.eq(BookSubject::getCode, rule.getSubjectCode());
BookSubject bookSubject = bookSubjectMapper.selectOne(wrapper);
VoucherItemChangeDto itemDto = new VoucherItemChangeDto();
itemDto.setSummary(rule.getSummary());
itemDto.setSubjectId(rule.getSubjectId());
itemDto.setSubjectId(bookSubject.getId());
if (isDebit) {
itemDto.setDebitAmount(amount);
} else {

View File

@ -1,12 +1,12 @@
/*
* Copyright [2025] [JinBooks of copyright http://www.jinbooks.com]
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.jinbooks.persistence.service.impl;
@ -266,7 +266,7 @@ public class EmployeeSalaryVoucherRuleServiceImpl extends ServiceImpl<EmployeeSa
// 设置属性
rule.setSummary(dto.getSummary());
rule.setDirection(dto.getDirection());
rule.setSubjectId(dto.getSubjectId());
rule.setSubjectCode(dto.getSubjectCode());
rule.setSelectedValue(dto.getSelectedValue());
// 设置其他属性...
return rule;
@ -276,7 +276,7 @@ public class EmployeeSalaryVoucherRuleServiceImpl extends ServiceImpl<EmployeeSa
// 更新属性
rule.setSummary(dto.getSummary());
rule.setDirection(dto.getDirection());
rule.setSubjectId(dto.getSubjectId());;
rule.setSubjectCode(dto.getSubjectCode());
rule.setSelectedValue(dto.getSelectedValue());
// 更新其他属性...
}