Browse Source

心理咨询pc端接口修改

hotfix/yujt_opt
yujt 5 years ago
parent
commit
d90a92a654
  1. 10
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologistDao.java
  2. 30
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologistServiceImpl.java
  3. 7
      epdc-cloud-property/src/main/resources/mapper/conflict/ConflictMediateDao.xml
  4. 18
      epdc-cloud-property/src/main/resources/mapper/psychology/PsychologistDao.xml

10
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologistDao.java

@ -57,16 +57,6 @@ public interface PsychologistDao extends BaseDao<PsychologistEntity> {
*/
List<PsychologistEntity> listPsychiatrist(PsychologistFormDTO dto);
/**
* 心理咨询师注册检查
*
* @return java.util.List<com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity>
* @params [params]
* @author zhangyuan
* @since 2020/5/21 14:54
*/
List<PsychologistEntity> checkPsychiatrist(PsychologistDTO dto);
/**
* 心理咨询师详细
*

30
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologistServiceImpl.java

@ -17,10 +17,13 @@
package com.elink.esua.epdc.modules.psychology.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.enums.EpdcDelFlagEnum;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
@ -105,18 +108,28 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps
return dto;
}
private boolean isPsychologist(String userId, String psychologistId) {
QueryWrapper<PsychologistEntity> wrapper = new QueryWrapper<>();
wrapper.eq("USER_ID", userId)
.eq(FieldConstant.DEL_FLAG, EpdcDelFlagEnum.NORMAL.value())
.ne(StringUtils.isNotBlank(psychologistId), FieldConstant.ID, psychologistId);
return baseDao.selectCount(wrapper) > NumConstant.ZERO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PsychologistDTO dto) {
List<PsychologistEntity> check = baseDao.checkPsychiatrist(dto);
if (check.size() > 0) {
if (isPsychologist(dto.getUserId(), null)) {
throw new RenException("该用户已经注册心理咨询师");
}
List<String> relation = dto.getTitles();
PsychologistEntity entity = ConvertUtils.sourceToTarget(dto, PsychologistEntity.class);
int num = baseDao.insert(entity);
if (num > 0 && relation != null && relation.size() > 0) {
List<String> relation = dto.getTitles();
if (num > NumConstant.ZERO && CollUtil.isNotEmpty(relation)) {
relation.forEach(item -> {
PsychologistTitleRelationEntity psychologistTitleRelationEntity = new PsychologistTitleRelationEntity();
psychologistTitleRelationEntity.setPsychologistId(entity.getId());
@ -129,10 +142,15 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PsychologistDTO dto) {
if (isPsychologist(dto.getUserId(), dto.getId())) {
throw new RenException("该用户已经注册心理咨询师");
}
List<String> relation = dto.getTitles();
PsychologistEntity entity = ConvertUtils.sourceToTarget(dto, PsychologistEntity.class);
boolean updFlag = updateById(entity);
if (updFlag && relation != null && relation.size() > 0) {
if (updateById(entity) && CollUtil.isNotEmpty(relation)) {
psychologistTitleRelationDao.clearRelation(entity.getId());
relation.forEach(item -> {
PsychologistTitleRelationEntity psychologistTitleRelationEntity = new PsychologistTitleRelationEntity();

7
epdc-cloud-property/src/main/resources/mapper/conflict/ConflictMediateDao.xml

@ -16,11 +16,8 @@
epdc_conflict_mediate
WHERE
DEL_FLAG = '0'
<if test="grid != null and grid != ''">
AND find_in_set(#{grid},ALL_DEPT_IDS)
</if>
<if test="comm != null and comm != ''">
AND find_in_set(#{comm},ALL_DEPT_IDS)
<if test="deptId != null and deptId != ''">
AND find_in_set(#{deptId},ALL_DEPT_IDS)
</if>
<if test="startTime != null and startTime != ''">
AND SUBMIT_TIME &gt; #{startTime}

18
epdc-cloud-property/src/main/resources/mapper/psychology/PsychologistDao.xml

@ -29,7 +29,7 @@
SELECT
<include refid="Base_Column_List"/>
FROM
epdc_psychologist
epdc_psychologist p
WHERE
DEL_FLAG = '0'
<if test="name != null and name != ''">
@ -38,21 +38,7 @@
<if test="mobile != null and mobile != ''">
AND MOBILE like CONCAT( '%', #{mobile}, '%' )
</if>
ORDER BY
SORT ASC,
CREATED_TIME DESC
</select>
<select id="checkPsychiatrist" resultType="com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity">
SELECT
<include refid="Base_Column_List"/>
FROM
epdc_psychologist
WHERE
DEL_FLAG = '0'
<if test="allFlag == '0' or allFlag == 0">
LIMIT 4
</if>
ORDER BY SORT ASC, CREATED_TIME DESC
</select>
<select id="listPsychiatrist" resultType="com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity">

Loading…
Cancel
Save