| | |
| | | */ |
| | | package org.springblade.modules.evaluate.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.modules.evaluate.dto.EvaluateTaskDTO; |
| | | import org.springblade.modules.evaluate.entity.EvaluateTaskEntity; |
| | | import org.springblade.modules.evaluate.excel.EvaluateTaskExcel; |
| | | import org.springblade.modules.evaluate.service.IEvaluateTaskService; |
| | | import org.springblade.modules.evaluate.vo.EvaluateTaskVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.evaluate.wrapper.EvaluateTaskWrapper; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springblade.modules.system.wrapper.UserWrapper; |
| | | import org.springblade.modules.utils.DateUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 评优任务表 控制器 |
| | | * |
| | | * @author aix |
| | | * @since 2023-12-08 |
| | | * @since 2024-01-05 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | |
| | | public class EvaluateTaskController extends BladeController { |
| | | |
| | | private final IEvaluateTaskService evaluateTaskService; |
| | | private final IUserService userService; |
| | | |
| | | /** |
| | | * 评优任务表 详情 |
| | |
| | | return R.data(EvaluateTaskWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | @GetMapping("/taskList/{deptId}/{userId}") |
| | | public R taskList(@ApiIgnore @PathVariable Long deptId,@ApiIgnore @PathVariable Long userId) { |
| | | QueryWrapper<EvaluateTaskEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.or().like("candidate_num",deptId).or().like("candidate_num",userId); |
| | | List<EvaluateTaskEntity> list = evaluateTaskService.list(wrapper); |
| | | return R.data(EvaluateTaskWrapper.build().listVO(list)); |
| | | /** |
| | | * H5使用-评优任务列表 |
| | | * @param evaluateTask |
| | | * @param query |
| | | * @return 返回自己是否投票和投票集合 |
| | | */ |
| | | @GetMapping("/selfList") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入evaluateTask") |
| | | public R<IPage<EvaluateTaskVO>> selfList(EvaluateTaskEntity evaluateTask, Query query) { |
| | | IPage<EvaluateTaskEntity> pages = evaluateTaskService.page(Condition.getPage(query), Condition.getQueryWrapper(evaluateTask)); |
| | | return R.data(EvaluateTaskWrapper.build().h5ReferremPageVO(pages)); |
| | | } |
| | | @GetMapping("/taskListByPolling") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入evaluateTask") |
| | | public R<IPage<EvaluateTaskVO>> taskListByPolling(EvaluateTaskEntity evaluateTask, Query query) { |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | if (null != evaluateTask.getType()) |
| | | queryWrapper.eq("type", evaluateTask.getType()); |
| | | User user = userService.getById(AuthUtil.getUser().getUserId()); |
| | | queryWrapper.like("polling_persons" , user.getEmployeeType()); |
| | | IPage<EvaluateTaskEntity> pages = evaluateTaskService.page(Condition.getPage(query), queryWrapper); |
| | | return R.data(EvaluateTaskWrapper.build().h5CandidatePageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门id获取用户列表 |
| | | * @param query 分页 |
| | | * @param user 用户参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/userList") |
| | | @ApiOperation(value = "分页", notes = "传入user") |
| | | public R<IPage<UserVO>> userList(Query query,User user) { |
| | | if (StringUtil.isBlank(user.getDeptId())) |
| | | return R.fail(-1,"部门id不能为空"); |
| | | QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user); |
| | | IPage<User> pages = userService.page(Condition.getPage(query), queryWrapper); |
| | | return R.data(UserWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入evaluateTask") |
| | | public R save(@Valid @RequestBody EvaluateTaskEntity evaluateTask) { |
| | | return R.status(evaluateTaskService.save(evaluateTask)); |
| | | public R save(@Valid @RequestBody EvaluateTaskDTO dto) { |
| | | return R.status(evaluateTaskService.saveTaskAndCategory(dto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入evaluateTask") |
| | | public R submit(@Valid @RequestBody EvaluateTaskEntity evaluateTask) { |
| | | if (DateUtils.isToday(evaluateTask.getEvaluateCutoffTimeStart())) {//是否今天开始 |
| | | evaluateTask.setEvaluateState(1); |
| | | } |
| | | return R.status(evaluateTaskService.saveOrUpdate(evaluateTask)); |
| | | } |
| | | |