|
|
@ -1,57 +1,197 @@ |
|
|
|
package org.jeecg.modules.demo.bugx.service.impl; |
|
|
|
package org.jeecg.modules.demo.bugx.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
|
|
|
|
import org.jeecg.common.system.vo.DictModel; |
|
|
|
import org.jeecg.modules.demo.bugx.entity.Bugx; |
|
|
|
import org.jeecg.modules.demo.bugx.entity.Bugx; |
|
|
|
import org.jeecg.modules.demo.bugx.mapper.BugxMapper; |
|
|
|
import org.jeecg.modules.demo.bugx.mapper.BugxMapper; |
|
|
|
import org.jeecg.modules.demo.bugx.service.IBugxService; |
|
|
|
import org.jeecg.modules.demo.bugx.service.IBugxService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.functionx.entity.Functionx; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.functionx.service.IFunctionxService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.newlayout.dto.BugDto; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.rulex.entity.Rulex; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.rulex.service.IRulexService; |
|
|
|
|
|
|
|
import org.jeecg.modules.modulex.entity.Modulex; |
|
|
|
|
|
|
|
import org.jeecg.modules.modulex.service.IModulexService; |
|
|
|
|
|
|
|
import org.jeecg.modules.projectx.entity.Projectx; |
|
|
|
|
|
|
|
import org.jeecg.modules.projectx.service.IProjectxService; |
|
|
|
|
|
|
|
import org.jeecg.modules.system.entity.SysUser; |
|
|
|
|
|
|
|
import org.jeecg.modules.system.service.ISysDictService; |
|
|
|
|
|
|
|
import org.jeecg.modules.system.service.ISysUserService; |
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @Description: BUG管理 |
|
|
|
* @Description: BUG管理 |
|
|
|
* @Author: jeecg-boot |
|
|
|
* @Author: jeecg-boot |
|
|
|
* @Date: 2023-04-11 |
|
|
|
* @Date: 2023-04-11 |
|
|
|
* @Version: V1.0 |
|
|
|
* @Version: V1.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
public class BugxServiceImpl extends ServiceImpl<BugxMapper, Bugx> implements IBugxService { |
|
|
|
public class BugxServiceImpl extends ServiceImpl<BugxMapper, Bugx> implements IBugxService { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
BugxMapper bugxMapper; |
|
|
|
BugxMapper bugxMapper; |
|
|
|
@Override |
|
|
|
|
|
|
|
public String sort(String code) { |
|
|
|
@Autowired |
|
|
|
return bugxMapper.sort(code); |
|
|
|
private ISysDictService dictService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IProjectxService projectxService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IModulexService modulexService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IFunctionxService functionxService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IRulexService rulexService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ISysUserService sysUserService; |
|
|
|
|
|
|
|
private static final String BUG_TYPE_DICT_CODE = "bug_type"; |
|
|
|
|
|
|
|
private static final String BUG_LEVEL_DICT_CODE = "work_level"; |
|
|
|
|
|
|
|
private static final String BUG_STATUS_DICT_CODE = "bug_status"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String sort(String code) { |
|
|
|
|
|
|
|
return bugxMapper.sort(code); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Result<?> shenhe(String id) { |
|
|
|
|
|
|
|
Bugx bugx = bugxMapper.selectById(id); |
|
|
|
|
|
|
|
if (bugx.getBugStatus() == 4) { |
|
|
|
|
|
|
|
if (bugx.getRuleId() != null) { |
|
|
|
|
|
|
|
bugxMapper.upRstatus(bugx.getRuleId()); |
|
|
|
|
|
|
|
} else if (bugx.getFunctionId() != null) { |
|
|
|
|
|
|
|
baseMapper.upFstatus(bugx.getFunctionId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
baseMapper.upMstatus(bugx.getModuleId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
bugxMapper.shenhe(id, new Date()); |
|
|
|
|
|
|
|
return Result.OK("审核通过!!"); |
|
|
|
|
|
|
|
} else if (bugx.getBugStatus() == 2) { |
|
|
|
|
|
|
|
return Result.error("已审核过!!!"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return Result.error("请先提交!!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
} |
|
|
|
public Result<?> shenhe(String id) { |
|
|
|
|
|
|
|
Bugx bugx = bugxMapper.selectById(id); |
|
|
|
@Override |
|
|
|
if(bugx.getBugStatus()==4){ |
|
|
|
public Result<?> bohui(String id) { |
|
|
|
if(bugx.getRuleId()!=null){ |
|
|
|
bugxMapper.bohui(id, new Date()); |
|
|
|
bugxMapper.upRstatus(bugx.getRuleId()); |
|
|
|
return Result.OK("驳回!!"); |
|
|
|
}else if(bugx.getFunctionId()!=null){ |
|
|
|
} |
|
|
|
baseMapper.upFstatus(bugx.getFunctionId()); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
baseMapper.upMstatus(bugx.getModuleId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
bugxMapper.shenhe(id,new Date()); |
|
|
|
|
|
|
|
return Result.OK("审核通过!!"); |
|
|
|
|
|
|
|
}else if(bugx.getBugStatus()==2){ |
|
|
|
|
|
|
|
return Result.error("已审核过!!!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
return Result.error("请先提交!!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<BugDto> queryBugDtoListByFunctionId(Functionx functionx) { |
|
|
|
|
|
|
|
LambdaQueryWrapper<Bugx> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
wrapper.eq(Bugx::getFunctionId, functionx.getId()); |
|
|
|
|
|
|
|
List<Bugx> bugxList = this.list(wrapper); |
|
|
|
|
|
|
|
List<BugDto> bugDtoList = new ArrayList<>(); |
|
|
|
|
|
|
|
// 将bug转为bugDto
|
|
|
|
|
|
|
|
for (Bugx bugx : bugxList) { |
|
|
|
|
|
|
|
BugDto bugDto = new BugDto(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(bugx, bugDto); |
|
|
|
|
|
|
|
// 设置功能
|
|
|
|
|
|
|
|
bugDto.setFunctionId_dictText(functionx.getFunctionName()); |
|
|
|
|
|
|
|
// 设置规则
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(bugDto.getRuleId())) { |
|
|
|
|
|
|
|
Rulex rulex = rulexService.getById(bugDto.getRuleId()); |
|
|
|
|
|
|
|
Optional.ofNullable(rulex).ifPresent(consumer -> { |
|
|
|
|
|
|
|
bugDto.setRuleId_dictText(rulex.getRuleCode()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.createBugDto(bugDto); |
|
|
|
|
|
|
|
bugDtoList.add(bugDto); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return bugDtoList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Result<?> bohui(String id) { |
|
|
|
public List<BugDto> queryBugDtoListByRuleId(Rulex rulex) { |
|
|
|
bugxMapper.bohui(id,new Date()); |
|
|
|
LambdaQueryWrapper<Bugx> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
return Result.OK("驳回!!"); |
|
|
|
wrapper.eq(Bugx::getRuleId, rulex.getId()); |
|
|
|
|
|
|
|
List<Bugx> bugxList = this.list(wrapper); |
|
|
|
|
|
|
|
List<BugDto> bugDtoList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Bugx bugx : bugxList) { |
|
|
|
|
|
|
|
BugDto bugDto = new BugDto(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(bugx, bugDto); |
|
|
|
|
|
|
|
// 设置规则
|
|
|
|
|
|
|
|
bugDto.setRuleId_dictText(rulex.getRuleCode()); |
|
|
|
|
|
|
|
this.createBugDto(bugDto); |
|
|
|
|
|
|
|
//设置功能
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(bugDto.getFunctionId())) { |
|
|
|
|
|
|
|
Functionx functionx = functionxService.getById(bugDto.getFunctionId()); |
|
|
|
|
|
|
|
Optional.ofNullable(functionx).ifPresent(consumer -> { |
|
|
|
|
|
|
|
bugDto.setFunctionId_dictText(functionx.getFunctionName()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
bugDtoList.add(bugDto); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return bugDtoList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void createBugDto(BugDto bugDto) { |
|
|
|
|
|
|
|
// 设置bug类型
|
|
|
|
|
|
|
|
List<DictModel> bugTypeList = |
|
|
|
|
|
|
|
dictService.getDictItems(BUG_TYPE_DICT_CODE); |
|
|
|
|
|
|
|
bugTypeList.forEach(type -> { |
|
|
|
|
|
|
|
if (type.getValue().equals(bugDto.getType().toString())) { |
|
|
|
|
|
|
|
bugDto.setType_dictText(type.getText()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 设置项目
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(bugDto.getProjectId())) { |
|
|
|
|
|
|
|
Projectx projectx = projectxService.getById(bugDto.getId()); |
|
|
|
|
|
|
|
Optional.ofNullable(projectx).ifPresent(consumer -> { |
|
|
|
|
|
|
|
bugDto.setProjectId_dictText(projectx.getProjectName()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 设置责任人
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(bugDto.getManagerUsers())) { |
|
|
|
|
|
|
|
String[] users = bugDto.getManagerUsers().split(","); |
|
|
|
|
|
|
|
if (users.length > 0) { |
|
|
|
|
|
|
|
List<SysUser> sysUsers = |
|
|
|
|
|
|
|
sysUserService.listByIds(Arrays.asList(users)); |
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
|
|
|
|
sysUsers.forEach(user -> sb.append(user.getRealname()).append(",")); |
|
|
|
|
|
|
|
if (sb.length() > 0) { |
|
|
|
|
|
|
|
bugDto.setManagerUsers_dictText(sb.substring(0, sb.length() - 1)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 设置模块
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(bugDto.getModuleId())) { |
|
|
|
|
|
|
|
Modulex modulex = modulexService.getById(bugDto.getModuleId()); |
|
|
|
|
|
|
|
Optional.ofNullable(modulex).ifPresent(consumer -> { |
|
|
|
|
|
|
|
bugDto.setModuleId_dictText(modulex.getModuleName()); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//设置错误级别
|
|
|
|
|
|
|
|
List<DictModel> bugLevelList = |
|
|
|
|
|
|
|
dictService.getDictItems(BUG_LEVEL_DICT_CODE); |
|
|
|
|
|
|
|
bugLevelList.forEach(level -> { |
|
|
|
|
|
|
|
if (level.getValue().equals(bugDto.getBugLevel().toString())) { |
|
|
|
|
|
|
|
bugDto.setBugLevel_dictText(level.getText()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 设置bug状态
|
|
|
|
|
|
|
|
List<DictModel> bugStatusList = |
|
|
|
|
|
|
|
dictService.getDictItems(BUG_STATUS_DICT_CODE); |
|
|
|
|
|
|
|
bugStatusList.forEach(status -> { |
|
|
|
|
|
|
|
if (status.getValue().equals(bugDto.getBugStatus().toString())) { |
|
|
|
|
|
|
|
bugDto.setBugStatus_dictText(status.getText()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|