| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.dto.InsOrderPlanDTO; |
| | | import com.yuanchu.mom.dto.InsProductDto; |
| | | import com.yuanchu.mom.pojo.InsOrderFile; |
| | | import com.yuanchu.mom.service.InsOrderFileService; |
| | | import com.yuanchu.mom.service.InsOrderPlanService; |
| | | import com.yuanchu.mom.service.InsProductService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/insOrderPlan") |
| | | @Api(tags = "检验任务") |
| | | @AllArgsConstructor |
| | | public class InsOrderPlanController { |
| | | |
| | | private InsOrderPlanService insOrderPlanService; |
| | | |
| | | private InsOrderFileService insOrderFileService; |
| | | |
| | | private InsProductService insProductService; |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "获取检验任务列表") |
| | | @PostMapping("/selectInsOrderPlanList") |
| | | public Result selectInsOrderPlanList(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | page.setOptimizeCountSql(false); |
| | | InsOrderPlanDTO insOrderPlanDTO = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), InsOrderPlanDTO.class); |
| | | return Result.success(insOrderPlanService.selectInsOrderPlanList(page, insOrderPlanDTO)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "检验单详情-任务切换") |
| | | @PostMapping("/inspectionOrderDetailsTaskSwitching") |
| | | public Result inspectionOrderDetailsTaskSwitching(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | page.setOptimizeCountSql(false); |
| | | InsOrderPlanDTO insOrderPlanDTO = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), InsOrderPlanDTO.class); |
| | | return Result.success(insOrderPlanService.inspectionOrderDetailsTaskSwitching(page, insOrderPlanDTO)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "认领任务计划") |
| | | @PostMapping("/claimInsOrderPlan") |
| | | public Result claimInsOrderPlan(@RequestBody InsOrderPlanDTO data) { |
| | | return Result.success(insOrderPlanService.claimInsOrderPlan(data)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "执行检验操作") |
| | | @PostMapping("/doInsOrder") |
| | | public Result<?> doInsOrder(Integer id, String laboratory) { |
| | | return Result.success(insOrderPlanService.doInsOrder(id, laboratory)); |
| | | } |
| | | |
| | | @ApiOperation(value = "切换光纤/光纤带记录模版查询检验内容") |
| | | @PostMapping("/getReportModel") |
| | | @ValueAuth |
| | | public Result<?> getReportModel(Integer sampleId) { |
| | | return Result.success(insOrderPlanService.getReportModel(sampleId)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @PostMapping("/getInsProduct") |
| | | @ApiOperation("获取检验项目和模板内容") |
| | | public Result<?> getInsProduct(Integer id, Integer type, String laboratory, HttpServletRequest request) { |
| | | return Result.success(insOrderPlanService.getInsProduct(id, type, laboratory, request)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "任务交接") |
| | | @PostMapping("/upPlanUser") |
| | | public Result<?> upPlanUser(Integer userId, Integer orderId,String sonLaboratory) { |
| | | return Result.success(insOrderPlanService.upPlanUser(userId, orderId, sonLaboratory)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "判断交接的试验室") |
| | | @PostMapping("/upPlanUser2") |
| | | public Result<?> upPlanUser2(Integer orderId) { |
| | | return Result.success(insOrderPlanService.upPlanUser2(orderId)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "复核检验任务") |
| | | @PostMapping("/verifyPlan") |
| | | public Result<?> verifyPlan(Integer orderId, String laboratory, Integer type, String tell) { |
| | | return Result.success(insOrderPlanService.verifyPlan(orderId, laboratory, type, tell)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "校验检验任务提交") |
| | | @PostMapping("/checkSubmitPlan") |
| | | public Result<?> checkSubmitPlan(Integer orderId, String laboratory) { |
| | | return Result.success(insOrderPlanService.checkSubmitPlan(orderId, laboratory)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "检验任务提交") |
| | | @PostMapping("/submitPlan") |
| | | public Result<?> submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode, String sampleCode) { |
| | | int num = insOrderPlanService.submitPlan(orderId, laboratory, verifyUser, entrustCode, sampleCode); |
| | | return num == 1 ? Result.success() : Result.fail("提交失败,部分项目还未进行检验"); |
| | | } |
| | | |
| | | @ValueClassify("设备") |
| | | @ApiOperation(value = "是否允许修改采集值") |
| | | @DeleteMapping("/isItAllowedToModifyTheCollectedValues") |
| | | public Result<?> isItAllowedToModifyTheCollectedValues() { |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "保存检验内容") |
| | | @PostMapping("/saveInsContext") |
| | | @ValueAuth |
| | | public Result<?> saveInsContext(String param) { |
| | | Map<String, Object> param2 = JSON.parseObject(param, Map.class); |
| | | insOrderPlanService.saveInsContext(param2); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "查看检验单下的附件列表") |
| | | @PostMapping("/getFileList") |
| | | public Result<?> getFileList(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | page.setOptimizeCountSql(false); |
| | | InsOrderFile insOrderFile = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), InsOrderFile.class); |
| | | return Result.success(insOrderPlanService.getFileList(page, insOrderFile)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "上传附件") |
| | | @PostMapping("/uploadFile") |
| | | public Result<?> uploadFile(Integer orderId, MultipartFile file) { |
| | | return Result.success(insOrderPlanService.uploadFile(orderId, file)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "删除附件") |
| | | @PostMapping("/delfile") |
| | | public Result<?> delfile(Integer id) { |
| | | return Result.success(insOrderFileService.removeById(id)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "下载附件") |
| | | @PostMapping("/downFile") |
| | | public Result<?> downFile(Integer id) { |
| | | InsOrderFile insOrderFile = insOrderFileService.getById(id); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("type", insOrderFile.getType()); |
| | | map.put("fileUrl", insOrderFile.getFileUrl()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "填写温度与湿度") |
| | | @PostMapping("/write") |
| | | @ValueAuth |
| | | public Result<?> write(@RequestBody InsProductDto insProductDto) { |
| | | return Result.success(insProductService.write(insProductDto)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "温度循环查看列表数据(包括通过样品id,循环次数,温度,循环次数进行筛选)") |
| | | @PostMapping("/temCycle") |
| | | public Result<?> temCycle(Integer sampleId, String inspectionItem, String inspectionItemSubclass) { |
| | | return Result.success(insOrderPlanService.temCycle(sampleId, inspectionItem, inspectionItemSubclass)); |
| | | } |
| | | } |