AccidentCarController.java 1.75 KB
package cn.fw.valhalla.controller.app;

import cn.fw.common.web.annotation.ControllerMethod;
import cn.fw.common.web.auth.LoginAuthBean;
import cn.fw.common.web.auth.annotation.CurrentUser;
import cn.fw.data.base.domain.common.Message;
import cn.fw.security.auth.client.annotation.Authorization;
import cn.fw.security.auth.client.enums.AuthType;
import cn.fw.valhalla.domain.dto.AccidentPoolDTO;
import cn.fw.valhalla.service.bus.cust.AccidentPoolBizService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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 javax.validation.Valid;

import static cn.fw.common.web.util.ResultBuilder.success;

/**
 * @author : kurisu
 * @className : AccidentCarController
 * @description : 事故车处理控制器
 * @date: 2020-08-15 14:52
 */
@Slf4j
@RestController
@Authorization(AuthType.APP)
@Validated
@RequestMapping("/app/accident")
public class AccidentCarController {

    private final AccidentPoolBizService accidentPoolBizService;

    @Autowired
    public AccidentCarController(final AccidentPoolBizService accidentPoolBizService) {
        this.accidentPoolBizService = accidentPoolBizService;
    }

    @PostMapping("/pool/save")
    @ControllerMethod("新增事故车线索")
    public Message<Long> save(@CurrentUser LoginAuthBean currentUser,
                              @RequestBody @Valid final AccidentPoolDTO accidentPoolDTO) {
        return success(accidentPoolBizService.add2Pool(currentUser, accidentPoolDTO));
    }
}