package com.ruoyi.cwgl.service.impl; import java.util.Date; import java.util.List; import com.ruoyi.common.utils.DateUtils; import javax.annotation.Resource; import com.ruoyi.common.utils.SecurityUtils; import org.springframework.transaction.annotation.Transactional; import org.springframework.stereotype.Service; import org.springframework.scheduling.annotation.Async; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.core.service.BaseService; import com.ruoyi.cwgl.mapper.EstimatedReceivableLogMapper; import com.ruoyi.cwgl.domain.EstimatedReceivableLog; import com.ruoyi.cwgl.service.IEstimatedReceivableLogService; import com.ruoyi.common.core.text.Convert; /** * 预估应收管理日志Service业务层处理 * * @author ruoyi * @date 2025-08-13 */ @Service @Transactional(rollbackFor = Exception.class) public class EstimatedReceivableLogServiceImpl extends BaseService implements IEstimatedReceivableLogService { protected final Logger logger = LoggerFactory.getLogger(getClass()); @Resource private EstimatedReceivableLogMapper estimatedReceivableLogMapper; /** * 查询预估应收管理日志 * * @param id 预估应收管理日志ID * @return 预估应收管理日志 */ @DataSource(DataSourceType.SLAVE) @Override public EstimatedReceivableLog selectEstimatedReceivableLogById(Integer id) { return estimatedReceivableLogMapper.selectEstimatedReceivableLogById(id); } /** * 查询预估应收管理日志 记录数 * * @param estimatedReceivableLog 预估应收管理日志 * @return 预估应收管理日志集合 */ @DataSource(DataSourceType.SLAVE) @Override public int selectEstimatedReceivableLogCount(EstimatedReceivableLog estimatedReceivableLog) { return estimatedReceivableLogMapper.selectEstimatedReceivableLogCount(estimatedReceivableLog); } /** * 查询预估应收管理日志列表 * * @param estimatedReceivableLog 预估应收管理日志 * @return 预估应收管理日志 */ @DataSource(DataSourceType.SLAVE) @Override public List selectEstimatedReceivableLogList(EstimatedReceivableLog estimatedReceivableLog) { return estimatedReceivableLogMapper.selectEstimatedReceivableLogList(estimatedReceivableLog); } /** * 查询预估应收管理日志列表 异步 导出 * * @param estimatedReceivableLog 预估应收管理日志 * @param exportKey 导出功能的唯一标识 * @return 预估应收管理日志集合 */ @DataSource(DataSourceType.SLAVE) @Async @Override public void export(EstimatedReceivableLog estimatedReceivableLog,String exportKey) { super.export(EstimatedReceivableLog.class,exportKey,"estimatedReceivableLogData",(pageNum)->{ PageUtils.startPage(pageNum, Constants.EXPORT_PATE_SIZE); return selectEstimatedReceivableLogList(estimatedReceivableLog); }); } /** * 新增预估应收管理日志 * * @param estimatedReceivableLog 预估应收管理日志 * @return 结果 */ @Override public int insertEstimatedReceivableLog(EstimatedReceivableLog estimatedReceivableLog) { estimatedReceivableLog.setCreateTime(DateUtils.getNowDate()); return estimatedReceivableLogMapper.insertEstimatedReceivableLog(estimatedReceivableLog); } /** * 新增预估应收管理日志[批量] * * @param estimatedReceivableLogs 预估应收管理日志 * @return 结果 */ @Override public int insertEstimatedReceivableLogBatch(List estimatedReceivableLogs) { int rows = estimatedReceivableLogMapper.insertEstimatedReceivableLogBatch(estimatedReceivableLogs); return rows; } /** * 修改预估应收管理日志 * * @param estimatedReceivableLog 预估应收管理日志 * @return 结果 */ @Override public int updateEstimatedReceivableLog(EstimatedReceivableLog estimatedReceivableLog) { return estimatedReceivableLogMapper.updateEstimatedReceivableLog(estimatedReceivableLog); } /** * 修改预估应收管理日志[批量] * * @param estimatedReceivableLogs 预估应收管理日志 * @return 结果 */ @Override public int updateEstimatedReceivableLogBatch(List estimatedReceivableLogs){ return estimatedReceivableLogMapper.updateEstimatedReceivableLogBatch(estimatedReceivableLogs); } /** * 删除预估应收管理日志对象 * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteEstimatedReceivableLogByIds(String ids) { return deleteEstimatedReceivableLogByIds(Convert.toIntArray(ids)); } /** * 删除预估应收管理日志对象 * * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteEstimatedReceivableLogByIds(Integer[] ids) { return estimatedReceivableLogMapper.deleteEstimatedReceivableLogByIds(ids); } /** * 删除预估应收管理日志信息 * * @param id 预估应收管理日志ID * @return 结果 */ @Override public int deleteEstimatedReceivableLogById(Integer id) { return estimatedReceivableLogMapper.deleteEstimatedReceivableLogById(id); } @Override public void insertEstimatedReceivableLog(String operation, Integer id,String userName ) { EstimatedReceivableLog estimatedReceivableLog = new EstimatedReceivableLog(); estimatedReceivableLog.setCreateBy(userName); estimatedReceivableLog.setCreateTime(new Date()); estimatedReceivableLog.setEstimatedId(id); estimatedReceivableLog.setOperation(operation); estimatedReceivableLogMapper.insertEstimatedReceivableLog(estimatedReceivableLog); } }