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>
|
||||
|
||||
@ -30,247 +30,277 @@ public class PushServiceImpl implements PushService {
|
||||
private WxXrPemsOrderPushLogMapper wxXrPemsOrderPushLogMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject pushorder(int id) {
|
||||
JSONObject jsret = new JSONObject();
|
||||
jsret.put("returncode", 0);
|
||||
jsret.put("message", "");
|
||||
@Override
|
||||
public JSONObject pushorder(int id) {
|
||||
JSONObject jsret = new JSONObject();
|
||||
jsret.put("returncode", 0);
|
||||
jsret.put("message", "");
|
||||
|
||||
try {
|
||||
|
||||
WxXrPemsOrder wxXrPemsOrder = wxXrPemsOrderMapper.selectByPrimaryKey(id);
|
||||
log.info("{}", 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}
|
||||
|
||||
if (createorder.getInteger("returncode") != 2000) {
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", "调用接口生成订单失败");
|
||||
return jsret;
|
||||
}
|
||||
String orderId = createorder.getJSONObject("result").getString("orderid");
|
||||
List<WxSgPolluteSds> wxSgPolluteSdsList = new ArrayList<>();
|
||||
|
||||
List<WxXrPemsOrderResult.WxXrPemsOrderItemResult> wxXrPemsOrderItemResultList = new ArrayList<>();
|
||||
|
||||
//查询订单检测结果list
|
||||
|
||||
WxSgPolluteSdsExample example1 = new WxSgPolluteSdsExample();
|
||||
WxSgPolluteSdsExample.Criteria ca = example1.createCriteria();
|
||||
ca.andWxOrderIdEqualTo(id);
|
||||
wxSgPolluteSdsList = wxSgPolluteSdsMapper.selectByExample(example1);
|
||||
|
||||
|
||||
JSONObject pollutesave = pollutesave(wxXrPemsOrder, wxSgPolluteSdsList, orderId);
|
||||
Integer returncode = pollutesave.getInteger("returncode");
|
||||
if (returncode== 2000||returncode==3000) {
|
||||
jsret.put("returncode", 0);
|
||||
jsret.put("message", "调用接口保存成功xxx");
|
||||
return jsret;
|
||||
}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());
|
||||
WxXrPemsOrder wxXrPemsOrder = wxXrPemsOrderMapper.selectByPrimaryKey(id);
|
||||
try {
|
||||
if(wxXrPemsOrder.getSyncStatus()==1){
|
||||
log.info("之前已经通不过,其实无须再次同步,为防止极端情况,暂不做拦截,wxXrPemsOrder={}",wxXrPemsOrder);
|
||||
}else{
|
||||
|
||||
log.info("wxXrPemsOrder={}", wxXrPemsOrder);
|
||||
}
|
||||
|
||||
return jsret;
|
||||
}
|
||||
//调用生成订单接口,返回订单编号
|
||||
JSONObject createorder = createorder(wxXrPemsOrder);
|
||||
//{"extmessage":null,"message":"操作成功","result":{"brandimg":"https://api.mycar369.com/api/carimg/14.jpg","orderid":"2024101418552975925900036","sname":"思域","platenum":"京atest1"},"returncode":2000}
|
||||
|
||||
/**
|
||||
* 【第一步】:
|
||||
* https://api.mycar369.com/api/sg/createorder?mid=22&userid=36&vin=0000&platenum=%E4%BA%ACatest1&licensingtime=2022-10-14&mileage=10&drivinglicenseimgsrc=&carimgsrc=&modelid=135&brandid=14&linkname=lxr&phonenum=13126679999&engine_air_count=4&exhaustsystem=2&appid=LANBBXCXtest&os=xiaochengxu&version=1.1.2×tamp=1728900072&udid=000&noncestr=000&usid=36&_sign=77705A9803DCEBBD6006E07BF592882D
|
||||
* 发动机缸数
|
||||
* engine_air_count:4
|
||||
* 排气系统类型 1,单排 2,双排
|
||||
* exhaustsystem: 1 or 2
|
||||
* 维修门店id
|
||||
* mid:22
|
||||
* 操作用户id
|
||||
* usid:36 对应数据库里的用户id
|
||||
* userid:36 对应数据库里的用户id
|
||||
* 车系品牌id
|
||||
* modelid=135&brandid=14
|
||||
* <p>
|
||||
* 返回内容:
|
||||
* {"extmessage":null,"message":"操作成功","result":{"brandimg":"https://api.mycar369.com/api/carimg/14.jpg","orderid":"2024101418552975925900036","sname":"思域","platenum":"京atest1"},"returncode":2000}
|
||||
* returncode:2000 表示成功
|
||||
*
|
||||
* @param wxXrPemsOrder
|
||||
* @return
|
||||
*/
|
||||
public JSONObject createorder(WxXrPemsOrder wxXrPemsOrder) {
|
||||
JSONObject js = new JSONObject();
|
||||
Map<String, String> fields = new HashMap<>();
|
||||
String body = "";
|
||||
try {
|
||||
//测试时只能写固定值,防止数据投送到其他站点
|
||||
fields.put("mid", "22");
|
||||
fields.put("userid", "36");
|
||||
fields.put("usid", "36");
|
||||
if (createorder.getInteger("returncode") != 2000) {
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", "调用接口生成订单失败");
|
||||
updateOrderStatus(wxXrPemsOrder, jsret);
|
||||
return jsret;
|
||||
}
|
||||
String orderId = createorder.getJSONObject("result").getString("orderid");
|
||||
List<WxSgPolluteSds> wxSgPolluteSdsList = new ArrayList<>();
|
||||
|
||||
List<WxXrPemsOrderResult.WxXrPemsOrderItemResult> wxXrPemsOrderItemResultList = new ArrayList<>();
|
||||
|
||||
//查询订单检测结果list
|
||||
|
||||
WxSgPolluteSdsExample example1 = new WxSgPolluteSdsExample();
|
||||
WxSgPolluteSdsExample.Criteria ca = example1.createCriteria();
|
||||
ca.andWxOrderIdEqualTo(id);
|
||||
wxSgPolluteSdsList = wxSgPolluteSdsMapper.selectByExample(example1);
|
||||
|
||||
|
||||
JSONObject pollutesave = pollutesave(wxXrPemsOrder, wxSgPolluteSdsList, orderId);
|
||||
Integer returncode = pollutesave.getInteger("returncode");
|
||||
if (returncode == 2000 || returncode == 3000) {
|
||||
jsret.put("returncode", 0);
|
||||
jsret.put("message", "调用接口保存成功");
|
||||
|
||||
} else {
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", "调用接口保存订单失败");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("pushorder is error:{}", e);
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", e.getMessage());
|
||||
}
|
||||
updateOrderStatus(wxXrPemsOrder, 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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 【第一步】:
|
||||
* https://api.mycar369.com/api/sg/createorder?mid=22&userid=36&vin=0000&platenum=%E4%BA%ACatest1&licensingtime=2022-10-14&mileage=10&drivinglicenseimgsrc=&carimgsrc=&modelid=135&brandid=14&linkname=lxr&phonenum=13126679999&engine_air_count=4&exhaustsystem=2&appid=LANBBXCXtest&os=xiaochengxu&version=1.1.2×tamp=1728900072&udid=000&noncestr=000&usid=36&_sign=77705A9803DCEBBD6006E07BF592882D
|
||||
* 发动机缸数
|
||||
* engine_air_count:4
|
||||
* 排气系统类型 1,单排 2,双排
|
||||
* exhaustsystem: 1 or 2
|
||||
* 维修门店id
|
||||
* mid:22
|
||||
* 操作用户id
|
||||
* usid:36 对应数据库里的用户id
|
||||
* userid:36 对应数据库里的用户id
|
||||
* 车系品牌id
|
||||
* modelid=135&brandid=14
|
||||
* <p>
|
||||
* 返回内容:
|
||||
* {"extmessage":null,"message":"操作成功","result":{"brandimg":"https://api.mycar369.com/api/carimg/14.jpg","orderid":"2024101418552975925900036","sname":"思域","platenum":"京atest1"},"returncode":2000}
|
||||
* returncode:2000 表示成功
|
||||
*
|
||||
* @param wxXrPemsOrder
|
||||
* @return
|
||||
*/
|
||||
public JSONObject createorder(WxXrPemsOrder wxXrPemsOrder) {
|
||||
JSONObject js = new JSONObject();
|
||||
Map<String, String> fields = new HashMap<>();
|
||||
String body = "";
|
||||
try {
|
||||
//测试时只能写固定值,防止数据投送到其他站点
|
||||
fields.put("mid", "22");
|
||||
fields.put("userid", "36");
|
||||
fields.put("usid", "36");
|
||||
|
||||
// fields.put("mid", wxXrPemsOrder.getMid()+"");
|
||||
// fields.put("userid", wxXrPemsOrder.getOrderuserid()+"");
|
||||
// fields.put("usid", wxXrPemsOrder.getOrderuserid()+"");
|
||||
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("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("linkname", wxXrPemsOrder.getLinkname() == null ? "" : wxXrPemsOrder.getLinkname());
|
||||
fields.put("phonenum", wxXrPemsOrder.getLinktel() == null ? "" : wxXrPemsOrder.getLinktel());
|
||||
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("udid", "000");
|
||||
fields.put("noncestr", "000");
|
||||
fields.put("_sign", "77705A9803DCEBBD6006E07BF592882D");
|
||||
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("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("linkname", wxXrPemsOrder.getLinkname() == null ? "" : wxXrPemsOrder.getLinkname());
|
||||
fields.put("phonenum", wxXrPemsOrder.getLinktel() == null ? "" : wxXrPemsOrder.getLinktel());
|
||||
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("udid", "000");
|
||||
fields.put("noncestr", "000");
|
||||
fields.put("_sign", "77705A9803DCEBBD6006E07BF592882D");
|
||||
|
||||
String url = "https://api.mycar369.com/api/sg/createorder?";
|
||||
body = HttpUtil.sendGetRequest(url, fields);
|
||||
String url = "https://api.mycar369.com/api/sg/createorder?";
|
||||
body = HttpUtil.sendGetRequest(url, fields);
|
||||
|
||||
// String url = "https://api.mycar369.com/api/sg/createorder?mid=22&userid=36&vin=0000&platenum=%E4%BA%ACatest1&licensingtime=2022-10-14&mileage=10&drivinglicenseimgsrc=&carimgsrc=&modelid=135&brandid=14&linkname=lxr&phonenum=13126679999&engine_air_count=4&exhaustsystem=2&appid=LANBBXCXtest&os=xiaochengxu&version=1.1.2×tamp=1728900072&udid=000&noncestr=000&usid=36&_sign=77705A9803DCEBBD6006E07BF592882D";
|
||||
// body = HttpUtil.sendGetRequest(url);
|
||||
|
||||
js = JSONObject.parseObject(body);
|
||||
js = JSONObject.parseObject(body);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("createorder is error:{}", e);
|
||||
js.put("returncode", -1);
|
||||
js.put("message", "请求数据报错");
|
||||
} finally {
|
||||
WxXrPemsOrderPushLog record = new WxXrPemsOrderPushLog();
|
||||
record.setOrderno(wxXrPemsOrder.getOrderno());
|
||||
record.setWeixiuorderno("");
|
||||
record.setRequestparam(fields.toString());
|
||||
record.setResponse(body.length() > 1000 ? body.substring(0, 1000) : body);
|
||||
record.setStep(1);
|
||||
|
||||
if (js.containsKey("returncode")) {
|
||||
record.setStatus(js.getInteger("returncode"));
|
||||
} else {
|
||||
record.setStatus(-1);
|
||||
}
|
||||
wxXrPemsOrderPushLogMapper.insert(record);
|
||||
}
|
||||
|
||||
return js;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第二步】:
|
||||
* https://api.mycar369.com/api/sg/pollutesave?ordernum=2024101418552975925900036&categroy=2&jystco=0&jysthc=0&jystnox=0&cohigh1=1&hchigh=2&lambdahigh1=3&colow1=0&hclow1=0&lambdalow1=0&appid=LANBB00M&os=android-11-M2011K2C&version=1.1.2×tamp=1728900609&udid=a97c068f-0ba3-3f3b-a25e-172087d538e2&noncestr=3PbaRn&usid=36&_sign=8F016C479C2D69561AE541A0A26C98C7
|
||||
* <p>
|
||||
* 第一步得到的订单id
|
||||
* ordernum:2024101418552975925900036
|
||||
* 污染数据-高怠速
|
||||
* categroy=2
|
||||
* 污染数据 cohigh1=1&hchigh=2&lambdahigh1=3 其它污染数据填0
|
||||
* 污染数据-低怠速
|
||||
* categroy=3
|
||||
* 污染数据 colow1=20&hclow1=20&lambdalow1=20 其它污染数据填0
|
||||
* 返回内容:
|
||||
* {"extmessage":null,"message":"操作成功","result":{"code":"0","message":"添加成功"},"returncode":2000}
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public JSONObject pollutesave(WxXrPemsOrder wxXrPemsOrder, List<WxSgPolluteSds> wxSgPolluteSdsList, String orderId) {
|
||||
JSONObject js = new JSONObject();
|
||||
js.put("returncode", -1);
|
||||
String body = "";
|
||||
Map<String, String> fields = new HashMap<>();
|
||||
try {
|
||||
for (WxSgPolluteSds wxSgPolluteSds : wxSgPolluteSdsList) {
|
||||
String url = "https://api.mycar369.com/api/sg/pollutesave?";
|
||||
fields = new HashMap<>();
|
||||
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("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("lambdahigh1", "0");
|
||||
fields.put("cohigh1", "0");
|
||||
fields.put("hchigh", "0");
|
||||
}
|
||||
fields.put("jystco", "0");
|
||||
fields.put("jysthc", "0");
|
||||
fields.put("jystnox", "0");
|
||||
|
||||
fields.put("appid", "LANBBXCXtest");
|
||||
fields.put("os", "xiaochengxu");
|
||||
fields.put("version", "1.1.2");
|
||||
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);
|
||||
|
||||
try {
|
||||
js = JSONObject.parseObject(body);
|
||||
} catch (Exception e) {
|
||||
log.error("返回结果非json body={}", body);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("createorder is error:{}", e);
|
||||
js.put("returncode", -1);
|
||||
js.put("message", "请求数据报错");
|
||||
} finally {
|
||||
WxXrPemsOrderPushLog record = new WxXrPemsOrderPushLog();
|
||||
record.setOrderno(wxXrPemsOrder.getOrderno());
|
||||
record.setWeixiuorderno("");
|
||||
record.setRequestparam(fields.toString());
|
||||
record.setResponse(body.length() > 1000 ? body.substring(0, 1000) : body);
|
||||
record.setStep(1);
|
||||
record.setResponse(body.length() > 1000 ? body.substring(1, 1000) : body);
|
||||
record.setStep(2);
|
||||
savelog(record, js);
|
||||
|
||||
if (js.containsKey("returncode")) {
|
||||
record.setStatus(js.getInteger("returncode"));
|
||||
} else {
|
||||
record.setStatus(-1);
|
||||
}
|
||||
wxXrPemsOrderPushLogMapper.insert(record);
|
||||
}
|
||||
|
||||
return js;
|
||||
} catch (Exception e) {
|
||||
log.error("pollutesave is error:{}", e);
|
||||
js.put("returncode", -1);
|
||||
js.put("message", "请求数据报错");
|
||||
}
|
||||
return js;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第二步】:
|
||||
* https://api.mycar369.com/api/sg/pollutesave?ordernum=2024101418552975925900036&categroy=2&jystco=0&jysthc=0&jystnox=0&cohigh1=1&hchigh=2&lambdahigh1=3&colow1=0&hclow1=0&lambdalow1=0&appid=LANBB00M&os=android-11-M2011K2C&version=1.1.2×tamp=1728900609&udid=a97c068f-0ba3-3f3b-a25e-172087d538e2&noncestr=3PbaRn&usid=36&_sign=8F016C479C2D69561AE541A0A26C98C7
|
||||
* <p>
|
||||
* 第一步得到的订单id
|
||||
* ordernum:2024101418552975925900036
|
||||
* 污染数据-高怠速
|
||||
* categroy=2
|
||||
* 污染数据 cohigh1=1&hchigh=2&lambdahigh1=3 其它污染数据填0
|
||||
* 污染数据-低怠速
|
||||
* categroy=3
|
||||
* 污染数据 colow1=20&hclow1=20&lambdalow1=20 其它污染数据填0
|
||||
* 返回内容:
|
||||
* {"extmessage":null,"message":"操作成功","result":{"code":"0","message":"添加成功"},"returncode":2000}
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public JSONObject pollutesave(WxXrPemsOrder wxXrPemsOrder, List<WxSgPolluteSds> wxSgPolluteSdsList, String orderId) {
|
||||
JSONObject js = new JSONObject();
|
||||
js.put("returncode",-1);
|
||||
String body = "";
|
||||
Map<String, String> fields = new HashMap<>();
|
||||
try {
|
||||
for (WxSgPolluteSds wxSgPolluteSds : wxSgPolluteSdsList) {
|
||||
String url = "https://api.mycar369.com/api/sg/pollutesave?";
|
||||
fields = new HashMap<>();
|
||||
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("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("lambdahigh1", "0");
|
||||
fields.put("cohigh1", "0");
|
||||
fields.put("hchigh", "0");
|
||||
}
|
||||
fields.put("jystco", "0");
|
||||
fields.put("jysthc", "0");
|
||||
fields.put("jystnox", "0");
|
||||
|
||||
fields.put("appid", "LANBBXCXtest");
|
||||
fields.put("os", "xiaochengxu");
|
||||
fields.put("version", "1.1.2");
|
||||
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);
|
||||
|
||||
try{
|
||||
js = JSONObject.parseObject(body);
|
||||
}catch (Exception e){
|
||||
log.error("返回结果非json body={}",body);
|
||||
}
|
||||
|
||||
WxXrPemsOrderPushLog record = new WxXrPemsOrderPushLog();
|
||||
record.setOrderno(wxXrPemsOrder.getOrderno());
|
||||
record.setWeixiuorderno("");
|
||||
record.setRequestparam(fields.toString());
|
||||
record.setResponse(body.length() > 1000 ? body.substring(1, 1000) : body);
|
||||
record.setStep(2);
|
||||
savelog(record, js);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("pollutesave is error:{}", e);
|
||||
js.put("returncode", -1);
|
||||
js.put("message", "请求数据报错");
|
||||
}
|
||||
return js;
|
||||
}
|
||||
|
||||
public void savelog(WxXrPemsOrderPushLog record, JSONObject js) {
|
||||
try {
|
||||
if (js.containsKey("returncode")) {
|
||||
record.setStatus(js.getInteger("returncode"));
|
||||
} else {
|
||||
record.setStatus(-1);
|
||||
}
|
||||
record.setCreateTime(new Date());
|
||||
record.setUpdateTime(new Date());
|
||||
wxXrPemsOrderPushLogMapper.insert(record);
|
||||
} catch (Exception e) {
|
||||
log.error("insert log error:{}", e);
|
||||
public void savelog(WxXrPemsOrderPushLog record, JSONObject js) {
|
||||
try {
|
||||
if (js.containsKey("returncode")) {
|
||||
record.setStatus(js.getInteger("returncode"));
|
||||
} else {
|
||||
record.setStatus(-1);
|
||||
}
|
||||
record.setCreateTime(new Date());
|
||||
record.setUpdateTime(new Date());
|
||||
wxXrPemsOrderPushLogMapper.insert(record);
|
||||
} catch (Exception e) {
|
||||
log.error("insert log error:{}", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user