XiaoRuby
2023-09-11 e2c14ffb0a6237bb5c397f5d0baaa4fa70cfe3b0
inspect-server/src/main/java/com/yuanchu/mom/controller/InspectUnacceptedController.java
@@ -8,7 +8,6 @@
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.utils.Jwt;
import com.yuanchu.mom.utils.MyUtil;
import com.yuanchu.mom.utils.RedisUtil;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -29,7 +28,6 @@
 * @author zss
 * @since 2023-08-07 10:04:01
 */
@Api(tags = "QMS管理-->不合格品管理")
@RestController
@RequestMapping("/inspectUnaccepted")
public class InspectUnacceptedController {
@@ -43,7 +41,7 @@
    @Autowired
    private OpinionService opinionService;
    @ApiOperation(value = "查询成品不合格品检验单列表", tags = "QMS管理-->不合格品管理")
    @ApiOperation(value = "不合格品管理列表", tags = "QMS管理-->不合格品管理")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "pageSize",value = "页数",dataTypeClass  = Integer.class,required = true),
            @ApiImplicitParam(name = "countSize",value = "条数/页",dataTypeClass  = Integer.class,required = true),
@@ -87,6 +85,20 @@
        return Result.success(map);
    }
    @ApiOperation(value = "评审", tags = "QMS管理-->原材料不合格品")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "rawId",value = "原材料Id",dataTypeClass  = Integer.class,required = true),
            @ApiImplicitParam(name = "passOrNo",value = "是否通过:0:不通过;1:通过",dataTypeClass  = Integer.class,required = true)
    })
    @PostMapping("/evaluatePassOrNo")
    public Result<?> rawEvaluate(Integer rawId, Integer passOrNo){
        Integer integer = inspectUnacceptedService.rawEvaluate(rawId, passOrNo);
        if (integer >= 1) {
            return Result.success("评审成功!");
        }
        return Result.fail("评审失败!");
    }
    @ApiOperation(value = "不合格品分页列表", tags = "QMS管理-->不合格品处置")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "pageSize",value = "页数",dataTypeClass  = Integer.class,required = true),
@@ -117,11 +129,12 @@
    @ApiOperation(value = "编辑意见-->确定按钮", tags = "QMS管理-->不合格品处置")
    @PostMapping("/addOpinion")
    public Result<?> updateOpinion(@RequestHeader("token") String token, @Validated @RequestBody List<Opinion> opinion) throws Exception {
    public Result<?> updateOpinion(@RequestHeader("token") String token, @RequestBody Map<String, Object> opinion) throws Exception {
        List<?> opinion1 = JackSonUtil.unmarshal(JackSonUtil.marshal(opinion.get("opinion")), List.class);
        Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class);
        String id = data.get("id").replaceAll("\"", "");
        opinionService.updateOpinion(id, opinion);
        return Result.success();
        opinionService.updateOpinion(id, opinion1);
        return Result.success("添加成功!");
    }
    @ApiOperation(value = "查看编辑意见", tags = "QMS管理-->不合格品处置")
@@ -140,15 +153,19 @@
    })
    @GetMapping("/descriptionUpdate")
    public Result<?> descriptionUpdate(Integer rawUnacceptedId, String tell) {
        return Result.success(inspectUnacceptedService.descriptionUpdate(rawUnacceptedId, tell));
        Integer isUpdateSuccess = inspectUnacceptedService.descriptionUpdate(rawUnacceptedId, tell);
        if (isUpdateSuccess == 1) {
            return Result.success("更新成功");
        }
        return Result.fail("更新失败");
    }
    @ApiOperation(value = "点击编辑意见触发查询", tags = "QMS管理-->不合格品处置")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "rawUnacceptedId",value = "不合格品处置Id",dataTypeClass  = Integer.class,required = true)
    })
    @PostMapping("/clickEditing")
    public Result<?> clickEditingTriggerQuery(Integer rawUnacceptedId) {
    @GetMapping("/clickEditing")
    public Result<?> clickEditingTriggerQuery(@RequestParam("rawUnacceptedId") Integer rawUnacceptedId) {
        return Result.success(opinionService.clickEditingTriggerQuery(rawUnacceptedId));
    }
}