gr_bi_fs_business_sum,

gr_bi_fs_sum,
gr_bi_ps_saleprod 数据同步定时任务
This commit is contained in:
shih
2026-04-27 14:31:18 +08:00
parent 0e6454dddd
commit ca563ca462
15 changed files with 605 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
package com.lideeyunji.core.framework.config.job;
import com.lideeyunji.core.framework.service.IGrBiFsBusinessSumService;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import com.lideeyunji.tool.framework.quartz.core.handler.JobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
*
* oracle gr_bi_fs_business_sum -> mysql gr_bi_fs_business_sum
*/
@Slf4j
@Component("generateFsBusinessSumJob")
public class GenerateFsBusinessSumJob implements JobHandler {
@Resource
private IGrBiFsBusinessSumService giBiFsBusinessSumService;
@Override
public String execute(String param) throws Exception {
log.info("*********** 开始同步gr_bi_fs_business_sum ************");
giBiFsBusinessSumService.GenerateFsBusinessSum(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
log.info("*********** 同步gr_bi_fs_business_sum完成 ************");
return "*********** 同步gr_bi_fs_business_sum完成 ************";
}
}

View File

@@ -0,0 +1,29 @@
package com.lideeyunji.core.framework.config.job;
import com.lideeyunji.core.framework.service.IGrBiFsSumService;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import com.lideeyunji.tool.framework.quartz.core.handler.JobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
*
* oracle gr_bi_fs_sum -> mysql gr_bi_fs_sum
*/
@Slf4j
@Component("generateFsSumJob")
public class GenerateFsSumJob implements JobHandler {
@Resource
private IGrBiFsSumService grBiFsSumService;
@Override
public String execute(String param) throws Exception {
log.info("*********** 开始同步gr_bi_fs_sum ************");
grBiFsSumService.generateFsSum(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
log.info("*********** 同步gr_bi_fs_sum完成 ************");
return "*********** 同步gr_bi_fs_sum完成 ************";
}
}

View File

@@ -0,0 +1,29 @@
package com.lideeyunji.core.framework.config.job;
import com.lideeyunji.core.framework.service.IGrBiPsSaleprodService;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import com.lideeyunji.tool.framework.quartz.core.handler.JobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
*
* oracle gr_bi_ps_saleprod -> mysql gr_bi_ps_saleprod
*/
@Slf4j
@Component("generatePsSaleprodJob")
public class GeneratePsSaleprodJob implements JobHandler {
@Resource
private IGrBiPsSaleprodService grBiPsSaleprodService;
@Override
public String execute(String param) throws Exception {
log.info("*********** 开始同步gr_bi_ps_saleprod ************");
grBiPsSaleprodService.generatePsSaleprod(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
log.info("*********** 同步gr_bi_ps_saleprod完成 ************");
return "*********** 同步gr_bi_ps_saleprod完成 ************";
}
}

View File

@@ -0,0 +1,84 @@
package com.lideeyunji.core.framework.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@TableName("gr_bi_fs_business_sum")
@Data
public class GrBiFsBusinessSum implements Serializable {
private static final long serialVersionUID = 1L;
@TableField(value = "ID")
private Integer id;
@TableField(value = "USEYEAR")
private Integer useyear;
@TableField(value = "USEMONTH")
private Integer usemonth;
@TableField(value = "THISPSRATE")
private Double thispsrate;
@TableField(value = "LASTPSRATE")
private Double lastpsrate;
@TableField(value = "THISQTYRATE")
private Double thisqtyrate;
@TableField(value = "LASTQTYRATE")
private Double lastqtyrate;
@TableField(value = "THISCYCLE")
private Double thiscycle;
@TableField(value = "LASTCYCLE")
private Double lastcycle;
@TableField(value = "MONTHPROFITRATE")
private Double monthprofitrate;
@TableField(value = "THISPROFITRATE")
private Double thisprofitrate;
@TableField(value = "LASTPROFITRATE")
private Double lastprofitrate;
@TableField(value = "MONTHINCOME")
private Double monthincome;
@TableField(value = "THISINCOME")
private Double thisincome;
@TableField(value = "LASTINCOME")
private Double lastincome;
@TableField(value = "MONTHPROFIT")
private Double monthprofit;
@TableField(value = "THISPROFIT")
private Double thisprofit;
@TableField(value = "LASTPROFIT")
private Double lastprofit;
@TableField(value = "THISASSETS")
private Double thisassets;
@TableField(value = "LASTASSETS")
private Double lastassets;
@TableField(value = "THISLIAB")
private Double thisliab;
@TableField(value = "LASTLIAB")
private Double lastliab;
@TableField(value = "THISDEBTRATIO")
private Double thisdebtratio;
@TableField(value = "LASTDEBTRATIO")
private Double lastdebtratio;
}

View File

@@ -0,0 +1,58 @@
package com.lideeyunji.core.framework.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@TableName("gr_bi_fs_sum")
@Data
public class GrBiFsSum implements Serializable {
private static final long serialVersionUID = 1L;
@TableField(value = "ID")
private String id;
@TableField(value = "USEYEAR")
private String useyear;
@TableField(value = "USEMONTH")
private String usemonth;
@TableField(value = "DEFAULTFLAG")
private String defaultflag;
@TableField(value = "MONTHSAMONEY")
private String monthsamoney;
@TableField(value = "THISSAMONEY")
private String thissamoney;
@TableField(value = "LASTSAMONEY")
private String lastsamoney;
@TableField(value = "YOYSAMONEY")
private String yoysamoney;
@TableField(value = "MONTHPROFIT")
private String monthprofit;
@TableField(value = "THISPROFIT")
private String thisprofit;
@TableField(value = "LASTPROFIT")
private String lastprofit;
@TableField(value = "YOYPROFIT")
private String yoyprofit;
@TableField(value = "THISREMMONEY")
private String thisremmoney;
@TableField(value = "THISPSRATE")
private String thispsrate;
@TableField(value = "THISQTYRATE")
private String thisqtyrate;
}

View File

@@ -0,0 +1,163 @@
package com.lideeyunji.core.framework.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@TableName("gr_bi_ps_saleprod")
@Data
public class GrBiPsSaleprod implements Serializable {
private static final long serialVersionUID = 1L;
@TableField(value = "USEYEAR")
private String useyear;
@TableField(value = "USEMONTH")
private String usemonth;
@TableField(value = "GOODSID")
private String goodsid;
@TableField(value = "GOODSNAME")
private String goodsname;
@TableField(value = "GOODSTYPE")
private String goodstype;
@TableField(value = "GOODSUNIT")
private String goodsunit;
@TableField(value = "GOODSCLASSID")
private String goodsclassid;
@TableField(value = "GOODSCLASSNAME")
private String goodsclassname;
@TableField(value = "MONTHSAQTY")
private String monthsaqty;
@TableField(value = "THISSAQTY")
private String thissaqty;
@TableField(value = "LASTSAQTY")
private String lastsaqty;
@TableField(value = "THISPRQTY")
private String thisprqty;
@TableField(value = "LASTPRQTY")
private String lastprqty;
@TableField(value = "THISPSRATE")
private String thispsrate;
@TableField(value = "LASTPSRATE")
private String lastpsrate;
@TableField(value = "THISREMQTY")
private String thisremqty;
@TableField(value = "LASTREMQTY")
private String lastremqty;
@TableField(value = "THISQTYRATE")
private String thisqtyrate;
@TableField(value = "LASTQTYRATE")
private String lastqtyrate;
@TableField(value = "MONTHSAMONEY")
private String monthsamoney;
@TableField(value = "THISSAMONEY")
private String thissamoney;
@TableField(value = "LASTSAMONEY")
private String lastsamoney;
@TableField(value = "MONTHPROFIT")
private String monthprofit;
@TableField(value = "THISPROFIT")
private String thisprofit;
@TableField(value = "LASTPROFIT")
private String lastprofit;
@TableField(value = "MONTHCOST")
private String monthcost;
@TableField(value = "THISCOST")
private String thiscost;
@TableField(value = "LASTCOST")
private String lastcost;
@TableField(value = "ID")
private String id;
@TableField(value = "MONTHPRQTY")
private String monthprqty;
@TableField(value = "MONTHPRMONEY")
private String monthprmoney;
@TableField(value = "THISPRMONEY")
private String thisprmoney;
@TableField(value = "LASTPRMONEY")
private String lastprmoney;
@TableField(value = "MONTHPRCOST")
private String monthprcost;
@TableField(value = "THISPRCOST")
private String thisprcost;
@TableField(value = "LASTPRCOST")
private String lastprcost;
@TableField(value = "THISREMMONEY")
private String thisremmoney;
@TableField(value = "LASTREMMONEY")
private String lastremmoney;
@TableField(value = "MONTHPROFITRATE")
private String monthprofitrate;
@TableField(value = "THISPROFITRATE")
private String thisprofitrate;
@TableField(value = "LASTPROFITRATE")
private String lastprofitrate;
@TableField(value = "MONTHSAMONEYSHARE")
private String monthsamoneyshare;
@TableField(value = "THISSAMONEYSHARE")
private String thissamoneyshare;
@TableField(value = "LASTSAMONEYSHARE")
private String lastsamoneyshare;
@TableField(value = "MONTHPROFITSHARE")
private String monthprofitshare;
@TableField(value = "THISPROFITSHARE")
private String thisprofitshare;
@TableField(value = "LASTPROFITSHARE")
private String lastprofitshare;
@TableField(value = "SAMONEYGROWTH")
private String samoneygrowth;
@TableField(value = "PROFITGROWTH")
private String profitgrowth;
@TableField(value = "PROFITCHANGE")
private String profitchange;
}

View File

@@ -0,0 +1,24 @@
package com.lideeyunji.core.framework.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lideeyunji.core.framework.entity.GrBiFsBusinessSum;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface GrBiFsBusinessSumMapper extends BaseMapper<GrBiFsBusinessSum> {
@DS(value = "#dataSourceType")
default List<GrBiFsBusinessSum> getBusinessSumList(@Param("dataSourceType") String dataSourceType){
return this.selectList(new QueryWrapper<>());
}
@DS(value = "#dataSourceType")
default int deleteOldBusinessSum(@Param("dataSourceType") String dataSourceType){
return this.delete(new QueryWrapper<>());
}
}

View File

@@ -0,0 +1,24 @@
package com.lideeyunji.core.framework.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lideeyunji.core.framework.entity.GrBiFsSum;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface GrBiFsSumMapper extends BaseMapper<GrBiFsSum> {
@DS(value = "#dataSourceType")
default List<GrBiFsSum> getFsSumList(@Param("dataSourceType") String dataSourceType){
return this.selectList(new QueryWrapper<>());
}
@DS(value = "#dataSourceType")
default int deleteOldFsSum(@Param("dataSourceType") String dataSourceType){
return this.delete(new QueryWrapper<>());
}
}

View File

@@ -0,0 +1,24 @@
package com.lideeyunji.core.framework.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lideeyunji.core.framework.entity.GrBiPsSaleprod;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface GrBiPsSaleprodMapper extends BaseMapper<GrBiPsSaleprod> {
@DS(value = "#dataSourceType")
default List<GrBiPsSaleprod> getPsSaleprodList(@Param("dataSourceType") String dataSourceType){
return this.selectList(new QueryWrapper<>());
}
@DS(value = "#dataSourceType")
default int deleteOldPsSaleprod(@Param("dataSourceType") String dataSourceType){
return this.delete(new QueryWrapper<>());
}
}

View File

@@ -0,0 +1,9 @@
package com.lideeyunji.core.framework.service;
import org.apache.ibatis.annotations.Param;
public interface IGrBiFsBusinessSumService {
void GenerateFsBusinessSum(@Param("dataSourceType") String dataSourceType);
}

View File

@@ -0,0 +1,9 @@
package com.lideeyunji.core.framework.service;
import org.apache.ibatis.annotations.Param;
public interface IGrBiFsSumService {
void generateFsSum(@Param("dataSourceType") String dataSourceType);
}

View File

@@ -0,0 +1,9 @@
package com.lideeyunji.core.framework.service;
import org.apache.ibatis.annotations.Param;
public interface IGrBiPsSaleprodService {
void generatePsSaleprod(@Param("dataSourceType") String dataSourceType);
}

View File

@@ -0,0 +1,38 @@
package com.lideeyunji.core.framework.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lideeyunji.core.framework.entity.GrBiFsBusinessSum;
import com.lideeyunji.core.framework.mapper.GrBiFsBusinessSumMapper;
import com.lideeyunji.core.framework.service.IGrBiFsBusinessSumService;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class GrBiFsBusinessSumServiceImpl extends ServiceImpl<GrBiFsBusinessSumMapper, GrBiFsBusinessSum> implements IGrBiFsBusinessSumService {
@Override
@DSTransactional
@DS(value = "#dataSourceType")
public void GenerateFsBusinessSum(String dataSourceType) {
// 获取数据
List<GrBiFsBusinessSum> grBiSaSetdtlList = this.baseMapper.getBusinessSumList(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI);
if (CollUtil.isEmpty(grBiSaSetdtlList)) {
return;
}
//保存数据
int reNum = this.baseMapper.deleteOldBusinessSum(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
log.info("删除数量:{}", reNum);
//使用 saveBatch 批量插入
boolean success = this.saveBatch(grBiSaSetdtlList, 500);
if (!success) {
throw new RuntimeException("批量新增异常");
}
}
}

View File

@@ -0,0 +1,38 @@
package com.lideeyunji.core.framework.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lideeyunji.core.framework.entity.GrBiFsSum;
import com.lideeyunji.core.framework.mapper.GrBiFsSumMapper;
import com.lideeyunji.core.framework.service.IGrBiFsSumService;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class GrBiFsSumServiceImpl extends ServiceImpl<GrBiFsSumMapper, GrBiFsSum> implements IGrBiFsSumService {
@Override
@DSTransactional
@DS(value = "#dataSourceType")
public void generateFsSum(String dataSourceType) {
// 获取数据
List<GrBiFsSum> grBiSaSetdtlList = this.baseMapper.getFsSumList(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI);
if (CollUtil.isEmpty(grBiSaSetdtlList)) {
return;
}
//保存数据
int reNum = this.baseMapper.deleteOldFsSum(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
log.info("删除数量:{}", reNum);
//使用 saveBatch 批量插入
boolean success = this.saveBatch(grBiSaSetdtlList, 500);
if (!success) {
throw new RuntimeException("批量新增异常");
}
}
}

View File

@@ -0,0 +1,38 @@
package com.lideeyunji.core.framework.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lideeyunji.core.framework.entity.GrBiPsSaleprod;
import com.lideeyunji.core.framework.mapper.GrBiPsSaleprodMapper;
import com.lideeyunji.core.framework.service.IGrBiPsSaleprodService;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class GrBiPsSaleprodServiceImpl extends ServiceImpl<GrBiPsSaleprodMapper, GrBiPsSaleprod> implements IGrBiPsSaleprodService {
@Override
@DSTransactional
@DS(value = "#dataSourceType")
public void generatePsSaleprod(String dataSourceType) {
// 获取数据
List<GrBiPsSaleprod> grBiSaSetdtlList = this.baseMapper.getPsSaleprodList(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI);
if (CollUtil.isEmpty(grBiSaSetdtlList)) {
return;
}
//保存数据
int reNum = this.baseMapper.deleteOldPsSaleprod(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
log.info("删除数量:{}", reNum);
//使用 saveBatch 批量插入
boolean success = this.saveBatch(grBiSaSetdtlList, 500);
if (!success) {
throw new RuntimeException("批量新增异常");
}
}
}