Browse Source

增加店铺二维码表功能;

其他问题处理。
dev
wangfukang 2 years ago
parent
commit
432692f1ed
  1. 9
      hiver-admin/src/main/resources/application.yml
  2. 16
      hiver-admin/test-output/test-report.html
  3. 24
      hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
  4. 11
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java
  5. 33
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java
  6. 14
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SupplierDao.java
  7. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/CustomerMapper.java
  8. 12
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java
  9. 13
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SupplierService.java
  10. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java
  11. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java
  12. 6
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java
  13. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
  14. 127
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/controller/ShopQrcodeController.java
  15. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/entity/ShopQrcode.java
  16. 20
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/mapper/ShopQrcodeMapper.java
  17. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/ShopQrcodeService.java
  18. 30
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/impl/ShopQrcodeServiceImpl.java
  19. 9
      hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml
  20. 4
      hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml
  21. 31
      hiver-modules/hiver-mall/src/main/resources/mapper/ShopQrcodeMapper.xml

9
hiver-admin/src/main/resources/application.yml

@ -25,8 +25,8 @@ spring:
timeout-per-shutdown-phase: 10S timeout-per-shutdown-phase: 10S
# 数据源 # 数据源
datasource: datasource:
url: jdbc:mysql://154.8.162.157:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true # url: jdbc:mysql://154.8.162.157:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true
# url: jdbc:mysql://8.140.198.243:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true url: jdbc:mysql://8.140.198.243:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true
username: reddoor username: reddoor
# Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456 # Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456
password: ENC(Zla4U4+yRLPhicvuX2TmiEgxEpzP4dk8BHzFDEtiEhwLQIIaftZrrEUJZce6efoe) password: ENC(Zla4U4+yRLPhicvuX2TmiEgxEpzP4dk8BHzFDEtiEhwLQIIaftZrrEUJZce6efoe)
@ -67,8 +67,8 @@ spring:
ddl-auto: update ddl-auto: update
# Redis 若设有密码自行添加配置password # Redis 若设有密码自行添加配置password
redis: redis:
host: 154.8.162.157 # host: 154.8.162.157
# host: 8.140.198.243 host: 8.140.198.243
password: reddoor168 password: reddoor168
# 数据库索引 默认0 # 数据库索引 默认0
database: 1 database: 1
@ -336,7 +336,6 @@ ignored:
- /hiver/app/shop/getshopIconById - /hiver/app/shop/getshopIconById
# 临时增加 # 临时增加
- /hiver/app/debt/getAllDebtByShopId
# 限流及黑名单不拦截的路径 # 限流及黑名单不拦截的路径
limitUrls: limitUrls:
- /**/*.js - /**/*.js

16
hiver-admin/test-output/test-report.html

@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a> <a href="#"><span class="badge badge-primary">Hiver</span></a>
</li> </li>
<li class="m-r-10"> <li class="m-r-10">
<a href="#"><span class="badge badge-primary">八月 08, 2024 23:26:15</span></a> <a href="#"><span class="badge badge-primary">八月 12, 2024 09:47:24</span></a>
</li> </li>
</ul> </ul>
</div> </div>
@ -84,7 +84,7 @@
<div class="test-detail"> <div class="test-detail">
<span class="meta text-white badge badge-sm"></span> <span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p> <p class="name">passTest</p>
<p class="text-sm"><span>23:26:16 下</span> / <span>0.016 secs</span></p> <p class="text-sm"><span>09:47:25 上</span> / <span>0.017 secs</span></p>
</div> </div>
<div class="test-contents d-none"> <div class="test-contents d-none">
<div class="detail-head"> <div class="detail-head">
@ -92,9 +92,9 @@
<div class="info"> <div class="info">
<div class='float-right'><span class='badge badge-default'>#test-id=1</span></div> <div class='float-right'><span class='badge badge-default'>#test-id=1</span></div>
<h5 class="test-status text-pass">passTest</h5> <h5 class="test-status text-pass">passTest</h5>
<span class='badge badge-success'>08.08.2024 23:26:16</span> <span class='badge badge-success'>08.12.2024 09:47:25</span>
<span class='badge badge-danger'>08.08.2024 23:26:16</span> <span class='badge badge-danger'>08.12.2024 09:47:25</span>
<span class='badge badge-default'>0.016 secs</span> <span class='badge badge-default'>0.017 secs</span>
</div> </div>
<div class="m-t-10 m-l-5"></div> <div class="m-t-10 m-l-5"></div>
</div> </div>
@ -104,7 +104,7 @@
<tbody> <tbody>
<tr class="event-row"> <tr class="event-row">
<td><span class="badge log pass-bg">Pass</span></td> <td><span class="badge log pass-bg">Pass</span></td>
<td>23:26:16</td> <td>9:47:25</td>
<td> <td>
Test passed Test passed
</td> </td>
@ -128,13 +128,13 @@
<div class="col-md-3"> <div class="col-md-3">
<div class="card"><div class="card-body"> <div class="card"><div class="card-body">
<p class="m-b-0">Started</p> <p class="m-b-0">Started</p>
<h3>八月 08, 2024 23:26:15</h3> <h3>八月 12, 2024 09:47:24</h3>
</div></div> </div></div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<div class="card"><div class="card-body"> <div class="card"><div class="card-body">
<p class="m-b-0">Ended</p> <p class="m-b-0">Ended</p>
<h3>八月 08, 2024 23:26:16</h3> <h3>八月 12, 2024 09:47:25</h3>
</div></div> </div></div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

24
hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java

@ -176,6 +176,17 @@ public class AuthController {
if (UserConstant.USER_TYPE_NORMAL.equals(type)) { if (UserConstant.USER_TYPE_NORMAL.equals(type)) {
// 获取 // 获取
final List<ShopUser> shopUsers = shopUserService.selectByUserId(user.getId()); final List<ShopUser> shopUsers = shopUserService.selectByUserId(user.getId());
if(shopUsers != null && !shopUsers.isEmpty()){
// 获取店主手机号
final Shop shop = shopService.findById(shopUsers.get(0).getShopId());
if(shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())){
final User shopOwner = userService.get(shop.getShopOwnerId());
for (ShopUser shopUser : shopUsers) {
shopUser.setShopOwnerName(shopOwner.getNickname());
shopUser.setShopOwnerPhone(shopOwner.getMobile());
}
}
}
if (!shopUsers.isEmpty()) { if (!shopUsers.isEmpty()) {
/*if (shopUsers.size() == 1) { /*if (shopUsers.size() == 1) {
// 如果只有一个商铺,直接放到缓存中取 // 如果只有一个商铺,直接放到缓存中取
@ -450,7 +461,7 @@ public class AuthController {
supplier.setDelFlag(CommonConstant.DEL_FLAG_FALSE); supplier.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
supplierService.addSupplier(supplier); supplierService.addSupplier(supplier);
// 启用店铺的时候需要给该店铺新增一个散客的客户; // 启用店铺的时候需要给该店铺新增一个散客的客户;
Customer customer = new Customer(); final Customer customer = new Customer();
customer.setCreateBy(user.getId()); customer.setCreateBy(user.getId());
customer.setCreateByName(user.getNickname()); customer.setCreateByName(user.getNickname());
customer.setName("散客"); customer.setName("散客");
@ -504,6 +515,17 @@ public class AuthController {
final User u = securityUtil.getCurrUser(); final User u = securityUtil.getCurrUser();
// 获取 // 获取
final List<ShopUser> shopUsers = shopUserService.selectByUserId(u.getId()); final List<ShopUser> shopUsers = shopUserService.selectByUserId(u.getId());
if(shopUsers != null && !shopUsers.isEmpty()){
// 获取店主手机号
final Shop shop = shopService.findById(shopUsers.get(0).getShopId());
if(shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())){
final User user = userService.get(shop.getShopOwnerId());
for (ShopUser shopUser : shopUsers) {
shopUser.setShopOwnerName(user.getNickname());
shopUser.setShopOwnerPhone(user.getMobile());
}
}
}
return ResultUtil.data(shopUsers); return ResultUtil.data(shopUsers);
} }

11
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java

@ -216,4 +216,15 @@ public class CustomerController {
return new ResultUtil<List<String>>().setData(list); return new ResultUtil<List<String>>().setData(list);
} }
@RequestMapping(value = "/findByUserName", method = RequestMethod.POST)
@ApiOperation("根据客户名称精准查询查询客户列表")
public Result findByUserName(String userName) {
if(StringUtils.isEmpty(userName)){
return ResultUtil.error("用户名不能为空");
}
// shopId从缓存中设置
final List<Customer> list = customerService.findByUserName(userName);
return new ResultUtil<List<Customer>>().setData(list);
}
} }

33
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java

@ -5,6 +5,7 @@ import cc.hiver.core.common.constant.DealingsRecordConstant;
import cc.hiver.core.common.utils.PageUtil; import cc.hiver.core.common.utils.PageUtil;
import cc.hiver.core.common.utils.ResultUtil; import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.utils.SecurityUtil; import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.utils.StringUtils;
import cc.hiver.core.common.vo.PageVo; import cc.hiver.core.common.vo.PageVo;
import cc.hiver.core.common.vo.Result; import cc.hiver.core.common.vo.Result;
import cc.hiver.core.entity.User; import cc.hiver.core.entity.User;
@ -60,16 +61,17 @@ public class SupplierControlller {
/** /**
* 获取当前店铺所有供应商 * 获取当前店铺所有供应商
*
* @return Result<List < Supplier>>
* @author 王富康 * @author 王富康
* @date 2023/10/29 * @date 2023/10/29
* @return Result<List<Supplier>>
*/ */
@RequestMapping(value = "/getbyShopId", method = RequestMethod.POST) @RequestMapping(value = "/getbyShopId", method = RequestMethod.POST)
@ApiOperation("获取当前店铺所有供应商") @ApiOperation("获取当前店铺所有供应商")
public Result<List<Supplier>> getbyShopId(String searchStr) { public Result<List<Supplier>> getbyShopId(String searchStr) {
// 从缓存中拿到店铺id // 从缓存中拿到店铺id
final String shopId = securityUtil.getShopId(); final String shopId = securityUtil.getShopId();
final List<Supplier> suppliers = supplierService.getbyShopId(shopId,searchStr); final List<Supplier> suppliers = supplierService.getbyShopId(shopId, searchStr);
return new ResultUtil<List<Supplier>>().setData(suppliers); return new ResultUtil<List<Supplier>>().setData(suppliers);
} }
@ -143,18 +145,39 @@ public class SupplierControlller {
/** /**
* 批量通过ids删除 * 批量通过ids删除
* @author 王富康 *
* @date 2024/1/3
* @param ids * @param ids
* @return Result * @return Result
* @author 王富康
* @date 2024/1/3
*/ */
@RequestMapping(value = "/delByIds", method = RequestMethod.POST) @RequestMapping(value = "/delByIds", method = RequestMethod.POST)
@ApiOperation("批量通过ids删除") @ApiOperation("批量通过ids删除")
public Result delByIds( String ids) { public Result delByIds(String ids) {
final String[] idsArray = ids.split(","); final String[] idsArray = ids.split(",");
for (String id : idsArray) { for (String id : idsArray) {
supplierService.delById(id); supplierService.delById(id);
} }
return ResultUtil.success("批量通过id删除数据成功"); return ResultUtil.success("批量通过id删除数据成功");
} }
/**
* 根据供应商名称精准查询店铺下供应商
*
* @param supplierName
* @return Result<List < Supplier>>
* @author 王富康
* @date 2024/8/11
*/
@RequestMapping(value = "/getbySupplierName", method = RequestMethod.POST)
@ApiOperation("根据供应商名称精准查询店铺下供应商")
public Result<List<Supplier>> getbySupplierName(String supplierName) {
if (StringUtils.isEmpty(supplierName)) {
return ResultUtil.error("供应商名称不能为空");
}
// 从缓存中拿到店铺id
final String shopId = securityUtil.getShopId();
final List<Supplier> suppliers = supplierService.getbySupplierName(supplierName, shopId);
return new ResultUtil<List<Supplier>>().setData(suppliers);
}
} }

14
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SupplierDao.java

@ -10,9 +10,21 @@ import java.util.List;
public interface SupplierDao extends HiverBaseDao<Supplier, String> { public interface SupplierDao extends HiverBaseDao<Supplier, String> {
@Query(value = "select * from t_supplier t where t.del_flag ='0' and t.shop_id = ?1 and if(?2 is not null and ?2!='',(consignee_Name like concat('%',?2,'%') or consignee_mobile like concat('%',?2,'%')), 1=1)", nativeQuery = true) @Query(value = "select * from t_supplier t where t.del_flag ='0' and t.shop_id = ?1 and if(?2 is not null and ?2!='',(consignee_Name like concat('%',?2,'%') or consignee_mobile like concat('%',?2,'%')), 1=1)", nativeQuery = true)
List<Supplier> getbyShopId(String shopId,String searchStr); List<Supplier> getbyShopId(String shopId, String searchStr);
@Modifying @Modifying
@Query(value = "update Supplier t set t.delFlag ='1' where t.id = ?1") @Query(value = "update Supplier t set t.delFlag ='1' where t.id = ?1")
void delById(String id); void delById(String id);
/**
* 根据供应商名称精准查询店铺下供应商
*
* @param supplierName
* @param shopId
* @return List<Supplier>
* @author 王富康
* @date 2024/8/11
*/
@Query(value = "select * from t_supplier t where t.del_flag ='0' and t.shop_id = ?2 and consignee_name = ?1", nativeQuery = true)
List<Supplier> getbySupplierName(String supplierName, String shopId);
} }

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/CustomerMapper.java

@ -46,4 +46,6 @@ public interface CustomerMapper extends BaseMapper<Customer> {
void updatePhone(@Param("newMobile")String newMobile,@Param("userId") String userId); void updatePhone(@Param("newMobile")String newMobile,@Param("userId") String userId);
boolean batchDeleteCustomer(@Param("idList") List<String> idList); boolean batchDeleteCustomer(@Param("idList") List<String> idList);
List<Customer> findByUserName(@Param("userName") String userName,@Param("shopId") String shopId);
} }

12
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java

@ -1,6 +1,7 @@
package cc.hiver.mall.entity; package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity; import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -11,6 +12,7 @@ import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ -38,4 +40,14 @@ public class ShopUser extends HiverBaseEntity {
@ApiModelProperty(value = "是否有维护成本权限 0:是;1否") @ApiModelProperty(value = "是否有维护成本权限 0:是;1否")
private Integer type; private Integer type;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "店主名称")
private String shopOwnerName;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "店主联系方式")
private String shopOwnerPhone;
} }

13
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SupplierService.java

@ -10,9 +10,20 @@ import java.util.List;
public interface SupplierService extends HiverBaseService<Supplier, String> { public interface SupplierService extends HiverBaseService<Supplier, String> {
Page<Supplier> queryAll(Supplier supplierOfquery, Pageable pageable); Page<Supplier> queryAll(Supplier supplierOfquery, Pageable pageable);
List<Supplier> getbyShopId(String shopId,String searchStr); List<Supplier> getbyShopId(String shopId, String searchStr);
void delById(String id); void delById(String id);
void addSupplier(Supplier supplier); void addSupplier(Supplier supplier);
/**
* 根据供应商名称精准查询店铺下供应商
*
* @param supplierName
* @param shopId
* @return List<Supplier>
* @author 王富康
* @date 2024/8/11
*/
List<Supplier> getbySupplierName(String supplierName, String shopId);
} }

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java

@ -22,4 +22,6 @@ public interface CustomerService extends IService<Customer> {
void updatePhone(String newMobile, String userId); void updatePhone(String newMobile, String userId);
boolean batchDeleteCustomer(String ids); boolean batchDeleteCustomer(String ids);
List<Customer> findByUserName(String userName);
} }

16
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java

@ -85,7 +85,7 @@ public class SupplierServiceImpl implements SupplierService {
// 添加到id列表中 // 添加到id列表中
idList.add(id); idList.add(id);
}); });
if(!idList.isEmpty()){ if (!idList.isEmpty()) {
// 获取供应商的欠款信息 // 获取供应商的欠款信息
final List<Debt> debtByUserIds = debtService.getDebtByUserIds(idList); final List<Debt> debtByUserIds = debtService.getDebtByUserIds(idList);
// 变为map,key为userid, // 变为map,key为userid,
@ -151,4 +151,18 @@ public class SupplierServiceImpl implements SupplierService {
dealingsRecord.setDealingsType(DealingsRecordConstant.DEALINGS_TYPE[3]); dealingsRecord.setDealingsType(DealingsRecordConstant.DEALINGS_TYPE[3]);
dealingsRecordService.save(dealingsRecord); dealingsRecordService.save(dealingsRecord);
} }
/**
* 根据供应商名称精准查询店铺下供应商
*
* @param supplierName
* @param shopId
* @return List<Supplier>
* @author 王富康
* @date 2024/8/11
*/
@Override
public List<Supplier> getbySupplierName(String supplierName, String shopId) {
return supplierDao.getbySupplierName(supplierName, shopId);
}
} }

6
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java

@ -208,4 +208,10 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
final List<String> idList = Arrays.asList(ids.split(",")); final List<String> idList = Arrays.asList(ids.split(","));
return customerMapper.batchDeleteCustomer(idList); return customerMapper.batchDeleteCustomer(idList);
} }
@Override
public List<Customer> findByUserName(String userName) {
String shopId = securityUtil.getShopId();
return customerMapper.findByUserName(userName,shopId);
}
} }

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java

@ -604,7 +604,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
final Integer tailWarn = product.getTailWarn(); final Integer tailWarn = product.getTailWarn();
//平均采购价 //平均采购价
final BigDecimal purchasePrice = product.getPurchasePrice() == null ? new BigDecimal(0) : product.getPurchasePrice(); final BigDecimal purchasePrice = product.getPurchasePrice() == null ? new BigDecimal(0) : product.getPurchasePrice();
final Integer thisStockCount = stock.getStockCount(); final Integer thisStockCount = stock.getStockCount()==null?0:stock.getStockCount();
// 计算成本,负数按0计算 // 计算成本,负数按0计算
if (thisStockCount > 0) { if (thisStockCount > 0) {
final BigDecimal thisStockCost = purchasePrice.multiply(BigDecimal.valueOf(thisStockCount)); final BigDecimal thisStockCost = purchasePrice.multiply(BigDecimal.valueOf(thisStockCount));

127
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/controller/ShopQrcodeController.java

@ -0,0 +1,127 @@
package cc.hiver.mall.shopqrcode.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.shopqrcode.entity.ShopQrcode;
import cc.hiver.mall.shopqrcode.service.ShopQrcodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j
@RestController
@Api(tags = "店铺二维码接口")
@RequestMapping("/hiver/app/shopQrcode/")
@Transactional
public class ShopQrcodeController {
@Autowired
private ShopQrcodeService shopQrcodeService;
/**
* 新增店铺二维码
*
* @param shopQrcode
* @return Result
* @author 王富康
* @date 2024/8/11
*/
@PostMapping(value = "/addProductSn")
@ApiOperation("新增店铺二维码")
public Result addShopQrcode(@RequestBody ShopQrcode shopQrcode) {
if (StringUtils.isEmpty(shopQrcode.getQrcodeName())) {
return ResultUtil.error("二维码名称不能为空");
}
if (StringUtils.isEmpty(shopQrcode.getQrcodePath())) {
return ResultUtil.error("二维码路径不能为空");
}
final boolean save = shopQrcodeService.save(shopQrcode);
if (save) {
return ResultUtil.success("新增成功");
} else {
return ResultUtil.error("新增失败");
}
}
/**
* 根据店铺id获取二维码
*
* @param shopId
* @return Result
* @author 王富康
* @date 2024/8/11
*/
@PostMapping(value = "/getShopQrcodeByShopId")
@ApiOperation("根据店铺id获取二维码")
public Result getShopQrcodeByShopId(String shopId) {
if (StringUtils.isEmpty(shopId)) {
return ResultUtil.error("店铺id不能为空");
}
final List<ShopQrcode> shopQrcode = shopQrcodeService.getShopQrcodeByShopId(shopId);
if (shopQrcode != null) {
return new ResultUtil<List<ShopQrcode>>().setData(shopQrcode);
} else {
return ResultUtil.error("查询失败");
}
}
/**
* 更新二维码
*
* @param shopQrcode
* @return Result
* @author 王富康
* @date 2024/8/11
*/
@PostMapping(value = "/updateShopQrcode")
@ApiOperation("更新二维码")
public Result updateShopQrcode(@RequestBody ShopQrcode shopQrcode) {
if (StringUtils.isEmpty(shopQrcode.getId())) {
return ResultUtil.error("二维码id不能为空");
}
if (StringUtils.isEmpty(shopQrcode.getQrcodeName())) {
return ResultUtil.error("二维码名称不能为空");
}
if (StringUtils.isEmpty(shopQrcode.getQrcodePath())) {
return ResultUtil.error("二维码路径不能为空");
}
final boolean update = shopQrcodeService.updateById(shopQrcode);
if (update) {
return ResultUtil.success("更新成功");
} else {
return ResultUtil.error("更新失败");
}
}
/**
* 删除二维码
*
* @param id
* @return Result
* @author 王富康
* @date 2024/8/11
*/
@PostMapping(value = "/deleteShopQrcode")
@ApiOperation("")
public Result deleteShopQrcode(String id) {
if (StringUtils.isEmpty(id)) {
return ResultUtil.error("二维码id不能为空");
}
final boolean removeById = shopQrcodeService.removeById(id);
if (removeById) {
return ResultUtil.success("删除成功");
} else {
return ResultUtil.error("删除失败");
}
}
}

27
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/entity/ShopQrcode.java

@ -0,0 +1,27 @@
package cc.hiver.mall.shopqrcode.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "货号规则")
@TableName(value = "t_shop_qrcode", autoResultMap = true)
public class ShopQrcode extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "店铺ID")
private String shopId;
@ApiModelProperty(value = "店铺名称")
private String shopName;
@ApiModelProperty(value = "二维码名称")
private String qrcodeName;
@ApiModelProperty(value = "二维码路径")
private String qrcodePath;
@ApiModelProperty(value = "二维码图片阿里云存放路径")
private String qrcodeServerPath;
}

20
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/mapper/ShopQrcodeMapper.java

@ -0,0 +1,20 @@
package cc.hiver.mall.shopqrcode.mapper;
import cc.hiver.mall.shopqrcode.entity.ShopQrcode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ShopQrcodeMapper extends BaseMapper<ShopQrcode> {
/**
* 根据店铺id获取二维码
*
* @param shopId
* @return List<ShopQrcode>
* @author 王富康
* @date 2024/8/11
*/
List<ShopQrcode> getShopQrcodeByShopId(@Param("shopId") String shopId);
}

19
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/ShopQrcodeService.java

@ -0,0 +1,19 @@
package cc.hiver.mall.shopqrcode.service;
import cc.hiver.mall.shopqrcode.entity.ShopQrcode;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface ShopQrcodeService extends IService<ShopQrcode> {
/**
* 根据店铺id获取二维码
*
* @param shopId
* @return List<ShopQrcode>
* @author 王富康
* @date 2024/8/11
*/
List<ShopQrcode> getShopQrcodeByShopId(String shopId);
}

30
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/impl/ShopQrcodeServiceImpl.java

@ -0,0 +1,30 @@
package cc.hiver.mall.shopqrcode.service.impl;
import cc.hiver.mall.shopqrcode.entity.ShopQrcode;
import cc.hiver.mall.shopqrcode.mapper.ShopQrcodeMapper;
import cc.hiver.mall.shopqrcode.service.ShopQrcodeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ShopQrcodeServiceImpl extends ServiceImpl<ShopQrcodeMapper, ShopQrcode> implements ShopQrcodeService {
@Autowired
private ShopQrcodeMapper shopQrcodeMapper;
/**
* 根据店铺id获取二维码
*
* @param shopId
* @return List<ShopQrcode>
* @author 王富康
* @date 2024/8/11
*/
@Override
public List<ShopQrcode> getShopQrcodeByShopId(String shopId) {
return shopQrcodeMapper.getShopQrcodeByShopId(shopId);
}
}

9
hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml

@ -450,4 +450,13 @@
#{listItem} #{listItem}
</foreach> </foreach>
</update> </update>
<select id="findByUserName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_customer a
where del_flag = '0'
and a.shop_id = #{shopId,jdbcType=VARCHAR}
and a.name = #{userName,jdbcType=VARCHAR}
</select>
</mapper> </mapper>

4
hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml

@ -862,14 +862,14 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
and ts.status = #{saleVO.status} and ts.status = #{saleVO.status}
</if> </if>
</if> </if>
<if test='saleVO.fromWhere == null or saleVO.fromWhere.trim() eq ""'> <if test='saleVO.fromWhere == null or saleVO.fromWhere eq ""'>
and ts.status not in ('6','7') and ts.status not in ('6','7')
</if> </if>
<if test='saleVO.delFlag!=null and saleVO.delFlag.trim() neq ""'> <if test='saleVO.delFlag!=null and saleVO.delFlag.trim() neq ""'>
and ts.del_flag = #{saleVO.delFlag} and ts.del_flag = #{saleVO.delFlag}
</if> </if>
<if test='saleVO.status!=null and saleVO.delFlag.trim() neq ""'> <if test='saleVO.status != null and saleVO.status.trim() neq ""'>
and ts.status = #{saleVO.status} and ts.status = #{saleVO.status}
</if> </if>
<if test='saleVO.transportType!=null'> <if test='saleVO.transportType!=null'>

31
hiver-modules/hiver-mall/src/main/resources/mapper/ShopQrcodeMapper.xml

@ -0,0 +1,31 @@
<?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="cc.hiver.mall.shopqrcode.mapper.ShopQrcodeMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.shopqrcode.entity.ShopQrcode">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
<result column="shop_name" jdbcType="VARCHAR" property="shopName" />
<result column="qrcode_name" jdbcType="VARCHAR" property="qrcodeName" />
<result column="qrcode_path" jdbcType="VARCHAR" property="qrcodePath" />
<result column="qrcode_server_path" jdbcType="VARCHAR" property="qrcodeServerPath" />
</resultMap>
<sql id="Base_Column_List">
id, create_by, create_time, del_flag, update_by, update_time, shop_id, shop_name, qrcode_name,
qrcode_path, qrcode_server_path
</sql>
<!--查询当前段铺的货号规则-->
<select id="getShopQrcodeByShopId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_shop_qrcode
where shop_id = #{shopId,jdbcType=VARCHAR}
</select>
</mapper>
Loading…
Cancel
Save