1、单据日志查询修改
This commit is contained in:
parent
9c111bb93a
commit
22b03c85e3
|
@ -48,210 +48,210 @@ public class AePushVoucherLogServiceImpl extends BaseService<AePushVoucherLogEnt
|
||||||
private IAePushVoucherLogDetailsDao voucherLogDetailsDao;
|
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
|
// @Override
|
||||||
// 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());
|
// createVoucherVO.setTimeEnd(entity.getTimeEnd());
|
||||||
// }
|
|
||||||
// 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);
|
// 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());
|
||||||
// break;
|
// } else {
|
||||||
// } else {
|
// allEntity.setBillStatus("N");
|
||||||
// allEntity.setBillStatus("N");
|
// // pushInfo 保持 null 或设为默认值
|
||||||
//// 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;
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// // 4. 过滤数据
|
||||||
|
// List<AePushVoucherLogEntity> filteredList = filterByConditions(allList, entity.getBillCode(), entity.getBillStatus());
|
||||||
//
|
//
|
||||||
// for (AePushVoucherLogEntity aePushVoucherLogEntity : allList) {
|
// // 5. 增强数据:调用 Y 状态专用查询和模板类型查询
|
||||||
// queryByBillCodeAndStatueY(aePushVoucherLogEntity);
|
// enhanceData(filteredList);
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// queryTempType(allList);
|
// // 6. 返回结果
|
||||||
// return allList;
|
// 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());
|
||||||
|
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
|
@Override
|
||||||
public List<AePushVoucherLogDetailsEntity> queryDetailsByBillCode(AePushVoucherLogEntity entity) {
|
public List<AePushVoucherLogDetailsEntity> queryDetailsByBillCode(AePushVoucherLogEntity entity) {
|
||||||
|
|
Loading…
Reference in New Issue