新增接口艺术模块pdf操作,新增智育模块API 分组内容

develop
zhouj1203@hotmail.com 4 months ago
parent bfb5eb7beb
commit 8198da6fa5

@ -3,9 +3,12 @@ package cn.teammodel.controller.admin.controller;
import cn.teammodel.common.R; import cn.teammodel.common.R;
import cn.teammodel.controller.admin.service.ArtService; import cn.teammodel.controller.admin.service.ArtService;
import cn.teammodel.model.dto.admin.art.ArtFindDto; import cn.teammodel.model.dto.admin.art.ArtFindDto;
import cn.teammodel.model.dto.admin.art.DataFileCommentDto;
import cn.teammodel.model.dto.admin.art.DataFileDto;
import cn.teammodel.model.dto.admin.common.GroupDto; import cn.teammodel.model.dto.admin.common.GroupDto;
import cn.teammodel.model.dto.admin.common.RGroupList; import cn.teammodel.model.dto.admin.common.RGroupList;
import cn.teammodel.model.vo.admin.ArtElementsVo; import cn.teammodel.model.vo.admin.ArtElementsVo;
import cn.teammodel.model.vo.admin.DataFileVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -35,5 +38,17 @@ public class ArtController {
List<RGroupList> res = ArtService.getGroupList(groupDto,request); List<RGroupList> res = ArtService.getGroupList(groupDto,request);
return R.success(res); return R.success(res);
} }
@PostMapping("getPdfData")
@ApiOperation("请求学生的pdf数据文件")
public R<List<DataFileVo>> getPdfData(@Valid @RequestBody DataFileDto dataFileDto, HttpServletRequest request) {
List<DataFileVo> res = ArtService.getPdfData(dataFileDto,request);
return R.success(res);
}
@PostMapping("updateComment")
@ApiOperation("更新评论")
public R<List<DataFileVo>> updateComment(@Valid @RequestBody DataFileCommentDto dataFileCommentDto, HttpServletRequest request) {
List<DataFileVo> res = ArtService.updateComment(dataFileCommentDto,request);
return R.success(res);
}
} }

@ -0,0 +1,33 @@
package cn.teammodel.controller.admin.controller;
import cn.teammodel.common.R;
import cn.teammodel.controller.admin.service.ExamService;
import cn.teammodel.model.dto.admin.art.ArtFindDto;
import cn.teammodel.model.dto.admin.exam.OverViewDto;
import cn.teammodel.model.vo.admin.ArtElementsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("admin/exam")
@Api(tags = "管理员端-智育分析")
public class ExamController {
@Resource
private ExamService examService;
@PostMapping("getOverView")
@ApiOperation("获取当前学校艺术评测列表")
public R<Map<String, Object>> getOverView(@Valid @RequestBody OverViewDto overViewDto, HttpServletRequest request) {
Map<String, Object> res = examService.getAnalysis(overViewDto,request);
return R.success(res);
}
}

@ -1,9 +1,12 @@
package cn.teammodel.controller.admin.service; package cn.teammodel.controller.admin.service;
import cn.teammodel.model.dto.admin.art.ArtFindDto; import cn.teammodel.model.dto.admin.art.ArtFindDto;
import cn.teammodel.model.dto.admin.art.DataFileCommentDto;
import cn.teammodel.model.dto.admin.art.DataFileDto;
import cn.teammodel.model.dto.admin.common.GroupDto; import cn.teammodel.model.dto.admin.common.GroupDto;
import cn.teammodel.model.dto.admin.common.RGroupList; import cn.teammodel.model.dto.admin.common.RGroupList;
import cn.teammodel.model.vo.admin.ArtElementsVo; import cn.teammodel.model.vo.admin.ArtElementsVo;
import cn.teammodel.model.vo.admin.DataFileVo;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
@ -11,4 +14,6 @@ import java.util.List;
public interface ArtService { public interface ArtService {
List<ArtElementsVo> getArtList(ArtFindDto artFindDto, HttpServletRequest request); List<ArtElementsVo> getArtList(ArtFindDto artFindDto, HttpServletRequest request);
List<RGroupList> getGroupList(GroupDto groupDto, HttpServletRequest request); List<RGroupList> getGroupList(GroupDto groupDto, HttpServletRequest request);
List<DataFileVo> getPdfData(DataFileDto dataFileDto,HttpServletRequest request);
List<DataFileVo> updateComment(DataFileCommentDto dataFileCommentDto, HttpServletRequest request);
} }

@ -0,0 +1,10 @@
package cn.teammodel.controller.admin.service;
import cn.teammodel.model.dto.admin.exam.OverViewDto;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
public interface ExamService {
Map<String,Object> getAnalysis(OverViewDto overViewDto, HttpServletRequest request);
}

@ -1,11 +1,16 @@
package cn.teammodel.controller.admin.service.impl; package cn.teammodel.controller.admin.service.impl;
import cn.teammodel.common.ErrorCode;
import cn.teammodel.config.exception.ServiceException;
import cn.teammodel.controller.admin.service.ArtService; import cn.teammodel.controller.admin.service.ArtService;
import cn.teammodel.model.dto.admin.art.ArtFindDto; import cn.teammodel.model.dto.admin.art.ArtFindDto;
import cn.teammodel.model.dto.admin.art.DataFileCommentDto;
import cn.teammodel.model.dto.admin.art.DataFileDto;
import cn.teammodel.model.dto.admin.common.GroupDto; import cn.teammodel.model.dto.admin.common.GroupDto;
import cn.teammodel.model.dto.admin.common.RGroupList; import cn.teammodel.model.dto.admin.common.RGroupList;
import cn.teammodel.model.dto.admin.common.RMember; import cn.teammodel.model.dto.admin.common.RMember;
import cn.teammodel.model.vo.admin.ArtElementsVo; import cn.teammodel.model.vo.admin.ArtElementsVo;
import cn.teammodel.model.vo.admin.DataFileVo;
import cn.teammodel.repository.ArtRepository; import cn.teammodel.repository.ArtRepository;
import cn.teammodel.repository.ClassRepository; import cn.teammodel.repository.ClassRepository;
import cn.teammodel.repository.StudentRepository; import cn.teammodel.repository.StudentRepository;
@ -75,7 +80,7 @@ public class ArtServiceImpl implements ArtService {
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
} }
return artElementsVos; return artElementsVos;
} }
@ -97,9 +102,53 @@ public class ArtServiceImpl implements ArtService {
} }
}catch (Exception e) { }catch (Exception e) {
throw new RuntimeException(e); throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
} }
return rGroupList; return rGroupList;
} }
@Override
public List<DataFileVo> getPdfData(DataFileDto dataFileDto,HttpServletRequest request) {
List<DataFileVo> dataFile = new ArrayList<>();
String url = env.getProperty("ies.server-url-pdf-data");
try {
Map<String, Object> groupId = GroupUtil.getGroupId(dataFileDto,new GroupUtil(env), request,url);
//List<RMember> rMembers = new ArrayList<>();
for (Map.Entry<String, Object> entry : groupId.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (key.equals("dataFiles")) {
String jsonGroups = JSON.toJSONString(value);
dataFile = JSON.parseObject(jsonGroups, new TypeReference<List<DataFileVo>>() {});
}
}
}catch (Exception e) {
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
}
return dataFile;
}
@Override
public List<DataFileVo> updateComment(DataFileCommentDto dataFileCommentDto, HttpServletRequest request) {
List<DataFileVo> dataFile = new ArrayList<>();
String url = env.getProperty("ies.server-url-update-custom-comment");
try {
Map<String, Object> groupId = GroupUtil.getGroupId(dataFileCommentDto,new GroupUtil(env), request,url);
//List<RMember> rMembers = new ArrayList<>();
for (Map.Entry<String, Object> entry : groupId.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (key.equals("dataFile")) {
String jsonGroups = JSON.toJSONString(value);
dataFile = JSON.parseObject(jsonGroups, new TypeReference<List<DataFileVo>>() {});
}
}
}catch (Exception e) {
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
}
return dataFile;
}
} }

