├── .gitignore ├── README.md ├── db ├── db_finance_new.sql ├── db_finance_new_20151022.sql └── update │ ├── product_is_crawler.sql │ ├── product_is_crawler_20151112.sql │ └── t_c_east_finance.sql ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── jerry │ │ └── financecrawler │ │ ├── commons │ │ ├── CommonsCharset.java │ │ ├── CommonsUrl.java │ │ ├── HtmlParserUtil.java │ │ ├── IdTools.java │ │ ├── JsonParseUtil.java │ │ ├── ProductFilter.java │ │ └── StringUtil.java │ │ ├── convert │ │ ├── PoToVo.java │ │ ├── SetValue.java │ │ └── VoToPo.java │ │ ├── db │ │ ├── dao │ │ │ ├── AnnualFluctuationRateDao.java │ │ │ ├── AnnualizedReturnRateDao.java │ │ │ ├── CalmarRatioDao.java │ │ │ ├── CostRateDao.java │ │ │ ├── EastFinanceDao.java │ │ │ ├── FundManagePeopleDao.java │ │ │ ├── FundManagerDao.java │ │ │ ├── FundProductDao.java │ │ │ ├── HSDao.java │ │ │ ├── HistoricalNetDao.java │ │ │ ├── IAnnualFluctuationRate.java │ │ │ ├── IAnnualizedReturnRate.java │ │ │ ├── ICalmarRatio.java │ │ │ ├── ICostRate.java │ │ │ ├── IEastFinance.java │ │ │ ├── IFundManagePeople.java │ │ │ ├── IFundManager.java │ │ │ ├── IFundProduct.java │ │ │ ├── IHS.java │ │ │ ├── IHistoricalNet.java │ │ │ ├── IIncome.java │ │ │ ├── IIncomeRanking.java │ │ │ ├── IMaximumReturn.java │ │ │ ├── IProductReFundManagePeople.java │ │ │ ├── IProductReFundManager.java │ │ │ ├── ISharpRatio.java │ │ │ ├── ISterlingRatio.java │ │ │ ├── IncomeDao.java │ │ │ ├── IncomeRankingDao.java │ │ │ ├── MaximumReturnDao.java │ │ │ ├── ProductReFundManagePeopleDao.java │ │ │ ├── ProductReFundManagerDao.java │ │ │ ├── SharpRatioDao.java │ │ │ └── SterlingRatioDao.java │ │ └── po │ │ │ ├── AnnualFluctuationRatePo.java │ │ │ ├── AnnualizedReturnRatePo.java │ │ │ ├── CalmarRatioPo.java │ │ │ ├── CostRatePo.java │ │ │ ├── EastFinancePo.java │ │ │ ├── FundManagePeoplePo.java │ │ │ ├── FundManagerPo.java │ │ │ ├── FundProductPo.java │ │ │ ├── HSPo.java │ │ │ ├── HistoricalNetPo.java │ │ │ ├── IncomePo.java │ │ │ ├── IncomeRankingPo.java │ │ │ ├── MaximumReturnPo.java │ │ │ ├── ProductReFundManagePeoplePo.java │ │ │ ├── ProductReFundManagerPo.java │ │ │ ├── SharpRatioPo.java │ │ │ └── SterlingRatioPo.java │ │ ├── job │ │ ├── QuartzJob.java │ │ ├── eastmoney │ │ │ ├── EastMoneyFundProductJob.java │ │ │ └── EastMoneyHistoricalNetJob.java │ │ ├── howbuy │ │ │ ├── FundProductDetailJob.java │ │ │ ├── FundProductJob.java │ │ │ └── HistoricalNetJob.java │ │ ├── hs │ │ │ └── HSJob.java │ │ └── licai │ │ │ ├── LiCaiDetailJob.java │ │ │ ├── LiCaiFundProductJob.java │ │ │ └── LiCaiHistoricalNetJob.java │ │ ├── save │ │ └── SaveData.java │ │ ├── service │ │ └── StartService.java │ │ ├── translate │ │ ├── eastmoney │ │ │ ├── HtmlToEastMoneyDetailVo.java │ │ │ ├── JsonToEastMoneyFundProductVo.java │ │ │ └── JsonToEastMoneyHistoricalNetVo.java │ │ ├── howbuy │ │ │ ├── HtmlToFundProductVo.java │ │ │ ├── HtmlToHistoricalNetVo.java │ │ │ ├── HtmlToIncomeRankingVo.java │ │ │ ├── HtmlToIncomeVo.java │ │ │ └── HtmlToRiskAssessmentIndexVo.java │ │ ├── hs │ │ │ └── HtmlToHSVo.java │ │ └── licai │ │ │ ├── HtmlToLiCaiDetailVo.java │ │ │ ├── HtmlToLiCaiFundProductVo.java │ │ │ └── HtmlToLiCaiHistoricalNetVo.java │ │ ├── visitor │ │ └── HtmlRequest.java │ │ └── vo │ │ ├── AnnualFluctuationRateVo.java │ │ ├── AnnualizedReturnRateVo.java │ │ ├── CalmarRatioVo.java │ │ ├── CostRateVo.java │ │ ├── EastFinanceTotalVo.java │ │ ├── EastFinanceVo.java │ │ ├── FundManagePeopleVo.java │ │ ├── FundManagerVo.java │ │ ├── FundProductTotalVo.java │ │ ├── FundProductVo.java │ │ ├── HSVo.java │ │ ├── HistoricalNetTotalVo.java │ │ ├── HistoricalNetVo.java │ │ ├── IncomeRankingVo.java │ │ ├── IncomeVo.java │ │ ├── MaximumReturnVo.java │ │ ├── ProductReFundManagePeopleVo.java │ │ ├── ProductReFundManagerVo.java │ │ ├── RiskAssessmentIndexVo.java │ │ ├── SharpRatioVo.java │ │ └── SterlingRatioVo.java └── resources │ ├── applicationContext-Quartz.xml │ ├── applicationContext.xml │ ├── config.properties │ ├── jobtime.properties │ └── log4j.properties └── test ├── java └── com │ └── jerry │ └── finance │ └── crawler │ ├── TestBase.java │ ├── db │ └── dao │ │ └── FundProductDaoTest.java │ └── job │ └── EastFinanceDaoTest.java └── resources ├── applicationContext-Quartz.xml ├── applicationContext.xml ├── config.properties ├── jobtime.properties └── log4j.properties /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .DS_Store 3 | out/ 4 | target/ 5 | *.iml 6 | log/ 7 | lib/ 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FinanceCrawler 2 | ##金融数据爬虫 3 | 4 | ###数据库 5 | 6 | * mysql 7 | 8 | ### 语言 9 | 10 | * JAVA 11 | 12 | ### 完成 13 | 14 | 15 | * 完成howbuy 产品基本数据和收益的采集 16 | * 完成howbuy 历史净值的采集 17 | * 完成howbuy 风险评估指标的采集 18 | * 完成howbuy 收益率的采集 19 | * 完成howbuy 收益排名的采集 20 | 21 | 22 | * 完成eastmoney 产品和收益的采集 23 | * 完成eastmoney 历史净值的采集 24 | 25 | * 完成格上理财 产品和收益和历史净值的采集 26 | 27 | * 完成新浪沪深300数据的采集 28 | 29 | ### 关键技术 30 | 31 | * json 采用org.json进行翻译 32 | * html 采用org.htmlparser进行翻译 33 | * 定时任务 采用org.quartz与spring相结合进行处理 34 | 35 | ### help 36 | 37 | * maven 编码命令 : 38 | mvn clean install 39 | mvn package 40 | 41 | * maven导出所有jar 42 | 43 | 从Maven仓库中导出jar包:进入工程pom.xml 所在的目录下,输入: 44 | 45 | mvn dependency:copy-dependencies 46 | 47 | 会导出到targed/dependency 下面 48 | 49 | 可以在工程创建lib文件夹,输入以下命令: 50 | 51 | mvn dependency:copy-dependencies -DoutputDirectory=lib 52 | 53 | 这样jar包都会copy到工程目录下的lib里面 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /db/update/product_is_crawler.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `bs_product` 2 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `product_image_url`; 3 | 4 | 5 | ALTER TABLE `bs_networth` 6 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `Chg`; 7 | 8 | 9 | ALTER TABLE `bs_income` 10 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `I_SINCE_ITS_ESTABLISHMENT`; 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /db/update/product_is_crawler_20151112.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `bs_annual_fluctuation_rate` 2 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `FR_MAXIMUM_CONTINUOUS_LOSS_DAYS`; 3 | ALTER TABLE `bs_annualized_return_rate` 4 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `RR_SINCE_ITS_ESTABLISHMENT`; 5 | ALTER TABLE `bs_calmar_ratio` 6 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `CR_SINCE_ITS_ESTABLISHMENT`; 7 | ALTER TABLE `bs_cost_rate` 8 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `CR_PERFORMANCE_PAY_RATE`; 9 | ALTER TABLE `bs_income_ranking` 10 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `IR_NEARLY_FIVE_YEARS`; 11 | ALTER TABLE `bs_maximum_return` 12 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `MR_SINCE_ITS_ESTABLISHMENT`; 13 | ALTER TABLE `bs_sharp_ratio` 14 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `SR_SINCE_ITS_ESTABLISHMENT`; 15 | ALTER TABLE `bs_sterling_ratio` 16 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `SR_SINCE_ITS_ESTABLISHMENT`; 17 | ALTER TABLE `bs_productfund` 18 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `bs_fund`; 19 | 20 | ALTER TABLE `bs_productfundmanager` 21 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `bs_fundmanager`; 22 | 23 | 24 | ALTER TABLE `bs_fund` 25 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `fund_count`; 26 | ALTER TABLE `bs_fundmanager` 27 | ADD COLUMN `product_is_crawler` int(1) NULL DEFAULT 0 COMMENT '是否为爬取 1 是 0 不是' AFTER `BS_WORKING_YEAR`; -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/commons/CommonsCharset.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.commons; 2 | 3 | /** 4 | * Created by Jerry on 2015/10/10. 5 | */ 6 | public class CommonsCharset { 7 | public static final String GB2312 = "gb2312"; 8 | 9 | public static final String UTF_8 = "utf-8"; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/commons/CommonsUrl.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.commons; 2 | 3 | /** 4 | * Created by Jerry on 2015/9/18. 5 | */ 6 | public class CommonsUrl { 7 | 8 | //how buy 9 | public static final String HOW_BUY_FINANCE_URL = "http://simu.howbuy.com/mlboard.htm?page=%s&perPage=%s"; 10 | public static final String HOW_BUY_FINANCE_HISTORICAL_NET_URL = "http://simu.howbuy.com/touzi/%s/lsjz"; 11 | public static final String HOW_BUY_FINANCE_PRODUCT_DETAIL_URL = "http://simu.howbuy.com/touzi/%s"; 12 | //east money 13 | public static final String EAST_MONEY_URL = "http://simu.eastmoney.com/Handler/SimuJJDataAPI.ashx?callback=fundData&sf=HY&st=desc&ft=&pi=%s&pn=%s&m=0&yxzt=1&clsc=-1&glgm=-1&glgs=&v=0.1882981201633811"; 14 | public static final String EAST_MONEY_HISTORICAL_NET_URL = "http://simu.eastmoney.com/PinzhongF10DataApi.aspx?type=lsjz&fc=%s&pageindex=%s&pagesize=%s"; 15 | public static final String EAST_MONEY_DETAIL_URL = "http://simu.eastmoney.com/pro%s.html"; 16 | //licai 17 | public static final String LI_CAI_URL = "http://www.licai.com/simu/phtype4.html"; 18 | public static final String LI_CAI_BASE_URL = "http://www.licai.com/"; 19 | //hs300 20 | public static final String HS_URL = "http://vip.stock.finance.sina.com.cn/corp/go.php/vMS_MarketHistory/stockid/000300/type/S.phtml"; 21 | 22 | 23 | public static String getUrl(String baseUrl, int index, int pageNum, int totalPage) { 24 | String url = ""; 25 | if (pageNum <= totalPage || totalPage == 0) { 26 | url = String.format(baseUrl, index, pageNum); 27 | } else { 28 | url = String.format(baseUrl, index, totalPage); 29 | } 30 | return url; 31 | } 32 | 33 | public static String getUrlByCode(String baseUrl, String code) { 34 | return String.format(baseUrl, code); 35 | } 36 | 37 | public static String getEastMoneyFinanceHistoricalNetUrlByCode(String baseUrl,String fincode, int index, int pageNum, int totalPage){ 38 | String url = ""; 39 | if (pageNum <= totalPage || totalPage == 0) { 40 | url = String.format(baseUrl, fincode, index, pageNum); 41 | } else { 42 | url = String.format(baseUrl,fincode, index, totalPage); 43 | } 44 | return url; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/commons/HtmlParserUtil.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.commons; 2 | 3 | 4 | import org.htmlparser.Node; 5 | import org.htmlparser.NodeFilter; 6 | import org.htmlparser.Parser; 7 | import org.htmlparser.filters.HasAttributeFilter; 8 | import org.htmlparser.filters.TagNameFilter; 9 | import org.htmlparser.tags.InputTag; 10 | import org.htmlparser.tags.LinkTag; 11 | import org.htmlparser.util.NodeList; 12 | import org.htmlparser.util.ParserException; 13 | 14 | /** 15 | * Created by Jerry on 15/12/4. 16 | */ 17 | public class HtmlParserUtil { 18 | 19 | public static NodeList filterTargetNode(String html,String charset,String property, String key) throws ParserException { 20 | Parser parser = new Parser(); 21 | parser.setResource(html); 22 | parser.setEncoding(charset); 23 | NodeFilter filter = new HasAttributeFilter(property, key); 24 | NodeList nodes = parser.extractAllNodesThatMatch(filter); 25 | return nodes; 26 | } 27 | 28 | public static NodeList filterTargetNode(String html,String charset,String key) throws ParserException { 29 | Parser parser = new Parser(); 30 | parser.setResource(html); 31 | parser.setEncoding(charset); 32 | NodeFilter filter = new TagNameFilter(key); 33 | NodeList nodes = parser.extractAllNodesThatMatch(filter); 34 | return nodes; 35 | } 36 | 37 | 38 | public static NodeList filterNode(Node node, String key){ 39 | NodeList nodes = new NodeList(); 40 | NodeFilter filter = new TagNameFilter(key); 41 | node.collectInto(nodes, filter); 42 | return nodes; 43 | } 44 | public static NodeList filterNode(Node node,String property, String key){ 45 | NodeList nodes = new NodeList(); 46 | NodeFilter filter = new HasAttributeFilter(property, key); 47 | node.collectInto(nodes, filter); 48 | return nodes; 49 | } 50 | 51 | 52 | public static String getPlainTextString(Node node){ 53 | String val = node.toPlainTextString(); 54 | String fVal = StringUtil.filterAllSymbol(val).trim();//过滤特殊符号 55 | return fVal; 56 | } 57 | 58 | public static String getPlainTextStringWithoutFilter(Node node){ 59 | String val = node.toPlainTextString(); 60 | String fVal =val.trim(); 61 | return fVal; 62 | } 63 | 64 | 65 | 66 | public static String getInputAttribute(Node node, String key){ 67 | InputTag inputTag = (InputTag)node; 68 | String value = inputTag.getAttribute(key); 69 | return value; 70 | } 71 | 72 | public static String getLinkAttribute(Node node, String key){ 73 | LinkTag inputTag = (LinkTag)node; 74 | String value = inputTag.getAttribute(key); 75 | return value; 76 | } 77 | 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/commons/IdTools.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.commons; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by Jerry on 2015/10/9. 7 | */ 8 | public class IdTools { 9 | 10 | /** 11 | * 通过时间截取11位数字id 12 | * @return 13 | */ 14 | public static int getID(){ 15 | Date now = new Date(); 16 | long l = now.getTime(); 17 | String str = l + ""; 18 | int id = Integer.parseInt(str.substring(5)); 19 | return id; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/commons/JsonParseUtil.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.commons; 2 | 3 | import org.json.JSONException; 4 | import org.json.JSONObject; 5 | 6 | /** 7 | * Created by Jerry on 15/12/3. 8 | */ 9 | public class JsonParseUtil { 10 | 11 | public static Double getDouble(JSONObject obj, String key){ 12 | Double d; 13 | try { 14 | d = obj.getDouble(key); 15 | } catch (JSONException e) { 16 | d = 0d; 17 | } 18 | return d; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/commons/ProductFilter.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.commons; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by Jerry on 15/11/9. 8 | */ 9 | public class ProductFilter { 10 | 11 | public static final List typeList = new ArrayList(); //类型集合 12 | public static final List nameList = new ArrayList(); //类型集合 13 | static{ 14 | //typeList 15 | typeList.add("套利型"); 16 | typeList.add("市场中性"); 17 | typeList.add("量化对冲"); 18 | //nameList 19 | nameList.add("量化"); 20 | nameList.add("对冲"); 21 | nameList.add("阿尔法"); 22 | nameList.add("CTA"); 23 | nameList.add("高频"); 24 | nameList.add("套利"); 25 | nameList.add("alpha"); 26 | nameList.add("程序化"); 27 | } 28 | 29 | //过滤type 30 | public static Boolean filterType(String type){ 31 | boolean result = false; 32 | if(!StringUtil.isEmpty(type)){ 33 | for (int i = 0; i < nameList.size(); i++) { 34 | String midName = nameList.get(i); 35 | if(type.toUpperCase().indexOf(midName.toUpperCase()) != -1){ 36 | result = true; 37 | break; 38 | } 39 | } 40 | if(result == false) result = typeList.contains(type); 41 | } 42 | return result; 43 | } 44 | 45 | public static boolean filterName(String name){ 46 | boolean result = false; 47 | if(!StringUtil.isEmpty(name)){ 48 | for (int i = 0; i < nameList.size(); i++) { 49 | String midName = nameList.get(i); 50 | if(name.toUpperCase().indexOf(midName.toUpperCase()) != -1){ 51 | result = true; 52 | break; 53 | } 54 | } 55 | } 56 | return result; 57 | } 58 | 59 | public static boolean filter(String type, String name){ 60 | boolean result = false; 61 | if(filterType(type)) result = true; 62 | if(filterName(name)) result = true; 63 | return result; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/commons/StringUtil.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.commons; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | import java.util.TimeZone; 7 | 8 | /** 9 | * Created by Jerry on 2015/10/12. 10 | */ 11 | public class StringUtil { 12 | 13 | public static final String SYMBOL_ASTERISK = "*"; 14 | public static final String SYMBOL_QUESTION_MARK = "?"; 15 | public static final String SYMBOL_PERCENT = "%"; 16 | public static final String SYMBOL_WRAP = "\n"; 17 | public static final String SYMBOL_DOUBLE_MINUS = "--"; 18 | 19 | //substring 20 | public static final String SYMBOL_PRE_BRACKET = "("; 21 | 22 | public static final String SYMBOL_BACK_BRACKET = ")"; 23 | 24 | public static final String SYMBOL_EQUAL = "="; 25 | 26 | 27 | public static String filterSymbol(String str, String symbol) { 28 | return str.replace(symbol, ""); 29 | } 30 | 31 | public static String filterAllSymbol(String str) { 32 | String result = str.replace(SYMBOL_ASTERISK, ""); 33 | result = result.replace(SYMBOL_WRAP, ""); 34 | result = result.replace(SYMBOL_DOUBLE_MINUS, ""); 35 | return result.replace(SYMBOL_PERCENT, ""); 36 | } 37 | 38 | public static double StringToDouble(String str) throws ClassCastException { 39 | if (str.equals("")) return 0; 40 | return Double.parseDouble(str); 41 | } 42 | 43 | public static Integer StringToInt(String str) throws ClassCastException { 44 | 45 | return Integer.parseInt(str); 46 | } 47 | 48 | 49 | public static String subPreBracket(String str) throws Exception { 50 | if (str.indexOf(SYMBOL_PRE_BRACKET) == -1) { 51 | return str; 52 | } 53 | return str.substring(0, str.indexOf(SYMBOL_PRE_BRACKET)); 54 | } 55 | 56 | public static String subBackBracket(String str) throws Exception { 57 | if (str.indexOf(SYMBOL_PRE_BRACKET) == -1) { 58 | return str; 59 | } 60 | return str.substring(str.indexOf(SYMBOL_PRE_BRACKET) + 1, str.indexOf(SYMBOL_BACK_BRACKET)); 61 | } 62 | 63 | public static String addDateYear(String str) { 64 | Date date = new Date(); 65 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); 66 | sdf.setTimeZone(TimeZone.getTimeZone("GMT+8")); 67 | return sdf.format(date) + "-" + str.trim(); 68 | } 69 | 70 | public static String dateToString(Date date) { 71 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 72 | sdf.setTimeZone(TimeZone.getTimeZone("GMT+8")); 73 | return sdf.format(date); 74 | } 75 | 76 | public static Date strToDate(String str) throws ParseException { 77 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 78 | sdf.setTimeZone(TimeZone.getTimeZone("GMT+8")); 79 | Date date = sdf.parse(str); 80 | return date; 81 | } 82 | 83 | public static Date getPreDate(Date d) throws ParseException{ 84 | return new Date(d.getTime() - 24 * 60 * 60 * 1000); 85 | } 86 | 87 | public static Date getNextDate(Date d) throws ParseException{ 88 | return new Date(d.getTime() + 24 * 60 * 60 * 1000); 89 | } 90 | 91 | public static boolean isEmpty(String str) { 92 | if (str == null || str.equals("")) return true; 93 | return false; 94 | } 95 | 96 | public static String subJsonStrBySymbol(String data, String symbol) { 97 | return data.substring(data.indexOf(symbol) + 1, data.length()); 98 | } 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/convert/PoToVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.convert; 2 | 3 | import com.jerry.financecrawler.db.po.FundProductPo; 4 | import com.jerry.financecrawler.vo.FundProductVo; 5 | 6 | /** 7 | * Created by Jerry on 15/11/19. 8 | */ 9 | public class PoToVo { 10 | //产品 11 | public static FundProductVo fundProductPoToVo(FundProductPo po) { 12 | //产品 13 | FundProductVo vo = new FundProductVo(); 14 | vo.setId(po.getId()); 15 | vo.setProduct_name(po.getProduct_name()); //产品名称 16 | vo.setProduct_shortname(po.getProduct_shortname());//产品简称 17 | vo.setProduct_code(po.getProduct_code());//产品代码 18 | vo.setIsactice(po.getIsactice());//产品状态 19 | vo.setSupplier_code(po.getSupplier_code());//基金发行人 20 | vo.setProduct_nature(po.getProduct_nature()); //基金性质 21 | vo.setProduct_bank(po.getProduct_bank()); //托管行 22 | vo.setProduct_COOPERATIVE_SECURITIES_INSTITUTION(po.getProduct_COOPERATIVE_SECURITIES_INSTITUTION()); //合作证券机构 23 | vo.setProduct_COOPERATIVE_FUTURES_AGENCY(po.getProduct_COOPERATIVE_FUTURES_AGENCY()); //合作期货机构 24 | vo.setProduct_ESTABLISHMENT_DATE(po.getProduct_ESTABLISHMENT_DATE()); // date 成立日期 25 | vo.setProduct_DURATION_YEAR(po.getProduct_DURATION_YEAR()); //存续期间(年) 26 | vo.setProduct_DURATION_EXISTENCE_YEAR(po.getProduct_DURATION_EXISTENCE_YEAR()); //存续期限(年) 27 | vo.setProduct_TERMINATION_CONTION(po.getProduct_TERMINATION_CONTION()); //终止条件 28 | vo.setProduct_TYPE(po.getProduct_TYPE()); //基金类型 29 | vo.setProduct_INVESTMENT_TYPE(po.getProduct_INVESTMENT_TYPE()); //投资类型 30 | vo.setProduct_INVESTMENT_TYPE_DETAIL(po.getProduct_INVESTMENT_TYPE_DETAIL()); //投资类型细分 31 | vo.setProduct_info(po.getProduct_info()); // 产品信息 32 | vo.setProduct_INVESTMENT_TARGETS(po.getProduct_INVESTMENT_TARGETS()); //投资标的 33 | vo.setProduct_INVESTMENT_RATIO(po.getProduct_INVESTMENT_RATIO()); //投资比例 34 | vo.setProduct_EXPECTED_RETURN(po.getProduct_EXPECTED_RETURN()); //预期收益 35 | vo.setProduct_HEDGE_RATIO(po.getProduct_HEDGE_RATIO()); //对冲比例 36 | vo.setProduct_INVESTMENT_THRESHOLD(po.getProduct_INVESTMENT_THRESHOLD()); //投资门槛(万) 37 | vo.setProduct_ADDITIONAL_AMOUNT(po.getProduct_ADDITIONAL_AMOUNT()); //追加金额(万) 38 | vo.setProduct_OPEN_PERIOD(po.getProduct_OPEN_PERIOD()); //开放期 39 | vo.setProduct_OPEN_FREQUENCY(po.getProduct_OPEN_FREQUENCY()); //开放频度 40 | vo.setProduct_CLOSURE_PERIOD(po.getProduct_CLOSURE_PERIOD()); //封闭期(天)(转换下) 41 | vo.setProduct_EARLY_WARNING_LINE(po.getProduct_EARLY_WARNING_LINE()); //预警线 42 | vo.setProduct_STOP_LINE(po.getProduct_STOP_LINE()); //止损线 43 | vo.setProduct_CLASSIFICATON(po.getProduct_CLASSIFICATON()); //是否分级 0 否 1 是 44 | vo.setProduct_GRADING_SCALE(po.getProduct_GRADING_SCALE()); //分级比例 45 | vo.setProduct_OTHERS(po.getProduct_OTHERS()); //其他说明 46 | vo.setProduct_price(po.getProduct_price()); //产品价格 47 | vo.setCreatedate(po.getCreatedate()); //datetime 48 | vo.setProductcategory_code(po.getProductcategory_code()); //产品分类代码 49 | vo.setProduct_image_url(po.getProduct_image_url()); //图片url 50 | vo.setProduct_is_crawler(1); //是否为爬取 1 是 0 不是 51 | return vo; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/AnnualFluctuationRateDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.AnnualFluctuationRatePo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/17. 17 | */ 18 | @Repository 19 | public class AnnualFluctuationRateDao implements IAnnualFluctuationRate{ 20 | @Resource 21 | private JdbcTemplate jdbcTemplate; 22 | 23 | @Override 24 | public void save(final AnnualFluctuationRatePo po) { 25 | final String sql = "INSERT INTO bs_annual_fluctuation_rate(product_id,FR_NEARLY_A_YEAR,FR_NEARLY_TWO_YEARS,FR_NEARLY_THREE_YEARS,FR_NEARLY_FIVE_YEARS,FR_SINCE_ITS_ESTABLISHMENT,FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS,FR_MAXIMUM_CONTINUOUS_LOSS_DAYS,product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"; 26 | jdbcTemplate.update(new PreparedStatementCreator() { 27 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 28 | PreparedStatement ps = connection.prepareStatement(sql); 29 | ps.setInt(1, po.getProduct_id()); 30 | ps.setDouble(2, po.getFR_NEARLY_A_YEAR()); 31 | ps.setDouble(3, po.getFR_NEARLY_TWO_YEARS()); 32 | ps.setDouble(4, po.getFR_NEARLY_THREE_YEARS()); 33 | ps.setDouble(5, po.getFR_NEARLY_FIVE_YEARS()); 34 | ps.setDouble(6, po.getFR_SINCE_ITS_ESTABLISHMENT()); 35 | ps.setInt(7, po.getFR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS()); 36 | ps.setInt(8, po.getFR_MAXIMUM_CONTINUOUS_LOSS_DAYS()); 37 | ps.setInt(9, po.getProduct_is_crawler()); 38 | 39 | return ps; 40 | } 41 | }); 42 | } 43 | 44 | @Override 45 | public void remove(int product_id) { 46 | String sql = "DELETE FROM bs_annual_fluctuation_rate WHERE product_id = ?"; 47 | jdbcTemplate.update(sql, new Object[]{product_id}, new int[]{Types.INTEGER}); 48 | } 49 | 50 | @Override 51 | public void modify(final AnnualFluctuationRatePo po) { 52 | final String sql = "UPDATE bs_annual_fluctuation_rate SET FR_NEARLY_A_YEAR = ?, FR_NEARLY_TWO_YEARS = ?, FR_NEARLY_THREE_YEARS = ?, FR_NEARLY_FIVE_YEARS = ?, FR_SINCE_ITS_ESTABLISHMENT = ?, FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS = ?, FR_MAXIMUM_CONTINUOUS_LOSS_DAYS = ?, product_is_crawler = ? WHERE product_id = ?"; 53 | jdbcTemplate.update(new PreparedStatementCreator() { 54 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 55 | PreparedStatement ps = connection.prepareStatement(sql); 56 | ps.setDouble(1, po.getFR_NEARLY_A_YEAR()); 57 | ps.setDouble(2, po.getFR_NEARLY_TWO_YEARS()); 58 | ps.setDouble(3, po.getFR_NEARLY_THREE_YEARS()); 59 | ps.setDouble(4, po.getFR_NEARLY_FIVE_YEARS()); 60 | ps.setDouble(5, po.getFR_SINCE_ITS_ESTABLISHMENT()); 61 | ps.setInt(6, po.getFR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS()); 62 | ps.setInt(7, po.getFR_MAXIMUM_CONTINUOUS_LOSS_DAYS()); 63 | ps.setInt(8, po.getProduct_is_crawler()); 64 | ps.setInt(9, po.getProduct_id()); 65 | return ps; 66 | } 67 | }); 68 | } 69 | 70 | @Override 71 | public AnnualFluctuationRatePo find(int product_id) { 72 | String sql = "SELECT * FROM bs_annual_fluctuation_rate WHERE product_id = ?"; 73 | List annualFluctuationRatePoList = jdbcTemplate.query(sql, new Object[]{product_id}, 74 | new int[]{Types.INTEGER}, new AnnualFluctuationRatePo()); 75 | if (annualFluctuationRatePoList.isEmpty()) { 76 | return null; 77 | } else { 78 | return annualFluctuationRatePoList.get(0); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/AnnualizedReturnRateDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.AnnualizedReturnRatePo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/17. 17 | */ 18 | @Repository 19 | public class AnnualizedReturnRateDao implements IAnnualizedReturnRate{ 20 | @Resource 21 | private JdbcTemplate jdbcTemplate; 22 | 23 | @Override 24 | public void save(final AnnualizedReturnRatePo po) { 25 | final String sql = "INSERT INTO bs_annualized_return_rate (product_id,RR_NEARLY_A_YEAR ,RR_NEARLY_TWO_YEARS,RR_NEARLY_THREE_YEARS,RR_NEARLY_FIVE_YEARS,RR_SINCE_ITS_ESTABLISHMENT,product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?)"; 26 | jdbcTemplate.update(new PreparedStatementCreator() { 27 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 28 | PreparedStatement ps = connection.prepareStatement(sql); 29 | ps.setInt(1, po.getProduct_id()); 30 | ps.setDouble(2, po.getRR_NEARLY_A_YEAR()); 31 | ps.setDouble(3, po.getRR_NEARLY_TWO_YEARS()); 32 | ps.setDouble(4, po.getRR_NEARLY_THREE_YEARS()); 33 | ps.setDouble(5, po.getRR_NEARLY_FIVE_YEARS()); 34 | ps.setDouble(6, po.getRR_SINCE_ITS_ESTABLISHMENT()); 35 | ps.setInt(7, po.getProduct_is_crawler()); 36 | return ps; 37 | } 38 | }); 39 | } 40 | 41 | @Override 42 | public void remove(int product_id) { 43 | String sql = "DELETE FROM bs_annualized_return_rate WHERE product_id = ?"; 44 | jdbcTemplate.update(sql, new Object[]{product_id}, new int[]{Types.INTEGER}); 45 | } 46 | 47 | @Override 48 | public void modify(final AnnualizedReturnRatePo po) { 49 | final String sql = "UPDATE bs_annualized_return_rate SET RR_NEARLY_A_YEAR = ?, RR_NEARLY_TWO_YEARS = ?, RR_NEARLY_THREE_YEARS = ?, RR_NEARLY_FIVE_YEARS = ?, RR_SINCE_ITS_ESTABLISHMENT = ?, product_is_crawler = ? WHERE product_id = ?"; 50 | jdbcTemplate.update(new PreparedStatementCreator() { 51 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 52 | PreparedStatement ps = connection.prepareStatement(sql); 53 | ps.setDouble(1, po.getRR_NEARLY_A_YEAR()); 54 | ps.setDouble(2, po.getRR_NEARLY_TWO_YEARS()); 55 | ps.setDouble(3, po.getRR_NEARLY_THREE_YEARS()); 56 | ps.setDouble(4, po.getRR_NEARLY_FIVE_YEARS()); 57 | ps.setDouble(5, po.getRR_SINCE_ITS_ESTABLISHMENT()); 58 | ps.setInt(6, po.getProduct_is_crawler()); 59 | ps.setInt(7, po.getProduct_id()); 60 | return ps; 61 | } 62 | }); 63 | } 64 | 65 | @Override 66 | public AnnualizedReturnRatePo find(int product_id) { 67 | String sql = "SELECT * FROM bs_annualized_return_rate WHERE product_id = ?"; 68 | List annualizedReturnRatePoList = jdbcTemplate.query(sql, new Object[]{product_id}, 69 | new int[]{Types.INTEGER}, new AnnualizedReturnRatePo()); 70 | if (annualizedReturnRatePoList.isEmpty()) { 71 | return null; 72 | } else { 73 | return annualizedReturnRatePoList.get(0); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/CalmarRatioDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.CalmarRatioPo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/17. 17 | */ 18 | @Repository 19 | public class CalmarRatioDao implements ICalmarRatio{ 20 | 21 | @Resource 22 | private JdbcTemplate jdbcTemplate; 23 | 24 | @Override 25 | public void save(final CalmarRatioPo po) { 26 | final String sql = "INSERT INTO bs_calmar_ratio( product_id,CR_NEARLY_A_YEAR,CR_NEARLY_TWO_YEARS,CR_NEARLY_THREE_YEARS,CR_NEARLY_FIVE_YEARS,CR_SINCE_ITS_ESTABLISHMENT,product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?)"; 27 | jdbcTemplate.update(new PreparedStatementCreator() { 28 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 29 | PreparedStatement ps = connection.prepareStatement(sql); 30 | ps.setInt(1, po.getProduct_id()); 31 | ps.setDouble(2, po.getCR_NEARLY_A_YEAR()); 32 | ps.setDouble(3, po.getCR_NEARLY_TWO_YEARS()); 33 | ps.setDouble(4, po.getCR_NEARLY_THREE_YEARS()); 34 | ps.setDouble(5, po.getCR_NEARLY_FIVE_YEARS()); 35 | ps.setDouble(6, po.getCR_SINCE_ITS_ESTABLISHMENT()); 36 | ps.setInt(7, po.getProduct_is_crawler()); 37 | return ps; 38 | } 39 | }); 40 | 41 | } 42 | 43 | @Override 44 | public void remove(int product_id) { 45 | String sql = "DELETE FROM bs_calmar_ratio WHERE product_id = ?"; 46 | jdbcTemplate.update(sql, new Object[]{product_id}, new int[]{Types.INTEGER}); 47 | } 48 | 49 | @Override 50 | public void modify(final CalmarRatioPo po) { 51 | final String sql = "UPDATE bs_calmar_ratio SET CR_NEARLY_A_YEAR = ?, CR_NEARLY_TWO_YEARS = ?,CR_NEARLY_THREE_YEARS = ?, CR_NEARLY_FIVE_YEARS = ?, CR_SINCE_ITS_ESTABLISHMENT = ?, product_is_crawler = ? WHERE product_id = ?"; 52 | jdbcTemplate.update(new PreparedStatementCreator() { 53 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 54 | PreparedStatement ps = connection.prepareStatement(sql); 55 | ps.setDouble(1, po.getCR_NEARLY_A_YEAR()); 56 | ps.setDouble(2, po.getCR_NEARLY_TWO_YEARS()); 57 | ps.setDouble(3, po.getCR_NEARLY_THREE_YEARS()); 58 | ps.setDouble(4, po.getCR_NEARLY_FIVE_YEARS()); 59 | ps.setDouble(5, po.getCR_SINCE_ITS_ESTABLISHMENT()); 60 | ps.setInt(6, po.getProduct_is_crawler()); 61 | ps.setInt(7, po.getProduct_id()); 62 | return ps; 63 | } 64 | }); 65 | } 66 | 67 | @Override 68 | public CalmarRatioPo find(int product_id) { 69 | String sql = "SELECT * FROM bs_calmar_ratio WHERE product_id = ?"; 70 | List calmarRatioPoList = jdbcTemplate.query(sql, new Object[]{product_id}, 71 | new int[]{Types.INTEGER}, new CalmarRatioPo()); 72 | if (calmarRatioPoList.isEmpty()) { 73 | return null; 74 | } else { 75 | return calmarRatioPoList.get(0); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/CostRateDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.CostRatePo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/17. 17 | */ 18 | @Repository 19 | public class CostRateDao implements ICostRate{ 20 | 21 | @Resource 22 | private JdbcTemplate jdbcTemplate; 23 | 24 | @Override 25 | public void save(final CostRatePo po) { 26 | final String sql = "INSERT INTO bs_cost_rate(product_id,CR_SUBSCRIPTION_RATE,CR_REDEMPTION_RATE,CR_MANAGEMENT_RATE,CR_HOSTING_RATE,CR_PERFORMANCE_PAY_RATE,product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?)"; 27 | jdbcTemplate.update(new PreparedStatementCreator() { 28 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 29 | PreparedStatement ps = connection.prepareStatement(sql); 30 | ps.setInt(1, po.getProduct_id()); 31 | ps.setDouble(2, po.getCR_SUBSCRIPTION_RATE()); 32 | ps.setDouble(3, po.getCR_REDEMPTION_RATE()); 33 | ps.setDouble(4, po.getCR_MANAGEMENT_RATE()); 34 | ps.setDouble(5, po.getCR_HOSTING_RATE()); 35 | ps.setDouble(6, po.getCR_PERFORMANCE_PAY_RATE()); 36 | ps.setInt(7, po.getProduct_is_crawler()); 37 | return ps; 38 | } 39 | }); 40 | } 41 | 42 | @Override 43 | public void remove(int product_id) { 44 | String sql = "DELETE FROM bs_cost_rate WHERE product_id = ?"; 45 | jdbcTemplate.update(sql, new Object[]{product_id}, new int[]{Types.INTEGER}); 46 | } 47 | 48 | @Override 49 | public void modify(final CostRatePo po) { 50 | final String sql = "UPDATE bs_cost_rate SET CR_SUBSCRIPTION_RATE = ?,CR_REDEMPTION_RATE = ?, CR_MANAGEMENT_RATE = ?, CR_HOSTING_RATE = ?, CR_PERFORMANCE_PAY_RATE = ?, product_is_crawler = ? WHERE product_id = ?"; 51 | jdbcTemplate.update(new PreparedStatementCreator() { 52 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 53 | PreparedStatement ps = connection.prepareStatement(sql); 54 | ps.setDouble(1, po.getCR_SUBSCRIPTION_RATE()); 55 | ps.setDouble(2, po.getCR_REDEMPTION_RATE()); 56 | ps.setDouble(3, po.getCR_MANAGEMENT_RATE()); 57 | ps.setDouble(4, po.getCR_HOSTING_RATE()); 58 | ps.setDouble(5, po.getCR_PERFORMANCE_PAY_RATE()); 59 | ps.setInt(6, po.getProduct_is_crawler()); 60 | ps.setInt(7, po.getProduct_id()); 61 | return ps; 62 | } 63 | }); 64 | } 65 | 66 | @Override 67 | public CostRatePo find(int product_id) { 68 | String sql = "SELECT * FROM bs_cost_rate WHERE product_id = ?"; 69 | List costRatePoList = jdbcTemplate.query(sql, new Object[]{product_id}, 70 | new int[]{Types.INTEGER}, new CostRatePo()); 71 | if (costRatePoList.isEmpty()) { 72 | return null; 73 | } else { 74 | return costRatePoList.get(0); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/FundManagePeopleDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.FundManagePeoplePo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/17. 17 | */ 18 | @Repository 19 | public class FundManagePeopleDao implements IFundManagePeople { 20 | 21 | @Resource 22 | private JdbcTemplate jdbcTemplate; 23 | 24 | @Override 25 | public void save(final FundManagePeoplePo po) { 26 | final String sql = "INSERT INTO bs_fund(id, fund_name, fund_date, fund_assets, fund_product_no, fund_count, product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?)"; 27 | jdbcTemplate.update(new PreparedStatementCreator() { 28 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 29 | PreparedStatement ps = connection.prepareStatement(sql); 30 | ps.setInt(1, po.getId()); 31 | ps.setString(2, po.getFund_name()); 32 | ps.setString(3, po.getFund_date()); 33 | ps.setString(4, po.getFund_assets()); 34 | ps.setInt(5, po.getFund_product_no()); 35 | ps.setString(6, po.getFund_count()); 36 | ps.setInt(7, po.getProduct_is_crawler()); 37 | return ps; 38 | } 39 | }); 40 | } 41 | 42 | @Override 43 | public void remove(int id) { 44 | String sql = "DELETE FROM bs_fund WHERE id = ?"; 45 | jdbcTemplate.update(sql, new Object[]{id}, new int[]{Types.INTEGER}); 46 | } 47 | 48 | @Override 49 | public void modify(final FundManagePeoplePo po) { 50 | final String sql = "UPDATE bs_fund SET fund_name = ?, fund_date = ?, fund_assets = ?, fund_product_no = ?, fund_count = ?, product_is_crawler = ? WHERE id = ? "; 51 | jdbcTemplate.update(new PreparedStatementCreator() { 52 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 53 | PreparedStatement ps = connection.prepareStatement(sql); 54 | ps.setString(1, po.getFund_name()); 55 | ps.setString(2, po.getFund_date()); 56 | ps.setString(3, po.getFund_assets()); 57 | ps.setInt(4, po.getFund_product_no()); 58 | ps.setString(5, po.getFund_count()); 59 | ps.setInt(6, po.getProduct_is_crawler()); 60 | ps.setInt(7, po.getId()); 61 | return ps; 62 | } 63 | }); 64 | } 65 | 66 | @Override 67 | public FundManagePeoplePo find(int id) { 68 | String sql = "SELECT * FROM bs_fund WHERE product_id = ?"; 69 | List fundManagePeoplePoList = jdbcTemplate.query(sql, new Object[]{id}, 70 | new int[]{Types.INTEGER}, new FundManagePeoplePo()); 71 | if (fundManagePeoplePoList.isEmpty()) { 72 | return null; 73 | } else { 74 | return fundManagePeoplePoList.get(0); 75 | } 76 | } 77 | 78 | @Override 79 | public Integer getMaxId() { 80 | String sql = "select max(id) as maxid from bs_fund"; 81 | Integer maxId = jdbcTemplate.queryForObject(sql, Integer.class); 82 | return maxId; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/FundManagerDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.FundManagerPo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/18. 17 | */ 18 | @Repository 19 | public class FundManagerDao implements IFundManager { 20 | 21 | @Resource 22 | private JdbcTemplate jdbcTemplate; 23 | 24 | @Override 25 | public void save(final FundManagerPo po) { 26 | final String sql = "INSERT INTO bs_fundmanager(fundmanager_id, ID, BS_NAME, BS_FUND_MANAGEMENT_START_DATE, BS_FUND_MANAGEMENT_END_DATE, BS_MANAGEMENT_FUND_NUM, BS_HISTORICAL_MANANGEMENT_FUND_NUM, BS_UNIVERSITY, BS_EDUCATION, BS_PROFESSIONAL, BS_WORKING_TIME, BS_WORKING_YEAR, product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; 27 | jdbcTemplate.update(new PreparedStatementCreator() { 28 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 29 | PreparedStatement ps = connection.prepareStatement(sql); 30 | ps.setInt(1, po.getFundmanager_id()); 31 | ps.setInt(2, po.getID()); 32 | ps.setString(3, po.getBS_NAME()); 33 | ps.setString(4, po.getBS_FUND_MANAGEMENT_START_DATE()); 34 | ps.setString(5, po.getBS_FUND_MANAGEMENT_END_DATE()); 35 | ps.setInt(6, po.getBS_MANAGEMENT_FUND_NUM()); 36 | ps.setInt(7, po.getBS_HISTORICAL_MANANGEMENT_FUND_NUM()); 37 | ps.setString(8, po.getBS_UNIVERSITY()); 38 | ps.setString(9, po.getBS_EDUCATION()); 39 | ps.setString(10, po.getBS_PROFESSIONAL()); 40 | ps.setInt(11, po.getBS_WORKING_TIME()); 41 | ps.setString(12, po.getBS_WORKING_YEAR()); 42 | ps.setInt(13, po.getProduct_is_crawler()); 43 | return ps; 44 | } 45 | }); 46 | } 47 | 48 | @Override 49 | public void remove(int fundmanager_id) { 50 | String sql = "DELETE FROM bs_fundmanager WHERE fundmanager_id = ?"; 51 | jdbcTemplate.update(sql, new Object[]{fundmanager_id}, new int[]{Types.INTEGER}); 52 | } 53 | 54 | @Override 55 | public void modify(final FundManagerPo po) { 56 | final String sql = "UPDATE bs_fundmanager SET ID = ?, BS_NAME = ?, BS_FUND_MANAGEMENT_START_DATE = ?, BS_FUND_MANAGEMENT_END_DATE = ?, BS_MANAGEMENT_FUND_NUM = ?, BS_HISTORICAL_MANANGEMENT_FUND_NUM = ?, BS_UNIVERSITY = ?, BS_EDUCATION = ?, BS_PROFESSIONAL = ?, BS_WORKING_TIME = ?, BS_WORKING_YEAR = ?, product_is_crawler = ? where fundmanager_id = ?"; 57 | jdbcTemplate.update(new PreparedStatementCreator() { 58 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 59 | PreparedStatement ps = connection.prepareStatement(sql); 60 | ps.setInt(1, po.getID()); 61 | ps.setString(2, po.getBS_NAME()); 62 | ps.setString(3, po.getBS_FUND_MANAGEMENT_START_DATE()); 63 | ps.setString(4, po.getBS_FUND_MANAGEMENT_END_DATE()); 64 | ps.setInt(5, po.getBS_MANAGEMENT_FUND_NUM()); 65 | ps.setInt(6, po.getBS_HISTORICAL_MANANGEMENT_FUND_NUM()); 66 | ps.setString(7, po.getBS_UNIVERSITY()); 67 | ps.setString(8, po.getBS_EDUCATION()); 68 | ps.setString(9, po.getBS_PROFESSIONAL()); 69 | ps.setInt(10, po.getBS_WORKING_TIME()); 70 | ps.setString(11, po.getBS_WORKING_YEAR()); 71 | ps.setInt(12, po.getProduct_is_crawler()); 72 | ps.setInt(13, po.getFundmanager_id()); 73 | return ps; 74 | } 75 | }); 76 | } 77 | 78 | @Override 79 | public FundManagerPo find(int fundmanager_id) { 80 | String sql = "SELECT * FROM bs_fundmanager WHERE fundmanager_id = ?"; 81 | List fundManagerPoList = jdbcTemplate.query(sql, new Object[]{fundmanager_id}, 82 | new int[]{Types.INTEGER}, new FundManagerPo()); 83 | if (fundManagerPoList.isEmpty()) { 84 | return null; 85 | } else { 86 | return fundManagerPoList.get(0); 87 | } 88 | } 89 | 90 | @Override 91 | public Integer getMaxId() { 92 | String sql = "select max(id) as maxid from bs_fundmanager"; 93 | Integer maxId = jdbcTemplate.queryForObject(sql, Integer.class); 94 | return maxId; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/HSDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.HSPo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 2015/9/20. 17 | * 沪深300 18 | */ 19 | 20 | @Repository 21 | public class HSDao implements IHS { 22 | 23 | @Resource 24 | private JdbcTemplate jdbcTemplate; 25 | 26 | @Override 27 | public void save(final HSPo hsPo) { 28 | final String sql = "INSERT INTO hs300(id, date, kpj, zgj, spj, zdj, jyl, jyje, zdf) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"; 29 | jdbcTemplate.update(new PreparedStatementCreator() { 30 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 31 | PreparedStatement ps = connection.prepareStatement(sql); 32 | ps.setInt(1, hsPo.getId()); 33 | ps.setString(2, hsPo.getDate()); 34 | ps.setDouble(3, hsPo.getKpj()); 35 | ps.setDouble(4, hsPo.getZgj()); 36 | ps.setDouble(5, hsPo.getSpj()); 37 | ps.setDouble(6, hsPo.getZdj()); 38 | ps.setDouble(7, hsPo.getJyl()); 39 | ps.setDouble(8, hsPo.getJyje()); 40 | ps.setDouble(9, hsPo.getZdf()); 41 | return ps; 42 | } 43 | }); 44 | } 45 | 46 | @Override 47 | public void remove(int id) { 48 | String sql = "DELETE FROM hs300 WHERE id = ?" ; 49 | jdbcTemplate.update(sql, new Object[]{id}, new int[]{Types.INTEGER}); 50 | } 51 | 52 | @Override 53 | public void modify(final HSPo hsPo) { 54 | final String sql = "UPDATE hs300 SET date = ?, kpj = ?, zgj = ?, spj = ?, zdj = ?, jyl = ?, jyje = ?, zdf = ? WHERE id = ?"; 55 | jdbcTemplate.update(new PreparedStatementCreator() { 56 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 57 | PreparedStatement ps = connection.prepareStatement(sql); 58 | 59 | ps.setString(1, hsPo.getDate()); 60 | ps.setDouble(2, hsPo.getKpj()); 61 | ps.setDouble(3, hsPo.getZgj()); 62 | ps.setDouble(4, hsPo.getSpj()); 63 | ps.setDouble(5, hsPo.getZdj()); 64 | ps.setDouble(6, hsPo.getJyl()); 65 | ps.setDouble(7, hsPo.getJyje()); 66 | ps.setDouble(8, hsPo.getZdf()); 67 | 68 | ps.setInt(9, hsPo.getId()); 69 | return ps; 70 | } 71 | }); 72 | } 73 | 74 | @Override 75 | public HSPo find(int id) { 76 | String sql = "SELECT * FROM hs300 WHERE id = ?" ; 77 | List hsPoList = jdbcTemplate.query(sql,new Object[]{id}, 78 | new int[]{Types.INTEGER}, new HSPo()); 79 | if (hsPoList.isEmpty()) { 80 | return null; 81 | } else { 82 | return hsPoList.get(0); 83 | } 84 | } 85 | 86 | @Override 87 | public HSPo findByDate(String date) { 88 | String sql = "SELECT * FROM hs300 WHERE date = ?" ; 89 | List hsPoList = jdbcTemplate.query(sql,new Object[]{date}, 90 | new int[]{Types.VARCHAR}, new HSPo()); 91 | if (hsPoList.isEmpty()) { 92 | return null; 93 | } else { 94 | return hsPoList.get(0); 95 | } 96 | } 97 | 98 | @Override 99 | public Integer getMaxId() { 100 | String sql = "select max(id) as maxid from hs300"; 101 | Integer maxId = jdbcTemplate.queryForObject(sql, Integer.class); 102 | return maxId; 103 | } 104 | 105 | @Override 106 | public HSPo findPreData(String date) { 107 | String sql = "SELECT * FROM hs300 where date != ? ORDER BY date DESC" ; 108 | List hsPoList = jdbcTemplate.query(sql,new Object[]{date}, 109 | new int[]{Types.VARCHAR}, new HSPo()); 110 | if (hsPoList.isEmpty()) { 111 | return null; 112 | } else { 113 | return hsPoList.get(0); 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IAnnualFluctuationRate.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.AnnualFluctuationRatePo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/16. 7 | */ 8 | public interface IAnnualFluctuationRate { 9 | 10 | void save(AnnualFluctuationRatePo po); 11 | 12 | void remove(int product_id); 13 | 14 | void modify(AnnualFluctuationRatePo po); 15 | 16 | AnnualFluctuationRatePo find(int product_id); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IAnnualizedReturnRate.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.AnnualizedReturnRatePo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/16. 7 | */ 8 | public interface IAnnualizedReturnRate { 9 | void save(AnnualizedReturnRatePo po); 10 | 11 | void remove(int product_id); 12 | 13 | void modify(AnnualizedReturnRatePo po); 14 | 15 | AnnualizedReturnRatePo find(int product_id); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/ICalmarRatio.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.CalmarRatioPo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/16. 7 | */ 8 | public interface ICalmarRatio { 9 | void save(CalmarRatioPo po); 10 | 11 | void remove(int product_id); 12 | 13 | void modify(CalmarRatioPo po); 14 | 15 | CalmarRatioPo find(int product_id); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/ICostRate.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.CostRatePo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/16. 7 | */ 8 | public interface ICostRate { 9 | void save(CostRatePo po); 10 | 11 | void remove(int product_id); 12 | 13 | void modify(CostRatePo po); 14 | 15 | CostRatePo find(int product_id); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IEastFinance.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.EastFinancePo; 4 | 5 | /** 6 | * Created by Jerry on 2015/9/20. 7 | */ 8 | public interface IEastFinance { 9 | void save(EastFinancePo eastFinancePo); 10 | 11 | void remove(String id); 12 | 13 | void modify(EastFinancePo eastFinancePo); 14 | 15 | EastFinancePo find(String id); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IFundManagePeople.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.FundManagePeoplePo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/16. 7 | */ 8 | public interface IFundManagePeople { 9 | void save(FundManagePeoplePo po); 10 | 11 | void remove(int id); 12 | 13 | void modify(FundManagePeoplePo po); 14 | 15 | FundManagePeoplePo find(int id); 16 | 17 | Integer getMaxId(); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IFundManager.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.FundManagerPo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/17. 7 | */ 8 | public interface IFundManager { 9 | void save(FundManagerPo po); 10 | 11 | void remove(int fundmanager_id); 12 | 13 | void modify(FundManagerPo po); 14 | 15 | FundManagerPo find(int fundmanager_id); 16 | 17 | Integer getMaxId(); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IFundProduct.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.FundProductPo; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by Jerry on 2015/9/20. 9 | * 基金产品 10 | */ 11 | public interface IFundProduct { 12 | void save(FundProductPo fundProductPo); 13 | 14 | void remove(int id); 15 | 16 | void modify(FundProductPo fundProductPo); 17 | 18 | FundProductPo find(int id); 19 | 20 | List findAll(); 21 | 22 | FundProductPo findByCodeOrName(String product_code, String product_name); 23 | 24 | Integer getMaxId(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IHS.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.HSPo; 4 | 5 | /** 6 | * Created by Jerry on 2015/9/20. 7 | * 沪深300 8 | */ 9 | public interface IHS { 10 | void save(HSPo hsPo); 11 | 12 | void remove(int id); 13 | 14 | void modify(HSPo hsPo); 15 | 16 | HSPo find(int id); 17 | 18 | HSPo findByDate(String date); 19 | 20 | public Integer getMaxId(); 21 | 22 | HSPo findPreData(String date); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IHistoricalNet.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.HistoricalNetPo; 4 | 5 | /** 6 | * Created by Jerry on 2015/9/20 7 | * 历史净值 接口. 8 | */ 9 | public interface IHistoricalNet { 10 | void save(HistoricalNetPo historicalNetPo); 11 | 12 | void remove(int id); 13 | 14 | void modify(HistoricalNetPo historicalNetPo); 15 | 16 | HistoricalNetPo find(int id); 17 | 18 | HistoricalNetPo findByProductIDAndDate(int product_id, String date); 19 | 20 | Integer getMaxId(); 21 | 22 | HistoricalNetPo findLatestPo(int product_id); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IIncome.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.IncomePo; 4 | 5 | /** 6 | * Created by Jerry on 2015/9/20. 7 | * 收益率 8 | */ 9 | public interface IIncome { 10 | void save(IncomePo incomePo); 11 | 12 | void remove(int product_id); 13 | 14 | void modify(IncomePo incomePo); 15 | 16 | IncomePo find(int product_id); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IIncomeRanking.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.IncomeRankingPo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/17. 7 | */ 8 | public interface IIncomeRanking { 9 | 10 | void save(IncomeRankingPo po); 11 | 12 | void remove(int product_id); 13 | 14 | void modify(IncomeRankingPo po); 15 | 16 | IncomeRankingPo find(int product_id); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IMaximumReturn.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.MaximumReturnPo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/17. 7 | */ 8 | public interface IMaximumReturn { 9 | 10 | void save(MaximumReturnPo po); 11 | 12 | void remove(int product_id); 13 | 14 | void modify(MaximumReturnPo po); 15 | 16 | MaximumReturnPo find(int product_id); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IProductReFundManagePeople.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.ProductReFundManagePeoplePo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/17. 7 | */ 8 | public interface IProductReFundManagePeople { 9 | void save(ProductReFundManagePeoplePo po); 10 | 11 | void remove(int id); 12 | 13 | void modify(ProductReFundManagePeoplePo po); 14 | 15 | ProductReFundManagePeoplePo find(int id); 16 | 17 | ProductReFundManagePeoplePo findByProductIDAndFundPeopleID(int product_id, int bs_fund); 18 | 19 | Integer getMaxId(); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IProductReFundManager.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.ProductReFundManagerPo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/17. 7 | */ 8 | public interface IProductReFundManager { 9 | void save(ProductReFundManagerPo po); 10 | 11 | void remove(int id); 12 | 13 | void modify(ProductReFundManagerPo po); 14 | 15 | ProductReFundManagerPo find(int id); 16 | 17 | ProductReFundManagerPo findByProductIDAndFundManagerID(int product_id, int bs_fundmanager); 18 | 19 | Integer getMaxId(); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/ISharpRatio.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.SharpRatioPo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/17. 7 | */ 8 | public interface ISharpRatio { 9 | 10 | void save(SharpRatioPo po); 11 | 12 | void remove(int product_id); 13 | 14 | void modify(SharpRatioPo po); 15 | 16 | SharpRatioPo find(int product_id); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/ISterlingRatio.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.SterlingRatioPo; 4 | 5 | /** 6 | * Created by Jerry on 15/11/17. 7 | */ 8 | public interface ISterlingRatio { 9 | void save(SterlingRatioPo po); 10 | 11 | void remove(int product_id); 12 | 13 | void modify(SterlingRatioPo po); 14 | 15 | SterlingRatioPo find(int product_id); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/IncomeRankingDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.IncomeRankingPo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/18. 17 | */ 18 | @Repository 19 | public class IncomeRankingDao implements IIncomeRanking { 20 | @Resource 21 | private JdbcTemplate jdbcTemplate; 22 | 23 | 24 | @Override 25 | public void save(final IncomeRankingPo po) { 26 | final String sql = "INSERT INTO bs_income_ranking(product_id, IR_SINCE_THIS_YEAR, IR_NEARLY_A_MONTH, IR_NEARLY_THREE_MONTHS, IR_NEARLY_HALF_A_YEAR, IR_NEARLY_A_YEAR, IR_NEARLY_TWO_YEARS, IR_NEARLY_THREE_YEARS, IR_NEARLY_FIVE_YEARS, product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; 27 | jdbcTemplate.update(new PreparedStatementCreator() { 28 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 29 | PreparedStatement ps = connection.prepareStatement(sql); 30 | ps.setInt(1, po.getProduct_id()); 31 | ps.setString(2, po.getIR_SINCE_THIS_YEAR()); 32 | ps.setString(3, po.getIR_NEARLY_A_MONTH()); 33 | ps.setString(4, po.getIR_NEARLY_THREE_MONTHS()); 34 | ps.setString(5, po.getIR_NEARLY_HALF_A_YEAR()); 35 | ps.setString(6, po.getIR_NEARLY_A_YEAR()); 36 | ps.setString(7, po.getIR_NEARLY_TWO_YEARS()); 37 | ps.setString(8, po.getIR_NEARLY_THREE_YEARS()); 38 | ps.setString(9, po.getIR_NEARLY_FIVE_YEARS()); 39 | ps.setInt(10, po.getProduct_is_crawler()); 40 | return ps; 41 | } 42 | }); 43 | } 44 | 45 | @Override 46 | public void remove(int product_id) { 47 | String sql = "DELETE FROM bs_income_ranking WHERE product_id = ?"; 48 | jdbcTemplate.update(sql, new Object[]{product_id}, new int[]{Types.INTEGER}); 49 | } 50 | 51 | @Override 52 | public void modify(final IncomeRankingPo po) { 53 | final String sql = "UPDATE bs_income_ranking SET IR_SINCE_THIS_YEAR = ?, IR_NEARLY_A_MONTH = ?, IR_NEARLY_THREE_MONTHS = ?, IR_NEARLY_HALF_A_YEAR = ?, IR_NEARLY_A_YEAR = ?, IR_NEARLY_TWO_YEARS = ?, IR_NEARLY_THREE_YEARS = ?, IR_NEARLY_FIVE_YEARS = ?, product_is_crawler = ? WHERE product_id = ?"; 54 | jdbcTemplate.update(new PreparedStatementCreator() { 55 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 56 | PreparedStatement ps = connection.prepareStatement(sql); 57 | ps.setString(1, po.getIR_SINCE_THIS_YEAR()); 58 | ps.setString(2, po.getIR_NEARLY_A_MONTH()); 59 | ps.setString(3, po.getIR_NEARLY_THREE_MONTHS()); 60 | ps.setString(4, po.getIR_NEARLY_HALF_A_YEAR()); 61 | ps.setString(5, po.getIR_NEARLY_A_YEAR()); 62 | ps.setString(6, po.getIR_NEARLY_TWO_YEARS()); 63 | ps.setString(7, po.getIR_NEARLY_THREE_YEARS()); 64 | ps.setString(8, po.getIR_NEARLY_FIVE_YEARS()); 65 | ps.setInt(9, po.getProduct_is_crawler()); 66 | ps.setInt(10, po.getProduct_id()); 67 | return ps; 68 | } 69 | }); 70 | } 71 | 72 | @Override 73 | public IncomeRankingPo find(int product_id) { 74 | String sql = "SELECT * FROM bs_income_ranking WHERE product_id = ?"; 75 | List incomeRankingPoList = jdbcTemplate.query(sql, new Object[]{product_id}, 76 | new int[]{Types.INTEGER}, new IncomeRankingPo()); 77 | if (incomeRankingPoList.isEmpty()) { 78 | return null; 79 | } else { 80 | return incomeRankingPoList.get(0); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/MaximumReturnDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.MaximumReturnPo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/18. 17 | */ 18 | @Repository 19 | public class MaximumReturnDao implements IMaximumReturn { 20 | @Resource 21 | private JdbcTemplate jdbcTemplate; 22 | 23 | @Override 24 | public void save(final MaximumReturnPo po) { 25 | final String sql = "INSERT INTO bs_maximum_return( product_id, MR_NEARLY_A_YEAR, MR_NEARLY_TWO_YEARS, MR_NEARLY_THREE_YEARS, MR_NEARLY_FIVE_YEARS, MR_SINCE_ITS_ESTABLISHMENT, product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?)"; 26 | jdbcTemplate.update(new PreparedStatementCreator() { 27 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 28 | PreparedStatement ps = connection.prepareStatement(sql); 29 | ps.setInt(1, po.getProduct_id()); 30 | ps.setDouble(2, po.getMR_NEARLY_A_YEAR()); 31 | ps.setDouble(3, po.getMR_NEARLY_TWO_YEARS()); 32 | ps.setDouble(4, po.getMR_NEARLY_THREE_YEARS()); 33 | ps.setDouble(5, po.getMR_NEARLY_FIVE_YEARS()); 34 | ps.setDouble(6, po.getMR_SINCE_ITS_ESTABLISHMENT()); 35 | ps.setInt(7, po.getProduct_is_crawler()); 36 | return ps; 37 | } 38 | }); 39 | } 40 | 41 | @Override 42 | public void remove(int product_id) { 43 | String sql = "DELETE FROM bs_maximum_return WHERE product_id = ?"; 44 | jdbcTemplate.update(sql, new Object[]{product_id}, new int[]{Types.INTEGER}); 45 | } 46 | 47 | @Override 48 | public void modify(final MaximumReturnPo po) { 49 | final String sql = "UPDATE bs_maximum_return SET MR_NEARLY_A_YEAR = ?, MR_NEARLY_TWO_YEARS = ?, MR_NEARLY_THREE_YEARS = ?, MR_NEARLY_FIVE_YEARS = ?, MR_SINCE_ITS_ESTABLISHMENT = ?, product_is_crawler = ? WHERE product_id = ?"; 50 | jdbcTemplate.update(new PreparedStatementCreator() { 51 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 52 | PreparedStatement ps = connection.prepareStatement(sql); 53 | ps.setDouble(1, po.getMR_NEARLY_A_YEAR()); 54 | ps.setDouble(2, po.getMR_NEARLY_TWO_YEARS()); 55 | ps.setDouble(3, po.getMR_NEARLY_THREE_YEARS()); 56 | ps.setDouble(4, po.getMR_NEARLY_FIVE_YEARS()); 57 | ps.setDouble(5, po.getMR_SINCE_ITS_ESTABLISHMENT()); 58 | ps.setInt(6, po.getProduct_is_crawler()); 59 | ps.setInt(7, po.getProduct_id()); 60 | return ps; 61 | } 62 | }); 63 | } 64 | 65 | @Override 66 | public MaximumReturnPo find(int product_id) { 67 | String sql = "SELECT * FROM bs_maximum_return WHERE product_id = ?"; 68 | List maximumReturnPoList = jdbcTemplate.query(sql, new Object[]{product_id}, 69 | new int[]{Types.INTEGER}, new MaximumReturnPo()); 70 | if (maximumReturnPoList.isEmpty()) { 71 | return null; 72 | } else { 73 | return maximumReturnPoList.get(0); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/ProductReFundManagePeopleDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.ProductReFundManagePeoplePo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/18. 17 | */ 18 | @Repository 19 | public class ProductReFundManagePeopleDao implements IProductReFundManagePeople { 20 | @Resource 21 | private JdbcTemplate jdbcTemplate; 22 | 23 | @Override 24 | public void save(final ProductReFundManagePeoplePo po) { 25 | final String sql = "INSERT INTO bs_productfund (id, product_id, bs_fund, product_is_crawler ) VALUES(?, ?, ?, ?)"; 26 | jdbcTemplate.update(new PreparedStatementCreator() { 27 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 28 | PreparedStatement ps = connection.prepareStatement(sql); 29 | ps.setInt(1, po.getId()); 30 | ps.setInt(2, po.getProduct_id()); 31 | ps.setInt(3, po.getBs_fund()); 32 | ps.setInt(4, po.getProduct_is_crawler()); 33 | return ps; 34 | } 35 | }); 36 | } 37 | 38 | @Override 39 | public void remove(int id) { 40 | String sql = "DELETE FROM bs_productfund WHERE id = ?"; 41 | jdbcTemplate.update(sql, new Object[]{id}, new int[]{Types.INTEGER}); 42 | } 43 | 44 | @Override 45 | public void modify(final ProductReFundManagePeoplePo po) { 46 | final String sql = "UPDATE bs_productfund SET product_id = ?, bs_fund = ?, product_is_crawler = ? WHERE id = ?"; 47 | jdbcTemplate.update(new PreparedStatementCreator() { 48 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 49 | PreparedStatement ps = connection.prepareStatement(sql); 50 | ps.setInt(1, po.getProduct_id()); 51 | ps.setInt(2, po.getBs_fund()); 52 | ps.setInt(3, po.getProduct_is_crawler()); 53 | ps.setInt(4, po.getId()); 54 | return ps; 55 | } 56 | }); 57 | } 58 | 59 | @Override 60 | public ProductReFundManagePeoplePo find(int id) { 61 | String sql = "SELECT * FROM bs_productfund WHERE id = ?"; 62 | List productReFundManagePeoplePoList = jdbcTemplate.query(sql, new Object[]{id}, 63 | new int[]{Types.INTEGER}, new ProductReFundManagePeoplePo()); 64 | if (productReFundManagePeoplePoList.isEmpty()) { 65 | return null; 66 | } else { 67 | return productReFundManagePeoplePoList.get(0); 68 | } 69 | } 70 | 71 | @Override 72 | public ProductReFundManagePeoplePo findByProductIDAndFundPeopleID(int product_id, int bs_fund) { 73 | String sql = "SELECT * FROM bs_productfund WHERE product_id = ? and bs_fund = ?"; 74 | List productReFundManagePeoplePoList = jdbcTemplate.query(sql, new Object[]{product_id, bs_fund}, 75 | new int[]{Types.VARCHAR,Types.VARCHAR}, new ProductReFundManagePeoplePo()); 76 | if (productReFundManagePeoplePoList.isEmpty()) { 77 | return null; 78 | } else { 79 | return productReFundManagePeoplePoList.get(0); 80 | } 81 | } 82 | 83 | @Override 84 | public Integer getMaxId() { 85 | String sql = "select max(id) as maxid from bs_productfund"; 86 | Integer maxId = jdbcTemplate.queryForObject(sql, Integer.class); 87 | return maxId; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/ProductReFundManagerDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.ProductReFundManagerPo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/18. 17 | */ 18 | @Repository 19 | public class ProductReFundManagerDao implements IProductReFundManager { 20 | 21 | @Resource 22 | private JdbcTemplate jdbcTemplate; 23 | 24 | @Override 25 | public void save(final ProductReFundManagerPo po) { 26 | final String sql = "INSERT INTO bs_productfundmanager (id, product_id, bs_fundmanager, product_is_crawler) VALUES(?, ?, ?, ?)"; 27 | jdbcTemplate.update(new PreparedStatementCreator() { 28 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 29 | PreparedStatement ps = connection.prepareStatement(sql); 30 | ps.setInt(1, po.getId()); 31 | ps.setInt(2, po.getProduct_id()); 32 | ps.setInt(3, po.getBs_fundmanager()); 33 | ps.setInt(4, po.getProduct_is_crawler()); 34 | return ps; 35 | } 36 | }); 37 | } 38 | 39 | @Override 40 | public void remove(int id) { 41 | String sql = "DELETE FROM bs_productfundmanager WHERE id = ?"; 42 | jdbcTemplate.update(sql, new Object[]{id}, new int[]{Types.INTEGER}); 43 | } 44 | 45 | @Override 46 | public void modify(final ProductReFundManagerPo po) { 47 | final String sql = "UPDATE bs_productfundmanager SET product_id = ?, bs_fundmanager = ?, product_is_crawler = ?WHERE id = ?"; 48 | jdbcTemplate.update(new PreparedStatementCreator() { 49 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 50 | PreparedStatement ps = connection.prepareStatement(sql); 51 | ps.setInt(1, po.getProduct_id()); 52 | ps.setInt(2, po.getBs_fundmanager()); 53 | ps.setInt(3, po.getProduct_is_crawler()); 54 | ps.setInt(4, po.getId()); 55 | return ps; 56 | } 57 | }); 58 | } 59 | 60 | @Override 61 | public ProductReFundManagerPo find(int id) { 62 | String sql = "SELECT * FROM bs_productfundmanager WHERE id = ?"; 63 | List productReFundManagerPoList = jdbcTemplate.query(sql, new Object[]{id}, 64 | new int[]{Types.INTEGER}, new ProductReFundManagerPo()); 65 | if (productReFundManagerPoList.isEmpty()) { 66 | return null; 67 | } else { 68 | return productReFundManagerPoList.get(0); 69 | } 70 | } 71 | 72 | @Override 73 | public ProductReFundManagerPo findByProductIDAndFundManagerID(int product_id, int bs_fundmanager){ 74 | String sql = "SELECT * FROM bs_productfundmanager WHERE product_id = ? and bs_fundmanager = ?"; 75 | List productReFundManagerPoList = jdbcTemplate.query(sql, new Object[]{product_id, bs_fundmanager}, 76 | new int[]{Types.VARCHAR,Types.VARCHAR}, new ProductReFundManagerPo()); 77 | if (productReFundManagerPoList.isEmpty()) { 78 | return null; 79 | } else { 80 | return productReFundManagerPoList.get(0); 81 | } 82 | } 83 | 84 | @Override 85 | public Integer getMaxId() { 86 | String sql = "select max(id) as maxid from bs_productfundmanager"; 87 | Integer maxId = jdbcTemplate.queryForObject(sql, Integer.class); 88 | return maxId; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/SharpRatioDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.SharpRatioPo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/18. 17 | */ 18 | @Repository 19 | public class SharpRatioDao implements ISharpRatio { 20 | 21 | @Resource 22 | private JdbcTemplate jdbcTemplate; 23 | 24 | @Override 25 | public void save(final SharpRatioPo po) { 26 | final String sql = "INSERT INTO bs_sharp_ratio(product_id, SR_NEARLY_A_YEAR, SR_NEARLY_TWO_YEARS, SR_NEARLY_THREE_YEARS, SR_NEARLY_FIVE_YEARS, SR_SINCE_ITS_ESTABLISHMENT, product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?)"; 27 | jdbcTemplate.update(new PreparedStatementCreator() { 28 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 29 | PreparedStatement ps = connection.prepareStatement(sql); 30 | ps.setInt(1, po.getProduct_id()); 31 | ps.setDouble(2, po.getSR_NEARLY_A_YEAR()); 32 | ps.setDouble(3, po.getSR_NEARLY_TWO_YEARS()); 33 | ps.setDouble(4, po.getSR_NEARLY_THREE_YEARS()); 34 | ps.setDouble(5, po.getSR_NEARLY_FIVE_YEARS()); 35 | ps.setDouble(6, po.getSR_SINCE_ITS_ESTABLISHMENT()); 36 | ps.setInt(7, po.getProduct_is_crawler()); 37 | return ps; 38 | } 39 | }); 40 | } 41 | 42 | @Override 43 | public void remove(int product_id) { 44 | String sql = "DELETE FROM bs_sharp_ratio WHERE product_id = ?"; 45 | jdbcTemplate.update(sql, new Object[]{product_id}, new int[]{Types.INTEGER}); 46 | } 47 | 48 | @Override 49 | public void modify(final SharpRatioPo po) { 50 | final String sql = "UPDATE bs_sharp_ratio SET SR_NEARLY_A_YEAR = ?, SR_NEARLY_TWO_YEARS = ?,SR_NEARLY_THREE_YEARS = ?, SR_NEARLY_FIVE_YEARS = ?, SR_SINCE_ITS_ESTABLISHMENT = ?, product_is_crawler = ? WHERE product_id = ?"; 51 | jdbcTemplate.update(new PreparedStatementCreator() { 52 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 53 | PreparedStatement ps = connection.prepareStatement(sql); 54 | ps.setDouble(1, po.getSR_NEARLY_A_YEAR()); 55 | ps.setDouble(2, po.getSR_NEARLY_TWO_YEARS()); 56 | ps.setDouble(3, po.getSR_NEARLY_THREE_YEARS()); 57 | ps.setDouble(4, po.getSR_NEARLY_FIVE_YEARS()); 58 | ps.setDouble(5, po.getSR_SINCE_ITS_ESTABLISHMENT()); 59 | ps.setInt(6, po.getProduct_is_crawler()); 60 | ps.setInt(7, po.getProduct_id()); 61 | return ps; 62 | } 63 | }); 64 | } 65 | 66 | @Override 67 | public SharpRatioPo find(int product_id) { 68 | String sql = "SELECT * FROM bs_sharp_ratio WHERE product_id = ?"; 69 | List sharpRatioPoList = jdbcTemplate.query(sql, new Object[]{product_id}, 70 | new int[]{Types.INTEGER}, new SharpRatioPo()); 71 | if (sharpRatioPoList.isEmpty()) { 72 | return null; 73 | } else { 74 | return sharpRatioPoList.get(0); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/dao/SterlingRatioDao.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.dao; 2 | 3 | import com.jerry.financecrawler.db.po.SterlingRatioPo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.core.PreparedStatementCreator; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Resource; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.SQLException; 12 | import java.sql.Types; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 15/11/18. 17 | */ 18 | @Repository 19 | public class SterlingRatioDao implements ISterlingRatio{ 20 | 21 | @Resource 22 | private JdbcTemplate jdbcTemplate; 23 | 24 | @Override 25 | public void save(final SterlingRatioPo po) { 26 | final String sql = "INSERT INTO bs_sterling_ratio(product_id, SR_NEARLY_A_YEAR, SR_NEARLY_TWO_YEARS, SR_NEARLY_THREE_YEARS, SR_NEARLY_FIVE_YEARS, SR_SINCE_ITS_ESTABLISHMENT, product_is_crawler) VALUES(?, ?, ?, ?, ?, ?, ?)"; 27 | jdbcTemplate.update(new PreparedStatementCreator() { 28 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 29 | PreparedStatement ps = connection.prepareStatement(sql); 30 | ps.setInt(1, po.getProduct_id()); 31 | ps.setDouble(2, po.getSR_NEARLY_A_YEAR()); 32 | ps.setDouble(3, po.getSR_NEARLY_TWO_YEARS()); 33 | ps.setDouble(4, po.getSR_NEARLY_THREE_YEARS()); 34 | ps.setDouble(5, po.getSR_NEARLY_FIVE_YEARS()); 35 | ps.setDouble(6, po.getSR_SINCE_ITS_ESTABLISHMENT()); 36 | ps.setInt(7, po.getProduct_is_crawler()); 37 | return ps; 38 | } 39 | }); 40 | } 41 | 42 | @Override 43 | public void remove(int product_id) { 44 | String sql = "DELETE FROM bs_sterling_ratio WHERE product_id = ?"; 45 | jdbcTemplate.update(sql, new Object[]{product_id}, new int[]{Types.INTEGER}); 46 | } 47 | 48 | @Override 49 | public void modify(final SterlingRatioPo po) { 50 | final String sql = "UPDATE bs_sterling_ratio SET SR_NEARLY_A_YEAR = ?, SR_NEARLY_TWO_YEARS = ?,SR_NEARLY_THREE_YEARS = ?, SR_NEARLY_FIVE_YEARS = ?, SR_SINCE_ITS_ESTABLISHMENT = ?, product_is_crawler = ? WHERE product_id = ?"; 51 | jdbcTemplate.update(new PreparedStatementCreator() { 52 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 53 | PreparedStatement ps = connection.prepareStatement(sql); 54 | ps.setDouble(1, po.getSR_NEARLY_A_YEAR()); 55 | ps.setDouble(2, po.getSR_NEARLY_TWO_YEARS()); 56 | ps.setDouble(3, po.getSR_NEARLY_THREE_YEARS()); 57 | ps.setDouble(4, po.getSR_NEARLY_FIVE_YEARS()); 58 | ps.setDouble(5, po.getSR_SINCE_ITS_ESTABLISHMENT()); 59 | ps.setInt(6, po.getProduct_is_crawler()); 60 | ps.setInt(7, po.getProduct_id()); 61 | return ps; 62 | } 63 | }); 64 | } 65 | 66 | @Override 67 | public SterlingRatioPo find(int product_id) { 68 | String sql = "SELECT * FROM bs_sterling_ratio WHERE product_id = ?"; 69 | List sterlingRatioPoList = jdbcTemplate.query(sql, new Object[]{product_id}, 70 | new int[]{Types.INTEGER}, new SterlingRatioPo()); 71 | if (sterlingRatioPoList.isEmpty()) { 72 | return null; 73 | } else { 74 | return sterlingRatioPoList.get(0); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/AnnualFluctuationRatePo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.AnnualFluctuationRateVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * 年化波动率 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class AnnualFluctuationRatePo extends AnnualFluctuationRateVo implements RowMapper { 14 | @Override 15 | public int hashCode() { 16 | return getProduct_id() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | AnnualFluctuationRatePo annualFluctuationRatePo = (AnnualFluctuationRatePo) obj; 25 | if (this.getProduct_id() != annualFluctuationRatePo.getProduct_id()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public AnnualFluctuationRatePo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | AnnualFluctuationRatePo annualFluctuationRatePo = new AnnualFluctuationRatePo(); 34 | annualFluctuationRatePo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 35 | annualFluctuationRatePo.setFR_NEARLY_A_YEAR(rs.getDouble("FR_NEARLY_A_YEAR"));//近一年 36 | annualFluctuationRatePo.setFR_NEARLY_TWO_YEARS(rs.getDouble("FR_NEARLY_TWO_YEARS"));//近两年 37 | annualFluctuationRatePo.setFR_NEARLY_THREE_YEARS(rs.getDouble("FR_NEARLY_THREE_YEARS"));// 近三年 38 | annualFluctuationRatePo.setFR_NEARLY_FIVE_YEARS(rs.getDouble("FR_NEARLY_FIVE_YEARS"));//近5年 39 | annualFluctuationRatePo.setFR_SINCE_ITS_ESTABLISHMENT(rs.getDouble("FR_SINCE_ITS_ESTABLISHMENT"));//成立以来 40 | annualFluctuationRatePo.setFR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS(rs.getInt("FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS"));//最多连续盈利天数 41 | annualFluctuationRatePo.setFR_MAXIMUM_CONTINUOUS_LOSS_DAYS(rs.getInt("FR_MAXIMUM_CONTINUOUS_LOSS_DAYS"));//最多连续亏损天数 42 | annualFluctuationRatePo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 43 | return annualFluctuationRatePo; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/AnnualizedReturnRatePo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.AnnualizedReturnRateVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * 年化收益率 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class AnnualizedReturnRatePo extends AnnualizedReturnRateVo implements RowMapper { 14 | @Override 15 | public int hashCode() { 16 | return getProduct_id() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | AnnualizedReturnRatePo annualizedReturnRatePo = (AnnualizedReturnRatePo) obj; 25 | if (this.getProduct_id() != annualizedReturnRatePo.getProduct_id()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public AnnualizedReturnRatePo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | AnnualizedReturnRatePo annualizedReturnRatePo = new AnnualizedReturnRatePo(); 34 | annualizedReturnRatePo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 35 | annualizedReturnRatePo.setRR_NEARLY_A_YEAR(rs.getDouble("RR_NEARLY_A_YEAR"));//近一年 36 | annualizedReturnRatePo.setRR_NEARLY_TWO_YEARS(rs.getDouble("RR_NEARLY_TWO_YEARS"));//近两年 37 | annualizedReturnRatePo.setRR_NEARLY_THREE_YEARS(rs.getDouble("RR_NEARLY_THREE_YEARS"));// 近三年 38 | annualizedReturnRatePo.setRR_NEARLY_FIVE_YEARS(rs.getDouble("RR_NEARLY_FIVE_YEARS"));//近5年 39 | annualizedReturnRatePo.setRR_SINCE_ITS_ESTABLISHMENT(rs.getDouble("RR_SINCE_ITS_ESTABLISHMENT"));//成立以来 40 | annualizedReturnRatePo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 41 | return annualizedReturnRatePo; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/CalmarRatioPo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.CalmarRatioVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * CALMAR比率 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class CalmarRatioPo extends CalmarRatioVo implements RowMapper { 14 | @Override 15 | public int hashCode() { 16 | return getProduct_id() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | CalmarRatioPo calmarRatioPo = (CalmarRatioPo) obj; 25 | if (this.getProduct_id() != calmarRatioPo.getProduct_id()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public CalmarRatioPo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | CalmarRatioPo calmarRatioPo = new CalmarRatioPo(); 34 | calmarRatioPo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 35 | calmarRatioPo.setCR_NEARLY_A_YEAR(rs.getDouble("CR_NEARLY_A_YEAR"));//近一年 36 | calmarRatioPo.setCR_NEARLY_TWO_YEARS(rs.getDouble("CR_NEARLY_TWO_YEARS"));//近两年 37 | calmarRatioPo.setCR_NEARLY_THREE_YEARS(rs.getDouble("CR_NEARLY_THREE_YEARS"));// 近三年 38 | calmarRatioPo.setCR_NEARLY_FIVE_YEARS(rs.getDouble("CR_NEARLY_FIVE_YEARS"));//近5年 39 | calmarRatioPo.setCR_SINCE_ITS_ESTABLISHMENT(rs.getDouble("CR_SINCE_ITS_ESTABLISHMENT"));//成立以来 40 | calmarRatioPo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 41 | return calmarRatioPo; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/CostRatePo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.CostRateVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * 费用费率 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class CostRatePo extends CostRateVo implements RowMapper { 14 | @Override 15 | public int hashCode() { 16 | return getProduct_id() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | CostRatePo costRatePo = (CostRatePo) obj; 25 | if (this.getProduct_id() != costRatePo.getProduct_id()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public CostRatePo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | CostRatePo costRatePo = new CostRatePo(); 34 | costRatePo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 35 | costRatePo.setCR_SUBSCRIPTION_RATE(rs.getDouble("CR_SUBSCRIPTION_RATE"));//认购费率 36 | costRatePo.setCR_REDEMPTION_RATE(rs.getDouble("CR_REDEMPTION_RATE"));//赎回费 37 | costRatePo.setCR_MANAGEMENT_RATE(rs.getDouble("CR_MANAGEMENT_RATE"));//管理费 38 | costRatePo.setCR_HOSTING_RATE(rs.getDouble("CR_HOSTING_RATE"));//托管费 39 | costRatePo.setCR_PERFORMANCE_PAY_RATE(rs.getDouble("CR_PERFORMANCE_PAY_RATE"));//业绩报酬 40 | costRatePo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 41 | return costRatePo; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/EastFinancePo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.EastFinanceVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * Created by Jerry on 2015/9/20. 11 | */ 12 | public class EastFinancePo extends EastFinanceVo implements RowMapper { 13 | @Override 14 | public int hashCode() { 15 | return getId().hashCode() * 3; 16 | } 17 | 18 | @Override 19 | public boolean equals(Object obj) { 20 | if (obj == null || (obj.getClass() != this.getClass())) { 21 | return false; 22 | } 23 | EastFinancePo eastFinancePo = (EastFinancePo) obj; 24 | if (!this.getId() .equals( eastFinancePo.getId())) { 25 | return false; 26 | } 27 | return true; 28 | } 29 | 30 | @Override 31 | public EastFinancePo mapRow(ResultSet rs, int rowNum) throws SQLException { 32 | EastFinancePo eastFinancePo = new EastFinancePo(); 33 | eastFinancePo.setId(rs.getString("id")); 34 | eastFinancePo.setFINCODE(rs.getString("FINCODE")); 35 | eastFinancePo.setFINCODE(rs.getString("FINCODE")); 36 | eastFinancePo.setSHORTNAME(rs.getString("SHORTNAME")); 37 | eastFinancePo.setESTABDATE(rs.getString("ESTABDATE")); 38 | eastFinancePo.setMANAGERCODE(rs.getString("MANAGERCODE")); 39 | eastFinancePo.setMANAGER(rs.getString("MANAGER")); 40 | eastFinancePo.setSMANAGER(rs.getString("SMANAGER")); 41 | eastFinancePo.setTRUSTEECODE(rs.getString("TRUSTEECODE")); 42 | eastFinancePo.setTRUSTEE(rs.getString("TRUSTEE")); 43 | eastFinancePo.setSTRUSTEE(rs.getString("STRUSTEE")); 44 | eastFinancePo.setSCUSTDN(rs.getString("SCUSTDN")); 45 | eastFinancePo.setMGRNAME(rs.getString("MGRNAME")); 46 | eastFinancePo.setPDATE(rs.getString("PDATE")); 47 | eastFinancePo.setNAV(rs.getString("NAV")); 48 | eastFinancePo.setACCNAV(rs.getString("ACCNAV")); 49 | eastFinancePo.setHY(rs.getString("HY")); 50 | eastFinancePo.setY(rs.getString("Y")); 51 | eastFinancePo.setTWY(rs.getString("TWY")); 52 | eastFinancePo.setSY(rs.getString("SY")); 53 | return eastFinancePo; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/FundManagePeoplePo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.FundManagePeopleVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * 基金管理人 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class FundManagePeoplePo extends FundManagePeopleVo implements RowMapper { 14 | 15 | @Override 16 | public int hashCode() { 17 | return getId() * 3; 18 | } 19 | 20 | @Override 21 | public boolean equals(Object obj) { 22 | if (obj == null || (obj.getClass() != this.getClass())) { 23 | return false; 24 | } 25 | FundManagePeoplePo fundManagePeoplePo = (FundManagePeoplePo) obj; 26 | if (this.getId() != fundManagePeoplePo.getId()) { 27 | return false; 28 | } 29 | return true; 30 | } 31 | 32 | @Override 33 | public FundManagePeoplePo mapRow(ResultSet rs, int rowNum) throws SQLException { 34 | FundManagePeoplePo fundManagePeoplePo = new FundManagePeoplePo(); 35 | fundManagePeoplePo.setId(rs.getInt("id")); 36 | fundManagePeoplePo.setFund_name(rs.getString("fund_name"));// 基金管理人 37 | fundManagePeoplePo.setFund_date(rs.getString("fund_date"));//成立时间 38 | fundManagePeoplePo.setFund_assets(rs.getString("fund_assets"));//管理人管理资产 39 | fundManagePeoplePo.setFund_product_no(rs.getInt("fund_product_no"));//管理人管理产品数量 40 | fundManagePeoplePo.setFund_count(rs.getString("fund_count"));//投研人数 41 | fundManagePeoplePo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 42 | return fundManagePeoplePo; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/FundManagerPo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.FundManagerVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * 基金经理 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class FundManagerPo extends FundManagerVo implements RowMapper { 14 | 15 | @Override 16 | public int hashCode() { 17 | return getFundmanager_id() * 3; 18 | } 19 | 20 | @Override 21 | public boolean equals(Object obj) { 22 | if (obj == null || (obj.getClass() != this.getClass())) { 23 | return false; 24 | } 25 | FundManagerPo fundManagerPo = (FundManagerPo) obj; 26 | if (this.getFundmanager_id() != fundManagerPo.getFundmanager_id()) { 27 | return false; 28 | } 29 | return true; 30 | } 31 | 32 | @Override 33 | public FundManagerPo mapRow(ResultSet rs, int rowNum) throws SQLException { 34 | FundManagerPo fundManagerPo = new FundManagerPo(); 35 | fundManagerPo.setFundmanager_id(rs.getInt("fundmanager_id")); 36 | fundManagerPo.setID(rs.getInt("ID")); 37 | fundManagerPo.setBS_NAME(rs.getString("BS_NAME"));//基金经理 38 | fundManagerPo.setBS_FUND_MANAGEMENT_START_DATE(rs.getString("BS_FUND_MANAGEMENT_START_DATE"));//基金起始管理日期 39 | fundManagerPo.setBS_FUND_MANAGEMENT_END_DATE(rs.getString("BS_FUND_MANAGEMENT_END_DATE"));//基金结束管理日期 40 | fundManagerPo.setBS_MANAGEMENT_FUND_NUM(rs.getInt("BS_MANAGEMENT_FUND_NUM"));//管理基金数 41 | fundManagerPo.setBS_HISTORICAL_MANANGEMENT_FUND_NUM(rs.getInt("BS_HISTORICAL_MANANGEMENT_FUND_NUM"));//历史管理基金数 42 | fundManagerPo.setBS_UNIVERSITY(rs.getString("BS_UNIVERSITY"));//毕业院校 43 | fundManagerPo.setBS_EDUCATION(rs.getString("BS_EDUCATION"));//学历 44 | fundManagerPo.setBS_PROFESSIONAL(rs.getString("BS_PROFESSIONAL"));//专业 45 | fundManagerPo.setBS_WORKING_TIME(rs.getInt("BS_WORKING_TIME"));//从业时间 46 | fundManagerPo.setBS_WORKING_YEAR(rs.getString("BS_WORKING_YEAR"));//从业年限 47 | fundManagerPo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 48 | return fundManagerPo; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/HSPo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.HSVo; 4 | import com.jerry.financecrawler.vo.IncomeVo; 5 | import org.springframework.jdbc.core.RowMapper; 6 | 7 | import java.sql.ResultSet; 8 | import java.sql.SQLException; 9 | 10 | /** 11 | * Created by Jerry on 2015/9/20. 12 | */ 13 | public class HSPo extends HSVo implements RowMapper { 14 | @Override 15 | public int hashCode() { 16 | return getId() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | HSPo hsPo = (HSPo) obj; 25 | if (this.getId() != hsPo.getId()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public HSPo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | HSPo hsPo = new HSPo(); 34 | hsPo.setId(rs.getInt("id")); 35 | hsPo.setDate(rs.getString("date"));//日期 36 | hsPo.setKpj(rs.getDouble("kpj"));//开盘价 37 | hsPo.setZgj(rs.getDouble("zgj"));//最高价 38 | hsPo.setSpj(rs.getDouble("spj"));//收盘价 39 | hsPo.setZdj(rs.getDouble("zdj"));//最低价 40 | hsPo.setJyl(rs.getDouble("jyl"));//交易量(股) 41 | hsPo.setJyje(rs.getDouble("jyje"));//交易金额(元) 42 | hsPo.setZdf(rs.getDouble("zdf"));//涨跌幅 43 | return hsPo; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/HistoricalNetPo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.HistoricalNetVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * Created by Jerry on 2015/9/20. 11 | */ 12 | public class HistoricalNetPo extends HistoricalNetVo implements RowMapper { 13 | @Override 14 | public int hashCode() { 15 | return getId() * 3; 16 | } 17 | 18 | @Override 19 | public boolean equals(Object obj) { 20 | if (obj == null || (obj.getClass() != this.getClass())) { 21 | return false; 22 | } 23 | HistoricalNetPo eastFinancePo = (HistoricalNetPo) obj; 24 | if (this.getId() != eastFinancePo.getId()) { 25 | return false; 26 | } 27 | return true; 28 | } 29 | 30 | @Override 31 | public HistoricalNetPo mapRow(ResultSet rs, int rowNum) throws SQLException { 32 | HistoricalNetPo historicalNetPo = new HistoricalNetPo(); 33 | historicalNetPo.setId(rs.getInt("id")); 34 | historicalNetPo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 35 | historicalNetPo.setProduct_code(rs.getString("product_code"));//产品代码 36 | historicalNetPo.setNet_worth_date(rs.getString("net_worth_date")); //date 净值日期 37 | historicalNetPo.setUnit_net_worth(rs.getDouble("unit_net_worth"));//单位净值 38 | historicalNetPo.setAdd_net_worth(rs.getDouble("add_net_worth"));//累计净值 39 | historicalNetPo.setChg(rs.getDouble("Chg")); //涨跌幅 40 | historicalNetPo.setProduct_is_crawler(rs.getInt("product_is_crawler"));//是否为爬取 1 是 0 不是 41 | return historicalNetPo; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/IncomePo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.IncomeVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * Created by Jerry on 2015/9/20. 11 | */ 12 | public class IncomePo extends IncomeVo implements RowMapper { 13 | @Override 14 | public int hashCode() { 15 | return getProduct_id() * 3; 16 | } 17 | 18 | @Override 19 | public boolean equals(Object obj) { 20 | if (obj == null || (obj.getClass() != this.getClass())) { 21 | return false; 22 | } 23 | IncomePo incomePo = (IncomePo) obj; 24 | if (this.getProduct_id() != incomePo.getProduct_id()) { 25 | return false; 26 | } 27 | return true; 28 | } 29 | 30 | @Override 31 | public IncomePo mapRow(ResultSet rs, int rowNum) throws SQLException { 32 | IncomePo incomePo = new IncomePo(); 33 | incomePo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 34 | incomePo.setI_UPDATE_DATE(rs.getString("I_UPDATE_DATE"));// date 更新时间 35 | incomePo.setI_LATEST_NET_WORTH(rs.getDouble("I_LATEST_NET_WORTH"));// 最新净值 36 | incomePo.setI_SINCE_THIS_YEAR(rs.getDouble("I_SINCE_THIS_YEAR"));// 今年以来 37 | incomePo.setI_NEARLY_A_MONTH(rs.getDouble("I_NEARLY_A_MONTH"));// 近一月 38 | incomePo.setI_NEARLY_THREE_MONTHS(rs.getDouble("I_NEARLY_THREE_MONTHS"));// 近三月 39 | incomePo.setI_NEARLY_HALF_A_YEAR(rs.getDouble("I_NEARLY_HALF_A_YEAR"));//近半年 40 | incomePo.setI_NEARLY_A_YEAR(rs.getDouble("I_NEARLY_A_YEAR"));// 近一年 41 | incomePo.setI_NEARLY_TWO_YEARS(rs.getDouble("I_NEARLY_TWO_YEARS"));//近两年 42 | incomePo.setI_NEARLY_THREE_YEARS(rs.getDouble("I_NEARLY_THREE_YEARS"));//近三年 43 | incomePo.setI_NEARLY_FIVE_YEARS(rs.getDouble("I_NEARLY_FIVE_YEARS"));//近5年 44 | incomePo.setI_SINCE_ITS_ESTABLISHMENT(rs.getDouble("I_SINCE_ITS_ESTABLISHMENT"));//成立以来 45 | incomePo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 46 | return incomePo; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/IncomeRankingPo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.IncomeRankingVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * 收益排名 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class IncomeRankingPo extends IncomeRankingVo implements RowMapper { 14 | @Override 15 | public int hashCode() { 16 | return getProduct_id() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | IncomeRankingPo incomeRankingPo = (IncomeRankingPo) obj; 25 | if (this.getProduct_id() != incomeRankingPo.getProduct_id()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public IncomeRankingPo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | IncomeRankingPo incomeRankingPo = new IncomeRankingPo(); 34 | incomeRankingPo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 35 | incomeRankingPo.setIR_SINCE_THIS_YEAR(rs.getString("IR_SINCE_THIS_YEAR"));// 今年以来 36 | incomeRankingPo.setIR_NEARLY_A_MONTH(rs.getString("IR_NEARLY_A_MONTH"));// 近一月 37 | incomeRankingPo.setIR_NEARLY_THREE_MONTHS(rs.getString("IR_NEARLY_THREE_MONTHS"));// 近三月 38 | incomeRankingPo.setIR_NEARLY_HALF_A_YEAR(rs.getString("IR_NEARLY_HALF_A_YEAR"));//近半年 39 | incomeRankingPo.setIR_NEARLY_A_YEAR(rs.getString("IR_NEARLY_A_YEAR"));// 近一年 40 | incomeRankingPo.setIR_NEARLY_TWO_YEARS(rs.getString("IR_NEARLY_TWO_YEARS"));//近两年 41 | incomeRankingPo.setIR_NEARLY_THREE_YEARS(rs.getString("IR_NEARLY_THREE_YEARS"));//近三年 42 | incomeRankingPo.setIR_NEARLY_FIVE_YEARS(rs.getString("IR_NEARLY_FIVE_YEARS"));//近5年 43 | incomeRankingPo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 44 | return incomeRankingPo; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/MaximumReturnPo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.MaximumReturnVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * Created by Jerry on 15/11/12. 11 | */ 12 | public class MaximumReturnPo extends MaximumReturnVo implements RowMapper { 13 | @Override 14 | public int hashCode() { 15 | return getProduct_id() * 3; 16 | } 17 | 18 | @Override 19 | public boolean equals(Object obj) { 20 | if (obj == null || (obj.getClass() != this.getClass())) { 21 | return false; 22 | } 23 | MaximumReturnPo maximumReturnPo = (MaximumReturnPo) obj; 24 | if (this.getProduct_id() != maximumReturnPo.getProduct_id()) { 25 | return false; 26 | } 27 | return true; 28 | } 29 | 30 | @Override 31 | public MaximumReturnPo mapRow(ResultSet rs, int rowNum) throws SQLException { 32 | MaximumReturnPo maximumReturnPo = new MaximumReturnPo(); 33 | maximumReturnPo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 34 | maximumReturnPo.setMR_NEARLY_A_YEAR(rs.getDouble("MR_NEARLY_A_YEAR"));//近一年 35 | maximumReturnPo.setMR_NEARLY_TWO_YEARS(rs.getDouble("MR_NEARLY_TWO_YEARS"));//近两年 36 | maximumReturnPo.setMR_NEARLY_THREE_YEARS(rs.getDouble("MR_NEARLY_THREE_YEARS"));// 近三年 37 | maximumReturnPo.setMR_NEARLY_FIVE_YEARS(rs.getDouble("MR_NEARLY_FIVE_YEARS"));//近5年 38 | maximumReturnPo.setMR_SINCE_ITS_ESTABLISHMENT(rs.getDouble("MR_SINCE_ITS_ESTABLISHMENT"));//成立以来 39 | maximumReturnPo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 40 | return maximumReturnPo; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/ProductReFundManagePeoplePo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.ProductReFundManagePeopleVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * 管理人产品关联关系表 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class ProductReFundManagePeoplePo extends ProductReFundManagePeopleVo implements RowMapper { 14 | @Override 15 | public int hashCode() { 16 | return getId() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | ProductReFundManagePeoplePo re = (ProductReFundManagePeoplePo) obj; 25 | if (this.getId() != re.getId()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public ProductReFundManagePeoplePo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | ProductReFundManagePeoplePo re = new ProductReFundManagePeoplePo(); 34 | re.setId(rs.getInt("id")); 35 | re.setProduct_id(rs.getInt("product_id"));// 产品ID 36 | re.setBs_fund(rs.getInt("bs_fund"));// 管理人 37 | re.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 38 | return re; 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/ProductReFundManagerPo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.ProductReFundManagerVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * Created by Jerry on 15/11/12. 11 | */ 12 | public class ProductReFundManagerPo extends ProductReFundManagerVo implements RowMapper { 13 | 14 | @Override 15 | public int hashCode() { 16 | return getId() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | ProductReFundManagerPo re = (ProductReFundManagerPo) obj; 25 | if (this.getId() != re.getId()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public ProductReFundManagerPo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | ProductReFundManagerPo re = new ProductReFundManagerPo(); 34 | re.setId(rs.getInt("id")); 35 | re.setProduct_id(rs.getInt("product_id"));// 产品ID 36 | re.setBs_fundmanager(rs.getInt("bs_fundmanager"));// 基金经理 37 | re.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 38 | return re; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/SharpRatioPo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.SharpRatioVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | * 夏普比率 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class SharpRatioPo extends SharpRatioVo implements RowMapper { 14 | @Override 15 | public int hashCode() { 16 | return getProduct_id() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | SharpRatioPo sharpRatioPo = (SharpRatioPo) obj; 25 | if (this.getProduct_id() != sharpRatioPo.getProduct_id()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public SharpRatioPo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | SharpRatioPo sharpRatioPo = new SharpRatioPo(); 34 | sharpRatioPo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 35 | sharpRatioPo.setSR_NEARLY_A_YEAR(rs.getDouble("SR_NEARLY_A_YEAR"));//近一年 36 | sharpRatioPo.setSR_NEARLY_TWO_YEARS(rs.getDouble("SR_NEARLY_TWO_YEARS"));//近两年 37 | sharpRatioPo.setSR_NEARLY_THREE_YEARS(rs.getDouble("SR_NEARLY_THREE_YEARS"));// 近三年 38 | sharpRatioPo.setSR_NEARLY_FIVE_YEARS(rs.getDouble("SR_NEARLY_FIVE_YEARS"));//近5年 39 | sharpRatioPo.setSR_SINCE_ITS_ESTABLISHMENT(rs.getDouble("SR_SINCE_ITS_ESTABLISHMENT"));//成立以来 40 | sharpRatioPo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 41 | return sharpRatioPo; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/db/po/SterlingRatioPo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.db.po; 2 | 3 | import com.jerry.financecrawler.vo.SterlingRatioVo; 4 | import org.springframework.jdbc.core.RowMapper; 5 | 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | 9 | /** 10 | *Sterling比率 11 | * Created by Jerry on 15/11/12. 12 | */ 13 | public class SterlingRatioPo extends SterlingRatioVo implements RowMapper { 14 | @Override 15 | public int hashCode() { 16 | return getProduct_id() * 3; 17 | } 18 | 19 | @Override 20 | public boolean equals(Object obj) { 21 | if (obj == null || (obj.getClass() != this.getClass())) { 22 | return false; 23 | } 24 | SterlingRatioPo sterlingRatioPo = (SterlingRatioPo) obj; 25 | if (this.getProduct_id() != sterlingRatioPo.getProduct_id()) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | @Override 32 | public SterlingRatioPo mapRow(ResultSet rs, int rowNum) throws SQLException { 33 | SterlingRatioPo sterlingRatioPo = new SterlingRatioPo(); 34 | sterlingRatioPo.setProduct_id(rs.getInt("product_id"));//产品id-唯一值 35 | sterlingRatioPo.setSR_NEARLY_A_YEAR(rs.getDouble("SR_NEARLY_A_YEAR"));//近一年 36 | sterlingRatioPo.setSR_NEARLY_TWO_YEARS(rs.getDouble("SR_NEARLY_TWO_YEARS"));//近两年 37 | sterlingRatioPo.setSR_NEARLY_THREE_YEARS(rs.getDouble("SR_NEARLY_THREE_YEARS"));// 近三年 38 | sterlingRatioPo.setSR_NEARLY_FIVE_YEARS(rs.getDouble("SR_NEARLY_FIVE_YEARS"));//近5年 39 | sterlingRatioPo.setSR_SINCE_ITS_ESTABLISHMENT(rs.getDouble("SR_SINCE_ITS_ESTABLISHMENT"));//成立以来 40 | sterlingRatioPo.setProduct_is_crawler(rs.getInt("product_is_crawler")); //是否为爬取 1 是 0 不是 41 | return sterlingRatioPo; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/job/QuartzJob.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.job; 2 | 3 | /** 4 | * Created by Jerry on 2015/9/17. 5 | */ 6 | public interface QuartzJob { 7 | 8 | public void execute(); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/job/eastmoney/EastMoneyFundProductJob.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.job.eastmoney; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.CommonsUrl; 5 | import com.jerry.financecrawler.commons.StringUtil; 6 | import com.jerry.financecrawler.db.po.FundProductPo; 7 | import com.jerry.financecrawler.job.QuartzJob; 8 | import com.jerry.financecrawler.save.SaveData; 9 | import com.jerry.financecrawler.translate.eastmoney.HtmlToEastMoneyDetailVo; 10 | import com.jerry.financecrawler.translate.eastmoney.JsonToEastMoneyFundProductVo; 11 | import com.jerry.financecrawler.visitor.HtmlRequest; 12 | import com.jerry.financecrawler.vo.*; 13 | import org.slf4j.Logger; 14 | import org.slf4j.LoggerFactory; 15 | 16 | import javax.annotation.Resource; 17 | import java.util.List; 18 | 19 | /** 20 | * Created by Jerry on 2015/9/17. 21 | */ 22 | public class EastMoneyFundProductJob implements QuartzJob { 23 | /** 24 | * Logger 25 | */ 26 | private static final Logger log = LoggerFactory.getLogger(EastMoneyFundProductJob.class); 27 | 28 | private static final String baseUrl = CommonsUrl.EAST_MONEY_URL; 29 | 30 | private static final String detailUrl = CommonsUrl.EAST_MONEY_DETAIL_URL; 31 | 32 | private static final String charset = CommonsCharset.GB2312; 33 | 34 | @Resource 35 | private HtmlRequest htmlRequest; 36 | 37 | @Resource 38 | private JsonToEastMoneyFundProductVo jsonToEastMoneyFundProductVo; 39 | @Resource 40 | private SaveData saveData; 41 | @Resource 42 | private EastMoneyHistoricalNetJob eastMoneyHistoricalNetJob; 43 | @Resource 44 | private HtmlToEastMoneyDetailVo htmlToEastMoneyDetailVo; 45 | 46 | @Override 47 | public void execute() { 48 | log.info("EastMoney 基金产品采集服务启动"); 49 | try { 50 | int index = 1; 51 | int pageNum = 100; 52 | FundProductTotalVo fundProductTotalVo = getHtmlData(index, pageNum, 0); 53 | int allPages = fundProductTotalVo.getAllPages(); 54 | index++; 55 | while (index <= allPages) { 56 | getHtmlData(index, pageNum, allPages); 57 | index++; 58 | } 59 | } catch (Exception ex) { 60 | ex.printStackTrace(); 61 | log.error("dealing EastMoney data", ex); 62 | } 63 | 64 | 65 | log.info("EastMoney 基金产品采集服务完成"); 66 | } 67 | 68 | private FundProductTotalVo getHtmlData(int index, int pageNum, int allPages) throws Exception { 69 | String url = CommonsUrl.getUrl(baseUrl, index, pageNum, allPages); 70 | String data = htmlRequest.getHtmlData(url, charset); 71 | FundProductTotalVo fundProductTotalVo = null; 72 | if (!data.equals("")) { 73 | data = StringUtil.subJsonStrBySymbol(data, StringUtil.SYMBOL_EQUAL); 74 | // 翻译EastMoney 产品数据 75 | fundProductTotalVo = jsonToEastMoneyFundProductVo.parseToEastMoneyData(data); 76 | List fundProductVoList = fundProductTotalVo.getDatas(); 77 | if (fundProductVoList != null && fundProductVoList.size() > 0) { 78 | for (int i = 0; i < fundProductVoList.size(); i++) { 79 | FundProductVo fundProductVo = fundProductVoList.get(i); 80 | String fincode = fundProductVo.getFincode(); 81 | //获取product_code 82 | String product_code = getFcodeByFincode(fincode); 83 | fundProductVo.setProduct_code(product_code); 84 | //log.info("product_code = [" + product_code + "]"); 85 | }// for fundProductVoList 86 | //log.info("开始保存 基金产品数据"); 87 | List fundProductPoList = saveData.saveFundProductData(fundProductVoList); 88 | //log.info("fundProductPoList.size = [" + fundProductPoList.size() + "]"); 89 | //采集新东方历史净值 90 | eastMoneyHistoricalNetJob.execute(fundProductPoList); 91 | }// if fundProductVoList 92 | } 93 | return fundProductTotalVo; 94 | } 95 | 96 | private String getFcodeByFincode(String fincode) throws Exception{ 97 | String url = CommonsUrl.getUrlByCode(detailUrl, fincode); 98 | String data = htmlRequest.getHtmlData(url, charset); 99 | 100 | return htmlToEastMoneyDetailVo.HtmlToProductCode(data); 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/job/eastmoney/EastMoneyHistoricalNetJob.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.job.eastmoney; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.CommonsUrl; 5 | import com.jerry.financecrawler.commons.StringUtil; 6 | import com.jerry.financecrawler.db.po.FundProductPo; 7 | import com.jerry.financecrawler.save.SaveData; 8 | import com.jerry.financecrawler.translate.eastmoney.JsonToEastMoneyHistoricalNetVo; 9 | import com.jerry.financecrawler.visitor.HtmlRequest; 10 | import com.jerry.financecrawler.vo.HistoricalNetTotalVo; 11 | import com.jerry.financecrawler.vo.HistoricalNetVo; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.stereotype.Component; 15 | 16 | import javax.annotation.Resource; 17 | import java.util.List; 18 | 19 | /** 20 | * Created by Jerry on 2015/9/17. 21 | */ 22 | @Component 23 | public class EastMoneyHistoricalNetJob { 24 | /** 25 | * Logger 26 | */ 27 | private static final Logger log = LoggerFactory.getLogger(EastMoneyHistoricalNetJob.class); 28 | 29 | private static final String baseUrl = CommonsUrl.EAST_MONEY_HISTORICAL_NET_URL; 30 | 31 | private static final String charset = CommonsCharset.GB2312; 32 | 33 | @Resource 34 | private HtmlRequest htmlRequest; 35 | 36 | @Resource 37 | private JsonToEastMoneyHistoricalNetVo jsonToEastMoneyHistoricalNetVo; 38 | @Resource 39 | private SaveData saveData; 40 | 41 | public void execute(List fundProductPoList) { 42 | log.info("EastMoney 历史净值采集服务启动"); 43 | if (fundProductPoList != null) { 44 | for (int i = 0; i < fundProductPoList.size(); i++) { 45 | FundProductPo fundProductPo = fundProductPoList.get(i); 46 | String fincode = fundProductPo.getFincode(); 47 | int product_id = fundProductPo.getId(); 48 | String product_code = fundProductPo.getProduct_code(); 49 | try { 50 | int index = 1; 51 | int pageNum = 10; 52 | HistoricalNetTotalVo historicalNetTotalVo = getHtmlData(product_id, product_code, fincode, index, pageNum, 0); 53 | int allPages = historicalNetTotalVo.getAllPages(); 54 | index++; 55 | while (index <= allPages) { 56 | getHtmlData(product_id, product_code, fincode, index, pageNum, allPages); 57 | index++; 58 | } 59 | } catch (Exception ex) { 60 | ex.printStackTrace(); 61 | log.error("dealing EastMoneyHistoricalNetJob data", ex); 62 | } 63 | } 64 | } 65 | 66 | log.info("EastMoney 历史净值采集服务完成"); 67 | } 68 | 69 | private HistoricalNetTotalVo getHtmlData( int product_id, String product_code, String fincode, int index, int pageNum, int allPages) throws Exception { 70 | String url = CommonsUrl.getEastMoneyFinanceHistoricalNetUrlByCode(baseUrl, fincode, index, pageNum, allPages); 71 | String data = htmlRequest.getHtmlData(url, charset); 72 | HistoricalNetTotalVo historicalNetTotalVo = null; 73 | if (!data.equals("")) { 74 | data = StringUtil.subJsonStrBySymbol(data, StringUtil.SYMBOL_EQUAL); 75 | historicalNetTotalVo = jsonToEastMoneyHistoricalNetVo.parseToHistoricalNetData(data, product_id, product_code); 76 | List historicalNetVoList = historicalNetTotalVo.getDatas(); 77 | 78 | if(historicalNetVoList != null) saveData.saveHistoricalNetData(historicalNetVoList); 79 | } 80 | return historicalNetTotalVo; 81 | } 82 | 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/job/howbuy/FundProductJob.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.job.howbuy; import com.jerry.financecrawler.commons.CommonsCharset; import com.jerry.financecrawler.commons.CommonsUrl; import com.jerry.financecrawler.job.QuartzJob; import com.jerry.financecrawler.save.SaveData; import com.jerry.financecrawler.translate.howbuy.HtmlToFundProductVo; import com.jerry.financecrawler.visitor.HtmlRequest; import com.jerry.financecrawler.vo.FundProductTotalVo; import com.jerry.financecrawler.vo.FundProductVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Resource; import java.util.List; /** * Created by Jerry on 2015/9/17. */ public class FundProductJob implements QuartzJob { /** * Logger */ private static final Logger log = LoggerFactory.getLogger(FundProductJob.class); private static final String baseUrl = CommonsUrl.HOW_BUY_FINANCE_URL; private static final String charset = CommonsCharset.UTF_8; @Resource private HtmlRequest htmlRequest; @Resource private HtmlToFundProductVo htmlToFundProductVo; @Resource private SaveData saveData; @Override public void execute() { log.info("howbuy 基金产品采集服务启动"); try { int index = 1; int pageNum = 100; FundProductTotalVo fundProductTotalVo = getHtmlData(index, pageNum, 0); if (fundProductTotalVo != null) { int allPages = fundProductTotalVo.getAllPages(); index++; while (index <= allPages) { // log.info("index = " + index + ", pageNum = " + pageNum ); getHtmlData(index, pageNum, allPages); index++; } } } catch (Exception ex) { ex.printStackTrace(); log.error("dealing FundProductJob data", ex); } log.info("howbuy 基金产品采集服务完成"); } private FundProductTotalVo getHtmlData(int index, int pageNum, int allpages) throws Exception { String url = CommonsUrl.getUrl(baseUrl, index, pageNum, 0); String html = htmlRequest.getHtmlData(url, charset); FundProductTotalVo fundProductTotalVo = null; if (!html.equals("")) { fundProductTotalVo = htmlToFundProductVo.parseToFundProductData(html); if (fundProductTotalVo != null) { List fundProductVoList = fundProductTotalVo.getDatas(); saveData.saveFundProductData(fundProductVoList); } } return fundProductTotalVo; } } -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/job/howbuy/HistoricalNetJob.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.job.howbuy; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.CommonsUrl; 5 | import com.jerry.financecrawler.db.dao.IFundProduct; 6 | import com.jerry.financecrawler.db.po.FundProductPo; 7 | import com.jerry.financecrawler.job.QuartzJob; 8 | import com.jerry.financecrawler.save.SaveData; 9 | import com.jerry.financecrawler.translate.howbuy.HtmlToHistoricalNetVo; 10 | import com.jerry.financecrawler.visitor.HtmlRequest; 11 | import com.jerry.financecrawler.vo.HistoricalNetVo; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | 15 | import javax.annotation.Resource; 16 | import java.util.List; 17 | 18 | /** 19 | * Created by Jerry on 2015/9/17. 20 | */ 21 | public class HistoricalNetJob implements QuartzJob { 22 | /** 23 | * Logger 24 | */ 25 | private static final Logger log = LoggerFactory.getLogger(HistoricalNetJob.class); 26 | 27 | private static final String baseUrl = CommonsUrl.HOW_BUY_FINANCE_HISTORICAL_NET_URL; 28 | 29 | private static final String charset = CommonsCharset.UTF_8; 30 | 31 | @Resource 32 | private HtmlRequest htmlRequest; 33 | 34 | @Resource 35 | private HtmlToHistoricalNetVo htmlToHistoricalNetVo; 36 | @Resource 37 | private IFundProduct fundProductDao; 38 | @Resource 39 | private SaveData saveData; 40 | 41 | @Override 42 | public void execute() { 43 | log.info("howbuy 历史净值采集服务启动"); 44 | List fundProductPoList = fundProductDao.findAll(); 45 | if (fundProductPoList != null) { 46 | for (int i = 0; i < fundProductPoList.size(); i++) { 47 | FundProductPo fundProduct = fundProductPoList.get(i); 48 | int product_id = fundProduct.getId(); 49 | String product_code = fundProduct.getProduct_code(); 50 | //System.out.println("product_code = " + product_code); 51 | List historicalNetList = null; 52 | try { 53 | if (product_code != null && !product_code.equals("")) { 54 | historicalNetList = getHtmlData(product_id, product_code); 55 | } else { 56 | log.error("id = "+ product_id+", name ="+fundProduct.getProduct_name() + "(" + fundProduct.getProduct_shortname() + ")的 product_code为空"); 57 | } 58 | } catch (Exception ex) { 59 | log.error("id = "+ product_id +", name ="+ fundProduct.getProduct_name() + "(" + fundProduct.getProduct_shortname() + ")的 product_code = " + product_code); 60 | log.error("dealing HowBuyHistoricalNetJob data", ex); 61 | ex.printStackTrace(); 62 | } 63 | if(historicalNetList != null) { 64 | try { 65 | saveData.saveHistoricalNetData(historicalNetList);//保存历史净值 66 | saveData.updateHistoricalNetInIncome(product_id);//更新最新的历史净值到收益 67 | } catch (Exception e) { 68 | log.error("id = "+ product_id+", name ="+fundProduct.getProduct_name() + "(" + fundProduct.getProduct_shortname() + ")的历史净值保存 或者 收益更新失败", e); 69 | e.printStackTrace(); 70 | } 71 | } 72 | 73 | } 74 | } 75 | log.info("howbuy 历史净值采集服务完成"); 76 | } 77 | 78 | private List getHtmlData(int product_id, String product_code) throws Exception { 79 | String url = CommonsUrl.getUrlByCode(baseUrl, product_code); 80 | String html = htmlRequest.getHtmlData(url, charset); 81 | List historicalNetList = null; 82 | if (!html.equals("")) { 83 | historicalNetList = htmlToHistoricalNetVo.parseToHistoricalNetData(html, product_id, product_code); 84 | } 85 | return historicalNetList; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/job/hs/HSJob.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.job.hs; import com.jerry.financecrawler.commons.CommonsCharset; import com.jerry.financecrawler.commons.CommonsUrl; import com.jerry.financecrawler.job.QuartzJob; import com.jerry.financecrawler.save.SaveData; import com.jerry.financecrawler.translate.howbuy.HtmlToFundProductVo; import com.jerry.financecrawler.translate.hs.HtmlToHSVo; import com.jerry.financecrawler.visitor.HtmlRequest; import com.jerry.financecrawler.vo.FundProductTotalVo; import com.jerry.financecrawler.vo.FundProductVo; import com.jerry.financecrawler.vo.HSVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Resource; import java.util.List; /** * Created by Jerry on 2015/9/17. */ public class HSJob implements QuartzJob { /** * Logger */ private static final Logger log = LoggerFactory.getLogger(HSJob.class); private static final String baseUrl = CommonsUrl.HS_URL; private static final String charset = CommonsCharset.GB2312; @Resource private HtmlRequest htmlRequest; @Resource private HtmlToHSVo htmlToHSVo; @Resource private SaveData saveData; @Override public void execute() { log.info("HS300 采集服务启动"); try { getHtmlData(); } catch (Exception ex) { ex.printStackTrace(); log.error("dealing HSJob data", ex); } log.info("HS300 采集服务完成"); } private HSVo getHtmlData() throws Exception { String url =baseUrl; String html = htmlRequest.getHtmlData(url, charset); HSVo hsVo = null; if (!html.equals("")) { hsVo = htmlToHSVo.parseToHSData(html); if (hsVo != null) { saveData.saveHSData(hsVo); } } return hsVo; } } -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/job/licai/LiCaiDetailJob.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.job.licai; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.CommonsUrl; 5 | import com.jerry.financecrawler.translate.licai.HtmlToLiCaiDetailVo; 6 | import com.jerry.financecrawler.visitor.HtmlRequest; 7 | import com.jerry.financecrawler.vo.FundProductVo; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.stereotype.Component; 11 | 12 | import javax.annotation.Resource; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Jerry on 2015/9/17. 17 | */ 18 | @Component 19 | public class LiCaiDetailJob { 20 | /** 21 | * Logger 22 | */ 23 | private static final Logger log = LoggerFactory.getLogger(LiCaiDetailJob.class); 24 | 25 | private static final String baseUrl = CommonsUrl.LI_CAI_BASE_URL; 26 | 27 | private static final String charset = CommonsCharset.GB2312; 28 | 29 | @Resource 30 | private HtmlRequest htmlRequest; 31 | 32 | @Resource 33 | private HtmlToLiCaiDetailVo htmlToLiCaiDetailVo; 34 | 35 | public void execute(List fundProductVoList) { 36 | log.info("LiCai 详情采集服务启动"); 37 | if (fundProductVoList != null) { 38 | for (int i = 0; i < fundProductVoList.size(); i++) { 39 | FundProductVo fundProductVo = fundProductVoList.get(i); 40 | String fincode = fundProductVo.getFincode(); 41 | try { 42 | 43 | getHtmlData(fincode, fundProductVo); 44 | 45 | } catch (Exception ex) { 46 | ex.printStackTrace(); 47 | log.error("dealing LiCaiDetailJob data", ex); 48 | } 49 | } 50 | } 51 | 52 | log.info("LiCai 详情采集服务完成"); 53 | } 54 | 55 | private void getHtmlData(String fincode, FundProductVo fundProductVo) throws Exception { 56 | String url = baseUrl + fincode; 57 | String data = htmlRequest.getHtmlData(url, charset); 58 | if (!data.equals("")) { 59 | 60 | htmlToLiCaiDetailVo.HtmlToLiCaiDetail(data, fundProductVo); 61 | 62 | } 63 | } 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/job/licai/LiCaiFundProductJob.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.job.licai; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.CommonsUrl; 5 | import com.jerry.financecrawler.db.po.FundProductPo; 6 | import com.jerry.financecrawler.job.QuartzJob; 7 | import com.jerry.financecrawler.save.SaveData; 8 | import com.jerry.financecrawler.translate.licai.HtmlToLiCaiFundProductVo; 9 | import com.jerry.financecrawler.visitor.HtmlRequest; 10 | import com.jerry.financecrawler.vo.FundProductVo; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | 14 | import javax.annotation.Resource; 15 | import java.util.List; 16 | 17 | /** 18 | * Created by Jerry on 2015/9/17. 19 | */ 20 | public class LiCaiFundProductJob implements QuartzJob { 21 | /** 22 | * Logger 23 | */ 24 | private static final Logger log = LoggerFactory.getLogger(LiCaiFundProductJob.class); 25 | 26 | private static final String baseUrl = CommonsUrl.LI_CAI_URL; 27 | 28 | private static final String charset = CommonsCharset.GB2312; 29 | 30 | @Resource 31 | private HtmlRequest htmlRequest; 32 | 33 | @Resource 34 | private HtmlToLiCaiFundProductVo htmlToLiCaiFundProductVo; 35 | @Resource 36 | private SaveData saveData; 37 | @Resource 38 | private LiCaiHistoricalNetJob liCaiHistoricalNetJob; 39 | @Resource 40 | private LiCaiDetailJob liCaiDetailJob; 41 | 42 | @Override 43 | public void execute() { 44 | log.info("LiCai 采集服务启动"); 45 | List fundProductVoList = null; 46 | try { 47 | fundProductVoList = getHtmlData(); 48 | if (fundProductVoList != null) { 49 | //补全产品数据detail 50 | liCaiDetailJob.execute(fundProductVoList); 51 | //保存产品数据 52 | List fundProductPoList = saveData.saveFundProductData(fundProductVoList); 53 | //采集历史净值 54 | liCaiHistoricalNetJob.execute(fundProductPoList); 55 | } 56 | 57 | } catch (Exception ex) { 58 | log.error("dealing LiCaiJob data", ex); 59 | ex.printStackTrace(); 60 | } 61 | 62 | log.info("LiCai 采集服务完成"); 63 | } 64 | 65 | private List getHtmlData() throws Exception { 66 | String url = baseUrl; 67 | String html = htmlRequest.getHtmlData(url, charset); 68 | List fundProductVoList = null; 69 | if (!html.equals("")) { 70 | fundProductVoList = htmlToLiCaiFundProductVo.parseToFundProductData(html); 71 | } 72 | return fundProductVoList; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/job/licai/LiCaiHistoricalNetJob.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.job.licai; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.CommonsUrl; 5 | import com.jerry.financecrawler.db.po.FundProductPo; 6 | import com.jerry.financecrawler.save.SaveData; 7 | import com.jerry.financecrawler.translate.licai.HtmlToLiCaiHistoricalNetVo; 8 | import com.jerry.financecrawler.visitor.HtmlRequest; 9 | import com.jerry.financecrawler.vo.HistoricalNetVo; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | import org.springframework.stereotype.Component; 13 | 14 | import javax.annotation.Resource; 15 | import java.util.List; 16 | 17 | /** 18 | * Created by Jerry on 2015/9/17. 19 | */ 20 | @Component 21 | public class LiCaiHistoricalNetJob { 22 | /** 23 | * Logger 24 | */ 25 | private static final Logger log = LoggerFactory.getLogger(LiCaiHistoricalNetJob.class); 26 | 27 | private static final String baseUrl = CommonsUrl.LI_CAI_BASE_URL; 28 | 29 | private static final String charset = CommonsCharset.GB2312; 30 | 31 | @Resource 32 | private HtmlRequest htmlRequest; 33 | 34 | @Resource 35 | private HtmlToLiCaiHistoricalNetVo htmlToLiCaiHistoricalNetVo; 36 | @Resource 37 | private SaveData saveData; 38 | 39 | public void execute(List fundProductPoList) { 40 | log.info("LiCai 历史净值采集服务启动"); 41 | //log.info("fundProductPoList= " + fundProductPoList.size()); 42 | if (fundProductPoList != null) { 43 | for (int i = 0; i < fundProductPoList.size(); i++) { 44 | FundProductPo fundProductPo = fundProductPoList.get(i); 45 | String fincode = fundProductPo.getFincode(); 46 | int product_id = fundProductPo.getId(); 47 | String product_code = fundProductPo.getProduct_code(); 48 | try { 49 | 50 | getHtmlData(product_id, product_code, fincode); 51 | 52 | } catch (Exception ex) { 53 | ex.printStackTrace(); 54 | log.error("dealing LiCaiHistoricalNetJob data", ex); 55 | } 56 | } 57 | } 58 | 59 | log.info("LiCai 历史净值采集服务完成"); 60 | } 61 | 62 | private void getHtmlData(int product_id, String product_code, String fincode) throws Exception { 63 | String url = baseUrl + fincode; 64 | String data = htmlRequest.getHtmlData(url, charset); 65 | if (!data.equals("")) { 66 | 67 | List historicalNetVoList = htmlToLiCaiHistoricalNetVo.parseToHistoricalNetData(data, product_id, product_code); 68 | //log.info("historicalNetVoList = " + historicalNetVoList.size()); 69 | if (historicalNetVoList != null) saveData.saveHistoricalNetData(historicalNetVoList); 70 | } 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/service/StartService.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.service; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.support.ClassPathXmlApplicationContext; 7 | 8 | /** 9 | * Created by Jerry on 2015/9/18. 10 | */ 11 | public class StartService { 12 | private static final Logger log = LoggerFactory.getLogger(StartService.class); 13 | 14 | public static void main(String[] args) throws Exception { 15 | //os.name:Mac OS X 16 | //os.name:Windows Vista 17 | //String osName = System.getProperties().getProperty("os.name"); 18 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:applicationContext*.xml"); 19 | log.info("服务已经正常启动..."); 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/translate/eastmoney/HtmlToEastMoneyDetailVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.translate.eastmoney; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import org.htmlparser.NodeFilter; 5 | import org.htmlparser.Parser; 6 | import org.htmlparser.filters.HasAttributeFilter; 7 | import org.htmlparser.tags.Span; 8 | import org.htmlparser.util.NodeList; 9 | import org.springframework.stereotype.Component; 10 | 11 | 12 | /** 13 | * Created by Jerry on 15/12/2. 14 | */ 15 | @Component 16 | public class HtmlToEastMoneyDetailVo { 17 | 18 | public String HtmlToProductCode(String html) throws Exception { 19 | String product_code = ""; 20 | Parser parser = new Parser(); 21 | parser.setResource(html); 22 | parser.setEncoding(CommonsCharset.UTF_8); 23 | NodeFilter filter = new HasAttributeFilter("class", "fcode"); 24 | NodeList spans = parser.extractAllNodesThatMatch(filter); 25 | if (spans != null && spans.elementAt(0) != null) { 26 | Span span = (Span) spans.elementAt(0); 27 | product_code = span.toPlainTextString(); 28 | //System.out.println("product_code = [" + product_code + "]"); 29 | } 30 | return product_code; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/translate/eastmoney/JsonToEastMoneyHistoricalNetVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.translate.eastmoney; 2 | 3 | import com.jerry.financecrawler.commons.JsonParseUtil; 4 | import com.jerry.financecrawler.commons.StringUtil; 5 | import com.jerry.financecrawler.vo.*; 6 | import org.json.JSONArray; 7 | import org.json.JSONObject; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by Jerry on 2015/9/18. 15 | */ 16 | @Component 17 | public class JsonToEastMoneyHistoricalNetVo { 18 | 19 | public HistoricalNetTotalVo parseToHistoricalNetData(String json, int product_id,String product_code) throws Exception{ 20 | HistoricalNetTotalVo historicalNetTotalVo = new HistoricalNetTotalVo(); 21 | JSONObject jsonObject = new JSONObject(json); 22 | //"PageSize":0,"PageIndex":3,"Pages":32,"ErrCode":0 23 | int pageIndex = jsonObject.getInt("PageIndex"); 24 | int errCode = jsonObject.getInt("ErrCode"); 25 | int pageSize = jsonObject.getInt("PageSize"); 26 | int allPages = jsonObject.getInt("Pages"); 27 | if(errCode == 0){ 28 | historicalNetTotalVo.setPageIndex(pageIndex); 29 | historicalNetTotalVo.setPageSize(pageSize); 30 | historicalNetTotalVo.setAllPages(allPages); 31 | historicalNetTotalVo.setErrCode(errCode); 32 | JSONArray datasArr = jsonObject.getJSONArray("Datas"); 33 | List datas = new ArrayList(); 34 | for(int i=0;i parseToHistoricalNetData(String html, int product_id, String product_code) throws Exception{ 20 | //System.out.println("html = [" + html + "]"); 21 | List resultList = null; 22 | NodeList div = HtmlParserUtil.filterTargetNode(html, CommonsCharset.UTF_8, "class", "fund_data" ); 23 | if(div != null && div.elementAt(0) != null){ 24 | NodeList table = HtmlParserUtil.filterNode(div.elementAt(0), "table"); 25 | if(table != null && table.elementAt(0)!= null && table.size() > 0){ 26 | resultList = new ArrayList(); 27 | NodeList trs = HtmlParserUtil.filterNode(table.elementAt(0), "tr"); 28 | if(trs != null && trs.size() > 0){ 29 | for (int i = 0; i < trs.size(); i++) { 30 | NodeList tds = HtmlParserUtil.filterNode(trs.elementAt(i), "td"); 31 | if(tds != null && tds.size() > 0){ 32 | HistoricalNetVo midVo = new HistoricalNetVo(); 33 | midVo.setProduct_id(product_id); 34 | midVo.setProduct_code(product_code); 35 | for (int j = 0; j < tds.size() ; j++) { 36 | String fVal= HtmlParserUtil.getPlainTextString(tds.elementAt(j)); 37 | //System.out.println("fVal = [" + fVal + "]" +"j = [" + j + "]" ); 38 | //赋值 39 | switch (j){ 40 | case 0: if(!StringUtil.isEmpty(fVal))midVo.setNet_worth_date(fVal); break; 41 | case 1: midVo.setUnit_net_worth(StringUtil.StringToDouble(fVal)); break; 42 | case 2: midVo.setAdd_net_worth(StringUtil.StringToDouble(fVal));break; 43 | case 3: midVo.setChg(StringUtil.StringToDouble(fVal));break; 44 | } 45 | } 46 | if(midVo != null) resultList.add(midVo); 47 | }//tds 48 | } 49 | }// trs 50 | }//table 51 | }//div 52 | return resultList; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/translate/howbuy/HtmlToIncomeRankingVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.translate.howbuy; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.HtmlParserUtil; 5 | import com.jerry.financecrawler.commons.StringUtil; 6 | import com.jerry.financecrawler.vo.IncomeRankingVo; 7 | import org.htmlparser.Node; 8 | import org.htmlparser.util.NodeList; 9 | import org.springframework.stereotype.Component; 10 | 11 | /** 12 | * Created by Jerry on 15/11/30. 13 | */ 14 | @Component 15 | public class HtmlToIncomeRankingVo { 16 | public IncomeRankingVo parseToIncomeRankingData(String html, int product_id) throws Exception{ 17 | IncomeRankingVo vo = new IncomeRankingVo(); 18 | if (html == null || html.equals("")) return null; 19 | vo.setProduct_id(product_id); 20 | //获取表格信息 21 | NodeList div = HtmlParserUtil.filterTargetNode(html, CommonsCharset.UTF_8, "class", "history_tb_con table-style-a"); 22 | if (div != null) { 23 | NodeList table = HtmlParserUtil.filterNode(div.elementAt(0), "table"); 24 | if (table != null && table.elementAt(0) != null && table.size() > 0) { 25 | NodeList trs = HtmlParserUtil.filterNode(table.elementAt(0), "tr"); 26 | if (trs != null && trs.size() > 0) { 27 | for (int i = 0; i < trs.size(); i++) { 28 | if (i == 5) {//只取收益排名数据 29 | NodeList tds = HtmlParserUtil.filterNode(trs.elementAt(i), "td"); 30 | if (tds != null && tds.size() > 0) { 31 | for (int j = 0; j < tds.size(); j++) { 32 | Node td = tds.elementAt(j); 33 | String fVal = HtmlParserUtil.getPlainTextStringWithoutFilter(td); 34 | System.out.println("fVal = [" + fVal + "]" + ", j = [" + j + "]"); 35 | //赋值 36 | switch (j) { 37 | case 0: 38 | // 数据类型名称 39 | break; 40 | case 1: 41 | if (!StringUtil.isEmpty(fVal)) 42 | vo.setIR_SINCE_THIS_YEAR(fVal); //今年以来 43 | break; 44 | case 2: 45 | if (!StringUtil.isEmpty(fVal)) 46 | vo.setIR_NEARLY_A_MONTH(fVal);//近一月 47 | break; 48 | case 3: 49 | if (!StringUtil.isEmpty(fVal)) 50 | vo.setIR_NEARLY_THREE_MONTHS(fVal);//近三月 51 | break; 52 | case 4: 53 | if (!StringUtil.isEmpty(fVal)) 54 | vo.setIR_NEARLY_HALF_A_YEAR(fVal);//近六月 55 | break; 56 | case 5: 57 | if (!StringUtil.isEmpty(fVal)) 58 | vo.setIR_NEARLY_A_YEAR(fVal);//近一年 59 | break; 60 | case 6: 61 | if (!StringUtil.isEmpty(fVal)) 62 | vo.setIR_NEARLY_TWO_YEARS(fVal);//近二年 63 | break; 64 | case 7: 65 | if (!StringUtil.isEmpty(fVal)) 66 | vo.setIR_NEARLY_THREE_YEARS(fVal);//近三年 67 | break; 68 | case 8: 69 | if (!StringUtil.isEmpty(fVal)) 70 | vo.setIR_NEARLY_FIVE_YEARS(fVal);//近五年 71 | break; 72 | case 9: 73 | break; 74 | } 75 | }//for tds 76 | }//tds 77 | break; 78 | }//if i 79 | }//for trs 80 | }//if trs 81 | }//if table 82 | } 83 | return vo; 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/translate/hs/HtmlToHSVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.translate.hs; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.HtmlParserUtil; 5 | import com.jerry.financecrawler.commons.StringUtil; 6 | import com.jerry.financecrawler.vo.HSVo; 7 | import org.htmlparser.Node; 8 | import org.htmlparser.util.NodeList; 9 | import org.springframework.stereotype.Component; 10 | 11 | 12 | /** 13 | * Created by Jerry on 2015/9/18. 14 | */ 15 | @Component 16 | public class HtmlToHSVo { 17 | public HSVo parseToHSData(String html) throws Exception { 18 | if (html == null || html.equals("")) return null; 19 | HSVo hsVo = new HSVo(); 20 | //获取表格信息 21 | NodeList table = HtmlParserUtil.filterTargetNode(html, CommonsCharset.GB2312, "id", "FundHoldSharesTable"); 22 | if (table != null && table.elementAt(0) != null && table.size() > 0) { 23 | NodeList trs = HtmlParserUtil.filterNode(table.elementAt(0), "tr"); 24 | if (trs != null && trs.size() > 0) { 25 | for (int i = 0; i < trs.size(); i++) { 26 | if (i == 2) {//只是取最新的数据 27 | NodeList tds = HtmlParserUtil.filterNode(trs.elementAt(i), "td"); 28 | if (tds != null && tds.size() > 0) { 29 | for (int j = 0; j < tds.size(); j++) { 30 | Node td = tds.elementAt(j); 31 | String fVal = HtmlParserUtil.getPlainTextString(td); 32 | fVal = fVal.trim(); 33 | //System.out.println("fVal = [" + fVal + "]" + ", j = [" + j + "]"); 34 | //赋值 35 | switch (j) { 36 | case 0: 37 | if (!StringUtil.isEmpty(fVal)) hsVo.setDate(fVal);//日期 38 | break; 39 | case 1: 40 | if (!StringUtil.isEmpty(fVal)) hsVo.setKpj(StringUtil.StringToDouble(fVal)); //开盘价 41 | break; 42 | case 2: 43 | if (!StringUtil.isEmpty(fVal)) hsVo.setZgj(StringUtil.StringToDouble(fVal));//最高价 44 | break; 45 | case 3: 46 | if (!StringUtil.isEmpty(fVal)) hsVo.setSpj(StringUtil.StringToDouble(fVal));//收盘价 47 | break; 48 | case 4: 49 | if (!StringUtil.isEmpty(fVal)) 50 | hsVo.setZdj(StringUtil.StringToDouble(fVal)); 51 | break;//最低价 52 | case 5: 53 | if (!StringUtil.isEmpty(fVal)) 54 | hsVo.setJyl(StringUtil.StringToDouble(fVal)); 55 | break;//交易量(股) 56 | case 6: 57 | if (!StringUtil.isEmpty(fVal)) 58 | hsVo.setJyje(StringUtil.StringToDouble(fVal)); 59 | break;//交易金额(元) 60 | } 61 | }//for tds 62 | }//tds 63 | break; 64 | }//if i 65 | }//for trs 66 | 67 | }//if trs 68 | }//if table 69 | return hsVo; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/translate/licai/HtmlToLiCaiDetailVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.translate.licai; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.HtmlParserUtil; 5 | import com.jerry.financecrawler.commons.StringUtil; 6 | import com.jerry.financecrawler.vo.FundProductVo; 7 | import com.jerry.financecrawler.vo.IncomeVo; 8 | import org.htmlparser.util.NodeList; 9 | import org.springframework.stereotype.Component; 10 | 11 | 12 | 13 | /** 14 | * Created by Jerry on 15/12/2. 15 | */ 16 | @Component 17 | public class HtmlToLiCaiDetailVo { 18 | 19 | public void HtmlToLiCaiDetail(String html, FundProductVo fundProductVo) throws Exception { 20 | IncomeVo incomeVo = fundProductVo.getIncomeVo(); 21 | //获取单位净值 22 | setLatestNetWorth(html, incomeVo); 23 | 24 | //获取净值更新时间和创建时间 25 | setUpdateDateAndEstablishmentDate(html, incomeVo, fundProductVo); 26 | } 27 | 28 | private void setLatestNetWorth(String html, IncomeVo incomeVo) throws Exception{ 29 | NodeList uls = HtmlParserUtil.filterTargetNode(html, CommonsCharset.GB2312, "class", "fund_dt_big"); 30 | if (uls != null && uls.elementAt(0) != null) { 31 | NodeList lis = HtmlParserUtil.filterNode(uls.elementAt(0), "li"); 32 | if(lis.size() > 0 ){ 33 | NodeList spans = HtmlParserUtil.filterNode(lis.elementAt(0), "span"); 34 | String fVal = HtmlParserUtil.getPlainTextString(spans.elementAt(0)); 35 | // System.out.println("fVal = [" + fVal + "]"); 36 | incomeVo.setI_LATEST_NET_WORTH(StringUtil.StringToDouble(fVal));//最新净值 37 | }//if lis 38 | 39 | }//if uls 40 | } 41 | 42 | private void setUpdateDateAndEstablishmentDate(String html, IncomeVo incomeVo, FundProductVo fundProductVo) throws Exception{ 43 | NodeList uls = HtmlParserUtil.filterTargetNode(html, CommonsCharset.GB2312, "class", "fund_dtail"); 44 | if (uls != null && uls.elementAt(0) != null) { 45 | NodeList lis = HtmlParserUtil.filterNode(uls.elementAt(0), "li"); 46 | if(lis.size() > 0 ){ 47 | for (int i = 0; i 0) { 59 | String companyUrl = HtmlParserUtil.getLinkAttribute(as.elementAt(0), "href"); 60 | } 61 | break;//私募公司 62 | case 1: 63 | NodeList aList = HtmlParserUtil.filterNode(lis.elementAt(i), "a"); 64 | if(aList.size() > 0) { 65 | String managerUrl = HtmlParserUtil.getLinkAttribute(aList.elementAt(0), "href"); 66 | } 67 | break;//基金经理 68 | case 2: 69 | 70 | break;//年化收益 71 | case 3: 72 | 73 | break;//复权净值 74 | case 4: 75 | if(!StringUtil.isEmpty(fVal)){ 76 | fVal = fVal.replace("/", "-"); 77 | incomeVo.setI_UPDATE_DATE(fVal); 78 | } 79 | //System.out.println("incomeVo = [" + incomeVo.getI_UPDATE_DATE() + "]"); 80 | break;//净值日期 81 | case 5: 82 | if(!StringUtil.isEmpty(fVal)){ 83 | fVal = fVal.replace("/", "-"); 84 | fundProductVo.setProduct_ESTABLISHMENT_DATE(fVal); 85 | } 86 | break;//成立日期 87 | default:break; 88 | } 89 | }// for lis 90 | }//if lis 91 | 92 | }//if uls 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/translate/licai/HtmlToLiCaiHistoricalNetVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.translate.licai; 2 | 3 | import com.jerry.financecrawler.commons.CommonsCharset; 4 | import com.jerry.financecrawler.commons.HtmlParserUtil; 5 | import com.jerry.financecrawler.commons.StringUtil; 6 | import com.jerry.financecrawler.vo.HistoricalNetVo; 7 | import org.htmlparser.util.NodeList; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by Jerry on 2015/9/18. 15 | */ 16 | @Component 17 | public class HtmlToLiCaiHistoricalNetVo { 18 | 19 | public List parseToHistoricalNetData(String html, int product_id, String product_code) throws Exception { 20 | //System.out.println("html = [" + html + "]"); 21 | List resultList = null; 22 | NodeList div = HtmlParserUtil.filterTargetNode(html, CommonsCharset.GB2312, "class", "tab_zst r m"); 23 | if (div != null && div.size() > 0) { 24 | NodeList tables = HtmlParserUtil.filterNode(div.elementAt(0), "table"); 25 | if (tables != null && tables.size() > 1 && tables.elementAt(1) != null ) { 26 | resultList = new ArrayList(); 27 | NodeList trs = HtmlParserUtil.filterNode(tables.elementAt(1), "tr"); 28 | if (trs != null && trs.size() > 0) { 29 | for (int i = 0; i < trs.size(); i++) { 30 | NodeList tds = HtmlParserUtil.filterNode(trs.elementAt(i), "td"); 31 | if (tds != null && tds.size() > 0) { 32 | HistoricalNetVo midVo = new HistoricalNetVo(); 33 | midVo.setProduct_id(product_id); 34 | midVo.setProduct_code(product_code); 35 | for (int j = 0; j < tds.size(); j++) { 36 | String fVal = HtmlParserUtil.getPlainTextString(tds.elementAt(j)); 37 | //System.out.println("fVal = [" + fVal + "]" +"j = [" + j + "]" ); 38 | //赋值 39 | switch (j) { 40 | case 0: 41 | if (!StringUtil.isEmpty(fVal)) { 42 | fVal = fVal.replace(".", "-"); 43 | midVo.setNet_worth_date(fVal); 44 | } 45 | break;//净值时间 46 | case 1: 47 | midVo.setUnit_net_worth(StringUtil.StringToDouble(fVal)); 48 | break;//单位净值 49 | case 2: //midVo.setAdd_net_worth(StringUtil.StringToDouble(fVal));break;//复权净值 50 | case 3: 51 | midVo.setChg(StringUtil.StringToDouble(fVal)); 52 | break;//增长率 53 | } 54 | } 55 | if (midVo != null) resultList.add(midVo); 56 | }//tds 57 | } 58 | }// trs 59 | }//table 60 | }//div 61 | return resultList; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/visitor/HtmlRequest.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.visitor; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.io.ByteArrayOutputStream; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.net.HttpURLConnection; 9 | import java.net.URL; 10 | 11 | /** 12 | * Created by Jerry on 2015/9/18. 13 | */ 14 | @Component 15 | public class HtmlRequest { 16 | 17 | public byte[] readInputStream(InputStream inputStream) throws IOException { 18 | byte[] buffer = new byte[1024]; 19 | int len = 0; 20 | ByteArrayOutputStream bos = null; 21 | try { 22 | bos = new ByteArrayOutputStream(); 23 | while ((len = inputStream.read(buffer)) != -1) { 24 | bos.write(buffer, 0, len); 25 | } 26 | }catch (IOException ex){ 27 | bos.close(); 28 | throw ex; 29 | }finally { 30 | bos.close(); 31 | } 32 | return bos.toByteArray(); 33 | } 34 | 35 | public String getHtmlData(String rurl, String charset) throws IOException{ 36 | URL url = new URL(rurl); 37 | HttpURLConnection conn = (HttpURLConnection)url.openConnection(); 38 | InputStream inputStream = null; 39 | String data = ""; 40 | try{ 41 | inputStream = conn.getInputStream(); //通过输入流获得网站数据 42 | byte[] getData = readInputStream(inputStream); //获得网站的二进制数据 43 | data = new String(getData,charset); 44 | }catch (IOException ex){ 45 | if(inputStream != null)inputStream.close(); 46 | throw ex; 47 | }finally { 48 | if(inputStream != null)inputStream.close(); 49 | } 50 | return data; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/AnnualFluctuationRateVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * 年化波动率 5 | * Created by Jerry on 15/11/12. 6 | */ 7 | public class AnnualFluctuationRateVo { 8 | 9 | private int product_id ; 10 | private double FR_NEARLY_A_YEAR ;// 近一年 11 | private double FR_NEARLY_TWO_YEARS ;//近两年 12 | private double FR_NEARLY_THREE_YEARS ;// 近三年 13 | private double FR_NEARLY_FIVE_YEARS ;//近5年 14 | private double FR_SINCE_ITS_ESTABLISHMENT ;// 成立以来 15 | private int FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS ;//最多连续盈利天数 16 | private int FR_MAXIMUM_CONTINUOUS_LOSS_DAYS ;// 最多连续亏损天数 17 | private int product_is_crawler = 1; //是否为爬取 1 是 0 不是 18 | 19 | public int getProduct_id() { 20 | return product_id; 21 | } 22 | 23 | public void setProduct_id(int product_id) { 24 | this.product_id = product_id; 25 | } 26 | 27 | public double getFR_NEARLY_A_YEAR() { 28 | return FR_NEARLY_A_YEAR; 29 | } 30 | 31 | public void setFR_NEARLY_A_YEAR(double FR_NEARLY_A_YEAR) { 32 | this.FR_NEARLY_A_YEAR = FR_NEARLY_A_YEAR; 33 | } 34 | 35 | public double getFR_NEARLY_TWO_YEARS() { 36 | return FR_NEARLY_TWO_YEARS; 37 | } 38 | 39 | public void setFR_NEARLY_TWO_YEARS(double FR_NEARLY_TWO_YEARS) { 40 | this.FR_NEARLY_TWO_YEARS = FR_NEARLY_TWO_YEARS; 41 | } 42 | 43 | public double getFR_NEARLY_THREE_YEARS() { 44 | return FR_NEARLY_THREE_YEARS; 45 | } 46 | 47 | public void setFR_NEARLY_THREE_YEARS(double FR_NEARLY_THREE_YEARS) { 48 | this.FR_NEARLY_THREE_YEARS = FR_NEARLY_THREE_YEARS; 49 | } 50 | 51 | public double getFR_NEARLY_FIVE_YEARS() { 52 | return FR_NEARLY_FIVE_YEARS; 53 | } 54 | 55 | public void setFR_NEARLY_FIVE_YEARS(double FR_NEARLY_FIVE_YEARS) { 56 | this.FR_NEARLY_FIVE_YEARS = FR_NEARLY_FIVE_YEARS; 57 | } 58 | 59 | public double getFR_SINCE_ITS_ESTABLISHMENT() { 60 | return FR_SINCE_ITS_ESTABLISHMENT; 61 | } 62 | 63 | public void setFR_SINCE_ITS_ESTABLISHMENT(double FR_SINCE_ITS_ESTABLISHMENT) { 64 | this.FR_SINCE_ITS_ESTABLISHMENT = FR_SINCE_ITS_ESTABLISHMENT; 65 | } 66 | 67 | public int getFR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS() { 68 | return FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS; 69 | } 70 | 71 | public void setFR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS(int FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS) { 72 | this.FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS = FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS; 73 | } 74 | 75 | public int getFR_MAXIMUM_CONTINUOUS_LOSS_DAYS() { 76 | return FR_MAXIMUM_CONTINUOUS_LOSS_DAYS; 77 | } 78 | 79 | public void setFR_MAXIMUM_CONTINUOUS_LOSS_DAYS(int FR_MAXIMUM_CONTINUOUS_LOSS_DAYS) { 80 | this.FR_MAXIMUM_CONTINUOUS_LOSS_DAYS = FR_MAXIMUM_CONTINUOUS_LOSS_DAYS; 81 | } 82 | 83 | public int getProduct_is_crawler() { 84 | return product_is_crawler; 85 | } 86 | 87 | public void setProduct_is_crawler(int product_is_crawler) { 88 | this.product_is_crawler = product_is_crawler; 89 | } 90 | 91 | @Override 92 | public String toString() { 93 | return "AnnualFluctuationRateVo{" + 94 | "product_id=" + product_id + 95 | ", FR_NEARLY_A_YEAR=" + FR_NEARLY_A_YEAR + 96 | ", FR_NEARLY_TWO_YEARS=" + FR_NEARLY_TWO_YEARS + 97 | ", FR_NEARLY_THREE_YEARS=" + FR_NEARLY_THREE_YEARS + 98 | ", FR_NEARLY_FIVE_YEARS=" + FR_NEARLY_FIVE_YEARS + 99 | ", FR_SINCE_ITS_ESTABLISHMENT=" + FR_SINCE_ITS_ESTABLISHMENT + 100 | ", FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS=" + FR_MAXIMUM_CONTINUOUS_EARNINGS_DAYS + 101 | ", FR_MAXIMUM_CONTINUOUS_LOSS_DAYS=" + FR_MAXIMUM_CONTINUOUS_LOSS_DAYS + 102 | ", product_is_crawler=" + product_is_crawler + 103 | '}'; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/AnnualizedReturnRateVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * 年化收益率 5 | * Created by Jerry on 15/11/12. 6 | */ 7 | public class AnnualizedReturnRateVo { 8 | private int product_id; 9 | private double RR_NEARLY_A_YEAR ; //近一年 10 | private double RR_NEARLY_TWO_YEARS ;//近两年 11 | private double RR_NEARLY_THREE_YEARS ;// 近三年 12 | private double RR_NEARLY_FIVE_YEARS; //近5年 13 | private double RR_SINCE_ITS_ESTABLISHMENT ;//成立以来 14 | private int product_is_crawler = 1; //是否为爬取 1 是 0 不是 15 | 16 | public int getProduct_id() { 17 | return product_id; 18 | } 19 | 20 | public void setProduct_id(int product_id) { 21 | this.product_id = product_id; 22 | } 23 | 24 | public double getRR_NEARLY_A_YEAR() { 25 | return RR_NEARLY_A_YEAR; 26 | } 27 | 28 | public void setRR_NEARLY_A_YEAR(double RR_NEARLY_A_YEAR) { 29 | this.RR_NEARLY_A_YEAR = RR_NEARLY_A_YEAR; 30 | } 31 | 32 | public double getRR_NEARLY_TWO_YEARS() { 33 | return RR_NEARLY_TWO_YEARS; 34 | } 35 | 36 | public void setRR_NEARLY_TWO_YEARS(double RR_NEARLY_TWO_YEARS) { 37 | this.RR_NEARLY_TWO_YEARS = RR_NEARLY_TWO_YEARS; 38 | } 39 | 40 | public double getRR_NEARLY_THREE_YEARS() { 41 | return RR_NEARLY_THREE_YEARS; 42 | } 43 | 44 | public void setRR_NEARLY_THREE_YEARS(double RR_NEARLY_THREE_YEARS) { 45 | this.RR_NEARLY_THREE_YEARS = RR_NEARLY_THREE_YEARS; 46 | } 47 | 48 | public double getRR_NEARLY_FIVE_YEARS() { 49 | return RR_NEARLY_FIVE_YEARS; 50 | } 51 | 52 | public void setRR_NEARLY_FIVE_YEARS(double RR_NEARLY_FIVE_YEARS) { 53 | this.RR_NEARLY_FIVE_YEARS = RR_NEARLY_FIVE_YEARS; 54 | } 55 | 56 | public double getRR_SINCE_ITS_ESTABLISHMENT() { 57 | return RR_SINCE_ITS_ESTABLISHMENT; 58 | } 59 | 60 | public void setRR_SINCE_ITS_ESTABLISHMENT(double RR_SINCE_ITS_ESTABLISHMENT) { 61 | this.RR_SINCE_ITS_ESTABLISHMENT = RR_SINCE_ITS_ESTABLISHMENT; 62 | } 63 | 64 | public int getProduct_is_crawler() { 65 | return product_is_crawler; 66 | } 67 | 68 | public void setProduct_is_crawler(int product_is_crawler) { 69 | this.product_is_crawler = product_is_crawler; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return "AnnualizedReturnRateVo{" + 75 | "product_id=" + product_id + 76 | ", RR_NEARLY_A_YEAR=" + RR_NEARLY_A_YEAR + 77 | ", RR_NEARLY_TWO_YEARS=" + RR_NEARLY_TWO_YEARS + 78 | ", RR_NEARLY_THREE_YEARS=" + RR_NEARLY_THREE_YEARS + 79 | ", RR_NEARLY_FIVE_YEARS=" + RR_NEARLY_FIVE_YEARS + 80 | ", RR_SINCE_ITS_ESTABLISHMENT=" + RR_SINCE_ITS_ESTABLISHMENT + 81 | ", product_is_crawler=" + product_is_crawler + 82 | '}'; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/CalmarRatioVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * CALMAR比率 5 | * Created by Jerry on 15/11/12. 6 | */ 7 | public class CalmarRatioVo { 8 | private int product_id; 9 | private double CR_NEARLY_A_YEAR;// 近一年 10 | private double CR_NEARLY_TWO_YEARS;// 近两年 11 | private double CR_NEARLY_THREE_YEARS ;// 近三年 12 | private double CR_NEARLY_FIVE_YEARS ;// 近5年 13 | private double CR_SINCE_ITS_ESTABLISHMENT;// 成立以来 14 | private int product_is_crawler = 1;// 是否为爬取 1 是 0 不是 15 | 16 | public int getProduct_id() { 17 | return product_id; 18 | } 19 | 20 | public void setProduct_id(int product_id) { 21 | this.product_id = product_id; 22 | } 23 | 24 | public double getCR_NEARLY_A_YEAR() { 25 | return CR_NEARLY_A_YEAR; 26 | } 27 | 28 | public void setCR_NEARLY_A_YEAR(double CR_NEARLY_A_YEAR) { 29 | this.CR_NEARLY_A_YEAR = CR_NEARLY_A_YEAR; 30 | } 31 | 32 | public double getCR_NEARLY_TWO_YEARS() { 33 | return CR_NEARLY_TWO_YEARS; 34 | } 35 | 36 | public void setCR_NEARLY_TWO_YEARS(double CR_NEARLY_TWO_YEARS) { 37 | this.CR_NEARLY_TWO_YEARS = CR_NEARLY_TWO_YEARS; 38 | } 39 | 40 | public double getCR_NEARLY_THREE_YEARS() { 41 | return CR_NEARLY_THREE_YEARS; 42 | } 43 | 44 | public void setCR_NEARLY_THREE_YEARS(double CR_NEARLY_THREE_YEARS) { 45 | this.CR_NEARLY_THREE_YEARS = CR_NEARLY_THREE_YEARS; 46 | } 47 | 48 | public double getCR_NEARLY_FIVE_YEARS() { 49 | return CR_NEARLY_FIVE_YEARS; 50 | } 51 | 52 | public void setCR_NEARLY_FIVE_YEARS(double CR_NEARLY_FIVE_YEARS) { 53 | this.CR_NEARLY_FIVE_YEARS = CR_NEARLY_FIVE_YEARS; 54 | } 55 | 56 | public double getCR_SINCE_ITS_ESTABLISHMENT() { 57 | return CR_SINCE_ITS_ESTABLISHMENT; 58 | } 59 | 60 | public void setCR_SINCE_ITS_ESTABLISHMENT(double CR_SINCE_ITS_ESTABLISHMENT) { 61 | this.CR_SINCE_ITS_ESTABLISHMENT = CR_SINCE_ITS_ESTABLISHMENT; 62 | } 63 | 64 | public int getProduct_is_crawler() { 65 | return product_is_crawler; 66 | } 67 | 68 | public void setProduct_is_crawler(int product_is_crawler) { 69 | this.product_is_crawler = product_is_crawler; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return "CalmarRatioVo{" + 75 | "product_id=" + product_id + 76 | ", CR_NEARLY_A_YEAR=" + CR_NEARLY_A_YEAR + 77 | ", CR_NEARLY_TWO_YEARS=" + CR_NEARLY_TWO_YEARS + 78 | ", CR_NEARLY_THREE_YEARS=" + CR_NEARLY_THREE_YEARS + 79 | ", CR_NEARLY_FIVE_YEARS=" + CR_NEARLY_FIVE_YEARS + 80 | ", CR_SINCE_ITS_ESTABLISHMENT=" + CR_SINCE_ITS_ESTABLISHMENT + 81 | ", product_is_crawler=" + product_is_crawler + 82 | '}'; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/CostRateVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * 费用费率 5 | * Created by Jerry on 15/11/12. 6 | */ 7 | public class CostRateVo { 8 | private int product_id ; 9 | private double CR_SUBSCRIPTION_RATE; //认购费率 10 | private double CR_REDEMPTION_RATE; //赎回费 11 | private double CR_MANAGEMENT_RATE; //管理费 12 | private double CR_HOSTING_RATE ; //托管费 13 | private double CR_PERFORMANCE_PAY_RATE ; //业绩报酬 14 | private int product_is_crawler = 1 ; //是否为爬取 1 是 0 不是 15 | 16 | public int getProduct_id() { 17 | return product_id; 18 | } 19 | 20 | public void setProduct_id(int product_id) { 21 | this.product_id = product_id; 22 | } 23 | 24 | public double getCR_SUBSCRIPTION_RATE() { 25 | return CR_SUBSCRIPTION_RATE; 26 | } 27 | 28 | public void setCR_SUBSCRIPTION_RATE(double CR_SUBSCRIPTION_RATE) { 29 | this.CR_SUBSCRIPTION_RATE = CR_SUBSCRIPTION_RATE; 30 | } 31 | 32 | public double getCR_REDEMPTION_RATE() { 33 | return CR_REDEMPTION_RATE; 34 | } 35 | 36 | public void setCR_REDEMPTION_RATE(double CR_REDEMPTION_RATE) { 37 | this.CR_REDEMPTION_RATE = CR_REDEMPTION_RATE; 38 | } 39 | 40 | public double getCR_MANAGEMENT_RATE() { 41 | return CR_MANAGEMENT_RATE; 42 | } 43 | 44 | public void setCR_MANAGEMENT_RATE(double CR_MANAGEMENT_RATE) { 45 | this.CR_MANAGEMENT_RATE = CR_MANAGEMENT_RATE; 46 | } 47 | 48 | public double getCR_HOSTING_RATE() { 49 | return CR_HOSTING_RATE; 50 | } 51 | 52 | public void setCR_HOSTING_RATE(double CR_HOSTING_RATE) { 53 | this.CR_HOSTING_RATE = CR_HOSTING_RATE; 54 | } 55 | 56 | public double getCR_PERFORMANCE_PAY_RATE() { 57 | return CR_PERFORMANCE_PAY_RATE; 58 | } 59 | 60 | public void setCR_PERFORMANCE_PAY_RATE(double CR_PERFORMANCE_PAY_RATE) { 61 | this.CR_PERFORMANCE_PAY_RATE = CR_PERFORMANCE_PAY_RATE; 62 | } 63 | 64 | public int getProduct_is_crawler() { 65 | return product_is_crawler; 66 | } 67 | 68 | public void setProduct_is_crawler(int product_is_crawler) { 69 | this.product_is_crawler = product_is_crawler; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return "CostRateVo{" + 75 | "product_id=" + product_id + 76 | ", CR_SUBSCRIPTION_RATE=" + CR_SUBSCRIPTION_RATE + 77 | ", CR_REDEMPTION_RATE=" + CR_REDEMPTION_RATE + 78 | ", CR_MANAGEMENT_RATE=" + CR_MANAGEMENT_RATE + 79 | ", CR_HOSTING_RATE=" + CR_HOSTING_RATE + 80 | ", CR_PERFORMANCE_PAY_RATE=" + CR_PERFORMANCE_PAY_RATE + 81 | ", product_is_crawler=" + product_is_crawler + 82 | '}'; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/EastFinanceTotalVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by Jerry on 2015/9/18. 7 | */ 8 | public class EastFinanceTotalVo { 9 | private List Datas; 10 | 11 | private int PageIndex; 12 | 13 | private int TotalCount; 14 | 15 | private int ErrCode; 16 | 17 | private int PageSize; 18 | 19 | private int AllPages; 20 | 21 | public int getAllPages() { 22 | return AllPages; 23 | } 24 | 25 | public int getPageIndex() { 26 | return PageIndex; 27 | } 28 | 29 | public int getTotalCount() { 30 | return TotalCount; 31 | } 32 | 33 | public int getErrCode() { 34 | return ErrCode; 35 | } 36 | 37 | public int getPageSize() { 38 | return PageSize; 39 | } 40 | 41 | public List getDatas() { 42 | return Datas; 43 | } 44 | 45 | public void setDatas(List datas) { 46 | Datas = datas; 47 | } 48 | 49 | public void setPageIndex(int pageIndex) { 50 | PageIndex = pageIndex; 51 | } 52 | 53 | public void setTotalCount(int totalCount) { 54 | TotalCount = totalCount; 55 | } 56 | 57 | public void setErrCode(int errCode) { 58 | ErrCode = errCode; 59 | } 60 | 61 | public void setPageSize(int pageSize) { 62 | PageSize = pageSize; 63 | } 64 | 65 | public void setAllPages(int allPages) { 66 | AllPages = allPages; 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | return "EastFinanceTotalModel{" + 72 | "Datas=" + Datas + 73 | ", PageIndex=" + PageIndex + 74 | ", TotalCount=" + TotalCount + 75 | ", ErrCode=" + ErrCode + 76 | ", PageSize=" + PageSize + 77 | ", AllPages=" + AllPages + 78 | '}'; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/FundManagePeopleVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * 基金管理人 5 | * Created by Jerry on 15/11/12. 6 | */ 7 | public class FundManagePeopleVo { 8 | private int id ; 9 | private String fund_name ;// 基金管理人 10 | private String fund_date ;// 成立时间 11 | private String fund_assets;// 管理人管理资产 12 | private int fund_product_no;// 管理人管理产品数量 13 | private String fund_count;//投研人数 14 | private int product_is_crawler = 1;// 是否为爬取 1 是 0 不是 15 | private String detail_url; //地址 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public String getFund_name() { 25 | return fund_name; 26 | } 27 | 28 | public void setFund_name(String fund_name) { 29 | this.fund_name = fund_name; 30 | } 31 | 32 | public String getFund_date() { 33 | return fund_date; 34 | } 35 | 36 | public void setFund_date(String fund_date) { 37 | this.fund_date = fund_date; 38 | } 39 | 40 | public String getFund_assets() { 41 | return fund_assets; 42 | } 43 | 44 | public void setFund_assets(String fund_assets) { 45 | this.fund_assets = fund_assets; 46 | } 47 | 48 | public int getFund_product_no() { 49 | return fund_product_no; 50 | } 51 | 52 | public void setFund_product_no(int fund_product_no) { 53 | this.fund_product_no = fund_product_no; 54 | } 55 | 56 | public String getFund_count() { 57 | return fund_count; 58 | } 59 | 60 | public void setFund_count(String fund_count) { 61 | this.fund_count = fund_count; 62 | } 63 | 64 | public int getProduct_is_crawler() { 65 | return product_is_crawler; 66 | } 67 | 68 | public void setProduct_is_crawler(int product_is_crawler) { 69 | this.product_is_crawler = product_is_crawler; 70 | } 71 | 72 | public String getDetail_url() { 73 | return detail_url; 74 | } 75 | 76 | public void setDetail_url(String detail_url) { 77 | this.detail_url = detail_url; 78 | } 79 | 80 | @Override 81 | public String toString() { 82 | return "FundManagePeopleVo{" + 83 | "id=" + id + 84 | ", fund_name='" + fund_name + '\'' + 85 | ", fund_date='" + fund_date + '\'' + 86 | ", fund_assets='" + fund_assets + '\'' + 87 | ", fund_product_no=" + fund_product_no + 88 | ", fund_count='" + fund_count + '\'' + 89 | ", product_is_crawler=" + product_is_crawler + 90 | ", detail_url='" + detail_url + '\'' + 91 | '}'; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/FundProductTotalVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by Jerry on 2015/10/9. 7 | */ 8 | public class FundProductTotalVo { 9 | private List Datas; 10 | 11 | private int PageIndex; 12 | 13 | private int TotalCount; 14 | 15 | private int ErrCode; 16 | 17 | private int PageSize; 18 | 19 | private int AllPages; 20 | 21 | public List getDatas() { 22 | return Datas; 23 | } 24 | 25 | public void setDatas(List datas) { 26 | Datas = datas; 27 | } 28 | 29 | public int getPageIndex() { 30 | return PageIndex; 31 | } 32 | 33 | public void setPageIndex(int pageIndex) { 34 | PageIndex = pageIndex; 35 | } 36 | 37 | public int getTotalCount() { 38 | return TotalCount; 39 | } 40 | 41 | public void setTotalCount(int totalCount) { 42 | TotalCount = totalCount; 43 | } 44 | 45 | public int getErrCode() { 46 | return ErrCode; 47 | } 48 | 49 | public void setErrCode(int errCode) { 50 | ErrCode = errCode; 51 | } 52 | 53 | public int getPageSize() { 54 | return PageSize; 55 | } 56 | 57 | public void setPageSize(int pageSize) { 58 | PageSize = pageSize; 59 | } 60 | 61 | public int getAllPages() { 62 | return AllPages; 63 | } 64 | 65 | public void setAllPages(int allPages) { 66 | AllPages = allPages; 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | return "FundProductTotalVo{" + 72 | "Datas=" + Datas + 73 | ", PageIndex=" + PageIndex + 74 | ", TotalCount=" + TotalCount + 75 | ", ErrCode=" + ErrCode + 76 | ", PageSize=" + PageSize + 77 | ", AllPages=" + AllPages + 78 | '}'; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/HSVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * Created by Jerry on 15/12/21. 5 | * 沪深300 6 | */ 7 | public class HSVo { 8 | private int id; 9 | private String date;//日期 10 | private double kpj;//开盘价 11 | private double zgj;//最高价 12 | private double spj;//收盘价 13 | private double zdj;//最低价 14 | private double jyl;//交易量(股) 15 | private double jyje;//交易金额(元) 16 | private double zdf;//涨跌幅 17 | 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | public String getDate() { 27 | return date; 28 | } 29 | 30 | public void setDate(String date) { 31 | this.date = date; 32 | } 33 | 34 | public double getKpj() { 35 | return kpj; 36 | } 37 | 38 | public void setKpj(double kpj) { 39 | this.kpj = kpj; 40 | } 41 | 42 | public double getZgj() { 43 | return zgj; 44 | } 45 | 46 | public void setZgj(double zgj) { 47 | this.zgj = zgj; 48 | } 49 | 50 | public double getSpj() { 51 | return spj; 52 | } 53 | 54 | public void setSpj(double spj) { 55 | this.spj = spj; 56 | } 57 | 58 | public double getZdj() { 59 | return zdj; 60 | } 61 | 62 | public void setZdj(double zdj) { 63 | this.zdj = zdj; 64 | } 65 | 66 | public double getJyl() { 67 | return jyl; 68 | } 69 | 70 | public void setJyl(double jyl) { 71 | this.jyl = jyl; 72 | } 73 | 74 | public double getJyje() { 75 | return jyje; 76 | } 77 | 78 | public void setJyje(double jyje) { 79 | this.jyje = jyje; 80 | } 81 | 82 | public double getZdf() { 83 | return zdf; 84 | } 85 | 86 | public void setZdf(double zdf) { 87 | this.zdf = zdf; 88 | } 89 | 90 | @Override 91 | public String toString() { 92 | return "HSVo{" + 93 | "id=" + id + 94 | ", date='" + date + '\'' + 95 | ", kpj=" + kpj + 96 | ", zgj=" + zgj + 97 | ", spj=" + spj + 98 | ", zdj=" + zdj + 99 | ", jyl=" + jyl + 100 | ", jyje=" + jyje + 101 | ", zdf=" + zdf + 102 | '}'; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/HistoricalNetTotalVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by Jerry on 15/12/2. 7 | */ 8 | public class HistoricalNetTotalVo { 9 | private List Datas; 10 | 11 | private int PageIndex; 12 | 13 | private int ErrCode; 14 | 15 | private int PageSize; 16 | 17 | private int AllPages; 18 | 19 | public List getDatas() { 20 | return Datas; 21 | } 22 | 23 | public void setDatas(List datas) { 24 | Datas = datas; 25 | } 26 | 27 | public int getPageIndex() { 28 | return PageIndex; 29 | } 30 | 31 | public void setPageIndex(int pageIndex) { 32 | PageIndex = pageIndex; 33 | } 34 | 35 | public int getErrCode() { 36 | return ErrCode; 37 | } 38 | 39 | public void setErrCode(int errCode) { 40 | ErrCode = errCode; 41 | } 42 | 43 | public int getPageSize() { 44 | return PageSize; 45 | } 46 | 47 | public void setPageSize(int pageSize) { 48 | PageSize = pageSize; 49 | } 50 | 51 | public int getAllPages() { 52 | return AllPages; 53 | } 54 | 55 | public void setAllPages(int allPages) { 56 | AllPages = allPages; 57 | } 58 | 59 | @Override 60 | public String toString() { 61 | return "HistoricalNetTotalVo{" + 62 | "Datas=" + Datas + 63 | ", PageIndex=" + PageIndex + 64 | ", ErrCode=" + ErrCode + 65 | ", PageSize=" + PageSize + 66 | ", AllPages=" + AllPages + 67 | '}'; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/HistoricalNetVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * Created by Jerry on 2015/10/9. 5 | * 历史净值 6 | */ 7 | public class HistoricalNetVo { 8 | private int id; 9 | private int product_id; //产品id-唯一值 10 | private String product_code; //产品代码 11 | private String net_worth_date; //date 净值日期 12 | private double unit_net_worth; //单位净值 13 | private double add_net_worth; //累计净值 14 | private double Chg; //涨跌幅 15 | private int product_is_crawler = 1; //是否为爬取 1 是 0 不是 16 | 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | public void setId(int id) { 22 | this.id = id; 23 | } 24 | 25 | public int getProduct_id() { 26 | return product_id; 27 | } 28 | 29 | public void setProduct_id(int product_id) { 30 | this.product_id = product_id; 31 | } 32 | 33 | public String getProduct_code() { 34 | return product_code; 35 | } 36 | 37 | public void setProduct_code(String product_code) { 38 | this.product_code = product_code; 39 | } 40 | 41 | public String getNet_worth_date() { 42 | return net_worth_date; 43 | } 44 | 45 | public void setNet_worth_date(String net_worth_date) { 46 | this.net_worth_date = net_worth_date; 47 | } 48 | 49 | public double getUnit_net_worth() { 50 | return unit_net_worth; 51 | } 52 | 53 | public void setUnit_net_worth(double unit_net_worth) { 54 | this.unit_net_worth = unit_net_worth; 55 | } 56 | 57 | public double getAdd_net_worth() { 58 | return add_net_worth; 59 | } 60 | 61 | public void setAdd_net_worth(double add_net_worth) { 62 | this.add_net_worth = add_net_worth; 63 | } 64 | 65 | public double getChg() { 66 | return Chg; 67 | } 68 | 69 | public void setChg(double chg) { 70 | Chg = chg; 71 | } 72 | 73 | public int getProduct_is_crawler() { 74 | return product_is_crawler; 75 | } 76 | 77 | public void setProduct_is_crawler(int product_is_crawler) { 78 | this.product_is_crawler = product_is_crawler; 79 | } 80 | 81 | @Override 82 | public String toString() { 83 | return "HistoricalNetVo{" + 84 | "id=" + id + 85 | ", product_id=" + product_id + 86 | ", product_code='" + product_code + '\'' + 87 | ", net_worth_date='" + net_worth_date + '\'' + 88 | ", unit_net_worth=" + unit_net_worth + 89 | ", add_net_worth=" + add_net_worth + 90 | ", Chg=" + Chg + 91 | ", product_is_crawler=" + product_is_crawler + 92 | '}'; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/IncomeRankingVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * 收益排名 5 | * Created by Jerry on 15/11/12. 6 | */ 7 | public class IncomeRankingVo { 8 | private int product_id ; 9 | private String IR_SINCE_THIS_YEAR;// 今年以来 10 | private String IR_NEARLY_A_MONTH;//近一月 11 | private String IR_NEARLY_THREE_MONTHS;//近三月 12 | private String IR_NEARLY_HALF_A_YEAR ;//近半年 13 | private String IR_NEARLY_A_YEAR;//近一年 14 | private String IR_NEARLY_TWO_YEARS;//近两年 15 | private String IR_NEARLY_THREE_YEARS;//近三年 16 | private String IR_NEARLY_FIVE_YEARS;//近5年 17 | private int product_is_crawler = 1;// 是否为爬取 1 是 0 不是 18 | 19 | public int getProduct_id() { 20 | return product_id; 21 | } 22 | 23 | public void setProduct_id(int product_id) { 24 | this.product_id = product_id; 25 | } 26 | 27 | public String getIR_SINCE_THIS_YEAR() { 28 | return IR_SINCE_THIS_YEAR; 29 | } 30 | 31 | public void setIR_SINCE_THIS_YEAR(String IR_SINCE_THIS_YEAR) { 32 | this.IR_SINCE_THIS_YEAR = IR_SINCE_THIS_YEAR; 33 | } 34 | 35 | public String getIR_NEARLY_A_MONTH() { 36 | return IR_NEARLY_A_MONTH; 37 | } 38 | 39 | public void setIR_NEARLY_A_MONTH(String IR_NEARLY_A_MONTH) { 40 | this.IR_NEARLY_A_MONTH = IR_NEARLY_A_MONTH; 41 | } 42 | 43 | public String getIR_NEARLY_THREE_MONTHS() { 44 | return IR_NEARLY_THREE_MONTHS; 45 | } 46 | 47 | public void setIR_NEARLY_THREE_MONTHS(String IR_NEARLY_THREE_MONTHS) { 48 | this.IR_NEARLY_THREE_MONTHS = IR_NEARLY_THREE_MONTHS; 49 | } 50 | 51 | public String getIR_NEARLY_HALF_A_YEAR() { 52 | return IR_NEARLY_HALF_A_YEAR; 53 | } 54 | 55 | public void setIR_NEARLY_HALF_A_YEAR(String IR_NEARLY_HALF_A_YEAR) { 56 | this.IR_NEARLY_HALF_A_YEAR = IR_NEARLY_HALF_A_YEAR; 57 | } 58 | 59 | public String getIR_NEARLY_A_YEAR() { 60 | return IR_NEARLY_A_YEAR; 61 | } 62 | 63 | public void setIR_NEARLY_A_YEAR(String IR_NEARLY_A_YEAR) { 64 | this.IR_NEARLY_A_YEAR = IR_NEARLY_A_YEAR; 65 | } 66 | 67 | public String getIR_NEARLY_TWO_YEARS() { 68 | return IR_NEARLY_TWO_YEARS; 69 | } 70 | 71 | public void setIR_NEARLY_TWO_YEARS(String IR_NEARLY_TWO_YEARS) { 72 | this.IR_NEARLY_TWO_YEARS = IR_NEARLY_TWO_YEARS; 73 | } 74 | 75 | public String getIR_NEARLY_THREE_YEARS() { 76 | return IR_NEARLY_THREE_YEARS; 77 | } 78 | 79 | public void setIR_NEARLY_THREE_YEARS(String IR_NEARLY_THREE_YEARS) { 80 | this.IR_NEARLY_THREE_YEARS = IR_NEARLY_THREE_YEARS; 81 | } 82 | 83 | public String getIR_NEARLY_FIVE_YEARS() { 84 | return IR_NEARLY_FIVE_YEARS; 85 | } 86 | 87 | public void setIR_NEARLY_FIVE_YEARS(String IR_NEARLY_FIVE_YEARS) { 88 | this.IR_NEARLY_FIVE_YEARS = IR_NEARLY_FIVE_YEARS; 89 | } 90 | 91 | public int getProduct_is_crawler() { 92 | return product_is_crawler; 93 | } 94 | 95 | public void setProduct_is_crawler(int product_is_crawler) { 96 | this.product_is_crawler = product_is_crawler; 97 | } 98 | 99 | @Override 100 | public String toString() { 101 | return "IncomeRankingVo{" + 102 | "product_id=" + product_id + 103 | ", IR_SINCE_THIS_YEAR='" + IR_SINCE_THIS_YEAR + '\'' + 104 | ", IR_NEARLY_A_MONTH='" + IR_NEARLY_A_MONTH + '\'' + 105 | ", IR_NEARLY_THREE_MONTHS='" + IR_NEARLY_THREE_MONTHS + '\'' + 106 | ", IR_NEARLY_HALF_A_YEAR='" + IR_NEARLY_HALF_A_YEAR + '\'' + 107 | ", IR_NEARLY_A_YEAR='" + IR_NEARLY_A_YEAR + '\'' + 108 | ", IR_NEARLY_TWO_YEARS='" + IR_NEARLY_TWO_YEARS + '\'' + 109 | ", IR_NEARLY_THREE_YEARS='" + IR_NEARLY_THREE_YEARS + '\'' + 110 | ", IR_NEARLY_FIVE_YEARS='" + IR_NEARLY_FIVE_YEARS + '\'' + 111 | ", product_is_crawler=" + product_is_crawler + 112 | '}'; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/MaximumReturnVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * Created by Jerry on 15/11/12. 5 | */ 6 | public class MaximumReturnVo { 7 | private int product_id; 8 | private double MR_NEARLY_A_YEAR;//近一年 9 | private double MR_NEARLY_TWO_YEARS ;//近两年 10 | private double MR_NEARLY_THREE_YEARS ;//近三年 11 | private double MR_NEARLY_FIVE_YEARS ;//近5年 12 | private double MR_SINCE_ITS_ESTABLISHMENT;//成立以来 13 | private int product_is_crawler = 1;//是否为爬取 1 是 0 不是 14 | 15 | public int getProduct_id() { 16 | return product_id; 17 | } 18 | 19 | public void setProduct_id(int product_id) { 20 | this.product_id = product_id; 21 | } 22 | 23 | public double getMR_NEARLY_A_YEAR() { 24 | return MR_NEARLY_A_YEAR; 25 | } 26 | 27 | public void setMR_NEARLY_A_YEAR(double MR_NEARLY_A_YEAR) { 28 | this.MR_NEARLY_A_YEAR = MR_NEARLY_A_YEAR; 29 | } 30 | 31 | public double getMR_NEARLY_TWO_YEARS() { 32 | return MR_NEARLY_TWO_YEARS; 33 | } 34 | 35 | public void setMR_NEARLY_TWO_YEARS(double MR_NEARLY_TWO_YEARS) { 36 | this.MR_NEARLY_TWO_YEARS = MR_NEARLY_TWO_YEARS; 37 | } 38 | 39 | public double getMR_NEARLY_THREE_YEARS() { 40 | return MR_NEARLY_THREE_YEARS; 41 | } 42 | 43 | public void setMR_NEARLY_THREE_YEARS(double MR_NEARLY_THREE_YEARS) { 44 | this.MR_NEARLY_THREE_YEARS = MR_NEARLY_THREE_YEARS; 45 | } 46 | 47 | public double getMR_NEARLY_FIVE_YEARS() { 48 | return MR_NEARLY_FIVE_YEARS; 49 | } 50 | 51 | public void setMR_NEARLY_FIVE_YEARS(double MR_NEARLY_FIVE_YEARS) { 52 | this.MR_NEARLY_FIVE_YEARS = MR_NEARLY_FIVE_YEARS; 53 | } 54 | 55 | public double getMR_SINCE_ITS_ESTABLISHMENT() { 56 | return MR_SINCE_ITS_ESTABLISHMENT; 57 | } 58 | 59 | public void setMR_SINCE_ITS_ESTABLISHMENT(double MR_SINCE_ITS_ESTABLISHMENT) { 60 | this.MR_SINCE_ITS_ESTABLISHMENT = MR_SINCE_ITS_ESTABLISHMENT; 61 | } 62 | 63 | public int getProduct_is_crawler() { 64 | return product_is_crawler; 65 | } 66 | 67 | public void setProduct_is_crawler(int product_is_crawler) { 68 | this.product_is_crawler = product_is_crawler; 69 | } 70 | 71 | @Override 72 | public String toString() { 73 | return "MaximumReturnVo{" + 74 | "product_id=" + product_id + 75 | ", MR_NEARLY_A_YEAR=" + MR_NEARLY_A_YEAR + 76 | ", MR_NEARLY_TWO_YEARS=" + MR_NEARLY_TWO_YEARS + 77 | ", MR_NEARLY_THREE_YEARS=" + MR_NEARLY_THREE_YEARS + 78 | ", MR_NEARLY_FIVE_YEARS=" + MR_NEARLY_FIVE_YEARS + 79 | ", MR_SINCE_ITS_ESTABLISHMENT=" + MR_SINCE_ITS_ESTABLISHMENT + 80 | ", product_is_crawler=" + product_is_crawler + 81 | '}'; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/ProductReFundManagePeopleVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * 管理人产品关联关系表 5 | * Created by Jerry on 15/11/12. 6 | */ 7 | public class ProductReFundManagePeopleVo { 8 | 9 | private int id ; 10 | private int product_id;//产品ID 11 | private int bs_fund; //管理人 12 | private int product_is_crawler = 1;//是否为爬取 1 是 0 不是 13 | 14 | public int getId() { 15 | return id; 16 | } 17 | 18 | public void setId(int id) { 19 | this.id = id; 20 | } 21 | 22 | public int getProduct_id() { 23 | return product_id; 24 | } 25 | 26 | public void setProduct_id(int product_id) { 27 | this.product_id = product_id; 28 | } 29 | 30 | public int getBs_fund() { 31 | return bs_fund; 32 | } 33 | 34 | public void setBs_fund(int bs_fund) { 35 | this.bs_fund = bs_fund; 36 | } 37 | 38 | public int getProduct_is_crawler() { 39 | return product_is_crawler; 40 | } 41 | 42 | public void setProduct_is_crawler(int product_is_crawler) { 43 | this.product_is_crawler = product_is_crawler; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "ProductReFundManagePeopleVo{" + 49 | "id=" + id + 50 | ", product_id=" + product_id + 51 | ", bs_fund=" + bs_fund + 52 | ", product_is_crawler=" + product_is_crawler + 53 | '}'; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/ProductReFundManagerVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * Created by Jerry on 15/11/12. 5 | */ 6 | public class ProductReFundManagerVo { 7 | private int id ; 8 | private int product_id;//产品ID 9 | private int bs_fundmanager; //基金经理 10 | private int product_is_crawler = 1;//是否为爬取 1 是 0 不是 11 | 12 | public int getId() { 13 | return id; 14 | } 15 | 16 | public void setId(int id) { 17 | this.id = id; 18 | } 19 | 20 | public int getProduct_id() { 21 | return product_id; 22 | } 23 | 24 | public void setProduct_id(int product_id) { 25 | this.product_id = product_id; 26 | } 27 | 28 | public int getBs_fundmanager() { 29 | return bs_fundmanager; 30 | } 31 | 32 | public void setBs_fundmanager(int bs_fundmanager) { 33 | this.bs_fundmanager = bs_fundmanager; 34 | } 35 | 36 | public int getProduct_is_crawler() { 37 | return product_is_crawler; 38 | } 39 | 40 | public void setProduct_is_crawler(int product_is_crawler) { 41 | this.product_is_crawler = product_is_crawler; 42 | } 43 | 44 | 45 | @Override 46 | public String toString() { 47 | return "ProductReFundManagerVo{" + 48 | "id=" + id + 49 | ", product_id=" + product_id + 50 | ", bs_fundmanager=" + bs_fundmanager + 51 | ", product_is_crawler=" + product_is_crawler + 52 | '}'; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/RiskAssessmentIndexVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * Created by Jerry on 15/11/24. 5 | * 风险评估指标 6 | */ 7 | public class RiskAssessmentIndexVo { 8 | private AnnualizedReturnRateVo annualizedReturnRateVo;//年化收益率 9 | private AnnualFluctuationRateVo annualFluctuationRateVo;//年化波动率 10 | private MaximumReturnVo maximumReturnVo; //最大回撤 11 | private SharpRatioVo sharpRatioVo;//夏普比率 12 | private CalmarRatioVo calmarRatioVo;//CALMAR比率 13 | private SterlingRatioVo sterlingRatioVo;//Sterling比率 14 | 15 | public AnnualizedReturnRateVo getAnnualizedReturnRateVo() { 16 | return annualizedReturnRateVo; 17 | } 18 | 19 | public void setAnnualizedReturnRateVo(AnnualizedReturnRateVo annualizedReturnRateVo) { 20 | this.annualizedReturnRateVo = annualizedReturnRateVo; 21 | } 22 | 23 | public AnnualFluctuationRateVo getAnnualFluctuationRateVo() { 24 | return annualFluctuationRateVo; 25 | } 26 | 27 | public void setAnnualFluctuationRateVo(AnnualFluctuationRateVo annualFluctuationRateVo) { 28 | this.annualFluctuationRateVo = annualFluctuationRateVo; 29 | } 30 | 31 | public MaximumReturnVo getMaximumReturnVo() { 32 | return maximumReturnVo; 33 | } 34 | 35 | public void setMaximumReturnVo(MaximumReturnVo maximumReturnVo) { 36 | this.maximumReturnVo = maximumReturnVo; 37 | } 38 | 39 | public SharpRatioVo getSharpRatioVo() { 40 | return sharpRatioVo; 41 | } 42 | 43 | public void setSharpRatioVo(SharpRatioVo sharpRatioVo) { 44 | this.sharpRatioVo = sharpRatioVo; 45 | } 46 | 47 | public CalmarRatioVo getCalmarRatioVo() { 48 | return calmarRatioVo; 49 | } 50 | 51 | public void setCalmarRatioVo(CalmarRatioVo calmarRatioVo) { 52 | this.calmarRatioVo = calmarRatioVo; 53 | } 54 | 55 | public SterlingRatioVo getSterlingRatioVo() { 56 | return sterlingRatioVo; 57 | } 58 | 59 | public void setSterlingRatioVo(SterlingRatioVo sterlingRatioVo) { 60 | this.sterlingRatioVo = sterlingRatioVo; 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return "RiskAssessmentIndexVo{" + 66 | "annualizedReturnRateVo=" + annualizedReturnRateVo + 67 | ", annualFluctuationRateVo=" + annualFluctuationRateVo + 68 | ", maximumReturnVo=" + maximumReturnVo + 69 | ", sharpRatioVo=" + sharpRatioVo + 70 | ", calmarRatioVo=" + calmarRatioVo + 71 | ", sterlingRatioVo=" + sterlingRatioVo + 72 | '}'; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/SharpRatioVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | * 夏普比率 5 | * Created by Jerry on 15/11/12. 6 | */ 7 | public class SharpRatioVo { 8 | private int product_id; 9 | private double SR_NEARLY_A_YEAR;// '近一年' 10 | private double SR_NEARLY_TWO_YEARS;// '近两年' 11 | private double SR_NEARLY_THREE_YEARS;//'近三年' 12 | private double SR_NEARLY_FIVE_YEARS ;//'近5年' 13 | private double SR_SINCE_ITS_ESTABLISHMENT ;// '成立以来' 14 | private int product_is_crawler = 1;// '是否为爬取 1 是 0 不是' 15 | 16 | public int getProduct_id() { 17 | return product_id; 18 | } 19 | 20 | public void setProduct_id(int product_id) { 21 | this.product_id = product_id; 22 | } 23 | 24 | public double getSR_NEARLY_A_YEAR() { 25 | return SR_NEARLY_A_YEAR; 26 | } 27 | 28 | public void setSR_NEARLY_A_YEAR(double SR_NEARLY_A_YEAR) { 29 | this.SR_NEARLY_A_YEAR = SR_NEARLY_A_YEAR; 30 | } 31 | 32 | public double getSR_NEARLY_TWO_YEARS() { 33 | return SR_NEARLY_TWO_YEARS; 34 | } 35 | 36 | public void setSR_NEARLY_TWO_YEARS(double SR_NEARLY_TWO_YEARS) { 37 | this.SR_NEARLY_TWO_YEARS = SR_NEARLY_TWO_YEARS; 38 | } 39 | 40 | public double getSR_NEARLY_THREE_YEARS() { 41 | return SR_NEARLY_THREE_YEARS; 42 | } 43 | 44 | public void setSR_NEARLY_THREE_YEARS(double SR_NEARLY_THREE_YEARS) { 45 | this.SR_NEARLY_THREE_YEARS = SR_NEARLY_THREE_YEARS; 46 | } 47 | 48 | public double getSR_NEARLY_FIVE_YEARS() { 49 | return SR_NEARLY_FIVE_YEARS; 50 | } 51 | 52 | public void setSR_NEARLY_FIVE_YEARS(double SR_NEARLY_FIVE_YEARS) { 53 | this.SR_NEARLY_FIVE_YEARS = SR_NEARLY_FIVE_YEARS; 54 | } 55 | 56 | public double getSR_SINCE_ITS_ESTABLISHMENT() { 57 | return SR_SINCE_ITS_ESTABLISHMENT; 58 | } 59 | 60 | public void setSR_SINCE_ITS_ESTABLISHMENT(double SR_SINCE_ITS_ESTABLISHMENT) { 61 | this.SR_SINCE_ITS_ESTABLISHMENT = SR_SINCE_ITS_ESTABLISHMENT; 62 | } 63 | 64 | public int getProduct_is_crawler() { 65 | return product_is_crawler; 66 | } 67 | 68 | public void setProduct_is_crawler(int product_is_crawler) { 69 | this.product_is_crawler = product_is_crawler; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return "SharpRatioVo{" + 75 | "product_id=" + product_id + 76 | ", SR_NEARLY_A_YEAR=" + SR_NEARLY_A_YEAR + 77 | ", SR_NEARLY_TWO_YEARS=" + SR_NEARLY_TWO_YEARS + 78 | ", SR_NEARLY_THREE_YEARS=" + SR_NEARLY_THREE_YEARS + 79 | ", SR_NEARLY_FIVE_YEARS=" + SR_NEARLY_FIVE_YEARS + 80 | ", SR_SINCE_ITS_ESTABLISHMENT=" + SR_SINCE_ITS_ESTABLISHMENT + 81 | ", product_is_crawler=" + product_is_crawler + 82 | '}'; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/jerry/financecrawler/vo/SterlingRatioVo.java: -------------------------------------------------------------------------------- 1 | package com.jerry.financecrawler.vo; 2 | 3 | /** 4 | *Sterling比率 5 | * Created by Jerry on 15/11/12. 6 | */ 7 | public class SterlingRatioVo { 8 | private int product_id; 9 | private double SR_NEARLY_A_YEAR;// '近一年' 10 | private double SR_NEARLY_TWO_YEARS;// '近两年' 11 | private double SR_NEARLY_THREE_YEARS;//'近三年' 12 | private double SR_NEARLY_FIVE_YEARS ;//'近5年' 13 | private double SR_SINCE_ITS_ESTABLISHMENT ;// '成立以来' 14 | private int product_is_crawler = 1;// '是否为爬取 1 是 0 不是' 15 | 16 | public int getProduct_id() { 17 | return product_id; 18 | } 19 | 20 | public void setProduct_id(int product_id) { 21 | this.product_id = product_id; 22 | } 23 | 24 | public double getSR_NEARLY_A_YEAR() { 25 | return SR_NEARLY_A_YEAR; 26 | } 27 | 28 | public void setSR_NEARLY_A_YEAR(double SR_NEARLY_A_YEAR) { 29 | this.SR_NEARLY_A_YEAR = SR_NEARLY_A_YEAR; 30 | } 31 | 32 | public double getSR_NEARLY_TWO_YEARS() { 33 | return SR_NEARLY_TWO_YEARS; 34 | } 35 | 36 | public void setSR_NEARLY_TWO_YEARS(double SR_NEARLY_TWO_YEARS) { 37 | this.SR_NEARLY_TWO_YEARS = SR_NEARLY_TWO_YEARS; 38 | } 39 | 40 | public double getSR_NEARLY_THREE_YEARS() { 41 | return SR_NEARLY_THREE_YEARS; 42 | } 43 | 44 | public void setSR_NEARLY_THREE_YEARS(double SR_NEARLY_THREE_YEARS) { 45 | this.SR_NEARLY_THREE_YEARS = SR_NEARLY_THREE_YEARS; 46 | } 47 | 48 | public double getSR_NEARLY_FIVE_YEARS() { 49 | return SR_NEARLY_FIVE_YEARS; 50 | } 51 | 52 | public void setSR_NEARLY_FIVE_YEARS(double SR_NEARLY_FIVE_YEARS) { 53 | this.SR_NEARLY_FIVE_YEARS = SR_NEARLY_FIVE_YEARS; 54 | } 55 | 56 | public double getSR_SINCE_ITS_ESTABLISHMENT() { 57 | return SR_SINCE_ITS_ESTABLISHMENT; 58 | } 59 | 60 | public void setSR_SINCE_ITS_ESTABLISHMENT(double SR_SINCE_ITS_ESTABLISHMENT) { 61 | this.SR_SINCE_ITS_ESTABLISHMENT = SR_SINCE_ITS_ESTABLISHMENT; 62 | } 63 | 64 | public int getProduct_is_crawler() { 65 | return product_is_crawler; 66 | } 67 | 68 | public void setProduct_is_crawler(int product_is_crawler) { 69 | this.product_is_crawler = product_is_crawler; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return "SharpRatioVo{" + 75 | "product_id=" + product_id + 76 | ", SR_NEARLY_A_YEAR=" + SR_NEARLY_A_YEAR + 77 | ", SR_NEARLY_TWO_YEARS=" + SR_NEARLY_TWO_YEARS + 78 | ", SR_NEARLY_THREE_YEARS=" + SR_NEARLY_THREE_YEARS + 79 | ", SR_NEARLY_FIVE_YEARS=" + SR_NEARLY_FIVE_YEARS + 80 | ", SR_SINCE_ITS_ESTABLISHMENT=" + SR_SINCE_ITS_ESTABLISHMENT + 81 | ", product_is_crawler=" + product_is_crawler + 82 | '}'; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/resources/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | #dataSource 2 | db.driver = com.mysql.jdbc.Driver 3 | db.url = jdbc:mysql://127.0.0.1:3306/financedb?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull 4 | db.user = root 5 | db.password = 123 6 | 7 | # DB settings 8 | # ~~~~~~~~~~~~ 9 | # H2 10 | #db.driver = org.h2.Driver 11 | #db.url = jdbc:h2:mem:myDBname 12 | #db.user = sa 13 | #db.password = 14 | 15 | # MySQL 16 | #db.driver = com.mysql.jdbc.Driver 17 | #db.url = jdbc:mysql://localhost:3306/myDBname 18 | #db.user = mysql 19 | #db.password = mysql 20 | 21 | # PostegrSQL 22 | #db.driver = org.postgresql.Driver 23 | #db.url = jdbc:postgresql://localhost:5432/myDBname?searchpath=public 24 | #db.user = postgresql 25 | #db.password = postgresql 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/jobtime.properties: -------------------------------------------------------------------------------- 1 | #job time 2 | howbuy.historicalnet = 0/5 * * * * ? 3 | 4 | howbuy.fundproduct = 0 0 1 * * ? 5 | howbuy.detail = 0 0 2 * * ? 6 | 7 | eastmoney.fundproduct = 0 0 0 * * ? 8 | 9 | licai.fundproduct = 0 0 23 * * ? 10 | 11 | hs = 0 0 22 * * ? -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=info,Console,File 2 | 3 | log4j.logger.org.springframework=error 4 | log4j.logger.org.mybatis.spring=DEBUG 5 | log4j.logger.base=DEBUG 6 | log4j.logger.org.apache.ibatis=debug 7 | log4j.logger.java.sql=debug 8 | log4j.logger.java.sql.Connection=DEBUG 9 | log4j.logger.java.sql.PreparedStatement=DEBUG 10 | log4j.logger.java.sql.ResultSet=DEBUG 11 | log4j.logger.java.sql.Statement=DEBUG 12 | 13 | log4j.appender.Console=org.apache.log4j.ConsoleAppender 14 | log4j.appender.Console.Target=System.out 15 | log4j.appender.Console.Threshold=DEBUG 16 | log4j.appender.Console.layout=org.apache.log4j.PatternLayout 17 | log4j.appender.Console.layout.ConversionPattern=[%p][%l]-%m%n 18 | 19 | log4j.appender.File=org.apache.log4j.RollingFileAppender 20 | log4j.appender.File.File=./log/financeCrawler.log 21 | log4j.appender.File.MaxBackupIndex=10 22 | log4j.appender.File.MaxFileSize=5MB 23 | log4j.appender.File.Threshold=ALL 24 | log4j.appender.File.layout=org.apache.log4j.PatternLayout 25 | log4j.appender.File.layout.ConversionPattern=[%p][%d{yyyy-MM-dd HH\:mm\:ss,SSS}][%c]%m%n 26 | log4j.logger.org.quartz=ERROR 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/test/java/com/jerry/finance/crawler/TestBase.java: -------------------------------------------------------------------------------- 1 | package com.jerry.finance.crawler; 2 | import org.junit.runner.RunWith; 3 | import org.springframework.test.context.ContextConfiguration; 4 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 5 | 6 | /** 7 | * Created by Jerry on 2015/9/20. 8 | */ 9 | @RunWith(SpringJUnit4ClassRunner.class) 10 | @ContextConfiguration(locations = "classpath*:applicationContext*.xml") 11 | public class TestBase { 12 | } 13 | -------------------------------------------------------------------------------- /src/test/java/com/jerry/finance/crawler/db/dao/FundProductDaoTest.java: -------------------------------------------------------------------------------- 1 | package com.jerry.finance.crawler.db.dao; 2 | 3 | import com.jerry.finance.crawler.TestBase; 4 | import com.jerry.financecrawler.db.dao.IFundProduct; 5 | import com.jerry.financecrawler.db.po.FundProductPo; 6 | import org.junit.Test; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | import javax.annotation.Resource; 11 | 12 | /** 13 | * Created by Jerry on 2015/10/20. 14 | */ 15 | public class FundProductDaoTest extends TestBase { 16 | /** 17 | * Logger 18 | */ 19 | private static final Logger log = LoggerFactory.getLogger(FundProductDaoTest.class); 20 | @Resource 21 | private IFundProduct fundProductDao; 22 | 23 | @Test 24 | public void testFind() { 25 | int id = 2; 26 | FundProductPo po =fundProductDao.find(id); 27 | log.info("[FundProductPo] = " + po.toString()); 28 | } 29 | 30 | @Test 31 | public void testFindByCodeOrName(){ 32 | String product_name = "锝金1号"; 33 | FundProductPo po =fundProductDao.findByCodeOrName("", product_name); 34 | log.info("[FundProductPo] = " + po.toString()); 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/java/com/jerry/finance/crawler/job/EastFinanceDaoTest.java: -------------------------------------------------------------------------------- 1 | package com.jerry.finance.crawler.job; 2 | 3 | import com.jerry.finance.crawler.TestBase; 4 | import org.junit.Test; 5 | 6 | /** 7 | * Created by Jerry on 2015/9/20. 8 | */ 9 | public class EastFinanceDaoTest extends TestBase { 10 | @Test 11 | public void test() { 12 | System.out.println("11111111"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/test/resources/config.properties: -------------------------------------------------------------------------------- 1 | #dataSource 2 | db.driver = com.mysql.jdbc.Driver 3 | db.url = jdbc:mysql://127.0.0.1:3306/financedb?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull 4 | db.user = root 5 | db.password = 123 6 | 7 | # DB settings 8 | # ~~~~~~~~~~~~ 9 | # H2 10 | #db.driver = org.h2.Driver 11 | #db.url = jdbc:h2:mem:myDBname 12 | #db.user = sa 13 | #db.password = 14 | 15 | # MySQL 16 | #db.driver = com.mysql.jdbc.Driver 17 | #db.url = jdbc:mysql://localhost:3306/myDBname 18 | #db.user = mysql 19 | #db.password = mysql 20 | 21 | # PostegrSQL 22 | #db.driver = org.postgresql.Driver 23 | #db.url = jdbc:postgresql://localhost:5432/myDBname?searchpath=public 24 | #db.user = postgresql 25 | #db.password = postgresql 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/test/resources/jobtime.properties: -------------------------------------------------------------------------------- 1 | #job time 2 | howbuy.historicalnet = 0 30 1 * * ? 3 | 4 | howbuy.fundproduct = 0 0 1 * * ? 5 | howbuy.detail = 0 0 2 * * ? 6 | 7 | eastmoney.fundproduct = 0 0 0 * * ? 8 | 9 | licai.fundproduct = 0 0 23 * * ? 10 | 11 | hs = 0/5 * * * * ? -------------------------------------------------------------------------------- /src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=info,Console,File 2 | 3 | log4j.logger.org.springframework=error 4 | log4j.logger.org.mybatis.spring=DEBUG 5 | log4j.logger.base=DEBUG 6 | log4j.logger.org.apache.ibatis=debug 7 | log4j.logger.java.sql=debug 8 | log4j.logger.java.sql.Connection=DEBUG 9 | log4j.logger.java.sql.PreparedStatement=DEBUG 10 | log4j.logger.java.sql.ResultSet=DEBUG 11 | log4j.logger.java.sql.Statement=DEBUG 12 | 13 | log4j.appender.Console=org.apache.log4j.ConsoleAppender 14 | log4j.appender.Console.Target=System.out 15 | log4j.appender.Console.Threshold=DEBUG 16 | log4j.appender.Console.layout=org.apache.log4j.PatternLayout 17 | log4j.appender.Console.layout.ConversionPattern=[%p][%l]-%m%n 18 | 19 | log4j.appender.File=org.apache.log4j.RollingFileAppender 20 | log4j.appender.File.File=./log/financeCrawler.log 21 | log4j.appender.File.MaxBackupIndex=10 22 | log4j.appender.File.MaxFileSize=5MB 23 | log4j.appender.File.Threshold=ALL 24 | log4j.appender.File.layout=org.apache.log4j.PatternLayout 25 | log4j.appender.File.layout.ConversionPattern=[%p][%d{yyyy-MM-dd HH\:mm\:ss,SSS}][%c]%m%n 26 | log4j.logger.org.quartz=ERROR 27 | 28 | 29 | 30 | 31 | 32 | 33 | --------------------------------------------------------------------------------