| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.eam.constant.TechnicalStatusDeactivateStatusEnum; |
| | | import org.jeecg.modules.eam.entity.EamTechnicalStatusDeactivate; |
| | | import org.jeecg.modules.eam.request.EamTechnicalStatusDeactivateQuery; |
| | | import org.jeecg.modules.eam.request.EamTechnicalStatusDeactivateRequest; |
| | | import org.jeecg.modules.eam.service.IEamTechnicalStatusDeactivateService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | /** |
| | | * @Description: 停用加工设备申请单 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-09 |
| | | * @Date: 2025-07-09 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags="停用加工设备申请单") |
| | | @Api(tags = "停用加工设备申请单") |
| | | @RestController |
| | | @RequestMapping("/eam/eamTechnicalStatusDeactivate") |
| | | public class EamTechnicalStatusDeactivateController extends JeecgController<EamTechnicalStatusDeactivate, IEamTechnicalStatusDeactivateService> { |
| | | @Autowired |
| | | private IEamTechnicalStatusDeactivateService eamTechnicalStatusDeactivateService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param eamTechnicalStatusDeactivate |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="停用加工设备申请单-分页列表查询", notes="停用加工设备申请单-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamTechnicalStatusDeactivate eamTechnicalStatusDeactivate, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<EamTechnicalStatusDeactivate> queryWrapper = QueryGenerator.initQueryWrapper(eamTechnicalStatusDeactivate, req.getParameterMap()); |
| | | Page<EamTechnicalStatusDeactivate> page = new Page<EamTechnicalStatusDeactivate>(pageNo, pageSize); |
| | | IPage<EamTechnicalStatusDeactivate> pageList = eamTechnicalStatusDeactivateService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param eamTechnicalStatusDeactivate |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "停用加工设备申请单-添加") |
| | | @ApiOperation(value="停用加工设备申请单-添加", notes="停用加工设备申请单-添加") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamTechnicalStatusDeactivate eamTechnicalStatusDeactivate) { |
| | | eamTechnicalStatusDeactivateService.save(eamTechnicalStatusDeactivate); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param eamTechnicalStatusDeactivate |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "停用加工设备申请单-编辑") |
| | | @ApiOperation(value="停用加工设备申请单-编辑", notes="停用加工设备申请单-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EamTechnicalStatusDeactivate eamTechnicalStatusDeactivate) { |
| | | eamTechnicalStatusDeactivateService.updateById(eamTechnicalStatusDeactivate); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "停用加工设备申请单-通过id删除") |
| | | @ApiOperation(value="停用加工设备申请单-通过id删除", notes="停用加工设备申请单-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
| | | eamTechnicalStatusDeactivateService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "停用加工设备申请单-批量删除") |
| | | @ApiOperation(value="停用加工设备申请单-批量删除", notes="停用加工设备申请单-批量删除") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.eamTechnicalStatusDeactivateService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "停用加工设备申请单-通过id查询") |
| | | @ApiOperation(value="停用加工设备申请单-通过id查询", notes="停用加工设备申请单-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
| | | EamTechnicalStatusDeactivate eamTechnicalStatusDeactivate = eamTechnicalStatusDeactivateService.getById(id); |
| | | return Result.OK(eamTechnicalStatusDeactivate); |
| | | } |
| | | @Autowired |
| | | private IEamTechnicalStatusDeactivateService eamTechnicalStatusDeactivateService; |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param eamTechnicalStatusDeactivate |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EamTechnicalStatusDeactivate eamTechnicalStatusDeactivate) { |
| | | return super.exportXls(request, eamTechnicalStatusDeactivate, EamTechnicalStatusDeactivate.class, "停用加工设备申请单"); |
| | | } |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param query |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "停用加工设备申请单-分页列表查询", notes = "停用加工设备申请单-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamTechnicalStatusDeactivateQuery query, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | Page<EamTechnicalStatusDeactivate> page = new Page<>(pageNo, pageSize); |
| | | IPage<EamTechnicalStatusDeactivate> pageList = eamTechnicalStatusDeactivateService.queryPageList(page, query); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, EamTechnicalStatusDeactivate.class); |
| | | } |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "停用加工设备申请单-添加") |
| | | @ApiOperation(value = "停用加工设备申请单-添加", notes = "停用加工设备申请单-添加") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamTechnicalStatusDeactivateRequest request) { |
| | | if (request == null) { |
| | | return Result.error("添加的对象不能为空!"); |
| | | } |
| | | if (CollectionUtil.isEmpty(request.getTableDetailList())) { |
| | | return Result.error("设备明细不能为空!"); |
| | | } |
| | | boolean b = eamTechnicalStatusDeactivateService.addTechnicalStatusDeactivate(request); |
| | | if (!b) { |
| | | return Result.error("添加失败!"); |
| | | } |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "停用加工设备申请单-编辑") |
| | | @ApiOperation(value = "停用加工设备申请单-编辑", notes = "停用加工设备申请单-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EamTechnicalStatusDeactivateRequest request) { |
| | | if (request == null) { |
| | | return Result.error("编辑的对象不能为空!"); |
| | | } |
| | | boolean b = eamTechnicalStatusDeactivateService.editTechnicalStatusDeactivate(request); |
| | | if (!b) { |
| | | return Result.error("编辑失败!"); |
| | | } |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "停用加工设备申请单-提交") |
| | | @ApiOperation(value = "停用加工设备申请单-提交", notes = "停用加工设备申请单-提交") |
| | | @GetMapping("/submit") |
| | | public Result<?> submit(@RequestParam(name = "id") String id) { |
| | | boolean b = eamTechnicalStatusDeactivateService.submit(id); |
| | | if (!b) { |
| | | return Result.error("提交失败!"); |
| | | } |
| | | return Result.OK("提交成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "停用加工设备申请单-作废") |
| | | @ApiOperation(value = "停用加工设备申请单-作废", notes = "停用加工设备申请单-作废") |
| | | @GetMapping("/abolish") |
| | | public Result<?> abolish(@RequestParam(name = "id") String id) { |
| | | EamTechnicalStatusDeactivate entity = eamTechnicalStatusDeactivateService.getById(id); |
| | | if (entity == null) { |
| | | return Result.error("要作废的数据不存在,请刷新重试!"); |
| | | } |
| | | if (!TechnicalStatusDeactivateStatusEnum.WAIT_SUBMIT.name().equals(entity.getApplicationStatus())) { |
| | | return Result.error("该状态的数据不允许进行作废!"); |
| | | } |
| | | entity.setApplicationStatus(TechnicalStatusDeactivateStatusEnum.ABOLISH.name()); |
| | | eamTechnicalStatusDeactivateService.updateById(entity); |
| | | return Result.OK("作废成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "技术状态变更申请-审批") |
| | | @ApiOperation(value = "技术状态变更申请-审批", notes = "技术状态变更申请-审批") |
| | | @PostMapping("/approval") |
| | | public Result<?> approval(@RequestBody EamTechnicalStatusDeactivateRequest request) { |
| | | if (request == null) { |
| | | return Result.error("审批的对象不能为空!"); |
| | | } |
| | | // 检查请求参数 |
| | | if (StrUtil.isBlank(request.getTaskId()) || StrUtil.isBlank(request.getDataId()) || StrUtil.isBlank(request.getInstanceId())) { |
| | | return Result.error("审批任务错误或不存在!"); |
| | | } |
| | | EamTechnicalStatusDeactivate b = eamTechnicalStatusDeactivateService.approval(request); |
| | | if (b == null) { |
| | | return Result.error("操作失败!"); |
| | | } |
| | | return Result.ok("操作成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "停用加工设备申请单-通过id查询") |
| | | @ApiOperation(value = "停用加工设备申请单-通过id查询", notes = "停用加工设备申请单-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | EamTechnicalStatusDeactivate eamTechnicalStatusDeactivate = eamTechnicalStatusDeactivateService.getById(id); |
| | | return Result.OK(eamTechnicalStatusDeactivate); |
| | | } |
| | | } |