Merge branch 'ww' into test
This commit is contained in:
commit
8aa6b1e56b
|
|
@ -48,9 +48,6 @@ public class TbConsInfo implements Serializable {
|
|||
@ApiModelProperty(value = "库存值")
|
||||
private BigDecimal stockNumber;
|
||||
|
||||
@Column(name = "`balance`")
|
||||
@ApiModelProperty(value = "实际库存值")
|
||||
private BigDecimal balance;
|
||||
|
||||
@Column(name = "`con_unit`")
|
||||
@ApiModelProperty(value = "单位值")
|
||||
|
|
@ -105,7 +102,4 @@ public class TbConsInfo implements Serializable {
|
|||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
System.out.println(JSONUtil.toJSONString(new TbConsInfo()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,106 @@
|
|||
package cn.ysk.cashier.cons.domain;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-06-22
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_cons_info")
|
||||
public class TbConsInfoV2 implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`con_type_id`")
|
||||
@ApiModelProperty(value = "耗材类型id")
|
||||
private Integer conTypeId;
|
||||
|
||||
@Column(name = "`con_type_name`")
|
||||
@ApiModelProperty(value = "耗材类型名称")
|
||||
private String conTypeName;
|
||||
|
||||
@Column(name = "`con_code`")
|
||||
@ApiModelProperty(value = "耗材代码")
|
||||
private String conCode;
|
||||
|
||||
@Column(name = "`con_name`")
|
||||
@ApiModelProperty(value = "耗材名称")
|
||||
private String conName;
|
||||
|
||||
@Column(name = "`stock_number`")
|
||||
@ApiModelProperty(value = "库存值")
|
||||
private BigDecimal stockNumber;
|
||||
|
||||
// @Column(name = "`balance`")
|
||||
@ApiModelProperty(value = "实际库存值")
|
||||
private BigDecimal balance;
|
||||
|
||||
@Column(name = "`con_unit`")
|
||||
@ApiModelProperty(value = "单位值")
|
||||
private String conUnit;
|
||||
|
||||
|
||||
@Column(name = "`laster_in_stock`")
|
||||
@ApiModelProperty(value = "最近一次入库量")
|
||||
private BigDecimal lasterInStock;
|
||||
|
||||
@Column(name = "`con_warning`")
|
||||
@ApiModelProperty(value = "耗材预警值")
|
||||
private BigDecimal conWarning;
|
||||
|
||||
@Column(name = "`create_time`")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "`update_time`")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Timestamp updateTime;
|
||||
|
||||
@Column(name = "`shop_id`")
|
||||
@ApiModelProperty(value = "店铺id")
|
||||
private Integer shopId;
|
||||
|
||||
|
||||
@Column(name = "`price`")
|
||||
@ApiModelProperty(value = "单价")
|
||||
private BigDecimal price;
|
||||
|
||||
|
||||
@Column(name = "`status`")
|
||||
@ApiModelProperty(value = "状态 1 启用 0 禁用")
|
||||
private String status;
|
||||
|
||||
|
||||
@Column(name = "`stock_consume`")
|
||||
@ApiModelProperty(value = "消耗总量")
|
||||
private BigDecimal stockConsume;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`is_check`")
|
||||
@ApiModelProperty(value = "是否检测库存")
|
||||
private String isCheck;
|
||||
|
||||
@Transient
|
||||
private List<Map<Integer, Object>> product;
|
||||
|
||||
public void copy(TbConsInfoV2 source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package cn.ysk.cashier.cons.repository;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbConsInfoV2;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
public interface TbConsInfoV2Repository extends JpaRepository<TbConsInfoV2, Integer>, JpaSpecificationExecutor<TbConsInfoV2> {
|
||||
|
||||
}
|
||||
|
|
@ -4,10 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.ysk.cashier.cons.domain.*;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||
import cn.ysk.cashier.cons.repository.TbConsSuppFlowRepository;
|
||||
import cn.ysk.cashier.cons.repository.TbConsTypeRepository;
|
||||
import cn.ysk.cashier.cons.repository.*;
|
||||
import cn.ysk.cashier.cons.service.TbConsInfoService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoQueryCriteria;
|
||||
|
|
@ -57,6 +54,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||
public final TbConsInfoFlowRepository tbConsInfoFlowRepository;
|
||||
public final TbConsSuppFlowRepository tbConsSuppFlowRepository;
|
||||
private final TbConsInfoRepository tbConsInfoRepository;
|
||||
private final TbConsInfoV2Repository tbConsInfoV2Repository;
|
||||
private final TbConsInfoMapper tbConsInfoMapper;
|
||||
private final TbShopPurveyorRepository tbShopPurveyorRepository;
|
||||
|
||||
|
|
@ -86,13 +84,12 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||
sort = Sort.by(sortDirection, sortField);
|
||||
}
|
||||
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
|
||||
Page<TbConsInfo> page = tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
Page<TbConsInfoDto> result = page.map(tbConsInfoMapper::toDto);
|
||||
result.getContent().forEach(it -> {
|
||||
Page<TbConsInfoV2> page = tbConsInfoV2Repository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
page.getContent().forEach(it -> {
|
||||
List<Map<Integer, Object>> list = tbConsInfoRepository.queryAllAndPro(criteria.getShopId(), it.getId());
|
||||
it.setProduct(list);
|
||||
});
|
||||
return PageUtil.toPage(result);
|
||||
return PageUtil.toPage(page);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -154,9 +151,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||
throw new Exception("耗材信息不存在");
|
||||
}
|
||||
BeanUtil.copyProperties(resource,tbConsInfo, CopyOptions.create().setIgnoreNullValue(true));
|
||||
tbConsInfo.setBalance(null);
|
||||
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
|
||||
tbConsInfoRepository.save(tbConsInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue