费用报销单探亲休假功能调整
This commit is contained in:
parent
62fca77de0
commit
d39d5f0ba5
|
|
@ -11,6 +11,7 @@ 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.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||
import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils;
|
||||
|
|
@ -62,10 +63,10 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
public void validate() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy");
|
||||
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||
int i =0;
|
||||
Map<Long,Map<String,Object>> allMap = new HashMap<>();
|
||||
// int i =0;
|
||||
// Map<Long,Map<String,Object>> allMap = new HashMap<>();
|
||||
//当前提交的探亲单据id集合
|
||||
Map<Long,List<Long>> currentBillIdListMap = new HashMap<>();
|
||||
// Map<Long,List<Long>> currentBillIdListMap = new HashMap<>();
|
||||
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||
|
|
@ -113,7 +114,7 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
//探亲年限
|
||||
int visitYear = 0;
|
||||
|
||||
//总年探亲天数
|
||||
//探父母假天数
|
||||
int visitDays =dynamicObject.getInt("visitDays");
|
||||
//婚姻状况,1:已婚,2:未婚
|
||||
int marriedStatus =dynamicObject.getInt("marriedStatus");
|
||||
|
|
@ -136,31 +137,8 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
//未婚探望父母次数
|
||||
int unmarriedParentsTime =dynamicObject.getInt("unmarriedParentsTime");
|
||||
|
||||
/*if(visitDays == 0 ){
|
||||
this.addFatalErrorMessage(extendedDataEntity, "人员探亲配置探父母天数为空!");
|
||||
return;
|
||||
}*/
|
||||
//配置婚姻状况 zcgj_married_status
|
||||
if(marriedStatus == 1 ){ // 已婚
|
||||
/*if(marriedSpouseDays == 0 ){
|
||||
this.addFatalErrorMessage(extendedDataEntity, "人员探亲配置探配偶天数为空!");
|
||||
return;
|
||||
}
|
||||
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;
|
||||
|
|
@ -172,18 +150,10 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
visitYear = marriedSpouseYear;
|
||||
}
|
||||
}else if (marriedStatus == 2) { // 未婚
|
||||
if(!"1".equals(visitType)){
|
||||
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;
|
||||
|
|
@ -207,22 +177,65 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
billStatuslist.add("F");
|
||||
billStatuslist.add("G");
|
||||
// 查询条件
|
||||
QFilter[] filterArray = new QFilter[5];
|
||||
QFilter[] filterArray = new QFilter[6];
|
||||
//查询申请人下的今年的探亲差旅单据
|
||||
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);
|
||||
filterArray[5] = new QFilter("zcgj_visit_type", QCP.equals, visitType);
|
||||
|
||||
DataSet dateSet = QueryServiceHelper.queryDataSet(
|
||||
DynamicObject[] dailyreimbursebillArray = BusinessDataServiceHelper.load("er_dailyreimbursebill",
|
||||
"id,billno,zcgj_visit_type ,zcgj_holiday_start_time ,zcgj_holiday_end_time ,zcgj_holiday_days ",filterArray );
|
||||
//类型请假总次数
|
||||
int allHolidayCount = 0;//已用探亲假天数
|
||||
int holidayCount = 0;//已用探亲假次数
|
||||
for (DynamicObject dailyreimbursebill : dailyreimbursebillArray) {
|
||||
long billId = dailyreimbursebill.getLong("id");
|
||||
if(billId != aLong){
|
||||
String string = dailyreimbursebill.getString("billno");
|
||||
Date startTimeVal = dailyreimbursebill.getDate("zcgj_holiday_start_time");
|
||||
Date endTimeVal = dailyreimbursebill.getDate("zcgj_holiday_end_time");
|
||||
Integer dayCount = dailyreimbursebill.getInt("zcgj_holiday_days");
|
||||
String type = dailyreimbursebill.getString("zcgj_visit_type");//1:探父母。2:探配哦
|
||||
//long dayCount = ChronoUnit.DAYS.between(dateToLocalDate(startTimeVal), dateToLocalDate(endTimeVal));
|
||||
allHolidayCount+=dayCount;
|
||||
holidayCount++;
|
||||
}
|
||||
}
|
||||
|
||||
//已用剩余次数
|
||||
int remainderTimes = visitTime-holidayCount;
|
||||
//已用剩余天数
|
||||
int remainderDays =visitDays-allHolidayCount;
|
||||
//计算提交单据的剩余次数
|
||||
|
||||
int tims = remainderTimes - 1;
|
||||
//计算提交单据的剩余天数
|
||||
int dayCount = remainderDays - days;
|
||||
|
||||
String typeStr = "父母";
|
||||
if("2".equals(visitType)){
|
||||
typeStr = "配偶";
|
||||
}
|
||||
String message = String.format("您在%s年到%s年中已用%d次探"+typeStr+"休假,剩余%d次探"+typeStr+"休假,已用%d天探"+typeStr+"天数,剩余%d天探"+typeStr+"天数。本次休假天数%d天。"
|
||||
,firstDayYearsAgo.getYear(),dateFormat.format(startTime),
|
||||
holidayCount,remainderTimes,
|
||||
allHolidayCount,remainderDays,
|
||||
days);
|
||||
if((tims < 0) || dayCount < 0){
|
||||
this.addFatalErrorMessage(extendedDataEntity, "探亲次数或探亲天数不足!"+message);
|
||||
}
|
||||
|
||||
/*DataSet dateSet = QueryServiceHelper.queryDataSet(
|
||||
this.getClass().getName(),
|
||||
"er_dailyreimbursebill",
|
||||
"id,billno,zcgj_visit_type as visitType,zcgj_holiday_start_time as startTime,zcgj_holiday_end_time as endTime,zcgj_holiday_days as days",
|
||||
filterArray, null
|
||||
);
|
||||
);*/
|
||||
|
||||
if(currentBillIdListMap.containsKey(applierId)){
|
||||
/*if(currentBillIdListMap.containsKey(applierId)){
|
||||
List<Long> longs = currentBillIdListMap.get(applierId);
|
||||
longs.add(aLong);
|
||||
}else{
|
||||
|
|
@ -241,10 +254,10 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
filterArray1, null
|
||||
);
|
||||
dateSet = dateSet.union(dateSetSave) ;
|
||||
}
|
||||
}*/
|
||||
|
||||
//使用请假总天数
|
||||
int allHolidayCount = 0;
|
||||
/*int allHolidayCount = 0;
|
||||
int allHolidayCountPO = 0;
|
||||
//使用请假总次数
|
||||
int holidayCount = 0;
|
||||
|
|
@ -290,9 +303,8 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
}else{
|
||||
this.addFatalErrorMessage(extendedDataEntity, "探亲次数或探亲天数不足!"+message);
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue