refactor: 将接口文档名称标识"

11111
winter 12 months ago
parent 9f77aa9ede
commit 327e399d5a

@ -4,6 +4,7 @@ import cn.teammodel.common.R;
import cn.teammodel.controller.admin.service.AdminAppraiseService;
import cn.teammodel.model.dto.admin.UpdateAchievementRuleDto;
import cn.teammodel.model.entity.appraise.AchievementRule;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@ -17,6 +18,7 @@ import java.util.List;
*/
@RestController
@RequestMapping("admin/appraise")
@Api(tags = "管理员端-学生评价管理")
public class AdminAppraiseController {
@Resource
private AdminAppraiseService adminAppraiseService;

@ -5,6 +5,7 @@ import cn.teammodel.controller.admin.service.AdminAppraiseService;
import cn.teammodel.model.dto.admin.TimeRangeDto;
import cn.teammodel.model.vo.admin.*;
import cn.teammodel.model.vo.appraise.RecordVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@ -19,6 +20,7 @@ import java.util.List;
*/
@RestController
@RequestMapping("admin/index")
@Api(tags = "管理员端-首页数据")
public class IndexController {
@Resource
private AdminAppraiseService adminAppraiseService;

@ -7,6 +7,7 @@ import cn.teammodel.model.dto.ai.UpdateSessionDto;
import cn.teammodel.model.entity.ai.ChatSession;
import cn.teammodel.service.ChatMessageService;
import cn.teammodel.service.ChatSessionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
@ -19,6 +20,7 @@ import java.util.concurrent.CompletableFuture;
@RestController
@RequestMapping("/ai")
@Api(tags = "AI 能力")
public class AiController {
@Resource
private ChatSessionService chatSessionService;

@ -7,6 +7,7 @@ import cn.teammodel.model.entity.appraise.Appraise;
import cn.teammodel.model.vo.appraise.AppraiseRecordVo;
import cn.teammodel.model.vo.appraise.StudentReportVo;
import cn.teammodel.service.EvaluationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -23,6 +24,7 @@ import java.util.List;
*/
@RestController
@RequestMapping("/appraise")
@Api(tags = "学生评价")
public class AppraiseController {
@Resource
private EvaluationService evaluationService;

@ -1,17 +1,17 @@
package cn.teammodel.controller.frontend;
import cn.teammodel.common.IdRequest;
import cn.teammodel.common.R;
import cn.teammodel.model.dto.weekDuty.DeleteDutyNodeDto;
import cn.teammodel.model.dto.weekDuty.DutyVoteDto;
import cn.teammodel.model.dto.weekDuty.InsertDutyNodeDto;
import cn.teammodel.model.dto.weekDuty.UpdateDutyNodeDto;
import cn.teammodel.model.dto.weekDuty.*;
import cn.teammodel.model.entity.weekDuty.WeekDuty;
import cn.teammodel.service.DutyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/**
* @author winter
@ -19,6 +19,7 @@ import javax.validation.Valid;
*/
@RestController
@RequestMapping("/duty")
@Api(tags = "值周巡检")
public class DutyController {
@Resource
private DutyService dutyService;
@ -58,6 +59,20 @@ public class DutyController {
return R.success("评价成功");
}
@PostMapping("/insertSpot")
@ApiOperation("插入值周评价地点")
public R<List<WeekDuty.DutySpot>> insertSpot(@RequestBody @Valid InsertSpotDto insertSpotDto) {
List<WeekDuty.DutySpot> spots = dutyService.insertSpot(insertSpotDto);
return R.success(spots);
}
@PostMapping("/deleteSpot")
@ApiOperation("删除值周评价地点")
public R<List<WeekDuty.DutySpot>> deleteSpot(@RequestBody @Valid IdRequest idRequest) {
List<WeekDuty.DutySpot> spots = dutyService.deleteSpot(idRequest.getId());
return R.success(spots);
}

@ -2,6 +2,7 @@ package cn.teammodel.controller.frontend;
import cn.teammodel.common.R;
import cn.teammodel.repository.AppraiseRepository;
import io.swagger.annotations.Api;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
@ -12,6 +13,7 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("/")
@Api(tags = "鉴权测试")
public class HelloController {
@Resource

@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.PositiveOrZero;
/**
* @author winter
@ -19,6 +20,7 @@ public class InsertDutyNodeDto {
String name;
String desc;
Integer order = 0;
@PositiveOrZero(message = "score 不能为负数")
Integer score = 0;
// Boolean positive = true;
Boolean positive = true;
}

@ -0,0 +1,18 @@
package cn.teammodel.model.dto.weekDuty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @author winter
* @create 2024-01-03 10:45
*/
@Data
public class InsertSpotDto {
@ApiModelProperty(value = "地点名称", required = true)
@NotBlank(message = "name 不能为空")
private String name;
}

@ -3,6 +3,7 @@ package cn.teammodel.model.entity.weekDuty;
import cn.teammodel.model.entity.BaseItem;
import com.azure.spring.data.cosmos.core.mapping.Container;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -49,6 +50,7 @@ public class WeekDuty extends BaseItem {
private Long createTime;
}
@Data
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class DutySpot {
private String id;

@ -1,11 +1,10 @@
package cn.teammodel.service;
import cn.teammodel.model.dto.weekDuty.DeleteDutyNodeDto;
import cn.teammodel.model.dto.weekDuty.DutyVoteDto;
import cn.teammodel.model.dto.weekDuty.InsertDutyNodeDto;
import cn.teammodel.model.dto.weekDuty.UpdateDutyNodeDto;
import cn.teammodel.model.dto.weekDuty.*;
import cn.teammodel.model.entity.weekDuty.WeekDuty;
import java.util.List;
/**
* @author winter
* @create 2024-01-03 10:07
@ -21,4 +20,7 @@ public interface DutyService {
void vote(DutyVoteDto dutyVoteDto);
List<WeekDuty.DutySpot> insertSpot(InsertSpotDto insertSpotDto);
List<WeekDuty.DutySpot> deleteSpot(String id);
}

@ -4,10 +4,7 @@ import cn.hutool.core.lang.UUID;
import cn.teammodel.common.ErrorCode;
import cn.teammodel.common.PK;
import cn.teammodel.config.exception.ServiceException;
import cn.teammodel.model.dto.weekDuty.DeleteDutyNodeDto;
import cn.teammodel.model.dto.weekDuty.DutyVoteDto;
import cn.teammodel.model.dto.weekDuty.InsertDutyNodeDto;
import cn.teammodel.model.dto.weekDuty.UpdateDutyNodeDto;
import cn.teammodel.model.dto.weekDuty.*;
import cn.teammodel.model.entity.User;
import cn.teammodel.model.entity.school.ClassInfo;
import cn.teammodel.model.entity.school.School;
@ -76,7 +73,8 @@ public class DutyServiceImpl implements DutyService {
String pid = insertDutyNodeDto.getPid();
String name = insertDutyNodeDto.getName();
Integer order = insertDutyNodeDto.getOrder();
Integer score = insertDutyNodeDto.getScore();
Boolean positive = insertDutyNodeDto.getPositive();
Integer score = positive ? insertDutyNodeDto.getScore() : -insertDutyNodeDto.getScore();
String desc = insertDutyNodeDto.getDesc();
User user = SecurityUtil.getLoginUser();
@ -115,7 +113,7 @@ public class DutyServiceImpl implements DutyService {
newNode.setDesc(desc);
newNode.setPath(path);
newNode.setScore(score);
newNode.setPositive(score >= 0);
newNode.setPositive(positive);
}
}
@ -273,6 +271,38 @@ public class DutyServiceImpl implements DutyService {
}
}
@Override
public List<WeekDuty.DutySpot> insertSpot(InsertSpotDto insertSpotDto) {
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
WeekDuty duty = dutyRepository.findBySchoolIdAndCode(schoolId, PK.WEEK_DUTY);
if (duty == null) {
throw new ServiceException("值周树不存在");
}
String name = insertSpotDto.getName();
CosmosPatchOperations operations = CosmosPatchOperations.create().add("/spots/-", new WeekDuty.DutySpot(UUID.randomUUID().toString(), name));
duty = dutyRepository.save(
duty.getId(),
PK.of(PK.WEEK_DUTY),
WeekDuty.class,
operations
);
return duty.getSpots();
}
@Override
public List<WeekDuty.DutySpot> deleteSpot(String id) {
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
WeekDuty duty = dutyRepository.findBySchoolIdAndCode(schoolId, PK.WEEK_DUTY);
if (duty == null) {
throw new ServiceException("值周树不存在");
}
List<WeekDuty.DutySpot> spots = duty.getSpots();
WeekDuty.DutySpot spot = spots.stream().filter(x -> id.equals(x.getId())).findFirst().orElseThrow(() -> new ServiceException("值周评价地点不存在"));
spots.remove(spot);
duty = dutyRepository.save(duty);
return duty.getSpots();
}
/**
* spots id
*/

Loading…
Cancel
Save