From 72dda4f30f03daf7967bc959c90eeffe1931addb Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 15 十二月 2020 18:14:58 +0800
Subject: [PATCH] 加入欠费缴费工鞥
---
service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java | 345 +++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 259 insertions(+), 86 deletions(-)
diff --git a/service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java b/service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java
index e429999..fd82ef9 100644
--- a/service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java
+++ b/service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java
@@ -6,6 +6,7 @@
import com.java110.api.bmo.fee.IFeeBMO;
import com.java110.core.context.DataFlowContext;
import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.core.smo.IComputeFeeSMO;
import com.java110.dto.RoomDto;
import com.java110.dto.fee.FeeConfigDto;
import com.java110.dto.fee.FeeDto;
@@ -24,7 +25,6 @@
import com.java110.po.fee.PayFeePo;
import com.java110.po.feeReceipt.FeeReceiptPo;
import com.java110.po.feeReceiptDetail.FeeReceiptDetailPo;
-import com.java110.service.smo.IComputeFeeSMO;
import com.java110.utils.constant.BusinessTypeConstant;
import com.java110.utils.constant.CommonConstant;
import com.java110.utils.constant.ResponseConstant;
@@ -109,85 +109,23 @@
super.update(dataFlowContext, payFeePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FEE_INFO);
}
- /**
- * 娣诲姞璐圭敤鏄庣粏淇℃伅
- *
- * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
- * @param dataFlowContext 鏁版嵁涓婁笅鏂�
- * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
- */
- public JSONObject addFeeDetail(JSONObject paramInJson, DataFlowContext dataFlowContext, FeeReceiptDetailPo feeReceiptDetailPo, FeeReceiptPo feeReceiptPo) {
+ private static Calendar getTargetEndTime(Calendar endCalender, Double cycles) {
+ if (StringUtil.isInteger(cycles.toString())) {
+ endCalender.add(Calendar.MONTH, new Double(cycles).intValue());
-
- JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
- business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_DETAIL);
- business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
- business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
- JSONObject businessFeeDetail = new JSONObject();
- businessFeeDetail.putAll(paramInJson);
- businessFeeDetail.put("detailId", "-1");
- businessFeeDetail.put("primeRate", "1.00");
- //璁$畻 搴旀敹閲戦
- FeeDto feeDto = new FeeDto();
- feeDto.setFeeId(paramInJson.getString("feeId"));
- feeDto.setCommunityId(paramInJson.getString("communityId"));
- List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
-
- if (feeDtos == null || feeDtos.size() != 1) {
- throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
+ return endCalender;
}
- feeDto = feeDtos.get(0);
- businessFeeDetail.put("startTime", DateUtil.getFormatTimeString(feeDto.getEndTime(), DateUtil.DATE_FORMATE_STRING_A));
- int hours = 0;
- Date targetEndTime = null;
- if ("-101".equals(paramInJson.getString("cycles"))) {
- Date endTime = feeDto.getEndTime();
- Calendar endCalender = Calendar.getInstance();
- endCalender.setTime(endTime);
- hours = new Double(Double.parseDouble(paramInJson.getString("tmpCycles")) * DateUtil.getCurrentMonthDay() * 24).intValue();
- endCalender.add(Calendar.HOUR, hours);
- targetEndTime = endCalender.getTime();
- } else {
- targetEndTime = computeFeeSMOImpl.getFeeEndTimeByCycles(feeDto, paramInJson.getString("cycles"));
+ if (cycles >= 1) {
+ endCalender.add(Calendar.MONTH, new Double(Math.floor(cycles)).intValue());
+ cycles = cycles - Math.floor(cycles);
}
- businessFeeDetail.put("endTime", DateUtil.getFormatTimeString(targetEndTime, DateUtil.DATE_FORMATE_STRING_A));
- paramInJson.put("feeInfo", feeDto);
+ //int hours = new Double(cycles * DateUtil.getCurrentMonthDay() * 24).intValue();
+ int futureDay = endCalender.getActualMaximum(Calendar.DAY_OF_MONTH);
+ int hours = new Double(cycles * futureDay * 24).intValue();
+ endCalender.add(Calendar.HOUR, hours);
- BigDecimal feePrice = new BigDecimal(computeFeeSMOImpl.getFeePrice(feeDto));
-
- BigDecimal cycles = null;
- //BigDecimal receivableAmount = feePrice;
- if ("-101".equals(paramInJson.getString("cycles"))) {//鑷畾涔夌即璐�
- BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(paramInJson.getString("receivedAmount")));
- cycles = receivedAmount.divide(feePrice, 2, BigDecimal.ROUND_HALF_EVEN);
- paramInJson.put("tmpCycles", cycles);
- businessFeeDetail.put("cycles", cycles.doubleValue());
- businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
- } else {
- cycles = new BigDecimal(Double.parseDouble(paramInJson.getString("cycles")));
- double tmpReceivableAmount = cycles.multiply(feePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
- businessFeeDetail.put("receivableAmount", tmpReceivableAmount);
- }
-
- business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(PayFeeDetailPo.class.getSimpleName(), businessFeeDetail);
-
- feeReceiptDetailPo.setAmount(businessFeeDetail.getString("receivableAmount"));
- feeReceiptDetailPo.setCommunityId(feeDto.getCommunityId());
- feeReceiptDetailPo.setCycle(businessFeeDetail.getString("cycles"));
- feeReceiptDetailPo.setDetailId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId));
- feeReceiptDetailPo.setEndTime(businessFeeDetail.getString("endTime"));
- feeReceiptDetailPo.setFeeId(feeDto.getFeeId());
- feeReceiptDetailPo.setFeeName(StringUtil.isEmpty(feeDto.getImportFeeName()) ? feeDto.getFeeName() : feeDto.getImportFeeName());
- feeReceiptDetailPo.setStartTime(businessFeeDetail.getString("startTime"));
- feeReceiptDetailPo.setReceiptId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_receiptId));
- feeReceiptPo.setAmount(feeReceiptDetailPo.getAmount());
- feeReceiptPo.setCommunityId(feeReceiptDetailPo.getCommunityId());
- feeReceiptPo.setReceiptId(feeReceiptDetailPo.getReceiptId());
- feeReceiptPo.setObjType(feeDto.getPayerObjType());
- feeReceiptPo.setObjId(feeDto.getPayerObjId());
- feeReceiptPo.setObjName(computeFeeSMOImpl.getFeeObjName(feeDto));
- return business;
+ return endCalender;
}
@@ -212,6 +150,159 @@
}
/**
+ * 娣诲姞璐圭敤鏄庣粏淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject addFeeDetail(JSONObject paramInJson, DataFlowContext dataFlowContext, FeeReceiptDetailPo feeReceiptDetailPo, FeeReceiptPo feeReceiptPo) {
+
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_DETAIL);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessFeeDetail = new JSONObject();
+ businessFeeDetail.putAll(paramInJson);
+ businessFeeDetail.put("detailId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId));
+ businessFeeDetail.put("primeRate", "1.00");
+ //璁$畻 搴旀敹閲戦
+ FeeDto feeDto = new FeeDto();
+ feeDto.setFeeId(paramInJson.getString("feeId"));
+ feeDto.setCommunityId(paramInJson.getString("communityId"));
+ List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+
+ if (feeDtos == null || feeDtos.size() != 1) {
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
+ }
+ if (!businessFeeDetail.containsKey("state")) {
+ businessFeeDetail.put("state", "1400");
+ }
+ feeDto = feeDtos.get(0);
+ businessFeeDetail.put("startTime", DateUtil.getFormatTimeString(feeDto.getEndTime(), DateUtil.DATE_FORMATE_STRING_A));
+ int hours = 0;
+ Date targetEndTime = null;
+ BigDecimal cycles = null;
+ BigDecimal feePrice = new BigDecimal(computeFeeSMOImpl.getFeePrice(feeDto));
+ if ("-101".equals(paramInJson.getString("cycles"))) {
+ Date endTime = feeDto.getEndTime();
+ Calendar endCalender = Calendar.getInstance();
+ endCalender.setTime(endTime);
+ BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(paramInJson.getString("receivedAmount")));
+ cycles = receivedAmount.divide(feePrice, 4, BigDecimal.ROUND_HALF_EVEN);
+ endCalender = getTargetEndTime(endCalender, cycles.doubleValue());
+ targetEndTime = endCalender.getTime();
+ paramInJson.put("tmpCycles", cycles.doubleValue());
+ businessFeeDetail.put("cycles", cycles.doubleValue());
+ businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
+ } else {
+ targetEndTime = computeFeeSMOImpl.getFeeEndTimeByCycles(feeDto, paramInJson.getString("cycles"));
+ cycles = new BigDecimal(Double.parseDouble(paramInJson.getString("cycles")));
+ double tmpReceivableAmount = cycles.multiply(feePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ businessFeeDetail.put("receivableAmount", tmpReceivableAmount);
+ }
+
+ businessFeeDetail.put("endTime", DateUtil.getFormatTimeString(targetEndTime, DateUtil.DATE_FORMATE_STRING_A));
+ paramInJson.put("feeInfo", feeDto);
+
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(PayFeeDetailPo.class.getSimpleName(), businessFeeDetail);
+ paramInJson.put("detailId", businessFeeDetail.getString("detailId"));
+ feeReceiptDetailPo.setAmount(businessFeeDetail.getString("receivedAmount"));
+ feeReceiptDetailPo.setCommunityId(feeDto.getCommunityId());
+ feeReceiptDetailPo.setCycle(businessFeeDetail.getString("cycles"));
+ feeReceiptDetailPo.setDetailId(businessFeeDetail.getString("detailId"));
+ feeReceiptDetailPo.setEndTime(businessFeeDetail.getString("endTime"));
+ feeReceiptDetailPo.setFeeId(feeDto.getFeeId());
+ feeReceiptDetailPo.setFeeName(StringUtil.isEmpty(feeDto.getImportFeeName()) ? feeDto.getFeeName() : feeDto.getImportFeeName());
+ feeReceiptDetailPo.setStartTime(businessFeeDetail.getString("startTime"));
+ feeReceiptDetailPo.setReceiptId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_receiptId));
+ computeFeeSMOImpl.freshFeeReceiptDetail(feeDto, feeReceiptDetailPo);
+ feeReceiptPo.setAmount(feeReceiptDetailPo.getAmount());
+ feeReceiptPo.setCommunityId(feeReceiptDetailPo.getCommunityId());
+ feeReceiptPo.setReceiptId(feeReceiptDetailPo.getReceiptId());
+ feeReceiptPo.setObjType(feeDto.getPayerObjType());
+ feeReceiptPo.setObjId(feeDto.getPayerObjId());
+ feeReceiptPo.setObjName(computeFeeSMOImpl.getFeeObjName(feeDto));
+ return business;
+ }
+
+ /**
+ * 娣诲姞璐圭敤鏄庣粏淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject addOweFeeDetail(JSONObject paramInJson, DataFlowContext dataFlowContext,
+ List<FeeReceiptDetailPo> feeReceiptDetailPos,
+ List<FeeReceiptPo> feeReceiptPos) {
+
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_DETAIL);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessFeeDetail = new JSONObject();
+ businessFeeDetail.putAll(paramInJson);
+ businessFeeDetail.put("detailId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId));
+ businessFeeDetail.put("primeRate", "1.00");
+ //璁$畻 搴旀敹閲戦
+ FeeDto feeDto = new FeeDto();
+ feeDto.setFeeId(paramInJson.getString("feeId"));
+ feeDto.setCommunityId(paramInJson.getString("communityId"));
+ List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+
+ if (feeDtos == null || feeDtos.size() != 1) {
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
+ }
+ if (!businessFeeDetail.containsKey("state")) {
+ businessFeeDetail.put("state", "1400");
+ }
+ feeDto = feeDtos.get(0);
+ businessFeeDetail.put("startTime", paramInJson.getString("startTime"));
+ BigDecimal cycles = null;
+ BigDecimal feePrice = new BigDecimal(computeFeeSMOImpl.getFeePrice(feeDto));
+ Date endTime = feeDto.getEndTime();
+ Calendar endCalender = Calendar.getInstance();
+ endCalender.setTime(endTime);
+ BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(paramInJson.getString("receivedAmount")));
+ cycles = receivedAmount.divide(feePrice, 4, BigDecimal.ROUND_HALF_EVEN);
+ businessFeeDetail.put("cycles", cycles.doubleValue());
+ businessFeeDetail.put("receivableAmount", paramInJson.getString("receivedAmount"));
+ businessFeeDetail.put("receivedAmount", paramInJson.getString("receivedAmount"));
+ businessFeeDetail.put("endTime", paramInJson.getString("endTime"));
+ paramInJson.put("feeInfo", feeDto);
+ paramInJson.put("cycles", cycles.doubleValue());
+
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(PayFeeDetailPo.class.getSimpleName(), businessFeeDetail);
+ paramInJson.put("detailId", businessFeeDetail.getString("detailId"));
+
+ FeeReceiptPo feeReceiptPo = new FeeReceiptPo();
+ FeeReceiptDetailPo feeReceiptDetailPo = new FeeReceiptDetailPo();
+ feeReceiptDetailPo.setAmount(businessFeeDetail.getString("receivedAmount"));
+ feeReceiptDetailPo.setCommunityId(feeDto.getCommunityId());
+ feeReceiptDetailPo.setCycle(businessFeeDetail.getString("cycles"));
+ feeReceiptDetailPo.setDetailId(businessFeeDetail.getString("detailId"));
+ feeReceiptDetailPo.setEndTime(businessFeeDetail.getString("endTime"));
+ feeReceiptDetailPo.setFeeId(feeDto.getFeeId());
+ feeReceiptDetailPo.setFeeName(StringUtil.isEmpty(feeDto.getImportFeeName()) ? feeDto.getFeeName() : feeDto.getImportFeeName());
+ feeReceiptDetailPo.setStartTime(businessFeeDetail.getString("startTime"));
+ feeReceiptDetailPo.setReceiptId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_receiptId));
+ computeFeeSMOImpl.freshFeeReceiptDetail(feeDto, feeReceiptDetailPo);
+ feeReceiptDetailPos.add(feeReceiptDetailPo);
+ feeReceiptPo.setAmount(feeReceiptDetailPo.getAmount());
+ feeReceiptPo.setCommunityId(feeReceiptDetailPo.getCommunityId());
+ feeReceiptPo.setReceiptId(feeReceiptDetailPo.getReceiptId());
+ feeReceiptPo.setObjType(feeDto.getPayerObjType());
+ feeReceiptPo.setObjId(feeDto.getPayerObjId());
+ feeReceiptPo.setObjName(computeFeeSMOImpl.getFeeObjName(feeDto));
+
+ feeReceiptPos.add(feeReceiptPo);
+ return business;
+ }
+
+ /**
* 淇敼璐圭敤淇℃伅
*
* @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
@@ -232,8 +323,10 @@
endCalender.setTime(endTime);
int hours = 0;
if ("-101".equals(paramInJson.getString("cycles"))) {
- hours = new Double(Double.parseDouble(paramInJson.getString("tmpCycles")) * DateUtil.getCurrentMonthDay() * 24).intValue();
- endCalender.add(Calendar.HOUR, hours);
+// hours = new Double(Double.parseDouble(paramInJson.getString("tmpCycles")) * DateUtil.getCurrentMonthDay() * 24).intValue();
+// endCalender.add(Calendar.HOUR, hours);
+
+ endCalender = getTargetEndTime(endCalender, Double.parseDouble(paramInJson.getString("tmpCycles")));
} else {
endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles")));
}
@@ -257,6 +350,34 @@
}
/**
+ * 淇敼璐圭敤淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject modifyOweFee(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_ONLY_UPDATE_FEE_INFO); //杩欓噷璧皁nly
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 1);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessFee = new JSONObject();
+ FeeDto feeInfo = (FeeDto) paramInJson.get("feeInfo");
+ Map feeMap = BeanConvertUtil.beanCovertMap(feeInfo);
+ feeMap.put("startTime", DateUtil.getFormatTimeString(feeInfo.getStartTime(), DateUtil.DATE_FORMATE_STRING_A));
+ feeMap.put("endTime", paramInJson.getString("endTime"));
+ feeMap.put("cycles", paramInJson.getString("cycles"));
+ feeMap.put("configEndTime", feeInfo.getConfigEndTime());
+
+ businessFee.putAll(feeMap);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(PayFeePo.class.getSimpleName(), businessFee);
+
+ return business;
+ }
+
+ /**
* 娣诲姞璐圭敤鏄庣粏淇℃伅
*
* @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
@@ -272,8 +393,12 @@
business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
JSONObject businessFeeDetail = new JSONObject();
businessFeeDetail.putAll(paramInJson);
- businessFeeDetail.put("detailId", "-1");
+ businessFeeDetail.put("detailId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId));
businessFeeDetail.put("primeRate", "1.00");
+
+ if (!businessFeeDetail.containsKey("state")) {
+ businessFeeDetail.put("state", "1400");
+ }
//璁$畻 搴旀敹閲戦
FeeDto feeDto = new FeeDto();
feeDto.setFeeId(paramInJson.getString("feeId"));
@@ -292,8 +417,9 @@
endCalender.setTime(endTime);
int hours = 0;
if ("-101".equals(paramInJson.getString("cycles"))) {
- hours = new Double(Double.parseDouble(paramInJson.getString("tmpCycles")) * DateUtil.getCurrentMonthDay() * 24).intValue();
- endCalender.add(Calendar.HOUR, hours);
+// hours = new Double(Double.parseDouble(paramInJson.getString("tmpCycles")) * DateUtil.getCurrentMonthDay() * 24).intValue();
+// endCalender.add(Calendar.HOUR, hours);
+ endCalender = getTargetEndTime(endCalender, Double.parseDouble(paramInJson.getString("tmpCycles")));
} else {
endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles")));
if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
@@ -332,6 +458,21 @@
feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
} else if ("4004".equals(computingFormula)) {
feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
+ } else if ("5005".equals(computingFormula)) {
+ if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+ //throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
+ } else {
+ BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+ BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+ BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ BigDecimal sub = curDegree.subtract(preDegree);
+ feePrice = sub.multiply(squarePrice)
+ .add(additionalAmount)
+ .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ }
+ } else if ("6006".equals(computingFormula)) {
+ feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
} else {
throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
}
@@ -355,6 +496,21 @@
//feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ } else if ("5005".equals(computingFormula)) {
+ if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+ throw new IllegalArgumentException("鎶勮〃鏁版嵁寮傚父");
+ } else {
+ BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+ BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+ BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ BigDecimal sub = curDegree.subtract(preDegree);
+ feePrice = sub.multiply(squarePrice)
+ .add(additionalAmount)
+ .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ }
+ } else if ("6006".equals(computingFormula)) {
+ feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
} else if ("4004".equals(computingFormula)) {
feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
} else {
@@ -365,10 +521,14 @@
BigDecimal receivableAmount = feePrice;
BigDecimal cycles = new BigDecimal(Double.parseDouble(paramInJson.getString("cycles")));
double tmpReceivableAmount = cycles.multiply(receivableAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
-
+ double discountPrice = paramInJson.getDouble("discountPrice");
businessFeeDetail.put("receivableAmount", tmpReceivableAmount);
+ businessFeeDetail.put("receivedAmount",
+ new BigDecimal(tmpReceivableAmount).subtract(new BigDecimal(discountPrice)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(PayFeeDetailPo.class.getSimpleName(), businessFeeDetail);
paramInJson.put("receivableAmount", tmpReceivableAmount);
+ paramInJson.put("receivedAmount", businessFeeDetail.getString("receivedAmount"));
+ paramInJson.put("detailId", businessFeeDetail.getString("detailId"));
return business;
}
@@ -444,6 +604,9 @@
businessFeeDetail.putAll(paramInJson);
businessFeeDetail.put("detailId", "-1");
businessFeeDetail.put("primeRate", "1.00");
+ if (!businessFeeDetail.containsKey("state")) {
+ businessFeeDetail.put("state", "1400");
+ }
//璁$畻 搴旀敹閲戦
FeeDto feeDto = new FeeDto();
feeDto.setFeeId(paramInJson.getString("feeId"));
@@ -550,6 +713,11 @@
*/
public JSONObject addFee(OwnerCarDto ownerCarDto, JSONObject paramInJson, DataFlowContext dataFlowContext) {
+ String time = DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A);
+
+ if (paramInJson.containsKey("startTime")) {
+ time = paramInJson.getString("startTime");
+ }
JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);
@@ -561,8 +729,8 @@
businessUnit.put("feeTypeCd", paramInJson.getString("feeTypeCd"));
businessUnit.put("incomeObjId", paramInJson.getString("storeId"));
businessUnit.put("amount", "-1.00");
- businessUnit.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
- businessUnit.put("endTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+ businessUnit.put("startTime", time);
+ businessUnit.put("endTime", time);
businessUnit.put("communityId", paramInJson.getString("communityId"));
businessUnit.put("payerObjId", ownerCarDto.getCarId());
businessUnit.put("payerObjType", FeeDto.PAYER_OBJ_TYPE_CAR);
@@ -605,7 +773,13 @@
*/
public JSONObject addRoomFee(RoomDto roomDto, JSONObject paramInJson, DataFlowContext dataFlowContext) {
+ String time = DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A);
+ if (paramInJson.containsKey("feeEndDate")) {
+ time = paramInJson.getString("feeEndDate");
+ } else if (paramInJson.containsKey("startTime")) {
+ time = paramInJson.getString("startTime");
+ }
JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);
business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 1);
@@ -616,9 +790,8 @@
businessUnit.put("feeTypeCd", paramInJson.getString("feeTypeCd"));
businessUnit.put("incomeObjId", paramInJson.getString("storeId"));
businessUnit.put("amount", "-1.00");
- businessUnit.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
- businessUnit.put("endTime", paramInJson.containsKey("feeEndDate") ? paramInJson.getString("feeEndDate")
- : DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+ businessUnit.put("startTime", time);
+ businessUnit.put("endTime", time);
businessUnit.put("communityId", paramInJson.getString("communityId"));
businessUnit.put("payerObjId", roomDto.getRoomId());
businessUnit.put("payerObjType", "3333");
--
Gitblit v1.8.0