diff --git a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java index 9d5a97c..db2ac39 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java @@ -58,20 +58,20 @@ public class ProjectManagementController { @ApiOperation(value = "项目管理列表", notes = "项目管理列表") @GetMapping("/queryAllManagements") R queryAllManagements( - @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) { + @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(); ProjectManagement vo = new ProjectManagement(); if (null != projectPermissions) { vo.setProjectPermissions(projectPermissions); } - if (null != founder && founder !="") { + if (null != founder && founder != "") { vo.setFounder(founder); } if (null != state) { @@ -86,22 +86,84 @@ public class ProjectManagementController { if (null != userId) { vo.setUserId(userId); } - if (null != pageNo){ + if (null != pageNo) { vo.setPageNo(pageNo); } - if (null != pageSize){ + if (null != pageSize) { vo.setPageSize(pageSize); } HashMap ret = service.queryAllManagements(vo); int status = (int) ret.get("retcode"); if (status == 200) { r.put("status", 200); - r.put("pageInfo",ret.get("pageInfo")); + r.put("pageInfo", ret.get("pageInfo")); } else { - R.error(500,ret.get("retvalue").toString()); + R.error(500, ret.get("retvalue").toString()); } return r; } + + + /** + * 首页面查询(科大) + *

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 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; + } + + // /** // * 首页面查询 // *

@@ -155,6 +217,7 @@ public class ProjectManagementController { // } // return resp; // } + /** * 页面查询,排除练习 *

@@ -165,11 +228,11 @@ public class ProjectManagementController { @ApiOperation(value = "项目列表(排除练习)", notes = "项目列表(用于创建实验,排除练习项目)") @GetMapping("/queryManagements") Response queryManagements( - @ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam(required = false) Integer systemId, - @ApiParam(name = "userId", value = "用户id", required = true) @RequestParam(required = false) Integer userId, - @ApiParam(name = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo, - @ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize, - @ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam String projectName) { + @ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam(required = false) Integer systemId, + @ApiParam(name = "userId", value = "用户id", required = true) @RequestParam(required = false) Integer userId, + @ApiParam(name = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo, + @ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize, + @ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName) { Response resp = new Response(); ProjectManagement vo = new ProjectManagement(); if (null != systemId) { @@ -178,10 +241,17 @@ public class ProjectManagementController { if (null != userId) { vo.setUserId(userId); } - if (null != projectName) { + + + + /*if (null != projectName) { vo.setQueryName(projectName); + }*/ + + if (org.apache.commons.lang3.StringUtils.equals("", projectName)) { + projectName = null; } - HashMap ret = service.queryManagements(vo,pageNo,pageSize); + HashMap ret = service.queryManagements(vo, pageNo, pageSize); int status = (int) ret.get("retcode"); if (status == 200) { resp.setStatus(status); @@ -194,10 +264,43 @@ public class ProjectManagementController { } - - - - + /** + * 页面查询,排除练习 --- 科大分开接口 + *

+ * + * @param systemId + * @return + */ + @ApiOperation(value = "项目列表(排除练习)--科大分开接口", notes = "项目列表(用于创建实验,排除练习项目)") + @GetMapping("/KDqueryManagements") + Response KDqueryManagements( + @ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam(required = false) Integer systemId, + @ApiParam(name = "userId", value = "用户id", required = true) @RequestParam(required = false) Integer userId, + @ApiParam(name = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo, + @ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize, + @ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName) { + Response resp = new Response(); + ProjectManagement vo = new ProjectManagement(); + if (null != systemId) { + vo.setSystemId(systemId); + } + if (null != userId) { + vo.setUserId(userId); + } + if (org.apache.commons.lang3.StringUtils.equals("", projectName)) { + projectName = null; + } + HashMap ret = service.KDqueryManagements(vo, pageNo, pageSize); + 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; + } /** @@ -246,7 +349,7 @@ public class ProjectManagementController { } /** - * 根据项目管理id查询对应交易类判分点信息 + * 根据项目管理id查询对应交易类判分点信息(职站) * * @param projectId * @return @@ -267,6 +370,29 @@ public class ProjectManagementController { return resp; } + + /** + * 根据项目管理id查询对应交易类判分点信息(科大) + * + * @param projectId + * @return + */ + @ApiOperation(value = "根据项目管理id查询对应交易类判分点信息(科大)", notes = "根据项目管理id查询对应交易类判分点信息(科大)") + @GetMapping("/getTrdingJudgmentPointsByKD") + Response getTrdingJudgmentPointsByKD(@ApiParam(name = "projectId", value = "项目主键ID", required = true) @RequestParam Integer projectId) { + Response resp = new Response(); + HashMap ret = service.getTrdingJudgmentPointsByKD(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查询对应交易类判分点信息 * @@ -483,7 +609,7 @@ public class ProjectManagementController { /** - * 添加创建项目管理信息 + * 添加创建项目管理信息(职站项目) * * @param vo 项目管理信息 * @return @@ -525,6 +651,50 @@ public class ProjectManagementController { 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 points = vo.getPooints(); + List roles = vo.getRoleId(); + if (StringUtils.isEmpty(pro)) { + resp.setStatus(300); + resp.setMessage("management cannot be empty"); + return resp; + } + if (points.isEmpty() || points.size() <= 0) { + resp.setStatus(300); + resp.setMessage("pooints cannot be empty"); + return resp; + } + + if (pro.getIsstartexperimental() == 0) {//开启实验数据 + if (roles.isEmpty() || roles.size() <= 0) { + resp.setStatus(300); + resp.setMessage("roleId cannot be empty"); + return resp; + } + } + HashMap ret = service.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; + } + /** * 添加交易类判分点项目管理信息 * @@ -660,16 +830,17 @@ public class ProjectManagementController { /** * 判断项目名称是否存在 + * * @param projectName * @return */ @GetMapping("/isNameExistis") - Response isNameExistis(@RequestParam String projectName){ + Response isNameExistis(@RequestParam String projectName) { Response resp = new Response(); if (StringUtils.isEmpty(projectName)) { resp.setStatus(300); resp.setMessage("项目名称为空"); - }else{ + } else { HashMap ret = service.getByName(projectName); int status = (int) ret.get("retcode"); if (status == 200) { @@ -685,12 +856,12 @@ public class ProjectManagementController { /** - * 修改项目管理信息 + * 修改项目管理信息(职站) * * @param vo * @return */ - @ApiOperation(value = "编辑项目", notes = "编辑项目") + @ApiOperation(value = "编辑项目(职站)", notes = "编辑项目(职站)") @PostMapping("/newUpdateProjectManagement") Response newUpdateProjectManagement(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointVo vo) { Response resp = new Response(); @@ -727,6 +898,51 @@ public class ProjectManagementController { 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 points = vo.getPooints(); + List roles = vo.getRoleId(); + if (StringUtils.isEmpty(pro)) { + resp.setStatus(300); + resp.setMessage("项目管理为空,修改失败!"); + return resp; + } + if (points.isEmpty() || points.size() <= 0) { + resp.setStatus(300); + resp.setMessage("判分点为空,修改失败!"); + return resp; + } + + if (pro.getIsstartexperimental() == 0) {//开启实验数据 + if (roles.isEmpty() || roles.size() <= 0) { + resp.setStatus(300); + resp.setMessage("角色id为空,修改失败!"); + return resp; + } + } + HashMap ret = service.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; + } + + /** * 川大查询项目管理 *

@@ -737,13 +953,13 @@ public class ProjectManagementController { @ApiOperation(value = "川大查询项目管理列表", notes = "川大查询项目管理列表") @GetMapping("/getManagements") Response getManagements( - @ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = true) @RequestParam(required = true) Integer projectPermissions){ + @ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = true) @RequestParam(required = true) Integer projectPermissions) { Response resp = new Response(); ProjectManagement vo = new ProjectManagement(); if (null == projectPermissions) { resp.setStatus(300); resp.setErrmessage("项目权限不能为空!"); - }else { + } else { HashMap ret = service.getManagements(projectPermissions); int status = (int) ret.get("retcode"); if (status == 200) { @@ -759,13 +975,14 @@ public class ProjectManagementController { /** * 是否启用 + * * @param enable 0:启用,1:禁用 - * @param id 项目id + * @param id 项目id */ @ApiOperation(value = "启用/禁用", notes = "启用/禁用") @GetMapping("/enable") - public Response enable(@ApiParam(name = "enable", value = "0:启用,1:禁用")@RequestParam("enable") Integer enable, - @ApiParam(name = "id", value = "项目id")@RequestParam("id") Integer id) { + public Response enable(@ApiParam(name = "enable", value = "0:启用,1:禁用") @RequestParam("enable") Integer enable, + @ApiParam(name = "id", value = "项目id") @RequestParam("id") Integer id) { Response resp = new Response(); if (enable == null || id == null || (enable != 0 && enable != 1)) { resp.setStatus(406); diff --git a/src/main/java/com/yipin/liuwanr/entity/HrProjectManagement.java b/src/main/java/com/yipin/liuwanr/entity/HrProjectManagement.java new file mode 100644 index 0000000..dabf932 --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/entity/HrProjectManagement.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/entity/ManagementAndPointByKDVo.java b/src/main/java/com/yipin/liuwanr/entity/ManagementAndPointByKDVo.java new file mode 100644 index 0000000..b4e6441 --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/entity/ManagementAndPointByKDVo.java @@ -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 pooints;//判分点信息 + + @ApiModelProperty(value = "角色id列表", name = "roleId", example = "[403]", required = true) + private List roleId;//存储角色id + + + public HrProjectManagement getManagement() { + return management; + } + + public void setManagement(HrProjectManagement management) { + this.management = management; + } + + public List getPooints() { + return pooints; + } + + public void setPooints(List pooints) { + this.pooints = pooints; + } + + public List getRoleId() { + return roleId; + } + + public void setRoleId(List roleId) { + this.roleId = roleId; + } + +} diff --git a/src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java b/src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java index f9b8fbf..119bfed 100644 --- a/src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java +++ b/src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java @@ -65,6 +65,24 @@ public class ProjectManagement { @ApiModelProperty(hidden = true) private Integer isShow; + @ApiModelProperty(value = "是否启用实验数据(0启用 1不启用)", name = "isstartexperimental", example = "0", required = true) + private Integer isstartexperimental;//是否启用实验数据(0启用 1不启用) + + @ApiModelProperty(value = "是否启用实验提示(0启用 1不启用)", name = "isstartexperimentSuggests", example = "0", required = true) + private Integer isstartexperimentSuggests; + + @ApiModelProperty(value = "用户ID", name = "userId", example = "4", required = true) + private Integer userId; + + @ApiModelProperty(value = "知识点是否启用(0、启用 1、不展示)", name = "knowledgePointsIsEnable", example = "0", required = true) + private Integer knowledgePointsIsEnable; + + @ApiModelProperty(value = "实验介绍是否启用(0、启用 1、不展示)", name = "userId", example = "0", required = true) + private Integer experimentIntroductionIsEnable; + + @ApiModelProperty(value = "是否启用(0:启用,1:禁用)") + private Integer enable; + public Integer getPageNo() { return pageNo; } @@ -89,24 +107,6 @@ public class ProjectManagement { this.pageSize = pageSize; } - @ApiModelProperty(value = "是否启用实验数据(0启用 1不启用)", name = "isstartexperimental", example = "0", required = true) - private Integer isstartexperimental;//是否启用实验数据(0启用 1不启用) - - @ApiModelProperty(value = "是否启用实验提示(0启用 1不启用)", name = "isstartexperimentSuggests", example = "0", required = true) - private Integer isstartexperimentSuggests; - - @ApiModelProperty(value = "用户ID", name = "userId", example = "4", required = true) - private Integer userId; - - @ApiModelProperty(value = "知识点是否启用(0、启用 1、不展示)", name = "knowledgePointsIsEnable", example = "0", required = true) - private Integer knowledgePointsIsEnable; - - @ApiModelProperty(value = "实验介绍是否启用(0、启用 1、不展示)", name = "userId", example = "0", required = true) - private Integer experimentIntroductionIsEnable; - - @ApiModelProperty(value = "是否启用(0:启用,1:禁用)") - private Integer enable; - public Integer getEnable() { return enable; } diff --git a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java index 5d6be3e..8e96456 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java @@ -25,17 +25,16 @@ public interface ProjectManagementMapper { * 分页查询+条件查询 * * @param management - * @return - * "select projectId,projectName,projectPermissions,founder,creationTime,state from hr_project_management where isdel=0", - * " and projectPermissions=#{projectPermissions}", - * " and founder=#{founder}",//服务端跳项目管理 - * " and (userId=#{userId} or founder = 0)",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的 - * " and founder=#{founder}",//教师选择创建人为系统 - * " and userId=#{userId}",//教师选则创建人为老师 - * " and state=#{state}", - * " and systemId=#{systemId}", - * " and projectName like concat('%',#{projectName},'%')", - * " ORDER BY creationTime desc", + * @return "select projectId,projectName,projectPermissions,founder,creationTime,state from hr_project_management where isdel=0", + * " and projectPermissions=#{projectPermissions}", + * " and founder=#{founder}",//服务端跳项目管理 + * " and (userId=#{userId} or founder = 0)",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的 + * " and founder=#{founder}",//教师选择创建人为系统 + * " and userId=#{userId}",//教师选则创建人为老师 + * " and state=#{state}", + * " and systemId=#{systemId}", + * " and projectName like concat('%',#{projectName},'%')", + * " ORDER BY creationTime desc", */ @Select({""}) List queryManagements(ProjectManagement management); + + + @Select({""}) + List queryManagementsByKD(HrProjectManagement management); // @Select({""}) // List queryManagements(ProjectManagement management); + //科大分开接口 + @Select({""}) + List KDqueryManagementsExportTest(ProjectManagement management); + + @Select({""}) List queryManagementsExportTest(ProjectManagement management); @@ -87,6 +114,16 @@ public interface ProjectManagementMapper { @Select("select projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction,knowledgePointsIsEnable,experimentIntroductionIsEnable from hr_project_management where isdel=0 and projectId=#{projectId}") ProjectManagement getProjectId(Integer projectId); + + /** + * 根据实验项目id查询信息(科大) + * + * @param projectId + * @return + */ + @Select("select pattern,projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction,knowledgePointsIsEnable,experimentIntroductionIsEnable from hr_project_management where isdel=0 and projectId=#{projectId}") + HrProjectManagement getProjectIdByKD(Integer projectId); + /** * 根据实验项目id查询项目名称 * @@ -211,7 +248,7 @@ public interface ProjectManagementMapper { @Select({""}) - List getScore(Integer judgmentPointsId,Integer systemId,Integer projectId); + List getScore(Integer judgmentPointsId, Integer systemId, Integer projectId); /** @@ -310,6 +347,7 @@ public interface ProjectManagementMapper { /** * 修改判分点绑定的项目 + * * @param projectId * @param judgmentPointsId */ @@ -320,7 +358,7 @@ public interface ProjectManagementMapper { void updateTradingJudgmentPoints(String projectId, Integer judgmentPointsId); /** - * 添加项目管理信息 + * 添加项目管理信息(职站) * * @param management */ @@ -329,6 +367,16 @@ public interface ProjectManagementMapper { @Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId") 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); + /** * 修改项目管理信息 * @@ -338,6 +386,16 @@ public interface ProjectManagementMapper { + "isstartexperimental=#{isstartexperimental},isstartexperimentSuggests=#{isstartexperimentSuggests},knowledgePoints=#{knowledgePoints},experimentIntroduction=#{experimentIntroduction},knowledgePointsIsEnable=#{knowledgePointsIsEnable},experimentIntroductionIsEnable=#{experimentIntroductionIsEnable} where projectId=#{projectId}") 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 * diff --git a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java index 30a0cb1..16acbc8 100644 --- a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java +++ b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java @@ -105,8 +105,49 @@ public class ProjectManagementService { } return resp; } + + /** - * 分页查询+条件查询 + * 条件查询 ---- 科大分开接口 + * + * @param vo + * @return + */ + public HashMap KDqueryManagements(ProjectManagement vo, Integer pageNo, Integer pageSize) { + HashMap resp = new HashMap(); + 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)) { + vo.setUserId(null); + } + } + PageHelper.startPage(pageNo, pageSize); + //条件查询 + List list = mapper.KDqueryManagementsExportTest(vo); + PageInfo info = new PageInfo(list); + resp.put("retvalue", new PageResult(info.getTotal(), list)); + resp.put("retcode", 200); + } catch (Exception e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + + /** + * 分页查询+条件查询(职站) * * @param vo * @return @@ -137,10 +178,10 @@ public class ProjectManagementService { //记录total long total = 0; //出现这种情况,管理员查询条数会为空 - if (adminId.equals(vo.getFounder())){ + if (adminId.equals(vo.getFounder())) { //查完管理员,再查管理员+教师权限的 13,14 ProjectManagement vo1 = new ProjectManagement(); - BeanUtils.copyProperties(vo,vo1); + BeanUtils.copyProperties(vo, vo1); vo1.setFounder("13,14"); //分页,进入这里 数据只会有管理员+老师的权限,list长度为0 PageHelper.startPage(vo.getPageNo(), vo.getPageSize()); @@ -151,10 +192,71 @@ public class ProjectManagementService { list.addAll(list1); } PageInfo pageInfo = new PageInfo(list); - if (total != 0){ + 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; + } + + + /** + * 分页查询+条件查询(科大) + * + * @param vo + * @return + */ + public HashMap queryAllManagementsByKD(HrProjectManagement vo) { + HashMap resp = new HashMap(); + 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 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 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("pageInfo", pageInfo); resp.put("retcode", 200); } catch (Exception e) { logger.error(e.getMessage()); @@ -202,11 +304,11 @@ public class ProjectManagementService { mapper.deleteRole(po); } int size = projectId.size(); - for (int i = 0;i result = mapper.queryproject(id); - if (result.size()==0){ + if (result.size() == 0) { mapper.daleteManegement(id); } @@ -336,6 +438,41 @@ public class ProjectManagementService { } + /** + * 根据项目管理id查询对应交易类判分点信息(科大) + * + * @param projectId + * @return + */ + public HashMap getTrdingJudgmentPointsByKD(Integer projectId) { + HashMap resp = new HashMap(); + List obj = new ArrayList(); + + try { + // 项目信息 + HrProjectManagement management = mapper.getProjectIdByKD(projectId); + if (null != management) { + // 判分点信息 + List points = mapper.queryJudgmentPoints(projectId); + // 角色信息 + List roles = mapper.queryProjectId(projectId); + // 存数据 + obj.add(management); + obj.add(points); + obj.add(roles); + } + resp.put("retvalue", obj); + resp.put("retcode", 200); + } catch (Exception e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + /** * 根据项目管理id查询对应交易类判分点信息 * @@ -472,15 +609,15 @@ public class ProjectManagementService { List judgmentPointsList = mapper.getJudgmentPoints(projectId); Integer size = judgmentPointsList.size(); - for (int i = 0; i roleList = mapper.queryProjectId(projectId); - obj.put("roleList",roleList); + obj.put("roleList", roleList); obj.put("judgmentPointsList", judgmentPointsList); obj.put("scoreIndexList", score); resp.put("retvalue", obj); @@ -508,15 +645,15 @@ public class ProjectManagementService { try { List judgmentPointsList = mapper.getZZJudgmentPoints(projectId); Integer size = judgmentPointsList.size(); - for (int i = 0; i roleList = mapper.queryProjectId(projectId); - obj.put("roleList",roleList); + obj.put("roleList", roleList); obj.put("judgmentPointsList", judgmentPointsList); obj.put("scoreIndexList", score); resp.put("retvalue", obj); @@ -596,7 +733,7 @@ public class ProjectManagementService { /** - * 添加项目管理信息 + * 添加项目管理信息(职站) * * @return */ @@ -644,14 +781,14 @@ public class ProjectManagementService { } // 得到判分指标信息 - ScoreIndex scoreIndex = new ScoreIndex(points.get(i).getScore(), pointId, projectId, pro.getUserId(),pro.getSystemId()); + 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 newAddProjectManagementByKD(HrProjectManagement pro, List points, List roles) { + HashMap resp = new HashMap(); + 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 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; + } + /** * 添加项目管理信息 * @@ -721,14 +931,14 @@ public class ProjectManagementService { } // 得到判分指标信息 - ScoreIndex scoreIndex = new ScoreIndex(points.get(i).getScore(), pointId, projectId, pro.getUserId(),pro.getSystemId()); + 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 getByName(String projectName){ + public HashMap getByName(String projectName) { HashMap resp = new HashMap(); - try{ + try { Integer count = mapper.getByprojectName(projectName); - if(count>=1){ + if (count >= 1) { resp.put("retcode", 300); resp.put("retvalue", "该项目名称已存在"); - }else{ + } else { resp.put("retcode", 200); } - }catch (RuntimeException e){ + } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); resp.put("retvalue", "QUERY Failed"); @@ -808,11 +1018,11 @@ public class ProjectManagementService { Integer score2 = indexMapper.getbyJudgmentPointsIdScore(pointId, project, userId); // 如果分数不一致,则修改分数表中的分数 if (score2 != null && score1 != score2) { - indexMapper.updateScore(new ScoreIndex(score1, pointId, project, userId,systemId)); + indexMapper.updateScore(new ScoreIndex(score1, pointId, project, userId, systemId)); } // 如果数据库中该判分点分数为空,则添加分数 else if (score2 == null) { - indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(),systemId)); + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(), systemId)); } //如果前端传来的实验要求与数据库中不一致,则修改数据库中的判分点信息 if (!experimentalRequirements2.equals(experimentalRequirements1)) { @@ -843,7 +1053,7 @@ public class ProjectManagementService { mapper.updateProject(new String(buff), experimentalRequirements1, pointId); } // 添加分数 - indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(),systemId)); + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(), systemId)); } judgments.remove(pointId); } @@ -882,7 +1092,7 @@ public class ProjectManagementService { if (roles != null && roles.size() > 0) { Integer size = roles.size(); - for (int i = 0; i newUpdateProjectManagement(ProjectManagement pro, List points, - List roles) { + List roles) { HashMap resp = new HashMap(); //项目id @@ -947,11 +1157,11 @@ public class ProjectManagementService { Integer score2 = indexMapper.getbyJudgmentPointsIdScore(pointId, project, userId); // 如果分数不一致,则修改分数表中的分数 if (score2 != null && score1 != score2) { - indexMapper.updateScore(new ScoreIndex(score1, pointId, project, userId,systemId)); + indexMapper.updateScore(new ScoreIndex(score1, pointId, project, userId, systemId)); } // 如果数据库中该判分点分数为空,则添加分数 else if (score2 == null) { - indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(),systemId)); + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(), systemId)); } //如果前端传来的实验要求与数据库中不一致,则修改数据库中的判分点信息 if (!experimentalRequirements2.equals(experimentalRequirements1)) { @@ -982,7 +1192,7 @@ public class ProjectManagementService { mapper.updateTradingJudgmentPoints(new String(buff), pointId); } // 添加分数 - indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(),systemId)); + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(), systemId)); } judgments.remove(pointId); } @@ -1021,7 +1231,7 @@ public class ProjectManagementService { if (roles != null && roles.size() > 0) { Integer size = roles.size(); - for (int i = 0; i getManagements(Integer projectPermissions){ + + /** + * 新修改修改项目管理信息(科大) + * + * @return + */ + @Transactional + public HashMap newUpdateProjectManagementByKD(HrProjectManagement pro, List points, + List roles) { + HashMap resp = new HashMap(); + + //项目id + Integer project = pro.getProjectId(); +// int del = mapper.delete(project); + //用户id + Integer userId = pro.getUserId(); + try { + //删除项目原本绑定的判分点 + int del = mapper.delete(project); + // 取出该项目对应的判分点id + List judgments = mapper.getByPointProjectId(project); + // 取出该项目对应的角色id + List rolesIds = mapper.getByRoleProjectId(project); + + for (int i = 0; i < points.size(); i++) { + //拼接判分点中的项目id + StringBuffer buff = new StringBuffer(); + + //前端传来的判分点id + Integer pointId = points.get(i).getJudgmentPointsId(); + //前端传来的实验要求 + String experimentalRequirements1 = points.get(i).getExperimentalRequirements(); + //前端传来的分数 + Integer score1 = points.get(i).getScore(); + Integer systemId = pro.getSystemId(); + + //判分点信息 + JudgmentPoints point = mapper.getNewByjudgmentPointsId(pointId); + String projectIds = point.getProjectId(); + String experimentalRequirements2 = point.getExperimentalRequirements(); + + // 如果数据库中有,则取出分数,进行比较 + if (judgments.contains(pointId)) { + //分数 + Integer score2 = indexMapper.getbyJudgmentPointsIdScore(pointId, project, userId); + // 如果分数不一致,则修改分数表中的分数 + if (score2 != null && score1 != score2) { + indexMapper.updateScore(new ScoreIndex(score1, pointId, project, userId, systemId)); + } + // 如果数据库中该判分点分数为空,则添加分数 + else if (score2 == null) { + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(), systemId)); + } + //如果前端传来的实验要求与数据库中不一致,则修改数据库中的判分点信息 + if (!experimentalRequirements2.equals(experimentalRequirements1)) { + mapper.updateTradingJudgmentPoints(point.getProjectId(), pointId); + } + } else { + //数据库中该判分点已绑定过别的项目id,并且该判分点没有绑定过此时前端传来的项目id + if (!StringUtils.isEmpty(projectIds)) { + List lists = Arrays.asList(projectIds.split(",")); + if (!lists.contains(project.toString())) { + buff.append(projectIds); + buff.append(","); + buff.append(project); + } + + } + //数据库中该判分点未绑定任何项目id + else if (StringUtils.isEmpty(projectIds)) { + buff.append(project); + } + //数据中实验要求不为空,且数据库中的实验要求与前端传来的实验要求信息一致 + if (experimentalRequirements2 != null && !experimentalRequirements2.equals("") + && experimentalRequirements2.equals(experimentalRequirements1)) { + mapper.updateTradingJudgmentPoints(new String(buff), pointId); + } + //数据库中的实验要求与前端传来的实验要求信息不一致 + else if (!experimentalRequirements2.equals(experimentalRequirements1)) { + mapper.updateTradingJudgmentPoints(new String(buff), pointId); + } + // 添加分数 + indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId(), systemId)); + } + judgments.remove(pointId); + } + + // 从判分点id中删除该项目的id + for (int i = 0; i < judgments.size(); i++) { + Integer judgmentPointsId = judgments.get(i); + + JudgmentPoints point = mapper.getByjudgmentPointsId(judgmentPointsId); + String projectIds = point.getProjectId(); + // 删除分数表中对应的判分点id+项目id数据 + indexMapper.removeScore(judgmentPointsId, project, userId); + + // 对取出的数据,删除该项目的id + List str3 = Arrays.asList(projectIds.split(",")); + if (str3.contains(project.toString())) { + List arrayList = new ArrayList(str3); + arrayList.remove(project.toString()); + // 删除字符中项目id + projectIds = StringUtils.strip(arrayList.toString(), "[]").replace(" ", ""); + // 修改判分点中的项目id + mapper.updateProject(projectIds, null, judgments.get(i)); + } + } + + // 用来存储需要修改的角色id + List roleid = new ArrayList(); + + // 遍历前端传来的新的角色id + for (int i = 0; i < roles.size(); i++) { + // 如果前端传来的数据,在数据库中没有,则存起来 + if (!rolesIds.contains(roles.get(i))) { + roleid.add(roles.get(i)); + } + } + + if (roles != null && roles.size() > 0) { + Integer size = roles.size(); + for (int i = 0; i < 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 getManagements(Integer projectPermissions) { HashMap resp = new HashMap(); - try{ - List projectManagements = mapper.getManagements(projectPermissions); + try { + List projectManagements = mapper.getManagements(projectPermissions); resp.put("retcode", 200); - resp.put("retvalue",projectManagements); - }catch (RuntimeException e){ + resp.put("retvalue", projectManagements); + } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); resp.put("retvalue", "数据有误,查询失败!"); @@ -1062,7 +1411,7 @@ public class ProjectManagementService { try { mapper.enable(id, enable); resp.put("retcode", 200); - resp.put("retvalue","SUCCESS"); + resp.put("retvalue", "SUCCESS"); } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8c9bea6..e1b8720 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,14 @@ -spring.datasource.url=jdbc:mysql://rm-wz9y13wf7u8q8610fwo.mysql.rds.aliyuncs.com:3306/huoran?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai +#Ʒliuwanr -ְվĿ +#spring.datasource.url=jdbc:mysql://rm-wz9y13wf7u8q8610fwo.mysql.rds.aliyuncs.com:3306/huoran?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai +#spring.datasource.username=super +#spring.datasource.password=huoran888 +#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver + +#Ȼʽ -ƴĿ +spring.datasource.url=jdbc:mysql://rm-wz9y13wf7u8q8610fwo.mysql.rds.aliyuncs.com:3306/keda?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai spring.datasource.username=super spring.datasource.password=huoran888 -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.jackson.default-property-inclusion=non_null