|
|
@@ -8,16 +8,23 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.dromara.physical.domain.PhysicalJudge;
|
|
|
import org.dromara.physical.domain.PhysicalJudgePositionRelation;
|
|
|
import org.dromara.physical.domain.bo.PhysicalJudgePositionRelationBo;
|
|
|
import org.dromara.physical.domain.vo.PhysicalJudgePositionRelationVo;
|
|
|
+import org.dromara.physical.domain.vo.PhysicalJudgePositionVo;
|
|
|
+import org.dromara.physical.domain.vo.PhysicalJudgeVo;
|
|
|
+import org.dromara.physical.mapper.PhysicalJudgeMapper;
|
|
|
+import org.dromara.physical.mapper.PhysicalJudgePositionMapper;
|
|
|
import org.dromara.physical.mapper.PhysicalJudgePositionRelationMapper;
|
|
|
import org.dromara.physical.service.IPhysicalJudgePositionRelationService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Collection;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 裁判职务关联(支持待配置状态)Service业务层处理
|
|
|
@@ -32,6 +39,10 @@ public class PhysicalJudgePositionRelationServiceImpl implements IPhysicalJudgeP
|
|
|
|
|
|
private final PhysicalJudgePositionRelationMapper baseMapper;
|
|
|
|
|
|
+ private final PhysicalJudgePositionMapper physicalJudgePositionMapper;
|
|
|
+
|
|
|
+ private final PhysicalJudgeMapper physicalJudgeMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询裁判职务关联(支持待配置状态)
|
|
|
*
|
|
|
@@ -40,7 +51,25 @@ public class PhysicalJudgePositionRelationServiceImpl implements IPhysicalJudgeP
|
|
|
*/
|
|
|
@Override
|
|
|
public PhysicalJudgePositionRelationVo queryById(Long id){
|
|
|
- return baseMapper.selectJudgePositionRelationById(id);
|
|
|
+ PhysicalJudgePositionRelationVo physicalJudgePositionRelationVo = baseMapper.selectJudgePositionRelationById(id);
|
|
|
+ if(physicalJudgePositionRelationVo!=null){
|
|
|
+ Long positionId = physicalJudgePositionRelationVo.getPositionId();
|
|
|
+ Long judgeId = physicalJudgePositionRelationVo.getJudgeId();
|
|
|
+ PhysicalJudgePositionVo physicalJudgePositionVo = physicalJudgePositionMapper.selectJudgePositionById(positionId);
|
|
|
+ if(physicalJudgePositionVo!=null){
|
|
|
+ physicalJudgePositionRelationVo.setPositionName(physicalJudgePositionVo.getName());
|
|
|
+ }
|
|
|
+ PhysicalJudgeVo physicalJudgeVo = physicalJudgeMapper.selectPhysicalJudgeById(judgeId);
|
|
|
+ if(physicalJudgeVo!=null){
|
|
|
+ physicalJudgePositionRelationVo.setJudgeName(physicalJudgeVo.getName());
|
|
|
+ physicalJudgePositionRelationVo.setName(physicalJudgeVo.getName());
|
|
|
+ physicalJudgePositionRelationVo.setPeopleIconUrl(physicalJudgeVo.getPeopleIconUrl());
|
|
|
+ physicalJudgePositionRelationVo.setJudgeNumber(physicalJudgeVo.getJudgeNumber());
|
|
|
+ physicalJudgePositionRelationVo.setWorkYears(physicalJudgeVo.getWorkYears());
|
|
|
+ physicalJudgePositionRelationVo.setJudgeId(physicalJudgeVo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return physicalJudgePositionRelationVo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -54,6 +83,24 @@ public class PhysicalJudgePositionRelationServiceImpl implements IPhysicalJudgeP
|
|
|
public TableDataInfo<PhysicalJudgePositionRelationVo> queryPageList(PhysicalJudgePositionRelationBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<PhysicalJudgePositionRelation> lqw = buildQueryWrapper(bo);
|
|
|
Page<PhysicalJudgePositionRelationVo> result = baseMapper.selectJudgePositionRelationPage(pageQuery.build(), lqw);
|
|
|
+ List<PhysicalJudgePositionRelationVo> relationVoList = result.getRecords();
|
|
|
+ for (PhysicalJudgePositionRelationVo physicalJudgePositionRelationVo : relationVoList) {
|
|
|
+ Long positionId = physicalJudgePositionRelationVo.getPositionId();
|
|
|
+ Long judgeId = physicalJudgePositionRelationVo.getJudgeId();
|
|
|
+ PhysicalJudgePositionVo physicalJudgePositionVo = physicalJudgePositionMapper.selectJudgePositionById(positionId);
|
|
|
+ if(physicalJudgePositionVo!=null){
|
|
|
+ physicalJudgePositionRelationVo.setPositionName(physicalJudgePositionVo.getName());
|
|
|
+ }
|
|
|
+ PhysicalJudgeVo physicalJudgeVo = physicalJudgeMapper.selectPhysicalJudgeById(judgeId);
|
|
|
+ if(physicalJudgeVo!=null){
|
|
|
+ physicalJudgePositionRelationVo.setJudgeName(physicalJudgeVo.getName());
|
|
|
+ physicalJudgePositionRelationVo.setName(physicalJudgeVo.getName());
|
|
|
+ physicalJudgePositionRelationVo.setPeopleIconUrl(physicalJudgeVo.getPeopleIconUrl());
|
|
|
+ physicalJudgePositionRelationVo.setJudgeNumber(physicalJudgeVo.getJudgeNumber());
|
|
|
+ physicalJudgePositionRelationVo.setWorkYears(physicalJudgeVo.getWorkYears());
|
|
|
+ physicalJudgePositionRelationVo.setJudgeId(physicalJudgeVo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
|
@@ -85,16 +132,34 @@ public class PhysicalJudgePositionRelationServiceImpl implements IPhysicalJudgeP
|
|
|
* @return 是否新增成功
|
|
|
*/
|
|
|
@Override
|
|
|
+ //@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean insertByBo(PhysicalJudgePositionRelationBo bo) {
|
|
|
- PhysicalJudgePositionRelation add = MapstructUtils.convert(bo, PhysicalJudgePositionRelation.class);
|
|
|
- validEntityBeforeSave(add);
|
|
|
- boolean flag = baseMapper.insertJudgePositionRelation(add) > 0;
|
|
|
- if (flag) {
|
|
|
- bo.setId(add.getId());
|
|
|
+ PhysicalJudgePositionRelation baseEntity = MapstructUtils.convert(bo, PhysicalJudgePositionRelation.class);
|
|
|
+ validEntityBeforeSave(baseEntity);
|
|
|
+
|
|
|
+ List<Long> judgeIdList = bo.getJudgeIdList();
|
|
|
+ if (judgeIdList == null || judgeIdList.isEmpty()) {
|
|
|
+ log.warn("裁判ID列表为空,无法新增裁判职务关联");
|
|
|
+ return false;
|
|
|
}
|
|
|
- return flag;
|
|
|
+
|
|
|
+ boolean allSuccess = true;
|
|
|
+ for (Long judgeId : judgeIdList) {
|
|
|
+ PhysicalJudgePositionRelation add = MapstructUtils.convert(bo, PhysicalJudgePositionRelation.class);
|
|
|
+ add.setJudgeId(judgeId);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+
|
|
|
+ boolean flag = baseMapper.insertJudgePositionRelation(add) > 0;
|
|
|
+ if (!flag) {
|
|
|
+ log.error("新增裁判职务关联失败,裁判ID: {}", judgeId);
|
|
|
+ allSuccess = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return allSuccess;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 修改裁判职务关联(支持待配置状态)
|
|
|
*
|
|
|
@@ -105,7 +170,14 @@ public class PhysicalJudgePositionRelationServiceImpl implements IPhysicalJudgeP
|
|
|
public Boolean updateByBo(PhysicalJudgePositionRelationBo bo) {
|
|
|
PhysicalJudgePositionRelation update = MapstructUtils.convert(bo, PhysicalJudgePositionRelation.class);
|
|
|
validEntityBeforeSave(update);
|
|
|
- return baseMapper.updateJudgePositionRelationById(update) > 0;
|
|
|
+ Long workYears = bo.getWorkYears();
|
|
|
+ int updated = baseMapper.updateJudgePositionRelationById(update);
|
|
|
+ PhysicalJudge update1 = new PhysicalJudge();
|
|
|
+ update1.setWorkYears(workYears);
|
|
|
+ update1.setId(bo.getJudgeId());
|
|
|
+ physicalJudgeMapper.updatePhysicalJudgeById(update1);
|
|
|
+
|
|
|
+ return updated > 0;
|
|
|
}
|
|
|
|
|
|
/**
|