计算销售报表-库存产品占比表对象,产品可销库存对象 同步
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.lideeyunji.core.framework.config.job;
|
||||
|
||||
import com.lideeyunji.core.framework.service.IGrBiStProductAvlService;
|
||||
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_st_product_avl -> mysql gr_bi_st_product_avl
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("generateStProductAvlJob")
|
||||
public class GenerateStProductAvlJob implements JobHandler {
|
||||
|
||||
@Resource
|
||||
private IGrBiStProductAvlService grBiFsStProductAvlService;
|
||||
|
||||
@Override
|
||||
public String execute(String param) throws Exception {
|
||||
log.info("*********** 开始生成产品可销库存对象完成情况 ************");
|
||||
grBiFsStProductAvlService.generateStProductAvl(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
|
||||
log.info("*********** 生成产品可销库存对象完成情况完成 ************");
|
||||
return "*********** 生成产品可销库存对象完成情况完成 ************";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.lideeyunji.core.framework.config.job;
|
||||
|
||||
import com.lideeyunji.core.framework.service.IGrBiStLotService;
|
||||
import com.lideeyunji.core.framework.service.IGrBiStProductService;
|
||||
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_st_product -> mysql gr_bi_st_product
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("generateStProductJob")
|
||||
public class GenerateStProductJob implements JobHandler {
|
||||
|
||||
@Resource
|
||||
private IGrBiStProductService grBiFsStProductService;
|
||||
|
||||
@Override
|
||||
public String execute(String param) throws Exception {
|
||||
log.info("*********** 开始生成库存产品占比表对象完成情况 ************");
|
||||
grBiFsStProductService.generateStProduct(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
|
||||
log.info("*********** 生成库存产品占比表对象完成情况完成 ************");
|
||||
return "*********** 生成库存产品占比表对象完成情况完成 ************";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.lideeyunji.core.framework.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@@ -20,48 +24,63 @@ public class GrBiStLot extends BaseTenantEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long ID;
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
private Long GOODSID;
|
||||
@TableField(value = "GOODSID")
|
||||
private Long goodsId;
|
||||
|
||||
private String GOODSNAME;
|
||||
@TableField(value = "GOODSNAME")
|
||||
private String goodsName;
|
||||
|
||||
private String GOODSTYPE;
|
||||
@TableField(value = "GOODSTYPE")
|
||||
private String goodsType;
|
||||
|
||||
private String GOODSUNIT;
|
||||
@TableField(value = "GOODSUNIT")
|
||||
private String goodsUnit;
|
||||
|
||||
private Long CLASSID;
|
||||
@TableField(value = "CLASSID")
|
||||
private Long classid;
|
||||
|
||||
private String CLASSNAME;
|
||||
@TableField(value = "CLASSNAME")
|
||||
private String className;
|
||||
|
||||
private Long LOTID;
|
||||
@TableField(value = "LOTID")
|
||||
private Long lotId;
|
||||
|
||||
private String LOTNO;
|
||||
@TableField(value = "LOTNO")
|
||||
private String lotNo;
|
||||
|
||||
private Long GOODSQTY;
|
||||
@TableField(value = "GOODSQTY")
|
||||
private Long goodsQty;
|
||||
|
||||
private Date PRODDATE;
|
||||
@TableField(value = "PRODDATE")
|
||||
private Date proddate;
|
||||
|
||||
private String INVALIDDATE;
|
||||
@TableField(value = "INVALIDDATE")
|
||||
private String invalidDate;
|
||||
|
||||
private Long INVALIDDAYS;
|
||||
@TableField(value = "INVALIDDAYS")
|
||||
private Long invalidDays;
|
||||
|
||||
private String STINDATE;
|
||||
@TableField(value = "STINDATE")
|
||||
private String stInDate;
|
||||
|
||||
private String STOUTDATE;
|
||||
|
||||
private Long INVALIDDAYSTYPEID;
|
||||
|
||||
private String INVALIDDAYSTYPE;
|
||||
|
||||
private Long OUTTYPE;
|
||||
|
||||
private Long STORAGEID;
|
||||
|
||||
private String STORAGENAME;
|
||||
@TableField(value = "STOUTDATE")
|
||||
private String stOutDate;
|
||||
|
||||
@TableField(value = "INVALIDDAYSTYPEID")
|
||||
private Long invalidDaysTypeId;
|
||||
|
||||
@TableField(value = "INVALIDDAYSTYPE")
|
||||
private String invalidDaysType;
|
||||
|
||||
@TableField(value = "OUTTYPE")
|
||||
private Long outType;
|
||||
|
||||
@TableField(value = "STORAGEID")
|
||||
private Long storageId;
|
||||
|
||||
@TableField(value = "STORAGENAME")
|
||||
private String storageName;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.lideeyunji.core.framework.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -18,26 +21,37 @@ public class GrBiStProduct extends BaseTenantEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long ID;
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
private Long GOODSID;
|
||||
@TableField(value = "GOODSID")
|
||||
private Long goodsId;
|
||||
|
||||
private String GOODSNAME;
|
||||
@TableField(value = "GOODSNAME")
|
||||
private String goodsName;
|
||||
|
||||
private String GOODSTYPE;
|
||||
@TableField(value = "GOODSTYPE")
|
||||
private String goodsType;
|
||||
|
||||
private String GOODSUNIT;
|
||||
@TableField(value = "GOODSUNIT")
|
||||
private String goodsunit;
|
||||
|
||||
private Long GOODSCLASSID;
|
||||
@TableField(value = "GOODSCLASSID")
|
||||
private Long goodsclassid;
|
||||
|
||||
private String GOODSCLASSNAME;
|
||||
@TableField(value = "GOODSCLASSNAME")
|
||||
private String goodsClassName;
|
||||
|
||||
private Long QTY;
|
||||
@TableField(value = "QTY")
|
||||
private Long qty;
|
||||
|
||||
@TableField(value = "QTY_PROP")
|
||||
private Long qtyProp;
|
||||
|
||||
private Long MONEY;
|
||||
@TableField(value = "MONEY")
|
||||
private Long money;
|
||||
|
||||
@TableField(value = "MONEY_PROP")
|
||||
private Long moneyProp;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.lideeyunji.core.framework.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -18,34 +21,43 @@ public class GrBiStProductAvl extends BaseTenantEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long ID;
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
private Long GOODSID;
|
||||
@TableField(value = "GOODSID")
|
||||
private Long goodsId;
|
||||
|
||||
private String GOODSNAME;
|
||||
@TableField(value = "GOODSNAME")
|
||||
private String goodsName;
|
||||
|
||||
private String GOODSTYPE;
|
||||
@TableField(value = "GOODSTYPE")
|
||||
private String goodsType;
|
||||
|
||||
private String GOODSUNIT;
|
||||
@TableField(value = "GOODSUNIT")
|
||||
private String goodsUnit;
|
||||
|
||||
private Long PACKSIZE;
|
||||
@TableField(value = "PACKSIZE")
|
||||
private Long packSize;
|
||||
|
||||
private Long SORT;
|
||||
@TableField(value = "SORT")
|
||||
private Long sort;
|
||||
|
||||
private Long SEMIREM;
|
||||
@TableField(value = "SEMIREM")
|
||||
private Long semiRem;
|
||||
|
||||
private String TODAYIN;
|
||||
|
||||
private Long REM;
|
||||
|
||||
private Long THISMONTHOUT;
|
||||
|
||||
private Long LASTMONTHOUT;
|
||||
|
||||
private Long THISYEAROUT;
|
||||
@TableField(value = "TODAYIN")
|
||||
private String todayIn;
|
||||
|
||||
@TableField(value = "REM")
|
||||
private Long rem;
|
||||
|
||||
@TableField(value = "THISMONTHOUT")
|
||||
private Long thisMonthOut;
|
||||
|
||||
@TableField(value = "LASTMONTHOUT")
|
||||
private Long lastMonthOut;
|
||||
|
||||
@TableField(value = "THISYEAROUT")
|
||||
private Long thisYearOut;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.lideeyunji.core.framework.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStLot;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 物料产品库存统计表Mapper接口
|
||||
@@ -59,4 +63,14 @@ public interface GrBiStLotMapper extends BaseMapper<GrBiStLot>
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGrBiStLotByIDs(Long[] IDs);
|
||||
|
||||
@DS(value = "#dataSourceType")
|
||||
default List<GrBiStLot> getStLotList(@Param("dataSourceType") String dataSourceType){
|
||||
return this.selectList(new QueryWrapper<>());
|
||||
}
|
||||
|
||||
@DS(value = "#dataSourceType")
|
||||
default int deleteOldStLot(@Param("dataSourceType") String dataSourceType){
|
||||
return this.delete(new QueryWrapper<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.lideeyunji.core.framework.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStProductAvl;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 产品可销库存Mapper接口
|
||||
@@ -59,4 +63,14 @@ public interface GrBiStProductAvlMapper extends BaseMapper<GrBiStProductAvl>
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGrBiStProductAvlByIDs(Long[] IDs);
|
||||
|
||||
@DS(value = "#dataSourceType")
|
||||
default List<GrBiStProductAvl> getStProductList(@Param("dataSourceType") String dataSourceType){
|
||||
return this.selectList(new QueryWrapper<>());
|
||||
}
|
||||
|
||||
@DS(value = "#dataSourceType")
|
||||
default int deleteOldStProduct(@Param("dataSourceType") String dataSourceType){
|
||||
return this.delete(new QueryWrapper<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.lideeyunji.core.framework.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStProduct;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 库存产品占比表Mapper接口
|
||||
@@ -59,4 +63,14 @@ public interface GrBiStProductMapper extends BaseMapper<GrBiStProduct>
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGrBiStProductByIDs(Long[] IDs);
|
||||
|
||||
@DS(value = "#dataSourceType")
|
||||
default List<GrBiStProduct> getStProductList(@Param("dataSourceType") String dataSourceType){
|
||||
return this.selectList(new QueryWrapper<>());
|
||||
}
|
||||
|
||||
@DS(value = "#dataSourceType")
|
||||
default int deleteOldStProduct(@Param("dataSourceType") String dataSourceType){
|
||||
return this.delete(new QueryWrapper<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,5 +59,5 @@ public interface IGrBiStLotService
|
||||
*/
|
||||
public int deleteGrBiStLotByID(Long ID);
|
||||
|
||||
void generateStLot(String dsErpBiData);
|
||||
void generateStLot(String dataSourceType);
|
||||
}
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface IGrBiStProductAvlService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGrBiStProductAvlByID(Long ID);
|
||||
|
||||
void generateStProductAvl(String dataSourceType);
|
||||
}
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface IGrBiStProductService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGrBiStProductByID(Long ID);
|
||||
|
||||
void generateStProduct(String dataSourceType);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
package com.lideeyunji.core.framework.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lideeyunji.core.framework.entity.GrBiFsBusinessReal;
|
||||
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.lideeyunji.core.framework.mapper.GrBiStLotMapper;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStLot;
|
||||
@@ -13,9 +21,58 @@ import com.lideeyunji.core.framework.service.IGrBiStLotService;
|
||||
* @author king
|
||||
* @date 2026-03-12
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GrBiStLotServiceImpl extends ServiceImpl<GrBiStLotMapper, GrBiStLot> implements IGrBiStLotService
|
||||
{
|
||||
|
||||
@Override
|
||||
@DS(value = "#dataSourceType")
|
||||
public void generateStLot(String dataSourceType) {
|
||||
//获取本地mysql数据库中表中UPDATE_TIME最新的数据
|
||||
// LambdaQueryWrapper<GrBiStLot> queryWrapper = new LambdaQueryWrapper<GrBiStLot>().orderByDesc(GrBiStLot::getUseYear, GrBiStLot::getUseMonth).last("LIMIT 1");
|
||||
// GrBiStLot real = this.baseMapper.selectOne(queryWrapper);
|
||||
// int lastUserYear = 2022;
|
||||
// int lastUserMonth = 1;
|
||||
// if(real != null){
|
||||
// lastUserYear = Integer.parseInt(real.getUseYear());
|
||||
// lastUserMonth = Integer.parseInt(real.getUseMonth());
|
||||
// }
|
||||
// // 获取当前时间的年和月
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// int currentYear = now.getYear();
|
||||
// int currentMonth = now.getMonthValue();
|
||||
//
|
||||
// // 获取三个月前的时间和年月
|
||||
// LocalDateTime threeMonthsAgo = now.minusMonths(3);
|
||||
// int pastYear = threeMonthsAgo.getYear();
|
||||
// int pastMonth = threeMonthsAgo.getMonthValue();
|
||||
//
|
||||
// log.info("最后更新的年月:{}年{}月", lastUserYear, lastUserMonth);
|
||||
// log.info("当前:{}年{}月", currentYear, currentMonth);
|
||||
// log.info("三个月前:{}年{}月", pastYear, pastMonth);
|
||||
// if (lastUserYear < pastYear || (lastUserYear == pastYear && lastUserMonth < pastMonth)) {
|
||||
// pastYear = lastUserYear;
|
||||
// pastMonth = lastUserMonth;
|
||||
// }
|
||||
// log.info("开始时间:{}年{}月, 结束时间:{}年{}月", pastYear, pastMonth, currentYear, currentMonth);
|
||||
|
||||
// 获取数据
|
||||
List<GrBiStLot> grBiSaSetdtlList = this.baseMapper.getStLotList(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI);
|
||||
if (CollUtil.isEmpty(grBiSaSetdtlList)) {
|
||||
return;
|
||||
}
|
||||
//保存数据
|
||||
int reNum = this.baseMapper.deleteOldStLot(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
|
||||
log.info("删除数量:{}", reNum);
|
||||
for (GrBiStLot grBiSaSetdtl : grBiSaSetdtlList) {
|
||||
int re = this.baseMapper.insert(grBiSaSetdtl);
|
||||
if (re < 1) {
|
||||
throw new RuntimeException("批量新增异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物料产品库存统计表
|
||||
*
|
||||
@@ -88,8 +145,5 @@ public class GrBiStLotServiceImpl extends ServiceImpl<GrBiStLotMapper, GrBiStLot
|
||||
return this.baseMapper.deleteGrBiStLotByID(ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateStLot(String dsErpBiData) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package com.lideeyunji.core.framework.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStProduct;
|
||||
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.lideeyunji.core.framework.mapper.GrBiStProductAvlMapper;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStProductAvl;
|
||||
@@ -13,9 +19,58 @@ import com.lideeyunji.core.framework.service.IGrBiStProductAvlService;
|
||||
* @author king
|
||||
* @date 2026-03-12
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GrBiStProductAvlServiceImpl extends ServiceImpl<GrBiStProductAvlMapper, GrBiStProductAvl> implements IGrBiStProductAvlService
|
||||
{
|
||||
|
||||
@Override
|
||||
@DS(value = "#dataSourceType")
|
||||
public void generateStProductAvl(String dataSourceType) {
|
||||
//获取本地mysql数据库中表中UPDATE_TIME最新的数据
|
||||
// LambdaQueryWrapper<grBiStProductAvl> queryWrapper = new LambdaQueryWrapper<grBiStProductAvl>().orderByDesc(grBiStProductAvl::getUseYear, grBiStProductAvl::getUseMonth).last("LIMIT 1");
|
||||
// grBiStProductAvl real = this.baseMapper.selectOne(queryWrapper);
|
||||
// int lastUserYear = 2022;
|
||||
// int lastUserMonth = 1;
|
||||
// if(real != null){
|
||||
// lastUserYear = Integer.parseInt(real.getUseYear());
|
||||
// lastUserMonth = Integer.parseInt(real.getUseMonth());
|
||||
// }
|
||||
// // 获取当前时间的年和月
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// int currentYear = now.getYear();
|
||||
// int currentMonth = now.getMonthValue();
|
||||
//
|
||||
// // 获取三个月前的时间和年月
|
||||
// LocalDateTime threeMonthsAgo = now.minusMonths(3);
|
||||
// int pastYear = threeMonthsAgo.getYear();
|
||||
// int pastMonth = threeMonthsAgo.getMonthValue();
|
||||
//
|
||||
// log.info("最后更新的年月:{}年{}月", lastUserYear, lastUserMonth);
|
||||
// log.info("当前:{}年{}月", currentYear, currentMonth);
|
||||
// log.info("三个月前:{}年{}月", pastYear, pastMonth);
|
||||
// if (lastUserYear < pastYear || (lastUserYear == pastYear && lastUserMonth < pastMonth)) {
|
||||
// pastYear = lastUserYear;
|
||||
// pastMonth = lastUserMonth;
|
||||
// }
|
||||
// log.info("开始时间:{}年{}月, 结束时间:{}年{}月", pastYear, pastMonth, currentYear, currentMonth);
|
||||
|
||||
// 获取数据
|
||||
List<GrBiStProductAvl> grBiSaSetdtlList = this.baseMapper.getStProductList(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI);
|
||||
if (CollUtil.isEmpty(grBiSaSetdtlList)) {
|
||||
return;
|
||||
}
|
||||
//保存数据
|
||||
int reNum = this.baseMapper.deleteOldStProduct(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
|
||||
log.info("删除数量:{}", reNum);
|
||||
for (GrBiStProductAvl grBiStProductAvl : grBiSaSetdtlList) {
|
||||
int re = this.baseMapper.insert(grBiStProductAvl);
|
||||
if (re < 1) {
|
||||
throw new RuntimeException("批量新增异常");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 查询产品可销库存
|
||||
*
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package com.lideeyunji.core.framework.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStProduct;
|
||||
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.lideeyunji.core.framework.mapper.GrBiStProductMapper;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStProduct;
|
||||
@@ -13,9 +19,57 @@ import com.lideeyunji.core.framework.service.IGrBiStProductService;
|
||||
* @author king
|
||||
* @date 2026-03-12
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GrBiStProductServiceImpl extends ServiceImpl<GrBiStProductMapper, GrBiStProduct> implements IGrBiStProductService
|
||||
{
|
||||
@Override
|
||||
@DS(value = "#dataSourceType")
|
||||
public void generateStProduct(String dataSourceType) {
|
||||
//获取本地mysql数据库中表中UPDATE_TIME最新的数据
|
||||
// LambdaQueryWrapper<GrBiStProduct> queryWrapper = new LambdaQueryWrapper<GrBiStProduct>().orderByDesc(GrBiStProduct::getUseYear, GrBiStProduct::getUseMonth).last("LIMIT 1");
|
||||
// GrBiStProduct real = this.baseMapper.selectOne(queryWrapper);
|
||||
// int lastUserYear = 2022;
|
||||
// int lastUserMonth = 1;
|
||||
// if(real != null){
|
||||
// lastUserYear = Integer.parseInt(real.getUseYear());
|
||||
// lastUserMonth = Integer.parseInt(real.getUseMonth());
|
||||
// }
|
||||
// // 获取当前时间的年和月
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// int currentYear = now.getYear();
|
||||
// int currentMonth = now.getMonthValue();
|
||||
//
|
||||
// // 获取三个月前的时间和年月
|
||||
// LocalDateTime threeMonthsAgo = now.minusMonths(3);
|
||||
// int pastYear = threeMonthsAgo.getYear();
|
||||
// int pastMonth = threeMonthsAgo.getMonthValue();
|
||||
//
|
||||
// log.info("最后更新的年月:{}年{}月", lastUserYear, lastUserMonth);
|
||||
// log.info("当前:{}年{}月", currentYear, currentMonth);
|
||||
// log.info("三个月前:{}年{}月", pastYear, pastMonth);
|
||||
// if (lastUserYear < pastYear || (lastUserYear == pastYear && lastUserMonth < pastMonth)) {
|
||||
// pastYear = lastUserYear;
|
||||
// pastMonth = lastUserMonth;
|
||||
// }
|
||||
// log.info("开始时间:{}年{}月, 结束时间:{}年{}月", pastYear, pastMonth, currentYear, currentMonth);
|
||||
|
||||
// 获取数据
|
||||
List<GrBiStProduct> grBiSaSetdtlList = this.baseMapper.getStProductList(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI);
|
||||
if (CollUtil.isEmpty(grBiSaSetdtlList)) {
|
||||
return;
|
||||
}
|
||||
//保存数据
|
||||
int reNum = this.baseMapper.deleteOldStProduct(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
|
||||
log.info("删除数量:{}", reNum);
|
||||
for (GrBiStProduct grBiSaSetdtl : grBiSaSetdtlList) {
|
||||
int re = this.baseMapper.insert(grBiSaSetdtl);
|
||||
if (re < 1) {
|
||||
throw new RuntimeException("批量新增异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存产品占比表
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user