新增学霸业务、掌门少儿新增设备字段
parent
cbff138796
commit
81c8fd7ae5
@ -0,0 +1,21 @@
|
||||
package com.yuyou.openapi.openapi.dao;
|
||||
|
||||
import com.yuyou.openapi.openapi.model.dataobject.SongshuMessageDO;
|
||||
import com.yuyou.openapi.openapi.model.dataobject.XuebaMessageDO;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface XuebaMessageRepository extends JpaRepository<XuebaMessageDO, Long> {
|
||||
|
||||
/**
|
||||
* 根据RecId来进行查询
|
||||
*
|
||||
* @param recId 记录Id
|
||||
* @return
|
||||
*/
|
||||
List<XuebaMessageDO> findByRecId(Long recId);
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package com.yuyou.openapi.openapi.model.convert;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import com.yuyou.openapi.openapi.common.enums.ConstantEnum;
|
||||
import com.yuyou.openapi.openapi.common.enums.GradeEnum;
|
||||
import com.yuyou.openapi.openapi.common.enums.SubjectEnum;
|
||||
import com.yuyou.openapi.openapi.common.security.SecurityConstants;
|
||||
import com.yuyou.openapi.openapi.common.security.SecurityService;
|
||||
import com.yuyou.openapi.openapi.model.dataobject.SongshuMessageDO;
|
||||
import com.yuyou.openapi.openapi.model.dataobject.XuebaMessageDO;
|
||||
import com.yuyou.openapi.openapi.model.dto.SongshuMessageDTO;
|
||||
import com.yuyou.openapi.openapi.model.dto.XuebaMessageDTO;
|
||||
import com.yuyou.openapi.openapi.model.vo.ABClientSongshuMessageVO;
|
||||
import com.yuyou.openapi.openapi.model.vo.ABClientXuebaMessageVO;
|
||||
import com.yuyou.openapi.openapi.utils.DateUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 掌门记录转换类
|
||||
*
|
||||
* @version 1.0
|
||||
* @date 2020/8/10
|
||||
*/
|
||||
@Slf4j
|
||||
public class XuebaMessageConverter {
|
||||
|
||||
/**
|
||||
* VO层转为DTO层
|
||||
* @param abClientXuebaMessageVO
|
||||
* @return
|
||||
*/
|
||||
public static XuebaMessageDTO convertXuebaMessageDTOFromVO(XuebaMessageDTO xuebaMessageDTO, ABClientXuebaMessageVO abClientXuebaMessageVO) {
|
||||
BeanUtils.copyProperties(abClientXuebaMessageVO, xuebaMessageDTO);
|
||||
return xuebaMessageDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量DTO转DO
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public static List<XuebaMessageDO> convertXuebaMessageDOFromDTO(List<XuebaMessageDTO> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
List<XuebaMessageDO> xuebaMessageDOs = new ArrayList<>();
|
||||
list.forEach(each -> {
|
||||
XuebaMessageDO xuebaMessageDO = convertXuebaMessageDOFromDTO(each);
|
||||
if (xuebaMessageDO != null) {
|
||||
xuebaMessageDOs.add(xuebaMessageDO);
|
||||
}
|
||||
});
|
||||
return xuebaMessageDOs;
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO层转为DO层
|
||||
* @param xuebaMessageDTO
|
||||
* @return
|
||||
*/
|
||||
public static XuebaMessageDO convertXuebaMessageDOFromDTO(XuebaMessageDTO xuebaMessageDTO) {
|
||||
if (xuebaMessageDTO == null || xuebaMessageDTO.getTag() == null || xuebaMessageDTO.getData() == null) {
|
||||
return null;
|
||||
}
|
||||
XuebaMessageDO xuebaMessageDO = new XuebaMessageDO();
|
||||
BeanUtils.copyProperties(xuebaMessageDTO.getData(), xuebaMessageDO);
|
||||
try {
|
||||
xuebaMessageDTO.getData().setMobile(Base64.encode(xuebaMessageDTO.getData().getMobile()));
|
||||
String encryptedMobile = SecurityService.encrypt(xuebaMessageDTO.getData().getMobile(), SecurityConstants.PHONE);
|
||||
String encryptedName = SecurityService.encrypt(xuebaMessageDTO.getData().getName(), SecurityConstants.SIMPLE);
|
||||
xuebaMessageDO.setPnum(encryptedMobile);
|
||||
xuebaMessageDO.setStuName(encryptedName);
|
||||
} catch (Exception e) {
|
||||
log.error("Encrypt data raise Error, recId = {}, error is :", xuebaMessageDTO.getTag().getTag_key_id(), e);
|
||||
xuebaMessageDO.setPnum(xuebaMessageDTO.getData().getMobile());
|
||||
xuebaMessageDO.setStuName(xuebaMessageDTO.getData().getName());
|
||||
}
|
||||
|
||||
xuebaMessageDO.setAppId(xuebaMessageDTO.getAppId());
|
||||
xuebaMessageDO.setPushTime(DateUtils.date(xuebaMessageDTO.getTimestamp()));
|
||||
|
||||
xuebaMessageDO.setStuGrade(GradeEnum.codeOf(xuebaMessageDTO.getData().getGrade()));
|
||||
xuebaMessageDO.setStuSub(SubjectEnum.codeOf(xuebaMessageDTO.getData().getCourse()));
|
||||
xuebaMessageDO.setDevice(ConstantEnum.YesOrNo.codeOf(xuebaMessageDTO.getData().getDevice()));
|
||||
xuebaMessageDO.setRecId(xuebaMessageDTO.getTag().getTag_key_id());
|
||||
|
||||
return xuebaMessageDO;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package com.yuyou.openapi.openapi.model.dataobject;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 掌门少儿成单记录表
|
||||
* @version 1.0
|
||||
* @date 2020/8/10
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "xueba_message")
|
||||
@Entity
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
public class XuebaMessageDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "gmt_create")
|
||||
@CreatedDate
|
||||
private Date gmtCreate;
|
||||
|
||||
@Column(name = "gmt_modified")
|
||||
@LastModifiedDate
|
||||
private Date gmtModified;
|
||||
|
||||
/**
|
||||
* 记录推送id
|
||||
*/
|
||||
@Column(name = "rec_id")
|
||||
private Long recId;
|
||||
|
||||
/**
|
||||
* 报课学生名
|
||||
*/
|
||||
@Column(name = "stu_name")
|
||||
private String stuName;
|
||||
|
||||
/**
|
||||
* 报课学生码
|
||||
*/
|
||||
private String pnum;
|
||||
|
||||
/**
|
||||
* 报课学生年级
|
||||
*/
|
||||
@Column(name = "stu_grade")
|
||||
private Integer stuGrade;
|
||||
|
||||
/**
|
||||
* 报课学生学科
|
||||
*/
|
||||
@Column(name = "stu_sub")
|
||||
private Integer stuSub;
|
||||
|
||||
@Column(name = "device")
|
||||
private Integer device;
|
||||
|
||||
/**
|
||||
* 上游推送用户id
|
||||
*/
|
||||
@Column(name = "app_id")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 上游推送时间
|
||||
*/
|
||||
@Column(name = "push_time")
|
||||
private Date pushTime;
|
||||
|
||||
@Column(name = "submit_status")
|
||||
private Integer submitStatus = 0;
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package com.yuyou.openapi.openapi.model.dto;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class XuebaMessageDTO {
|
||||
|
||||
/**
|
||||
* 推送用户的ID
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 请求时间戳
|
||||
*/
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 标记集合
|
||||
*/
|
||||
private Tag tag;
|
||||
|
||||
/**
|
||||
* 数据集合
|
||||
*/
|
||||
private Datas data;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class Tag {
|
||||
/**
|
||||
* 记录id
|
||||
*/
|
||||
private Long tag_key_id;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
private String tag_key_name;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String tag_key_mobile;
|
||||
|
||||
/**
|
||||
* 课程年级
|
||||
*/
|
||||
private String tag_key_grade;
|
||||
|
||||
/**
|
||||
* 课程科目
|
||||
*/
|
||||
private String tag_key_course;
|
||||
|
||||
/**
|
||||
* 试听设备
|
||||
*/
|
||||
private String tag_key_device;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class Datas {
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 学生报学年级
|
||||
*/
|
||||
private String grade;
|
||||
|
||||
/**
|
||||
* 学生报课科目
|
||||
*/
|
||||
private String course;
|
||||
|
||||
/**
|
||||
* 是否有设备
|
||||
*/
|
||||
private String device;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.yuyou.openapi.openapi.model.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Copyright (C), 2012 - 2018, qyx
|
||||
* FileName: ABClientMessageVO
|
||||
* Author: x
|
||||
* Date: 2020/8/4 6:59 PM
|
||||
* Description: ABClient接口对应接口表现层映射
|
||||
* History:
|
||||
* <author> <time> <version> <desc>
|
||||
* x 2020/8/4 v1.0 创建此文件
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ABClientXuebaMessageVO extends ABClientBaseVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 需要接收到的加密数据
|
||||
*/
|
||||
private String calllog;
|
||||
|
||||
}
|
Loading…
Reference in New Issue