微信端查看咨询师培训经历;咨询师的擅长领域数据格式优化

This commit is contained in:
cjw 2024-08-20 14:49:13 +08:00
parent 5602f14254
commit 77e48de989
9 changed files with 63 additions and 28 deletions

View File

@ -35,7 +35,7 @@ import java.util.List;
@RequestMapping("/counselor/experience") @RequestMapping("/counselor/experience")
public class CounselorExperienceController extends BaseController { public class CounselorExperienceController extends BaseController {
private final ICounselorExperienceService counselorExperienceService; private final ICounselorExperienceService experienceService;
/** /**
* 查询培训经历列表 * 查询培训经历列表
@ -43,7 +43,7 @@ public class CounselorExperienceController extends BaseController {
@SaCheckPermission("counselor:experience:list") @SaCheckPermission("counselor:experience:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo<CounselorExperienceVo> list(CounselorExperienceBo bo, PageQuery pageQuery) { public TableDataInfo<CounselorExperienceVo> list(CounselorExperienceBo bo, PageQuery pageQuery) {
return counselorExperienceService.queryPageList(bo, pageQuery); return experienceService.queryPageList(bo, pageQuery);
} }
/** /**
@ -53,7 +53,7 @@ public class CounselorExperienceController extends BaseController {
@Log(title = "培训经历", businessType = BusinessType.EXPORT) @Log(title = "培训经历", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(CounselorExperienceBo bo, HttpServletResponse response) { public void export(CounselorExperienceBo bo, HttpServletResponse response) {
List<CounselorExperienceVo> list = counselorExperienceService.queryList(bo); List<CounselorExperienceVo> list = experienceService.queryList(bo);
ExcelUtil.exportExcel(list, "培训经历", CounselorExperienceVo.class, response); ExcelUtil.exportExcel(list, "培训经历", CounselorExperienceVo.class, response);
} }
@ -66,7 +66,7 @@ public class CounselorExperienceController extends BaseController {
@GetMapping("/{id}") @GetMapping("/{id}")
public R<CounselorExperienceVo> getInfo(@NotNull(message = "主键不能为空") public R<CounselorExperienceVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) { @PathVariable Long id) {
return R.ok(counselorExperienceService.queryById(id)); return R.ok(experienceService.queryById(id));
} }
/** /**
@ -77,7 +77,7 @@ public class CounselorExperienceController extends BaseController {
@RepeatSubmit() @RepeatSubmit()
@PostMapping() @PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody CounselorExperienceBo bo) { public R<Void> add(@Validated(AddGroup.class) @RequestBody CounselorExperienceBo bo) {
return toAjax(counselorExperienceService.insertByBo(bo)); return toAjax(experienceService.insertByBo(bo));
} }
/** /**
@ -88,7 +88,7 @@ public class CounselorExperienceController extends BaseController {
@RepeatSubmit() @RepeatSubmit()
@PutMapping() @PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CounselorExperienceBo bo) { public R<Void> edit(@Validated(EditGroup.class) @RequestBody CounselorExperienceBo bo) {
return toAjax(counselorExperienceService.updateByBo(bo)); return toAjax(experienceService.updateByBo(bo));
} }
/** /**
@ -101,6 +101,6 @@ public class CounselorExperienceController extends BaseController {
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) { @PathVariable Long[] ids) {
return toAjax(counselorExperienceService.deleteWithValidByIds(List.of(ids), true)); return toAjax(experienceService.deleteWithValidByIds(List.of(ids), true));
} }
} }

View File

@ -8,11 +8,14 @@ import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType; import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.scale.domain.bo.CounselorExperienceBo;
import org.dromara.scale.domain.bo.CounselorQualificationBo; import org.dromara.scale.domain.bo.CounselorQualificationBo;
import org.dromara.scale.domain.bo.ReservationDayBo; import org.dromara.scale.domain.bo.ReservationDayBo;
import org.dromara.scale.domain.vo.CounselorExperienceVo;
import org.dromara.scale.domain.vo.CounselorQualificationVo; import org.dromara.scale.domain.vo.CounselorQualificationVo;
import org.dromara.scale.domain.vo.CounselorVo; import org.dromara.scale.domain.vo.CounselorVo;
import org.dromara.scale.domain.vo.ReservationDateVo; import org.dromara.scale.domain.vo.ReservationDateVo;
import org.dromara.scale.service.ICounselorExperienceService;
import org.dromara.scale.service.ICounselorQualificationService; import org.dromara.scale.service.ICounselorQualificationService;
import org.dromara.scale.service.ICounselorService; import org.dromara.scale.service.ICounselorService;
import org.dromara.scale.service.IReservationService; import org.dromara.scale.service.IReservationService;
@ -40,6 +43,8 @@ public class WxCounselorController extends BaseController {
private final ICounselorQualificationService qualificationService; private final ICounselorQualificationService qualificationService;
private final ICounselorExperienceService experienceService;
/** /**
* 获取心理咨询师详细信息 * 获取心理咨询师详细信息
*/ */
@ -59,17 +64,42 @@ public class WxCounselorController extends BaseController {
return toAjax(reservationService.insertByBo(bo)); return toAjax(reservationService.insertByBo(bo));
} }
/**
* 获取咨询师预约日历
*
* @param time -
* @param counselorId 咨询师id
* @return
*/
@GetMapping("/date") @GetMapping("/date")
public R<List<ReservationDateVo>> getReservationList(String time, Long counselorId) { public R<List<ReservationDateVo>> getReservationList(String time, Long counselorId) {
return R.ok(reservationService.selectDateList(time, counselorId)); return R.ok(reservationService.selectDateList(time, counselorId));
} }
/**
* 获取咨询师证书
*
* @return
*/
@GetMapping("/qualification") @GetMapping("/qualification")
public R<List<CounselorQualificationVo>> getQualificationList() { public R<List<CounselorQualificationVo>> getQualificationList() {
Long userId = LoginHelper.getUserId(); Long userId = LoginHelper.getUserId();
CounselorQualificationBo bo = new CounselorQualificationBo(); CounselorQualificationBo bo = new CounselorQualificationBo();
bo.setCounselorId(userId);
return R.ok(qualificationService.queryList(bo)); return R.ok(qualificationService.queryList(bo));
} }
/**
* 获取咨询师培训经历
*
* @return
*/
@GetMapping("/experience")
public R<List<CounselorExperienceVo>> getExperienceList() {
Long userId = LoginHelper.getUserId();
CounselorExperienceBo bo = new CounselorExperienceBo();
bo.setCounselorId(userId);
return R.ok(experienceService.queryList(bo));
}
} }

