Commit 47fb12a2 by 杨清松

账单明细导出

parent 3e0e4d88
package com.xyst.dinas.finance.service;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
public interface StatementAccountService {
Object queryStatementAccountByContractId(JSONObject jsonObject);
Map<String, Object> queryStatementAccountByContractId(JSONObject jsonObject);
void exportStatementAccountDetails(HttpServletResponse response, JSONObject param);
}
package com.xyst.dinas.finance.web;
import java.io.IOException;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -12,10 +17,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.xyst.dinas.finance.service.StatementAccountService;
/**
* 费用调整
* 对账单
*
* @author yangqingsong
* @date 2021年4月25日
......@@ -30,7 +36,34 @@ public class StatementAccountController {
@ResponseBody
@RequestMapping(value = "/sand/user/finance/statementAccount/queryStatementAccountByContractId", method = RequestMethod.POST)
public Object queryStatementAccountByContractId(@RequestBody String body) {
return statementAccountService.queryStatementAccountByContractId(new JSONObject(body));
try{
Map<String, Object> statementAccountByContract = statementAccountService.queryStatementAccountByContractId(new JSONObject(body));
return ResponseObj.success("查询成功", statementAccountByContract);
} catch(Exception e) {
return ResponseObj.error();
}
}
@ResponseBody
@RequestMapping(value = "/sand/user/finance/exportStatementAccountDetails", method = RequestMethod.POST)
public Object exportStatementAccountDetails(HttpServletRequest request, HttpServletResponse response) throws IOException {
request.setCharacterEncoding("utf-8");
String exportParamStr = request.getParameter("exportParamStr");
response.reset();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/x-www-form-urlencoded");
JSONObject obj = new JSONObject();
try {
obj.put("code", 200);
JSONObject param = new JSONObject(exportParamStr);
statementAccountService.exportStatementAccountDetails(response, param);
} catch(Exception e) {
e.printStackTrace();
return ResponseObj.error();
}
return obj.toString();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment