java110
2022-04-25 6143e4184fb40e0d40f2d69fd08a7a38ae6a9ca2
service-report/src/main/java/com/java110/report/bmo/reportOwnerPayFee/impl/GetReportOwnerPayFeeBMOImpl.java
@@ -4,6 +4,7 @@
import com.java110.dto.reportOwnerPayFee.ReportOwnerPayFeeDto;
import com.java110.intf.report.IReportOwnerPayFeeInnerServiceSMO;
import com.java110.report.bmo.reportOwnerPayFee.IGetReportOwnerPayFeeBMO;
import com.java110.utils.util.DateUtil;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +13,7 @@
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
@Service("getReportOwnerPayFeeBMOImpl")
@@ -25,14 +27,18 @@
     * @return 订单服务能够接受的报文
     */
    public ResponseEntity<String> get(ReportOwnerPayFeeDto reportOwnerPayFeeDto) {
        if(!StringUtil.isEmpty(reportOwnerPayFeeDto.getPfYear())) {
            reportOwnerPayFeeDto.setFeeEndTime(reportOwnerPayFeeDto.getPfYear()+"-01-01");
        }else{
            Calendar calendar =Calendar.getInstance();
            reportOwnerPayFeeDto.setFeeEndTime(calendar.get(Calendar.YEAR)+"-01-01");
        }
        int count = reportOwnerPayFeeInnerServiceSMOImpl.queryReportOwnerPayFeesCount(reportOwnerPayFeeDto);
        List<ReportOwnerPayFeeDto> reportOwnerPayFeeDtos = null;
        if (count > 0) {
            reportOwnerPayFeeDtos = reportOwnerPayFeeInnerServiceSMOImpl.queryReportOwnerPayFees(reportOwnerPayFeeDto);
            refreshOwnerPayFeeDto(reportOwnerPayFeeDtos);
            refreshOwnerPayFeeDto(reportOwnerPayFeeDtos, reportOwnerPayFeeDto);
        } else {
            reportOwnerPayFeeDtos = new ArrayList<>();
        }
@@ -47,7 +53,7 @@
    /**
     * @param reportOwnerPayFeeDtos
     */
    private void refreshOwnerPayFeeDto(List<ReportOwnerPayFeeDto> reportOwnerPayFeeDtos) {
    private void refreshOwnerPayFeeDto(List<ReportOwnerPayFeeDto> reportOwnerPayFeeDtos, ReportOwnerPayFeeDto tmpReportOwnerPayFeeDto) {
        if (reportOwnerPayFeeDtos == null || reportOwnerPayFeeDtos.size() < 1) {
            return;
        }
@@ -66,6 +72,30 @@
            feeIds.add(reportOwnerPayFeeDto.getFeeId());
        }
        ReportOwnerPayFeeDto reportOwnerPayFeeDto = new ReportOwnerPayFeeDto();
        reportOwnerPayFeeDto.setFeeIds(feeIds.toArray(new String[feeIds.size()]));
        reportOwnerPayFeeDto.setPfYear(tmpReportOwnerPayFeeDto.getPfYear());
        reportOwnerPayFeeDto.setConfigId(tmpReportOwnerPayFeeDto.getConfigId());
        if (StringUtil.isEmpty(reportOwnerPayFeeDto.getPfYear())) {
            reportOwnerPayFeeDto.setPfYear(DateUtil.getYear() + "");
        }
        List<ReportOwnerPayFeeDto> tmpReportOwnerPayFeeDtos
                = reportOwnerPayFeeInnerServiceSMOImpl.queryReportOwnerMonthPayFees(reportOwnerPayFeeDto);
        List<ReportOwnerPayFeeDto> tmoNewReportOwnerPayFeeDtos = null;
        for (ReportOwnerPayFeeDto oldReportOwnerPayFeeDto : reportOwnerPayFeeDtos) {
            tmoNewReportOwnerPayFeeDtos = new ArrayList<>();
            for (ReportOwnerPayFeeDto newReportOwnerPayFeeDto : tmpReportOwnerPayFeeDtos) {
                if (oldReportOwnerPayFeeDto.getFeeId().equals(newReportOwnerPayFeeDto.getFeeId())) {
                    tmoNewReportOwnerPayFeeDtos.add(newReportOwnerPayFeeDto);
                }
            }
            oldReportOwnerPayFeeDto.setReportOwnerPayFeeDtos(tmoNewReportOwnerPayFeeDtos);
        }
    }