|
@@ -1,9 +1,11 @@
|
|
|
package com.citu.module.menduner.system.service.talent;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.codec.Base64Decoder;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.citu.framework.common.pojo.PageResult;
|
|
|
import com.citu.framework.common.util.object.BeanUtils;
|
|
|
+import com.citu.module.infra.api.file.FileApi;
|
|
|
import com.citu.module.menduner.system.controller.base.talent.TalentMapDetailRespVO;
|
|
|
import com.citu.module.menduner.system.controller.base.talent.TalentMapSaveReqVO;
|
|
|
import com.citu.module.menduner.system.controller.base.talent.edu.TalentMapEduExpRespVO;
|
|
@@ -19,10 +21,7 @@ import com.citu.module.menduner.system.dal.dataobject.talent.TalentMapEduExpDO;
|
|
|
import com.citu.module.menduner.system.dal.dataobject.talent.TalentMapInfoDO;
|
|
|
import com.citu.module.menduner.system.dal.dataobject.talent.TalentMapTrainExpDO;
|
|
|
import com.citu.module.menduner.system.dal.dataobject.talent.TalentMapWorkExpDO;
|
|
|
-import com.citu.module.menduner.system.dal.mysql.talent.TalentMapEduExpMapper;
|
|
|
import com.citu.module.menduner.system.dal.mysql.talent.TalentMapInfoMapper;
|
|
|
-import com.citu.module.menduner.system.dal.mysql.talent.TalentMapTrainExpMapper;
|
|
|
-import com.citu.module.menduner.system.dal.mysql.talent.TalentMapWorkExpMapper;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -55,6 +54,9 @@ public class TalentMapInfoServiceImpl implements TalentMapInfoService {
|
|
|
@Resource
|
|
|
private TalentMapTrainExpService talentMapTrainExpService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private FileApi fileApi;
|
|
|
+
|
|
|
@Override
|
|
|
public Long createTalentMapInfo(TalentMapInfoSaveReqVO createReqVO) {
|
|
|
// 插入
|
|
@@ -74,11 +76,15 @@ public class TalentMapInfoServiceImpl implements TalentMapInfoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @DSTransactional
|
|
|
public void deleteTalentMapInfo(Long id) {
|
|
|
// 校验存在
|
|
|
validateTalentMapInfoExists(id);
|
|
|
// 删除
|
|
|
talentMapInfoMapper.deleteById(id);
|
|
|
+ talentMapEduExpService.deleteByPersonId(id);
|
|
|
+ talentMapWorkExpService.deleteByPersonId(id);
|
|
|
+ talentMapTrainExpService.deleteByPersonId(id);
|
|
|
}
|
|
|
|
|
|
private void validateTalentMapInfoExists(Long id) {
|
|
@@ -92,6 +98,30 @@ public class TalentMapInfoServiceImpl implements TalentMapInfoService {
|
|
|
return talentMapInfoMapper.selectById(id);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public TalentMapDetailRespVO detail(Long id) {
|
|
|
+ TalentMapInfoDO info = talentMapInfoMapper.selectById(id);
|
|
|
+ TalentMapDetailRespVO resp = new TalentMapDetailRespVO();
|
|
|
+ // 基本信息
|
|
|
+ resp.setPerson(BeanUtils.toBean(info, TalentMapInfoRespVO.class));
|
|
|
+ // 教育经历
|
|
|
+ List<TalentMapEduExpDO> eduList = talentMapEduExpService.selectListByPersonId(info.getId());
|
|
|
+ if (ObjectUtils.isNotEmpty(eduList)) {
|
|
|
+ resp.setEduList(BeanUtils.toBean(eduList, TalentMapEduExpRespVO.class));
|
|
|
+ }
|
|
|
+ // 工作经历
|
|
|
+ List<TalentMapWorkExpDO> workList = talentMapWorkExpService.selectListByPersonId(info.getId());
|
|
|
+ if (ObjectUtils.isNotEmpty(workList)) {
|
|
|
+ resp.setWorkList(BeanUtils.toBean(workList, TalentMapWorkExpRespVO.class));
|
|
|
+ }
|
|
|
+ // 培训经历
|
|
|
+ List<TalentMapTrainExpDO> trainList = talentMapTrainExpService.selectListByPersonId(info.getId());
|
|
|
+ if (ObjectUtils.isNotEmpty(trainList)) {
|
|
|
+ resp.setTrainList(BeanUtils.toBean(trainList, TalentMapTrainExpRespVO.class));
|
|
|
+ }
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public PageResult<TalentMapInfoDO> getTalentMapInfoPage(TalentMapInfoPageReqVO pageReqVO) {
|
|
|
return talentMapInfoMapper.selectPage(pageReqVO);
|
|
@@ -132,11 +162,20 @@ public class TalentMapInfoServiceImpl implements TalentMapInfoService {
|
|
|
@DSTransactional
|
|
|
public void add(TalentMapSaveReqVO reqVO) {
|
|
|
TalentMapInfoDO talentMapInfo = BeanUtils.toBean(reqVO.getPerson(), TalentMapInfoDO.class);
|
|
|
+ if (talentMapInfo.getAvatar().contains("base64")) {
|
|
|
+ // base64编码
|
|
|
+ // 截取, 之后的所有
|
|
|
+ int index = talentMapInfo.getAvatar().indexOf(", ");
|
|
|
+ byte[] data = Base64Decoder.decode(talentMapInfo.getAvatar().substring(index + 1));
|
|
|
+ // 转为图片地址保存
|
|
|
+ String path = "talent/map/" + talentMapInfo.getName() + "_" +
|
|
|
+ talentMapInfo.getAvatar()
|
|
|
+ .substring(talentMapInfo.getAvatar().length() - 10).replaceAll("/", "") + ".jpg";
|
|
|
+ talentMapInfo.setAvatar(fileApi.createFile(talentMapInfo.getName(), path, data));
|
|
|
+ }
|
|
|
if (null == talentMapInfo.getId()) {
|
|
|
// 新增
|
|
|
talentMapInfoMapper.insert(talentMapInfo);
|
|
|
- } else {
|
|
|
- talentMapInfoMapper.updateById(talentMapInfo);
|
|
|
}
|
|
|
|
|
|
for (TalentMapEduExpSaveReqVO eduReqVO : reqVO.getEduList()) {
|
|
@@ -156,7 +195,7 @@ public class TalentMapInfoServiceImpl implements TalentMapInfoService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (TalentMapTrainExpSaveReqVO trainReqVO: reqVO.getTrainList()) {
|
|
|
+ for (TalentMapTrainExpSaveReqVO trainReqVO : reqVO.getTrainList()) {
|
|
|
if (null == trainReqVO.getId()) {
|
|
|
trainReqVO.setPersonId(talentMapInfo.getId());
|
|
|
// 新增
|