From 432692f1ed15edf7fc35afa242df3f73ac9016f8 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Mon, 12 Aug 2024 15:21:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=97=E9=93=BA=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E8=A1=A8=E5=8A=9F=E8=83=BD=EF=BC=9B=20?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 9 +- hiver-admin/test-output/test-report.html | 16 +-- .../controller/manage/AuthController.java | 24 +++- .../mall/controller/CustomerController.java | 11 ++ .../mall/controller/SupplierControlller.java | 33 ++++- .../java/cc/hiver/mall/dao/SupplierDao.java | 14 +- .../hiver/mall/dao/mapper/CustomerMapper.java | 2 + .../java/cc/hiver/mall/entity/ShopUser.java | 12 ++ .../hiver/mall/service/SupplierService.java | 13 +- .../mall/service/mybatis/CustomerService.java | 2 + .../mall/serviceimpl/SupplierServiceImpl.java | 18 ++- .../mybatis/CustomerServiceImpl.java | 6 + .../serviceimpl/mybatis/StockServiceImpl.java | 2 +- .../controller/ShopQrcodeController.java | 127 ++++++++++++++++++ .../mall/shopqrcode/entity/ShopQrcode.java | 27 ++++ .../shopqrcode/mapper/ShopQrcodeMapper.java | 20 +++ .../shopqrcode/service/ShopQrcodeService.java | 19 +++ .../service/impl/ShopQrcodeServiceImpl.java | 30 +++++ .../main/resources/mapper/CustomerMapper.xml | 9 ++ .../src/main/resources/mapper/SaleMapper.xml | 4 +- .../resources/mapper/ShopQrcodeMapper.xml | 31 +++++ 21 files changed, 403 insertions(+), 26 deletions(-) create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/controller/ShopQrcodeController.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/entity/ShopQrcode.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/mapper/ShopQrcodeMapper.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/ShopQrcodeService.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/impl/ShopQrcodeServiceImpl.java create mode 100644 hiver-modules/hiver-mall/src/main/resources/mapper/ShopQrcodeMapper.xml diff --git a/hiver-admin/src/main/resources/application.yml b/hiver-admin/src/main/resources/application.yml index ea40127b..d3d832b1 100644 --- a/hiver-admin/src/main/resources/application.yml +++ b/hiver-admin/src/main/resources/application.yml @@ -25,8 +25,8 @@ spring: timeout-per-shutdown-phase: 10S # 数据源 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://8.140.198.243: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 username: reddoor # Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456 password: ENC(Zla4U4+yRLPhicvuX2TmiEgxEpzP4dk8BHzFDEtiEhwLQIIaftZrrEUJZce6efoe) @@ -67,8 +67,8 @@ spring: ddl-auto: update # Redis 若设有密码自行添加配置password redis: - host: 154.8.162.157 -# host: 8.140.198.243 +# host: 154.8.162.157 + host: 8.140.198.243 password: reddoor168 # 数据库索引 默认0 database: 1 @@ -336,7 +336,6 @@ ignored: - /hiver/app/shop/getshopIconById # 临时增加 - - /hiver/app/debt/getAllDebtByShopId # 限流及黑名单不拦截的路径 limitUrls: - /**/*.js diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html index ab7ee4c4..d1a84232 100644 --- a/hiver-admin/test-output/test-report.html +++ b/hiver-admin/test-output/test-report.html @@ -35,7 +35,7 @@ Hiver
  • - 08, 2024 23:26:15 + 12, 2024 09:47:24
  • @@ -84,7 +84,7 @@

    passTest

    -

    23:26:16 / 0.016 secs

    +

    09:47:25 / 0.017 secs

    @@ -92,9 +92,9 @@
    #test-id=1
    passTest
    -08.08.2024 23:26:16 -08.08.2024 23:26:16 -0.016 secs +08.12.2024 09:47:25 +08.12.2024 09:47:25 +0.017 secs
    @@ -104,7 +104,7 @@ Pass - 23:26:16 + 9:47:25 Test passed @@ -128,13 +128,13 @@

    Started

    -

    08, 2024 23:26:15

    +

    12, 2024 09:47:24

    Ended

    -

    08, 2024 23:26:16

    +

    12, 2024 09:47:25

    diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java index 209b9c3b..91df83ac 100644 --- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java +++ b/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)) { // 获取 final List 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.size() == 1) { // 如果只有一个商铺,直接放到缓存中取 @@ -450,7 +461,7 @@ public class AuthController { supplier.setDelFlag(CommonConstant.DEL_FLAG_FALSE); supplierService.addSupplier(supplier); // 启用店铺的时候需要给该店铺新增一个散客的客户; - Customer customer = new Customer(); + final Customer customer = new Customer(); customer.setCreateBy(user.getId()); customer.setCreateByName(user.getNickname()); customer.setName("散客"); @@ -504,6 +515,17 @@ public class AuthController { final User u = securityUtil.getCurrUser(); // 获取 final List 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); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java index deb3f9fa..5c7e1526 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java @@ -216,4 +216,15 @@ public class CustomerController { return new ResultUtil>().setData(list); } + @RequestMapping(value = "/findByUserName", method = RequestMethod.POST) + @ApiOperation("根据客户名称精准查询查询客户列表") + public Result findByUserName(String userName) { + if(StringUtils.isEmpty(userName)){ + return ResultUtil.error("用户名不能为空"); + } + // shopId从缓存中设置 + final List list = customerService.findByUserName(userName); + return new ResultUtil>().setData(list); + } + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java index f225a49a..342132a7 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java +++ b/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.ResultUtil; 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.Result; import cc.hiver.core.entity.User; @@ -60,16 +61,17 @@ public class SupplierControlller { /** * 获取当前店铺所有供应商 + * + * @return Result> * @author 王富康 * @date 2023/10/29 - * @return Result> */ @RequestMapping(value = "/getbyShopId", method = RequestMethod.POST) @ApiOperation("获取当前店铺所有供应商") public Result> getbyShopId(String searchStr) { // 从缓存中拿到店铺id final String shopId = securityUtil.getShopId(); - final List suppliers = supplierService.getbyShopId(shopId,searchStr); + final List suppliers = supplierService.getbyShopId(shopId, searchStr); return new ResultUtil>().setData(suppliers); } @@ -143,18 +145,39 @@ public class SupplierControlller { /** * 批量通过ids删除 - * @author 王富康 - * @date 2024/1/3 + * * @param ids * @return Result + * @author 王富康 + * @date 2024/1/3 */ @RequestMapping(value = "/delByIds", method = RequestMethod.POST) @ApiOperation("批量通过ids删除") - public Result delByIds( String ids) { + public Result delByIds(String ids) { final String[] idsArray = ids.split(","); for (String id : idsArray) { supplierService.delById(id); } return ResultUtil.success("批量通过id删除数据成功"); } + + /** + * 根据供应商名称精准查询店铺下供应商 + * + * @param supplierName + * @return Result> + * @author 王富康 + * @date 2024/8/11 + */ + @RequestMapping(value = "/getbySupplierName", method = RequestMethod.POST) + @ApiOperation("根据供应商名称精准查询店铺下供应商") + public Result> getbySupplierName(String supplierName) { + if (StringUtils.isEmpty(supplierName)) { + return ResultUtil.error("供应商名称不能为空"); + } + // 从缓存中拿到店铺id + final String shopId = securityUtil.getShopId(); + final List suppliers = supplierService.getbySupplierName(supplierName, shopId); + return new ResultUtil>().setData(suppliers); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SupplierDao.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SupplierDao.java index f9eb83a6..60c6e8f1 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SupplierDao.java +++ b/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 { @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 getbyShopId(String shopId,String searchStr); + List getbyShopId(String shopId, String searchStr); @Modifying @Query(value = "update Supplier t set t.delFlag ='1' where t.id = ?1") void delById(String id); + + /** + * 根据供应商名称精准查询店铺下供应商 + * + * @param supplierName + * @param shopId + * @return List + * @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 getbySupplierName(String supplierName, String shopId); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/CustomerMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/CustomerMapper.java index ec18b52f..ba203798 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/CustomerMapper.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/CustomerMapper.java @@ -46,4 +46,6 @@ public interface CustomerMapper extends BaseMapper { void updatePhone(@Param("newMobile")String newMobile,@Param("userId") String userId); boolean batchDeleteCustomer(@Param("idList") List idList); + + List findByUserName(@Param("userName") String userName,@Param("shopId") String shopId); } \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java index 88e4a284..7b26b80e 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java @@ -1,6 +1,7 @@ package cc.hiver.mall.entity; import cc.hiver.core.base.HiverBaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -11,6 +12,7 @@ import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Entity; import javax.persistence.Table; +import javax.persistence.Transient; @Data @Accessors(chain = true) @@ -38,4 +40,14 @@ public class ShopUser extends HiverBaseEntity { @ApiModelProperty(value = "是否有维护成本权限 0:是;1否") private Integer type; + @Transient + @TableField(exist = false) + @ApiModelProperty(value = "店主名称") + private String shopOwnerName; + + @Transient + @TableField(exist = false) + @ApiModelProperty(value = "店主联系方式") + private String shopOwnerPhone; + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SupplierService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SupplierService.java index c9716dcc..2d72d16f 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SupplierService.java +++ b/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 { Page queryAll(Supplier supplierOfquery, Pageable pageable); - List getbyShopId(String shopId,String searchStr); + List getbyShopId(String shopId, String searchStr); void delById(String id); void addSupplier(Supplier supplier); + + /** + * 根据供应商名称精准查询店铺下供应商 + * + * @param supplierName + * @param shopId + * @return List + * @author 王富康 + * @date 2024/8/11 + */ + List getbySupplierName(String supplierName, String shopId); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java index 64e24c26..e9ad2548 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java @@ -22,4 +22,6 @@ public interface CustomerService extends IService { void updatePhone(String newMobile, String userId); boolean batchDeleteCustomer(String ids); + + List findByUserName(String userName); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java index 5d1494ae..5e28081a 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java @@ -52,7 +52,7 @@ public class SupplierServiceImpl implements SupplierService { public Page queryAll(Supplier supplierOfquery, Pageable pageable) { // 添加未删除标记 supplierOfquery.setDelFlag(CommonConstant.DEL_FLAG_FALSE); - final Page list = supplierDao.findAll(new Specification() { + final Page list = supplierDao.findAll(new Specification() { @Nullable @Override public Predicate toPredicate(Root root, CriteriaQuery cq, CriteriaBuilder cb) { @@ -85,7 +85,7 @@ public class SupplierServiceImpl implements SupplierService { // 添加到id列表中 idList.add(id); }); - if(!idList.isEmpty()){ + if (!idList.isEmpty()) { // 获取供应商的欠款信息 final List debtByUserIds = debtService.getDebtByUserIds(idList); // 变为map,key为userid, @@ -151,4 +151,18 @@ public class SupplierServiceImpl implements SupplierService { dealingsRecord.setDealingsType(DealingsRecordConstant.DEALINGS_TYPE[3]); dealingsRecordService.save(dealingsRecord); } + + /** + * 根据供应商名称精准查询店铺下供应商 + * + * @param supplierName + * @param shopId + * @return List + * @author 王富康 + * @date 2024/8/11 + */ + @Override + public List getbySupplierName(String supplierName, String shopId) { + return supplierDao.getbySupplierName(supplierName, shopId); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java index f1369481..39e5da0d 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java @@ -208,4 +208,10 @@ public class CustomerServiceImpl extends ServiceImpl i final List idList = Arrays.asList(ids.split(",")); return customerMapper.batchDeleteCustomer(idList); } + + @Override + public List findByUserName(String userName) { + String shopId = securityUtil.getShopId(); + return customerMapper.findByUserName(userName,shopId); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java index f67c40b6..c64b2f96 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java @@ -604,7 +604,7 @@ public class StockServiceImpl extends ServiceImpl implements final Integer tailWarn = product.getTailWarn(); //平均采购价 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计算 if (thisStockCount > 0) { final BigDecimal thisStockCost = purchasePrice.multiply(BigDecimal.valueOf(thisStockCount)); diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/controller/ShopQrcodeController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/controller/ShopQrcodeController.java new file mode 100644 index 00000000..e918610f --- /dev/null +++ b/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 = shopQrcodeService.getShopQrcodeByShopId(shopId); + if (shopQrcode != null) { + return new ResultUtil>().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("删除失败"); + } + } +} diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/entity/ShopQrcode.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/entity/ShopQrcode.java new file mode 100644 index 00000000..c011958b --- /dev/null +++ b/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; + +} diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/mapper/ShopQrcodeMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/mapper/ShopQrcodeMapper.java new file mode 100644 index 00000000..39831920 --- /dev/null +++ b/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 { + + /** + * 根据店铺id获取二维码 + * + * @param shopId + * @return List + * @author 王富康 + * @date 2024/8/11 + */ + List getShopQrcodeByShopId(@Param("shopId") String shopId); +} diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/ShopQrcodeService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/ShopQrcodeService.java new file mode 100644 index 00000000..a4012d26 --- /dev/null +++ b/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 { + + /** + * 根据店铺id获取二维码 + * + * @param shopId + * @return List + * @author 王富康 + * @date 2024/8/11 + */ + List getShopQrcodeByShopId(String shopId); +} diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/impl/ShopQrcodeServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shopqrcode/service/impl/ShopQrcodeServiceImpl.java new file mode 100644 index 00000000..351c4652 --- /dev/null +++ b/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 implements ShopQrcodeService { + + @Autowired + private ShopQrcodeMapper shopQrcodeMapper; + + /** + * 根据店铺id获取二维码 + * + * @param shopId + * @return List + * @author 王富康 + * @date 2024/8/11 + */ + @Override + public List getShopQrcodeByShopId(String shopId) { + return shopQrcodeMapper.getShopQrcodeByShopId(shopId); + } +} diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml index 5bcc72e0..6c96956c 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml @@ -450,4 +450,13 @@ #{listItem} + + \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml index e47b6cd3..46b5187d 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml +++ b/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 not in ('6','7') and ts.del_flag = #{saleVO.delFlag} - + and ts.status = #{saleVO.status} diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ShopQrcodeMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopQrcodeMapper.xml new file mode 100644 index 00000000..7b0b1844 --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopQrcodeMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + id, create_by, create_time, del_flag, update_by, update_time, shop_id, shop_name, qrcode_name, + qrcode_path, qrcode_server_path + + + + + + \ No newline at end of file