|
@@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.picc.grab.crawl.*;
|
|
import com.picc.grab.crawl.*;
|
|
|
|
|
+import com.picc.grab.domain.Zbwt;
|
|
|
|
|
+import com.picc.grab.entity.ZbwtVo;
|
|
|
import com.picc.grab.entity.common.vo.ResultVO;
|
|
import com.picc.grab.entity.common.vo.ResultVO;
|
|
|
import com.picc.grab.mapper.ZbwtMapper;
|
|
import com.picc.grab.mapper.ZbwtMapper;
|
|
|
import com.picc.grab.service.ICarinfoService;
|
|
import com.picc.grab.service.ICarinfoService;
|
|
@@ -51,6 +53,11 @@ public class SuccessfulTask {
|
|
|
@Transactional
|
|
@Transactional
|
|
|
@Scheduled(cron = "0 */10 * * * ?")
|
|
@Scheduled(cron = "0 */10 * * * ?")
|
|
|
public void syncInfo() throws Exception {
|
|
public void syncInfo() throws Exception {
|
|
|
|
|
+ //查询需要同步中标信息的车
|
|
|
|
|
+ List<ZbwtVo> zbwtList = zbwtMapper.findByTime();
|
|
|
|
|
+ if (CollectionUtils.isEmpty(zbwtList)){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
//入参
|
|
//入参
|
|
|
OfferPlatFromBody body = new OfferPlatFromBody();
|
|
OfferPlatFromBody body = new OfferPlatFromBody();
|
|
|
body.setAuctionStatus("02");
|
|
body.setAuctionStatus("02");
|
|
@@ -58,38 +65,54 @@ public class SuccessfulTask {
|
|
|
body.setStartTime(DateUtil.format(cn.hutool.core.date.DateUtil.lastMonth(), "yyyy-MM-dd"));
|
|
body.setStartTime(DateUtil.format(cn.hutool.core.date.DateUtil.lastMonth(), "yyyy-MM-dd"));
|
|
|
body.setEndTime(DateUtil.format(cn.hutool.core.date.DateUtil.tomorrow(), "yyyy-MM-dd"));
|
|
body.setEndTime(DateUtil.format(cn.hutool.core.date.DateUtil.tomorrow(), "yyyy-MM-dd"));
|
|
|
List<String> tokens = piccgrabaccountService.findTokenByLogIn();
|
|
List<String> tokens = piccgrabaccountService.findTokenByLogIn();
|
|
|
|
|
+ if (CollectionUtils.isEmpty(tokens)){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(tokens)) {
|
|
|
|
|
- for (String token : tokens) {
|
|
|
|
|
- // 获取报价完成列表的车辆
|
|
|
|
|
- OfferPlatformBean platFromBean = getPlatFromBean(token, body);
|
|
|
|
|
- for (OfferPlatformBean.BbpAuctionSelectVo car : platFromBean.getData().getBbpAuctionSelectVoList()) {
|
|
|
|
|
- //查询车辆详情
|
|
|
|
|
- try {
|
|
|
|
|
- BbpDetailBean detailBean = getBbpDetail(token, new BbpDetailBody(car.getId()));
|
|
|
|
|
- if (!Objects.isNull(detailBean)) {
|
|
|
|
|
- String zbgzstatus = "3";
|
|
|
|
|
- if (StringUtils.isNotBlank(detailBean.getData().getBbpWonBidVo().getBidCompanyName())
|
|
|
|
|
- && detailBean.getData().getBbpWonBidVo().getBidCompanyName().contains("湖北同凯拍卖有限公司")){
|
|
|
|
|
- zbgzstatus = "4";
|
|
|
|
|
- }
|
|
|
|
|
- List<String> carids = piccgrabaccountService.getCarIds(car.getCarNo());
|
|
|
|
|
- //修改车辆中标信息
|
|
|
|
|
- for (String carid : carids) {
|
|
|
|
|
- zbwtMapper.updateZbwt(zbgzstatus,carid
|
|
|
|
|
- ,detailBean.getData().getBbpWonBidVo().getBidCompanyName()
|
|
|
|
|
- ,detailBean.getData().getBbpWonBidVo().getCreateTime()
|
|
|
|
|
- ,detailBean.getData().getBbpWonBidVo().getBidPrice());
|
|
|
|
|
- log.info("定时任务--同步车辆中标信息,车辆id:"+carid);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
|
+ for (String token : tokens) {
|
|
|
|
|
+ // 获取报价完成列表的车辆
|
|
|
|
|
+ OfferPlatformBean platFromBean;
|
|
|
|
|
+ try {
|
|
|
|
|
+ platFromBean = getPlatFromBean(token, body);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ // list转为map key为车牌号
|
|
|
|
|
+ Map<String, OfferPlatformBean.BbpAuctionSelectVo> map = platFromBean.getData().getBbpAuctionSelectVoList()
|
|
|
|
|
+ .stream().collect(Collectors.toMap(OfferPlatformBean.BbpAuctionSelectVo::getCarNo, Function.identity(), (item1, item2) -> item1));
|
|
|
|
|
+ for (ZbwtVo zbwt : zbwtList) {
|
|
|
|
|
+ //根据车牌号获取报价完成的车辆信息
|
|
|
|
|
+ OfferPlatformBean.BbpAuctionSelectVo auctionSelectVo = map.get(zbwt.getCph());
|
|
|
|
|
+ if (Objects.isNull(auctionSelectVo)){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ //获取车辆详情
|
|
|
|
|
+ BbpDetailBean detailBean = getBbpDetail(token, new BbpDetailBody(auctionSelectVo.getId()));
|
|
|
|
|
+ if (Objects.isNull(detailBean.getData())) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
+ //同步中标信息
|
|
|
|
|
+ if (!Objects.isNull(detailBean.getData().getBbpWonBidVo())) {
|
|
|
|
|
+ String zbgzstatus = "3";
|
|
|
|
|
+ if (StringUtils.isNotBlank(detailBean.getData().getBbpWonBidVo().getBidCompanyName())
|
|
|
|
|
+ && detailBean.getData().getBbpWonBidVo().getBidCompanyName().contains("湖北同凯拍卖有限公司")){
|
|
|
|
|
+ zbgzstatus = "4";
|
|
|
|
|
+ }
|
|
|
|
|
+ zbwtMapper.updateZbwt(zbgzstatus,zbwt.getCarid()
|
|
|
|
|
+ ,detailBean.getData().getBbpWonBidVo().getBidCompanyName()
|
|
|
|
|
+ ,detailBean.getData().getBbpWonBidVo().getCreateTime()
|
|
|
|
|
+ ,detailBean.getData().getBbpWonBidVo().getBidPrice());
|
|
|
|
|
+ log.info("定时任务--同步车辆中标信息,车辆id:"+zbwt.getCarid());
|
|
|
|
|
+ }
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|