package com.java110.fee.bmo.importFeeDetail.impl;
|
|
import com.java110.dto.importData.ImportFeeDetailDto;
|
import com.java110.fee.bmo.importFeeDetail.IGetImportFeeDetailBMO;
|
import com.java110.intf.fee.IImportFeeDetailInnerServiceSMO;
|
import com.java110.po.importFee.MaintenancePayment;
|
import com.java110.po.importFee.MpFifthPaymentRecord;
|
import com.java110.po.importFee.MpPaymentRecord;
|
import com.java110.utils.util.BeanConvertUtil;
|
import com.java110.vo.ResultVo;
|
import org.mybatis.spring.SqlSessionTemplate;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.http.HttpStatus;
|
import org.springframework.http.ResponseEntity;
|
import org.springframework.stereotype.Service;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Map;
|
|
@Service("getImportFeeDetailBMOImpl")
|
public class GetImportFeeDetailBMOImpl implements IGetImportFeeDetailBMO {
|
|
@Autowired
|
private IImportFeeDetailInnerServiceSMO importFeeDetailInnerServiceSMOImpl;
|
|
|
@Autowired
|
private SqlSessionTemplate sqlSessionTemplate;
|
/**
|
* @param importFeeDetailDto
|
* @return 订单服务能够接受的报文
|
*/
|
public ResponseEntity<String> get(ImportFeeDetailDto importFeeDetailDto) {
|
|
|
int count = importFeeDetailInnerServiceSMOImpl.queryImportFeeDetailsCount(importFeeDetailDto);
|
|
List<ImportFeeDetailDto> importFeeDetailDtos = null;
|
if (count > 0) {
|
importFeeDetailDtos = importFeeDetailInnerServiceSMOImpl.queryImportFeeDetails(importFeeDetailDto);
|
} else {
|
importFeeDetailDtos = new ArrayList<>();
|
}
|
|
ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) importFeeDetailDto.getRow()), count, importFeeDetailDtos);
|
|
ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
|
|
return responseEntity;
|
}
|
|
@Override
|
public ResponseEntity<String> get(MaintenancePayment importFeeDetailDto) {
|
|
|
int count = importFeeDetailInnerServiceSMOImpl.queryImportFeeDetailsCount(importFeeDetailDto);
|
|
List<MaintenancePayment> importFeeDetailDtos = null;
|
if (count > 0) {
|
importFeeDetailDtos = importFeeDetailInnerServiceSMOImpl.queryImportFeeDetails(importFeeDetailDto);
|
} else {
|
importFeeDetailDtos = new ArrayList<>();
|
}
|
|
ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) importFeeDetailDto.getRow()), count, importFeeDetailDtos);
|
|
ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
|
|
return responseEntity;
|
}
|
|
@Override
|
public ResponseEntity<String> get(MpPaymentRecord importFeeDetailDto) {
|
|
|
int count = importFeeDetailInnerServiceSMOImpl.queryImportFeeDetailsCount(importFeeDetailDto);
|
|
List<MpPaymentRecord> importFeeDetailDtos = null;
|
if (count > 0) {
|
importFeeDetailDtos = importFeeDetailInnerServiceSMOImpl.queryImportFeeDetails(importFeeDetailDto);
|
} else {
|
importFeeDetailDtos = new ArrayList<>();
|
}
|
|
ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) importFeeDetailDto.getRow()), count, importFeeDetailDtos);
|
|
ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
|
|
return responseEntity;
|
}
|
|
@Override
|
public ResponseEntity<String> get(MpFifthPaymentRecord importFeeDetailDto) {
|
|
|
int count = importFeeDetailInnerServiceSMOImpl.queryImportFeeDetailsCount(importFeeDetailDto);
|
|
List<MpFifthPaymentRecord> importFeeDetailDtos = null;
|
if (count > 0) {
|
importFeeDetailDtos = importFeeDetailInnerServiceSMOImpl.queryImportFeeDetails(importFeeDetailDto);
|
} else {
|
importFeeDetailDtos = new ArrayList<>();
|
}
|
|
ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) importFeeDetailDto.getRow()), count, importFeeDetailDtos);
|
|
ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
|
|
return responseEntity;
|
}
|
|
@Override
|
public ResponseEntity<String> queryMpPaymentRecordAll(MpPaymentRecord mpPaymentRecordDto) {
|
// 1. 把 MpPaymentRecord 的 mpId(String)转成 Long,封装成 MaintenancePayment
|
MaintenancePayment maintenancePayment = new MaintenancePayment();
|
maintenancePayment.setId(mpPaymentRecordDto.getMpId());
|
|
// 2. 调用服务层统计方法(参数是 MaintenancePayment)
|
int count = importFeeDetailInnerServiceSMOImpl.queryImportFeeDetailsCount(maintenancePayment);
|
|
Object importFeeDetailDtos = null;
|
if (count > 0) {
|
// 3. 核心错误点:调用服务层 queryMpPaymentRecordAll 时传入了 MaintenancePayment
|
// 但服务层接口定义的该方法参数可能不是 MaintenancePayment,导致找不到方法(404)
|
|
importFeeDetailDtos = sqlSessionTemplate.selectList("mpFifthPaymentRecordServiceDaoImpl.queryMpPaymentRecordAll", BeanConvertUtil.beanCovertMap(maintenancePayment));
|
} else {
|
importFeeDetailDtos = new Object();
|
}
|
|
// 4. 潜在问题:mpPaymentRecordDto.getRow() 可能为 null/0,导致分页计算异常
|
ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) mpPaymentRecordDto.getRow()), count, importFeeDetailDtos);
|
|
ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
|
return responseEntity;
|
}
|
|
}
|