package cn.hanghui.outapi.platform.ldrk.controller;

import cn.hanghui.outapi.platform.common.annotation.DecryptBySm2;
import cn.hanghui.outapi.platform.common.annotation.DecryptParam;
import cn.hanghui.outapi.platform.common.controller.BaseController;
import cn.hanghui.outapi.platform.common.entity.rest.Result;
import cn.hanghui.outapi.platform.ldrk.entity.dto.LdrkReportDto;
import cn.hanghui.outapi.platform.ldrk.service.LdrkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Api(tags = "流动人口API服务")
@RestController
@RequestMapping("ldrkApi")
@AllArgsConstructor(onConstructor_ = @Autowired)
public class LdrkController extends BaseController {

    private final LdrkService ldrkService;

    /**
     * 流动人口自主申报
     *
     * @param ldrkReportDto LdrkReportDto
     * @return Result<Void>
     */
    @DecryptBySm2()
    @ApiOperation("流动人口自主申报")
    @PostMapping("reportPersonInfo")
    public Result<Void> reportPersonInfo(HttpServletRequest request, @DecryptParam LdrkReportDto ldrkReportDto) {
        ldrkService.reportPersonInfo(ldrkReportDto, getUserName(request));
        return Result.ok();
    }
}
