解决遗漏不计算不同住人员住宿费问题-龚宇杰
This commit is contained in:
parent
27ddcd823f
commit
92835169dd
|
@ -43,6 +43,8 @@ public class TripPersonCohabitPlugin extends AbstractBillPlugIn implements Plugi
|
||||||
updateTripAccStd(parentIndex, rowIndex);
|
updateTripAccStd(parentIndex, rowIndex);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.getView().updateView("entryentity");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,6 +113,7 @@ public class TripPersonCohabitPlugin extends AbstractBillPlugIn implements Plugi
|
||||||
DynamicObject travelerI = travelers.get(i).getDynamicObject("fbasedataid");
|
DynamicObject travelerI = travelers.get(i).getDynamicObject("fbasedataid");
|
||||||
if (cohabitPersons.containsKey(travelerI.getLong("id"))) continue;
|
if (cohabitPersons.containsKey(travelerI.getLong("id"))) continue;
|
||||||
|
|
||||||
|
boolean isCohabit = false;
|
||||||
for (int j = i + 1; j < travelers.size(); j++) {
|
for (int j = i + 1; j < travelers.size(); j++) {
|
||||||
DynamicObject travelerJ = travelers.get(j).getDynamicObject("fbasedataid");
|
DynamicObject travelerJ = travelers.get(j).getDynamicObject("fbasedataid");
|
||||||
travelerI = BusinessDataServiceHelper.loadSingle(travelerI.getPkValue(), "bos_user");
|
travelerI = BusinessDataServiceHelper.loadSingle(travelerI.getPkValue(), "bos_user");
|
||||||
|
@ -119,6 +122,7 @@ public class TripPersonCohabitPlugin extends AbstractBillPlugIn implements Plugi
|
||||||
String genderI = travelerI.getString("gender");
|
String genderI = travelerI.getString("gender");
|
||||||
String genderJ = travelerJ.getString("gender");
|
String genderJ = travelerJ.getString("gender");
|
||||||
if (!genderI.equals("0") && genderI.equals(genderJ)) {
|
if (!genderI.equals("0") && genderI.equals(genderJ)) {
|
||||||
|
isCohabit = true;
|
||||||
cohabitPersons.put(travelerI.getLong("id"), travelerJ.getLong("id"));
|
cohabitPersons.put(travelerI.getLong("id"), travelerJ.getLong("id"));
|
||||||
cohabitPersons.put(travelerJ.getLong("id"), travelerI.getLong("id"));
|
cohabitPersons.put(travelerJ.getLong("id"), travelerI.getLong("id"));
|
||||||
|
|
||||||
|
@ -146,24 +150,29 @@ public class TripPersonCohabitPlugin extends AbstractBillPlugIn implements Plugi
|
||||||
BigDecimal tripSTDAmount = tripStdDetail == null ? BigDecimal.ZERO : tripStdDetail.getStandardamount();
|
BigDecimal tripSTDAmount = tripStdDetail == null ? BigDecimal.ZERO : tripStdDetail.getStandardamount();
|
||||||
BigDecimal highSeasonTripSTDAmount = tripStdDetail == null ? BigDecimal.ZERO : tripStdDetail.getHighSeasonStandardamount();
|
BigDecimal highSeasonTripSTDAmount = tripStdDetail == null ? BigDecimal.ZERO : tripStdDetail.getHighSeasonStandardamount();
|
||||||
|
|
||||||
BigDecimal std = tripSTDAmount.setScale(2, RoundingMode.HALF_DOWN);
|
getStdDetail(stdDetail, tripSTDAmount, highSeasonTripSTDAmount);
|
||||||
if (std.equals(new BigDecimal(0).setScale(2, RoundingMode.HALF_DOWN))) {
|
|
||||||
stdDetail.append("未设置").append(",");
|
|
||||||
} else {
|
|
||||||
stdDetail.append("¥").append(std).append("/天,");
|
|
||||||
}
|
|
||||||
tripStdSum = tripStdSum.add(tripSTDAmount);
|
|
||||||
|
|
||||||
BigDecimal highStd = highSeasonTripSTDAmount.setScale(2, RoundingMode.HALF_DOWN);
|
tripStdSum = tripStdSum.add(tripSTDAmount);
|
||||||
if (highStd.equals(new BigDecimal(0).setScale(2, RoundingMode.HALF_DOWN))) {
|
|
||||||
stdDetail.append("旺季未设置");
|
|
||||||
} else {
|
|
||||||
stdDetail.append("旺季¥").append(highStd).append("/天");
|
|
||||||
}
|
|
||||||
highTripStdSum = highTripStdSum.add(highSeasonTripSTDAmount);
|
highTripStdSum = highTripStdSum.add(highSeasonTripSTDAmount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isCohabit) {
|
||||||
|
if (stdDetail.length() == 0) {
|
||||||
|
stdDetail.append(travelerI.getString("name")).append(":");
|
||||||
|
} else {
|
||||||
|
stdDetail.append(" | ").append(travelerI.getString("name")).append(":");
|
||||||
|
}
|
||||||
|
|
||||||
|
TripStandardDetail tripStdDetail = TripStandardUtils.getAccmodationStdFromPageCache(travelerI.getLong("id"), this, entryCurrency.getPkValue(), tripArea.getPkValue(), tripExpenseItem.getPkValue(), null);
|
||||||
|
BigDecimal tripSTDAmount = tripStdDetail == null ? BigDecimal.ZERO : tripStdDetail.getStandardamount();
|
||||||
|
BigDecimal highSeasonTripSTDAmount = tripStdDetail == null ? BigDecimal.ZERO : tripStdDetail.getHighSeasonStandardamount();
|
||||||
|
getStdDetail(stdDetail, tripSTDAmount, highSeasonTripSTDAmount);
|
||||||
|
|
||||||
|
tripStdSum = tripStdSum.add(tripSTDAmount);
|
||||||
|
highTripStdSum = highTripStdSum.add(highSeasonTripSTDAmount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
model.setValue("tripstandardamount", tripStdSum, curEntryIndex, parentEntryIndex);
|
model.setValue("tripstandardamount", tripStdSum, curEntryIndex, parentEntryIndex);
|
||||||
|
@ -184,26 +193,42 @@ public class TripPersonCohabitPlugin extends AbstractBillPlugIn implements Plugi
|
||||||
* @param reimburseLevelJ B用户报销级别
|
* @param reimburseLevelJ B用户报销级别
|
||||||
*/
|
*/
|
||||||
private int whichIsTopReimburseLevel(DynamicObject reimburseLevelI, DynamicObject reimburseLevelJ) {
|
private int whichIsTopReimburseLevel(DynamicObject reimburseLevelI, DynamicObject reimburseLevelJ) {
|
||||||
int i = 0;
|
|
||||||
int j = 0;
|
|
||||||
|
|
||||||
String numberI = reimburseLevelI.getString("number");
|
String numberI = reimburseLevelI.getString("number");
|
||||||
String numberJ = reimburseLevelJ.getString("number");
|
String numberJ = reimburseLevelJ.getString("number");
|
||||||
|
|
||||||
String[] reimburseLevels = new String[]{"002", "003", "General-01"};
|
String[] reimburseLevels = new String[]{"002", "003", "General-01"};
|
||||||
|
int length = reimburseLevels.length;
|
||||||
|
int i = length;
|
||||||
|
int j = length;
|
||||||
|
|
||||||
for (int num = 0; num < reimburseLevels.length; num++) {
|
for (int num = 0; num < reimburseLevels.length; num++) {
|
||||||
String reimburseLevel = reimburseLevels[num];
|
String reimburseLevel = reimburseLevels[num];
|
||||||
if (i == 0 && numberI.equals(reimburseLevel)) i = num;
|
if (i == length && numberI.equals(reimburseLevel)) i = num;
|
||||||
if (j == 0 && numberJ.equals(reimburseLevel)) j = num;
|
if (j == length && numberJ.equals(reimburseLevel)) j = num;
|
||||||
|
|
||||||
if (i != 0 && j != 0) break;
|
if (i != length && j != length) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > j) {
|
if (i < j) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getStdDetail(StringBuilder stdDetail, BigDecimal tripSTDAmount, BigDecimal highSeasonTripSTDAmount) {
|
||||||
|
BigDecimal std = tripSTDAmount.setScale(2, RoundingMode.HALF_DOWN);
|
||||||
|
if (std.equals(new BigDecimal(0).setScale(2, RoundingMode.HALF_DOWN))) {
|
||||||
|
stdDetail.append("未设置").append(",");
|
||||||
|
} else {
|
||||||
|
stdDetail.append("¥").append(std).append("/天,");
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal highStd = highSeasonTripSTDAmount.setScale(2, RoundingMode.HALF_DOWN);
|
||||||
|
if (highStd.equals(new BigDecimal(0).setScale(2, RoundingMode.HALF_DOWN))) {
|
||||||
|
stdDetail.append("旺季未设置");
|
||||||
|
} else {
|
||||||
|
stdDetail.append("旺季¥").append(highStd).append("/天");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue