Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
2024-09-27 10:38:09 +08:00
11 changed files with 371 additions and 9 deletions

View File

@@ -143,6 +143,7 @@ public class MemberService {
tbShopUser.setLevel(Byte.parseByte(String.valueOf(map.get("level"))));
tbShopUser.setIsVip(Byte.parseByte("1"));
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUser.setJoinTime(new Date());
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
return Result.success(CodeEnum.SUCCESS);
}
@@ -168,6 +169,7 @@ public class MemberService {
tbShopUser.setCode(code);
tbShopUser.setIsVip(Byte.parseByte("1"));
tbShopUser.setCreatedAt(System.currentTimeMillis());
tbShopUser.setJoinTime(new Date());
tbShopUserMapper.insert(tbShopUser);
return Result.success(CodeEnum.SUCCESS);
}

View File

@@ -196,7 +196,7 @@ public class ProductService {
}
}
public void updateStock(ProductStockDTO productStockDTO) {
public void updateStock(ProductStockDTO productStockDTO,String loginName) {
TbProduct product = tbProductMapper.selectByShopIdAndId(productStockDTO.getProductId(), productStockDTO.getShopId());
if (product == null) {
throw new MsgException("商品不存在");
@@ -204,7 +204,7 @@ public class ProductService {
if (product.getIsDistribute() != 1 && product.getTypeEnum().equals("sku")) {
throw new MsgException("多规格非共享商品暂不支持修改库存");
}else {
} else {
tbProductMapper.updateStock(productStockDTO.getShopId(), productStockDTO.getProductId(), productStockDTO.getStock());
tbProductSkuMapper.updateStock(productStockDTO.getShopId(), productStockDTO.getProductId(), productStockDTO.getStock());
@@ -213,9 +213,16 @@ public class ProductService {
data.put("shopId", productStockDTO.getShopId());
data.put("skuId", tbProductSkus.isEmpty() ? null : tbProductSkus.get(0).getId());
data.put("productId", productStockDTO.getProductId());
data.put("type", "pc收银机修改库存");
// data.put("type", "pc收银机修改库存");
data.put("subType", product.getStockNumber() > productStockDTO.getStock() ? -1 : 1);
data.put("number",productStockDTO.getStock() - product.getStockNumber());
data.put("number", productStockDTO.getStock() - product.getStockNumber());
data.put("operator", loginName);
data.put("remark", "pc收银机修改库存");
if (product.getStockNumber() > productStockDTO.getStock()) {
data.put("type", "盘点出库");
}else {
data.put("type", "盘点入库");
}
producer.sendStockRecordMsg(data);
}
}

View File

@@ -0,0 +1,30 @@
package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.entity.dto.ShopPrinterDTO;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Map;
/**
* 打印机配置
* @author tankaikai
* @since 2024-09-24 17:15
*/
public interface ShopPrinterService {
PageInfo<ShopPrinterDTO> page(Map<String, Object> params);
List<ShopPrinterDTO> list(Map<String, Object> params);
ShopPrinterDTO get(Integer id);
void save(ShopPrinterDTO dto);
void update(ShopPrinterDTO dto);
void delete(Integer id);
void updateStatus(Integer id,Integer status);
}

View File

@@ -0,0 +1,79 @@
package com.chaozhanggui.system.cashierservice.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapProxy;
import com.chaozhanggui.system.cashierservice.dao.ShopPrinterServiceMapper;
import com.chaozhanggui.system.cashierservice.dao.TbPrintMachineMapper;
import com.chaozhanggui.system.cashierservice.entity.TbPrintMachineWithBLOBs;
import com.chaozhanggui.system.cashierservice.entity.dto.ShopPrinterDTO;
import com.chaozhanggui.system.cashierservice.service.ShopPrinterService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 店铺打印配置
*
* @author tankaikai
* @since 2024-09-24 17:23
*/
@Service
public class ShopPrinterServiceImpl implements ShopPrinterService {
@Resource
private ShopPrinterServiceMapper shopPrinterServiceMapper;
@Resource
private TbPrintMachineMapper tbPrintMachineMapper;
@Override
public PageInfo<ShopPrinterDTO> page(Map<String, Object> params) {
MapProxy mapProxy = MapProxy.create(params);
Integer pageNum = mapProxy.getInt("pageNum");
Integer pageSize = mapProxy.getInt("pageSize");
PageInfo<ShopPrinterDTO> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> shopPrinterServiceMapper.getList(params));
return pageInfo;
}
@Override
public List<ShopPrinterDTO> list(Map<String, Object> params) {
return shopPrinterServiceMapper.getList(params);
}
@Override
public ShopPrinterDTO get(Integer id) {
TbPrintMachineWithBLOBs entity = tbPrintMachineMapper.selectByPrimaryKey(id);
return BeanUtil.toBean(entity, ShopPrinterDTO.class);
}
@Override
public void save(ShopPrinterDTO dto) {
TbPrintMachineWithBLOBs entity = new TbPrintMachineWithBLOBs();
BeanUtil.copyProperties(dto, entity, "createdAt", "updatedAt");
entity.setCreatedAt(System.currentTimeMillis());
entity.setUpdatedAt(System.currentTimeMillis());
tbPrintMachineMapper.insert(entity);
}
@Override
public void update(ShopPrinterDTO dto) {
TbPrintMachineWithBLOBs entity = tbPrintMachineMapper.selectByPrimaryKey(dto.getId());
BeanUtil.copyProperties(dto, entity, "createdAt", "updatedAt");
entity.setUpdatedAt(System.currentTimeMillis());
tbPrintMachineMapper.updateByPrimaryKeyWithBLOBs(entity);
}
@Override
public void delete(Integer id) {
tbPrintMachineMapper.deleteByPrimaryKey(id);
}
@Override
public void updateStatus(Integer id, Integer status) {
shopPrinterServiceMapper.updateStatus(id, status);
}
}