From 7126f1a0982d09101895af6c38691f47ff84b59f Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期三, 16 七月 2025 20:21:31 +0800 Subject: [PATCH] Merge branch 'dev' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile into dev --- ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/util/GovernmentCloudTask.java | 376 ++++++++++++++++++++++++++++++++--------------------- 1 files changed, 225 insertions(+), 151 deletions(-) diff --git a/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/util/GovernmentCloudTask.java b/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/util/GovernmentCloudTask.java index 923ce2e..ffadd44 100644 --- a/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/util/GovernmentCloudTask.java +++ b/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/util/GovernmentCloudTask.java @@ -1,4 +1,10 @@ package com.ruoyi.jianguan.util; +import com.ruoyi.account.api.factory.JianGuanAccountFallbackFactory; +import com.ruoyi.account.api.feignClient.JianGuanAccountClient; +import com.ruoyi.system.api.domain.SysRole; +import com.ruoyi.system.api.domain.SysLoginLog; +import com.ruoyi.system.api.domain.SysOperLog; +import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.other.api.domain.TEnterpriseUserApplication; import com.ruoyi.other.api.domain.THtml; @@ -65,7 +71,6 @@ import com.ruoyi.account.api.model.TAppUserIntegralChange; import com.ruoyi.account.api.model.TAppUserTag; -import com.ruoyi.account.api.feignClient.JianGuanAccountClient; import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; import com.ruoyi.chargingPile.api.feignClient.JianGuanChargingPileClient; import com.ruoyi.chargingPile.api.model.TChargingPile; @@ -75,6 +80,9 @@ import com.ruoyi.order.api.vo.GovernmentCloudOrderVO; import com.ruoyi.other.api.feignClient.JianGuanOtherClient; import com.ruoyi.other.api.vo.GovernmentCloudOtherVO; +import com.ruoyi.system.api.feignClient.JianGuanSystemClient; +import com.ruoyi.system.api.vo.GovernmentCloudSystemVO; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -88,6 +96,7 @@ * @date 2023/7/11 8:39 */ @Component +@Slf4j public class GovernmentCloudTask { @@ -265,354 +274,419 @@ private JianGuanOrderClient jianGuanOrderClient; @Resource private JianGuanOtherClient jianGuanOtherClient; + @Resource + private JianGuanSystemClient jianGuanSystemClient; - // 每天早上9点执行的定时任务 - @Scheduled(cron = "0 0 9 * * ?") + // 每天下午3点执行的定时任务 + @Scheduled(fixedRate = 86400000) public void taskMonth() { + log.info("市政云传数据"); // account服务 GovernmentCloudAccountVO data = jianGuanAccountClient.listAll().getData(); if (data != null) { + log.info("Account"); + List<TAppCoupon> appCoupons = data.getAppCoupons(); if (!appCoupons.isEmpty()) { - appCouponService.saveBatch(appCoupons); + log.info("用户优惠券"+appCoupons.size()); + // 将id 设置为null + appCouponService.saveOrUpdateBatch(appCoupons); } List<TAppUser> appUsers = data.getAppUsers(); if (!appUsers.isEmpty()) { - appUserService.saveBatch(appUsers); + log.info("用户"+appUsers.size()); + + appUserService.saveOrUpdateBatch(appUsers); } List<TAppUserAddress> appUserAddresses = data.getAppUserAddresses(); if (!appUserAddresses.isEmpty()) { - appUserAddressService.saveBatch(appUserAddresses); + log.info("用户地址"+appUserAddresses.size()); + + appUserAddressService.saveOrUpdateBatch(appUserAddresses); } List<TAppUserCar> appUserCars = data.getAppUserCars(); if (!appUserCars.isEmpty()) { - appUserCarService.saveBatch(appUserCars); + log.info("用户车辆"+appUserCars.size()); + appUserCarService.saveOrUpdateBatch(appUserCars); } List<TAppUserIntegralChange> appUserIntegralChanges = data.getAppUserIntegralChanges(); if (!appUserIntegralChanges.isEmpty()) { - appUserIntegralChangeService.saveBatch(appUserIntegralChanges); + log.info("用户积分变动"+appUserIntegralChanges.size()); + + appUserIntegralChangeService.saveOrUpdateBatch(appUserIntegralChanges); } List<TAppUserSign> appUserSigns = data.getAppUserSigns(); if (!appUserSigns.isEmpty()) { - appUserSignService.saveBatch(appUserSigns); + log.info("用户签到"+appUserSigns.size()); + + appUserSignService.saveOrUpdateBatch(appUserSigns); } List<TAppUserTag> appUserTags = data.getAppUserTags(); if (!appUserTags.isEmpty()) { - appUserTagService.saveBatch(appUserTags); + log.info("用户标签"+appUserTags.size()); + + appUserTagService.saveOrUpdateBatch(appUserTags); } List<TAppUserVipDetail> appUserVipDetails = data.getAppUserVipDetails(); if (!appUserVipDetails.isEmpty()) { - appUserVipDetailService.saveBatch(appUserVipDetails); + log.info("用户会员明细"+appUserVipDetails.size()); + + appUserVipDetailService.saveOrUpdateBatch(appUserVipDetails); } List<TInviteUser> inviteUsers = data.getInviteUsers(); if (!inviteUsers.isEmpty()) { - inviteUserService.saveBatch(inviteUsers); + log.info("邀请用户"+inviteUsers.size()); + + inviteUserService.saveOrUpdateBatch(inviteUsers); } List<TInvoiceInformation> invoiceInformations = data.getInvoiceInformations(); if (!invoiceInformations.isEmpty()) { - tInvoiceInformationService.saveBatch(invoiceInformations); + log.info("开票"+invoiceInformations.size()); + + tInvoiceInformationService.saveOrUpdateBatch(invoiceInformations); } } // chargingPile服务 GovernmentCloudChargingPileVO data1 = jianGuanChargingPileClient.listAll().getData(); if (data1 != null) { + log.info("chargingPile服务"); + List<Partner> partners = data1.getPartners(); if (!partners.isEmpty()) { - partnerService.saveBatch(partners); + log.info("合作商"+partners.size()); + + partnerService.saveOrUpdateBatch(partners); } List<Site> sites = data1.getSites(); if (!sites.isEmpty()) { - siteService.saveBatch(sites); + log.info("站点"+sites.size()); + + siteService.saveOrUpdateBatch(sites); } List<TAccountingStrategy> accountingStrategies = data1.getAccountingStrategies(); if (!accountingStrategies.isEmpty()) { - accountingStrategyService.saveBatch(accountingStrategies); + log.info("策略"+accountingStrategies.size()); + + accountingStrategyService.saveOrUpdateBatch(accountingStrategies); } List<TAccountingStrategyDetail> accountingStrategyDetails = data1.getAccountingStrategyDetails(); if (!accountingStrategyDetails.isEmpty()) { - accountingStrategyDetailService.saveBatch(accountingStrategyDetails); + log.info("策略明细"+accountingStrategyDetails.size()); + + accountingStrategyDetailService.saveOrUpdateBatch(accountingStrategyDetails); } List<TApplyChargingPile> applyChargingPiles = data1.getApplyChargingPiles(); if (!applyChargingPiles.isEmpty()) { - applyChargingPileService.saveBatch(applyChargingPiles); + log.info("申请充电桩"+applyChargingPiles.size()); + + applyChargingPileService.saveOrUpdateBatch(applyChargingPiles); } List<TCarport> carports = data1.getCarports(); if (!carports.isEmpty()) { - carportService.saveBatch(carports); + log.info("停车场"+carports.size()); + + carportService.saveOrUpdateBatch(carports); } List<TChargingGun> chargingGuns = data1.getChargingGuns(); if (!chargingGuns.isEmpty()) { - chargingGunService.saveBatch(chargingGuns); + log.info("充电枪"+chargingGuns.size()); + + chargingGunService.saveOrUpdateBatch(chargingGuns); } List<TChargingPile> chargingPiles = data1.getChargingPiles(); if (!chargingPiles.isEmpty()) { - chargingPileService.saveBatch(chargingPiles); + log.info("充电桩"+chargingPiles.size()); + + chargingPileService.saveOrUpdateBatch(chargingPiles); } List<TChargingPileNotification> chargingPileNotifications = data1.getChargingPileNotifications(); if (!chargingPileNotifications.isEmpty()) { - chargingPileNotificationService.saveBatch(chargingPileNotifications); + log.info("通知"+chargingPileNotifications.size()); + + chargingPileNotificationService.saveOrUpdateBatch(chargingPileNotifications); } List<TFaultMessage> faultMessages = data1.getFaultMessages(); if (!faultMessages.isEmpty()) { - faultMessageService.saveBatch(faultMessages); + log.info("故障"+faultMessages.size()); + + faultMessageService.saveOrUpdateBatch(faultMessages); } List<TMonitoringEquipment> monitoringEquipments = data1.getMonitoringEquipments(); if (!monitoringEquipments.isEmpty()) { - monitoringEquipmentService.saveBatch(monitoringEquipments); + log.info("监控设备"+monitoringEquipments.size()); + + monitoringEquipmentService.saveOrUpdateBatch(monitoringEquipments); } List<TParkingLot> parkingLots = data1.getParkingLots(); if (!parkingLots.isEmpty()) { - parkingLotService.saveBatch(parkingLots); + log.info("停车场"+parkingLots.size()); + + parkingLotService.saveOrUpdateBatch(parkingLots); } List<TParkingRecord> parkingRecords = data1.getParkingRecords(); if (!parkingRecords.isEmpty()) { - parkingRecordService.saveBatch(parkingRecords); + log.info("停车记录"+parkingRecords.size()); + + parkingRecordService.saveOrUpdateBatch(parkingRecords); } // List<TPartnerSite> partnerSites = data1.getPartnerSites(); // if (!partnerSites.isEmpty()) { -// partnerSiteService.saveBatch(partnerSites); +// partnerSiteService.saveOrUpdateBatch(partnerSites); // } List<TRepair> repairs = data1.getRepairs(); if (!repairs.isEmpty()) { - repairService.saveBatch(repairs); + log.info("报修"+repairs.size()); + + repairService.saveOrUpdateBatch(repairs); } // List<TSiteMenu> siteMenus = data1.getSiteMenus(); // if (!siteMenus.isEmpty()) { -// siteMenuService.saveBatch(siteMenus); +// siteMenuService.saveOrUpdateBatch(siteMenus); // } List<TVehicleRamp> vehicleRamps = data1.getVehicleRamps(); if (!vehicleRamps.isEmpty()) { - vehicleRampService.saveBatch(vehicleRamps); + log.info("车道"+vehicleRamps.size()); + + vehicleRampService.saveOrUpdateBatch(vehicleRamps); } } //order服务 GovernmentCloudOrderVO data2 = jianGuanOrderClient.listAll().getData(); - - if (data2 != null) { + log.info("Order服务"); List<AccountingStrategyDetailOrder> accountingStrategyDetailOrders = data2.getAccountingStrategyDetailOrders(); if (!accountingStrategyDetailOrders.isEmpty()) { - accountingStrategyDetailOrderService.saveBatch(accountingStrategyDetailOrders); + log.info("订单明细策略"+accountingStrategyDetailOrders.size()); + + accountingStrategyDetailOrderService.saveOrUpdateBatch(accountingStrategyDetailOrders); } List<AccountingStrategyOrder> accountingStrategyOrders = data2.getAccountingStrategyOrders(); if (!accountingStrategyOrders.isEmpty()) { - accountingStrategyOrderService.saveBatch(accountingStrategyOrders); + log.info("订单策略"+accountingStrategyOrders.size()); + + accountingStrategyOrderService.saveOrUpdateBatch(accountingStrategyOrders); } List<TChargingBill> chargingBills = data2.getChargingBills(); if (!chargingBills.isEmpty()) { - chargingBillService.saveBatch(chargingBills); + log.info("账单"+chargingBills.size()); + + chargingBillService.saveOrUpdateBatch(chargingBills); } List<TChargingOrder> chargingOrders = data2.getChargingOrders(); if (!chargingOrders.isEmpty()) { - chargingOrderService.saveBatch(chargingOrders); + log.info("充电订单"+chargingOrders.size()); + + chargingOrderService.saveOrUpdateBatch(chargingOrders); } List<TChargingOrderAccountingStrategy> chargingOrderAccountingStrategies = data2.getChargingOrderAccountingStrategies(); if (!chargingOrderAccountingStrategies.isEmpty()) { - chargingOrderAccountingStrategyService.saveBatch(chargingOrderAccountingStrategies); + log.info("充电订单策略"+chargingOrderAccountingStrategies.size()); + + chargingOrderAccountingStrategyService.saveOrUpdateBatch(chargingOrderAccountingStrategies); } List<TChargingOrderRefund> chargingOrderRefunds = data2.getChargingOrderRefunds(); if (!chargingOrderRefunds.isEmpty()) { - chargingOrderRefundService.saveBatch(chargingOrderRefunds); + log.info("充电订单退款"+chargingOrderRefunds.size()); + + chargingOrderRefundService.saveOrUpdateBatch(chargingOrderRefunds); } List<TExchangeOrder> exchangeOrders = data2.getExchangeOrders(); if (!exchangeOrders.isEmpty()) { - exchangeOrderService.saveBatch(exchangeOrders); + log.info("兑换订单"+exchangeOrders.size()); + + exchangeOrderService.saveOrUpdateBatch(exchangeOrders); } List<TGrantVip> grantVips = data2.getGrantVips(); if (!grantVips.isEmpty()) { - grantVipService.saveBatch(grantVips); + log.info("赠送vip"+grantVips.size()); + + grantVipService.saveOrUpdateBatch(grantVips); } List<TOrderAppeal> orderAppeals = data2.getOrderAppeals(); if (!orderAppeals.isEmpty()) { - orderAppealService.saveBatch(orderAppeals); + log.info("订单申诉"+orderAppeals.size()); + + orderAppealService.saveOrUpdateBatch(orderAppeals); } List<TOrderEvaluate> orderEvaluates = data2.getOrderEvaluates(); if (!orderEvaluates.isEmpty()) { - orderEvaluateService.saveBatch(orderEvaluates); + log.info("订单评价"+orderEvaluates.size()); + + orderEvaluateService.saveOrUpdateBatch(orderEvaluates); } List<TOrderEvaluateTag> orderEvaluateTags = data2.getOrderEvaluateTags(); if (!orderEvaluateTags.isEmpty()) { - orderEvaluateTagService.saveBatch(orderEvaluateTags); + log.info("订单评价标签"+orderEvaluateTags.size()); + + orderEvaluateTagService.saveOrUpdateBatch(orderEvaluateTags); } List<TOrderInvoice> orderInvoices = data2.getOrderInvoices(); if (!orderInvoices.isEmpty()) { - orderInvoiceService.saveBatch(orderInvoices); + log.info("订单开票"+orderInvoices.size()); + + orderInvoiceService.saveOrUpdateBatch(orderInvoices); } List<TOrderInvoiceDetail> orderInvoiceDetails = data2.getOrderInvoiceDetails(); if (!orderInvoiceDetails.isEmpty()) { - orderInvoiceDetailService.saveBatch(orderInvoiceDetails); + log.info("订单开票明细"+orderInvoiceDetails.size()); + + orderInvoiceDetailService.saveOrUpdateBatch(orderInvoiceDetails); } List<TSettlementConfirm> settlementConfirms = data2.getSettlementConfirms(); if (!settlementConfirms.isEmpty()) { - settlementConfirmService.saveBatch(settlementConfirms); + log.info("账单结算"+settlementConfirms.size()); + + settlementConfirmService.saveOrUpdateBatch(settlementConfirms); } List<TShoppingOrder> shoppingOrders = data2.getShoppingOrders(); if (!shoppingOrders.isEmpty()) { - shoppingOrderService.saveBatch(shoppingOrders); + log.info("购物订单"+shoppingOrders.size()); + + shoppingOrderService.saveOrUpdateBatch(shoppingOrders); } List<TShoppingOrderRefund> shoppingOrderRefunds = data2.getShoppingOrderRefunds(); if (!shoppingOrderRefunds.isEmpty()) { - shoppingOrderRefundService.saveBatch(shoppingOrderRefunds); + log.info("购物订单退款"+shoppingOrderRefunds.size()); + + shoppingOrderRefundService.saveOrUpdateBatch(shoppingOrderRefunds); } List<TVipOrder> vipOrders = data2.getVipOrders(); if (!vipOrders.isEmpty()) { - vipOrderService.saveBatch(vipOrders); + log.info("会员订单"+vipOrders.size()); + + vipOrderService.saveOrUpdateBatch(vipOrders); } List<TVipOrderRefund> vipOrderRefunds = data2.getVipOrderRefunds(); if (!vipOrderRefunds.isEmpty()) { - vipOrderRefundService.saveBatch(vipOrderRefunds); + log.info("会员订单退款"+vipOrderRefunds); + + vipOrderRefundService.saveOrUpdateBatch(vipOrderRefunds); } } // other服务 GovernmentCloudOtherVO data3 = jianGuanOtherClient.listAll().getData(); - - if (data3 != null) { + log.info("other服务"); + List<Operator> operators = data3.getOperators(); if (!operators.isEmpty()) { - try { - operatorService.saveBatch(operators); - }catch (Exception e){ - } + log.info("运营商"+operators.size()); + + operatorService.saveOrUpdateBatch(operators); } List<TActivity> activities = data3.getActivities(); if (!activities.isEmpty()) { - activityService.saveBatch(activities); + log.info("活动"+activities.size()); + + activityService.saveOrUpdateBatch(activities); } List<TAdvertising> advertisings = data3.getAdvertisings(); if (!advertisings.isEmpty()) { - advertisingService.saveBatch(advertisings); + log.info("广告"+advertisings.size()); + + advertisingService.saveOrUpdateBatch(advertisings); } List<TCompany> companies = data3.getCompanies(); if (!companies.isEmpty()) { - companyService.saveBatch(companies); + log.info("公司"+companies.size()); + + companyService.saveOrUpdateBatch(companies); } List<TCoupon> coupons = data3.getCoupons(); if (!coupons.isEmpty()) { - couponService.saveBatch(coupons); + log.info("优惠券"+coupons.size()); + + couponService.saveOrUpdateBatch(coupons); } List<TEnterpriseUserApplication> enterpriseUserApplications = data3.getEnterpriseUserApplications(); if (!enterpriseUserApplications.isEmpty()) { - enterpriseUserApplicationService.saveBatch(enterpriseUserApplications); + log.info("公司申请"+enterpriseUserApplications.size()); + + enterpriseUserApplicationService.saveOrUpdateBatch(enterpriseUserApplications); } List<TEvaluationTag> evaluationTags = data3.getEvaluationTags(); if (!evaluationTags.isEmpty()) { - evaluationTagService.saveBatch(evaluationTags); + log.info("评价标签"+evaluationTags.size()); + + evaluationTagService.saveOrUpdateBatch(evaluationTags); } List<TGoods> goods = data3.getGoods(); if (!goods.isEmpty()) { - goodsService.saveBatch(goods); + log.info("商品"+goods.size()); + + goodsService.saveOrUpdateBatch(goods); } List<THtml> htmls = data3.getHtmls(); if (!htmls.isEmpty()) { - htmlService.saveBatch(htmls); + log.info("html"+htmls.size()); + + htmlService.saveOrUpdateBatch(htmls); } List<TIntegralRule> integralRules = data3.getIntegralRules(); if (!integralRules.isEmpty()) { - integralRuleService.saveBatch(integralRules); + log.info("积分规则"+integralRules.size()); + + integralRuleService.saveOrUpdateBatch(integralRules); } List<TInvoiceType> invoiceTypes = data3.getInvoiceTypes(); if (!invoiceTypes.isEmpty()) { - invoiceTypeService.saveBatch(invoiceTypes); + log.info("开票类型"+invoiceTypes.size()); + + invoiceTypeService.saveOrUpdateBatch(invoiceTypes); } List<TNotice> notices = data3.getNotices(); if (!notices.isEmpty()) { - noticeService.saveBatch(notices); + log.info("通知"+notices.size()); + + noticeService.saveOrUpdateBatch(notices); } List<TSystemConfiguration> systemConfigurations = data3.getSystemConfigurations(); if (!systemConfigurations.isEmpty()) { - systemConfigurationService.saveBatch(systemConfigurations); + log.info("系统设置"+systemConfigurations.size()); + + systemConfigurationService.saveOrUpdateBatch(systemConfigurations); } List<TUserTag> userTags = data3.getUserTags(); if (!userTags.isEmpty()) { - userTagService.saveBatch(userTags); + log.info("用户标签"+userTags.size()); + + userTagService.saveOrUpdateBatch(userTags); } List<TVip> vips = data3.getVips(); if (!vips.isEmpty()) { - vipService.saveBatch(vips); + log.info("会员"+vips.size()); + + vipService.saveOrUpdateBatch(vips); } } -// accountingStrategyDetailOrderService -// accountingStrategyOrderService -// genTableColumnService -// genTableService -// partnerService -// regionService -// siteService -// sysConfigService -// deptService -// sysDictDataService -// sysDictTypeService -// sysLoginLogService -// sysMenuService -// sysNoticeService -// sysOperLogService -// sysPermissionService -// sysPostService -// sysRoleService -// sysUserOnlineService -// sysUserRoleService -// sysUserService -// operatorService -// accountingStrategyDetailService -// accountingStrategyService -// activityService -// advertisingService -// appCouponService -// applyChargingPileService -// appUserAddressService -// appUserCarService -// appUserIntegralChangeService -// appUserService -// appUserSignService -// appUserTagService -// appUserVipDetailService -// carportService -// chargingBillService -// chargingGunService -// chargingOrderAccountingStrategyService -// chargingOrderRefundService -// chargingOrderService -// chargingPileNotificationService -// chargingPileService -// companyService -// couponService -// enterpriseUserApplicationService -// evaluationTagService -// exchangeOrderService -// faultMessageService -// goodsService -// grantVipService -// htmlService -// integralRuleService -// inviteUserService -// tInvoiceInformationService -// invoiceTypeService -// monitoringEquipmentService -// noticeService -// orderAppealService -// orderEvaluateService -// orderEvaluateTagService -// orderInvoiceDetailService -// orderInvoiceService -// parkingLotService -// parkingRecordService -// partnerSiteService -// repairService -// roleSiteService -// settlementConfirmService -// shoppingOrderRefundService -// shoppingOrderService -// siteMenuService -// systemConfigurationService -// userSiteService -// userTagService -// vehicleRampService -// vipOrderRefundService -// vipOrderService -// vipService + GovernmentCloudSystemVO data4 = jianGuanSystemClient.listAll().getData(); + if (data4 != null) { + log.info("System服务"); + List<SysLoginLog> loginLogs = data4.getLoginLogs(); + if (!loginLogs.isEmpty()) { + log.info("登录日志"+loginLogs.size()); + + sysLoginLogService.saveOrUpdateBatch(loginLogs); + } + List<SysOperLog> sysOperLogs = data4.getSysOperLogs(); + if (!sysOperLogs.isEmpty()) { + log.info("操作日志"+sysOperLogs.size()); + + sysOperLogService.saveOrUpdateBatch(sysOperLogs); + } + List<SysRole> sysRoles = data4.getSysRoles(); + if (!sysRoles.isEmpty()) { + log.info("角色"+sysRoles.size()); + + sysRoleService.saveOrUpdateBatch(sysRoles); + } + List<SysUser> sysUsers = data4.getSysUsers(); + if (!sysUsers.isEmpty()) { + log.info("系统用户"+sysUsers.size()); + + sysUserService.saveOrUpdateBatch(sysUsers); + } + } } - - } -- Gitblit v1.7.1