From b3c34d018e08c5382c5cff68a7d58901e6984165 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 14 五月 2020 18:51:43 +0800
Subject: [PATCH] 优化代码 并合并 安装文档
---
Api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java | 588 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 587 insertions(+), 1 deletions(-)
diff --git a/Api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java b/Api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java
index b8a79a2..d94b19f 100644
--- a/Api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java
+++ b/Api/src/main/java/com/java110/api/bmo/fee/impl/FeeBMOImpl.java
@@ -1,10 +1,33 @@
package com.java110.api.bmo.fee.impl;
+import com.alibaba.fastjson.JSONObject;
import com.java110.api.bmo.ApiBaseBMO;
-import com.java110.api.bmo.IApiBaseBMO;
import com.java110.api.bmo.fee.IFeeBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.fee.IFeeConfigInnerServiceSMO;
+import com.java110.core.smo.fee.IFeeInnerServiceSMO;
+import com.java110.core.smo.hardwareAdapation.ICarInoutInnerServiceSMO;
+import com.java110.core.smo.parkingSpace.IParkingSpaceInnerServiceSMO;
+import com.java110.core.smo.room.IRoomInnerServiceSMO;
+import com.java110.dto.RoomDto;
+import com.java110.dto.fee.FeeConfigDto;
+import com.java110.dto.fee.FeeDto;
+import com.java110.dto.hardwareAdapation.CarInoutDto;
+import com.java110.dto.parking.ParkingSpaceDto;
+import com.java110.utils.constant.*;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.DateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
/**
* @ClassName FeeBMOImpl
@@ -16,4 +39,567 @@
**/
@Service("feeBMOImpl")
public class FeeBMOImpl extends ApiBaseBMO implements IFeeBMO {
+
+
+ @Autowired
+ private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
+
+ @Autowired
+ private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
+
+ @Autowired
+ private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl;
+
+ @Autowired
+ private ICarInoutInnerServiceSMO carInoutInnerServiceSMOImpl;
+
+ @Autowired
+ private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl;
+ /**
+ * 娣诲姞灏忓尯淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject deleteFeeConfig(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_FEE_CONFIG);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessFeeConfig = new JSONObject();
+ businessFeeConfig.putAll(paramInJson);
+ //璁$畻 搴旀敹閲戦
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFeeConfig", businessFeeConfig);
+ return business;
+ }
+ /**
+ * 娣诲姞鐗╀笟璐圭敤
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject deleteFee(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_FEE_INFO);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 1);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessUnit = new JSONObject();
+ businessUnit.put("feeId", paramInJson.getString("feeId"));
+ businessUnit.put("communityId", paramInJson.getString("communityId"));
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessUnit);
+
+ return business;
+ }
+
+ public JSONObject updateFee(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FEE_INFO);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 1);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", paramInJson);
+ return business;
+ }
+
+ /**
+ * 娣诲姞璐圭敤鏄庣粏淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject addFeeDetail(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ 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, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
+ }
+
+ feeDto = feeDtos.get(0);
+ paramInJson.put("feeInfo", feeDto);
+
+ BigDecimal feePrice = new BigDecimal("0.00");
+
+ if ("3333".equals(feeDto.getPayerObjType())) { //鎴垮眿鐩稿叧
+ String computingFormula = feeDto.getComputingFormula();
+ if ("1001".equals(computingFormula)) { //闈㈢Н*鍗曚环+闄勫姞璐�
+ RoomDto roomDto = new RoomDto();
+ roomDto.setRoomId(feeDto.getPayerObjId());
+ roomDto.setCommunityId(feeDto.getCommunityId());
+ List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
+ if (roomDtos == null || roomDtos.size() != 1) {
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏈煡鍒版埧灞嬩俊鎭紝鏌ヨ澶氭潯鏁版嵁");
+ }
+ roomDto = roomDtos.get(0);
+ //feePrice = Double.parseDouble(feeDto.getSquarePrice()) * Double.parseDouble(roomDtos.get(0).getBuiltUpArea()) + Double.parseDouble(feeDto.getAdditionalAmount());
+ BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+ BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDtos.get(0).getBuiltUpArea()));
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ } else if ("2002".equals(computingFormula)) { // 鍥哄畾璐圭敤
+ //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ } else {
+ throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
+ }
+ } else if ("6666".equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
+ String computingFormula = feeDto.getComputingFormula();
+ if ("1001".equals(computingFormula)) { //闈㈢Н*鍗曚环+闄勫姞璐�
+ ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto();
+ parkingSpaceDto.setCommunityId(feeDto.getCommunityId());
+ parkingSpaceDto.setPsId(feeDto.getPayerObjId());
+ List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto);
+
+ if (parkingSpaceDtos == null || parkingSpaceDtos.size() < 1) { //鏁版嵁鏈夐棶棰�
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏈煡鍒板仠杞︿綅淇℃伅锛屾煡璇㈠鏉℃暟鎹�");
+ }
+ //feePrice = Double.parseDouble(feeDto.getSquarePrice()) * Double.parseDouble(parkingSpaceDtos.get(0).getArea()) + Double.parseDouble(feeDto.getAdditionalAmount());
+ BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+ BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(parkingSpaceDtos.get(0).getArea()));
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ } else if ("2002".equals(computingFormula)) { // 鍥哄畾璐圭敤
+ //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ } else {
+ throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
+ }
+ }
+ 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("businessFeeDetail", businessFeeDetail);
+
+ return business;
+ }
+
+
+ /**
+ * 淇敼璐圭敤淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject modifyFee(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FEE_INFO);
+ 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");
+ Date endTime = feeInfo.getEndTime();
+ Calendar endCalender = Calendar.getInstance();
+ 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);
+ } else {
+ endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles")));
+ }
+ feeInfo.setEndTime(endCalender.getTime());
+ Map feeMap = BeanConvertUtil.beanCovertMap(feeInfo);
+ feeMap.put("startTime", DateUtil.getFormatTimeString(feeInfo.getStartTime(), DateUtil.DATE_FORMATE_STRING_A));
+ feeMap.put("endTime", DateUtil.getFormatTimeString(feeInfo.getEndTime(), DateUtil.DATE_FORMATE_STRING_A));
+ feeMap.put("cycles", paramInJson.getString("cycles"));
+ feeMap.put("configEndTime",feeInfo.getConfigEndTime());
+
+ businessFee.putAll(feeMap);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessFee);
+
+ return business;
+ }
+
+ /**
+ * 娣诲姞璐圭敤鏄庣粏淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject addFeePreDetail(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ 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, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
+ }
+
+ feeDto = feeDtos.get(0);
+ paramInJson.put("feeInfo", feeDto);
+
+ BigDecimal feePrice = new BigDecimal("0.00");
+
+ if ("3333".equals(feeDto.getPayerObjType())) { //鎴垮眿鐩稿叧
+ String computingFormula = feeDto.getComputingFormula();
+ if ("1001".equals(computingFormula)) { //闈㈢Н*鍗曚环+闄勫姞璐�
+ RoomDto roomDto = new RoomDto();
+ roomDto.setRoomId(feeDto.getPayerObjId());
+ roomDto.setCommunityId(feeDto.getCommunityId());
+ List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
+ if (roomDtos == null || roomDtos.size() != 1) {
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏈煡鍒版埧灞嬩俊鎭紝鏌ヨ澶氭潯鏁版嵁");
+ }
+ roomDto = roomDtos.get(0);
+ //feePrice = Double.parseDouble(feeDto.getSquarePrice()) * Double.parseDouble(roomDtos.get(0).getBuiltUpArea()) + Double.parseDouble(feeDto.getAdditionalAmount());
+ BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+ BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDtos.get(0).getBuiltUpArea()));
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ } else if ("2002".equals(computingFormula)) { // 鍥哄畾璐圭敤
+ //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ } else {
+ throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
+ }
+ } else if ("6666".equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
+ String computingFormula = feeDto.getComputingFormula();
+ if ("1001".equals(computingFormula)) { //闈㈢Н*鍗曚环+闄勫姞璐�
+ ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto();
+ parkingSpaceDto.setCommunityId(feeDto.getCommunityId());
+ parkingSpaceDto.setPsId(feeDto.getPayerObjId());
+ List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto);
+
+ if (parkingSpaceDtos == null || parkingSpaceDtos.size() < 1) { //鏁版嵁鏈夐棶棰�
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏈煡鍒板仠杞︿綅淇℃伅锛屾煡璇㈠鏉℃暟鎹�");
+ }
+ //feePrice = Double.parseDouble(feeDto.getSquarePrice()) * Double.parseDouble(parkingSpaceDtos.get(0).getArea()) + Double.parseDouble(feeDto.getAdditionalAmount());
+ BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+ BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(parkingSpaceDtos.get(0).getArea()));
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ } else if ("2002".equals(computingFormula)) { // 鍥哄畾璐圭敤
+ //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ } else {
+ throw new IllegalArgumentException("鏆備笉鏀寔璇ョ被鍏紡");
+ }
+ }
+
+ BigDecimal receivableAmount = feePrice;
+ BigDecimal cycles = new BigDecimal(Double.parseDouble(paramInJson.getString("cycles")));
+ double tmpReceivableAmount = cycles.multiply(receivableAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+
+ businessFeeDetail.put("receivableAmount", tmpReceivableAmount);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFeeDetail", businessFeeDetail);
+ paramInJson.put("receivableAmount", tmpReceivableAmount);
+ return business;
+ }
+
+
+ /**
+ * 淇敼璐圭敤淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject modifyPreFee(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FEE_INFO);
+ 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");
+ Date endTime = feeInfo.getEndTime();
+ Calendar endCalender = Calendar.getInstance();
+ endCalender.setTime(endTime);
+ endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles")));
+ feeInfo.setEndTime(endCalender.getTime());
+ Map feeMap = BeanConvertUtil.beanCovertMap(feeInfo);
+ feeMap.put("startTime", DateUtil.getFormatTimeString(feeInfo.getStartTime(), DateUtil.DATE_FORMATE_STRING_A));
+ feeMap.put("endTime", DateUtil.getFormatTimeString(feeInfo.getEndTime(), DateUtil.DATE_FORMATE_STRING_A));
+ businessFee.putAll(feeMap);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessFee);
+
+ return business;
+ }
+
+ public JSONObject modifyTempCarInout(JSONObject reqJson, DataFlowContext context) {
+
+ FeeDto feeDto = (FeeDto) reqJson.get("feeInfo");
+ CarInoutDto tempCarInoutDto = new CarInoutDto();
+ tempCarInoutDto.setCommunityId(reqJson.getString("communityId"));
+ tempCarInoutDto.setInoutId(feeDto.getPayerObjId());
+ List<CarInoutDto> carInoutDtos = carInoutInnerServiceSMOImpl.queryCarInouts(tempCarInoutDto);
+
+ Assert.listOnlyOne(carInoutDtos, "鏍规嵁璐圭敤淇℃伅鍙嶅樊杞﹁締杩涘満璁板綍鏈煡鍒� 鎴栨煡鍒板鏉�");
+
+ CarInoutDto carInoutDto = carInoutDtos.get(0);
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_CAR_INOUT);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ+2);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessCarInout = new JSONObject();
+ businessCarInout.putAll(BeanConvertUtil.beanCovertMap(carInoutDto));
+ businessCarInout.put("state", "100400");
+ //璁$畻 搴旀敹閲戦
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCarInout", businessCarInout);
+ return business;
+ }
+
+ /**
+ * 娣诲姞璐圭敤鏄庣粏淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject addFeeTempDetail(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ 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, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
+ }
+ feeDto = feeDtos.get(0);
+ paramInJson.put("feeInfo", feeDto);
+ FeeConfigDto feeConfigDto = new FeeConfigDto();
+ feeConfigDto.setFeeTypeCd(feeDto.getFeeTypeCd());
+ feeConfigDto.setConfigId(feeDto.getConfigId());
+ feeConfigDto.setCommunityId(feeDto.getCommunityId());
+ List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
+ if (feeConfigDtos == null || feeConfigDtos.size() != 1) {
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏈煡鍒拌垂鐢ㄩ厤缃俊鎭紝鏌ヨ澶氭潯鏁版嵁");
+ }
+ feeConfigDto = feeConfigDtos.get(0);
+ Date nowTime = new Date();
+
+ long diff = nowTime.getTime() - feeDto.getStartTime().getTime();
+ long nd = 1000 * 24 * 60 * 60;// 涓�澶╃殑姣鏁�
+ long nh = 1000 * 60 * 60;// 涓�灏忔椂鐨勬绉掓暟
+ long nm = 1000 * 60;// 涓�鍒嗛挓鐨勬绉掓暟
+ double day = 0;
+ double hour = 0;
+ double min = 0;
+ day = diff / nd;// 璁$畻宸灏戝ぉ
+ hour = diff % nd / nh + day * 24;// 璁$畻宸灏戝皬鏃�
+ min = diff % nd % nh / nm + day * 24 * 60;// 璁$畻宸灏戝垎閽�
+ double money = 0.00;
+ double newHour = hour;
+ if (min > 0) { //涓�灏忔椂瓒呰繃
+ newHour += 1;
+ }
+ if (newHour <= 2) {
+ money = Double.parseDouble(feeConfigDto.getAdditionalAmount());
+ } else {
+ BigDecimal lastHour = new BigDecimal(newHour - 2);
+ BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+ BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+ money = squarePrice.multiply(lastHour).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+ }
+
+ double receivableAmount = money;
+
+ businessFeeDetail.put("receivableAmount", receivableAmount);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFeeDetail", businessFeeDetail);
+ paramInJson.put("receivableAmount", receivableAmount);
+ return business;
+ }
+
+
+ /**
+ * 淇敼璐圭敤淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject modifyTempFee(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FEE_INFO);
+ 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", DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_A));
+ feeMap.put("amount", paramInJson.getString("receivableAmount"));
+ feeMap.put("state", "2009001");
+ businessFee.putAll(feeMap);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessFee);
+
+ return business;
+ }
+
+ /**
+ * 娣诲姞灏忓尯淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject addFeeConfig(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_CONFIG);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessFeeConfig = new JSONObject();
+ businessFeeConfig.putAll(paramInJson);
+ businessFeeConfig.put("configId", "-1");
+ businessFeeConfig.put("isDefault", "F");
+ //璁$畻 搴旀敹閲戦
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFeeConfig", businessFeeConfig);
+ return business;
+ }
+
+ /**
+ * 娣诲姞鐗╀笟璐圭敤
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject addFee(ParkingSpaceDto parkingSpaceDto, JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ 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);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessUnit = new JSONObject();
+ businessUnit.put("feeId", "-1");
+ businessUnit.put("configId", paramInJson.getString("configId"));
+ 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("communityId", paramInJson.getString("communityId"));
+ businessUnit.put("payerObjId", parkingSpaceDto.getPsId());
+ businessUnit.put("payerObjType", "6666");
+ businessUnit.put("feeFlag", paramInJson.getString("feeFlag"));
+ businessUnit.put("state", "2008001");
+ businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessUnit);
+
+ return business;
+ }
+ /**
+ * 娣诲姞鐗╀笟璐圭敤
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject addRoomFee(RoomDto roomDto, JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+ 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);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessUnit = new JSONObject();
+ businessUnit.put("feeId", "-1");
+ businessUnit.put("configId", paramInJson.getString("configId"));
+ 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("communityId", paramInJson.getString("communityId"));
+ businessUnit.put("payerObjId", roomDto.getRoomId());
+ businessUnit.put("payerObjType", "3333");
+ businessUnit.put("feeFlag", paramInJson.getString("feeFlag"));
+ businessUnit.put("state", "2008001");
+ businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessUnit);
+
+ return business;
+ }
+ /**
+ * 娣诲姞璐圭敤椤逛俊鎭�
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public JSONObject updateFeeConfig(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+ FeeConfigDto feeConfigDto = new FeeConfigDto();
+ feeConfigDto.setCommunityId(paramInJson.getString("communityId"));
+ feeConfigDto.setConfigId(paramInJson.getString("configId"));
+ List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
+ Assert.listOnlyOne(feeConfigDtos, "鏈壘鍒拌璐圭敤椤�");
+
+
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FEE_CONFIG);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessFeeConfig = new JSONObject();
+ businessFeeConfig.putAll(paramInJson);
+ businessFeeConfig.put("isDefault", feeConfigDtos.get(0).getIsDefault());
+ //璁$畻 搴旀敹閲戦
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFeeConfig", businessFeeConfig);
+ return business;
+ }
+
}
--
Gitblit v1.8.0