|
@@ -5,13 +5,17 @@ import com.kingdee.bos.Context;
|
|
import com.kingdee.bos.dao.IObjectPK;
|
|
import com.kingdee.bos.dao.IObjectPK;
|
|
import com.kingdee.bos.dao.IObjectValue;
|
|
import com.kingdee.bos.dao.IObjectValue;
|
|
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
|
|
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
|
|
-import com.kingdee.bos.metadata.entity.SelectorItemCollection;
|
|
|
|
|
|
+import com.kingdee.bos.metadata.entity.*;
|
|
|
|
+import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
|
+import com.kingdee.bos.util.BOSUuid;
|
|
import com.kingdee.eas.basedata.person.IPerson;
|
|
import com.kingdee.eas.basedata.person.IPerson;
|
|
import com.kingdee.eas.basedata.person.PersonFactory;
|
|
import com.kingdee.eas.basedata.person.PersonFactory;
|
|
import com.kingdee.eas.basedata.person.PersonInfo;
|
|
import com.kingdee.eas.basedata.person.PersonInfo;
|
|
import com.kingdee.eas.common.EASBizException;
|
|
import com.kingdee.eas.common.EASBizException;
|
|
import com.kingdee.eas.custom.dormitorysystem.application.*;
|
|
import com.kingdee.eas.custom.dormitorysystem.application.*;
|
|
|
|
+import com.kingdee.eas.custom.dormitorysystem.dormitory.DormitoryInfo;
|
|
import com.kingdee.eas.custom.dormitorysystem.occupants.IOccupants;
|
|
import com.kingdee.eas.custom.dormitorysystem.occupants.IOccupants;
|
|
|
|
+import com.kingdee.eas.custom.dormitorysystem.occupants.OccupantsCollection;
|
|
import com.kingdee.eas.custom.dormitorysystem.occupants.OccupantsFactory;
|
|
import com.kingdee.eas.custom.dormitorysystem.occupants.OccupantsFactory;
|
|
import com.kingdee.eas.custom.dormitorysystem.occupants.OccupantsInfo;
|
|
import com.kingdee.eas.custom.dormitorysystem.occupants.OccupantsInfo;
|
|
import com.kingdee.eas.custom.dormitorysystem.otherbasicdata.PersonDormitoryTypeInfo;
|
|
import com.kingdee.eas.custom.dormitorysystem.otherbasicdata.PersonDormitoryTypeInfo;
|
|
@@ -32,11 +36,59 @@ import com.kingdee.shr.base.syssetting.MSFServiceFacadeFactory;
|
|
import com.kingdee.util.StringUtils;
|
|
import com.kingdee.util.StringUtils;
|
|
import org.apache.log4j.Logger;
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
public class CheckoutApplicationControllerBean extends AbstractCheckoutApplicationControllerBean {
|
|
public class CheckoutApplicationControllerBean extends AbstractCheckoutApplicationControllerBean {
|
|
private static Logger logger = Logger.getLogger(CheckoutApplicationControllerBean.class);
|
|
private static Logger logger = Logger.getLogger(CheckoutApplicationControllerBean.class);
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected IObjectPK _save(Context ctx, IObjectValue model) throws BOSException, EASBizException {
|
|
|
|
+ //退宿单
|
|
|
|
+ CheckoutApplicationInfo info = (CheckoutApplicationInfo) model;
|
|
|
|
+ //退宿单分录
|
|
|
|
+ CheckoutApplicationEntryCollection entrys = info.getEntrys();
|
|
|
|
+ Set<String> occupantsIds = new HashSet<>();
|
|
|
|
+ ICheckoutApplicationEntry iCheckoutApplicationEntry = CheckoutApplicationEntryFactory.getLocalInstance(ctx);
|
|
|
|
+ for (int i = 0; i < entrys.size(); i++) {
|
|
|
|
+ CheckoutApplicationEntryInfo checkoutApplicationEntryInfo = entrys.get(i);
|
|
|
|
+ BOSUuid id = checkoutApplicationEntryInfo.getId();
|
|
|
|
+ //入住人员信息
|
|
|
|
+ OccupantsInfo occupants = checkoutApplicationEntryInfo.getOccupants();
|
|
|
|
+ if (occupants == null) {
|
|
|
|
+ throw new BOSException("入住人员信息不能为空!");
|
|
|
|
+ }
|
|
|
|
+ String occupantsId = occupants.getId().toString();
|
|
|
|
+ if (occupantsIds.contains(occupantsId)) {
|
|
|
|
+ throw new BOSException("本单据中存在对相同入住信息做退宿情况,请检查单据信息!");
|
|
|
|
+ }
|
|
|
|
+ occupantsIds.add(occupantsId);
|
|
|
|
+ //校验是否存在对相同入住信息对退宿的退宿单分录
|
|
|
|
+ FilterInfo filterInfo = new FilterInfo();
|
|
|
|
+ FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
|
+ filterItems.add(new FilterItemInfo("occupants", occupantsId));
|
|
|
|
+ if (id != null) {
|
|
|
|
+ filterItems.add(new FilterItemInfo("id", id, CompareType.NOTEQUALS));
|
|
|
|
+ }
|
|
|
|
+ SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
|
+ sic.add("person.name");
|
|
|
|
+ sic.add("occupants.number");
|
|
|
|
+ sic.add("parent.number");
|
|
|
|
+ EntityViewInfo viewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
|
+ CheckoutApplicationEntryCollection checkoutApplicationEntryCol = iCheckoutApplicationEntry.getCheckoutApplicationEntryCollection(viewInfo);
|
|
|
|
+ for (int j = 0; j < checkoutApplicationEntryCol.size(); j++) {
|
|
|
|
+ CheckoutApplicationEntryInfo checkoutApplicationEntry = checkoutApplicationEntryCol.get(j);
|
|
|
|
+ String personName = checkoutApplicationEntry.getPerson().getName();
|
|
|
|
+ String occupantsNumber = checkoutApplicationEntry.getOccupants().getNumber();
|
|
|
|
+ String number = checkoutApplicationEntry.getParent().getNumber();
|
|
|
|
+ throw new BOSException(personName + "的入住信息[" + occupantsNumber + "]已经在退宿单[" + number + "],请勿重复提交退宿单!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return super._save(ctx, model);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 删除
|
|
* 删除
|
|
*
|
|
*
|
|
@@ -86,43 +138,7 @@ public class CheckoutApplicationControllerBean extends AbstractCheckoutApplicati
|
|
if (HRBillStateEnum.AUDITED.equals(billState)) {
|
|
if (HRBillStateEnum.AUDITED.equals(billState)) {
|
|
throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"单据已经审批通过,请勿重复操作!"});
|
|
throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"单据已经审批通过,请勿重复操作!"});
|
|
}
|
|
}
|
|
-// Map<String, String> params = new HashMap<String, String>();
|
|
|
|
-// params.put("billIds", billId);
|
|
|
|
-// Map result = null;
|
|
|
|
-// try {
|
|
|
|
-// IMSFServiceFacade imsfServiceFacade = MSFServiceFacadeFactory.getLocalInstance(ctx);
|
|
|
|
-// result = (Map) imsfServiceFacade.processService("validateRoomAvailableByBillIdsService", params);
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-// logger.error(e);
|
|
|
|
-// throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"调用接口validateRoomAvailableByBillIdsService报错: " + e.getMessage()});
|
|
|
|
-// }
|
|
|
|
-// Integer code = (Integer) result.get("code");
|
|
|
|
-// if (500 == code) {
|
|
|
|
-// List<String> errorMsgList = (List<String>) result.get("errorMsg");
|
|
|
|
-// StringBuilder errorMsgBuilder = new StringBuilder();
|
|
|
|
-// for (String errorMsg : errorMsgList) {
|
|
|
|
-// errorMsgBuilder.append(errorMsg).append("\n");
|
|
|
|
-// }
|
|
|
|
-// throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{errorMsgBuilder.toString()});
|
|
|
|
-// }
|
|
|
|
-// //校验入住申请单是否重复提交、校验入住信息时间交叉
|
|
|
|
-// Map result2 = null;
|
|
|
|
-// try {
|
|
|
|
-// IMSFServiceFacade imsfServiceFacade = MSFServiceFacadeFactory.getLocalInstance(ctx);
|
|
|
|
-// result2 = (Map) imsfServiceFacade.processService("checkDuplicateCheckInByBillIdService", params);
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-// logger.error(e);
|
|
|
|
-// throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"调用接口checkDuplicateCheckInByBillIdService报错: " + e.getMessage()});
|
|
|
|
-// }
|
|
|
|
-// Integer code2 = (Integer) result2.get("code");
|
|
|
|
-// if (500 == code2) {
|
|
|
|
-// List<String> errorMsgList = (List<String>) result2.get("errorMsg");
|
|
|
|
-// StringBuilder errorMsgBuilder = new StringBuilder();
|
|
|
|
-// for (String errorMsg : errorMsgList) {
|
|
|
|
-// errorMsgBuilder.append(errorMsg).append("\n");
|
|
|
|
-// }
|
|
|
|
-// throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{errorMsgBuilder.toString()});
|
|
|
|
-// }
|
|
|
|
|
|
+ IRoomChangeApplicationEntry iRoomChangeApplicationEntry = RoomChangeApplicationEntryFactory.getLocalInstance(ctx);
|
|
IOccupants iOccupants = OccupantsFactory.getLocalInstance(ctx);
|
|
IOccupants iOccupants = OccupantsFactory.getLocalInstance(ctx);
|
|
CoreBaseCollection updateCols = new CoreBaseCollection();
|
|
CoreBaseCollection updateCols = new CoreBaseCollection();
|
|
CheckoutApplicationEntryCollection entrys = info.getEntrys();
|
|
CheckoutApplicationEntryCollection entrys = info.getEntrys();
|
|
@@ -130,28 +146,24 @@ public class CheckoutApplicationControllerBean extends AbstractCheckoutApplicati
|
|
CheckoutApplicationEntryInfo entryInfo = entrys.get(i);
|
|
CheckoutApplicationEntryInfo entryInfo = entrys.get(i);
|
|
Date checkoutDate = entryInfo.getCheckoutDate();
|
|
Date checkoutDate = entryInfo.getCheckoutDate();
|
|
OccupantsInfo occupants = entryInfo.getOccupants();
|
|
OccupantsInfo occupants = entryInfo.getOccupants();
|
|
|
|
+ if (occupants == null) {
|
|
|
|
+ throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"入住信息为空!"});
|
|
|
|
+ }
|
|
|
|
+ String personName = entryInfo.getPerson().getName();
|
|
|
|
+ //校验入住信息是否被换宿
|
|
|
|
+ RoomChangeApplicationEntryCollection roomChangeApplicationEntryCollection =
|
|
|
|
+ iRoomChangeApplicationEntry.getRoomChangeApplicationEntryCollection("select parent.number where oldOccupants = '" + occupants.getId() + "'");
|
|
|
|
+ if (roomChangeApplicationEntryCollection.size() > 0) {
|
|
|
|
+ RoomChangeApplicationEntryInfo roomChangeApplicationEntryInfo = roomChangeApplicationEntryCollection.get(0);
|
|
|
|
+ String number = roomChangeApplicationEntryInfo.getParent().getNumber();
|
|
|
|
+ throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"员工 " + personName + "已有换宿单[ " + number + " ],不能提交生效!\n"});
|
|
|
|
+ }
|
|
occupants.setCheckOutDate(checkoutDate);
|
|
occupants.setCheckOutDate(checkoutDate);
|
|
-// PersonInfo personInfo = entryInfo.getPerson();
|
|
|
|
-// String personId = personInfo.getId().toString();
|
|
|
|
-// //校验员工用工关系状态
|
|
|
|
-// IPerson iPerson = PersonFactory.getLocalInstance(ctx);
|
|
|
|
-// //SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
|
-// //sic.add("");
|
|
|
|
-// personInfo = iPerson.getPersonInfo(new ObjectUuidPK(personId));
|
|
|
|
-// boolean isInCount = personInfo.getEmployeeType().isIsInCount();
|
|
|
|
-// if (!isInCount) {
|
|
|
|
-// //员工用工关系状态
|
|
|
|
-// //
|
|
|
|
-// }
|
|
|
|
- //生成入住人员信息
|
|
|
|
- //校验时间是否存在交叉
|
|
|
|
updateCols.add(occupants);
|
|
updateCols.add(occupants);
|
|
}
|
|
}
|
|
//批量更新入住信息
|
|
//批量更新入住信息
|
|
iOccupants.updateBatchData(updateCols);
|
|
iOccupants.updateBatchData(updateCols);
|
|
- //更新
|
|
|
|
- //update(ctx, new ObjectUuidPK(billId), info);
|
|
|
|
- //提交
|
|
|
|
|
|
+ //提交生效
|
|
IObjectPK iObjectPK = super._submitEffect(ctx, info);
|
|
IObjectPK iObjectPK = super._submitEffect(ctx, info);
|
|
return iObjectPK;
|
|
return iObjectPK;
|
|
}
|
|
}
|
|
@@ -192,47 +204,150 @@ public class CheckoutApplicationControllerBean extends AbstractCheckoutApplicati
|
|
sic.add("entrys.*");
|
|
sic.add("entrys.*");
|
|
sic.add("entrys.person.*");
|
|
sic.add("entrys.person.*");
|
|
sic.add("entrys.occupants.*");
|
|
sic.add("entrys.occupants.*");
|
|
|
|
+ sic.add("entrys.currentRoom.*");
|
|
CheckoutApplicationInfo info = getCheckoutApplicationInfo(ctx, new ObjectUuidPK(billId), sic);
|
|
CheckoutApplicationInfo info = getCheckoutApplicationInfo(ctx, new ObjectUuidPK(billId), sic);
|
|
HRBillStateEnum billState = info.getBillState();
|
|
HRBillStateEnum billState = info.getBillState();
|
|
if (!HRBillStateEnum.AUDITED.equals(billState)) {
|
|
if (!HRBillStateEnum.AUDITED.equals(billState)) {
|
|
throw new AffairBizException(HRBaseException.BILLSTATECANUNCHECK);
|
|
throw new AffairBizException(HRBaseException.BILLSTATECANUNCHECK);
|
|
}
|
|
}
|
|
IOccupants iOccupants = OccupantsFactory.getLocalInstance(ctx);
|
|
IOccupants iOccupants = OccupantsFactory.getLocalInstance(ctx);
|
|
- IRoomChangeApplicationEntry iRoomChangeApplicationEntry = RoomChangeApplicationEntryFactory.getLocalInstance(ctx);
|
|
|
|
- ICheckoutApplicationEntry iCheckoutApplicationEntry = CheckoutApplicationEntryFactory.getLocalInstance(ctx);
|
|
|
|
|
|
+// IRoomChangeApplicationEntry iRoomChangeApplicationEntry = RoomChangeApplicationEntryFactory.getLocalInstance(ctx);
|
|
|
|
+// ICheckoutApplicationEntry iCheckoutApplicationEntry = CheckoutApplicationEntryFactory.getLocalInstance(ctx);
|
|
CheckoutApplicationEntryCollection entrys = info.getEntrys();
|
|
CheckoutApplicationEntryCollection entrys = info.getEntrys();
|
|
- StringBuilder errorMsg = new StringBuilder();
|
|
|
|
|
|
+ //StringBuilder errorMsg = new StringBuilder();
|
|
CoreBaseCollection updateCols = new CoreBaseCollection();
|
|
CoreBaseCollection updateCols = new CoreBaseCollection();
|
|
for (int i = 0; i < entrys.size(); i++) {
|
|
for (int i = 0; i < entrys.size(); i++) {
|
|
|
|
+ //退宿单分录
|
|
CheckoutApplicationEntryInfo entryInfo = entrys.get(i);
|
|
CheckoutApplicationEntryInfo entryInfo = entrys.get(i);
|
|
- //PersonInfo person = entryInfo.getPerson();
|
|
|
|
|
|
+ PersonInfo person = entryInfo.getPerson();
|
|
|
|
+ String personId = person.getId().toString();
|
|
|
|
+ //入住日期
|
|
|
|
+ Date checkInDate = entryInfo.getCheckInDate();
|
|
|
|
+ if (checkInDate == null) {
|
|
|
|
+ throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"入住日期为空!"});
|
|
|
|
+ }
|
|
|
|
+ //原退宿日期
|
|
|
|
+ Date oldCheckoutDate = entryInfo.getOldCheckoutDate();
|
|
|
|
+ if (oldCheckoutDate == null) {
|
|
|
|
+ throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"原退宿日期为空!"});
|
|
|
|
+ }
|
|
OccupantsInfo occupants = entryInfo.getOccupants();
|
|
OccupantsInfo occupants = entryInfo.getOccupants();
|
|
|
|
+ if (occupants == null) {
|
|
|
|
+ throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"入住信息为空!"});
|
|
|
|
+ }
|
|
String occupantsId = occupants.getId().toString();
|
|
String occupantsId = occupants.getId().toString();
|
|
- //检查是否有退宿流程
|
|
|
|
-// RoomChangeApplicationEntryCollection roomChangeApplicationEntryCollection = iRoomChangeApplicationEntry.getRoomChangeApplicationEntryCollection("select parent.number where oldOccupants = '" + occupantsId + "'");
|
|
|
|
|
|
+ //现住房间
|
|
|
|
+ DormitoryInfo currentRoom = entryInfo.getCurrentRoom();
|
|
|
|
+ if (currentRoom == null) {
|
|
|
|
+ throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"现住房间为空!"});
|
|
|
|
+ }
|
|
|
|
+ String roomName = currentRoom.getName();
|
|
|
|
+ String displayName = currentRoom.getDisplayName();
|
|
|
|
+ String roomId = currentRoom.getId().toString();
|
|
|
|
+ //1.校验房间在原入住期间内有没有被其他人入住
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ Map<String, List> paramAll = new HashMap<String, List>();
|
|
|
|
+ Map<String, String> params = new HashMap<String, String>();
|
|
|
|
+ List list = new ArrayList();
|
|
|
|
+ list.add(params);
|
|
|
|
+ params.put("checkInDate", sdf.format(checkInDate));
|
|
|
|
+ params.put("checkoutDate", sdf.format(oldCheckoutDate));
|
|
|
|
+ params.put("personId", personId);
|
|
|
|
+ params.put("roomId", roomId);
|
|
|
|
+ paramAll.put("validateData", list);
|
|
|
|
+ Map result = null;
|
|
|
|
+ try {
|
|
|
|
+ IMSFServiceFacade imsfServiceFacade = MSFServiceFacadeFactory.getLocalInstance(ctx);
|
|
|
|
+ result = (Map) imsfServiceFacade.processService("validateRoomAvailableService", paramAll);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error(e);
|
|
|
|
+ throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{"调用接口validateRoomAvailableService报错: " + e.getMessage()});
|
|
|
|
+ }
|
|
|
|
+ Integer code = (Integer) result.get("code");
|
|
|
|
+ if (500 == code) {
|
|
|
|
+ throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{(String) result.get("errorMsg").toString()});
|
|
|
|
+ }
|
|
|
|
+// verifyOccupants(ctx, roomId, occupantsId, displayName, checkInDate, oldCheckoutDate);
|
|
|
|
+// //2.校验房间在原入住期间内有没有审批中的入住单、换宿单中
|
|
|
|
+// //检查是否有换宿流程
|
|
|
|
+// FilterInfo rcFilterInfo = new FilterInfo();
|
|
|
|
+// FilterItemCollection rcFilterItems = rcFilterInfo.getFilterItems();
|
|
|
|
+// //单据状态等于已提交、审批中或审批通过
|
|
|
|
+// rcFilterItems.add(new FilterItemInfo("parent.billState", "1,2,3", CompareType.INCLUDE));
|
|
|
|
+// //申请入住日期在入住日期和退宿日期之间
|
|
|
|
+// rcFilterItems.add(new FilterItemInfo("checkInDate", checkInDate, CompareType.LESS_EQUALS));
|
|
|
|
+// rcFilterItems.add(new FilterItemInfo("checkoutDate", checkInDate, CompareType.GREATER_EQUALS));
|
|
|
|
+// //入住日期在申请入住日期和申请退宿日期之间
|
|
|
|
+// rcFilterItems.add(new FilterItemInfo("checkInDate", checkInDate, CompareType.GREATER_EQUALS));
|
|
|
|
+// rcFilterItems.add(new FilterItemInfo("checkInDate", oldCheckoutDate, CompareType.LESS_EQUALS));
|
|
|
|
+// //调整房间
|
|
|
|
+// rcFilterItems.add(new FilterItemInfo("adjustRoom", currentRoom.getId()));
|
|
|
|
+// rcFilterInfo.setMaskString("#0 and ((#1 and #2) or (#3 and #4)) and #5 and #6");
|
|
|
|
+// rcFilterInfo.setMaskString("#0 and ((#1 and #2) or (#3 and #4)) and #5");
|
|
|
|
+// SelectorItemCollection rcSic = new SelectorItemCollection();
|
|
|
|
+// rcSic.add("person.name");
|
|
|
|
+// EntityViewInfo rcViewInfo = EntityViewInfo.getInstance(rcFilterInfo, rcSic, null);
|
|
|
|
+// RoomChangeApplicationEntryCollection roomChangeApplicationEntryCollection =
|
|
|
|
+// iRoomChangeApplicationEntry.getRoomChangeApplicationEntryCollection(rcViewInfo);
|
|
// if (roomChangeApplicationEntryCollection.size() > 0) {
|
|
// if (roomChangeApplicationEntryCollection.size() > 0) {
|
|
// RoomChangeApplicationEntryInfo roomChangeApplicationEntryInfo = roomChangeApplicationEntryCollection.get(0);
|
|
// RoomChangeApplicationEntryInfo roomChangeApplicationEntryInfo = roomChangeApplicationEntryCollection.get(0);
|
|
// String number = roomChangeApplicationEntryInfo.getParent().getNumber();
|
|
// String number = roomChangeApplicationEntryInfo.getParent().getNumber();
|
|
-// errorMsg.append("员工 " + person.getName() + "已有换宿单[ " + number + " ],不能反审核!\n");
|
|
|
|
-// }
|
|
|
|
- //检查是否有换宿流程
|
|
|
|
-// CheckoutApplicationEntryCollection checkoutApplicationEntryCollection = iCheckoutApplicationEntry.getCheckoutApplicationEntryCollection("select parent.number where occupants = '" + occupantsId + "'");
|
|
|
|
-// if (checkoutApplicationEntryCollection.size() > 0) {
|
|
|
|
-// CheckoutApplicationEntryInfo checkoutApplicationEntryInfo = checkoutApplicationEntryCollection.get(0);
|
|
|
|
-// String number = checkoutApplicationEntryInfo.getParent().getNumber();
|
|
|
|
-// errorMsg.append("员工 " + person.getName() + "已有退宿单[ " + number + " ],不能反审核!\n");
|
|
|
|
|
|
+// //errorMsg.append("员工 " + person.getName() + "已有换宿单[ " + number + " ],不能反审核!\n");
|
|
// }
|
|
// }
|
|
//没有水电明细的可以反审批
|
|
//没有水电明细的可以反审批
|
|
- occupants.setCheckOutDate(entryInfo.getOldCheckoutDate());
|
|
|
|
|
|
+ occupants.setCheckOutDate(oldCheckoutDate);
|
|
updateCols.add(occupants);
|
|
updateCols.add(occupants);
|
|
}
|
|
}
|
|
- if (errorMsg.length() > 0) {
|
|
|
|
- throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{errorMsg.toString()});
|
|
|
|
- }
|
|
|
|
super._untiCheckBizBill(ctx, billId);
|
|
super._untiCheckBizBill(ctx, billId);
|
|
if (updateCols.size() > 0) {
|
|
if (updateCols.size() > 0) {
|
|
//批量更新入住信息
|
|
//批量更新入住信息
|
|
iOccupants.updateBatchData(updateCols);
|
|
iOccupants.updateBatchData(updateCols);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 校验房间在原入住期间内有没有被其他人入住
|
|
|
|
+ *
|
|
|
|
+ * @param ctx
|
|
|
|
+ * @param roomId
|
|
|
|
+ * @param occupantsId
|
|
|
|
+ * @param displayName
|
|
|
|
+ * @param checkInDate
|
|
|
|
+ * @param oldCheckoutDate
|
|
|
|
+ * @throws BOSException
|
|
|
|
+ * @throws BaseItemException
|
|
|
|
+ */
|
|
|
|
+ private void verifyOccupants(
|
|
|
|
+ Context ctx,
|
|
|
|
+ String roomId,
|
|
|
|
+ String occupantsId,
|
|
|
|
+ String displayName,
|
|
|
|
+ Date checkInDate,
|
|
|
|
+ Date oldCheckoutDate
|
|
|
|
+ ) throws BOSException, BaseItemException {
|
|
|
|
+ IOccupants iOccupants = OccupantsFactory.getLocalInstance(ctx);
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ FilterInfo filterInfo = new FilterInfo();
|
|
|
|
+ FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
|
+ filterItems.add(new FilterItemInfo("Dormitory", roomId));
|
|
|
|
+ //申请入住日期在入住日期和退宿日期之间
|
|
|
|
+ filterItems.add(new FilterItemInfo("CheckInDate", checkInDate, CompareType.LESS_EQUALS));
|
|
|
|
+ filterItems.add(new FilterItemInfo("CheckOutDate", checkInDate, CompareType.GREATER_EQUALS));
|
|
|
|
+ //入住日期在申请入住日期和申请退宿日期之间
|
|
|
|
+ filterItems.add(new FilterItemInfo("CheckInDate", checkInDate, CompareType.GREATER_EQUALS));
|
|
|
|
+ filterItems.add(new FilterItemInfo("CheckInDate", oldCheckoutDate, CompareType.LESS_EQUALS));
|
|
|
|
+ filterItems.add(new FilterItemInfo("id", occupantsId, CompareType.NOTEQUALS));
|
|
|
|
+ filterInfo.setMaskString("#0 and ((#1 and #2) or (#3 and #4)) and #5");
|
|
|
|
+ SelectorItemCollection occupantsSic = new SelectorItemCollection();
|
|
|
|
+ occupantsSic.add("person.name");
|
|
|
|
+ EntityViewInfo viewInfo = EntityViewInfo.getInstance(filterInfo, occupantsSic, null);
|
|
|
|
+ OccupantsCollection occupantsCollection = iOccupants.getOccupantsCollection(viewInfo);
|
|
|
|
+ for (int j = 0; j < occupantsCollection.size(); j++) {
|
|
|
|
+ OccupantsInfo occupantsInfo = occupantsCollection.get(j);
|
|
|
|
+ String personName = occupantsInfo.getPerson().getName();
|
|
|
|
+ throw new BaseItemException(BaseItemException.CUSTOM_EXCEPTION, new Object[]{
|
|
|
|
+ "入住信息中员工[" + personName + "]在" + sdf.format(checkInDate) + " ~ " + sdf.format(oldCheckoutDate) + "期间已入住房间[" + displayName + "],无法反审批该退宿单"});
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|