Commit 72d8be80 authored by mcb's avatar mcb

Merge branch 'dmp_dev' of http://gitlab.ioubuy.cn/yaobenzhang/jz-dmp-service into dmp_dev

parents c6268406 17937e6b
......@@ -3,8 +3,11 @@ package com.jz.dmp.azkaban.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.jz.dmp.azkaban.entity.ProjectFlows;
import com.jz.dmp.modules.controller.azkaban.bean.ProjectFlowsDto;
import com.jz.dmp.modules.controller.bean.IndexProjAzkabanStatuDto;
/** mapper
* @author ybz
......@@ -94,5 +97,15 @@ public interface ProjectFlowsMapper {
* @throws Exception
*/
public void insertBatch(List<ProjectFlows> projectFlowss)throws Exception;
/**
* @Title: projAzkabanStatu
* @Description: TODO(统计任务运行状况)
* @param @return
* @param @throws Exception 参数
* @return IndexProjAzkabanStatuDto 返回类型
* @throws
*/
public IndexProjAzkabanStatuDto projAzkabanStatu(@Param("projectName")String projectName)throws Exception;
}
......@@ -15,6 +15,7 @@ import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.dmp.modules.controller.bean.DmpProjectDto;
import com.jz.dmp.modules.controller.bean.DmpProjectRequest;
import com.jz.dmp.modules.controller.bean.IndexProjAzkabanStatuDto;
import com.jz.dmp.modules.model.DmpProject;
import com.jz.dmp.modules.service.DmpProjectService;
......@@ -93,4 +94,23 @@ public class DmpProjectController {
return baseBeanResponse;
}
/**首页个人工作台项目运行统计
* @param dmpProjectRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/projAzkabanStatu")
@ApiOperation(value = "首页个人工作台项目运行统计", notes = "首页个人工作台项目运行统计")
public BaseBeanResponse<IndexProjAzkabanStatuDto> projAzkabanStatu(@RequestParam(name = "projectId", required = true) Integer projectId, HttpServletRequest httpRequest){
BaseBeanResponse<IndexProjAzkabanStatuDto> baseBeanResponse = new BaseBeanResponse<IndexProjAzkabanStatuDto>();
try {
baseBeanResponse = dmpProjectService.projAzkabanStatu(projectId, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("项目运行统计失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
}
package com.jz.dmp.modules.controller.bean;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: IndexProjAzkabanStatuDto
* @Description: TODO(工作台项目运行统计)
* @author ybz
* @date 2021年1月11日
*
*/
@ApiModel(value = "工作台项目运行统计封装", description = "工作台项目运行统计封装")
public class IndexProjAzkabanStatuDto implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "未运行任务数")
private Integer unRunCount;
@ApiModelProperty(value = "运行失败数")
private Integer failCount;
@ApiModelProperty(value = "运行成功数")
private Integer successCount;
public Integer getUnRunCount() {
return unRunCount;
}
public void setUnRunCount(Integer unRunCount) {
this.unRunCount = unRunCount;
}
public Integer getFailCount() {
return failCount;
}
public void setFailCount(Integer failCount) {
this.failCount = failCount;
}
public Integer getSuccessCount() {
return successCount;
}
public void setSuccessCount(Integer successCount) {
this.successCount = successCount;
}
}
......@@ -214,4 +214,28 @@ public class DmpMemberController {
return baseBeanResponse;
}
/**获取项目下不是成员的所有用户
* @param dmpMemberRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findListUnChoose")
@ApiOperation(value = "获取项目下不是成员的所有用户", notes = "获取项目下不是成员的所有用户")
@ApiImplicitParam(name = "projectId", value = "项目主键")
public BaseBeanResponse<DmpMemberDto> findListUnChoose(@RequestParam(name = "projectId", required = true) Integer projectId, HttpServletRequest httpRequest){
//封装参数
DmpMemberRequest dmpMemberRequest = new DmpMemberRequest();
dmpMemberRequest.setUnChooseProjId(projectId);
BaseBeanResponse<DmpMemberDto> baseBeanResponse = new BaseBeanResponse<DmpMemberDto>();
try {
baseBeanResponse = dmpMemberService.findList(dmpMemberRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
}
......@@ -126,6 +126,9 @@ public class DmpMemberRequest extends BasePageBean {
@ApiModelProperty(value = "项目主键")
private Integer projectId;
@ApiModelProperty(value = "非该项目主键")//过滤已经是该项目的用户
private Integer unChooseProjId;
public Integer getUserId() {
return userId;
......@@ -286,5 +289,13 @@ public class DmpMemberRequest extends BasePageBean {
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
public Integer getUnChooseProjId() {
return unChooseProjId;
}
public void setUnChooseProjId(Integer unChooseProjId) {
this.unChooseProjId = unChooseProjId;
}
}
......@@ -8,6 +8,7 @@ import com.jz.common.bean.PageInfoResponse;
import com.jz.dmp.modules.controller.bean.DmpProjectBatch;
import com.jz.dmp.modules.controller.bean.DmpProjectDto;
import com.jz.dmp.modules.controller.bean.DmpProjectRequest;
import com.jz.dmp.modules.controller.bean.IndexProjAzkabanStatuDto;
import com.jz.dmp.modules.model.DmpProject;
......@@ -42,5 +43,15 @@ public interface DmpProjectService {
*/
public BaseBeanResponse<DmpProject> add(DmpProject dmpProject, HttpServletRequest httpRequest)throws Exception;
/**
* @Title: projAzkabanStatu
* @Description: TODO(统计azkaban任务运行情况)
* @param @param httpRequest
* @param @return 参数
* @return BaseBeanResponse<IndexProjAzkabanStatuDto> 返回类型
* @throws
*/
public BaseBeanResponse<IndexProjAzkabanStatuDto> projAzkabanStatu(Integer projectId,HttpServletRequest httpRequest)throws Exception;
}
......@@ -22,8 +22,10 @@ import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.azkaban.dao.ProjectFlowsMapper;
import com.jz.dmp.modules.controller.bean.DmpProjectDto;
import com.jz.dmp.modules.controller.bean.DmpProjectRequest;
import com.jz.dmp.modules.controller.bean.IndexProjAzkabanStatuDto;
import com.jz.dmp.modules.controller.bean.MyDmpProjectConverter;
import com.jz.dmp.modules.dao.DmpProjectDao;
import com.jz.dmp.modules.model.DmpMember;
......@@ -43,6 +45,9 @@ public class DmpProjectServiceImpl extends BaseService implements DmpProjectServ
@Autowired
private DmpProjectDao dmpProjectDao;
@Autowired
private ProjectFlowsMapper projectFlowsMapper;
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpProjectService#findList(com.ycxc.vmts.controller.bean.DmpProjectRequest, javax.servlet.http.HttpServletRequest)
*/
......@@ -217,5 +222,20 @@ public class DmpProjectServiceImpl extends BaseService implements DmpProjectServ
return baseBeanResponse;
}
/**
*统计任务运行状况
*/
@Override
public BaseBeanResponse<IndexProjAzkabanStatuDto> projAzkabanStatu(Integer projectId, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<IndexProjAzkabanStatuDto> baseBeanResponse = new BaseBeanResponse<IndexProjAzkabanStatuDto>();
String projectName = "jz_workflow_"+projectId;
IndexProjAzkabanStatuDto dto = projectFlowsMapper.projAzkabanStatu(projectName);
baseBeanResponse.setCode(StatuConstant.CODE_SUCCESS);
baseBeanResponse.setMessage("统计成功");
baseBeanResponse.setData(dto);
return baseBeanResponse;
}
}
......@@ -257,6 +257,10 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic
if (dmpMemberRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpMemberRequest.getUpdateTimeEnd());
}
// 项目主键(用户过滤该项目下的成员)
if (dmpMemberRequest.getUnChooseProjId() != null) {
param.put("unChooseProjId", dmpMemberRequest.getUnChooseProjId());
}
List<DmpMemberDto> list = dmpMemberMapper.findList(param);
......
......@@ -249,5 +249,16 @@
where project_id = #{projectId,jdbcType=INTEGER}
AND data_status='1'
</select>
<!-- 统计任务运行状况 -->
<select id="projAzkabanStatu" resultType="com.jz.dmp.modules.controller.bean.IndexProjAzkabanStatuDto">
select
COUNT(CASE WHEN execFlows.exec_id is NULL THEN 1 ELSE NULL END) AS unRunCount,
COUNT(CASE WHEN execFlows.`status`='70' THEN 1 ELSE NULL END) AS failCount,
COUNT(CASE WHEN execFlows.`status`='50' THEN 1 ELSE NULL END) AS successCount
from project_flows flows left join execution_flows execFlows on flows.flow_id=execFlows.flow_id AND flows.project_id=execFlows.project_id
left join projects projects on flows.project_id=projects.id
where projects.`name`=#{projectName, jdbcType=VARCHAR};
</select>
</mapper>
......@@ -337,6 +337,10 @@
<if test="projectId != null" >
AND mprole.project_id = #{projectId,jdbcType=INTEGER}
</if>
<if test="unChooseProjId != null" >
AND mprole.project_id <![CDATA[<>]]> #{unChooseProjId,jdbcType=INTEGER}
OR mprole.project_id is null
</if>
AND m.data_status='1'
</where>
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment