Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
ca2ea3a606
15
sql/20210322-zhangsai.sql
Normal file
15
sql/20210322-zhangsai.sql
Normal file
@ -0,0 +1,15 @@
|
||||
-- 评价规则表添加字段
|
||||
alter table org_scoring_rule
|
||||
add `name` varchar(64) not null comment '名称' after id;
|
||||
|
||||
-- 创建表
|
||||
create table org_scoring_rule_rel
|
||||
(
|
||||
org_id int not null,
|
||||
rule_id bigint not null
|
||||
)
|
||||
comment '班级与评价规则关联表';
|
||||
|
||||
-- 组织表添加字段
|
||||
alter table org
|
||||
add status varchar(1) not null comment '状态';
|
@ -789,4 +789,11 @@ public interface BusinessConsts {
|
||||
enum OrgRole {
|
||||
Admin,Teacher, Student
|
||||
}
|
||||
|
||||
interface Org{
|
||||
interface Status {
|
||||
String DELETE = "0";
|
||||
String VALID = "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package club.joylink.rtss.controller;
|
||||
|
||||
import club.joylink.rtss.constants.RoleEnum;
|
||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||
import club.joylink.rtss.controller.advice.Role;
|
||||
import club.joylink.rtss.services.org.IOrgLessonService;
|
||||
import club.joylink.rtss.services.org.IOrgScoringRuleService;
|
||||
import club.joylink.rtss.services.org.IOrgService;
|
||||
@ -52,9 +54,8 @@ public class OrgController {
|
||||
|
||||
@ApiOperation(value = "分页获取公司列表")
|
||||
@GetMapping("paging")
|
||||
public PageVO<CompanyVO> pagingQueryAll(CompanyQueryVO queryVO) {
|
||||
PageVO<CompanyVO> list = iOrgUserService.queryPageOrganizations(queryVO);
|
||||
return list;
|
||||
public PageVO<CompanyVO> pagingQueryAll(OrgQueryVO queryVO) {
|
||||
return iOrgUserService.queryPageOrganizations(queryVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除公司信息")
|
||||
@ -164,10 +165,10 @@ public class OrgController {
|
||||
iOrgUserService.deleteDepartUserInfo(user, userDepartRelVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取单位部门成员信息")
|
||||
@GetMapping("/dept/{deptId}/departUserInfo")
|
||||
public PageVO<CompanyDepartUserVO> getCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer deptId, CompanyUserQueryVO companyUserQueryVO) {
|
||||
return iOrgUserService.getCompanyDepartUserInfoList(user, deptId, companyUserQueryVO);
|
||||
@ApiOperation(value = "分页获取班级学生信息")
|
||||
@GetMapping("/dept/{clsId}/departUserInfo")
|
||||
public PageVO<CompanyDepartUserVO> getCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer clsId, CompanyUserQueryVO companyUserQueryVO) {
|
||||
return iOrgUserService.getCompanyDepartUserInfoList(user, clsId, companyUserQueryVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入单位成员信息")
|
||||
@ -206,28 +207,22 @@ public class OrgController {
|
||||
iOrgService.createCls(createVO, loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询所有班级")
|
||||
@GetMapping("/paged/cls")
|
||||
public PageVO<DepartmentVO> pagedQueryCls(CompanyQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return iOrgService.pagedQueryCls(queryVO, loginInfo, false);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询个人创建的班级")
|
||||
@GetMapping("/paged/cls/self")
|
||||
public PageVO<DepartmentVO> pagedQuerySelfCls(CompanyQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
public PageVO<DepartmentVO> pagedQuerySelfCls(OrgQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return iOrgService.pagedQueryCls(queryVO, loginInfo, true);
|
||||
}
|
||||
|
||||
@ApiOperation("查询个人创建的班级")
|
||||
@GetMapping("/list/cls/self")
|
||||
public List<DepartmentVO> querySelfCls(CompanyQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
public List<DepartmentVO> querySelfCls(OrgQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return iOrgService.queryCls(queryVO, loginInfo, true);
|
||||
}
|
||||
|
||||
@ApiOperation("创建评价规则")
|
||||
@PostMapping("/orgScoringRule")
|
||||
public void createScoringRule(@RequestBody OrgScoringRuleVO orgScoringRuleVO, @RequestAttribute UserVO user) {
|
||||
iOrgScoringRuleService.createScoringRule(orgScoringRuleVO, user);
|
||||
public void createScoringRule(@RequestBody OrgScoringRuleVO orgScoringRuleVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
iOrgScoringRuleService.createScoringRule(orgScoringRuleVO, loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation("保存评价规则")
|
||||
@ -245,8 +240,8 @@ public class OrgController {
|
||||
@ApiOperation("查询自己创建的指定评价规则详细信息")
|
||||
@GetMapping("/orgScoringRule/details/self/{orgId}/{schoolYear}/{term}")
|
||||
public OrgScoringRuleVO queryOrgScoringRuleDetails(@PathVariable Integer orgId, @PathVariable String schoolYear,
|
||||
@PathVariable Integer term, @RequestAttribute UserVO user) {
|
||||
return iOrgScoringRuleService.queryOrgScoringRuleDetails(orgId, schoolYear, term, user);
|
||||
@PathVariable Integer term, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return iOrgScoringRuleService.queryOrgScoringRuleDetails(orgId, schoolYear, term, loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation("查询指定评价规则详细信息")
|
||||
@ -255,17 +250,11 @@ public class OrgController {
|
||||
return iOrgScoringRuleService.getOrgScoringRuleDetails(ruleId);
|
||||
}
|
||||
|
||||
@ApiOperation("使用评价规则评分")
|
||||
@GetMapping("/orgScoringRule/score")
|
||||
public List<OrgScoringResultVO> score(@RequestBody OrgScoringRuleVO orgScoringRuleVO, @RequestAttribute UserVO user) {
|
||||
return iOrgScoringRuleService.score(orgScoringRuleVO, user);
|
||||
}
|
||||
|
||||
@ApiOperation("使用评价规则评分")
|
||||
@GetMapping("/orgScoringRule/score/{orgId}/{schoolYear}/{term}")
|
||||
public List<OrgScoringResultVO> score(@PathVariable Integer orgId, @PathVariable String schoolYear,
|
||||
@PathVariable Integer term, @RequestAttribute UserVO user) {
|
||||
return iOrgScoringRuleService.score(orgId, schoolYear, term , user);
|
||||
@PathVariable Integer term, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return iOrgScoringRuleService.score(orgId, schoolYear, term, loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation("删除评分规则")
|
||||
@ -273,4 +262,23 @@ public class OrgController {
|
||||
public void deleteScoringRule(@PathVariable Long ruleId, @RequestAttribute UserVO user) {
|
||||
iOrgScoringRuleService.deleteRuleOfSelf(ruleId, user.getId());
|
||||
}
|
||||
|
||||
@ApiOperation("查询规则能够应用到的组织")
|
||||
@GetMapping("/orgScoringRule/{ruleId}/canApplyTo")
|
||||
public List<DepartmentVO> queryRuleCanApplyTo(@PathVariable Long ruleId) {
|
||||
return iOrgScoringRuleService.queryRuleCanApplyTo(ruleId);
|
||||
}
|
||||
|
||||
@ApiOperation("将评价规则应用到")
|
||||
@PostMapping("/orgScoringRule/{ruleId}/apply")
|
||||
public void applyOrgScoringRule(@PathVariable Long ruleId, @RequestBody List<Integer> orgIds) {
|
||||
iOrgScoringRuleService.applyOrgScoringRule(ruleId, orgIds);
|
||||
}
|
||||
|
||||
@Role(RoleEnum.Admin)
|
||||
@ApiOperation("管理员查看非顶级组织")
|
||||
@GetMapping("/org/admin/paged")
|
||||
public PageVO<DepartmentVO> adminPagedQueryOrg(OrgQueryVO queryVO) {
|
||||
return iOrgService.adminPagedQueryOrg(queryVO);
|
||||
}
|
||||
}
|
||||
|
@ -112,15 +112,21 @@ public class ExamController {
|
||||
this.iExamService.update(id, examDefinitionVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页查询自己创建的试卷")
|
||||
@GetMapping("/paged/org/self")
|
||||
@ApiOperation(value = "分页查询当前登录项目下自己创建的试卷")
|
||||
@GetMapping("/paged/loginProject/self")
|
||||
public PageVO<ExamDefinitionVO> pagedQuerySelfExam(ExamDefinitionQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return this.iExamService.pagedQuerySelfExam4OrgTeacher(queryVO, loginInfo);
|
||||
return this.iExamService.pagedQueryExamICreated(queryVO, loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "不分页查询自己为指定班级创建的试卷")
|
||||
@ApiOperation(value = "不分页查询当前登录项目下自己创建的试卷")
|
||||
@GetMapping("/list/loginProject/self")
|
||||
public List<ExamDefinitionVO> listQueryExamICreated(ExamDefinitionQueryVO queryVO, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return this.iExamService.listQueryExamICreated(queryVO, loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "不分页查询组织下自己创建的试卷")
|
||||
@GetMapping("/list/org/self")
|
||||
public List<ExamDefinitionVO> listQuerySelfExam(Integer clsId, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return this.iExamService.listQueryOrgExamOfSelf(clsId, loginInfo);
|
||||
public List<ExamDefinitionVO> listQueryOrgExamOfSelf(Integer clsId, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return this.iExamService.listQueryOrgExamICreated(clsId, loginInfo);
|
||||
}
|
||||
}
|
||||
|
@ -132,10 +132,10 @@ public class LessonController {
|
||||
@ApiOperation(value = "查询用户当前登录的项目下的课程")
|
||||
@GetMapping(path = "/unPaged/self")
|
||||
public List<LessonVO> queryPersonalLesson(@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginInfo) {
|
||||
return iLessonService.queryPersonalLesson(loginInfo);
|
||||
return iLessonService.queryLessonICreatedInLoginProject(loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询自己给指定班级创建的试卷")
|
||||
@ApiOperation(value = "查询自己给指定班级创建的课程")
|
||||
@GetMapping(path = "/list/org/self")
|
||||
public List<LessonVO> queryOrgLessonOfSelf(Integer clsId, @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return iLessonService.queryOrgLessonOfSelf(clsId, loginInfo);
|
||||
|
@ -0,0 +1,15 @@
|
||||
package club.joylink.rtss.dao;
|
||||
|
||||
import club.joylink.rtss.entity.OrgScoringRuleRel;
|
||||
import club.joylink.rtss.entity.OrgScoringRuleRelExample;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OrgScoringRuleRelDAO继承基类
|
||||
*/
|
||||
@Repository
|
||||
public interface OrgScoringRuleRelDAO extends MyBatisBaseDao<OrgScoringRuleRel, OrgScoringRuleRel, OrgScoringRuleRelExample> {
|
||||
void batchInsert(List<OrgScoringRuleRel> rels);
|
||||
}
|
@ -36,7 +36,7 @@ public class Org implements Serializable {
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* 创建者
|
||||
*/
|
||||
private Long creatorId;
|
||||
|
||||
@ -55,6 +55,11 @@ public class Org implements Serializable {
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
@ -137,6 +142,14 @@ public class Org implements Serializable {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
@ -158,7 +171,8 @@ public class Org implements Serializable {
|
||||
&& (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId()))
|
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
||||
&& (this.getUpdateId() == null ? other.getUpdateId() == null : this.getUpdateId().equals(other.getUpdateId()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
|
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -175,6 +189,7 @@ public class Org implements Serializable {
|
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
||||
result = prime * result + ((getUpdateId() == null) ? 0 : getUpdateId().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -194,6 +209,7 @@ public class Org implements Serializable {
|
||||
sb.append(", createTime=").append(createTime);
|
||||
sb.append(", updateId=").append(updateId);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", status=").append(status);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
|
@ -754,6 +754,76 @@ public class OrgExample {
|
||||
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIsNull() {
|
||||
addCriterion("`status` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIsNotNull() {
|
||||
addCriterion("`status` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusEqualTo(String value) {
|
||||
addCriterion("`status` =", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotEqualTo(String value) {
|
||||
addCriterion("`status` <>", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusGreaterThan(String value) {
|
||||
addCriterion("`status` >", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`status` >=", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusLessThan(String value) {
|
||||
addCriterion("`status` <", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusLessThanOrEqualTo(String value) {
|
||||
addCriterion("`status` <=", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusLike(String value) {
|
||||
addCriterion("`status` like", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotLike(String value) {
|
||||
addCriterion("`status` not like", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIn(List<String> values) {
|
||||
addCriterion("`status` in", values, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotIn(List<String> values) {
|
||||
addCriterion("`status` not in", values, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusBetween(String value1, String value2) {
|
||||
addCriterion("`status` between", value1, value2, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotBetween(String value1, String value2) {
|
||||
addCriterion("`status` not between", value1, value2, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,12 @@ public class OrgScoringRule implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 组织(班级)id
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 该规则属于哪个顶级组织
|
||||
*/
|
||||
private Integer orgId;
|
||||
|
||||
@ -55,6 +60,14 @@ public class OrgScoringRule implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getOrgId() {
|
||||
return orgId;
|
||||
}
|
||||
@ -124,6 +137,7 @@ public class OrgScoringRule implements Serializable {
|
||||
}
|
||||
OrgScoringRule other = (OrgScoringRule) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
||||
&& (this.getOrgId() == null ? other.getOrgId() == null : this.getOrgId().equals(other.getOrgId()))
|
||||
&& (this.getSchoolYear() == null ? other.getSchoolYear() == null : this.getSchoolYear().equals(other.getSchoolYear()))
|
||||
&& (this.getTerm() == null ? other.getTerm() == null : this.getTerm().equals(other.getTerm()))
|
||||
@ -138,6 +152,7 @@ public class OrgScoringRule implements Serializable {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
||||
result = prime * result + ((getOrgId() == null) ? 0 : getOrgId().hashCode());
|
||||
result = prime * result + ((getSchoolYear() == null) ? 0 : getSchoolYear().hashCode());
|
||||
result = prime * result + ((getTerm() == null) ? 0 : getTerm().hashCode());
|
||||
@ -155,6 +170,7 @@ public class OrgScoringRule implements Serializable {
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", name=").append(name);
|
||||
sb.append(", orgId=").append(orgId);
|
||||
sb.append(", schoolYear=").append(schoolYear);
|
||||
sb.append(", term=").append(term);
|
||||
|
@ -185,6 +185,76 @@ public class OrgScoringRuleExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNull() {
|
||||
addCriterion("`name` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNotNull() {
|
||||
addCriterion("`name` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameEqualTo(String value) {
|
||||
addCriterion("`name` =", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotEqualTo(String value) {
|
||||
addCriterion("`name` <>", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThan(String value) {
|
||||
addCriterion("`name` >", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`name` >=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThan(String value) {
|
||||
addCriterion("`name` <", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("`name` <=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLike(String value) {
|
||||
addCriterion("`name` like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotLike(String value) {
|
||||
addCriterion("`name` not like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIn(List<String> values) {
|
||||
addCriterion("`name` in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotIn(List<String> values) {
|
||||
addCriterion("`name` not in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameBetween(String value1, String value2) {
|
||||
addCriterion("`name` between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotBetween(String value1, String value2) {
|
||||
addCriterion("`name` not between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIsNull() {
|
||||
addCriterion("org_id is null");
|
||||
return (Criteria) this;
|
||||
|
@ -0,0 +1,69 @@
|
||||
package club.joylink.rtss.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* 班级与评价规则关联表
|
||||
*/
|
||||
public class OrgScoringRuleRel implements Serializable {
|
||||
private Integer orgId;
|
||||
|
||||
private Long ruleId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getOrgId() {
|
||||
return orgId;
|
||||
}
|
||||
|
||||
public void setOrgId(Integer orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public Long getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId(Long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
OrgScoringRuleRel other = (OrgScoringRuleRel) that;
|
||||
return (this.getOrgId() == null ? other.getOrgId() == null : this.getOrgId().equals(other.getOrgId()))
|
||||
&& (this.getRuleId() == null ? other.getRuleId() == null : this.getRuleId().equals(other.getRuleId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getOrgId() == null) ? 0 : getOrgId().hashCode());
|
||||
result = prime * result + ((getRuleId() == null) ? 0 : getRuleId().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", orgId=").append(orgId);
|
||||
sb.append(", ruleId=").append(ruleId);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,342 @@
|
||||
package club.joylink.rtss.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OrgScoringRuleRelExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
private Integer limit;
|
||||
|
||||
private Long offset;
|
||||
|
||||
public OrgScoringRuleRelExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
public void setLimit(Integer limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public Integer getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setOffset(Long offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public Long getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIsNull() {
|
||||
addCriterion("org_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIsNotNull() {
|
||||
addCriterion("org_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdEqualTo(Integer value) {
|
||||
addCriterion("org_id =", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotEqualTo(Integer value) {
|
||||
addCriterion("org_id <>", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdGreaterThan(Integer value) {
|
||||
addCriterion("org_id >", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("org_id >=", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdLessThan(Integer value) {
|
||||
addCriterion("org_id <", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("org_id <=", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIn(List<Integer> values) {
|
||||
addCriterion("org_id in", values, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotIn(List<Integer> values) {
|
||||
addCriterion("org_id not in", values, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("org_id between", value1, value2, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("org_id not between", value1, value2, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdIsNull() {
|
||||
addCriterion("rule_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdIsNotNull() {
|
||||
addCriterion("rule_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdEqualTo(Long value) {
|
||||
addCriterion("rule_id =", value, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdNotEqualTo(Long value) {
|
||||
addCriterion("rule_id <>", value, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdGreaterThan(Long value) {
|
||||
addCriterion("rule_id >", value, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("rule_id >=", value, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdLessThan(Long value) {
|
||||
addCriterion("rule_id <", value, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("rule_id <=", value, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdIn(List<Long> values) {
|
||||
addCriterion("rule_id in", values, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdNotIn(List<Long> values) {
|
||||
addCriterion("rule_id not in", values, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdBetween(Long value1, Long value2) {
|
||||
addCriterion("rule_id between", value1, value2, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRuleIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("rule_id not between", value1, value2, "ruleId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -48,6 +48,7 @@ public class OrgScoringRuleWithBLOBs extends OrgScoringRule implements Serializa
|
||||
}
|
||||
OrgScoringRuleWithBLOBs other = (OrgScoringRuleWithBLOBs) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
||||
&& (this.getOrgId() == null ? other.getOrgId() == null : this.getOrgId().equals(other.getOrgId()))
|
||||
&& (this.getSchoolYear() == null ? other.getSchoolYear() == null : this.getSchoolYear().equals(other.getSchoolYear()))
|
||||
&& (this.getTerm() == null ? other.getTerm() == null : this.getTerm().equals(other.getTerm()))
|
||||
@ -64,6 +65,7 @@ public class OrgScoringRuleWithBLOBs extends OrgScoringRule implements Serializa
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
||||
result = prime * result + ((getOrgId() == null) ? 0 : getOrgId().hashCode());
|
||||
result = prime * result + ((getSchoolYear() == null) ? 0 : getSchoolYear().hashCode());
|
||||
result = prime * result + ((getTerm() == null) ? 0 : getTerm().hashCode());
|
||||
|
@ -14,7 +14,6 @@ import club.joylink.rtss.vo.client.*;
|
||||
import club.joylink.rtss.vo.client.org.DepartmentVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.NonNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -445,6 +444,7 @@ public class ExamService implements IExamService {
|
||||
examDefinitionDAO.deleteByPrimaryKey(Long.parseLong(id));
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 查询章节下允许创建的最多题目数量
|
||||
// *
|
||||
@ -465,7 +465,6 @@ public class ExamService implements IExamService {
|
||||
//
|
||||
// return lsRelChapterTrainingList.size();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Long queryTrainingNum(Long lessonId, String trainingType, String operateType) {
|
||||
// 获取课程数据
|
||||
@ -501,6 +500,20 @@ public class ExamService implements IExamService {
|
||||
forceOffline(exam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExamDefinition getEntity(Long examId) {
|
||||
ExamDefinition entity = examDefinitionDAO.selectByPrimaryKey(examId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(entity, String.format("考试[%s]不存在", examId));
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamDefinition> findEntities(List<Long> examIds) {
|
||||
ExamDefinitionExample example = new ExamDefinitionExample();
|
||||
example.createCriteria().andIdIn(examIds);
|
||||
return examDefinitionDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
private void forceOffline(ExamDefinition exam) {
|
||||
exam.setStatus(BusinessConsts.STATUS_NOT_USE);
|
||||
this.examDefinitionDAO.updateByPrimaryKey(exam);
|
||||
@ -590,41 +603,79 @@ public class ExamService implements IExamService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<ExamDefinitionVO> pagedQuerySelfExam4OrgTeacher(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo) {
|
||||
List<OrgLesson> orgLessons;
|
||||
public PageVO<ExamDefinitionVO> pagedQueryExamICreated(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo) {
|
||||
List<Long> lessonIds;
|
||||
if (queryVO.getLessonId() != null) {
|
||||
orgLessons = iOrgLessonService.findEntities(queryVO.getLessonId());
|
||||
lessonIds = List.of(queryVO.getLessonId());
|
||||
} else {
|
||||
Org topOrg = iOrgService.getEntity(loginInfo.getProject());
|
||||
List<Integer> clsIds = iOrgService.findEntitiesByParentId(topOrg.getId(), null).stream().map(Org::getId).collect(Collectors.toList());
|
||||
orgLessons = iOrgLessonService.findEntities(clsIds);
|
||||
lessonIds = iLessonService.queryLessonICreatedInLoginProject(loginInfo).stream().map(LessonVO::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<Long, List<OrgLesson>> lessonOrgMap = orgLessons.stream().collect(Collectors.groupingBy(OrgLesson::getLessonId));
|
||||
List<Long> lessonIds = orgLessons.stream().map(OrgLesson::getLessonId).collect(Collectors.toList());
|
||||
ExamDefinitionExample example = new ExamDefinitionExample();
|
||||
ExamDefinitionExample.Criteria criteria = example.createCriteria().andLessonIdIn(lessonIds).andCreatorIdEqualTo(loginInfo.getUserVO().getId());
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
if (CollectionUtils.isEmpty(lessonIds)) {
|
||||
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());
|
||||
} else {
|
||||
List<OrgLesson> orgLessons = iOrgLessonService.findEntitiesByLessonIds(lessonIds);
|
||||
Map<Long, List<Integer>> lessonOrgMap = orgLessons.stream()
|
||||
.collect(Collectors.groupingBy(OrgLesson::getLessonId, Collectors.mapping(OrgLesson::getOrgId, Collectors.toList())));
|
||||
ExamDefinitionExample example = new ExamDefinitionExample();
|
||||
ExamDefinitionExample.Criteria criteria = example.createCriteria().andLessonIdIn(lessonIds).andCreatorIdEqualTo(loginInfo.getUserVO().getId());
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<ExamDefinition> page = (Page<ExamDefinition>) examDefinitionDAO.selectByExample(example);
|
||||
List<ExamDefinitionVO> list = page.getResult().stream().map(examDefinition -> {
|
||||
ExamDefinitionVO vo = new ExamDefinitionVO(examDefinition);
|
||||
vo.setClsIds(lessonOrgMap.get(vo.getLessonId()));
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
return PageVO.convert(page, list);
|
||||
}
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<ExamDefinition> page = (Page<ExamDefinition>) examDefinitionDAO.selectByExample(example);
|
||||
List<ExamDefinitionVO> list = page.getResult().stream().map(examDefinition -> {
|
||||
ExamDefinitionVO vo = new ExamDefinitionVO(examDefinition);
|
||||
vo.setClsIds(lessonOrgMap.get(vo.getLessonId()).stream().map(OrgLesson::getOrgId).collect(Collectors.toList()));
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
return PageVO.convert(page, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamDefinitionVO> listQueryOrgExamOfSelf(@NonNull Integer clsId, LoginUserInfoVO loginInfo) {
|
||||
List<Long> lessonIds = iOrgLessonService.findEntities(clsId).stream().map(OrgLesson::getLessonId).collect(Collectors.toList());
|
||||
public List<ExamDefinitionVO> listQueryOrgExamICreated(Integer clsId, LoginUserInfoVO loginInfo) {
|
||||
List<Long> lessonIds;
|
||||
if (clsId == null) {
|
||||
Org topOrg = iOrgService.getEntity(loginInfo.getProject(), BusinessConsts.Org.Status.VALID);
|
||||
List<Org> clsList = iOrgService.findEntitiesByParentId(topOrg.getId(), "id", BusinessConsts.Org.Status.VALID);
|
||||
List<Integer> clsIds = clsList.stream().map(Org::getId).collect(Collectors.toList());
|
||||
lessonIds = iOrgLessonService.findEntitiesByOrgIds(clsIds).stream().map(OrgLesson::getLessonId).collect(Collectors.toList());
|
||||
} else {
|
||||
lessonIds = iOrgLessonService.findEntities(clsId).stream().map(OrgLesson::getLessonId).collect(Collectors.toList());
|
||||
}
|
||||
return findEntityByLessonIdList(lessonIds).stream()
|
||||
.filter(exam -> loginInfo.getUserVO().getId().equals(exam.getCreatorId()))
|
||||
.map(ExamDefinitionVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamDefinitionVO> listQueryExamICreated(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo) {
|
||||
List<Long> lessonIds;
|
||||
if (queryVO.getLessonId() != null) {
|
||||
lessonIds = List.of(queryVO.getLessonId());
|
||||
} else {
|
||||
lessonIds = iLessonService.queryLessonICreatedInLoginProject(loginInfo).stream().map(LessonVO::getId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isEmpty(lessonIds)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
List<OrgLesson> orgLessons = iOrgLessonService.findEntitiesByLessonIds(lessonIds);
|
||||
Map<Long, List<Integer>> lessonOrgMap = orgLessons.stream()
|
||||
.collect(Collectors.groupingBy(OrgLesson::getLessonId, Collectors.mapping(OrgLesson::getOrgId, Collectors.toList())));
|
||||
ExamDefinitionExample example = new ExamDefinitionExample();
|
||||
ExamDefinitionExample.Criteria criteria = example.createCriteria().andLessonIdIn(lessonIds).andCreatorIdEqualTo(loginInfo.getUserVO().getId());
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
List<ExamDefinition> exams = examDefinitionDAO.selectByExample(example);
|
||||
return exams.stream().map(examDefinition -> {
|
||||
ExamDefinitionVO vo = new ExamDefinitionVO(examDefinition);
|
||||
vo.setClsIds(lessonOrgMap.get(vo.getLessonId()));
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
private List<ExamDefinition> findEntityByLessonIdList(List<Long> lessonIdList) {
|
||||
if (CollectionUtils.isEmpty(lessonIdList)) {
|
||||
return new ArrayList<>();
|
||||
|
@ -49,11 +49,11 @@ public interface IExamService {
|
||||
*/
|
||||
void deleteExam(String id, UserVO userVO);
|
||||
|
||||
|
||||
// /**
|
||||
// * 查询章节下允许创建的最多题目数量
|
||||
// */
|
||||
// int queryTrainingNum(String lessonId, String chapterId);
|
||||
|
||||
/**
|
||||
* 根据课程和实训类型查询实训数量
|
||||
*/
|
||||
@ -84,10 +84,19 @@ public interface IExamService {
|
||||
/**
|
||||
* 分页查询组织老师个人创建的考试
|
||||
*/
|
||||
PageVO<ExamDefinitionVO> pagedQuerySelfExam4OrgTeacher(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
PageVO<ExamDefinitionVO> pagedQueryExamICreated(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 不分页查询组织老师个人创建的考试
|
||||
*/
|
||||
List<ExamDefinitionVO> listQueryOrgExamOfSelf(Integer clsId, LoginUserInfoVO loginInfo);
|
||||
List<ExamDefinitionVO> listQueryOrgExamICreated(Integer clsId, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 查询当前项目下“我”创建的考试
|
||||
*/
|
||||
List<ExamDefinitionVO> listQueryExamICreated(ExamDefinitionQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
ExamDefinition getEntity(Long examId);
|
||||
|
||||
List<ExamDefinition> findEntities(List<Long> examIds);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.*;
|
||||
@ -153,12 +154,17 @@ public interface ILessonService {
|
||||
PageVO<LessonVO> pagedQueryPersonalLesson(LessonQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 查询用户当前登录的项目下的课程(仅课程的信息)
|
||||
* 查询自己创建的、当前登录的项目下的课程(仅课程的信息)
|
||||
*/
|
||||
List<LessonVO> queryPersonalLesson(LoginUserInfoVO loginInfo);
|
||||
List<LessonVO> queryLessonICreatedInLoginProject(LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 查询自己为指定班级创建的课程
|
||||
*/
|
||||
List<LessonVO> queryOrgLessonOfSelf(Integer clsId, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 查询由该用户创建的、在这个项目下的课程
|
||||
*/
|
||||
List<LessonVO> queryLessons(Long userId, Project project);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.constants.MapStatus;
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.dao.*;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.entity.LsLessonExample.Criteria;
|
||||
@ -573,20 +574,8 @@ public class LessonService implements ILessonService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LessonVO> queryPersonalLesson(LoginUserInfoVO loginInfo) {
|
||||
List<MapVO> maps = iMapService.findOnlineMapByProjectCode(loginInfo.getProject().name());
|
||||
if (CollectionUtils.isEmpty(maps)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
List<Long> mapIds = maps.stream().map(MapVO::getId).collect(Collectors.toList());
|
||||
LsLessonExample example = new LsLessonExample();
|
||||
example.createCriteria()
|
||||
.andMapIdIn(mapIds)
|
||||
.andCreatorIdEqualTo(loginInfo.getUserVO().getId())
|
||||
.andSysfaultEqualTo(false);
|
||||
List<LsLesson> list = lessonDAO.selectByExample(example);
|
||||
return LessonVO.convert(list);
|
||||
}
|
||||
public List<LessonVO> queryLessonICreatedInLoginProject(LoginUserInfoVO loginInfo) {
|
||||
return queryLessons(loginInfo.getUserVO().getId(), loginInfo.getProject());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -597,6 +586,23 @@ public class LessonService implements ILessonService {
|
||||
.filter(lesson->loginInfo.getUserVO().getId().equals(lesson.getCreatorId())).map(LessonVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LessonVO> queryLessons(Long userId, Project project) {
|
||||
List<MapVO> maps = iMapService.findOnlineMapByProjectCode(project.name());
|
||||
if (CollectionUtils.isEmpty(maps)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
List<Long> mapIds = maps.stream().map(MapVO::getId).collect(Collectors.toList());
|
||||
LsLessonExample example = new LsLessonExample();
|
||||
example.createCriteria()
|
||||
.andMapIdIn(mapIds)
|
||||
.andCreatorIdEqualTo(userId)
|
||||
.andSysfaultEqualTo(false);
|
||||
List<LsLesson> list = lessonDAO.selectByExample(example);
|
||||
return LessonVO.convert(list);
|
||||
}
|
||||
}
|
||||
|
||||
private List<LsLesson> findLessonEntities(List<Long> lessonIds) {
|
||||
if (CollectionUtils.isEmpty(lessonIds)) {
|
||||
return new ArrayList<>();
|
||||
|
@ -324,7 +324,7 @@ public class UserExamService implements IUserExamService {
|
||||
.collect(Collectors.toMap(UserExam::getUserId, Function.identity()));
|
||||
|
||||
Map<Long, SysUser> userMap = iSysUserService.findEntity(userIds, "id").stream().collect(Collectors.toMap(SysUser::getId, Function.identity()));
|
||||
Org topOrg = iOrgService.getTopOrgEntity(orgId);
|
||||
Org topOrg = iOrgService.getTopOrgEntity(orgId, BusinessConsts.Org.Status.VALID);
|
||||
List<UserExamVO> vos = userIds.stream().map(userId -> {
|
||||
UserExam userExam = userExamMap.get(userId);
|
||||
UserExamVO vo;
|
||||
|
@ -88,7 +88,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
// 删除旧联锁数据,保存新联锁数据
|
||||
this.draftMapService.cleanAndSaveCiData(mapId, approachSectionVOList,
|
||||
routeVOList, overlapVOList, flsVOList, autoSignalNewVOList,
|
||||
autoReentryVOList,destinationCodeDefinitionVOList, result.getRoutingList(),result.getStationRunLevelList());
|
||||
autoReentryVOList, destinationCodeDefinitionVOList, result.getRoutingList(), result.getStationRunLevelList());
|
||||
|
||||
return result.convert2VO();
|
||||
}
|
||||
@ -324,6 +324,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
Boolean leftFrontTurnBack = null;
|
||||
Station rightStation = null;
|
||||
Boolean rightFrontTurnBack = null;
|
||||
Route route = null;
|
||||
|
||||
int codeNum = 1;
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
@ -352,7 +353,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
rightFrontTurnBack = endTbSection.isNormalStandTrack();
|
||||
destinationCodeDefinitionList.add(
|
||||
new DestinationCodeDefinition(code, type, description, startSection, section, right, necessarySections,
|
||||
leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, null, null)
|
||||
leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, route, null, null)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -373,13 +374,14 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
return new CiGenerateResult(errorList, approachList,
|
||||
autoSignalList, generatedRouteList, generatedOverlapList, flsList,
|
||||
generateCycleList, generateRoutingList,generatedStationRunLevelList, destinationCodeDefinitionList);
|
||||
generateCycleList, generateRoutingList, generatedStationRunLevelList, destinationCodeDefinitionList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 筛选站后折返轨(优先右行站台折返)
|
||||
*
|
||||
* @param stations 所有车站
|
||||
* @param right 是否是右端车站
|
||||
* @param right 是否是右端车站
|
||||
*/
|
||||
private List<Section> queryFrontTurnBackList(List<Station> stations, Station station, boolean right) {
|
||||
List<Section> turnBackList = station.getTurnBackList();
|
||||
@ -425,6 +427,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 筛选站前折返轨
|
||||
*
|
||||
* @param right 是否是右端车站
|
||||
*/
|
||||
private List<Section> queryAfterTurnBackList(Station station, boolean right) {
|
||||
@ -506,12 +509,13 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 生成进路
|
||||
* @param start 始端信号机
|
||||
* @param routeCodeGenerator 进路code生成器
|
||||
* @param overlapMap 已经构建的延续保护数据map(key-信号机code,val-延续保护路径)
|
||||
*
|
||||
* @param start 始端信号机
|
||||
* @param routeCodeGenerator 进路code生成器
|
||||
* @param overlapMap 已经构建的延续保护数据map(key-信号机code,val-延续保护路径)
|
||||
* @param overlapCodeGenerator 延续保护code生成器
|
||||
* @param config 生成配置
|
||||
* @param errorList 生成错误信息
|
||||
* @param config 生成配置
|
||||
* @param errorList 生成错误信息
|
||||
*/
|
||||
private List<Route> generateRoute(Signal start, CodeGenerator routeCodeGenerator,
|
||||
Map<String, List<RouteOverlap>> overlapMap,
|
||||
@ -575,7 +579,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
routeList.add(route);
|
||||
++index;
|
||||
}
|
||||
} else if(config.isOverlapSettingByTrigger()) { // 触发建立,进路不绑定延续保护
|
||||
} else if (config.isOverlapSettingByTrigger()) { // 触发建立,进路不绑定延续保护
|
||||
String code = routeCodeGenerator.next();
|
||||
String name = String.format("%s-%s", start.getName(), endName);
|
||||
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath,
|
||||
@ -594,13 +598,14 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errorList.add(String.format("以[%s(%s)]为始端信号的进路未搜索到",start.getName(), start.getCode()));
|
||||
errorList.add(String.format("以[%s(%s)]为始端信号的进路未搜索到", start.getName(), start.getCode()));
|
||||
}
|
||||
return routeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询距给给定信号机最近的信号机
|
||||
*
|
||||
* @param signal
|
||||
* @param sectionPath
|
||||
* @return
|
||||
@ -629,6 +634,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 根据信号机配置,删除不需要的基本进路
|
||||
*
|
||||
* @param signalList
|
||||
* @param generatedRouteList
|
||||
*/
|
||||
@ -672,6 +678,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 构建道岔定位侧防
|
||||
*
|
||||
* @param aSwitch
|
||||
* @param fpCodeGenerator
|
||||
* @return
|
||||
@ -761,6 +768,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 构建道岔反位侧防
|
||||
*
|
||||
* @param aSwitch
|
||||
* @param fpCodeGenerator
|
||||
* @return
|
||||
@ -848,9 +856,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
Section routingEndSection = (Section) deviceMap.get(routing.getEndSectionCode());
|
||||
Boolean right = routing.getRight();
|
||||
List<MapRoutingSectionNewVO> sectionCodeList = routing.getParkSectionCodeList();
|
||||
for (int i = 0; i < sectionCodeList.size()-1; i++) {
|
||||
for (int i = 0; i < sectionCodeList.size() - 1; i++) {
|
||||
Section startSection = (Section) deviceMap.get(sectionCodeList.get(i).getSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(sectionCodeList.get(i+1).getSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(sectionCodeList.get(i + 1).getSectionCode());
|
||||
//已创建
|
||||
boolean exist = false;
|
||||
for (MapStationRunLevelVO vo : generatedStationRunLevelList) {
|
||||
@ -900,7 +908,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
String.format("%s(%s)->%s(%s)",
|
||||
routingStartSection.getStation().getName(), routingStartSection.getName(),
|
||||
routingEndSection.getStation().getName(), routingEndSection.getName()),
|
||||
!right ? "右向":"左向"));
|
||||
!right ? "右向" : "左向"));
|
||||
runLevelVO.setRight(!right);
|
||||
}
|
||||
}
|
||||
@ -1143,6 +1151,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 生成折返进路
|
||||
*
|
||||
* @param routeList
|
||||
* @param routeCodeGenerator
|
||||
* @param config
|
||||
@ -1221,6 +1230,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 查询进路终端信号机的临近反向信号机
|
||||
*
|
||||
* @param end
|
||||
* @return
|
||||
*/
|
||||
@ -1248,13 +1258,14 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 生成进路的敌对关系
|
||||
*
|
||||
* @param routeList
|
||||
*/
|
||||
private void buildRouteConflict(List<Route> routeList) {
|
||||
// 敌对进路:两进路方向相反,且始端信号机在同一区段或有共同区段,但无冲突道岔
|
||||
for (int i = 0; i < routeList.size(); i++) {
|
||||
Route route1 = routeList.get(i);
|
||||
for (int j = i+1; j < routeList.size(); j++) {
|
||||
for (int j = i + 1; j < routeList.size(); j++) {
|
||||
Route route2 = routeList.get(j);
|
||||
if (route1.containConflictRoute(route2)) {
|
||||
continue;
|
||||
@ -1283,14 +1294,15 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 构造进路对象
|
||||
*
|
||||
* @param code
|
||||
* @param name
|
||||
* @param start 始端信号机
|
||||
* @param end 终端信号机
|
||||
* @param endButton 建立方式为按钮点选方式时,终端按钮信号机
|
||||
* @param start 始端信号机
|
||||
* @param end 终端信号机
|
||||
* @param endButton 建立方式为按钮点选方式时,终端按钮信号机
|
||||
* @param sectionPath
|
||||
* @param routeOverlap
|
||||
* @param alwaysGreen 进路始端信号是否总是开绿灯
|
||||
* @param alwaysGreen 进路始端信号是否总是开绿灯
|
||||
* @return
|
||||
*/
|
||||
private Route buildRoute(String code, String name,
|
||||
@ -1372,9 +1384,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 根据路径创建延续保护
|
||||
* @param end 延续保护始端信号机
|
||||
*
|
||||
* @param end 延续保护始端信号机
|
||||
* @param overlapCodeGenerator code生成器
|
||||
* @param config 配置
|
||||
* @param config 配置
|
||||
* @param errorList
|
||||
* @return
|
||||
*/
|
||||
@ -1456,7 +1469,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
if (routeOverlap.containRpSwitch()) {
|
||||
routeOverlap.setName(routeOverlap.getName() + "_2");
|
||||
} else {
|
||||
routeOverlap.setName(routeOverlap.getName()+"_1");
|
||||
routeOverlap.setName(routeOverlap.getName() + "_1");
|
||||
}
|
||||
}
|
||||
} else if (list.size() > 2) {
|
||||
@ -1562,11 +1575,12 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 获取延续保护路径
|
||||
*
|
||||
* @param section
|
||||
* @param right 方向
|
||||
* @param tempPath 临时路径
|
||||
* @param right 方向
|
||||
* @param tempPath 临时路径
|
||||
* @param overlapPathList 最终结果列表
|
||||
* @param config 生成配置参数
|
||||
* @param config 生成配置参数
|
||||
* @param errorList
|
||||
*/
|
||||
private void getOverlapPathOf(Section section, boolean right,
|
||||
@ -1663,12 +1677,13 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 获取可走的进路路径
|
||||
* @param section 下一个区段
|
||||
* @param ground 是否查询地面信号
|
||||
* @param tempPath 临时路径
|
||||
*
|
||||
* @param section 下一个区段
|
||||
* @param ground 是否查询地面信号
|
||||
* @param tempPath 临时路径
|
||||
* @param routePathList 最终结果
|
||||
* @param config 生成配置参数
|
||||
* @param errorList 错误信息
|
||||
* @param config 生成配置参数
|
||||
* @param errorList 错误信息
|
||||
*/
|
||||
private void getRoutePathOf(Signal startSignal, Section section, boolean ground,
|
||||
SectionPath tempPath, List<SectionPath> routePathList,
|
||||
@ -1768,6 +1783,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 生成接近区段
|
||||
*
|
||||
* @param signal
|
||||
* @param config
|
||||
*/
|
||||
@ -1786,7 +1802,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
List<Section> logicApproachList = new ArrayList<>();
|
||||
List<Section> sectionList = sectionPath.getSectionList();
|
||||
for (Section phySection : sectionList) {
|
||||
if(len >= 600) break;
|
||||
if (len >= 600) break;
|
||||
if (phySection.isSwitchTrack()) {
|
||||
len += phySection.getLen();
|
||||
logicApproachList.add(phySection);
|
||||
@ -1805,7 +1821,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
for (Section logic : sortedList) {
|
||||
logicApproachList.add(logic);
|
||||
len += logic.getLen();
|
||||
if(len >= 600) break;
|
||||
if (len >= 600) break;
|
||||
}
|
||||
}
|
||||
sectionPath.setLogicList(logicApproachList);
|
||||
@ -1874,8 +1890,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
} else {
|
||||
throw BusinessExceptionAssertEnum.DATA_ERROR.exception(
|
||||
String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
|
||||
section.getName(), section.getCode(),
|
||||
relSwitch.getName(), relSwitch.getCode()));
|
||||
section.getName(), section.getCode(),
|
||||
relSwitch.getName(), relSwitch.getCode()));
|
||||
}
|
||||
} else {
|
||||
tempPath.addSection(section);
|
||||
@ -1886,6 +1902,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
|
||||
/**
|
||||
* 生成自动信号
|
||||
*
|
||||
* @param signal
|
||||
* @param autoSignalGenerator
|
||||
* @param errorList
|
||||
|
@ -16,7 +16,9 @@ public interface IOrgLessonService {
|
||||
/**
|
||||
* 查询这些组织的课程关联关系
|
||||
*/
|
||||
List<OrgLesson> findEntities(List<Integer> orgIds);
|
||||
List<OrgLesson> findEntitiesByOrgIds(List<Integer> orgIds);
|
||||
|
||||
List<OrgLesson> findEntitiesByLessonIds(List<Long> lessonIds);
|
||||
|
||||
List<OrgLesson> findEntities(Long lessonId);
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
package club.joylink.rtss.services.org;
|
||||
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.org.DepartmentVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgScoringResultVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgScoringRuleQueryVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgScoringRuleVO;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -12,19 +15,13 @@ public interface IOrgScoringRuleService {
|
||||
/**
|
||||
* 创建评分规则
|
||||
*/
|
||||
void createScoringRule(OrgScoringRuleVO orgScoringRuleVO, UserVO user);
|
||||
void createScoringRule(OrgScoringRuleVO orgScoringRuleVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 更新评分规则
|
||||
*/
|
||||
void updateScoringRule(OrgScoringRuleVO orgScoringRuleVO, UserVO user);
|
||||
|
||||
/**
|
||||
* 使用评分规则评分
|
||||
* @return
|
||||
*/
|
||||
List<OrgScoringResultVO> score(OrgScoringRuleVO orgScoringRuleVO, UserVO user);
|
||||
|
||||
/**
|
||||
* 查询自己创建的评价规则基础信息
|
||||
*/
|
||||
@ -33,7 +30,7 @@ public interface IOrgScoringRuleService {
|
||||
/**
|
||||
* 查询自己创建的指定评价规则的详细信息
|
||||
*/
|
||||
OrgScoringRuleVO queryOrgScoringRuleDetails(Integer orgId, String schoolYear, Integer term, UserVO user);
|
||||
OrgScoringRuleVO queryOrgScoringRuleDetails(Integer orgId, String schoolYear, Integer term, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 根据id获取规则详情
|
||||
@ -48,5 +45,17 @@ public interface IOrgScoringRuleService {
|
||||
/**
|
||||
* 使用评分规则进行评分
|
||||
*/
|
||||
List<OrgScoringResultVO> score(Integer orgId, String schoolYear, Integer term, UserVO user);
|
||||
List<OrgScoringResultVO> score(Integer orgId, String schoolYear, Integer term, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 将评价规则应用到
|
||||
*/
|
||||
@Transactional
|
||||
void applyOrgScoringRule(Long ruleId, List<Integer> orgIds);
|
||||
|
||||
/**
|
||||
* 查询评价规则能应用到的组织
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentVO> queryRuleCanApplyTo(Long ruleId);
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ import club.joylink.rtss.entity.Org;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.org.CompanyQueryVO;
|
||||
import club.joylink.rtss.vo.client.org.CompanyVO;
|
||||
import club.joylink.rtss.vo.client.org.DepartmentVO;
|
||||
import club.joylink.rtss.vo.client.org.NonTopOrgCreateVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgQueryVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -19,7 +19,7 @@ public interface IOrgService {
|
||||
|
||||
Org getEntity(Integer orgId);
|
||||
|
||||
Org getEntity(Project project);
|
||||
Org getEntity(Project project, String status);
|
||||
|
||||
CompanyVO updateOrg(Integer id, CompanyVO companyVO, UserVO user);
|
||||
|
||||
@ -28,21 +28,28 @@ public interface IOrgService {
|
||||
*/
|
||||
void deleteNonTopOrg(Integer nonTopOrgId);
|
||||
|
||||
List<Org> findEntitiesByParentId(Integer parentId, String orderBy);
|
||||
List<Org> findEntitiesByParentId(Integer parentId, String orderBy, String status);
|
||||
|
||||
/**
|
||||
* 分页查询自己创建的班级
|
||||
* @param self 是否仅查询自己创建的
|
||||
*/
|
||||
PageVO<DepartmentVO> pagedQueryCls(CompanyQueryVO queryVO, LoginUserInfoVO loginInfo, boolean self);
|
||||
PageVO<DepartmentVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo, boolean self);
|
||||
|
||||
/**
|
||||
* 查询自己创建的班级
|
||||
*/
|
||||
List<DepartmentVO> queryCls(CompanyQueryVO queryVO, LoginUserInfoVO loginInfo, boolean self);
|
||||
List<DepartmentVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo, boolean self);
|
||||
|
||||
/**
|
||||
* 获取该组织所属的顶级组织
|
||||
*/
|
||||
Org getTopOrgEntity(Integer orgId);
|
||||
Org getTopOrgEntity(Integer orgId, String status);
|
||||
|
||||
List<Org> findEntities(List<Integer> orgIds, String status);
|
||||
|
||||
/**
|
||||
* 管理员分页查询组织
|
||||
*/
|
||||
PageVO<DepartmentVO> adminPagedQueryOrg(OrgQueryVO queryVO);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public interface IOrgUserService {
|
||||
|
||||
boolean isExistWithCompanyName(String name);
|
||||
|
||||
PageVO<CompanyVO> queryPageOrganizations(CompanyQueryVO queryVO);
|
||||
PageVO<CompanyVO> queryPageOrganizations(OrgQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 用户绑定为单位管理员
|
||||
@ -96,4 +96,6 @@ public interface IOrgUserService {
|
||||
void createOrgUser(Integer orgId, Long userId, BusinessConsts.OrgRole role);
|
||||
|
||||
List<OrgUser> findEntities(Integer orgId, BusinessConsts.OrgRole role);
|
||||
|
||||
List<OrgUser> findEntities(List<Integer> orgIds, BusinessConsts.OrgRole role);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class OrgLessonService implements IOrgLessonService{
|
||||
public class OrgLessonService implements IOrgLessonService {
|
||||
@Autowired
|
||||
private OrgLessonDAO orgLessonDAO;
|
||||
|
||||
@ -45,14 +45,14 @@ public class OrgLessonService implements IOrgLessonService{
|
||||
List<OrgLesson> orgLessons = findEntitiesByOrgId(orgId);
|
||||
if (CollectionUtils.isEmpty(orgLessons)) {
|
||||
return new ArrayList<>();
|
||||
} else{
|
||||
} else {
|
||||
List<Long> lessonIds = orgLessons.stream().map(OrgLesson::getLessonId).collect(Collectors.toList());
|
||||
return iLessonService.queryByIds(lessonIds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgLesson> findEntities(List<Integer> orgIds) {
|
||||
public List<OrgLesson> findEntitiesByOrgIds(List<Integer> orgIds) {
|
||||
if (CollectionUtils.isEmpty(orgIds)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
@ -62,6 +62,17 @@ public class OrgLessonService implements IOrgLessonService{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgLesson> findEntitiesByLessonIds(List<Long> lessonIds) {
|
||||
if (CollectionUtils.isEmpty(lessonIds)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
OrgLessonExample example = new OrgLessonExample();
|
||||
example.createCriteria().andLessonIdIn(lessonIds);
|
||||
return orgLessonDAO.selectByExample(example);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgLesson> findEntities(Long lessonId) {
|
||||
OrgLessonExample example = new OrgLessonExample();
|
||||
|
@ -1,16 +1,21 @@
|
||||
package club.joylink.rtss.services.org;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.dao.OrgDAO;
|
||||
import club.joylink.rtss.dao.OrgScoringRuleDAO;
|
||||
import club.joylink.rtss.dao.OrgScoringRuleRelDAO;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.IExamService;
|
||||
import club.joylink.rtss.services.ISysUserService;
|
||||
import club.joylink.rtss.services.IUserExamService;
|
||||
import club.joylink.rtss.services.IUserUsageStatsService;
|
||||
import club.joylink.rtss.services.user.ISysUserLoginService;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.UserRankStatsVO;
|
||||
import club.joylink.rtss.vo.client.org.DepartmentVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgScoringResultVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgScoringRuleQueryVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgScoringRuleVO;
|
||||
@ -23,10 +28,8 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@ -52,12 +55,26 @@ public class OrgScoringRuleService implements IOrgScoringRuleService {
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
@Autowired
|
||||
private IExamService iExamService;
|
||||
|
||||
@Autowired
|
||||
private OrgScoringRuleRelDAO orgScoringRuleRelDAO;
|
||||
|
||||
@Autowired
|
||||
private IOrgLessonService iOrgLessonService;
|
||||
|
||||
@Autowired
|
||||
private OrgDAO orgDAO;
|
||||
|
||||
|
||||
@Override
|
||||
public void createScoringRule(OrgScoringRuleVO orgScoringRuleVO, UserVO user) {
|
||||
this.check4Create(orgScoringRuleVO, user.getId());
|
||||
public void createScoringRule(OrgScoringRuleVO orgScoringRuleVO, LoginUserInfoVO loginInfo) {
|
||||
Org topOrg = iOrgService.getEntity(loginInfo.getProject(), BusinessConsts.Org.Status.VALID);
|
||||
this.check4Create(orgScoringRuleVO, topOrg.getId(), loginInfo.getUserVO().getId());
|
||||
OrgScoringRuleWithBLOBs rule = orgScoringRuleVO.convert2DB();
|
||||
rule.setCreatorId(user.getId());
|
||||
rule.setOrgId(topOrg.getId());
|
||||
rule.setCreatorId(loginInfo.getUserVO().getId());
|
||||
rule.setCreateTime(LocalDateTime.now());
|
||||
orgScoringRuleDAO.insert(rule);
|
||||
}
|
||||
@ -65,46 +82,27 @@ public class OrgScoringRuleService implements IOrgScoringRuleService {
|
||||
@Override
|
||||
public void updateScoringRule(OrgScoringRuleVO orgScoringRuleVO, UserVO user) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(orgScoringRuleVO.getId(), "id不能为null");
|
||||
this.check4Update(orgScoringRuleVO, user.getId());
|
||||
OrgScoringRuleWithBLOBs entity = getEntity(orgScoringRuleVO.getId());
|
||||
this.check4Update(orgScoringRuleVO);
|
||||
OrgScoringRuleWithBLOBs entity = getRuleEntity(orgScoringRuleVO.getId());
|
||||
OrgScoringRuleWithBLOBs rule = orgScoringRuleVO.cover4Update(entity);
|
||||
rule.setUpdateId(user.getId());
|
||||
rule.setUpdateTime(LocalDateTime.now());
|
||||
orgScoringRuleDAO.updateByPrimaryKeyWithBLOBs(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgScoringResultVO> score(@NonNull OrgScoringRuleVO orgScoringRuleVO, @NonNull UserVO user) {
|
||||
orgScoringRuleVO.check4Use();
|
||||
List<OrgUser> students = iOrgUserService.findEntities(orgScoringRuleVO.getOrgId(), BusinessConsts.OrgRole.Student);
|
||||
List<Long> userIds = students.stream().map(OrgUser::getUserId).collect(Collectors.toList());
|
||||
Org topOrg = iOrgService.getTopOrgEntity(orgScoringRuleVO.getOrgId());
|
||||
List<String> projects = List.of(topOrg.getProjectCode().split(","));
|
||||
int totalWeight = orgScoringRuleVO.calculateTotalWeight();
|
||||
Map<Long, Integer> usualScoreMap = new HashMap<>();
|
||||
if (orgScoringRuleVO.getUsualScoringRule() != null) {
|
||||
usualScoreMap = this.score(userIds, orgScoringRuleVO.getUsualScoringRule(), totalWeight, projects);
|
||||
}
|
||||
Map<Long, Integer> finalScoreMap = new HashMap<>();
|
||||
if (orgScoringRuleVO.getFinalScoringRule() != null) {
|
||||
finalScoreMap = this.score(userIds, orgScoringRuleVO.getFinalScoringRule(), totalWeight, projects);
|
||||
}
|
||||
List<OrgScoringResultVO> list = new ArrayList<>();
|
||||
List<SysUser> users = iSysUserService.findEntity(userIds, "id");
|
||||
for (SysUser sysUser : users) {
|
||||
Long userId = sysUser.getId();
|
||||
String account = sysUser.getAccount().substring(0, sysUser.getAccount().indexOf(topOrg.getCode()));
|
||||
list.add(new OrgScoringResultVO(userId, account, sysUser.getName(), usualScoreMap.get(userId), finalScoreMap.get(userId)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<OrgScoringRuleVO> queryBasicInfo(OrgScoringRuleQueryVO queryVO, UserVO user) {
|
||||
List<Long> ruleIds = null;
|
||||
if (queryVO.getOrgId() != null) {
|
||||
ruleIds = findRelEntities(queryVO.getOrgId()).stream().map(OrgScoringRuleRel::getRuleId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(ruleIds)) {
|
||||
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());
|
||||
}
|
||||
}
|
||||
OrgScoringRuleExample example = new OrgScoringRuleExample();
|
||||
OrgScoringRuleExample.Criteria criteria = example.createCriteria().andCreatorIdEqualTo(user.getId());
|
||||
if (queryVO.getOrgId() != null) {
|
||||
criteria.andOrgIdEqualTo(queryVO.getOrgId());
|
||||
if (!CollectionUtils.isEmpty(ruleIds)) {
|
||||
criteria.andIdIn(ruleIds);
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getSchoolYear())) {
|
||||
criteria.andSchoolYearEqualTo(queryVO.getSchoolYear());
|
||||
@ -114,21 +112,45 @@ public class OrgScoringRuleService implements IOrgScoringRuleService {
|
||||
}
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<OrgScoringRule> page = (Page<OrgScoringRule>) orgScoringRuleDAO.selectByExample(example);
|
||||
List<OrgScoringRuleVO> voList = page.stream().map(OrgScoringRuleVO::buildBasicInfo).collect(Collectors.toList());
|
||||
return PageVO.convert(page, voList);
|
||||
if (CollectionUtils.isEmpty(page)) {
|
||||
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());
|
||||
} else {
|
||||
Map<Long, List<Integer>> rule_org_map = findRelEntities(page.stream().map(OrgScoringRule::getId).collect(Collectors.toList()))
|
||||
.stream().collect(Collectors.groupingBy(OrgScoringRuleRel::getRuleId,
|
||||
Collectors.mapping(OrgScoringRuleRel::getOrgId, Collectors.toList())));
|
||||
List<OrgScoringRuleVO> voList = page.stream().map(rule -> OrgScoringRuleVO.buildBasicInfo(rule, rule_org_map.get(rule.getId())))
|
||||
.collect(Collectors.toList());
|
||||
return PageVO.convert(page, voList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgScoringRuleVO queryOrgScoringRuleDetails(Integer orgId, String schoolYear, Integer term, UserVO user) {
|
||||
public OrgScoringRuleVO queryOrgScoringRuleDetails(Integer orgId, String schoolYear, Integer term, LoginUserInfoVO loginInfo) {
|
||||
Org topOrg = iOrgService.getEntity(loginInfo.getProject(), BusinessConsts.Org.Status.VALID);
|
||||
OrgScoringRuleExample example = new OrgScoringRuleExample();
|
||||
example.createCriteria()
|
||||
.andOrgIdEqualTo(orgId)
|
||||
.andOrgIdEqualTo(topOrg.getId())
|
||||
.andCreatorIdEqualTo(loginInfo.getUserVO().getId())
|
||||
.andSchoolYearEqualTo(schoolYear)
|
||||
.andTermEqualTo(term)
|
||||
.andCreatorIdEqualTo(user.getId());
|
||||
.andTermEqualTo(term);
|
||||
List<OrgScoringRuleWithBLOBs> rules = orgScoringRuleDAO.selectByExampleWithBLOBs(example);
|
||||
if (!CollectionUtils.isEmpty(rules)) {
|
||||
return OrgScoringRuleVO.buildDetails(rules.get(0));
|
||||
List<Long> ruleIds = rules.stream().map(OrgScoringRule::getId).collect(Collectors.toList());
|
||||
List<OrgScoringRuleRel> rels = findRelEntities(ruleIds);
|
||||
if (CollectionUtils.isEmpty(rels)) {
|
||||
return null;
|
||||
} else {
|
||||
OrgScoringRuleRel rel = rels.stream().filter(orgRuleRel -> orgRuleRel.getOrgId().equals(orgId)).limit(1).findAny().orElse(null);
|
||||
if (rel == null) {
|
||||
return null;
|
||||
} else {
|
||||
OrgScoringRuleWithBLOBs rule = rules.stream().filter(orgRule -> orgRule.getId().equals(rel.getRuleId()))
|
||||
.limit(1).findAny().orElse(null);
|
||||
List<Integer> orgIds = rels.stream().filter(orgRuleRel -> orgRuleRel.getRuleId().equals(rule.getId()))
|
||||
.map(OrgScoringRuleRel::getOrgId).collect(Collectors.toList());
|
||||
return OrgScoringRuleVO.buildDetails(rule, orgIds);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -136,13 +158,14 @@ public class OrgScoringRuleService implements IOrgScoringRuleService {
|
||||
|
||||
@Override
|
||||
public OrgScoringRuleVO getOrgScoringRuleDetails(Long ruleId) {
|
||||
OrgScoringRuleWithBLOBs rule = orgScoringRuleDAO.selectByPrimaryKey(ruleId);
|
||||
return OrgScoringRuleVO.buildDetails(rule);
|
||||
OrgScoringRuleWithBLOBs rule = getRuleEntity(ruleId);
|
||||
List<Integer> orgIds = findRelEntities(ruleId).stream().map(OrgScoringRuleRel::getOrgId).collect(Collectors.toList());
|
||||
return OrgScoringRuleVO.buildDetails(rule, orgIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRuleOfSelf(@NonNull Long id, @NonNull Long userId) {
|
||||
OrgScoringRuleWithBLOBs rule = findEntity(id);
|
||||
OrgScoringRuleWithBLOBs rule = findRuleEntity(id);
|
||||
if (rule != null) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertEquals(rule.getCreatorId(), userId,
|
||||
"非本人创建的评价规则不能删除");
|
||||
@ -151,77 +174,247 @@ public class OrgScoringRuleService implements IOrgScoringRuleService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgScoringResultVO> score(@NonNull Integer orgId, @NonNull String schoolYear, @NonNull Integer term, UserVO user) {
|
||||
OrgScoringRuleVO ruleVO = queryOrgScoringRuleDetails(orgId, schoolYear, term, user);
|
||||
public List<OrgScoringResultVO> score(@NonNull Integer orgId, @NonNull String schoolYear, @NonNull Integer term, LoginUserInfoVO loginInfo) {
|
||||
OrgScoringRuleVO ruleVO = queryOrgScoringRuleDetails(orgId, schoolYear, term, loginInfo);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ruleVO, "评价规则不存在");
|
||||
return score(ruleVO, user);
|
||||
return score(ruleVO, orgId);
|
||||
}
|
||||
|
||||
private Map<Long, Integer> score(List<Long> userIds, @NonNull OrgScoringRuleVO.ScoringRule rule, int totalWeight, List<String> projects) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(userIds);
|
||||
Map<Long, Integer> scoreMap = new HashMap<>();
|
||||
for (Long userId : userIds) {
|
||||
int score = 0;
|
||||
@Override
|
||||
public void applyOrgScoringRule(Long ruleId, List<Integer> orgIds) {
|
||||
//校验
|
||||
if (!CollectionUtils.isEmpty(orgIds)) {
|
||||
OrgScoringRuleWithBLOBs rule = getRuleEntity(ruleId);
|
||||
OrgScoringRuleExample ruleExample = new OrgScoringRuleExample();
|
||||
ruleExample.createCriteria()
|
||||
.andOrgIdEqualTo(rule.getOrgId())
|
||||
.andCreatorIdEqualTo(rule.getCreatorId())
|
||||
.andSchoolYearEqualTo(rule.getSchoolYear())
|
||||
.andTermEqualTo(rule.getTerm())
|
||||
.andIdNotEqualTo(ruleId);
|
||||
List<OrgScoringRule> otherRules = orgScoringRuleDAO.selectByExample(ruleExample); //与操作的规则同顶级组织、同创建者、同学年、同学期的其它规则
|
||||
if (!CollectionUtils.isEmpty(otherRules)) {
|
||||
List<Long> otherRuleIds = otherRules.stream()
|
||||
.map(OrgScoringRule::getId).collect(Collectors.toList());
|
||||
OrgScoringRuleRelExample relExample = new OrgScoringRuleRelExample();
|
||||
relExample.createCriteria()
|
||||
.andRuleIdIn(otherRuleIds)
|
||||
.andOrgIdIn(orgIds);
|
||||
List<OrgScoringRuleRel> relList = orgScoringRuleRelDAO.selectByExample(relExample);
|
||||
if (!CollectionUtils.isEmpty(relList)) {
|
||||
List<Integer> ruleRelOrgIds = relList.stream().map(OrgScoringRuleRel::getOrgId).collect(Collectors.toList());
|
||||
Map<Integer, Org> orgMap = iOrgService.findEntities(ruleRelOrgIds, BusinessConsts.Org.Status.VALID).stream().collect(Collectors.toMap(Org::getId, Function.identity()));
|
||||
Map<Long, OrgScoringRule> ruleMap = otherRules.stream().collect(Collectors.toMap(OrgScoringRule::getId, Function.identity()));
|
||||
StringBuilder builder = new StringBuilder();
|
||||
relList.forEach(rel -> {
|
||||
Org org = orgMap.get(rel.getOrgId());
|
||||
if (org != null) {
|
||||
builder.append(String.format("组织[%s]已被应用规则[%s]", org.getName(), ruleMap.get(rel.getRuleId()).getName()));
|
||||
builder.append("\n");
|
||||
}
|
||||
});
|
||||
throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception(builder.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
//处理
|
||||
deleteRelEntities(ruleId);
|
||||
if (!CollectionUtils.isEmpty(orgIds)) {
|
||||
List<OrgScoringRuleRel> rels = orgIds.stream().map(orgId -> {
|
||||
OrgScoringRuleRel rel = new OrgScoringRuleRel();
|
||||
rel.setOrgId(orgId);
|
||||
rel.setRuleId(ruleId);
|
||||
return rel;
|
||||
}).collect(Collectors.toList());
|
||||
orgScoringRuleRelDAO.batchInsert(rels);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DepartmentVO> queryRuleCanApplyTo(Long ruleId) {
|
||||
OrgScoringRuleWithBLOBs rule = getRuleEntity(ruleId);
|
||||
OrgScoringRuleVO vo = OrgScoringRuleVO.buildDetails(rule, null);
|
||||
OrgScoringRuleVO.ScoringRule scoringRule = vo.getScoringRule();
|
||||
Set<Long> lessonIdSet = new HashSet<>();
|
||||
if (!CollectionUtils.isEmpty(scoringRule.getLearningTimeList())) {
|
||||
scoringRule.getLearningTimeList().forEach(learningTime -> lessonIdSet.addAll(learningTime.getLessonIds()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(scoringRule.getExams())) {
|
||||
List<Long> examIds = scoringRule.getExams().stream().map(OrgScoringRuleVO.Exam::getExamId).collect(Collectors.toList());
|
||||
List<ExamDefinition> examDefinitions = iExamService.findEntities(examIds);
|
||||
examDefinitions.forEach(examDefinition -> lessonIdSet.add(examDefinition.getLessonId()));
|
||||
}
|
||||
OrgExample orgExample = new OrgExample();
|
||||
OrgExample.Criteria criteria = orgExample.createCriteria()
|
||||
.andParentIdEqualTo(rule.getOrgId())
|
||||
.andCreatorIdEqualTo(rule.getCreatorId())
|
||||
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
if (!CollectionUtils.isEmpty(lessonIdSet)) {
|
||||
List<OrgLesson> orgLessonList = iOrgLessonService.findEntitiesByLessonIds(new ArrayList<>(lessonIdSet));
|
||||
if (CollectionUtils.isEmpty(orgLessonList)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
Map<Integer, Set<Long>> org_lessons_map = orgLessonList.stream().collect(Collectors.groupingBy(OrgLesson::getOrgId,
|
||||
Collectors.mapping(OrgLesson::getLessonId, Collectors.toSet())));
|
||||
List<Integer> orgIds = org_lessons_map.entrySet().stream().filter(entry -> entry.getValue().containsAll(lessonIdSet))
|
||||
.map(Map.Entry::getKey).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(orgIds)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
criteria.andIdIn(orgIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
return orgDAO.selectByExample(orgExample).stream().map(org -> {
|
||||
DepartmentVO departmentVO = new DepartmentVO();
|
||||
departmentVO.setId(org.getId());
|
||||
departmentVO.setName(org.getName());
|
||||
return departmentVO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void check4Update(OrgScoringRuleVO orgScoringRuleVO) {
|
||||
orgScoringRuleVO.check4Save();
|
||||
OrgScoringRuleWithBLOBs rule = getRuleEntity(orgScoringRuleVO.getId());
|
||||
if (!rule.getSchoolYear().equals(orgScoringRuleVO.getSchoolYear()) || !rule.getTerm().equals(orgScoringRuleVO.getTerm())) { //学年或学期有改动
|
||||
List<Integer> relOrgList = findRelEntities(rule.getId()).stream()
|
||||
.map(OrgScoringRuleRel::getOrgId).collect(Collectors.toList()); //要更新的评价规则关联的组织id
|
||||
if (!CollectionUtils.isEmpty(relOrgList)) {
|
||||
OrgScoringRuleRelExample relExample = new OrgScoringRuleRelExample();
|
||||
relExample.createCriteria().andOrgIdIn(relOrgList).andRuleIdNotEqualTo(rule.getId());
|
||||
List<Long> ruleIds = orgScoringRuleRelDAO.selectByExample(relExample).stream()
|
||||
.map(OrgScoringRuleRel::getRuleId).collect(Collectors.toList()); //要更新的评价规则应用到的组织关联的其它规则
|
||||
OrgScoringRuleExample ruleExample = new OrgScoringRuleExample();
|
||||
ruleExample.createCriteria()
|
||||
.andOrgIdEqualTo(rule.getOrgId())
|
||||
.andCreatorIdEqualTo(rule.getCreatorId())
|
||||
.andSchoolYearEqualTo(orgScoringRuleVO.getSchoolYear())
|
||||
.andTermEqualTo(orgScoringRuleVO.getTerm())
|
||||
.andIdIn(ruleIds);
|
||||
List<OrgScoringRule> rules = orgScoringRuleDAO.selectByExample(ruleExample);
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertCollectionEmpty(rules,
|
||||
"该规则应用到的班级有些已被同学年同学期的其它规则应用到");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<OrgScoringResultVO> score(@NonNull OrgScoringRuleVO orgScoringRuleVO, Integer clsId) {
|
||||
//校验
|
||||
orgScoringRuleVO.check4Use();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(orgScoringRuleVO.getOrgIds(),
|
||||
String.format("评价规则[%s]未被应用到任何一个班级", orgScoringRuleVO.getId()));
|
||||
if (clsId != null) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(orgScoringRuleVO.getOrgIds())
|
||||
&& orgScoringRuleVO.getOrgIds().contains(clsId),
|
||||
String.format("评价规则[%s]可应用的班级不包含[%s]", orgScoringRuleVO.getId(), clsId));
|
||||
}
|
||||
|
||||
List<OrgUser> students;
|
||||
if (clsId == null) {
|
||||
students = iOrgUserService.findEntities(orgScoringRuleVO.getOrgIds(), BusinessConsts.OrgRole.Student);
|
||||
} else {
|
||||
students = iOrgUserService.findEntities(clsId, BusinessConsts.OrgRole.Student);
|
||||
}
|
||||
List<Long> userIds = students.stream().map(OrgUser::getUserId).collect(Collectors.toList());
|
||||
List<SysUser> users = iSysUserService.findEntity(userIds, "id");
|
||||
Org topOrg = iOrgService.getTopOrgEntity(orgScoringRuleVO.getOrgIds().get(0), BusinessConsts.Org.Status.VALID);
|
||||
List<OrgScoringResultVO> results = users.stream().map(sysUser -> {
|
||||
String account = sysUser.getAccount().substring(0, sysUser.getAccount().indexOf(topOrg.getCode()));
|
||||
return new OrgScoringResultVO(sysUser.getId(), account, sysUser.getName());
|
||||
}).collect(Collectors.toList());
|
||||
List<String> projects = List.of(topOrg.getProjectCode().split(","));
|
||||
this.score(results, orgScoringRuleVO.getScoringRule(), projects);
|
||||
return results;
|
||||
}
|
||||
|
||||
private void check4Create(OrgScoringRuleVO orgScoringRuleVO, Integer orgId, Long userId) {
|
||||
orgScoringRuleVO.check4Save();
|
||||
confirmNameUnique(orgScoringRuleVO, orgId, userId);
|
||||
}
|
||||
|
||||
private void confirmNameUnique(OrgScoringRuleVO orgScoringRuleVO, Integer orgId, Long userId) {
|
||||
OrgScoringRuleExample example = new OrgScoringRuleExample();
|
||||
example.createCriteria().andOrgIdEqualTo(orgId).andCreatorIdEqualTo(userId).andNameEqualTo(orgScoringRuleVO.getName());
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(orgScoringRuleDAO.countByExample(example) == 0,
|
||||
"有重名的规则");
|
||||
}
|
||||
|
||||
private void score(List<OrgScoringResultVO> results, @NonNull OrgScoringRuleVO.ScoringRule rule, List<String> projects) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(results);
|
||||
Map<Long, Integer> examScoreMap = new HashMap<>(); //考试及其满分
|
||||
for (OrgScoringResultVO result : results) {
|
||||
Long userId = result.getUserId();
|
||||
//考勤分
|
||||
OrgScoringRuleVO.Attendance attendance = rule.getAttendance();
|
||||
if (attendance != null) {
|
||||
int loginDays = iSysUserLoginService.getLoginDays(userId, attendance.getStartDate(), attendance.getEndDate(), projects);
|
||||
score += attendance.calculateScore(loginDays, totalWeight);
|
||||
result.setAttendanceScore(attendance.calculateScore(loginDays));
|
||||
}
|
||||
//课时分
|
||||
List<OrgScoringRuleVO.LearningTime> learningTimeList = rule.getLearningTimeList();
|
||||
if (!CollectionUtils.isEmpty(learningTimeList)) {
|
||||
for (OrgScoringRuleVO.LearningTime learningTime : learningTimeList) {
|
||||
int score = learningTimeList.stream().mapToInt(learningTime -> {
|
||||
UserRankStatsVO vo = iUserUsageStatsService.statisticsLessonLearningDuration(learningTime.getLessonIds(), userId);
|
||||
score += learningTime.calculateScore(vo.getDuration(), totalWeight);
|
||||
}
|
||||
return learningTime.calculateScore(vo.getDuration());
|
||||
}).sum();
|
||||
result.setLearningTimeScore(score);
|
||||
}
|
||||
//考试分
|
||||
List<OrgScoringRuleVO.Exam> exams = rule.getExams();
|
||||
if (!CollectionUtils.isEmpty(exams)) {
|
||||
for (OrgScoringRuleVO.Exam exam : exams) {
|
||||
Integer examScore = iUserExamService.queryHeightScoreOfUserExam(userId, exam.getExamId());
|
||||
score += exam.calculateScore(examScore, totalWeight);
|
||||
}
|
||||
int score = exams.stream().mapToInt(exam -> {
|
||||
Integer userScore = iUserExamService.queryHeightScoreOfUserExam(userId, exam.getExamId());
|
||||
Integer examFullMarks = examScoreMap.get(exam.getExamId());
|
||||
if (examFullMarks == null) {
|
||||
ExamDefinition examDefinition = iExamService.getEntity(exam.getExamId());
|
||||
examFullMarks = examDefinition.getFullPoint();
|
||||
examScoreMap.put(exam.getExamId(), examFullMarks);
|
||||
}
|
||||
return exam.calculateScore(userScore, examFullMarks);
|
||||
}).sum();
|
||||
result.setExamScore(score);
|
||||
}
|
||||
scoreMap.put(userId, score);
|
||||
}
|
||||
return scoreMap;
|
||||
}
|
||||
|
||||
private void check4Create(OrgScoringRuleVO vo, Long userId) {
|
||||
vo.check4Save();
|
||||
OrgScoringRuleExample example = new OrgScoringRuleExample();
|
||||
OrgScoringRuleExample.Criteria criteria = example.createCriteria()
|
||||
.andOrgIdEqualTo(vo.getOrgId())
|
||||
.andSchoolYearEqualTo(vo.getSchoolYear())
|
||||
.andTermEqualTo(vo.getTerm())
|
||||
.andCreatorIdEqualTo(userId);
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(orgScoringRuleDAO.countByExample(example) == 0,
|
||||
String.format("该班级在学年[%s]学期[%s]的评价规则已存在", vo.getSchoolYear(), vo.getTerm()));
|
||||
}
|
||||
|
||||
private void check4Update(OrgScoringRuleVO vo, Long userId) {
|
||||
vo.check4Save();
|
||||
OrgScoringRuleExample example = new OrgScoringRuleExample();
|
||||
OrgScoringRuleExample.Criteria criteria = example.createCriteria()
|
||||
.andOrgIdEqualTo(vo.getOrgId())
|
||||
.andSchoolYearEqualTo(vo.getSchoolYear())
|
||||
.andTermEqualTo(vo.getTerm())
|
||||
.andCreatorIdEqualTo(userId)
|
||||
.andIdNotEqualTo(vo.getId());
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(orgScoringRuleDAO.countByExample(example) == 0,
|
||||
String.format("该班级在学年[%s]学期[%s]的评价规则已存在", vo.getSchoolYear(), vo.getTerm()));
|
||||
}
|
||||
|
||||
private OrgScoringRuleWithBLOBs getEntity(Long id) {
|
||||
private OrgScoringRuleWithBLOBs getRuleEntity(Long id) {
|
||||
OrgScoringRuleWithBLOBs entity = orgScoringRuleDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(entity,
|
||||
String.format("id[%s]的评分规则不存在", id));
|
||||
return entity;
|
||||
}
|
||||
|
||||
private OrgScoringRuleWithBLOBs findEntity(Long id) {
|
||||
private OrgScoringRuleWithBLOBs findRuleEntity(Long id) {
|
||||
return orgScoringRuleDAO.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
private List<OrgScoringRule> findBasicRuleEntities(Integer orgId, Long creatorId) {
|
||||
OrgScoringRuleExample example = new OrgScoringRuleExample();
|
||||
example.createCriteria().andOrgIdEqualTo(orgId).andCreatorIdEqualTo(creatorId);
|
||||
return orgScoringRuleDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
private List<OrgScoringRuleRel> findRelEntities(Integer orgId) {
|
||||
OrgScoringRuleRelExample example = new OrgScoringRuleRelExample();
|
||||
example.createCriteria().andOrgIdEqualTo(orgId);
|
||||
return orgScoringRuleRelDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
private List<OrgScoringRuleRel> findRelEntities(Long ruleId) {
|
||||
OrgScoringRuleRelExample example = new OrgScoringRuleRelExample();
|
||||
example.createCriteria().andRuleIdEqualTo(ruleId);
|
||||
return orgScoringRuleRelDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
private List<OrgScoringRuleRel> findRelEntities(List<Long> ruleIds) {
|
||||
OrgScoringRuleRelExample example = new OrgScoringRuleRelExample();
|
||||
example.createCriteria().andRuleIdIn(ruleIds);
|
||||
return orgScoringRuleRelDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
private void deleteRelEntities(Long ruleId) {
|
||||
OrgScoringRuleRelExample relExample = new OrgScoringRuleRelExample();
|
||||
relExample.createCriteria().andRuleIdEqualTo(ruleId);
|
||||
orgScoringRuleRelDAO.deleteByExample(relExample);
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.org.CompanyQueryVO;
|
||||
import club.joylink.rtss.vo.client.org.CompanyVO;
|
||||
import club.joylink.rtss.vo.client.org.DepartmentVO;
|
||||
import club.joylink.rtss.vo.client.org.NonTopOrgCreateVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgQueryVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.NonNull;
|
||||
@ -23,11 +23,12 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class OrgService implements IOrgService{
|
||||
public class OrgService implements IOrgService {
|
||||
@Autowired
|
||||
private OrgDAO orgDAO;
|
||||
|
||||
@ -44,7 +45,7 @@ public class OrgService implements IOrgService{
|
||||
@Override
|
||||
public void createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo) {
|
||||
//检查
|
||||
Org topOrg = getEntity(loginInfo.getProject());
|
||||
Org topOrg = getEntity(loginInfo.getProject(), BusinessConsts.Org.Status.VALID);
|
||||
Integer topOrgId = topOrg.getId();
|
||||
Long userId = loginInfo.getUserVO().getId();
|
||||
iOrgUserService.confirmIsTheRoleInThisOrg(userId, topOrgId, BusinessConsts.OrgRole.Admin);
|
||||
@ -60,9 +61,12 @@ public class OrgService implements IOrgService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org getEntity(Project project) {
|
||||
public Org getEntity(Project project, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
example.createCriteria().andProjectCodeEqualTo(project.name());
|
||||
OrgExample.Criteria criteria = example.createCriteria().andProjectCodeEqualTo(project.name());
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
List<Org> orgs = orgDAO.selectByExample(example);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(orgs, String.format("关联项目为[%s]的组织不存在", project));
|
||||
return orgs.get(0);
|
||||
@ -88,55 +92,98 @@ public class OrgService implements IOrgService{
|
||||
@Override
|
||||
public void deleteNonTopOrg(Integer nonTopOrgId) {
|
||||
confirmIsNonTopOrg(nonTopOrgId);
|
||||
orgDAO.deleteByPrimaryKey(nonTopOrgId);
|
||||
Org org = new Org();
|
||||
org.setId(nonTopOrgId);
|
||||
org.setStatus(BusinessConsts.Org.Status.DELETE);
|
||||
orgDAO.updateByPrimaryKeySelective(org);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Org> findEntitiesByParentId(Integer parentId, String orderBy) {
|
||||
public List<Org> findEntitiesByParentId(Integer parentId, String orderBy, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
if (StringUtils.hasText(orderBy)) {
|
||||
example.setOrderByClause(orderBy);
|
||||
}
|
||||
example.createCriteria().andParentIdEqualTo(parentId);
|
||||
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(parentId);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<DepartmentVO> pagedQueryCls(CompanyQueryVO queryVO, LoginUserInfoVO loginInfo, boolean self) {
|
||||
OrgExample example = buildQueryClsExample(queryVO, loginInfo, self);
|
||||
public PageVO<DepartmentVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo, boolean self) {
|
||||
OrgExample example = buildQueryClsExample(queryVO, loginInfo.getUserVO().getId(), loginInfo.getProject(), self);
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
|
||||
List<DepartmentVO> list = page.getResult().stream().map(entity -> {
|
||||
DepartmentVO vo = new DepartmentVO(entity);
|
||||
vo.setNumberOfPeople(iOrgUserService.getQuantities(vo.getId(), BusinessConsts.OrgRole.Student));
|
||||
return vo;
|
||||
int numberOfPeople = iOrgUserService.getQuantities(entity.getId(), BusinessConsts.OrgRole.Student);
|
||||
return new DepartmentVO(entity, numberOfPeople);
|
||||
}).collect(Collectors.toList());
|
||||
return PageVO.convert(page, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DepartmentVO> queryCls(CompanyQueryVO queryVO, LoginUserInfoVO loginInfo, boolean self) {
|
||||
OrgExample example = buildQueryClsExample(queryVO, loginInfo, self);;
|
||||
public List<DepartmentVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo, boolean self) {
|
||||
OrgExample example = buildQueryClsExample(queryVO, loginInfo.getUserVO().getId(), loginInfo.getProject(), self);
|
||||
List<Org> clsList = orgDAO.selectByExample(example);
|
||||
return clsList.stream().map(DepartmentVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org getTopOrgEntity(Integer orgId) {
|
||||
public Org getTopOrgEntity(Integer orgId, String status) {
|
||||
Org entity = getEntity(orgId);
|
||||
return getEntity(entity.getRootId());
|
||||
}
|
||||
|
||||
private OrgExample buildQueryClsExample(CompanyQueryVO queryVO, LoginUserInfoVO loginInfo, boolean self) {
|
||||
Org topOrg = getEntity(loginInfo.getProject());
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(topOrg.getId());
|
||||
if (self) {
|
||||
criteria.andCreatorIdEqualTo(loginInfo.getUserVO().getId());
|
||||
@Override
|
||||
public List<Org> findEntities(List<Integer> orgIds, String status) {
|
||||
if (CollectionUtils.isEmpty(orgIds)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andIdIn(orgIds);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<DepartmentVO> adminPagedQueryOrg(OrgQueryVO queryVO) {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria()
|
||||
.andParentIdIsNotNull().andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
if (queryVO.getTopOrgId() != null) {
|
||||
criteria.andRootIdEqualTo(queryVO.getTopOrgId());
|
||||
}
|
||||
if (queryVO.getName() != null) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
|
||||
List<DepartmentVO> list = page.stream().map(org -> {
|
||||
int studentNum = iOrgUserService.getQuantities(org.getId(), BusinessConsts.OrgRole.Student);
|
||||
return new DepartmentVO(org, studentNum);
|
||||
}).collect(Collectors.toList());
|
||||
return PageVO.convert(page, list);
|
||||
}
|
||||
|
||||
private OrgExample buildQueryClsExample(OrgQueryVO queryVO, Long userId, Project project, boolean self) {
|
||||
Org topOrg = getEntity(project, BusinessConsts.Org.Status.VALID);
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria()
|
||||
.andParentIdEqualTo(topOrg.getId())
|
||||
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
if (self) {
|
||||
criteria.andCreatorIdEqualTo(userId);
|
||||
}
|
||||
if (queryVO != null) {
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
}
|
||||
return example;
|
||||
}
|
||||
|
||||
@ -147,7 +194,7 @@ public class OrgService implements IOrgService{
|
||||
//检查顶级组织
|
||||
confirmIsTopOrg(rootId);
|
||||
//检查同级同名组织
|
||||
List<Org> entities = findEntitiesByParentId(parentId, null);
|
||||
List<Org> entities = findEntitiesByParentId(parentId, null, BusinessConsts.Org.Status.VALID);
|
||||
if (!CollectionUtils.isEmpty(entities)) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(entities.stream().noneMatch(org -> org.getName().equals(name)),
|
||||
String.format("上级为[%s]的同名组织已存在", parentId));
|
||||
@ -185,12 +232,15 @@ public class OrgService implements IOrgService{
|
||||
String.format("组织[%s]是顶级组织", id));
|
||||
}
|
||||
|
||||
private List<Org> findEntitiesByRootId(Integer rootId, String orderBy) {
|
||||
private List<Org> findEntitiesByRootId(Integer rootId, String orderBy, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
if (StringUtils.hasText(orderBy)) {
|
||||
example.setOrderByClause(orderBy);
|
||||
}
|
||||
example.createCriteria().andRootIdEqualTo(rootId);
|
||||
OrgExample.Criteria criteria = example.createCriteria().andRootIdEqualTo(rootId);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
List<Org> orgs = orgDAO.selectByExample(example);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(orgs,
|
||||
String.format("没有顶级组织id为[%s]的组织", rootId));
|
||||
|
@ -66,7 +66,7 @@ public class OrgUserService implements IOrgUserService {
|
||||
|
||||
|
||||
@Override
|
||||
public PageVO<CompanyVO> queryPageOrganizations(CompanyQueryVO queryVO) {
|
||||
public PageVO<CompanyVO> queryPageOrganizations(OrgQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria();
|
||||
@ -569,6 +569,19 @@ public class OrgUserService implements IOrgUserService {
|
||||
return orgUserDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgUser> findEntities(List<Integer> orgIds, BusinessConsts.OrgRole role) {
|
||||
if (CollectionUtils.isEmpty(orgIds)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
OrgUserExample example = new OrgUserExample();
|
||||
example.createCriteria()
|
||||
.andOrgIdIn(orgIds)
|
||||
.andRoleEqualTo(role.name());
|
||||
return orgUserDAO.selectByExample(example);
|
||||
}
|
||||
}
|
||||
|
||||
private String nextCompanyCode() {
|
||||
OrgExample e = new OrgExample();
|
||||
e.setLimit(1);
|
||||
|
@ -434,7 +434,11 @@ public class AtsStationService {
|
||||
* 计轴预复位
|
||||
*/
|
||||
public void preReset(Simulation simulation, Station station) {
|
||||
station.getPreResetValidDuration().set(60 * 1000);
|
||||
if (station.isCentralized()) {
|
||||
station.getPreResetValidDuration().set(60 * 1000);
|
||||
} else {
|
||||
station.getDeviceStation().getPreResetValidDuration().set(60 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -631,9 +631,9 @@ public class CiApiServiceImpl implements CiApiService {
|
||||
VirtualRealitySectionAxleCounter virtualAxleCounter = axleSection.getVirtualAxleCounter();
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(virtualAxleCounter.isOccupy(), section.debugStr() + "计轴未占用,无需预复位");
|
||||
if (simulation.getRepository().getConfig().isStationPreResetBeforeAxlePreReset()) {
|
||||
Station station = axleSection.getStation();
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(station, section.debugStr() + "没有所属车站");
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(station.isPreReset(), station.debugStr() + "需处于预复位状态");
|
||||
Station deviceStation = axleSection.getDeviceStation();
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(deviceStation, section.debugStr() + "没有所属集中站");
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(deviceStation.isPreReset(), deviceStation.debugStr() + "需处于预复位状态");
|
||||
}
|
||||
return virtualAxleCounter;
|
||||
}
|
||||
|
@ -550,6 +550,7 @@ public class InterlockBuilder2 {
|
||||
Station rightStation = null;
|
||||
Boolean leftFrontTurnBack = null;
|
||||
Boolean rightFrontTurnBack = null;
|
||||
Route route = null;
|
||||
List<Section> runPath = null;
|
||||
List<Route> routes = null;
|
||||
|
||||
@ -677,7 +678,7 @@ public class InterlockBuilder2 {
|
||||
break;
|
||||
}
|
||||
DestinationCodeDefinition destinationCodeDefinition = new DestinationCodeDefinition(code, type, description, startSection, section,
|
||||
right, necessarySections, leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, runPath, routes);
|
||||
right, necessarySections, leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, route, runPath, routes);
|
||||
destinationMap.put(code, destinationCodeDefinition);
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,11 @@ public class DestinationCodeDefinition {
|
||||
*/
|
||||
private Boolean rightFrontTurnBack;
|
||||
|
||||
/**
|
||||
* 必选进路
|
||||
*/
|
||||
private Route necessaryRoute;
|
||||
|
||||
//根据目的地码的定义数据,生成路径
|
||||
/**
|
||||
* 目的地码代表的运行路径(物理区段)
|
||||
@ -62,12 +67,12 @@ public class DestinationCodeDefinition {
|
||||
private List<Route> routes;
|
||||
|
||||
public DestinationCodeDefinition(String code, Type type, Section section) {
|
||||
this(code, type, null, null, section, null, null, null, null, null, null, null, null);
|
||||
this(code, type, null, null, section, null, null, null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
public DestinationCodeDefinition(String code, Type type, String description, Section startSection, Section section, Boolean right,
|
||||
List<Section> necessarySections, Station leftStation, Boolean leftFrontTurnBack,
|
||||
Station rightStation, Boolean rightFrontTurnBack, List<Section> runPath, List<Route> routes) {
|
||||
Station rightStation, Boolean rightFrontTurnBack, Route route, List<Section> runPath, List<Route> routes) {
|
||||
this.code = code;
|
||||
this.type = type;
|
||||
this.description = description;
|
||||
@ -79,6 +84,7 @@ public class DestinationCodeDefinition {
|
||||
this.leftFrontTurnBack = leftFrontTurnBack;
|
||||
this.rightStation = rightStation;
|
||||
this.rightFrontTurnBack = rightFrontTurnBack;
|
||||
this.necessaryRoute = route;
|
||||
this.runPath = runPath;
|
||||
this.routes = routes;
|
||||
}
|
||||
|
@ -65,6 +65,11 @@ public class MapDestinationCodeDefinitionVO {
|
||||
*/
|
||||
private Boolean stationBFrontTurnBack;
|
||||
|
||||
/**
|
||||
* 必选进路
|
||||
*/
|
||||
private String necessaryRouteCode;
|
||||
|
||||
/**
|
||||
* 目前仅用来生成目的地码数据
|
||||
*/
|
||||
@ -95,6 +100,9 @@ public class MapDestinationCodeDefinitionVO {
|
||||
if (definition.getRightFrontTurnBack() != null) {
|
||||
vo.stationBFrontTurnBack = definition.getRightFrontTurnBack();
|
||||
}
|
||||
if (definition.getNecessaryRoute() != null) {
|
||||
vo.necessaryRouteCode = definition.getNecessaryRoute().getCode();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
@ -2,14 +2,15 @@ package club.joylink.rtss.vo.client.org;
|
||||
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CompanyQueryVO extends PageQueryVO {
|
||||
|
||||
@NoArgsConstructor
|
||||
public class OrgQueryVO extends PageQueryVO {
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private Integer topOrgId;
|
||||
}
|
@ -17,16 +17,24 @@ public class OrgScoringResultVO {
|
||||
|
||||
private String username;
|
||||
|
||||
private Integer usualScore;
|
||||
private Integer attendanceScore;
|
||||
|
||||
private Integer finalScore;
|
||||
private Integer learningTimeScore;
|
||||
|
||||
public OrgScoringResultVO(Long userId, String account, String username, Integer usualScore, Integer finalScore) {
|
||||
private Integer examScore;
|
||||
|
||||
public OrgScoringResultVO(Long userId, String account, String username, Integer attendanceScore, Integer learningTimeScore, Integer examScore) {
|
||||
this.userId = userId;
|
||||
this.account = account;
|
||||
this.username = username;
|
||||
this.usualScore = usualScore;
|
||||
this.finalScore = finalScore;
|
||||
this.attendanceScore = attendanceScore;
|
||||
this.learningTimeScore = learningTimeScore;
|
||||
this.examScore = examScore;
|
||||
}
|
||||
|
||||
public OrgScoringResultVO(Long userId, String account, String username) {
|
||||
this.userId = userId;
|
||||
this.account = account;
|
||||
this.username = username;
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,10 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 评分规则
|
||||
@ -27,10 +29,12 @@ public class OrgScoringRuleVO {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 组织(班级)id
|
||||
*/
|
||||
private Integer orgId;
|
||||
private List<Integer> orgIds;
|
||||
|
||||
/**
|
||||
* 学年
|
||||
@ -42,15 +46,15 @@ public class OrgScoringRuleVO {
|
||||
*/
|
||||
private Integer term;
|
||||
|
||||
/**
|
||||
* 平时分评价规则
|
||||
*/
|
||||
private ScoringRule usualScoringRule;
|
||||
// /**
|
||||
// * 平时分评价规则
|
||||
// */
|
||||
// private ScoringRule usualScoringRule;
|
||||
|
||||
/**
|
||||
* 期末分评价规则
|
||||
* 评价规则
|
||||
*/
|
||||
private ScoringRule finalScoringRule;
|
||||
private ScoringRule scoringRule;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long creatorId;
|
||||
@ -65,10 +69,11 @@ public class OrgScoringRuleVO {
|
||||
/**
|
||||
* 构建基础信息
|
||||
*/
|
||||
public static OrgScoringRuleVO buildBasicInfo(OrgScoringRule rule) {
|
||||
public static OrgScoringRuleVO buildBasicInfo(OrgScoringRule rule, List<Integer> orgIds) {
|
||||
OrgScoringRuleVO vo = new OrgScoringRuleVO();
|
||||
vo.setId(rule.getId());
|
||||
vo.setOrgId(rule.getOrgId());
|
||||
vo.setName(rule.getName());
|
||||
vo.setOrgIds(Objects.requireNonNullElseGet(orgIds, ArrayList::new));
|
||||
vo.setSchoolYear(rule.getSchoolYear());
|
||||
vo.setTerm(rule.getTerm());
|
||||
vo.setCreatorId(rule.getCreatorId());
|
||||
@ -81,13 +86,10 @@ public class OrgScoringRuleVO {
|
||||
/**
|
||||
* 构建详细信息
|
||||
*/
|
||||
public static OrgScoringRuleVO buildDetails(OrgScoringRuleWithBLOBs rule) {
|
||||
OrgScoringRuleVO vo = buildBasicInfo(rule);
|
||||
if (StringUtils.hasText(rule.getUsualScoringRule())) {
|
||||
vo.setUsualScoringRule(JsonUtils.read(rule.getUsualScoringRule(), ScoringRule.class));
|
||||
}
|
||||
public static OrgScoringRuleVO buildDetails(OrgScoringRuleWithBLOBs rule, List<Integer> orgIds) {
|
||||
OrgScoringRuleVO vo = buildBasicInfo(rule, orgIds);
|
||||
if (StringUtils.hasText(rule.getFinalScoringRule())) {
|
||||
vo.setFinalScoringRule(JsonUtils.read(rule.getFinalScoringRule(), ScoringRule.class));
|
||||
vo.setScoringRule(JsonUtils.read(rule.getFinalScoringRule(), ScoringRule.class));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
@ -96,7 +98,6 @@ public class OrgScoringRuleVO {
|
||||
* 检查以确保评分规则能够保存
|
||||
*/
|
||||
public void check4Save() {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(orgId, "班级不能不选");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(schoolYear, "学年不能不选");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(term, "学期不能不选");
|
||||
}
|
||||
@ -106,45 +107,31 @@ public class OrgScoringRuleVO {
|
||||
*/
|
||||
public void check4Use() {
|
||||
check4Save();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(usualScoringRule != null || finalScoringRule != null,
|
||||
"平时分和期末分评价规则至少有一个");
|
||||
if (usualScoringRule != null) {
|
||||
usualScoringRule.check4Use(true);
|
||||
}
|
||||
if (finalScoringRule != null) {
|
||||
finalScoringRule.check4Use(false);
|
||||
}
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(scoringRule, "评价规则未填写");
|
||||
scoringRule.check4Use();
|
||||
}
|
||||
|
||||
public OrgScoringRuleWithBLOBs convert2DB() {
|
||||
OrgScoringRuleWithBLOBs rule = new OrgScoringRuleWithBLOBs();
|
||||
rule.setId(id);
|
||||
rule.setOrgId(orgId);
|
||||
rule.setName(name);
|
||||
rule.setSchoolYear(schoolYear);
|
||||
rule.setTerm(term);
|
||||
rule.setUsualScoringRule(JsonUtils.writeValueAsString(usualScoringRule));
|
||||
rule.setFinalScoringRule(JsonUtils.writeValueAsString(finalScoringRule));
|
||||
if (scoringRule != null) {
|
||||
rule.setFinalScoringRule(JsonUtils.writeValueAsString(scoringRule));
|
||||
}
|
||||
return rule;
|
||||
}
|
||||
|
||||
public OrgScoringRuleWithBLOBs cover4Update(OrgScoringRuleWithBLOBs entity) {
|
||||
entity.setOrgId(orgId);
|
||||
entity.setSchoolYear(schoolYear);
|
||||
entity.setTerm(term);
|
||||
entity.setUsualScoringRule(JsonUtils.writeValueAsString(usualScoringRule));
|
||||
entity.setFinalScoringRule(JsonUtils.writeValueAsString(finalScoringRule));
|
||||
entity.setFinalScoringRule(JsonUtils.writeValueAsString(scoringRule));
|
||||
return entity;
|
||||
}
|
||||
|
||||
public int calculateTotalWeight() {
|
||||
int totalWeight = 0;
|
||||
if (usualScoringRule != null) {
|
||||
totalWeight += usualScoringRule.calculateTotalWeight();
|
||||
}
|
||||
if (finalScoringRule != null) {
|
||||
totalWeight += usualScoringRule.calculateTotalWeight();
|
||||
}
|
||||
return totalWeight;
|
||||
public int calculateTotalMarks() {
|
||||
return scoringRule.calculateTotalMarks();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,40 +159,33 @@ public class OrgScoringRuleVO {
|
||||
/**
|
||||
* 获取总权重
|
||||
*/
|
||||
public int calculateTotalWeight() {
|
||||
public int calculateTotalMarks() {
|
||||
int weight = 0;
|
||||
if (this.attendance != null) {
|
||||
weight += this.attendance.getWeight();
|
||||
weight += this.attendance.getFullMarks();
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(learningTimeList)) {
|
||||
for (LearningTime learningTime : learningTimeList) {
|
||||
weight += learningTime.getWeight();
|
||||
weight += learningTime.getFullMarks();
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(exams)) {
|
||||
for (Exam exam : exams) {
|
||||
weight += exam.getWeight();
|
||||
weight += exam.getFullMarks();
|
||||
}
|
||||
}
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void check4Use(boolean usual) {
|
||||
if (usual) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(attendance != null
|
||||
|| !CollectionUtils.isEmpty(learningTimeList) || !CollectionUtils.isEmpty(exams),
|
||||
"平时成绩评价细则不能为空");
|
||||
} else {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(exams,
|
||||
"期末成绩评价细则不能为空");
|
||||
public void check4Use() {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(attendance != null
|
||||
|| !CollectionUtils.isEmpty(learningTimeList) || !CollectionUtils.isEmpty(exams),
|
||||
"评价规则的细则未填写");
|
||||
if (attendance != null) {
|
||||
attendance.check4Use();
|
||||
}
|
||||
if (usual) {
|
||||
if (attendance != null) {
|
||||
attendance.check4Use();
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(learningTimeList)) {
|
||||
learningTimeList.forEach(LearningTime::check4Use);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(learningTimeList)) {
|
||||
learningTimeList.forEach(LearningTime::check4Use);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(exams)) {
|
||||
exams.forEach(Exam::check4Use);
|
||||
@ -243,23 +223,23 @@ public class OrgScoringRuleVO {
|
||||
private Map<Integer, Integer> scoringRules;
|
||||
|
||||
/**
|
||||
* 权重(百分数)
|
||||
* 满分
|
||||
*/
|
||||
private Integer weight;
|
||||
private Integer fullMarks;
|
||||
|
||||
/**
|
||||
* 根据登录天数计算得分
|
||||
*/
|
||||
public int calculateScore(int loginDays, int totalWeight) {
|
||||
double score = Math.min((double) loginDays / days4FullMarks, 1) * 100;
|
||||
return (int) (score * weight / totalWeight);
|
||||
public int calculateScore(int loginDays) {
|
||||
double percent = Math.min((double) loginDays / days4FullMarks, 1);
|
||||
return (int) (percent * fullMarks);
|
||||
}
|
||||
|
||||
public void check4Use() {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(startDate, "考勤评分的开始时间不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(endDate, "考勤评分的截止时间不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(days4FullMarks, "满分的考勤次数不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(weight, "考勤评分的权重不能不填");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(startDate, "考勤评价的开始时间未填写");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(endDate, "考勤评价的截止时间未填写");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(days4FullMarks, "满分的考勤次数未填写");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(fullMarks, "考勤评价的满分未填写");
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,20 +266,20 @@ public class OrgScoringRuleVO {
|
||||
*/
|
||||
private Map<Integer, Integer> scoringRules;
|
||||
|
||||
private Integer weight;
|
||||
private Integer fullMarks;
|
||||
|
||||
public int calculateScore(Long durationInSecond, int totalWeight) {
|
||||
public int calculateScore(Long durationInSecond) {
|
||||
if (durationInSecond == null) {
|
||||
return 0;
|
||||
}
|
||||
double score = Math.min(1, durationInSecond / (duration4FullMarks * 60d)) * 100;
|
||||
return (int) (score * weight / totalWeight);
|
||||
double percent = Math.min(1, durationInSecond / (duration4FullMarks * 60d));
|
||||
return (int) (percent * fullMarks);
|
||||
}
|
||||
|
||||
public void check4Use() {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(lessonIds, "学习时长评分所选课程不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(duration4FullMarks, "学习时长评分的满分学习时长不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(weight, "学习时长评分的权重不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(lessonIds, "学习时长评价课程未选择");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(duration4FullMarks, "学习时长评价的满分学习时长未填写");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(fullMarks, "学习时长评价的总分未填写");
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,18 +290,24 @@ public class OrgScoringRuleVO {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long examId;
|
||||
|
||||
private Integer weight;
|
||||
private Integer fullMarks;
|
||||
|
||||
public int calculateScore(Integer examScore, int totalWeight) {
|
||||
if (examScore == null) {
|
||||
/**
|
||||
* 计算得分
|
||||
* @param userScore 用户考试得分
|
||||
* @param examFullMarks 考试满分
|
||||
*/
|
||||
public int calculateScore(Integer userScore, int examFullMarks) {
|
||||
if (userScore == null) {
|
||||
return 0;
|
||||
}
|
||||
return (int) (examScore * (double) weight / totalWeight);
|
||||
double percent = (double) userScore / examFullMarks;
|
||||
return (int) (percent * fullMarks);
|
||||
}
|
||||
|
||||
public void check4Use() {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(examId, "考试评份所选的考试不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(weight, "考试评分的权重不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(examId, "考试评价的考试未选择");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(fullMarks, "考试评价的满分未填写");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_id" jdbcType="BIGINT" property="updateId" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@ -73,7 +74,7 @@
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, parent_id, root_id, project_code, code, creator_id, create_time, update_id,
|
||||
update_time
|
||||
update_time, `status`
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.OrgExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -116,12 +117,12 @@
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Org" useGeneratedKeys="true">
|
||||
insert into org (`name`, parent_id, root_id,
|
||||
project_code, code, creator_id,
|
||||
create_time, update_id, update_time
|
||||
)
|
||||
create_time, update_id, update_time,
|
||||
`status`)
|
||||
values (#{name,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{rootId,jdbcType=INTEGER},
|
||||
#{projectCode,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
|
||||
#{status,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Org" useGeneratedKeys="true">
|
||||
insert into org
|
||||
@ -153,6 +154,9 @@
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
@ -182,6 +186,9 @@
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.OrgExample" resultType="java.lang.Long">
|
||||
@ -223,6 +230,9 @@
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.status != null">
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -239,7 +249,8 @@
|
||||
creator_id = #{record.creatorId,jdbcType=BIGINT},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
update_id = #{record.updateId,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
`status` = #{record.status,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@ -274,6 +285,9 @@
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
@ -287,7 +301,8 @@
|
||||
creator_id = #{creatorId,jdbcType=BIGINT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_id = #{updateId,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
`status` = #{status,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
@ -3,6 +3,7 @@
|
||||
<mapper namespace="club.joylink.rtss.dao.OrgScoringRuleDAO">
|
||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.OrgScoringRule">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="org_id" jdbcType="INTEGER" property="orgId" />
|
||||
<result column="school_year" jdbcType="VARCHAR" property="schoolYear" />
|
||||
<result column="term" jdbcType="INTEGER" property="term" />
|
||||
@ -74,7 +75,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, org_id, school_year, term, creator_id, create_time, update_id, update_time
|
||||
id, `name`, org_id, school_year, term, creator_id, create_time, update_id, update_time
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
usual_scoring_rule, final_scoring_rule
|
||||
@ -144,18 +145,21 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.OrgScoringRuleWithBLOBs" useGeneratedKeys="true">
|
||||
insert into org_scoring_rule (org_id, school_year, term,
|
||||
creator_id, create_time, update_id,
|
||||
update_time, usual_scoring_rule, final_scoring_rule
|
||||
)
|
||||
values (#{orgId,jdbcType=INTEGER}, #{schoolYear,jdbcType=VARCHAR}, #{term,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateId,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{usualScoringRule,jdbcType=LONGVARCHAR}, #{finalScoringRule,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
insert into org_scoring_rule (`name`, org_id, school_year,
|
||||
term, creator_id, create_time,
|
||||
update_id, update_time, usual_scoring_rule,
|
||||
final_scoring_rule)
|
||||
values (#{name,jdbcType=VARCHAR}, #{orgId,jdbcType=INTEGER}, #{schoolYear,jdbcType=VARCHAR},
|
||||
#{term,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{usualScoringRule,jdbcType=LONGVARCHAR},
|
||||
#{finalScoringRule,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.OrgScoringRuleWithBLOBs" useGeneratedKeys="true">
|
||||
insert into org_scoring_rule
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
org_id,
|
||||
</if>
|
||||
@ -185,6 +189,9 @@
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
#{orgId,jdbcType=INTEGER},
|
||||
</if>
|
||||
@ -226,6 +233,9 @@
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.name != null">
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.orgId != null">
|
||||
org_id = #{record.orgId,jdbcType=INTEGER},
|
||||
</if>
|
||||
@ -261,6 +271,7 @@
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update org_scoring_rule
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
org_id = #{record.orgId,jdbcType=INTEGER},
|
||||
school_year = #{record.schoolYear,jdbcType=VARCHAR},
|
||||
term = #{record.term,jdbcType=INTEGER},
|
||||
@ -277,6 +288,7 @@
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update org_scoring_rule
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
org_id = #{record.orgId,jdbcType=INTEGER},
|
||||
school_year = #{record.schoolYear,jdbcType=VARCHAR},
|
||||
term = #{record.term,jdbcType=INTEGER},
|
||||
@ -291,6 +303,9 @@
|
||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.OrgScoringRuleWithBLOBs">
|
||||
update org_scoring_rule
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
org_id = #{orgId,jdbcType=INTEGER},
|
||||
</if>
|
||||
@ -323,7 +338,8 @@
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.OrgScoringRuleWithBLOBs">
|
||||
update org_scoring_rule
|
||||
set org_id = #{orgId,jdbcType=INTEGER},
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
org_id = #{orgId,jdbcType=INTEGER},
|
||||
school_year = #{schoolYear,jdbcType=VARCHAR},
|
||||
term = #{term,jdbcType=INTEGER},
|
||||
creator_id = #{creatorId,jdbcType=BIGINT},
|
||||
@ -336,7 +352,8 @@
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.OrgScoringRule">
|
||||
update org_scoring_rule
|
||||
set org_id = #{orgId,jdbcType=INTEGER},
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
org_id = #{orgId,jdbcType=INTEGER},
|
||||
school_year = #{schoolYear,jdbcType=VARCHAR},
|
||||
term = #{term,jdbcType=INTEGER},
|
||||
creator_id = #{creatorId,jdbcType=BIGINT},
|
||||
|
156
src/main/resources/mybatis/mapper/OrgScoringRuleRelDAO.xml
Normal file
156
src/main/resources/mybatis/mapper/OrgScoringRuleRelDAO.xml
Normal file
@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="club.joylink.rtss.dao.OrgScoringRuleRelDAO">
|
||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.OrgScoringRuleRel">
|
||||
<result column="org_id" jdbcType="INTEGER" property="orgId" />
|
||||
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
org_id, rule_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.OrgScoringRuleRelExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from org_scoring_rule_rel
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="limit != null">
|
||||
<if test="offset != null">
|
||||
limit ${offset}, ${limit}
|
||||
</if>
|
||||
<if test="offset == null">
|
||||
limit ${limit}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.OrgScoringRuleRelExample">
|
||||
delete from org_scoring_rule_rel
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="club.joylink.rtss.entity.OrgScoringRuleRel">
|
||||
insert into org_scoring_rule_rel (org_id, rule_id)
|
||||
values (#{orgId,jdbcType=INTEGER}, #{ruleId,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.OrgScoringRuleRel">
|
||||
insert into org_scoring_rule_rel
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="orgId != null">
|
||||
org_id,
|
||||
</if>
|
||||
<if test="ruleId != null">
|
||||
rule_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orgId != null">
|
||||
#{orgId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="ruleId != null">
|
||||
#{ruleId,jdbcType=BIGINT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.OrgScoringRuleRelExample" resultType="java.lang.Long">
|
||||
select count(*) from org_scoring_rule_rel
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update org_scoring_rule_rel
|
||||
<set>
|
||||
<if test="record.orgId != null">
|
||||
org_id = #{record.orgId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.ruleId != null">
|
||||
rule_id = #{record.ruleId,jdbcType=BIGINT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update org_scoring_rule_rel
|
||||
set org_id = #{record.orgId,jdbcType=INTEGER},
|
||||
rule_id = #{record.ruleId,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<!-- 自定义 -->
|
||||
<insert id="batchInsert">
|
||||
insert into org_scoring_rule_rel (org_id, rule_id)
|
||||
values
|
||||
<foreach collection="rels" item="rel" separator=",">
|
||||
(#{rel.orgId}, #{rel.ruleId})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user