dev
parent
e11cb40d75
commit
80861ce523
|
|
@ -10,7 +10,9 @@ import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class InvoiceUseService {
|
public class InvoiceUseService {
|
||||||
private static Log log = Log.getLog(InvoiceUseService.class);
|
private static Log log = Log.getLog(InvoiceUseService.class);
|
||||||
|
|
@ -131,19 +133,14 @@ public class InvoiceUseService {
|
||||||
paramord.add(invoice_type);
|
paramord.add(invoice_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Record> list = new ArrayList<>();
|
|
||||||
|
|
||||||
if (order_state != null) {
|
if (order_state != null) {
|
||||||
if (order_state == 9) {
|
|
||||||
logsql += " and o.state = ? \n";
|
|
||||||
paramlog.add(order_state);
|
|
||||||
|
|
||||||
list = Db.find(logsql + " order by t.create_time", paramlog.toArray());
|
|
||||||
} else {
|
|
||||||
logsql += " and o.state = ? \n";
|
logsql += " and o.state = ? \n";
|
||||||
ordsql += " and t.state = ? \n";
|
ordsql += " and t.state = ? \n";
|
||||||
paramlog.add(order_state);
|
paramlog.add(order_state);
|
||||||
paramord.add(order_state);
|
paramord.add(order_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Record> list = new ArrayList<>();
|
||||||
|
|
||||||
if (invoice_state != null) {
|
if (invoice_state != null) {
|
||||||
if (invoice_state == 9) {
|
if (invoice_state == 9) {
|
||||||
|
|
@ -154,21 +151,31 @@ public class InvoiceUseService {
|
||||||
} else {
|
} else {
|
||||||
paramlog.addAll(paramord);
|
paramlog.addAll(paramord);
|
||||||
|
|
||||||
list = Db.find("select * from (" + logsql + "\n union \n " + ordsql + ") a order by a.create_time ", paramlog.toArray());
|
List<Record> l1 = Db.find(logsql + " order by t.create_time", paramlog.toArray());
|
||||||
}
|
List<Record> l2 = Db.find(ordsql + " order by t.create_time", paramord.toArray());
|
||||||
}
|
|
||||||
}else {
|
|
||||||
if (invoice_state != null) {
|
|
||||||
if (invoice_state == 9) {
|
|
||||||
list = Db.find(logsql + " order by t.create_time", paramlog.toArray());
|
|
||||||
} else if (invoice_state == 5) {
|
|
||||||
list = Db.find(ordsql + " order by t.create_time", paramord.toArray());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
paramlog.addAll(paramord);
|
|
||||||
|
|
||||||
list = Db.find("select * from (" + logsql + "\n union \n " + ordsql + ") a order by a.create_time ", paramlog.toArray());
|
Map<String, Record> map1 = new HashMap<>();
|
||||||
|
Map<String, Record> map2 = new HashMap<>();
|
||||||
|
|
||||||
|
for(Record record : l1){
|
||||||
|
String key = record.getStr("order_sn") + "_" +record.getStr("invoice_number") + "_" +record.getStr("invoice_code");
|
||||||
|
map1.put(key, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(Record record : l2){
|
||||||
|
String key = record.getStr("order_sn") + "_" +record.getStr("invoice_number") + "_" +record.getStr("invoice_code");
|
||||||
|
map2.put(key, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Map.Entry<String, Record> entry : map2.entrySet()){
|
||||||
|
if(map1.containsKey(entry.getKey())){
|
||||||
|
map1.remove(entry.getKey()); // 从 map1 中移除相同的
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map2.putAll(map1); // 剩下的不同的全部加到 map2 中
|
||||||
|
|
||||||
|
list = new ArrayList<>(map2.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
Record out = new Record();
|
Record out = new Record();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue