Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c73c174a87
|
@ -32,6 +32,11 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
|
||||
private static final String DEV_KEY="zcgj";
|
||||
|
||||
private static final String FYF ="FYXM002.152";//防疫费(新增)
|
||||
private static final String TXF ="FYXM002.018";//通信费(通信与网络费)
|
||||
private static final String PXF ="FYXM002.006";//培训费
|
||||
private static final String YWZDF ="FYXM002.007";//业务招待费
|
||||
|
||||
@Override
|
||||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
|
||||
|
@ -103,7 +108,6 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
return resultDataSet;
|
||||
}
|
||||
|
||||
|
||||
//获取公司下的所有人
|
||||
List<Long> orgIds = new ArrayList<>();
|
||||
orgIds.add(orgId);
|
||||
|
@ -139,43 +143,17 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
searchFilterList.add(new QFilter(DEV_KEY+"_user", QCP.equals,userId ));
|
||||
DataSet settlementDataSet = QueryServiceHelper.queryDataSet(this.getClass().getName() + Bill_ANNUAL_BUDGET,
|
||||
Bill_ANNUAL_BUDGET, selectSettlementFields.toString(), searchFilterList.toArray(new QFilter [] {}), null).orderBy(new String[]{DEV_KEY+"_user",DEV_KEY+"_year"});
|
||||
|
||||
|
||||
//获取配置
|
||||
List<QFilter> searchFilterListConf = new ArrayList<>();
|
||||
searchFilterListConf.add(new QFilter(DEV_KEY+"_class", QCP.equals, "BudgetActuRptItem"));
|
||||
DataSet repConf = QueryServiceHelper.queryDataSet(this.getClass().getName() + DEV_KEY+"_rep_conf",
|
||||
DEV_KEY+"_rep_conf", "zcgj_class as class,number,zcgj_val1 as val1", searchFilterListConf.toArray(new QFilter [] {}), null);
|
||||
|
||||
String FYF ="";//防疫费
|
||||
String PXF ="";//培训费
|
||||
String TXF ="";//通信费
|
||||
String YWZDF ="";//业务招待费
|
||||
|
||||
for (Row row : repConf) {
|
||||
if("FYF".equals(row.getString("number"))){
|
||||
FYF = row.getString("val1");
|
||||
}else if("PXF".equals(row.getString("number"))){
|
||||
PXF = row.getString("val1");
|
||||
}else if("TXF".equals(row.getString("number"))){
|
||||
TXF = row.getString("val1");
|
||||
}else if("YWZDF".equals(row.getString("number"))){
|
||||
YWZDF = row.getString("val1");
|
||||
}
|
||||
|
||||
if(settlementDataSet==null||settlementDataSet.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
logger.info(">>> 人员预算单: " + settlementDataSet.toString());
|
||||
|
||||
for (Row row : settlementDataSet) {
|
||||
String formatYear = dateFormat.format(row.getDate(DEV_KEY+"_year"));
|
||||
BigDecimal travel = row.getBigDecimal(DEV_KEY+"_travel");
|
||||
BigDecimal health = row.getBigDecimal(DEV_KEY+"_health");
|
||||
BigDecimal abroadTravel = row.getBigDecimal(DEV_KEY+"_abroad_travel");
|
||||
BigDecimal training = row.getBigDecimal(DEV_KEY+"_training");
|
||||
BigDecimal entertain = row.getBigDecimal(DEV_KEY+"_entertain");
|
||||
BigDecimal correspondence = row.getBigDecimal(DEV_KEY+"_correspondence");
|
||||
BigDecimal travel = row.getBigDecimal(DEV_KEY+"_travel") != null ? row.getBigDecimal(DEV_KEY+"_travel"):BigDecimal.ZERO ;
|
||||
BigDecimal health = row.getBigDecimal(DEV_KEY+"_health") != null ? row.getBigDecimal(DEV_KEY+"_health"):BigDecimal.ZERO;
|
||||
BigDecimal abroadTravel = row.getBigDecimal(DEV_KEY+"_abroad_travel") != null ?row.getBigDecimal(DEV_KEY+"_abroad_travel"):BigDecimal.ZERO ;
|
||||
BigDecimal training = row.getBigDecimal(DEV_KEY+"_training") != null ? row.getBigDecimal(DEV_KEY+"_training"):BigDecimal.ZERO ;
|
||||
BigDecimal entertain = row.getBigDecimal(DEV_KEY+"_entertain") != null ? row.getBigDecimal(DEV_KEY+"_entertain") :BigDecimal.ZERO;
|
||||
BigDecimal correspondence = row.getBigDecimal(DEV_KEY+"_correspondence") != null ? row.getBigDecimal(DEV_KEY+"_correspondence"):BigDecimal.ZERO;
|
||||
if(userYearMapData.containsKey(formatYear)){
|
||||
|
||||
Map<String, BigDecimal> stringBigDecimalMap = userYearMapData.get(formatYear);
|
||||
|
@ -292,7 +270,7 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
//汇总国内差旅费 FYXM0015.001、防疫费 FYXM002-CUS.001
|
||||
String itemnumber = itemRow.getString("itemnumber");
|
||||
String happendateStr = dateFormat.format(itemRow.getDate("happendate"));
|
||||
BigDecimal expenseamount = itemRow.getBigDecimal("expenseamount");
|
||||
BigDecimal expenseamount = itemRow.getBigDecimal("expenseamount")!=null ?itemRow.getBigDecimal("expenseamount"):BigDecimal.ZERO;
|
||||
|
||||
if(itemnumber.startsWith(FYF)){//防疫费
|
||||
healthRealTotal = healthRealTotal.add(expenseamount);
|
||||
|
@ -310,7 +288,7 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
DataSet tripreimburseDataSet = getTripreimburseDataSet(userId, year, false);
|
||||
for (Row itemRow : tripreimburseDataSet) {
|
||||
//国内差旅费
|
||||
BigDecimal orientryamount = itemRow.getBigDecimal("orientryamount");
|
||||
BigDecimal orientryamount = itemRow.getBigDecimal("orientryamount") !=null ?itemRow.getBigDecimal("orientryamount"):BigDecimal.ZERO;
|
||||
travelRealTotal = travelRealTotal.add(orientryamount);
|
||||
}
|
||||
|
||||
|
@ -320,14 +298,14 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
DataSet bdMaterialForeignDataSet = getDailyreimbursebillDataSet(userId, year,true);
|
||||
for (Row itemRow : bdMaterialForeignDataSet) {
|
||||
//获取因公临时出国报销金额
|
||||
BigDecimal expenseamount = itemRow.getBigDecimal("expenseamount");
|
||||
BigDecimal expenseamount = itemRow.getBigDecimal("expenseamount") !=null ?itemRow.getBigDecimal("expenseamount"):BigDecimal.ZERO;
|
||||
abroadTravelTotal = abroadTravelTotal.add(expenseamount);
|
||||
}
|
||||
//报销金额(差旅报销单报销金额,勾选了“因公临时出国”) er_tripreimbursebill
|
||||
DataSet tripreimburseForeignDataSet = getTripreimburseDataSet(userId, year, true);
|
||||
for (Row itemRow : tripreimburseForeignDataSet) {
|
||||
//获取因公临时出国报销金额
|
||||
BigDecimal orientryamount = itemRow.getBigDecimal("orientryamount");
|
||||
BigDecimal orientryamount = itemRow.getBigDecimal("orientryamount") !=null ? itemRow.getBigDecimal("orientryamount"):BigDecimal.ZERO;
|
||||
abroadTravelTotal = abroadTravelTotal.add(orientryamount);
|
||||
}
|
||||
|
||||
|
@ -386,7 +364,9 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(countMap.isEmpty()){
|
||||
return resultDataSet;
|
||||
}
|
||||
//汇总合计
|
||||
for (int year = startYear; year <= currentYear; year++) {
|
||||
Map<String, BigDecimal> stringBigDecimalMap = countMap.get(year + "a");
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.report;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 职务消费台账实体类
|
||||
*/
|
||||
class ExpenseReport {
|
||||
private Long reimburser; // 报销人
|
||||
private String billNumber; // 单据编号
|
||||
private String happenDateStr; // 费用发生日期
|
||||
private BigDecimal businessEntertainment = BigDecimal.ZERO; //商务招待
|
||||
private BigDecimal foreignEntertainment = BigDecimal.ZERO;//外事招待
|
||||
private BigDecimal importantOfficial = BigDecimal.ZERO;//重要公务
|
||||
private BigDecimal accommodation = BigDecimal.ZERO;//住宿
|
||||
private BigDecimal souvenirs = BigDecimal.ZERO;//纪念品
|
||||
private BigDecimal other = BigDecimal.ZERO;//其他(其他公务招待)
|
||||
private BigDecimal subtotal = BigDecimal.ZERO;//小计
|
||||
private BigDecimal travel = BigDecimal.ZERO;//国内差旅费用
|
||||
private BigDecimal abroadTravel = BigDecimal.ZERO;//因公临时出国费用
|
||||
private BigDecimal health = BigDecimal.ZERO;//防疫费用
|
||||
private BigDecimal correspondence = BigDecimal.ZERO;//通信费用
|
||||
private BigDecimal training = BigDecimal.ZERO;//培训费用
|
||||
private BigDecimal total = BigDecimal.ZERO;//合计
|
||||
|
||||
public ExpenseReport(Long reimburser, String billNumber, String happenDateStr) {
|
||||
this.reimburser = reimburser;
|
||||
this.billNumber = billNumber;
|
||||
this.happenDateStr = happenDateStr;
|
||||
}
|
||||
|
||||
public Long getReimburser() {
|
||||
return reimburser;
|
||||
}
|
||||
|
||||
public void setReimburser(Long reimburser) {
|
||||
this.reimburser = reimburser;
|
||||
}
|
||||
|
||||
public String getBillNumber() {
|
||||
return billNumber;
|
||||
}
|
||||
|
||||
public void setBillNumber(String billNumber) {
|
||||
this.billNumber = billNumber;
|
||||
}
|
||||
|
||||
public String getHappenDateStr() {
|
||||
return happenDateStr;
|
||||
}
|
||||
|
||||
public void setHappenDateStr(String happenDateStr) {
|
||||
this.happenDateStr = happenDateStr;
|
||||
}
|
||||
|
||||
public BigDecimal getBusinessEntertainment() {
|
||||
return businessEntertainment;
|
||||
}
|
||||
|
||||
public void setBusinessEntertainment(BigDecimal businessEntertainment) {
|
||||
this.businessEntertainment = businessEntertainment;
|
||||
}
|
||||
|
||||
public BigDecimal getForeignEntertainment() {
|
||||
return foreignEntertainment;
|
||||
}
|
||||
|
||||
public void setForeignEntertainment(BigDecimal foreignEntertainment) {
|
||||
this.foreignEntertainment = foreignEntertainment;
|
||||
}
|
||||
|
||||
public BigDecimal getImportantOfficial() {
|
||||
return importantOfficial;
|
||||
}
|
||||
|
||||
public void setImportantOfficial(BigDecimal importantOfficial) {
|
||||
this.importantOfficial = importantOfficial;
|
||||
}
|
||||
|
||||
public BigDecimal getAccommodation() {
|
||||
return accommodation;
|
||||
}
|
||||
|
||||
public void setAccommodation(BigDecimal accommodation) {
|
||||
this.accommodation = accommodation;
|
||||
}
|
||||
|
||||
public BigDecimal getSouvenirs() {
|
||||
return souvenirs;
|
||||
}
|
||||
|
||||
public void setSouvenirs(BigDecimal souvenirs) {
|
||||
this.souvenirs = souvenirs;
|
||||
}
|
||||
|
||||
public BigDecimal getOther() {
|
||||
return other;
|
||||
}
|
||||
|
||||
public void setOther(BigDecimal other) {
|
||||
this.other = other;
|
||||
}
|
||||
|
||||
public BigDecimal getSubtotal() {
|
||||
return subtotal;
|
||||
}
|
||||
|
||||
public void setSubtotal(BigDecimal subtotal) {
|
||||
this.subtotal = subtotal;
|
||||
}
|
||||
|
||||
public BigDecimal getTravel() {
|
||||
return travel;
|
||||
}
|
||||
|
||||
public void setTravel(BigDecimal travel) {
|
||||
this.travel = travel;
|
||||
}
|
||||
|
||||
public BigDecimal getAbroadTravel() {
|
||||
return abroadTravel;
|
||||
}
|
||||
|
||||
public void setAbroadTravel(BigDecimal abroadTravel) {
|
||||
this.abroadTravel = abroadTravel;
|
||||
}
|
||||
|
||||
public BigDecimal getHealth() {
|
||||
return health;
|
||||
}
|
||||
|
||||
public void setHealth(BigDecimal health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
public BigDecimal getCorrespondence() {
|
||||
return correspondence;
|
||||
}
|
||||
|
||||
public void setCorrespondence(BigDecimal correspondence) {
|
||||
this.correspondence = correspondence;
|
||||
}
|
||||
|
||||
public BigDecimal getTraining() {
|
||||
return training;
|
||||
}
|
||||
|
||||
public void setTraining(BigDecimal training) {
|
||||
this.training = training;
|
||||
}
|
||||
|
||||
public BigDecimal getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(BigDecimal total) {
|
||||
this.total = total;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,8 @@ import kd.bos.servicehelper.user.UserServiceHelper;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -30,6 +32,8 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
@Override
|
||||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
List<FilterItemInfo> filters = reportQueryParam.getFilter().getFilterItems();
|
||||
Long orgId = null;
|
||||
Date queryYear = null;
|
||||
List<Long> applierId = new ArrayList<>();
|
||||
for (FilterItemInfo filterItem : filters) {
|
||||
switch (filterItem.getPropName()) {
|
||||
|
@ -41,6 +45,12 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
}
|
||||
}
|
||||
break;
|
||||
/*case DEV_KEY+"_query_org":
|
||||
orgId = (filterItem.getValue() == null) ? null :Long.valueOf(String.valueOf(((DynamicObject) filterItem.getValue()).getPkValue()));
|
||||
break;*/
|
||||
case DEV_KEY+"_query_year":
|
||||
queryYear = filterItem.getDate();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -66,13 +76,25 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
|
||||
// 日期格式化
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
||||
/*if(orgId==null ){
|
||||
return resultDataSet;
|
||||
}*/
|
||||
List<QFilter> searchFilterList = new ArrayList<>();
|
||||
|
||||
// 查询条件
|
||||
QFilter[] filterArray = new QFilter[1];
|
||||
if(!applierId.isEmpty()){
|
||||
//查询申请人下的单据
|
||||
filterArray[0] = new QFilter("applier", QCP.in, applierId);
|
||||
searchFilterList.add(new QFilter("applier", QCP.in, applierId));
|
||||
}
|
||||
if(queryYear!=null){
|
||||
LocalDate localDate = dateToLocalDate(queryYear);
|
||||
LocalDate firstDay = getFirstDayOfYear(localDate.getYear());
|
||||
LocalDate lastDay = getLastDayOfYear(localDate.getYear());
|
||||
searchFilterList.add(new QFilter("tripentry.startdate", QCP.large_equals, firstDay));
|
||||
searchFilterList.add(new QFilter("tripentry.startdate", QCP.less_equals, lastDay));
|
||||
}
|
||||
|
||||
|
||||
DataSet bdMaterialDataSet = QueryServiceHelper.queryDataSet(
|
||||
this.getClass().getName(),
|
||||
"er_tripreimbursebill",
|
||||
|
@ -81,15 +103,20 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
"tripentry.entryentity.expenseitem.name as expenseitemname,tripentry.entryentity.expenseitem.attribute as attribute," +
|
||||
"tripentry.entryentity.orientryamount as orientryamount,tripentry.entryentity.notaxamount as notaxamount," +
|
||||
"tripentry.entryentity.taxamount as taxamount",
|
||||
filterArray, null
|
||||
searchFilterList.toArray(new QFilter [] {}), null
|
||||
).orderBy(new String[]{"applier", "startdate"});
|
||||
|
||||
if(bdMaterialDataSet == null || bdMaterialDataSet.isEmpty()){
|
||||
return resultDataSet;
|
||||
}
|
||||
// 汇总数据
|
||||
Map<Long, Map<String, Map<String, BigDecimal>>> allData = new HashMap<>();
|
||||
for (Row itemRow : bdMaterialDataSet) {
|
||||
Long applier = itemRow.getLong("applier");
|
||||
String attribute = itemRow.getString("attribute");
|
||||
Date startdate = itemRow.getDate("startdate");
|
||||
if(startdate == null){
|
||||
continue;
|
||||
}
|
||||
String startdateStr = dateFormat.format(startdate);
|
||||
BigDecimal orientryamount = itemRow.getBigDecimal("orientryamount");
|
||||
BigDecimal notaxamount = itemRow.getBigDecimal("notaxamount");
|
||||
|
@ -192,4 +219,27 @@ public class FeeDeductionRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
return rowData;
|
||||
}
|
||||
|
||||
// 获取某年份的第一天
|
||||
public static LocalDate getFirstDayOfYear(int year) {
|
||||
return LocalDate.of(year, 1, 1);
|
||||
}
|
||||
|
||||
// 获取某年份的最后一天
|
||||
public static LocalDate getLastDayOfYear(int year) {
|
||||
return LocalDate.of(year, 12, 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 java.util.Date 转换为 java.time.LocalDate
|
||||
* @param date java.util.Date
|
||||
* @return java.time.LocalDate
|
||||
*/
|
||||
public static LocalDate dateToLocalDate(Date date) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("日期不能为 null");
|
||||
}
|
||||
return date.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.report;
|
||||
|
||||
import kd.bos.entity.datamodel.events.PackageDataEvent;
|
||||
import kd.bos.entity.report.FilterInfo;
|
||||
import kd.bos.entity.report.ReportQueryParam;
|
||||
import kd.bos.report.events.CellStyleRule;
|
||||
import kd.bos.report.plugin.AbstractReportFormPlugin;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
@ -31,6 +33,21 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen
|
|||
super.setMergeColums(columns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verifyQuery(ReportQueryParam queryParam) {
|
||||
FilterInfo filter = queryParam.getFilter();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (filter.getValue("zcgj_query_org") == null){
|
||||
this.getView().showTipNotification("请选择查询组织!");
|
||||
return false;
|
||||
}
|
||||
if (filter.getValue("zcgj_query_year") == null){
|
||||
this.getView().showTipNotification("请选择查询年度!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void packageData(PackageDataEvent packageDataEvent) {
|
||||
super.packageData(packageDataEvent);
|
||||
|
|
|
@ -2,6 +2,8 @@ package zcgj.zcdev.zcdev.fs.plugin.report;
|
|||
|
||||
import kd.bos.algo.*;
|
||||
import kd.bos.algo.input.CollectionInput;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.report.AbstractReportListDataPlugin;
|
||||
import kd.bos.entity.report.FilterItemInfo;
|
||||
import kd.bos.entity.report.ReportQueryParam;
|
||||
|
@ -9,51 +11,82 @@ import kd.bos.logging.Log;
|
|||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 职工探亲休假台账
|
||||
* 职务消费休假台账
|
||||
* 报表取数插件
|
||||
*/
|
||||
public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin {
|
||||
private static final Log logger = LogFactory.getLog(PositionFeesRptQueryPlugin.class);
|
||||
private static final String DEV_KEY="zcgj";
|
||||
|
||||
private static final String FYF ="FYXM002.152";//防疫费(新增)
|
||||
private static final String TXF ="FYXM002.018";//通信费(通信与网络费)
|
||||
private static final String PXF ="FYXM002.006";//培训费
|
||||
private static final String YWZDF ="FYXM002.007";//业务招待费
|
||||
private static final String YWZD_SWZD ="FYXM002.007.004";//业务招待费-商务招待(新增)
|
||||
private static final String YWZD_WSZD ="FYXM002.007.005";//业务招待费-外事招待(新增)
|
||||
private static final String YWZD_ZYGW ="FYXM002.007.006";//业务招待费-重要公务(新增)
|
||||
private static final String YWZD_ZS ="FYXM002.007.007";//业务招待费-住宿(新增)
|
||||
private static final String YWZD_JNP ="FYXM002.007.008";//业务招待费-赠送纪念品(新增)
|
||||
private static final String YWZD_QT ="FYXM002.007.009";//业务招待费-其他公务招待(新增)
|
||||
|
||||
@Override
|
||||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
List<FilterItemInfo> filters = reportQueryParam.getFilter().getFilterItems();
|
||||
List<Long> applierId = new ArrayList<>();
|
||||
/* for (FilterItemInfo filterItem : filters) {
|
||||
Set<Long> applierId = new HashSet<>();
|
||||
Long orgId = null;
|
||||
Date queryYear = null;
|
||||
for (FilterItemInfo filterItem : filters) {
|
||||
switch (filterItem.getPropName()) {
|
||||
case "_queryuser.id":
|
||||
Object value = filterItem.getValue();
|
||||
if(value instanceof ArrayList){
|
||||
applierId = (ArrayList)value;
|
||||
}else{
|
||||
applierId.add(Long.valueOf(value.toString()));
|
||||
case DEV_KEY+"_query_users":
|
||||
DynamicObjectCollection users = (DynamicObjectCollection)filterItem.getValue();
|
||||
if(users != null){
|
||||
for (DynamicObject user : users) {
|
||||
applierId.add(Long.valueOf(String.valueOf(user.getPkValue())));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DEV_KEY+"_query_year":
|
||||
queryYear = filterItem.getDate();
|
||||
break;
|
||||
case DEV_KEY+"_query_org":
|
||||
orgId = (filterItem.getValue() == null) ? null :Long.valueOf(String.valueOf(((DynamicObject) filterItem.getValue()).getPkValue()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
// 报表字段及数据类型
|
||||
String[] FIELDS = {
|
||||
DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_date",
|
||||
DEV_KEY+"_billno",DEV_KEY+"_serve_business", DEV_KEY+"_serve_outside",
|
||||
DEV_KEY+"_serve_significant",DEV_KEY+"_serve_other_business",DEV_KEY+"_serve_souvenir",
|
||||
DEV_KEY+"_serve_total",DEV_KEY+"_travel",DEV_KEY+"_abroad_travel",
|
||||
DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_date",DEV_KEY+"_bill_number",
|
||||
|
||||
DEV_KEY+"_serve_business", DEV_KEY+"_serve_outside",DEV_KEY+"_serve_significant",
|
||||
DEV_KEY+"_serve_other_business",DEV_KEY+"_serve_lodging",
|
||||
DEV_KEY+"_serve_souvenir",DEV_KEY+"_serve_total",
|
||||
|
||||
DEV_KEY+"_travel",DEV_KEY+"_abroad_travel",
|
||||
DEV_KEY+"_health",DEV_KEY+"_correspondence",DEV_KEY+"_training",
|
||||
DEV_KEY+"_total"
|
||||
};
|
||||
DataType[] DATATYPES = {
|
||||
DataType.LongType,DataType.StringType, DataType.StringType,
|
||||
DataType.StringType,DataType.BigDecimalType, DataType.BigDecimalType,
|
||||
DataType.BigDecimalType,DataType.BigDecimalType,DataType.BigDecimalType,
|
||||
DataType.BigDecimalType,DataType.BigDecimalType,DataType.BigDecimalType,
|
||||
DataType.LongType,DataType.StringType, DataType.StringType,DataType.StringType,
|
||||
|
||||
DataType.BigDecimalType, DataType.BigDecimalType,DataType.BigDecimalType,
|
||||
DataType.BigDecimalType,DataType.BigDecimalType,
|
||||
DataType.BigDecimalType,DataType.BigDecimalType,
|
||||
|
||||
DataType.BigDecimalType,DataType.BigDecimalType,
|
||||
DataType.BigDecimalType,DataType.BigDecimalType,DataType.BigDecimalType,
|
||||
DataType.BigDecimalType
|
||||
};
|
||||
|
@ -64,51 +97,289 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
CollectionInput inputs = new CollectionInput(rowMeta, coll);
|
||||
DataSet resultDataSet = Algo.create(this.getClass().getName()).createDataSet(inputs);
|
||||
|
||||
// 日期格式化
|
||||
if(orgId==null || queryYear == null){
|
||||
return resultDataSet;
|
||||
}
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// 查询条件
|
||||
QFilter[] filterArray = new QFilter[1];
|
||||
//获取公司下的所有人
|
||||
List<Long> orgIds = new ArrayList<>();
|
||||
orgIds.add(orgId);
|
||||
List<Long> allUsersOfOrg = UserServiceHelper.getAllUsersOfOrg(orgIds);
|
||||
if(!applierId.isEmpty()){
|
||||
//查询申请人下的单据
|
||||
filterArray[0] = new QFilter("applier", QCP.in, applierId);
|
||||
//通过查询用户过滤组织下的人
|
||||
allUsersOfOrg = allUsersOfOrg.stream().filter(applierId::contains).collect(Collectors.toList());
|
||||
}
|
||||
DataSet bdMaterialDataSet = QueryServiceHelper.queryDataSet(
|
||||
this.getClass().getName(),
|
||||
"er_tripreimbursebill",
|
||||
"id,applier,applier.name as appliername,applier.phone as appliernamephone,description," +
|
||||
"org.name as orgname,triptype.name as triptypename," +
|
||||
"tripentry.to.name as toname,tripentry.startdate as startdate" ,
|
||||
filterArray, null
|
||||
).orderBy(new String[]{"applier", "startdate"});
|
||||
LocalDate localDate = dateToLocalDate(queryYear);
|
||||
int year = localDate.getYear();
|
||||
|
||||
// 汇总数据
|
||||
Map<Long, Map<String, Map<String, BigDecimal>>> allData = new HashMap<>();
|
||||
for (Row itemRow : bdMaterialDataSet) {
|
||||
Long applier = itemRow.getLong("applier");
|
||||
String appliername = itemRow.getString("appliername");
|
||||
String orgname = itemRow.getString("orgname");
|
||||
String appliernamephone = itemRow.getString("appliernamephone");
|
||||
Date startdate = itemRow.getDate("startdate");
|
||||
String startdateStr = dateFormat.format(startdate);
|
||||
String triptypename = itemRow.getString("triptypename");
|
||||
String toname = itemRow.getString("toname");
|
||||
String description = itemRow.getString("description");
|
||||
// 用 Map 来按照报销人、单据编号、费用发生日期分组
|
||||
Map<String, ExpenseReport> reportMap = new LinkedHashMap<>();
|
||||
for (Long userId : allUsersOfOrg) {
|
||||
//费用报销单数据
|
||||
DynamicObject[] dailyreimbursebillDataSet = getDailyreimbursebillDataSet(userId, year);
|
||||
for (DynamicObject dynamicObject : dailyreimbursebillDataSet) {
|
||||
String billno = dynamicObject.getString("billno");//单据编号
|
||||
//判罚是否因公出国
|
||||
Boolean isBusinessForeign = dynamicObject.getBoolean(DEV_KEY+"_is_business_foreign");//单据编号
|
||||
|
||||
DynamicObjectCollection entrys = dynamicObject.getDynamicObjectCollection("expenseentryentity");
|
||||
for (DynamicObject entry : entrys) {
|
||||
DynamicObject expenseitemObj = entry.getDynamicObject("expenseitem"); //费用项目
|
||||
Date happendate = entry.getDate("happendate");//费用发生日期
|
||||
String itemNumber = expenseitemObj.getString("number");//费用项目编码
|
||||
String happendateStr = dateFormat.format(happendate);//费用发生日期str
|
||||
BigDecimal expenseamount = entry.getBigDecimal("expenseamount");//报销金额
|
||||
|
||||
// 生成唯一的键:报销人 + 单据编号 + 费用发生日期
|
||||
String key = userId + "-" + billno + "-" + happendateStr;
|
||||
|
||||
// 根据键获取报表对象
|
||||
ExpenseReport report = reportMap.get(key);
|
||||
if (report == null) {
|
||||
report = new ExpenseReport(userId, billno, happendateStr);
|
||||
reportMap.put(key, report);
|
||||
}
|
||||
if(!isBusinessForeign){
|
||||
// 为该行添加费用
|
||||
//report.addExpense(expenseType, amount);
|
||||
if(itemNumber.startsWith(FYF)){//防疫费
|
||||
BigDecimal health = report.getHealth().add(expenseamount);
|
||||
report.setHealth(health);
|
||||
}else if(itemNumber.startsWith(TXF)){//日常费用-通信费用
|
||||
BigDecimal correspondence = report.getCorrespondence().add(expenseamount);
|
||||
report.setCorrespondence(correspondence);
|
||||
}else if(itemNumber.startsWith(PXF)){//日常费用-培训费用
|
||||
BigDecimal training = report.getTraining().add(expenseamount);
|
||||
report.setTraining(training);
|
||||
}else if(itemNumber.startsWith(YWZD_SWZD)){//日常费用-业务招待费-商务招待
|
||||
//businessEntertainment
|
||||
BigDecimal businessEntertainment = report.getBusinessEntertainment().add(expenseamount);
|
||||
report.setBusinessEntertainment(businessEntertainment);
|
||||
}else if(itemNumber.startsWith(YWZD_WSZD)){//日常费用-业务招待费-外事招待
|
||||
//foreignEntertainment
|
||||
BigDecimal foreignEntertainment = report.getForeignEntertainment().add(expenseamount);
|
||||
report.setForeignEntertainment(foreignEntertainment);
|
||||
}
|
||||
else if(itemNumber.startsWith(YWZD_ZYGW)){//日常费用-业务招待费-重要公务
|
||||
//importantOfficial
|
||||
BigDecimal importantOfficial = report.getImportantOfficial().add(expenseamount);
|
||||
report.setImportantOfficial(importantOfficial);
|
||||
}
|
||||
else if(itemNumber.startsWith(YWZD_ZS)){//日常费用-业务招待费-住宿
|
||||
//accommodation
|
||||
BigDecimal accommodation = report.getAccommodation().add(expenseamount);
|
||||
report.setAccommodation(accommodation);
|
||||
}
|
||||
else if(itemNumber.startsWith(YWZD_JNP)){//日常费用-业务招待费-纪念品
|
||||
//souvenirs
|
||||
BigDecimal souvenirs = report.getSouvenirs().add(expenseamount);
|
||||
report.setSouvenirs(souvenirs);
|
||||
}else if(itemNumber.startsWith(YWZD_QT)){//日常费用-业务招待费-其他
|
||||
//other
|
||||
BigDecimal other = report.getOther().add(expenseamount);
|
||||
report.setOther(other);
|
||||
}
|
||||
}else{
|
||||
//费用明细中的所有金额因公临时出国费用
|
||||
BigDecimal abroadTravel = report.getAbroadTravel().add(expenseamount);
|
||||
report.setAbroadTravel(abroadTravel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//差旅报销单数据
|
||||
DynamicObject[] tripreimburseDataSet = getTripreimburseDataSet(userId, year);
|
||||
for (DynamicObject dynamicObject : tripreimburseDataSet) {
|
||||
String billno = dynamicObject.getString("billno");//单据编号
|
||||
//判罚是否因公出国
|
||||
Boolean isBusinessForeign = dynamicObject.getBoolean(DEV_KEY+"_is_business_foreign");//单据编号
|
||||
DynamicObjectCollection entrys = dynamicObject.getDynamicObjectCollection("tripentry");
|
||||
for (DynamicObject entry : entrys) {
|
||||
Date happendate = entry.getDate("startdate");//出差开始日期
|
||||
String happendateStr = dateFormat.format(happendate);//费用发生日期str
|
||||
DynamicObjectCollection entryentity = entry.getDynamicObjectCollection("entryentity");
|
||||
for (DynamicObject object : entryentity) {
|
||||
BigDecimal orientryamount = object.getBigDecimal("orientryamount");//报销金额
|
||||
// 生成唯一的键:报销人 + 单据编号 + 费用发生日期
|
||||
String key = userId + "-" + billno + "-" + happendateStr;
|
||||
// 根据键获取报表对象
|
||||
ExpenseReport report = reportMap.get(key);
|
||||
if (report == null) {
|
||||
report = new ExpenseReport(userId, billno, happendateStr);
|
||||
reportMap.put(key, report);
|
||||
}
|
||||
if(!isBusinessForeign){
|
||||
//费用明细中的所有金额因公临时出国费用
|
||||
BigDecimal travel = report.getTravel().add(orientryamount);
|
||||
report.setTravel(travel);
|
||||
}else{
|
||||
//费用明细中的所有金额因公临时出国费用
|
||||
BigDecimal abroadTravel = report.getAbroadTravel().add(orientryamount);
|
||||
report.setAbroadTravel(abroadTravel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object[] totalRow = new Object[FIELDS.length];
|
||||
totalRow[0] = applier;
|
||||
totalRow[1] = appliername;
|
||||
totalRow[2] = orgname;
|
||||
totalRow[3] = startdateStr;
|
||||
totalRow[4] = triptypename;
|
||||
totalRow[5] = toname;
|
||||
totalRow[6] = appliernamephone;
|
||||
totalRow[7] = description;
|
||||
coll.add(totalRow);
|
||||
}
|
||||
//合计汇总
|
||||
ExpenseReport totalReport = new ExpenseReport(null, null, null);
|
||||
|
||||
ArrayList<ExpenseReport> reportsList = new ArrayList<>(reportMap.values());
|
||||
// 打印每一行报表
|
||||
for (ExpenseReport report : reportsList) {
|
||||
Map<String, Object> userInfoByID = UserServiceHelper.getUserInfoByID(report.getReimburser());
|
||||
String username = String.valueOf(userInfoByID.get("name"));//报销人
|
||||
|
||||
Object [] tempData = new Object [FIELDS.length];
|
||||
coll.add(tempData);
|
||||
tempData[0] = report.getReimburser();
|
||||
tempData[1] = username;
|
||||
tempData[2] = report.getHappenDateStr();
|
||||
tempData[3] = report.getBillNumber();
|
||||
BigDecimal businessEntertainment = report.getBusinessEntertainment();
|
||||
totalReport.setBusinessEntertainment(totalReport.getBusinessEntertainment().add(businessEntertainment));
|
||||
tempData[4] = businessEntertainment;
|
||||
BigDecimal foreignEntertainment = report.getForeignEntertainment();
|
||||
totalReport.setForeignEntertainment(totalReport.getForeignEntertainment().add(foreignEntertainment));
|
||||
tempData[5] = foreignEntertainment;
|
||||
BigDecimal importantOfficial = report.getImportantOfficial();
|
||||
totalReport.setImportantOfficial(totalReport.getImportantOfficial().add(importantOfficial));
|
||||
tempData[6] = importantOfficial;
|
||||
BigDecimal other = report.getOther();
|
||||
totalReport.setOther(totalReport.getOther().add(other));
|
||||
tempData[7] = other;
|
||||
BigDecimal accommodation = report.getAccommodation();
|
||||
totalReport.setAccommodation(totalReport.getAccommodation().add(accommodation));
|
||||
tempData[8] = accommodation;
|
||||
BigDecimal souvenirs = report.getSouvenirs();
|
||||
totalReport.setSouvenirs(totalReport.getSouvenirs().add(souvenirs));
|
||||
tempData[9] = souvenirs;
|
||||
BigDecimal subtotal = businessEntertainment.add(foreignEntertainment)
|
||||
.add(importantOfficial).add(other)
|
||||
.add(accommodation).add(souvenirs);
|
||||
totalReport.setSubtotal(totalReport.getSubtotal().add(subtotal));
|
||||
tempData[10] = subtotal;
|
||||
BigDecimal travel = report.getTravel();
|
||||
totalReport.setTravel(totalReport.getTravel().add(travel));
|
||||
tempData[11] = travel;//travel
|
||||
BigDecimal abroadTravel = report.getAbroadTravel();
|
||||
totalReport.setAbroadTravel(totalReport.getAbroadTravel().add(abroadTravel));
|
||||
tempData[12] = abroadTravel;
|
||||
BigDecimal health = report.getHealth();
|
||||
totalReport.setHealth(totalReport.getHealth().add(health));
|
||||
tempData[13] = health;
|
||||
BigDecimal correspondence = report.getCorrespondence();
|
||||
totalReport.setCorrespondence(totalReport.getCorrespondence().add(correspondence));
|
||||
tempData[14] = correspondence;
|
||||
BigDecimal training = report.getTraining();
|
||||
totalReport.setTraining(totalReport.getTraining().add(training));
|
||||
tempData[15] = training;
|
||||
|
||||
BigDecimal total = subtotal.add(travel).add(abroadTravel).add(health).add(correspondence).add(training);
|
||||
totalReport.setTotal(totalReport.getTotal().add(total));
|
||||
tempData[16] = total;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Object [] tempData = new Object [FIELDS.length];
|
||||
coll.add(tempData);
|
||||
tempData[1] = "合计";
|
||||
tempData[4] = totalReport.getBusinessEntertainment();
|
||||
tempData[5] = totalReport.getForeignEntertainment();
|
||||
tempData[6] = totalReport.getImportantOfficial();
|
||||
tempData[7] = totalReport.getOther();
|
||||
tempData[8] = totalReport.getAccommodation();
|
||||
tempData[9] = totalReport.getSouvenirs();
|
||||
tempData[10] = totalReport.getSubtotal();
|
||||
tempData[11] = totalReport.getTravel();
|
||||
tempData[12] = totalReport.getAbroadTravel();
|
||||
tempData[13] = totalReport.getHealth();
|
||||
tempData[14] = totalReport.getCorrespondence();
|
||||
tempData[15] = totalReport.getTraining();
|
||||
tempData[16] = totalReport.getTotal();
|
||||
|
||||
|
||||
return resultDataSet;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取费用报销单数据
|
||||
* @param userId 用户id
|
||||
* @param year 统计年份
|
||||
* @return 数据集
|
||||
*/
|
||||
public DynamicObject[] getDailyreimbursebillDataSet(Long userId, Integer year){
|
||||
LocalDate firstDay = getFirstDayOfYear(year);
|
||||
LocalDate lastDay = getLastDayOfYear(year);
|
||||
List<QFilter> searchFilterList = new ArrayList<>();
|
||||
searchFilterList.add(new QFilter("applier", QCP.equals, userId));
|
||||
searchFilterList.add(new QFilter("expenseentryentity.happendate", QCP.large_equals, firstDay));
|
||||
searchFilterList.add(new QFilter("expenseentryentity.happendate", QCP.less_equals, lastDay));
|
||||
DynamicObject[] load = BusinessDataServiceHelper.load("er_dailyreimbursebill",
|
||||
"id,description,billno,expenseentryentity," +
|
||||
DEV_KEY+"_is_business_foreign,"+
|
||||
"expenseentryentity.happendate," + //费用发生日期
|
||||
"expenseentryentity.expenseitem," + //费用项目
|
||||
"expenseentryentity.expenseamount ", searchFilterList.toArray(new QFilter [] {}));
|
||||
return load;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取差旅报销单数据
|
||||
* @param userId 用户id
|
||||
* @param year 统计年份
|
||||
* @return 数据集
|
||||
*/
|
||||
private DynamicObject[] getTripreimburseDataSet(Long userId, Integer year) {
|
||||
LocalDate firstDay = getFirstDayOfYear(year);
|
||||
LocalDate lastDay = getLastDayOfYear(year);
|
||||
List<QFilter> searchFilterList = new ArrayList<>();
|
||||
//searchFilterList.add(new QFilter(DEV_KEY+"_year", QCP.equals, getFirstDayOfYear(year)));
|
||||
searchFilterList.add(new QFilter("applier", QCP.equals, userId));
|
||||
searchFilterList.add(new QFilter("tripentry.startdate", QCP.large_equals, firstDay));
|
||||
searchFilterList.add(new QFilter("tripentry.startdate", QCP.less_equals, lastDay));
|
||||
//searchFilterList.add(new QFilter(DEV_KEY+"_is_business_foreign", QCP.equals, isBusinessForeign));
|
||||
/*DataSet bdMaterialDataSet = QueryServiceHelper.queryDataSet(
|
||||
this.getClass().getName(),
|
||||
"er_tripreimbursebill",
|
||||
"id,applier,billno,tripentry.startdate as startdate," +
|
||||
"tripentry.entryentity.orientryamount as orientryamount" ,
|
||||
searchFilterList.toArray(new QFilter [] {}), null
|
||||
).orderBy(new String[]{"applier", "startdate"});*/
|
||||
DynamicObject[] load = BusinessDataServiceHelper.load("er_tripreimbursebill",
|
||||
"id,description,billno,expenseentryentity," +
|
||||
DEV_KEY+"_is_business_foreign,"+
|
||||
"id,applier,billno,tripentry.startdate,tripentry.entryentity," + //费用发生日期
|
||||
"entryentity.orientryamount", //报销金额
|
||||
searchFilterList.toArray(new QFilter [] {}));
|
||||
return load;
|
||||
}
|
||||
|
||||
// 获取某年份的第一天
|
||||
public static LocalDate getFirstDayOfYear(int year) {
|
||||
return LocalDate.of(year, 1, 1);
|
||||
}
|
||||
|
||||
// 获取某年份的最后一天
|
||||
public static LocalDate getLastDayOfYear(int year) {
|
||||
return LocalDate.of(year, 12, 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 java.util.Date 转换为 java.time.LocalDate
|
||||
* @param date java.util.Date
|
||||
* @return java.time.LocalDate
|
||||
*/
|
||||
public static LocalDate dateToLocalDate(Date date) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("日期不能为 null");
|
||||
}
|
||||
return date.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ import kd.bos.servicehelper.QueryServiceHelper;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -30,6 +32,8 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
List<FilterItemInfo> filters = reportQueryParam.getFilter().getFilterItems();
|
||||
List<Long> applierId = new ArrayList<>();
|
||||
Long orgId = null;
|
||||
Date queryYear = null;
|
||||
for (FilterItemInfo filterItem : filters) {
|
||||
switch (filterItem.getPropName()) {
|
||||
case DEV_KEY+"_query_users":
|
||||
|
@ -40,6 +44,12 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
}
|
||||
}
|
||||
break;
|
||||
/*case DEV_KEY+"_query_org":
|
||||
orgId = (filterItem.getValue() == null) ? null :Long.valueOf(String.valueOf(((DynamicObject) filterItem.getValue()).getPkValue()));
|
||||
break;*/
|
||||
case DEV_KEY+"_query_year":
|
||||
queryYear = filterItem.getDate();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -68,17 +78,26 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
// 日期格式化
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
/*if(orgId==null ){
|
||||
return resultDataSet;
|
||||
}*/
|
||||
|
||||
// 查询条件
|
||||
List<QFilter> filterList = new ArrayList<>();
|
||||
filterList.add(new QFilter(DEV_KEY+"_is_visit", QCP.equals, true));
|
||||
List<QFilter> searchFilterList = new ArrayList<>();
|
||||
searchFilterList.add(new QFilter(DEV_KEY+"_is_visit", QCP.equals, true));
|
||||
//QFilter[] filterArray = new QFilter[1];
|
||||
if(!applierId.isEmpty()){
|
||||
//查询申请人下的单据
|
||||
//filterArray[0] = new QFilter("applier", QCP.in, applierId);
|
||||
filterList.add(new QFilter("applier", QCP.in, applierId));
|
||||
searchFilterList.add(new QFilter("applier", QCP.in, applierId));
|
||||
}
|
||||
QFilter[] array = filterList.toArray(new QFilter[0]);
|
||||
|
||||
if(queryYear!=null){
|
||||
LocalDate localDate = dateToLocalDate(queryYear);
|
||||
LocalDate firstDay = getFirstDayOfYear(localDate.getYear());
|
||||
LocalDate lastDay = getLastDayOfYear(localDate.getYear());
|
||||
searchFilterList.add(new QFilter("zcgj_holiday_start_time", QCP.large_equals, firstDay));
|
||||
searchFilterList.add(new QFilter("zcgj_holiday_start_time", QCP.less_equals, lastDay));
|
||||
}
|
||||
DataSet bdMaterialDataSet = QueryServiceHelper.queryDataSet(
|
||||
this.getClass().getName(),
|
||||
"er_dailyreimbursebill",
|
||||
|
@ -86,7 +105,7 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
"org.name as orgname,'探亲休假' as triptypename," +
|
||||
"zcgj_holiday_address as address," +
|
||||
"zcgj_holiday_start_time as startdate,zcgj_holiday_end_time as enddate" ,
|
||||
array, null
|
||||
searchFilterList.toArray(new QFilter [] {}), null
|
||||
).orderBy(new String[]{"applier", "startdate"});
|
||||
|
||||
// 汇总数据
|
||||
|
@ -120,5 +139,27 @@ public class VisitRptQueryPlugin extends AbstractReportListDataPlugin {
|
|||
}
|
||||
|
||||
|
||||
// 获取某年份的第一天
|
||||
public static LocalDate getFirstDayOfYear(int year) {
|
||||
return LocalDate.of(year, 1, 1);
|
||||
}
|
||||
|
||||
// 获取某年份的最后一天
|
||||
public static LocalDate getLastDayOfYear(int year) {
|
||||
return LocalDate.of(year, 12, 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 java.util.Date 转换为 java.time.LocalDate
|
||||
* @param date java.util.Date
|
||||
* @return java.time.LocalDate
|
||||
*/
|
||||
public static LocalDate dateToLocalDate(Date date) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("日期不能为 null");
|
||||
}
|
||||
return date.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue