1、成本中心查询

2、出差申请单保存
This commit is contained in:
李靖 2024-05-08 18:16:54 +08:00
parent 1d18576d78
commit 6a5b2ac0c0
2 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,28 @@
package shkd.bamp.basedata.plugin;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.openapi.api.plugin.ApiQueryPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import java.util.Map;
public class GetCostcenterApiQueryPlugin implements ApiQueryPlugin {
@Override
public QFilter getFilter(QFilter filter, Map<String, Object> reqData) {
Map<String, Map<String, Object>> data = (Map<String, Map<String, Object>>)reqData.get("data");
Object numberObj = data.get("number");
if(numberObj != null && !((String)numberObj).isEmpty() ){
filter.and(new QFilter("number", QCP.equals, numberObj));
}
Object accountorgNumber = data.get("accountorgNumber");
if(accountorgNumber != null && !((String)accountorgNumber).isEmpty() ){
filter.and(new QFilter("accountorg.number", QCP.equals, accountorgNumber));
}
Object parentNumber = data.get("parentNumber");
if(parentNumber != null && !((String)parentNumber).isEmpty() ){
filter.and(new QFilter("parent.number", QCP.equals, parentNumber));
}
return filter;
}
}

View File

@ -0,0 +1,44 @@
package shkd.fi.er.plugin;
import kd.bos.openapi.api.plugin.ApiSavePlugin;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SaveTripBaseBillApiSavePlugin implements ApiSavePlugin {
@Override
public List<Map<String, Object>> preHandleRequestData(List<Map<String, Object>> reqData) {
for(Map<String, Object> temp1 : reqData) {
Object multitravelers = temp1.get("multitravelers");
if(temp1.containsKey("tripentry")){
List<Map<String, Object>> tripentryList = (List<Map<String, Object>>)temp1.get("tripentry");
BigDecimal amount = BigDecimal.ZERO;
for(Map<String, Object> tripentry : tripentryList) {
amount = amount.add((BigDecimal)tripentry.get("triporiamount"));
tripentry.put("travelers", multitravelers);
if(!tripentry.containsKey("tripexpenseitem")){
Map<String, Object> tripexpenseitem = new HashMap<String, Object>();
//费用项目默认差旅费FYXM0015
tripexpenseitem.put("number", "FYXM0015");
tripentry.put("tripexpenseitem", tripexpenseitem);
//交通工具默认其它工具 [1:飞机, 2:火车, 3:汽车, 4:轮船, 5:其他工具]
tripentry.put("vehicles", "5");
}
}
temp1.put("amount", amount);
temp1.put("approveamount", amount);
}
if(!temp1.containsKey("triptype")){
Map<String, Object> triptype = new HashMap<String, Object>();
//出差类型默认值普通出差001
triptype.put("number", "001");
temp1.put("triptype", triptype);
}
temp1.put("istravelers", true);
// temp1.put("billstatus", "C");
}
return reqData;
}
}