You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
172 lines
9.6 KiB
172 lines
9.6 KiB
package com.hai.schedule;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.hai.common.exception.ErrorCode;
|
|
import com.hai.common.exception.ErrorHelp;
|
|
import com.hai.common.exception.SysCode;
|
|
import com.hai.config.TuanYouConfig;
|
|
import com.hai.entity.HighGasOilPrice;
|
|
import com.hai.entity.HighMerchantStore;
|
|
import com.hai.enum_type.GasOilPriceStatusEnum;
|
|
import com.hai.model.HighMerchantModel;
|
|
import com.hai.model.HighMerchantStoreModel;
|
|
import com.hai.service.*;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.Date;
|
|
|
|
@Configuration
|
|
public class HighGasSchedule {
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(HighGasSchedule.class);
|
|
|
|
@Resource
|
|
private HighMerchantService highMerchantService;
|
|
|
|
@Resource
|
|
private HighMerchantStoreService highMerchantStoreService;
|
|
|
|
@Resource
|
|
private HighGasOilPriceService highGasOilPriceService;
|
|
|
|
@Resource
|
|
private HighGasService gasService;
|
|
|
|
// @Scheduled(cron = "0 0 1 * * ?") //每日凌晨1点执行一次
|
|
// public void certification() throws Exception {
|
|
// HighMerchantModel merchant = highMerchantService.getMerchantById(63L);
|
|
// if (merchant == null) {
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户");
|
|
// }
|
|
// JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000);
|
|
// JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class);
|
|
//
|
|
// for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue();i++) {
|
|
// JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000);
|
|
// JSONObject resultObject = jsonObject.getObject("result", JSONObject.class);
|
|
// JSONArray jsonArray = resultObject.getJSONArray("gasInfoList");
|
|
// HighMerchantStore highMerchantStore;
|
|
// HighGasOilPrice highGasOilPrice;
|
|
// for (Object gasObject : jsonArray) {
|
|
// JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject));
|
|
// HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId"));
|
|
// if (store != null) {
|
|
// store.setType(1);
|
|
// store.setSourceType(2);
|
|
// store.setMerchantId(merchant.getId());
|
|
// store.setCompanyId(merchant.getCompanyId());
|
|
// store.setStoreKey(object.getString("gasId"));
|
|
// store.setStoreName(object.getString("gasName"));
|
|
// store.setStoreLogo(object.getString("gasLogoSmall"));
|
|
// store.setRegionId(object.getLong("provinceCode"));
|
|
// store.setRegionName(object.getString("provinceName"));
|
|
// store.setAddress(object.getString("gasAddress"));
|
|
// store.setLongitude(object.getString("gasAddressLongitude"));
|
|
// store.setLatitude(object.getString("gasAddressLatitude"));
|
|
// store.setStatus(object.getInteger("gasStatus"));
|
|
// store.setPrestoreType(0);
|
|
// store.setOperatorId(0L);
|
|
// store.setOperatorName("系统创建");
|
|
// store.setUpdateTime(new Date());
|
|
// store.setExt1(object.getString("gasSourceId"));
|
|
// highMerchantStoreService.updateMerchantStoreDetail(store);
|
|
//
|
|
// JSONArray oilPriceList = object.getJSONArray("oilPriceList");
|
|
// for (Object oilPrice : oilPriceList) {
|
|
// JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice));
|
|
// // 查询门店油号
|
|
// highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getString("oilNo"));
|
|
// if (highGasOilPrice == null) {
|
|
// highGasOilPrice = new HighGasOilPrice();
|
|
// highGasOilPrice.setMerchantStoreId(store.getId());
|
|
// highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo"));
|
|
// highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName"));
|
|
// highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip"));
|
|
// highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun"));
|
|
// highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial"));
|
|
// highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType"));
|
|
// highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName"));
|
|
// highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus());
|
|
// } else {
|
|
// highGasOilPrice.setMerchantStoreId(store.getId());
|
|
// highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo"));
|
|
// highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName"));
|
|
// highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip"));
|
|
// highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun"));
|
|
// highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial"));
|
|
// highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType"));
|
|
// highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName"));
|
|
// }
|
|
// highGasOilPriceService.editGasOilPrice(highGasOilPrice);
|
|
// }
|
|
// } else {
|
|
// highMerchantStore = new HighMerchantStore();
|
|
// highMerchantStore.setType(1);
|
|
// highMerchantStore.setSourceType(2);
|
|
// highMerchantStore.setMerchantId(merchant.getId());
|
|
// highMerchantStore.setCompanyId(merchant.getCompanyId());
|
|
// highMerchantStore.setStoreKey(object.getString("jyzid"));
|
|
// highMerchantStore.setStoreName(object.getString("mingcheng"));
|
|
// highMerchantStore.setStoreLogo(object.getString("tupian"));
|
|
// highMerchantStore.setRegionName(object.getString("province"));
|
|
// highMerchantStore.setAddress(object.getString("dizhi"));
|
|
// highMerchantStore.setLongitude(object.getString("gasAddressLongitude"));
|
|
// highMerchantStore.setLatitude(object.getString("gasAddressLatitude"));
|
|
// highMerchantStore.setStatus(1);
|
|
// highMerchantStore.setPrestoreType(0);
|
|
// highMerchantStore.setOperatorId(0L);
|
|
// highMerchantStore.setOperatorName("系统创建");
|
|
// highMerchantStore.setCreateTime(new Date());
|
|
// highMerchantStore.setUpdateTime(new Date());
|
|
// highMerchantStore.setExt1(object.getString("gasSourceId"));
|
|
// HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel();
|
|
// BeanUtils.copyProperties(highMerchantStore, merchantStoreModel);
|
|
// highMerchantStoreService.insertMerchantStore(merchantStoreModel);
|
|
//
|
|
// JSONArray oilPriceList = object.getJSONArray("oilPriceList");
|
|
// for (Object oilPrice : oilPriceList) {
|
|
// JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice));
|
|
// highGasOilPrice = new HighGasOilPrice();
|
|
// highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId());
|
|
// highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo"));
|
|
// highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName"));
|
|
// highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip"));
|
|
// highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun"));
|
|
// highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial"));
|
|
// highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType"));
|
|
// highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName"));
|
|
// highGasOilPriceService.editGasOilPrice(highGasOilPrice);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
@Scheduled(cron = "5 0 0 * * ?") // 每日凌晨00:00:5执行一次
|
|
public void getJiaHaoYouAllStation() throws Exception {
|
|
gasService.getJiaHaoYouAllStation();
|
|
}
|
|
|
|
// @Scheduled(cron = "5 0 0 * * ?") // 每日凌晨00:00:5执行一次
|
|
// public void getPayloAllStation() throws Exception {
|
|
// gasService.getPayloAllStation();
|
|
// }
|
|
|
|
// @Scheduled(cron = "5 0 0 * * ?") // 每日凌晨00:00:5执行一次
|
|
// public void getDianAllStation() throws Exception {
|
|
// gasService.getDianAllStation();
|
|
// }
|
|
|
|
@Scheduled(cron = "7 0 0 * * ?") // 每日凌晨00:00:7执行一次
|
|
public void deleteOilNo() {
|
|
gasService.deleteOilNo();
|
|
}
|
|
|
|
|
|
}
|
|
|