Commit fc6d3125 by 徐甲彬

Merge remote-tracking branch 'origin/master'

2 parents c2a54915 65d62ed8
Showing 61 changed files with 1336 additions and 322 deletions
package com.dookay.cihai.core.theme.domain;
import lombok.Data;
import java.io.Serializable;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import java.util.List;
/**
* 专题
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@Data
@Table(name = "t_theme")
public class ThemeDomain implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
private Long id;
/**
*
*/
private String title;
/**
*
*/
private String introduce;
/**
*
*/
private String basicInfo;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*
*/
private String subTitle;
}
package com.dookay.cihai.core.theme.domain;
import lombok.Data;
import java.io.Serializable;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import java.util.List;
/**
* 专题词条关系
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@Data
@Table(name = "t_theme_word")
public class ThemeWordDomain implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
private Long id;
/**
*
*/
private Long wordId;
/**
*
*/
private Long themeId;
/**
*
*/
private Date createTime;
}
package com.dookay.cihai.core.theme.mapper;
import com.dookay.coral.common.core.persistence.Mapper;
import com.dookay.cihai.core.theme.domain.ThemeDomain;
/**
* 专题
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface ThemeMapper extends Mapper<ThemeDomain> {
}
package com.dookay.cihai.core.theme.mapper;
import com.dookay.coral.common.core.persistence.Mapper;
import com.dookay.cihai.core.theme.domain.ThemeWordDomain;
/**
* 专题词条关系
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface ThemeWordMapper extends Mapper<ThemeWordDomain> {
}
package com.dookay.cihai.core.theme.query;
import com.dookay.coral.common.core.persistence.Query;
import tk.mybatis.mapper.entity.Example;
import com.dookay.coral.common.core.persistence.criteria.QueryCriteria;
import com.dookay.cihai.core.theme.domain.ThemeDomain;
/**
* 专题
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public class ThemeQuery extends Query {
@Override
public QueryCriteria toCriteria() {
QueryCriteria queryCriteria = new QueryCriteria(ThemeDomain.class);
Example.Criteria criteria = queryCriteria.createCriteria();
//todo 写查询逻辑
return queryCriteria;
}
}
package com.dookay.cihai.core.theme.query;
import com.dookay.coral.common.core.persistence.Query;
import tk.mybatis.mapper.entity.Example;
import com.dookay.coral.common.core.persistence.criteria.QueryCriteria;
import com.dookay.cihai.core.theme.domain.ThemeWordDomain;
/**
* 专题词条关系
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public class ThemeWordQuery extends Query {
@Override
public QueryCriteria toCriteria() {
QueryCriteria queryCriteria = new QueryCriteria(ThemeWordDomain.class);
Example.Criteria criteria = queryCriteria.createCriteria();
//todo 写查询逻辑
return queryCriteria;
}
}
package com.dookay.cihai.core.theme.service;
import com.dookay.coral.common.core.service.IBaseService;
import com.dookay.cihai.core.theme.domain.ThemeDomain;
/**
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface IThemeService extends IBaseService<ThemeDomain> {
}
package com.dookay.cihai.core.theme.service;
import com.dookay.coral.common.core.service.IBaseService;
import com.dookay.cihai.core.theme.domain.ThemeWordDomain;
/**
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface IThemeWordService extends IBaseService<ThemeWordDomain> {
}
package com.dookay.cihai.core.theme.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dookay.coral.common.core.service.impl.BaseServiceImpl;
import com.dookay.cihai.core.theme.mapper.ThemeMapper;
import com.dookay.cihai.core.theme.domain.ThemeDomain;
import com.dookay.cihai.core.theme.service.IThemeService;
/**
* 专题
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@SuppressWarnings("ALL")
@Service("themeService")
public class ThemeServiceImpl extends BaseServiceImpl<ThemeDomain> implements IThemeService {
@Autowired
private ThemeMapper themeMapper;
}
package com.dookay.cihai.core.theme.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dookay.coral.common.core.service.impl.BaseServiceImpl;
import com.dookay.cihai.core.theme.mapper.ThemeWordMapper;
import com.dookay.cihai.core.theme.domain.ThemeWordDomain;
import com.dookay.cihai.core.theme.service.IThemeWordService;
/**
* 专题词条关系
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@SuppressWarnings("ALL")
@Service("themeWordService")
public class ThemeWordServiceImpl extends BaseServiceImpl<ThemeWordDomain> implements IThemeWordService {
@Autowired
private ThemeWordMapper themeWordMapper;
}
package com.dookay.cihai.core.word.domain;
import lombok.Data;
import java.io.Serializable;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import java.util.List;
/**
* 自定义字典
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@Data
@Table(name = "t_custom_dictionary")
public class CustomDictionaryDomain implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
private Long id;
/**
*
*/
private String word;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}
package com.dookay.cihai.core.word.domain;
import lombok.Data;
import java.io.Serializable;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import java.util.List;
/**
* 词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@Data
@Table(name = "t_word")
public class WordDomain implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
private Long id;
/**
*
*/
private String word;
/**
*
*/
private String body;
/**
*
*/
private String baikePoster;
/**
*
*/
private String baikeVoice;
/**
*
*/
private String baikeDescription;
/**
*
*/
private String baikeParaphrase;
/**
*
*/
private String baikePhotos;
/**
*
*/
private String baikeVideo;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 拼音
*/
private String wordSpell;
}
package com.dookay.cihai.core.word.mapper;
import com.dookay.coral.common.core.persistence.Mapper;
import com.dookay.cihai.core.word.domain.CustomDictionaryDomain;
/**
* 自定义字典
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface CustomDictionaryMapper extends Mapper<CustomDictionaryDomain> {
}
package com.dookay.cihai.core.word.mapper;
import com.dookay.coral.common.core.persistence.Mapper;
import com.dookay.cihai.core.word.domain.WordDomain;
/**
* 词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface WordMapper extends Mapper<WordDomain> {
}
package com.dookay.cihai.core.word.query;
import com.dookay.coral.common.core.persistence.Query;
import tk.mybatis.mapper.entity.Example;
import com.dookay.coral.common.core.persistence.criteria.QueryCriteria;
import com.dookay.cihai.core.word.domain.CustomDictionaryDomain;
/**
* 自定义字典
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public class CustomDictionaryQuery extends Query {
@Override
public QueryCriteria toCriteria() {
QueryCriteria queryCriteria = new QueryCriteria(CustomDictionaryDomain.class);
Example.Criteria criteria = queryCriteria.createCriteria();
//todo 写查询逻辑
return queryCriteria;
}
}
package com.dookay.cihai.core.word.query;
import com.dookay.coral.common.core.persistence.Query;
import tk.mybatis.mapper.entity.Example;
import com.dookay.coral.common.core.persistence.criteria.QueryCriteria;
import com.dookay.cihai.core.word.domain.WordDomain;
/**
* 词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public class WordQuery extends Query {
@Override
public QueryCriteria toCriteria() {
QueryCriteria queryCriteria = new QueryCriteria(WordDomain.class);
Example.Criteria criteria = queryCriteria.createCriteria();
//todo 写查询逻辑
return queryCriteria;
}
}
package com.dookay.cihai.core.word.service;
import com.dookay.coral.common.core.service.IBaseService;
import com.dookay.cihai.core.word.domain.CustomDictionaryDomain;
/**
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface ICustomDictionaryService extends IBaseService<CustomDictionaryDomain> {
}
package com.dookay.cihai.core.word.service;
import com.dookay.coral.common.core.service.IBaseService;
import com.dookay.cihai.core.word.domain.WordDomain;
/**
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface IWordService extends IBaseService<WordDomain> {
}
package com.dookay.cihai.core.word.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dookay.coral.common.core.service.impl.BaseServiceImpl;
import com.dookay.cihai.core.word.mapper.CustomDictionaryMapper;
import com.dookay.cihai.core.word.domain.CustomDictionaryDomain;
import com.dookay.cihai.core.word.service.ICustomDictionaryService;
/**
* 自定义字典
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@SuppressWarnings("ALL")
@Service("customDictionaryService")
public class CustomDictionaryServiceImpl extends BaseServiceImpl<CustomDictionaryDomain> implements ICustomDictionaryService {
@Autowired
private CustomDictionaryMapper customDictionaryMapper;
}
package com.dookay.cihai.core.word.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dookay.coral.common.core.service.impl.BaseServiceImpl;
import com.dookay.cihai.core.word.mapper.WordMapper;
import com.dookay.cihai.core.word.domain.WordDomain;
import com.dookay.cihai.core.word.service.IWordService;
/**
* 词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@SuppressWarnings("ALL")
@Service("wordService")
public class WordServiceImpl extends BaseServiceImpl<WordDomain> implements IWordService {
@Autowired
private WordMapper wordMapper;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dookay.cihai.core.word.mapper.CustomDictionaryMapper" >
<!-- 公共查询语句 -->
<sql id="selectSql">
select
<trim suffixOverrides="," >
a.`id` as 'id',
a.`word` as 'word',
a.`create_time` as 'createTime',
a.`update_time` as 'updateTime',
</trim>
from
`t_custom_dictionary` as a
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dookay.cihai.core.theme.mapper.ThemeMapper" >
<!-- 公共查询语句 -->
<sql id="selectSql">
select
<trim suffixOverrides="," >
a.`id` as 'id',
a.`title` as 'title',
a.`introduce` as 'introduce',
a.`basic_info` as 'basicInfo',
a.`create_time` as 'createTime',
a.`update_time` as 'updateTime',
a.`sub_title` as 'subTitle',
</trim>
from
`t_theme` as a
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dookay.cihai.core.theme.mapper.ThemeWordMapper" >
<!-- 公共查询语句 -->
<sql id="selectSql">
select
<trim suffixOverrides="," >
a.`id` as 'id',
a.`word_id` as 'wordId',
a.`theme_id` as 'themeId',
a.`create_time` as 'createTime',
</trim>
from
`t_theme_word` as a
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dookay.cihai.core.word.mapper.WordMapper" >
<!-- 公共查询语句 -->
<sql id="selectSql">
select
<trim suffixOverrides="," >
a.`id` as 'id',
a.`word` as 'word',
a.`body` as 'body',
a.`baike_poster` as 'baikePoster',
a.`baike_voice` as 'baikeVoice',
a.`baike_description` as 'baikeDescription',
a.`baike_paraphrase` as 'baikeParaphrase',
a.`baike_photos` as 'baikePhotos',
a.`baike_video` as 'baikeVideo',
a.`create_time` as 'createTime',
a.`update_time` as 'updateTime',
a.`word_spell` as 'wordSpell',
</trim>
from
`t_word` as a
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
package com.dookay.cihai.core;
import com.dookay.coral.common.core.CoralCommonCoreMarker;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author houkun
*/
@SpringBootApplication(scanBasePackageClasses = {
CoralCommonCoreMarker.class,
CiHaiCoreApplication.class
})
@MapperScan(basePackageClasses = CiHaiCoreApplication.class)
public class CiHaiCoreApplication {
public static void main(String[] args) {
SpringApplication.run(CiHaiCoreApplication.class, args);
}
}
...@@ -38,7 +38,6 @@ import org.springframework.data.redis.core.StringRedisTemplate; ...@@ -38,7 +38,6 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -52,8 +51,10 @@ import java.util.stream.Collectors; ...@@ -52,8 +51,10 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public final class AipWordUtilBean { public final class AipWordUtilBean {
private static final String APP_ID = "10486245";
private static final String API_KEY = "ws8qdxT51xm2qbWufxzRedI3";
private static final String SECRET_KEY = "8b6g9ZyR69dFl6aqYdIOGa4IbOGgkdjh";
private static final ConcurrentHashMap<String, Double> SCORE_MAP = new ConcurrentHashMap<>();
private static final String SCORE_KEY_PREFIX = "WORD_SCORE:"; private static final String SCORE_KEY_PREFIX = "WORD_SCORE:";
private static final double CRITICAL_VALUE = 0.4D; private static final double CRITICAL_VALUE = 0.4D;
private static final double RELATE_CRITICAL_VALUE = 0.6D; private static final double RELATE_CRITICAL_VALUE = 0.6D;
...@@ -64,14 +65,15 @@ public final class AipWordUtilBean { ...@@ -64,14 +65,15 @@ public final class AipWordUtilBean {
private static final String INTERNAL_ERROR = "282000"; private static final String INTERNAL_ERROR = "282000";
private final AipNlp aipNlp; private final AipNlp aipNlp;
private final StringRedisTemplate template;
@Autowired @Autowired
public AipWordUtilBean(AipNlp aipNlp, StringRedisTemplate template) { private StringRedisTemplate template;
this.aipNlp = aipNlp;
this.template = template; public AipWordUtilBean() {
this.aipNlp = new AipNlp(APP_ID, API_KEY, SECRET_KEY);
} }
/** /**
* 抽取查询关键词 * 抽取查询关键词
* *
......
package com.dookay.cihai.core.aip.config;
/*****************************************
* *
* @dookay.com Internet make it happen *
* ----------- ----------------------- *
* dddd ddddd Internet make it happen *
* o o o Internet make it happen *
* k k k Internet make it happen *
* a a a Internet make it happen *
* yyyy yyyyy Internet make it happen *
* ----------- ----------------------- *
* @dookay.com Internet make it happen *
* *
****************************************/
import com.baidu.aip.nlp.AipNlp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 配置
*
* @author houkun
* @date 2017/12/6
*/
@Configuration
public class AipConfig {
private final AipProperties aipProperties;
@Autowired
public AipConfig(AipProperties aipProperties) {
this.aipProperties = aipProperties;
}
@Bean
public AipNlp aipNlp() {
AipNlp aipNlp = new AipNlp(aipProperties.getAppId(), aipProperties.getApiKey(), aipProperties.getSecretKey());
aipNlp.setConnectionTimeoutInMillis(2000);
aipNlp.setSocketTimeoutInMillis(60000);
return aipNlp;
}
}
package com.dookay.cihai.core.aip.config;
/*****************************************
* *
* @dookay.com Internet make it happen *
* ----------- ----------------------- *
* dddd ddddd Internet make it happen *
* o o o Internet make it happen *
* k k k Internet make it happen *
* a a a Internet make it happen *
* yyyy yyyyy Internet make it happen *
* ----------- ----------------------- *
* @dookay.com Internet make it happen *
* *
****************************************/
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* 配置文件
*
* @author houkun
* @date 2017/12/6
*/
@ConfigurationProperties("aip")
@Data
@Component
public class AipProperties {
private String appId;
private String apiKey;
private String secretKey;
}
package com.dookay.cihai.core.word.domain;
import lombok.Data;
import java.io.Serializable;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import java.util.List;
/**
* 自定义词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@Data
@Table(name = "t_custom_dictionary")
public class CustomDictionaryDomain implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
private Long id;
/**
*
*/
private String word;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}
...@@ -79,6 +79,8 @@ public class WordDomain implements Serializable { ...@@ -79,6 +79,8 @@ public class WordDomain implements Serializable {
* 拼音 * 拼音
*/ */
private String wordSpell; private String wordSpell;
private String category;
} }
package com.dookay.cihai.core.word.mapper;
import com.dookay.coral.common.core.persistence.Mapper;
import com.dookay.cihai.core.word.domain.CustomDictionaryDomain;
/**
* 自定义词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface CustomDictionaryMapper extends Mapper<CustomDictionaryDomain> {
}
package com.dookay.cihai.core.word.query;
import com.dookay.coral.common.core.persistence.Query;
import lombok.Data;
import tk.mybatis.mapper.entity.Example;
import com.dookay.coral.common.core.persistence.criteria.QueryCriteria;
import com.dookay.cihai.core.word.domain.CustomDictionaryDomain;
/**
* 自定义词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@Data
public class CustomDictionaryQuery extends Query {
private String word;
@Override
public QueryCriteria toCriteria() {
QueryCriteria queryCriteria = new QueryCriteria(CustomDictionaryDomain.class);
Example.Criteria criteria = queryCriteria.createCriteria();
if (valid(word)) {
criteria.andEqualTo("word");
}
//todo 写查询逻辑
return queryCriteria;
}
}
package com.dookay.cihai.core.word.service;
import com.dookay.coral.common.core.service.IBaseService;
import com.dookay.cihai.core.word.domain.CustomDictionaryDomain;
/**
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
public interface ICustomDictionaryService extends IBaseService<CustomDictionaryDomain> {
}
package com.dookay.cihai.core.word.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dookay.coral.common.core.service.impl.BaseServiceImpl;
import com.dookay.cihai.core.word.mapper.CustomDictionaryMapper;
import com.dookay.cihai.core.word.domain.CustomDictionaryDomain;
import com.dookay.cihai.core.word.service.ICustomDictionaryService;
/**
* 自定义词条
* @author wangwei
* @since 2017年12月07日
* @version V1.0
*/
@SuppressWarnings("ALL")
@Service("customDictionaryService")
public class CustomDictionaryServiceImpl extends BaseServiceImpl<CustomDictionaryDomain> implements ICustomDictionaryService {
@Autowired
private CustomDictionaryMapper customDictionaryMapper;
}
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
<property name="smallint" value="Boolean"/> <property name="smallint" value="Boolean"/>
</javaTypeResolver> </javaTypeResolver>
<table tableName="t_custom_dictionary" domainObjectName="CustomDictionary"
packageName="com.dookay.cihai.core.word" desc="自定义字典" author="wangwei">
</table>
<table tableName="t_word" domainObjectName="Word" <table tableName="t_word" domainObjectName="Word"
packageName="com.dookay.cihai.core.word" desc="词条" author="wangwei"> packageName="com.dookay.cihai.core.word" desc="词条" author="wangwei">
</table> </table>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dookay.cihai.core.word.mapper.CustomDictionaryMapper" >
<!-- 公共查询语句 -->
<sql id="selectSql">
select
<trim suffixOverrides="," >
a.`id` as 'id',
a.`word` as 'word',
a.`create_time` as 'createTime',
a.`update_time` as 'updateTime',
</trim>
from
`t_custom_dictionary` as a
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
...@@ -18,10 +18,6 @@ mybatis.mapper-locations=classpath*:mapper/*.xml ...@@ -18,10 +18,6 @@ mybatis.mapper-locations=classpath*:mapper/*.xml
spring.redis.host=192.168.2.27 spring.redis.host=192.168.2.27
spring.redis.password=100001 spring.redis.password=100001
aip.app-id=10486245
aip.api-key=ws8qdxT51xm2qbWufxzRedI3
aip.secret-key=8b6g9ZyR69dFl6aqYdIOGa4IbOGgkdjh
logging.level.com.dookay.cihai.core=debug logging.level.com.dookay.cihai.core=debug
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
package com.dookay.cihai.wechat.config; package com.dookay.cihai.wechat.config;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
...@@ -25,7 +26,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur ...@@ -25,7 +26,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
* @date 2017/12/7 * @date 2017/12/7
*/ */
@EnableWebSecurity @EnableWebSecurity
@Order @Order(Ordered.HIGHEST_PRECEDENCE)
public class WechatSecurityConfig extends WebSecurityConfigurerAdapter { public class WechatSecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
......
...@@ -18,8 +18,8 @@ import com.dookay.cihai.core.aip.AipWordUtilBean; ...@@ -18,8 +18,8 @@ import com.dookay.cihai.core.aip.AipWordUtilBean;
import com.dookay.cihai.core.theme.domain.ThemeDomain; import com.dookay.cihai.core.theme.domain.ThemeDomain;
import com.dookay.cihai.core.theme.query.ThemeQuery; import com.dookay.cihai.core.theme.query.ThemeQuery;
import com.dookay.cihai.core.theme.service.IThemeService; import com.dookay.cihai.core.theme.service.IThemeService;
import com.dookay.cihai.core.word.domain.WordDomain; import com.dookay.cihai.core.word.query.CustomDictionaryQuery;
import com.dookay.cihai.core.word.query.WordQuery; import com.dookay.cihai.core.word.service.ICustomDictionaryService;
import com.dookay.cihai.core.word.service.IWordService; import com.dookay.cihai.core.word.service.IWordService;
import com.dookay.coral.common.web.controller.BaseController; import com.dookay.coral.common.web.controller.BaseController;
import com.dookay.coral.common.web.response.JsonResult; import com.dookay.coral.common.web.response.JsonResult;
...@@ -43,6 +43,8 @@ public class HomeController extends BaseController { ...@@ -43,6 +43,8 @@ public class HomeController extends BaseController {
@Autowired @Autowired
private IThemeService themeService; private IThemeService themeService;
@Autowired
private ICustomDictionaryService customDictionaryService;
@Autowired @Autowired
private AipWordUtilBean aipWordUtilBean; private AipWordUtilBean aipWordUtilBean;
...@@ -67,16 +69,25 @@ public class HomeController extends BaseController { ...@@ -67,16 +69,25 @@ public class HomeController extends BaseController {
@ResponseBody @ResponseBody
public JsonResult search(String keyword) { public JsonResult search(String keyword) {
System.out.println("进入搜索"); System.out.println("进入搜索");
String result = null;
CustomDictionaryQuery query1 = new CustomDictionaryQuery();
query1.setWord(keyword);
try { try {
String result = aipWordUtilBean.extractQueryKeyword(keyword); int count = customDictionaryService.count(query1);
if (count > 0) {
result = keyword;
} else {
result = aipWordUtilBean.extractQueryKeyword(keyword);
}
ThemeQuery query = new ThemeQuery(); ThemeQuery query = new ThemeQuery();
query.setKeyword(keyword); query.setKeyword(result);
ThemeDomain themeDomain = themeService.getFirst(query); ThemeDomain themeDomain = themeService.getFirst(query);
if (themeDomain == null) return errorResult("暂无检索结果"); if (themeDomain == null) return errorResult(String.format("暂无\"%s\"检索结果",keyword));
System.out.println(themeDomain); System.out.println(themeDomain);
return successResult("success", "/theme/detail/" + themeDomain.getId()); return successResult("success", "/theme/detail/" + themeDomain.getId());
} catch (Exception ex) { } catch (Exception ex) {
return errorResult("暂无检索结果"); return errorResult(String.format("暂无\"%s\"检索结果",keyword));
} }
} }
} }
...@@ -14,16 +14,26 @@ ...@@ -14,16 +14,26 @@
package com.dookay.cihai.wechat.controller; package com.dookay.cihai.wechat.controller;
import com.alibaba.fastjson.JSONObject;
import com.dookay.cihai.core.aip.AipWordUtilBean;
import com.dookay.cihai.core.aip.model.WordRelation;
import com.dookay.cihai.core.aip.model.WordSequence;
import com.dookay.cihai.core.theme.domain.ThemeDomain; import com.dookay.cihai.core.theme.domain.ThemeDomain;
import com.dookay.cihai.core.theme.service.IThemeService; import com.dookay.cihai.core.theme.service.IThemeService;
import com.dookay.coral.common.web.controller.BaseController; import com.dookay.coral.common.web.controller.BaseController;
import com.dookay.coral.common.web.response.JsonResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author 石磊 * @author 石磊
* @date 2017/12/6 * @date 2017/12/6
...@@ -34,6 +44,8 @@ public class ThemeController extends BaseController { ...@@ -34,6 +44,8 @@ public class ThemeController extends BaseController {
@Autowired @Autowired
private IThemeService themeService; private IThemeService themeService;
@Autowired
private AipWordUtilBean aipWordUtilBean;
/** /**
* @author 石磊 * @author 石磊
...@@ -47,4 +59,39 @@ public class ThemeController extends BaseController { ...@@ -47,4 +59,39 @@ public class ThemeController extends BaseController {
mv.addObject("theme", themeDomain); mv.addObject("theme", themeDomain);
return mv; return mv;
} }
/**
* 关联词出现次数
*
* @author houkun
* @date 2017/12/7
*/
@RequestMapping(value = "/detail/{id}/related", method = RequestMethod.GET)
@ResponseBody
public JsonResult related(@PathVariable Long id) {
ThemeDomain themeDomain = themeService.get(id);
String document = themeDomain.getIntroduce();
Map<String, Long> wordCountMap = aipWordUtilBean.extractNounWordsWithCount(document);
return successResult("关联词出现次数", wordCountMap);
}
/**
* 图谱信息
*
* @author houkun
* @date 2017/12/7
*/
@RequestMapping(value = "/detail/{id}/map", method = RequestMethod.GET)
@ResponseBody
public JsonResult map(@PathVariable Long id) {
ThemeDomain themeDomain = themeService.get(id);
String document = themeDomain.getIntroduce();
List<String> keywords = aipWordUtilBean.extractKeyWords(themeDomain.getTitle(), document, 15);
List<WordSequence> wordSequences = keywords.stream().map(l -> new WordSequence(keywords.indexOf(l), l)).collect(Collectors.toList());
List<WordRelation> wordRelations = aipWordUtilBean.generateWordsMap(keywords);
JSONObject jsonObject = new JSONObject();
jsonObject.put("nodes", wordSequences);
jsonObject.put("edges", wordRelations);
return successResult("success", jsonObject);
}
} }
/*****************************************
* *
* @dookay.com Internet make it happen *
* ----------- ----------------------- *
* dddd ddddd Internet make it happen *
* o o o Internet make it happen *
* k k k Internet make it happen *
* a a a Internet make it happen *
* yyyy yyyyy Internet make it happen *
* ----------- ----------------------- *
* NO BUG ENJOY LIFE *
* *
****************************************/
package com.dookay.cihai.wechat.controller;
import com.dookay.cihai.core.word.domain.WordDomain;
import com.dookay.cihai.core.word.service.IWordService;
import com.dookay.coral.common.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
/**
* @author 石磊
* @date 2017/12/7
*/
@Controller
@RequestMapping("/word")
public class WordController extends BaseController {
@Autowired
private IWordService wordService;
/**
* @author 石磊
* @date 2017/12/7
* @description 详情
*/
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
public ModelAndView detail(@PathVariable Long id) {
WordDomain wordDomain = wordService.get(id);
ModelAndView mv = new ModelAndView("/portal/word/detail");
mv.addObject("word", wordDomain);
return mv;
}
/**
* @author 石磊
* @date 2017/12/7
* @description 百科页面
*/
@RequestMapping(value = "/baike/{id}", method = RequestMethod.GET)
public ModelAndView baike(@PathVariable Long id) {
WordDomain wordDomain = wordService.get(id);
ModelAndView mv = new ModelAndView("/portal/word/baike");
mv.addObject("word", wordDomain);
return mv;
}
}
...@@ -11,7 +11,7 @@ logging.level.root=info ...@@ -11,7 +11,7 @@ logging.level.root=info
logging.level.com.dookay.core=trace logging.level.com.dookay.core=trace
# redis # redis
spring.redis.host=192.168.2.27 spring.redis.host=192.168.2.27
spring.redis.password=lyd123456 spring.redis.password=100001
# 文件存储 # 文件存储
coral.web.resource.mapping.uploads-inner=/uploads/* coral.web.resource.mapping.uploads-inner=/uploads/*
coral.web.resource.mapping.uploads-mapping=/data/www/uploads/cihai coral.web.resource.mapping.uploads-mapping=/data/www/uploads/cihai
...@@ -28,7 +28,3 @@ coral.wechat.WechatConfig.encodingAESKey=agkC7tsPUoOtbbUyxxcCLVJZVqVOCTeJgxUCXAx ...@@ -28,7 +28,3 @@ coral.wechat.WechatConfig.encodingAESKey=agkC7tsPUoOtbbUyxxcCLVJZVqVOCTeJgxUCXAx
# 是否加密 # 是否加密
coral.wechat.WechatConfig.messageEncrypt=false coral.wechat.WechatConfig.messageEncrypt=false
# 微信授权回调地址 # 微信授权回调地址
aip.app-id=10486245
aip.api-key=ws8qdxT51xm2qbWufxzRedI3
aip.secret-key=8b6g9ZyR69dFl6aqYdIOGa4IbOGgkdjh
\ No newline at end of file \ No newline at end of file
...@@ -30,4 +30,3 @@ coral.web.view.error.internal-error=500 ...@@ -30,4 +30,3 @@ coral.web.view.error.internal-error=500
coral.web.view.error.service=service coral.web.view.error.service=service
coral.web.view.error.other=other coral.web.view.error.other=other
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<%--添加此行消除额外空格--%> <%--添加此行消除额外空格--%>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="${ctx}/static/js/vendor.js"></script> <script src="${ctx}/static/js/vendor.js"></script>
<script src="${ctx}/static/js/routes.js"></script>
<script src="${ctx}/static/js/index.js"></script>
<script src="${ctx}/static/js/backend.js"></script> <script src="${ctx}/static/js/backend.js"></script>
<script src="${ctx}/static/js/layer/layer.js"></script> <script src="${ctx}/static/js/layer/layer.js"></script>
<script src="${ctx}/static/js/main.js"></script>
<script> <script>
$(function () { $(function () {
backEndApp.init() backEndApp.init()
......
...@@ -15,3 +15,13 @@ ...@@ -15,3 +15,13 @@
<link rel="stylesheet" href="${ctx}/static/css/vendor.css"> <link rel="stylesheet" href="${ctx}/static/css/vendor.css">
</head> </head>
<body> <body>
<div class="loading" id="loading">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="64px" height="64px" viewBox="0 0 128 128" xml:space="preserve">
<g>
<path d="M78.75 16.18V1.56a64.1 64.1 0 0 1 47.7 47.7H111.8a49.98 49.98 0 0 0-33.07-33.08zM16.43 49.25H1.8a64.1 64.1 0 0 1 47.7-47.7V16.2a49.98 49.98 0 0 0-33.07 33.07zm33.07 62.32v14.62A64.1 64.1 0 0 1 1.8 78.5h14.63a49.98 49.98 0 0 0 33.07 33.07zm62.32-33.07h14.62a64.1 64.1 0 0 1-47.7 47.7v-14.63a49.98 49.98 0 0 0 33.08-33.07z"
fill="#494949" fill-opacity="1" />
<animateTransform attributeName="transform" type="rotate" from="0 64 64" to="-90 64 64" dur="400ms" repeatCount="indefinite"></animateTransform>
</g>
</svg>
</div>
\ No newline at end of file \ No newline at end of file
...@@ -4,16 +4,7 @@ ...@@ -4,16 +4,7 @@
<jsp:include page="/WEB-INF/jsp/include/header.jsp"> <jsp:include page="/WEB-INF/jsp/include/header.jsp">
<jsp:param name="pageTitle" value="首页"/> <jsp:param name="pageTitle" value="首页"/>
</jsp:include> </jsp:include>
<div class="loading" id="loading">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="64px" height="64px" viewBox="0 0 128 128" xml:space="preserve">
<g>
<path d="M78.75 16.18V1.56a64.1 64.1 0 0 1 47.7 47.7H111.8a49.98 49.98 0 0 0-33.07-33.08zM16.43 49.25H1.8a64.1 64.1 0 0 1 47.7-47.7V16.2a49.98 49.98 0 0 0-33.07 33.07zm33.07 62.32v14.62A64.1 64.1 0 0 1 1.8 78.5h14.63a49.98 49.98 0 0 0 33.07 33.07zm62.32-33.07h14.62a64.1 64.1 0 0 1-47.7 47.7v-14.63a49.98 49.98 0 0 0 33.08-33.07z"
fill="#494949" fill-opacity="1" />
<animateTransform attributeName="transform" type="rotate" from="0 64 64" to="-90 64 64" dur="400ms" repeatCount="indefinite"></animateTransform>
</g>
</svg>
</div>
<div id="app"> <div id="app">
<div class="statusbar"></div> <div class="statusbar"></div>
<div class="view view-main view-init ios-edges" data-url="/"> <div class="view view-main view-init ios-edges" data-url="/">
...@@ -53,4 +44,76 @@ ...@@ -53,4 +44,76 @@
</div> </div>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="/wechat/jsConfig"></script> <script src="/wechat/jsConfig"></script>
<jsp:include page="/WEB-INF/jsp/include/footer.jsp"/>
\ No newline at end of file \ No newline at end of file
<jsp:include page="/WEB-INF/jsp/include/footer.jsp"/>
<script>
$('.search-area-voice').on('click', function () {
wx.startRecord();
myApp.dialog.create({
title: '正在录音...',
buttons: [
{
text: '完成',
onClick: function () {
wx.stopRecord({
success: function (res) {
myApp.dialog.preloader();
var localId = res.localId;
wx.translateVoice({
localId: localId, // 需要识别的音频的本地Id,由录音相关接口获得
isShowProgressTips: 0, // 默认为1,显示进度提示
success: function (res) {
jQuery.get("/home/search", {keyword: res.translateResult}, function (data) {
myApp.dialog.close();
if (data.code == "OK") {
// myApp.view.main.router.load({
// url:data.data
// });
location.href = data.data;
} else {
myApp.dialog.alert(data.message);
$('.j_search_input').val(res.translateResult);
}
})
}
});
}
});
}
}
]
}).open();
});
$('.search-area-image').on('click', function () {
wx.chooseImage({
count: 1, // 默认9
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
wx.getLocalImgData({
localId: localIds[0], // 图片的localID
success: function (res) {
var localData = res.localData; // localData是图片的base64数据,可以用img标签显示
alert(localData);
}
});
}
});
})
</script>
\ No newline at end of file \ No newline at end of file
...@@ -4,10 +4,21 @@ ...@@ -4,10 +4,21 @@
<jsp:include page="/WEB-INF/jsp/include/header.jsp"> <jsp:include page="/WEB-INF/jsp/include/header.jsp">
<jsp:param name="pageTitle" value="首页"/> <jsp:param name="pageTitle" value="首页"/>
</jsp:include> </jsp:include>
<div id="app"> <div id="app">
<div class="statusbar"></div> <div class="statusbar"></div>
<div class="view view-main view-init ios-edges" data-url="/"> <div class="view view-main view-init ios-edges" data-url="/">
<div class="page"> <div class="page">
<div class="navbar">
<div class="navbar-inner">
<div class="left">
<a class="link back js-jump-page" href="/">
<i class="iconfont icon-jiantou"></i>
<span class="ios-only">返回</span>
</a>
</div>
</div>
</div>
<div class="page-content special-content"> <div class="page-content special-content">
<!--专题简介--> <!--专题简介-->
<div class="intro-box"> <div class="intro-box">
...@@ -26,15 +37,20 @@ ...@@ -26,15 +37,20 @@
</div> </div>
<h5 class="sub-title">基本信息</h5> <h5 class="sub-title">基本信息</h5>
<div class="basic-msg"> <div class="basic-msg">
<b>中文名称:</b>中国共产党第十九次全国代表大会</div> <b>中文名称:</b>中国共产党第十九次全国代表大会
</div>
<div class="basic-msg"> <div class="basic-msg">
<b>会议简称:</b>党的十九大</div> <b>会议简称:</b>党的十九大
</div>
<div class="basic-msg"> <div class="basic-msg">
<b>会议时间:</b>2017年10月18日-24日</div> <b>会议时间:</b>2017年10月18日-24日
</div>
<div class="basic-msg"> <div class="basic-msg">
<b>会议地点:</b>北京</div> <b>会议地点:</b>北京
</div>
<div class="basic-msg"> <div class="basic-msg">
<b>代表人数:</b>2287(确认2280名代表资格有效)</div> <b>代表人数:</b>2287(确认2280名代表资格有效)
</div>
</div> </div>
</div> </div>
<!--相关词条--> <!--相关词条-->
...@@ -211,8 +227,13 @@ ...@@ -211,8 +227,13 @@
<img src="${ctx}/static/images/special-tip.png"> <img src="${ctx}/static/images/special-tip.png">
</div> </div>
<div class="title">十九大图谱</div> <div class="title">十九大图谱</div>
<div class="special-title-tools">
<a class="js-enable-drag" href="#" data-target="#relation-pic">
<span class="icon icon-drag"></span>
</a>
</div>
</div> </div>
<div id="mynetwork"></div> <div id="relation-pic"></div>
</div> </div>
<!--词云解析--> <!--词云解析-->
<div class="word-analysis"> <div class="word-analysis">
...@@ -221,10 +242,16 @@ ...@@ -221,10 +242,16 @@
<img src="${ctx}/static/images/special-tip.png"> <img src="${ctx}/static/images/special-tip.png">
</div> </div>
<div class="title">词云解析</div> <div class="title">词云解析</div>
<div class="special-title-tools">
<a class="js-refresh" href="#" data-target="#word-analysis">
<i class="iconfont icon-huanyipi"></i>
</a>
<a class="js-enable-drag" href="#" data-target="#word-analysis">
<span class="icon icon-drag"></span>
</a>
</div>
</div> </div>
<div class="inner"> <div id="word-analysis"></div>
<img src="${ctx}/static/images/special-pic-07.png">
</div>
</div> </div>
<!--相关新闻--> <!--相关新闻-->
<div class="about-news"> <div class="about-news">
...@@ -255,7 +282,6 @@ ...@@ -255,7 +282,6 @@
</div> </div>
<div class="card-footer">中国共产党第十九次全国代表大会,中国特色社会主义进入新时代的关键时期召开的一次十分重要的大会。</div> <div class="card-footer">中国共产党第十九次全国代表大会,中国特色社会主义进入新时代的关键时期召开的一次十分重要的大会。</div>
</div> </div>
<div class="more-btn">加载更多</div>
</div> </div>
<!--图说十九大--> <!--图说十九大-->
<div class="pic-show"> <div class="pic-show">
...@@ -310,12 +336,79 @@ ...@@ -310,12 +336,79 @@
</div> </div>
</div> </div>
<jsp:include page="/WEB-INF/jsp/include/footer.jsp"/> <jsp:include page="/WEB-INF/jsp/include/footer.jsp"/>
<script src="${ctx}/static/js/swiper.min.js"></script>
<script src="${ctx}/static/js/vis.js"></script>
<script src="${ctx}/static/js/special.js"></script> <script src="${ctx}/static/js/special.js"></script>
<script> <script>
$(function () { function relationPic(id, data) {
return new vis.Network(document.getElementById(id), relationPicData, {
nodes: {
shape: 'dot',
borderWidth: 3,
color: {
border: '#c6c6c6',
background: '#adadad',
highlight: {
border: '#187bb2',
background: '#187bb2'
}
},
font: {
color: '#333'
}
}
});
};
var relationPicData = {
nodes: [{
id: 1,
label: 'Node 1',
value: 15
},
{
id: 2,
label: 'Node 2',
value: 25
},
{
id: 3,
label: 'Node 3',
value: 50
},
{
id: 4,
label: 'Node 4',
value: 30
},
{
id: 5,
label: 'Node 5',
value: 8
}
],
edges: [{
from: 1,
to: 3
},
{
from: 1,
to: 2
},
{
from: 2,
to: 4
},
{
from: 2,
to: 5
}
]
};
relationPic('relation-pic', relationPicData);
relationPicData.edges = [];
var wordAnalysis = relationPic('word-analysis', relationPicData);
})
</script>
\ No newline at end of file \ No newline at end of file
$('.js-refresh').click(function () {
wordAnalysis.destroy();
wordAnalysis = relationPic('word-analysis', relationPicData);
});
</script>
...@@ -9,6 +9,16 @@ ...@@ -9,6 +9,16 @@
<link rel="stylesheet" href="css/vendor.css"> <link rel="stylesheet" href="css/vendor.css">
</head> </head>
<body> <body>
<div class="loading" id="loading">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="64px" height="64px" viewBox="0 0 128 128" xml:space="preserve">
<g>
<path d="M78.75 16.18V1.56a64.1 64.1 0 0 1 47.7 47.7H111.8a49.98 49.98 0 0 0-33.07-33.08zM16.43 49.25H1.8a64.1 64.1 0 0 1 47.7-47.7V16.2a49.98 49.98 0 0 0-33.07 33.07zm33.07 62.32v14.62A64.1 64.1 0 0 1 1.8 78.5h14.63a49.98 49.98 0 0 0 33.07 33.07zm62.32-33.07h14.62a64.1 64.1 0 0 1-47.7 47.7v-14.63a49.98 49.98 0 0 0 33.08-33.07z"
fill="#494949" fill-opacity="1" />
<animateTransform attributeName="transform" type="rotate" from="0 64 64" to="-90 64 64" dur="400ms" repeatCount="indefinite"></animateTransform>
</g>
</svg>
</div>
<div id="app"> <div id="app">
<div class="statusbar"></div> <div class="statusbar"></div>
<div class="panel panel-right panel-cover panel-nav"> <div class="panel panel-right panel-cover panel-nav">
...@@ -550,7 +560,6 @@ ...@@ -550,7 +560,6 @@
</div> </div>
</div> </div>
<script src="js/vendor.js"></script> <script src="js/vendor.js"></script>
<script src="js/routes.js"></script> <script src="js/main.js"></script>
<script src="js/word.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file \ No newline at end of file
...@@ -9,6 +9,16 @@ ...@@ -9,6 +9,16 @@
<link rel="stylesheet" href="css/vendor.css"> <link rel="stylesheet" href="css/vendor.css">
</head> </head>
<body> <body>
<div class="loading" id="loading">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="64px" height="64px" viewBox="0 0 128 128" xml:space="preserve">
<g>
<path d="M78.75 16.18V1.56a64.1 64.1 0 0 1 47.7 47.7H111.8a49.98 49.98 0 0 0-33.07-33.08zM16.43 49.25H1.8a64.1 64.1 0 0 1 47.7-47.7V16.2a49.98 49.98 0 0 0-33.07 33.07zm33.07 62.32v14.62A64.1 64.1 0 0 1 1.8 78.5h14.63a49.98 49.98 0 0 0 33.07 33.07zm62.32-33.07h14.62a64.1 64.1 0 0 1-47.7 47.7v-14.63a49.98 49.98 0 0 0 33.08-33.07z"
fill="#494949" fill-opacity="1" />
<animateTransform attributeName="transform" type="rotate" from="0 64 64" to="-90 64 64" dur="400ms" repeatCount="indefinite"></animateTransform>
</g>
</svg>
</div>
<div id="app"> <div id="app">
<div class="statusbar"></div> <div class="statusbar"></div>
<div class="panel panel-right panel-cover panel-nav"> <div class="panel panel-right panel-cover panel-nav">
...@@ -290,13 +300,25 @@ ...@@ -290,13 +300,25 @@
</div> </div>
</div> </div>
<div class="view view-main view-init ios-edges" data-url="/"> <div class="view view-main view-init ios-edges" data-url="/">
<div class="page"> <div class="page page-word-wiki">
<!--.navbar--> <div class="navbar">
<!-- .navbar-inner--> <div class="navbar-inner navbar-word-wiki">
<!-- .left--> <div class="left">
<!-- a.link.back(href='/')--> <a class="link back" href="/">
<!-- i.iconfont.icon-jiantou--> <i class="iconfont icon-jiantou"></i>
<!-- span.ios-only 返回--> <span class="ios-only">返回</span>
</a>
</div>
<div class="right word-navbar-btn">
<a class="panel-open" href="#" data-panel="right">
<span class="icon icon-book"></span>
</a>
<a href="/word-wiki/">
<i class="iconfont icon-qiyeguanxitupu"></i>
</a>
</div>
</div>
</div>
<div class="toolbar"> <div class="toolbar">
<div class="toolbar-cover"> <div class="toolbar-cover">
<a class="link-btn" href="#"> <a class="link-btn" href="#">
...@@ -338,11 +360,11 @@ ...@@ -338,11 +360,11 @@
<div class="single-word"> <div class="single-word">
<div class="word-body"> <div class="word-body">
<div class="word-title"> <div class="word-title">
<a class="word-title-pager prev active">语词 <a class="word-title-pager prev active back">语词
<span class="icon icon-word-prev"></span> <span class="icon icon-word-prev"></span>
</a> </a>
<h1 class="word-title-inner"></h1> <h1 class="word-title-inner"></h1>
<a class="word-title-pager next" href="/word-wiki/">百科 <a class="word-title-pager next" href="#">百科
<span class="icon icon-word-next"></span> <span class="icon icon-word-next"></span>
</a> </a>
</div> </div>
...@@ -755,7 +777,6 @@ ...@@ -755,7 +777,6 @@
</div> </div>
</div> </div>
<script src="js/vendor.js"></script> <script src="js/vendor.js"></script>
<script src="js/routes.js"></script> <script src="js/main.js"></script>
<script src="js/word.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.

3.39 KB | W: | H:

4.67 KB | W: | H:

serverside/cihai-wechat/src/main/webapp/static/images/icons.png
serverside/cihai-wechat/src/main/webapp/static/images/icons.png
serverside/cihai-wechat/src/main/webapp/static/images/icons.png
serverside/cihai-wechat/src/main/webapp/static/images/icons.png
  • 2-up
  • Swipe
  • Onion skin
var $ = Dom7; var $ = Dom7;
var myApp = new Framework7({ var myApp = new Framework7({
root: '#app', root: '#app',
theme: 'ios', theme: 'ios',
routes: routes, routes: routes,
modalButtonOk:'去顶'
}); });
var $loading = $('#loading'); var $loading = $('#loading');
$loading.addClass('fade-out'); $loading.addClass('fade-out');
setTimeout(function () { setTimeout(function () {
$loading.remove(); $loading.remove();
}, 300); },300);
$('.search-area-inner').on('click', function () {
wx.startRecord();
myApp.dialog.create({
title: '正在录音...',
buttons: [
{
text: '完成',
onClick: function () {
wx.stopRecord({
success: function (res) {
myApp.dialog.preloader();
var localId = res.localId;
wx.translateVoice({
localId: localId, // 需要识别的音频的本地Id,由录音相关接口获得
isShowProgressTips: 0, // 默认为1,显示进度提示
success: function (res) {
jQuery.get("/home/search", {keyword: res.translateResult}, function (data) {
myApp.dialog.close();
if (data.code == "OK") {
// myApp.view.main.router.load({
// url:data.data
// });
location.href = data.data;
} else {
myApp.dialog.alert(data.message);
$('.j_search_input').val(res.translateResult);
}
})
}
});
}
});
}
}
]
}).open();
});
$('.brand-index').on('click', function () {
wx.chooseImage({
count: 1, // 默认9
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 $('.search-area-inner').on('click', function () {
myApp.dialog.create({
success: function (res) { title: '正在录音...',
buttons: [
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片 {
wx.getLocalImgData({ text: '完成',
onClick:function () {
localId: localIds[0], // 图片的localID
myApp.view.main.router.load({
success: function (res) { url:'/2-1字语词义.html'
});
var localData = res.localData; // localData是图片的base64数据,可以用img标签显示
alert(localData);
}
});
} }
}
}); ]
}) }).open();
});
var $ = Dom7;
var myApp = new Framework7({
root: '#app',
theme: 'ios',
modalButtonOk:'去顶'
});
var $loading = $('#loading');
$loading.addClass('fade-out');
setTimeout(function () {
$loading.hide();
},300);
/**
* 页面切换
* @param url
*/
function jumpPage(url) {
$loading.show();
setTimeout(function () {
$loading.removeClass('fade-in');
setTimeout(function () {
window.location.href = url;
},300);
},10);
}
$('.js-jump-page').click(function () {
jumpPage($(this).attr('href'));
return false;
});
var $ = Dom7;
var app = new Framework7({
root: '#app',
theme: 'ios',
routes: routes
});
var numSwiper = new Swiper('.num-swiper', { var numSwiper = new Swiper('.num-swiper', {
loop: false, loop: false,
slidesPerView: 4, slidesPerView: 4,
slidesPerGroup: 1, slidesPerGroup: 1,
navigation: { navigation: {
nextEl: '.swiper-button-next', nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev', prevEl: '.swiper-button-prev'
} }
}); });
...@@ -43,93 +36,6 @@ var topicSwiper = new Swiper('.topic-swiper', { ...@@ -43,93 +36,6 @@ var topicSwiper = new Swiper('.topic-swiper', {
} }
}); });
//关系图
var DIR = 'img/soft-scraps-icons/';
var nodes = null;
var edges = null;
var network = null;
// Called when the Visualization API is loaded.
function draw() {
// create people.
// value corresponds with the age of the person
var DIR = 'images/special-pic-0';
nodes = [
{id: 1, shape: 'circularImage', image: DIR + '1.png'},
{id: 2, shape: 'circularImage', image: DIR + '2.png'},
{id: 3, shape: 'circularImage', image: DIR + '1.png'},
{id: 4, shape: 'circularImage', image: DIR + '2.png', label: "pictures by this guy!"},
{id: 5, shape: 'circularImage', image: DIR + '1.png'},
{id: 6, shape: 'circularImage', image: DIR + '2.png'},
{id: 7, shape: 'circularImage', image: DIR + '1.png'},
{id: 8, shape: 'circularImage', image: DIR + '2.png'},
{id: 9, shape: 'circularImage', image: DIR + '1.png'},
{id: 10, shape: 'circularImage', image: DIR + '2.png'},
{id: 11, shape: 'circularImage', image: DIR + '1.png'},
{id: 12, shape: 'circularImage', image: DIR + '2.png'},
{id: 13, shape: 'circularImage', image: DIR + '1.png'},
{id: 14, shape: 'circularImage', image: DIR + '2.png'},
{
id: 15,
shape: 'circularImage',
image: DIR + 'missing.png',
brokenImage: DIR + 'missingBrokenImage.png',
label: "when images\nfail\nto load"
},
{
id: 16,
shape: 'circularImage',
image: DIR + 'anotherMissing.png',
brokenImage: DIR + '9.png',
label: "fallback image in action"
}
];
// create connections between people
// value corresponds with the amount of contact between two people
edges = [
{from: 1, to: 2},
{from: 2, to: 3},
{from: 2, to: 4},
{from: 4, to: 5},
{from: 4, to: 10},
{from: 4, to: 6},
{from: 6, to: 7},
{from: 7, to: 8},
{from: 8, to: 9},
{from: 8, to: 10},
{from: 10, to: 11},
{from: 11, to: 12},
{from: 12, to: 13},
{from: 13, to: 14},
{from: 9, to: 16}
];
// create a network
var container = document.getElementById('mynetwork');
var data = {
nodes: nodes,
edges: edges
};
var options = {
nodes: {
borderWidth: 4,
size: 30,
color: {
border: '#222222',
background: '#666666'
},
font: {color: '#eeeeee'}
},
edges: {
color: 'lightgray'
}
};
network = new vis.Network(container, data, options);
}
draw();
$('.js-read-more').click(function () { $('.js-read-more').click(function () {
if($(this).hasClass('active')){ if($(this).hasClass('active')){
$('.special-content .txt-content').css('height','190px'); $('.special-content .txt-content').css('height','190px');
...@@ -138,4 +44,11 @@ $('.js-read-more').click(function () { ...@@ -138,4 +44,11 @@ $('.js-read-more').click(function () {
$('.special-content .txt-content').css('height','auto'); $('.special-content .txt-content').css('height','auto');
$(this).addClass('active') $(this).addClass('active')
} }
});
$('.js-enable-drag').click(function () {
var $this = $(this);
$this.hasClass('active')?$this.removeClass('active'):$this.addClass('active');
var $target = $($this.data('target'));
$target.hasClass('enable')?$target.removeClass('enable'):$target.addClass('enable');
}); });
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
...@@ -9,10 +9,30 @@ ...@@ -9,10 +9,30 @@
<link rel="stylesheet" href="css/vendor.css"> <link rel="stylesheet" href="css/vendor.css">
</head> </head>
<body> <body>
<div class="loading" id="loading">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="64px" height="64px" viewBox="0 0 128 128" xml:space="preserve">
<g>
<path d="M78.75 16.18V1.56a64.1 64.1 0 0 1 47.7 47.7H111.8a49.98 49.98 0 0 0-33.07-33.08zM16.43 49.25H1.8a64.1 64.1 0 0 1 47.7-47.7V16.2a49.98 49.98 0 0 0-33.07 33.07zm33.07 62.32v14.62A64.1 64.1 0 0 1 1.8 78.5h14.63a49.98 49.98 0 0 0 33.07 33.07zm62.32-33.07h14.62a64.1 64.1 0 0 1-47.7 47.7v-14.63a49.98 49.98 0 0 0 33.08-33.07z"
fill="#494949" fill-opacity="1" />
<animateTransform attributeName="transform" type="rotate" from="0 64 64" to="-90 64 64" dur="400ms" repeatCount="indefinite"></animateTransform>
</g>
</svg>
</div>
<div id="app"> <div id="app">
<div class="statusbar"></div> <div class="statusbar"></div>
<div class="view view-main view-init ios-edges" data-url="/"> <div class="view view-main view-init ios-edges" data-url="/">
<div class="page"> <div class="page">
<div class="navbar">
<div class="navbar-inner">
<div class="left">
<a class="link back" href="/">
<i class="iconfont icon-jiantou"></i>
<span class="ios-only">返回</span>
</a>
</div>
</div>
</div>
<div class="page-content special-content"> <div class="page-content special-content">
<!--专题简介--> <!--专题简介-->
<div class="intro-box"> <div class="intro-box">
...@@ -216,8 +236,13 @@ ...@@ -216,8 +236,13 @@
<img src="images/special-tip.png"> <img src="images/special-tip.png">
</div> </div>
<div class="title">十九大图谱</div> <div class="title">十九大图谱</div>
<div class="special-title-tools">
<a class="js-enable-drag" href="#" data-target="#relation-pic">
<span class="icon icon-drag"></span>
</a>
</div>
</div> </div>
<div id="mynetwork"></div> <div id="relation-pic"></div>
</div> </div>
<!--词云解析--> <!--词云解析-->
<div class="word-analysis"> <div class="word-analysis">
...@@ -226,10 +251,16 @@ ...@@ -226,10 +251,16 @@
<img src="images/special-tip.png"> <img src="images/special-tip.png">
</div> </div>
<div class="title">词云解析</div> <div class="title">词云解析</div>
<div class="special-title-tools">
<a class="js-refresh" href="#" data-target="#word-analysis">
<i class="iconfont icon-huanyipi"></i>
</a>
<a class="js-enable-drag" href="#" data-target="#word-analysis">
<span class="icon icon-drag"></span>
</a>
</div>
</div> </div>
<div class="inner"> <div id="word-analysis"></div>
<img src="images/special-pic-07.png">
</div>
</div> </div>
<!--相关新闻--> <!--相关新闻-->
<div class="about-news"> <div class="about-news">
...@@ -260,7 +291,6 @@ ...@@ -260,7 +291,6 @@
</div> </div>
<div class="card-footer">中国共产党第十九次全国代表大会,中国特色社会主义进入新时代的关键时期召开的一次十分重要的大会。</div> <div class="card-footer">中国共产党第十九次全国代表大会,中国特色社会主义进入新时代的关键时期召开的一次十分重要的大会。</div>
</div> </div>
<div class="more-btn">加载更多</div>
</div> </div>
<!--图说十九大--> <!--图说十九大-->
<div class="pic-show"> <div class="pic-show">
...@@ -315,9 +345,81 @@ ...@@ -315,9 +345,81 @@
</div> </div>
</div> </div>
<script src="js/vendor.js"></script> <script src="js/vendor.js"></script>
<script src="js/routes.js"></script> <script src="js/main.js"></script>
<script src="js/swiper.min.js"></script>
<script src="js/vis.js"></script>
<script src="js/special.js"></script> <script src="js/special.js"></script>
<script>
function relationPic(id, data) {
return new vis.Network(document.getElementById(id), relationPicData, {
nodes: {
shape: 'dot',
borderWidth: 3,
color: {
border: '#c6c6c6',
background: '#adadad',
highlight: {
border: '#187bb2',
background: '#187bb2'
}
},
font: {
color: '#333'
}
}
});
};
var relationPicData = {
nodes: [{
id: 1,
label: 'Node 1',
value: 15
},
{
id: 2,
label: 'Node 2',
value: 25
},
{
id: 3,
label: 'Node 3',
value: 50
},
{
id: 4,
label: 'Node 4',
value: 30
},
{
id: 5,
label: 'Node 5',
value: 8
}
],
edges: [{
from: 1,
to: 3
},
{
from: 1,
to: 2
},
{
from: 2,
to: 4
},
{
from: 2,
to: 5
}
]
};
relationPic('relation-pic', relationPicData);
relationPicData.edges = [];
var wordAnalysis = relationPic('word-analysis', relationPicData);
$('.js-refresh').click(function() {
wordAnalysis.destroy();
wordAnalysis = relationPic('word-analysis', relationPicData);
});
</script>
</body> </body>
</html> </html>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!