|
|
@ -59,10 +59,13 @@ public class SzPlanService extends BaseService<SzPlanMapper, SzPlan> { |
|
|
|
} |
|
|
|
|
|
|
|
public SzPlanDetailDto getDetailById(String id) { |
|
|
|
SzPlan SzPlan = this.getById(id); |
|
|
|
SzPlanDetailDto dto = BeanCopyUtils.copy(SzPlan, SzPlanDetailDto.class); |
|
|
|
SzPlan szPlan = this.getById(id); |
|
|
|
SzPlanDetailDto dto = BeanCopyUtils.copy(szPlan, SzPlanDetailDto.class); |
|
|
|
if (dto != null) { |
|
|
|
dto.setOtherConfig(JSON.parseObject(SzPlan.getOtherConfig())); |
|
|
|
dto.setOtherConfig(JSON.parseObject(szPlan.getOtherConfig())); |
|
|
|
if (StringUtils.isNotEmpty(szPlan.getFiles())) { |
|
|
|
dto.setFiles(JSON.parseArray(szPlan.getFiles(), String.class)); |
|
|
|
} |
|
|
|
Wrapper<SzPlanOperator> wp = Wrappers.<SzPlanOperator>lambdaQuery() |
|
|
|
.select(SzPlanOperator::getId, SzPlanOperator::getOperatorUid, |
|
|
|
SzPlanOperator::getOperatorName) |
|
|
@ -86,6 +89,7 @@ public class SzPlanService extends BaseService<SzPlanMapper, SzPlan> { |
|
|
|
szPlan.setId(null); |
|
|
|
if (checkNameDistinct(szPlan.getId(), szPlan.getName())) { |
|
|
|
szPlan.setOtherConfig(JSON.toJSONString(dto.getOtherConfig())); |
|
|
|
szPlan.setFiles(JSON.toJSONString(dto.getFiles())); |
|
|
|
getBaseMapper().insert(szPlan); |
|
|
|
String id = szPlan.getId(); |
|
|
|
if (CollectionUtil.isNotEmpty(dto.getOperators())) { |
|
|
@ -113,12 +117,13 @@ public class SzPlanService extends BaseService<SzPlanMapper, SzPlan> { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public SzPlanDetailDto update(SzPlanDetailDto dto) { |
|
|
|
if (exist(dto.getId())) { |
|
|
|
SzPlan SzPlan = BeanCopyUtils.copy(dto, SzPlan.class); |
|
|
|
if (SzPlan != null) { |
|
|
|
if (checkNameDistinct(SzPlan.getId(), SzPlan.getName())) { |
|
|
|
SzPlan.setOtherConfig(JSON.toJSONString(dto.getOtherConfig())); |
|
|
|
getBaseMapper().updateById(SzPlan); |
|
|
|
String id = SzPlan.getId(); |
|
|
|
SzPlan szPlan = BeanCopyUtils.copy(dto, SzPlan.class); |
|
|
|
if (szPlan != null) { |
|
|
|
if (checkNameDistinct(szPlan.getId(), szPlan.getName())) { |
|
|
|
szPlan.setOtherConfig(JSON.toJSONString(dto.getOtherConfig())); |
|
|
|
szPlan.setFiles(JSON.toJSONString(dto.getFiles())); |
|
|
|
getBaseMapper().updateById(szPlan); |
|
|
|
String id = szPlan.getId(); |
|
|
|
deleteItems(id); |
|
|
|
if (CollectionUtil.isNotEmpty(dto.getOperators())) { |
|
|
|
dto.getOperators().forEach(insertOperator(id)); |
|
|
@ -145,6 +150,7 @@ public class SzPlanService extends BaseService<SzPlanMapper, SzPlan> { |
|
|
|
} |
|
|
|
return rt; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isUse(String id) { |
|
|
|
Wrapper<SzRecord> wp = Wrappers.<SzRecord>lambdaQuery() |
|
|
|
.eq(SzRecord::getPlanId, id); |
|
|
|