|
@@ -10,11 +10,17 @@ import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import shop.alien.entity.store.StoreStaffConfig;
|
|
import shop.alien.entity.store.StoreStaffConfig;
|
|
|
import shop.alien.entity.store.excelVo.StoreStaffConfigExcelVo;
|
|
import shop.alien.entity.store.excelVo.StoreStaffConfigExcelVo;
|
|
|
import shop.alien.entity.store.excelVo.util.ExcelGenerator;
|
|
import shop.alien.entity.store.excelVo.util.ExcelGenerator;
|
|
|
|
|
+import shop.alien.entity.store.vo.StoreStaffDetailVo;
|
|
|
|
|
+import shop.alien.entity.store.vo.StoreStaffFitnessDetailVo;
|
|
|
import shop.alien.mapper.StoreStaffConfigMapper;
|
|
import shop.alien.mapper.StoreStaffConfigMapper;
|
|
|
import shop.alien.store.service.StoreStaffConfigService;
|
|
import shop.alien.store.service.StoreStaffConfigService;
|
|
|
|
|
+import shop.alien.store.service.StoreStaffFitnessBaseService;
|
|
|
|
|
+import shop.alien.store.service.StoreStaffFitnessCertificationService;
|
|
|
|
|
+import shop.alien.store.service.StoreStaffFitnessCourseService;
|
|
|
import shop.alien.store.util.CommonConstant;
|
|
import shop.alien.store.util.CommonConstant;
|
|
|
import shop.alien.util.ali.AliOSSUtil;
|
|
import shop.alien.util.ali.AliOSSUtil;
|
|
|
|
|
|
|
@@ -31,6 +37,7 @@ import java.util.UUID;
|
|
|
* @Description: 员工管理
|
|
* @Description: 员工管理
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
@Service
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
@@ -39,6 +46,22 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
|
|
|
|
|
|
private final AliOSSUtil aliOSSUtil;
|
|
private final AliOSSUtil aliOSSUtil;
|
|
|
|
|
|
|
|
|
|
+ private final StoreStaffFitnessCourseService storeStaffFitnessCourseService;
|
|
|
|
|
+
|
|
|
|
|
+ private final StoreStaffFitnessBaseService storeStaffFitnessBaseService;
|
|
|
|
|
+
|
|
|
|
|
+ private final StoreStaffFitnessCertificationService storeStaffFitnessCertificationService;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 认证类型:认证
|
|
|
|
|
+ */
|
|
|
|
|
+ private static final Integer CERTIFICATION_TYPE = 1;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 认证类型:荣誉
|
|
|
|
|
+ */
|
|
|
|
|
+ private static final Integer HONOR_TYPE = 2;
|
|
|
|
|
+
|
|
|
@Value("${spring.web.resources.excel-path}")
|
|
@Value("${spring.web.resources.excel-path}")
|
|
|
private String excelPath;
|
|
private String excelPath;
|
|
|
@Value("${spring.web.resources.excel-clearing-receipt}")
|
|
@Value("${spring.web.resources.excel-clearing-receipt}")
|
|
@@ -242,4 +265,104 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
|
queryWrapper.orderByDesc("top_status", "top_time", "created_time");
|
|
queryWrapper.orderByDesc("top_status", "top_time", "created_time");
|
|
|
return storeStaffConfigMapper.selectPage(storePage, queryWrapper);
|
|
return storeStaffConfigMapper.selectPage(storePage, queryWrapper);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public StoreStaffDetailVo getStaffDetailWithCourse(Integer id) {
|
|
|
|
|
+ log.info("查询员工详情(包含课程信息),id={}", id);
|
|
|
|
|
+
|
|
|
|
|
+ // 参数校验
|
|
|
|
|
+ if (id == null || id <= 0) {
|
|
|
|
|
+ log.warn("查询员工详情失败,员工ID无效:{}", id);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 查询员工基本信息
|
|
|
|
|
+ LambdaQueryWrapper<StoreStaffConfig> staffWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ staffWrapper.eq(StoreStaffConfig::getId, id)
|
|
|
|
|
+ .eq(StoreStaffConfig::getDeleteFlag, CommonConstant.DELETE_FLAG_UNDELETE);
|
|
|
|
|
+ StoreStaffConfig staffConfig = storeStaffConfigMapper.selectOne(staffWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if (staffConfig == null) {
|
|
|
|
|
+ log.warn("查询员工详情失败,员工不存在:id={}", id);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询关联的课程信息
|
|
|
|
|
+ List<shop.alien.entity.store.StoreStaffFitnessCourse> courseList =
|
|
|
|
|
+ storeStaffFitnessCourseService.getListByStaffId(id);
|
|
|
|
|
+
|
|
|
|
|
+ // 构建返回对象
|
|
|
|
|
+ StoreStaffDetailVo detailVo = new StoreStaffDetailVo();
|
|
|
|
|
+ detailVo.setStaffInfo(staffConfig);
|
|
|
|
|
+ detailVo.setCourseList(courseList);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("查询员工详情成功,id={},课程数量:{}", id, courseList != null ? courseList.size() : 0);
|
|
|
|
|
+ return detailVo;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("查询员工详情异常,id={},异常信息:{}", id, e.getMessage(), e);
|
|
|
|
|
+ throw new RuntimeException("查询员工详情异常:" + e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public StoreStaffFitnessDetailVo getFitnessCoachDetail(Integer id) {
|
|
|
|
|
+ log.info("查询健身教练详情,id={}", id);
|
|
|
|
|
+
|
|
|
|
|
+ // 参数校验
|
|
|
|
|
+ if (id == null || id <= 0) {
|
|
|
|
|
+ log.warn("查询健身教练详情失败,员工ID无效:{}", id);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 查询员工基本信息
|
|
|
|
|
+ LambdaQueryWrapper<StoreStaffConfig> staffWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ staffWrapper.eq(StoreStaffConfig::getId, id)
|
|
|
|
|
+ .eq(StoreStaffConfig::getDeleteFlag, CommonConstant.DELETE_FLAG_UNDELETE);
|
|
|
|
|
+ StoreStaffConfig staffConfig = storeStaffConfigMapper.selectOne(staffWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if (staffConfig == null) {
|
|
|
|
|
+ log.warn("查询健身教练详情失败,员工不存在:id={}", id);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询员工基本信息(运动健身)
|
|
|
|
|
+ shop.alien.entity.store.StoreStaffFitnessBase baseInfo = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ shop.alien.entity.result.R<shop.alien.entity.store.StoreStaffFitnessBase> baseResult =
|
|
|
|
|
+ storeStaffFitnessBaseService.getByStaffId(id);
|
|
|
|
|
+ if (baseResult != null && shop.alien.entity.result.R.isSuccess(baseResult) && baseResult.getData() != null) {
|
|
|
|
|
+ baseInfo = baseResult.getData();
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("查询员工基本信息失败,id={},异常信息:{}", id, e.getMessage());
|
|
|
|
|
+ // 基本信息查询失败不影响整体返回,设置为null即可
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询认证列表(type=1)
|
|
|
|
|
+ List<shop.alien.entity.store.StoreStaffFitnessCertification> certificationList =
|
|
|
|
|
+ storeStaffFitnessCertificationService.getListByStaffIdAndType(id, CERTIFICATION_TYPE);
|
|
|
|
|
+
|
|
|
|
|
+ // 查询荣誉列表(type=2)
|
|
|
|
|
+ List<shop.alien.entity.store.StoreStaffFitnessCertification> honorList =
|
|
|
|
|
+ storeStaffFitnessCertificationService.getListByStaffIdAndType(id, HONOR_TYPE);
|
|
|
|
|
+
|
|
|
|
|
+ // 构建返回对象
|
|
|
|
|
+ StoreStaffFitnessDetailVo detailVo = new StoreStaffFitnessDetailVo();
|
|
|
|
|
+ detailVo.setStaffInfo(staffConfig);
|
|
|
|
|
+ detailVo.setBaseInfo(baseInfo);
|
|
|
|
|
+ detailVo.setCertificationList(certificationList != null ? certificationList : new ArrayList<>());
|
|
|
|
|
+ detailVo.setHonorList(honorList != null ? honorList : new ArrayList<>());
|
|
|
|
|
+
|
|
|
|
|
+ log.info("查询健身教练详情成功,id={},认证数量:{},荣誉数量:{}",
|
|
|
|
|
+ id,
|
|
|
|
|
+ certificationList != null ? certificationList.size() : 0,
|
|
|
|
|
+ honorList != null ? honorList.size() : 0);
|
|
|
|
|
+ return detailVo;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("查询健身教练详情异常,id={},异常信息:{}", id, e.getMessage(), e);
|
|
|
|
|
+ throw new RuntimeException("查询健身教练详情异常:" + e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|