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.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
import kd.bos.orm.query.QFilter;
|
||||
|
@ -45,6 +49,7 @@ public class FormulaOperatipnImpl implements FormulaOperatipnService {
|
|||
if(budgetsystem.isEmpty()){
|
||||
QFilter shownumber = new QFilter("shownumber", "=", "CX01");
|
||||
DynamicObject priceModel = BusinessDataServiceHelper.loadSingle("epm_model","id", shownumber.toArray());
|
||||
priceModelid = (Long)priceModel.getPkValue();
|
||||
}else{
|
||||
QFilter shownumber = new QFilter("shownumber", "=", budgetsystem);
|
||||
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){
|
||||
ArrayList<Map<String,String>> resultMap = new ArrayList<Map<String, String>>();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
//成本中心
|
||||
map.put("Entity", value.get(1));
|
||||
|
||||
//预算项目
|
||||
map.put("Account", value.get(2));
|
||||
|
||||
//版本
|
||||
map.put("Version", value.get(4));
|
||||
|
||||
//币种
|
||||
map.put("Currency", value.get(5));
|
||||
|
||||
//线索
|
||||
map.put("AuditTrail", value.get(6));
|
||||
|
||||
//变动类型
|
||||
map.put("ChangeType", value.get(7));
|
||||
|
||||
//数据类型
|
||||
map.put("DataType", value.get(8));
|
||||
|
||||
//度量
|
||||
map.put("Metric", value.get(9));
|
||||
map.put("BudgetPeriod", value.get(10));
|
||||
// map.put("Entity", "Entity");
|
||||
// map.put("Account", "Account");
|
||||
// map.put("Version", "Version");
|
||||
// map.put("Currency", "Currency");
|
||||
// map.put("AuditTrail", "Currency");
|
||||
// map.put("ChangeType", "ChangeType");
|
||||
// map.put("DataType", "DataType");
|
||||
// map.put("Metric", "Metric");
|
||||
// map.put("BudgetPeriod", "BudgetPeriod");
|
||||
|
||||
//预算期间:lastmonth/thismonth
|
||||
String period = value.get(10);
|
||||
// 获取当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
// 定义日期格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DynamicObject temp = new DynamicObject();
|
||||
if("lastmonth".equals(period)){
|
||||
// 获取上个月的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);
|
||||
return resultMap;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue