1、日志查询优化
This commit is contained in:
parent
6f6a87d93b
commit
6ef95f6ff3
|
@ -11,5 +11,6 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
*/
|
*/
|
||||||
public interface IAePushVoucherLogDao extends IBaseDao<AePushVoucherLogEntity, String> {
|
public interface IAePushVoucherLogDao extends IBaseDao<AePushVoucherLogEntity, String> {
|
||||||
|
|
||||||
|
AePushVoucherLogEntity saveOrUpdateBymdmIdAndBillCodeAndTypeId(AePushVoucherLogEntity aePushVoucherLogEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package com.hzya.frame.voucher.ae.push.dao.impl;
|
package com.hzya.frame.voucher.ae.push.dao.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
import com.hzya.frame.voucher.ae.push.entity.AePushVoucherLogEntity;
|
import com.hzya.frame.voucher.ae.push.entity.AePushVoucherLogEntity;
|
||||||
import com.hzya.frame.voucher.ae.push.dao.IAePushVoucherLogDao;
|
import com.hzya.frame.voucher.ae.push.dao.IAePushVoucherLogDao;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (AePushVoucherLog)表数据库访问层
|
* (AePushVoucherLog)表数据库访问层
|
||||||
*
|
*
|
||||||
|
@ -13,5 +17,28 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
@Repository
|
@Repository
|
||||||
public class AePushVoucherLogDaoImpl extends MybatisGenericDao<AePushVoucherLogEntity, String> implements IAePushVoucherLogDao{
|
public class AePushVoucherLogDaoImpl extends MybatisGenericDao<AePushVoucherLogEntity, String> implements IAePushVoucherLogDao{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据mdmId,bill_code,typeId新增或修改日志
|
||||||
|
* 没数据则新增,有数据判断Y/N
|
||||||
|
* N->N/Y 更新
|
||||||
|
* Y->N/Y 返回null
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AePushVoucherLogEntity saveOrUpdateBymdmIdAndBillCodeAndTypeId(AePushVoucherLogEntity aePushVoucherLogEntity) {
|
||||||
|
Assert.notNull(aePushVoucherLogEntity.getMdmId(), "根据mdmId,bill_code,typeId新增或修改日志时,mdmId不能为空");
|
||||||
|
Assert.notNull(aePushVoucherLogEntity.getBillCode(), "根据mdmId,bill_code,billCode新增或修改日志时,mdmId不能为空");
|
||||||
|
Assert.notNull(aePushVoucherLogEntity.getBillStatus(), "根据mdmId,bill_code,billStatus新增或修改日志时,mdmId不能为空");
|
||||||
|
AePushVoucherLogEntity aePushVoucherLogEntity1 = new AePushVoucherLogEntity();
|
||||||
|
aePushVoucherLogEntity1.setMdmId(aePushVoucherLogEntity.getMdmId());
|
||||||
|
aePushVoucherLogEntity1.setBillCode(aePushVoucherLogEntity.getBillCode());
|
||||||
|
List<AePushVoucherLogEntity> query = this.query(aePushVoucherLogEntity1);
|
||||||
|
if (query == null || query.size() == 0) {
|
||||||
|
AePushVoucherLogEntity save = this.save(aePushVoucherLogEntity);
|
||||||
|
return save;
|
||||||
|
}else {
|
||||||
|
this.update(aePushVoucherLogEntity);
|
||||||
|
return aePushVoucherLogEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.hzya.frame.voucher.ae.push.entity;
|
package com.hzya.frame.voucher.ae.push.entity;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.hzya.frame.web.entity.BaseEntity;
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
|
||||||
|
@ -418,5 +419,16 @@ public class AePushVoucherLogEntity extends BaseEntity {
|
||||||
public void setdBbSum(String dBbSum) {
|
public void setdBbSum(String dBbSum) {
|
||||||
this.dBbSum = dBbSum;
|
this.dBbSum = dBbSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<AePushVoucherLogEntity> logList;
|
||||||
|
|
||||||
|
public List<AePushVoucherLogEntity> getLogList() {
|
||||||
|
return logList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogList(List<AePushVoucherLogEntity> logList) {
|
||||||
|
this.logList = logList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,4 +16,6 @@ public interface IAePushVoucherLogService extends IBaseService<AePushVoucherLogE
|
||||||
List<AePushVoucherLogEntity> queryBill(AePushVoucherLogEntity entity);
|
List<AePushVoucherLogEntity> queryBill(AePushVoucherLogEntity entity);
|
||||||
|
|
||||||
List<AePushVoucherLogDetailsEntity> queryDetailsByBillCode(AePushVoucherLogEntity entity);
|
List<AePushVoucherLogDetailsEntity> queryDetailsByBillCode(AePushVoucherLogEntity entity);
|
||||||
|
|
||||||
|
AePushVoucherLogEntity saveOrUpdateBymdmIdAndBillCodeAndTypeId(AePushVoucherLogEntity aePushVoucherLogEntity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,58 +52,206 @@ public class AePushVoucherLogServiceImpl extends BaseService<AePushVoucherLogEnt
|
||||||
public List<AePushVoucherLogEntity> queryBill(AePushVoucherLogEntity entity) {
|
public List<AePushVoucherLogEntity> queryBill(AePushVoucherLogEntity entity) {
|
||||||
Assert.notNull(entity.getMdmId(), "mdmId不能为空");
|
Assert.notNull(entity.getMdmId(), "mdmId不能为空");
|
||||||
|
|
||||||
|
// 1. 查询原始数据
|
||||||
CreateVoucherVO createVoucherVO = new CreateVoucherVO();
|
CreateVoucherVO createVoucherVO = new CreateVoucherVO();
|
||||||
createVoucherVO.setMdmId(entity.getMdmId());
|
createVoucherVO.setMdmId(entity.getMdmId());
|
||||||
if (entity.getTimeStart() != null && !"".equals(entity.getTimeStart())) {
|
|
||||||
createVoucherVO.setTimeStart(entity.getTimeStart());
|
createVoucherVO.setTimeStart(entity.getTimeStart());
|
||||||
}
|
|
||||||
if (entity.getTimeEnd() != null && !"".equals(entity.getTimeEnd())) {
|
|
||||||
createVoucherVO.setTimeEnd(entity.getTimeEnd());
|
createVoucherVO.setTimeEnd(entity.getTimeEnd());
|
||||||
}
|
|
||||||
|
|
||||||
List<Map<String, Object>> mapList = coreService.queryDataByMdmId(createVoucherVO);
|
List<Map<String, Object>> mapList = coreService.queryDataByMdmId(createVoucherVO);
|
||||||
|
|
||||||
List<AePushVoucherLogEntity> allList = transData(entity.getMdmId(), mapList);
|
List<AePushVoucherLogEntity> allList = transData(entity.getMdmId(), mapList);
|
||||||
AePushVoucherLogEntity aePushVoucherLogEntity1 = new AePushVoucherLogEntity();
|
|
||||||
aePushVoucherLogEntity1.setMdmId(entity.getMdmId());
|
|
||||||
List<AePushVoucherLogEntity> pushData = aePushVoucherLogDao.query(aePushVoucherLogEntity1);
|
|
||||||
|
|
||||||
|
// 2. 查询已推送数据,并构建 billCode -> entity 的映射
|
||||||
|
AePushVoucherLogEntity queryEntity = new AePushVoucherLogEntity();
|
||||||
|
queryEntity.setMdmId(entity.getMdmId());
|
||||||
|
List<AePushVoucherLogEntity> pushData = aePushVoucherLogDao.query(queryEntity);
|
||||||
|
|
||||||
|
Map<String, AePushVoucherLogEntity> pushMap = pushData.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
AePushVoucherLogEntity::getBillCode,
|
||||||
|
e -> e,
|
||||||
|
(e1, e2) -> e1 // 如果有重复 billCode,保留第一个
|
||||||
|
));
|
||||||
|
|
||||||
|
// 3. 设置 billStatus 和 pushInfo
|
||||||
for (AePushVoucherLogEntity allEntity : allList) {
|
for (AePushVoucherLogEntity allEntity : allList) {
|
||||||
for (AePushVoucherLogEntity pushEntity : pushData) {
|
AePushVoucherLogEntity pushEntity = pushMap.get(allEntity.getBillCode());
|
||||||
if (allEntity.getBillCode().equals(pushEntity.getBillCode())) {
|
if (pushEntity != null) {
|
||||||
allEntity.setBillStatus("Y");
|
allEntity.setBillStatus("Y");
|
||||||
allEntity.setPushInfo(pushEntity.getPushInfo());
|
allEntity.setPushInfo(pushEntity.getPushInfo());
|
||||||
} else {
|
} else {
|
||||||
allEntity.setBillStatus("N");
|
allEntity.setBillStatus("N");
|
||||||
|
// pushInfo 保持 null 或设为默认值
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 过滤数据
|
||||||
|
List<AePushVoucherLogEntity> filteredList = filterByConditions(allList, entity.getBillCode(), entity.getBillStatus());
|
||||||
|
|
||||||
|
// 5. 增强数据:调用 Y 状态专用查询和模板类型查询
|
||||||
|
enhanceData(filteredList);
|
||||||
|
|
||||||
|
// 6. 返回结果
|
||||||
|
return filteredList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过滤逻辑抽离
|
||||||
|
private List<AePushVoucherLogEntity> filterByConditions(List<AePushVoucherLogEntity> list, String billCode, String billStatus) {
|
||||||
|
return list.stream().filter(entity -> {
|
||||||
|
// 单据号匹配
|
||||||
|
if (billCode != null && !billCode.isEmpty()) {
|
||||||
|
if (entity.getBillCode() == null || !entity.getBillCode().contains(billCode)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 状态匹配
|
||||||
|
if (billStatus != null && !billStatus.isEmpty()) {
|
||||||
|
if (!billStatus.equals(entity.getBillStatus())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数据增强逻辑抽离
|
||||||
|
private void enhanceData(List<AePushVoucherLogEntity> list) {
|
||||||
|
list.forEach(entity -> {
|
||||||
|
if ("Y".equals(entity.getBillStatus())) {
|
||||||
|
queryByBillCodeAndStatueY(entity);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
queryTempType(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<AePushVoucherLogEntity> queryBill(AePushVoucherLogEntity entity) {
|
||||||
|
// Assert.notNull(entity.getMdmId(), "mdmId不能为空");
|
||||||
|
//
|
||||||
|
// CreateVoucherVO createVoucherVO = new CreateVoucherVO();
|
||||||
|
// createVoucherVO.setMdmId(entity.getMdmId());
|
||||||
|
// if (entity.getTimeStart() != null && !"".equals(entity.getTimeStart())) {
|
||||||
|
// createVoucherVO.setTimeStart(entity.getTimeStart());
|
||||||
|
// }
|
||||||
|
// if (entity.getTimeEnd() != null && !"".equals(entity.getTimeEnd())) {
|
||||||
|
// createVoucherVO.setTimeEnd(entity.getTimeEnd());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<Map<String, Object>> mapList = coreService.queryDataByMdmId(createVoucherVO);//已被去重
|
||||||
|
//
|
||||||
|
// List<AePushVoucherLogEntity> allList = transData(entity.getMdmId(), mapList);
|
||||||
|
// AePushVoucherLogEntity aePushVoucherLogEntity1 = new AePushVoucherLogEntity();
|
||||||
|
// aePushVoucherLogEntity1.setMdmId(entity.getMdmId());
|
||||||
|
// List<AePushVoucherLogEntity> pushData = aePushVoucherLogDao.query(aePushVoucherLogEntity1);
|
||||||
|
//
|
||||||
|
// for (AePushVoucherLogEntity allEntity : allList) {
|
||||||
|
// for (AePushVoucherLogEntity pushEntity : pushData) {
|
||||||
|
// if (allEntity.getBillCode().equals(pushEntity.getBillCode())) {
|
||||||
|
// allEntity.setBillStatus("Y");
|
||||||
// allEntity.setPushInfo(pushEntity.getPushInfo());
|
// allEntity.setPushInfo(pushEntity.getPushInfo());
|
||||||
}
|
// break;
|
||||||
}
|
// } else {
|
||||||
|
// allEntity.setBillStatus("N");
|
||||||
}
|
//// allEntity.setPushInfo(pushEntity.getPushInfo());
|
||||||
System.out.println(allList);
|
// }
|
||||||
String status = entity.getBillStatus();
|
// }
|
||||||
if (entity.getBillStatus() != null && !"".equals(entity.getBillStatus())) {
|
//
|
||||||
List<AePushVoucherLogEntity> statusList = new ArrayList<>();
|
// }
|
||||||
for (AePushVoucherLogEntity aePushVoucherLogEntity : allList) {
|
//
|
||||||
if (status.equals(aePushVoucherLogEntity.getBillStatus())) {
|
// List<AePushVoucherLogEntity> resList = new ArrayList<>();
|
||||||
statusList.add(aePushVoucherLogEntity);
|
//
|
||||||
}
|
// String billCode = entity.getBillCode();
|
||||||
}
|
// String status = entity.getBillStatus();
|
||||||
|
//
|
||||||
for (AePushVoucherLogEntity aePushVoucherLogEntity : statusList) {
|
// //单据号
|
||||||
queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
// if (billCode != null && status == null) {
|
||||||
}
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : allList) {
|
||||||
|
// if (aePushVoucherLogEntity.getBillCode().contains(billCode)) {
|
||||||
return statusList;
|
// resList.add(aePushVoucherLogEntity);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
for (AePushVoucherLogEntity aePushVoucherLogEntity : allList) {
|
// if (entity.getBillStatus() != null && !"".equals(entity.getBillStatus())) {
|
||||||
queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
// List<AePushVoucherLogEntity> statusList = new ArrayList<>();
|
||||||
}
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : resList) {
|
||||||
return allList;
|
// if (status.equals(aePushVoucherLogEntity.getBillStatus())) {
|
||||||
|
// statusList.add(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : statusList) {
|
||||||
|
// queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
|
// queryTempType(statusList);
|
||||||
|
// return statusList;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : resList) {
|
||||||
|
// queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// queryTempType(resList);
|
||||||
|
// return resList;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// //状态
|
||||||
|
// if (billCode == null && status != null) {
|
||||||
|
// if (entity.getBillStatus() != null && !"".equals(entity.getBillStatus())) {
|
||||||
|
// List<AePushVoucherLogEntity> statusList = new ArrayList<>();
|
||||||
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : allList) {
|
||||||
|
// if (status.equals(aePushVoucherLogEntity.getBillStatus())) {
|
||||||
|
// statusList.add(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : statusList) {
|
||||||
|
// queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
|
// queryTempType(statusList);
|
||||||
|
// return statusList;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : allList) {
|
||||||
|
// queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// queryTempType(allList);
|
||||||
|
// return allList;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// //单据号+状态
|
||||||
|
// if (billCode != null && status != null) {
|
||||||
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : allList) {
|
||||||
|
// if (aePushVoucherLogEntity.getBillCode().contains(billCode)) {
|
||||||
|
// resList.add(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (entity.getBillStatus() != null && !"".equals(entity.getBillStatus())) {
|
||||||
|
// List<AePushVoucherLogEntity> statusList = new ArrayList<>();
|
||||||
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : resList) {
|
||||||
|
// if (status.equals(aePushVoucherLogEntity.getBillStatus())) {
|
||||||
|
// statusList.add(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : statusList) {
|
||||||
|
// queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
|
// queryTempType(statusList);
|
||||||
|
// return statusList;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// for (AePushVoucherLogEntity aePushVoucherLogEntity : allList) {
|
||||||
|
// queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// queryTempType(allList);
|
||||||
|
// return allList;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AePushVoucherLogDetailsEntity> queryDetailsByBillCode(AePushVoucherLogEntity entity) {
|
public List<AePushVoucherLogDetailsEntity> queryDetailsByBillCode(AePushVoucherLogEntity entity) {
|
||||||
|
@ -119,12 +267,12 @@ public class AePushVoucherLogServiceImpl extends BaseService<AePushVoucherLogEnt
|
||||||
return voucherLogDetailsEntityList;
|
return voucherLogDetailsEntityList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bill_code单据编码
|
* bill_code单据编码
|
||||||
* bill_date单据日期
|
* bill_date单据日期
|
||||||
*/
|
*/
|
||||||
public List<AePushVoucherLogEntity> transData(String mdmId, List<Map<String, Object>> mapList) {
|
public List<AePushVoucherLogEntity> transData(String mdmId, List<Map<String, Object>> mapList) {
|
||||||
System.out.println(mapList);
|
|
||||||
List<AePushVoucherLogEntity> all = new ArrayList<>();
|
List<AePushVoucherLogEntity> all = new ArrayList<>();
|
||||||
for (Map<String, Object> stringObjectMap : mapList) {
|
for (Map<String, Object> stringObjectMap : mapList) {
|
||||||
if (stringObjectMap != null) {
|
if (stringObjectMap != null) {
|
||||||
|
@ -141,7 +289,6 @@ public class AePushVoucherLogServiceImpl extends BaseService<AePushVoucherLogEnt
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queryByBillCodeAndStatueY(AePushVoucherLogEntity aePushVoucherLogEntity) {
|
public void queryByBillCodeAndStatueY(AePushVoucherLogEntity aePushVoucherLogEntity) {
|
||||||
System.out.println(aePushVoucherLogEntity);
|
|
||||||
if ("Y".equals(aePushVoucherLogEntity.getBillStatus())) {
|
if ("Y".equals(aePushVoucherLogEntity.getBillStatus())) {
|
||||||
AePushVoucherLogEntity aePushVoucherLogEntity1 = new AePushVoucherLogEntity();
|
AePushVoucherLogEntity aePushVoucherLogEntity1 = new AePushVoucherLogEntity();
|
||||||
aePushVoucherLogEntity1.setMdmId(aePushVoucherLogEntity.getMdmId());
|
aePushVoucherLogEntity1.setMdmId(aePushVoucherLogEntity.getMdmId());
|
||||||
|
@ -151,7 +298,45 @@ public class AePushVoucherLogServiceImpl extends BaseService<AePushVoucherLogEnt
|
||||||
BeanUtils.copyProperties(query.get(0), aePushVoucherLogEntity);
|
BeanUtils.copyProperties(query.get(0), aePushVoucherLogEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据单据编码查询,是否生成了多张凭证
|
||||||
|
*/
|
||||||
|
public void queryTempType(List<AePushVoucherLogEntity> voucherLogEntityList) {
|
||||||
|
for (AePushVoucherLogEntity aePushVoucherLogEntity : voucherLogEntityList) {
|
||||||
|
AePushVoucherLogEntity aePushVoucherLogEntity1 = new AePushVoucherLogEntity();
|
||||||
|
aePushVoucherLogEntity1.setBillCode(aePushVoucherLogEntity.getBillCode());
|
||||||
|
List<AePushVoucherLogEntity> query = aePushVoucherLogDao.query(aePushVoucherLogEntity1);
|
||||||
|
aePushVoucherLogEntity.setLogList(query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据mdmId,bill_code,typeId新增或修改日志
|
||||||
|
* 没数据则新增,有数据判断Y/N
|
||||||
|
* N->N/Y 更新
|
||||||
|
* Y->N/Y 返回null
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AePushVoucherLogEntity saveOrUpdateBymdmIdAndBillCodeAndTypeId(AePushVoucherLogEntity aePushVoucherLogEntity) {
|
||||||
|
Assert.notNull(aePushVoucherLogEntity.getMdmId(), "根据mdmId,bill_code,typeId新增或修改日志时,mdmId不能为空");
|
||||||
|
Assert.notNull(aePushVoucherLogEntity.getBillCode(), "根据mdmId,bill_code,billCode新增或修改日志时,mdmId不能为空");
|
||||||
|
Assert.notNull(aePushVoucherLogEntity.getBillStatus(), "根据mdmId,bill_code,billStatus新增或修改日志时,mdmId不能为空");
|
||||||
|
AePushVoucherLogEntity aePushVoucherLogEntity1 = new AePushVoucherLogEntity();
|
||||||
|
aePushVoucherLogEntity1.setMdmId(aePushVoucherLogEntity.getMdmId());
|
||||||
|
aePushVoucherLogEntity1.setBillCode(aePushVoucherLogEntity.getBillCode());
|
||||||
|
List<AePushVoucherLogEntity> query = aePushVoucherLogDao.query(aePushVoucherLogEntity1);
|
||||||
|
if (query == null || query.size() == 0) {
|
||||||
|
AePushVoucherLogEntity save = aePushVoucherLogDao.save(aePushVoucherLogEntity);
|
||||||
|
return save;
|
||||||
|
} else {
|
||||||
|
aePushVoucherLogDao.update(aePushVoucherLogEntity);
|
||||||
|
return aePushVoucherLogEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue