新增 充电订单电池算法报告实体类、Service

This commit is contained in:
Lemon
2025-04-12 15:39:23 +08:00
parent 4fe641de1b
commit ef596a6fc7
6 changed files with 588 additions and 0 deletions

View File

@@ -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;
}