diff --git a/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/java/com/bsd/pjcloud/supermarket/controller/SupermarketSpuController.java b/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/java/com/bsd/pjcloud/supermarket/controller/SupermarketSpuController.java index 5f9ce2c37..2300ee105 100644 --- a/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/java/com/bsd/pjcloud/supermarket/controller/SupermarketSpuController.java +++ b/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/java/com/bsd/pjcloud/supermarket/controller/SupermarketSpuController.java @@ -41,12 +41,12 @@ import java.util.List; */ @RestController @RequiredArgsConstructor -@RequestMapping("/supermarketSpu" ) -@Tag(description = "supermarketSpu" , name = "商品spu管理" ) +@RequestMapping("/supermarketSpu") +@Tag(description = "supermarketSpu", name = "商品spu管理") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SupermarketSpuController { - private final SupermarketSpuService supermarketSpuService; + private final SupermarketSpuService supermarketSpuService; private final SupermarketUnitService supermarketUnitService; @@ -54,31 +54,33 @@ public class SupermarketSpuController { /** * 分页查询 - * @param page 分页对象 + * + * @param page 分页对象 * @param supermarketSpu 商品spu * @return */ - @Operation(summary = "分页查询" , description = "分页查询" ) - @GetMapping("/page" ) - @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" ) + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')") public R getSupermarketSpuPage(@ParameterObject Page page, @ParameterObject SupermarketSpuEntity supermarketSpu) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); - wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getProductCode()),SupermarketSpuEntity::getProductCode,supermarketSpu.getProductCode()); - wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getBarcode()),SupermarketSpuEntity::getBarcode,supermarketSpu.getBarcode()); - wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getProductName()),SupermarketSpuEntity::getProductName,supermarketSpu.getProductName()); + wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getProductCode()), SupermarketSpuEntity::getProductCode, supermarketSpu.getProductCode()); + wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getBarcode()), SupermarketSpuEntity::getBarcode, supermarketSpu.getBarcode()); + wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getProductName()), SupermarketSpuEntity::getProductName, supermarketSpu.getProductName()); return R.ok(supermarketSpuService.pageScope(page, wrapper)); } /** * 通过id查询商品spu + * * @param id id * @return R */ - @Operation(summary = "通过id查询" , description = "通过id查询" ) - @GetMapping("/{id}" ) - @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" ) - public R getById(@PathVariable("id" ) Long id) { + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')") + public R getById(@PathVariable("id") Long id) { SupermarketSpuEntity supermarketSpuEntity = supermarketSpuService.getById(id); List list = supermarketUnitService.list(new LambdaQueryWrapper().eq(SupermarketUnitEntity::getSpuId, id)); supermarketSpuEntity.setSupermarketUnitEntityList(list); @@ -91,13 +93,14 @@ public class SupermarketSpuController { /** * 新增商品spu + * * @param supermarketSpu 商品spu * @return R */ - @Operation(summary = "新增商品spu" , description = "新增商品spu" ) - @SysLog("新增商品spu" ) + @Operation(summary = "新增商品spu", description = "新增商品spu") + @SysLog("新增商品spu") @PostMapping - @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_add')" ) + @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_add')") public R save(@RequestBody SupermarketSpuEntity supermarketSpu) { supermarketSpu.setDeptId(SecurityUtils.getUser().getDeptId()); return supermarketSpuService.saveSpu(supermarketSpu); @@ -105,26 +108,28 @@ public class SupermarketSpuController { /** * 修改商品spu + * * @param supermarketSpu 商品spu * @return R */ - @Operation(summary = "修改商品spu" , description = "修改商品spu" ) - @SysLog("修改商品spu" ) + @Operation(summary = "修改商品spu", description = "修改商品spu") + @SysLog("修改商品spu") @PutMapping - @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_edit')" ) + @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_edit')") public R updateById(@RequestBody SupermarketSpuEntity supermarketSpu) { return supermarketSpuService.updateSpuById(supermarketSpu); } /** * 通过id删除商品spu + * * @param ids id列表 * @return R */ - @Operation(summary = "通过id删除商品spu" , description = "通过id删除商品spu" ) - @SysLog("通过id删除商品spu" ) + @Operation(summary = "通过id删除商品spu", description = "通过id删除商品spu") + @SysLog("通过id删除商品spu") @DeleteMapping - @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_del')" ) + @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_del')") public R removeById(@RequestBody Long[] ids) { return R.ok(supermarketSpuService.removeSpuBatchByIds(CollUtil.toList(ids))); } @@ -132,30 +137,31 @@ public class SupermarketSpuController { /** * 导出excel 表格 + * * @param supermarketSpu 查询条件 - * @param ids 导出指定ID + * @param ids 导出指定ID * @return excel 文件流 */ @ResponseExcel @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_export')" ) - public List export(SupermarketSpuEntity supermarketSpu,Long[] ids) { + @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_export')") + public List export(SupermarketSpuEntity supermarketSpu, Long[] ids) { return supermarketSpuService.list(Wrappers.lambdaQuery(supermarketSpu).in(ArrayUtil.isNotEmpty(ids), SupermarketSpuEntity::getId, ids)); } - // --------APP----------------- /** * 条件查询spu单表 列表信息 + * * @param supermarketSpuQueryDTO 商品spu * @return */ - @Operation(summary = "安卓机条件查询所有" , description = "安卓机条件查询所有" ) - @PostMapping("/ad/selectListAll" ) - @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" ) + @Operation(summary = "安卓机条件查询所有", description = "安卓机条件查询所有") + @PostMapping("/ad/selectListAll") + @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')") public R getSupermarketSpuByScope(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO) { return R.ok(supermarketSpuService.selectListAllScope(supermarketSpuQueryDTO)); } @@ -163,37 +169,36 @@ public class SupermarketSpuController { /** * 根据spu id 查询spu详情,详情包括辅助条码和包装单位基本信息 + * * @param id * @return */ - @Operation(summary = "条件查询所有" , description = "条件查询所有" ) - @GetMapping("/ad/SpuDetails" ) - public R getSupermarketSpuDetailById(@RequestParam("id")Long id) { + @Operation(summary = "条件查询所有", description = "条件查询所有") + @GetMapping("/ad/SpuDetails") + public R getSupermarketSpuDetailById(@RequestParam("id") Long id) { return R.ok(supermarketSpuService.getSupermarketSpuDetailById(id)); } @PostMapping("/ad/updateSpuStock") - @Operation(summary = "更新库存" , description = "app和安卓公用" ) + @Operation(summary = "更新库存", description = "app和安卓公用") @SysLog("更新商品库存") - public R updateSkuStock(@RequestBody SupermarketSpuUpdateStockReqDTO updateStockReqDTO){ + public R updateSkuStock(@RequestBody SupermarketSpuUpdateStockReqDTO updateStockReqDTO) { return supermarketSpuService.updateSpuStock(updateStockReqDTO); } - - - /** * 条件查询spu单表 列表信息 + * * @param supermarketSpuQueryDTO 商品spu * @return */ - @Operation(summary = "APP根据条件查询分页SPU" , description = "APP条件分页查询" ) - @PostMapping("/app/selectListAll" ) - @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" ) - public R getSupermarketSpu(@RequestBody SupermarketSpuAppQueryDTO supermarketSpuQueryDTO,@ParameterObject Page page) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + @Operation(summary = "APP根据条件查询分页SPU", description = "APP条件分页查询") + @PostMapping("/app/selectListAll") + @PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')") + public R getSupermarketSpu(@RequestBody SupermarketSpuAppQueryDTO supermarketSpuQueryDTO, @ParameterObject Page page) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(supermarketSpuQueryDTO.getMerchantId() != null, SupermarketSpuEntity::getMerchantId, supermarketSpuQueryDTO.getMerchantId()); wrapper.eq(supermarketSpuQueryDTO.getCategoryId() != null, SupermarketSpuEntity::getCategoryId, supermarketSpuQueryDTO.getCategoryId()); // wrapper.eq(StrUtil.isNotBlank(supermarketSpuQueryDTO.getProductCode()), SupermarketSpuEntity::getProductCode, supermarketSpuQueryDTO.getProductCode()); @@ -208,24 +213,25 @@ public class SupermarketSpuController { /** * 根据spu id 查询spu详情,详情包括辅助条码和包装单位基本信息 + * * @param id * @return */ - @Operation(summary = "app获取spu详情" , description = "根据spu的id" ) - @GetMapping("/app/SpuDetails" ) - public R getSupermarketSpuAppDetailById(@RequestParam("id")Long id) { + @Operation(summary = "app获取spu详情", description = "根据spu的id") + @GetMapping("/app/SpuDetails") + public R getSupermarketSpuAppDetailById(@RequestParam("id") Long id) { return R.ok(supermarketSpuService.getSupermarketSpuAppDetailById(id)); } @GetMapping("/app/checkSpuStock") @SysLog("购物车效验库存") @Transactional - public R checkSpuStock(@RequestParam(value ="spuId")Long spuId,@RequestParam("incrCount")Integer incrCount) { - SupermarketSpuEntity spu= supermarketSpuService.getById(spuId); + public R checkSpuStock(@RequestParam(value = "spuId") Long spuId, @RequestParam("incrCount") Integer incrCount) { + SupermarketSpuEntity spu = supermarketSpuService.getById(spuId); if (spu == null) { - R.failed("商品不存在"); + return R.failed("商品不存在"); } - if (spu.getStock() pageJoin(Page page, WalletRechargeApplyDto dto); Page scopePageList(Page page, WalletRechargeApplyDto dto); diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeApplyComposeServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeApplyComposeServiceImpl.java index a9edb9c2a..3b9ed0ddd 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeApplyComposeServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeApplyComposeServiceImpl.java @@ -53,7 +53,6 @@ public class WalletRechargeApplyComposeServiceImpl implements WalletRechargeAppl if (ObjectUtil.isEmpty(topUpApplyDetail)) return result; if (ObjectUtil.isEmpty(topUpApplyDetail.getImportTime())) return result; - rechargeApplyService.updateBeforePrice(topUpApplyDetail); Page resultVo = new Page<>(); List resultList = new ArrayList<>(); diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeApplyServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeApplyServiceImpl.java index 6fb8f1de6..108f58fcd 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeApplyServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeApplyServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.lang.Validator; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.extra.spring.SpringUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -16,6 +17,7 @@ import com.bsd.pjcloud.admin.api.feign.RemoteUserService; import com.bsd.pjcloud.admin.api.utils.DataUtil; import com.bsd.pjcloud.common.core.exception.CheckedException; import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.BeanUtils; import com.bsd.pjcloud.common.core.util.CollectionUtils; import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; @@ -35,7 +37,6 @@ import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity; import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity; import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity; import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil; -import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo; import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo; import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper; import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper; @@ -44,6 +45,7 @@ import com.bsd.pjcloud.wallet.service.WalletManageService; import com.bsd.pjcloud.wallet.service.WalletRechargeApplyService; import com.bsd.pjcloud.wallet.service.WalletTransactionService; import com.bsd.pjcloud.wallet.service.WalletTypeService; +import com.bsd.pjcloud.wallet.service.impl.WalletManageServiceImpl; import com.bsd.pjcloud.wallet.utils.flow.FlowUtil; import com.bsd.pjcloud.wallet.utils.flow.dto.WalletRechargeApplyFlowDto; import lombok.RequiredArgsConstructor; @@ -91,6 +93,17 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl pageJoin(Page page, WalletRechargeApplyDto dto) { Page list = baseMapper.pageJoin(page, dto); @@ -272,6 +285,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl v.setPrice(-1 * Math.abs(v.getPrice()))); } @@ -290,6 +304,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl 0; } + + private WalletRechargeApplyServiceImpl getSelf() { + return SpringUtil.getBean(getClass()); + } } \ No newline at end of file