|
@@ -1036,9 +1036,20 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
}
|
|
|
|
|
|
if (flag) {//开票金额为0的状态
|
|
|
- mapList.get(0).setBaseAccount(mapList.get(0).getAccount());
|
|
|
+ for(int i = 0 ;i<mapList.size();i ++ ){
|
|
|
+ CwFinanceInvoiceDTO invoiceDTO = mapList.get(i);
|
|
|
+ if(i == 0 ){
|
|
|
+ mapList.get(0).setBaseAccount(mapList.get(0).getAccount());
|
|
|
+ }else{
|
|
|
+ invoiceDTO.setAccount("0");
|
|
|
+ invoiceDTO.setAccountDetail("0");
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {//开票金额不为0的状态
|
|
|
int indexFlag = 0;
|
|
|
+ int baseAccountFlag = 0;
|
|
|
+ //创建发票集合
|
|
|
+ List<String> invoiceNumber = Lists.newArrayList();
|
|
|
for (CwFinanceInvoiceDTO invoiceDTO : mapList) {
|
|
|
indexFlag ++ ;
|
|
|
//开票金额
|
|
@@ -1050,17 +1061,28 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
|
|
|
if((baseAccountB.compareTo(accountB) < 0 && baseAccountB.compareTo(accountDetailB) < 0)) {
|
|
|
|
|
|
+ } else if (baseAccountB.compareTo(accountB) == 0) {
|
|
|
+ if(baseAccountFlag>0){
|
|
|
+ invoiceDTO.setBaseAccount("0");
|
|
|
+ }
|
|
|
+ baseAccountFlag ++ ;
|
|
|
} else if (accountB.compareTo(accountDetailB) < 0) {
|
|
|
invoiceDTO.setBaseAccount(invoiceDTO.getAccount());
|
|
|
} else if(accountDetailB.compareTo(accountB) < 0){
|
|
|
invoiceDTO.setBaseAccount(invoiceDTO.getAccountDetail());
|
|
|
}
|
|
|
|
|
|
+ String invoiceNumberStr = String.join(", ", invoiceNumber);
|
|
|
+
|
|
|
if(indexFlag>1){
|
|
|
invoiceDTO.setAccount("0");
|
|
|
- invoiceDTO.setAccountDetail("0");
|
|
|
+ if(invoiceNumberStr.contains(invoiceDTO.getNumber())){
|
|
|
+ invoiceDTO.setAccountDetail("0");
|
|
|
+ }
|
|
|
//invoiceDTO.setNumber("");
|
|
|
}
|
|
|
+ //将发票号进行存储
|
|
|
+ invoiceNumber.add(invoiceDTO.getNumber());
|
|
|
}
|
|
|
}
|
|
|
resultList.addAll(mapList);
|