|
|
|
|
package com.ruoyi.booksystem.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
|
import com.ruoyi.booksystem.domain.Operations;
|
|
|
|
|
import com.ruoyi.booksystem.service.IOperationsService;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当日操作Controller
|
|
|
|
|
*
|
|
|
|
|
* @author ruoyi
|
|
|
|
|
* @date 2023-12-18
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/booksystem/operations")
|
|
|
|
|
public class OperationsController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
@Autowired
|
|
|
|
|
private IOperationsService operationsService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询当日操作列表
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('booksystem:operations:list')")
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public TableDataInfo list(Operations operations)
|
|
|
|
|
{
|
|
|
|
|
startPage();
|
|
|
|
|
List<Operations> list = operationsService.selectOperationsList(operations);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出当日操作列表
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('booksystem:operations:export')")
|
|
|
|
|
@Log(title = "当日操作", businessType = BusinessType.EXPORT)
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
public void export(HttpServletResponse response, Operations operations)
|
|
|
|
|
{
|
|
|
|
|
List<Operations> list = operationsService.selectOperationsList(operations);
|
|
|
|
|
ExcelUtil<Operations> util = new ExcelUtil<Operations>(Operations.class);
|
|
|
|
|
util.exportExcel(response, list, "当日操作数据");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当日操作详细信息
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('booksystem:operations:query')")
|
|
|
|
|
@GetMapping(value = "/{id}")
|
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
|
{
|
|
|
|
|
return AjaxResult.success(operationsService.selectOperationsById(id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增当日操作
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('booksystem:operations:add')")
|
|
|
|
|
@Log(title = "当日操作", businessType = BusinessType.INSERT)
|
|
|
|
|
@PostMapping
|
|
|
|
|
public AjaxResult add(@RequestBody Operations operations)
|
|
|
|
|
{
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
|
System.out.println("[AccountBookController] userName: " + loginUser.getUsername() + " userId: " + loginUser.getUserId());
|
|
|
|
|
operations.setUserId(loginUser.getUserId());
|
|
|
|
|
//插入一条后,要更新持仓表
|
|
|
|
|
return toAjax(operationsService.insertOperations(operations));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改当日操作
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('booksystem:operations:edit')")
|
|
|
|
|
@Log(title = "当日操作", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping
|
|
|
|
|
public AjaxResult edit(@RequestBody Operations operations)
|
|
|
|
|
{
|
|
|
|
|
return toAjax(operationsService.updateOperations(operations));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除当日操作
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('booksystem:operations:remove')")
|
|
|
|
|
@Log(title = "当日操作", businessType = BusinessType.DELETE)
|
|
|
|
|
@DeleteMapping("/{ids}")
|
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
|
|
{
|
|
|
|
|
return toAjax(operationsService.deleteOperationsByIds(ids));
|
|
|
|
|
}
|
|
|
|
|
}
|