package org.jeecg.modules.userCode.controller;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.modules.bean.LoginReq;
import org.jeecg.modules.postBean.ReqUserRole;
import org.jeecg.modules.postBean.ReqUserRole2;
import org.jeecg.modules.tbTask.entity.TbTask;
import org.jeecg.modules.tbTask.service.ITbTaskService;
import org.jeecg.modules.userCode.model.req.TaskReq;
import org.jeecg.modules.userCode.model.req.TaskReq2;
import org.jeecg.modules.userCode.service.AppletLoginService;
import org.jeecg.modules.userCode.service.UserService;
import org.jeecg.modules.utils.ValidateTool;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * 服务化 system模块 对外接口请求类
 *
 * @author: jeecg-boot
 */
@Slf4j
@RestController
@RequestMapping("/order")
@Api(tags = "订单相关接口")
public class OrderController {

    @Resource
    private AppletLoginService appletLoginService;
    @Resource
    private UserService userService;
    @Resource
    private ITbTaskService tbTaskService;




    @ApiOperation(value = "公司发布任务", notes = "发布任务")
    @PostMapping(value = "/addTask")
    public Result<String> addTask(@RequestBody TaskReq tbTask, @RequestHeader("X-Access-Token") String token) {
        if (ValidateTool.isNull(tbTask)) {
            throw new JeecgBootException("请填写资料");
        }
        userService.addTask(tbTask, token);
        return Result.OK("添加成功！");
    }





}
