package org.jeecg.modules.eam.controller;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.apache.shiro.SecurityUtils;
|
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.common.system.vo.LoginUser;
|
import org.jeecg.modules.eam.entity.MaintenanceOrderActualWorkingHour;
|
import org.jeecg.modules.eam.entity.SpecialtyMaintenanceOrder;
|
import org.jeecg.modules.eam.service.IMaintenanceOrderActualWorkingHourService;
|
import org.jeecg.modules.eam.service.IPredictiveWorkOrderService;
|
import org.jeecg.modules.eam.service.ISpecialtyMaintenanceOrderService;
|
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.math.BigDecimal;
|
import java.util.Arrays;
|
import java.util.Date;
|
import java.util.Map;
|
|
@RestController
|
@RequestMapping("/eam/predictiveworkorder")
|
@Slf4j
|
public class PredictiveWorkOrderController extends JeecgController<SpecialtyMaintenanceOrder, ISpecialtyMaintenanceOrderService> {
|
|
@Autowired
|
private IPredictiveWorkOrderService predictiveWorkOrderService;
|
|
@Autowired
|
private IMaintenanceOrderActualWorkingHourService maintenanceOrderActualWorkingHourService;
|
|
/**
|
* 分页列表查询
|
*
|
* @param specialtyMaintenanceOrder
|
* @param pageNo
|
* @param pageSize
|
* @param req
|
* @return
|
*/
|
//@AutoLog(value = "mom_eam_specialty_maintenance_order-分页列表查询")
|
// @ApiOperation(value = "mom_eam_specialty_maintenance_order-分页列表查询", notes = "mom_eam_specialty_maintenance_order-分页列表查询")
|
// @GetMapping(value = "/list")
|
// public Result<IPage<SpecialtyMaintenanceOrder>> queryPageList(SpecialtyMaintenanceOrder specialtyMaintenanceOrder,
|
// @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
// @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
// HttpServletRequest req) {
|
// QueryWrapper<SpecialtyMaintenanceOrder> queryWrapper = QueryGenerator.initQueryWrapper(specialtyMaintenanceOrder, req.getParameterMap());
|
// Page<SpecialtyMaintenanceOrder> page = new Page<SpecialtyMaintenanceOrder>(pageNo, pageSize);
|
// IPage<SpecialtyMaintenanceOrder> pageList = specialtyMaintenanceOrderService.page(page, queryWrapper);
|
// return Result.OK(pageList);
|
// }
|
|
/**
|
* 获取专业保养工单
|
* 2023-4-25 qsw
|
*/
|
@GetMapping(value = "/pageOrderList")
|
public Result<?> pageOrderList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) {
|
IPage<Map<String, Object>> specialtyMaintenanceOrderList = predictiveWorkOrderService.pageOrderList(pageNo, pageSize, params);
|
// for (Map<String, Object> record : specialtyMaintenanceOrderList.getRecords()) {
|
// String id = (String) record.get("id");
|
//
|
// QueryWrapper<MaintenanceOrderActualWorkingHour> actualWorkingHourWrapper = new QueryWrapper<>();
|
// actualWorkingHourWrapper.eq("maintenance_order_id", id)
|
// .eq("del_flag", 0);
|
// actualWorkingHourWrapper.select("sum(actual_working_hour_quota) as actualQuantity");
|
// Map<String, Object> map = maintenanceOrderActualWorkingHourService.getMap(actualWorkingHourWrapper);
|
// BigDecimal actualQuantity = new BigDecimal(0);
|
// if (map != null) {
|
// actualQuantity = (BigDecimal) map.get("actualQuantity");
|
// }
|
// record.put("actualWorkingHourQuota", actualQuantity);
|
//
|
// String status = (String) record.get("status");
|
// if ("2".equals(status)) {
|
// record.put("distable", false);
|
// } else {
|
// record.put("distable", true);
|
// }
|
// }
|
return Result.ok(specialtyMaintenanceOrderList);
|
}
|
|
/**
|
* 添加
|
*
|
* @param specialtyMaintenanceOrder
|
* @return
|
*/
|
// @AutoLog(value = "mom_eam_specialty_maintenance_order-添加")
|
// @ApiOperation(value = "mom_eam_specialty_maintenance_order-添加", notes = "mom_eam_specialty_maintenance_order-添加")
|
// //@RequiresPermissions("org.jeecg.modules:mom_eam_specialty_maintenance_order:add")
|
// @PostMapping(value = "/add")
|
// public Result<String> add(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
|
// boolean b = specialtyMaintenanceOrderService.add(specialtyMaintenanceOrder);
|
// if (b) {
|
// return Result.OK("添加成功!");
|
// }
|
// return Result.error("添加失败!");
|
// }
|
//
|
// /**
|
// * 编辑
|
// *
|
// * @param specialtyMaintenanceOrder
|
// * @return
|
// */
|
// @AutoLog(value = "mom_eam_specialty_maintenance_order-编辑")
|
// @ApiOperation(value = "mom_eam_specialty_maintenance_order-编辑", notes = "mom_eam_specialty_maintenance_order-编辑")
|
// //@RequiresPermissions("org.jeecg.modules:mom_eam_specialty_maintenance_order:edit")
|
// @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
// public Result<String> edit(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
|
// boolean b = specialtyMaintenanceOrderService.edit(specialtyMaintenanceOrder);
|
// if (b) {
|
// return Result.OK("编辑成功!");
|
// }
|
// return Result.error("编辑失败!");
|
// }
|
//
|
//
|
// @RequestMapping(value = "/editStatus", method = {RequestMethod.PUT, RequestMethod.POST})
|
// public Result<String> editStatus(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
|
// specialtyMaintenanceOrder.setActualStartTime(new Date());
|
// boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder);
|
// if (b) {
|
// return Result.OK("下发成功!");
|
// } else {
|
// return Result.error("下发失败!");
|
// }
|
// }
|
//
|
// @RequestMapping(value = "/report", method = {RequestMethod.PUT, RequestMethod.POST})
|
// public Result<String> report(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
|
// specialtyMaintenanceOrder.setActualEndTime(new Date());
|
// boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder);
|
// if (!b) {
|
// return Result.error("报工失败!");
|
// } else {
|
// return Result.ok("报工成功!");
|
// }
|
// }
|
//
|
// @RequestMapping(value = "/revocation", method = {RequestMethod.PUT, RequestMethod.POST})
|
// public Result<String> revocation(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
|
// String id = specialtyMaintenanceOrder.getId();
|
// SpecialtyMaintenanceOrder maintenanceOrder = specialtyMaintenanceOrderService.getById(id);
|
// String status = maintenanceOrder.getStatus();
|
// if ("5".equals(status)) {
|
// maintenanceOrder.setActualEndTime(null);
|
// boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder);
|
// if (b) {
|
// return Result.OK("撤销成功!");
|
// } else {
|
// return Result.error("撤销失败!");
|
// }
|
// } else {
|
// return Result.error("仅限已完工状态撤销完成操作!");
|
// }
|
// }
|
//
|
// @RequestMapping(value = "/orderGet", method = {RequestMethod.PUT, RequestMethod.POST})
|
// public Result<String> orderGet(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
|
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
// String userId = sysUser.getId();
|
// specialtyMaintenanceOrder.setRecipientUserId(userId);
|
// specialtyMaintenanceOrder.setMaintenanceUserId(userId);
|
// specialtyMaintenanceOrder.setStatus("3");
|
// boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder);
|
// if (b) {
|
// return Result.OK("领取成功!");
|
// } else {
|
// return Result.error("领取失败!");
|
// }
|
// }
|
//
|
// /**
|
// * 通过id删除
|
// *
|
// * @param id
|
// * @return
|
// */
|
// @AutoLog(value = "mom_eam_specialty_maintenance_order-通过id删除")
|
// @ApiOperation(value = "mom_eam_specialty_maintenance_order-通过id删除", notes = "mom_eam_specialty_maintenance_order-通过id删除")
|
// //@RequiresPermissions("org.jeecg.modules:mom_eam_specialty_maintenance_order:delete")
|
// @DeleteMapping(value = "/delete")
|
// public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
// specialtyMaintenanceOrderService.removeById(id);
|
// return Result.OK("删除成功!");
|
// }
|
//
|
// /**
|
// * 批量删除
|
// *
|
// * @param ids
|
// * @return
|
// */
|
// @AutoLog(value = "mom_eam_specialty_maintenance_order-批量删除")
|
// @ApiOperation(value = "mom_eam_specialty_maintenance_order-批量删除", notes = "mom_eam_specialty_maintenance_order-批量删除")
|
// //@RequiresPermissions("org.jeecg.modules:mom_eam_specialty_maintenance_order:deleteBatch")
|
// @DeleteMapping(value = "/deleteBatch")
|
// public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
// this.specialtyMaintenanceOrderService.removeByIds(Arrays.asList(ids.split(",")));
|
// return Result.OK("批量删除成功!");
|
// }
|
//
|
// /**
|
// * 通过id查询
|
// *
|
// * @param id
|
// * @return
|
// */
|
// //@AutoLog(value = "mom_eam_specialty_maintenance_order-通过id查询")
|
// @ApiOperation(value = "mom_eam_specialty_maintenance_order-通过id查询", notes = "mom_eam_specialty_maintenance_order-通过id查询")
|
// @GetMapping(value = "/queryById")
|
// public Result<SpecialtyMaintenanceOrder> queryById(@RequestParam(name = "id", required = true) String id) {
|
// SpecialtyMaintenanceOrder specialtyMaintenanceOrder = specialtyMaintenanceOrderService.getById(id);
|
// if (specialtyMaintenanceOrder == null) {
|
// return Result.error("未找到对应数据");
|
// }
|
// return Result.OK(specialtyMaintenanceOrder);
|
// }
|
//
|
// /**
|
// * 导出excel
|
// *
|
// * @param request
|
// * @param specialtyMaintenanceOrder
|
// */
|
// //@RequiresPermissions("org.jeecg.modules:mom_eam_specialty_maintenance_order:exportXls")
|
// @RequestMapping(value = "/exportXls")
|
// public ModelAndView exportXls(HttpServletRequest request, SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
|
// return super.exportXls(request, specialtyMaintenanceOrder, SpecialtyMaintenanceOrder.class, "mom_eam_specialty_maintenance_order");
|
// }
|
//
|
// /**
|
// * 通过excel导入数据
|
// *
|
// * @param request
|
// * @param response
|
// * @return
|
// */
|
// //@RequiresPermissions("mom_eam_specialty_maintenance_order:importExcel")
|
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
// public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
// return super.importExcel(request, response, SpecialtyMaintenanceOrder.class);
|
// }
|
//
|
// @RequestMapping(value = "/assign", method = {RequestMethod.PUT, RequestMethod.POST})
|
// public Result<String> assign(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
|
// boolean b = specialtyMaintenanceOrderService.assign(specialtyMaintenanceOrder);
|
// if (b) {
|
// return Result.OK("改派成功!");
|
// } else {
|
// return Result.error("改派失败!");
|
// }
|
// }
|
|
|
}
|