|
|
|
|
@@ -1,6 +1,10 @@
|
|
|
|
|
package com.jeesite.modules.erp.web;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import com.jeesite.modules.apps.Module.ErpFlowParams;
|
|
|
|
|
import com.jeesite.modules.apps.Module.PageResult;
|
|
|
|
|
import com.jeesite.modules.utils.PageUtil;
|
|
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
@@ -26,6 +30,7 @@ import com.jeesite.modules.erp.service.ErpTransactionFlowService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 收支流水 Controller
|
|
|
|
|
*
|
|
|
|
|
* @author gaoxq
|
|
|
|
|
* @version 2026-03-22
|
|
|
|
|
*/
|
|
|
|
|
@@ -33,114 +38,131 @@ import com.jeesite.modules.erp.service.ErpTransactionFlowService;
|
|
|
|
|
@RequestMapping(value = "${adminPath}/erp/transactionFlow")
|
|
|
|
|
public class ErpTransactionFlowController extends BaseController {
|
|
|
|
|
|
|
|
|
|
private final ErpTransactionFlowService erpTransactionFlowService;
|
|
|
|
|
private final ErpTransactionFlowService erpTransactionFlowService;
|
|
|
|
|
|
|
|
|
|
public ErpTransactionFlowController(ErpTransactionFlowService erpTransactionFlowService) {
|
|
|
|
|
this.erpTransactionFlowService = erpTransactionFlowService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取数据
|
|
|
|
|
*/
|
|
|
|
|
@ModelAttribute
|
|
|
|
|
public ErpTransactionFlow get(String flowId, boolean isNewRecord) {
|
|
|
|
|
return erpTransactionFlowService.get(flowId, isNewRecord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = {"list", ""})
|
|
|
|
|
public String list(ErpTransactionFlow erpTransactionFlow, Model model) {
|
|
|
|
|
model.addAttribute("erpTransactionFlow", erpTransactionFlow);
|
|
|
|
|
return "modules/erp/erpTransactionFlowList";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = "listData")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Page<ErpTransactionFlow> listData(ErpTransactionFlow erpTransactionFlow, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
erpTransactionFlow.setPage(new Page<>(request, response));
|
|
|
|
|
Page<ErpTransactionFlow> page = erpTransactionFlowService.findPage(erpTransactionFlow);
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
public ErpTransactionFlowController(ErpTransactionFlowService erpTransactionFlowService) {
|
|
|
|
|
this.erpTransactionFlowService = erpTransactionFlowService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查看编辑表单
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = "form")
|
|
|
|
|
public String form(ErpTransactionFlow erpTransactionFlow, Model model) {
|
|
|
|
|
model.addAttribute("erpTransactionFlow", erpTransactionFlow);
|
|
|
|
|
return "modules/erp/erpTransactionFlowForm";
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取数据
|
|
|
|
|
*/
|
|
|
|
|
@ModelAttribute
|
|
|
|
|
public ErpTransactionFlow get(String flowId, boolean isNewRecord) {
|
|
|
|
|
return erpTransactionFlowService.get(flowId, isNewRecord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:edit")
|
|
|
|
|
@PostMapping(value = "save")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String save(@Validated ErpTransactionFlow erpTransactionFlow) {
|
|
|
|
|
erpTransactionFlowService.save(erpTransactionFlow);
|
|
|
|
|
return renderResult(Global.TRUE, text("保存流水成功!"));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = {"list", ""})
|
|
|
|
|
public String list(ErpTransactionFlow erpTransactionFlow, Model model) {
|
|
|
|
|
model.addAttribute("erpTransactionFlow", erpTransactionFlow);
|
|
|
|
|
return "modules/erp/erpTransactionFlowList";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = "exportData")
|
|
|
|
|
public void exportData(ErpTransactionFlow erpTransactionFlow, HttpServletResponse response) {
|
|
|
|
|
List<ErpTransactionFlow> list = erpTransactionFlowService.findList(erpTransactionFlow);
|
|
|
|
|
String fileName = "流水" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
|
|
|
|
try(ExcelExport ee = new ExcelExport("流水", ErpTransactionFlow.class)){
|
|
|
|
|
ee.setDataList(list).write(response, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = "listData")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Page<ErpTransactionFlow> listData(ErpTransactionFlow erpTransactionFlow, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
erpTransactionFlow.setPage(new Page<>(request, response));
|
|
|
|
|
Page<ErpTransactionFlow> page = erpTransactionFlowService.findPage(erpTransactionFlow);
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下载模板
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = "importTemplate")
|
|
|
|
|
public void importTemplate(HttpServletResponse response) {
|
|
|
|
|
ErpTransactionFlow erpTransactionFlow = new ErpTransactionFlow();
|
|
|
|
|
List<ErpTransactionFlow> list = ListUtils.newArrayList(erpTransactionFlow);
|
|
|
|
|
String fileName = "流水模板.xlsx";
|
|
|
|
|
try(ExcelExport ee = new ExcelExport("流水", ErpTransactionFlow.class, Type.IMPORT)){
|
|
|
|
|
ee.setDataList(list).write(response, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 查看编辑表单
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = "form")
|
|
|
|
|
public String form(ErpTransactionFlow erpTransactionFlow, Model model) {
|
|
|
|
|
model.addAttribute("erpTransactionFlow", erpTransactionFlow);
|
|
|
|
|
return "modules/erp/erpTransactionFlowForm";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导入数据
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:edit")
|
|
|
|
|
@PostMapping(value = "importData")
|
|
|
|
|
public String importData(MultipartFile file) {
|
|
|
|
|
try {
|
|
|
|
|
String message = erpTransactionFlowService.importData(file);
|
|
|
|
|
return renderResult(Global.TRUE, "posfull:"+message);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:edit")
|
|
|
|
|
@RequestMapping(value = "delete")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String delete(ErpTransactionFlow erpTransactionFlow) {
|
|
|
|
|
erpTransactionFlowService.delete(erpTransactionFlow);
|
|
|
|
|
return renderResult(Global.TRUE, text("删除流水成功!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:edit")
|
|
|
|
|
@PostMapping(value = "save")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String save(@Validated ErpTransactionFlow erpTransactionFlow) {
|
|
|
|
|
erpTransactionFlowService.save(erpTransactionFlow);
|
|
|
|
|
return renderResult(Global.TRUE, text("保存流水成功!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = "exportData")
|
|
|
|
|
public void exportData(ErpTransactionFlow erpTransactionFlow, HttpServletResponse response) {
|
|
|
|
|
List<ErpTransactionFlow> list = erpTransactionFlowService.findList(erpTransactionFlow);
|
|
|
|
|
String fileName = "流水" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
|
|
|
|
try (ExcelExport ee = new ExcelExport("流水", ErpTransactionFlow.class)) {
|
|
|
|
|
ee.setDataList(list).write(response, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下载模板
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:view")
|
|
|
|
|
@RequestMapping(value = "importTemplate")
|
|
|
|
|
public void importTemplate(HttpServletResponse response) {
|
|
|
|
|
ErpTransactionFlow erpTransactionFlow = new ErpTransactionFlow();
|
|
|
|
|
List<ErpTransactionFlow> list = ListUtils.newArrayList(erpTransactionFlow);
|
|
|
|
|
String fileName = "流水模板.xlsx";
|
|
|
|
|
try (ExcelExport ee = new ExcelExport("流水", ErpTransactionFlow.class, Type.IMPORT)) {
|
|
|
|
|
ee.setDataList(list).write(response, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导入数据
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:edit")
|
|
|
|
|
@PostMapping(value = "importData")
|
|
|
|
|
public String importData(MultipartFile file) {
|
|
|
|
|
try {
|
|
|
|
|
String message = erpTransactionFlowService.importData(file);
|
|
|
|
|
return renderResult(Global.TRUE, "posfull:" + message);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("erp:transactionFlow:edit")
|
|
|
|
|
@RequestMapping(value = "delete")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String delete(ErpTransactionFlow erpTransactionFlow) {
|
|
|
|
|
erpTransactionFlowService.delete(erpTransactionFlow);
|
|
|
|
|
return renderResult(Global.TRUE, text("删除流水成功!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "FlowList")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public PageResult<ErpTransactionFlow> getFlowList(ErpFlowParams erpFlowParams) {
|
|
|
|
|
ErpTransactionFlow erpTransactionFlow = new ErpTransactionFlow();
|
|
|
|
|
erpTransactionFlow.setFlowType(erpFlowParams.getFlowType());
|
|
|
|
|
erpTransactionFlow.setFlowName(erpFlowParams.getFlowName());
|
|
|
|
|
erpTransactionFlow.setAccountId(erpFlowParams.getAccountId());
|
|
|
|
|
erpTransactionFlow.setCategoryId(erpFlowParams.getCategoryId());
|
|
|
|
|
List<ErpTransactionFlow> list = erpTransactionFlowService.findList(erpTransactionFlow);
|
|
|
|
|
PageUtil<ErpTransactionFlow> util = new PageUtil<>(erpFlowParams.getPageNum(), erpFlowParams.getPageSize(), list);
|
|
|
|
|
return new PageResult<>(
|
|
|
|
|
util.OkData(),
|
|
|
|
|
util.getCurPage(),
|
|
|
|
|
util.getPageSize(),
|
|
|
|
|
util.getTotalCount()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|