科大项目管理增加项目模式字段及增加相关接口

master
rong.liu 4 years ago
parent 4d298b4a08
commit 466d0f0b4b
  1. 158
      src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java
  2. 325
      src/main/java/com/yipin/liuwanr/entity/HrProjectManagement.java
  3. 46
      src/main/java/com/yipin/liuwanr/entity/ManagementAndPointByKDVo.java
  4. 38
      src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java
  5. 278
      src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java

@ -102,6 +102,68 @@ public class ProjectManagementController {
} }
return r; return r;
} }
/**
* 首页面查询科大
* <p>updateProjectManagement
*
* @param projectPermissions:权限
* @param founder:创建人
* @param state:状态
* @param projectName:项目名称
* @param systemId
* @return
*/
@ApiOperation(value = "项目管理列表(科大)", notes = "项目管理列表(科大)")
@GetMapping("/queryAllManagementsByKD")
R queryAllManagementsByKD(
@ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = false) @RequestParam(required = false) Integer projectPermissions,
@ApiParam(name = "founder", value = "项目创建人(0、系统 1、老师)", required = false) @RequestParam(required = false) String founder,
@ApiParam(name = "state", value = "项目状态(0、草稿箱 1、已发布)", required = false) @RequestParam(required = false) Integer state,
@ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName,
@ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId,
@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId,
@ApiParam(name = "pageNo", value = "起始页数", required = true) @RequestParam Integer pageNo,
@ApiParam(name = "pageSize", value = "页数", required = true) @RequestParam Integer pageSize) {
R r = new R();
HrProjectManagement vo = new HrProjectManagement();
if (null != projectPermissions) {
vo.setProjectPermissions(projectPermissions);
}
if (null != founder && 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);
}
if (null != pageNo) {
vo.setPageNo(pageNo);
}
if (null != pageSize) {
vo.setPageSize(pageSize);
}
HashMap<String, Object> ret = service.queryAllManagementsByKD(vo);
int status = (int) ret.get("retcode");
if (status == 200) {
r.put("status", 200);
r.put("pageInfo", ret.get("pageInfo"));
} else {
R.error(500, ret.get("retvalue").toString());
}
return r;
}
// /** // /**
// * 首页面查询 // * 首页面查询
// * <p> // * <p>
@ -241,7 +303,6 @@ public class ProjectManagementController {
} }
/** /**
* 批量删除 * 批量删除
* *
@ -525,7 +586,7 @@ public class ProjectManagementController {
/** /**
* 添加创建项目管理信息 * 添加创建项目管理信息(职站项目)
* *
* @param vo 项目管理信息 * @param vo 项目管理信息
* @return * @return
@ -567,6 +628,50 @@ public class ProjectManagementController {
return resp; return resp;
} }
/**
* 添加创建项目管理信息(科大)
*
* @param vo 项目管理信息
* @return
*/
@ApiOperation(value = "科大创建项目", notes = "科大创建项目")
@PostMapping("/newProjectManagementByKD")
Response newAddProjectManagementByKD(@RequestBody @ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) ManagementAndPointByKDVo vo) {
Response resp = new Response();
HrProjectManagement 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.newAddProjectManagementByKD(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;
}
/** /**
* 添加交易类判分点项目管理信息 * 添加交易类判分点项目管理信息
* *
@ -728,12 +833,12 @@ public class ProjectManagementController {
/** /**
* 修改项目管理信息 * 修改项目管理信息(职站)
* *
* @param vo * @param vo
* @return * @return
*/ */
@ApiOperation(value = "编辑项目", notes = "编辑项目") @ApiOperation(value = "编辑项目(职站)", notes = "编辑项目(职站)")
@PostMapping("/newUpdateProjectManagement") @PostMapping("/newUpdateProjectManagement")
Response newUpdateProjectManagement(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointVo vo) { Response newUpdateProjectManagement(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointVo vo) {
Response resp = new Response(); Response resp = new Response();
@ -770,6 +875,51 @@ public class ProjectManagementController {
return resp; return resp;
} }
/**
* 修改项目管理信息(科大)
*
* @param vo
* @return
*/
@ApiOperation(value = "编辑项目(科大)", notes = "编辑项目(科大)")
@PostMapping("/newUpdateProjectManagementByKD")
Response newUpdateProjectManagementByKD(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointByKDVo vo) {
Response resp = new Response();
HrProjectManagement 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.newUpdateProjectManagementByKD(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,325 @@
package com.yipin.liuwanr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @描述项目管理
* @作者: Rong
* @日期: 2021-04-08
*/
@ApiModel(value = "项目管理")
@TableName("hr_project_management")
public class HrProjectManagement implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "项目主键ID")
private Integer projectId;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "模式(0基础模式,1挑战模式)")
private Integer pattern;
@ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)")
private Integer projectPermissions;
@ApiModelProperty(value = "绑定服务配置ID")
private Integer systemId;
@ApiModelProperty(value = "绑定用户id")
private Integer userId;
@ApiModelProperty(value = "是否删除(0、未删除 1、已删除)")
private Integer isdel;
@ApiModelProperty(value = "创建人角色(0、系统 1、老师)")
private String founder;
@ApiModelProperty(value = "创建时间")
private String creationTime;
@ApiModelProperty(value = "状态(0、草稿箱 1、已发布)")
private Integer state;
@ApiModelProperty(value = "实验目标")
private String experimentalGoal;
@ApiModelProperty(value = "案例描述")
private String caseDescription;
@ApiModelProperty(value = "实验任务")
private String experimentTask;
@ApiModelProperty(value = "绑定实验数据ID")
private String experimentalDataId;
@ApiModelProperty(value = "绑定角色Id(已弃用)")
private String roleId;
@ApiModelProperty(value = "实验提示")
private String experimentSuggests;
@ApiModelProperty(value = "是否展示(0、展示 1、不展示)")
private Boolean isShow;
@ApiModelProperty(value = "是否启用实验数据(0启用 1不启用) ")
private Integer isstartexperimental;
@ApiModelProperty(value = "是否启用实验提示(0启用 1不启用) ")
private Integer isstartexperimentSuggests;
@ApiModelProperty(value = "知识点")
private String knowledgePoints;
@ApiModelProperty(value = "实验介绍")
private String experimentIntroduction;
@ApiModelProperty(value = "知识点是否启用(0、启用 1、不展示)")
private Integer knowledgePointsIsEnable;
@ApiModelProperty(value = "实验介绍是否启用(0、启用 1、不展示)")
private Integer experimentIntroductionIsEnable;
@ApiModelProperty(value = "是否启用,0:启用,1:禁用")
private Integer enable;
private Integer pageNo;// 第几页,页码
private Integer pageSize;// 每页展示的数据条数
private String queryName;// 模糊查询名称,与数据库字段区分
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Integer getPageNo() {
return pageNo;
}
public void setPageNo(Integer pageNo) {
this.pageNo = pageNo;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public String getQueryName() {
return queryName;
}
public void setQueryName(String queryName) {
this.queryName = queryName;
}
public Integer getProjectId() {
return projectId;
}
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public Integer getPattern() {
return pattern;
}
public void setPattern(Integer pattern) {
this.pattern = pattern;
}
public Integer getProjectPermissions() {
return projectPermissions;
}
public void setProjectPermissions(Integer projectPermissions) {
this.projectPermissions = projectPermissions;
}
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 getIsdel() {
return isdel;
}
public void setIsdel(Integer isdel) {
this.isdel = isdel;
}
public String getFounder() {
return founder;
}
public void setFounder(String founder) {
this.founder = founder;
}
public String getCreationTime() {
return creationTime;
}
public void setCreationTime(String creationTime) {
this.creationTime = creationTime;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public String getExperimentalGoal() {
return experimentalGoal;
}
public void setExperimentalGoal(String experimentalGoal) {
this.experimentalGoal = experimentalGoal;
}
public String getCaseDescription() {
return caseDescription;
}
public void setCaseDescription(String caseDescription) {
this.caseDescription = caseDescription;
}
public String getExperimentTask() {
return experimentTask;
}
public void setExperimentTask(String experimentTask) {
this.experimentTask = experimentTask;
}
public String getExperimentalDataId() {
return experimentalDataId;
}
public void setExperimentalDataId(String experimentalDataId) {
this.experimentalDataId = experimentalDataId;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getExperimentSuggests() {
return experimentSuggests;
}
public void setExperimentSuggests(String experimentSuggests) {
this.experimentSuggests = experimentSuggests;
}
public Boolean getShow() {
return isShow;
}
public void setShow(Boolean show) {
isShow = show;
}
public Integer getIsstartexperimental() {
return isstartexperimental;
}
public void setIsstartexperimental(Integer isstartexperimental) {
this.isstartexperimental = isstartexperimental;
}
public Integer getIsstartexperimentSuggests() {
return isstartexperimentSuggests;
}
public void setIsstartexperimentSuggests(Integer isstartexperimentSuggests) {
this.isstartexperimentSuggests = isstartexperimentSuggests;
}
public String getKnowledgePoints() {
return knowledgePoints;
}
public void setKnowledgePoints(String knowledgePoints) {
this.knowledgePoints = knowledgePoints;
}
public String getExperimentIntroduction() {
return experimentIntroduction;
}
public void setExperimentIntroduction(String experimentIntroduction) {
this.experimentIntroduction = experimentIntroduction;
}
public Integer getKnowledgePointsIsEnable() {
return knowledgePointsIsEnable;
}
public void setKnowledgePointsIsEnable(Integer knowledgePointsIsEnable) {
this.knowledgePointsIsEnable = knowledgePointsIsEnable;
}
public Integer getExperimentIntroductionIsEnable() {
return experimentIntroductionIsEnable;
}
public void setExperimentIntroductionIsEnable(Integer experimentIntroductionIsEnable) {
this.experimentIntroductionIsEnable = experimentIntroductionIsEnable;
}
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
}

@ -0,0 +1,46 @@
package com.yipin.liuwanr.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "ManagementAndPointVo对象", description = "添加项目管理对象ManagementAndPointVo")
public class ManagementAndPointByKDVo {
@ApiModelProperty(value = "项目管理实体类", name = "management", required = true)
private HrProjectManagement 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<JudgmentPoints> pooints;//判分点信息
@ApiModelProperty(value = "角色id列表", name = "roleId", example = "[403]", required = true)
private List<Integer> roleId;//存储角色id
public HrProjectManagement getManagement() {
return management;
}
public void setManagement(HrProjectManagement management) {
this.management = management;
}
public List<JudgmentPoints> getPooints() {
return pooints;
}
public void setPooints(List<JudgmentPoints> pooints) {
this.pooints = pooints;
}
public List<Integer> getRoleId() {
return roleId;
}
public void setRoleId(List<Integer> roleId) {
this.roleId = roleId;
}
}

@ -49,6 +49,21 @@ public interface ProjectManagementMapper {
" ORDER BY creationTime desc", " ORDER BY creationTime desc",
"</script>"}) "</script>"})
List<ProjectManagement> queryManagements(ProjectManagement management); List<ProjectManagement> queryManagements(ProjectManagement management);
@Select({"<script>",
// "select projectId,projectName,projectPermissions,founder,creationTime,state,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0",
"select * from hr_project_management where 1 = 1",// (roleId NOT LIKE '%3%' AND isdel = 0)",
" <if test='userId==null'>AND founder NOT LIKE '4' AND isdel = 0</if>",
" <if test='userId!=null'>AND ((FIND_IN_SET(1,founder) AND isdel = 0) OR ( isdel = 0 AND userId = #{userId} ))</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
" <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>",
" <if test='founder!=null'> and founder=#{founder}</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>",
" ORDER BY creationTime desc",
"</script>"})
List<HrProjectManagement> queryManagementsByKD(HrProjectManagement management);
// @Select({"<script>", // @Select({"<script>",
//// "select projectId,projectName,projectPermissions,founder,creationTime,state,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0", //// "select projectId,projectName,projectPermissions,founder,creationTime,state,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0",
// "select * from hr_project_management where isdel=0", // "select * from hr_project_management where isdel=0",
@ -79,7 +94,6 @@ public interface ProjectManagementMapper {
List<ProjectManagement> KDqueryManagementsExportTest(ProjectManagement management); List<ProjectManagement> KDqueryManagementsExportTest(ProjectManagement management);
@Select({"<script>", @Select({"<script>",
"select * from hr_project_management where enable = 0",//(roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0)", "select * from hr_project_management where enable = 0",//(roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0)",
"<if test='userId==null'>AND roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0</if>", "<if test='userId==null'>AND roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0</if>",
@ -334,7 +348,7 @@ public interface ProjectManagementMapper {
void updateTradingJudgmentPoints(String projectId, Integer judgmentPointsId); void updateTradingJudgmentPoints(String projectId, Integer judgmentPointsId);
/** /**
* 添加项目管理信息 * 添加项目管理信息职站
* *
* @param management * @param management
*/ */
@ -343,6 +357,16 @@ public interface ProjectManagementMapper {
@Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId") @Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId")
void insertProjectManagement(ProjectManagement management); void insertProjectManagement(ProjectManagement management);
/**
* 添加项目管理信息科大
*
* @param management
*/
@Insert("INSERT INTO hr_project_management(pattern,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction,knowledgePointsIsEnable,experimentIntroductionIsEnable)"
+ " VALUES (#{pattern},#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},#{knowledgePoints},#{experimentIntroduction},#{knowledgePointsIsEnable},#{experimentIntroductionIsEnable})")
@Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId")
void insertProjectManagementByKD(HrProjectManagement management);
/** /**
* 修改项目管理信息 * 修改项目管理信息
* *
@ -352,6 +376,16 @@ public interface ProjectManagementMapper {
+ "isstartexperimental=#{isstartexperimental},isstartexperimentSuggests=#{isstartexperimentSuggests},knowledgePoints=#{knowledgePoints},experimentIntroduction=#{experimentIntroduction},knowledgePointsIsEnable=#{knowledgePointsIsEnable},experimentIntroductionIsEnable=#{experimentIntroductionIsEnable} where projectId=#{projectId}") + "isstartexperimental=#{isstartexperimental},isstartexperimentSuggests=#{isstartexperimentSuggests},knowledgePoints=#{knowledgePoints},experimentIntroduction=#{experimentIntroduction},knowledgePointsIsEnable=#{knowledgePointsIsEnable},experimentIntroductionIsEnable=#{experimentIntroductionIsEnable} where projectId=#{projectId}")
void updateProjectManagement(ProjectManagement management); void updateProjectManagement(ProjectManagement management);
/**
* 修改项目管理信息(科大)
*
* @param management
*/
@Update("update hr_project_management set pattern=#{pattern},projectName=#{projectName},projectPermissions=#{projectPermissions},experimentalGoal=#{experimentalGoal},caseDescription=#{caseDescription},experimentSuggests=#{experimentSuggests},state=#{state},"
+ "isstartexperimental=#{isstartexperimental},isstartexperimentSuggests=#{isstartexperimentSuggests},knowledgePoints=#{knowledgePoints},experimentIntroduction=#{experimentIntroduction},knowledgePointsIsEnable=#{knowledgePointsIsEnable},experimentIntroductionIsEnable=#{experimentIntroductionIsEnable} where projectId=#{projectId}")
void updateProjectManagementByKD(HrProjectManagement management);
/** /**
* 根据项目id,查询出该项目所有的判分点id * 根据项目id,查询出该项目所有的判分点id
* *

@ -146,9 +146,8 @@ public class ProjectManagementService {
} }
/** /**
* 分页查询+条件查询 * 分页查询+条件查询(职站)
* *
* @param vo * @param vo
* @return * @return
@ -208,6 +207,67 @@ public class ProjectManagementService {
} }
/**
* 分页查询+条件查询(科大)
*
* @param vo
* @return
*/
public HashMap<String, Object> queryAllManagementsByKD(HrProjectManagement vo) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
//获取用户的角色信息
String roleId = mapper.queryRoleId(vo.getUserId());
if (null != roleId) {
//角色不对(学生没有权限)
if ("4".equals(roleId)) {
resp.put("retcode", 300);
resp.put("retvalue", "抱歉,您的权限不能访问该地址!");
return resp;
}
//角色等于超级管理员或管理员
else if ("1".equals(roleId) || "13".equals(roleId) || "13,14".equals(roleId)) {
vo.setUserId(null);
}
}
//分页
PageHelper.startPage(vo.getPageNo(), vo.getPageSize());
//条件查询
List<HrProjectManagement> list = mapper.queryManagementsByKD(vo);
//管理员权限id
String adminId = "13";
//记录total
long total = 0;
//出现这种情况,管理员查询条数会为空
if (adminId.equals(vo.getFounder())) {
//查完管理员,再查管理员+教师权限的 13,14
HrProjectManagement vo1 = new HrProjectManagement();
BeanUtils.copyProperties(vo, vo1);
vo1.setFounder("13,14");
//分页,进入这里 数据只会有管理员+老师的权限,list长度为0
PageHelper.startPage(vo.getPageNo(), vo.getPageSize());
List<HrProjectManagement> list1 = mapper.queryManagementsByKD(vo1);
//拿取总条数,数据由外面pageInfo传
PageInfo pageInfo = new PageInfo(list1);
total = pageInfo.getTotal();
list.addAll(list1);
}
PageInfo pageInfo = new PageInfo(list);
if (total != 0) {
pageInfo.setTotal(total);
}
resp.put("pageInfo", pageInfo);
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}
/** /**
* 批量删除 * 批量删除
* *
@ -638,7 +698,7 @@ public class ProjectManagementService {
/** /**
* 添加项目管理信息 * 添加项目管理信息(职站)
* *
* @return * @return
*/ */
@ -711,6 +771,79 @@ public class ProjectManagementService {
} }
/**
* 添加项目管理信息(科大)
*
* @return
*/
@Transactional
public HashMap<String, Object> newAddProjectManagementByKD(HrProjectManagement pro, List<JudgmentPoints> points, List<Integer> roles) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
// 添加项目信息
mapper.insertProjectManagementByKD(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;
}
/** /**
* 添加项目管理信息 * 添加项目管理信息
* *
@ -1081,6 +1214,145 @@ public class ProjectManagementService {
return resp; return resp;
} }
/**
* 新修改修改项目管理信息(科大)
*
* @return
*/
@Transactional
public HashMap<String, Object> newUpdateProjectManagementByKD(HrProjectManagement 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);
}
}
//修改项目信息
mapper.updateProjectManagementByKD(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;
}
public HashMap<String, Object> getManagements(Integer projectPermissions) { public HashMap<String, Object> getManagements(Integer projectPermissions) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {

Loading…
Cancel
Save