Commit c4143015 by songxiang

错题本二期知识点浮生内容

parent 434570cb
/**
*
*/
package com.pcloud.common.core.biz;
import com.pcloud.common.core.dto.KnowledgeUseMQDTO;
import com.pcloud.common.exceptions.BizException;
/**
* @author:songx
* @date:2019/6/20,11:38
*/
public interface KnowledgeUseQueueBiz {
/**
* 发送消息
*
* @param knowledgeUseMQDTO
*/
void send(KnowledgeUseMQDTO knowledgeUseMQDTO) throws BizException;
}
......@@ -17,7 +17,7 @@ public interface TranscodeQueueBiz {
/**
* 发送消息
*
* @param messageQueueDto
* @param transcodeMQDTO
*/
void sendTranscodeQueue(TranscodeMQDTO transcodeMQDTO) throws BizException;
......
/**
*
*/
package com.pcloud.common.core.biz.impl;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.biz.KnowledgeUseQueueBiz;
import com.pcloud.common.core.constant.MQQueueConstant;
import com.pcloud.common.core.dto.KnowledgeUseMQDTO;
import com.pcloud.common.exceptions.BizException;
/**
* @author:songx
* @date:2019/6/20,11:37
*/
@Component
public class KnowledgeUseQueueBizImpl implements KnowledgeUseQueueBiz {
@Autowired
private AmqpTemplate amqpTemplate;
/**
* 知识点标签使用QUEUE
*/
@Override
@ParamLog("知识点标签使用QUEUE")
public void send(KnowledgeUseMQDTO knowledgeUseMQDTO) throws BizException {
if (knowledgeUseMQDTO == null) {
throw BizException.PARAM_IS_NULL;
}
amqpTemplate.convertAndSend(MQQueueConstant.KNOWLEDGE_USE, knowledgeUseMQDTO);
}
}
......@@ -9,8 +9,13 @@ package com.pcloud.common.core.constant;
* @date:2018年8月16日,下午9:54:51
*/
public class MQQueueConstant {
/**
/**
* 知识点标签使用
*/
public static final String KNOWLEDGE_USE = "knowledgeUse";
/**
* 模板消息
*/
public static final String TEMPLATE = "templateQueue";
......
/**
*
*/
package com.pcloud.common.core.dto;
import java.io.Serializable;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author:songx
* @date:2018年5月17日,下午4:27:26
*/
@Getter
@Setter
@ToString(callSuper = true)
public class KnowledgeUseMQDTO implements Serializable {
private static final long serialVersionUID = -6111501255761694004L;
/**
* 知识点标签
*/
private List<Long> knowledgeIds;
public KnowledgeUseMQDTO() {
}
public KnowledgeUseMQDTO(List<Long> knowledgeIds) {
this.knowledgeIds = knowledgeIds;
}
}
package com.pcloud.common.exceptions;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.pcloud.common.entity.BasePageVO;
import com.pcloud.common.utils.ListUtils;
/**
* 参数校验
*
* @author:songx
* @date:2019年4月15日,下午3:01:35
*/
public class ParamCheck {
/**
* check number is null
*
* @param number
* @param msg
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:06:03
*/
public static void isNull(Number number, String msg) throws BizException {
if (number == null) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), msg);
}
}
/**
* check boolean is null
*
* @param bool
* @param msg
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:06:25
*/
public static void isNull(Boolean bool, String msg) throws BizException {
if (bool == null) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), msg);
}
}
/**
* check string is null
*
* @param string
* @param msg
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:06:36
*/
public static void isEmpty(String string, String msg) throws BizException {
if (StringUtils.isEmpty(string)) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), msg);
}
}
/**
* check page number is null
*
* @param currentPage
* @param numPerPage
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:07:07
*/
public static void isNull(Integer currentPage, Integer numPerPage) throws BizException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BizException.PAGE_PARAM_DELETION;
}
}
/**
* check list is null
*
* @param list
* @param msg
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:07:37
*/
public static void isEmpty(List<?> list, String msg) throws BizException {
if (ListUtils.isEmpty(list)) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), msg);
}
}
/**
* 校验分页参数校验分页参数
*
* @param basePageVO
* @throws BizException
*/
public static void pageParam(BasePageVO basePageVO) throws BizException {
pageParam(basePageVO.getCurrentPage(), basePageVO.getNumPerPage());
}
/**
* 校验分页参数
*
* @param currentPage 当前页
* @param numPerPage 每页行数
* @throws BizException
*/
public static void pageParam(Integer currentPage, Integer numPerPage) throws BizException {
if (currentPage == null || currentPage < 0 || numPerPage == null || numPerPage < 0) {
throw BizException.PAGE_PARAM_DELETION;
}
}
}
package com.pcloud.common.exceptions;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.pcloud.common.entity.BasePageVO;
import com.pcloud.common.utils.ListUtils;
/**
* 参数校验
*
* @author:songx
* @date:2019年4月15日,下午3:01:35
*/
public class ParamCheck {
/**
* check number is null
*
* @param number
* @param msg
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:06:03
*/
public static void isNull(Number number, String msg) throws BizException {
if (number == null) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), msg);
}
}
/**
* check boolean is null
*
* @param bool
* @param msg
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:06:25
*/
public static void isNull(Boolean bool, String msg) throws BizException {
if (bool == null) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), msg);
}
}
/**
* check string is null
*
* @param string
* @param msg
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:06:36
*/
public static void isEmpty(String string, String msg) throws BizException {
if (StringUtils.isEmpty(string)) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), msg);
}
}
/**
* check page number is null
*
* @param currentPage
* @param numPerPage
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:07:07
*/
public static void isNull(Integer currentPage, Integer numPerPage) throws BizException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BizException.PAGE_PARAM_DELETION;
}
}
/**
* check list is null
*
* @param list
* @param msg
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:07:37
*/
public static void isEmpty(List<?> list, String msg) throws BizException {
if (ListUtils.isEmpty(list)) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), msg);
}
}
/**
* check bety[] is null
*
* @param bts
* @param msg
* @throws BizException
* @author songx
* @date 2019年4月23日, 下午3:07:37
*/
public static void isEmpty(byte[] bts, String msg) throws BizException {
if (bts == null || bts.length == 0) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), msg);
}
}
/**
* 校验分页参数校验分页参数
*
* @param basePageVO
* @throws BizException
*/
public static void pageParam(BasePageVO basePageVO) throws BizException {
pageParam(basePageVO.getCurrentPage(), basePageVO.getNumPerPage());
}
/**
* 校验分页参数
*
* @param currentPage 当前页
* @param numPerPage 每页行数
* @throws BizException
*/
public static void pageParam(Integer currentPage, Integer numPerPage) throws BizException {
if (currentPage == null || currentPage < 0 || numPerPage == null || numPerPage < 0) {
throw BizException.PAGE_PARAM_DELETION;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment