Merge branch 'test' into ww
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbConsInfoMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbConsInfo record);
|
||||
|
||||
int insertSelective(TbConsInfo record);
|
||||
|
||||
TbConsInfo selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbConsInfo record);
|
||||
|
||||
int updateByPrimaryKey(TbConsInfo record);
|
||||
|
||||
int countAll();
|
||||
|
||||
List<TbConsInfo> selectAllInfo();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbProskuConMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbProskuCon record);
|
||||
|
||||
int insertSelective(TbProskuCon record);
|
||||
|
||||
TbProskuCon selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbProskuCon record);
|
||||
|
||||
int updateByPrimaryKey(TbProskuCon record);
|
||||
|
||||
|
||||
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
List<TbProskuCon> selectBySkuIdAndShopIdAngCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
|
||||
|
||||
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
|
||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductIdAndCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbConsInfo implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private Integer conTypeId;
|
||||
|
||||
private String conTypeName;
|
||||
|
||||
private String conCode;
|
||||
|
||||
private String conName;
|
||||
|
||||
private BigDecimal stockNumber;
|
||||
|
||||
private String conUnit;
|
||||
|
||||
private BigDecimal lasterInStock;
|
||||
|
||||
private BigDecimal conWarning;
|
||||
|
||||
private BigDecimal stockConsume;
|
||||
|
||||
private String status;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String isCheck;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public Integer getConTypeId() {
|
||||
return conTypeId;
|
||||
}
|
||||
|
||||
public void setConTypeId(Integer conTypeId) {
|
||||
this.conTypeId = conTypeId;
|
||||
}
|
||||
|
||||
public String getConTypeName() {
|
||||
return conTypeName;
|
||||
}
|
||||
|
||||
public void setConTypeName(String conTypeName) {
|
||||
this.conTypeName = conTypeName == null ? null : conTypeName.trim();
|
||||
}
|
||||
|
||||
public String getConCode() {
|
||||
return conCode;
|
||||
}
|
||||
|
||||
public void setConCode(String conCode) {
|
||||
this.conCode = conCode == null ? null : conCode.trim();
|
||||
}
|
||||
|
||||
public String getConName() {
|
||||
return conName;
|
||||
}
|
||||
|
||||
public void setConName(String conName) {
|
||||
this.conName = conName == null ? null : conName.trim();
|
||||
}
|
||||
|
||||
public BigDecimal getStockNumber() {
|
||||
return stockNumber;
|
||||
}
|
||||
|
||||
public void setStockNumber(BigDecimal stockNumber) {
|
||||
this.stockNumber = stockNumber;
|
||||
}
|
||||
|
||||
public String getConUnit() {
|
||||
return conUnit;
|
||||
}
|
||||
|
||||
public void setConUnit(String conUnit) {
|
||||
this.conUnit = conUnit == null ? null : conUnit.trim();
|
||||
}
|
||||
|
||||
public BigDecimal getLasterInStock() {
|
||||
return lasterInStock;
|
||||
}
|
||||
|
||||
public void setLasterInStock(BigDecimal lasterInStock) {
|
||||
this.lasterInStock = lasterInStock;
|
||||
}
|
||||
|
||||
public BigDecimal getConWarning() {
|
||||
return conWarning;
|
||||
}
|
||||
|
||||
public void setConWarning(BigDecimal conWarning) {
|
||||
this.conWarning = conWarning;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public BigDecimal getStockConsume() {
|
||||
return stockConsume;
|
||||
}
|
||||
|
||||
public void setStockConsume(BigDecimal stockConsume) {
|
||||
this.stockConsume = stockConsume;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getIsCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setIsCheck(String isCheck) {
|
||||
this.isCheck = isCheck;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbProskuCon implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private Integer productId;
|
||||
|
||||
private Integer productSkuId;
|
||||
|
||||
private Integer conInfoId;
|
||||
|
||||
private BigDecimal surplusStock;
|
||||
|
||||
private String status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public Integer getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Integer productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Integer getProductSkuId() {
|
||||
return productSkuId;
|
||||
}
|
||||
|
||||
public void setProductSkuId(Integer productSkuId) {
|
||||
this.productSkuId = productSkuId;
|
||||
}
|
||||
|
||||
public Integer getConInfoId() {
|
||||
return conInfoId;
|
||||
}
|
||||
|
||||
public void setConInfoId(Integer conInfoId) {
|
||||
this.conInfoId = conInfoId;
|
||||
}
|
||||
|
||||
public BigDecimal getSurplusStock() {
|
||||
return surplusStock;
|
||||
}
|
||||
|
||||
public void setSurplusStock(BigDecimal surplusStock) {
|
||||
this.surplusStock = surplusStock;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status == null ? null : status.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,13 @@ public class CartService {
|
||||
|
||||
private final RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TbProskuConMapper tbProskuConMapper;
|
||||
|
||||
@Autowired
|
||||
TbConsInfoMapper tbConsInfoMapper;
|
||||
|
||||
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate) {
|
||||
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
|
||||
this.wechatUtil = wechatUtil;
|
||||
@@ -171,6 +178,25 @@ public class CartService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<TbProskuCon> proskuConList= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(Integer.valueOf(skuId),Integer.valueOf(shopId),Integer.valueOf(productId));
|
||||
if(Objects.nonNull(proskuConList)&&proskuConList.size()>0){
|
||||
for (TbProskuCon proskuCon : proskuConList) {
|
||||
if("1".equals(proskuCon.getStatus())){
|
||||
TbConsInfo consInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||
if("1".equals(consInfo.getIsCheck())){
|
||||
if(N.gt(proskuCon.getSurplusStock(),consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))){
|
||||
return Result.fail("商品:".concat(tbProduct.getName()).concat("对应的:").concat(consInfo.getConName()).concat("耗材不足"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
try{
|
||||
|
||||
Reference in New Issue
Block a user