1、单据日志查询修改
This commit is contained in:
parent
9c111bb93a
commit
22b03c85e3
|
@ -48,211 +48,211 @@ public class AePushVoucherLogServiceImpl extends BaseService<AePushVoucherLogEnt
|
|||
private IAePushVoucherLogDetailsDao voucherLogDetailsDao;
|
||||
|
||||
|
||||
@Override
|
||||
public List<AePushVoucherLogEntity> queryBill(AePushVoucherLogEntity entity) {
|
||||
Assert.notNull(entity.getMdmId(), "mdmId不能为空");
|
||||
|
||||
// 1. 查询原始数据
|
||||
CreateVoucherVO createVoucherVO = new CreateVoucherVO();
|
||||
createVoucherVO.setMdmId(entity.getMdmId());
|
||||
createVoucherVO.setTimeStart(entity.getTimeStart());
|
||||
createVoucherVO.setTimeEnd(entity.getTimeEnd());
|
||||
|
||||
List<Map<String, Object>> mapList = coreService.queryDataByMdmId(createVoucherVO);
|
||||
List<AePushVoucherLogEntity> allList = transData(entity.getMdmId(), mapList);
|
||||
|
||||
// 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) {
|
||||
AePushVoucherLogEntity pushEntity = pushMap.get(allEntity.getBillCode());
|
||||
if (pushEntity != null) {
|
||||
allEntity.setBillStatus("Y");
|
||||
allEntity.setPushInfo(pushEntity.getPushInfo());
|
||||
} else {
|
||||
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不能为空");
|
||||
//
|
||||
// // 1. 查询原始数据
|
||||
// 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<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);
|
||||
//
|
||||
// // 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 pushEntity : pushData) {
|
||||
// if (allEntity.getBillCode().equals(pushEntity.getBillCode())) {
|
||||
// AePushVoucherLogEntity pushEntity = pushMap.get(allEntity.getBillCode());
|
||||
// if (pushEntity != null) {
|
||||
// allEntity.setBillStatus("Y");
|
||||
// allEntity.setPushInfo(pushEntity.getPushInfo());
|
||||
// break;
|
||||
// } else {
|
||||
// allEntity.setBillStatus("N");
|
||||
//// allEntity.setPushInfo(pushEntity.getPushInfo());
|
||||
// // pushInfo 保持 null 或设为默认值
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 4. 过滤数据
|
||||
// List<AePushVoucherLogEntity> filteredList = filterByConditions(allList, entity.getBillCode(), entity.getBillStatus());
|
||||
//
|
||||
// // 5. 增强数据:调用 Y 状态专用查询和模板类型查询
|
||||
// enhanceData(filteredList);
|
||||
//
|
||||
// // 6. 返回结果
|
||||
// return filteredList;
|
||||
// }
|
||||
//
|
||||
// List<AePushVoucherLogEntity> resList = new ArrayList<>();
|
||||
//
|
||||
// String billCode = entity.getBillCode();
|
||||
// String status = entity.getBillStatus();
|
||||
//
|
||||
// //单据号
|
||||
// if (billCode != null && status == null) {
|
||||
// for (AePushVoucherLogEntity aePushVoucherLogEntity : allList) {
|
||||
// if (aePushVoucherLogEntity.getBillCode().contains(billCode)) {
|
||||
// resList.add(aePushVoucherLogEntity);
|
||||
// // 过滤逻辑抽离
|
||||
// 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 (entity.getBillStatus() != null && !"".equals(entity.getBillStatus())) {
|
||||
// List<AePushVoucherLogEntity> statusList = new ArrayList<>();
|
||||
// for (AePushVoucherLogEntity aePushVoucherLogEntity : resList) {
|
||||
// if (status.equals(aePushVoucherLogEntity.getBillStatus())) {
|
||||
// statusList.add(aePushVoucherLogEntity);
|
||||
// // 状态匹配
|
||||
// if (billStatus != null && !billStatus.isEmpty()) {
|
||||
// if (!billStatus.equals(entity.getBillStatus())) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// for (AePushVoucherLogEntity aePushVoucherLogEntity : statusList) {
|
||||
// queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
||||
// // 数据增强逻辑抽离
|
||||
// private void enhanceData(List<AePushVoucherLogEntity> list) {
|
||||
// list.forEach(entity -> {
|
||||
// if ("Y".equals(entity.getBillStatus())) {
|
||||
// queryByBillCodeAndStatueY(entity);
|
||||
// }
|
||||
// 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;
|
||||
// });
|
||||
// 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());
|
||||
break;
|
||||
} else {
|
||||
allEntity.setBillStatus("N");
|
||||
// allEntity.setPushInfo(pushEntity.getPushInfo());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<AePushVoucherLogEntity> resList = new ArrayList<>();
|
||||
|
||||
String billCode = entity.getBillCode();
|
||||
String status = entity.getBillStatus();
|
||||
|
||||
//单据号
|
||||
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 : 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
|
||||
public List<AePushVoucherLogDetailsEntity> queryDetailsByBillCode(AePushVoucherLogEntity entity) {
|
||||
Assert.notNull(entity.getId(), "id不能为空");
|
||||
|
|
Loading…
Reference in New Issue