1.上浮20%控制

2.附件必填校验
This commit is contained in:
zhangzhiguo 2024-12-13 09:35:25 +08:00
parent de4a2d76a6
commit 9aad5b82b7
5 changed files with 534 additions and 49 deletions

View File

@ -0,0 +1,378 @@
package zcgj.zcdev.zcdev.fs.plugin.form;
import kd.bos.algo.DataSet;
import kd.bos.algo.Row;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.ExtendedDataEntity;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.validate.AbstractValidator;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.sdk.plugin.Plugin;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Month;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
* 费用报销单探亲检查
*/
public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
private static final String prefix ="zcgj";
@Override
public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e);
e.getFieldKeys().add("zcgj_holiday_start_time");
e.getFieldKeys().add("zcgj_holiday_end_time");
e.getFieldKeys().add("applier");
e.getFieldKeys().add("zcgj_is_visit");
e.getFieldKeys().add("zcgj_visit_type");
e.getFieldKeys().add("zcgj_is_home");
e.getFieldKeys().add("zcgj_visit_type");
e.getFieldKeys().add("zcgj_holiday_days");
e.getFieldKeys().add("bizdate");
e.getFieldKeys().add("billstatus");
}
@Override
public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e);
e.getValidators().add(new ValidatorExt());
}
class ValidatorExt extends AbstractValidator {
@Override
public void validate() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy");
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
int i =0;
Map<Long,Map<String,Object>> allMap = new HashMap<>();
//当前提交的探亲单据id集合
Map<Long,List<Long>> currentBillIdListMap = new HashMap<>();
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
long aLong = dataEntity.getLong("id");
//获取报销人
DynamicObject applier = dataEntity.getDynamicObject("applier");
long applierId = applier.getLong("id");
//获取休假开始时间
Date startTime = dataEntity.getDate(prefix + "_holiday_start_time");
//获取休假结束时间
Date endTime = dataEntity.getDate(prefix + "_holiday_end_time");
//获取休假天数
Integer days = dataEntity.getInt(prefix + "_holiday_days");
//获取申请日期
Date bizdate = dataEntity.getDate( "bizdate");
//获取是否探亲
//如果是探亲则进行逻辑判断
boolean isVisit = dataEntity.getBoolean(prefix + "_is_visit");
boolean isHome = dataEntity.getBoolean(prefix + "_is_home");
//探亲类型 1探望父母2探望配偶
String visitType = dataEntity.getString(prefix + "_visit_type");
if(isVisit){
//获取当前人的探亲假配置
QFilter[] visitSetFilterArray = new QFilter[1];
visitSetFilterArray[0] = new QFilter(prefix+"_user", QCP.equals, applierId);
DynamicObject dynamicObject = QueryServiceHelper.queryOne( prefix+"_user_visit_set",
"id,zcgj_visit_times as visitTime,zcgj_visit_days as visitDays,zcgj_married_status as marriedStatus," +
"zcgj_married_parents_year as marriedParentsYear,zcgj_married_parents_time as marriedParentsTime," +
"zcgj_married_spouse_year as marriedSpouseYear,zcgj_married_spouse_time as marriedSpouseTime," +
"zcgj_unmarried_parents_y as unmarriedParentsYear,zcgj_unmarried_parents_t as unmarriedParentsTime",visitSetFilterArray);
if(dynamicObject == null){
//取消提交操作
this.addFatalErrorMessage(extendedDataEntity, "请设置人员探亲配置信息!");
return;
}
//探亲次数
int visitTime = 0;
//探亲年限
int visitYear = 0;
//总年探亲天数
int visitDays =dynamicObject.getInt("visitDays");
//婚姻状况1已婚2未婚
int marriedStatus =dynamicObject.getInt("marriedStatus");
//已婚探望父母年限
int marriedParentsYear =dynamicObject.getInt("marriedParentsYear");
//已婚探望父母次数
int marriedParentsTime =dynamicObject.getInt("marriedParentsTime");
//已婚探望配偶年限
int marriedSpouseYear =dynamicObject.getInt("marriedSpouseYear");
//已婚探望配偶次数
int marriedSpouseTime =dynamicObject.getInt("marriedSpouseTime");
//未婚探望父母年限
int unmarriedParentsYear =dynamicObject.getInt("unmarriedParentsYear");
//未婚探望父母次数
int unmarriedParentsTime =dynamicObject.getInt("unmarriedParentsTime");
if(visitDays == 0 ){
this.addFatalErrorMessage(extendedDataEntity, "人员探亲配置探亲假天数为空!");
return;
}
if(marriedStatus == 1 ){ // 已婚
if(marriedParentsYear == 0 ){
this.addFatalErrorMessage(extendedDataEntity, "人员探亲配置已婚探望父母年限为空!");
return;
}
if(marriedParentsTime == 0 ){
this.addFatalErrorMessage(extendedDataEntity, "人员探亲配置已婚探望父母次数为空!");
return;
}
if(marriedSpouseYear == 0 ){
this.addFatalErrorMessage(extendedDataEntity, "人员探亲配置已婚探望配偶年限为空!");
return;
}
if(marriedSpouseTime == 0 ){
this.addFatalErrorMessage(extendedDataEntity, "人员探亲配置已婚探望配偶次数为空!");
return;
}
//如果是探望父母
if("1".equals(visitType)){
visitYear = marriedParentsYear;
visitTime = marriedParentsTime;
}else
//如果是探望配偶
if("2".equals(visitType)){
visitTime = marriedSpouseTime;
visitYear = marriedSpouseYear;
}
}else if (marriedStatus == 2) { // 未婚
if(!"1".equals(visitType)){
this.addFatalErrorMessage(extendedDataEntity, "未婚状态下探亲类型只能选择探望父母!");
return;
}
if(unmarriedParentsYear == 0 ){
this.addFatalErrorMessage(extendedDataEntity, "人员探亲配置未婚探望父母年限为空!");
return;
}
if(unmarriedParentsTime == 0 ){
this.addFatalErrorMessage(extendedDataEntity, "人员探亲配置未婚探望父母次数为空!");
return;
}
visitTime = unmarriedParentsTime;
visitYear = unmarriedParentsYear;
}
Date firstDayOfYear = getFirstDayOfYear(startTime);
//年限开始时间
LocalDate firstDayYearsAgo = getFirstDayYearsAgo(dateToLocalDate(startTime), visitYear);
Date lastDayOfYear = getLastDayOfYear(startTime);
//查询非暂存废弃的数据
List<String> billStatuslist = new ArrayList<>();
billStatuslist.add("B");
billStatuslist.add("C");
billStatuslist.add("D");
billStatuslist.add("E");
billStatuslist.add("F");
billStatuslist.add("G");
// 查询条件
QFilter[] filterArray = new QFilter[5];
//查询申请人下的今年的探亲差旅单据
filterArray[0] = new QFilter(prefix+"_holiday_start_time", QCP.large_equals, firstDayOfYear);
filterArray[1] = new QFilter(prefix+"_holiday_start_time", QCP.less_equals, lastDayOfYear);
filterArray[2] = new QFilter("applier", QCP.equals, applierId);
filterArray[3] = new QFilter(prefix+"_is_visit", QCP.equals, true);
filterArray[4] = new QFilter("billstatus", QCP.in, billStatuslist);
DataSet dateSet = QueryServiceHelper.queryDataSet(
this.getClass().getName(),
"er_dailyreimbursebill",
"id,billno,zcgj_holiday_start_time as startTime,zcgj_holiday_end_time as endTime,zcgj_holiday_days as days",
filterArray, null
);
if(currentBillIdListMap.containsKey(applierId)){
List<Long> longs = currentBillIdListMap.get(applierId);
longs.add(aLong);
}else{
List<Long> currentBillIdList = new ArrayList<>();
currentBillIdList.add(aLong);
currentBillIdListMap.put(applierId,currentBillIdList);
}
List<Long> longs = currentBillIdListMap.get(applierId);
if(!longs.isEmpty()&&extendedDataEntities.length>1){
QFilter[] filterArray1 = new QFilter[1];
filterArray1[0] = new QFilter("id", QCP.in, longs);
DataSet dateSetSave = QueryServiceHelper.queryDataSet(
this.getClass().getName(),
"er_dailyreimbursebill",
"id,billno,zcgj_holiday_start_time as startTime,zcgj_holiday_end_time as endTime,zcgj_holiday_days as days",
filterArray1, null
);
dateSet = dateSet.union(dateSetSave) ;
}
//使用请假总天数
int allHolidayCount = 0;
//使用请假总次数
int holidayCount = 0;
for (Row itemRow : dateSet) {
String string = itemRow.getString("billno");
Date startTimeVal = itemRow.getDate("startTime");
Date endTimeVal = itemRow.getDate("endTime");
Integer dayCount = itemRow.getInteger("days");
//long dayCount = ChronoUnit.DAYS.between(dateToLocalDate(startTimeVal), dateToLocalDate(endTimeVal));
allHolidayCount+=dayCount;
holidayCount++;
System.out.println(string);
}
//剩余次数
int remainderTimes = visitTime-holidayCount;
//剩余天数
long remainderDays = visitDays-allHolidayCount;
//判断剩余天数和本次请假天数
//long nowDays = ChronoUnit.DAYS.between(dateToLocalDate(startTime),dateToLocalDate(endTime))+1;
String message = String.format("您在%s年到%s年中已用%d次探亲休假剩余%d次探亲休假已用%d天探亲天数剩余%d天探亲天数。本次休假天数%d天。"
,firstDayYearsAgo.getYear(),dateFormat.format(startTime),holidayCount,remainderTimes,
allHolidayCount,remainderDays,days);
if((remainderTimes > 0) && (remainderDays >= 0) &&((remainderDays - days) >=0)){
//this.getView().showTipNotification(message);
//this.addMessage(extendedDataEntity, message);
}else{
this.addFatalErrorMessage(extendedDataEntity, "探亲次数或探亲天数不足!"+message);
return;
}
}
//判断是否来往家居地
if(isHome){
//获取当前人的往来家居地配置
QFilter[] visitSetFilterArray = new QFilter[1];
visitSetFilterArray[0] = new QFilter(prefix+"_user", QCP.equals, applierId);
DataSet homeDataSet = QueryServiceHelper.queryDataSet(
this.getClass().getName(),
prefix+"_user_home_conf",
"id,zcgj_month_times as monthTime",
visitSetFilterArray, null
);
Integer monthTime = null;
for (Row row : homeDataSet) {
monthTime = row.getInteger("monthTime");
}
//获取申请人在月份的单据量
LocalDate firstDayOfMonth = getFirstDayOfMonth(bizdate);
LocalDate lastDayOfMonth = getLastDayOfMonth(bizdate);
QFilter[] filterArray = new QFilter[4];
//查询申请人下的今年的探亲差旅单据
filterArray[0] = new QFilter("bizdate", QCP.large_equals, firstDayOfMonth);
filterArray[1] = new QFilter("bizdate", QCP.less_equals, lastDayOfMonth);
filterArray[2] = new QFilter("applier", QCP.equals, applierId);
filterArray[3] = new QFilter(prefix+"_is_home", QCP.equals, true);
DataSet dateSet = QueryServiceHelper.queryDataSet(
this.getClass().getName(),
"er_dailyreimbursebill",
"id,billno,zcgj_holiday_start_time as startTime,zcgj_holiday_end_time as endTime,zcgj_is_home as ishome",
filterArray, null
);
int goHomeCount = 0;
for (Row row : dateSet) {
Boolean ishome = row.getBoolean("ishome");
System.out.println(row.getString("billno"));
if(ishome){
goHomeCount++;
}
}
if(monthTime != null && monthTime != 0){
int monthVal = firstDayOfMonth.getMonth().getValue();
String message = String.format("请知悉:您每月共有%d次往来家居地报销次数在%d月中已进行过%d次来往家居地报销。",monthTime,monthVal,goHomeCount);
//this.getView().showSuccessNotification(message);
this.addMessage(extendedDataEntity, message);
}
}
i++;
}
}
}
/**
* 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();
}
/**
* 获取指定日期所在年份的第一天
* @param date java.util.Date
* @return java.util.Date
*/
public static Date getFirstDayOfYear(Date date) {
LocalDate localDate = dateToLocalDate(date);
LocalDate firstDayOfYear = LocalDate.of(localDate.getYear(), Month.JANUARY, 1);
return Date.from(firstDayOfYear.atStartOfDay(ZoneId.systemDefault()).toInstant());
}
/**
* 获取指定日期所在年份的最后一天
* @param date java.util.Date
* @return java.util.Date
*/
public static Date getLastDayOfYear(Date date) {
LocalDate localDate = dateToLocalDate(date);
LocalDate lastDayOfYear = LocalDate.of(localDate.getYear(), Month.DECEMBER, 31);
return Date.from(lastDayOfYear.atStartOfDay(ZoneId.systemDefault()).toInstant());
}
/**
* 获取指定日期所在月份的第一天
* @param date 指定日期
* @return LocalDate 所在月份的第一天
*/
public static LocalDate getFirstDayOfMonth(Date date) {
LocalDate localDate = dateToLocalDate(date);
return localDate.with(TemporalAdjusters.firstDayOfMonth());
}
/**
* 获取指定日期所在月份的最后一天
* @param date 指定日期
* @return LocalDate 所在月份的最后一天
*/
public static LocalDate getLastDayOfMonth(Date date) {
LocalDate localDate = dateToLocalDate(date);
return localDate.with(TemporalAdjusters.lastDayOfMonth());
}
/**
* 获取指定年限-1年前的第一天
* @param date 指定日期
* @param years 年限值
* @return LocalDate 年限-1年前的第一天
*/
public static LocalDate getFirstDayYearsAgo(LocalDate date, int years) {
if (date == null) {
throw new IllegalArgumentException("日期不能为空");
}
if (years < 1) {
throw new IllegalArgumentException("年限值必须大于等于 1");
}
return LocalDate.of(date.getYear() - (years - 1), Month.JANUARY, 1);
}
}

