|
|
@@ -6,6 +6,7 @@ import com.kingdee.bos.Context;
|
|
|
import com.kingdee.bos.dao.AbstractObjectCollection;
|
|
|
import com.kingdee.bos.metadata.entity.*;
|
|
|
import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
+import com.kingdee.bos.util.BOSObjectType;
|
|
|
import com.kingdee.bos.util.BOSUuid;
|
|
|
import com.kingdee.eas.basedata.person.Genders;
|
|
|
import com.kingdee.eas.basedata.person.PersonInfo;
|
|
|
@@ -37,6 +38,9 @@ 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 CHECKINAPPLICATIONBOSTYPE = "412D7440";//入住单bosType
|
|
|
|
|
|
/**
|
|
|
* 开始校验
|
|
|
@@ -56,15 +60,22 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
}
|
|
|
Map<String, List<Map<String, Date>>> roomListMap = new HashMap<String, List<Map<String, Date>>>();
|
|
|
List<String> errorMsgList = new ArrayList<String>();
|
|
|
- ICoreBillBase iCoreBillBase = (ICoreBillBase) BOSObjectFactory.createBOSObject(ctx,
|
|
|
- BOSUuid.read(billIds.split(",")[0]).getType());
|
|
|
+ BOSObjectType bosType = BOSUuid.read(billIds.split(",")[0]).getType();
|
|
|
+ ICoreBillBase iCoreBillBase = (ICoreBillBase) BOSObjectFactory.createBOSObject(ctx, bosType);
|
|
|
SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
sic.add("*");
|
|
|
sic.add("entrys.*");
|
|
|
sic.add("entrys.person.*");
|
|
|
sic.add("entrys.person.personType.*");
|
|
|
- sic.add("entrys.checkInRoom.*");
|
|
|
- sic.add("entrys.checkInRoom.DormitoryType.*");
|
|
|
+ if(CHECKOUTAPPLICATIONBOSTYPE.equals(CHECKOUTAPPLICATIONBOSTYPE)) {
|
|
|
+ //退宿单
|
|
|
+ sic.add("entrys.currentRoom.DormitoryType.*");
|
|
|
+ sic.add("entrys.currentRoom.*");
|
|
|
+ }else if(CHECKINAPPLICATIONBOSTYPE.equals(CHECKINAPPLICATIONBOSTYPE)) {
|
|
|
+ //入住单
|
|
|
+ sic.add("entrys.checkInRoom.DormitoryType.*");
|
|
|
+ sic.add("entrys.checkInRoom.*");
|
|
|
+ }
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
//房间
|
|
|
@@ -75,7 +86,6 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
HRBillBaseInfo hrBillBaseInfo = (HRBillBaseInfo) hrBillBaseCollection.get(i);
|
|
|
String billId = hrBillBaseInfo.getId().toString();
|
|
|
String baseInfoNumber = hrBillBaseInfo.getNumber();
|
|
|
- String bosType = hrBillBaseInfo.getId().getType().toString();
|
|
|
AbstractObjectCollection entrys = (AbstractObjectCollection) hrBillBaseInfo.get("entrys");
|
|
|
for (int j = 0; j < entrys.size(); j++) {
|
|
|
try {
|
|
|
@@ -93,7 +103,13 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
throw new BOSException("入住日期不能为空!");
|
|
|
}
|
|
|
//退宿日期
|
|
|
- Date checkoutDate = entryInfo.getDate("checkoutDate");
|
|
|
+ Date checkoutDate = null;
|
|
|
+ if (CHECKOUTAPPLICATIONBOSTYPE.equals(bosType)) {
|
|
|
+ //退宿单
|
|
|
+ checkInDate = entryInfo.getDate("oldCheckoutDate");
|
|
|
+ } else {
|
|
|
+ checkoutDate = entryInfo.getDate("checkoutDate");
|
|
|
+ }
|
|
|
if (checkoutDate == null) {
|
|
|
throw new BOSException("退宿日期不能为空!");
|
|
|
}
|
|
|
@@ -103,7 +119,13 @@ public class ValidateRoomAvailableByBillIdsUtil {
|
|
|
throw new BOSException("人员不能为空!");
|
|
|
}
|
|
|
//房间
|
|
|
- DormitoryInfo dormitory = (DormitoryInfo) entryInfo.getObjectValue("checkInRoom");
|
|
|
+ DormitoryInfo dormitory = null;
|
|
|
+ if (CHECKOUTAPPLICATIONBOSTYPE.equals(bosType)) {
|
|
|
+ //退宿单
|
|
|
+ dormitory = (DormitoryInfo) entryInfo.getObjectValue("currentRoom");
|
|
|
+ } else {
|
|
|
+ dormitory = (DormitoryInfo) entryInfo.getObjectValue("checkInRoom");
|
|
|
+ }
|
|
|
if (dormitory == null) {
|
|
|
throw new BOSException("房间不能为空!");
|
|
|
}
|