wan shan
This commit is contained in:
parent
3fbf6fc170
commit
5276ca8248
@ -22,6 +22,6 @@ public class AppRunnerController implements ApplicationRunner {
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
|
||||
// 启动后初始化参数表信息
|
||||
msgService.addinfo();
|
||||
// msgService.addinfo();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
package com.weiqi.mis.contorller;
|
||||
|
||||
import com.weiqi.mis.MsgService;
|
||||
import com.weiqi.mis.PushService;
|
||||
import com.weiqi.vo.OrderInfoVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* 下发查询
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "api/aync")
|
||||
@Slf4j
|
||||
public class CarApiController {
|
||||
|
||||
@Autowired
|
||||
PushService pushService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取同步
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/order")
|
||||
@ResponseBody
|
||||
public Object sync(int id) {
|
||||
|
||||
log.info("id= {}", id);
|
||||
return pushService.pushorder(id);
|
||||
}
|
||||
|
||||
}
|
||||
28
car-mis/src/main/resources/application-prod.properties
Normal file
28
car-mis/src/main/resources/application-prod.properties
Normal file
@ -0,0 +1,28 @@
|
||||
###\u7AEF\u53E3\u914D\u7F6E
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
|
||||
spring.datasource.url=jdbc:mysql://cfo.mycar369.com:3306/wx_weiqi?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useSSL=false
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=autoHOME2022!!!!mysql
|
||||
|
||||
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.initialSize=1
|
||||
spring.datasource.minIdle=1
|
||||
spring.datasource.maxActive=20
|
||||
spring.datasource.dbcp2.max-open-prepared-statements=20
|
||||
spring.datasource.maxWait=60000
|
||||
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||
spring.datasource.minEvictableIdleTimeMillis=300000
|
||||
spring.datasource.testWhileIdle=true
|
||||
spring.datasource.testOnBorrow=false
|
||||
spring.datasource.testOnReturn=false
|
||||
spring.datasource.poolPreparedStatements=false
|
||||
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
|
||||
spring.datasource.hikari.validation-timeout=900000
|
||||
spring.datasource.filters=stat,wall,log4j
|
||||
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=50
|
||||
|
||||
logging.config=classpath:logback-prod.xml
|
||||
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
####\u7AEF\u53E3\u914D\u7F6E
|
||||
#spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
#
|
||||
##
|
||||
##spring.datasource.url=jdbc:mysql://feed-4000-tidb.yz.weiqi.com.cn:4000/smsdb?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||
#spring.datasource.url=jdbc:mysql://sms-master-4000.tidb.db.corpweiqi.com:4000/smsdb?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useSSL=false
|
||||
#spring.datasource.username=smsdb_wr
|
||||
#spring.datasource.password=ULZahlCFfI9Tt5qk
|
||||
#
|
||||
##\u4E3A\u4E86\u4F7F\u7528tiflash\u5148\u4F7F\u7528\u5ECA\u574A\u673A\u623F
|
||||
##spring.datasource.url=jdbc:mysql://sms-slave-4000.tidb.db.corpweiqi.com:4000/smsdb?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&useServerPrepStmts=true&allowMultiQueries=true
|
||||
##spring.datasource.username=smsdb_wr
|
||||
##spring.datasource.password=ULZahlCFfI9Tt5qk
|
||||
#
|
||||
#spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
#spring.datasource.initialSize=1
|
||||
#spring.datasource.minIdle=1
|
||||
#spring.datasource.maxActive=20
|
||||
#spring.datasource.dbcp2.max-open-prepared-statements=20
|
||||
#spring.datasource.maxWait=60000
|
||||
#spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||
#spring.datasource.minEvictableIdleTimeMillis=300000
|
||||
#spring.datasource.testWhileIdle=true
|
||||
#spring.datasource.testOnBorrow=false
|
||||
#spring.datasource.testOnReturn=false
|
||||
#spring.datasource.poolPreparedStatements=false
|
||||
#spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
|
||||
#spring.datasource.hikari.validation-timeout=900000
|
||||
#spring.datasource.filters=stat,wall,log4j
|
||||
#spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=50
|
||||
#
|
||||
#logging.config=classpath:logback-prod.xml
|
||||
#
|
||||
#
|
||||
#spring.redis.database=0
|
||||
#spring.redis.host=jiage-sms-kafka.redis.cache.corpweiqi.com
|
||||
#spring.redis.port=20061
|
||||
#spring.redis.password=9FL4a*g4Ai
|
||||
##spring.redis.host=10.231.61.40
|
||||
##spring.redis.port=6379
|
||||
##spring.redis.password=9FL4a*g4Ai
|
||||
#spring.redis.jedis.pool.max-active=1024
|
||||
#spring.redis.jedis.pool.max-idle=500
|
||||
#spring.redis.jedis.pool.min-idle=100
|
||||
#spring.redis.block-when-exhausted=true
|
||||
#
|
||||
##\u9001\u8FBE\u7387\u4F4E\u4E8E90%\u62A5\u8B66
|
||||
#send.rate.alarm.phoneno=18801217561,18975045528,16601102415,13180180070,13581608179
|
||||
## xxl-job??
|
||||
#xxl.job.enable=true
|
||||
#xxl.job.admin.addresses=http://uag-job.corpweiqi.com/xxl-job-admin
|
||||
#xxl.job.executor.appname=sms-mis
|
||||
#xxl.job.executor.port=7999
|
||||
#xxl.job.executor.logpath=/data/jiage-sms-mis/log
|
||||
#xxl.job.executor.logretentiondays=30
|
||||
#xxl.job.accessToken=xMrVFjivwewvVriOeikYJFJIpUEktBGWrZMrBkhSXJS
|
||||
#xxl.job.executor.bindip=
|
||||
@ -1,6 +1,6 @@
|
||||
<configuration>
|
||||
|
||||
<property name="LOG_HOME" value="/data/jiage-sms-mis/log/jiage-sms-mis_8089"/>
|
||||
<property name="LOG_HOME" value="/data/log/carmis"/>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>[%thread] %d{MM-dd HH:mm:ss} %-5level %-4relative %logger{50} - %msg%n
|
||||
@ -73,18 +73,6 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- MQ日志 -->
|
||||
<!-- <appender name="mq" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>/home/centos/logs/ownerprice_pc/ donkey-mq.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>/home/centos/logs/ownerprice_pc/ donkey-mq.log.%d{yyyy-MM-dd}</fileNamePattern>
|
||||
<maxHistory>20</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>[%thread] %d{MM-dd HH:mm:ss} %-5level %-4relative %logger{0} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>-->
|
||||
|
||||
<!-- SlowSQL -->
|
||||
<appender name="slowSql" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/slowSql.log</file>
|
||||
|
||||
@ -36,10 +36,15 @@ public class PushServiceImpl implements PushService {
|
||||
jsret.put("returncode", 0);
|
||||
jsret.put("message", "");
|
||||
|
||||
try {
|
||||
|
||||
WxXrPemsOrder wxXrPemsOrder = wxXrPemsOrderMapper.selectByPrimaryKey(id);
|
||||
log.info("{}", wxXrPemsOrder);
|
||||
try {
|
||||
if(wxXrPemsOrder.getSyncStatus()==1){
|
||||
log.info("之前已经通不过,其实无须再次同步,为防止极端情况,暂不做拦截,wxXrPemsOrder={}",wxXrPemsOrder);
|
||||
}else{
|
||||
|
||||
log.info("wxXrPemsOrder={}", wxXrPemsOrder);
|
||||
}
|
||||
|
||||
//调用生成订单接口,返回订单编号
|
||||
JSONObject createorder = createorder(wxXrPemsOrder);
|
||||
//{"extmessage":null,"message":"操作成功","result":{"brandimg":"https://api.mycar369.com/api/carimg/14.jpg","orderid":"2024101418552975925900036","sname":"思域","platenum":"京atest1"},"returncode":2000}
|
||||
@ -47,6 +52,7 @@ public class PushServiceImpl implements PushService {
|
||||
if (createorder.getInteger("returncode") != 2000) {
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", "调用接口生成订单失败");
|
||||
updateOrderStatus(wxXrPemsOrder, jsret);
|
||||
return jsret;
|
||||
}
|
||||
String orderId = createorder.getJSONObject("result").getString("orderid");
|
||||
@ -64,25 +70,49 @@ public class PushServiceImpl implements PushService {
|
||||
|
||||
JSONObject pollutesave = pollutesave(wxXrPemsOrder, wxSgPolluteSdsList, orderId);
|
||||
Integer returncode = pollutesave.getInteger("returncode");
|
||||
if (returncode== 2000||returncode==3000) {
|
||||
if (returncode == 2000 || returncode == 3000) {
|
||||
jsret.put("returncode", 0);
|
||||
jsret.put("message", "调用接口保存成功xxx");
|
||||
return jsret;
|
||||
}else{
|
||||
jsret.put("message", "调用接口保存成功");
|
||||
|
||||
} else {
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", "调用接口保存订单失败");
|
||||
return jsret;
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("pushorder is error:{}", e);
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", e.getMessage());
|
||||
|
||||
}
|
||||
updateOrderStatus(wxXrPemsOrder, jsret);
|
||||
return jsret;
|
||||
}
|
||||
|
||||
return jsret;
|
||||
/**
|
||||
* 更新状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int updateOrderStatus(WxXrPemsOrder wxXrPemsOrder, JSONObject jsret) {
|
||||
int ret = 0;
|
||||
|
||||
try {
|
||||
int returncode = jsret.getIntValue("returncode");
|
||||
String message = jsret.getString("message");
|
||||
if (returncode == 0) {
|
||||
wxXrPemsOrder.setSyncStatus(1);
|
||||
} else {
|
||||
wxXrPemsOrder.setSyncStatus(2);
|
||||
}
|
||||
wxXrPemsOrder.setSyncResponse(message);
|
||||
|
||||
ret = wxXrPemsOrderMapper.updateByPrimaryKeySelective(wxXrPemsOrder);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新订单状态失败,{}", e);
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,21 +153,21 @@ public class PushServiceImpl implements PushService {
|
||||
fields.put("vin", wxXrPemsOrder.getVin());
|
||||
fields.put("platenum", wxXrPemsOrder.getPlatenumber());
|
||||
fields.put("licensingtime", DateHelper.serialize(wxXrPemsOrder.getAdmissiontime(), DateHelper.DATEFORMAT_ONLY_DATE));
|
||||
fields.put("mileage", wxXrPemsOrder.getKilometers().intValue()+"");
|
||||
fields.put("mileage", wxXrPemsOrder.getKilometers().intValue() + "");
|
||||
fields.put("drivinglicenseimgsrc", wxXrPemsOrder.getDrivinglicensesrc() == null ? "" : wxXrPemsOrder.getDrivinglicensesrc());
|
||||
fields.put("carimgsrc", wxXrPemsOrder.getVehiclesrc() == null ? "" : wxXrPemsOrder.getVehiclesrc());
|
||||
fields.put("modelid", wxXrPemsOrder.getSeriesid() == null ? "" : wxXrPemsOrder.getSeriesid()+"");
|
||||
fields.put("brandid", wxXrPemsOrder.getBrandid() == null ? "" : wxXrPemsOrder.getBrandid()+"");
|
||||
fields.put("modelid", wxXrPemsOrder.getSeriesid() == null ? "" : wxXrPemsOrder.getSeriesid() + "");
|
||||
fields.put("brandid", wxXrPemsOrder.getBrandid() == null ? "" : wxXrPemsOrder.getBrandid() + "");
|
||||
fields.put("linkname", wxXrPemsOrder.getLinkname() == null ? "" : wxXrPemsOrder.getLinkname());
|
||||
fields.put("phonenum", wxXrPemsOrder.getLinktel() == null ? "" : wxXrPemsOrder.getLinktel());
|
||||
fields.put("engine_air_count", wxXrPemsOrder.getEnginestructurenumber()+"");
|
||||
fields.put("engine_air_count", wxXrPemsOrder.getEnginestructurenumber() + "");
|
||||
// 排气系统类型 1,单排 2,双排 这个对应表中哪个字段,是排期构造? exhau
|
||||
fields.put("exhaustsystem", "1");
|
||||
// fields.put("exhaustsystem", wxXrPemsOrder.getExhauststructure());
|
||||
fields.put("appid", "LANBBXCXtest");
|
||||
fields.put("os", "xiaochengxu");
|
||||
fields.put("version", "1.1.2");
|
||||
fields.put("timestamp", (System.currentTimeMillis() / 1000)+"");
|
||||
fields.put("timestamp", (System.currentTimeMillis() / 1000) + "");
|
||||
fields.put("udid", "000");
|
||||
fields.put("noncestr", "000");
|
||||
fields.put("_sign", "77705A9803DCEBBD6006E07BF592882D");
|
||||
@ -193,7 +223,7 @@ public class PushServiceImpl implements PushService {
|
||||
*/
|
||||
public JSONObject pollutesave(WxXrPemsOrder wxXrPemsOrder, List<WxSgPolluteSds> wxSgPolluteSdsList, String orderId) {
|
||||
JSONObject js = new JSONObject();
|
||||
js.put("returncode",-1);
|
||||
js.put("returncode", -1);
|
||||
String body = "";
|
||||
Map<String, String> fields = new HashMap<>();
|
||||
try {
|
||||
@ -203,18 +233,18 @@ public class PushServiceImpl implements PushService {
|
||||
fields.put("ordernum", orderId);
|
||||
//高怠速
|
||||
if (wxSgPolluteSds.getCategory() == 2) {
|
||||
fields.put("categroy", wxSgPolluteSds.getCategory()+"");
|
||||
fields.put("cohigh1", wxSgPolluteSds.getCo()+"");
|
||||
fields.put("hchigh", wxSgPolluteSds.getHc()+"");
|
||||
fields.put("lambdahigh1", wxSgPolluteSds.getLambda()+"");
|
||||
fields.put("categroy", wxSgPolluteSds.getCategory() + "");
|
||||
fields.put("cohigh1", wxSgPolluteSds.getCo() + "");
|
||||
fields.put("hchigh", wxSgPolluteSds.getHc() + "");
|
||||
fields.put("lambdahigh1", wxSgPolluteSds.getLambda() + "");
|
||||
fields.put("lambdalow1", "0");
|
||||
fields.put("colow1", "0");
|
||||
fields.put("hclow1", "0");
|
||||
} else {
|
||||
fields.put("categroy", "1");
|
||||
fields.put("colow1", wxSgPolluteSds.getCo()+"");
|
||||
fields.put("hclow1", wxSgPolluteSds.getHc()+"");
|
||||
fields.put("lambdalow1", wxSgPolluteSds.getLambda()+"");
|
||||
fields.put("colow1", wxSgPolluteSds.getCo() + "");
|
||||
fields.put("hclow1", wxSgPolluteSds.getHc() + "");
|
||||
fields.put("lambdalow1", wxSgPolluteSds.getLambda() + "");
|
||||
fields.put("lambdahigh1", "0");
|
||||
fields.put("cohigh1", "0");
|
||||
fields.put("hchigh", "0");
|
||||
@ -226,18 +256,18 @@ public class PushServiceImpl implements PushService {
|
||||
fields.put("appid", "LANBBXCXtest");
|
||||
fields.put("os", "xiaochengxu");
|
||||
fields.put("version", "1.1.2");
|
||||
fields.put("timestamp", (System.currentTimeMillis()/1000)+"");
|
||||
fields.put("timestamp", (System.currentTimeMillis() / 1000) + "");
|
||||
fields.put("udid", "000");
|
||||
fields.put("noncestr", "000");
|
||||
fields.put("usid", "36");//TODO之后需要修改
|
||||
// fields.put("usid", wxXrPemsOrder.getOrderuserid()+"");
|
||||
fields.put("_sign", "77705A9803DCEBBD6006E07BF592882D");
|
||||
body= HttpUtil.sendGetRequest(url, fields);
|
||||
body = HttpUtil.sendGetRequest(url, fields);
|
||||
|
||||
try{
|
||||
try {
|
||||
js = JSONObject.parseObject(body);
|
||||
}catch (Exception e){
|
||||
log.error("返回结果非json body={}",body);
|
||||
} catch (Exception e) {
|
||||
log.error("返回结果非json body={}", body);
|
||||
}
|
||||
|
||||
WxXrPemsOrderPushLog record = new WxXrPemsOrderPushLog();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user