wujianwei
2026-01-19 fc236fc10f2bda6aa9419753c5cb284155026fa2
service/src/main/java/com/ruoyi/cwgl/service/impl/FundFlowServiceImpl.java
@@ -17,7 +17,9 @@
import com.ruoyi.cwgl.mapper.FundFlowMapper;
import com.ruoyi.cwgl.domain.FundFlow;
import com.ruoyi.cwgl.domain.FundFlowLog;
import com.ruoyi.cwgl.service.IFundFlowService;
import com.ruoyi.cwgl.service.IFundFlowLogService;
import com.ruoyi.common.core.text.Convert;
/**
@@ -33,6 +35,8 @@
    protected final Logger logger = LoggerFactory.getLogger(getClass());
    @Resource
    private FundFlowMapper fundFlowMapper;
    @Resource
    private IFundFlowLogService fundFlowLogService;
    /**
@@ -103,7 +107,17 @@
    public int insertFundFlow(FundFlow fundFlow)
    {
        fundFlow.setCreateTime(DateUtils.getNowDate());
        return fundFlowMapper.insertFundFlow(fundFlow);
        int result = fundFlowMapper.insertFundFlow(fundFlow);
        // 记录操作日志
        if (result > 0) {
            FundFlowLog log = new FundFlowLog();
            log.setFlowId(fundFlow.getId());
            log.setOperation("新增资金流水,流水号:" + fundFlow.getBankFlowNo());
            fundFlowLogService.insertFundFlowLog(log);
        }
        return result;
    }
    /**
@@ -129,7 +143,17 @@
    public int updateFundFlow(FundFlow fundFlow)
    {
        fundFlow.setUpdateTime(DateUtils.getNowDate());
        return fundFlowMapper.updateFundFlow(fundFlow);
        int result = fundFlowMapper.updateFundFlow(fundFlow);
        // 记录操作日志
        if (result > 0) {
            FundFlowLog log = new FundFlowLog();
            log.setFlowId(fundFlow.getId());
            log.setOperation("修改资金流水,流水号:" + fundFlow.getBankFlowNo());
            fundFlowLogService.insertFundFlowLog(log);
        }
        return result;
    }
    /**
@@ -179,4 +203,39 @@
    {
        return fundFlowMapper.deleteFundFlowById(id);
    }
    /**
     * 确认资金流水(将状态改为待认领)
     *
     * @param id 资金流水ID
     * @return 结果
     */
    @Override
    public int confirmFundFlow(Integer id)
    {
        // 先查询资金流水信息
        FundFlow fundFlow = fundFlowMapper.selectFundFlowById(id);
        if (fundFlow == null) {
            throw new RuntimeException("资金流水不存在");
        }
        // 判断状态是否为0(正常)才能确认
        if (!"0".equals(fundFlow.getStatus())) {
            throw new RuntimeException("只有状态为草稿的资金流水才能确认");
        }
        // 将状态改为"1"(待认领)
        fundFlow.setStatus("1");
        int result = fundFlowMapper.updateFundFlow(fundFlow);
        // 记录操作日志
        if (result > 0) {
            FundFlowLog log = new FundFlowLog();
            log.setFlowId(id);
            log.setOperation("确认资金流水,流水号:" + fundFlow.getBankFlowNo() + ",状态从草稿改为待认领");
            fundFlowLogService.insertFundFlowLog(log);
        }
        return result;
    }
}