mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
新增 充电订单电池算法报告实体类、Service
This commit is contained in:
@@ -9,7 +9,9 @@ import com.jsowell.common.core.domain.ykc.*;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
|
||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
||||
import com.jsowell.pile.service.ChargeAlgorithmRecordService;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import com.jsowell.pile.service.PileStationInfoService;
|
||||
@@ -52,6 +54,9 @@ public class ChargeAlgorithmService {
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private ChargeAlgorithmRecordService chargeAlgorithmRecordService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@@ -169,6 +174,18 @@ public class ChargeAlgorithmService {
|
||||
String response = HttpRequest.post(url).header("clientId", clientId).body(JSON.toJSONString(jsonObject)).execute().body();
|
||||
|
||||
log.info("发送请求收到回复 response:{}", response);
|
||||
// 将返回结果转化为json
|
||||
Map<String, Object> map = (Map<String, Object>) JSON.parse(response);
|
||||
String resultCode = String.valueOf(map.get("code"));
|
||||
if (StringUtils.equals("200", resultCode)) {
|
||||
// 请求成功,将数据报告保存到数据库
|
||||
ChargeAlgorithmRecord record = chargeAlgorithmRecordService.queryRecordByOrderCode(orderCode);
|
||||
if (record == null) {
|
||||
String jsonString = JSON.toJSONString(map.get("data"));
|
||||
record = JSON.parseObject(jsonString, ChargeAlgorithmRecord.class);
|
||||
chargeAlgorithmRecordService.insertChargeAlgorithmRecord(record);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user