From 28e7d3937f819a3486b22bfa1c84aee172aaccb4 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期一, 17 一月 2022 17:46:42 +0800
Subject: [PATCH] 优化代码
---
service-api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 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 e61d7cb..dfc9dcd 100755
--- 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
@@ -162,7 +162,7 @@
if (feeDtos == null || feeDtos.size() != 1) {
throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
}
- if (!businessFeeDetail.containsKey("state")) {
+ if (!businessFeeDetail.containsKey("state") || StringUtil.isEmpty(businessFeeDetail.getString("state"))) {
businessFeeDetail.put("state", "1400");
}
feeDto = feeDtos.get(0);
@@ -223,7 +223,7 @@
if (feeDtos == null || feeDtos.size() != 1) {
throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
}
- if (!businessFeeDetail.containsKey("state")) {
+ if (!businessFeeDetail.containsKey("state") || StringUtil.isEmpty(businessFeeDetail.getString("state"))) {
businessFeeDetail.put("state", "1400");
}
feeDto = feeDtos.get(0);
@@ -298,7 +298,7 @@
}
feeInfo.setEndTime(endCalender.getTime());
//鍒ゆ柇 缁撴潫鏃堕棿 鏄惁澶т簬 璐圭敤椤� 缁撴潫鏃堕棿锛岃繖閲� 瀹归敊涓�涓嬶紝濡傛灉 璐圭敤缁撴潫鏃堕棿澶т簬 璐圭敤椤圭粨鏉熸椂闂� 30澶� 璧版姤閿� 灞炰簬澶氱即璐�
- if (feeInfo.getEndTime().getTime() - feeInfo.getConfigEndTime().getTime() > 30 * 24 * 60 * 60 * 1000) {
+ if (feeInfo.getEndTime().getTime() - feeInfo.getConfigEndTime().getTime() > 30 * 24 * 60 * 60 * 1000L) {
throw new IllegalArgumentException("缂磋垂瓒呰繃浜� 璐圭敤椤圭粨鏉熸椂闂�");
}
Map feeMap = BeanConvertUtil.beanCovertMap(feeInfo);
@@ -443,7 +443,7 @@
endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles")));
feeInfo.setEndTime(endCalender.getTime());
//鍒ゆ柇 缁撴潫鏃堕棿 鏄惁澶т簬 璐圭敤椤� 缁撴潫鏃堕棿锛岃繖閲� 瀹归敊涓�涓嬶紝濡傛灉 璐圭敤缁撴潫鏃堕棿澶т簬 璐圭敤椤圭粨鏉熸椂闂� 30澶� 璧版姤閿� 灞炰簬澶氱即璐�
- if (feeInfo.getEndTime().getTime() - feeInfo.getConfigEndTime().getTime() > 30 * 24 * 60 * 60 * 1000) {
+ if (feeInfo.getEndTime().getTime() - feeInfo.getConfigEndTime().getTime() > 30 * 24 * 60 * 60 * 1000L) {
throw new IllegalArgumentException("缂磋垂瓒呰繃浜� 璐圭敤椤圭粨鏉熸椂闂�" + JSONObject.toJSONString(feeInfo) + "|||" + paramInJson.getString("cycles"));
}
Map feeMap = BeanConvertUtil.beanCovertMap(feeInfo);
@@ -459,16 +459,6 @@
return business;
}
- public static void main(String[] args) throws Exception {
- Date endTime = DateUtil.getDateFromString("2021-07-31 16:00:00", DateUtil.DATE_FORMATE_STRING_A);
- Date configEndTime = DateUtil.getDateFromString("2021-08-31 15:05:45", DateUtil.DATE_FORMATE_STRING_A);
- Calendar endCalender = Calendar.getInstance();
- endCalender.setTime(endTime);
- endCalender.add(Calendar.MONTH, Integer.parseInt("1"));
- if (endCalender.getTime().getTime() - configEndTime.getTime() > 30 * 24 * 60 * 60 * 1000) {
- throw new IllegalArgumentException("缂磋垂瓒呰繃浜� 璐圭敤椤圭粨鏉熸椂闂�");
- }
- }
public JSONObject modifyTempCarInout(JSONObject reqJson, DataFlowContext context) {
FeeDto feeDto = (FeeDto) reqJson.get("feeInfo");
@@ -627,6 +617,7 @@
businessUnit.put("payerObjType", FeeDto.PAYER_OBJ_TYPE_CAR);
businessUnit.put("feeFlag", paramInJson.getString("feeFlag"));
businessUnit.put("state", "2008001");
+ businessUnit.put("batchId", paramInJson.getString("batchId"));
businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(PayFeePo.class.getSimpleName(), businessUnit);
paramInJson.put("feeId", businessUnit.getString("feeId"));
@@ -711,6 +702,7 @@
businessUnit.put("payerObjType", "3333");
businessUnit.put("feeFlag", paramInJson.getString("feeFlag"));
businessUnit.put("state", "2008001");
+ businessUnit.put("batchId", paramInJson.getString("batchId"));
businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(PayFeePo.class.getSimpleName(), businessUnit);
paramInJson.put("feeId", businessUnit.getString("feeId"));
@@ -741,6 +733,9 @@
businessUnit.put("feeTypeCd", paramInJson.getString("feeTypeCd"));
businessUnit.put("incomeObjId", paramInJson.getString("storeId"));
businessUnit.put("amount", "-1.00");
+ if (paramInJson.containsKey("amount") && !StringUtil.isEmpty(paramInJson.getString("amount"))) {
+ businessUnit.put("amount", paramInJson.getString("amount"));
+ }
businessUnit.put("startTime", time);
businessUnit.put("endTime", time);
businessUnit.put("communityId", paramInJson.getString("communityId"));
@@ -748,6 +743,7 @@
businessUnit.put("payerObjType", FeeDto.PAYER_OBJ_TYPE_CONTRACT);
businessUnit.put("feeFlag", paramInJson.getString("feeFlag"));
businessUnit.put("state", "2008001");
+ businessUnit.put("batchId", paramInJson.getString("batchId"));
businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(PayFeePo.class.getSimpleName(), businessUnit);
paramInJson.put("feeId", businessUnit.getString("feeId"));
--
Gitblit v1.8.0