You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.2 KiB

2 years ago
/*
* Copyright (C), 2018-2022
* Project: starter11
* FileName: CsvImportResultHandler
* Author:
* Date: 2022/9/15 11:43
*/
package com.fr.plugin.ajhig.io.result;
import com.fr.json.JSONObject;
import com.fr.web.utils.WebUtils;
import javax.servlet.http.HttpServletResponse;
/**
* <Function Description><br>
* <CsvImportResultHandler>
*
* @author
* @since 1.0.0
*/
public class CsvImportResultHandler {
private static final String SUCCESS = "success";
private static final String MSG = "msg";
private static final CsvImportResultHandler INSTANCE = new CsvImportResultHandler();
public CsvImportResultHandler() {
}
public static CsvImportResultHandler getInstance() {
return INSTANCE;
}
public void input(HttpServletResponse response, CsvImportResult importResult) throws Exception {
String msg = importResult.getMsg();
if (msg == null && importResult.getWie() != null) {
msg = importResult.getWie().getMessage();
}
JSONObject result = JSONObject.create();
result.put("success", importResult.isSuccess());
result.put("msg", msg);
WebUtils.printAsString(response, result.toString());
}
}