基于mall4j产品的二开项目后端
lee
2024-12-18 efdb99f8cecc4afb592afad79c761081d5d5cf22
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.yami.shop.api.controller;
 
import com.yami.shop.common.response.ResponseEnum;
import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.security.api.util.SecurityUtils;
import com.yami.shop.task.common.service.TaskUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
 
@RestController
@RequestMapping("/p/taskRule")
@Tag(name = "任务规则API")
public class TaskRuleController {
 
    @Autowired
    private TaskUserService taskUserService;
 
    @GetMapping("/updateTaskStatus")
    @Operation(summary = "修改用户任务状态")
    public ServerResponseEntity<?> updateTaskStatus(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "status") Integer status) {
       String userId =  SecurityUtils.getUser().getUserId();
        Integer num = taskUserService.updateTaskStatus(taskId,status,userId);
        if(num >0 ){
            return ServerResponseEntity.success(ResponseEnum.OK.getMsg());
        }else{
            return ServerResponseEntity.showFailMsg(ResponseEnum.ERROR.getMsg());
        }
    }
}