chengf
2025-08-13 f44187822ea6217070c0f6fc585c3feadea03cb1
service-fee/src/main/java/com/java110/fee/bmo/feeDiscountRuleSpec/impl/ComputeFeeDiscountBMOImpl.java
old mode 100644 new mode 100755
@@ -1,28 +1,24 @@
package com.java110.fee.bmo.feeDiscountRuleSpec.impl;
import com.java110.dto.fee.FeeDto;
import com.java110.dto.payFeeConfigDiscount.PayFeeConfigDiscountDto;
import com.java110.dto.fee.FeeDetailDto;
import com.java110.dto.fee.ComputeDiscountDto;
import com.java110.fee.bmo.feeDiscountRuleSpec.IComputeFeeDiscountBMO;
import com.java110.intf.fee.IFeeInnerServiceSMO;
import com.java110.intf.fee.IPayFeeConfigDiscountInnerServiceSMO;
import com.java110.utils.util.Assert;
import com.java110.fee.smo.impl.FeeDiscountInnerServiceSMOImpl;
import com.java110.utils.util.DateUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
@Service("computeFeeDiscountBMOImpl")
public class ComputeFeeDiscountBMOImpl implements IComputeFeeDiscountBMO {
    @Autowired
    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
    @Autowired
    private IPayFeeConfigDiscountInnerServiceSMO payFeeConfigDiscountInnerServiceSMOImpl;
    private FeeDiscountInnerServiceSMOImpl feeDiscountInnerServiceSMOImpl;
    /**
     * 计算折扣
@@ -35,30 +31,56 @@
     * @return
     */
    @Override
    public ResponseEntity<String> compute(String feeId, String communityId, double cycles, int page, int row) {
        FeeDto feeDto = new FeeDto();
        feeDto.setFeeId(feeId);
        feeDto.setCommunityId(communityId);
        feeDto.setState(FeeDto.STATE_DOING);
        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
        Assert.listOnlyOne(feeDtos, "费用不存在");
        PayFeeConfigDiscountDto payFeeConfigDiscountDto = new PayFeeConfigDiscountDto();
        payFeeConfigDiscountDto.setConfigId(feeDtos.get(0).getConfigId());
        payFeeConfigDiscountDto.setCommunityId(communityId);
        List<PayFeeConfigDiscountDto> payFeeConfigDiscountDtos =
                payFeeConfigDiscountInnerServiceSMOImpl.queryPayFeeConfigDiscounts(payFeeConfigDiscountDto);
        if (payFeeConfigDiscountDtos == null || payFeeConfigDiscountDtos.size() < 1) {
            return ResultVo.success();
    public ResponseEntity<String> compute(String feeId, String communityId, double cycles, String payerObjId, String payerObjType, String endTime, int page, int row) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        FeeDetailDto feeDetailDto = new FeeDetailDto();
        feeDetailDto.setCommunityId(communityId);
        feeDetailDto.setFeeId(feeId);
        feeDetailDto.setCycles(cycles + "");
        feeDetailDto.setPayerObjId(payerObjId);
        feeDetailDto.setPayerObjType(payerObjType);
        //缴费开始时间为上月到期时间
        feeDetailDto.setStartTime(simpleDateFormat.parse(endTime));
        feeDetailDto.setRow(row);
        feeDetailDto.setPage(page);
        List<ComputeDiscountDto> computeDiscountDtos = feeDiscountInnerServiceSMOImpl.computeDiscount(feeDetailDto);
        return ResultVo.createResponseEntity(computeDiscountDtos);
    }
    /**
     * 计算折扣
     *
     * @param feeId
     * @param communityId
     * @param cycles
     * @param page
     * @param row
     * @return
     */
    @Override
    public ResponseEntity<String> compute(String feeId, String communityId, double cycles, String payerObjId, String payerObjType, String endTime, int page, int row, String custEndTime) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        FeeDetailDto feeDetailDto = new FeeDetailDto();
        feeDetailDto.setCommunityId(communityId);
        feeDetailDto.setFeeId(feeId);
        feeDetailDto.setCycles(cycles + "");
        feeDetailDto.setPayerObjId(payerObjId);
        feeDetailDto.setPayerObjType(payerObjType);
        //缴费开始时间为上月到期时间
        feeDetailDto.setStartTime(DateUtil.getDateFromStringB(endTime));
        feeDetailDto.setEndTime(DateUtil.getDateFromStringB(custEndTime));
        if(Double.parseDouble(feeDetailDto.getCycles())==105){
            double cycle = (DateUtil.dayCompare(
                    feeDetailDto.getStartTime(),
                    feeDetailDto.getEndTime()
            ));
            feeDetailDto.setRow(row);
            feeDetailDto.setPage(page);
            List<ComputeDiscountDto> computeDiscountDtos = feeDiscountInnerServiceSMOImpl.computeDiscount(feeDetailDto,cycle);
            return ResultVo.createResponseEntity(computeDiscountDtos);
        }
        for(PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto : payFeeConfigDiscountDtos){
        }
        return null;
        feeDetailDto.setRow(row);
        feeDetailDto.setPage(page);
        List<ComputeDiscountDto> computeDiscountDtos = feeDiscountInnerServiceSMOImpl.computeDiscount(feeDetailDto);
        return ResultVo.createResponseEntity(computeDiscountDtos);
    }
}