| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | 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.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.entity.EamSecondMaintenanceOrderDetail; |
| | | import org.jeecg.modules.eam.service.IEamSecondMaintenanceOrderDetailService; |
| | | import org.jeecg.modules.eam.vo.InspectionVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | /** |
| | | * @Description: 设备二级保养明细 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-04-29 |
| | |
| | | @Slf4j |
| | | @Api(tags="设备二级保养明细") |
| | | @RestController |
| | | @RequestMapping("/eam/eamSecondMaintenanceOrderDetail") |
| | | @RequestMapping("/eam/secondMaintenanceOrderDetail") |
| | | public class EamSecondMaintenanceOrderDetailController extends JeecgController<EamSecondMaintenanceOrderDetail, IEamSecondMaintenanceOrderDetailService> { |
| | | @Autowired |
| | | private IEamSecondMaintenanceOrderDetailService eamSecondMaintenanceOrderDetailService; |
| | | |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param eamSecondMaintenanceOrderDetail |
| | | * @param orderId |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设备二级保养明细-分页列表查询") |
| | | @ApiOperation(value="设备二级保养明细-分页列表查询", notes="设备二级保养明细-分页列表查询") |
| | | @ApiOperation(value = "周保工单明细-分页列表查询", notes = "周保工单明细-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamSecondMaintenanceOrderDetail eamSecondMaintenanceOrderDetail, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<EamSecondMaintenanceOrderDetail> queryWrapper = QueryGenerator.initQueryWrapper(eamSecondMaintenanceOrderDetail, req.getParameterMap()); |
| | | Page<EamSecondMaintenanceOrderDetail> page = new Page<EamSecondMaintenanceOrderDetail>(pageNo, pageSize); |
| | | public Result<?> queryPageList(@RequestParam("orderId") String orderId, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | LambdaQueryWrapper<EamSecondMaintenanceOrderDetail> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(EamSecondMaintenanceOrderDetail::getOrderId, orderId); |
| | | queryWrapper.orderByAsc(EamSecondMaintenanceOrderDetail::getItemCode); |
| | | Page<EamSecondMaintenanceOrderDetail> page = new Page<>(pageNo, pageSize); |
| | | IPage<EamSecondMaintenanceOrderDetail> pageList = eamSecondMaintenanceOrderDetailService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 一次加载 |
| | | * |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "周保工单明细-不分页列表查询", notes = "周保工单明细-不分页列表查询") |
| | | @GetMapping(value = "/queryList") |
| | | public Result<?> queryList(@RequestParam("orderId") String orderId) { |
| | | LambdaQueryWrapper<EamSecondMaintenanceOrderDetail> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(EamSecondMaintenanceOrderDetail::getOrderId, orderId); |
| | | queryWrapper.orderByAsc(EamSecondMaintenanceOrderDetail::getItemCode); |
| | | List<EamSecondMaintenanceOrderDetail> list = eamSecondMaintenanceOrderDetailService.list(queryWrapper); |
| | | return Result.OK(list); |
| | | } |
| | | |
| | | /** |
| | | * 报表使用 qsw |
| | | * 2025-6-19 |
| | | */ |
| | | @GetMapping("/findExceptionDescriptionAll") |
| | | public JSONObject findInspectionUser(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, |
| | | @RequestParam Map<String, Object> params) { |
| | | |
| | | String orderId = (String)params.get("id"); |
| | | |
| | | List<EamSecondMaintenanceOrderDetail> details = new ArrayList<>(); |
| | | List<EamSecondMaintenanceOrderDetail> list = eamSecondMaintenanceOrderDetailService.lambdaQuery() |
| | | .eq(EamSecondMaintenanceOrderDetail::getOrderId, orderId) |
| | | .eq(EamSecondMaintenanceOrderDetail::getMaintenanceResult, "2") |
| | | .list(); |
| | | EamSecondMaintenanceOrderDetail detail = new EamSecondMaintenanceOrderDetail(); |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | int index = 1; |
| | | for (EamSecondMaintenanceOrderDetail item : list) { |
| | | String value = item.getExceptionDescription(); |
| | | if (value != null && !value.isEmpty()) { // 跳过null和空字符串 |
| | | sb.append(index).append(". ").append(value).append(System.lineSeparator()); |
| | | index++; |
| | | } |
| | | } |
| | | // 移除最后一个多余的换行符(可选) |
| | | if (sb.length() > 0) { |
| | | sb.setLength(sb.length() - System.lineSeparator().length()); |
| | | } |
| | | |
| | | String s = sb.toString(); |
| | | detail.setExceptionDescription(s); |
| | | details.add(detail); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("data",details); |
| | | return jsonObject; |
| | | } |
| | | } |