Browse Source

调整采集显示

master
xyiege 3 years ago
parent
commit
0a47d3095c
  1. 2
      src/main/java/cn/chjyj/szwh/SzwhApplication.java
  2. 6
      src/main/java/cn/chjyj/szwh/controller/task/TaskGoodsController.java
  3. 5
      src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java
  4. 49
      src/main/resources/application.properties

2
src/main/java/cn/chjyj/szwh/SzwhApplication.java

@ -2,8 +2,10 @@ package cn.chjyj.szwh;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
public class SzwhApplication {
public static void main(String[] args) {

6
src/main/java/cn/chjyj/szwh/controller/task/TaskGoodsController.java

@ -3,16 +3,21 @@ package cn.chjyj.szwh.controller.task;
import cn.chjyj.szwh.controller.BaseController;
import cn.chjyj.szwh.service.GoodsService;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* 任务控制器
*/
@RestController
@RequestMapping("/task/Goods")
public class TaskGoodsController extends BaseController {
private static Log log = LogFactory.getLog(TaskGoodsController.class);
@Autowired
private GoodsService goodsService;
@ -22,6 +27,7 @@ public class TaskGoodsController extends BaseController {
*/
@RequestMapping("/getApiGoods")
public JSONObject getApiGoods(){
log.info("远程采集商品信息:TASKGOODS:"+new Date());
int ret = goodsService.getApiGoods();
jsonObject.put("data",ret);
jsonObject.put("code",200);

5
src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

@ -73,10 +73,11 @@ public class GoodsServiceImpl implements GoodsService {
//创建签名
String sign = SignUtils.createSign("entrust");
log.info("请求token:"+sign);
// 请求头
Map<String, Object> hmap = new HashMap();
hmap.put("token", sign);
hmap.put("Content-Type", "application/json");
hmap.put("entrust_token", sign);
// hmap.put("Content-Type", "application/json");
// get 方式获取
JSONObject jsonObject = RequestUtils.GetData(apiurl, hmap);
log.info("goods api result : " + jsonObject);

49
src/main/resources/application.properties

@ -23,50 +23,5 @@ spring.redis.jedis.pool.enabled=true
spring.redis.jedis.pool.max-active=8
spring.redis.jedis.pool.max-wait=-1
# 存放在数据库
#spring.quartz.job-store-type=jdbc
# 是否等待任务执行完毕后,容器才会关闭
#spring.quartz.wait-for-jobs-to-complete-on-shutdown=true
# 容器名称
spring.quartz.scheduler-name=SzwhScheduler
#
org.quartz.simpl.SimpleThreadPool=10
#
#org.quartz.simpl.RAMJobStore
#org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
org.quartz.scheduler.instanceName= DefaultQuartzScheduler
org.quartz.scheduler.rmi.export= false
org.quartz.scheduler.rmi.proxy= false
org.quartz.scheduler.wrapJobExecutionInUserTransaction= false
#定义线程池的数量
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=10
org.quartz.threadPool.threadPriority=5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
org.quartz.jobStore.misfireThreshold=60000
#内存存储配置
#org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
#持久化配置
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
# 输出mybatis sql语句
#mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
#是否启用StatFilter默认值true
spring.datasource.druid.web-stat-filter.enabled= true
#添加过滤规则
spring.datasource.druid.web-stat-filter.url-pattern=/*
#忽略过滤的格式
spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
# 过滤器
spring.datasource.druid.web
#是否启用StatViewServlet默认值true
spring.datasource.druid.stat-view-servlet.enabled= true
# 链接时间
spring.datasource.druid.min-evictable-idle-time-millis=30000
#
spring.datasource.druid.time-between-connect-error-millis=60000
# 暂使用单机模式进行任务管理
spring.quartz.job-store-type=memory

Loading…
Cancel
Save