耗材
This commit is contained in:
@@ -18,8 +18,8 @@ public class CodeGen {
|
||||
private final static String DATABASE = "czg_cashier_test";
|
||||
private final static String OLD_DATABASE = "fycashier";
|
||||
|
||||
// private final static boolean IS_OLD_VERSION = false;
|
||||
private final static boolean IS_OLD_VERSION = true;
|
||||
private final static boolean IS_OLD_VERSION = false;
|
||||
// private final static boolean IS_OLD_VERSION = true;
|
||||
|
||||
public static void main(String[] args) {
|
||||
//配置数据源
|
||||
@@ -81,7 +81,7 @@ public class CodeGen {
|
||||
//设置表前缀和只生成哪些表,setGenerateTable 未配置时,生成所有表
|
||||
globalConfig.getStrategyConfig()
|
||||
.setTablePrefix("tb_")
|
||||
.setGenerateTable("tb_product_stock_detail", "tb_product_stock_operate", "tb_product_stocktakin");
|
||||
.setGenerateTable("tb_prod_cons_relation");
|
||||
|
||||
EntityConfig entityConfig = globalConfig.getEntityConfig();
|
||||
if (IS_OLD_VERSION) {
|
||||
|
||||
@@ -43,6 +43,14 @@ public class ShopInfoController {
|
||||
@Resource
|
||||
private CurFreeDineConfigService curFreeDineConfigService;
|
||||
|
||||
@Resource
|
||||
private CurConsInfoService curConsInfoService;
|
||||
|
||||
@RequestMapping("/consInfo")
|
||||
public CzgResult<String> consInfo() {
|
||||
return curConsInfoService.mergeConsData();
|
||||
}
|
||||
|
||||
@RequestMapping("/freeDineConfig")
|
||||
public CzgResult<String> freeDineConfig() {
|
||||
return curFreeDineConfigService.mergeData();
|
||||
|
||||
63
src/main/java/com/czg/mergedata/cur/entity/CurConsGroup.java
Normal file
63
src/main/java/com/czg/mergedata/cur/entity/CurConsGroup.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.czg.mergedata.cur.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 耗材分组 实体类。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_cons_group")
|
||||
public class CurConsGroup implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 状态 1 正常 0 禁用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.czg.mergedata.cur.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 耗材分组关联关系 实体类。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_cons_group_relation")
|
||||
public class CurConsGroupRelation implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 分组 id
|
||||
*/
|
||||
@Id
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 耗材 Id
|
||||
*/
|
||||
@Id
|
||||
private Long consId;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
109
src/main/java/com/czg/mergedata/cur/entity/CurConsInfo.java
Normal file
109
src/main/java/com/czg/mergedata/cur/entity/CurConsInfo.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package com.czg.mergedata.cur.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 耗材信息 实体类。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_cons_info")
|
||||
public class CurConsInfo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 耗材分组id
|
||||
*/
|
||||
private Long consGroupId;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 耗材名称
|
||||
*/
|
||||
private String conName;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 库存值
|
||||
*/
|
||||
private BigDecimal stockNumber;
|
||||
|
||||
/**
|
||||
* 状态 1 启用 0 禁用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 单位值
|
||||
*/
|
||||
private String conUnit;
|
||||
|
||||
/**
|
||||
* 耗材预警值
|
||||
*/
|
||||
private BigDecimal conWarning;
|
||||
|
||||
/**
|
||||
* 是否检测耗材: 1 检测 0 不检测
|
||||
*/
|
||||
private Integer isStock;
|
||||
|
||||
/**
|
||||
* 第二单位
|
||||
*/
|
||||
private String conUnitTwo;
|
||||
|
||||
/**
|
||||
* 第二单位转换数量
|
||||
*/
|
||||
private BigDecimal conUnitTwoConvert;
|
||||
|
||||
/**
|
||||
* 默认入库单位
|
||||
*/
|
||||
private String defaultUnit;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.czg.mergedata.cur.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 商品耗材绑定关系 实体类。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_prod_cons_relation")
|
||||
public class CurProdConsRelation implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 耗材id
|
||||
*/
|
||||
private Long consInfoId;
|
||||
|
||||
/**
|
||||
* 单位消耗值
|
||||
*/
|
||||
private BigDecimal surplusStock;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.czg.mergedata.cur.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.mergedata.cur.entity.CurConsGroup;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 耗材分组 映射层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface CurConsGroupMapper extends BaseMapper<CurConsGroup> {
|
||||
@Select("truncate tb_cons_group")
|
||||
void truncateTable();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.czg.mergedata.cur.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.mergedata.cur.entity.CurConsGroupRelation;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 耗材分组关联关系 映射层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface CurConsGroupRelationMapper extends BaseMapper<CurConsGroupRelation> {
|
||||
@Select("truncate tb_cons_group_relation")
|
||||
void truncateTable();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.czg.mergedata.cur.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.mergedata.cur.entity.CurConsInfo;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 耗材信息 映射层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface CurConsInfoMapper extends BaseMapper<CurConsInfo> {
|
||||
@Select("truncate tb_cons_info")
|
||||
void truncateTable();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.czg.mergedata.cur.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.mergedata.cur.entity.CurProdConsRelation;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 商品耗材绑定关系 映射层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface CurProdConsRelationMapper extends BaseMapper<CurProdConsRelation> {
|
||||
|
||||
@Select("truncate tb_prod_cons_relation")
|
||||
void truncateTable();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.mergedata.cur.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.mergedata.cur.entity.CurConsGroupRelation;
|
||||
|
||||
/**
|
||||
* 耗材分组关联关系 服务层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface CurConsGroupRelationService extends IService<CurConsGroupRelation> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.mergedata.cur.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.mergedata.cur.entity.CurConsGroup;
|
||||
|
||||
/**
|
||||
* 耗材分组 服务层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface CurConsGroupService extends IService<CurConsGroup> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.czg.mergedata.cur.service;
|
||||
|
||||
import com.czg.mergedata.common.resp.CzgResult;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.mergedata.cur.entity.CurConsInfo;
|
||||
|
||||
/**
|
||||
* 耗材信息 服务层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface CurConsInfoService extends IService<CurConsInfo> {
|
||||
|
||||
CzgResult<String> mergeConsData();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.mergedata.cur.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.mergedata.cur.entity.CurProdConsRelation;
|
||||
|
||||
/**
|
||||
* 商品耗材绑定关系 服务层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface CurProdConsRelationService extends IService<CurProdConsRelation> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.czg.mergedata.cur.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.mergedata.cur.entity.CurConsGroupRelation;
|
||||
import com.czg.mergedata.cur.mapper.CurConsGroupRelationMapper;
|
||||
import com.czg.mergedata.cur.service.CurConsGroupRelationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 耗材分组关联关系 服务层实现。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Service
|
||||
public class CurConsGroupRelationServiceImpl extends ServiceImpl<CurConsGroupRelationMapper, CurConsGroupRelation> implements CurConsGroupRelationService{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.czg.mergedata.cur.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.mergedata.cur.entity.CurConsGroup;
|
||||
import com.czg.mergedata.cur.mapper.CurConsGroupMapper;
|
||||
import com.czg.mergedata.cur.service.CurConsGroupService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 耗材分组 服务层实现。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Service
|
||||
public class CurConsGroupServiceImpl extends ServiceImpl<CurConsGroupMapper, CurConsGroup> implements CurConsGroupService{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.czg.mergedata.cur.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.mergedata.common.resp.CzgResult;
|
||||
import com.czg.mergedata.cur.entity.CurConsGroup;
|
||||
import com.czg.mergedata.cur.entity.CurConsInfo;
|
||||
import com.czg.mergedata.cur.entity.CurProdConsRelation;
|
||||
import com.czg.mergedata.cur.mapper.CurConsGroupMapper;
|
||||
import com.czg.mergedata.cur.mapper.CurConsInfoMapper;
|
||||
import com.czg.mergedata.cur.mapper.CurProdConsRelationMapper;
|
||||
import com.czg.mergedata.cur.service.CurConsGroupService;
|
||||
import com.czg.mergedata.cur.service.CurConsInfoService;
|
||||
import com.czg.mergedata.cur.service.CurProdConsRelationService;
|
||||
import com.czg.mergedata.old.entity.OldConsType;
|
||||
import com.czg.mergedata.old.entity.OldProskuCon;
|
||||
import com.czg.mergedata.old.service.OldConsInfoService;
|
||||
import com.czg.mergedata.old.service.OldConsTypeService;
|
||||
import com.czg.mergedata.old.service.OldProskuConService;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 耗材信息 服务层实现。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Service
|
||||
public class CurConsInfoServiceImpl extends ServiceImpl<CurConsInfoMapper, CurConsInfo> implements CurConsInfoService {
|
||||
@Resource
|
||||
private CurConsGroupMapper curConsGroupMapper;
|
||||
|
||||
@Resource
|
||||
private CurConsGroupService curConsGroupService;
|
||||
|
||||
@Resource
|
||||
private CurProdConsRelationMapper curProdConsRelationMapper;
|
||||
|
||||
@Resource
|
||||
private CurProdConsRelationService curProdConsRelationService;
|
||||
|
||||
@Resource
|
||||
private OldConsTypeService oldConsTypeService;
|
||||
|
||||
@Resource
|
||||
private OldConsInfoService oldConsInfoService;
|
||||
|
||||
@Resource
|
||||
private OldProskuConService oldProskuConService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public CzgResult<String> mergeConsData() {
|
||||
getMapper().truncateTable();
|
||||
curConsGroupMapper.truncateTable();
|
||||
curProdConsRelationMapper.truncateTable();
|
||||
|
||||
mergeConsGroup();
|
||||
mergeConsInfo();
|
||||
mergeProdConsRelation();
|
||||
|
||||
return CzgResult.success("合并耗材数据成功");
|
||||
}
|
||||
|
||||
private void mergeConsGroup() {
|
||||
List<OldConsType> consTypes = oldConsTypeService.list();
|
||||
List<CurConsGroup> curConsGroups = new ArrayList<>();
|
||||
|
||||
for (OldConsType oldConsType : consTypes) {
|
||||
CurConsGroup curConsGroup = new CurConsGroup();
|
||||
curConsGroup.setId(Long.valueOf(oldConsType.getId()));
|
||||
curConsGroup.setShopId(Long.valueOf(oldConsType.getShopId()));
|
||||
curConsGroup.setName(oldConsType.getConTypeName());
|
||||
curConsGroup.setStatus(Integer.valueOf(oldConsType.getStatus()));
|
||||
curConsGroup.setCreateTime(oldConsType.getCreateTime());
|
||||
curConsGroup.setUpdateTime(oldConsType.getUpdateTime());
|
||||
|
||||
curConsGroups.add(curConsGroup);
|
||||
}
|
||||
|
||||
curConsGroupService.saveBatch(curConsGroups);
|
||||
}
|
||||
|
||||
private void mergeConsInfo() {
|
||||
List<CurConsInfo> curConsInfos = new ArrayList<>();
|
||||
|
||||
oldConsInfoService.list().forEach(oldConsInfo -> {
|
||||
CurConsInfo curConsInfo = new CurConsInfo();
|
||||
curConsInfo.setId(Long.valueOf(oldConsInfo.getId()));
|
||||
curConsInfo.setShopId(oldConsInfo.getShopId() == null ? 1L :Long.valueOf(oldConsInfo.getShopId()));
|
||||
curConsInfo.setConsGroupId(Long.valueOf(oldConsInfo.getConTypeId()));
|
||||
curConsInfo.setConName(oldConsInfo.getConName());
|
||||
curConsInfo.setPrice(oldConsInfo.getPrice());
|
||||
curConsInfo.setStockNumber(oldConsInfo.getStockNumber());
|
||||
curConsInfo.setStatus(StrUtil.isBlank(oldConsInfo.getStatus()) ? 1 :Integer.parseInt(oldConsInfo.getStatus()));
|
||||
curConsInfo.setConUnit(oldConsInfo.getConUnit());
|
||||
curConsInfo.setConWarning(oldConsInfo.getConWarning());
|
||||
curConsInfo.setIsStock(oldConsInfo.getIsCheck() == null ? 0 : Integer.parseInt(oldConsInfo.getIsCheck()));
|
||||
curConsInfo.setConUnitTwo(oldConsInfo.getConUnitTwo());
|
||||
curConsInfo.setConUnitTwoConvert(oldConsInfo.getConUnitTwoConvert());
|
||||
curConsInfo.setDefaultUnit(oldConsInfo.getDefaultUnit());
|
||||
curConsInfo.setCreateTime(oldConsInfo.getCreateTime());
|
||||
curConsInfo.setUpdateTime(oldConsInfo.getUpdateTime());
|
||||
});
|
||||
|
||||
saveBatch(curConsInfos);
|
||||
}
|
||||
|
||||
private void mergeProdConsRelation() {
|
||||
List<CurProdConsRelation> curProdConsRelations = new ArrayList<>();
|
||||
|
||||
Map<Integer, Set<OldProskuCon>> oldProskuConMap = new HashMap<>();
|
||||
|
||||
List<OldProskuCon> oldProskuCons = oldProskuConService.list();
|
||||
for (OldProskuCon oldProskuCon : oldProskuCons) {
|
||||
if (!oldProskuConMap.containsKey(oldProskuCon.getProductId())) {
|
||||
oldProskuConMap.put(oldProskuCon.getProductId(), new HashSet<>());
|
||||
}
|
||||
Set<OldProskuCon> proskuConList = oldProskuConMap.get(oldProskuCon.getProductId());
|
||||
|
||||
proskuConList.add(oldProskuCon);
|
||||
}
|
||||
|
||||
oldProskuConMap.forEach((productId, proskuConList) -> proskuConList.forEach(oldProskuCon -> {
|
||||
CurProdConsRelation curProdConsRelation = new CurProdConsRelation();
|
||||
curProdConsRelation.setId(Long.valueOf(oldProskuCon.getId()));
|
||||
curProdConsRelation.setShopId(Long.valueOf(oldProskuCon.getShopId()));
|
||||
curProdConsRelation.setProductId(Long.valueOf(oldProskuCon.getProductId()));
|
||||
curProdConsRelation.setConsInfoId(Long.valueOf(oldProskuCon.getConInfoId()));
|
||||
curProdConsRelation.setSurplusStock(oldProskuCon.getSurplusStock());
|
||||
curProdConsRelation.setCreateTime(oldProskuCon.getCreateTime() == null ? LocalDateTime.now() : oldProskuCon.getCreateTime());
|
||||
|
||||
curProdConsRelations.add(curProdConsRelation);
|
||||
}));
|
||||
|
||||
curProdConsRelationService.saveBatch(curProdConsRelations);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.czg.mergedata.cur.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.mergedata.cur.entity.CurProdConsRelation;
|
||||
import com.czg.mergedata.cur.mapper.CurProdConsRelationMapper;
|
||||
import com.czg.mergedata.cur.service.CurProdConsRelationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 商品耗材绑定关系 服务层实现。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Service
|
||||
public class CurProdConsRelationServiceImpl extends ServiceImpl<CurProdConsRelationMapper, CurProdConsRelation> implements CurProdConsRelationService{
|
||||
|
||||
}
|
||||
128
src/main/java/com/czg/mergedata/old/entity/OldConsInfo.java
Normal file
128
src/main/java/com/czg/mergedata/old/entity/OldConsInfo.java
Normal file
@@ -0,0 +1,128 @@
|
||||
package com.czg.mergedata.old.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 耗材信息 实体类。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_cons_info")
|
||||
public class OldConsInfo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
* 耗材类型id
|
||||
*/
|
||||
private Integer conTypeId;
|
||||
|
||||
/**
|
||||
* 耗材类型名称
|
||||
*/
|
||||
private String conTypeName;
|
||||
|
||||
/**
|
||||
* 耗材代码
|
||||
*/
|
||||
private String conCode;
|
||||
|
||||
/**
|
||||
* 耗材名称
|
||||
*/
|
||||
private String conName;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 库存值
|
||||
*/
|
||||
private BigDecimal stockNumber;
|
||||
|
||||
/**
|
||||
* 消耗总量
|
||||
*/
|
||||
private BigDecimal stockConsume;
|
||||
|
||||
/**
|
||||
* 状态 1 启用 0 禁用
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 单位值
|
||||
*/
|
||||
private String conUnit;
|
||||
|
||||
/**
|
||||
* 最近一次入库量
|
||||
*/
|
||||
private BigDecimal lasterInStock;
|
||||
|
||||
/**
|
||||
* 耗材预警值
|
||||
*/
|
||||
private BigDecimal conWarning;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否检测耗材: 1 检测 0 不检测
|
||||
*/
|
||||
private String isCheck;
|
||||
|
||||
private BigDecimal balance;
|
||||
|
||||
/**
|
||||
* 第二单位
|
||||
*/
|
||||
private String conUnitTwo;
|
||||
|
||||
/**
|
||||
* 第二单位转换数量
|
||||
*/
|
||||
private BigDecimal conUnitTwoConvert;
|
||||
|
||||
/**
|
||||
* 默认入库单位
|
||||
*/
|
||||
private String defaultUnit;
|
||||
|
||||
}
|
||||
65
src/main/java/com/czg/mergedata/old/entity/OldConsType.java
Normal file
65
src/main/java/com/czg/mergedata/old/entity/OldConsType.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.czg.mergedata.old.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 耗材分类 实体类。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_cons_type")
|
||||
public class OldConsType implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
* 耗材类型代码
|
||||
*/
|
||||
private String conTypeCode;
|
||||
|
||||
/**
|
||||
* 耗材名称
|
||||
*/
|
||||
private String conTypeName;
|
||||
|
||||
/**
|
||||
* 状态 1 正常 0 禁用
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
89
src/main/java/com/czg/mergedata/old/entity/OldProskuCon.java
Normal file
89
src/main/java/com/czg/mergedata/old/entity/OldProskuCon.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package com.czg.mergedata.old.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 实体类。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_prosku_con")
|
||||
public class OldProskuCon implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer productId;
|
||||
|
||||
/**
|
||||
* 商品规格id
|
||||
*/
|
||||
private Integer productSkuId;
|
||||
|
||||
/**
|
||||
* 耗材id
|
||||
*/
|
||||
private Integer conInfoId;
|
||||
|
||||
/**
|
||||
* 单位消耗值
|
||||
*/
|
||||
private BigDecimal surplusStock;
|
||||
|
||||
/**
|
||||
* 状态 1 启用 0 禁用
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return conInfoId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (obj instanceof OldProskuCon other) {
|
||||
return conInfoId.equals(other.conInfoId);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.czg.mergedata.old.mapper;
|
||||
|
||||
import com.mybatisflex.annotation.UseDataSource;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.mergedata.old.entity.OldConsInfo;
|
||||
|
||||
/**
|
||||
* 耗材信息 映射层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@UseDataSource("ds2")
|
||||
public interface OldConsInfoMapper extends BaseMapper<OldConsInfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.czg.mergedata.old.mapper;
|
||||
|
||||
import com.mybatisflex.annotation.UseDataSource;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.mergedata.old.entity.OldConsType;
|
||||
|
||||
/**
|
||||
* 耗材分类 映射层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@UseDataSource("ds2")
|
||||
public interface OldConsTypeMapper extends BaseMapper<OldConsType> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.czg.mergedata.old.mapper;
|
||||
|
||||
import com.mybatisflex.annotation.UseDataSource;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.mergedata.old.entity.OldProskuCon;
|
||||
|
||||
/**
|
||||
* 映射层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@UseDataSource("ds2")
|
||||
public interface OldProskuConMapper extends BaseMapper<OldProskuCon> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.mergedata.old.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.mergedata.old.entity.OldConsInfo;
|
||||
|
||||
/**
|
||||
* 耗材信息 服务层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface OldConsInfoService extends IService<OldConsInfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.mergedata.old.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.mergedata.old.entity.OldConsType;
|
||||
|
||||
/**
|
||||
* 耗材分类 服务层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface OldConsTypeService extends IService<OldConsType> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.czg.mergedata.old.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.mergedata.old.entity.OldProskuCon;
|
||||
|
||||
/**
|
||||
* 服务层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
public interface OldProskuConService extends IService<OldProskuCon> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.czg.mergedata.old.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.mergedata.old.entity.OldConsInfo;
|
||||
import com.czg.mergedata.old.mapper.OldConsInfoMapper;
|
||||
import com.czg.mergedata.old.service.OldConsInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 耗材信息 服务层实现。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Service
|
||||
public class OldConsInfoServiceImpl extends ServiceImpl<OldConsInfoMapper, OldConsInfo> implements OldConsInfoService{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.czg.mergedata.old.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.mergedata.old.entity.OldConsType;
|
||||
import com.czg.mergedata.old.mapper.OldConsTypeMapper;
|
||||
import com.czg.mergedata.old.service.OldConsTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 耗材分类 服务层实现。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Service
|
||||
public class OldConsTypeServiceImpl extends ServiceImpl<OldConsTypeMapper, OldConsType> implements OldConsTypeService{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.czg.mergedata.old.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.mergedata.old.entity.OldProskuCon;
|
||||
import com.czg.mergedata.old.mapper.OldProskuConMapper;
|
||||
import com.czg.mergedata.old.service.OldProskuConService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 服务层实现。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-03-17
|
||||
*/
|
||||
@Service
|
||||
public class OldProskuConServiceImpl extends ServiceImpl<OldProskuConMapper, OldProskuCon> implements OldProskuConService{
|
||||
|
||||
}
|
||||
7
src/main/resources/mapper/cur/ConsGroupMapper.xml
Normal file
7
src/main/resources/mapper/cur/ConsGroupMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.mergedata.cur.mapper.CurConsGroupMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.mergedata.cur.mapper.CurConsGroupRelationMapper">
|
||||
|
||||
</mapper>
|
||||
7
src/main/resources/mapper/cur/ConsInfoMapper.xml
Normal file
7
src/main/resources/mapper/cur/ConsInfoMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.mergedata.cur.mapper.CurConsInfoMapper">
|
||||
|
||||
</mapper>
|
||||
7
src/main/resources/mapper/cur/ProdConsRelationMapper.xml
Normal file
7
src/main/resources/mapper/cur/ProdConsRelationMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.mergedata.cur.mapper.CurProdConsRelationMapper">
|
||||
|
||||
</mapper>
|
||||
7
src/main/resources/mapper/old/ConsInfoMapper.xml
Normal file
7
src/main/resources/mapper/old/ConsInfoMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.mergedata.old.mapper.OldConsInfoMapper">
|
||||
|
||||
</mapper>
|
||||
7
src/main/resources/mapper/old/ConsTypeMapper.xml
Normal file
7
src/main/resources/mapper/old/ConsTypeMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.mergedata.old.mapper.OldConsTypeMapper">
|
||||
|
||||
</mapper>
|
||||
7
src/main/resources/mapper/old/ProskuConMapper.xml
Normal file
7
src/main/resources/mapper/old/ProskuConMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.mergedata.old.mapper.OldProskuConMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -204,4 +204,12 @@
|
||||
- tb_free_dine_config 表
|
||||
|
||||
|
||||
### 29. 耗材
|
||||
> /merge/shopInfo/consInfo
|
||||
#### 执行表
|
||||
- tb_cons_info 表
|
||||
- tb_cons_group 表
|
||||
- tb_prod_cons_relation 表
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user