105 lines
2.9 KiB
Java
105 lines
2.9 KiB
Java
package lingtao.net.controller;
|
|
|
|
import java.util.List;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import lingtao.net.bean.Finance;
|
|
import lingtao.net.bean.Msg;
|
|
import lingtao.net.bean.SysUser;
|
|
import lingtao.net.service.Finance6Service;
|
|
|
|
@Controller
|
|
public class Finance6Controller {
|
|
|
|
@Autowired
|
|
private Finance6Service finance6Service;
|
|
|
|
// 用户跳转页面
|
|
@RequestMapping("/finance_6/index")
|
|
public void index(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
// return "/finance/finance";
|
|
response.sendRedirect(request.getContextPath() + "/views/system/finance/finance6.jsp");
|
|
}
|
|
|
|
/**
|
|
* 根据条件查询数据
|
|
*
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/getFinance_6")
|
|
public PageInfo<Finance> getFinance(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
|
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Finance finance) {
|
|
PageHelper.startPage(page, limit);
|
|
List<Finance> financeList = finance6Service.getFinance(finance);
|
|
PageInfo<Finance> pageInfo = new PageInfo<Finance>(financeList);
|
|
return pageInfo;
|
|
}
|
|
|
|
/**
|
|
* 获取自己上传过的文件名(用于导出文件)
|
|
*
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/getAllFilename_6")
|
|
public List<String> getAllFilename() {
|
|
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
|
List<String> FilenameList = finance6Service.getAllFilename(user.getRealname());
|
|
return FilenameList;
|
|
}
|
|
|
|
/**
|
|
* 根据文件名删除自己导入过的文件
|
|
*
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/deleteDataByFilename_6")
|
|
public Msg deleteDataByFilename(@RequestParam(value = "filename") String filename) {
|
|
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
|
return finance6Service.deleteDataByFilename(filename, user.getRealname());
|
|
}
|
|
|
|
/**
|
|
*
|
|
* 文件上传
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value = "/ajaxUpload_f6")
|
|
public Msg uploadExcel(@RequestParam("file") MultipartFile file) throws Exception {
|
|
synchronized (this) {
|
|
return finance6Service.ajaxUploadExcel(file);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 导出
|
|
*
|
|
* @param response
|
|
* @param request
|
|
* @param finance
|
|
* @throws Exception
|
|
*/
|
|
@RequestMapping("/excel_6")
|
|
public void excel(HttpServletResponse response, Finance finance) throws Exception {
|
|
if (StringUtils.isEmpty(finance.getFilename())) {
|
|
return;
|
|
}
|
|
finance6Service.excel(response, finance);
|
|
}
|
|
}
|