动态管理功能补充

This commit is contained in:
pserimal
2023-06-29 15:46:23 +08:00
parent 43dc7202bc
commit 6a68fde497
9 changed files with 119 additions and 5 deletions

View File

@@ -243,4 +243,9 @@ public class RedisConstant {
*/
public static final String MDM_AREA_OTHERS = "mdm:area:others:{0}";
/**
* 动态标题
*/
public static final String CONTENT_TITLES = "content:titles";
}

View File

@@ -77,6 +77,7 @@ public enum ErrorCodeEnum {
INTERVIEW_INTERVIEW_TIME_IS_UNUSABLE(1021114, "当前预约时间不可用,请和线索用户协商其他时间后确定预约时间\n面试人{0} 手机号:{1}", null),
INTERVIEW_PARTNER_NOT_EXIST(1021115, "线索下的加盟商不存在!", null),
ROOM_STATUS_ERROR(10211156, "当前面试房间状态不允许进行该操作!", null),
CONTENT_DUPLICATED(10211200, "动态标题重复!", null),
SIGN_FAIL(600000, "验签失败", null),
GET_ACCESSTOKEN_ERROR(600001, "获取小程序TOKEN错误", null),
NEW_MOBILE_HAS_EXIST(600002,"加盟商用户信息已存在",null),

View File

@@ -39,9 +39,24 @@ public interface HyContentInfoMapper {
*/
List<HyContentInfoVO> queryContentList(ContentQueryListDto dto);
/**
* B 端使用的动态查询
*/
List<HyContentInfoVO> queryContentListForB(ContentQueryListDto dto);
/**
* 根据contentId查询动态详情
*/
HyContentInfoDO queryContentInfo(@Param("contentId") String contentId);
/**
* 标题是否重复
*/
Boolean whetherTitleDuplicated(@Param("contentTitle") String contentTitle);
/**
* 查询动态标题
*/
List<String> queryTitles();
}

View File

@@ -179,6 +179,29 @@
and user_id = #{updateUserId}
</select>
<!-- B 端使用的动态查询 -->
<select id="queryContentListForB" resultType="com.cool.store.vo.HyContentInfoVO">
select <include refid="Base_Column_List"></include>
from hy_content_info
where deleted = 0
and status = 1
<if test="contentTitle != null and contentTitle != ''">
and content_title like concat('%', #{contentTitle}, '%')
</if>
<if test="subject != null">
and subject = #{subject}
</if>
<if test="contentType != null">
and content_type = #{contentType}
</if>
<if test="startTime != null and startTime != ''">
and update_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and update_time &lt;= #{endTime}
</if>
</select>
<!-- 查询动态详情 -->
<select id="queryContentInfo" resultType="com.cool.store.entity.HyContentInfoDO">
select <include refid="Base_Column_List"></include>
@@ -186,4 +209,19 @@
where deleted = 0
and id = #{contentId}
</select>
<!-- 标题是否重复 -->
<select id="whetherTitleDuplicated" resultType="java.lang.Boolean">
SELECT COUNT(*)
FROM hy_content_info
WHERE deleted = 0
AND content_title = #{contentTitle}
</select>
<!-- 获取所有标题 -->
<select id="queryTitles" resultType="java.lang.String">
SELECT content_title
FROM hy_content_info
WHERE deleted = 0
</select>
</mapper>

View File

@@ -0,0 +1,12 @@
package com.cool.store.dto.content;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ContentQueryTitlesDto {
@ApiModelProperty("用户输入标题")
private String tittle;
}

View File

@@ -4,6 +4,7 @@ import com.cool.store.dto.content.ContentAddDto;
import com.cool.store.dto.content.ContentQueryListDto;
import com.cool.store.dto.content.ContentUpdateDto;
import com.cool.store.entity.HyContentInfoDO;
import com.cool.store.exception.ApiException;
import com.cool.store.vo.HyContentInfoVO;
import java.util.List;
@@ -15,7 +16,7 @@ public interface ContentService {
* @param dto
* @return contentId 新增动态id
*/
String addNews(ContentAddDto dto);
String addNews(ContentAddDto dto) throws ApiException;
/**
* 删除动态
@@ -41,4 +42,9 @@ public interface ContentService {
*/
HyContentInfoDO queryContentInfo(String contentId);
/**
* 标题是否重复
*/
Boolean queryTitles(String title);
}

View File

@@ -1,13 +1,18 @@
package com.cool.store.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.RedisConstant;
import com.cool.store.dao.ContentDAO;
import com.cool.store.dto.content.ContentAddDto;
import com.cool.store.dto.content.ContentQueryListDto;
import com.cool.store.dto.content.ContentUpdateDto;
import com.cool.store.entity.HyContentInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ApiException;
import com.cool.store.mapper.HyContentInfoMapper;
import com.cool.store.service.ContentService;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.vo.HyContentInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -23,13 +28,21 @@ public class ContentServiceImpl implements ContentService {
@Autowired
private HyContentInfoMapper contentInfoMapper;
@Autowired
private RedisUtilPool redisUtilPool;
/**
*
* @param dto
* @return contentId 新增动态id
*/
@Override
public String addNews(ContentAddDto dto) {
public String addNews(ContentAddDto dto) throws ApiException {
//增加不允许重复标题的逻辑
Boolean isDuplicated = contentInfoMapper.whetherTitleDuplicated(dto.getContentTitle());
if (isDuplicated) {
throw new ApiException(ErrorCodeEnum.DATA_CONVERT_ERROR);
}
HyContentInfoDO hyContentInfoDO = new HyContentInfoDO();
BeanUtil.copyProperties(dto, hyContentInfoDO);
hyContentInfoDO.setUpdateUserId(dto.getCreateUserId());
@@ -62,7 +75,7 @@ public class ContentServiceImpl implements ContentService {
*/
@Override
public List<HyContentInfoVO> queryContentList(ContentQueryListDto dto) {
return contentInfoMapper.queryContentList(dto);
return contentInfoMapper.queryContentListForB(dto);
}
/**
@@ -75,4 +88,18 @@ public class ContentServiceImpl implements ContentService {
return contentInfoMapper.queryContentInfo(contentId);
}
/**
* 标题是否重复
*/
@Override
public Boolean queryTitles(String title) {
List<String> titles = (List<String>) JSONObject.parseObject(redisUtilPool.getString(RedisConstant.CONTENT_TITLES), List.class);
if (titles != null && titles.size() != 0) {
return titles.contains(title);
}
titles = contentInfoMapper.queryTitles();
redisUtilPool.setString(RedisConstant.CONTENT_TITLES, JSONObject.toJSONString(titles), 60);
return titles.contains(title);
}
}

View File

@@ -194,8 +194,9 @@ public class FlowServiceImpl implements FlowService {
//更新面试状态
interviewDAO.updateInterviewWorkflowStatus(request.getInterviewPlanId(), WorkflowStatusEnum.INTERVIEW_5);
hyPartnerInterviewDO.setUpdateTime(new Date());
//获取当前操作人
//注意将 hyPartnerInterviewDO 的 status 设置为 null否则又会修改回 4
hyPartnerInterviewDO.setStatus(null);
//获取当前操作人并添加面试总结/记录信息
LoginUserInfo operator = CurrentUserHolder.getUser();
hyPartnerInterviewDO.setRecorder(operator.getUserId());
hyPartnerInterviewDO.setRecordTime(new Date());

View File

@@ -1,10 +1,13 @@
package com.cool.store.controller;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.content.*;
import com.cool.store.entity.HyContentInfoDO;
import com.cool.store.exception.ApiException;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ContentService;
import com.cool.store.vo.HyContentInfoVO;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
@@ -24,9 +27,15 @@ public class ContentController {
@Autowired
private ContentService contentService;
@PostMapping("/queryTitles")
@ApiOperation("搜索标题是否重复")
public ResponseResult<Boolean> queryTitles(@RequestBody ContentQueryTitlesDto title) {
return ResponseResult.success(contentService.queryTitles(title.getTittle()));
}
@PostMapping("/add")
@ApiOperation("新增动态")
public ResponseResult<String> addContent(@RequestBody ContentAddDto dto) {
public ResponseResult<String> addContent(@RequestBody ContentAddDto dto) throws ApiException {
return ResponseResult.success(contentService.addNews(dto));
}