| | |
| | | package org.jeecg.modules.qms.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | import java.net.URLDecoder; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.qms.entity.InspectionItem; |
| | | import org.jeecg.modules.qms.entity.InspectionTools; |
| | | import org.jeecg.modules.qms.service.IInspectionItemService; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.jeecg.modules.qms.service.IInspectionToolsService; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | |
| | | public class InspectionItemController extends JeecgController<InspectionItem, IInspectionItemService> { |
| | | @Autowired |
| | | private IInspectionItemService inspectionItemService; |
| | | |
| | | @Autowired |
| | | private IInspectionToolsService inspectionToolsService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | return super.importExcel(request, response, InspectionItem.class); |
| | | } |
| | | |
| | | @AutoLog(value = "检验项目-启用&禁用") |
| | | @ApiOperation(value = "检验项目-启用&禁用", notes = "检验项目-启用&禁用") |
| | | @PutMapping(value = "/active") |
| | | public Result<?> active(@RequestParam(name = "id", required = true) String id) { |
| | | InspectionItem inspectionItem = inspectionItemService.getById(id); |
| | | if (CommonConstant.STATUS_1.equals(inspectionItem.getItemStatus())) { |
| | | inspectionItem.setItemStatus(CommonConstant.STATUS_0); |
| | | } else { |
| | | inspectionItem.setItemStatus(CommonConstant.STATUS_1); |
| | | } |
| | | inspectionItemService.updateById(inspectionItem); |
| | | return Result.ok("操作成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param inspectionItem |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="检验项目-分页列表查询", notes="检验项目-分页列表查询") |
| | | @GetMapping(value = "/queryList") |
| | | public Result<?> queryList(InspectionItem inspectionItem, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | @RequestParam Map<String, String> query) { |
| | | IPage<Map<String, Object>> pageList = inspectionItemService.queryList(pageNo,pageSize, query); |
| | | for(Map<String, Object> r : pageList.getRecords()){ |
| | | String inspectionTools = (String) r.get("inspectionTools"); |
| | | if(StringUtils.isNotBlank(inspectionTools)){ |
| | | List<String> inspectionToolsList = Arrays.asList(inspectionTools.split(",")); |
| | | List<String> inspectionToolsNameList = new ArrayList<>(); |
| | | String inspectionToolsNames = ""; |
| | | for(String inspectionTool : inspectionToolsList){ |
| | | InspectionTools inspectionTools1 = inspectionToolsService.getById(inspectionTool); |
| | | if(inspectionTools1 != null){ |
| | | inspectionToolsNameList.add(inspectionTools1.getToolName()); |
| | | } |
| | | } |
| | | inspectionToolsNames = inspectionToolsNameList.stream() |
| | | .collect(Collectors.joining(",")); |
| | | r.put("inspectionToolsNames",inspectionToolsNames); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据检验方案id查询 |
| | | * |
| | | * @param inspectionPlanId |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="检验项目-分页列表查询", notes="检验项目-分页列表查询") |
| | | @GetMapping(value = "/queryListByPlanId") |
| | | public Result<?> queryListByPlanId(String inspectionPlanId, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) { |
| | | IPage<Map<String, Object>> pageList = inspectionItemService.queryListByPlanId(pageNo,pageSize, inspectionPlanId); |
| | | for(Map<String, Object> r : pageList.getRecords()){ |
| | | String inspectionTools = (String) r.get("inspectionTools"); |
| | | if(StringUtils.isNotBlank(inspectionTools)){ |
| | | List<String> inspectionToolsList = Arrays.asList(inspectionTools.split(",")); |
| | | List<String> inspectionToolsNameList = new ArrayList<>(); |
| | | String inspectionToolsNames = ""; |
| | | for(String inspectionTool : inspectionToolsList){ |
| | | InspectionTools inspectionTools1 = inspectionToolsService.getById(inspectionTool); |
| | | if(inspectionTools1 != null){ |
| | | inspectionToolsNameList.add(inspectionTools1.getToolName()); |
| | | } |
| | | } |
| | | inspectionToolsNames = inspectionToolsNameList.stream() |
| | | .collect(Collectors.joining(",")); |
| | | r.put("inspectionToolsNames",inspectionToolsNames); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | } |