package com.gkhy.hazmat.admin.controller.app;
|
|
|
import com.gkhy.hazmat.common.annotation.RepeatSubmit;
|
import com.gkhy.hazmat.common.api.CommonResult;
|
import com.gkhy.hazmat.system.domain.HzHazmat;
|
import com.gkhy.hazmat.system.service.HzHazmatService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* <p>
|
* 危化品表 前端控制器
|
* </p>
|
*
|
* @author kzy
|
* @since 2024-08-05 14:41:40
|
*/
|
@Api(tags = "APP原材料危化品前端控制器")
|
@RestController
|
@RequestMapping("/app/hazmat")
|
public class AppHazmatController {
|
@Autowired
|
private HzHazmatService hazmatService;
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
|
@ApiOperation(value = "根据条码查询危化品信息")
|
@ApiImplicitParams({
|
@ApiImplicitParam(paramType = "query", name = "code", dataType = "string", required = true, value = "条码code")
|
})
|
@GetMapping("/getHazmatByCode")
|
public CommonResult getHazmatByCode(@RequestParam(required = true) String code){
|
return CommonResult.success(hazmatService.selectHazmatByCode(code));
|
}
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
|
@RepeatSubmit
|
@ApiOperation(value = "领用")
|
@PostMapping(value = { "/hazmatUse/{hazmatId}" })
|
public CommonResult hazmatUse(@PathVariable(value = "hazmatId", required = true) Long hazmatId,@RequestParam(defaultValue = "0",required = true) Integer used){
|
hazmatService.hazmatUse(hazmatId,used);
|
return CommonResult.success();
|
}
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
|
@RepeatSubmit
|
@ApiOperation(value = "归还")
|
@PostMapping(value = { "/hazmatReturn" })
|
public CommonResult hazmatReturn(@RequestBody HzHazmat hazmat){
|
hazmatService.hazmatReturn(hazmat);
|
return CommonResult.success();
|
}
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
|
@RepeatSubmit
|
@ApiOperation(value = "用尽登记")
|
@PostMapping(value = { "/hazmatUsed/{hazmatId}" })
|
public CommonResult hazmatUsed(@PathVariable(value = "hazmatId", required = true) Long hazmatId){
|
hazmatService.hazmatUsed(hazmatId);
|
return CommonResult.success();
|
}
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
|
@RepeatSubmit
|
@ApiOperation(value = "二维码作废")
|
@PostMapping(value = { "/hazmatDiscard/{hazmatId}" })
|
public CommonResult hazmatDiscard(@PathVariable(value = "hazmatId", required = true) Long hazmatId){
|
hazmatService.hazmatDiscard(hazmatId);
|
return CommonResult.success();
|
}
|
}
|