From 9d2df08195f6a0bfd8dc31d27b800abad5ec5a4b Mon Sep 17 00:00:00 2001 From: gaoxq <376340421@qq.com> Date: Thu, 1 Jan 2026 23:01:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BE=85=E5=8A=9E=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/dao/ErpAccountTransferDao.java | 15 + .../erp/entity/ErpAccountTransfer.java | 110 +++++++ .../service/ErpAccountTransferService.java | 134 +++++++++ .../erp/web/ErpAccountTransferController.java | 169 +++++++++++ .../packages/erp/api/erp/accountTransfer.ts | 59 ++++ .../erp/views/erp/accountTransfer/form.vue | 132 +++++++++ .../views/erp/accountTransfer/formImport.vue | 103 +++++++ .../erp/views/erp/accountTransfer/list.vue | 269 ++++++++++++++++++ 8 files changed, 991 insertions(+) create mode 100644 web-api/src/main/java/com/jeesite/modules/erp/dao/ErpAccountTransferDao.java create mode 100644 web-api/src/main/java/com/jeesite/modules/erp/entity/ErpAccountTransfer.java create mode 100644 web-api/src/main/java/com/jeesite/modules/erp/service/ErpAccountTransferService.java create mode 100644 web-api/src/main/java/com/jeesite/modules/erp/web/ErpAccountTransferController.java create mode 100644 web-vue/packages/erp/api/erp/accountTransfer.ts create mode 100644 web-vue/packages/erp/views/erp/accountTransfer/form.vue create mode 100644 web-vue/packages/erp/views/erp/accountTransfer/formImport.vue create mode 100644 web-vue/packages/erp/views/erp/accountTransfer/list.vue diff --git a/web-api/src/main/java/com/jeesite/modules/erp/dao/ErpAccountTransferDao.java b/web-api/src/main/java/com/jeesite/modules/erp/dao/ErpAccountTransferDao.java new file mode 100644 index 00000000..6276402a --- /dev/null +++ b/web-api/src/main/java/com/jeesite/modules/erp/dao/ErpAccountTransferDao.java @@ -0,0 +1,15 @@ +package com.jeesite.modules.erp.dao; + +import com.jeesite.common.dao.CrudDao; +import com.jeesite.common.mybatis.annotation.MyBatisDao; +import com.jeesite.modules.erp.entity.ErpAccountTransfer; + +/** + * 账号转账流水表DAO接口 + * @author gaoxq + * @version 2026-01-01 + */ +@MyBatisDao(dataSourceName="work") +public interface ErpAccountTransferDao extends CrudDao { + +} \ No newline at end of file diff --git a/web-api/src/main/java/com/jeesite/modules/erp/entity/ErpAccountTransfer.java b/web-api/src/main/java/com/jeesite/modules/erp/entity/ErpAccountTransfer.java new file mode 100644 index 00000000..293b9ee7 --- /dev/null +++ b/web-api/src/main/java/com/jeesite/modules/erp/entity/ErpAccountTransfer.java @@ -0,0 +1,110 @@ +package com.jeesite.modules.erp.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import com.jeesite.common.mybatis.annotation.JoinTable; +import com.jeesite.common.mybatis.annotation.JoinTable.Type; + +import com.jeesite.common.entity.DataEntity; +import com.jeesite.common.mybatis.annotation.Column; +import com.jeesite.common.mybatis.annotation.Table; +import com.jeesite.common.mybatis.mapper.query.QueryType; +import com.jeesite.common.utils.excel.annotation.ExcelField; +import com.jeesite.common.utils.excel.annotation.ExcelField.Align; +import com.jeesite.common.utils.excel.annotation.ExcelFields; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 账号转账流水表Entity + * + * @author gaoxq + * @version 2026-01-01 + */ +@EqualsAndHashCode(callSuper = true) +@Table(name = "erp_account_transfer", alias = "a", label = "转账信息信息", columns = { + @Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true), + @Column(name = "transfer_id", attrName = "transferId", label = "转账标识", isPK = true), + @Column(name = "transfer_name", attrName = "transferName", label = "转账说明", queryType = QueryType.LIKE), + @Column(name = "out_account_id", attrName = "outAccountId", label = "转出账号"), + @Column(name = "in_account_id", attrName = "inAccountId", label = "转入账号"), + @Column(name = "transfer_amount", attrName = "transferAmount", label = "转账金额", isQuery = false), + @Column(name = "transfer_status", attrName = "transferStatus", label = "转账状态"), + @Column(name = "remark", attrName = "remark", label = "转账备注"), + @Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户标识", isUpdate = false, isQuery = false), + @Column(name = "f_flow_id", attrName = "fflowId", label = "流程标识", isUpdate = false, isQuery = false), + @Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false), + @Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true), +}, joinTable = { + @JoinTable(type = Type.LEFT_JOIN, entity = ErpAccount.class, attrName = "this", alias = "b", + on = "a.out_account_id = b.account_id", + columns = { + @Column(name = "account_name", attrName = "accountOutName", label = "账户名称"), + }), + @JoinTable(type = Type.LEFT_JOIN, entity = ErpAccount.class, attrName = "this", alias = "c", + on = "a.in_account_id = c.account_id", + columns = { + @Column(name = "account_name", attrName = "accountInName", label = "账户名称"), + }), +}, orderBy = "a.create_time DESC" +) +@Data +public class ErpAccountTransfer extends DataEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + private Date createTime; // 记录时间 + private String transferId; // 转账标识 + private String transferName; // 转账说明 + private String outAccountId; // 转出账号 + private String inAccountId; // 转入账号 + private BigDecimal transferAmount; // 转账金额 + private String transferStatus; // 转账状态 + private String remark; // 转账备注 + private String ftenantId; // 租户标识 + private String fflowId; // 流程标识 + private String fflowTaskId; // 流程任务主键 + private Integer fflowState; // 流程任务状态 + + private String accountOutName; + private String accountInName; + + @ExcelFields({ + @ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"), + @ExcelField(title = "转账标识", attrName = "transferId", align = Align.CENTER, sort = 20), + @ExcelField(title = "转账说明", attrName = "transferName", align = Align.CENTER, sort = 30), + @ExcelField(title = "转出账号", attrName = "accountOutName", align = Align.CENTER, sort = 40), + @ExcelField(title = "转入账号", attrName = "accountInName", align = Align.CENTER, sort = 50), + @ExcelField(title = "转账金额", attrName = "transferAmount", align = Align.CENTER, sort = 60), + @ExcelField(title = "转账状态", attrName = "transferStatus", dictType = "transfer_status", align = Align.CENTER, sort = 70), + @ExcelField(title = "转账备注", attrName = "remark", align = Align.CENTER, sort = 80), + }) + public ErpAccountTransfer() { + this(null); + } + + public ErpAccountTransfer(String id) { + super(id); + } + + public Date getCreateTime_gte() { + return sqlMap.getWhere().getValue("create_time", QueryType.GTE); + } + + public void setCreateTime_gte(Date createTime) { + sqlMap.getWhere().and("create_time", QueryType.GTE, createTime); + } + + public Date getCreateTime_lte() { + return sqlMap.getWhere().getValue("create_time", QueryType.LTE); + } + + public void setCreateTime_lte(Date createTime) { + sqlMap.getWhere().and("create_time", QueryType.LTE, createTime); + } + +} \ No newline at end of file diff --git a/web-api/src/main/java/com/jeesite/modules/erp/service/ErpAccountTransferService.java b/web-api/src/main/java/com/jeesite/modules/erp/service/ErpAccountTransferService.java new file mode 100644 index 00000000..d70e192a --- /dev/null +++ b/web-api/src/main/java/com/jeesite/modules/erp/service/ErpAccountTransferService.java @@ -0,0 +1,134 @@ +package com.jeesite.modules.erp.service; + +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.jeesite.common.entity.Page; +import com.jeesite.common.service.CrudService; +import com.jeesite.modules.erp.entity.ErpAccountTransfer; +import com.jeesite.modules.erp.dao.ErpAccountTransferDao; +import com.jeesite.common.service.ServiceException; +import com.jeesite.common.config.Global; +import com.jeesite.common.validator.ValidatorUtils; +import com.jeesite.common.utils.excel.ExcelImport; +import org.springframework.web.multipart.MultipartFile; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.ConstraintViolationException; + +/** + * 账号转账流水表Service + * @author gaoxq + * @version 2026-01-01 + */ +@Service +public class ErpAccountTransferService extends CrudService { + + /** + * 获取单条数据 + * @param erpAccountTransfer 主键 + */ + @Override + public ErpAccountTransfer get(ErpAccountTransfer erpAccountTransfer) { + return super.get(erpAccountTransfer); + } + + /** + * 查询分页数据 + * @param erpAccountTransfer 查询条件 + * @param erpAccountTransfer page 分页对象 + */ + @Override + public Page findPage(ErpAccountTransfer erpAccountTransfer) { + return super.findPage(erpAccountTransfer); + } + + /** + * 查询列表数据 + * @param erpAccountTransfer 查询条件 + */ + @Override + public List findList(ErpAccountTransfer erpAccountTransfer) { + return super.findList(erpAccountTransfer); + } + + /** + * 保存数据(插入或更新) + * @param erpAccountTransfer 数据对象 + */ + @Override + @Transactional + public void save(ErpAccountTransfer erpAccountTransfer) { + super.save(erpAccountTransfer); + } + + /** + * 导入数据 + * @param file 导入的数据文件 + */ + @Transactional + public String importData(MultipartFile file) { + if (file == null){ + throw new ServiceException(text("请选择导入的数据文件!")); + } + int successNum = 0; int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + try(ExcelImport ei = new ExcelImport(file, 2, 0)){ + List list = ei.getDataList(ErpAccountTransfer.class); + for (ErpAccountTransfer erpAccountTransfer : list) { + try{ + ValidatorUtils.validateWithException(erpAccountTransfer); + this.save(erpAccountTransfer); + successNum++; + successMsg.append("
" + successNum + "、编号 " + erpAccountTransfer.getId() + " 导入成功"); + } catch (Exception e) { + failureNum++; + String msg = "
" + failureNum + "、编号 " + erpAccountTransfer.getId() + " 导入失败:"; + if (e instanceof ConstraintViolationException){ + ConstraintViolationException cve = (ConstraintViolationException)e; + for (ConstraintViolation violation : cve.getConstraintViolations()) { + msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")"; + } + }else{ + msg += e.getMessage(); + } + failureMsg.append(msg); + logger.error(msg, e); + } + } + } catch (Exception e) { + logger.error(e.getMessage(), e); + failureMsg.append(e.getMessage()); + return failureMsg.toString(); + } + if (failureNum > 0) { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + }else{ + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + } + return successMsg.toString(); + } + + /** + * 更新状态 + * @param erpAccountTransfer 数据对象 + */ + @Override + @Transactional + public void updateStatus(ErpAccountTransfer erpAccountTransfer) { + super.updateStatus(erpAccountTransfer); + } + + /** + * 删除数据 + * @param erpAccountTransfer 数据对象 + */ + @Override + @Transactional + public void delete(ErpAccountTransfer erpAccountTransfer) { + super.delete(erpAccountTransfer); + } + +} \ No newline at end of file diff --git a/web-api/src/main/java/com/jeesite/modules/erp/web/ErpAccountTransferController.java b/web-api/src/main/java/com/jeesite/modules/erp/web/ErpAccountTransferController.java new file mode 100644 index 00000000..530a9c30 --- /dev/null +++ b/web-api/src/main/java/com/jeesite/modules/erp/web/ErpAccountTransferController.java @@ -0,0 +1,169 @@ +package com.jeesite.modules.erp.web; + +import java.util.List; + +import com.jeesite.modules.app.utils.BigDecimalUtils; +import com.jeesite.modules.erp.entity.ErpAccount; +import com.jeesite.modules.erp.service.ErpAccountService; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.jeesite.common.config.Global; +import com.jeesite.common.collect.ListUtils; +import com.jeesite.common.entity.Page; +import com.jeesite.common.lang.DateUtils; +import com.jeesite.common.utils.excel.ExcelExport; +import com.jeesite.common.utils.excel.annotation.ExcelField.Type; +import org.springframework.web.multipart.MultipartFile; +import com.jeesite.common.web.BaseController; +import com.jeesite.modules.erp.entity.ErpAccountTransfer; +import com.jeesite.modules.erp.service.ErpAccountTransferService; + +/** + * 账号转账流水表Controller + * + * @author gaoxq + * @version 2026-01-01 + */ +@Controller +@RequestMapping(value = "${adminPath}/erp/accountTransfer") +public class ErpAccountTransferController extends BaseController { + + + @Resource + private ErpAccountService erpAccountService; + + private final ErpAccountTransferService erpAccountTransferService; + + public ErpAccountTransferController(ErpAccountTransferService erpAccountTransferService) { + this.erpAccountTransferService = erpAccountTransferService; + } + + /** + * 获取数据 + */ + @ModelAttribute + public ErpAccountTransfer get(String transferId, boolean isNewRecord) { + return erpAccountTransferService.get(transferId, isNewRecord); + } + + /** + * 查询列表 + */ + @RequiresPermissions("erp:accountTransfer:view") + @RequestMapping(value = {"list", ""}) + public String list(ErpAccountTransfer erpAccountTransfer, Model model) { + model.addAttribute("erpAccountTransfer", erpAccountTransfer); + return "modules/erp/erpAccountTransferList"; + } + + /** + * 查询列表数据 + */ + @RequiresPermissions("erp:accountTransfer:view") + @RequestMapping(value = "listData") + @ResponseBody + public Page listData(ErpAccountTransfer erpAccountTransfer, HttpServletRequest request, HttpServletResponse response) { + erpAccountTransfer.setPage(new Page<>(request, response)); + Page page = erpAccountTransferService.findPage(erpAccountTransfer); + return page; + } + + /** + * 查看编辑表单 + */ + @RequiresPermissions("erp:accountTransfer:view") + @RequestMapping(value = "form") + public String form(ErpAccountTransfer erpAccountTransfer, Model model) { + model.addAttribute("erpAccountTransfer", erpAccountTransfer); + return "modules/erp/erpAccountTransferForm"; + } + + /** + * 保存数据 + */ + @RequiresPermissions("erp:accountTransfer:edit") + @PostMapping(value = "save") + @ResponseBody + public String save(@Validated ErpAccountTransfer erpAccountTransfer) { + erpAccountTransferService.save(erpAccountTransfer); + return renderResult(Global.TRUE, text("保存转账信息成功!")); + } + + /** + * 导出数据 + */ + @RequiresPermissions("erp:accountTransfer:view") + @RequestMapping(value = "exportData") + public void exportData(ErpAccountTransfer erpAccountTransfer, HttpServletResponse response) { + List list = erpAccountTransferService.findList(erpAccountTransfer); + String fileName = "转账信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx"; + try (ExcelExport ee = new ExcelExport("转账信息", ErpAccountTransfer.class)) { + ee.setDataList(list).write(response, fileName); + } + } + + /** + * 下载模板 + */ + @RequiresPermissions("erp:accountTransfer:view") + @RequestMapping(value = "importTemplate") + public void importTemplate(HttpServletResponse response) { + ErpAccountTransfer erpAccountTransfer = new ErpAccountTransfer(); + List list = ListUtils.newArrayList(erpAccountTransfer); + String fileName = "转账信息模板.xlsx"; + try (ExcelExport ee = new ExcelExport("转账信息", ErpAccountTransfer.class, Type.IMPORT)) { + ee.setDataList(list).write(response, fileName); + } + } + + /** + * 导入数据 + */ + @ResponseBody + @RequiresPermissions("erp:accountTransfer:edit") + @PostMapping(value = "importData") + public String importData(MultipartFile file) { + try { + String message = erpAccountTransferService.importData(file); + return renderResult(Global.TRUE, "posfull:" + message); + } catch (Exception ex) { + return renderResult(Global.FALSE, "posfull:" + ex.getMessage()); + } + } + + /** + * 删除数据 + */ + @RequiresPermissions("erp:accountTransfer:edit") + @RequestMapping(value = "delete") + @ResponseBody + public String delete(ErpAccountTransfer erpAccountTransfer) { + erpAccountTransferService.delete(erpAccountTransfer); + return renderResult(Global.TRUE, text("删除转账信息成功!")); + } + + @RequiresPermissions("erp:accountTransfer:edit") + @RequestMapping(value = "finish") + @ResponseBody + public String finish(ErpAccountTransfer erpAccountTransfer) { + ErpAccountTransfer transfer = erpAccountTransferService.get(erpAccountTransfer); + ErpAccount outAccount = erpAccountService.get(transfer.getOutAccountId()); + ErpAccount inAccount = erpAccountService.get(transfer.getInAccountId()); + outAccount.setCurrentBalance(BigDecimalUtils.subtract(outAccount.getCurrentBalance(), transfer.getTransferAmount())); + inAccount.setCurrentBalance(BigDecimalUtils.add(inAccount.getCurrentBalance(), transfer.getTransferAmount())); + erpAccountService.save(inAccount); + erpAccountService.save(outAccount); + return renderResult(Global.TRUE, text("转入账户成功!")); + } +} \ No newline at end of file diff --git a/web-vue/packages/erp/api/erp/accountTransfer.ts b/web-vue/packages/erp/api/erp/accountTransfer.ts new file mode 100644 index 00000000..6d28185d --- /dev/null +++ b/web-vue/packages/erp/api/erp/accountTransfer.ts @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. + * @author gaoxq + */ +import { defHttp } from '@jeesite/core/utils/http/axios'; +import { useGlobSetting } from '@jeesite/core/hooks/setting'; +import { BasicModel, Page } from '@jeesite/core/api/model/baseModel'; +import { UploadApiResult } from '@jeesite/core/api/sys/upload'; +import { UploadFileParams } from '@jeesite/types/axios'; +import { AxiosProgressEvent } from 'axios'; + +const { ctxPath, adminPath } = useGlobSetting(); + +export interface ErpAccountTransfer extends BasicModel { + createTime?: string; // 记录时间 + transferId?: string; // 转账标识 + transferName: string; // 转账说明 + outAccountId: string; // 转出账号 + inAccountId: string; // 转入账号 + transferAmount: number; // 转账金额 + transferStatus?: string; // 转账状态 + remark?: string; // 转账备注 + ftenantId?: string; // 租户标识 + fflowId?: string; // 流程标识 + fflowTaskId?: string; // 流程任务主键 + fflowState?: number; // 流程任务状态 +} + +export const erpAccountTransferList = (params?: ErpAccountTransfer | any) => + defHttp.get({ url: adminPath + '/erp/accountTransfer/list', params }); + +export const erpAccountTransferListData = (params?: ErpAccountTransfer | any) => + defHttp.post>({ url: adminPath + '/erp/accountTransfer/listData', params }); + +export const erpAccountTransferForm = (params?: ErpAccountTransfer | any) => + defHttp.get({ url: adminPath + '/erp/accountTransfer/form', params }); + +export const erpAccountTransferSave = (params?: any, data?: ErpAccountTransfer | any) => + defHttp.postJson({ url: adminPath + '/erp/accountTransfer/save', params, data }); + +export const erpAccountTransferImportData = ( + params: UploadFileParams, + onUploadProgress: (progressEvent: AxiosProgressEvent) => void, +) => + defHttp.uploadFile( + { + url: ctxPath + adminPath + '/erp/accountTransfer/importData', + onUploadProgress, + }, + params, + ); + +export const erpAccountTransferDelete = (params?: ErpAccountTransfer | any) => + defHttp.get({ url: adminPath + '/erp/accountTransfer/delete', params }); + +export const erpAccountTransferFinish = (params?: ErpAccountTransfer | any) => + defHttp.get({ url: adminPath + '/erp/accountTransfer/finish', params }); + diff --git a/web-vue/packages/erp/views/erp/accountTransfer/form.vue b/web-vue/packages/erp/views/erp/accountTransfer/form.vue new file mode 100644 index 00000000..a491e879 --- /dev/null +++ b/web-vue/packages/erp/views/erp/accountTransfer/form.vue @@ -0,0 +1,132 @@ + + + diff --git a/web-vue/packages/erp/views/erp/accountTransfer/formImport.vue b/web-vue/packages/erp/views/erp/accountTransfer/formImport.vue new file mode 100644 index 00000000..8f580d9f --- /dev/null +++ b/web-vue/packages/erp/views/erp/accountTransfer/formImport.vue @@ -0,0 +1,103 @@ + + + diff --git a/web-vue/packages/erp/views/erp/accountTransfer/list.vue b/web-vue/packages/erp/views/erp/accountTransfer/list.vue new file mode 100644 index 00000000..4c7f16c1 --- /dev/null +++ b/web-vue/packages/erp/views/erp/accountTransfer/list.vue @@ -0,0 +1,269 @@ + + +