feat(oa): 添加日记账批量更新接口并优化流程实例启动逻辑

- 在 IOaJournalAccountService 中添加 batchUpdate 方法
- 在 OaJournalAccountBo 中添加 journalIds 字段用于批量更新
- 实现 OaJournalAccountController 中的 batchUpdate 接口
- 在 OaJournalAccountServiceImpl 中实现 batchUpdate 方法,用于批量更新日记账的 batchId
- 优化 WfProcessServiceImpl 中的 startProcess
This commit is contained in:
2025-09-15 15:29:51 +08:00
parent 7b74ae82a7
commit 743c3133a6
5 changed files with 117 additions and 1 deletions

View File

@@ -46,4 +46,6 @@ public interface IOaJournalAccountService {
* 校验并批量删除日记账绑定封账批次未封账数据batch_id为NULL信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
int batchUpdate(OaJournalAccountBo bo);
}

View File

@@ -15,6 +15,7 @@ import com.ruoyi.oa.domain.vo.OaJournalAccountVo;
import com.ruoyi.oa.domain.OaJournalAccount;
import com.ruoyi.oa.mapper.OaJournalAccountMapper;
import com.ruoyi.oa.service.IOaJournalAccountService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -131,4 +132,38 @@ public class OaJournalAccountServiceImpl implements IOaJournalAccountService {
}
return baseMapper.deleteBatchIds(ids) > 0;
}
@Override
@Transactional
public int batchUpdate(OaJournalAccountBo bo) {
// 参数校验
if (bo.getJournalIds() == null || bo.getJournalIds().isEmpty()) {
return 0;
}
if (bo.getBatchId() == null) {
throw new ServiceException("批次ID不能为空");
}
int count = 0;
// 循环遍历list数组然后修改batchId
for (Long journalId : bo.getJournalIds()) {
// 检查记录是否存在且未封账
OaJournalAccount existing = baseMapper.selectById(journalId);
if (existing == null) {
throw new ServiceException("记录不存在ID: " + journalId);
}
if (existing.getBatchId() != null) {
throw new ServiceException("记录已封账不能重复封账ID: " + journalId);
}
OaJournalAccount oaJournalAccount = new OaJournalAccount();
oaJournalAccount.setJournalId(journalId);
oaJournalAccount.setBatchId(bo.getBatchId());
count += baseMapper.updateById(oaJournalAccount);
}
return count;
}
}