package com.java110.fee.api;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.java110.dto.msg.MpPaymentRecordPo;
|
import com.java110.fee.bmo.importFeeDetail.IDeleteImportFeeDetailBMO;
|
import com.java110.fee.bmo.importFeeDetail.IGetImportFeeDetailBMO;
|
import com.java110.fee.bmo.importFeeDetail.ISaveImportFeeDetailBMO;
|
import com.java110.fee.bmo.importFeeDetail.IUpdateImportFeeDetailBMO;
|
import com.java110.po.importFee.MpPaymentRecord;
|
import com.java110.utils.util.Assert;
|
import com.java110.utils.util.BeanConvertUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.http.HttpStatus;
|
import org.springframework.http.ResponseEntity;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* 打印支取到账记录接口
|
* 匹配原有 ImportFeeApi 代码风格
|
*/
|
@RestController
|
@RequestMapping(value = "/mpPaymentRecord")
|
public class MpPaymentRecordApi {
|
|
@Autowired
|
private ISaveImportFeeDetailBMO saveImportFeeDetailBMOImpl;
|
@Autowired
|
private IUpdateImportFeeDetailBMO updateImportFeeDetailBMOImpl;
|
@Autowired
|
private IDeleteImportFeeDetailBMO deleteImportFeeDetailBMOImpl;
|
@Autowired
|
private IGetImportFeeDetailBMO getImportFeeDetailBMOImpl;
|
|
/**
|
* 保存打印支取到账记录
|
*
|
* @param reqJson 请求参数
|
* @return 响应结果
|
* @serviceCode /mpPaymentRecord/saveMpPaymentRecord
|
* @path /app/mpPaymentRecord/saveMpPaymentRecord
|
*/
|
@RequestMapping(value = "/saveMpPaymentRecord", method = RequestMethod.POST)
|
public ResponseEntity<String> saveMpPaymentRecord(@RequestBody JSONObject reqJson) {
|
// 核心参数校验
|
Assert.hasKeyAndValue(reqJson, "mpId", "请求报文中未包含打印记录ID");
|
Assert.hasKeyAndValue(reqJson, "firstPrintDate", "请求报文中未包含第一次打印日期");
|
Assert.hasKeyAndValue(reqJson, "printAmount", "请求报文中未包含打印金额");
|
|
// 将JSON参数转换为MpPaymentRecord实体类
|
MpPaymentRecord mpPaymentRecord = BeanConvertUtil.covertBean(reqJson, MpPaymentRecord.class);
|
// 由于BMO接口使用MaintenancePayment,这里需要做适配转换
|
// 注意:这里需要根据实际情况调整,可能需要转换器
|
return saveImportFeeDetailBMOImpl.save(mpPaymentRecord);
|
}
|
|
public ResponseEntity<String> saveMpPaymentRecord(MpPaymentRecordPo mpPaymentRecord) {
|
if (mpPaymentRecord == null) {
|
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
}
|
return saveImportFeeDetailBMOImpl.save(mpPaymentRecord);
|
}
|
|
|
/**
|
* 修改打印支取到账记录
|
*
|
* @param reqJson 请求参数
|
* @return 响应结果
|
* @serviceCode /mpPaymentRecord/updateMpPaymentRecord
|
* @path /app/mpPaymentRecord/updateMpPaymentRecord
|
*/
|
@RequestMapping(value = "/updateMpPaymentRecord", method = RequestMethod.POST)
|
public ResponseEntity<String> updateMpPaymentRecord(@RequestBody JSONObject reqJson) {
|
// 主键校验(修改必须传id)
|
Assert.hasKeyAndValue(reqJson, "id", "请求报文中未包含主键ID");
|
Assert.hasKeyAndValue(reqJson, "id", "主键ID不能为空");
|
|
// 将JSON参数转换为MpPaymentRecord实体类
|
MpPaymentRecord mpPaymentRecord = BeanConvertUtil.covertBean(reqJson, MpPaymentRecord.class);
|
// 由于BMO接口使用MaintenancePayment,这里需要做适配转换
|
return updateImportFeeDetailBMOImpl.update(mpPaymentRecord);
|
}
|
|
/**
|
* 删除打印支取到账记录
|
*
|
* @param reqJson 请求参数
|
* @return 响应结果
|
* @serviceCode /mpPaymentRecord/deleteMpPaymentRecord
|
* @path /app/mpPaymentRecord/deleteMpPaymentRecord
|
*/
|
@RequestMapping(value = "/deleteMpPaymentRecord", method = RequestMethod.POST)
|
public ResponseEntity<String> deleteMpPaymentRecord(@RequestBody JSONObject reqJson) {
|
// 必要参数校验
|
Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空");
|
Assert.hasKeyAndValue(reqJson, "id", "主键ID不能为空");
|
|
// 将JSON参数转换为MpPaymentRecord实体类
|
MpPaymentRecord mpPaymentRecord = BeanConvertUtil.covertBean(reqJson, MpPaymentRecord.class);
|
// 由于BMO接口使用MaintenancePayment,这里需要做适配转换
|
return deleteImportFeeDetailBMOImpl.delete(mpPaymentRecord);
|
}
|
|
/**
|
* 分页查询打印支取到账记录列表
|
*
|
* @param mpId 打印记录ID(必填)
|
* @param page 页码
|
* @param row 每页条数
|
* @param resolutionNumber 决议编号(可选)
|
* @param withdrawer 支取人(可选)
|
* @param roadName 路名(可选)
|
* @param startDate 开始日期(可选)
|
* @param endDate 结束日期(可选)
|
* @param id 主键ID(可选)
|
* @return 响应结果
|
* @serviceCode /mpPaymentRecord/queryMpPaymentRecord
|
* @path /app/mpPaymentRecord/queryMpPaymentRecord
|
*/
|
@RequestMapping(value = "/queryMpPaymentRecord", method = RequestMethod.GET)
|
public ResponseEntity<String> queryMpPaymentRecord(@RequestParam(value = "mpId") String mpId,
|
@RequestParam(value = "page") int page,
|
@RequestParam(value = "row") int row,
|
@RequestParam(value = "resolutionNumber", required = false) String resolutionNumber,
|
@RequestParam(value = "withdrawer", required = false) String withdrawer,
|
@RequestParam(value = "roadName", required = false) String roadName,
|
@RequestParam(value = "startDate", required = false) String startDate,
|
@RequestParam(value = "endDate", required = false) String endDate,
|
@RequestParam(value = "id", required = false) String id) {
|
// 封装查询DTO
|
MpPaymentRecord mpPaymentRecordDto = new MpPaymentRecord();
|
mpPaymentRecordDto.setPage(page);
|
mpPaymentRecordDto.setRow(row);
|
mpPaymentRecordDto.setMpId(mpId);
|
mpPaymentRecordDto.setResolutionNumber(resolutionNumber);
|
mpPaymentRecordDto.setWithdrawer(withdrawer);
|
mpPaymentRecordDto.setRoadName(roadName);
|
|
// 设置其他查询条件
|
if (id != null && !id.isEmpty()) {
|
mpPaymentRecordDto.setId(Long.parseLong(id));
|
}
|
|
// 由于BMO接口使用MaintenancePayment,这里需要做适配转换
|
|
return getImportFeeDetailBMOImpl.get(mpPaymentRecordDto);
|
}
|
|
|
/**
|
* 查询打印支取到账记录汇总
|
*
|
* @param mpId 主表记录ID(必填)
|
* @return 响应结果
|
* @serviceCode /mpPaymentRecord/queryMpPaymentRecordAll
|
* @path /app/mpPaymentRecord/queryMpPaymentRecordAll
|
*/
|
@RequestMapping(value = "/queryMpPaymentRecordAll", method = RequestMethod.GET)
|
public ResponseEntity<String> queryMpPaymentRecordAll(@RequestParam(value = "mpId") String mpId) {
|
// 封装查询DTO
|
MpPaymentRecord mpPaymentRecordDto = new MpPaymentRecord();
|
mpPaymentRecordDto.setMpId(mpId);
|
|
return getImportFeeDetailBMOImpl.queryMpPaymentRecordAll(mpPaymentRecordDto);
|
}
|
|
/**
|
* 根据ID查询单条打印支取到账记录
|
*
|
* @param reqJson 请求参数
|
* @return 响应结果
|
* @serviceCode /mpPaymentRecord/getMpPaymentRecordById
|
* @path /app/mpPaymentRecord/getMpPaymentRecordById
|
*/
|
@RequestMapping(value = "/getMpPaymentRecordById", method = RequestMethod.POST)
|
public ResponseEntity<String> getMpPaymentRecordById(@RequestBody JSONObject reqJson) {
|
// 主键校验
|
Assert.hasKeyAndValue(reqJson, "id", "请求报文中未包含主键ID");
|
Assert.hasKeyAndValue(reqJson, "id", "主键ID不能为空");
|
|
// 封装查询DTO
|
MpPaymentRecord mpPaymentRecordDto = new MpPaymentRecord();
|
mpPaymentRecordDto.setId(reqJson.getLong("id"));
|
|
// 由于BMO接口使用MaintenancePayment,这里需要做适配转换
|
return getImportFeeDetailBMOImpl.get(mpPaymentRecordDto);
|
}
|
|
/**
|
* 根据打印记录ID查询记录
|
*
|
* @param reqJson 请求参数
|
* @return 响应结果
|
* @serviceCode /mpPaymentRecord/getMpPaymentRecordByMpId
|
* @path /app/mpPaymentRecord/getMpPaymentRecordByMpId
|
*/
|
@RequestMapping(value = "/getMpPaymentRecordByMpId", method = RequestMethod.POST)
|
public ResponseEntity<String> getMpPaymentRecordByMpId(@RequestBody JSONObject reqJson) {
|
// 参数校验
|
Assert.hasKeyAndValue(reqJson, "mpId", "请求报文中未包含打印记录ID");
|
|
// 封装查询DTO
|
MpPaymentRecord mpPaymentRecordDto = new MpPaymentRecord();
|
mpPaymentRecordDto.setMpId(reqJson.getString("mpId"));
|
|
// 由于BMO接口使用MaintenancePayment,这里需要做适配转换
|
return getImportFeeDetailBMOImpl.get(mpPaymentRecordDto);
|
}
|
|
/**
|
* 查询到账记录统计信息
|
*
|
* @param reqJson 请求参数
|
* @return 响应结果
|
* @serviceCode /mpPaymentRecord/queryArrivalStatistics
|
* @path /app/mpPaymentRecord/queryArrivalStatistics
|
*/
|
@RequestMapping(value = "/queryArrivalStatistics", method = RequestMethod.POST)
|
public ResponseEntity<String> queryArrivalStatistics(@RequestBody JSONObject reqJson) {
|
// 参数校验
|
Assert.hasKeyAndValue(reqJson, "mpId", "请求报文中未包含打印记录ID");
|
Assert.hasKeyAndValue(reqJson, "startDate", "请求报文中未包含开始日期");
|
Assert.hasKeyAndValue(reqJson, "endDate", "请求报文中未包含结束日期");
|
|
// 封装查询DTO
|
MpPaymentRecord mpPaymentRecordDto = new MpPaymentRecord();
|
mpPaymentRecordDto.setMpId(reqJson.getString("mpId"));
|
|
// 注意:这里需要根据实际日期格式处理
|
try {
|
if (reqJson.containsKey("startDate")) {
|
mpPaymentRecordDto.setStartDate(reqJson.getDate("startDate"));
|
}
|
if (reqJson.containsKey("endDate")) {
|
mpPaymentRecordDto.setEndDate(reqJson.getDate("endDate"));
|
}
|
} catch (Exception e) {
|
// 日期格式转换异常处理
|
mpPaymentRecordDto.setStartDate(null);
|
mpPaymentRecordDto.setEndDate(null);
|
}
|
|
// 由于BMO接口使用MaintenancePayment,这里需要做适配转换
|
// 注意:这个统计方法可能需要单独实现或调用另一个BMO方法
|
return getImportFeeDetailBMOImpl.get(mpPaymentRecordDto);
|
}
|
}
|