feat(sip): 新增Vue项目与订单管理接口- 添加VueProjectInfoController控制器,提供项目信息的增删改查接口
- 添加VueProjectOrderInfoController控制器,提供订单信息的增删改查接口 - 实现项目与订单的列表查询、详情获取、新增、修改、删除功能 - 支持项目与订单的数据导出功能- 集成权限控制与操作日志记录- 优化订单审批状态判断逻辑dev_1.0.0
parent
dbacc884be
commit
0b12e0b88e
|
|
@ -0,0 +1,104 @@
|
|||
package com.ruoyi.sip.controller.vue;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.sip.domain.ProjectInfo;
|
||||
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
||||
import com.ruoyi.sip.service.IProjectInfoService;
|
||||
import com.ruoyi.sip.service.IProjectOrderInfoService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 项目管理Controller for Vue
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sip/project/vue")
|
||||
public class VueProjectInfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IProjectInfoService projectInfoService;
|
||||
@Autowired
|
||||
private IProjectOrderInfoService orderInfoService;
|
||||
|
||||
/**
|
||||
* 查询项目管理列表
|
||||
*/
|
||||
@RequiresPermissions("sip:project:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProjectInfo projectInfo) {
|
||||
startPage();
|
||||
List<ProjectInfo> list = projectInfoService.selectProjectInfoList(projectInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出项目管理列表
|
||||
*/
|
||||
@RequiresPermissions("sip:project:export")
|
||||
@Log(title = "项目管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public AjaxResult export(ProjectInfo projectInfo) {
|
||||
return AjaxResult.success(projectInfoService.exportList(projectInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目管理详细信息
|
||||
*/
|
||||
@RequiresPermissions("sip:project:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
Map<String,Object> mmap = new HashMap<>();
|
||||
List<ProjectOrderInfo> orderInfoList = orderInfoService.selectProjectOrderInfoByProjectId(Collections.singletonList(id));
|
||||
ProjectOrderInfo orderInfo = CollUtil.isNotEmpty(orderInfoList) ? orderInfoList.get(0) : null;
|
||||
mmap.put("canUpdate", orderInfo == null ||
|
||||
orderInfo.getOrderStatus().equals(ProjectOrderInfo.OrderStatus.WAIT_COMMIT.getCode())
|
||||
|| orderInfo.getOrderStatus().equals(ProjectOrderInfo.OrderStatus.APPROVE_REJECT.getCode()));
|
||||
mmap.put("project",projectInfoService.selectProjectInfoById(id));
|
||||
return success(mmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目管理
|
||||
*/
|
||||
@RequiresPermissions("sip:project:add")
|
||||
@Log(title = "项目管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ProjectInfo projectInfo) {
|
||||
return toAjax(projectInfoService.insertProjectInfo(projectInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目管理
|
||||
*/
|
||||
@RequiresPermissions("sip:project:edit")
|
||||
@Log(title = "项目管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ProjectInfo projectInfo) {
|
||||
return toAjax(projectInfoService.updateProjectInfo(projectInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目管理
|
||||
*/
|
||||
@RequiresPermissions("sip:project:remove")
|
||||
@Log(title = "项目管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String ids) {
|
||||
return toAjax(projectInfoService.deleteProjectInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.ruoyi.sip.controller.vue;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
||||
import com.ruoyi.sip.service.IProjectOrderInfoService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单管理 (Vue)
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/project/order/vue")
|
||||
public class VueProjectOrderInfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IProjectOrderInfoService projectOrderInfoService;
|
||||
|
||||
/**
|
||||
* 查询订单管理列表
|
||||
*/
|
||||
@RequiresPermissions(value = {"project:order:list", "project:order:approve"}, logical = Logical.OR)
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProjectOrderInfo projectOrderInfo) {
|
||||
if (StringUtils.isNotEmpty(projectOrderInfo.getApprove())) {
|
||||
projectOrderInfo.setApprove(ShiroUtils.getUserId().toString());
|
||||
}
|
||||
startPage();
|
||||
List<ProjectOrderInfo> list = projectOrderInfoService.selectProjectOrderInfoList(projectOrderInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单管理详细信息
|
||||
*/
|
||||
@RequiresPermissions("project:order:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(projectOrderInfoService.selectProjectOrderInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增订单管理
|
||||
*/
|
||||
@RequiresPermissions("project:order:add")
|
||||
@Log(title = "订单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ProjectOrderInfo projectOrderInfo) {
|
||||
return toAjax(projectOrderInfoService.insertProjectOrderInfo(projectOrderInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单管理
|
||||
*/
|
||||
@RequiresPermissions("project:order:edit")
|
||||
@Log(title = "订单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ProjectOrderInfo projectOrderInfo) {
|
||||
return toAjax(projectOrderInfoService.updateProjectOrderInfo(projectOrderInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单管理
|
||||
*/
|
||||
@RequiresPermissions("project:order:remove")
|
||||
@Log(title = "订单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String ids) {
|
||||
return toAjax(projectOrderInfoService.deleteProjectOrderInfoByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出订单管理列表
|
||||
*/
|
||||
@RequiresPermissions("project:order:export")
|
||||
@Log(title = "订单管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public AjaxResult export(@RequestBody ProjectOrderInfo projectOrderInfo) {
|
||||
// 在Vue前端,通常是先调用这个接口生成文件,拿到文件名,然后再通过/common/download接口下载
|
||||
String fileName = projectOrderInfoService.exportList(projectOrderInfo);
|
||||
return AjaxResult.success(fileName);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue