Authored by caoyan

退款

package com.yoho.ufo.order.controller;
import java.io.File;
import java.text.ParseException;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -12,9 +15,13 @@ import org.springframework.web.bind.annotation.RestController;
import com.yoho.order.model.AppraiseOrderReq;
import com.yoho.order.model.RefundRecordBo;
import com.yoho.order.model.RefundRecordReq;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.order.service.IRefundRecordService;
import com.yoho.ufo.service.impl.BatchService;
import com.yoho.ufo.service.model.ApiResponse;
import com.yoho.ufo.service.model.ExportParam;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yoho.ufo.util.HttpUtil;
@RestController
@RequestMapping(value = "/refundRecord")
... ... @@ -24,6 +31,9 @@ public class RefundRecordController {
@Autowired
private IRefundRecordService refundRecordService;
@Autowired
private BatchService batchService;
@RequestMapping(value = "/list")
public ApiResponse list(RefundRecordReq req) {
... ... @@ -109,5 +119,23 @@ public class RefundRecordController {
return new ApiResponse.ApiResponseBuilder().code(400).message("更新失败").build();
}
}
@RequestMapping(value = "/export")
public String export(HttpServletResponse response, String param) {
File file;
try {
ExportParam exportParam = new ExportParam();
exportParam.setType("refundRecordServiceImpl");
exportParam.setQueryConf(param);
file = batchService.batchExport(exportParam);
return HttpUtil.writeFile(response, file, "application/vnd.ms-excel");
} catch (PlatformException e) {
LOGGER.warn("exportForGet find wrong.", e);
return HttpUtil.writeErrorInfo(response, e.getMessage());
} catch (Exception e) {
LOGGER.warn("exportForGet find wrong.", e);
return HttpUtil.writeErrorInfo(response, "<p>导出失败</p>");
}
}
}
... ...