diff --git a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java index 7531ec8..33ce22d 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java @@ -241,6 +241,50 @@ public class ProjectManagementController { return resp; } + /** + * 根据项目管理id查询对应交易类判分点信息 + * + * @param projectId + * @return + */ + @ApiOperation(value = "根据项目管理id查询对应交易类判分点信息", notes = "根据项目管理id查询对应交易类判分点信息") + @GetMapping("/getTrdingJudgmentPoints") + Response getTrdingJudgmentPoints(@ApiParam(name = "projectId", value = "项目主键ID", required = true) @RequestParam Integer projectId) { + Response resp = new Response(); + HashMap ret = service.getTrdingJudgmentPoints(projectId); + int status = (int) ret.get("retcode"); + if (status == 200) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + + /** + * 根据项目管理id查询对应交易类判分点信息 + * + * @param projectId + * @return + */ + @ApiOperation(value = "根据项目管理id查询项目管理信息", notes = "根据项目管理id查询项目管理信息") + @GetMapping("/getProject") + Response getProject(@ApiParam(name = "projectId", value = "项目主键ID", required = true) @RequestParam Integer projectId) { + Response resp = new Response(); + HashMap ret = service.getProject(projectId); + int status = (int) ret.get("retcode"); + if (status == 200) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + /** * 添加点面板的数据展示+条件筛选 * @@ -252,7 +296,7 @@ public class ProjectManagementController { Response queryAllJudgmentPoints(@ApiParam(name = "judgmentPointsName", value = "判分点名称", required = false) @RequestParam(required = false) String judgmentPointsName, @ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId) { Response resp = new Response(); - Judgment_Points points = new Judgment_Points(); + JudgmentPoints points = new JudgmentPoints(); if (StringUtils.isEmpty(systemId)) { resp.setStatus(300); resp.setMessage("systemId cannot be empty"); @@ -397,10 +441,10 @@ public class ProjectManagementController { */ @ApiOperation(value = "创建项目", notes = "创建项目") @PostMapping("/addProjectManagement") - Response insertProjectManagement(@RequestBody @ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) ManagementAndPointVo vo) { + Response addProjectManagement(@RequestBody @ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) ManagementAndPointVo vo) { Response resp = new Response(); ProjectManagement pro = vo.getManagement(); - List points = vo.getPooints(); + List points = vo.getPooints(); List roles = vo.getRoleId(); if (StringUtils.isEmpty(pro)) { resp.setStatus(300); @@ -433,8 +477,96 @@ public class ProjectManagementController { return resp; } + /** - * 查询单个项目判分点信息,根据项目id + * 添加创建项目管理信息 + * + * @param vo 项目管理信息 + * @return + */ + @ApiOperation(value = "创建项目", notes = "创建项目") + @PostMapping("/newAddProjectManagement") + Response newAddProjectManagement(@RequestBody @ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) ManagementAndPointVo vo) { + Response resp = new Response(); + ProjectManagement pro = vo.getManagement(); + List points = vo.getPooints(); + List roles = vo.getRoleId(); + if (StringUtils.isEmpty(pro)) { + resp.setStatus(300); + resp.setMessage("management cannot be empty"); + return resp; + } + if (points.isEmpty() || points.size() <= 0) { + resp.setStatus(300); + resp.setMessage("pooints cannot be empty"); + return resp; + } + + if (pro.getIsstartexperimental() == 0) {//开启实验数据 + if (roles.isEmpty() || roles.size() <= 0) { + resp.setStatus(300); + resp.setMessage("roleId cannot be empty"); + return resp; + } + } + HashMap ret = service.newAddProjectManagement(pro, points, roles); + int status = (int) ret.get("retcode"); + if (status == 200) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + + /** + * 添加交易类判分点项目管理信息 + * + * @param vo 项目管理信息 + * @return + */ + @ApiOperation(value = "添加交易类判分点项目", notes = "添加交易类判分点项目") + @PostMapping("/add") + Response add(@RequestBody @ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) ManagementAndPointVo vo) { + Response resp = new Response(); + ProjectManagement pro = vo.getManagement(); + List points = vo.getPooints(); + List roles = vo.getRoleId(); + if (StringUtils.isEmpty(pro)) { + resp.setStatus(300); + resp.setMessage("management cannot be empty"); + return resp; + } + if (points.isEmpty() || points.size() <= 0) { + resp.setStatus(300); + resp.setMessage("pooints cannot be empty"); + return resp; + } + + if (pro.getIsstartexperimental() == 0) {//开启实验数据 + if (roles.isEmpty() || roles.size() <= 0) { + resp.setStatus(300); + resp.setMessage("roleId cannot be empty"); + return resp; + } + } + + HashMap ret = service.insertProjectManagement(pro, points, roles); + int status = (int) ret.get("retcode"); + if (status == 200) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + + /** + * 职站查询单个项目判分点信息,根据项目id * * @param projectId 项目id * @return @@ -455,6 +587,28 @@ public class ProjectManagementController { return resp; } + /** + * 职站查询单个项目判分点信息,根据项目id + * + * @param projectId 项目id + * @return + */ + @ApiOperation(value = "查询职站单个项目判分点信息", notes = "查询职站单个项目判分点信息") + @GetMapping("/getZZJudgmentPoints") + Response getZZJudgmentPoints(@ApiParam(name = "projectId", value = "项目id", required = true) @RequestParam Integer projectId) { + Response resp = new Response(); + HashMap ret = service.getZZJudgmentPoints(projectId); + int status = (int) ret.get("retcode"); + if (status == 200) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + /** * 修改项目管理信息 * @@ -466,7 +620,7 @@ public class ProjectManagementController { Response updateProjectManagement(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointVo vo) { Response resp = new Response(); ProjectManagement pro = vo.getManagement(); - List points = vo.getPooints(); + List points = vo.getPooints(); List roles = vo.getRoleId(); if (StringUtils.isEmpty(pro)) { resp.setStatus(300); @@ -526,6 +680,49 @@ public class ProjectManagementController { } + /** + * 修改项目管理信息 + * + * @param vo + * @return + */ + @ApiOperation(value = "编辑项目", notes = "编辑项目") + @PostMapping("/newUpdateProjectManagement") + Response newUpdateProjectManagement(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointVo vo) { + Response resp = new Response(); + ProjectManagement pro = vo.getManagement(); + List points = vo.getPooints(); + List roles = vo.getRoleId(); + if (StringUtils.isEmpty(pro)) { + resp.setStatus(300); + resp.setMessage("项目管理为空,修改失败!"); + return resp; + } + if (points.isEmpty() || points.size() <= 0) { + resp.setStatus(300); + resp.setMessage("判分点为空,修改失败!"); + return resp; + } + + if (pro.getIsstartexperimental() == 0) {//开启实验数据 + if (roles.isEmpty() || roles.size() <= 0) { + resp.setStatus(300); + resp.setMessage("角色id为空,修改失败!"); + return resp; + } + } + HashMap ret = service.newUpdateProjectManagement(pro, points, roles); + int status = (int) ret.get("retcode"); + if (status == 200) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + /** * 川大查询项目管理 *

diff --git a/src/main/java/com/yipin/liuwanr/entity/JudgmentPoints.java b/src/main/java/com/yipin/liuwanr/entity/JudgmentPoints.java new file mode 100644 index 0000000..0b23f1e --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/entity/JudgmentPoints.java @@ -0,0 +1,112 @@ +package com.yipin.liuwanr.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * 判分表 + * "pooints": [{ + * "judgmentPointsId": 184, + * "judgmentPointsName": "列表——元素的修改 ", + * "experimentalRequirements": "新学期开始,老师组织了学习小组,该学习小组有A,B,C,D五个学生\nList1=[''A'',''B'',''C'',''D'']\n列表元素-修改-请使用下标索引\n第三天上课,老师发现把E同学的名字打错了,应该T。请修改并打印本小组的全体学生", + * "score": "100" + * }], + */ +@ApiModel(value = "Judgment_Points对象", description = "判分点对象Judgment_Points") +public class JudgmentPoints { + + @ApiModelProperty(value = "判分点主键Id", name = "judgmentPointsId", example = "184", required = true) + private Integer judgmentPointsId;// 判分点主键Id + @ApiModelProperty(value = "判分点名称", name = "judgmentPointsName", example = "列表——元素的修改", required = true) + private String judgmentPointsName;// 判分点名称 + @ApiModelProperty(value = "实验要求", name = "experimentalRequirements", example = "新学期开始,老师组织了学习小组,该学习小组有A,B,C,D五个学生\\nList1=[''A'',''B'',''C'',''D'']\\n列表元素-修改-请使用下标索引\\n第三天上课,老师发现把E同学的名字打错了,应该T。请修改并打印本小组的全体学生", required = true) + private String experimentalRequirements;//实验要求 + @ApiModelProperty(hidden = true) + private String projectId;//绑定项目管理Id + @ApiModelProperty(hidden = true) + private Integer judgmentPointsType;// 判分点类型(1、编程类 2、交易类 3、工具类 4、业务类) + @ApiModelProperty(hidden = true) + private Integer systemId; + @ApiModelProperty(hidden = true) + private Integer userId; + @ApiModelProperty(value = "判分点指标的分数", name = "score", example = "100", required = true) + private Integer score;//判分点指标的分数 + + public Integer getSystemId() { + return systemId; + } + + public void setSystemId(Integer systemId) { + this.systemId = systemId; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public Integer getScore() { + return score; + } + + public void setScore(Integer score) { + this.score = score; + } + + public Integer getJudgmentPointsId() { + return judgmentPointsId; + } + + public void setJudgmentPointsId(Integer judgmentPointsId) { + this.judgmentPointsId = judgmentPointsId; + } + + public String getJudgmentPointsName() { + return judgmentPointsName; + } + + public void setJudgmentPointsName(String judgmentPointsName) { + this.judgmentPointsName = judgmentPointsName; + } + + public String getExperimentalRequirements() { + return experimentalRequirements; + } + + public void setExperimentalRequirements(String experimentalRequirements) { + this.experimentalRequirements = experimentalRequirements; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public Integer getJudgmentPointsType() { + return judgmentPointsType; + } + + public void setJudgmentPointsType(Integer judgmentPointsType) { + this.judgmentPointsType = judgmentPointsType; + } + + @Override + public String toString() { + return "JudgmentPoints{" + + "judgmentPointsId=" + judgmentPointsId + + ", judgmentPointsName='" + judgmentPointsName + '\'' + + ", experimentalRequirements='" + experimentalRequirements + '\'' + + ", projectId='" + projectId + '\'' + + ", judgmentPointsType=" + judgmentPointsType + + ", systemId=" + systemId + + ", userId=" + userId + + ", score=" + score + + '}'; + } +} diff --git a/src/main/java/com/yipin/liuwanr/entity/Judgment_Points.java b/src/main/java/com/yipin/liuwanr/entity/JudgmentPointsBinding.java similarity index 98% rename from src/main/java/com/yipin/liuwanr/entity/Judgment_Points.java rename to src/main/java/com/yipin/liuwanr/entity/JudgmentPointsBinding.java index 46ec6d8..ecc5178 100644 --- a/src/main/java/com/yipin/liuwanr/entity/Judgment_Points.java +++ b/src/main/java/com/yipin/liuwanr/entity/JudgmentPointsBinding.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; * }], */ @ApiModel(value = "Judgment_Points对象", description = "判分点对象Judgment_Points") -public class Judgment_Points { +public class JudgmentPointsBinding { @ApiModelProperty(value = "判分点主键Id", name = "judgmentPointsId", example = "184", required = true) private Integer judgmentPointsId;// 判分点主键Id @@ -108,7 +108,7 @@ public class Judgment_Points { @Override public String toString() { - return "Judgment_Points{" + + return "JudgmentPoints{" + "judgmentPointsId=" + judgmentPointsId + ", judgmentPointsName='" + judgmentPointsName + '\'' + ", experimentalRequirements='" + experimentalRequirements + '\'' + diff --git a/src/main/java/com/yipin/liuwanr/entity/ManagementAndPointVo.java b/src/main/java/com/yipin/liuwanr/entity/ManagementAndPointVo.java index 7cca797..8450317 100644 --- a/src/main/java/com/yipin/liuwanr/entity/ManagementAndPointVo.java +++ b/src/main/java/com/yipin/liuwanr/entity/ManagementAndPointVo.java @@ -5,14 +5,15 @@ import io.swagger.annotations.ApiModelProperty; import java.util.List; + @ApiModel(value = "ManagementAndPointVo对象", description = "添加项目管理对象ManagementAndPointVo") public class ManagementAndPointVo { - @ApiModelProperty(value = "项目管理实体类", name = "management", required = true) + @ApiModelProperty(value = "项目管理实体类", name = "management", required = true) private ProjectManagement management;//项目管理 //@ApiModelProperty(value = "判分点信息列表,key:判分点主键 value:分数", name = "pooints", example = "[{\"judgmentPointsId\":184,\"judgmentPointsName\":\"列表——元素的修改 \",\"experimentalRequirements\":\"新学期开始,老师组织了学习小组,该学习小组有A,B,C,D五个学生\\nList1=[''A'',''B'',''C'',''D'']\\n列表元素-修改-请使用下标索引\\n第三天上课,老师发现把E同学的名字打错了,应该T。请修改并打印本小组的全体学生\",\"score\":\"100\"}]", required = true) @ApiModelProperty(value = "判分点信息列表,key:判分点主键 value:分数", name = "pooints", required = true) - private List pooints;//判分点信息 + private List pooints;//判分点信息 @ApiModelProperty(value = "角色id列表", name = "roleId", example = "[403]", required = true) private List roleId;//存储角色id @@ -25,11 +26,11 @@ public class ManagementAndPointVo { this.management = management; } - public List getPooints() { + public List getPooints() { return pooints; } - public void setPooints(List pooints) { + public void setPooints(List pooints) { this.pooints = pooints; } diff --git a/src/main/java/com/yipin/liuwanr/entity/ScoreIndex.java b/src/main/java/com/yipin/liuwanr/entity/ScoreIndex.java index d5c6eee..7648ebe 100644 --- a/src/main/java/com/yipin/liuwanr/entity/ScoreIndex.java +++ b/src/main/java/com/yipin/liuwanr/entity/ScoreIndex.java @@ -12,15 +12,24 @@ public class ScoreIndex { private Integer score;//分数 private Integer judgmentPointsId;//判分点id private Integer projectId;//项目id - private Integer isdel;//是否删除 - private Integer userId; + private Integer userId;//绑定用户id + private Integer systemId;//绑定系统id - public ScoreIndex( Integer score, Integer judgmentPointsId, Integer projectId,Integer userId) { + public ScoreIndex( Integer score, Integer judgmentPointsId, Integer projectId,Integer userId,Integer systemId) { super(); this.score = score; this.judgmentPointsId = judgmentPointsId; this.projectId = projectId; this.userId = userId; + this.systemId = systemId; + } + + public Integer getSystemId() { + return systemId; + } + + public void setSystemId(Integer systemId) { + this.systemId = systemId; } public Integer getUserId() { @@ -43,15 +52,6 @@ public class ScoreIndex { this.projectId = projectId; } - public Integer getIsdel() { - return isdel; - } - - - public void setIsdel(Integer isdel) { - this.isdel = isdel; - } - public Integer getScoreindexId() { return scoreindexId; } diff --git a/src/main/java/com/yipin/liuwanr/entity/TradingJudgmentPoints.java b/src/main/java/com/yipin/liuwanr/entity/TradingJudgmentPoints.java new file mode 100644 index 0000000..466e7ed --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/entity/TradingJudgmentPoints.java @@ -0,0 +1,74 @@ +package com.yipin.liuwanr.entity; + +/** + * 交易类判分点实体类 + * + * @author Ning + * + */ +public class TradingJudgmentPoints { + + private Integer id; // 判分点主键Id + private String judgmentPointsName; // 判分点名称 + private String experimentalRequirements;// 实验要求 + private String projectId;// 绑定项目管理Id + private Integer systemId;//绑定系统id + private Integer userId;//绑定用户id + private String creationTime;//创建时间 + + public String getCreationTime() { + return creationTime; + } + + public void setCreationTime(String creationTime) { + this.creationTime = creationTime; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getJudgmentPointsName() { + return judgmentPointsName; + } + + public void setJudgmentPointsName(String judgmentPointsName) { + this.judgmentPointsName = judgmentPointsName; + } + + public String getExperimentalRequirements() { + return experimentalRequirements; + } + + public void setExperimentalRequirements(String experimentalRequirements) { + this.experimentalRequirements = experimentalRequirements; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public Integer getSystemId() { + return systemId; + } + + public void setSystemId(Integer systemId) { + this.systemId = systemId; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } +} diff --git a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java index fe64c0e..ce4e439 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java @@ -2,7 +2,7 @@ package com.yipin.liuwanr.mapper; import java.util.List; -import com.yipin.liuwanr.entity.ProjectManagement; +import com.yipin.liuwanr.entity.*; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Options; @@ -10,9 +10,6 @@ import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; -import com.yipin.liuwanr.entity.Judgment_Points; -import com.yipin.liuwanr.entity.Role; - /** * 项目管理系统 项目管理表 * @@ -26,7 +23,7 @@ public interface ProjectManagementMapper { * @param projectName * @return */ - @Select("select count(*) from hr_project_management where projectName=#{projectName} and isdel = 0") + @Select("select count(*) from hr_project_management where projectName=#{projectName}") Integer getByprojectName(String projectName); /** @@ -46,20 +43,14 @@ public interface ProjectManagementMapper { * " ORDER BY creationTime desc", */ @Select({""}) List queryManagements(ProjectManagement management); @@ -82,19 +73,11 @@ public interface ProjectManagementMapper { @Select({""}) List queryManagementsExportTest(ProjectManagement management); - @Select({""}) - List queryManagementsExport(ProjectManagement management); /** @@ -103,7 +86,7 @@ public interface ProjectManagementMapper { * @param projectId * @return */ - @Select("select knowledgePointsIsEnable,experimentIntroductionIsEnable,isstartexperimentSuggests,projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction,systemId from hr_project_management where isdel=0 and projectId=#{projectId}") + @Select("select projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0 and projectId=#{projectId}") ProjectManagement getProjectId(Integer projectId); /** @@ -126,16 +109,16 @@ public interface ProjectManagementMapper { "where hpm.projectId=#{projectId} and hpm.projectId = tet.project_id" + "") void deleteProjectManagement(Integer projectId); -// 202.10.29 标准版 -// /** -// * 批量删除 -// * -// * @param projectId -// */ -// @Update("") -// void deleteProjectManagement(Integer projectId); + + /** + * 批量删除分数表 + * + * @param projectId + */ + @Update("") + int delete(Integer projectId); /** @@ -161,18 +144,13 @@ public interface ProjectManagementMapper { * 点击编辑或者创建项目管理页面的保存按钮后, * 修改角色表中的对应数据的项目id * - * @param ids + * @param roleId * @param projectId */ -// @Update("") - @Update({""}) - void updateRoleProjectId(@Param("ids") List ids, @Param("projectId") Integer projectId); + @Update("") + int updateRoleProjectId(Integer roleId, @Param("projectId") Integer projectId); @Delete("delete from hr_role where projectId=#{projectId}") @@ -192,7 +170,7 @@ public interface ProjectManagementMapper { /** - * 查询单个项目判分点信息,根据项目id + * 查询职站单个项目判分点信息,根据项目id * * @param projectId 项目id * @return @@ -200,7 +178,31 @@ public interface ProjectManagementMapper { @Select({""}) - List getJudgmentPoints(@Param("projectId") Integer projectId); + List getZZJudgmentPoints(@Param("projectId") Integer projectId); + + + /** + * 查询单个项目判分点信息,根据项目id + * + * @param projectId 项目id + * @return + */ + @Select({""}) + List getJudgmentPoints(@Param("projectId") Integer projectId); + + /** + * 查询单个项目判分点信息,根据项目id + * + * @param judgmentPointsId 判分点id + * @return + */ + @Select({""}) + List getScore(Integer judgmentPointsId,Integer systemId,Integer projectId); /** @@ -223,7 +225,7 @@ public interface ProjectManagementMapper { "select judgmentPointsId,judgmentPointsName from hr_judgment_points where isdel=0 and systemId=#{systemId} and isopen=0", " and judgmentPointsName like concat('%','${judgmentPointsName}','%')", ""}) - List queryAllJudgmentPoints(Judgment_Points points); + List queryAllJudgmentPoints(JudgmentPoints points); /** @@ -234,10 +236,10 @@ public interface ProjectManagementMapper { * @return */ @Select({""}) - List getByjudgmentPointsIds(@Param("point") List point); + List getByjudgmentPointsIds(@Param("point") List point); /** * 点击具体某个项目信息的编辑按钮, @@ -246,12 +248,15 @@ public interface ProjectManagementMapper { * @param projectId * @return */ - @Select("select judgmentPointsId,judgmentPointsName,experimentalRequirements ,userId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") - List getByProjectId(Integer projectId); + @Select("select judgmentPointsId,judgmentPointsName,experimentalRequirements from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") + List getByProjectId(Integer projectId); + + @Select("select hjp.id as judgmentPointsId,hjp.judgment_points_name as judgmentPointsName,si.score from hr_trading_judgment_points hjp,hr_score_index si where si.projectId =#{projectId} and hjp.system_id = 3 and si.judgmentPointsId = hjp.id ") + List queryJudgmentPoints(Integer projectId); @Select("select judgmentPointsId,projectId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") - List queryProjectIds(Integer projectId); + List queryProjectIds(Integer projectId); /** * 取出判分点中的项目管理的id @@ -260,7 +265,25 @@ public interface ProjectManagementMapper { * @return */ @Select("select projectId,experimentalRequirements from hr_judgment_points where judgmentPointsId=#{judgmentPointsId}") - Judgment_Points getByjudgmentPointsId(Integer judgmentPointsId); + JudgmentPoints getByjudgmentPointsId(Integer judgmentPointsId); + + /** + * 取出判分点中的项目管理的id + * + * @param judgmentPointsId + * @return + */ + @Select("select id as judgmentPointsId,project_id as projectId,experimental_requirements as experimentalRequirements from hr_trading_judgment_points where id=#{judgmentPointsId}") + JudgmentPoints newGetProjectId(Integer judgmentPointsId); + + /** + * 取出判分点中的项目管理的id + * + * @param judgmentPointsId + * @return + */ + @Select("select project_id as projectId ,experimental_requirements as experimentalRequirements from hr_trading_judgment_points where id=#{judgmentPointsId}") + JudgmentPoints getNewByjudgmentPointsId(Integer judgmentPointsId); /** @@ -276,13 +299,24 @@ public interface ProjectManagementMapper { ""}) void updateProject(String projectId, String experimentalRequirements, Integer judgmentPointsId); + /** + * 修改判分点绑定的项目 + * @param projectId + * @param judgmentPointsId + */ + @Update({""}) + void updateTradingJudgmentPoints(String projectId, Integer judgmentPointsId); + /** * 添加项目管理信息 * * @param management */ - @Insert("INSERT INTO hr_project_management(roleId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction,knowledgePointsIsEnable,experimentIntroductionIsEnable)" - + " VALUES (#{founder},#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},#{knowledgePoints},#{experimentIntroduction},#{knowledgePointsIsEnable},#{experimentIntroductionIsEnable})") + @Insert("INSERT INTO hr_project_management(projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction,knowledgePointsIsEnable,experimentIntroductionIsEnable)" + + " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},#{knowledgePoints},#{experimentIntroduction},#{knowledgePointsIsEnable},#{experimentIntroductionIsEnable})") @Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId") void insertProjectManagement(ProjectManagement management); @@ -333,16 +367,6 @@ public interface ProjectManagementMapper { @Select("SELECT accountRole FROM user WHERE userId=#{userId}") Integer queryRoleId(Integer userId); - /** - * 查询用户角色 - * - * @param userId - * @return - */ - @Select("SELECT roleId FROM hr_user_info WHERE userId=#{userId}") - String queryRoleIds(Integer userId); - - /** * 查询项目名称 * @@ -361,5 +385,4 @@ public interface ProjectManagementMapper { "where projectId=#{projectId}" + "") void daleteManegement(Integer id); - } diff --git a/src/main/java/com/yipin/liuwanr/mapper/ScoreIndexMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ScoreIndexMapper.java index 0b63d22..c5db52c 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ScoreIndexMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ScoreIndexMapper.java @@ -18,8 +18,8 @@ public interface ScoreIndexMapper { * 给判分指标添加分数 * @param scoreIndex */ - @Insert("insert into hr_score_index (score,judgmentPointsId,projectId,userId,isdel) " - + " values (#{score},#{judgmentPointsId},#{projectId},#{userId},0)") + @Insert("insert into hr_score_index (score,judgmentPointsId,projectId,userId,systemId) " + + " values (#{score},#{judgmentPointsId},#{projectId},#{userId},#{systemId})") @Options(useGeneratedKeys = true,keyProperty = "scoreindexId",keyColumn = "scoreindexId") void addScoreIndex(ScoreIndex scoreIndex); @@ -46,7 +46,7 @@ public interface ScoreIndexMapper { * 根据判分点id和项目id查询具体分数 * @return */ - @Select("select score from hr_score_index where isdel=0 and judgmentPointsId=#{judgmentPointsId} and projectId=#{projectId} and userId=#{userId} ORDER BY score DESC LIMIT 1") + @Select("select score from hr_score_index where judgmentPointsId=#{judgmentPointsId} and projectId=#{projectId} and userId=#{userId}") Integer getbyJudgmentPointsIdScore(@Param("judgmentPointsId")Integer judgmentPointsId,@Param("projectId") Integer projectId,@Param("userId") Integer userId); /** @@ -56,9 +56,8 @@ public interface ScoreIndexMapper { * @return */ @Select({""}) List queryScore(@Param("ids")List judgmentPointsId,@Param("projectId")Integer projectId,@Param("userId") Integer userId); } diff --git a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java index eb87657..0b09827 100644 --- a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java +++ b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java @@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional; import com.yipin.liuwanr.helper.UserUtil; import com.yipin.liuwanr.mapper.ProjectManagementMapper; import com.yipin.liuwanr.mapper.ScoreIndexMapper; +import org.springframework.util.LinkedMultiValueMap; @Service public class ProjectManagementService { @@ -77,18 +78,23 @@ public class ProjectManagementService { public HashMap queryManagements(ProjectManagement vo, Integer pageNo, Integer pageSize) { HashMap resp = new HashMap(); try { + //获取用户的角色信息 + Integer roleId = mapper.queryRoleId(vo.getUserId()); + if (null != roleId) { + //角色不对(学生没有权限) + if (roleId == 4) { + resp.put("retcode", 300); + resp.put("retvalue", "抱歉,您的权限不能访问该地址!"); + return resp; + } + //角色等于管理员或者超级管理员 + else if (roleId == 1 ) { + vo.setUserId(null); + } + } PageHelper.startPage(pageNo, pageSize); //条件查询 - List list = mapper.queryManagementsExport(vo); -// //获取用户的角色信息 -// String roleId = mapper.queryRoleIds(vo.getUserId()); -// if (null != roleId) { -// if (roleId.contains("3")) { -// vo.setUserId(null); -// List projectManagements = mapper.queryManagementsExport(vo); -// list.addAll(projectManagements); -// } -// } + List list = mapper.queryManagementsExportTest(vo); PageInfo info = new PageInfo(list); resp.put("retvalue", new PageResult(info.getTotal(), list)); resp.put("retcode", 200); @@ -110,25 +116,21 @@ public class ProjectManagementService { HashMap resp = new HashMap(); try { //获取用户的角色信息 -// String roleId = mapper.queryRoleIds(vo.getUserId()); -// if (null != roleId) { -// //角色不对(学生没有权限) -// if (roleId.contains("4")) { -// resp.put("retcode", 300); -// resp.put("retvalue", "抱歉,您的权限不能访问该地址!"); -// return resp; -// } -// //角色等于管理员或者超级管理员 -// else if (roleId.contains("1")) { -// vo.setUserId(null); -// } -// } + Integer roleId = mapper.queryRoleId(vo.getUserId()); + if (null != roleId) { + //角色不对(学生没有权限) + if (roleId == 4) { + resp.put("retcode", 300); + resp.put("retvalue", "抱歉,您的权限不能访问该地址!"); + return resp; + } + //角色等于管理员或者超级管理员 + else if (roleId == 1 ) { + vo.setUserId(null); + } + } //条件查询 List list = mapper.queryManagements(vo); -// if (vo.getFounder()==null||vo.getFounder()==3){ -// List list2 = mapper.queryUserManagements(vo); -// list.addAll(list2); -// } resp.put("retvalue",list); resp.put("retcode", 200); } catch (Exception e) { @@ -153,10 +155,10 @@ public class ProjectManagementService { try { for (Integer po : projectId) { //判分点 - List points = mapper.queryProjectIds(po); + List points = mapper.queryProjectIds(po); for (int i = 0; i < points.size(); i++) { //判分点 - Judgment_Points pos = points.get(i); + JudgmentPoints pos = points.get(i); Integer pointId = pos.getJudgmentPointsId();//判分点id String projectIds = pos.getProjectId();//项目id @@ -216,7 +218,7 @@ public class ProjectManagementService { if (null != management) { // 判分点信息 - List points = mapper.getByProjectId(projectId); + List points = mapper.getByProjectId(projectId); //判分点不为空 if (null != points && !points.isEmpty()) { //存储判分点id @@ -228,7 +230,7 @@ public class ProjectManagementService { if (scores.size() > 0 && !scores.isEmpty()) { //为有分数的赋值 for (int i = 0; i < points.size(); i++) { - Judgment_Points point = points.get(i); + JudgmentPoints point = points.get(i); for (int j = 0; j < scores.size(); j++) { ScoreIndex score = scores.get(j); if (point.getJudgmentPointsId().equals(score.getJudgmentPointsId())) { @@ -242,14 +244,14 @@ public class ProjectManagementService { //为没值的赋值 for (int i = 0; i < points.size(); i++) { if (!indexs.contains(i)) { - Judgment_Points points3 = points.get(i); + JudgmentPoints points3 = points.get(i); points3.setScore(0); points.set(i, points3); } } } else { for (int i = 0; i < points.size(); i++) { - Judgment_Points point = points.get(i); + JudgmentPoints point = points.get(i); //给分数赋值 point.setScore(0); //修改该判分点 @@ -276,12 +278,70 @@ public class ProjectManagementService { } + /** + * 根据项目管理id查询对应交易类判分点信息 + * + * @param projectId + * @return + */ + public HashMap getTrdingJudgmentPoints(Integer projectId) { + HashMap resp = new HashMap(); + List obj = new ArrayList(); + + try { + // 项目信息 + ProjectManagement management = mapper.getProjectId(projectId); + if (null != management) { + // 判分点信息 + List points = mapper.queryJudgmentPoints(projectId); + // 角色信息 + List roles = mapper.queryProjectId(projectId); + // 存数据 + obj.add(management); + obj.add(points); + obj.add(roles); + } + resp.put("retvalue", obj); + resp.put("retcode", 200); + } catch (Exception e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + + /** + * 根据项目管理id查询对应交易类判分点信息 + * + * @param projectId + * @return + */ + public HashMap getProject(Integer projectId) { + HashMap resp = new HashMap(); + try { + // 项目信息 + ProjectManagement management = mapper.getProjectId(projectId); + resp.put("retvalue", management); + resp.put("retcode", 200); + } catch (Exception e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + /** * 添加判分点页面的判分点信息展示 * * @return */ - public HashMap queryAllJudgmentPoints(Judgment_Points points) { + public HashMap queryAllJudgmentPoints(JudgmentPoints points) { HashMap resp = new HashMap(); try { resp.put("retvalue", mapper.queryAllJudgmentPoints(points)); @@ -305,13 +365,13 @@ public class ProjectManagementService { public HashMap getByjudgmentPointsId(List judgmentPointsId, Integer projectId, Integer userId) { HashMap resp = new HashMap(); try { - List points = mapper.getByjudgmentPointsIds(judgmentPointsId); + List points = mapper.getByjudgmentPointsIds(judgmentPointsId); List scores = indexMapper.queryScore(judgmentPointsId, projectId, userId); List indexs = new ArrayList(); //为新增项目时勾选判分点赋值 if (scores.size() <= 0) { for (int i = 0; i < points.size(); i++) { - Judgment_Points points2 = points.get(i); + JudgmentPoints points2 = points.get(i); points2.setScore(0); points.set(i, points2); } @@ -320,7 +380,7 @@ public class ProjectManagementService { else { //为有分数的赋值 for (int i = 0; i < points.size(); i++) { - Judgment_Points point = points.get(i); + JudgmentPoints point = points.get(i); for (int j = 0; j < scores.size(); j++) { ScoreIndex score = scores.get(j); if (point.getJudgmentPointsId().equals(score.getJudgmentPointsId())) { @@ -334,7 +394,7 @@ public class ProjectManagementService { //为没值的赋值 for (int i = 0; i < points.size(); i++) { if (!indexs.contains(i)) { - Judgment_Points points3 = points.get(i); + JudgmentPoints points3 = points.get(i); points3.setScore(0); points.set(i, points3); } @@ -373,7 +433,6 @@ public class ProjectManagementService { return resp; } - /** * 查询单个项目判分点信息,根据项目id * @@ -382,8 +441,60 @@ public class ProjectManagementService { */ public HashMap getJudgmentPoints(Integer projectId) { HashMap resp = new HashMap(); + HashMap obj = new HashMap(); + HashMap score = new HashMap(); + List scoreIndexList = null; try { - resp.put("retvalue", mapper.getJudgmentPoints(projectId)); + List judgmentPointsList = mapper.getJudgmentPoints(projectId); + Integer size = judgmentPointsList.size(); + for (int i = 0; i roleList = mapper.queryProjectId(projectId); + obj.put("roleList",roleList); + obj.put("judgmentPointsList", judgmentPointsList); + obj.put("scoreIndexList", score); + resp.put("retvalue", obj); + resp.put("retcode", 200); + } catch (Exception e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + /** + * 查询职站单个项目判分点信息,根据项目id + * + * @param projectId 项目id + * @return + */ + public HashMap getZZJudgmentPoints(Integer projectId) { + HashMap resp = new HashMap(); + HashMap obj = new HashMap(); + HashMap score = new HashMap(); + List scoreIndexList = null; + try { + List judgmentPointsList = mapper.getZZJudgmentPoints(projectId); + Integer size = judgmentPointsList.size(); + for (int i = 0; i roleList = mapper.queryProjectId(projectId); + obj.put("roleList",roleList); + obj.put("judgmentPointsList", judgmentPointsList); + obj.put("scoreIndexList", scoreIndexList); + resp.put("retvalue", obj); resp.put("retcode", 200); } catch (Exception e) { logger.error(e.getMessage()); @@ -465,17 +576,83 @@ public class ProjectManagementService { * @return */ @Transactional - public HashMap insertProjectManagement(ProjectManagement pro, List points, List roles) { + public HashMap newAddProjectManagement(ProjectManagement pro, List points, List roles) { + HashMap resp = new HashMap(); + try { + // 添加项目信息 + mapper.insertProjectManagement(pro); + // 取出添加的项目信息的id + Integer projectId = pro.getProjectId(); + for (int i = 0; i < points.size(); i++) { + //拼接判分点中的项目id + StringBuffer buff = new StringBuffer(); + //判分点id + Integer pointId = points.get(i).getJudgmentPointsId(); + //根据该判分点得到数据库存储的对应数据 + JudgmentPoints point = mapper.newGetProjectId(pointId); + //取出绑定的项目id + String projectIds = point.getProjectId(); + //取出实验要求 + String experimentalRequirements = point.getExperimentalRequirements(); + + //数据库中该判分点已绑定过别的项目id,并且该判分点没有绑定过此时前端传来的项目id + if (!StringUtils.isEmpty(projectIds)) { + List lists = Arrays.asList(projectIds.split(",")); + if (!lists.contains(projectId.toString())) { + buff.append(projectIds); + buff.append(","); + buff.append(projectId); + } + } + //数据库中该判分点未绑定任何项目id + else if (projectIds == null) { + buff.append(projectId); + } + //数据中实验要求不为空,且数据库中的实验要求与前端传来的实验要求信息一致 + if (experimentalRequirements != null && !experimentalRequirements.equals("") + && experimentalRequirements.equals(points.get(i).getExperimentalRequirements())) { + mapper.updateTradingJudgmentPoints(new String(buff), pointId); + } + //数据库中的实验要求与前端传来的实验要求信息不一致 + else if (!experimentalRequirements.equals(points.get(i).getExperimentalRequirements())) { + mapper.updateTradingJudgmentPoints(new String(buff), pointId); + } + + // 得到判分指标信息 + ScoreIndex scoreIndex = new ScoreIndex(points.get(i).getScore(), pointId, projectId, pro.getUserId(),pro.getSystemId()); + // 在判分指标中添加对应信息 + indexMapper.addScoreIndex(scoreIndex); + } + // 修改角色信息中的项目管理id + if (roles != null && roles.size() > 0) { + Integer size = roles.size(); + for (int i = 0; i insertProjectManagement(ProjectManagement pro, List points, List roles) { HashMap resp = new HashMap(); try { - //只允许一个Founder -// if (pro.getFounder()==1){//超管 -// pro.setFounder(1); -// }else if (pro.getFounder()==2){//管理员 -// pro.setFounder(2); -// }else if (pro.getFounder()==3){//老师 -// pro.setFounder(3); -// } // 添加项目信息 mapper.insertProjectManagement(pro); // 取出添加的项目信息的id @@ -487,7 +664,7 @@ public class ProjectManagementService { //判分点id Integer pointId = points.get(i).getJudgmentPointsId(); //根据该判分点得到数据库存储的对应数据 - Judgment_Points point = mapper.getByjudgmentPointsId(pointId); + JudgmentPoints point = mapper.getByjudgmentPointsId(pointId); //取出绑定的项目id String projectIds = point.getProjectId(); //取出实验要求 @@ -517,13 +694,17 @@ public class ProjectManagementService { } // 得到判分指标信息 - ScoreIndex scoreIndex = new ScoreIndex(points.get(i).getScore(), pointId, projectId, pro.getUserId()); + ScoreIndex scoreIndex = new ScoreIndex(points.get(i).getScore(), pointId, projectId, pro.getUserId(),pro.getSystemId()); // 在判分指标中添加对应信息 indexMapper.addScoreIndex(scoreIndex); } // 修改角色信息中的项目管理id if (roles != null && roles.size() > 0) { - mapper.updateRoleProjectId(roles, projectId); + Integer size = roles.size(); + for (int i = 0; i=1){ - resp.put("retcode", 201); + resp.put("retcode", 300); resp.put("retvalue", "该项目名称已存在"); }else{ resp.put("retcode", 200); @@ -563,7 +744,7 @@ public class ProjectManagementService { * @return */ @Transactional - public HashMap updateProjectManagement(ProjectManagement pro, List points, + public HashMap updateProjectManagement(ProjectManagement pro, List points, List roles) { HashMap resp = new HashMap(); @@ -587,9 +768,10 @@ public class ProjectManagementService { String experimentalRequirements1 = points.get(i).getExperimentalRequirements(); //前端传来的分数 Integer score1 = points.get(i).getScore(); + Integer systemId = pro.getSystemId(); //判分点信息 - Judgment_Points point = mapper.getByjudgmentPointsId(pointId); + JudgmentPoints point = mapper.getByjudgmentPointsId(pointId); String projectIds = point.getProjectId(); String experimentalRequirements2 = point.getExperimentalRequirements(); @@ -599,11 +781,11 @@ public class ProjectManagementService { Integer score2 = indexMapper.getbyJudgmentPointsIdScore(pointId, project, userId); // 如果分数不一致,则修改分数表中的分数 if (score2 != null && score1 != score2) { - indexMapper.updateScore(new ScoreIndex(score1, pointId, project, userId)); + indexMapper.updateScore(new ScoreIndex(score1, pointId, project, userId,systemId)); } // 如果数据库中该判分点分数为空,则添加分数 else if (score2 == null) { - indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId())); + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(),systemId)); } //如果前端传来的实验要求与数据库中不一致,则修改数据库中的判分点信息 if (!experimentalRequirements2.equals(experimentalRequirements1)) { @@ -634,7 +816,146 @@ public class ProjectManagementService { mapper.updateProject(new String(buff), experimentalRequirements1, pointId); } // 添加分数 - indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId())); + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(),systemId)); + } + judgments.remove(pointId); + } + + // 从判分点id中删除该项目的id + for (int i = 0; i < judgments.size(); i++) { + Integer judgmentPointsId = judgments.get(i); + + JudgmentPoints point = mapper.getByjudgmentPointsId(judgmentPointsId); + String projectIds = point.getProjectId(); + // 删除分数表中对应的判分点id+项目id数据 + indexMapper.removeScore(judgmentPointsId, project, userId); + + // 对取出的数据,删除该项目的id + List str3 = Arrays.asList(projectIds.split(",")); + if (str3.contains(project.toString())) { + List arrayList = new ArrayList(str3); + arrayList.remove(project.toString()); + // 删除字符中项目id + projectIds = StringUtils.strip(arrayList.toString(), "[]").replace(" ", ""); + // 修改判分点中的项目id + mapper.updateProject(projectIds, null, judgments.get(i)); + } + } + + // 用来存储需要修改的角色id + List roleid = new ArrayList(); + + // 遍历前端传来的新的角色id + for (int i = 0; i < roles.size(); i++) { + // 如果前端传来的数据,在数据库中没有,则存起来 + if (!rolesIds.contains(roles.get(i))) { + roleid.add(roles.get(i)); + } + } + + if (roles != null && roles.size() > 0) { + Integer size = roles.size(); + for (int i = 0; i newUpdateProjectManagement(ProjectManagement pro, List points, + List roles) { + HashMap resp = new HashMap(); + + //项目id + Integer project = pro.getProjectId(); +// int del = mapper.delete(project); + //用户id + Integer userId = pro.getUserId(); + try { + //删除项目原本绑定的判分点 + int del = mapper.delete(project); + // 取出该项目对应的判分点id + List judgments = mapper.getByPointProjectId(project); + // 取出该项目对应的角色id + List rolesIds = mapper.getByRoleProjectId(project); + + for (int i = 0; i < points.size(); i++) { + //拼接判分点中的项目id + StringBuffer buff = new StringBuffer(); + + //前端传来的判分点id + Integer pointId = points.get(i).getJudgmentPointsId(); + //前端传来的实验要求 + String experimentalRequirements1 = points.get(i).getExperimentalRequirements(); + //前端传来的分数 + Integer score1 = points.get(i).getScore(); + Integer systemId = pro.getSystemId(); + + //判分点信息 + JudgmentPoints point = mapper.getNewByjudgmentPointsId(pointId); + String projectIds = point.getProjectId(); + String experimentalRequirements2 = point.getExperimentalRequirements(); + + // 如果数据库中有,则取出分数,进行比较 + if (judgments.contains(pointId)) { + //分数 + Integer score2 = indexMapper.getbyJudgmentPointsIdScore(pointId, project, userId); + // 如果分数不一致,则修改分数表中的分数 + if (score2 != null && score1 != score2) { + indexMapper.updateScore(new ScoreIndex(score1, pointId, project, userId,systemId)); + } + // 如果数据库中该判分点分数为空,则添加分数 + else if (score2 == null) { + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(),systemId)); + } + //如果前端传来的实验要求与数据库中不一致,则修改数据库中的判分点信息 + if (!experimentalRequirements2.equals(experimentalRequirements1)) { + mapper.updateTradingJudgmentPoints(point.getProjectId(), pointId); + } + } else { + //数据库中该判分点已绑定过别的项目id,并且该判分点没有绑定过此时前端传来的项目id + if (!StringUtils.isEmpty(projectIds)) { + List lists = Arrays.asList(projectIds.split(",")); + if (!lists.contains(project.toString())) { + buff.append(projectIds); + buff.append(","); + buff.append(project); + } + + } + //数据库中该判分点未绑定任何项目id + else if (StringUtils.isEmpty(projectIds)) { + buff.append(project); + } + //数据中实验要求不为空,且数据库中的实验要求与前端传来的实验要求信息一致 + if (experimentalRequirements2 != null && !experimentalRequirements2.equals("") + && experimentalRequirements2.equals(experimentalRequirements1)) { + mapper.updateTradingJudgmentPoints(new String(buff), pointId); + } + //数据库中的实验要求与前端传来的实验要求信息不一致 + else if (!experimentalRequirements2.equals(experimentalRequirements1)) { + mapper.updateTradingJudgmentPoints(new String(buff), pointId); + } + // 添加分数 + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(),systemId)); } judgments.remove(pointId); } @@ -643,7 +964,7 @@ public class ProjectManagementService { for (int i = 0; i < judgments.size(); i++) { Integer judgmentPointsId = judgments.get(i); - Judgment_Points point = mapper.getByjudgmentPointsId(judgmentPointsId); + JudgmentPoints point = mapper.getByjudgmentPointsId(judgmentPointsId); String projectIds = point.getProjectId(); // 删除分数表中对应的判分点id+项目id数据 indexMapper.removeScore(judgmentPointsId, project, userId); @@ -671,9 +992,12 @@ public class ProjectManagementService { } } - if (roleid.size() > 0 && !roleid.isEmpty()) { - // 修改对应角色的项目id - mapper.updateRoleProjectId(roleid, project); + if (roles != null && roles.size() > 0) { + Integer size = roles.size(); + for (int i = 0; i map = managementService.queryRole(userid); - - map.forEach((key, value) -> { - System.out.println("key = " + key + " ===> value = " + value.toString()); - }); - } - - /** - * 分页查询+条件查询 - */ -// @Test -// public void testQueryAllManagements() { +//package com.yipin.liuwanr; // -// Integer projectPermissions = null; -// Integer founder = null; -// Integer state = null; -// String projectName = null; -// Integer systemId = 1; -// Integer userId = 4; +//import com.yipin.liuwanr.entity.*; +//import com.yipin.liuwanr.mapper.ProjectManagementMapper; +//import com.yipin.liuwanr.service.ProjectManagementService; +//import org.junit.jupiter.api.Test; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.test.context.SpringBootTest; // -// ProjectManagement vo = new ProjectManagement(); -// if (null != projectPermissions) { -// vo.setProjectPermissions(projectPermissions); -// } -// if (null != founder) { -// vo.setFounder(founder); -// } -// if (null != state) { -// vo.setState(state); -// } -// if (null != systemId) { -// vo.setSystemId(systemId); -// } -// if (null != projectName && projectName != "") { -// vo.setProjectName(projectName); -// } -// if (null != userId) { -// vo.setUserId(userId); -// } +//import org.springframework.transaction.annotation.Transactional; // -// Integer pageNo = 1; -// Integer pageSize = 10; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.List; // -// HashMap map = managementService.queryAllManagements(vo); -//// HashMap map = managementService.queryAllManagements(vo, pageNo, pageSize); +//@SpringBootTest +//public class Project_ManagementTest { // -// Integer retcode = (Integer) map.get("retcode"); +// @Autowired +// private ProjectManagementService managementService; // -// System.out.println(retcode); +// @Autowired +// private ProjectManagementMapper projectManagementMapper; // -// if (retcode == 200) { -// PageResult pageResult = (PageResult) map.get("retvalue"); +// /** +// * 查询用户角色信息 +// */ +// @Test +// public void testQueryRole() { +// Integer userid = 455; // -// Long total = pageResult.getTotal(); +// HashMap map = managementService.queryRole(userid); // -// System.out.println("total = " + total); +// map.forEach((key, value) -> { +// System.out.println("key = " + key + " ===> value = " + value.toString()); +// }); +// } +// +// /** +// * 分页查询+条件查询 +// */ +//// @Test +//// public void testQueryAllManagements() { +//// +//// Integer projectPermissions = null; +//// Integer founder = null; +//// Integer state = null; +//// String projectName = null; +//// Integer systemId = 1; +//// Integer userId = 4; +//// +//// ProjectManagement vo = new ProjectManagement(); +//// if (null != projectPermissions) { +//// vo.setProjectPermissions(projectPermissions); +//// } +//// if (null != founder) { +//// vo.setFounder(founder); +//// } +//// if (null != state) { +//// vo.setState(state); +//// } +//// if (null != systemId) { +//// vo.setSystemId(systemId); +//// } +//// if (null != projectName && projectName != "") { +//// vo.setProjectName(projectName); +//// } +//// if (null != userId) { +//// vo.setUserId(userId); +//// } +//// +//// Integer pageNo = 1; +//// Integer pageSize = 10; +//// +//// HashMap map = managementService.queryAllManagements(vo); +////// HashMap map = managementService.queryAllManagements(vo, pageNo, pageSize); +//// +//// Integer retcode = (Integer) map.get("retcode"); +//// +//// System.out.println(retcode); +//// +//// if (retcode == 200) { +//// PageResult pageResult = (PageResult) map.get("retvalue"); +//// +//// Long total = pageResult.getTotal(); +//// +//// System.out.println("total = " + total); +//// +//// List rows = (List) pageResult.getRows(); +//// +//// rows.forEach(item -> { +//// System.out.println(item.toString()); +//// }); +//// +//// } else { +//// String msg = (String) map.get("retvalue"); +//// System.out.println(msg); +//// } +//// } +// +// +// /** +// * 批量删除 +// */ +// @Transactional +// @Test +// public void testDeleteProjectManagement() { +// List point = new ArrayList<>(); +// point.add(1); +// HashMap map = managementService.deleteProjectManagement(point); +// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); +// } // -// List rows = (List) pageResult.getRows(); +// /** +// * 根据项目管理id查询对应信息 +// */ +// @Test +// public void testGetProjectId() { +// Integer projectId = 299; +// HashMap map = managementService.getProjectId(projectId); +// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); +// } // -// rows.forEach(item -> { +// /** +// * 添加判分点页面的判分点信息展示 +// */ +// @Test +// public void testQueryAllJudgmentPoints() { +// JudgmentPoints points = new JudgmentPoints(); +// points.setSystemId(1); +// points.setJudgmentPointsName(""); +// HashMap map = managementService.queryAllJudgmentPoints(points); +// Integer retcode = (Integer) map.get("retcode"); +// System.out.println(retcode); +// if (retcode == 200) { +// List list = (List) map.get("retvalue"); +// list.forEach(item -> { // System.out.println(item.toString()); // }); +// } else { +// String msg = (String) map.get("retvalue"); +// System.out.println(msg); +// } +// } // +// +// /** +// * 创建项目管理页面的判分点信息展示 +// */ +// @Test +// public void testGetByjudgmentPointsId() { +// List judgmentPointsId = new ArrayList<>(); +// judgmentPointsId.add(187); +// Integer projectId = 1; +// Integer userId = 4; +// HashMap map = managementService.getByjudgmentPointsId(judgmentPointsId, projectId, userId); +// Integer retcode = (Integer) map.get("retcode"); +// System.out.println(retcode); +// if (retcode == 200) { +// List list = (List) map.get("retvalue"); +// list.forEach(item -> { +// System.out.println(item.toString()); +// }); // } else { // String msg = (String) map.get("retvalue"); // System.out.println(msg); // } // } - - - /** - * 批量删除 - */ - @Transactional - @Test - public void testDeleteProjectManagement() { - List point = new ArrayList<>(); - point.add(1); - HashMap map = managementService.deleteProjectManagement(point); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); - } - - /** - * 根据项目管理id查询对应信息 - */ - @Test - public void testGetProjectId() { - Integer projectId = 299; - HashMap map = managementService.getProjectId(projectId); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); - } - - /** - * 添加判分点页面的判分点信息展示 - */ - @Test - public void testQueryAllJudgmentPoints() { - Judgment_Points points = new Judgment_Points(); - points.setSystemId(1); - points.setJudgmentPointsName(""); - HashMap map = managementService.queryAllJudgmentPoints(points); - Integer retcode = (Integer) map.get("retcode"); - System.out.println(retcode); - if (retcode == 200) { - List list = (List) map.get("retvalue"); - list.forEach(item -> { - System.out.println(item.toString()); - }); - } else { - String msg = (String) map.get("retvalue"); - System.out.println(msg); - } - } - - - /** - * 创建项目管理页面的判分点信息展示 - */ - @Test - public void testGetByjudgmentPointsId() { - List judgmentPointsId = new ArrayList<>(); - judgmentPointsId.add(187); - Integer projectId = 1; - Integer userId = 4; - HashMap map = managementService.getByjudgmentPointsId(judgmentPointsId, projectId, userId); - Integer retcode = (Integer) map.get("retcode"); - System.out.println(retcode); - if (retcode == 200) { - List list = (List) map.get("retvalue"); - list.forEach(item -> { - System.out.println(item.toString()); - }); - } else { - String msg = (String) map.get("retvalue"); - System.out.println(msg); - } - } - - /** - * 平均分配分值 - */ - @Test - public void testAvgValues() { - Integer number = 66; - HashMap map = managementService.avgValues(number); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); - } - - /** - * 添加完角色信息 角色信息展示 - */ - @Test - public void testGetByRoleId() { - List roleId = new ArrayList<>(); - roleId.add(235); - HashMap map = managementService.getByRoleId(roleId); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); - } - - /** - * 修改角色信息 - */ - @Test - public void testUpdateRole() { - - List list = new ArrayList<>(); - list.add(235); - - List roleList = projectManagementMapper.getByRoleId(list); - Role role = roleList.get(0); - role.setRoleName("hh"); - //System.out.println(role.toString());//Role{roleId=235, roleName='null', roleNumber=1, roleType=1, roleAttribute=1} - - HashMap map = managementService.updateRole(role); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); - } - - /** - * 添加角色信息 - */ - @Test - public void testInsertRole() { - List list = new ArrayList<>(); - list.add(235); - - List roleList = projectManagementMapper.getByRoleId(list); - Role role = roleList.get(0); - role.setRoleId(null); - role.setRoleName("hh"); - - HashMap map = managementService.insertRole(role); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); - } - +// +// /** +// * 平均分配分值 +// */ +// @Test +// public void testAvgValues() { +// Integer number = 66; +// HashMap map = managementService.avgValues(number); +// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); +// } +// +// /** +// * 添加完角色信息 角色信息展示 +// */ +// @Test +// public void testGetByRoleId() { +// List roleId = new ArrayList<>(); +// roleId.add(235); +// HashMap map = managementService.getByRoleId(roleId); +// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); +// } +// +// /** +// * 修改角色信息 +// */ +// @Test +// public void testUpdateRole() { +// +// List list = new ArrayList<>(); +// list.add(235); +// +// List roleList = projectManagementMapper.getByRoleId(list); +// Role role = roleList.get(0); +// role.setRoleName("hh"); +// //System.out.println(role.toString());//Role{roleId=235, roleName='null', roleNumber=1, roleType=1, roleAttribute=1} +// +// HashMap map = managementService.updateRole(role); +// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); +// } +// +// /** +// * 添加角色信息 +// */ +// @Test +// public void testInsertRole() { +// List list = new ArrayList<>(); +// list.add(235); +// +// List roleList = projectManagementMapper.getByRoleId(list); +// Role role = roleList.get(0); +// role.setRoleId(null); +// role.setRoleName("hh"); +// +// HashMap map = managementService.insertRole(role); +// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); +// } +// // /** // * 添加项目管理信息 // */ @@ -241,8 +241,8 @@ public class Project_ManagementTest { // pro.setSystemId(6); // pro.setUserId(4); // pro.setFounder(0); -// List points = new ArrayList<>(); -// Judgment_Points judgmentPoints = new Judgment_Points(); +// List points = new ArrayList<>(); +// JudgmentPoints judgmentPoints = new JudgmentPoints(); // judgmentPoints.setJudgmentPointsId(205); // judgmentPoints.setExperimentalRequirements("按要求写出代码并正确运行显示小明考核结果"); // judgmentPoints.setScore(100); @@ -252,56 +252,56 @@ public class Project_ManagementTest { // ProjectManagement pro = projectManagementMapper.getProjectId(302); // pro.setProjectId(null); // pro.setFounder(0); -// List points = projectManagementMapper.queryProjectIds(302); +// List points = projectManagementMapper.queryProjectIds(302); +// List roles = projectManagementMapper.getByRoleProjectId(302); +//// HashMap map = managementService.insertProjectManagement(pro, points, roles); +//// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); +// } +// +// +// /** +// * 根据项目名称查询 +// */ +// @Test +// public void testGetByName() { +// String projectName = "测试2"; +// HashMap map = managementService.getByName(projectName); +// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); +// } +// +// /** +// * 修改项目管理信息 +// */ +// +// @Transactional +// @Test +// public void testUpdateProjectManagement() { +// /*ProjectManagement pro = new ProjectManagement(); +// pro.setProjectId(302); +// pro.setProjectName("简单加法计算"); +// pro.setProjectPermissions(1); +// pro.setExperimentalGoal("本项目将会帮助学生了解简单的加法计算"); +// pro.setCaseDescription("声明两个变量,让其相加,得到其和"); +// pro.setIsstartexperimental(0); +// pro.setExperimentSuggests("使用加号,将声明的变量相加"); +// pro.setIsstartexperimentSuggests(0); +// pro.setState(1); +// pro.setSystemId(6); +// pro.setUserId(4); +// pro.setFounder(0); +// List points = new ArrayList<>(); +// JudgmentPoints judgmentPoints = new JudgmentPoints(); +// judgmentPoints.setJudgmentPointsId(205); +// judgmentPoints.setExperimentalRequirements("按要求写出代码并正确运行显示小明考核结果"); +// judgmentPoints.setScore(100); +// points.add(judgmentPoints); +// List roles = new ArrayList<>(); +// roles.add(433);*/ +// ProjectManagement pro = projectManagementMapper.getProjectId(302); +// pro.setFounder(0); +// List points = projectManagementMapper.queryProjectIds(302); // List roles = projectManagementMapper.getByRoleProjectId(302); -// HashMap map = managementService.insertProjectManagement(pro, points, roles); +// HashMap map = managementService.updateProjectManagement(pro, points, roles); // map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); // } - - - /** - * 根据项目名称查询 - */ - @Test - public void testGetByName() { - String projectName = "测试2"; - HashMap map = managementService.getByName(projectName); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); - } - - /** - * 修改项目管理信息 - */ - - @Transactional - @Test - public void testUpdateProjectManagement() { - /*ProjectManagement pro = new ProjectManagement(); - pro.setProjectId(302); - pro.setProjectName("简单加法计算"); - pro.setProjectPermissions(1); - pro.setExperimentalGoal("本项目将会帮助学生了解简单的加法计算"); - pro.setCaseDescription("声明两个变量,让其相加,得到其和"); - pro.setIsstartexperimental(0); - pro.setExperimentSuggests("使用加号,将声明的变量相加"); - pro.setIsstartexperimentSuggests(0); - pro.setState(1); - pro.setSystemId(6); - pro.setUserId(4); - pro.setFounder(0); - List points = new ArrayList<>(); - Judgment_Points judgmentPoints = new Judgment_Points(); - judgmentPoints.setJudgmentPointsId(205); - judgmentPoints.setExperimentalRequirements("按要求写出代码并正确运行显示小明考核结果"); - judgmentPoints.setScore(100); - points.add(judgmentPoints); - List roles = new ArrayList<>(); - roles.add(433);*/ - ProjectManagement pro = projectManagementMapper.getProjectId(302); - pro.setFounder(0); - List points = projectManagementMapper.queryProjectIds(302); - List roles = projectManagementMapper.getByRoleProjectId(302); - HashMap map = managementService.updateProjectManagement(pro, points, roles); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); - } -} +//}