Commit a601199c authored by 黎博's avatar 黎博

Merge branch 'master' into mock

parents b43bc524 d56c4713
...@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -34,8 +35,8 @@ public class AutoModuleController { ...@@ -34,8 +35,8 @@ public class AutoModuleController {
* @return * @return
*/ */
@GetMapping("/list") @GetMapping("/list")
public JsonResult getAutoModuleList(Integer pageNum, Integer pageSize) { public JsonResult getAutoModuleList(Integer pageNum, Integer pageSize, Integer projectId) {
IPage<AutoModule> autoModuleIPage = autoModuleService.getAutoModuleList(pageNum, pageSize); IPage<AutoModule> autoModuleIPage = autoModuleService.getAutoModuleList(pageNum, pageSize, projectId);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("total", autoModuleIPage.getTotal()); map.put("total", autoModuleIPage.getTotal());
map.put("list", autoModuleIPage.getRecords()); map.put("list", autoModuleIPage.getRecords());
......
...@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -36,18 +37,11 @@ public class InterfaceController { ...@@ -36,18 +37,11 @@ public class InterfaceController {
* @return * @return
*/ */
@GetMapping("/list") @GetMapping("/list")
public JsonResult getInterfaceList(Integer moduleId, public JsonResult getInterfaceList(Integer projectId,
Integer moduleId,
@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) { @RequestParam(defaultValue = "10") Integer pageSize) {
IPage<Interface> interfaceIPage = new Page<>(pageNum, pageSize); IPage<Interface> interfaceIPageEntity = interfaceService.getInterfaceList(projectId, moduleId, pageNum, pageSize);
IPage<Interface> interfaceIPageEntity;
if (moduleId != null) {
QueryWrapper<Interface> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("module_id", moduleId);
interfaceIPageEntity = interfaceService.page(interfaceIPage, queryWrapper);
} else {
interfaceIPageEntity = interfaceService.page(interfaceIPage);
}
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("total", interfaceIPageEntity.getTotal()); map.put("total", interfaceIPageEntity.getTotal());
map.put("list", interfaceIPageEntity.getRecords()); map.put("list", interfaceIPageEntity.getRecords());
......
package cn.qg.holmes.entity.auto; package cn.qg.holmes.entity.auto;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
...@@ -27,4 +28,8 @@ public class Interface { ...@@ -27,4 +28,8 @@ public class Interface {
private Date createTime; private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
@TableField(exist = false)
private String moduleName;
@TableField(exist = false)
private String projectName;
} }
...@@ -5,5 +5,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -5,5 +5,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
public interface AutoModuleMapper extends BaseMapper<AutoModule> { public interface AutoModuleMapper extends BaseMapper<AutoModule> {
IPage<AutoModule> getAutoModuleList(IPage<AutoModule> page); IPage<AutoModule> getAutoModuleList(IPage<AutoModule> page, Integer projectId);
} }
...@@ -2,6 +2,8 @@ package cn.qg.holmes.mapper.auto; ...@@ -2,6 +2,8 @@ package cn.qg.holmes.mapper.auto;
import cn.qg.holmes.entity.auto.Interface; import cn.qg.holmes.entity.auto.Interface;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
public interface InterfaceMapper extends BaseMapper<Interface> { public interface InterfaceMapper extends BaseMapper<Interface> {
IPage<Interface> getInterfaceList(IPage<Interface> page, Integer projectId, Integer moduleId);
} }
...@@ -7,5 +7,5 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -7,5 +7,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface AutoModuleService extends IService<AutoModule> { public interface AutoModuleService extends IService<AutoModule> {
IPage<AutoModule> getAutoModuleList(Integer pageNum, Integer pageSize); IPage<AutoModule> getAutoModuleList(Integer pageNum, Integer pageSize, Integer projectId);
} }
package cn.qg.holmes.service.auto; package cn.qg.holmes.service.auto;
import cn.qg.holmes.entity.auto.Interface; import cn.qg.holmes.entity.auto.Interface;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
public interface InterfaceService extends IService<Interface> { public interface InterfaceService extends IService<Interface> {
IPage<Interface> getInterfaceList(Integer projectId, Integer moduleId, Integer pageNum, Integer pageSize);
} }
...@@ -16,8 +16,8 @@ public class AutoModuleServiceImpl extends ServiceImpl<AutoModuleMapper, AutoMod ...@@ -16,8 +16,8 @@ public class AutoModuleServiceImpl extends ServiceImpl<AutoModuleMapper, AutoMod
AutoModuleMapper autoModuleMapper; AutoModuleMapper autoModuleMapper;
@Override @Override
public IPage<AutoModule> getAutoModuleList(Integer pageNum, Integer pageSize) { public IPage<AutoModule> getAutoModuleList(Integer pageNum, Integer pageSize, Integer projectId) {
IPage<AutoModule> page = new Page<>(pageNum, pageSize); IPage<AutoModule> page = new Page<>(pageNum, pageSize);
return autoModuleMapper.getAutoModuleList(page); return autoModuleMapper.getAutoModuleList(page, projectId);
} }
} }
package cn.qg.holmes.service.auto.impl; package cn.qg.holmes.service.auto.impl;
import cn.qg.holmes.entity.auto.AutoModule;
import cn.qg.holmes.entity.auto.Interface; import cn.qg.holmes.entity.auto.Interface;
import cn.qg.holmes.mapper.auto.InterfaceMapper; import cn.qg.holmes.mapper.auto.InterfaceMapper;
import cn.qg.holmes.service.auto.InterfaceService; import cn.qg.holmes.service.auto.InterfaceService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/**
* 自动化-接口相关service
* @author libo
*/
@Service @Service
public class InterfaceServiceImpl extends ServiceImpl<InterfaceMapper, Interface> implements InterfaceService { public class InterfaceServiceImpl extends ServiceImpl<InterfaceMapper, Interface> implements InterfaceService {
@Autowired
InterfaceMapper interfaceMapper;
@Override
public IPage<Interface> getInterfaceList(Integer projectId, Integer moduleId, Integer pageNum, Integer pageSize) {
IPage<Interface> page = new Page<>(pageNum, pageSize);
IPage<Interface> interfaceIPage = interfaceMapper.getInterfaceList(page, projectId, moduleId);
return interfaceIPage;
}
} }
...@@ -22,15 +22,22 @@ public class JiraToDingding { ...@@ -22,15 +22,22 @@ public class JiraToDingding {
@Value("${sjgd.ding.url}") @Value("${sjgd.ding.url}")
private String sjgdDingUrl; private String sjgdDingUrl;
@Value("${task.debug}")
private String taskDebug;
/** /**
* 数据工单bug统计 * 数据工单bug统计
* @throws Exception * @throws Exception
*/ */
@Scheduled(cron = "0 0 19 * * ?") @Scheduled(cron = "0 0 19 * * ?")
public void SJGDJiraIssueStatisticsTimedJob() throws Exception { public void SJGDJiraIssueStatisticsTimedJob() throws Exception {
if (taskDebug.equals("true")) {
log.info("开始执行数据工单BUG统计定时任务!"); log.info("开始执行数据工单BUG统计定时任务!");
Iterable<Issue> issues = jiraIssueService.getUnsolvedIssueListByProject("SJGD"); Iterable<Issue> issues = jiraIssueService.getUnsolvedIssueListByProject("SJGD");
String markdownMsg = DingdingUtils.buildMarkdownMsgForUnsolvedIssueList(issues); String markdownMsg = DingdingUtils.buildMarkdownMsgForUnsolvedIssueList(issues);
DingdingUtils.sendToDingding(markdownMsg, sjgdDingUrl); DingdingUtils.sendToDingding(markdownMsg, sjgdDingUrl);
} else {
log.info("当前部署的是mock,不执行定时任务!");
}
} }
} }
...@@ -52,8 +52,8 @@ public class DingdingUtils { ...@@ -52,8 +52,8 @@ public class DingdingUtils {
issueList.add(issue); issueList.add(issue);
} }
markdown.put("msgtype", "markdown"); markdown.put("msgtype", "markdown");
contentMap.put("title", "今日未解决BUG统计"); contentMap.put("title", "今日剩余未解决BUG统计");
String content = "### 今日未解决BUG数:" + issueList.size() + "\n"; String content = "#### 今日剩余未解决BUG数:" + issueList.size() + "\n";
int count = 0; int count = 0;
for (Issue issue: issueList) { for (Issue issue: issueList) {
count = count + 1; count = count + 1;
...@@ -61,8 +61,7 @@ public class DingdingUtils { ...@@ -61,8 +61,7 @@ public class DingdingUtils {
content = content + count + "、[" + issue.getSummary().replace("\"", "") + "](" + issueUrl + ")\n"; content = content + count + "、[" + issue.getSummary().replace("\"", "") + "](" + issueUrl + ")\n";
content = content + "- 优先级:" + issue.getPriority().getName() + "\n"; content = content + "- 优先级:" + issue.getPriority().getName() + "\n";
content = content + "- 状态:" + issue.getStatus().getName() + "\n"; content = content + "- 状态:" + issue.getStatus().getName() + "\n";
content = content + "- 经办人:" + issue.getAssignee().getDisplayName() + "\n"; content = content + "- 经办人:" + issue.getAssignee().getDisplayName() + "\n\n";
content = content + "\n";
} }
contentMap.put("text", content); contentMap.put("text", content);
markdown.put("markdown", contentMap); markdown.put("markdown", contentMap);
......
...@@ -7,5 +7,8 @@ ...@@ -7,5 +7,8 @@
p.`name` as projectName p.`name` as projectName
from `auto_module` a, auto_project p from `auto_module` a, auto_project p
where a.`project_id` = p.`id` where a.`project_id` = p.`id`
<if test="projectId != null and projectId != ''">
AND a.`project_id` = #{projectId}
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.qg.holmes.mapper.auto.InterfaceMapper">
<select id="getInterfaceList" resultType="cn.qg.holmes.entity.auto.Interface">
SELECT it.*, am.`name` as moduleName, ap.`name` as projectName
FROM `interface` AS `it`
INNER JOIN `auto_module` AS `am` on it.`module_id` = am.`id`
INNER JOIN `auto_project` AS `ap` on am.`project_id` = ap.`id`
WHERE 1=1
<if test="projectId != null and projectId !=''">
AND ap.`id`= #{projectId}
</if>
<if test="moduleId != null and moduleId != ''">
AND am.`id` = #{moduleId}
</if>
</select>
</mapper>
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
select stc.* from scene_testcase as stc select stc.* from scene_testcase as stc
left join scene as sc ON stc.`scene_id`=sc.`id` left join scene as sc ON stc.`scene_id`=sc.`id`
<if test="projectId != null"> <if test="projectId != null">
WHERE sc.`id`=#{projectId} WHERE sc.`id`= #{projectId}
</if> </if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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