use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class StateMachineClientServiceImpl method updateStatus.
@UpdateStatus(code = UPDATE_STATUS)
public void updateStatus(Long instanceId, Long targetStatusId, String input) {
IssueDTO issue = issueMapper.selectByPrimaryKey(instanceId);
if (issue == null) {
throw new CommonException("error.updateStatus.instanceId.notFound");
}
if (targetStatusId == null) {
throw new CommonException("error.updateStatus.targetStateId.null");
}
if (issue.getStatusId().equals(targetStatusId)) {
return;
}
Long triggerIssueId = null;
Boolean autoTranferFlag = null;
if (input != null && !Objects.equals(input, "null")) {
JSONObject jsonObject = JSON.parseObject(input, JSONObject.class);
triggerIssueId = jsonObject.getLong(TRIGGER_ISSUE_ID);
autoTranferFlag = jsonObject.getBoolean(AUTO_TRANFER_FLAG);
}
IssueUpdateVO issueUpdateVO = issueAssembler.toTarget(issue, IssueUpdateVO.class);
issueUpdateVO.setStatusId(targetStatusId);
if (Objects.nonNull(triggerIssueId)) {
IssueDTO issueDTO = issueMapper.selectByPrimaryKey(triggerIssueId);
issueUpdateVO.setAutoTranferFlag(autoTranferFlag);
issueUpdateVO.setAutoTriggerId(triggerIssueId);
issueUpdateVO.setAutoTriggerNum(projectInfoMapper.selectProjectCodeByProjectId(issueDTO.getProjectId()) + "-" + issueDTO.getIssueNum());
}
issueService.handleUpdateIssueWithoutRuleNotice(issueUpdateVO, new ArrayList<>(Collections.singletonList(STATUS_ID)), issue.getProjectId());
logger.info("stateMachine updateStatus successful");
}
use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class StateMachineClientServiceImpl method justReporter.
@Condition(code = "just_reporter", name = "仅允许报告人", description = "只有该报告人才能执行转换")
public Boolean justReporter(Long instanceId, StateMachineConfigDTO configDTO) {
IssueDTO issue = issueMapper.selectByPrimaryKey(instanceId);
Long currentUserId = DetailsHelper.getUserDetails().getUserId();
return issue != null && issue.getReporterId() != null && issue.getReporterId().equals(currentUserId);
}
use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class ExcelCommonServiceImpl method checkEpicNameExist.
private Boolean checkEpicNameExist(Long projectId, String epicName) {
IssueDTO issueDTO = new IssueDTO();
issueDTO.setProjectId(projectId);
issueDTO.setEpicName(epicName);
List<IssueDTO> issueDTOList = issueMapper.select(issueDTO);
return issueDTOList == null || issueDTOList.isEmpty();
}
use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class ExcelCommonServiceImpl method validateAndSetFeature.
private void validateAndSetFeature(Row row, Integer col, ExcelColumnVO excelColumn, Map<Integer, List<Integer>> errorRowColMap, IssueCreateVO issueCreateVO, String issueTypeCode, String issueType) {
if (IssueTypeCode.AGILE_PARENT_ISSUE_TYPES.contains(issueTypeCode) && !SUB_BUG_CN.equals(issueType)) {
Cell cell = row.getCell(col);
if (!isCellEmpty(cell)) {
int rowNum = row.getRowNum();
String value = cell.toString();
List<String> values = excelColumn.getPredefinedValues();
Map<String, Long> valueIdMap = excelColumn.getValueIdMap();
if (!values.contains(value)) {
cell.setCellValue(buildWithErrorMsg(value, "所属特性输入错误"));
addErrorColumn(rowNum, col, errorRowColMap);
} else {
Long featureId = valueIdMap.get(value);
issueCreateVO.setFeatureId(featureId);
// 如果特性关联史诗,也要设置史诗id
IssueDTO feature = issueMapper.selectByPrimaryKey(featureId);
if (feature != null && Objects.equals(0L, feature.getEpicId())) {
issueCreateVO.setEpicId(feature.getEpicId());
}
}
}
}
}
use of io.choerodon.agile.infra.dto.business.IssueDTO in project agile-service by open-hand.
the class ExcelServiceImpl method validateData.
private void validateData(Long projectId, Row row, Map<Integer, ExcelColumnVO> headerMap, Set<Integer> withoutParentRows, Map<Integer, List<Integer>> errorRowColMap, IssueCreateVO issueCreateVO, IssueVO parentIssue, int issueTypeCol, int parentCol, Map<Long, List<String>> requireFieldMap) {
issueCreateVO.setProjectId(projectId);
int rowNum = row.getRowNum();
Cell issueTypeCell = row.getCell(issueTypeCol);
if (issueTypeCell == null) {
issueTypeCell = row.createCell(issueTypeCol);
}
String value = "";
if (isCellEmpty(issueTypeCell)) {
issueTypeCell.setCellValue(buildWithErrorMsg(value, IssueConstant.ISSUE_TYPE_CN + "为空"));
addErrorColumn(rowNum, issueTypeCol, errorRowColMap);
return;
}
value = issueTypeCell.toString();
if (withoutParentRows.contains(rowNum)) {
issueTypeCell.setCellValue(buildWithErrorMsg(value, "子任务/子缺陷必须要有父节点"));
addErrorColumn(rowNum, issueTypeCol, errorRowColMap);
return;
}
String issueTypeCode = getIssueTypeCode(headerMap, value);
if (parentIssue == null && (IssueTypeCode.isSubTask(issueTypeCode) || SUB_BUG_CN.equals(value))) {
Cell parentCell = row.getCell(parentCol);
if (parentCell == null) {
parentCell = row.createCell(parentCol);
}
String parentCellValue = "";
if (isCellEmpty(parentCell)) {
issueTypeCell.setCellValue(buildWithErrorMsg(parentCellValue, "子任务/子缺陷必须要有父节点"));
addErrorColumn(rowNum, parentCol, errorRowColMap);
return;
}
parentCellValue = parentCell.toString();
List<String> values = headerMap.get(parentCol).getPredefinedValues();
String issueNum = parentCellValue.split(COLON_CN)[0];
if (!values.contains(issueNum)) {
parentCell.setCellValue(buildWithErrorMsg(parentCellValue, "输入的父级编号有误"));
addErrorColumn(rowNum, parentCol, errorRowColMap);
return;
}
parentIssue = issueMapper.selectByIssueNum(projectId, issueNum);
if (parentIssue == null) {
issueTypeCell.setCellValue(buildWithErrorMsg(parentCellValue, "父节点不存在"));
addErrorColumn(rowNum, parentCol, errorRowColMap);
return;
}
IssueDTO issueDTO = issueMapper.queryIssueSprintNotClosed(projectId, parentIssue.getIssueId());
parentIssue.setSprintId(issueDTO.getSprintId());
}
for (Map.Entry<Integer, ExcelColumnVO> entry : headerMap.entrySet()) {
Integer col = entry.getKey();
ExcelColumnVO excelColumn = entry.getValue();
boolean isCustomField = excelColumn.isCustomField();
excelCommonService.handlerRequireFiled(excelColumn, requireFieldMap, issueCreateVO, projectId);
Boolean checkRequireField = excelCommonService.checkRequireField(requireFieldMap, excelColumn, issueCreateVO, row, col, errorRowColMap);
if (!checkRequireField) {
break;
}
if (isCustomField) {
excelCommonService.validateCustomFieldData(row, col, excelColumn, errorRowColMap, issueCreateVO);
} else {
excelCommonService.validateCommonSystemFieldData(row, col, excelColumn, errorRowColMap, issueCreateVO, parentIssue, projectId, headerMap);
}
}
}
Aggregations