上传代码

master
zhiyong.ning 4 years ago
parent 5eb8a2bdc2
commit a1f64af94d
  1. 207
      src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java
  2. 112
      src/main/java/com/yipin/liuwanr/entity/JudgmentPoints.java
  3. 4
      src/main/java/com/yipin/liuwanr/entity/JudgmentPointsBinding.java
  4. 7
      src/main/java/com/yipin/liuwanr/entity/ManagementAndPointVo.java
  5. 24
      src/main/java/com/yipin/liuwanr/entity/ScoreIndex.java
  6. 74
      src/main/java/com/yipin/liuwanr/entity/TradingJudgmentPoints.java
  7. 155
      src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java
  8. 11
      src/main/java/com/yipin/liuwanr/mapper/ScoreIndexMapper.java
  9. 448
      src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java
  10. 514
      src/test/java/com/yipin/liuwanr/Project_ManagementTest.java

@ -241,6 +241,50 @@ public class ProjectManagementController {
return resp; 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<String, Object> 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<String, Object> 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, Response queryAllJudgmentPoints(@ApiParam(name = "judgmentPointsName", value = "判分点名称", required = false) @RequestParam(required = false) String judgmentPointsName,
@ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId) { @ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId) {
Response resp = new Response(); Response resp = new Response();
Judgment_Points points = new Judgment_Points(); JudgmentPoints points = new JudgmentPoints();
if (StringUtils.isEmpty(systemId)) { if (StringUtils.isEmpty(systemId)) {
resp.setStatus(300); resp.setStatus(300);
resp.setMessage("systemId cannot be empty"); resp.setMessage("systemId cannot be empty");
@ -397,10 +441,10 @@ public class ProjectManagementController {
*/ */
@ApiOperation(value = "创建项目", notes = "创建项目") @ApiOperation(value = "创建项目", notes = "创建项目")
@PostMapping("/addProjectManagement") @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(); Response resp = new Response();
ProjectManagement pro = vo.getManagement(); ProjectManagement pro = vo.getManagement();
List<Judgment_Points> points = vo.getPooints(); List<JudgmentPoints> points = vo.getPooints();
List<Integer> roles = vo.getRoleId(); List<Integer> roles = vo.getRoleId();
if (StringUtils.isEmpty(pro)) { if (StringUtils.isEmpty(pro)) {
resp.setStatus(300); resp.setStatus(300);
@ -433,8 +477,96 @@ public class ProjectManagementController {
return resp; 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<JudgmentPoints> points = vo.getPooints();
List<Integer> 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<String, Object> 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<JudgmentPoints> points = vo.getPooints();
List<Integer> 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<String, Object> 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 * @param projectId 项目id
* @return * @return
@ -455,6 +587,28 @@ public class ProjectManagementController {
return resp; 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<String, Object> 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 updateProjectManagement(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointVo vo) {
Response resp = new Response(); Response resp = new Response();
ProjectManagement pro = vo.getManagement(); ProjectManagement pro = vo.getManagement();
List<Judgment_Points> points = vo.getPooints(); List<JudgmentPoints> points = vo.getPooints();
List<Integer> roles = vo.getRoleId(); List<Integer> roles = vo.getRoleId();
if (StringUtils.isEmpty(pro)) { if (StringUtils.isEmpty(pro)) {
resp.setStatus(300); 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<JudgmentPoints> points = vo.getPooints();
List<Integer> 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<String, Object> 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;
}
/** /**
* 川大查询项目管理 * 川大查询项目管理
* <p> * <p>

@ -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 +
'}';
}
}

@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
* }], * }],
*/ */
@ApiModel(value = "Judgment_Points对象", description = "判分点对象Judgment_Points") @ApiModel(value = "Judgment_Points对象", description = "判分点对象Judgment_Points")
public class Judgment_Points { public class JudgmentPointsBinding {
@ApiModelProperty(value = "判分点主键Id", name = "judgmentPointsId", example = "184", required = true) @ApiModelProperty(value = "判分点主键Id", name = "judgmentPointsId", example = "184", required = true)
private Integer judgmentPointsId;// 判分点主键Id private Integer judgmentPointsId;// 判分点主键Id
@ -108,7 +108,7 @@ public class Judgment_Points {
@Override @Override
public String toString() { public String toString() {
return "Judgment_Points{" + return "JudgmentPoints{" +
"judgmentPointsId=" + judgmentPointsId + "judgmentPointsId=" + judgmentPointsId +
", judgmentPointsName='" + judgmentPointsName + '\'' + ", judgmentPointsName='" + judgmentPointsName + '\'' +
", experimentalRequirements='" + experimentalRequirements + '\'' + ", experimentalRequirements='" + experimentalRequirements + '\'' +

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
@ApiModel(value = "ManagementAndPointVo对象", description = "添加项目管理对象ManagementAndPointVo") @ApiModel(value = "ManagementAndPointVo对象", description = "添加项目管理对象ManagementAndPointVo")
public class ManagementAndPointVo { public class ManagementAndPointVo {
@ApiModelProperty(value = "项目管理实体类", name = "management", required = true) @ApiModelProperty(value = "项目管理实体类", name = "management", required = true)
@ -12,7 +13,7 @@ public class ManagementAndPointVo {
//@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", 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) @ApiModelProperty(value = "判分点信息列表,key:判分点主键 value:分数", name = "pooints", required = true)
private List<Judgment_Points> pooints;//判分点信息 private List<JudgmentPoints> pooints;//判分点信息
@ApiModelProperty(value = "角色id列表", name = "roleId", example = "[403]", required = true) @ApiModelProperty(value = "角色id列表", name = "roleId", example = "[403]", required = true)
private List<Integer> roleId;//存储角色id private List<Integer> roleId;//存储角色id
@ -25,11 +26,11 @@ public class ManagementAndPointVo {
this.management = management; this.management = management;
} }
public List<Judgment_Points> getPooints() { public List<JudgmentPoints> getPooints() {
return pooints; return pooints;
} }
public void setPooints(List<Judgment_Points> pooints) { public void setPooints(List<JudgmentPoints> pooints) {
this.pooints = pooints; this.pooints = pooints;
} }

@ -12,15 +12,24 @@ public class ScoreIndex {
private Integer score;//分数 private Integer score;//分数
private Integer judgmentPointsId;//判分点id private Integer judgmentPointsId;//判分点id
private Integer projectId;//项目id private Integer projectId;//项目id
private Integer isdel;//是否删除 private Integer userId;//绑定用户id
private Integer userId; 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(); super();
this.score = score; this.score = score;
this.judgmentPointsId = judgmentPointsId; this.judgmentPointsId = judgmentPointsId;
this.projectId = projectId; this.projectId = projectId;
this.userId = userId; this.userId = userId;
this.systemId = systemId;
}
public Integer getSystemId() {
return systemId;
}
public void setSystemId(Integer systemId) {
this.systemId = systemId;
} }
public Integer getUserId() { public Integer getUserId() {
@ -43,15 +52,6 @@ public class ScoreIndex {
this.projectId = projectId; this.projectId = projectId;
} }
public Integer getIsdel() {
return isdel;
}
public void setIsdel(Integer isdel) {
this.isdel = isdel;
}
public Integer getScoreindexId() { public Integer getScoreindexId() {
return scoreindexId; return scoreindexId;
} }

@ -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;
}
}

@ -2,7 +2,7 @@ package com.yipin.liuwanr.mapper;
import java.util.List; 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.Delete;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options; 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.Select;
import org.apache.ibatis.annotations.Update; 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 * @param projectName
* @return * @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); Integer getByprojectName(String projectName);
/** /**
@ -46,20 +43,14 @@ public interface ProjectManagementMapper {
* " ORDER BY creationTime desc", * " ORDER BY creationTime desc",
*/ */
@Select({"<script>", @Select({"<script>",
"select * from hr_project_management where isdel = 0", // "select projectId,projectName,projectPermissions,founder,creationTime,state,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0",
" <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>", "select * from hr_project_management where (roleId NOT LIKE '%3%' AND isdel = 0)",
" <if test='founder!=null'> and founder=#{founder}</if>",//教师选择创建人为系统 " <if test='userId!=null'>OR ( isdel = 0 AND userId = #{userId} )</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
" <if test='founder==null'> and founder in (1,2)</if>",//教师选择创建人为系统
" <if test='state!=null'> and state=#{state}</if>",
" <if test='systemId!=null'> and systemId=#{systemId}</if>",
" <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>" +
"<if test='founder==null or founder==3'> or ( isdel = 0 AND userId = #{userId} " +
" <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>", " <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>",
" <if test='founder!=null'> and founder=#{founder}</if>",//教师选择创建人为系统 " <if test='founder!=null'> and founder=#{founder}</if>",//教师选择创建人为系统
" <if test='state!=null'> and state=#{state}</if>", " <if test='state!=null'> and state=#{state}</if>",
" <if test='systemId!=null'> and systemId=#{systemId}</if>", " <if test='systemId!=null'> and systemId=#{systemId}</if>",
" <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>", " <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>",
") </if>" +
" ORDER BY creationTime desc", " ORDER BY creationTime desc",
"</script>"}) "</script>"})
List<ProjectManagement> queryManagements(ProjectManagement management); List<ProjectManagement> queryManagements(ProjectManagement management);
@ -82,19 +73,11 @@ public interface ProjectManagementMapper {
@Select({"<script>", @Select({"<script>",
"select * from hr_project_management where (roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0)", "select * from hr_project_management where (roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0)",
" <if test='userId!=null'>OR ( isdel = 0 AND projectPermissions != 0 AND userId = #{userId} )</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
" <if test='systemId!=null'> and systemId=#{systemId}</if>", " <if test='systemId!=null'> and systemId=#{systemId}</if>",
" ORDER BY creationTime desc", " ORDER BY creationTime desc",
"</script>"}) "</script>"})
List<ProjectManagement> queryManagementsExportTest(ProjectManagement management); List<ProjectManagement> queryManagementsExportTest(ProjectManagement management);
@Select({"<script>",
"select * from hr_project_management where isdel = 0 AND projectPermissions != 0 AND state = 1",
" <if test='systemId!=null'> and systemId=#{systemId}</if>" +
"<if test ='userId!=null'> or( isdel = 0 AND projectPermissions != 0 AND userId = #{userId} AND state = 1" +
"<if test='systemId!=null'> and systemId=#{systemId}</if>" +
")</if>",
" ORDER BY creationTime desc",
"</script>"})
List<ProjectManagement> queryManagementsExport(ProjectManagement management);
/** /**
@ -103,7 +86,7 @@ public interface ProjectManagementMapper {
* @param projectId * @param projectId
* @return * @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); ProjectManagement getProjectId(Integer projectId);
/** /**
@ -126,16 +109,16 @@ public interface ProjectManagementMapper {
"where hpm.projectId=#{projectId} and hpm.projectId = tet.project_id" "where hpm.projectId=#{projectId} and hpm.projectId = tet.project_id"
+ "</script>") + "</script>")
void deleteProjectManagement(Integer projectId); void deleteProjectManagement(Integer projectId);
// 202.10.29 标准版
// /** /**
// * 批量删除 * 批量删除分数表
// * *
// * @param projectId * @param projectId
// */ */
// @Update("<script>" @Update("<script>"
// + "update hr_project_management set isdel=1 where projectId=#{projectId}" + "delete from hr_score_index where projectId=#{projectId}"
// + "</script>") + "</script>")
// void deleteProjectManagement(Integer projectId); int delete(Integer projectId);
/** /**
@ -161,18 +144,13 @@ public interface ProjectManagementMapper {
* 点击编辑或者创建项目管理页面的保存按钮后, * 点击编辑或者创建项目管理页面的保存按钮后,
* 修改角色表中的对应数据的项目id * 修改角色表中的对应数据的项目id
* *
* @param ids * @param roleId
* @param projectId * @param projectId
*/ */
// @Update("<script>" + @Update("<script>" +
// "<foreach collection = 'ids' item ='id' open='' close='' separator=';'>" "update hr_role set projectId=#{projectId} where roleId=#{roleId}"
// + "update hr_role set projectId=#{projectId} where roleId=#{ids}</foreach>" + "</script>")
// + "</script>") int updateRoleProjectId(Integer roleId, @Param("projectId") Integer projectId);
@Update({"<script>" +
"update hr_role set projectId=#{projectId} where roleId in" +
"<foreach collection = 'ids' item ='id' open='(' close=')' separator=','>#{id}</foreach>" +
"</script>"})
void updateRoleProjectId(@Param("ids") List<Integer> ids, @Param("projectId") Integer projectId);
@Delete("delete from hr_role where projectId=#{projectId}") @Delete("delete from hr_role where projectId=#{projectId}")
@ -192,7 +170,7 @@ public interface ProjectManagementMapper {
/** /**
* 查询单个项目判分点信息根据项目id * 查询职站单个项目判分点信息根据项目id
* *
* @param projectId 项目id * @param projectId 项目id
* @return * @return
@ -200,7 +178,31 @@ public interface ProjectManagementMapper {
@Select({"<script>", @Select({"<script>",
"select * from hr_judgment_points where find_in_set(#{projectId},projectId)", "select * from hr_judgment_points where find_in_set(#{projectId},projectId)",
"</script>"}) "</script>"})
List<Judgment_Points> getJudgmentPoints(@Param("projectId") Integer projectId); List<JudgmentPoints> getZZJudgmentPoints(@Param("projectId") Integer projectId);
/**
* 查询单个项目判分点信息根据项目id
*
* @param projectId 项目id
* @return
*/
@Select({"<script>",
"select id,judgment_points_name as judgmentPointsName,experimental_requirements as experimentalRequirements,project_id as projectId,system_id as systemId,creation_time as creationTime,user_id as userId " +
"from hr_trading_judgment_points where find_in_set(#{projectId},project_id)",
"</script>"})
List<TradingJudgmentPoints> getJudgmentPoints(@Param("projectId") Integer projectId);
/**
* 查询单个项目判分点信息根据项目id
*
* @param judgmentPointsId 判分点id
* @return
*/
@Select({"<script>",
"select score,judgmentPointsId from hr_score_index where judgmentPointsId=#{judgmentPointsId} and systemId = #{systemId} and projectId = #{projectId}",
"</script>"})
List<ScoreIndex> 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", "select judgmentPointsId,judgmentPointsName from hr_judgment_points where isdel=0 and systemId=#{systemId} and isopen=0",
" <if test='judgmentPointsName!=null'> and judgmentPointsName like concat('%','${judgmentPointsName}','%')</if>", " <if test='judgmentPointsName!=null'> and judgmentPointsName like concat('%','${judgmentPointsName}','%')</if>",
"</script>"}) "</script>"})
List<Judgment_Points> queryAllJudgmentPoints(Judgment_Points points); List<JudgmentPoints> queryAllJudgmentPoints(JudgmentPoints points);
/** /**
@ -234,10 +236,10 @@ public interface ProjectManagementMapper {
* @return * @return
*/ */
@Select({"<script>", @Select({"<script>",
"select judgmentPointsId,judgmentPointsName,experimentalRequirements,userId from hr_judgment_points where isdel=0 and judgmentPointsId in", "select judgmentPointsId,judgmentPointsName,experimentalRequirements from hr_judgment_points where isdel=0 and judgmentPointsId in",
"<foreach collection='point' item='po' open='(' separator=',' close=')'>" + "#{po} " + "</foreach> ", "<foreach collection='point' item='po' open='(' separator=',' close=')'>" + "#{po} " + "</foreach> ",
"</script>"}) "</script>"})
List<Judgment_Points> getByjudgmentPointsIds(@Param("point") List<Integer> point); List<JudgmentPoints> getByjudgmentPointsIds(@Param("point") List<Integer> point);
/** /**
* 点击具体某个项目信息的编辑按钮, * 点击具体某个项目信息的编辑按钮,
@ -246,12 +248,15 @@ public interface ProjectManagementMapper {
* @param projectId * @param projectId
* @return * @return
*/ */
@Select("select judgmentPointsId,judgmentPointsName,experimentalRequirements ,userId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") @Select("select judgmentPointsId,judgmentPointsName,experimentalRequirements from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0")
List<Judgment_Points> getByProjectId(Integer projectId); List<JudgmentPoints> 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<JudgmentPoints> queryJudgmentPoints(Integer projectId);
@Select("select judgmentPointsId,projectId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") @Select("select judgmentPointsId,projectId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0")
List<Judgment_Points> queryProjectIds(Integer projectId); List<JudgmentPoints> queryProjectIds(Integer projectId);
/** /**
* 取出判分点中的项目管理的id * 取出判分点中的项目管理的id
@ -260,7 +265,25 @@ public interface ProjectManagementMapper {
* @return * @return
*/ */
@Select("select projectId,experimentalRequirements from hr_judgment_points where judgmentPointsId=#{judgmentPointsId}") @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 {
"</script>"}) "</script>"})
void updateProject(String projectId, String experimentalRequirements, Integer judgmentPointsId); void updateProject(String projectId, String experimentalRequirements, Integer judgmentPointsId);
/**
* 修改判分点绑定的项目
* @param projectId
* @param judgmentPointsId
*/
@Update({"<script>",
"update hr_trading_judgment_points set project_id=#{projectId}",
" where id=#{judgmentPointsId}",
"</script>"})
void updateTradingJudgmentPoints(String projectId, Integer judgmentPointsId);
/** /**
* 添加项目管理信息 * 添加项目管理信息
* *
* @param management * @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)" @Insert("INSERT INTO hr_project_management(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})") + " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},#{knowledgePoints},#{experimentIntroduction},#{knowledgePointsIsEnable},#{experimentIntroductionIsEnable})")
@Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId") @Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId")
void insertProjectManagement(ProjectManagement management); void insertProjectManagement(ProjectManagement management);
@ -333,16 +367,6 @@ public interface ProjectManagementMapper {
@Select("SELECT accountRole FROM user WHERE userId=#{userId}") @Select("SELECT accountRole FROM user WHERE userId=#{userId}")
Integer queryRoleId(Integer 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}" "where projectId=#{projectId}"
+ "</script>") + "</script>")
void daleteManegement(Integer id); void daleteManegement(Integer id);
} }

@ -18,8 +18,8 @@ public interface ScoreIndexMapper {
* 给判分指标添加分数 * 给判分指标添加分数
* @param scoreIndex * @param scoreIndex
*/ */
@Insert("insert into hr_score_index (score,judgmentPointsId,projectId,userId,isdel) " @Insert("insert into hr_score_index (score,judgmentPointsId,projectId,userId,systemId) "
+ " values (#{score},#{judgmentPointsId},#{projectId},#{userId},0)") + " values (#{score},#{judgmentPointsId},#{projectId},#{userId},#{systemId})")
@Options(useGeneratedKeys = true,keyProperty = "scoreindexId",keyColumn = "scoreindexId") @Options(useGeneratedKeys = true,keyProperty = "scoreindexId",keyColumn = "scoreindexId")
void addScoreIndex(ScoreIndex scoreIndex); void addScoreIndex(ScoreIndex scoreIndex);
@ -46,7 +46,7 @@ public interface ScoreIndexMapper {
* 根据判分点id和项目id查询具体分数 * 根据判分点id和项目id查询具体分数
* @return * @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); Integer getbyJudgmentPointsIdScore(@Param("judgmentPointsId")Integer judgmentPointsId,@Param("projectId") Integer projectId,@Param("userId") Integer userId);
/** /**
@ -56,9 +56,8 @@ public interface ScoreIndexMapper {
* @return * @return
*/ */
@Select({"<script>", @Select({"<script>",
"select score,judgmentPointsId from hr_score_index where isdel=0 and userId=#{userId} and projectId=#{projectId} and judgmentPointsId in", "select score,judgmentPointsId from hr_score_index where userId=#{userId} and projectId=#{projectId} and judgmentPointsId in",
"<foreach collection='ids' item='id' open='(' separator=',' close=')'>" + "#{id} " + "</foreach> " + "<foreach collection='ids' item='id' open='(' separator=',' close=')'>" + "#{id} " + "</foreach> ",
"GROUP BY scoreindexId",
"</script>"}) "</script>"})
List<ScoreIndex> queryScore(@Param("ids")List<Integer> judgmentPointsId,@Param("projectId")Integer projectId,@Param("userId") Integer userId); List<ScoreIndex> queryScore(@Param("ids")List<Integer> judgmentPointsId,@Param("projectId")Integer projectId,@Param("userId") Integer userId);
} }

@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.yipin.liuwanr.helper.UserUtil; import com.yipin.liuwanr.helper.UserUtil;
import com.yipin.liuwanr.mapper.ProjectManagementMapper; import com.yipin.liuwanr.mapper.ProjectManagementMapper;
import com.yipin.liuwanr.mapper.ScoreIndexMapper; import com.yipin.liuwanr.mapper.ScoreIndexMapper;
import org.springframework.util.LinkedMultiValueMap;
@Service @Service
public class ProjectManagementService { public class ProjectManagementService {
@ -77,18 +78,23 @@ public class ProjectManagementService {
public HashMap<String, Object> queryManagements(ProjectManagement vo, Integer pageNo, Integer pageSize) { public HashMap<String, Object> queryManagements(ProjectManagement vo, Integer pageNo, Integer pageSize) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { 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); PageHelper.startPage(pageNo, pageSize);
//条件查询 //条件查询
List<ProjectManagement> list = mapper.queryManagementsExport(vo); List<ProjectManagement> list = mapper.queryManagementsExportTest(vo);
// //获取用户的角色信息
// String roleId = mapper.queryRoleIds(vo.getUserId());
// if (null != roleId) {
// if (roleId.contains("3")) {
// vo.setUserId(null);
// List<ProjectManagement> projectManagements = mapper.queryManagementsExport(vo);
// list.addAll(projectManagements);
// }
// }
PageInfo<ProjectManagement> info = new PageInfo<ProjectManagement>(list); PageInfo<ProjectManagement> info = new PageInfo<ProjectManagement>(list);
resp.put("retvalue", new PageResult(info.getTotal(), list)); resp.put("retvalue", new PageResult(info.getTotal(), list));
resp.put("retcode", 200); resp.put("retcode", 200);
@ -110,25 +116,21 @@ public class ProjectManagementService {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
//获取用户的角色信息 //获取用户的角色信息
// String roleId = mapper.queryRoleIds(vo.getUserId()); Integer roleId = mapper.queryRoleId(vo.getUserId());
// if (null != roleId) { if (null != roleId) {
// //角色不对(学生没有权限) //角色不对(学生没有权限)
// if (roleId.contains("4")) { if (roleId == 4) {
// resp.put("retcode", 300); resp.put("retcode", 300);
// resp.put("retvalue", "抱歉,您的权限不能访问该地址!"); resp.put("retvalue", "抱歉,您的权限不能访问该地址!");
// return resp; return resp;
// } }
// //角色等于管理员或者超级管理员 //角色等于管理员或者超级管理员
// else if (roleId.contains("1")) { else if (roleId == 1 ) {
// vo.setUserId(null); vo.setUserId(null);
// } }
// } }
//条件查询 //条件查询
List<ProjectManagement> list = mapper.queryManagements(vo); List<ProjectManagement> list = mapper.queryManagements(vo);
// if (vo.getFounder()==null||vo.getFounder()==3){
// List<ProjectManagement> list2 = mapper.queryUserManagements(vo);
// list.addAll(list2);
// }
resp.put("retvalue",list); resp.put("retvalue",list);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
@ -153,10 +155,10 @@ public class ProjectManagementService {
try { try {
for (Integer po : projectId) { for (Integer po : projectId) {
//判分点 //判分点
List<Judgment_Points> points = mapper.queryProjectIds(po); List<JudgmentPoints> points = mapper.queryProjectIds(po);
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
//判分点 //判分点
Judgment_Points pos = points.get(i); JudgmentPoints pos = points.get(i);
Integer pointId = pos.getJudgmentPointsId();//判分点id Integer pointId = pos.getJudgmentPointsId();//判分点id
String projectIds = pos.getProjectId();//项目id String projectIds = pos.getProjectId();//项目id
@ -216,7 +218,7 @@ public class ProjectManagementService {
if (null != management) { if (null != management) {
// 判分点信息 // 判分点信息
List<Judgment_Points> points = mapper.getByProjectId(projectId); List<JudgmentPoints> points = mapper.getByProjectId(projectId);
//判分点不为空 //判分点不为空
if (null != points && !points.isEmpty()) { if (null != points && !points.isEmpty()) {
//存储判分点id //存储判分点id
@ -228,7 +230,7 @@ public class ProjectManagementService {
if (scores.size() > 0 && !scores.isEmpty()) { if (scores.size() > 0 && !scores.isEmpty()) {
//为有分数的赋值 //为有分数的赋值
for (int i = 0; i < points.size(); i++) { 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++) { for (int j = 0; j < scores.size(); j++) {
ScoreIndex score = scores.get(j); ScoreIndex score = scores.get(j);
if (point.getJudgmentPointsId().equals(score.getJudgmentPointsId())) { if (point.getJudgmentPointsId().equals(score.getJudgmentPointsId())) {
@ -242,14 +244,14 @@ public class ProjectManagementService {
//为没值的赋值 //为没值的赋值
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
if (!indexs.contains(i)) { if (!indexs.contains(i)) {
Judgment_Points points3 = points.get(i); JudgmentPoints points3 = points.get(i);
points3.setScore(0); points3.setScore(0);
points.set(i, points3); points.set(i, points3);
} }
} }
} else { } else {
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
Judgment_Points point = points.get(i); JudgmentPoints point = points.get(i);
//给分数赋值 //给分数赋值
point.setScore(0); point.setScore(0);
//修改该判分点 //修改该判分点
@ -276,12 +278,70 @@ public class ProjectManagementService {
} }
/**
* 根据项目管理id查询对应交易类判分点信息
*
* @param projectId
* @return
*/
public HashMap<String, Object> getTrdingJudgmentPoints(Integer projectId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
List<Object> obj = new ArrayList<Object>();
try {
// 项目信息
ProjectManagement management = mapper.getProjectId(projectId);
if (null != management) {
// 判分点信息
List<JudgmentPoints> points = mapper.queryJudgmentPoints(projectId);
// 角色信息
List<Role> 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<String, Object> getProject(Integer projectId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
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 * @return
*/ */
public HashMap<String, Object> queryAllJudgmentPoints(Judgment_Points points) { public HashMap<String, Object> queryAllJudgmentPoints(JudgmentPoints points) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", mapper.queryAllJudgmentPoints(points)); resp.put("retvalue", mapper.queryAllJudgmentPoints(points));
@ -305,13 +365,13 @@ public class ProjectManagementService {
public HashMap<String, Object> getByjudgmentPointsId(List<Integer> judgmentPointsId, Integer projectId, Integer userId) { public HashMap<String, Object> getByjudgmentPointsId(List<Integer> judgmentPointsId, Integer projectId, Integer userId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
List<Judgment_Points> points = mapper.getByjudgmentPointsIds(judgmentPointsId); List<JudgmentPoints> points = mapper.getByjudgmentPointsIds(judgmentPointsId);
List<ScoreIndex> scores = indexMapper.queryScore(judgmentPointsId, projectId, userId); List<ScoreIndex> scores = indexMapper.queryScore(judgmentPointsId, projectId, userId);
List<Integer> indexs = new ArrayList<Integer>(); List<Integer> indexs = new ArrayList<Integer>();
//为新增项目时勾选判分点赋值 //为新增项目时勾选判分点赋值
if (scores.size() <= 0) { if (scores.size() <= 0) {
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
Judgment_Points points2 = points.get(i); JudgmentPoints points2 = points.get(i);
points2.setScore(0); points2.setScore(0);
points.set(i, points2); points.set(i, points2);
} }
@ -320,7 +380,7 @@ public class ProjectManagementService {
else { else {
//为有分数的赋值 //为有分数的赋值
for (int i = 0; i < points.size(); i++) { 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++) { for (int j = 0; j < scores.size(); j++) {
ScoreIndex score = scores.get(j); ScoreIndex score = scores.get(j);
if (point.getJudgmentPointsId().equals(score.getJudgmentPointsId())) { if (point.getJudgmentPointsId().equals(score.getJudgmentPointsId())) {
@ -334,7 +394,7 @@ public class ProjectManagementService {
//为没值的赋值 //为没值的赋值
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
if (!indexs.contains(i)) { if (!indexs.contains(i)) {
Judgment_Points points3 = points.get(i); JudgmentPoints points3 = points.get(i);
points3.setScore(0); points3.setScore(0);
points.set(i, points3); points.set(i, points3);
} }
@ -373,7 +433,6 @@ public class ProjectManagementService {
return resp; return resp;
} }
/** /**
* 查询单个项目判分点信息根据项目id * 查询单个项目判分点信息根据项目id
* *
@ -382,8 +441,60 @@ public class ProjectManagementService {
*/ */
public HashMap<String, Object> getJudgmentPoints(Integer projectId) { public HashMap<String, Object> getJudgmentPoints(Integer projectId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
HashMap<String, Object> score = new HashMap<String, Object>();
List<ScoreIndex> scoreIndexList = null;
try {
List<TradingJudgmentPoints> judgmentPointsList = mapper.getJudgmentPoints(projectId);
Integer size = judgmentPointsList.size();
for (int i = 0; i<size; i++){
TradingJudgmentPoints tradingJudgmentPoints = judgmentPointsList.get(i);
Integer judgmentPointsId = tradingJudgmentPoints.getId();
Integer systemId = tradingJudgmentPoints.getSystemId();
scoreIndexList = mapper.getScore(judgmentPointsId,systemId,projectId);
score.put("scoreIndexList"+i,scoreIndexList);
}
List<Role> 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<String, Object> getZZJudgmentPoints(Integer projectId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
HashMap<String, Object> score = new HashMap<String, Object>();
List<ScoreIndex> scoreIndexList = null;
try { try {
resp.put("retvalue", mapper.getJudgmentPoints(projectId)); List<JudgmentPoints> judgmentPointsList = mapper.getZZJudgmentPoints(projectId);
Integer size = judgmentPointsList.size();
for (int i = 0; i<size; i++){
JudgmentPoints judgmentPoints = judgmentPointsList.get(i);
Integer judgmentPointsId = judgmentPoints.getJudgmentPointsId();
Integer systemId = judgmentPoints.getSystemId();
scoreIndexList = mapper.getScore(judgmentPointsId,systemId,projectId);
score.put("scoreIndexList"+i,scoreIndexList);
}
List<Role> roleList = mapper.queryProjectId(projectId);
obj.put("roleList",roleList);
obj.put("judgmentPointsList", judgmentPointsList);
obj.put("scoreIndexList", scoreIndexList);
resp.put("retvalue", obj);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -465,17 +576,83 @@ public class ProjectManagementService {
* @return * @return
*/ */
@Transactional @Transactional
public HashMap<String, Object> insertProjectManagement(ProjectManagement pro, List<Judgment_Points> points, List<Integer> roles) { public HashMap<String, Object> newAddProjectManagement(ProjectManagement pro, List<JudgmentPoints> points, List<Integer> roles) {
HashMap<String, Object> resp = new HashMap<String, Object>();
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<String> 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<size; i++){
Integer roleId = roles.get(i);
mapper.updateRoleProjectId(roleId, projectId);
}
}
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Add Failed");
System.out.println(e.getMessage());
throw new RuntimeException();
}
return resp;
}
/**
* 添加项目管理信息
*
* @return
*/
@Transactional
public HashMap<String, Object> insertProjectManagement(ProjectManagement pro, List<JudgmentPoints> points, List<Integer> roles) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { 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); mapper.insertProjectManagement(pro);
// 取出添加的项目信息的id // 取出添加的项目信息的id
@ -487,7 +664,7 @@ public class ProjectManagementService {
//判分点id //判分点id
Integer pointId = points.get(i).getJudgmentPointsId(); Integer pointId = points.get(i).getJudgmentPointsId();
//根据该判分点得到数据库存储的对应数据 //根据该判分点得到数据库存储的对应数据
Judgment_Points point = mapper.getByjudgmentPointsId(pointId); JudgmentPoints point = mapper.getByjudgmentPointsId(pointId);
//取出绑定的项目id //取出绑定的项目id
String projectIds = point.getProjectId(); 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); indexMapper.addScoreIndex(scoreIndex);
} }
// 修改角色信息中的项目管理id // 修改角色信息中的项目管理id
if (roles != null && roles.size() > 0) { if (roles != null && roles.size() > 0) {
mapper.updateRoleProjectId(roles, projectId); Integer size = roles.size();
for (int i = 0; i<size; i++){
Integer roleId = roles.get(i);
mapper.updateRoleProjectId(roleId, projectId);
}
} }
resp.put("retcode", 200); resp.put("retcode", 200);
@ -543,7 +724,7 @@ public class ProjectManagementService {
try{ try{
Integer count = mapper.getByprojectName(projectName); Integer count = mapper.getByprojectName(projectName);
if(count>=1){ if(count>=1){
resp.put("retcode", 201); resp.put("retcode", 300);
resp.put("retvalue", "该项目名称已存在"); resp.put("retvalue", "该项目名称已存在");
}else{ }else{
resp.put("retcode", 200); resp.put("retcode", 200);
@ -563,7 +744,7 @@ public class ProjectManagementService {
* @return * @return
*/ */
@Transactional @Transactional
public HashMap<String, Object> updateProjectManagement(ProjectManagement pro, List<Judgment_Points> points, public HashMap<String, Object> updateProjectManagement(ProjectManagement pro, List<JudgmentPoints> points,
List<Integer> roles) { List<Integer> roles) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
@ -587,9 +768,10 @@ public class ProjectManagementService {
String experimentalRequirements1 = points.get(i).getExperimentalRequirements(); String experimentalRequirements1 = points.get(i).getExperimentalRequirements();
//前端传来的分数 //前端传来的分数
Integer score1 = points.get(i).getScore(); 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 projectIds = point.getProjectId();
String experimentalRequirements2 = point.getExperimentalRequirements(); String experimentalRequirements2 = point.getExperimentalRequirements();
@ -599,11 +781,11 @@ public class ProjectManagementService {
Integer score2 = indexMapper.getbyJudgmentPointsIdScore(pointId, project, userId); Integer score2 = indexMapper.getbyJudgmentPointsIdScore(pointId, project, userId);
// 如果分数不一致,则修改分数表中的分数 // 如果分数不一致,则修改分数表中的分数
if (score2 != null && score1 != score2) { 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) { 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)) { if (!experimentalRequirements2.equals(experimentalRequirements1)) {
@ -634,7 +816,7 @@ public class ProjectManagementService {
mapper.updateProject(new String(buff), experimentalRequirements1, pointId); 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); judgments.remove(pointId);
} }
@ -643,7 +825,7 @@ public class ProjectManagementService {
for (int i = 0; i < judgments.size(); i++) { for (int i = 0; i < judgments.size(); i++) {
Integer judgmentPointsId = judgments.get(i); Integer judgmentPointsId = judgments.get(i);
Judgment_Points point = mapper.getByjudgmentPointsId(judgmentPointsId); JudgmentPoints point = mapper.getByjudgmentPointsId(judgmentPointsId);
String projectIds = point.getProjectId(); String projectIds = point.getProjectId();
// 删除分数表中对应的判分点id+项目id数据 // 删除分数表中对应的判分点id+项目id数据
indexMapper.removeScore(judgmentPointsId, project, userId); indexMapper.removeScore(judgmentPointsId, project, userId);
@ -671,9 +853,151 @@ public class ProjectManagementService {
} }
} }
if (roleid.size() > 0 && !roleid.isEmpty()) { if (roles != null && roles.size() > 0) {
// 修改对应角色的项目id Integer size = roles.size();
mapper.updateRoleProjectId(roleid, project); for (int i = 0; i<size; i++){
Integer roleId = roles.get(i);
mapper.updateRoleProjectId(roleId, project);
}
}
//修改项目信息
mapper.updateProjectManagement(pro);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Update Failed");
throw new RuntimeException();
}
return resp;
}
/**
* 新修改修改项目管理信息
*
* @return
*/
@Transactional
public HashMap<String, Object> newUpdateProjectManagement(ProjectManagement pro, List<JudgmentPoints> points,
List<Integer> roles) {
HashMap<String, Object> resp = new HashMap<String, Object>();
//项目id
Integer project = pro.getProjectId();
// int del = mapper.delete(project);
//用户id
Integer userId = pro.getUserId();
try {
//删除项目原本绑定的判分点
int del = mapper.delete(project);
// 取出该项目对应的判分点id
List<Integer> judgments = mapper.getByPointProjectId(project);
// 取出该项目对应的角色id
List<Integer> 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<String> 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);
}
// 从判分点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<String> str3 = Arrays.asList(projectIds.split(","));
if (str3.contains(project.toString())) {
List<String> arrayList = new ArrayList<String>(str3);
arrayList.remove(project.toString());
// 删除字符中项目id
projectIds = StringUtils.strip(arrayList.toString(), "[]").replace(" ", "");
// 修改判分点中的项目id
mapper.updateProject(projectIds, null, judgments.get(i));
}
}
// 用来存储需要修改的角色id
List<Integer> roleid = new ArrayList<Integer>();
// 遍历前端传来的新的角色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<size; i++){
Integer roleId = roles.get(i);
mapper.updateRoleProjectId(roleId, project);
}
} }
//修改项目信息 //修改项目信息

@ -1,228 +1,228 @@
package com.yipin.liuwanr; //package com.yipin.liuwanr;
//
import com.yipin.liuwanr.entity.*; //import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.mapper.ProjectManagementMapper; //import com.yipin.liuwanr.mapper.ProjectManagementMapper;
import com.yipin.liuwanr.service.ProjectManagementService; //import com.yipin.liuwanr.service.ProjectManagementService;
import org.junit.jupiter.api.Test; //import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; //import org.springframework.boot.test.context.SpringBootTest;
//
import org.springframework.transaction.annotation.Transactional; //import org.springframework.transaction.annotation.Transactional;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.HashMap; //import java.util.HashMap;
import java.util.List; //import java.util.List;
//
@SpringBootTest //@SpringBootTest
public class Project_ManagementTest { //public class Project_ManagementTest {
//
@Autowired // @Autowired
private ProjectManagementService managementService; // private ProjectManagementService managementService;
//
@Autowired // @Autowired
private ProjectManagementMapper projectManagementMapper; // private ProjectManagementMapper projectManagementMapper;
//
/** // /**
* 查询用户角色信息 // * 查询用户角色信息
*/ // */
@Test
public void testQueryRole() {
Integer userid = 455;
HashMap<String, Object> map = managementService.queryRole(userid);
map.forEach((key, value) -> {
System.out.println("key = " + key + " ===> value = " + value.toString());
});
}
/**
* 分页查询+条件查询
*/
// @Test // @Test
// public void testQueryAllManagements() { // public void testQueryRole() {
// Integer userid = 455;
// //
// Integer projectPermissions = null; // HashMap<String, Object> map = managementService.queryRole(userid);
// Integer founder = null;
// Integer state = null;
// String projectName = null;
// Integer systemId = 1;
// Integer userId = 4;
// //
// ProjectManagement vo = new ProjectManagement(); // map.forEach((key, value) -> {
// if (null != projectPermissions) { // System.out.println("key = " + key + " ===> value = " + value.toString());
// vo.setProjectPermissions(projectPermissions); // });
// }
// if (null != founder) {
// vo.setFounder(founder);
// } // }
// if (null != state) { //
// vo.setState(state); // /**
// * 分页查询+条件查询
// */
//// @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<String, Object> map = managementService.queryAllManagements(vo);
////// HashMap<String, Object> 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<ProjectManagement> rows = (List<ProjectManagement>) 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<Integer> point = new ArrayList<>();
// point.add(1);
// HashMap<String, Object> map = managementService.deleteProjectManagement(point);
// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
// } // }
// if (null != systemId) { //
// vo.setSystemId(systemId); // /**
// * 根据项目管理id查询对应信息
// */
// @Test
// public void testGetProjectId() {
// Integer projectId = 299;
// HashMap<String, Object> map = managementService.getProjectId(projectId);
// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
// } // }
// if (null != projectName && projectName != "") { //
// vo.setProjectName(projectName); // /**
// * 添加判分点页面的判分点信息展示
// */
// @Test
// public void testQueryAllJudgmentPoints() {
// JudgmentPoints points = new JudgmentPoints();
// points.setSystemId(1);
// points.setJudgmentPointsName("");
// HashMap<String, Object> map = managementService.queryAllJudgmentPoints(points);
// Integer retcode = (Integer) map.get("retcode");
// System.out.println(retcode);
// if (retcode == 200) {
// List<JudgmentPoints> list = (List<JudgmentPoints>) map.get("retvalue");
// list.forEach(item -> {
// System.out.println(item.toString());
// });
// } else {
// String msg = (String) map.get("retvalue");
// System.out.println(msg);
// } // }
// if (null != userId) {
// vo.setUserId(userId);
// } // }
// //
// Integer pageNo = 1;
// Integer pageSize = 10;
//
// HashMap<String, Object> map = managementService.queryAllManagements(vo);
//// HashMap<String, Object> map = managementService.queryAllManagements(vo, pageNo, pageSize);
// //
// /**
// * 创建项目管理页面的判分点信息展示
// */
// @Test
// public void testGetByjudgmentPointsId() {
// List<Integer> judgmentPointsId = new ArrayList<>();
// judgmentPointsId.add(187);
// Integer projectId = 1;
// Integer userId = 4;
// HashMap<String, Object> map = managementService.getByjudgmentPointsId(judgmentPointsId, projectId, userId);
// Integer retcode = (Integer) map.get("retcode"); // Integer retcode = (Integer) map.get("retcode");
//
// System.out.println(retcode); // System.out.println(retcode);
//
// if (retcode == 200) { // if (retcode == 200) {
// PageResult pageResult = (PageResult) map.get("retvalue"); // List<JudgmentPoints> list = (List<JudgmentPoints>) map.get("retvalue");
// // list.forEach(item -> {
// Long total = pageResult.getTotal();
//
// System.out.println("total = " + total);
//
// List<ProjectManagement> rows = (List<ProjectManagement>) pageResult.getRows();
//
// rows.forEach(item -> {
// System.out.println(item.toString()); // System.out.println(item.toString());
// }); // });
//
// } else { // } else {
// String msg = (String) map.get("retvalue"); // String msg = (String) map.get("retvalue");
// System.out.println(msg); // System.out.println(msg);
// } // }
// } // }
//
// /**
/** // * 平均分配分值
* 批量删除 // */
*/ // @Test
@Transactional // public void testAvgValues() {
@Test // Integer number = 66;
public void testDeleteProjectManagement() { // HashMap<String, Object> map = managementService.avgValues(number);
List<Integer> point = new ArrayList<>(); // map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value));
point.add(1); // }
HashMap<String, Object> map = managementService.deleteProjectManagement(point); //
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); // /**
} // * 添加完角色信息 角色信息展示
// */
/** // @Test
* 根据项目管理id查询对应信息 // public void testGetByRoleId() {
*/ // List<Integer> roleId = new ArrayList<>();
@Test // roleId.add(235);
public void testGetProjectId() { // HashMap<String, Object> map = managementService.getByRoleId(roleId);
Integer projectId = 299; // map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
HashMap<String, Object> map = managementService.getProjectId(projectId); // }
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); //
} // /**
// * 修改角色信息
/** // */
* 添加判分点页面的判分点信息展示 // @Test
*/ // public void testUpdateRole() {
@Test //
public void testQueryAllJudgmentPoints() { // List<Integer> list = new ArrayList<>();
Judgment_Points points = new Judgment_Points(); // list.add(235);
points.setSystemId(1); //
points.setJudgmentPointsName(""); // List<Role> roleList = projectManagementMapper.getByRoleId(list);
HashMap<String, Object> map = managementService.queryAllJudgmentPoints(points); // Role role = roleList.get(0);
Integer retcode = (Integer) map.get("retcode"); // role.setRoleName("hh");
System.out.println(retcode); // //System.out.println(role.toString());//Role{roleId=235, roleName='null', roleNumber=1, roleType=1, roleAttribute=1}
if (retcode == 200) { //
List<Judgment_Points> list = (List<Judgment_Points>) map.get("retvalue"); // HashMap<String, Object> map = managementService.updateRole(role);
list.forEach(item -> { // map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
System.out.println(item.toString()); // }
}); //
} else { // /**
String msg = (String) map.get("retvalue"); // * 添加角色信息
System.out.println(msg); // */
} // @Test
} // public void testInsertRole() {
// List<Integer> list = new ArrayList<>();
// list.add(235);
/** //
* 创建项目管理页面的判分点信息展示 // List<Role> roleList = projectManagementMapper.getByRoleId(list);
*/ // Role role = roleList.get(0);
@Test // role.setRoleId(null);
public void testGetByjudgmentPointsId() { // role.setRoleName("hh");
List<Integer> judgmentPointsId = new ArrayList<>(); //
judgmentPointsId.add(187); // HashMap<String, Object> map = managementService.insertRole(role);
Integer projectId = 1; // map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
Integer userId = 4; // }
HashMap<String, Object> map = managementService.getByjudgmentPointsId(judgmentPointsId, projectId, userId); //
Integer retcode = (Integer) map.get("retcode");
System.out.println(retcode);
if (retcode == 200) {
List<Judgment_Points> list = (List<Judgment_Points>) 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<String, Object> map = managementService.avgValues(number);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value));
}
/**
* 添加完角色信息 角色信息展示
*/
@Test
public void testGetByRoleId() {
List<Integer> roleId = new ArrayList<>();
roleId.add(235);
HashMap<String, Object> map = managementService.getByRoleId(roleId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
/**
* 修改角色信息
*/
@Test
public void testUpdateRole() {
List<Integer> list = new ArrayList<>();
list.add(235);
List<Role> 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<String, Object> map = managementService.updateRole(role);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
/**
* 添加角色信息
*/
@Test
public void testInsertRole() {
List<Integer> list = new ArrayList<>();
list.add(235);
List<Role> roleList = projectManagementMapper.getByRoleId(list);
Role role = roleList.get(0);
role.setRoleId(null);
role.setRoleName("hh");
HashMap<String, Object> 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.setSystemId(6);
// pro.setUserId(4); // pro.setUserId(4);
// pro.setFounder(0); // pro.setFounder(0);
// List<Judgment_Points> points = new ArrayList<>(); // List<JudgmentPoints> points = new ArrayList<>();
// Judgment_Points judgmentPoints = new Judgment_Points(); // JudgmentPoints judgmentPoints = new JudgmentPoints();
// judgmentPoints.setJudgmentPointsId(205); // judgmentPoints.setJudgmentPointsId(205);
// judgmentPoints.setExperimentalRequirements("按要求写出代码并正确运行显示小明考核结果"); // judgmentPoints.setExperimentalRequirements("按要求写出代码并正确运行显示小明考核结果");
// judgmentPoints.setScore(100); // judgmentPoints.setScore(100);
@ -252,56 +252,56 @@ public class Project_ManagementTest {
// ProjectManagement pro = projectManagementMapper.getProjectId(302); // ProjectManagement pro = projectManagementMapper.getProjectId(302);
// pro.setProjectId(null); // pro.setProjectId(null);
// pro.setFounder(0); // pro.setFounder(0);
// List<Judgment_Points> points = projectManagementMapper.queryProjectIds(302); // List<JudgmentPoints> points = projectManagementMapper.queryProjectIds(302);
// List<Integer> roles = projectManagementMapper.getByRoleProjectId(302);
//// HashMap<String, Object> 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<String, Object> 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<JudgmentPoints> points = new ArrayList<>();
// JudgmentPoints judgmentPoints = new JudgmentPoints();
// judgmentPoints.setJudgmentPointsId(205);
// judgmentPoints.setExperimentalRequirements("按要求写出代码并正确运行显示小明考核结果");
// judgmentPoints.setScore(100);
// points.add(judgmentPoints);
// List<Integer> roles = new ArrayList<>();
// roles.add(433);*/
// ProjectManagement pro = projectManagementMapper.getProjectId(302);
// pro.setFounder(0);
// List<JudgmentPoints> points = projectManagementMapper.queryProjectIds(302);
// List<Integer> roles = projectManagementMapper.getByRoleProjectId(302); // List<Integer> roles = projectManagementMapper.getByRoleProjectId(302);
// HashMap<String, Object> map = managementService.insertProjectManagement(pro, points, roles); // HashMap<String, Object> map = managementService.updateProjectManagement(pro, points, roles);
// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); // map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value));
// } // }
//}
/**
* 根据项目名称查询
*/
@Test
public void testGetByName() {
String projectName = "测试2";
HashMap<String, Object> 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<Judgment_Points> points = new ArrayList<>();
Judgment_Points judgmentPoints = new Judgment_Points();
judgmentPoints.setJudgmentPointsId(205);
judgmentPoints.setExperimentalRequirements("按要求写出代码并正确运行显示小明考核结果");
judgmentPoints.setScore(100);
points.add(judgmentPoints);
List<Integer> roles = new ArrayList<>();
roles.add(433);*/
ProjectManagement pro = projectManagementMapper.getProjectId(302);
pro.setFounder(0);
List<Judgment_Points> points = projectManagementMapper.queryProjectIds(302);
List<Integer> roles = projectManagementMapper.getByRoleProjectId(302);
HashMap<String, Object> map = managementService.updateProjectManagement(pro, points, roles);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value));
}
}

Loading…
Cancel
Save