diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmEnvListController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmEnvListController.java index b67dec1d..24a4e1aa 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmEnvListController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmEnvListController.java @@ -5,11 +5,15 @@ import com.mdp.audit.log.client.annotation.OperType; import com.mdp.core.entity.Tips; import com.mdp.core.err.BizException; import com.mdp.core.utils.RequestUtils; +import com.mdp.core.utils.ResponseHelper; import com.mdp.mybatis.PageUtils; import com.mdp.qx.HasQx; +import com.mdp.safe.client.entity.User; +import com.mdp.safe.client.utils.LoginUtils; import com.mdp.swagger.ApiEntityParams; import com.xm.core.entity.XmEnvList; import com.xm.core.service.XmEnvListService; +import com.xm.core.service.XmGroupService; import io.swagger.annotations.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -42,8 +46,11 @@ public class XmEnvListController { @Autowired private XmEnvListService xmEnvListService; - - + + + + @Autowired + XmGroupService xmGroupService; @ApiOperation( value = "查询xm_env_list信息列表",notes="listXmEnvList,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}") @@ -83,8 +90,23 @@ public class XmEnvListController { Map m = new HashMap<>(); Tips tips=new Tips("成功新增一条数据"); try{ - if(StringUtils.hasText(xmEnvList.get)){ + if(!StringUtils.hasText(xmEnvList.getProjectId())){ + return ResponseHelper.failed("projectId-0","项目编号不能为空"); + } + User user= LoginUtils.getCurrentUserInfo(); + boolean inProjectGroup=xmGroupService.checkUserExistsGroup(xmEnvList.getProjectId(),user.getUserid()); + if(!inProjectGroup){ + return ResponseHelper.failed("no-in-project","您不在项目中【"+xmEnvList.getProjectId()+"】,不能添加环境清单"); + } + if(!StringUtils.hasText(xmEnvList.getReadQx())){ + return ResponseHelper.failed("readQx-0","请选中读权限"); + } + if(!StringUtils.hasText(xmEnvList.getWriteQx())){ + return ResponseHelper.failed("writeQx-0","请选中写权限"); + } + if(!StringUtils.hasText(xmEnvList.getRemark())){ + return ResponseHelper.failed("remark-0","请填写备注"); } xmEnvListService.addEnv(xmEnvList); m.put("data",xmEnvList); @@ -109,6 +131,29 @@ public class XmEnvListController { Map m = new HashMap<>(); Tips tips=new Tips("成功删除一条数据"); try{ + XmEnvList xmEnvListDb=this.xmEnvListService.selectOneById(xmEnvList.getId()); + if(xmEnvListDb==null){ + return ResponseHelper.failed("data-0","数据已不存在"); + } + User user=LoginUtils.getCurrentUserInfo(); + if(StringUtils.hasText(xmEnvListDb.getWriteQx()) && !"0".equals(xmEnvListDb.getWriteQx()) && user.getUserid().equals(xmEnvListDb.getCreateUserid())){ + String writeQx=xmEnvListDb.getWriteQx(); + if("1".equals(writeQx)){//同一机构可写 + if(!user.getBranchId().equals(xmEnvListDb.getBranchId())){ + return ResponseHelper.failed("writeQx-err-1","您无权更改"); + } + }else if("2".equals(writeQx)){//同一机构同一项目可写 + boolean inProject=this.xmGroupService.checkUserExistsGroup(xmEnvListDb.getProjectId(), user.getUserid()); + if(!inProject){ + return ResponseHelper.failed("writeQx-err-2","您不在项目【"+xmEnvListDb.getProjectId()+"】,无权更改"); + } + }else if("3".equals(writeQx)){//同一机构同一项目可写 + Tips isHeader=this.xmGroupService.checkIsAdmOrTeamHeadOrAss(user,xmEnvListDb.getCreateUserid(),xmEnvListDb.getProjectId()); + if(!isHeader.isOk()){ + return ResponseHelper.failed("writeQx-err-3","您不是【"+xmEnvListDb.getCreateUsername()+"】的上级,无权更改"); + } + } + } xmEnvListService.deleteByPk(xmEnvList); }catch (BizException e) { tips=e.getTips(); @@ -131,6 +176,29 @@ public class XmEnvListController { Map m = new HashMap<>(); Tips tips=new Tips("成功更新一条数据"); try{ + XmEnvList xmEnvListDb=this.xmEnvListService.selectOneById(xmEnvList.getId()); + if(xmEnvListDb==null){ + return ResponseHelper.failed("data-0","数据已不存在"); + } + User user=LoginUtils.getCurrentUserInfo(); + if(StringUtils.hasText(xmEnvListDb.getWriteQx()) && !"0".equals(xmEnvListDb.getWriteQx()) && user.getUserid().equals(xmEnvListDb.getCreateUserid())){ + String writeQx=xmEnvListDb.getWriteQx(); + if("1".equals(writeQx)){//同一机构可写 + if(!user.getBranchId().equals(xmEnvListDb.getBranchId())){ + return ResponseHelper.failed("writeQx-err-1","您无权更改"); + } + }else if("2".equals(writeQx)){//同一机构同一项目可写 + boolean inProject=this.xmGroupService.checkUserExistsGroup(xmEnvListDb.getProjectId(), user.getUserid()); + if(!inProject){ + return ResponseHelper.failed("writeQx-err-2","您不在项目【"+xmEnvListDb.getProjectId()+"】,无权更改"); + } + }else if("3".equals(writeQx)){//同一机构同一项目可写 + Tips isHeader=this.xmGroupService.checkIsAdmOrTeamHeadOrAss(user,xmEnvListDb.getCreateUserid(),xmEnvListDb.getProjectId()); + if(!isHeader.isOk()){ + return ResponseHelper.failed("writeQx-err-3","您不是【"+xmEnvListDb.getCreateUsername()+"】的上级,无权更改"); + } + } + } xmEnvListService.updateByPk(xmEnvList); m.put("data",xmEnvList); }catch (BizException e) { @@ -145,7 +213,7 @@ public class XmEnvListController { } - + /** @ApiOperation( value = "根据主键列表批量删除xm_env_list信息",notes="batchDelXmEnvList,仅需要上传主键字段") @ApiResponses({ @ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") @@ -166,7 +234,8 @@ public class XmEnvListController { } m.put("tips", tips); return m; - } + } + **/ /** diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmProjectEnvListController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmProjectEnvListController.java deleted file mode 100644 index d5e7c40e..00000000 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmProjectEnvListController.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.xm.core.ctrl; - -import com.mdp.audit.log.client.annotation.AuditLog; -import com.mdp.audit.log.client.annotation.OperType; -import com.mdp.core.entity.Tips; -import com.mdp.core.err.BizException; -import com.mdp.core.utils.RequestUtils; -import com.mdp.mybatis.PageUtils; -import com.xm.core.entity.XmProjectEnvList; -import com.xm.core.service.XmProjectEnvListService; -import io.swagger.annotations.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * url编制采用rest风格,如对XM.xm_project_env_list xm_project_env_list的操作有增删改查,对应的url分别为:
- * 新增: xm/xmProjectEnvList/add
- * 查询: xm/xmProjectEnvList/list
- * 模糊查询: xm/xmProjectEnvList/listKey
- * 修改: xm/xmProjectEnvList/edit
- * 删除: xm/xmProjectEnvList/del
- * 批量删除: xm/xmProjectEnvList/batchDel
- * 组织 com.qqkj 顶级模块 oa 大模块 xm 小模块
- * 实体 XmProjectEnvList 表 XM.xm_project_env_list 当前主键(包括多主键): id; - ***/ -@RestController("xm.core.xmProjectEnvListController") -@RequestMapping(value="/**/xm/core/xmProjectEnvList") -@Api(tags={"xm_project_env_list操作接口"}) -public class XmProjectEnvListController { - - static Log logger=LogFactory.getLog(XmProjectEnvListController.class); - - @Autowired - private XmProjectEnvListService xmProjectEnvListService; - - - - - @ApiOperation( value = "查询xm_project_env_list信息列表",notes="listXmProjectEnvList,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}") - @ApiImplicitParams({ - @ApiImplicitParam(name="id",value="主键,主键",required=false), - @ApiImplicitParam(name="remark",value="备注说明",required=false), - @ApiImplicitParam(name="ipAddress",value="ip地址",required=false), - @ApiImplicitParam(name="port",value="访问端口",required=false), - @ApiImplicitParam(name="projectId",value="归属项目组",required=false), - @ApiImplicitParam(name="projectName",value="归属项目组名称",required=false), - @ApiImplicitParam(name="accessUserid",value="访问用户编号",required=false), - @ApiImplicitParam(name="accessPassword",value="访问密码",required=false), - @ApiImplicitParam(name="effect",value="作用说明",required=false), - @ApiImplicitParam(name="accessUrl",value="访问链接",required=false), - @ApiImplicitParam(name="webIpAddress",value="外网ip地址",required=false), - @ApiImplicitParam(name="webPort",value="外网端口",required=false), - @ApiImplicitParam(name="otherRemark",value="其它说明",required=false), - @ApiImplicitParam(name="createUserid",value="添加人员",required=false), - @ApiImplicitParam(name="createUsername",value="添加人员姓名",required=false), - @ApiImplicitParam(name="createTime",value="添加时间",required=false), - @ApiImplicitParam(name="pageSize",value="每页记录数",required=false), - @ApiImplicitParam(name="pageNum",value="当前页码,从1开始",required=false), - @ApiImplicitParam(name="total",value="总记录数,服务器端收到0时,会自动计算总记录数,如果上传>0的不自动计算",required=false), - @ApiImplicitParam(name="orderBy",value="排序列 如性别、学生编号排序 orderBy = sex desc,student_id desc",required=false), - @ApiImplicitParam(name="count",value="是否进行总条数计算,count=true|false",required=false) - }) - @ApiResponses({ - @ApiResponse(code = 200,response= XmProjectEnvList.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") - }) - @RequestMapping(value="/list",method=RequestMethod.GET) - public Map listXmProjectEnvList( @ApiIgnore @RequestParam Map xmProjectEnvList){ - Map m = new HashMap<>(); - RequestUtils.transformArray(xmProjectEnvList, "ids"); - PageUtils.startPage(xmProjectEnvList); - List> xmProjectEnvListList = xmProjectEnvListService.selectListMapByWhere(xmProjectEnvList); //列出XmProjectEnvList列表 - PageUtils.responePage(m, xmProjectEnvListList); - m.put("data",xmProjectEnvListList); - Tips tips=new Tips("查询成功"); - m.put("tips", tips); - return m; - } - - - - @ApiOperation( value = "新增一条xm_project_env_list信息",notes="addXmProjectEnvList,主键如果为空,后台自动生成") - @ApiResponses({ - @ApiResponse(code = 200,response=XmProjectEnvList.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") - }) - @RequestMapping(value="/add",method=RequestMethod.POST) - public Map addXmProjectEnvList(@RequestBody XmProjectEnvList xmProjectEnvList) { - Map m = new HashMap<>(); - Tips tips=new Tips("成功新增一条数据"); - try{ - xmProjectEnvListService.addEnvList(xmProjectEnvList); -// if(StringUtils.isEmpty(xmProjectEnvList.getId())) { -// xmProjectEnvList.setId(xmProjectEnvListService.createKey("id")); -// }else{ -// XmProjectEnvList xmProjectEnvListQuery = new XmProjectEnvList(xmProjectEnvList.getId()); -// if(xmProjectEnvListService.countByWhere(xmProjectEnvListQuery)>0){ -// tips.setFailureMsg("编号重复,请修改编号再提交"); -// m.put("tips", tips); -// return m; -// } -// } -// xmProjectEnvListService.insert(xmProjectEnvList); - m.put("data",xmProjectEnvList); - }catch (BizException e) { - tips=e.getTips(); - logger.error("",e); - }catch (Exception e) { - tips.setFailureMsg(e.getMessage()); - logger.error("",e); - } - m.put("tips", tips); - return m; - } - - @ApiOperation( value = "删除一条xm_project_env_list信息",notes="delXmProjectEnvList,仅需要上传主键字段") - @ApiResponses({ - @ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") - }) - @RequestMapping(value="/del",method=RequestMethod.POST) - public Map delXmProjectEnvList(@RequestBody XmProjectEnvList xmProjectEnvList){ - Map m = new HashMap<>(); - Tips tips=new Tips("成功删除一条数据"); - try{ - xmProjectEnvListService.deleteByPk(xmProjectEnvList); - }catch (BizException e) { - tips=e.getTips(); - logger.error("",e); - }catch (Exception e) { - tips.setFailureMsg(e.getMessage()); - logger.error("",e); - } - m.put("tips", tips); - return m; - } - - @ApiOperation( value = "根据主键修改一条xm_project_env_list信息",notes="editXmProjectEnvList") - @ApiResponses({ - @ApiResponse(code = 200,response=XmProjectEnvList.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") - }) - @RequestMapping(value="/edit",method=RequestMethod.POST) - public Map editXmProjectEnvList(@RequestBody XmProjectEnvList xmProjectEnvList) { - Map m = new HashMap<>(); - Tips tips=new Tips("成功更新一条数据"); - try{ - xmProjectEnvListService.updateByPk(xmProjectEnvList); - m.put("data",xmProjectEnvList); - }catch (BizException e) { - tips=e.getTips(); - logger.error("",e); - }catch (Exception e) { - tips.setFailureMsg(e.getMessage()); - logger.error("",e); - } - m.put("tips", tips); - return m; - } - - - - @ApiOperation( value = "根据主键列表批量删除xm_project_env_list信息",notes="batchDelXmProjectEnvList,仅需要上传主键字段") - @ApiResponses({ - @ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") - }) - @RequestMapping(value="/batchDel",method=RequestMethod.POST) - public Map batchDelXmProjectEnvList(@RequestBody List xmProjectEnvLists) { - Map m = new HashMap<>(); - Tips tips=new Tips("成功删除"+xmProjectEnvLists.size()+"条数据"); - try{ - xmProjectEnvListService.batchDelete(xmProjectEnvLists); - }catch (BizException e) { - tips=e.getTips(); - logger.error("",e); - }catch (Exception e) { - tips.setFailureMsg(e.getMessage()); - logger.error("",e); - } - m.put("tips", tips); - return m; - } - - - /** - * 流程审批过程中回调该接口,更新业务数据 - * 如果发起流程时上送了restUrl,则无论流程中是否配置了监听器都会在流程发生以下事件时推送数据过来 - * eventName: PROCESS_STARTED 流程启动完成 全局 - * PROCESS_COMPLETED 流程正常结束 全局 - * PROCESS_CANCELLED 流程删除 全局 - * create 人工任务启动 - * complete 人工任务完成 - * assignment 人工任务分配给了具体的人 - * delete 人工任务被删除 - * - * 其中 create/complete/assignment/delete事件是需要在模型中人工节点上配置了委托代理表达式 ${taskBizCallListener}才会推送过来。 - * 在人工任务节点上配置 任务监听器 建议事件为 complete,其它assignment/create/complete/delete也可以,一般建议在complete,委托代理表达式 ${taskBizCallListener} - * - * @param flowVars {flowBranchId,agree,procInstId,assignee,actId,taskName,mainTitle,branchId,bizKey,commentMsg,eventName,modelKey} 等 - * @return 如果tips.isOk==false,将影响流程提交 - **/ - @AuditLog(firstMenu="办公平台",secondMenu="项目环境清单",func="processApprova",funcDesc="环境配置审核",operType=OperType.UPDATE) - @RequestMapping(value="/processApprova",method=RequestMethod.POST) - public Map processApprova( @RequestBody Map flowVars){ - Map m = new HashMap<>(); - Tips tips=new Tips("成功新增一条数据"); - - try{ - - this.xmProjectEnvListService.processApprova(flowVars); - logger.debug("procInstId====="+flowVars.get("procInstId")); - }catch (BizException e) { - tips=e.getTips(); - logger.error("执行异常",e); - }catch (Exception e) { - tips.setFailureMsg(e.getMessage()); - logger.error("执行异常",e); - } - m.put("tips", tips); - return m; - } -} diff --git a/xm-core/src/main/java/com/xm/core/entity/XmProjectEnvList.java b/xm-core/src/main/java/com/xm/core/entity/XmProjectEnvList.java deleted file mode 100644 index e4ead974..00000000 --- a/xm-core/src/main/java/com/xm/core/entity/XmProjectEnvList.java +++ /dev/null @@ -1,304 +0,0 @@ -package com.xm.core.entity; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import java.util.Date; - -/** - * 组织 com.qqkj 顶级模块 oa 大模块 xm 小模块
- * 实体 XmProjectEnvList所有属性名:
- * id,remark,ipAddress,port,projectId,projectName,accessUserid,accessPassword,effect,accessUrl,webIpAddress,webPort,otherRemark,createUserid,createUsername,createTime,bizProcInstId,bizFlowState;
- * 表 XM.xm_project_env_list xm_project_env_list的所有字段名:
- * id,remark,ip_address,port,project_id,project_name,access_userid,access_password,effect,access_url,web_ip_address,web_port,other_remark,create_userid,create_username,create_time,biz_proc_inst_id,biz_flow_state;
- * 当前主键(包括多主键):
- * id;
- */ -@ApiModel(description="xm_project_env_list") -public class XmProjectEnvList implements java.io.Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(notes="主键,主键",allowEmptyValue=true,example="",allowableValues="") - String id; - - - @ApiModelProperty(notes="备注说明",allowEmptyValue=true,example="",allowableValues="") - String remark; - - @ApiModelProperty(notes="ip地址",allowEmptyValue=true,example="",allowableValues="") - String ipAddress; - - @ApiModelProperty(notes="访问端口",allowEmptyValue=true,example="",allowableValues="") - String port; - - @ApiModelProperty(notes="归属项目组",allowEmptyValue=true,example="",allowableValues="") - String projectId; - - @ApiModelProperty(notes="归属项目组名称",allowEmptyValue=true,example="",allowableValues="") - String projectName; - - @ApiModelProperty(notes="访问用户编号",allowEmptyValue=true,example="",allowableValues="") - String accessUserid; - - @ApiModelProperty(notes="访问密码",allowEmptyValue=true,example="",allowableValues="") - String accessPassword; - - @ApiModelProperty(notes="作用说明",allowEmptyValue=true,example="",allowableValues="") - String effect; - - @ApiModelProperty(notes="访问链接",allowEmptyValue=true,example="",allowableValues="") - String accessUrl; - - @ApiModelProperty(notes="外网ip地址",allowEmptyValue=true,example="",allowableValues="") - String webIpAddress; - - @ApiModelProperty(notes="外网端口",allowEmptyValue=true,example="",allowableValues="") - String webPort; - - @ApiModelProperty(notes="其它说明",allowEmptyValue=true,example="",allowableValues="") - String otherRemark; - - @ApiModelProperty(notes="添加人员",allowEmptyValue=true,example="",allowableValues="") - String createUserid; - - @ApiModelProperty(notes="添加人员姓名",allowEmptyValue=true,example="",allowableValues="") - String createUsername; - - @ApiModelProperty(notes="添加时间",allowEmptyValue=true,example="",allowableValues="") - Date createTime; - - @ApiModelProperty(notes="当前流程实例编号",allowEmptyValue=true,example="",allowableValues="") - String bizProcInstId; - - @ApiModelProperty(notes="当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除",allowEmptyValue=true,example="",allowableValues="") - String bizFlowState; - - /**主键**/ - public XmProjectEnvList(String id) { - this.id = id; - } - - /**xm_project_env_list**/ - public XmProjectEnvList() { - } - - /** - * 主键 - **/ - public void setId(String id) { - this.id = id; - } - /** - * 备注说明 - **/ - public void setRemark(String remark) { - this.remark = remark; - } - /** - * ip地址 - **/ - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - /** - * 访问端口 - **/ - public void setPort(String port) { - this.port = port; - } - /** - * 归属项目组 - **/ - public void setProjectId(String projectId) { - this.projectId = projectId; - } - /** - * 归属项目组名称 - **/ - public void setProjectName(String projectName) { - this.projectName = projectName; - } - /** - * 访问用户编号 - **/ - public void setAccessUserid(String accessUserid) { - this.accessUserid = accessUserid; - } - /** - * 访问密码 - **/ - public void setAccessPassword(String accessPassword) { - this.accessPassword = accessPassword; - } - /** - * 作用说明 - **/ - public void setEffect(String effect) { - this.effect = effect; - } - /** - * 访问链接 - **/ - public void setAccessUrl(String accessUrl) { - this.accessUrl = accessUrl; - } - /** - * 外网ip地址 - **/ - public void setWebIpAddress(String webIpAddress) { - this.webIpAddress = webIpAddress; - } - /** - * 外网端口 - **/ - public void setWebPort(String webPort) { - this.webPort = webPort; - } - /** - * 其它说明 - **/ - public void setOtherRemark(String otherRemark) { - this.otherRemark = otherRemark; - } - /** - * 添加人员 - **/ - public void setCreateUserid(String createUserid) { - this.createUserid = createUserid; - } - /** - * 添加人员姓名 - **/ - public void setCreateUsername(String createUsername) { - this.createUsername = createUsername; - } - /** - * 添加时间 - **/ - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - /** - * 当前流程实例编号 - **/ - public void setBizProcInstId(String bizProcInstId) { - this.bizProcInstId = bizProcInstId; - } - /** - * 当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除 - **/ - public void setBizFlowState(String bizFlowState) { - this.bizFlowState = bizFlowState; - } - - /** - * 主键 - **/ - public String getId() { - return this.id; - } - /** - * 备注说明 - **/ - public String getRemark() { - return this.remark; - } - /** - * ip地址 - **/ - public String getIpAddress() { - return this.ipAddress; - } - /** - * 访问端口 - **/ - public String getPort() { - return this.port; - } - /** - * 归属项目组 - **/ - public String getProjectId() { - return this.projectId; - } - /** - * 归属项目组名称 - **/ - public String getProjectName() { - return this.projectName; - } - /** - * 访问用户编号 - **/ - public String getAccessUserid() { - return this.accessUserid; - } - /** - * 访问密码 - **/ - public String getAccessPassword() { - return this.accessPassword; - } - /** - * 作用说明 - **/ - public String getEffect() { - return this.effect; - } - /** - * 访问链接 - **/ - public String getAccessUrl() { - return this.accessUrl; - } - /** - * 外网ip地址 - **/ - public String getWebIpAddress() { - return this.webIpAddress; - } - /** - * 外网端口 - **/ - public String getWebPort() { - return this.webPort; - } - /** - * 其它说明 - **/ - public String getOtherRemark() { - return this.otherRemark; - } - /** - * 添加人员 - **/ - public String getCreateUserid() { - return this.createUserid; - } - /** - * 添加人员姓名 - **/ - public String getCreateUsername() { - return this.createUsername; - } - /** - * 添加时间 - **/ - public Date getCreateTime() { - return this.createTime; - } - /** - * 当前流程实例编号 - **/ - public String getBizProcInstId() { - return this.bizProcInstId; - } - /** - * 当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除 - **/ - public String getBizFlowState() { - return this.bizFlowState; - } - -} \ No newline at end of file diff --git a/xm-core/src/main/java/com/xm/core/service/XmProjectEnvListService.java b/xm-core/src/main/java/com/xm/core/service/XmProjectEnvListService.java deleted file mode 100644 index ccec015c..00000000 --- a/xm-core/src/main/java/com/xm/core/service/XmProjectEnvListService.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.xm.core.service; - -import com.mdp.core.err.BizException; -import com.mdp.core.service.BaseService; -import com.mdp.safe.client.entity.User; -import com.mdp.safe.client.utils.LoginUtils; -import com.xm.core.entity.XmProjectEnvList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.StringUtils; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -/** - * 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.
- * 组织 com.qqkj 顶级模块 oa 大模块 xm 小模块
- * 实体 XmProjectEnvList 表 XM.xm_project_env_list 当前主键(包括多主键): id; - ***/ -@Service("xm.core.xmProjectEnvListService") -public class XmProjectEnvListService extends BaseService { - - - @Autowired - XmRecordService xmRecordService; - - /** 请在此类添加自定义函数 */ - - public void addEnvList(XmProjectEnvList xmProjectEnvList) { - xmProjectEnvList.setId(this.createKey("id")); - User user = LoginUtils.getCurrentUserInfo(); - xmProjectEnvList.setCreateUserid(user.getUserid()); - xmProjectEnvList.setCreateUsername(user.getUsername()); - xmProjectEnvList.setCreateTime(new Date()); - this.insert(xmProjectEnvList); - } - - - /** - * 流程审批过程中回调该接口,更新业务数据 - * 如果发起流程时上送了restUrl,则无论流程中是否配置了监听器都会在流程发生以下事件时推送数据过来 - * eventName: PROCESS_STARTED 流程启动完成 全局 - * PROCESS_COMPLETED 流程正常结束 全局 - * PROCESS_CANCELLED 流程删除 全局 - * create 人工任务启动 - * complete 人工任务完成 - * assignment 人工任务分配给了具体的人 - * delete 人工任务被删除 - * TASK_COMPLETED_FORM_DATA_UPDATE 人工任务提交完成后,智能表单数据更新 - * - * 其中 create/complete/assignment/delete事件是需要在模型中人工节点上配置了委托代理表达式 ${taskBizCallListener}才会推送过来。 - * 在人工任务节点上配置 任务监听器 建议事件为 complete,其它assignment/create/complete/delete也可以,一般建议在complete,委托代理表达式 ${taskBizCallListener} - * - * @param flowVars {flowBranchId,agree,procInstId,startUserid,assignee,actId,taskName,mainTitle,branchId,bizKey,commentMsg,eventName,modelKey} 等 - * @return 如果tips.isOk==false,将影响流程提交 - **/ - public void processApprova(Map flowVars) { - String eventName=(String) flowVars.get("eventName"); - String agree=(String) flowVars.get("agree"); - String branchId=(String) flowVars.get("branchId"); - String envId=(String) flowVars.get("envId"); - String bizKey=(String) flowVars.get("bizKey"); - if("xm_project_env_list_approva".equals(bizKey) ) { - }else { - throw new BizException("不支持的业务,请上送业务编码【bizKey】参数"); - } - if("complete".equals(eventName)) { - if("1".equals(agree)) { - this.updateFlowStateByProcInst("", flowVars); - }else { - this.updateFlowStateByProcInst("", flowVars); - } - }else { - if("PROCESS_STARTED".equals(eventName)) { - Map bizQuery=new HashMap<>(); - bizQuery.put("envId", envId); - if(StringUtils.isEmpty(envId)) { - throw new BizException("请上送envId"); - } - if(StringUtils.isEmpty(branchId)) { - throw new BizException("请上送branchId"); - } - List> bizList=this.selectListMapByWhere(bizQuery); - if(bizList==null || bizList.size()==0) { - throw new BizException("没有找到对应环境清单,环境清单为【"+envId+"】"); - }else { - Map bizObject=bizList.get(0); - if("1".equals(bizObject.get("bizFlowState"))) { - throw new BizException("该环境清单正在审批中,不能再发起审批"); - } - } - flowVars.put("id", this.createKey("id")); - this.insert("insertProcessApprova", flowVars); - this.updateFlowStateByProcInst("1", flowVars); - }else if("PROCESS_COMPLETED".equals(eventName)) { - if("1".equals(agree)) { - this.updateFlowStateByProcInst("2", flowVars); - - }else { - this.updateFlowStateByProcInst("3", flowVars); - } - }else if("PROCESS_CANCELLED".equals(eventName)) { - this.updateFlowStateByProcInst("4", flowVars); - } - } - } - - private void updateFlowStateByProcInstForDeleteSuccess(Map flowVars) { - this.update("updateFlowStateByProcInstForDeleteSuccess", flowVars); - - } - - public void updateFlowStateByProcInst(String flowState,Map flowVars) { - flowVars.put("flowState", flowState); - flowVars.put("bizFlowState", flowState); - if("1".equals(flowState)) { - flowVars.put("bizProcInstId", flowVars.get("procInstId")); - } - this.update("updateProcessApprova", flowVars); - } - -} - diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectEnvListMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectEnvListMapper.xml deleted file mode 100644 index 465bbd81..00000000 --- a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectEnvListMapper.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into xm_project_env_list( - - ) values ( - #{id},#{remark},#{ipAddress},#{port},#{projectId},#{projectName},#{accessUserid},#{accessPassword},#{effect},#{accessUrl},#{webIpAddress},#{webPort},#{otherRemark},#{createUserid},#{createUsername},#{createTime},#{bizProcInstId},#{bizFlowState} - ) - - - - - delete from xm_project_env_list res - - - - - - - - delete from xm_project_env_list - where id = #{id} - - - - - update xm_project_env_list - - - - where id = #{id} - - - - - update xm_project_env_list - - - - where id = #{id} - - - - - - - - update xm_project_env_list - set - - where id = #{item.id} - - - - - delete from xm_project_env_list - where id in - - #{item.id } - - - - - - - id,remark,ip_address,port,project_id,project_name,access_userid,access_password,effect,access_url,web_ip_address,web_port,other_remark,create_userid,create_username,create_time,biz_proc_inst_id,biz_flow_state - - - - - and res.id = #{id} - and res.remark = #{remark} - and res.ip_address = #{ipAddress} - and res.port = #{port} - and res.project_id = #{projectId} - and res.project_name = #{projectName} - and res.access_userid = #{accessUserid} - and res.access_password = #{accessPassword} - and res.effect = #{effect} - and res.access_url = #{accessUrl} - and res.web_ip_address = #{webIpAddress} - and res.web_port = #{webPort} - and res.other_remark = #{otherRemark} - and res.create_userid = #{createUserid} - and res.create_username = #{createUsername} - and TO_CHAR(res.create_time,'YYYY-MM-DD') = TO_CHAR(#{createTime},'YYYY-MM-DD') - and res.biz_proc_inst_id = #{bizProcInstId} - and res.biz_flow_state = #{bizFlowState} - - - - remark = #{remark}, - ip_address = #{ipAddress}, - port = #{port}, - project_id = #{projectId}, - project_name = #{projectName}, - access_userid = #{accessUserid}, - access_password = #{accessPassword}, - effect = #{effect}, - access_url = #{accessUrl}, - web_ip_address = #{webIpAddress}, - web_port = #{webPort}, - other_remark = #{otherRemark}, - create_userid = #{createUserid}, - create_username = #{createUsername}, - create_time = #{createTime}, - biz_proc_inst_id = #{bizProcInstId}, - biz_flow_state = #{bizFlowState} - - - remark = #{remark}, - ip_address = #{ipAddress}, - port = #{port}, - project_id = #{projectId}, - project_name = #{projectName}, - access_userid = #{accessUserid}, - access_password = #{accessPassword}, - effect = #{effect}, - access_url = #{accessUrl}, - web_ip_address = #{webIpAddress}, - web_port = #{webPort}, - other_remark = #{otherRemark}, - create_userid = #{createUserid}, - create_username = #{createUsername}, - create_time = #{createTime}, - biz_proc_inst_id = #{bizProcInstId}, - biz_flow_state = #{bizFlowState}, - - - - remark = #{item.remark}, - ip_address = #{item.ipAddress}, - port = #{item.port}, - project_id = #{item.projectId}, - project_name = #{item.projectName}, - access_userid = #{item.accessUserid}, - access_password = #{item.accessPassword}, - effect = #{item.effect}, - access_url = #{item.accessUrl}, - web_ip_address = #{item.webIpAddress}, - web_port = #{item.webPort}, - other_remark = #{item.otherRemark}, - create_userid = #{item.createUserid}, - create_username = #{item.createUsername}, - create_time = #{item.createTime}, - biz_proc_inst_id = #{item.bizProcInstId}, - biz_flow_state = #{item.bizFlowState} - - \ No newline at end of file