| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | 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.*; |
| | | import com.yuanchu.mom.mapper.InsSampleUserMapper; |
| | | import com.yuanchu.mom.pojo.InsOrderFile; |
| | | import com.yuanchu.mom.service.InsOrderFileService; |
| | | import com.yuanchu.mom.service.InsOrderPlanService; |
| | | import com.yuanchu.mom.pojo.InsOrderState; |
| | | import com.yuanchu.mom.pojo.InsProductResult; |
| | | import com.yuanchu.mom.pojo.InsSampleUser; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.vo.InsProductResultVo; |
| | | 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.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | public class InsOrderPlanController { |
| | | |
| | | private InsOrderPlanService insOrderPlanService; |
| | | private InsOrderUserService insOrderUserService; |
| | | |
| | | private InsOrderFileService insOrderFileService; |
| | | |
| | | private InsProductService insProductService; |
| | | private InsOrderStateService insOrderStateService; |
| | | |
| | | private InsSampleUserMapper insSampleUserMapper; |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "获取检验任务列表") |
| | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "执行检验操作") |
| | | @PostMapping("/doInsOrder") |
| | | public Result<?> doInsOrder(Integer id, String laboratory) { |
| | | return Result.success(insOrderPlanService.doInsOrder(id, laboratory)); |
| | | } |
| | | |
| | | @ApiOperation(value = "切换光纤/光纤带记录模版查询检验内容") |
| | | @PostMapping("/getReportModel") |
| | | public Result<?> getReportModel(Integer orderId) { |
| | | return Result.success(insOrderPlanService.getReportModel(orderId)); |
| | | public Result<?> doInsOrder(Integer sampleId, String laboratory) { |
| | | return Result.success(insOrderPlanService.doInsOrder(sampleId, laboratory)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @PostMapping("/getInsProduct") |
| | | @ApiOperation("获取检验项目和模板内容") |
| | | public Result<?> getInsProduct(Integer id, Integer type, String laboratory) { |
| | | return Result.success(insOrderPlanService.getInsProduct(id, type, laboratory)); |
| | | //这里的id就是样品id |
| | | 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) { |
| | | return Result.success(insOrderPlanService.upPlanUser(userId, orderId)); |
| | | public Result<?> upPlanUser(Integer userId, Integer sampleId, String sonLaboratory) { |
| | | return Result.success(insOrderPlanService.upPlanUser(userId, sampleId, sonLaboratory)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "判断交接的试验室") |
| | | @PostMapping("/upPlanUser2") |
| | | public Result<?> upPlanUser2(Integer sampleId) { |
| | | return Result.success(insOrderPlanService.upPlanUser2(sampleId)); |
| | | } |
| | | |
| | | @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)); |
| | | public Result<?> verifyPlan(Integer sampleId, String laboratory, Integer type, String tell) throws IOException { |
| | | return Result.success(insOrderPlanService.verifyPlan(sampleId, laboratory, type, tell)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "校验检验任务提交") |
| | | @PostMapping("/checkSubmitPlan") |
| | | public Result<?> checkSubmitPlan(Integer orderId, String laboratory) { |
| | | return Result.success(insOrderPlanService.checkSubmitPlan(orderId, laboratory)); |
| | | public Result<?> checkSubmitPlan(Integer sampleId, String laboratory) { |
| | | return Result.success(insOrderPlanService.checkSubmitPlan(sampleId, laboratory)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "检验任务提交") |
| | | @PostMapping("/submitPlan") |
| | | public Result<?> submitPlan(Integer orderId, String laboratory, Integer verifyUser) { |
| | | int num = insOrderPlanService.submitPlan(orderId, laboratory, verifyUser); |
| | | public Result<?> submitPlan(@RequestBody SubmitPlanDto submitPlanDto) { |
| | | int num = insOrderPlanService.submitPlan(submitPlanDto); |
| | | return num == 1 ? Result.success() : Result.fail("提交失败,部分项目还未进行检验"); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "检验任务撤销提交") |
| | | @PostMapping("/cancelSubmitPlan") |
| | | public Result cancelSubmitPlan(Integer orderStateId) { |
| | | return Result.success(insOrderPlanService.cancelSubmitPlan(orderStateId)); |
| | | } |
| | | |
| | | @ValueClassify("设备") |
| | | @ApiOperation(value = "是否允许修改采集值") |
| | | @DeleteMapping("/isItAllowedToModifyTheCollectedValues") |
| | | public Result<?> isItAllowedToModifyTheCollectedValues() { |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "保存检验内容") |
| | | @PostMapping("/saveInsContext") |
| | | @ValueAuth |
| | | public Result<?> saveInsContext(String param) { |
| | | public Result<?> saveInsContext(String param, Integer num) { |
| | | Map<String, Object> param2 = JSON.parseObject(param, Map.class); |
| | | insOrderPlanService.saveInsContext(param2); |
| | | insOrderPlanService.saveInsContext(param2, num); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "电路试验的保存检验内容") |
| | | @PostMapping("/saveInsContext2") |
| | | @ValueAuth |
| | | public Result<?> saveInsContext2(@RequestBody InsProductResultDto insProductResultDtos) { |
| | | return Result.success(insOrderPlanService.saveInsContext2(insProductResultDtos)); |
| | | } |
| | | |
| | | @ApiOperation(value = "电路试验的保存检验内容(返回/提交)") |
| | | @PostMapping("/saveInsContext2s") |
| | | @ValueAuth |
| | | public Result<?> saveInsContext2s(@RequestBody InsProductResultDtos insProductResultDtos) { |
| | | return Result.success(insOrderPlanService.saveInsContext2s(insProductResultDtos)); |
| | | } |
| | | |
| | | @ApiOperation(value = "温湿度试验+功率试验的保存检验内容") |
| | | @PostMapping("/saveInsContext3") |
| | | @ValueAuth |
| | | public Result<?> saveInsContext3(@RequestBody InsProductResult insProductResult) { |
| | | return Result.success(insOrderPlanService.saveInsContext3(insProductResult)); |
| | | } |
| | | |
| | | @ValueAuth |
| | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "上传附件") |
| | | @PostMapping("/uploadFile") |
| | | public Result<?> uploadFile(Integer orderId, MultipartFile file) { |
| | | return Result.success(insOrderPlanService.uploadFile(orderId, file)); |
| | | public Result<?> uploadFile(Integer orderId, MultipartFile file, String sonLaboratory,Integer sampleId) { |
| | | return Result.success(insOrderPlanService.uploadFile(orderId, file, sonLaboratory,sampleId)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "删除附件") |
| | | @PostMapping("/delfile") |
| | | public Result<?> delfile(Integer id) { |
| | | return Result.success(insOrderFileService.removeById(id)); |
| | | return Result.success(insOrderFileService.delfile(id)); |
| | | } |
| | | |
| | | @ValueAuth |
| | |
| | | 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)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "插队操作") |
| | | @PostMapping("/jumpTeam") |
| | | public Result<?> jumpTeam(@RequestBody InsOrderState insOrderState) { |
| | | return Result.success(insOrderStateService.jumpTeam(insOrderState)); |
| | | } |
| | | |
| | | @ApiOperation(value = "电路试验的删除频段") |
| | | @PostMapping("/deleteInsContext") |
| | | @ValueAuth |
| | | public Result<?> deleteInsContext(@RequestBody InsProductResultVo insProductResultVo) { |
| | | return Result.success(insOrderPlanService.deleteInsContext(insProductResultVo)); |
| | | } |
| | | |
| | | @ApiOperation(value = "电路试验点击检验选择版本") |
| | | @PostMapping("/chooseVersion") |
| | | @ValueAuth |
| | | public Result<?> chooseVersion(Integer orderStateId, Integer version) { |
| | | InsOrderState orderState = new InsOrderState(); |
| | | orderState.setId(orderStateId); |
| | | orderState.setVersion(version); |
| | | return Result.success(insOrderStateService.updateById(orderState)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @PostMapping("/getInsOrderUserList") |
| | | @ApiOperation("查看检验历史列表") |
| | | public Result<?> getInsOrderUserList(Integer insOrderStateId) { |
| | | return Result.success(insOrderPlanService.getInsOrderUserList(insOrderStateId)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @PostMapping("/getInsProduct2") |
| | | @ApiOperation("查看检验历史") |
| | | //这里的id是样品id |
| | | public Result<?> getInsProduct2(Integer id, Integer type, String laboratory, HttpServletRequest request, Integer num) { |
| | | return Result.success(insOrderPlanService.getInsProduct2(id, type, laboratory, request, num)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "扫码报检(入库)") |
| | | @PostMapping("/scanInsOrderState") |
| | | public Result scanInsOrderState(String sonLaboratory, String sampleCode, String trees,String entrustCode) { |
| | | return Result.success(insOrderPlanService.scanInsOrderState(sonLaboratory, sampleCode, trees,entrustCode)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "扫码出库") |
| | | @PostMapping("/outInsOrderState") |
| | | public Result outInsOrderState(String sonLaboratory, String sampleCode,String entrustCode) { |
| | | return Result.success(insOrderPlanService.outInsOrderState(sonLaboratory, sampleCode,entrustCode)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @PostMapping("/preview") |
| | | @ApiOperation("预览文件") |
| | | public Result<?> preview(Integer id) throws Exception { |
| | | return Result.success(insOrderPlanService.preview(id)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @PostMapping("/getCheckUser") |
| | | @ApiOperation("获取当前检验任务的所有检验员信息") |
| | | //这里的传参是样品id,等检验任务那块全改了之后这里就没问题 |
| | | public Result<?> getCheckUser(Integer id,String sonLaboratory) { |
| | | List<InsSampleUser> insSampleUsers = insSampleUserMapper.selectList(Wrappers.<InsSampleUser>lambdaQuery() |
| | | .eq(InsSampleUser::getState, 0) //检验人 |
| | | .eq(InsSampleUser::getInsSampleId, id) |
| | | .eq(InsSampleUser::getSonLaboratory, sonLaboratory)); |
| | | return Result.success(insSampleUsers); |
| | | } |
| | | |
| | | } |