View File

@ -25,8 +25,10 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 费用报销单探亲检查插件 * 费用报销单探亲检查插件(废弃)
* 使用 DailyreimbursVisitCheckOp
*/ */
@Deprecated
public class DailyreimbursVisitCheckPlugin extends AbstractBillPlugIn implements Plugin{ public class DailyreimbursVisitCheckPlugin extends AbstractBillPlugIn implements Plugin{
private static final Log log = LogFactory.getLog(DailyreimbursVisitCheckPlugin.class); private static final Log log = LogFactory.getLog(DailyreimbursVisitCheckPlugin.class);
//开发商标识 //开发商标识
@ -47,7 +49,7 @@ public class DailyreimbursVisitCheckPlugin extends AbstractBillPlugIn implemen
Date startTime = (Date)model.getValue(prefix + "_holiday_start_time"); Date startTime = (Date)model.getValue(prefix + "_holiday_start_time");
Date endTime = (Date)model.getValue(prefix + "_holiday_end_time"); Date endTime = (Date)model.getValue(prefix + "_holiday_end_time");
//获取是否探亲 //获取是否探亲
//如果探亲则进行逻辑判断 //如果探亲则进行逻辑判断
Boolean isVisit = (Boolean)model.getValue(prefix+"_is_visit"); Boolean isVisit = (Boolean)model.getValue(prefix+"_is_visit");
if(isVisit){ if(isVisit){
@ -180,7 +182,7 @@ public class DailyreimbursVisitCheckPlugin extends AbstractBillPlugIn implemen
DataSet dateSet = QueryServiceHelper.queryDataSet( DataSet dateSet = QueryServiceHelper.queryDataSet(
this.getClass().getName(), this.getClass().getName(),
"er_dailyreimbursebill", "er_dailyreimbursebill",
"id,billno,zcgj_holiday_start_time as startTime,zcgj_holiday_end_time as endTime", "id,billno,zcgj_holiday_start_time as startTime,zcgj_holiday_end_time as endTime,zcgj_holiday_days as days",
filterArray, null filterArray, null
); );
//使用请假总天数 //使用请假总天数
@ -191,7 +193,8 @@ public class DailyreimbursVisitCheckPlugin extends AbstractBillPlugIn implemen
String string = itemRow.getString("billno"); String string = itemRow.getString("billno");
Date startTimeVal = itemRow.getDate("startTime"); Date startTimeVal = itemRow.getDate("startTime");
Date endTimeVal = itemRow.getDate("endTime"); Date endTimeVal = itemRow.getDate("endTime");
long dayCount = ChronoUnit.DAYS.between(dateToLocalDate(startTimeVal), dateToLocalDate(endTimeVal)); //long dayCount = ChronoUnit.DAYS.between(dateToLocalDate(startTimeVal), dateToLocalDate(endTimeVal));
Integer dayCount = itemRow.getInteger("days");
allHolidayCount+=dayCount; allHolidayCount+=dayCount;
holidayCount++; holidayCount++;
System.out.println(string); System.out.println(string);

View File

@ -1,42 +0,0 @@
package zcgj.zcdev.zcdev.fs.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.operate.Submit;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.sdk.plugin.Plugin;
/**
* 报销单附件控制插件
* 差旅报销费用报销对公报销
*/
public class ReimbursementCheckAttachmentPlugin extends AbstractBillPlugIn implements Plugin {
//开发商标识
private static final String prefix ="zcgj";
@Override
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
//zcgj_attachmentcount
Object source = args.getSource();
if(args.getSource() instanceof Submit){
// 根据类型进行安全转换
String operateKey = ((Submit) source).getOperateKey();
//重写返回的数据
if("submit".equals(operateKey)){
//提交时校验附件是否必填
IDataModel model = this.getModel();
int attachmentcount = Integer.parseInt(model.getValue(prefix+"_attachmentcount")+"");
if(attachmentcount == 0){
this.getView().showErrorNotification("请上传附件");
//取消提交操作
args.setCancel(true);
}
}
}
super.beforeDoOperation(args);
}
}

View File

@ -17,6 +17,7 @@ import java.math.BigDecimal;
/** /**
* 差旅报销单插件 * 差旅报销单插件
*/ */
@Deprecated
public class TripreimbursebillPlugin extends AbstractBillPlugIn implements Plugin { public class TripreimbursebillPlugin extends AbstractBillPlugIn implements Plugin {
private static final Log log = LogFactory.getLog(TripreimbursebillPlugin.class); private static final Log log = LogFactory.getLog(TripreimbursebillPlugin.class);
@ -81,7 +82,7 @@ public class TripreimbursebillPlugin extends AbstractBillPlugIn implements Plug
public void propertyChanged(PropertyChangedArgs e) { public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e); super.propertyChanged(e);
String name = e.getProperty().getName(); String name = e.getProperty().getName();
if(name.equals("zcgj_isfloating20")){ /*if(name.equals("zcgj_isfloating20")){
IDataModel model = this.getModel(); IDataModel model = this.getModel();
ChangeData[] changeSet = e.getChangeSet(); ChangeData[] changeSet = e.getChangeSet();
Boolean isfloating20 = (Boolean)changeSet[0].getNewValue(); Boolean isfloating20 = (Boolean)changeSet[0].getNewValue();
@ -109,11 +110,11 @@ public class TripreimbursebillPlugin extends AbstractBillPlugIn implements Plug
entryentity.set("tripstandardamount",tripstandardamountOld); entryentity.set("tripstandardamount",tripstandardamountOld);
} }
this.getView().updateView("entryentity"); this.getView().updateView("entryentity");
this.getView().showTipNotification(tripstandardamount+" "+tripstandardamountOld); //this.getView().showTipNotification(tripstandardamount+" "+tripstandardamountOld);
} }
} }
} }
} }*/
} }
} }

View File

@ -0,0 +1,145 @@
package zcgj.zcdev.zcdev.fs.plugin.form;
import kd.bos.algo.DataSet;
import kd.bos.algo.Row;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.ExtendedDataEntity;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.entity.operate.Submit;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.validate.AbstractValidator;
import kd.bos.form.events.BeforeDoOperationEventArgs;
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.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
/**
* 差旅报销单上浮20%控制
*/
public class TripreimbursebillUpOp extends AbstractOperationServicePlugIn {
private static final Log log = LogFactory.getLog(TripreimbursebillUpOp.class);
//开发商标识
private static final String prefix ="zcgj";
@Override
public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e);
e.getFieldKeys().add("zcgj_isfloating20");
e.getFieldKeys().add("tripentry");
e.getFieldKeys().add("entryentity");
e.getFieldKeys().add("zcgj_zs_key");
}
@Override
public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e);
e.getValidators().add(new ValidatorExt());
}
class ValidatorExt extends AbstractValidator {
@Override
public void validate() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy");
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
//当前提交的探亲单据id集合
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
String zskey = dataEntity.getString("zcgj_zs_key");
boolean isfloating20 = dataEntity.getBoolean("zcgj_isfloating20");
DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("tripentry");//oa流程分录
int trip = 1;
for (DynamicObject dynamicObject : tripentry) {
DynamicObjectCollection dynamicObjectCollection = dynamicObject.getDynamicObjectCollection("entryentity");
for (DynamicObject dy : dynamicObjectCollection) {
DynamicObject expenseObj = dy.getDynamicObject("expenseitem");
String expenseitem = expenseObj.getString("number");
if(zskey.equals(expenseitem)){
BigDecimal orientryamount = dy.getBigDecimal("orientryamount");//报销金额
BigDecimal tripstandardamount = dy.getBigDecimal("tripstandardamount");//差旅标准金额
Integer caldaycount = dy.getInt("caldaycount");//标准天数
int isover = dy.getInt("isover");//是否超标,1是0否
//如果选择了上浮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));
//-1表示小于0是等于1是大于
if(orientryamount.compareTo(multiply) <= 0){
//第1段行程第4行明细住宿费已超标不允许提交
// this.addFatalErrorMessage(extendedDataEntity, ""+trip+"段行程报销住宿超出标准上浮20%");
dy.set("isover",0);
}
}
}
}
trip++;
}
}
}
}
/*@Override
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
if((args.getSource() instanceof Submit) ){
Submit source = (Submit)args.getSource();
if(source.getOperateKey().equals("submit") ){
//highseasontripstdshow
//提交时校验附件是否必填
IDataModel model = this.getModel();
String zsKey = String.valueOf(model.getValue("zcgj_zs_key"));
boolean isfloating20 = Boolean.parseBoolean(model.getValue("zcgj_isfloating20")+"");
//获取当前费用为住宿的
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");//差旅标准金额
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(caldaycount));
//-1表示小于0是等于1是大于
if(orientryamount.compareTo(multiply) > 0){
this.getView().showTipNotification("报销住宿超出标准上浮20%");
//取消提交操作
args.setCancel(true);
}
}else{
BigDecimal multiply = tripstandardamount.multiply(new BigDecimal(caldaycount));
//-1表示小于0是等于1是大于
if(orientryamount.compareTo(multiply) > 0){
this.getView().showTipNotification("报销住宿超出标准!");
//取消提交操作
args.setCancel(true);
}
}
}
}
}
}
}
}*/
}