From 64b14b0549344f13b191e2c26ed199f62655c43f Mon Sep 17 00:00:00 2001
From: chengf <cgf12138@163.com>
Date: 星期三, 25 二月 2026 10:12:46 +0800
Subject: [PATCH] 导入测试
---
service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java | 200 +++++++++++++-------------------------------------
1 files changed, 52 insertions(+), 148 deletions(-)
diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java
index e043521..4841d40 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java
@@ -2,31 +2,24 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.CmdContextUtils;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.core.factory.CommunitySettingFactory;
import com.java110.core.log.LoggerFactory;
import com.java110.core.smo.IComputeFeeSMO;
+import com.java110.core.smo.IOwnerGetDataCheck;
import com.java110.dto.floor.FloorDto;
import com.java110.dto.room.RoomDto;
import com.java110.dto.unit.UnitDto;
-import com.java110.dto.fee.FeeAttrDto;
import com.java110.dto.fee.FeeDto;
-import com.java110.dto.owner.OwnerCarDto;
-import com.java110.dto.owner.OwnerDto;
import com.java110.dto.owner.OwnerRoomRelDto;
-import com.java110.dto.parking.ParkingSpaceDto;
import com.java110.intf.community.IFloorInnerServiceSMO;
-import com.java110.intf.community.IParkingSpaceInnerServiceSMO;
import com.java110.intf.community.IRoomInnerServiceSMO;
import com.java110.intf.community.IUnitInnerServiceSMO;
-import com.java110.intf.fee.IFeeAttrInnerServiceSMO;
import com.java110.intf.fee.IFeeInnerServiceSMO;
-import com.java110.intf.user.IOwnerCarInnerServiceSMO;
-import com.java110.intf.user.IOwnerInnerServiceSMO;
import com.java110.intf.user.IOwnerRoomRelV1InnerServiceSMO;
-import com.java110.po.fee.FeeAttrPo;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.*;
@@ -38,7 +31,6 @@
import org.springframework.http.ResponseEntity;
import java.math.BigDecimal;
-import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -53,16 +45,7 @@
private static Logger logger = LoggerFactory.getLogger(ListFeeCmd.class);
@Autowired
- private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl;
-
- @Autowired
- private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl;
-
- @Autowired
private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
-
- @Autowired
- private IFeeAttrInnerServiceSMO feeAttrInnerServiceSMOImpl;
@Autowired
private IComputeFeeSMO computeFeeSMOImpl;
@@ -80,7 +63,7 @@
private IOwnerRoomRelV1InnerServiceSMO ownerRoomRelV1InnerServiceSMOImpl;
@Autowired
- private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
+ private IOwnerGetDataCheck ownerGetDataCheckImpl;
//鍩�
public static final String DOMAIN_COMMON = "DOMAIN.COMMON";
@@ -98,10 +81,26 @@
public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
super.validatePageInfo(reqJson);
Assert.hasKeyAndValue(reqJson, "communityId", "鏈寘鍚皬鍖篒D");
+
+ // todo 涓氫富鏌ヨ鍚堟硶鎬ф牎楠�
+ ownerGetDataCheckImpl.checkOwnerFee(CmdContextUtils.getAppId(cmdDataFlowContext), CmdContextUtils.getLoginUserId(cmdDataFlowContext), reqJson);
}
@Override
public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+ if (reqJson.containsKey("roomNum") && !StringUtil.isEmpty(reqJson.getString("roomNum"))) {
+ String[] roomNums = reqJson.getString("roomNum").split("-");
+ if (roomNums.length != 3) {
+ throw new IllegalArgumentException("鎴垮眿缂栧彿鏍煎紡涓嶅锛�");
+ }
+ RoomDto roomDto = new RoomDto();
+ roomDto.setCommunityId(reqJson.getString("communityId"));
+ roomDto.setFloorNum(roomNums[0]);
+ roomDto.setUnitNum(roomNums[1]);
+ roomDto.setRoomNum(roomNums[2]);
+ List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
+ Assert.listOnlyOne(roomDtos, "鎵句笉鍒版埧灞嬩俊鎭紒");
+ }
// todo 鎴垮眿鍚嶇О 鍒峰叆 鎴垮眿ID
freshPayerObjIdByRoomNum(reqJson);
@@ -116,7 +115,7 @@
ownerRoomRelDto.setRoomId(reqJson.getString("payerObjId"));
ownerRoomRelDto.setOwnerId(reqJson.getString("ownerId"));
List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelV1InnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
- if (ownerRoomRelDtos == null || ownerRoomRelDtos.size() < 1) {
+ if (ListUtil.isNull(ownerRoomRelDtos)) {
ApiFeeVo apiFeeVo = new ApiFeeVo();
apiFeeVo.setTotal(0);
apiFeeVo.setRecords((int) Math.ceil((double) 0 / (double) reqJson.getInteger("row")));
@@ -125,15 +124,31 @@
cmdDataFlowContext.setResponseEntity(responseEntity);
}
}
+ if(reqJson.containsKey("isContractFee")){
+ feeDto.setContractFee(reqJson.getString("payerObjId"));
+ feeDto.setPayerObjId(null);
+ }
+ if(reqJson.containsKey("contractId")){
+ feeDto.setContractFee(reqJson.getString("contractId"));
+ }
int count = feeInnerServiceSMOImpl.queryFeesCount(feeDto);
if (count > 0) {
List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);//鏌ヨ璐圭敤椤圭洰
- computeFeePrice(feeDtos);//璁$畻璐圭敤
+ //todo 璁$畻璐圭敤
+ computeFeePrice(feeDtos);
List<ApiFeeDataVo> apiFeeDataVos = BeanConvertUtil.covertBeanList(feeDtos, ApiFeeDataVo.class);
for (ApiFeeDataVo apiFeeDataVo : apiFeeDataVos) {
+ apiFeeDataVo.setStartTime(apiFeeDataVo.getStartTime() == null ? null : apiFeeDataVo.getStartTime().split(" ")[0]);
+ apiFeeDataVo.setEndTime(apiFeeDataVo.getEndTime() == null ? null : apiFeeDataVo.getEndTime().split(" ")[0]);
+ apiFeeDataVo.setMaxEndTime(apiFeeDataVo.getMaxEndTime() == null ? null : apiFeeDataVo.getMaxEndTime().split(" ")[0]);
+ apiFeeDataVo.setDeadlineTime(apiFeeDataVo.getDeadlineTime() == null ? null : apiFeeDataVo.getDeadlineTime().split(" ")[0]);
+ //璁$畻monthCount
+ //璁$畻MaxEndTime鍜宔ndTime涔嬮棿鐨勬湀鏁�
+ int monthCount = DateUtil.calculateMonths(apiFeeDataVo.getEndTime(), apiFeeDataVo.getMaxEndTime());
+ apiFeeDataVo.setMonthCount(monthCount);
//鑾峰彇浠樿垂瀵硅薄绫诲瀷
String payerObjType = apiFeeDataVo.getPayerObjType();
- if (!StringUtil.isEmpty(payerObjType) && payerObjType.equals("6666")) {
+ if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(payerObjType)) {
apiFeeDataVo.setCarTypeCd("1001");
}
fees.add(apiFeeDataVo);
@@ -160,7 +175,6 @@
if (!reqJson.containsKey("payerObjIds") || StringUtil.isEmpty(reqJson.getString("payerObjIds"))) {
return;
}
-
String payerObjIds = reqJson.getString("payerObjIds");
feeDto.setPayerObjIds(payerObjIds.split(","));
}
@@ -174,12 +188,10 @@
if (!reqJson.containsKey("roomNum") || StringUtil.isEmpty(reqJson.getString("roomNum"))) {
return;
}
-
String[] roomNums = reqJson.getString("roomNum").split("-", 3);
if (roomNums == null || roomNums.length != 3) {
throw new IllegalArgumentException("鎴垮眿缂栧彿鏍煎紡閿欒锛�");
}
-
String floorNum = roomNums[0];
String unitNum = roomNums[1];
String roomNum = roomNums[2];
@@ -187,7 +199,7 @@
floorDto.setFloorNum(floorNum);
floorDto.setCommunityId(reqJson.getString("communityId"));
List<FloorDto> floorDtos = floorInnerServiceSMOImpl.queryFloors(floorDto);
- if (floorDtos == null || floorDtos.size() < 1) {
+ if (ListUtil.isNull(floorDtos)) {
return;
}
for (FloorDto floor : floorDtos) {
@@ -195,7 +207,7 @@
unitDto.setFloorId(floor.getFloorId());
unitDto.setUnitNum(unitNum);
List<UnitDto> unitDtos = unitInnerServiceSMOImpl.queryUnits(unitDto);
- if (unitDtos == null || unitDtos.size() < 1) {
+ if (ListUtil.isNull(unitDtos)) {
continue;
}
for (UnitDto unit : unitDtos) {
@@ -211,54 +223,6 @@
}
private void freshFeeAttrs(List<ApiFeeDataVo> fees, List<FeeDto> feeDtos) {
- String link = "";
- for (FeeDto feeDto : feeDtos) {
- if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())) { //鎴垮眿
- OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
- ownerRoomRelDto.setRoomId(feeDto.getPayerObjId());
- List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelV1InnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
- if (ownerRoomRelDtos == null || ownerRoomRelDtos.size() < 1) {
- continue;
- }
- OwnerDto ownerDto = new OwnerDto();
- ownerDto.setMemberId(ownerRoomRelDtos.get(0).getOwnerId());
- List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
- Assert.listOnlyOne(ownerDtos, "鏌ヨ涓氫富閿欒锛�");
- link = ownerDtos.get(0).getLink();
- } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {
- OwnerCarDto ownerCarDto = new OwnerCarDto();
- ownerCarDto.setMemberId(feeDto.getPayerObjId());
- List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
- Assert.listOnlyOne(ownerCarDtos, "鏌ヨ涓氫富杞﹁締琛ㄩ敊璇紒");
- OwnerDto ownerDto = new OwnerDto();
- ownerDto.setMemberId(ownerCarDtos.get(0).getOwnerId());
- List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
- Assert.listOnlyOne(ownerDtos, "鏌ヨ涓氫富閿欒锛�");
- link = ownerDtos.get(0).getLink();
- }
- FeeAttrDto feeAttrDto = new FeeAttrDto();
- feeAttrDto.setFeeId(feeDto.getFeeId());
- List<FeeAttrDto> feeAttrDtos = feeAttrInnerServiceSMOImpl.queryFeeAttrs(feeAttrDto);
- if (feeAttrDtos == null || feeAttrDtos.size() < 1) {
- continue;
- }
- for (FeeAttrDto feeAttr : feeAttrDtos) {
- if (!FeeAttrDto.SPEC_CD_OWNER_LINK.equals(feeAttr.getSpecCd())) { //鑱旂郴鏂瑰紡
- continue;
- }
- if (feeAttr.getValue().equals(link)) {
- continue;
- }
- FeeAttrPo feeAttrPo = new FeeAttrPo();
- feeAttrPo.setAttrId(feeAttr.getAttrId());
- feeAttrPo.setValue(link);
- int flag = feeAttrInnerServiceSMOImpl.updateFeeAttr(feeAttrPo);
- if (flag < 1) {
- throw new CmdException("鏇存柊涓氫富鑱旂郴鏂瑰紡澶辫触");
- }
-
- }
- }
for (ApiFeeDataVo apiFeeDataVo : fees) {
for (FeeDto feeDto : feeDtos) {
if (apiFeeDataVo.getFeeId().equals(feeDto.getFeeId())) {
@@ -269,7 +233,7 @@
}
private void computeFeePrice(List<FeeDto> feeDtos) {
- if (feeDtos == null || feeDtos.size() < 1) {
+ if (ListUtil.isNull(feeDtos)) {
return;
}
String val = CommunitySettingFactory.getValue(feeDtos.get(0).getCommunityId(), TOTAL_FEE_PRICE);
@@ -293,14 +257,14 @@
Date targetEndDate = (Date) targetEndDateAndOweMonth.get("targetEndDate");
double oweMonth = (double) targetEndDateAndOweMonth.get("oweMonth");
feeDto.setCycle(feeDto.getPaymentCycle());
- feeDto.setDeadlineTime(targetEndDate);
- if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())) { //鎴垮眿鐩稿叧
- computeFeePriceByRoom(feeDto, oweMonth);
- } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
- computeFeePriceByCar(feeDto, oweMonth);
- } else if (FeeDto.PAYER_OBJ_TYPE_CONTRACT.equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
- computeFeePriceByContract(feeDto, oweMonth);
+ //todo 杩欓噷鑰冭檻 璐﹀崟妯″紡鐨勫満鏅�
+ if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
+ feeDto.setCycle(oweMonth + "");
}
+ feeDto.setDeadlineTime(targetEndDate);
+ //todo 绠楄垂
+ doComputeFeePrice(feeDto, oweMonth);
+
feeDto.setVal(val);
//鍏抽棴 绾夸笅鏀堕摱鍔熻兘
if (StringUtil.isEmpty(received_amount_switch)) {
@@ -318,47 +282,12 @@
}
}
- private void computeFeePriceByCar(FeeDto feeDto, double oweMonth) {
- OwnerCarDto ownerCarDto = new OwnerCarDto();
- ownerCarDto.setCarTypeCd("1001"); //涓氫富杞﹁締
- ownerCarDto.setCommunityId(feeDto.getCommunityId());
- ownerCarDto.setCarId(feeDto.getPayerObjId());
- List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
- if (ownerCarDtos == null || ownerCarDtos.size() < 1) { //鏁版嵁鏈夐棶棰�
- return;
- }
- ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto();
- parkingSpaceDto.setCommunityId(feeDto.getCommunityId());
- parkingSpaceDto.setPsId(ownerCarDtos.get(0).getPsId());
- List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto);
- if (parkingSpaceDtos == null || parkingSpaceDtos.size() < 1) { //鏁版嵁鏈夐棶棰�
- return;
- }
- String computingFormula = feeDto.getComputingFormula();
- DecimalFormat df = new DecimalFormat("0.00");
- Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
- feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString()));
- feeDto.setFeeTotalPrice(Double.parseDouble(feePriceAll.get("feeTotalPrice").toString()));
- BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice());
- curFeePrice = curFeePrice.multiply(new BigDecimal(oweMonth));
- feeDto.setAmountOwed(df.format(curFeePrice));
- //鍔ㄦ�佽垂鐢�
- if ("4004".equals(computingFormula)
- && FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())
- && !FeeDto.STATE_FINISH.equals(feeDto.getState())) {
- feeDto.setAmountOwed(df.format(curFeePrice));
- feeDto.setDeadlineTime(DateUtil.getCurrentDate());
- }
- //鑰冭檻绉熼噾閫掑
- computeFeeSMOImpl.dealRentRate(feeDto);
- }
-
/**
* 鏍规嵁鎴垮眿鏉ョ畻鍗曚环
*
* @param feeDto
*/
- private void computeFeePriceByRoom(FeeDto feeDto, double oweMonth) {
+ private void doComputeFeePrice(FeeDto feeDto, double oweMonth) {
String computingFormula = feeDto.getComputingFormula();
Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString()));
@@ -368,40 +297,15 @@
Integer.parseInt(feeDto.getDecimalPlace())));
BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice());
curFeePrice = curFeePrice.multiply(new BigDecimal(oweMonth));
+ if (curFeePrice.doubleValue() == -1) {
+ curFeePrice = BigDecimal.valueOf(0);
+ }
feeDto.setAmountOwed(MoneyUtil.computePriceScale(curFeePrice.doubleValue(), feeDto.getScale(), Integer.parseInt(feeDto.getDecimalPlace())) + "");
//鍔ㄦ�佽垂鐢�
if ("4004".equals(computingFormula)
&& FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())
&& !FeeDto.STATE_FINISH.equals(feeDto.getState())
&& feeDto.getDeadlineTime() == null) {
- feeDto.setDeadlineTime(DateUtil.getCurrentDate());
- }
- //鑰冭檻绉熼噾閫掑
- computeFeeSMOImpl.dealRentRate(feeDto);
-
- }
-
-
- /**
- * 鏍规嵁鍚堝悓鏉ョ畻鍗曚环
- *
- * @param feeDto
- */
- private void computeFeePriceByContract(FeeDto feeDto, double oweMonth) {
- String computingFormula = feeDto.getComputingFormula();
- Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
- feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString()));
- feeDto.setFeeTotalPrice(MoneyUtil.computePriceScale(Double.parseDouble(feePriceAll.get("feeTotalPrice").toString()),
- feeDto.getScale(),
- Integer.parseInt(feeDto.getDecimalPlace())));
- BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice());
- curFeePrice = curFeePrice.multiply(new BigDecimal(oweMonth));
- feeDto.setAmountOwed(MoneyUtil.computePriceScale(curFeePrice.doubleValue(), feeDto.getScale(), Integer.parseInt(feeDto.getDecimalPlace())) + "");
- //鍔ㄦ�佽垂鐢�
- if ("4004".equals(computingFormula)
- && FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())
- && !FeeDto.STATE_FINISH.equals(feeDto.getState())) {
- feeDto.setAmountOwed(MoneyUtil.computePriceScale(curFeePrice.doubleValue(), feeDto.getScale(), Integer.parseInt(feeDto.getDecimalPlace())) + "");
feeDto.setDeadlineTime(DateUtil.getCurrentDate());
}
//鑰冭檻绉熼噾閫掑
--
Gitblit v1.8.0