1.报销单问题修复

2.台账查询报错修复
This commit is contained in:
zhangzhiguo 2024-12-11 20:14:50 +08:00
parent e0c6e8ab2e
commit 74268c7dd1
5 changed files with 153 additions and 2 deletions

View File

@ -0,0 +1,71 @@
package zcgj.zcdev.zcdev.fs.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.operate.Submit;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.sdk.plugin.Plugin;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
/**
* 对公报销单去年合同提醒插件
*/
public class PublicreimbursebillContractPlugin extends AbstractBillPlugIn implements Plugin{
private static final Log log = LogFactory.getLog(PublicreimbursebillContractPlugin.class);
//开发商标识
private static final String prefix ="zcgj";
//预付单的关联合同标识
private final static String CONTRACT_ENTRY_ENTITY = "contractentry";
@Override
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
if((args.getSource() instanceof Submit) ) {
Submit source = (Submit) args.getSource();
if (source.getOperateKey().equals("submit")) {
//获取当前页面的数据包
DynamicObject dataEntity = this.getModel().getDataEntity(true);
//获取单据体数据的集合
DynamicObjectCollection goodsEntities=dataEntity.getDynamicObjectCollection(CONTRACT_ENTRY_ENTITY);
boolean isMsg = false;
for (DynamicObject entryObj : goodsEntities) {
//获取合同签订日期
Date signdate = entryObj.getDate("signdate");
LocalDate localDate = dateToLocalDate(signdate);
int signdateYear = localDate.getYear();
int currentYear = LocalDate.now().getYear();
if(signdateYear<currentYear) {
isMsg = true;
}
}
if(isMsg){
this.getView().showTipNotification("去年合同不占用本年预算");
}
}
}
}
/**
* 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();
}
}

View File

@ -4,6 +4,8 @@ import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.entity.operate.Submit;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.logging.Log;
@ -46,7 +48,8 @@ public class TripreimbursebillPlugin extends AbstractBillPlugIn implements Plug
Integer caldaycount = entryentity.getInt("caldaycount");//标准天数
//如果选择了上浮20%则按照上浮20%进行判断
if(isfloating20){
BigDecimal multiply = tripstandardamount.multiply(new BigDecimal("1.2")).multiply(new BigDecimal(caldaycount));
//BigDecimal multiply = tripstandardamount.multiply(new BigDecimal("1.2")).multiply(new BigDecimal(caldaycount));
BigDecimal multiply = tripstandardamount.multiply(new BigDecimal(caldaycount));
//-1表示小于0是等于1是大于
if(orientryamount.compareTo(multiply) > 0){
this.getView().showTipNotification("报销住宿超出标准上浮20%");
@ -73,4 +76,44 @@ public class TripreimbursebillPlugin extends AbstractBillPlugIn implements Plug
}
}
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String name = e.getProperty().getName();
if(name.equals("zcgj_isfloating20")){
IDataModel model = this.getModel();
ChangeData[] changeSet = e.getChangeSet();
Boolean isfloating20 = (Boolean)changeSet[0].getNewValue();
String zsKey = String.valueOf(model.getValue("zcgj_zs_key"));
//获取当前费用为住宿的
DynamicObjectCollection tripentryCollection = model.getEntryEntity("tripentry");
//tripentry.get(0).getDynamicObjectCollection("entryentity").get(2).getDynamicObject("expenseitem").getString("number");
for (DynamicObject tripentry : tripentryCollection) {
DynamicObjectCollection entryentityCollection = tripentry.getDynamicObjectCollection("entryentity");
for (DynamicObject entryentity : entryentityCollection) {
DynamicObject expenseitem = entryentity.getDynamicObject("expenseitem");
String zsNumber = expenseitem.getString("number");
if(zsKey.equals(zsNumber)){
BigDecimal orientryamount = entryentity.getBigDecimal("orientryamount");//报销金额
BigDecimal tripstandardamount = entryentity.getBigDecimal("tripstandardamount");//差旅标准金额
BigDecimal tripstandardamountOld = tripstandardamount;//差旅标准金额
Integer caldaycount = entryentity.getInt("caldaycount");//标准天数
//如果选择了上浮20%则按照上浮20%进行判断
if(isfloating20){
BigDecimal multiply = tripstandardamount.multiply(new BigDecimal("1.2"));
entryentity.set("tripstandardamount",multiply);
}else{
entryentity.set("tripstandardamount",tripstandardamountOld);
}
this.getView().updateView("entryentity");
this.getView().showTipNotification(tripstandardamount+" "+tripstandardamountOld);
}
}
}
}
}
}

View File

@ -1,6 +1,8 @@
package zcgj.zcdev.zcdev.fs.plugin.report;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.PackageDataEvent;
import kd.bos.entity.report.FilterInfo;
import kd.bos.entity.report.ReportQueryParam;
@ -35,6 +37,15 @@ public class BudgetActuRptListPlugin extends AbstractReportFormPlugin implements
super.packageData(packageDataEvent);
}
@Override
public void initDefaultQueryParam(ReportQueryParam queryParam) {
super.initDefaultQueryParam(queryParam);
IDataModel model = this.getModel();
//获取当前登陆人所在组织
long orgId = RequestContext.get().getOrgId();
model.setValue("zcgj_query_org",orgId);
}
@Override
public boolean verifyQuery(ReportQueryParam queryParam) {
FilterInfo filter = queryParam.getFilter();
@ -46,6 +57,8 @@ public class BudgetActuRptListPlugin extends AbstractReportFormPlugin implements
return true;
}
@Override
public void setCellStyleRules(List<CellStyleRule> cellStyleRules) {
for (String field : FIELDS) {

View File

@ -1,5 +1,7 @@
package zcgj.zcdev.zcdev.fs.plugin.report;
import kd.bos.context.RequestContext;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.PackageDataEvent;
import kd.bos.entity.report.FilterInfo;
import kd.bos.entity.report.ReportQueryParam;
@ -35,6 +37,15 @@ public class FeeDeductionRptListPlugin extends AbstractReportFormPlugin implemen
super.packageData(packageDataEvent);
}
@Override
public void initDefaultQueryParam(ReportQueryParam queryParam) {
super.initDefaultQueryParam(queryParam);
IDataModel model = this.getModel();
//获取当前登陆人所在组织
long orgId = RequestContext.get().getOrgId();
model.setValue("zcgj_query_org",orgId);
}
@Override
public boolean verifyQuery(ReportQueryParam queryParam) {
FilterInfo filter = queryParam.getFilter();

View File

@ -1,5 +1,7 @@
package zcgj.zcdev.zcdev.fs.plugin.report;
import kd.bos.context.RequestContext;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.PackageDataEvent;
import kd.bos.entity.report.FilterInfo;
import kd.bos.entity.report.ReportQueryParam;
@ -7,10 +9,11 @@ import kd.bos.report.events.CellStyleRule;
import kd.bos.report.plugin.AbstractReportFormPlugin;
import kd.sdk.plugin.Plugin;
import java.util.Date;
import java.util.List;
/**
* 领导预算汇总与实际台账
* 职务消费台账
* 报表格式化插件
*/
public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implements Plugin {
@ -33,6 +36,16 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen
super.setMergeColums(columns);
}
@Override
public void initDefaultQueryParam(ReportQueryParam queryParam) {
super.initDefaultQueryParam(queryParam);
IDataModel model = this.getModel();
//获取当前登陆人所在组织
long orgId = RequestContext.get().getOrgId();
model.setValue("zcgj_query_org",orgId);
model.setValue("zcgj_query_year",new Date());
}
@Override
public boolean verifyQuery(ReportQueryParam queryParam) {
FilterInfo filter = queryParam.getFilter();