youhua
This commit is contained in:
parent
131530c483
commit
1afa521471
|
@ -156,53 +156,57 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
entrys.removeIf(record -> isLastMonth(zcgjDebillno));//若属于上个月那就删除重新塞入
|
||||
}
|
||||
}
|
||||
DynamicObjectCollection depresplitdetails = QueryServiceHelper.query("fa_depresplitdetail", "billno,period,splitdept,assentry.costcentrer,assentry.splitamount", new QFilter[]{qf});
|
||||
// DynamicObjectCollection depresplitdetails = QueryServiceHelper.query("fa_depresplitdetail", "billno,period,splitdept,assentry.costcentrer,assentry.splitamount", new QFilter[]{qf});
|
||||
|
||||
// DynamicObject[] depresplitdetails = BusinessDataServiceHelper.load("fa_depresplitdetail", "billno,period,splitdept,assentry.costcentrer,assentry.splitamount", new QFilter[]{qf});
|
||||
// DataSet rows = QueryServiceHelper.queryDataSet(this.getClass().getName(), "fa_depresplitdetail", "billno,period,period.number,splitdept,assentry.costcentrer,assentry.splitamount", qFilter.toArray(), "period.number DESC", 1);
|
||||
// 增强版比较器(自动适配多种日期格式)
|
||||
for (int i = 0; i < depresplitdetails.size(); i++) {
|
||||
DynamicObject item = depresplitdetails.get(i);
|
||||
DataSet rows = QueryServiceHelper.queryDataSet(this.getClass().getName(), "fa_depresplitdetail", "billno,period,splitdept,assentry.costcentrer,assentry.splitamount", qFilter.toArray(), "period.number DESC", 1);
|
||||
DynamicObjectCollection depresplitdetails = ORM.create().toPlainDynamicObjectCollection(rows.copy());
|
||||
// // 增强版比较器(自动适配多种日期格式)
|
||||
// for (int i = 0; i < depresplitdetails.size(); i++) {
|
||||
// DynamicObject item = depresplitdetails.get(i);
|
||||
//// log.info("排序前 " + i + ": " + item.getDynamicObject("period").getString("number"));
|
||||
// }
|
||||
// Comparator<DynamicObject> smartComparator = (o1, o2) -> {
|
||||
// DynamicObject p1 = o1.getDynamicObject("period");
|
||||
// DynamicObject p2 = o2.getDynamicObject("period");
|
||||
// // 空值处理
|
||||
// if (p1 == null && p2 == null) return 0;
|
||||
// if (p1 == null) return 1;
|
||||
// if (p2 == null) return -1;
|
||||
// String c1 = p1.getString("number");
|
||||
// String c2 = p2.getString("number");
|
||||
// if (c1 == null) c1 = "";
|
||||
// if (c2 == null) c2 = "";
|
||||
// // 尝试解析为年月
|
||||
// for (String pattern : new String[]{"yyyyMM", "yyyy-MM", "yyyy/MM"}) {
|
||||
// try {
|
||||
// DateTimeFormatter fmt = DateTimeFormatter.ofPattern(pattern);
|
||||
// YearMonth ym1 = YearMonth.parse(c1, fmt);
|
||||
// YearMonth ym2 = YearMonth.parse(c2, fmt);
|
||||
// return ym2.compareTo(ym1); // 降序
|
||||
// } catch (Exception ignored) {}
|
||||
// }
|
||||
// // 纯数字比较(如 "202301")
|
||||
// try {
|
||||
// int num1 = Integer.parseInt(c1);
|
||||
// int num2 = Integer.parseInt(c2);
|
||||
// return Integer.compare(num2, num1);
|
||||
// } catch (NumberFormatException e) {
|
||||
// return c2.compareTo(c1); // 字符串降序
|
||||
// }
|
||||
// };
|
||||
// depresplitdetails.sort(smartComparator);
|
||||
// for (int i = 0; i < depresplitdetails.size(); i++) {
|
||||
// DynamicObject item = depresplitdetails.get(i);
|
||||
// log.info("排序前 " + i + ": " + item.getDynamicObject("period").getString("number"));
|
||||
}
|
||||
Comparator<DynamicObject> smartComparator = (o1, o2) -> {
|
||||
DynamicObject p1 = o1.getDynamicObject("period");
|
||||
DynamicObject p2 = o2.getDynamicObject("period");
|
||||
|
||||
// 空值处理
|
||||
if (p1 == null && p2 == null) return 0;
|
||||
if (p1 == null) return 1;
|
||||
if (p2 == null) return -1;
|
||||
|
||||
String c1 = p1.getString("number");
|
||||
String c2 = p2.getString("number");
|
||||
if (c1 == null) c1 = "";
|
||||
if (c2 == null) c2 = "";
|
||||
|
||||
// 尝试解析为年月
|
||||
for (String pattern : new String[]{"yyyyMM", "yyyy-MM", "yyyy/MM"}) {
|
||||
try {
|
||||
DateTimeFormatter fmt = DateTimeFormatter.ofPattern(pattern);
|
||||
YearMonth ym1 = YearMonth.parse(c1, fmt);
|
||||
YearMonth ym2 = YearMonth.parse(c2, fmt);
|
||||
return ym2.compareTo(ym1); // 降序
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
// 纯数字比较(如 "202301")
|
||||
try {
|
||||
int num1 = Integer.parseInt(c1);
|
||||
int num2 = Integer.parseInt(c2);
|
||||
return Integer.compare(num2, num1);
|
||||
} catch (NumberFormatException e) {
|
||||
return c2.compareTo(c1); // 字符串降序
|
||||
}
|
||||
};
|
||||
depresplitdetails.sort(smartComparator);
|
||||
for (int i = 0; i < depresplitdetails.size(); i++) {
|
||||
DynamicObject item = depresplitdetails.get(i);
|
||||
log.info("排序前 " + i + ": " + item.getDynamicObject("period").getString("number"));
|
||||
}
|
||||
|
||||
// }
|
||||
// //按字段 menuindex 排序
|
||||
// Collections.sort(depresplitdetails , new Comparator<DynamicObject>(){
|
||||
// @Override
|
||||
// public int compare(DynamicObject stu1, DynamicObject stu2) {
|
||||
// return stu1.getInt("menuindex")-stu2.getInt("menuindex");
|
||||
// }
|
||||
// });
|
||||
for (DynamicObject depresplitdetail : depresplitdetails) {
|
||||
String billno = depresplitdetail.getString("billno");
|
||||
DynamicObject period = depresplitdetail.getDynamicObject("period");//折旧区间
|
||||
|
|
Loading…
Reference in New Issue