初始化项目

This commit is contained in:
2026-03-22 22:44:27 +08:00
parent 3ec3a07cd3
commit bff3b3bd78
9 changed files with 114 additions and 76 deletions

View File

@@ -80,25 +80,45 @@ public class erpFlowService {
*/
public void addDebt(ErpDebtRecords erpDebtRecords) {
ErpDebts debts = erpDebtsService.get(erpDebtRecords.getDebtId());
ErpCategory category = erpCategoryService.get(debts.getCategoryId());
ErpAccount account = erpAccountService.get(erpDebtRecords.getAccountId());
ErpCategory category = erpCategoryService.get(erpDebtRecords.getCategoryId());
debts.setRemaining(BigDecimalUtils.add(debts.getRemaining(),erpDebtRecords.getRepayAmount()));
debts.setRemaining(BigDecimalUtils.add(debts.getRemaining(), erpDebtRecords.getRepayAmount()));
erpDebtsService.save(debts);
account.setUpdateTime(new Date());
account.setCurrentBalance(BigDecimalUtils.subtract(account.getCurrentBalance(), erpDebtRecords.getRepayAmount()));
erpAccountService.save(account);
addFlow(
erpDebtRecords.getDebtName(), // 交易名称
category.getCategoryType(), // 交易类型
erpDebtRecords.getRepayAmount(), // 交易金额
erpDebtRecords.getAccountId(), // 账户ID
erpDebtRecords.getCategoryId(), // 分类ID
erpDebtRecords.getRemark(), // 备注
erpDebtRecords.getDebtId(), // 业务ID
DateUtils.getCurrentYear(), // 年份
DateUtils.getCurrentMonth() //
);
if (debts.getDebtType().equals("1")) {
account.setUpdateTime(new Date());
account.setCurrentBalance(BigDecimalUtils.subtract(account.getCurrentBalance(), erpDebtRecords.getRepayAmount()));
erpAccountService.save(account);
addFlow(
erpDebtRecords.getDebtName(), // 交易名称
category.getCategoryType(), // 交易类型
erpDebtRecords.getRepayAmount(), // 交易金额
erpDebtRecords.getAccountId(), // 账户ID
debts.getCategoryId(), // 分类ID
erpDebtRecords.getRemark(), // 备注
erpDebtRecords.getDebtId(), // 业务ID
DateUtils.getCurrentYear(), //
DateUtils.getCurrentMonth() // 月份
);
}
if (debts.getDebtType().equals("2")) {
account.setUpdateTime(new Date());
account.setCurrentBalance(BigDecimalUtils.add(account.getCurrentBalance(), erpDebtRecords.getRepayAmount()));
erpAccountService.save(account);
addFlow(
erpDebtRecords.getDebtName(), // 交易名称
category.getCategoryType(), // 交易类型
erpDebtRecords.getRepayAmount(), // 交易金额
erpDebtRecords.getAccountId(), // 账户ID
debts.getCategoryId(), // 分类ID
erpDebtRecords.getRemark(), // 备注
erpDebtRecords.getDebtId(), // 业务ID
DateUtils.getCurrentYear(), // 年份
DateUtils.getCurrentMonth() // 月份
);
}
}
/**

View File

@@ -37,7 +37,6 @@ import java.io.Serial;
@Column(name = "account_id", attrName = "accountId", label = "账户标识"),
@Column(name = "repay_amount", attrName = "repayAmount", label = "还款金额", isQuery = false),
@Column(name = "repay_time", attrName = "repayTime", label = "还款时间", isQuery = false, isUpdateForce = true),
@Column(name = "category_id", attrName = "categoryId", label = "分类标识"),
@Column(name = "remark", attrName = "remark", label = "备注说明", queryType = QueryType.LIKE),
@Column(name = "is_recorded", attrName = "isRecorded", label = "是否记账"),
}, joinTable = {
@@ -51,12 +50,6 @@ import java.io.Serial;
columns = {
@Column(name = "debt_name", attrName = "debtName", label = "对方名称"),
}),
@JoinTable(type = Type.LEFT_JOIN, entity = ErpCategory.class, alias = "d",
on = "a.category_id = d.category_id", attrName = "this",
columns = {
@Column(name = "parent_name", attrName = "parentName", label = "父级名称"),
@Column(name = "category_name", attrName = "categoryName", label = "分类名称"),
}),
}, orderBy = "a.record_id DESC"
)
@Data
@@ -70,17 +63,12 @@ public class ErpDebtRecords extends DataEntity<ErpDebtRecords> implements Serial
private String accountId; // 账户标识
private BigDecimal repayAmount; // 还款金额
private Date repayTime; // 还款时间
private String categoryId;
private String remark; // 备注说明
private String isRecorded;
private String accountName;
private String debtName;
private String parentName;
private String categoryName;
@ExcelFields({
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "唯一标识", attrName = "recordId", align = Align.CENTER, sort = 20),

View File

@@ -39,7 +39,15 @@ import java.io.Serial;
@Column(name = "remaining", attrName = "remaining", label = "未还金额", isQuery = false, isUpdateForce = true),
@Column(name = "end_time", attrName = "endTime", label = "结清时间", isQuery = false, isUpdateForce = true),
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),
@Column(name = "category_id", attrName = "categoryId", label = "分类标识"),
@Column(name = "remark", attrName = "remark", label = "交易备注", isQuery = false),
}, joinTable = {
@JoinTable(type = Type.LEFT_JOIN, entity = ErpCategory.class, alias = "b",
on = "a.category_id = b.category_id", attrName = "this",
columns = {
@Column(name = "parent_name", attrName = "parentName", label = "父级名称"),
@Column(name = "category_name", attrName = "categoryName", label = "分类名称"),
}),
}, orderBy = "a.create_time DESC"
)
@Data
@@ -52,11 +60,17 @@ public class ErpDebts extends DataEntity<ErpDebts> implements Serializable {
private String debtType; // 负债类型
private String debtName; // 对方名称
private BigDecimal debtAmount; // 借贷金额
private BigDecimal remaining; // 还金额
private BigDecimal remaining; // 还金额
private Date endTime; // 结清时间
private String ustatus; // 状态
private String categoryId;
private String remark;
private String parentName;
private String categoryName;
@ExcelFields({
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "唯一标识", attrName = "debtId", align = Align.CENTER, sort = 20),

View File

@@ -19,7 +19,6 @@ export interface ErpDebtRecords extends BasicModel<ErpDebtRecords> {
accountId: string; // 账户标识
repayAmount: number; // 还款金额
repayTime?: string; // 还款时间
categoryId?: string; // 分类标识
remark?: string; // 备注说明
}

View File

@@ -21,6 +21,7 @@ export interface ErpDebts extends BasicModel<ErpDebts> {
remaining?: number; // 已还金额
endTime?: string; // 结清时间
ustatus: string; // 状态
categoryId?: string; // 分类标识
remark?: string; // 交易备注
}

View File

@@ -27,7 +27,6 @@
import { Icon } from '@jeesite/core/components/Icon';
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { ErpCategory, erpCategoryListAll } from '@jeesite/erp/api/erp/category';
import { ErpDebtRecords, erpDebtRecordsSave, erpDebtRecordsForm } from '@jeesite/erp/api/erp/debtRecords';
import { formatToDateTime } from '@jeesite/core/utils/dateUtil';
@@ -37,6 +36,8 @@
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<ErpDebtRecords>({} as ErpDebtRecords);
const categoryParams = ref<Recordable>({ categoryType: '' });
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
@@ -70,36 +71,22 @@
},
required: true,
},
{
label: t('还款分类'),
field: 'categoryId',
component: 'Select',
componentProps: {
api: erpCategoryListAll,
params: {
categoryType: '1'
},
fieldNames: { label: 'categoryName', value: 'categoryId' },
},
required: true,
},
{
label: t('还款金额'),
field: 'repayAmount',
component: 'InputNumber',
componentProps: {
maxlength: 10,
maxlength: 20,
},
required: true,
},
{
label: t('备注说明'),
field: 'remark',
component: 'InputTextArea',
component: 'Input',
componentProps: {
maxlength: 200,
},
colProps: { md: 24, lg: 24 },
},
];

View File

@@ -109,22 +109,6 @@
width: 130,
align: 'left',
},
{
title: t('父级分类'),
dataIndex: 'parentName',
key: 'd.parent_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('还款分类'),
dataIndex: 'categoryName',
key: 'd.category_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('还款金额'),
dataIndex: 'repayAmount',

View File

@@ -27,6 +27,7 @@
import { Icon } from '@jeesite/core/components/Icon';
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { ErpCategory, erpCategoryListAll } from '@jeesite/erp/api/erp/category';
import { ErpDebts, erpDebtsSave, erpDebtsForm } from '@jeesite/erp/api/erp/debts';
import { formatToDateTime } from '@jeesite/core/utils/dateUtil';
@@ -36,6 +37,8 @@
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<ErpDebts>({} as ErpDebts);
const categoryParams = ref<Recordable>({ categoryType: '' });
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
@@ -58,25 +61,49 @@
},
required: true,
},
{
label: t('负债类型'),
field: 'debtType',
component: 'Select',
componentProps: {
dictType: 'debt_type',
allowClear: true,
},
required: true,
},
{
label: t('借贷金额'),
field: 'debtAmount',
component: 'InputNumber',
componentProps: {
maxlength: 10,
maxlength: 20,
},
required: true,
},
{
label: t('负债类型'),
field: 'debtType',
component: 'Select',
componentProps: {
dictType: 'debt_type',
allowClear: true,
onChange: (value: string) => {
categoryParams.value.categoryType = value;
},
},
required: true,
},
{
label: t('借贷分类'),
field: 'categoryId',
component: 'Select',
componentProps: {
api: erpCategoryListAll,
params: categoryParams.value,
fieldNames: { label: 'categoryName', value: 'categoryId' },
},
required: true,
},
{
label: t('已还金额'),
field: 'remaining',
defaultValue: 0,
component: 'InputNumber',
componentProps: {
maxlength: 20,
},
required: true,
},
{
label: t('借贷状态'),
field: 'ustatus',
@@ -107,6 +134,9 @@
const res = await erpDebtsForm(data);
record.value = (res.erpDebts || {}) as ErpDebts;
record.value.__t = new Date().getTime();
if (record.value.debtType) {
categoryParams.value.categoryType = record.value.debtType;
}
await setFieldsValue(record.value);
setModalProps({ loading: false });
});
@@ -122,7 +152,7 @@
data[record.value.isNewRecord ? 'createTime' : 'updateTime'] = formatToDateTime(new Date());
console.log('submit', params, data, record);
// console.log('submit', params, data, record);
const res = await erpDebtsSave(params, data);
showMessage(res.message);
setTimeout(closeModal);

View File

@@ -109,7 +109,6 @@
sorter: true,
width: 130,
align: 'left',
slot: 'bizScopeKey',
},
{
title: t('借贷金额'),
@@ -127,6 +126,22 @@
width: 130,
align: 'right',
},
{
title: t('父级分类'),
dataIndex: 'parentName',
key: 'b.parent_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('借贷分类'),
dataIndex: 'categoryName',
key: 'b.category_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('结清时间'),
dataIndex: 'endTime',