|
|
@@ -4,6 +4,7 @@ import com.kingdee.bos.BOSException;
|
|
|
import com.kingdee.bos.BOSObjectFactory;
|
|
|
import com.kingdee.bos.Context;
|
|
|
import com.kingdee.bos.dao.AbstractObjectCollection;
|
|
|
+import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
|
|
|
import com.kingdee.bos.metadata.entity.*;
|
|
|
import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
import com.kingdee.bos.util.BOSObjectType;
|
|
|
@@ -12,7 +13,9 @@ import com.kingdee.eas.basedata.person.Genders;
|
|
|
import com.kingdee.eas.basedata.person.PersonInfo;
|
|
|
import com.kingdee.eas.common.EASBizException;
|
|
|
import com.kingdee.eas.custom.dormitorysystem.application.*;
|
|
|
+import com.kingdee.eas.custom.dormitorysystem.dormitory.DormitoryFactory;
|
|
|
import com.kingdee.eas.custom.dormitorysystem.dormitory.DormitoryInfo;
|
|
|
+import com.kingdee.eas.custom.dormitorysystem.dormitory.IDormitory;
|
|
|
import com.kingdee.eas.custom.dormitorysystem.enumerationset.DormitoryClassification;
|
|
|
import com.kingdee.eas.custom.dormitorysystem.occupants.IOccupants;
|
|
|
import com.kingdee.eas.custom.dormitorysystem.occupants.OccupantsCollection;
|
|
|
@@ -39,9 +42,10 @@ import java.util.*;
|
|
|
public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
private static Logger logger = Logger.getLogger(ValidateRoomAvailableByBillIdsUtil.class);
|
|
|
private static String CHECKOUTAPPLICATIONBOSTYPE = "EBE6D24D";//退宿单bosType
|
|
|
- private static String ROOMCHANGEAPPLICATIONBOSTYPE = "0CDEF948";
|
|
|
+ private static String ROOMCHANGEAPPLICATIONBOSTYPE = "0CDEF948"; //换宿单 coyle
|
|
|
private static String CHECKINAPPLICATIONBOSTYPE = "412D7440";//入住单bosType
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 开始校验
|
|
|
*
|
|
|
@@ -67,11 +71,11 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
sic.add("entrys.*");
|
|
|
sic.add("entrys.person.*");
|
|
|
sic.add("entrys.person.personType.*");
|
|
|
- if(CHECKOUTAPPLICATIONBOSTYPE.equals(CHECKOUTAPPLICATIONBOSTYPE)) {
|
|
|
+ if(CHECKOUTAPPLICATIONBOSTYPE.equals(bosType.toString())) {
|
|
|
//退宿单
|
|
|
sic.add("entrys.currentRoom.DormitoryType.*");
|
|
|
sic.add("entrys.currentRoom.*");
|
|
|
- }else if(CHECKINAPPLICATIONBOSTYPE.equals(CHECKINAPPLICATIONBOSTYPE)) {
|
|
|
+ }else if(CHECKINAPPLICATIONBOSTYPE.equals(bosType.toString())) {
|
|
|
//入住单
|
|
|
sic.add("entrys.checkInRoom.DormitoryType.*");
|
|
|
sic.add("entrys.checkInRoom.*");
|
|
|
@@ -91,7 +95,7 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
try {
|
|
|
HRBillBaseEntryInfo entryInfo = (HRBillBaseEntryInfo) entrys.getObject(j);
|
|
|
Date checkInDate = null;
|
|
|
- if ("B371AC0A".equals(bosType)) {
|
|
|
+ if ("B371AC0A".equals(bosType.toString())) {
|
|
|
//换宿单
|
|
|
//入住日期
|
|
|
checkInDate = entryInfo.getDate("adjustmentDate");
|
|
|
@@ -104,11 +108,11 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
}
|
|
|
//退宿日期
|
|
|
Date checkoutDate = null;
|
|
|
- if (CHECKOUTAPPLICATIONBOSTYPE.equals(bosType)) {
|
|
|
+ if (CHECKOUTAPPLICATIONBOSTYPE.equals(bosType.toString())) {
|
|
|
//退宿单
|
|
|
- checkInDate = entryInfo.getDate("oldCheckoutDate");
|
|
|
- } else {
|
|
|
checkoutDate = entryInfo.getDate("checkoutDate");
|
|
|
+ } else {
|
|
|
+ checkoutDate = entryInfo.getDate("checkoutDate");
|
|
|
}
|
|
|
if (checkoutDate == null) {
|
|
|
throw new BOSException("退宿日期不能为空!");
|
|
|
@@ -120,7 +124,7 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
}
|
|
|
//房间
|
|
|
DormitoryInfo dormitory = null;
|
|
|
- if (CHECKOUTAPPLICATIONBOSTYPE.equals(bosType)) {
|
|
|
+ if (CHECKOUTAPPLICATIONBOSTYPE.equals(bosType.toString())) {
|
|
|
//退宿单
|
|
|
dormitory = (DormitoryInfo) entryInfo.getObjectValue("currentRoom");
|
|
|
} else {
|
|
|
@@ -129,6 +133,8 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
if (dormitory == null) {
|
|
|
throw new BOSException("房间不能为空!");
|
|
|
}
|
|
|
+ IDormitory dorIns = DormitoryFactory.getLocalInstance(ctx);
|
|
|
+ dormitory = dorIns.getDormitoryInfo(new ObjectUuidPK(dormitory.getId()));
|
|
|
String roomId = dormitory.getId().toString();
|
|
|
//根据入住日期,性别,员工类别查询可选房间
|
|
|
//人员类型
|
|
|
@@ -171,7 +177,7 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
//6.算出房间剩余可住人数: 可住人数 - 已住人数
|
|
|
if (occupancyCapacity - dormCheckInCount < 0) {
|
|
|
String dormitoryName = dormitory.getName();
|
|
|
- throw new BOSException("当前入住人数" + dormCheckInCount + ",已超过房间[" + dormitoryName + "]可住人数" + occupancyCapacity + ",不能入住!");
|
|
|
+ throw new BOSException("当前入住人数" + dormCheckInCount + ",已超过! 房间[" + dormitoryName + "]可住人数" + occupancyCapacity + ",不能入住!");
|
|
|
}
|
|
|
Map roomMap = new HashMap();
|
|
|
roomMap.put("checkInDate", checkInDate);
|
|
|
@@ -409,6 +415,7 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
if (gender == null) {
|
|
|
throw new BOSException("员工性别为空!");
|
|
|
}
|
|
|
+
|
|
|
String personInfoName = personInfo.getName();
|
|
|
//IDormitory iDormitory = DormitoryFactory.getLocalInstance(ctx);
|
|
|
//查询房间信息
|