| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.constant.MajorPartialRepairStatusEnum; |
| | | import org.jeecg.modules.eam.entity.EamMajorPartialRepair; |
| | | import org.jeecg.modules.eam.entity.EamMajorPartialRepairDetail; |
| | | import org.jeecg.modules.eam.request.EamMajorPartialRepairQuery; |
| | | import org.jeecg.modules.eam.service.IEamMajorPartialRepairService; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.entity.ImportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | |
| | | /** |
| | | * @Description: 大修项修 |
| | | * @Description: eam_major_partial_repair |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-05-13 |
| | | * @Date: 2025-06-20 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags="大修项修") |
| | | @Api(tags="eam_major_partial_repair") |
| | | @RestController |
| | | @RequestMapping("/eam/eamMajorPartialRepair") |
| | | @Slf4j |
| | | public class EamMajorPartialRepairController extends JeecgController<EamMajorPartialRepair, IEamMajorPartialRepairService> { |
| | | @Autowired |
| | | private IEamMajorPartialRepairService eamMajorPartialRepairService; |
| | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param eamMajorPartialRepair |
| | | * @param query |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "大修项修-分页列表查询") |
| | | @ApiOperation(value="大修项修-分页列表查询", notes="大修项修-分页列表查询") |
| | | //@AutoLog(value = "eam_major_partial_repair-分页列表查询") |
| | | @ApiOperation(value="eam_major_partial_repair-分页列表查询", notes="eam_major_partial_repair-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamMajorPartialRepair eamMajorPartialRepair, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<EamMajorPartialRepair> queryWrapper = QueryGenerator.initQueryWrapper(eamMajorPartialRepair, req.getParameterMap()); |
| | | public Result<IPage<EamMajorPartialRepair>> queryPageList(EamMajorPartialRepairQuery query, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | Page<EamMajorPartialRepair> page = new Page<EamMajorPartialRepair>(pageNo, pageSize); |
| | | IPage<EamMajorPartialRepair> pageList = eamMajorPartialRepairService.page(page, queryWrapper); |
| | | IPage<EamMajorPartialRepair> pageList = eamMajorPartialRepairService.queryPageList(page, query); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * 添加 |
| | | * |
| | | * @param eamMajorPartialRepair |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "大修项修-添加") |
| | | @ApiOperation(value="大修项修-添加", notes="大修项修-添加") |
| | | @AutoLog(value = "eam_major_partial_repair-添加") |
| | | @ApiOperation(value="eam_major_partial_repair-添加", notes="eam_major_partial_repair-添加") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:add") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamMajorPartialRepair eamMajorPartialRepair) { |
| | | eamMajorPartialRepairService.save(eamMajorPartialRepair); |
| | | public Result<String> add(@RequestBody EamMajorPartialRepair eamMajorPartialRepair) { |
| | | eamMajorPartialRepairService.saveMajorPartialRepair(eamMajorPartialRepair); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑 |
| | | * 编辑 |
| | | * |
| | | * @param eamMajorPartialRepair |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "大修项修-编辑") |
| | | @ApiOperation(value="大修项修-编辑", notes="大修项修-编辑") |
| | | @AutoLog(value = "eam_major_partial_repair-编辑") |
| | | @ApiOperation(value="eam_major_partial_repair-编辑", notes="eam_major_partial_repair-编辑") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EamMajorPartialRepair eamMajorPartialRepair) { |
| | | eamMajorPartialRepairService.updateById(eamMajorPartialRepair); |
| | | public Result<String> edit(@RequestBody EamMajorPartialRepair eamMajorPartialRepair) { |
| | | eamMajorPartialRepairService.updateMajorPartialRepair(eamMajorPartialRepair); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "eam_major_partial_repair-提交") |
| | | @ApiOperation(value="eam_major_partial_repair-提交", notes="eam_major_partial_repair-提交") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:submit") |
| | | @GetMapping(value = "/submit") |
| | | public Result<String> submit(@RequestParam("id") String id) { |
| | | EamMajorPartialRepair majorPartialRepair = eamMajorPartialRepairService.getById(id); |
| | | if (Objects.isNull(majorPartialRepair)) { |
| | | return Result.error("要提交的维修单不存在,请刷新重试!"); |
| | | } |
| | | if (!MajorPartialRepairStatusEnum.PENDING_SUBMISSION.name().equals(majorPartialRepair.getRepairStatus())) { |
| | | return Result.error("该状态的维修单不能提交!"); |
| | | } |
| | | majorPartialRepair.setRepairStatus(MajorPartialRepairStatusEnum.PENDING_CONFIRMATION.name()); |
| | | eamMajorPartialRepairService.updateById(majorPartialRepair); |
| | | return Result.OK("提交成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "eam_major_partial_repair-批量提交") |
| | | @ApiOperation(value="eam_major_partial_repair-批量提交", notes="eam_major_partial_repair-批量提交") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:submit") |
| | | @GetMapping(value = "/submitBatch") |
| | | public Result<String> submitBatch(@RequestParam(name="ids") String ids) { |
| | | List<String> idList = Arrays.asList(ids.split(",")); |
| | | List<EamMajorPartialRepair> submitList = CollectionUtil.newArrayList(); |
| | | idList.forEach(id -> { |
| | | EamMajorPartialRepair majorPartialRepair = eamMajorPartialRepairService.getById(id); |
| | | if (Objects.nonNull(majorPartialRepair) && MajorPartialRepairStatusEnum.PENDING_SUBMISSION.name().equals(majorPartialRepair.getRepairStatus())) { |
| | | majorPartialRepair.setRepairStatus(MajorPartialRepairStatusEnum.PENDING_CONFIRMATION.name()); |
| | | submitList.add(majorPartialRepair); |
| | | } |
| | | }); |
| | | eamMajorPartialRepairService.updateBatchById(submitList); |
| | | return Result.OK("批量提交 " + submitList.size() + " 条维修单!"); |
| | | } |
| | | |
| | | @AutoLog(value = "eam_major_partial_repair-确认") |
| | | @ApiOperation(value="eam_major_partial_repair-确认", notes="eam_major_partial_repair-确认") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:confirm") |
| | | @GetMapping(value = "/confirm") |
| | | public Result<String> confirm(@RequestParam("id") String id) { |
| | | EamMajorPartialRepair majorPartialRepair = eamMajorPartialRepairService.getById(id); |
| | | if (Objects.isNull(majorPartialRepair)) { |
| | | return Result.error("要确认的维修单不存在,请刷新重试!"); |
| | | } |
| | | if (!MajorPartialRepairStatusEnum.PENDING_CONFIRMATION.name().equals(majorPartialRepair.getRepairStatus())) { |
| | | return Result.error("该状态的维修单不能确认!"); |
| | | } |
| | | majorPartialRepair.setRepairStatus(MajorPartialRepairStatusEnum.CONFIRMED.name()); |
| | | majorPartialRepair.setActualStartTime(new Date()); |
| | | eamMajorPartialRepairService.updateById(majorPartialRepair); |
| | | return Result.OK("确认成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "eam_major_partial_repair-批量确认") |
| | | @ApiOperation(value="eam_major_partial_repair-批量确认", notes="eam_major_partial_repair-批量确认") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:confirm") |
| | | @GetMapping(value = "/confirmBatch") |
| | | public Result<String> confirmBatch(@RequestParam(name="ids") String ids) { |
| | | List<String> idList = Arrays.asList(ids.split(",")); |
| | | List<EamMajorPartialRepair> confirmList = CollectionUtil.newArrayList(); |
| | | idList.forEach(id -> { |
| | | EamMajorPartialRepair majorPartialRepair = eamMajorPartialRepairService.getById(id); |
| | | if (Objects.nonNull(majorPartialRepair) && MajorPartialRepairStatusEnum.PENDING_CONFIRMATION.name().equals(majorPartialRepair.getRepairStatus())) { |
| | | majorPartialRepair.setRepairStatus(MajorPartialRepairStatusEnum.CONFIRMED.name()); |
| | | majorPartialRepair.setActualStartTime(new Date()); |
| | | confirmList.add(majorPartialRepair); |
| | | } |
| | | }); |
| | | eamMajorPartialRepairService.updateBatchById(confirmList); |
| | | return Result.OK("批量确认 " + confirmList.size() + " 条维修单!"); |
| | | } |
| | | |
| | | @AutoLog(value = "eam_major_partial_repair-作废") |
| | | @ApiOperation(value="eam_major_partial_repair-作废", notes="eam_major_partial_repair-作废") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:repeal") |
| | | @GetMapping(value = "/repeal") |
| | | public Result<String> repeal(@RequestParam("id") String id) { |
| | | EamMajorPartialRepair majorPartialRepair = eamMajorPartialRepairService.getById(id); |
| | | if (Objects.isNull(majorPartialRepair)) { |
| | | return Result.error("要作废的维修单不存在,请刷新重试!"); |
| | | } |
| | | if (!MajorPartialRepairStatusEnum.CONFIRMED.name().equals(majorPartialRepair.getRepairStatus())) { |
| | | return Result.error("该状态的维修单不能作废!"); |
| | | } |
| | | majorPartialRepair.setRepairStatus(MajorPartialRepairStatusEnum.INVALIDATED.name()); |
| | | eamMajorPartialRepairService.updateById(majorPartialRepair); |
| | | return Result.OK("作废成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "eam_major_partial_repair-批量作废") |
| | | @ApiOperation(value="eam_major_partial_repair-批量作废", notes="eam_major_partial_repair-批量作废") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:repeal") |
| | | @GetMapping(value = "/repealBatch") |
| | | public Result<String> repealBatch(@RequestParam(name="ids") String ids) { |
| | | List<String> idList = Arrays.asList(ids.split(",")); |
| | | List<EamMajorPartialRepair> repealList = CollectionUtil.newArrayList(); |
| | | idList.forEach(id -> { |
| | | EamMajorPartialRepair majorPartialRepair = eamMajorPartialRepairService.getById(id); |
| | | if (Objects.nonNull(majorPartialRepair) && MajorPartialRepairStatusEnum.PENDING_SUBMISSION.name().equals(majorPartialRepair.getRepairStatus())) { |
| | | majorPartialRepair.setRepairStatus(MajorPartialRepairStatusEnum.INVALIDATED.name()); |
| | | repealList.add(majorPartialRepair); |
| | | } |
| | | }); |
| | | eamMajorPartialRepairService.updateBatchById(repealList); |
| | | return Result.OK("批量作废 " + repealList.size() + " 条维修单!"); |
| | | } |
| | | |
| | | @AutoLog(value = "eam_major_partial_repair-结果填报") |
| | | @ApiOperation(value="eam_major_partial_repair-结果填报", notes="eam_major_partial_repair-结果填报") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:fillResult") |
| | | @RequestMapping(value = "/fillResult", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<String> fillResult(@RequestBody List<EamMajorPartialRepairDetail> detailList) { |
| | | eamMajorPartialRepairService.fillResult(detailList); |
| | | return Result.OK("结果填报成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "大修项修-通过id删除") |
| | | @ApiOperation(value="大修项修-通过id删除", notes="大修项修-通过id删除") |
| | | @AutoLog(value = "eam_major_partial_repair-通过id删除") |
| | | @ApiOperation(value="eam_major_partial_repair-通过id删除", notes="eam_major_partial_repair-通过id删除") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
| | | public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | eamMajorPartialRepairService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "大修项修-批量删除") |
| | | @ApiOperation(value="大修项修-批量删除", notes="大修项修-批量删除") |
| | | @AutoLog(value = "eam_major_partial_repair-批量删除") |
| | | @ApiOperation(value="eam_major_partial_repair-批量删除", notes="eam_major_partial_repair-批量删除") |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.eamMajorPartialRepairService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "大修项修-通过id查询") |
| | | @ApiOperation(value="大修项修-通过id查询", notes="大修项修-通过id查询") |
| | | //@AutoLog(value = "eam_major_partial_repair-通过id查询") |
| | | @ApiOperation(value="eam_major_partial_repair-通过id查询", notes="eam_major_partial_repair-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
| | | public Result<EamMajorPartialRepair> queryById(@RequestParam(name="id",required=true) String id) { |
| | | EamMajorPartialRepair eamMajorPartialRepair = eamMajorPartialRepairService.getById(id); |
| | | if(eamMajorPartialRepair==null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | return Result.OK(eamMajorPartialRepair); |
| | | } |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param eamMajorPartialRepair |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EamMajorPartialRepair eamMajorPartialRepair) { |
| | | return super.exportXls(request, eamMajorPartialRepair, EamMajorPartialRepair.class, "大修项修"); |
| | | } |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param eamMajorPartialRepair |
| | | */ |
| | | //@RequiresPermissions("org.jeecg.modules:eam_major_partial_repair:exportXls") |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EamMajorPartialRepair eamMajorPartialRepair) { |
| | | return super.exportXls(request, eamMajorPartialRepair, EamMajorPartialRepair.class, "eam_major_partial_repair"); |
| | | } |
| | | |
| | | /** |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, EamMajorPartialRepair.class); |
| | | } |
| | | /** |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | //@RequiresPermissions("eam_major_partial_repair:importExcel") |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, EamMajorPartialRepair.class); |
| | | } |
| | | |
| | | } |