Browse Source

Merge branch 'master' of http://47.92.109.230:8080/lu914596513/airasia_loop

# Conflicts:
#	src/main/resources/application.properties
lu914596513 6 years ago
parent
commit
ad5b6f8450

+ 1 - 0
src/main/java/com/bjlt/spider/dao/impl/ScCitycurrencyDaoImpl.java

@@ -1,6 +1,7 @@
 package com.bjlt.spider.dao.impl;
 
 
+import com.bjlt.spider.dao.ScCitycurrencyDao;
 import com.bjlt.spider.entity.ScCitycurrency;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;

+ 1 - 1
src/main/java/com/bjlt/spider/job/SmallLoopJob.java

@@ -39,7 +39,7 @@ public class SmallLoopJob {
 	public void worker() {
 
 		// 控制是否往mysq 扔消息
-		if (config != null && config.isSmallStartSendMq()) {
+		if (config != null && config.getSmallStartSendMq()) {
 			ScPolicy scPolicy = new ScPolicy();
 			scPolicy.setStatus(1);
 			List<ScPolicy> scPolicies = scPolicyService.selectNonRepeatingRoute("1");

+ 1 - 1
src/main/java/com/bjlt/spider/runner/ActiveMQConnectionHandler.java

@@ -34,7 +34,7 @@ public class ActiveMQConnectionHandler implements Runnable {
 			session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 			MessageConsumer consumer = session.createConsumer(destination);
 			consumer.setMessageListener(new SmallAirSoureLineListenter());
-
+			conn.start();
 		} catch (JMSException e) {
 			e.printStackTrace();
 		}

+ 5 - 5
src/main/java/com/bjlt/spider/runner/small/SmallAirSourceLineRunner.java

@@ -52,13 +52,13 @@ public class SmallAirSourceLineRunner implements CommandLineRunner {
 					session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 					MessageConsumer consumer = session.createConsumer(destination);
 					consumer.setMessageListener(new SmallAirSoureLineListenter());
-//					for (int i = 0; i < 3; i++) {
-//						log.info("小循环执行的线程为--->{}",i);
-//						executorService.execute(new ActiveMQConnectionHandler(conn, session, destination));
-//					}
+					for (int i = 0; i < 3; i++) {
+						log.info("小循环执行的线程为--->{}",i);
+						executorService.execute(new ActiveMQConnectionHandler(conn, session, destination));
+					}
 //
 //					if(Too)
-					conn.start();
+
 				} catch (JMSException e) {
 					e.printStackTrace();
 				}

+ 55 - 24
src/main/java/com/bjlt/spider/service/impl/SmallAirLineServiceImpl.java

@@ -121,7 +121,13 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 
 										// 新的积分
 										BigDecimal adultQuotedPoints = new BigDecimal(cheapAirlinePrice.getData().get("AdultQuotedPoints").toString());
-										BigDecimal oldAdultQuotedPoints = new BigDecimal(oldScpolicy.getBigScore());
+										BigDecimal oldAdultQuotedPoints = null;
+										String bigScore = oldScpolicy.getBigScore();
+										if(StringUtil.isNotBlank(bigScore)){
+											 oldAdultQuotedPoints = new BigDecimal(bigScore);
+										}else {
+											 oldAdultQuotedPoints = new BigDecimal(0);
+										}
 										monitor.put("adultQuotedPoints", adultQuotedPoints.doubleValue());
 										monitor.put("oldAdultQuotedPoints", oldAdultQuotedPoints.doubleValue());
 
@@ -248,14 +254,14 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 							//进行入库
 							log.info("需要进行修改政策");
 							monitor.put("status", "修改政策");
-							update(bigAirlineInfomation.getFormCity(), bigAirlineInfomation.getToCity(), bigAirlineInfomation.getFromDate(), flightNumbers.toString(), webAdultPrice_cny, bigAdultPrice_cny, bigPrice.getData().get("AdultQuotedPoints").toString(), config, scPolicyService, triptoCustomAddpriceService);
+							update(bigAirlineInfomation.getFormCity(), bigAirlineInfomation.getToCity(), bigAirlineInfomation.getFromDate(), flightNumbers.toString(), webAdultPrice_cny, bigAdultPrice_cny, bigPrice.getData().get("AdultQuotedPoints").toString(), config,bigPrice.getMaxSeats(), scPolicyService, triptoCustomAddpriceService);
 
 
 						} else {
 							//修改状态为失效
 							log.info("需要进行修改状态为失效");
 							monitor.put("status", "设置失效");
-							updateStatus(bigAirlineInfomation.getFormCity(), bigAirlineInfomation.getToCity(), bigAirlineInfomation.getFromDate(), flightNumbers.toString(), config, scPolicyService, triptoCustomAddpriceService);
+							updateStatus(bigAirlineInfomation.getFormCity(), bigAirlineInfomation.getToCity(), bigAirlineInfomation.getFromDate(), flightNumbers.toString(), webAdultPrice_cny, bigAdultPrice_cny, bigPrice.getData().get("AdultQuotedPoints").toString(), config,bigPrice.getMaxSeats(), scPolicyService, triptoCustomAddpriceService);
 						}
 						monitors.add(monitor);
 					}
@@ -363,8 +369,9 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 	 * @param totalPoint
 	 * @param config
 	 * @param scPolicyService
+	 * @param  maxSears  座位数
 	 */
-	public void update(String formCity, String toCity, String fromDate, String allFlightNumber, BigDecimal webCNY, BigDecimal bigCNY, String totalPoint, Config config, ScPolicyService scPolicyService, TriptoCustomAddpriceService triptoCustomAddpriceService) {
+	public void update(String formCity, String toCity, String fromDate, String allFlightNumber, BigDecimal webCNY, BigDecimal bigCNY, String totalPoint, Config config,Integer maxSears, ScPolicyService scPolicyService, TriptoCustomAddpriceService triptoCustomAddpriceService) {
 
 
 		try {
@@ -385,19 +392,22 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 				scPolicy.setFlightNumberLimitType(1);
 
 
-				scPolicy.setOriginalPrice(webCNY);
+
 				scPolicy.setLowPrice(new BigDecimal(10));
 				scPolicy.setUpPrice(new BigDecimal(99999999));
 				scPolicy.setAdjustType("0");
-				scPolicy.setFinalPrice(new BigDecimal(bigCNY.intValue() + config.getAddPrice()));
-				scPolicy.setFileNo("积分自维");
+
+				scPolicy.setStatus(3);
 				scPolicy.setAddOrSubtractMoney("0");
 				scPolicy.setAddTime(DateUtil.getFormatDate(new Date(), DatePattren.TIME_FORMAT));
 				scPolicy.setScore(String.valueOf(bigCNY.doubleValue()));
+				scPolicy.setFileNo("积分自维");
+				scPolicy.setOriginalPrice(webCNY);
 				scPolicy.setPolicySource("point");
 				scPolicy.setCabinScope("0");
-				scPolicy.setStatus(3);
+				scPolicy.setFinalPrice(new BigDecimal(bigCNY.intValue() + config.getAddPrice()));
 				scPolicy.setBigScore(totalPoint);
+				scPolicy.setBigSeatCount(maxSears);
 				logger.info(SysLogger.builder().logFilePath("log").isCreateFile(true).name("add_old_policy").message(JSONObject.toJSONString(scPolicy)).build());
 				scPolicyService.updateByPrimaryKeySelective(scPolicy);
 				log.info("新政策表开始更新,更新参数为-->{}", JSON.toJSONString(scPolicy));
@@ -411,11 +421,7 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 		try {
 			//插入新的政策表
 			TriptoCustomAddprice triptoCustomAddprice = new TriptoCustomAddprice();
-			triptoCustomAddprice.setName("system");
-			triptoCustomAddprice.setFilename("积分自维"); //文件编号
-			triptoCustomAddprice.setPlatform("ltd/lqe/tuniu/meituan/tongcheng/ali");//
-			triptoCustomAddprice.setEnable(3);//1 有;效 0 无效 3 挂起
-			triptoCustomAddprice.setMethod("AKNEW");
+
 			triptoCustomAddprice.setDptAirport(formCity);
 			triptoCustomAddprice.setArrAirport(toCity);
 			triptoCustomAddprice.setFlyStartday(fromDate);
@@ -423,24 +429,34 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 			triptoCustomAddprice.setFlightNo(allFlightNumber);
 
 			List<TriptoCustomAddprice> triptoCustomAddprices = triptoCustomAddpriceService.listPageTriptoCustomAddprice(triptoCustomAddprice);
+
+          log.info("旧政策表查询到的条数--》{},参数为-=->{}",triptoCustomAddprices.size(),JSON.toJSONString(triptoCustomAddprice));
 			if (triptoCustomAddprices != null && triptoCustomAddprices.size() > 0) {
+
 				Integer id = triptoCustomAddprices.get(0).getId();
+//				triptoCustomAddprice.setName("system");
+//				triptoCustomAddprice.setPlatform("ltd/lqe/tuniu/meituan/tongcheng/ali");//
+//				triptoCustomAddprice.setMethod("AKNEW");
+				System.out.println("triptoCustomAddpricesId ---"+triptoCustomAddprices);
+				triptoCustomAddprice.setEnable(3);//1 有;效 0 无效 3 挂起
 				triptoCustomAddprice.setExcludeFlyStartday("");
 				triptoCustomAddprice.setExcludeFlyEndday("");
 				triptoCustomAddprice.setFlightNoStatus(2);//1,适用 2,排除 3,全部
 
 				triptoCustomAddprice.setIsSalePrice(1);//1 固定价格 2 区间价
-				triptoCustomAddprice.setSalePrice(Double.valueOf(bigCNY.intValue() + config.getAddPrice()));//销售价格
 				triptoCustomAddprice.setAddPrice(0);//加减钱
 				triptoCustomAddprice.setAddPricePercent(0.0);//调整百分比
-				triptoCustomAddprice.setWebrmbPrice(webCNY.doubleValue());//官网人民币总参考价格
-				triptoCustomAddprice.setBigrmbPrice(bigCNY.doubleValue());//积分人民币总参考价格
 				triptoCustomAddprice.setPriceDifference(0.0);//差价参考
 				triptoCustomAddprice.setPriceFrom(0.0);
 				triptoCustomAddprice.setPriceTo(0.0);
 				triptoCustomAddprice.setPriceRange(0.0);
 				triptoCustomAddprice.setPricePercent(0.0);
-
+				triptoCustomAddprice.setId(id);
+				triptoCustomAddprice.setSalePrice(Double.valueOf(bigCNY.intValue() + config.getAddPrice()));//销售价格
+				triptoCustomAddprice.setFilename("积分自维"); //文件编号
+				triptoCustomAddprice.setWebrmbPrice(webCNY.doubleValue());//官网人民币总参考价格
+				triptoCustomAddprice.setBigrmbPrice(bigCNY.doubleValue());//积分人民币总参考价格
+				triptoCustomAddprice.setBigSeatCount(maxSears);
 				triptoCustomAddprice.setModifytime(DateUtil.getFormatDate(new Date(), DatePattren.TIME_FORMAT));
 				triptoCustomAddprice.setMark("bigapp积分:" + totalPoint);
 				logger.info(SysLogger.builder().logFilePath("log").isCreateFile(true).name("add_new_policy").message(JSONObject.toJSONString(triptoCustomAddprice)).build());
@@ -460,7 +476,7 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 	/**
 	 * 修改状态
 	 */
-	public void updateStatus(String formCity, String toCity, String fromDate, String allFlightNumber, Config config, ScPolicyService scPolicyService, TriptoCustomAddpriceService triptoCustomAddpriceService) {
+	public void updateStatus(String formCity, String toCity, String fromDate, String allFlightNumber, BigDecimal webCNY, BigDecimal bigCNY, String totalPoint, Config config,Integer maxSears,ScPolicyService scPolicyService, TriptoCustomAddpriceService triptoCustomAddpriceService) {
 		try {
 			ScPolicy scPolicy = new ScPolicy();
 			scPolicy.setAirSourceGroupId(1);
@@ -476,6 +492,15 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 				scPolicy.setId(id);
 				scPolicy.setFileNo("积分自维");
 				scPolicy.setStatus(0);
+				scPolicy.setAddTime(DateUtil.getFormatDate(new Date(), DatePattren.TIME_FORMAT));
+				scPolicy.setScore(String.valueOf(bigCNY.doubleValue()));
+				scPolicy.setFileNo("积分自维");
+				scPolicy.setOriginalPrice(webCNY);
+				scPolicy.setPolicySource("point");
+				scPolicy.setCabinScope("0");
+				scPolicy.setFinalPrice(new BigDecimal(bigCNY.intValue() + config.getAddPrice()));
+				scPolicy.setBigScore(totalPoint);
+				scPolicy.setBigSeatCount(maxSears);
 				logger.info(SysLogger.builder().logFilePath("log").isCreateFile(true).name("add_old_policy").message(JSONObject.toJSONString(scPolicy)).build());
 				scPolicyService.updateByPrimaryKeySelective(scPolicy);
 				log.info("新政策表状态开始更新,更新参数为-->{}", JSON.toJSONString(scPolicy));
@@ -489,11 +514,7 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 		try {
 			//插入新的政策表
 			TriptoCustomAddprice triptoCustomAddprice = new TriptoCustomAddprice();
-			triptoCustomAddprice.setName("system");
-			triptoCustomAddprice.setFilename("积分自维"); //文件编号
-			triptoCustomAddprice.setPlatform("ltd/lqe/tuniu/meituan/tongcheng/ali");//
-			triptoCustomAddprice.setEnable(0);//1 有;效 0 无效 3 挂起
-			triptoCustomAddprice.setMethod("AKNEW");
+
 			triptoCustomAddprice.setDptAirport(formCity);
 			triptoCustomAddprice.setArrAirport(toCity);
 			triptoCustomAddprice.setFlyStartday(fromDate);
@@ -504,7 +525,17 @@ public class SmallAirLineServiceImpl implements SmallAirLineService {
 			if (triptoCustomAddprices != null && triptoCustomAddprices.size() > 0) {
 				Integer id = triptoCustomAddprices.get(0).getId();
 				triptoCustomAddprice.setId(id);
-
+				triptoCustomAddprice.setEnable(0);//1 有;效 0 无效 3 挂起
+				triptoCustomAddprice.setName("system");
+				triptoCustomAddprice.setPlatform("ltd/lqe/tuniu/meituan/tongcheng/ali");//
+				triptoCustomAddprice.setMethod("AKNEW");
+				triptoCustomAddprice.setSalePrice(Double.valueOf(bigCNY.intValue() + config.getAddPrice()));//销售价格
+				triptoCustomAddprice.setFilename("积分自维"); //文件编号
+				triptoCustomAddprice.setWebrmbPrice(webCNY.doubleValue());//官网人民币总参考价格
+				triptoCustomAddprice.setBigrmbPrice(bigCNY.doubleValue());//积分人民币总参考价格
+				triptoCustomAddprice.setBigSeatCount(maxSears);
+				triptoCustomAddprice.setModifytime(DateUtil.getFormatDate(new Date(), DatePattren.TIME_FORMAT));
+				triptoCustomAddprice.setMark("bigapp积分:" + totalPoint);
 				logger.info(SysLogger.builder().logFilePath("log").isCreateFile(true).name("add_new_policy").message(JSONObject.toJSONString(triptoCustomAddprice)).build());
 				triptoCustomAddpriceService.updateByPrimaryKeySelective(triptoCustomAddprice);
 

+ 4 - 6
src/main/resources/application-test.properties

@@ -48,9 +48,9 @@ spring.datasource.first.password=mysqlTripto#789
 
 
 ##配置数据源2
-spring.datasource.second.url=jdbc:mysql://47.75.91.168:33609/triptoflight?serverTimezone=CTT&characterEncoding=utf8&useUnicode=true&useSSL=false&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false
-spring.datasource.second.username=triptomysqluser
-spring.datasource.second.password=Tripto123!@#mysql
+spring.datasource.second.url=jdbc:mysql://203.130.42.246:3306/oatest?serverTimezone=CTT&characterEncoding=utf8&useUnicode=true&useSSL=false&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false
+spring.datasource.second.username=mytripto
+spring.datasource.second.password=mysqlTripto#789
 ##配置数据源3
 spring.datasource.three.url=jdbc:mysql://47.75.91.168:33609/book?serverTimezone=CTT&characterEncoding=utf8&useUnicode=true&useSSL=false&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false
 spring.datasource.three.username=triptomysqluser
@@ -60,9 +60,7 @@ spring.datasource.three.password=Tripto123!@#mysql
 mqSearchName=search_key
 mqSearchListenerNum=3
 
-<<<<<<< HEAD
 # 小循环
 smallMqSearchName=smallMqSearchTest
-=======
+
 peronNum =5
->>>>>>> a5a706e3752b12fd6c506e46faa4e4046fae5ce1

+ 3 - 2
src/main/resources/application.properties

@@ -4,9 +4,9 @@ server.port=31008
 #server.port=0
 #eureka.instance.instance-id=${spring.application.name}:${random.int}
 #eureka.instance.prefer-ip-address=true
-#spring.profiles.active=intranet
+spring.profiles.active=intranet
 
-spring.profiles.active=test
+#spring.profiles.active=test
 
 feign.hystrix.enabled=false
 feign.httpclient.enabled=false
@@ -49,6 +49,7 @@ isStartSendMq = false
 isStartMqListenter = false
 
 
+
 #小循环是否发送查询key
 isSmallStartSendMq = true
 #小循环是否开启查询消费者