|
|
@@ -78,6 +78,7 @@ import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
@@ -2936,7 +2937,18 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
if (feeCenterListMh.isEmpty()) {
|
|
|
throw new RuntimeException("请先维护费用信息");
|
|
|
}
|
|
|
+ List<Long> amendIds = feeCenterListMh.stream().filter(f -> AmendType.isAmendType(f.getBusinessType())).map(FeeCenter::getPid).distinct().collect(Collectors.toList());
|
|
|
allFeeCenter.addAll(feeCenterListMh);
|
|
|
+ if (!CollectionUtils.isEmpty(amendIds)) {
|
|
|
+ List<Amends> amendsList = amendsService.list(new LambdaQueryWrapper<Amends>()
|
|
|
+ .select(Amends::getId, Amends::getStatus).in(Amends::getId, amendIds));
|
|
|
+ feeCenterListMh = feeCenterListMh.stream().filter(fc -> {
|
|
|
+ // 是 amend 类型并没审核通过的不计入
|
|
|
+ Amends amends = amendsList.stream().filter(a -> a.getId().equals(fc.getPid())).findFirst().orElse(null);
|
|
|
+ return amends == null || CommonEnum.THREE.info.equals(String.valueOf(amends.getStatus()));
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
for (FeeCenter item : feeCenterListMh) {
|
|
|
if (ObjectUtils.isNotNull(item.getShortName())) {
|
|
|
item.setCorpCnName(item.getShortName());
|
|
|
@@ -3024,7 +3036,17 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
.eq(FeeCenter::getMblno, bills.getMblno())
|
|
|
.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FeeCenter::getIsDeleted, 0));
|
|
|
+ List<Long> amendIds = feeCenterList.stream().filter(f -> AmendType.isAmendType(f.getBusinessType())).map(FeeCenter::getPid).distinct().collect(Collectors.toList());
|
|
|
allFeeCenter.addAll(feeCenterList);
|
|
|
+ List<Amends> amendsList = amendsService.list(new LambdaQueryWrapper<Amends>()
|
|
|
+ .select(Amends::getId, Amends::getStatus).in(Amends::getId, amendIds));
|
|
|
+ if (!CollectionUtils.isEmpty(amendIds)) {
|
|
|
+ feeCenterList = feeCenterList.stream().filter(fc -> {
|
|
|
+ // 是 amend 类型并没审核通过的不计入
|
|
|
+ Amends amends = amendsList.stream().filter(a -> a.getId().equals(fc.getPid())).findFirst().orElse(null);
|
|
|
+ return amends == null || CommonEnum.THREE.info.equals(String.valueOf(amends.getStatus()));
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
|
|
|
List<FeeCenter> feeD = feeCenterList.stream().filter(e -> MagicValues.D.equals(e.getDc())).collect(Collectors.toList());
|
|
|
bills.setFeeCenterListD(feeD);
|
|
|
@@ -3049,10 +3071,6 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
Comparator.comparing(f -> f.getFeeId() + f.getCorpId() + f.getCurCode() + f.getDc()))), ArrayList::new));
|
|
|
List<FeeCenterReports> feeCenterReportList = new ArrayList<>();
|
|
|
for (FeeCenter fee : feeCenters) {
|
|
|
-/* if (AmendType.isAmendType(fee.getBusinessType()) && !CommonEnum.FOUR.info.equals(fee.getAuditStatus())) {
|
|
|
- // 是 amend 类型并没审核通过的不计入
|
|
|
- continue;
|
|
|
- }*/
|
|
|
FeeCenterReports feeCenterReports = new FeeCenterReports();
|
|
|
feeCenterReports.setRemarks(fee.getRemarks());
|
|
|
feeCenterReports.setPid(bills.getId());
|
|
|
@@ -3113,6 +3131,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
throw new RuntimeException("请先维护费用");
|
|
|
}
|
|
|
list.add(0, bills);
|
|
|
+ map.put(MagicValues.DATA, list);
|
|
|
} else if (MagicValues.MH.equals(bills.getBillType())) {
|
|
|
// 分单
|
|
|
Bills details = billsService.getOne(new LambdaQueryWrapper<Bills>()
|
|
|
@@ -3567,12 +3586,18 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
|
|
|
BigDecimal sumOFPS = new BigDecimal(BigInteger.ZERO);
|
|
|
if (item.equals(bills)) {
|
|
|
+ List<Long> amendIds = allFeeCenter.stream().filter(f -> AmendType.isAmendType(f.getBusinessType())).map(FeeCenter::getPid).distinct().collect(Collectors.toList());
|
|
|
+ List<Amends> amendsList = amendsService.list(new LambdaQueryWrapper<Amends>()
|
|
|
+ .select(Amends::getId, Amends::getStatus).in(Amends::getId, amendIds));
|
|
|
// 当前单据,计算 ProfitStatus
|
|
|
for (FeeCenter fee : allFeeCenter) {
|
|
|
-/* if (AmendType.isAmendType(fee.getBusinessType()) && !CommonEnum.FOUR.info.equals(fee.getAuditStatus())) {
|
|
|
- // 是 amend 类型并没审核通过的不计入
|
|
|
- continue;
|
|
|
- }*/
|
|
|
+ if (AmendType.isAmendType(fee.getBusinessType()) && !CollectionUtils.isEmpty(amendsList)) {
|
|
|
+ Amends amends = amendsList.stream().filter(a -> a.getId().equals(fee.getPid())).findFirst().orElse(null);
|
|
|
+ if (amends != null && !CommonEnum.THREE.info.equals(String.valueOf(amends.getStatus()))) {
|
|
|
+ // 是 amend 类型并没审核通过的不计入
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (MagicValues.C.equals(fee.getDc()) && "P/S".equals(fee.getFeeCode())) {
|
|
|
// if("USD".equals(fee.getCurCode())){
|
|
|
sumOFPS = sumOFPS.add(fee.getAmountLoc()).setScale(2, BigDecimal.ROUND_HALF_UP);
|