feat: vote 接口添加是否推送给家长字段

11111
winter 1 year ago
parent 8f7b1f9cc1
commit 6d631563c6

@ -9,8 +9,8 @@ import lombok.Data;
*/
@Data
public class PageableRequest {
@ApiModelProperty("当前页码")
@ApiModelProperty("当前页码, 默认: 0")
private Integer current = 0;
@ApiModelProperty("每页数量")
@ApiModelProperty("每页数量, 默认: 10")
private Integer size = 10;
}

@ -19,8 +19,11 @@ public class AppraiseVoteDto {
@ApiModelProperty(value = "评价对象类型:", allowableValues = "student ,class")
private String targetType;
@ApiModelProperty(value = "评分是否传播到班级下的所有学生(字段仅在 targetType=class 时生效)")
@ApiModelProperty(value = "评分是否传播到班级下的所有学生(评价 CLASS 时生效)")
private boolean spread;
@ApiModelProperty(value = "是否推送给家长(评价 STUDENT 时生效)")
private boolean pushParent;
/**
* id
*/

@ -21,6 +21,7 @@ public class AppraiseRecordItem {
* , null
*/
private Boolean spread;
private Boolean pushParent;
String creator;
String creatorId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

@ -235,6 +235,7 @@ public class EvaluationServiceImpl implements EvaluationService {
public void vote(AppraiseVoteDto appraiseVoteDto) {
String targetId = appraiseVoteDto.getTargetId();
boolean spread = appraiseVoteDto.isSpread();
boolean pushParent = appraiseVoteDto.isPushParent();
String targetType = appraiseVoteDto.getTargetType();
String appraiseId = appraiseVoteDto.getAppraiseId();
User loginUser = SecurityUtil.getLoginUser();
@ -293,6 +294,12 @@ public class EvaluationServiceImpl implements EvaluationService {
item.setCreator(loginUser.getName());
item.setCreatorId(loginUser.getId());
item.setCreateTime(LocalDateTime.now());
// 处理学校与学生的差异
if (targetType.equals(TARGET_CLASS)){
item.setSpread(spread);
} else {
item.setPushParent(pushParent);
}
// 不存在或者学生的班级不一样则创建一条新的,存在则处理一下分值后再向其 nodes 中插入一条 item
if (record == null || !classId.equals(record.getClassId())) {
@ -312,10 +319,7 @@ public class EvaluationServiceImpl implements EvaluationService {
record.setCode(String.format(PK.PK_APPRAISE_RECORD, schoolId));
appraiseRecordRepository.save(record);
} else {
// 处理学校与学生的差异
if (targetType.equals(TARGET_CLASS)){
item.setSpread(spread);
}
CosmosPatchOperations operations = CosmosPatchOperations.create();
operations.add("/nodes/0", item);
// 表扬

Loading…
Cancel
Save