View File

@ -2,9 +2,12 @@ package org.dromara.scale.domain;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.scale.domain.vo.CounselorVo;
import java.io.Serial; import java.io.Serial;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -19,6 +22,7 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("m_counselor") @TableName("m_counselor")
@AutoMapper(target = CounselorVo.class)
public class Counselor extends BaseEntity { public class Counselor extends BaseEntity {
@Serial @Serial
@ -28,6 +32,7 @@ public class Counselor extends BaseEntity {
* *
*/ */
@TableId(value = "id") @TableId(value = "id")
@AutoMapping(target = "name")
private Long id; private Long id;
/** /**
@ -48,12 +53,13 @@ public class Counselor extends BaseEntity {
/** /**
* 擅长领域 * 擅长领域
*/ */
@AutoMapping(target = "specialityField", expression = "java(cn.hutool.core.util.StrUtil.split(source.getSpecialityField(), \",\"))")
private String specialityField; private String specialityField;
/** /**
* 封面组 * 封面组
*/ */
@AutoMapping(target = "coversUrl")
private String covers; private String covers;
/** /**

View File

@ -1,5 +1,6 @@
package org.dromara.scale.domain.bo; package org.dromara.scale.domain.bo;
import io.github.linpeilie.annotations.AutoMapping;
import org.dromara.scale.domain.Counselor; import org.dromara.scale.domain.Counselor;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup; import org.dromara.common.core.validate.AddGroup;
@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 心理咨询师业务对象 m_counselor * 心理咨询师业务对象 m_counselor
@ -55,8 +57,8 @@ public class CounselorBo extends BaseEntity {
/** /**
* 擅长领域 * 擅长领域
*/ */
@NotBlank(message = "擅长领域标签不能为空", groups = { AddGroup.class, EditGroup.class }) @AutoMapping(target = "specialityField", expression = "java(java.lang.String.join(\",\", source.getSpecialityField()))")
private String specialityField; private List<String> specialityField;
/** /**
* 封面组 * 封面组

View File

@ -11,6 +11,7 @@ import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
@ -35,8 +36,7 @@ public class CounselorVo implements Serializable {
* 姓名 * 姓名
*/ */
@Translation(type = TransConstant.USER_ID_TO_NICKNAME) @Translation(type = TransConstant.USER_ID_TO_NICKNAME)
@AutoMapping(target = "id") private Long name;
private String name;
/** /**
* 手机号 * 手机号
@ -56,7 +56,8 @@ public class CounselorVo implements Serializable {
/** /**
* 擅长领域 * 擅长领域
*/ */
private String specialityField; @AutoMapping(ignore = true)
private List<String> specialityField;
/** /**
* 封面组 * 封面组
@ -65,7 +66,6 @@ public class CounselorVo implements Serializable {
private String covers; private String covers;
@Translation(type = TransConstant.OSS_ID_TO_URL) @Translation(type = TransConstant.OSS_ID_TO_URL)
@AutoMapping(target = "covers")
private String coversUrl; private String coversUrl;
/** /**

View File

@ -70,7 +70,8 @@ public class CounselorExperienceServiceImpl implements ICounselorExperienceServi
private LambdaQueryWrapper<CounselorExperience> buildQueryWrapper(CounselorExperienceBo bo) { private LambdaQueryWrapper<CounselorExperience> buildQueryWrapper(CounselorExperienceBo bo) {
Map<String, Object> params = bo.getParams(); Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<CounselorExperience> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<CounselorExperience> lqw = Wrappers.lambdaQuery();
//lqw.eq(StringUtils.isNotBlank(bo.getDescribe()), CounselorExperience::getDescribe, bo.getDescribe()); lqw.eq(bo.getCounselorId() != null, CounselorExperience::getCounselorId, bo.getCounselorId());
lqw.orderByAsc(CounselorExperience::getStartTime);
return lqw; return lqw;
} }

View File

@ -1,23 +1,22 @@
package org.dromara.scale.service.impl; package org.dromara.scale.service.impl;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.scale.domain.CounselorQualification;
import org.dromara.scale.domain.bo.CounselorQualificationBo; import org.dromara.scale.domain.bo.CounselorQualificationBo;
import org.dromara.scale.domain.vo.CounselorQualificationVo; import org.dromara.scale.domain.vo.CounselorQualificationVo;
import org.dromara.scale.domain.CounselorQualification;
import org.dromara.scale.mapper.CounselorQualificationMapper; import org.dromara.scale.mapper.CounselorQualificationMapper;
import org.dromara.scale.service.ICounselorQualificationService; import org.dromara.scale.service.ICounselorQualificationService;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Collection;
/** /**
* 资质证书Service业务层处理 * 资质证书Service业务层处理
@ -72,8 +71,6 @@ public class CounselorQualificationServiceImpl implements ICounselorQualificatio
Map<String, Object> params = bo.getParams(); Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<CounselorQualification> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<CounselorQualification> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getCounselorId() != null, CounselorQualification::getCounselorId, bo.getCounselorId()); lqw.eq(bo.getCounselorId() != null, CounselorQualification::getCounselorId, bo.getCounselorId());
lqw.like(StringUtils.isNotBlank(bo.getCertificateName()), CounselorQualification::getCertificateName, bo.getCertificateName());
lqw.eq(bo.getCertificateImage() != null, CounselorQualification::getCertificateImage, bo.getCertificateImage());
return lqw; return lqw;
} }

View File

@ -79,7 +79,7 @@ public class CounselorServiceImpl implements ICounselorService {
//lqw.like(StringUtils.isNotBlank(bo.getName()), Counselor::getName, bo.getName()); //lqw.like(StringUtils.isNotBlank(bo.getName()), Counselor::getName, bo.getName());
lqw.eq(bo.getPrice() != null, Counselor::getPrice, bo.getPrice()); lqw.eq(bo.getPrice() != null, Counselor::getPrice, bo.getPrice());
lqw.eq(StringUtils.isNotBlank(bo.getIntroduce()), Counselor::getIntroduce, bo.getIntroduce()); lqw.eq(StringUtils.isNotBlank(bo.getIntroduce()), Counselor::getIntroduce, bo.getIntroduce());
lqw.eq(StringUtils.isNotBlank(bo.getSpecialityField()), Counselor::getSpecialityField, bo.getSpecialityField()); //lqw.eq(StringUtils.isNotBlank(bo.getSpecialityField()), Counselor::getSpecialityField, bo.getSpecialityField());
lqw.eq(StringUtils.isNotBlank(bo.getCovers()), Counselor::getCovers, bo.getCovers()); lqw.eq(StringUtils.isNotBlank(bo.getCovers()), Counselor::getCovers, bo.getCovers());
return lqw; return lqw;
} }

View File

@ -72,7 +72,6 @@ public class ReservationServiceImpl implements IReservationService {
@Override @Override
public List<ReservationDateVo> selectDateList(String time, Long counselorId) { public List<ReservationDateVo> selectDateList(String time, Long counselorId) {
return dayMapper.selectDateList(time, counselorId); return dayMapper.selectDateList(time, counselorId);
} }
} }