Compare commits
7 Commits
953397634b
...
02cf28ca13
Author | SHA1 | Date |
---|---|---|
|
02cf28ca13 | 2 months ago |
|
ba97d65f34 | 2 months ago |
|
753821c442 | 2 months ago |
|
5d55376ea7 | 2 months ago |
|
668486c9d4 | 2 months ago |
|
22dbd529a6 | 2 months ago |
|
3cfc32aae2 | 2 months ago |
45 changed files with 2543 additions and 591 deletions
@ -0,0 +1,124 @@ |
|||||
|
package com.gxwebsoft.shop.controller; |
||||
|
|
||||
|
import com.gxwebsoft.common.core.web.BaseController; |
||||
|
import com.gxwebsoft.shop.service.ShopCouponApplyCateService; |
||||
|
import com.gxwebsoft.shop.entity.ShopCouponApplyCate; |
||||
|
import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; |
||||
|
import com.gxwebsoft.common.core.web.ApiResult; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import com.gxwebsoft.common.core.web.PageParam; |
||||
|
import com.gxwebsoft.common.core.web.BatchParam; |
||||
|
import com.gxwebsoft.common.core.annotation.OperationLog; |
||||
|
import com.gxwebsoft.common.system.entity.User; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类控制器 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
@Tag(name = "优惠券可用分类管理") |
||||
|
@RestController |
||||
|
@RequestMapping("/api/shop/shop-coupon-apply-cate") |
||||
|
public class ShopCouponApplyCateController extends BaseController { |
||||
|
@Resource |
||||
|
private ShopCouponApplyCateService shopCouponApplyCateService; |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyCate:list')") |
||||
|
@Operation(summary = "分页查询优惠券可用分类") |
||||
|
@GetMapping("/page") |
||||
|
public ApiResult<PageResult<ShopCouponApplyCate>> page(ShopCouponApplyCateParam param) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopCouponApplyCateService.pageRel(param)); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyCate:list')") |
||||
|
@Operation(summary = "查询全部优惠券可用分类") |
||||
|
@GetMapping() |
||||
|
public ApiResult<List<ShopCouponApplyCate>> list(ShopCouponApplyCateParam param) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopCouponApplyCateService.listRel(param)); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyCate:list')") |
||||
|
@Operation(summary = "根据id查询优惠券可用分类") |
||||
|
@GetMapping("/{id}") |
||||
|
public ApiResult<ShopCouponApplyCate> get(@PathVariable("id") Integer id) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopCouponApplyCateService.getByIdRel(id)); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyCate:save')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "添加优惠券可用分类") |
||||
|
@PostMapping() |
||||
|
public ApiResult<?> save(@RequestBody ShopCouponApplyCate shopCouponApplyCate) { |
||||
|
if (shopCouponApplyCateService.save(shopCouponApplyCate)) { |
||||
|
return success("添加成功"); |
||||
|
} |
||||
|
return fail("添加失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyCate:update')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "修改优惠券可用分类") |
||||
|
@PutMapping() |
||||
|
public ApiResult<?> update(@RequestBody ShopCouponApplyCate shopCouponApplyCate) { |
||||
|
if (shopCouponApplyCateService.updateById(shopCouponApplyCate)) { |
||||
|
return success("修改成功"); |
||||
|
} |
||||
|
return fail("修改失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyCate:remove')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "删除优惠券可用分类") |
||||
|
@DeleteMapping("/{id}") |
||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) { |
||||
|
if (shopCouponApplyCateService.removeById(id)) { |
||||
|
return success("删除成功"); |
||||
|
} |
||||
|
return fail("删除失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyCate:save')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量添加优惠券可用分类") |
||||
|
@PostMapping("/batch") |
||||
|
public ApiResult<?> saveBatch(@RequestBody List<ShopCouponApplyCate> list) { |
||||
|
if (shopCouponApplyCateService.saveBatch(list)) { |
||||
|
return success("添加成功"); |
||||
|
} |
||||
|
return fail("添加失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyCate:update')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量修改优惠券可用分类") |
||||
|
@PutMapping("/batch") |
||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ShopCouponApplyCate> batchParam) { |
||||
|
if (batchParam.update(shopCouponApplyCateService, "id")) { |
||||
|
return success("修改成功"); |
||||
|
} |
||||
|
return fail("修改失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyCate:remove')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量删除优惠券可用分类") |
||||
|
@DeleteMapping("/batch") |
||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) { |
||||
|
if (shopCouponApplyCateService.removeByIds(ids)) { |
||||
|
return success("删除成功"); |
||||
|
} |
||||
|
return fail("删除失败"); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,125 @@ |
|||||
|
package com.gxwebsoft.shop.controller; |
||||
|
|
||||
|
import com.gxwebsoft.common.core.web.BaseController; |
||||
|
import com.gxwebsoft.shop.service.ShopCouponApplyItemService; |
||||
|
import com.gxwebsoft.shop.entity.ShopCouponApplyItem; |
||||
|
import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; |
||||
|
import com.gxwebsoft.common.core.web.ApiResult; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import com.gxwebsoft.common.core.web.PageParam; |
||||
|
import com.gxwebsoft.common.core.web.BatchParam; |
||||
|
import com.gxwebsoft.common.core.annotation.OperationLog; |
||||
|
import com.gxwebsoft.common.system.entity.User; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类控制器 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
@Tag(name = "优惠券可用分类管理") |
||||
|
@RestController |
||||
|
@RequestMapping("/api/shop/shop-coupon-apply-item") |
||||
|
public class ShopCouponApplyItemController extends BaseController { |
||||
|
@Resource |
||||
|
private ShopCouponApplyItemService shopCouponApplyItemService; |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyItem:list')") |
||||
|
@Operation(summary = "分页查询优惠券可用分类") |
||||
|
@GetMapping("/page") |
||||
|
public ApiResult<PageResult<ShopCouponApplyItem>> page(ShopCouponApplyItemParam param) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopCouponApplyItemService.pageRel(param)); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyItem:list')") |
||||
|
@Operation(summary = "查询全部优惠券可用分类") |
||||
|
@GetMapping() |
||||
|
public ApiResult<List<ShopCouponApplyItem>> list(ShopCouponApplyItemParam param) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopCouponApplyItemService.listRel(param)); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyItem:list')") |
||||
|
@Operation(summary = "根据id查询优惠券可用分类") |
||||
|
@GetMapping("/{id}") |
||||
|
public ApiResult<ShopCouponApplyItem> get(@PathVariable("id") Integer id) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopCouponApplyItemService.getByIdRel(id)); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyItem:save')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "添加优惠券可用分类") |
||||
|
@PostMapping() |
||||
|
public ApiResult<?> save(@RequestBody ShopCouponApplyItem shopCouponApplyItem) { |
||||
|
|
||||
|
if (shopCouponApplyItemService.save(shopCouponApplyItem)) { |
||||
|
return success("添加成功"); |
||||
|
} |
||||
|
return fail("添加失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyItem:update')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "修改优惠券可用分类") |
||||
|
@PutMapping() |
||||
|
public ApiResult<?> update(@RequestBody ShopCouponApplyItem shopCouponApplyItem) { |
||||
|
if (shopCouponApplyItemService.updateById(shopCouponApplyItem)) { |
||||
|
return success("修改成功"); |
||||
|
} |
||||
|
return fail("修改失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyItem:remove')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "删除优惠券可用分类") |
||||
|
@DeleteMapping("/{id}") |
||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) { |
||||
|
if (shopCouponApplyItemService.removeById(id)) { |
||||
|
return success("删除成功"); |
||||
|
} |
||||
|
return fail("删除失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyItem:save')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量添加优惠券可用分类") |
||||
|
@PostMapping("/batch") |
||||
|
public ApiResult<?> saveBatch(@RequestBody List<ShopCouponApplyItem> list) { |
||||
|
if (shopCouponApplyItemService.saveBatch(list)) { |
||||
|
return success("添加成功"); |
||||
|
} |
||||
|
return fail("添加失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyItem:update')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量修改优惠券可用分类") |
||||
|
@PutMapping("/batch") |
||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ShopCouponApplyItem> batchParam) { |
||||
|
if (batchParam.update(shopCouponApplyItemService, "id")) { |
||||
|
return success("修改成功"); |
||||
|
} |
||||
|
return fail("修改失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopCouponApplyItem:remove')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量删除优惠券可用分类") |
||||
|
@DeleteMapping("/batch") |
||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) { |
||||
|
if (shopCouponApplyItemService.removeByIds(ids)) { |
||||
|
return success("删除成功"); |
||||
|
} |
||||
|
return fail("删除失败"); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,259 @@ |
|||||
|
package com.gxwebsoft.shop.controller; |
||||
|
|
||||
|
import cn.hutool.core.io.FileUtil; |
||||
|
import cn.hutool.core.util.RandomUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.gxwebsoft.common.core.config.ConfigProperties; |
||||
|
import com.gxwebsoft.common.core.web.BaseController; |
||||
|
import com.gxwebsoft.common.system.entity.FileRecord; |
||||
|
import com.gxwebsoft.shop.entity.ShopGoods; |
||||
|
import com.gxwebsoft.shop.service.ShopGiftService; |
||||
|
import com.gxwebsoft.shop.entity.ShopGift; |
||||
|
import com.gxwebsoft.shop.param.ShopGiftParam; |
||||
|
import com.gxwebsoft.common.core.web.ApiResult; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import com.gxwebsoft.common.core.web.PageParam; |
||||
|
import com.gxwebsoft.common.core.web.BatchParam; |
||||
|
import com.gxwebsoft.common.core.annotation.OperationLog; |
||||
|
import com.gxwebsoft.common.system.entity.User; |
||||
|
import com.gxwebsoft.shop.service.ShopGoodsService; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import org.apache.poi.xssf.streaming.SXSSFRow; |
||||
|
import org.apache.poi.xssf.streaming.SXSSFSheet; |
||||
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.FileOutputStream; |
||||
|
import java.io.IOException; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.Random; |
||||
|
import java.util.Set; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 礼品卡控制器 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 18:07:32 |
||||
|
*/ |
||||
|
@Tag(name = "礼品卡管理") |
||||
|
@RestController |
||||
|
@RequestMapping("/api/shop/shop-gift") |
||||
|
public class ShopGiftController extends BaseController { |
||||
|
@Resource |
||||
|
private ShopGiftService shopGiftService; |
||||
|
@Value("${config.upload-path}") |
||||
|
private String uploadPath; |
||||
|
@Value("${config.api-url}") |
||||
|
private String apiUrl; |
||||
|
@Resource |
||||
|
private ShopGoodsService shopGoodsService; |
||||
|
|
||||
|
@Operation(summary = "根据code查询礼品卡") |
||||
|
@GetMapping("/by-code/{code}") |
||||
|
public ApiResult<ShopGift> get(@PathVariable("code") String code) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopGiftService.getByCode(code)); |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "礼品卡核销") |
||||
|
@PostMapping("/set-take") |
||||
|
public ApiResult<?> setTake(@RequestBody ShopGift shopGift) { |
||||
|
if (getLoginUser() == null) return fail("请登录"); |
||||
|
if (shopGift.getCode() == null) { |
||||
|
return fail("非法请求"); |
||||
|
} |
||||
|
ShopGift shopGift1 = shopGiftService.getByCode(shopGift.getCode()); |
||||
|
if (shopGift1 == null) return fail("礼品卡不存在"); |
||||
|
if (shopGift1.getTakeTime() != null) { |
||||
|
return fail("礼品卡已使用"); |
||||
|
} |
||||
|
shopGift1.setTakeTime(LocalDateTime.now()); |
||||
|
shopGift1.setOperatorUserId(getLoginUserId()); |
||||
|
shopGiftService.updateById(shopGift1); |
||||
|
return success(); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:list')") |
||||
|
@Operation(summary = "分页查询礼品卡") |
||||
|
@GetMapping("/page") |
||||
|
public ApiResult<PageResult<ShopGift>> page(ShopGiftParam param) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopGiftService.pageRel(param)); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:list')") |
||||
|
@Operation(summary = "查询全部礼品卡") |
||||
|
@GetMapping() |
||||
|
public ApiResult<List<ShopGift>> list(ShopGiftParam param) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopGiftService.listRel(param)); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:list')") |
||||
|
@Operation(summary = "根据id查询礼品卡") |
||||
|
@GetMapping("/{id}") |
||||
|
public ApiResult<ShopGift> get(@PathVariable("id") Integer id) { |
||||
|
// 使用关联查询
|
||||
|
return success(shopGiftService.getByIdRel(id)); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:save')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "添加礼品卡") |
||||
|
@PostMapping() |
||||
|
public ApiResult<?> save(@RequestBody ShopGift shopGift) { |
||||
|
// 记录当前登录用户id
|
||||
|
User loginUser = getLoginUser(); |
||||
|
if (loginUser != null) { |
||||
|
shopGift.setUserId(loginUser.getUserId()); |
||||
|
} |
||||
|
if (shopGiftService.save(shopGift)) { |
||||
|
return success("添加成功"); |
||||
|
} |
||||
|
return fail("添加失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:update')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "修改礼品卡") |
||||
|
@PutMapping() |
||||
|
public ApiResult<?> update(@RequestBody ShopGift shopGift) { |
||||
|
if (shopGiftService.updateById(shopGift)) { |
||||
|
return success("修改成功"); |
||||
|
} |
||||
|
return fail("修改失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:save')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量生成礼品卡") |
||||
|
@PostMapping("/make") |
||||
|
public ApiResult<?> make(@RequestBody ShopGift shopGiftData) { |
||||
|
if (shopGiftData.getNum() == null || shopGiftData.getNum() <= 0) { |
||||
|
return fail("请输入正确的数量"); |
||||
|
} |
||||
|
if (shopGiftData.getGoodsId() == null || shopGiftData.getGoodsId() <= 0) { |
||||
|
return fail("请选择商品"); |
||||
|
} |
||||
|
List<ShopGift> giftList = new ArrayList<>(); |
||||
|
for (int i = 0; i < shopGiftData.getNum(); i++) { |
||||
|
ShopGift shopGift = new ShopGift(); |
||||
|
shopGift.setName(shopGiftData.getName()); |
||||
|
shopGift.setCode(RandomUtil.randomString(8)); |
||||
|
shopGift.setGoodsId(shopGiftData.getGoodsId()); |
||||
|
giftList.add(shopGift); |
||||
|
} |
||||
|
if (shopGiftService.saveBatch(giftList)) { |
||||
|
return success("生成成功"); |
||||
|
} |
||||
|
return fail("生成失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:remove')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "删除礼品卡") |
||||
|
@DeleteMapping("/{id}") |
||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) { |
||||
|
if (shopGiftService.removeById(id)) { |
||||
|
return success("删除成功"); |
||||
|
} |
||||
|
return fail("删除失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:save')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量添加礼品卡") |
||||
|
@PostMapping("/batch") |
||||
|
public ApiResult<?> saveBatch(@RequestBody List<ShopGift> list) { |
||||
|
if (shopGiftService.saveBatch(list)) { |
||||
|
return success("添加成功"); |
||||
|
} |
||||
|
return fail("添加失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:update')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量修改礼品卡") |
||||
|
@PutMapping("/batch") |
||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ShopGift> batchParam) { |
||||
|
if (batchParam.update(shopGiftService, "id")) { |
||||
|
return success("修改成功"); |
||||
|
} |
||||
|
return fail("修改失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:remove')") |
||||
|
@OperationLog |
||||
|
@Operation(summary = "批量删除礼品卡") |
||||
|
@DeleteMapping("/batch") |
||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) { |
||||
|
if (shopGiftService.removeByIds(ids)) { |
||||
|
return success("删除成功"); |
||||
|
} |
||||
|
return fail("删除失败"); |
||||
|
} |
||||
|
|
||||
|
@PreAuthorize("hasAuthority('shop:shopGift:list')") |
||||
|
@Operation(summary = "导出礼品卡") |
||||
|
@PostMapping("/export") |
||||
|
public ApiResult<?> export(@RequestBody(required = false) List<Integer> ids) throws IOException { |
||||
|
String filename = "file/excel/礼品卡.xlsx"; |
||||
|
if (!FileUtil.exist(uploadPath + "file/excel")) { |
||||
|
FileUtil.mkdir(uploadPath + "file/excel"); |
||||
|
} |
||||
|
List<ShopGift> list; |
||||
|
if (ids != null && !ids.isEmpty()) { |
||||
|
list = shopGiftService.listByIds(ids); |
||||
|
} else { |
||||
|
list = shopGiftService.list(); |
||||
|
} |
||||
|
if (!list.isEmpty()) { |
||||
|
Set<Integer> goodsIds = list.stream().map(ShopGift::getGoodsId).collect(Collectors.toSet()); |
||||
|
List<ShopGoods> goodsList = shopGoodsService.listByIds(goodsIds); |
||||
|
for (ShopGift shopGift : list) { |
||||
|
ShopGoods shopGoods = goodsList.stream().filter(sG -> sG.getGoodsId().equals(shopGift.getGoodsId())).findFirst().orElse(null); |
||||
|
if (shopGoods != null) { |
||||
|
shopGift.setGoods(shopGoods); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
String path = uploadPath + filename; |
||||
|
SXSSFWorkbook workbook = new SXSSFWorkbook(); |
||||
|
//创建工作表单
|
||||
|
SXSSFSheet sheet = workbook.createSheet(); |
||||
|
String[] headers = {"名称", "秘钥", "领取时间", "商品"}; |
||||
|
|
||||
|
SXSSFRow row0 = sheet.createRow(0); |
||||
|
for (int i = 0; i < headers.length; i++) { |
||||
|
row0.createCell(i).setCellValue(headers[i]); |
||||
|
} |
||||
|
if (!list.isEmpty()) { |
||||
|
for (ShopGift shopGift : list) { |
||||
|
SXSSFRow row = sheet.createRow(sheet.getLastRowNum() + 1); |
||||
|
row.createCell(0).setCellValue(shopGift.getName()); |
||||
|
row.createCell(1).setCellValue(shopGift.getCode()); |
||||
|
row.createCell(2).setCellValue(shopGift.getTakeTime()); |
||||
|
row.createCell(3).setCellValue(shopGift.getGoods() != null ? shopGift.getGoods().getName() : ""); |
||||
|
} |
||||
|
} |
||||
|
FileOutputStream output = new FileOutputStream(path); |
||||
|
workbook.write(output); |
||||
|
output.flush(); |
||||
|
|
||||
|
FileRecord result = new FileRecord(); |
||||
|
result.setCreateUserId(getLoginUserId()); |
||||
|
result.setName("礼品卡"); |
||||
|
result.setPath(filename); |
||||
|
result.setUrl(apiUrl + "/" + filename); |
||||
|
return success(result); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package com.gxwebsoft.shop.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import java.time.LocalDateTime; |
||||
|
import com.baomidou.mybatisplus.annotation.TableLogic; |
||||
|
import java.io.Serializable; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@Schema(name = "ShopCouponApplyCate对象", description = "优惠券可用分类") |
||||
|
public class ShopCouponApplyCate implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@TableId(value = "id", type = IdType.AUTO) |
||||
|
private Integer id; |
||||
|
|
||||
|
private Integer couponId; |
||||
|
|
||||
|
private Integer cateId; |
||||
|
|
||||
|
@Schema(description = "分类等级") |
||||
|
private Integer cateLevel; |
||||
|
|
||||
|
@Schema(description = "状态, 0正常, 1冻结") |
||||
|
private Integer status; |
||||
|
|
||||
|
@Schema(description = "是否删除, 0否, 1是") |
||||
|
@TableLogic |
||||
|
private Integer deleted; |
||||
|
|
||||
|
@Schema(description = "租户id") |
||||
|
private Integer tenantId; |
||||
|
|
||||
|
@Schema(description = "注册时间") |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
@Schema(description = "修改时间") |
||||
|
private LocalDateTime updateTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package com.gxwebsoft.shop.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import java.time.LocalDateTime; |
||||
|
import com.baomidou.mybatisplus.annotation.TableLogic; |
||||
|
import java.io.Serializable; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@Schema(name = "ShopCouponApplyItem对象", description = "优惠券可用分类") |
||||
|
public class ShopCouponApplyItem implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@TableId(value = "id", type = IdType.AUTO) |
||||
|
private Integer id; |
||||
|
|
||||
|
private Integer couponId; |
||||
|
|
||||
|
private Integer type; |
||||
|
|
||||
|
@Schema(description = "0服务1需求2闲置") |
||||
|
private Integer pk; |
||||
|
|
||||
|
@Schema(description = "状态, 0正常, 1冻结") |
||||
|
private Integer status; |
||||
|
|
||||
|
@Schema(description = "是否删除, 0否, 1是") |
||||
|
@TableLogic |
||||
|
private Integer deleted; |
||||
|
|
||||
|
@Schema(description = "租户id") |
||||
|
private Integer tenantId; |
||||
|
|
||||
|
@Schema(description = "注册时间") |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
@Schema(description = "修改时间") |
||||
|
private LocalDateTime updateTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
package com.gxwebsoft.shop.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import java.time.LocalDateTime; |
||||
|
import com.baomidou.mybatisplus.annotation.TableLogic; |
||||
|
import java.io.Serializable; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 礼品卡 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 18:07:31 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@Schema(name = "ShopGift对象", description = "礼品卡") |
||||
|
public class ShopGift implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@TableId(value = "id", type = IdType.AUTO) |
||||
|
private Integer id; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
@Schema(description = "秘钥") |
||||
|
private String code; |
||||
|
|
||||
|
@Schema(description = "商品ID") |
||||
|
private Integer goodsId; |
||||
|
|
||||
|
@Schema(description = "领取时间") |
||||
|
private LocalDateTime takeTime; |
||||
|
|
||||
|
@Schema(description = "操作人") |
||||
|
private Integer operatorUserId; |
||||
|
|
||||
|
@Schema(description = "是否展示") |
||||
|
private Boolean isShow; |
||||
|
|
||||
|
@Schema(description = "状态, 0上架 1待上架 2待审核 3审核不通过") |
||||
|
private Integer status; |
||||
|
|
||||
|
@Schema(description = "备注") |
||||
|
private String comments; |
||||
|
|
||||
|
@Schema(description = "排序号") |
||||
|
private Integer sortNumber; |
||||
|
|
||||
|
@Schema(description = "用户ID") |
||||
|
private Integer userId; |
||||
|
|
||||
|
@Schema(description = "是否删除, 0否, 1是") |
||||
|
@TableLogic |
||||
|
private Integer deleted; |
||||
|
|
||||
|
@Schema(description = "租户id") |
||||
|
private Integer tenantId; |
||||
|
|
||||
|
@Schema(description = "创建时间") |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
@Schema(description = "修改时间") |
||||
|
private LocalDateTime updateTime; |
||||
|
|
||||
|
@TableField(exist = false) |
||||
|
private Integer num; |
||||
|
|
||||
|
@TableField(exist = false) |
||||
|
private ShopGoods goods; |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package com.gxwebsoft.shop.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.gxwebsoft.shop.entity.ShopCouponApplyCate; |
||||
|
import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类Mapper |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
public interface ShopCouponApplyCateMapper extends BaseMapper<ShopCouponApplyCate> { |
||||
|
|
||||
|
/** |
||||
|
* 分页查询 |
||||
|
* |
||||
|
* @param page 分页对象 |
||||
|
* @param param 查询参数 |
||||
|
* @return List<ShopCouponApplyCate> |
||||
|
*/ |
||||
|
List<ShopCouponApplyCate> selectPageRel(@Param("page") IPage<ShopCouponApplyCate> page, |
||||
|
@Param("param") ShopCouponApplyCateParam param); |
||||
|
|
||||
|
/** |
||||
|
* 查询全部 |
||||
|
* |
||||
|
* @param param 查询参数 |
||||
|
* @return List<User> |
||||
|
*/ |
||||
|
List<ShopCouponApplyCate> selectListRel(@Param("param") ShopCouponApplyCateParam param); |
||||
|
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package com.gxwebsoft.shop.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.gxwebsoft.shop.entity.ShopCouponApplyItem; |
||||
|
import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类Mapper |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
public interface ShopCouponApplyItemMapper extends BaseMapper<ShopCouponApplyItem> { |
||||
|
|
||||
|
/** |
||||
|
* 分页查询 |
||||
|
* |
||||
|
* @param page 分页对象 |
||||
|
* @param param 查询参数 |
||||
|
* @return List<ShopCouponApplyItem> |
||||
|
*/ |
||||
|
List<ShopCouponApplyItem> selectPageRel(@Param("page") IPage<ShopCouponApplyItem> page, |
||||
|
@Param("param") ShopCouponApplyItemParam param); |
||||
|
|
||||
|
/** |
||||
|
* 查询全部 |
||||
|
* |
||||
|
* @param param 查询参数 |
||||
|
* @return List<User> |
||||
|
*/ |
||||
|
List<ShopCouponApplyItem> selectListRel(@Param("param") ShopCouponApplyItemParam param); |
||||
|
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package com.gxwebsoft.shop.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.gxwebsoft.shop.entity.ShopGift; |
||||
|
import com.gxwebsoft.shop.param.ShopGiftParam; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 礼品卡Mapper |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 18:07:31 |
||||
|
*/ |
||||
|
public interface ShopGiftMapper extends BaseMapper<ShopGift> { |
||||
|
|
||||
|
/** |
||||
|
* 分页查询 |
||||
|
* |
||||
|
* @param page 分页对象 |
||||
|
* @param param 查询参数 |
||||
|
* @return List<ShopGift> |
||||
|
*/ |
||||
|
List<ShopGift> selectPageRel(@Param("page") IPage<ShopGift> page, |
||||
|
@Param("param") ShopGiftParam param); |
||||
|
|
||||
|
/** |
||||
|
* 查询全部 |
||||
|
* |
||||
|
* @param param 查询参数 |
||||
|
* @return List<User> |
||||
|
*/ |
||||
|
List<ShopGift> selectListRel(@Param("param") ShopGiftParam param); |
||||
|
|
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
<?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="com.gxwebsoft.shop.mapper.ShopCouponApplyCateMapper"> |
||||
|
|
||||
|
<!-- 关联查询sql --> |
||||
|
<sql id="selectSql"> |
||||
|
SELECT a.* |
||||
|
FROM shop_coupon_apply_cate a |
||||
|
<where> |
||||
|
<if test="param.id != null"> |
||||
|
AND a.id = #{param.id} |
||||
|
</if> |
||||
|
<if test="param.couponId != null"> |
||||
|
AND a.coupon_id = #{param.couponId} |
||||
|
</if> |
||||
|
<if test="param.cateId != null"> |
||||
|
AND a.cate_id = #{param.cateId} |
||||
|
</if> |
||||
|
<if test="param.cateLevel != null"> |
||||
|
AND a.cate_level = #{param.cateLevel} |
||||
|
</if> |
||||
|
<if test="param.status != null"> |
||||
|
AND a.status = #{param.status} |
||||
|
</if> |
||||
|
<if test="param.deleted != null"> |
||||
|
AND a.deleted = #{param.deleted} |
||||
|
</if> |
||||
|
<if test="param.deleted == null"> |
||||
|
AND a.deleted = 0 |
||||
|
</if> |
||||
|
<if test="param.createTimeStart != null"> |
||||
|
AND a.create_time >= #{param.createTimeStart} |
||||
|
</if> |
||||
|
<if test="param.createTimeEnd != null"> |
||||
|
AND a.create_time <= #{param.createTimeEnd} |
||||
|
</if> |
||||
|
<if test="param.keywords != null"> |
||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') |
||||
|
) |
||||
|
</if> |
||||
|
</where> |
||||
|
</sql> |
||||
|
|
||||
|
<!-- 分页查询 --> |
||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.ShopCouponApplyCate"> |
||||
|
<include refid="selectSql"></include> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 查询全部 --> |
||||
|
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopCouponApplyCate"> |
||||
|
<include refid="selectSql"></include> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,54 @@ |
|||||
|
<?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="com.gxwebsoft.shop.mapper.ShopCouponApplyItemMapper"> |
||||
|
|
||||
|
<!-- 关联查询sql --> |
||||
|
<sql id="selectSql"> |
||||
|
SELECT a.* |
||||
|
FROM shop_coupon_apply_item a |
||||
|
<where> |
||||
|
<if test="param.id != null"> |
||||
|
AND a.id = #{param.id} |
||||
|
</if> |
||||
|
<if test="param.couponId != null"> |
||||
|
AND a.coupon_id = #{param.couponId} |
||||
|
</if> |
||||
|
<if test="param.type != null"> |
||||
|
AND a.type = #{param.type} |
||||
|
</if> |
||||
|
<if test="param.pk != null"> |
||||
|
AND a.pk = #{param.pk} |
||||
|
</if> |
||||
|
<if test="param.status != null"> |
||||
|
AND a.status = #{param.status} |
||||
|
</if> |
||||
|
<if test="param.deleted != null"> |
||||
|
AND a.deleted = #{param.deleted} |
||||
|
</if> |
||||
|
<if test="param.deleted == null"> |
||||
|
AND a.deleted = 0 |
||||
|
</if> |
||||
|
<if test="param.createTimeStart != null"> |
||||
|
AND a.create_time >= #{param.createTimeStart} |
||||
|
</if> |
||||
|
<if test="param.createTimeEnd != null"> |
||||
|
AND a.create_time <= #{param.createTimeEnd} |
||||
|
</if> |
||||
|
<if test="param.keywords != null"> |
||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') |
||||
|
) |
||||
|
</if> |
||||
|
</where> |
||||
|
</sql> |
||||
|
|
||||
|
<!-- 分页查询 --> |
||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.ShopCouponApplyItem"> |
||||
|
<include refid="selectSql"></include> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 查询全部 --> |
||||
|
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopCouponApplyItem"> |
||||
|
<include refid="selectSql"></include> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,72 @@ |
|||||
|
<?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="com.gxwebsoft.shop.mapper.ShopGiftMapper"> |
||||
|
|
||||
|
<!-- 关联查询sql --> |
||||
|
<sql id="selectSql"> |
||||
|
SELECT a.* |
||||
|
FROM shop_gift a |
||||
|
<where> |
||||
|
<if test="param.id != null"> |
||||
|
AND a.id = #{param.id} |
||||
|
</if> |
||||
|
<if test="param.name != null"> |
||||
|
AND a.name LIKE CONCAT('%', #{param.name}, '%') |
||||
|
</if> |
||||
|
<if test="param.code != null"> |
||||
|
AND a.code LIKE CONCAT('%', #{param.code}, '%') |
||||
|
</if> |
||||
|
<if test="param.goodsId != null"> |
||||
|
AND a.goods_id = #{param.goodsId} |
||||
|
</if> |
||||
|
<if test="param.takeTime != null"> |
||||
|
AND a.take_time LIKE CONCAT('%', #{param.takeTime}, '%') |
||||
|
</if> |
||||
|
<if test="param.operatorUserId != null"> |
||||
|
AND a.operator_user_id = #{param.operatorUserId} |
||||
|
</if> |
||||
|
<if test="param.isShow != null"> |
||||
|
AND a.is_show = #{param.isShow} |
||||
|
</if> |
||||
|
<if test="param.status != null"> |
||||
|
AND a.status = #{param.status} |
||||
|
</if> |
||||
|
<if test="param.comments != null"> |
||||
|
AND a.comments LIKE CONCAT('%', #{param.comments}, '%') |
||||
|
</if> |
||||
|
<if test="param.sortNumber != null"> |
||||
|
AND a.sort_number = #{param.sortNumber} |
||||
|
</if> |
||||
|
<if test="param.userId != null"> |
||||
|
AND a.user_id = #{param.userId} |
||||
|
</if> |
||||
|
<if test="param.deleted != null"> |
||||
|
AND a.deleted = #{param.deleted} |
||||
|
</if> |
||||
|
<if test="param.deleted == null"> |
||||
|
AND a.deleted = 0 |
||||
|
</if> |
||||
|
<if test="param.createTimeStart != null"> |
||||
|
AND a.create_time >= #{param.createTimeStart} |
||||
|
</if> |
||||
|
<if test="param.createTimeEnd != null"> |
||||
|
AND a.create_time <= #{param.createTimeEnd} |
||||
|
</if> |
||||
|
<if test="param.keywords != null"> |
||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') |
||||
|
) |
||||
|
</if> |
||||
|
</where> |
||||
|
</sql> |
||||
|
|
||||
|
<!-- 分页查询 --> |
||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.ShopGift"> |
||||
|
<include refid="selectSql"></include> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 查询全部 --> |
||||
|
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopGift"> |
||||
|
<include refid="selectSql"></include> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,46 @@ |
|||||
|
package com.gxwebsoft.shop.param; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import com.gxwebsoft.common.core.annotation.QueryField; |
||||
|
import com.gxwebsoft.common.core.annotation.QueryType; |
||||
|
import com.gxwebsoft.common.core.web.BaseParam; |
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类查询参数 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:48 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
@Schema(name = "ShopCouponApplyCateParam对象", description = "优惠券可用分类查询参数") |
||||
|
public class ShopCouponApplyCateParam extends BaseParam { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer id; |
||||
|
|
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer couponId; |
||||
|
|
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer cateId; |
||||
|
|
||||
|
@Schema(description = "分类等级") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Boolean cateLevel; |
||||
|
|
||||
|
@Schema(description = "状态, 0正常, 1冻结") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer status; |
||||
|
|
||||
|
@Schema(description = "是否删除, 0否, 1是") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer deleted; |
||||
|
|
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.gxwebsoft.shop.param; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import com.gxwebsoft.common.core.annotation.QueryField; |
||||
|
import com.gxwebsoft.common.core.annotation.QueryType; |
||||
|
import com.gxwebsoft.common.core.web.BaseParam; |
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类查询参数 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
@Schema(name = "ShopCouponApplyItemParam对象", description = "优惠券可用分类查询参数") |
||||
|
public class ShopCouponApplyItemParam extends BaseParam { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer id; |
||||
|
|
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer couponId; |
||||
|
|
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Boolean type; |
||||
|
|
||||
|
@Schema(description = "0服务1需求2闲置") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer pk; |
||||
|
|
||||
|
@Schema(description = "状态, 0正常, 1冻结") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer status; |
||||
|
|
||||
|
@Schema(description = "是否删除, 0否, 1是") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer deleted; |
||||
|
|
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
package com.gxwebsoft.shop.param; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import com.gxwebsoft.common.core.annotation.QueryField; |
||||
|
import com.gxwebsoft.common.core.annotation.QueryType; |
||||
|
import com.gxwebsoft.common.core.web.BaseParam; |
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 礼品卡查询参数 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 18:07:31 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
@Schema(name = "ShopGiftParam对象", description = "礼品卡查询参数") |
||||
|
public class ShopGiftParam extends BaseParam { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer id; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
@Schema(description = "秘钥") |
||||
|
private String code; |
||||
|
|
||||
|
@Schema(description = "商品ID") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer goodsId; |
||||
|
|
||||
|
@Schema(description = "领取时间") |
||||
|
private String takeTime; |
||||
|
|
||||
|
@Schema(description = "操作人") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer operatorUserId; |
||||
|
|
||||
|
@Schema(description = "是否展示") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Boolean isShow; |
||||
|
|
||||
|
@Schema(description = "状态, 0上架 1待上架 2待审核 3审核不通过") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer status; |
||||
|
|
||||
|
@Schema(description = "备注") |
||||
|
private String comments; |
||||
|
|
||||
|
@Schema(description = "排序号") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer sortNumber; |
||||
|
|
||||
|
@Schema(description = "用户ID") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer userId; |
||||
|
|
||||
|
@Schema(description = "是否删除, 0否, 1是") |
||||
|
@QueryField(type = QueryType.EQ) |
||||
|
private Integer deleted; |
||||
|
|
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package com.gxwebsoft.shop.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import com.gxwebsoft.shop.entity.ShopCouponApplyCate; |
||||
|
import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类Service |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
public interface ShopCouponApplyCateService extends IService<ShopCouponApplyCate> { |
||||
|
|
||||
|
/** |
||||
|
* 分页关联查询 |
||||
|
* |
||||
|
* @param param 查询参数 |
||||
|
* @return PageResult<ShopCouponApplyCate> |
||||
|
*/ |
||||
|
PageResult<ShopCouponApplyCate> pageRel(ShopCouponApplyCateParam param); |
||||
|
|
||||
|
/** |
||||
|
* 关联查询全部 |
||||
|
* |
||||
|
* @param param 查询参数 |
||||
|
* @return List<ShopCouponApplyCate> |
||||
|
*/ |
||||
|
List<ShopCouponApplyCate> listRel(ShopCouponApplyCateParam param); |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return ShopCouponApplyCate |
||||
|
*/ |
||||
|
ShopCouponApplyCate getByIdRel(Integer id); |
||||
|
|
||||
|
void removeByCouponId(Integer couponId); |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package com.gxwebsoft.shop.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import com.gxwebsoft.shop.entity.ShopCouponApplyItem; |
||||
|
import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类Service |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
public interface ShopCouponApplyItemService extends IService<ShopCouponApplyItem> { |
||||
|
|
||||
|
/** |
||||
|
* 分页关联查询 |
||||
|
* |
||||
|
* @param param 查询参数 |
||||
|
* @return PageResult<ShopCouponApplyItem> |
||||
|
*/ |
||||
|
PageResult<ShopCouponApplyItem> pageRel(ShopCouponApplyItemParam param); |
||||
|
|
||||
|
/** |
||||
|
* 关联查询全部 |
||||
|
* |
||||
|
* @param param 查询参数 |
||||
|
* @return List<ShopCouponApplyItem> |
||||
|
*/ |
||||
|
List<ShopCouponApplyItem> listRel(ShopCouponApplyItemParam param); |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return ShopCouponApplyItem |
||||
|
*/ |
||||
|
ShopCouponApplyItem getByIdRel(Integer id); |
||||
|
|
||||
|
void removeByCouponId(Integer couponId); |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package com.gxwebsoft.shop.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import com.gxwebsoft.shop.entity.ShopGift; |
||||
|
import com.gxwebsoft.shop.param.ShopGiftParam; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 礼品卡Service |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 18:07:31 |
||||
|
*/ |
||||
|
public interface ShopGiftService extends IService<ShopGift> { |
||||
|
|
||||
|
/** |
||||
|
* 分页关联查询 |
||||
|
* |
||||
|
* @param param 查询参数 |
||||
|
* @return PageResult<ShopGift> |
||||
|
*/ |
||||
|
PageResult<ShopGift> pageRel(ShopGiftParam param); |
||||
|
|
||||
|
/** |
||||
|
* 关联查询全部 |
||||
|
* |
||||
|
* @param param 查询参数 |
||||
|
* @return List<ShopGift> |
||||
|
*/ |
||||
|
List<ShopGift> listRel(ShopGiftParam param); |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return ShopGift |
||||
|
*/ |
||||
|
ShopGift getByIdRel(Integer id); |
||||
|
|
||||
|
ShopGift getByCode(String code); |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.gxwebsoft.shop.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import com.gxwebsoft.shop.entity.ShopOrder; |
||||
|
import com.gxwebsoft.shop.entity.ShopOrderDelivery; |
||||
|
import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 发货单Service |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-01-11 10:45:12 |
||||
|
*/ |
||||
|
public interface ShopOrderUpdate10550Service { |
||||
|
|
||||
|
|
||||
|
void update(ShopOrder shopOrder); |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
package com.gxwebsoft.shop.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.gxwebsoft.shop.mapper.ShopCouponApplyCateMapper; |
||||
|
import com.gxwebsoft.shop.service.ShopCouponApplyCateService; |
||||
|
import com.gxwebsoft.shop.entity.ShopCouponApplyCate; |
||||
|
import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; |
||||
|
import com.gxwebsoft.common.core.web.PageParam; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类Service实现 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ShopCouponApplyCateServiceImpl extends ServiceImpl<ShopCouponApplyCateMapper, ShopCouponApplyCate> implements ShopCouponApplyCateService { |
||||
|
|
||||
|
@Override |
||||
|
public PageResult<ShopCouponApplyCate> pageRel(ShopCouponApplyCateParam param) { |
||||
|
PageParam<ShopCouponApplyCate, ShopCouponApplyCateParam> page = new PageParam<>(param); |
||||
|
page.setDefaultOrder("sort_number asc, create_time desc"); |
||||
|
List<ShopCouponApplyCate> list = baseMapper.selectPageRel(page, param); |
||||
|
return new PageResult<>(list, page.getTotal()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ShopCouponApplyCate> listRel(ShopCouponApplyCateParam param) { |
||||
|
List<ShopCouponApplyCate> list = baseMapper.selectListRel(param); |
||||
|
// 排序
|
||||
|
PageParam<ShopCouponApplyCate, ShopCouponApplyCateParam> page = new PageParam<>(); |
||||
|
page.setDefaultOrder("sort_number asc, create_time desc"); |
||||
|
return page.sortRecords(list); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ShopCouponApplyCate getByIdRel(Integer id) { |
||||
|
ShopCouponApplyCateParam param = new ShopCouponApplyCateParam(); |
||||
|
param.setId(id); |
||||
|
return param.getOne(baseMapper.selectListRel(param)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void removeByCouponId(Integer couponId) { |
||||
|
remove( |
||||
|
new LambdaQueryWrapper<ShopCouponApplyCate>() |
||||
|
.eq(ShopCouponApplyCate::getCouponId, couponId) |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
package com.gxwebsoft.shop.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.gxwebsoft.shop.mapper.ShopCouponApplyItemMapper; |
||||
|
import com.gxwebsoft.shop.service.ShopCouponApplyItemService; |
||||
|
import com.gxwebsoft.shop.entity.ShopCouponApplyItem; |
||||
|
import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; |
||||
|
import com.gxwebsoft.common.core.web.PageParam; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 优惠券可用分类Service实现 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 12:47:49 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ShopCouponApplyItemServiceImpl extends ServiceImpl<ShopCouponApplyItemMapper, ShopCouponApplyItem> implements ShopCouponApplyItemService { |
||||
|
|
||||
|
@Override |
||||
|
public PageResult<ShopCouponApplyItem> pageRel(ShopCouponApplyItemParam param) { |
||||
|
PageParam<ShopCouponApplyItem, ShopCouponApplyItemParam> page = new PageParam<>(param); |
||||
|
page.setDefaultOrder("sort_number asc, create_time desc"); |
||||
|
List<ShopCouponApplyItem> list = baseMapper.selectPageRel(page, param); |
||||
|
return new PageResult<>(list, page.getTotal()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ShopCouponApplyItem> listRel(ShopCouponApplyItemParam param) { |
||||
|
List<ShopCouponApplyItem> list = baseMapper.selectListRel(param); |
||||
|
// 排序
|
||||
|
PageParam<ShopCouponApplyItem, ShopCouponApplyItemParam> page = new PageParam<>(); |
||||
|
page.setDefaultOrder("sort_number asc, create_time desc"); |
||||
|
return page.sortRecords(list); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ShopCouponApplyItem getByIdRel(Integer id) { |
||||
|
ShopCouponApplyItemParam param = new ShopCouponApplyItemParam(); |
||||
|
param.setId(id); |
||||
|
return param.getOne(baseMapper.selectListRel(param)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void removeByCouponId(Integer couponId) { |
||||
|
remove( |
||||
|
new LambdaQueryWrapper<ShopCouponApplyItem>() |
||||
|
.eq(ShopCouponApplyItem::getCouponId, couponId) |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package com.gxwebsoft.shop.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.gxwebsoft.shop.entity.ShopGoods; |
||||
|
import com.gxwebsoft.shop.mapper.ShopGiftMapper; |
||||
|
import com.gxwebsoft.shop.service.ShopGiftService; |
||||
|
import com.gxwebsoft.shop.entity.ShopGift; |
||||
|
import com.gxwebsoft.shop.param.ShopGiftParam; |
||||
|
import com.gxwebsoft.common.core.web.PageParam; |
||||
|
import com.gxwebsoft.common.core.web.PageResult; |
||||
|
import com.gxwebsoft.shop.service.ShopGoodsService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
import java.util.Set; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 礼品卡Service实现 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-11 18:07:31 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ShopGiftServiceImpl extends ServiceImpl<ShopGiftMapper, ShopGift> implements ShopGiftService { |
||||
|
@Resource |
||||
|
private ShopGoodsService shopGoodsService; |
||||
|
|
||||
|
@Override |
||||
|
public PageResult<ShopGift> pageRel(ShopGiftParam param) { |
||||
|
PageParam<ShopGift, ShopGiftParam> page = new PageParam<>(param); |
||||
|
page.setDefaultOrder("sort_number asc, create_time desc"); |
||||
|
List<ShopGift> list = baseMapper.selectPageRel(page, param); |
||||
|
if (!list.isEmpty()) { |
||||
|
Set<Integer> goodsIds = list.stream().map(ShopGift::getGoodsId).collect(Collectors.toSet()); |
||||
|
List<ShopGoods> goodsList = shopGoodsService.listByIds(goodsIds); |
||||
|
for (ShopGift shopGift : list) { |
||||
|
ShopGoods shopGoods = goodsList.stream().filter(sG -> sG.getGoodsId().equals(shopGift.getGoodsId())).findFirst().orElse(null); |
||||
|
if (shopGoods != null) { |
||||
|
shopGift.setGoods(shopGoods); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return new PageResult<>(list, page.getTotal()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ShopGift> listRel(ShopGiftParam param) { |
||||
|
List<ShopGift> list = baseMapper.selectListRel(param); |
||||
|
// 排序
|
||||
|
PageParam<ShopGift, ShopGiftParam> page = new PageParam<>(); |
||||
|
page.setDefaultOrder("sort_number asc, create_time desc"); |
||||
|
return page.sortRecords(list); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ShopGift getByIdRel(Integer id) { |
||||
|
ShopGiftParam param = new ShopGiftParam(); |
||||
|
param.setId(id); |
||||
|
return param.getOne(baseMapper.selectListRel(param)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ShopGift getByCode(String code) { |
||||
|
ShopGiftParam param = new ShopGiftParam(); |
||||
|
param.setCode(code); |
||||
|
return param.getOne(baseMapper.selectListRel(param)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,90 @@ |
|||||
|
package com.gxwebsoft.shop.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import com.gxwebsoft.common.core.utils.RequestUtil; |
||||
|
import com.gxwebsoft.common.core.web.ApiResult; |
||||
|
import com.gxwebsoft.common.system.entity.User; |
||||
|
import com.gxwebsoft.shop.entity.*; |
||||
|
import com.gxwebsoft.shop.service.*; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.LinkedHashMap; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-01-11 10:45:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ShopOrderUpdate10550ServiceImpl implements ShopOrderUpdate10550Service { |
||||
|
@Resource |
||||
|
private RequestUtil requestUtil; |
||||
|
@Resource |
||||
|
private ShopDealerOrderService shopDealerOrderService; |
||||
|
@Resource |
||||
|
private ShopDealerCapitalService shopDealerCapitalService; |
||||
|
@Resource |
||||
|
private ShopOrderGoodsService shopOrderGoodsService; |
||||
|
@Resource |
||||
|
private ShopGoodsService shopGoodsService; |
||||
|
|
||||
|
@Override |
||||
|
public void update(ShopOrder order){ |
||||
|
requestUtil.setTenantId(order.getTenantId().toString()); |
||||
|
ApiResult<?> partnerConditionReq = requestUtil.pageDictData(1460); |
||||
|
if (partnerConditionReq.getCode().equals(0) && partnerConditionReq.getData() != null) { |
||||
|
LinkedHashMap<String, Object> dictDataMap = (LinkedHashMap<String, Object>) partnerConditionReq.getData(); |
||||
|
List<LinkedHashMap> dictDataList = (List<LinkedHashMap>) dictDataMap.get("list"); |
||||
|
String dictDataCode = (String) dictDataList.get(0).get("dictDataCode"); |
||||
|
BigDecimal partnerCondition = new BigDecimal(dictDataCode); |
||||
|
|
||||
|
User user = requestUtil.getByUserIdWithoutLogin(order.getUserId()); |
||||
|
if (user != null) { |
||||
|
user.setExpendMoney(user.getExpendMoney().add(order.getPayPrice())); |
||||
|
if (user.getExpendMoney().compareTo(partnerCondition) >= 0) { |
||||
|
user.setGradeId(3); |
||||
|
} |
||||
|
requestUtil.updateWithoutLogin(user); |
||||
|
|
||||
|
// 上级
|
||||
|
User parent = requestUtil.getParent(order.getUserId()); |
||||
|
if (parent != null) { |
||||
|
|
||||
|
List<ShopOrderGoods> shopOrderGoodsList = shopOrderGoodsService.getListByOrderId(order.getOrderId()); |
||||
|
List<Integer> goodsIds = shopOrderGoodsList.stream().map(ShopOrderGoods::getGoodsId).toList(); |
||||
|
List<ShopGoods> shopGoodsList = shopGoodsService.listByIds(goodsIds); |
||||
|
BigDecimal commission = BigDecimal.ZERO; |
||||
|
for (ShopOrderGoods shopOrderGoods : shopOrderGoodsList) { |
||||
|
ShopGoods shopGoods = shopGoodsList.stream().filter(sG -> sG.getGoodsId().equals(shopOrderGoods.getGoodsId())).findFirst().orElse(null); |
||||
|
if (shopGoods != null) { |
||||
|
commission = commission.add(shopGoods.getCommission().multiply(BigDecimal.valueOf(shopOrderGoods.getTotalNum()))); |
||||
|
} |
||||
|
} |
||||
|
parent.setBalance(parent.getBalance().add(commission)); |
||||
|
requestUtil.updateWithoutLogin(user); |
||||
|
|
||||
|
// 分销订单
|
||||
|
ShopDealerOrder shopDealerOrder = new ShopDealerOrder(); |
||||
|
shopDealerOrder.setUserId(parent.getUserId()); |
||||
|
shopDealerOrder.setOrderId(order.getOrderId()); |
||||
|
shopDealerOrder.setOrderPrice(order.getTotalPrice()); |
||||
|
shopDealerOrder.setFirstUserId(order.getUserId()); |
||||
|
shopDealerOrder.setFirstMoney(commission); |
||||
|
shopDealerOrder.setIsSettled(1); |
||||
|
shopDealerOrder.setSettleTime(DateUtil.currentSeconds()); |
||||
|
shopDealerOrderService.save(shopDealerOrder); |
||||
|
|
||||
|
// 分销资明细
|
||||
|
ShopDealerCapital shopDealerCapital = new ShopDealerCapital(); |
||||
|
shopDealerCapital.setUserId(parent.getUserId()); |
||||
|
shopDealerCapital.setOrderId(order.getOrderId()); |
||||
|
shopDealerCapital.setFlowType(10); |
||||
|
shopDealerCapitalService.save(shopDealerCapital); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,79 @@ |
|||||
|
package com.gxwebsoft.shop; |
||||
|
|
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import static org.junit.jupiter.api.Assertions.*; |
||||
|
|
||||
|
/** |
||||
|
* 证书路径构建测试 |
||||
|
* |
||||
|
* @author 科技小王子 |
||||
|
* @since 2025-08-09 |
||||
|
*/ |
||||
|
public class CertificatePathTest { |
||||
|
|
||||
|
@Test |
||||
|
public void testDevCertificatePath() { |
||||
|
// 模拟开发环境配置
|
||||
|
String uploadPath = "/Users/gxwebsoft/JAVA/mp-java/src/main/resources/"; |
||||
|
Integer tenantId = 10324; |
||||
|
String privateKeyFile = "apiclient_key.pem"; |
||||
|
|
||||
|
// 构建证书路径
|
||||
|
String tenantCertPath = uploadPath + "dev/wechat/" + tenantId; |
||||
|
String privateKeyPath = tenantCertPath + "/" + privateKeyFile; |
||||
|
|
||||
|
// 验证路径构建结果
|
||||
|
String expectedTenantPath = "/Users/gxwebsoft/JAVA/mp-java/src/main/resources/dev/wechat/10324"; |
||||
|
String expectedPrivateKeyPath = "/Users/gxwebsoft/JAVA/mp-java/src/main/resources/dev/wechat/10324/apiclient_key.pem"; |
||||
|
|
||||
|
assertEquals(expectedTenantPath, tenantCertPath); |
||||
|
assertEquals(expectedPrivateKeyPath, privateKeyPath); |
||||
|
|
||||
|
System.out.println("开发环境证书路径测试通过:"); |
||||
|
System.out.println("租户证书目录: " + tenantCertPath); |
||||
|
System.out.println("私钥文件路径: " + privateKeyPath); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void testProdCertificatePath() { |
||||
|
// 模拟生产环境配置
|
||||
|
String uploadPath = "/www/wwwroot/file.ws"; |
||||
|
Integer tenantId = 10324; |
||||
|
String privateKeyFile = "apiclient_key.pem"; |
||||
|
|
||||
|
// 构建证书路径(生产环境不使用upload-path,而是从数据库读取)
|
||||
|
// 这里只是为了对比展示
|
||||
|
String tenantCertPath = uploadPath + "dev/wechat/" + tenantId; |
||||
|
String privateKeyPath = tenantCertPath + "/" + privateKeyFile; |
||||
|
|
||||
|
// 验证路径构建结果
|
||||
|
String expectedTenantPath = "/www/wwwroot/file.ws/dev/wechat/10324"; |
||||
|
String expectedPrivateKeyPath = "/www/wwwroot/file.ws/dev/wechat/10324/apiclient_key.pem"; |
||||
|
|
||||
|
assertEquals(expectedTenantPath, tenantCertPath); |
||||
|
assertEquals(expectedPrivateKeyPath, privateKeyPath); |
||||
|
|
||||
|
System.out.println("生产环境证书路径测试通过:"); |
||||
|
System.out.println("租户证书目录: " + tenantCertPath); |
||||
|
System.out.println("私钥文件路径: " + privateKeyPath); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void testMultipleTenants() { |
||||
|
String uploadPath = "/Users/gxwebsoft/JAVA/mp-java/src/main/resources/"; |
||||
|
String privateKeyFile = "apiclient_key.pem"; |
||||
|
|
||||
|
// 测试多个租户的路径构建
|
||||
|
Integer[] tenantIds = {10324, 10325, 10326}; |
||||
|
|
||||
|
for (Integer tenantId : tenantIds) { |
||||
|
String tenantCertPath = uploadPath + "dev/wechat/" + tenantId; |
||||
|
String privateKeyPath = tenantCertPath + "/" + privateKeyFile; |
||||
|
|
||||
|
assertTrue(tenantCertPath.contains(tenantId.toString())); |
||||
|
assertTrue(privateKeyPath.endsWith(privateKeyFile)); |
||||
|
|
||||
|
System.out.println("租户 " + tenantId + " 证书路径: " + privateKeyPath); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue