完成评分细则的部分接口,把前端样式调了一下
This commit is contained in:
parent
ef8707272c
commit
4e7fa68ddf
|
|
@ -70,4 +70,6 @@ export default {
|
|||
addClassAssistant: (data) => request.post('/assistantClass/addClassAssistant', data),
|
||||
getAssistantNotBelongClass: (data) =>
|
||||
request.post('/adminusers/getAssistantNotBelongClass', data),
|
||||
AddScoringRubric: (data) => request.post('/problem/addScoringRubric', data),
|
||||
findScoringRubricNoStandardId:(data)=>request.post('/problem/findScoringRubricNoStandardId',data)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const router = useRouter()
|
|||
const rules=ref(null)
|
||||
const courseInfoRef = ref(null)
|
||||
const loading = ref(true)
|
||||
const courseList = ref([{ name: 'C++课程'}])
|
||||
const courseList = ref([])
|
||||
const paginationReactive = reactive({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
|
|
@ -155,12 +155,11 @@ const onBanjiCourse= async (courseId)=>{
|
|||
}
|
||||
|
||||
}
|
||||
const onProblem= async (classId)=>{
|
||||
// const { id } = classId
|
||||
const id=1
|
||||
const onProblem= async (courseId)=>{
|
||||
const { id } = courseId
|
||||
try {
|
||||
await router.push({ name:
|
||||
'AdminProblemList', query: { classId: id
|
||||
'AdminProblemList', query: { courseId: id
|
||||
} })
|
||||
}catch (err){
|
||||
$message.error('无法查看')
|
||||
|
|
@ -170,8 +169,11 @@ const onProblem= async (classId)=>{
|
|||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminCourseAdd'})
|
||||
}
|
||||
const onAddProblem= ()=>{
|
||||
router.push({name: 'AdminProblemAdd'})
|
||||
const onAddProblem= async (courseId)=>{
|
||||
const { id } = courseId
|
||||
await router.push({ name:
|
||||
'AdminProblemAdd', query: { courseId: id
|
||||
} })
|
||||
}
|
||||
const onProblemStore= ()=>{
|
||||
router.push({name: 'AdminProblemStore'})
|
||||
|
|
|
|||
|
|
@ -1,28 +1,25 @@
|
|||
<template>
|
||||
<n-scrollbar x-scrollable style="max-height: 100vh">
|
||||
<CommonPage show-footer>
|
||||
<div style="margin-top: 0px">
|
||||
<n-form ref="ProblemInfoRef"
|
||||
:model="ProblemInfoValue"
|
||||
:rules="rules"
|
||||
label-placement="left"
|
||||
size="small"
|
||||
:label-width="60" >
|
||||
</n-form>
|
||||
</div>
|
||||
<!-- <div style="margin-top: 0px">-->
|
||||
<!-- <n-form ref="ProblemInfoRef"-->
|
||||
<!-- :model="ProblemInfoValue"-->
|
||||
<!-- :rules="rules"-->
|
||||
<!-- label-placement="left"-->
|
||||
<!-- size="small"-->
|
||||
<!-- :label-width="60" >-->
|
||||
<!-- </n-form>-->
|
||||
<!-- </div>-->
|
||||
<n-data-table
|
||||
remote
|
||||
:single-line="false"
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:data="ProblemList"
|
||||
:data="ScoringRubricList"
|
||||
:loading="loading"
|
||||
:pagination="paginationReactive"
|
||||
:row-key="rowKey"
|
||||
:scroll-x="900"
|
||||
style="width: 1180px;--n-td-padding:0px 5px;"
|
||||
@update:page="onChangePage"
|
||||
@update:page-size="onUpdatePageSize"
|
||||
style="margin-left: -30px;margin-right:
|
||||
30px"
|
||||
/>
|
||||
|
||||
</CommonPage>
|
||||
|
|
@ -42,49 +39,9 @@ const userStore = useUserStore()
|
|||
const router = useRouter()
|
||||
const ProblemInfoRef = ref(null)
|
||||
const loading = ref(true)
|
||||
const ProblemList =
|
||||
ref([{demension:"1",weight:"20",rubics:"细则1"}])
|
||||
const options1=ref([])
|
||||
const ScoringRubricList =
|
||||
ref([])
|
||||
const role=userStore.getRole()
|
||||
const teacherId=ref()
|
||||
const paginationReactive = reactive({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
showSizePicker: true,
|
||||
pageSizes: [50, 100,150],
|
||||
prefix ({ itemCount }) {
|
||||
return `总共 ${itemCount} 条`
|
||||
}
|
||||
})
|
||||
const ProblemInfoValue = ref({
|
||||
pageNum:paginationReactive.page,
|
||||
pageSize:paginationReactive.pageSize,
|
||||
id:0,
|
||||
teacherId:'',
|
||||
});
|
||||
const queryByPage1=async (value)=>{
|
||||
if (userStore.getRole().some((r) => r === 'admin')) {
|
||||
const res = await api.findAllAdminusersBySchoolId({
|
||||
schoolId: value,
|
||||
})
|
||||
const transformedData = res.data.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}))
|
||||
transformedData.unshift({
|
||||
label: '全部',
|
||||
value: 0,
|
||||
})
|
||||
ProblemInfoValue.value.teacherId = 0
|
||||
options1.value = transformedData
|
||||
}
|
||||
}
|
||||
watch(()=>ProblemInfoValue.value.id,
|
||||
(newVal)=>{
|
||||
ProblemInfoValue.value.teacherId=''
|
||||
options1.value=[]
|
||||
queryByPage1(newVal)
|
||||
})
|
||||
let columns = [
|
||||
{
|
||||
key: 'range',
|
||||
|
|
@ -102,32 +59,13 @@ let columns = [
|
|||
const queryByPage = async (currentPage)=>{
|
||||
loading.value = true;
|
||||
try {
|
||||
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
||||
const res = await api.findAllProblemPage(
|
||||
const res = await
|
||||
api.findScoringRubricNoStandardId(
|
||||
{
|
||||
...ProblemInfoValue.value
|
||||
}
|
||||
);
|
||||
console.log(res.data)
|
||||
if (userStore.getRole().some((r) => r === 'admin')){
|
||||
const res1=await api.findAllShoolsInAdminusers()
|
||||
const list1=res1.data
|
||||
const transformedDatas=list1.map(item => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
transformedDatas.unshift({
|
||||
label: '全部',
|
||||
value: 0,
|
||||
});
|
||||
options.value=transformedDatas;
|
||||
}
|
||||
const {pageNum, pageSize, total, list} = res.data
|
||||
paginationReactive.page = pageNum
|
||||
paginationReactive.pageSize = pageSize
|
||||
paginationReactive.itemCount = total
|
||||
ProblemList.value=list.map((item,i)=>{return item;})
|
||||
|
||||
ScoringRubricList.value=res.data
|
||||
} catch (err) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
|
|
@ -171,8 +109,8 @@ watch(
|
|||
()=>router.currentRoute.value.fullPath,
|
||||
()=>{
|
||||
if
|
||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-list') {
|
||||
queryByPage(paginationReactive.page)
|
||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-scoring-standard') {
|
||||
queryByPage()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -254,17 +254,17 @@ const queryByPage = async (currentPage)=>{
|
|||
);
|
||||
console.log(res.data)
|
||||
if (userStore.getRole().some((r) => r === 'admin')){
|
||||
const res1=await api.findAllShoolsInAdminusers()
|
||||
const list1=res1.data
|
||||
const transformedDatas=list1.map(item => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
transformedDatas.unshift({
|
||||
label: '全部',
|
||||
value: 0,
|
||||
});
|
||||
options.value=transformedDatas;
|
||||
// const res1=await api.findAllShoolsInAdminusers()
|
||||
// const list1=res1.data
|
||||
// const transformedDatas=list1.map(item => ({
|
||||
// label: item.name,
|
||||
// value: item.id,
|
||||
// }));
|
||||
// transformedDatas.unshift({
|
||||
// label: '全部',
|
||||
// value: 0,
|
||||
// });
|
||||
// options.value=transformedDatas;
|
||||
}
|
||||
const {pageNum, pageSize, total, list} = res.data
|
||||
paginationReactive.page = pageNum
|
||||
|
|
|
|||
|
|
@ -5,14 +5,15 @@
|
|||
:model="problemInfoValue"
|
||||
:rules="rules"
|
||||
label-placement="left"style="margin-top: 15px;margin-left: 5%">
|
||||
<div class="flex" style='align-items: flex-start' >
|
||||
<div class="flex" style='align-items:
|
||||
flex-start;margin-top: 30px;margin-right: 20px' >
|
||||
<div class="flex-1">
|
||||
<div
|
||||
class="flex justify-between w-2/3">
|
||||
<n-form-item label="范围"
|
||||
>
|
||||
<n-input
|
||||
v-model:value="problemInfoValue.range"
|
||||
v-model:value="problemInfoValue.lowerLimit"
|
||||
placeholder="输入分值"
|
||||
style='width: 800px'/>
|
||||
</n-form-item>
|
||||
|
|
@ -20,26 +21,28 @@
|
|||
style="margin-left: 30px"
|
||||
>
|
||||
<n-input
|
||||
v-model:value="problemInfoValue.range"
|
||||
v-model:value="problemInfoValue.upperLimit"
|
||||
placeholder="输入分值"
|
||||
style='width: 800px'/>
|
||||
</n-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<n-form-item style='margin-right:30px '>
|
||||
<n-button type="primary"
|
||||
size="small"
|
||||
style="margin-bottom:
|
||||
10px" @click="submit">确认
|
||||
</n-button>
|
||||
@click="submit">确认
|
||||
</n-button></n-form-item>
|
||||
<n-form-item style='margin-right: 30px'>
|
||||
<n-button type="primary"
|
||||
size="small" @click="cancel" style="margin-left: 30px">取消</n-button>
|
||||
size="small" @click="cancel">取消</n-button></n-form-item>
|
||||
</div>
|
||||
<div class="mb-50 mt-10 flex-col">
|
||||
<div class="mb-10 mt-4 flex items-center">
|
||||
<h3 class="text-18">描述</h3>
|
||||
<span class="text-gray">(使用宋体字体,可以保证英文和数字等宽)</span>
|
||||
</div>
|
||||
<n-form-item path="description">
|
||||
<n-form-item path="description"
|
||||
style='margin-right:40px'>
|
||||
<RichTextEditor
|
||||
v-model:value="problemInfoValue.description"
|
||||
:editor-style="{ height: descEditorHeight }"
|
||||
|
|
@ -61,16 +64,21 @@ import api from "@/api/admin";
|
|||
import { useTagsStore } from '@/store'
|
||||
import RichTextEditor
|
||||
from '@/components/common/RichTextEditor.vue'
|
||||
import { once } from '@/utils'
|
||||
const tagsStore = useTagsStore()
|
||||
const path=ref('')
|
||||
const router = useRouter()
|
||||
const rules=ref(null)
|
||||
const descEditorHeight = ref('160px')
|
||||
const descEditorHeight = ref()
|
||||
const problemInfoValue = ref({
|
||||
name: ''
|
||||
lowerLimit:'',
|
||||
upperLimit:'',
|
||||
description:''
|
||||
});
|
||||
const problemInfoRef = ref(null)
|
||||
|
||||
const handleDescEditorFocus = once(() => {
|
||||
descEditorHeight.value = '160px'
|
||||
})
|
||||
const cancel = ()=>{
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-scoring-standard'})
|
||||
|
|
@ -79,20 +87,20 @@ const onAdd = ()=>{
|
|||
router.push({name: 'AdminProblemScoringRubric'})
|
||||
}
|
||||
const submit =async ()=>{
|
||||
if(problemInfoValue.value.name!==''){
|
||||
if(problemInfoValue.value.lowerLimit!==''&&problemInfoValue.value.upperLimit!==''&&problemInfoValue.value.description!==''){
|
||||
try {
|
||||
await api.Addproblem({
|
||||
await api.AddScoringRubric({
|
||||
...problemInfoValue.value
|
||||
})
|
||||
$message.success("添加课程成功")
|
||||
$message.success("添加评分细则成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
await router.push({name: 'AdminProblemScoringStandard'})
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
await router.push({name: 'AdminProblemScoringStandard'})
|
||||
}
|
||||
}else {
|
||||
$message.error("作业名称不能为空")
|
||||
$message.error("评分细则不能为空")
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
:model="problemInfoValue"
|
||||
:rules="rules"
|
||||
label-placement="left"style="margin-top: 15px;margin-left: 5%">
|
||||
<div class="flex" style='align-items: flex-start' >
|
||||
<div class="flex" style='align-items:
|
||||
flex-start;margin-top: 40px;margin-right: 30px' >
|
||||
<div class="flex-1">
|
||||
<div
|
||||
class="flex justify-between w-2/3">
|
||||
|
|
@ -27,13 +28,14 @@
|
|||
</n-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<n-form-item style='margin-right:30px '>
|
||||
<n-button type="primary"
|
||||
size="small"
|
||||
style="margin-bottom:
|
||||
10px" @click="submit">确认
|
||||
</n-button>
|
||||
@click="submit">确认
|
||||
</n-button></n-form-item>
|
||||
<n-form-item style='margin-right: 30px'>
|
||||
<n-button type="primary"
|
||||
size="small" @click="cancel" style="margin-left: 30px">取消</n-button>
|
||||
size="small" @click="cancel">取消</n-button></n-form-item>
|
||||
</div>
|
||||
<div class="mb-50 mt-10 flex-col">
|
||||
<div class="mb-10 mt-4 flex items-center">
|
||||
|
|
@ -50,7 +52,7 @@
|
|||
|
||||
<script setup>
|
||||
import {useRouter} from "vue-router";
|
||||
import {ref} from "vue";
|
||||
import { onMounted, ref } from 'vue'
|
||||
import api from "@/api/admin";
|
||||
import { useTagsStore } from '@/store'
|
||||
import RubricList from
|
||||
|
|
@ -62,7 +64,9 @@ const path=ref('')
|
|||
const router = useRouter()
|
||||
const rules=ref(null)
|
||||
const problemInfoValue = ref({
|
||||
name: ''
|
||||
demension:"",
|
||||
weight:"",
|
||||
problemId:''
|
||||
});
|
||||
const problemInfoRef = ref(null)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,31 +4,24 @@ package com.example.aes.problem.controller;
|
|||
import com.example.aes.global.model.DecodeToken;
|
||||
import com.example.aes.global.model.RespBean;
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.UScoringRubric;
|
||||
import com.example.aes.problem.service.ProblemServiceI;
|
||||
import com.example.aes.user.dao.AccountDao;
|
||||
import com.example.aes.user.model.Adminusers;
|
||||
import com.example.aes.user.model.Classstudents;
|
||||
import com.example.aes.user.model.DataGrid;
|
||||
import com.example.aes.user.model.Users;
|
||||
import com.example.aes.user.model.*;
|
||||
import com.example.aes.user.service.ClassesServiceI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/problem")
|
||||
@Transactional
|
||||
public class ProblemController {
|
||||
|
||||
@Autowired
|
||||
|
|
@ -36,7 +29,23 @@ public class ProblemController {
|
|||
|
||||
@Autowired
|
||||
private ProblemServiceI problemServiceI;
|
||||
@PostMapping("/addScoringRubric")
|
||||
public RespBean addScoringRubric(@RequestBody PMScoringRubric scoringRubric) {
|
||||
problemServiceI.addScoringRubric(scoringRubric);
|
||||
return RespBean.ok("添加评分细则成功");
|
||||
}
|
||||
@PostMapping("/findScoringRubricNoStandardId")
|
||||
public RespBean findScoringRubricNoStandardId() {
|
||||
List<UScoringRubric> uScoringRubricList=
|
||||
problemServiceI.findScoringRubricNoStandardId();
|
||||
if (uScoringRubricList != null) {
|
||||
return RespBean.ok("获取评分细则列表成功!",
|
||||
uScoringRubricList);
|
||||
} else {
|
||||
return RespBean.error("获取评分细则列表失败!");
|
||||
}
|
||||
|
||||
}
|
||||
//获取作业列表
|
||||
@GetMapping("/getExamList")
|
||||
public RespBean getExamList(Integer pageNum,Integer pageSize, HttpServletRequest request) {
|
||||
|
|
@ -68,5 +77,4 @@ public class ProblemController {
|
|||
}
|
||||
|
||||
|
||||
////////////逻辑在未完成
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.example.aes.problem.dao;
|
|||
|
||||
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.Problem;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
import com.example.aes.user.model.Classstudents;
|
||||
|
|
@ -16,5 +17,4 @@ public interface ProblemDaoI extends BaseDaoI<Problem> {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.example.aes.problem.dao;
|
||||
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.ScoringRubric;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ScoringRubricDaoI extends BaseDaoI<ScoringRubric> {
|
||||
public void addScoringRubric(PMScoringRubric pmScoringRubric);
|
||||
public List<ScoringRubric> getScoringRubricNoStandardId();
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.example.aes.problem.dao.impl;
|
|||
|
||||
import com.example.aes.problem.dao.ProblemDaoI;
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.Problem;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||
|
|
@ -39,4 +40,7 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
|
||||
return problems;
|
||||
}
|
||||
public void addScoringRubric(PMScoringRubric pmScoringRubric){
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.example.aes.problem.dao.impl;
|
||||
|
||||
import com.example.aes.problem.dao.ScoringRubricDaoI;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.ScoringRubric;
|
||||
import com.example.aes.user.dao.CourseDaoI;
|
||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||
import com.example.aes.user.model.Course;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository("ScoringRubricDao")
|
||||
public class ScoringRubricDaoImpl extends BaseDaoImpl<ScoringRubric> implements ScoringRubricDaoI {
|
||||
@Override
|
||||
public void addScoringRubric(PMScoringRubric pmScoringRubric){
|
||||
// TODO Auto-generated method stub
|
||||
ScoringRubric scoringRubric=
|
||||
new ScoringRubric();
|
||||
scoringRubric.setLowerLimit(pmScoringRubric.getLowerLimit());
|
||||
scoringRubric.setUpperLimit(pmScoringRubric.getUpperLimit());
|
||||
scoringRubric.setDescription(pmScoringRubric.getDescription());
|
||||
this.save(scoringRubric);
|
||||
}
|
||||
@Override
|
||||
public List<ScoringRubric> getScoringRubricNoStandardId(){
|
||||
String hql ="from ScoringRubric where " +
|
||||
"standardId is null";
|
||||
List<ScoringRubric> scoringRubricList =
|
||||
this.find(hql);
|
||||
return scoringRubricList;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PMScoringRubric {
|
||||
private Float lowerLimit;
|
||||
private Float upperLimit;
|
||||
private String description;
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "scoringrubric",catalog = "aes")
|
||||
public class ScoringRubric implements java.io.Serializable{
|
||||
private static final long serialVersionUID = -4577366061004245861L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", unique = true, nullable = false)
|
||||
private Integer id;
|
||||
@Column(name = "standardId")
|
||||
private Integer standardId;
|
||||
@Column(name = "lowerLimit")
|
||||
private Float lowerLimit;
|
||||
@Column(name = "upperlimit")
|
||||
private Float upperLimit;
|
||||
@Column(name = "description", length = 200)
|
||||
private String description;
|
||||
public ScoringRubric(){}
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getStandardId() {
|
||||
return standardId;
|
||||
}
|
||||
|
||||
public void setStandardId(Integer standardId) {
|
||||
this.standardId = standardId;
|
||||
}
|
||||
|
||||
public Float getLowerLimit() {
|
||||
return lowerLimit;
|
||||
}
|
||||
|
||||
public void setLowerLimit(Float lowerLimit) {
|
||||
this.lowerLimit = lowerLimit;
|
||||
}
|
||||
|
||||
public Float getUpperLimit() {
|
||||
return upperLimit;
|
||||
}
|
||||
|
||||
public void setUpperLimit(Float upperLimit) {
|
||||
this.upperLimit = upperLimit;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UScoringRubric {
|
||||
private String range;
|
||||
private String description;
|
||||
}
|
||||
|
|
@ -1,17 +1,31 @@
|
|||
package com.example.aes.problem.service.Impl;
|
||||
|
||||
import com.example.aes.problem.dao.ProblemDaoI;
|
||||
import com.example.aes.problem.dao.ScoringRubricDaoI;
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.ScoringRubric;
|
||||
import com.example.aes.problem.model.UScoringRubric;
|
||||
import com.example.aes.problem.service.ProblemServiceI;
|
||||
import com.example.aes.user.dao.ClassesDaoI;
|
||||
import com.example.aes.user.model.Course;
|
||||
import com.example.aes.user.model.DataGrid;
|
||||
import com.example.aes.user.model.PMCourse;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class ProblemServiceImpl implements ProblemServiceI {
|
||||
|
||||
private ProblemDaoI problemDao;
|
||||
private ScoringRubricDaoI scoringRubricDao;
|
||||
@Autowired
|
||||
public void setScoringRubricDao(ScoringRubricDaoI scoringRubricDao) {
|
||||
this.scoringRubricDao = scoringRubricDao;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setProblemDao(ProblemDaoI problemDao) {
|
||||
this.problemDao = problemDao;
|
||||
|
|
@ -20,4 +34,47 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
public List<PMProblem> getProblemsByClassIds(List<Integer> classIds){
|
||||
return problemDao.findProblemsByClassIds(classIds);
|
||||
}
|
||||
@Override
|
||||
public void addScoringRubric(PMScoringRubric pmscoringRubric){
|
||||
// TODO Auto-generated method stub
|
||||
scoringRubricDao.addScoringRubric(pmscoringRubric);
|
||||
}
|
||||
@Override
|
||||
public List<UScoringRubric> findScoringRubricNoStandardId(){
|
||||
List<ScoringRubric> scoringRubricList;
|
||||
scoringRubricList=
|
||||
scoringRubricDao.getScoringRubricNoStandardId();
|
||||
if (scoringRubricList == null) {
|
||||
return null;
|
||||
} else {
|
||||
List<UScoringRubric> uScoringRubricList=new ArrayList<>();
|
||||
changeModel2(scoringRubricList,
|
||||
uScoringRubricList);
|
||||
return uScoringRubricList;
|
||||
}
|
||||
|
||||
};
|
||||
private void changeModel1(List<ScoringRubric> l,
|
||||
List<PMScoringRubric> nl) {
|
||||
if (l != null && l.size() > 0) {
|
||||
for (ScoringRubric t : l) {
|
||||
PMScoringRubric u = new PMScoringRubric();
|
||||
BeanUtils.copyProperties(t, u);
|
||||
nl.add(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void changeModel2(List<ScoringRubric> l,
|
||||
List<UScoringRubric> nl) {
|
||||
if (l != null && l.size() > 0) {
|
||||
for (ScoringRubric t : l) {
|
||||
UScoringRubric u =
|
||||
new UScoringRubric();
|
||||
u.setRange(t.getLowerLimit()+
|
||||
"~"+t.getUpperLimit());
|
||||
u.setDescription(t.getDescription().replaceAll("<\\/?.*?>", "").trim());
|
||||
nl.add(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,15 @@ package com.example.aes.problem.service;
|
|||
|
||||
|
||||
import com.example.aes.problem.model.PMProblem;
|
||||
import com.example.aes.problem.model.PMScoringRubric;
|
||||
import com.example.aes.problem.model.UScoringRubric;
|
||||
import com.example.aes.user.model.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProblemServiceI {
|
||||
public List<PMProblem> getProblemsByClassIds(List<Integer> classIds);
|
||||
public void addScoringRubric(PMScoringRubric pmscoringRubric);
|
||||
public List<UScoringRubric> findScoringRubricNoStandardId();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ server.port=8082
|
|||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
jdbc_url=jdbc:mysql://localhost:3306/aes?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=True
|
||||
jdbc_username=root
|
||||
jdbc_password=13661744518xh
|
||||
jdbc_password=123456
|
||||
#spring.datasource.url=jdbc:mysql://localhost:3306/aes?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=True
|
||||
#spring.datasource.username=root
|
||||
#spring.datasource.password=123456
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@
|
|||
<list>
|
||||
<value>com.example.aes.user.model</value>
|
||||
<value>com.example.aes.global.model</value>
|
||||
<value>com.example.aes.problem.model</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
|
|
|||
Loading…
Reference in New Issue