@ -0,0 +1,45 @@
package cn.teammodel.controller.admin.service.impl;
import cn.teammodel.common.ErrorCode;
import cn.teammodel.config.exception.ServiceException;
import cn.teammodel.controller.admin.service.ExamService;
import cn.teammodel.model.dto.admin.common.RGroupList;
import cn.teammodel.model.dto.admin.exam.OverViewDto;
import cn.teammodel.utils.GroupUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Service
public class ExamServiceImpl implements ExamService {
@Autowired
private Environment env;
@Override
public Map<String, Object> getAnalysis(OverViewDto overViewDto, HttpServletRequest request) {
Map<String, Object> overView;
String url = env.getProperty("ies.server-url-overview");
try {
overView = GroupUtil.getGroupId(overViewDto,new GroupUtil(env), request,url);
//List<RMember> rMembers = new ArrayList<>();
/*for (Map.Entry<String, Object> entry : groupId.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (key.equals("groups")) {
String jsonGroups = JSON.toJSONString(value);
rGroupList = JSON.parseObject(jsonGroups, new TypeReference<List<RGroupList>>() {});
}
}*/
}catch (Exception e) {
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
}
return overView;
}
}

@ -0,0 +1,19 @@
package cn.teammodel.model.dto.admin.art;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DataFileCommentDto {
private String artId;
private String schoolId;
private String schoolCode;
private String headLang;
private String studentId;
@ApiModelProperty(value = "自定义评语,不传或者传空字符串代表清空之前的")
private String comment;
@ApiModelProperty(value = "自定义评语音乐,不传或者传空字符串代表清空之前的")
private String comment_music;
@ApiModelProperty(value = "自定义评语美术,不传或者传空字符串代表清空之前的")
private String comment_painting;
}

@ -0,0 +1,15 @@
package cn.teammodel.model.dto.admin.art;
import lombok.Data;
import java.util.List;
@Data
public class DataFileDto {
private String artId;
private String schoolId;
private String schoolCode;
private String opt;
private String headLang;
List<String> studentIds;
}

@ -0,0 +1,16 @@
package cn.teammodel.model.dto.admin.exam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OverViewDto {
@ApiModelProperty("指定学年")
private int studyYear;
private String semesterId;
private String school;
private String studentId;
private String periodId;
@ApiModelProperty("学生入学年")
private int studentYear;
}

@ -0,0 +1,11 @@
package cn.teammodel.model.vo.admin;
import lombok.Data;
import java.util.List;
@Data
public class DataFileVo {
public String blob;
public String blobFullUrl;
}

@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.type.TypeFactory;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity; import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
@ -51,9 +52,9 @@ public class GroupUtil {
httpPost.setHeader("Content-Type", "application/json; charset=utf-8"); httpPost.setHeader("Content-Type", "application/json; charset=utf-8");
// 设置请求体 // 设置请求体
//JsonUtil.convertToJson(dto); String jsonContent = JsonUtil.convertToJson(obj);
//String requestBody = String.format("{\"school\":\"%s\"}","{\"name\":\"%s\"}","{\"periodId\":\"%s\"}", code,name,periodId); //String requestBody = String.format("{\"school\":\"%s\"}","{\"name\":\"%s\"}","{\"periodId\":\"%s\"}", code,name,periodId);
httpPost.setEntity(new StringEntity(JsonUtil.convertToJson(obj))); httpPost.setEntity(new StringEntity(jsonContent, ContentType.create("application/json", "UTF-8")));
// 发送请求 // 发送请求
try (CloseableHttpResponse response = httpClient.execute(httpPost)) { try (CloseableHttpResponse response = httpClient.execute(httpPost)) {

@ -70,3 +70,6 @@ ding:
ies: ies:
server-url: /common/lesson-record/get-lesson-record server-url: /common/lesson-record/get-lesson-record
server-url-group: /grouplist/get-members-listids server-url-group: /grouplist/get-members-listids
server-url-pdf-data: /school/art/get-pdf-data
server-url-update-custom-comment: /school/art/update-custom-comment
server-url-overview: /overall-education/overview
Loading…
Cancel
Save