1、报表公式开发
This commit is contained in:
parent
6cda406213
commit
5577791dcd
|
@ -5,9 +5,13 @@ import cn.hutool.json.JSONObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.logging.Log;
|
import kd.bos.logging.Log;
|
||||||
import kd.bos.logging.LogFactory;
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
|
@ -45,6 +49,7 @@ public class FormulaOperatipnImpl implements FormulaOperatipnService {
|
||||||
if(budgetsystem.isEmpty()){
|
if(budgetsystem.isEmpty()){
|
||||||
QFilter shownumber = new QFilter("shownumber", "=", "CX01");
|
QFilter shownumber = new QFilter("shownumber", "=", "CX01");
|
||||||
DynamicObject priceModel = BusinessDataServiceHelper.loadSingle("epm_model","id", shownumber.toArray());
|
DynamicObject priceModel = BusinessDataServiceHelper.loadSingle("epm_model","id", shownumber.toArray());
|
||||||
|
priceModelid = (Long)priceModel.getPkValue();
|
||||||
}else{
|
}else{
|
||||||
QFilter shownumber = new QFilter("shownumber", "=", budgetsystem);
|
QFilter shownumber = new QFilter("shownumber", "=", budgetsystem);
|
||||||
DynamicObject priceModel = BusinessDataServiceHelper.loadSingle("epm_model","id", shownumber.toArray());
|
DynamicObject priceModel = BusinessDataServiceHelper.loadSingle("epm_model","id", shownumber.toArray());
|
||||||
|
@ -93,24 +98,53 @@ public class FormulaOperatipnImpl implements FormulaOperatipnService {
|
||||||
public ArrayList<Map<String,String>> makeReslutMap(ArrayList<String> value){
|
public ArrayList<Map<String,String>> makeReslutMap(ArrayList<String> value){
|
||||||
ArrayList<Map<String,String>> resultMap = new ArrayList<Map<String, String>>();
|
ArrayList<Map<String,String>> resultMap = new ArrayList<Map<String, String>>();
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
//成本中心
|
||||||
map.put("Entity", value.get(1));
|
map.put("Entity", value.get(1));
|
||||||
|
|
||||||
|
//预算项目
|
||||||
map.put("Account", value.get(2));
|
map.put("Account", value.get(2));
|
||||||
|
|
||||||
|
//版本
|
||||||
map.put("Version", value.get(4));
|
map.put("Version", value.get(4));
|
||||||
|
|
||||||
|
//币种
|
||||||
map.put("Currency", value.get(5));
|
map.put("Currency", value.get(5));
|
||||||
|
|
||||||
|
//线索
|
||||||
map.put("AuditTrail", value.get(6));
|
map.put("AuditTrail", value.get(6));
|
||||||
|
|
||||||
|
//变动类型
|
||||||
map.put("ChangeType", value.get(7));
|
map.put("ChangeType", value.get(7));
|
||||||
|
|
||||||
|
//数据类型
|
||||||
map.put("DataType", value.get(8));
|
map.put("DataType", value.get(8));
|
||||||
|
|
||||||
|
//度量
|
||||||
map.put("Metric", value.get(9));
|
map.put("Metric", value.get(9));
|
||||||
map.put("BudgetPeriod", value.get(10));
|
|
||||||
// map.put("Entity", "Entity");
|
//预算期间:lastmonth/thismonth
|
||||||
// map.put("Account", "Account");
|
String period = value.get(10);
|
||||||
// map.put("Version", "Version");
|
// 获取当前日期
|
||||||
// map.put("Currency", "Currency");
|
LocalDate today = LocalDate.now();
|
||||||
// map.put("AuditTrail", "Currency");
|
// 定义日期格式
|
||||||
// map.put("ChangeType", "ChangeType");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
// map.put("DataType", "DataType");
|
DynamicObject temp = new DynamicObject();
|
||||||
// map.put("Metric", "Metric");
|
if("lastmonth".equals(period)){
|
||||||
// map.put("BudgetPeriod", "BudgetPeriod");
|
// 获取上个月的1号
|
||||||
|
LocalDate usageDay = today.minusMonths(1).withDayOfMonth(1);
|
||||||
|
// 将 LocalDate 转换为 date
|
||||||
|
Date date = Date.from(usageDay.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||||
|
QFilter shownumber = new QFilter("startdate", "=", date).and(new QFilter("isleaf", QCP.equals, "1"));
|
||||||
|
temp = BusinessDataServiceHelper.loadSingle("epm_bperiodmembertree","shownumber", shownumber.toArray());
|
||||||
|
}else if("thismonth".equals(period)){
|
||||||
|
// 获取本月的1号
|
||||||
|
LocalDate usageDay = today.withDayOfMonth(1);
|
||||||
|
// 将 LocalDate 转换为 date
|
||||||
|
Date date = Date.from(usageDay.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||||
|
QFilter shownumber = new QFilter("startdate", "=", date).and(new QFilter("isleaf", "=", "1"));
|
||||||
|
temp = BusinessDataServiceHelper.loadSingle("epm_bperiodmembertree","shownumber", shownumber.toArray());
|
||||||
|
}
|
||||||
|
map.put("BudgetPeriod", temp.getString("shownumber"));
|
||||||
resultMap.add(map);
|
resultMap.add(map);
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue