Commit c58bbd6c authored by 李良停's avatar 李良停

llt

parents
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.chineseall.djgdata</groupId>
<artifactId>djgdata</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.16.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-version>4.3.19.RELEASE</spring-version>
<spring.version>4.3.19.RELEASE</spring.version>
<alpha-framework-version>2.0.6.0014</alpha-framework-version>
<spring-boot.version>1.5.16.RELEASE</spring-boot.version>
<mongodb.version>3.10.2</mongodb.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-api</artifactId>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-springboot-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-springboot-starter</artifactId>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-dao-core</artifactId>
<version>${alpha-framework-version}</version>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-dao-mongo</artifactId>
<version>${alpha-framework-version}</version>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-dao-mysql</artifactId>
<version>${alpha-framework-version}</version>
</dependency>
<!--因配置外部TOMCAT 而配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-api</artifactId>
<version>${alpha-framework-version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-springboot-bootstrap</artifactId>
<version>${alpha-framework-version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-core</artifactId>
<version>${alpha-framework-version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-dao-mongo</artifactId>
<version>${alpha-framework-version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.sh.chineseall</groupId>
<artifactId>alpha-framework-springboot-starter</artifactId>
<version>${alpha-framework-version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.6</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>public</id>
<url>http://180.167.91.206:5716/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</project>
\ No newline at end of file
package com.chineseall.djgdata;
import cn.sh.chineseall.framework.starter.annotation.AlphaFrameworkApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
@AlphaFrameworkApplication
@ComponentScan(basePackages = {"com.chineseall.djgdata"})
@EnableScheduling
public class EdenAuthcenterAgentApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(EdenAuthcenterAgentApplication.class);
}
public static void main(String[] args) {
cn.sh.chineseall.framework.springboot.bootstrap.application.AlphaFrameworkSpringApplication.run(EdenAuthcenterAgentApplication.class, args);
}
}
package com.chineseall.djgdata.common.enums;
public enum BookType {
PAPER("PAPER", "纸质"),
DIGITAL("DIGITAL","数字");
private String code;
private String desc;
private BookType(String code, String desc) {
this.code = code;
this.desc = desc;
}
public String getCode() {
return this.code;
}
public String getDesc() {
return this.desc;
}
public static BookType findResultEnum(String code) {
for (BookType resultEnum : values()) {
if (resultEnum.getCode().equals(code)) {
return resultEnum;
}
}
return null;
}
}
package com.chineseall.djgdata.common.enums;
/**
* 结果枚举,作为消息信息
*/
public enum ResultEnum {
/**
* 所有失败的操作均指定为999,未知错误
*/
Error(999, "失败"),
/**
* 令牌不合法
*/
TokenUnValidate(998, "令牌不合法"),
/**
* 签名不合法
*/
SignUnValidate(997, "签名不合法"),
/**
* 签名丢失
*/
SignHeaderMiss(996, "必须传递签名、过期时间和appId"),
/**
* 签名过期
*/
SignTimeOver(995, "签名过期"),
/**
* 用户名或者密码不正确
*/
ErrorUserNameOrPassword(994, "用户名或者密码不正确"),
UserNameInvalid(9941, "用户名无效"),
PasswordIncorrect(9942, "密码不正确"),
AccountDisabled(9943, "账户已冻结"),
/**
* APPID缺失
*/
MissAppId(993, "APP_ID缺失或者不正确"),
UnSupportUserType(992,"不支持的用户类型"),
/**
* 签名时间错误
*/
DeviceLocalTimeError(991,"设备传递的CHINESEALL_SIGN_EXP错误"),
/**
* 成功
*/
Success(1, "成功"),
/**
* 数据库操作失败
*/
DBError(1015, "数据库操作错误"),
/**
* 参数不全
*/
ParamsNull(1002, "参数不全"),
/**
* 不支持的HTTP方法
*/
MethodNotSupport(1001, "不支持的HTTP方法"),
NoHandlerFoundException(1003, "请求的方法不存在"),
SaveAnnotationError(2001, "保存云笔记失败"),
SaveAttachError(2002, "保存附件信息失败"),
SaveAnnotationTagError(2003, "创建云笔记与标签关系失败"),
AnnotationNotExist(2004, "云笔记不存在"),
ShareAnnotationError(2005, "分享笔记失败"),
SaveTagError(2006, "保存标签失败"),
UpdateTagError(2007, "更新标签失败"),
DeleteTagError(2008, "删除标签失败"),
SaveFolderError(2009, "创建文件夹失败"),
FolderNotExist(2010, "文件夹不存在"),
FolderOverdue(2011, "文件夹过期"),
AnnotationIdNull(2012, "笔记id为空"),
AnnotationDeleteError(2013, "删除云笔记失败"),
ShareIdNull(2014, "分享笔记id为空"),
ShareAnnotationNotExist(2015, "分享笔记不存在"),
TagTooMuch(2016, "标签创建过多"),
RegionError(2017, "区域代码错误"),
OrgIdError(2018, "机构代码错误"),
ForbiddenRequest(4000, "不在网关放行许可内"),
ConfigAuthCodeNull(3100, "获取配置信息授权码为空"),
GetConfigError(3001, "获取配置信息失败"),
/**
* 请求数据错误
*/
DataInvalid(1500,"请求数据无效"),
ReadingDataInvalid(1501,"阅读数据无效"),
JobAlreadyRun(1501,"该时间段任务已经执行过"),
JobRunning(1502,"任务正在执行");
private Integer code;
private String message;
private ResultEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
public static ResultEnum findResultEnum(Integer code) {
for (ResultEnum resultEnum : values()) {
if (resultEnum.getCode().equals(code)) {
return resultEnum;
}
}
return null;
}
}
package com.chineseall.djgdata.common.utils;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
public static Date getBeginTime(Date date){
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
}
}
package com.chineseall.djgdata.common.utils;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import javax.crypto.*;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
public class EncodeUtil {
private static final String charset = "utf-8";
private static final String KEY_ALGORITHM = "AES";
private static final String CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding";
private static final String key = "ChineseAllShanghai!@#$%^&*()";
public static String encodePassword(String originPassword) {
return EncodeUtil.base64Encode(
EncodeUtil.md5(originPassword + key), "UTF-8").trim();
}
/**
* 根据指定的字符串生成密钥
* @param len 密钥长度;支持128、192、256三种长度,本项目采用128位。
*
* @return String 密钥
*/
public static String getKey(String key, int len) throws Exception {
if (len != 128 && len != 192 && len != 256)
return null;
key = EncodeUtil.md5(key);
key = key.substring(0, len / 8);
byte[] kb = key.getBytes(charset);
key = EncodeUtil.encodeBase64(kb);
return key;
}
private static Key toKey(byte[] key)
{
return new SecretKeySpec(key, KEY_ALGORITHM);
}
public static String encrypt(String data, String key) throws Exception
{
//Key k = toKey(Base64.decode(key));
Key k = toKey(EncodeUtil.decodeBase64(key).getBytes(charset));
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, k);
String content = parseByte2HexStr(Base64.encodeBase64((cipher.doFinal(data.getBytes(charset)))));
return content;
}
public static String decrypt(String data, String key) throws Exception
{
Key k = toKey(EncodeUtil.decodeBase64(key).getBytes(charset));
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, k);
String content = new String(cipher.doFinal(Base64.decodeBase64(parseHexStr2Byte(data))), charset);
return content;
}
/**将16进制转换为二进制
* @param hexStr
* @return
*/
public static byte[] parseHexStr2Byte(String hexStr) {
if (hexStr.length() < 1)
return null;
byte[] result = new byte[hexStr.length()/2];
for (int i = 0;i< hexStr.length()/2; i++) {
int high = Integer.parseInt(hexStr.substring(i*2, i*2+1), 16);
int low = Integer.parseInt(hexStr.substring(i*2+1, i*2+2), 16);
result[i] = (byte) (high * 16 + low);
}
return result;
}
/**将二进制转换成16进制
* @param buf
* @return
*/
public static String parseByte2HexStr(byte buf[]) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < buf.length; i++) {
String hex = Integer.toHexString(buf[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
sb.append(hex.toUpperCase());
}
return sb.toString();
}
/**
* 传入字符串,返回一个加密串
*
* @param s
* @return
*/
public static String encode(String s , String key) {
try {
byte[] encryptedData = encrypt(s , HEXStringToByte(key));
s = byteToHEXString(encryptedData);
} catch (Exception e) {
e.printStackTrace();
}
return s;
}
/**
* 传入加密串,返回解密串
*
* @param s
* @return
*/
public static String decode(String s , String key) {
try {
return decrypt(HEXStringToByte(s) , HEXStringToByte(key));
} catch (Exception e) {
}
return s;
}
/**
* 传入字符串,返回一个加密串
*
* @param s
* @return
*/
public static String encodeBase64(String s) {
byte[] binaryData = null;
try {
binaryData = s.getBytes("utf-8");
} catch (UnsupportedEncodingException e) {
return s;
}
// byte[] newbt = Base64.encodeBase64(binaryData);
return encodeBase64(binaryData);// new String(newbt);
}
public static String encodeBase64(byte[] binaryData) {
byte[] newbt = Base64.encodeBase64(binaryData);
return new String(newbt);
}
public static byte[] enBase64(byte[] binaryData) {
return Base64.encodeBase64(binaryData);
}
public static byte[] deBase64(byte[] bytes) throws IOException {
return Base64.decodeBase64(bytes);
}
public static String stringEncode(String str) {
try {
return java.net.URLEncoder.encode(str, "utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return str;
}
/**
* 传入加密串,返回解密串
*
* @param s
* @return
*/
public static String decodeBase64(String s) {
try {
return decodeBase64(s.getBytes("utf-8"));
} catch (UnsupportedEncodingException e) {
return s;
}
}
public static String decodeBase64(byte[] bytes) {
byte[] oldbt = null;
String t = null;
try {
oldbt = Base64.decodeBase64(bytes);
t = new String(oldbt, "utf-8");
} catch (UnsupportedEncodingException e) {
}
return t;
}
public static String byteToHEXString(byte[] bArray) {
StringBuilder sb = new StringBuilder(100);
for (int i = 0; i < bArray.length; i++) {
String hex = Integer.toHexString(bArray[i] & 0xff);
if (hex.length() == 1) {
sb.append("0").append(hex);
} else {
sb.append(hex);
}
}
return sb.toString().toUpperCase();
}
public static byte[] HEXStringToByte(String strString) {
byte[] ret = new byte[strString.length() / 2];
for (int i = 0; i < ret.length; i++) {
ret[i] = Integer
.decode("#" + strString.substring(2 * i, 2 * i + 2))
.byteValue();
}
return ret;
}
/**
* 加密方法
*
* @param rawKeyData
* @param str
* @return
* @throws InvalidKeyException
* @throws NoSuchAlgorithmException
* @throws IllegalBlockSizeException
* @throws BadPaddingException
* @throws NoSuchPaddingException
* @throws InvalidKeySpecException
* @throws UnsupportedEncodingException
*/
public static byte[] encrypt(String str , byte [] rawKeyData) throws InvalidKeyException,
NoSuchAlgorithmException, IllegalBlockSizeException,
BadPaddingException, NoSuchPaddingException,
InvalidKeySpecException, UnsupportedEncodingException {
// DES算法要求有一个可信任的随机数源
// SecureRandom sr = new SecureRandom();
// 从原始密匙数据创建一个DESKeySpec对象
DESKeySpec dks = new DESKeySpec(rawKeyData);
// 创建一个密匙工厂,然后用它把DESKeySpec转换成一个SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey key = keyFactory.generateSecret(dks);
// Cipher对象实际完成加密操作
Cipher cipher = Cipher.getInstance("DES");
// 用密匙初始化Cipher对象
cipher.init(Cipher.ENCRYPT_MODE, key);
// 现在,获取数据并加密
byte data[] = str.getBytes("utf-8");
// 正式执行加密操作
byte[] encryptedData = cipher.doFinal(data);
return encryptedData;
}
/**
* 解密方法
*
* @param rawKeyData
* @param encryptedData
* @throws IllegalBlockSizeException
* @throws BadPaddingException
* @throws InvalidKeyException
* @throws NoSuchAlgorithmException
* @throws NoSuchPaddingException
* @throws InvalidKeySpecException
* @throws UnsupportedEncodingException
*/
public static String decrypt(byte[] encryptedData , byte[] rawKeyData)
throws IllegalBlockSizeException, BadPaddingException,
InvalidKeyException, NoSuchAlgorithmException,
NoSuchPaddingException, InvalidKeySpecException,
UnsupportedEncodingException {
// DES算法要求有一个可信任的随机数源
// SecureRandom sr = new SecureRandom();
// 从原始密匙数据创建一个DESKeySpec对象
DESKeySpec dks = new DESKeySpec(rawKeyData);
// 创建一个密匙工厂,然后用它把DESKeySpec对象转换成一个SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey key = keyFactory.generateSecret(dks);
// Cipher对象实际完成解密操作
Cipher cipher = Cipher.getInstance("DES");
// 用密匙初始化Cipher对象
cipher.init(Cipher.DECRYPT_MODE, key);
// 正式执行解密操作
byte decryptedData[] = cipher.doFinal(encryptedData);
return new String(decryptedData, "utf-8");
}
public String getCurrentMillyTime() {
return Long.valueOf(System.currentTimeMillis()).toString();
}
public static String md5(String content) {
return DigestUtils.md5Hex(content);
}
public static String sha(String content) {
return DigestUtils.shaHex(content);
}
public static String base64Encode(String content, String charset) {
byte[] bytes = null;
try {
bytes = Base64.encodeBase64(content.getBytes(charset), true);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return new String(bytes);
}
public static String base64Decode(String content, String charset) {
byte[] bytes = null;
try {
bytes = Base64.decodeBase64(content.getBytes(charset));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return new String(bytes);
}
}
This diff is collapsed.
package com.chineseall.djgdata.common.vo;
import lombok.Data;
import java.io.Serializable;
/**
* Created by yuchunlin on 2019/5/28.
*/
@Data
public class ClientItem implements Serializable{
private String clientName;
private String clientId;
private String clientSecret;
}
package com.chineseall.djgdata.common.vo;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Created by yuchunlin on 2019/5/28.
*/
@Data
@Component
@ConfigurationProperties(prefix = "oauthclient")
public class OauthClient {
private List<ClientItem> clients;
}
package com.chineseall.djgdata.common.vo;
import cn.sh.chineseall.framework.api.MapMessage;
import com.chineseall.djgdata.common.enums.ResultEnum;
/**
* 统一消息返回,<br>
* 目前只做错误消息返回
*
* @author yuchunlin
*/
public class TechMessage<T> extends MapMessage {
public Integer getCode() {
return (Integer) this.get("code");
}
public void setCode(Integer code) {
this.set("code", code);
}
public String getMsg() {
return (String) this.get("msg");
}
public void setMsg(String msg) {
this.set("msg", msg);
}
public T getData() {
return (T) this.get("data");
}
public void setData(T data) {
if (null != data){
this.put("data", data);
}
}
public TechMessage() {
this(ResultEnum.Success);
}
public TechMessage(Integer code, String msg) {
ResultEnum resultEnum = ResultEnum.findResultEnum(code);
if (resultEnum == ResultEnum.Success){
super.setSuccess(true);
}else {
super.setSuccess(false);
}
this.setCode(code);
this.setMsg(msg);
this.setInfo(msg);
}
public TechMessage(ResultEnum result) {
this(result.getCode(), result.getMessage());
}
public TechMessage(Integer code, String msg, T data) {
this(code, msg);
this.setData(data);
}
public TechMessage(ResultEnum result, T data) {
this(result);
this.setData(data);
}
}
package com.chineseall.djgdata.dao;
import cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.Sort;
import cn.sh.chineseall.framework.core.util.CollectionUtils;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.JobRecord;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@Component
public class JobRecordDao extends AlphaStaticJdbcDao<JobRecord, Long> {
@Override
protected void calculateCacheDimensions(JobRecord convertLogJobRecord, Collection<String> collection) {
}
public JobRecord queryLastRecord(){
Criteria criteria = new Criteria();
Sort s = new Sort(Sort.Direction.DESC, "begin_time");
Query query = new Query(criteria);
query.with(s);
List<JobRecord> result = query(query);
if(CollectionUtils.isEmpty(result))
return null;
return result.get(0);
}
public Long countRecordByBeginTime(String jobName, Date beginTime){
Criteria criteria = Criteria.where("job_name").is(jobName).and("begin_time").lte(beginTime).and("end_time").gt(beginTime).and("success").is(true);
return count(new Query(criteria));
}
public Long countRecordByEndTime(String jobName, Date endTime){
Criteria criteria = Criteria.where("job_name").is(jobName).and("begin_time").lt(endTime).and("end_time").gte(endTime).and("success").is(true);
return count(new Query(criteria));
}
}
package com.chineseall.djgdata.dao;
import cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.Sort;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mongo.dao.StaticCacheDimensionDocumentMongoDao;
import com.chineseall.djgdata.model.ReadingData;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
@Component
public class ReadingDataDao extends StaticCacheDimensionDocumentMongoDao<ReadingData, String> {
public List<ReadingData> queryDataByTime(Date beginTime, Date endTime){
Criteria criteria = Criteria.where("createTime").gte(beginTime).lt(endTime);
return query(new Query(criteria));
}
public ReadingData queryDataByTimeFirst(Date beginTime, Date endTime){
Criteria criteria = Criteria.where("createTime").gte(beginTime).lt(endTime);
return query(new Query(criteria).with(new Sort(Sort.Direction.ASC, "createTime")).limit(1)).stream().findFirst().orElse(null);
}
public ReadingData queryDataByTimeLast(Date beginTime, Date endTime){
Criteria criteria = Criteria.where("createTime").gte(beginTime).lt(endTime);
return query(new Query(criteria).with(new Sort(Sort.Direction.DESC, "createTime")).limit(1)).stream().findFirst().orElse(null);
}
public Long countByTime(Date beginTime, Date endTime){
Criteria criteria = Criteria.where("createTime").gte(beginTime).lt(endTime);
return count(new Query(criteria));
}
public List<ReadingData> queryDataByTimestamp(Date beginTime, Date endTime){
Criteria criteria = Criteria.where("timestamp").gte(beginTime).lt(endTime);
return query(new Query(criteria));
}
public List<ReadingData> queryDatas(Long begin, Long end){
return query(new Query(Criteria.where("_id").gte(begin).lt(end)));
}
}
package com.chineseall.djgdata.dao;
import cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.Sort;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.ShangtuData;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.List;
@Component
public class ShangtuDataDao extends AlphaStaticJdbcDao<ShangtuData, Long> {
@Override
protected void calculateCacheDimensions(ShangtuData shangtuData, Collection<String> collection) {
}
public List<ShangtuData> queryDatas(Integer begin, Integer end){
return query(new Query(Criteria.where("id").gte(begin).lt(end)).with(new Sort(Sort.Direction.ASC, "id")));
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RauthorCount;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RauthCountDao extends AlphaStaticJdbcDao<RauthorCount, Long> {
@Override
protected void calculateCacheDimensions(RauthorCount rauthorCount, Collection<String> collection) {
}
public RauthorCount queryByParams(Long userId, String date6, String author){
Criteria criteria = Criteria.where("user_id").is(userId).and("date6").is(date6).and("author").is(author);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RbookBooks;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RbookBooksDao extends AlphaStaticJdbcDao<RbookBooks, Long> {
@Override
protected void calculateCacheDimensions(RbookBooks rbookBooks, Collection<String> collection) {
}
public RbookBooks queryByParams(Long schoolCode, String date6){
Criteria criteria = Criteria.where("school_id").is(schoolCode).and("date6").is(date6);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RbookComp;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RbookCompDao extends AlphaStaticJdbcDao<RbookComp, Long> {
@Override
protected void calculateCacheDimensions(RbookComp rbookComp, Collection<String> collection) {
}
public RbookComp queryByParams(String bookType, String year, Long mon){
Criteria criteria = Criteria.where("book_type").is(bookType).and("year").is(year).and("month").is(mon);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RbookHot;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RbookHotDao extends AlphaStaticJdbcDao<RbookHot, Long> {
@Override
protected void calculateCacheDimensions(RbookHot rbookHot, Collection<String> collection) {
}
public RbookHot queryByParams(Long gradeId, Long sexId, Long bookId, String date6){
Criteria criteria = Criteria.where("grade_id").is(gradeId).and("sex_id").is(sexId).and("book_id").is(bookId).and("date6").is(date6);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RbookMtrend;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RbookMtrendDao extends AlphaStaticJdbcDao<RbookMtrend, Long> {
@Override
protected void calculateCacheDimensions(RbookMtrend rbookMtrend, Collection<String> collection) {
}
public RbookMtrend queryByParams(Long regionId, Long gradeId, String year, Long mon){
Criteria criteria = Criteria.where("region_id").is(regionId).and("grade_id").is(gradeId).and("year").is(year).and("month").is(mon);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RbookRate;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RbookRateDao extends AlphaStaticJdbcDao<RbookRate, Long> {
@Override
protected void calculateCacheDimensions(RbookRate rbookRate, Collection<String> collection) {
}
public RbookRate queryByParams(String ztId, String year){
Criteria criteria = Criteria.where("zt_id").is(ztId).and("year").is(year);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RbookStar;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RbookStarDao extends AlphaStaticJdbcDao<RbookStar, Long> {
@Override
protected void calculateCacheDimensions(RbookStar rbookStar, Collection<String> collection) {
}
public RbookStar queryByParams(Long userId, String date6){
Criteria criteria = Criteria.where("student_id").is(userId).and("date6").is(date6);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RbookYtrend;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RbookYtrendDao extends AlphaStaticJdbcDao<RbookYtrend, Long> {
@Override
protected void calculateCacheDimensions(RbookYtrend rbookYtrend, Collection<String> collection) {
}
public RbookYtrend queryByParams(Long regionId, String year){
Criteria criteria = Criteria.where("region_id").is(regionId).and("year").is(year);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RcostSex;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RcostSexDao extends AlphaStaticJdbcDao<RcostSex, Long> {
@Override
protected void calculateCacheDimensions(RcostSex rcostSex, Collection<String> collection) {
}
public RcostSex queryByParams(String grade,Long ageId, String sex, String date6){
Criteria criteria = Criteria.where("grade").is(grade).and("age_id").is(ageId).and("sex").is(sex).and("date6").is(date6);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RcostTrend;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RcostTrendDao extends AlphaStaticJdbcDao<RcostTrend, Long> {
@Override
protected void calculateCacheDimensions(RcostTrend rcostTrend, Collection<String> collection) {
}
public RcostTrend queryByParams(String year){
Criteria criteria = Criteria.where("year").is(year);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RmulAuth;
import com.chineseall.djgdata.model.djg.RmulZtage;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RmulAuthDao extends AlphaStaticJdbcDao<RmulAuth, Long> {
@Override
protected void calculateCacheDimensions(RmulAuth rmulAuth, Collection<String> collection) {
}
public RmulAuth queryByParams(Long sexCode,Long gradeCode, String author, String year){
Criteria criteria = Criteria.where("sex_id").is(sexCode).and("grade_id").is(gradeCode).and("author_name").is(author).and("date6").is(year);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RmulPub;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RmulPubDao extends AlphaStaticJdbcDao<RmulPub, Long> {
@Override
protected void calculateCacheDimensions(RmulPub rmulPub, Collection<String> collection) {
}
public RmulPub queryByParams(Long pubCode, String date6){
Criteria criteria = Criteria.where("pub_id").is(pubCode).and("date6").is(date6);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RmulPubtrend;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RmulPubtrendDao extends AlphaStaticJdbcDao<RmulPubtrend, Long> {
@Override
protected void calculateCacheDimensions(RmulPubtrend rmulPubtrend, Collection<String> collection) {
}
public RmulPubtrend queryByParams(Long pubId, String year, Long mon){
Criteria criteria = Criteria.where("pub_id").is(pubId).and("year").is(year).and("month").is(mon);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RmulZtage;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RmulZtageDao extends AlphaStaticJdbcDao<RmulZtage, Long> {
@Override
protected void calculateCacheDimensions(RmulZtage rmulZtage, Collection<String> collection) {
}
public RmulZtage queryByParams(Long regionId,Long ageId, String ztId, String date6){
Criteria criteria = Criteria.where("region_id").is(regionId).and("age_id").is(ageId).and("zt_id").is(ztId).and("date6").is(date6);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RmulZtreg;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RmulZtregDao extends AlphaStaticJdbcDao<RmulZtreg, Long> {
@Override
protected void calculateCacheDimensions(RmulZtreg rmulZtreg, Collection<String> collection) {
}
public RmulZtreg queryByParams(Long regionId, String ztId, String date6){
Criteria criteria = Criteria.where("region_id").is(regionId).and("zt_id").is(ztId).and("date6").is(date6);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RmulZtsex;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RmulZtsexDao extends AlphaStaticJdbcDao<RmulZtsex, Long> {
@Override
protected void calculateCacheDimensions(RmulZtsex rmulZtsex, Collection<String> collection) {
}
public RmulZtsex queryByParams(Long regionId,Long sexId, String ztId, String date6){
Criteria criteria = Criteria.where("region_id").is(regionId).and("sex_id").is(sexId).and("zt_id").is(ztId).and("date6").is(date6);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RmulZttrend;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RmulZttrendDao extends AlphaStaticJdbcDao<RmulZttrend, Long> {
@Override
protected void calculateCacheDimensions(RmulZttrend rmulZttrend, Collection<String> collection) {
}
public RmulZttrend queryByParams(String ztId, String year, Long mon){
Criteria criteria = Criteria.where("zt_id").is(ztId).and("year").is(year).and("month").is(mon);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RpublishingCount;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RpublishingCountDao extends AlphaStaticJdbcDao<RpublishingCount, Long> {
@Override
protected void calculateCacheDimensions(RpublishingCount rpublishingCount, Collection<String> collection) {
}
public RpublishingCount queryByParams(Long userId, String date6, String pubName){
Criteria criteria = Criteria.where("user_id").is(userId).and("date6").is(date6).and("publishing").is(pubName);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RreadComp;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RreadCompDao extends AlphaStaticJdbcDao<RreadComp, Long> {
@Override
protected void calculateCacheDimensions(RreadComp rreadComp, Collection<String> collection) {
}
public RreadComp queryByParams(Long userId, String date6, String bookType){
Criteria criteria = Criteria.where("user_id").is(userId).and("date6").is(date6).and("type").is(bookType);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RauthorCount;
import com.chineseall.djgdata.model.djg.RreadQuantity;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RreadQuantityDao extends AlphaStaticJdbcDao<RreadQuantity, Long> {
@Override
protected void calculateCacheDimensions(RreadQuantity rreadQuantity, Collection<String> collection) {
}
public RreadQuantity queryByParams(Long userId, String date6){
Criteria criteria = Criteria.where("user_id").is(userId).and("date6").is(date6);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.dao.djg;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mysql.jdbc.dao.AlphaStaticJdbcDao;
import com.chineseall.djgdata.model.djg.RtypeCount;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class RtypeCountDao extends AlphaStaticJdbcDao<RtypeCount, Long> {
@Override
protected void calculateCacheDimensions(RtypeCount rtypeCount, Collection<String> collection) {
}
public RtypeCount queryByParams(Long userId, String date6, String clcCode){
Criteria criteria = Criteria.where("user_id").is(userId).and("date6").is(date6).and("type").is(clcCode);
return query(new Query(criteria)).stream().findFirst().orElse(null);
}
}
package com.chineseall.djgdata.model;
import cn.sh.chineseall.framework.dao.core.DocumentIdAutoGenerator;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mysql.DocumentTable;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@DocumentConnection(configName = "main")
@DocumentTable(table = "job_record")
public class JobRecord implements Serializable {
@DocumentId(autoGenerator = DocumentIdAutoGenerator.AUTO_INC)
@DocumentField
private Long id;
@DocumentField("job_name")
private String jobName;
@DocumentField("create_time")
private Date createTime;
@DocumentField("process_end_time")
private Date processEndTime;
@DocumentField("begin_time")
private Date beginTime;
@DocumentField("end_time")
private Date endTime;
@DocumentField("success")
private Boolean success;
@DocumentField("suc_count")
private Long sucCount;
@DocumentField("fail_count")
private Long failCount;
@DocumentField("data_count")
private Long dataCount;
}
package com.chineseall.djgdata.model;
import cn.sh.chineseall.framework.dao.core.CacheDimensionDocument;
import cn.sh.chineseall.framework.dao.core.DocumentIdAutoGenerator;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mysql.DocumentTable;
import lombok.Data;
import java.util.Date;
@Data
@DocumentConnection(configName = "main")
@DocumentTable(table = "reading_data")
public class ReadingBaseInfo implements CacheDimensionDocument {
@DocumentId(autoGenerator = DocumentIdAutoGenerator.AUTO_INC)
private Long id;
@DocumentField("uuid")
private String uuid;
@DocumentField("user_id")
private String userId;
@DocumentField("real_name")
private String realName;
@DocumentField
private String birthday;
@DocumentField
private String race;
@DocumentField("student_code")
private String studentCode;
@DocumentField
private String age;
@DocumentField("sex_code")
private String sexCode;
@DocumentField("sex_name")
private String sexName;
@DocumentField("grade_code")
private String gradeCode;
@DocumentField("grade_name")
private String gradeName;
@DocumentField("stage_code")
private String stageCode;
@DocumentField("stage_name")
private String stageName;
@DocumentField("school_id")
private String schoolId;
@DocumentField("school_code")
private String schoolCode;
@DocumentField("school_name")
private String schoolName;
@DocumentField("school_addr")
private String schoolAddr;
@DocumentField("region_code")
private String regionCode;
@DocumentField("region_name")
private String regionName;
@DocumentField("verb_type")
private String verbType;
@DocumentField("verb_name")
private String verbName;
@DocumentField("lend_type_name")
private String lendTypeName;
@DocumentField("lend_type_code")
private String lendTypeCode;
@DocumentField("lend_date")
private String lendDate;
@DocumentField("lend_expired_date")
private String lendExpiredDate;
@DocumentField("lend_addr")
private String lendAddr;
@DocumentField("book_id")
private String bookId;
@DocumentField("book_type_code")
private String bookTypeCode;
@DocumentField("book_type_name")
private String bookTypeName;
@DocumentField("bar_code")
private String barCode;
@DocumentField("book_name")
private String bookName;
@DocumentField("isbn")
private String isbn;
@DocumentField("pub_date")
private String pubDate;
@DocumentField("clc_code")
private String clcCode;
@DocumentField("words_count")
private String wordsCount;
@DocumentField("page_count")
private String pageCount;
@DocumentField
private String price;
@DocumentField
private String author;
@DocumentField("author_id")
private String authorId;
@DocumentField("pub_name")
private String pubName;
@DocumentField("pub_code")
private String pubCode;
@DocumentField("subject_code")
private String subjectCode;
@DocumentField("subject_name")
private String subjectName;
@DocumentField("client_id")
private String clientId;
@DocumentField("client_name")
private String clientName;
@DocumentField("create_time")
private Date createTime;
@DocumentField
private Date timestamp;
@Override
public String[] generateCacheDimensions() {
return new String[0];
}
}
package com.chineseall.djgdata.model;
import cn.sh.chineseall.framework.dao.core.CacheDimensionDocument;
import cn.sh.chineseall.framework.dao.core.DocumentIdAutoGenerator;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentCreateTimestamp;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mongo.DocumentCollection;
import cn.sh.chineseall.framework.dao.core.annotation.mongo.DocumentDatabase;
import lombok.Data;
import java.util.Date;
import java.util.Map;
@Data
@DocumentConnection(configName = "mongo")
@DocumentDatabase(database = "xapi")
@DocumentCollection(collection = "reading_data")
public class ReadingData implements CacheDimensionDocument {
@DocumentId
private String id;
@DocumentCreateTimestamp
private Date createTime;
@DocumentField
private Date timestamp;
@DocumentField
private Map<String, Object> actor;
@DocumentField
private Map<String, Object> verb;
@DocumentField
private Map<String, Object> object;
@DocumentField
private Boolean valid;
@DocumentField
private String clientId;
@DocumentField
private String clientName;
@Override
public String[] generateCacheDimensions() {
return new String[0];
}
public ReadingBaseInfo toReadingBaseInfo(){
ReadingBaseInfo readingBaseInfo = new ReadingBaseInfo();
readingBaseInfo.setUuid(this.id);
readingBaseInfo.setCreateTime(this.createTime);
readingBaseInfo.setTimestamp(this.timestamp);
readingBaseInfo.setClientId(this.clientId);
readingBaseInfo.setClientName(this.clientName);
if(this.actor.get("userInfo")!=null){
Map<String, Object> userInfo = (Map<String, Object>) this.actor.get("userInfo");
readingBaseInfo.setUserId(toString(userInfo.get("userId")));
readingBaseInfo.setRealName(toString(userInfo.get("realName")));
readingBaseInfo.setBirthday(toString(userInfo.get("birthday")));
readingBaseInfo.setRace(toString(userInfo.get("race")));
readingBaseInfo.setStudentCode(toString(userInfo.get("studentCode")));
readingBaseInfo.setAge(toString(userInfo.get("age")));
if(userInfo.get("sex")!=null){
Map<String, Object> sex = (Map<String, Object>) userInfo.get("sex");
readingBaseInfo.setSexCode(toString(sex.get("sexCode")));
readingBaseInfo.setSexName(toString(sex.get("sexName")));
}
if(userInfo.get("grade")!=null){
Map<String, Object> grade = (Map<String, Object>) userInfo.get("grade");
readingBaseInfo.setGradeCode(toString(grade.get("gradeCode")));
readingBaseInfo.setGradeName(toString(grade.get("gradeName")));
}
if(userInfo.get("stage")!=null){
Map<String, Object> stage = (Map<String, Object>) userInfo.get("stage");
readingBaseInfo.setStageCode(toString(stage.get("stageCode")));
readingBaseInfo.setStageName(toString(stage.get("stageName")));
}
if(userInfo.get("schoolInfo")!=null){
Map<String, Object> schoolInfo = (Map<String, Object>) userInfo.get("schoolInfo");
readingBaseInfo.setSchoolId(toString(schoolInfo.get("schoolId")));
readingBaseInfo.setSchoolCode(toString(schoolInfo.get("schoolCode")));
readingBaseInfo.setSchoolName(toString(schoolInfo.get("schoolName")));
readingBaseInfo.setSchoolAddr(toString(schoolInfo.get("schoolAddr")));
}
if(userInfo.get("regionInfo")!=null){
Map<String, Object> regionInfo = (Map<String, Object>) userInfo.get("regionInfo");
readingBaseInfo.setRegionCode(toString(regionInfo.get("regionCode")));
readingBaseInfo.setRegionName(toString(regionInfo.get("regionName")));
}
}
readingBaseInfo.setVerbType(toString(this.verb.get("verbType")));
readingBaseInfo.setVerbName(toString(this.verb.get("verbName")));
if(this.object.get("lendInfo")!=null){
Map<String, Object> lendInfo = (Map<String, Object>) this.object.get("lendInfo");
if(lendInfo.get("lendType")!=null){
Map<String, Object> lendType = (Map<String, Object>) lendInfo.get("lendType");
readingBaseInfo.setLendTypeCode(toString(lendType.get("typeCode")));
readingBaseInfo.setLendTypeName(toString(lendType.get("typeName")));
}
readingBaseInfo.setLendDate(toString(lendInfo.get("lendDate")));
readingBaseInfo.setLendExpiredDate(toString(lendInfo.get("lendExpiredDate")));
readingBaseInfo.setLendAddr(toString(lendInfo.get("lendAddr")));
}
if(this.object.get("bookInfo")!=null){
Map<String, Object> bookInfo = (Map<String, Object>) this.object.get("bookInfo");
if(bookInfo.get("bookType")!=null){
Map<String, Object> bookType = (Map<String, Object>) bookInfo.get("bookType");
readingBaseInfo.setBookTypeCode(toString(bookType.get("typeCode")));
readingBaseInfo.setBookTypeName(toString(bookType.get("typeName")));
}
readingBaseInfo.setBookId(toString(bookInfo.get("bookId")));
readingBaseInfo.setBarCode(toString(bookInfo.get("barCode")));
readingBaseInfo.setBookName(toString(bookInfo.get("bookName")));
readingBaseInfo.setIsbn(toString(bookInfo.get("isbn")));
readingBaseInfo.setPubDate(toString(bookInfo.get("pubDate")));
readingBaseInfo.setClcCode(toString(bookInfo.get("clcCode")));
readingBaseInfo.setWordsCount(toString(bookInfo.get("wordsCount")));
readingBaseInfo.setPageCount(toString(bookInfo.get("pageCount")));
readingBaseInfo.setPrice(toString(bookInfo.get("price")));
readingBaseInfo.setAuthorId(toString(bookInfo.get("authorId")));
readingBaseInfo.setAuthor(toString(bookInfo.get("author")));
if(bookInfo.get("pubInfo")!=null){
Map<String, Object> pubInfo = (Map<String, Object>) bookInfo.get("pubInfo");
readingBaseInfo.setPubCode(toString(pubInfo.get("pubCode")));
readingBaseInfo.setPubName(toString(pubInfo.get("pubName")));
}
if(bookInfo.get("subject")!=null){
Map<String, Object> subject = (Map<String, Object>) bookInfo.get("subject");
readingBaseInfo.setSubjectCode(toString(subject.get("subjectCode")));
readingBaseInfo.setSubjectName(toString(subject.get("subjectName")));
}
}
return readingBaseInfo;
}
private String toString(Object ob){
return ob==null?null:ob.toString();
}
}
package com.chineseall.djgdata.model;
import cn.sh.chineseall.framework.dao.core.CacheDimensionDocument;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mysql.DocumentTable;
import com.chineseall.djgdata.common.enums.BookType;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
@Data
@DocumentConnection(configName = "main")
@DocumentTable(table = "st")
public class ShangtuData implements CacheDimensionDocument {
@DocumentId
private Long id;
@DocumentField
private String jhlx;//借还状态
@DocumentField
private String jhrq;//借还日期
@DocumentField
private String yhrq;//预还日期 只有外借才有值
@DocumentField
private String jhdd;//借还地点
@DocumentField
private String tstm;//图书条码
@DocumentField
private String sm ;//书名
@DocumentField
private String isbn;//isbn号
@DocumentField
private String zz ;//作者
@DocumentField
private String cbs ;//出版社
@DocumentField
private String cbrq;//出版日期
@DocumentField
private String flh ;//分类号 中图分类号
@DocumentField
private String ys ;//页数
@DocumentField
private String dj ;//定价
@DocumentField
private String xjh ;//学籍号
@DocumentField
private String xxdm;//学校代码
@DocumentField
private String xxmc;//学校名称
@DocumentField
private String zjlx;//
@DocumentField
private String xbm ;//性别
@DocumentField
private String csrq;//出生日期
@DocumentField
private String mz ;//民族
@DocumentField
private String gj ;//国籍
@DocumentField
private String xd ;//学段 1、小学,2、中学
@DocumentField
private String xm ;//姓名
@DocumentField
private String sfz ;//身份证
@DocumentField
private String qxdm;//区县代码
@DocumentField
private String student_id ;//学生ID
@DocumentField
private String school_id ;//学校ID
@DocumentField
private String area_id;//区县ID
@DocumentField
private String book_id;//图书ID
@DocumentField
private String auth_id;//作者ID
@DocumentField
private String pub_id ;//出版社ID
@DocumentField
private String date6_birth;//出生日期
@DocumentField
private String date6_enter ;//入学时间
@DocumentField
private String date6_lend ;//借还时间
@DocumentField
private String grade_id ;//年级ID
@DocumentField
private String age_id ;//年龄ID
@DocumentField
private String period_id ;//学段ID
@DocumentField
private String sex_id ;//性别ID
@DocumentField
private String zt_id;//性别ID
@Override
public String[] generateCacheDimensions() {
return new String[0];
}
public ReadingData toReadingData(){
ReadingData readingData = new ReadingData();
Map<String, Object> actor = new HashMap<>();
Map<String, Object> userInfo = new HashMap<>();
userInfo.put("userId", this.student_id);
userInfo.put("realName", this.xm);
userInfo.put("birthday", this.csrq);
userInfo.put("race", this.mz);
userInfo.put("studentCode", this.xjh);
userInfo.put("age", this.age_id);
Map<String, Object> sex = new HashMap<>();
sex.put("sexCode", this.xbm);
sex.put("sexName", null);
userInfo.put("sex", sex);
Map<String, Object> grade = new HashMap<>();
grade.put("gradeCode", this.grade_id);
grade.put("gradeName", null);
userInfo.put("grade", grade);
Map<String, Object> stage = new HashMap<>();
stage.put("stageCode", this.xd);
stage.put("stageName", null);
userInfo.put("stage", stage);
Map<String, Object> schoolInfo = new HashMap<>();
schoolInfo.put("schoolId", this.school_id);
schoolInfo.put("schoolCode", this.xxdm);
schoolInfo.put("schoolName", this.xxmc);
schoolInfo.put("schoolAddr", null);
userInfo.put("schoolInfo", schoolInfo);
Map<String, Object> regionInfo = new HashMap<>();
regionInfo.put("regionCode", this.qxdm);
regionInfo.put("regionName", null);
userInfo.put("regionInfo", regionInfo);
actor.put("userInfo", userInfo);
readingData.setActor(actor);
Map<String, Object> verb = new HashMap<>();
verb.put("verbType", null);
verb.put("verbName", this.jhlx);
readingData.setVerb(verb);
Map<String, Object> object = new HashMap<>();
Map<String, Object> lendInfo = new HashMap<>();
Map<String, Object> lendType = new HashMap<>();
lendType.put("typeCode", null);
lendType.put("typeName", this.jhlx);
lendInfo.put("lendType", lendType);
lendInfo.put("lendDate", this.jhrq);
lendInfo.put("lendExpiredDate", this.yhrq);
lendInfo.put("lendAddr", this.jhdd);
object.put("lendInfo", lendInfo);
Map<String, Object> bookInfo = new HashMap<>();
Map<String, Object> bookType = new HashMap<>();
bookType.put("typeCode", BookType.PAPER.getCode());
bookType.put("typeName", BookType.PAPER.getDesc());
bookInfo.put("bookType", bookType);
bookInfo.put("bookId", this.book_id);
bookInfo.put("barCode", this.tstm);
bookInfo.put("bookName", this.sm);
bookInfo.put("isbn", this.isbn);
bookInfo.put("pubDate", this.cbrq);
bookInfo.put("clcCode", this.flh);
bookInfo.put("wordsCount", null);
bookInfo.put("pageCount", this.ys);
bookInfo.put("price", this.dj);
bookInfo.put("author", this.zz);
Map<String, Object> pubInfo = new HashMap<>();
pubInfo.put("pubCode", this.pub_id);
pubInfo.put("pubName", this.cbs);
bookInfo.put("pubInfo", pubInfo);
Map<String, Object> subject = new HashMap<>();
subject.put("subjectCode", null);
subject.put("subjectName", null);
bookInfo.put("subject", subject);
object.put("bookInfo", bookInfo);
readingData.setObject(object);
return readingData;
}
}
package com.chineseall.djgdata.model.djg;
import cn.sh.chineseall.framework.dao.core.DocumentIdAutoGenerator;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mysql.DocumentTable;
import lombok.Data;
import java.io.Serializable;
@Data
@DocumentConnection(configName = "main")
@DocumentTable(table = "r_author_count")
public class RauthorCount implements Serializable {
@DocumentId(autoGenerator = DocumentIdAutoGenerator.AUTO_INC)
private Long id;
@DocumentField
private Long region_id;
@DocumentField
private Long user_id;
@DocumentField
private String date6;
@DocumentField
private Long month;
@DocumentField
private String author;
@DocumentField
private Long cc;
}
package com.chineseall.djgdata.model.djg;
import cn.sh.chineseall.framework.dao.core.DocumentIdAutoGenerator;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mysql.DocumentTable;
import lombok.Data;
import java.io.Serializable;
@Data
@DocumentConnection(configName = "main")
@DocumentTable(table = "r_book_books")
public class RbookBooks implements Serializable {
@DocumentId(autoGenerator = DocumentIdAutoGenerator.AUTO_INC)
private Long id;
@DocumentField
private Long region_id;
@DocumentField
private String region_name;
@DocumentField
private Long school_id;
@DocumentField
private String school_name;
@DocumentField
private String date6;
@DocumentField
private Long cc;
@DocumentField
private Integer level_type;
@DocumentField
private Long level_id;
@DocumentField
private Integer src_type;
}
package com.chineseall.djgdata.model.djg;
import cn.sh.chineseall.framework.dao.core.DocumentIdAutoGenerator;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mysql.DocumentTable;
import lombok.Data;
import java.io.Serializable;
@Data
@DocumentConnection(configName = "main")
@DocumentTable(table = "r_book_comp")
public class RbookComp implements Serializable {
@DocumentId(autoGenerator = DocumentIdAutoGenerator.AUTO_INC)
private Long id;
@DocumentField
private String book_type;
@DocumentField
private String year;
@DocumentField
private Long month;
@DocumentField
private Long cc;
@DocumentField
private Integer level_type;
@DocumentField
private Long level_id;
@DocumentField
private Integer src_type;
}
package com.chineseall.djgdata.model.djg;
import cn.sh.chineseall.framework.dao.core.DocumentIdAutoGenerator;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mysql.DocumentTable;
import lombok.Data;
import java.io.Serializable;
@Data
@DocumentConnection(configName = "main")
@DocumentTable(table = "r_book_hot")
public class RbookHot implements Serializable {
@DocumentId(autoGenerator = DocumentIdAutoGenerator.AUTO_INC)
private Long id;
@DocumentField
private Long grade_id;
@DocumentField
private String grade_name;
@DocumentField
private Long sex_id;
@DocumentField
private String sex_name;
@DocumentField
private Long book_id;
@DocumentField
private String book_name;
@DocumentField
private String author;
@DocumentField
private String press;
@DocumentField
private String date6;
@DocumentField
private Long cc;
@DocumentField
private Integer level_type;
@DocumentField
private Long level_id;
@DocumentField
private Integer src_type;
}
package com.chineseall.djgdata.model.djg;
import cn.sh.chineseall.framework.dao.core.DocumentIdAutoGenerator;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mysql.DocumentTable;
import lombok.Data;
import java.io.Serializable;
@Data
@DocumentConnection(configName = "main")
@DocumentTable(table = "r_book_mtrend")
public class RbookMtrend implements Serializable {
@DocumentId(autoGenerator = DocumentIdAutoGenerator.AUTO_INC)
private Long id;
@DocumentField
private Long region_id;
@DocumentField
private String region_name;
@DocumentField
private Long grade_id;
@DocumentField
private String grade_name;
@DocumentField
private String year;
@DocumentField
private Long month;
@DocumentField
private Long cc;
@DocumentField
private Integer level_type;
@DocumentField
private Long level_id;
@DocumentField
private Integer src_type;
}
package com.chineseall.djgdata.model.djg;
import cn.sh.chineseall.framework.dao.core.DocumentIdAutoGenerator;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentConnection;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentField;
import cn.sh.chineseall.framework.dao.core.annotation.DocumentId;
import cn.sh.chineseall.framework.dao.core.annotation.mysql.DocumentTable;
import lombok.Data;
import java.io.Serializable;
@Data
@DocumentConnection(configName = "main")
@DocumentTable(table = "r_book_rate")
public class RbookRate implements Serializable {
@DocumentId(autoGenerator = DocumentIdAutoGenerator.AUTO_INC)
private Long id;
@DocumentField
private String zt_id;
@DocumentField
private String zt_name;
@DocumentField
private String year;
@DocumentField
private Long used_count;
@DocumentField
private Integer level_type;
@DocumentField
private Long level_id;
@DocumentField
private Integer src_type;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
package com.chineseall.djgdata.service;
import com.chineseall.djgdata.model.ReadingData;
public interface ReadingDataService {
ReadingData getById(String id);
void save(ReadingData readingData);
}
This diff is collapsed.
This diff is collapsed.
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