报销接口编写,添加事物

This commit is contained in:
lvleigang 2024-08-19 09:17:09 +08:00
parent 0e717cd182
commit 885b0e4d28
2 changed files with 33 additions and 22 deletions

View File

@ -1,6 +1,7 @@
package com.hzya.frame.grpU8.nxproof.oerdjml.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
@ -32,5 +33,6 @@ public interface IOerDjmlService {
* @param jsonObject
* @return java.lang.Object
**/
@DSTransactional()
Object handleOerDjml(JSONObject jsonObject);
}

View File

@ -1206,6 +1206,7 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
logger.info("组装单据报销明细开始:------>");
List<OerDjnrEntity> oerDjnrEntityList = setOerDjnrEntity(entity,maxDjbh,maxMlId);
logger.info("保存报销明细开始:------>");
if(oerDjnrEntityList != null && oerDjnrEntityList.size() > 0){
for(OerDjnrEntity djnrEntity : oerDjnrEntityList){
djnrEntity.setDataSourceCode(dataSourceCode);
iOerDjnrDao.saveData(djnrEntity);
@ -1219,26 +1220,32 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
oeryszb.setDataSourceCode(dataSourceCode);
iGbiZbsyrecDao.saveData(oeryszb);
}
}
logger.info("组装单据结算方式明细开始:------>");
List<OerDjjsfsEntity> oerDjjsfsEntityList = setOerDjjsfsEntityList(entity,maxDjbh,maxMlId);
logger.info("保存结算方式明细开始:------>");
if(oerDjjsfsEntityList != null && oerDjjsfsEntityList.size() > 0){
for(OerDjjsfsEntity oerdjjsfs :oerDjjsfsEntityList){
oerdjjsfs.setDataSourceCode(dataSourceCode);
iOerDjjsfsDao.saveData(oerdjjsfs);
}
}
//保存日志表PubAuditLog
List<PubAuditLogEntity> pubAuditLogEntityList = setPubAuditLog(entity, maxMlId);
if(pubAuditLogEntityList != null&& pubAuditLogEntityList.size() > 0){
for (PubAuditLogEntity pubAuditLog : pubAuditLogEntityList) {
pubAuditLog.setDataSourceCode(dataSourceCode);
iPubAuditLogDao.saveData(pubAuditLog);
}
}
if(!flag){
//保存节点PUB_OBJ_FLOW
PubObjFlowEntity pubObjFlowEntity = setPubObjFlow(entity, maxMlId);
pubObjFlowEntity.setDataSourceCode(dataSourceCode);
iPubObjFlowDao.saveData(pubObjFlowEntity);
}
return BaseResult.getSuccessMessageEntity("保存报销单成功",maxDjbh);
}
@ -1253,10 +1260,12 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
**/
private List<OerDjnrEntity> setOerDjnrEntity(OerDjmlEntity entity, String maxDjbh, String maxMlId) {
List<OerDjnrEntity> djnrEntityList = entity.getOerDjnrEntityList();
if(djnrEntityList != null && djnrEntityList.size() > 0){
for (int i = 0; i < djnrEntityList.size(); i++) {
djnrEntityList.get(i).setMlId(maxMlId);
djnrEntityList.get(i).setGsdm(entity.getGsdm());
}
}
return djnrEntityList;
}