Commit 51fedc99 by manxiaoqiang

Merge branch 'master' of git.minrow.com:reyun/manager

# Conflicts: # .idea/workspace.xml # target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
parents d2fb06fe 87d05ec7
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<orderEntry type="module-library"> <orderEntry type="module-library">
<library name="Maven: com.alibaba:jconsole:1.8.0"> <library name="Maven: com.alibaba:jconsole:1.8.0">
<CLASSES> <CLASSES>
<root url="jar://E:/Java/jdk1.8.0_65/lib/jconsole.jar!/" /> <root url="jar://D:/java/jdk1.8.0_91/lib/jconsole.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<orderEntry type="module-library"> <orderEntry type="module-library">
<library name="Maven: com.alibaba:tools:1.8.0"> <library name="Maven: com.alibaba:tools:1.8.0">
<CLASSES> <CLASSES>
<root url="jar://E:/Java/jdk1.8.0_65/lib/tools.jar!/" /> <root url="jar://D:/java/jdk1.8.0_91/lib/tools.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />
......
...@@ -25,17 +25,17 @@ public class AppController ...@@ -25,17 +25,17 @@ public class AppController
{ {
@Autowired AppService appService; @Autowired AppService appService;
///api/applist/find?reyun=1&location=&firstCate=&secondCate=&pageNum=0&pageSize=20 ///api/applist/find?reyun=&location=%E5%8C%97%E4%BA%AC&firstCate=&secondCate=&pageNum=0&pageSize=20&sortString=pkgName&isASC=1
@RequestMapping(value = "find", method = RequestMethod.GET) @RequestMapping(value = "find", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResultModel findAll(@RequestParam Integer reyun, @RequestParam String location, @RequestParam String firstCate, @RequestParam String secondCate, public ResultModel findAll(@RequestParam Integer reyun, @RequestParam String location, @RequestParam String firstCate, @RequestParam String secondCate,
@RequestParam int pageNum, @RequestParam int pageSize) { @RequestParam int pageNum, @RequestParam int pageSize, @RequestParam String sortString, @RequestParam Integer isASC) {
AppInfo app = new AppInfo(); AppInfo app = new AppInfo();
app.setLocation(location); app.setLocation(location);
app.setFirstCate(firstCate); app.setFirstCate(firstCate);
app.setSecondCate(secondCate); app.setSecondCate(secondCate);
app.setReyun(reyun); app.setReyun(reyun);
return ResultModel.OK(appService.findAppList(app, pageNum, pageSize)); return ResultModel.OK(appService.findAppList(app, pageNum, pageSize, sortString, isASC));
} }
///api/applist/category/1 ///api/applist/category/1
......
...@@ -3,10 +3,15 @@ package common.repository; ...@@ -3,10 +3,15 @@ package common.repository;
import common.model.AppInfo; import common.model.AppInfo;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/** /**
* Created by zxy on 2017/12/26. * Created by zxy on 2017/12/26.
*/ */
public interface AppInfoRepository extends JpaRepository<AppInfo, Long>, JpaSpecificationExecutor<AppInfo> public interface AppInfoRepository extends JpaRepository<AppInfo, Long>, JpaSpecificationExecutor<AppInfo>
{ {
@Query(value = "select a from AppInfo a where reyun=0 or reyun is null")
List<AppInfo> findAppListByReyun();
} }
package common.service; package common.service;
import common.model.AppInfo; import common.model.AppInfo;
import dmp.model.AppData;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import java.util.List; import java.util.List;
...@@ -10,9 +11,11 @@ import java.util.List; ...@@ -10,9 +11,11 @@ import java.util.List;
*/ */
public interface AppService public interface AppService
{ {
Page<AppInfo> findAppList(AppInfo app, int pageNum, int pageSize); Page<AppInfo> findAppList(AppInfo app, int pageNum, int pageSize, String sort, Integer isASC);
List<String> findAllCategoryByLevel(int level); List<String> findAllCategoryByLevel(int level);
List<String> findCity(); List<String> findCity();
String findAppDataList(String startDate, String endDate, List<String> pkgNameList, Integer isASC);
} }
...@@ -5,6 +5,8 @@ import common.repository.AppCategoryRepository; ...@@ -5,6 +5,8 @@ import common.repository.AppCategoryRepository;
import common.repository.AppInfoRepository; import common.repository.AppInfoRepository;
import common.repository.CityRepository; import common.repository.CityRepository;
import common.service.AppService; import common.service.AppService;
import dmp.model.AppData;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
...@@ -12,6 +14,8 @@ import org.springframework.data.domain.Pageable; ...@@ -12,6 +14,8 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import util.Constant;
import util.HttpClientUtil;
import util.StringUtil; import util.StringUtil;
import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaBuilder;
...@@ -21,6 +25,7 @@ import javax.persistence.criteria.Root; ...@@ -21,6 +25,7 @@ import javax.persistence.criteria.Root;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by zxys on 2017/12/27. * Created by zxys on 2017/12/27.
...@@ -34,11 +39,14 @@ public class AppServiceImpl implements AppService ...@@ -34,11 +39,14 @@ public class AppServiceImpl implements AppService
@Autowired CityRepository cityRepository; @Autowired CityRepository cityRepository;
@Override @Override
public Page<AppInfo> findAppList(AppInfo app, int pageNum, int pageSize) public Page<AppInfo> findAppList(AppInfo app, int pageNum, int pageSize, String sortString, Integer isASC)
{ {
Specification<AppInfo> specification = getWhereClause(app); Specification<AppInfo> specification = getWhereClause(app);
List<Sort.Order> orders = new ArrayList<Sort.Order>(); List<Sort.Order> orders = new ArrayList<Sort.Order>();
orders.add(new Sort.Order(Sort.Direction.ASC,"id")); if (StringUtil.isEmpty(sortString)) {
sortString = "pkgName";
}
orders.add(new Sort.Order((isASC!=null && isASC==0)?Sort.Direction.DESC:Sort.Direction.ASC,sortString));
Sort sort = new Sort(orders); Sort sort = new Sort(orders);
Pageable pageable = new PageRequest(pageNum, pageSize, sort); Pageable pageable = new PageRequest(pageNum, pageSize, sort);
Page<AppInfo> appInfoPage = appInfoRepository.findAll(specification, pageable); Page<AppInfo> appInfoPage = appInfoRepository.findAll(specification, pageable);
...@@ -57,6 +65,24 @@ public class AppServiceImpl implements AppService ...@@ -57,6 +65,24 @@ public class AppServiceImpl implements AppService
return cityRepository.findCitys(); return cityRepository.findCitys();
} }
@Override
public String findAppDataList(String startDate, String endDate, List<String> pkgNameList, Integer isASC)
{
Map<String, String> conditions = new HashedMap();
String url = Constant.reportUrl + "/api/dmp/newdevicebypkgname/test";
conditions.put("datatype", "list");
conditions.put("startdate", "2017-12-20");
conditions.put("enddate", "2017-12-26");
if (pkgNameList != null && pkgNameList.size()>0) {
conditions.put("pkgname", String.join(",", pkgNameList));
}
if (isASC != null) {
conditions.put("isasc", isASC.toString());
}
String responseJson = HttpClientUtil.doHttpPostRequest(url, "manager", conditions);
return responseJson;
}
/** /**
* 动态生成where语句 * 动态生成where语句
* @param appInfo * @param appInfo
...@@ -79,6 +105,9 @@ public class AppServiceImpl implements AppService ...@@ -79,6 +105,9 @@ public class AppServiceImpl implements AppService
if (!StringUtil.isEmpty(appInfo.getSecondCate())) { if (!StringUtil.isEmpty(appInfo.getSecondCate())) {
predicate.add(cb.equal(root.get("secondCate").as(String.class), appInfo.getSecondCate())); predicate.add(cb.equal(root.get("secondCate").as(String.class), appInfo.getSecondCate()));
} }
if (!StringUtil.isEmpty(searchString)) {
}
Predicate[] pre = new Predicate[predicate.size()]; Predicate[] pre = new Predicate[predicate.size()];
query.where(predicate.toArray(pre)); query.where(predicate.toArray(pre));
return query.getRestriction(); return query.getRestriction();
......
package dmp.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* Created by zxy on 2017/12/28.
*/
@Entity
public class AppData
{
private Long id;
private String pkgName;
private String ds;
private Long newDevice;
@Id
@GeneratedValue
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getPkgName()
{
return pkgName;
}
public void setPkgName(String pkgName)
{
this.pkgName = pkgName;
}
public String getDs()
{
return ds;
}
public void setDs(String ds)
{
this.ds = ds;
}
public Long getNewDevice()
{
return newDevice;
}
public void setNewDevice(Long newDevice)
{
this.newDevice = newDevice;
}
@Override
public String toString()
{
return "AppData{" +
"id=" + id +
", pkgName='" + pkgName + '\'' +
", ds='" + ds + '\'' +
", newDevice=" + newDevice +
'}';
}
}
package dmp.repository;
import dmp.model.AppData;
import dmp.model.TagCrawlerAppsWandoujia;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* Created by Administrator on 2017/12/28.
*/
public interface AppDataRepository extends JpaRepository<AppData, Long>
{
@Query(value="select ad.pkgName,sum(ad.newDevice) as num from AppData ad where ds>=?1 and ds<=?2 group by ad.pkgName",nativeQuery=true)
List<AppData> findAllByDs(String startDate, String endDate);
}
package tkio.task; package tkio.task;
import common.context.AppUtils;
import common.model.AppCategory; import common.model.AppCategory;
import common.model.AppInfo; import common.model.AppInfo;
import common.repository.AppCategoryRepository; import common.repository.AppCategoryRepository;
import common.repository.AppInfoRepository; import common.repository.AppInfoRepository;
import common.repository.CityRepository; import common.repository.CityRepository;
import common.repository.UserRepository;
import dmp.model.TagCrawlerAppsWandoujia; import dmp.model.TagCrawlerAppsWandoujia;
import dmp.repository.TagCrawlerAppsWandoujiaRepository; import dmp.repository.TagCrawlerAppsWandoujiaRepository;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import security.annotation.Authorization; import util.Constant;
import tkio.model.App;
import tkio.repository.AccountRepository;
import util.DateUtil; import util.DateUtil;
import util.HttpClientUtil;
import util.StringUtil; import util.StringUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* Created by zxy on 2017/12/26. * Created by zxy on 2017/12/26.
...@@ -34,10 +32,12 @@ public class SyncAppDataTask ...@@ -34,10 +32,12 @@ public class SyncAppDataTask
@Autowired AppCategoryRepository appCategoryRepository; @Autowired AppCategoryRepository appCategoryRepository;
@Autowired CityRepository cityRepository; @Autowired CityRepository cityRepository;
public void syncAppData() public void syncAppData()
{ {
System.out.println(DateUtil.getBeforeDays(1)); System.out.println(DateUtil.getBeforeDays(1));
List<TagCrawlerAppsWandoujia> list = tagRepository.findAllByDs("2017-12-15"); List<TagCrawlerAppsWandoujia> list = tagRepository.findAllByDs("2017-12-15");
//从网上找了一个一线城市以及地级市的列表
List<String> citys = cityRepository.findCitys(); List<String> citys = cityRepository.findCitys();
List<AppInfo> appInfos = new ArrayList<>(); List<AppInfo> appInfos = new ArrayList<>();
List<AppCategory> appCategories = appCategoryRepository.findAll(); List<AppCategory> appCategories = appCategoryRepository.findAll();
...@@ -51,16 +51,25 @@ public class SyncAppDataTask ...@@ -51,16 +51,25 @@ public class SyncAppDataTask
map.put(appCategory.getLevel(), innerList); map.put(appCategory.getLevel(), innerList);
} }
List<String> ry_pkgNameList = findReyunPkgList();
List<AppCategory> newCategorys = new ArrayList<>(); List<AppCategory> newCategorys = new ArrayList<>();
List<AppInfo> newInfos = new ArrayList<>(); List<AppInfo> newInfos = new ArrayList<>();
for (TagCrawlerAppsWandoujia tag : list) { for (TagCrawlerAppsWandoujia tag : list) {
AppInfo appInfo = new AppInfo(); AppInfo appInfo = new AppInfo();
appInfo.setName(tag.getName()); appInfo.setName(tag.getName());
appInfo.setCompany(tag.getMaker()); appInfo.setCompany(tag.getMaker());
//豌豆荚爬取的都是安卓的
appInfo.setOs("Android"); appInfo.setOs("Android");
appInfo.setPkgName(tag.getPkgname()); appInfo.setPkgName(tag.getPkgname());
//判断这批app中是否有热云已有的
if (ry_pkgNameList.contains(tag.getPkgname())) {
appInfo.setReyun(1);
}
appInfo.setLogoUrl(tag.getApplogo_link()); appInfo.setLogoUrl(tag.getApplogo_link());
String types = tag.getMix_types(); String types = tag.getMix_types();
//类别按照_分割,第一个是一级类别,第二个是二级类别,第三个是三级类别,剩下到组合起来放到其他类别中
//同时将爬取的数据中的类别字典取出来
if (!StringUtil.isEmpty(types)) { if (!StringUtil.isEmpty(types)) {
String[] typeArray = types.split("_"); String[] typeArray = types.split("_");
String otherCase = ""; String otherCase = "";
...@@ -99,6 +108,7 @@ public class SyncAppDataTask ...@@ -99,6 +108,7 @@ public class SyncAppDataTask
appInfo.setOtherCate(otherCase.substring(1)); appInfo.setOtherCate(otherCase.substring(1));
} }
} }
//看公司名字中是含有城市列表中的某个,记录app的公司所在地
for (String city : citys) { for (String city : citys) {
if (tag.getMaker().indexOf(city) > -1) { if (tag.getMaker().indexOf(city) > -1) {
appInfo.setLocation(city); appInfo.setLocation(city);
...@@ -108,10 +118,40 @@ public class SyncAppDataTask ...@@ -108,10 +118,40 @@ public class SyncAppDataTask
newInfos.add(appInfo); newInfos.add(appInfo);
System.out.println(appInfo); System.out.println(appInfo);
} }
//把以前爬取的app不是热云的拿出来,看一下现在是不是热云的,是的话,更新进去。
List<AppInfo> oldNotRyAppList = appInfoRepository.findAppListByReyun();
System.out.println(oldNotRyAppList);
for (AppInfo app : oldNotRyAppList) {
if (ry_pkgNameList.contains(app.getPkgName())) {
app.setReyun(1);
System.out.println(app);
newInfos.add(app);
}
}
appInfoRepository.save(newInfos); appInfoRepository.save(newInfos);
appCategoryRepository.save(newCategorys); appCategoryRepository.save(newCategorys);
} }
public List<String> findReyunPkgList() {
Map<String, String> conditions = new HashedMap();
String url = Constant.reportUrl + "/api/manager/bysql";
String sql = "select distinct pkgname from tkio.tkio_app_pkgname where pkgname!='NULL'";
conditions.put("sql", sql);
conditions.put("dbtype", "mysql");
conditions.put("datatype", "list");
conditions.put("reportname", "pkgname_list");
String responseJson = HttpClientUtil.doHttpPostRequest(url, "manager", conditions);
JSONObject object = JSONObject.fromObject(responseJson);
JSONArray array = object.getJSONArray("val");
List<String> pkgName = new ArrayList<>();
for (int i=0; i<array.size(); i++) {
JSONObject o = array.getJSONObject(i);
pkgName.add(o.getString("pkgname"));
}
return pkgName;
}
public static void main(String[] args) public static void main(String[] args)
{ {
SyncAppDataTask task = new SyncAppDataTask(); SyncAppDataTask task = new SyncAppDataTask();
......
...@@ -33,6 +33,6 @@ ...@@ -33,6 +33,6 @@
<task:scheduled-tasks> <task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)--> <!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="SyncAppDataTask" method="syncAppData" cron="0 0 08 * * ?"/> <task:scheduled ref="SyncAppDataTask" method="syncAppData" cron="0 38 20 * * ?"/>
</task:scheduled-tasks> </task:scheduled-tasks>
</beans> </beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
default-lazy-init="true">
<description>调度配置</description>
<bean id="tkioAccountTask" class="tkio.task.AccountTask"></bean>
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="tkioAccountTask" method="task" cron="0 21 15 * * ?"/>
</task:scheduled-tasks>
<bean id="trackAccountTask" class="track.task.AccountTask"></bean>
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="trackAccountTask" method="task" cron="0 32 16 * * ?"/>
</task:scheduled-tasks>
<bean id="SyncAppDataTask" class="tkio.task.SyncAppDataTask"></bean>
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="SyncAppDataTask" method="syncAppData" cron="0 38 20 * * ?"/>
</task:scheduled-tasks>
</beans>
report.url=http://ec2-54-222-233-230.cn-north-1.compute.amazonaws.com.cn:9010
awsneed=${awsneed}
profile.table=${profile.table}
event.table=${event.table}
usergroup.table=${usergroup.table}
iscache=${iscache}
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<Encoding>UTF-8</Encoding>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%-20(%d{HH:mm:ss.SSS} [%thread][line:%L]) %-5level %logger{80} %M - %msg%n</Pattern>
</layout>
</appender>
<logger name="org.springframework" level="warn"/>
<logger name="org.springframework.remoting" level="warn"/>
<logger name="org.springframework.scheduling.quartz" level="warn"/>
<logger name="org.springframework.data.jpa" level="warn"/>
<logger name="ch.qos.logback" level="warn"/>
<logger name="org.hibernate" level="warn"/>
<root level="info">
<appender-ref ref="stdout" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<Encoding>UTF-8</Encoding>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%-20(%d{HH:mm:ss.SSS} [%thread][line:%L]) %-5level %logger{80} %M - %msg%n</Pattern>
</layout>
</appender>
<logger name="org.springframework" level="warn"/>
<logger name="org.springframework.remoting" level="warn"/>
<logger name="org.springframework.scheduling.quartz" level="warn"/>
<logger name="org.springframework.data.jpa" level="warn"/>
<logger name="ch.qos.logback" level="warn"/>
<logger name="org.hibernate" level="warn"/>
<root level="info">
<appender-ref ref="stdout" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<appender name="infoFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<Encoding>UTF-8</Encoding>
<file>/data/logs/trackingio.com/trackingio.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>/data/logs/trackingio.com/trackingio.%d{yyyy-MM-dd}.log.zip</FileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%-20(%d{HH:mm:ss.SSS} [%thread][line:%L]) %-5level %logger{80} - %msg%n</pattern>
</layout>
</appender>
<logger name="org.springframework">
<level value="warn" />
</logger>
<logger name="org.hibernate">
<level value="warn" />
</logger>
<logger name="org.apache.phoenix">
<level value="warn" />
</logger>
<logger name="org.apache.zookeeper">
<level value="warn" />
</logger>
<logger name="org.apache.hadoop">
<level value="warn" />
</logger>
<logger name="org.elasticsearch.plugins">
<level value="warn" />
</logger>
<root level="info">
<appender-ref ref="infoFile" />
<appender-ref ref="cat" />
</root>
</configuration>
\ No newline at end of file
mail.host=smtp.exmail.qq.com
mail.username=service1@reyun.com
mail.password=XSW29ijn
mail.content_type=text/plain;charset\=GBK
mail.list=zhangliang
mail.valid_time=3
\ No newline at end of file
dataSource.driverClassName=com.mysql.jdbc.Driver
default.dataSource.url=jdbc:mysql://192.168.2.57:3306/manager?characterEncoding=utf-8
default.dataSource.username=root
default.dataSource.password=reyun123
office.url=jdbc:mysql://192.168.2.57:3306/office?characterEncoding=utf-8
office.username=root
office.password=reyun123
tkio.url=jdbc:mysql://192.168.2.57:3306/trackingio?characterEncoding=utf-8
tkio.username=root
tkio.password=reyun123
track.url=jdbc:mysql://192.168.2.57:3306/track?characterEncoding=utf-8
track.username=root
track.password=reyun123
dmp.url=jdbc:mysql://192.168.2.57:3306/manager?characterEncoding=utf-8
dmp.username=root
dmp.password=reyun123
\ No newline at end of file
# Redis common settings
redis.key.validtime=120
redis.ip.requesttimes=5
redis.ip.unknown.requesttimes=5
redis.maxIdle=300
redis.testOnBorrow=true
# token
redis.surl.host=192.168.2.57
redis.surl.port=6379
# event
redis.event.host=192.168.2.57
redis.event.port=6379
redis.event.database=0
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
<context:component-scan base-package="exception" />
<context:component-scan base-package="common.controller" />
<context:component-scan base-package="track.controller" />
<context:component-scan base-package="tkio.controller" />
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean class="security.resolvers.LoginUserMethodArgumentsResolver"></bean>
</mvc:argument-resolvers>
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<constructor-arg value="UTF-8" />
</bean>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**" />
<bean class="security.interceptor.AuthorizationInterceptor" />
</mvc:interceptor>
</mvc:interceptors>
</beans>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment