通告券
This commit is contained in:
parent
dcd3420743
commit
2d54c21bb7
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -34,8 +35,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/base/coupon")
|
@RequestMapping("/base/coupon")
|
||||||
public class BaseCouponController extends BaseController
|
public class BaseCouponController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBaseCouponService baseCouponService;
|
private IBaseCouponService baseCouponService;
|
||||||
|
|
||||||
@ -45,22 +45,31 @@ public class BaseCouponController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('base:coupon:list')")
|
@PreAuthorize("@ss.hasPermi('base:coupon:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(BaseCoupon baseCoupon,
|
public AjaxResult list(BaseCoupon baseCoupon,
|
||||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
{
|
|
||||||
Page<BaseCoupon> page = new Page<>(pageNum, pageSize);
|
Page<BaseCoupon> page = new Page<>(pageNum, pageSize);
|
||||||
IPage<BaseCoupon> list = baseCouponService.queryListPage(baseCoupon,page);
|
IPage<BaseCoupon> list = baseCouponService.queryListPage(baseCoupon, page);
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通告券列表不分页查询
|
||||||
|
* @author PQZ
|
||||||
|
* @date 13:56 2025/4/11
|
||||||
|
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||||
|
**/
|
||||||
|
@GetMapping("/uniCouponList")
|
||||||
|
public AjaxResult uniCouponList() {
|
||||||
|
return success(baseCouponService.couponList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出通告券列表
|
* 导出通告券列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:coupon:export')")
|
@PreAuthorize("@ss.hasPermi('base:coupon:export')")
|
||||||
@Log(title = "通告券", businessType = BusinessType.EXPORT)
|
@Log(title = "通告券", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, BaseCoupon baseCoupon)
|
public void export(HttpServletResponse response, BaseCoupon baseCoupon) {
|
||||||
{
|
|
||||||
List<BaseCoupon> list = baseCouponService.list();
|
List<BaseCoupon> list = baseCouponService.list();
|
||||||
ExcelUtil<BaseCoupon> util = new ExcelUtil<BaseCoupon>(BaseCoupon.class);
|
ExcelUtil<BaseCoupon> util = new ExcelUtil<BaseCoupon>(BaseCoupon.class);
|
||||||
util.exportExcel(response, list, "通告券数据");
|
util.exportExcel(response, list, "通告券数据");
|
||||||
@ -71,8 +80,7 @@ public class BaseCouponController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:coupon:query')")
|
@PreAuthorize("@ss.hasPermi('base:coupon:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||||
{
|
|
||||||
return success(baseCouponService.getById(id));
|
return success(baseCouponService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,8 +90,7 @@ public class BaseCouponController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('base:coupon:add')")
|
@PreAuthorize("@ss.hasPermi('base:coupon:add')")
|
||||||
@Log(title = "通告券", businessType = BusinessType.INSERT)
|
@Log(title = "通告券", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody BaseCoupon baseCoupon)
|
public AjaxResult add(@RequestBody BaseCoupon baseCoupon) {
|
||||||
{
|
|
||||||
return toAjax(baseCouponService.save(baseCoupon));
|
return toAjax(baseCouponService.save(baseCoupon));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,8 +100,7 @@ public class BaseCouponController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('base:coupon:edit')")
|
@PreAuthorize("@ss.hasPermi('base:coupon:edit')")
|
||||||
@Log(title = "通告券", businessType = BusinessType.UPDATE)
|
@Log(title = "通告券", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody BaseCoupon baseCoupon)
|
public AjaxResult edit(@RequestBody BaseCoupon baseCoupon) {
|
||||||
{
|
|
||||||
return toAjax(baseCouponService.updateById(baseCoupon));
|
return toAjax(baseCouponService.updateById(baseCoupon));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,9 +109,8 @@ public class BaseCouponController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:coupon:remove')")
|
@PreAuthorize("@ss.hasPermi('base:coupon:remove')")
|
||||||
@Log(title = "通告券", businessType = BusinessType.DELETE)
|
@Log(title = "通告券", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable String[] ids)
|
public AjaxResult remove(@PathVariable String[] ids) {
|
||||||
{
|
|
||||||
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||||
return toAjax(baseCouponService.removeByIds(list));
|
return toAjax(baseCouponService.removeByIds(list));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.base.service;
|
package com.ruoyi.base.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@ -12,7 +13,14 @@ import com.ruoyi.base.domain.BaseCoupon;
|
|||||||
* @author vinjor-m
|
* @author vinjor-m
|
||||||
* @date 2025-03-17
|
* @date 2025-03-17
|
||||||
*/
|
*/
|
||||||
public interface IBaseCouponService extends IService<BaseCoupon>
|
public interface IBaseCouponService extends IService<BaseCoupon> {
|
||||||
{
|
|
||||||
IPage<BaseCoupon> queryListPage(BaseCoupon pageReqVO, Page<BaseCoupon> page);
|
IPage<BaseCoupon> queryListPage(BaseCoupon pageReqVO, Page<BaseCoupon> page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不分页查询基础通告券列表
|
||||||
|
* @author PQZ
|
||||||
|
* @date 13:54 2025/4/11
|
||||||
|
* @return java.util.List<com.ruoyi.base.domain.BaseCoupon>
|
||||||
|
**/
|
||||||
|
List<BaseCoupon> couponList();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.ruoyi.base.service.impl;
|
package com.ruoyi.base.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -27,4 +30,20 @@ public class BaseCouponServiceImpl extends ServiceImpl<BaseCouponMapper,BaseCoup
|
|||||||
public IPage<BaseCoupon> queryListPage(BaseCoupon pageReqVO, Page<BaseCoupon> page) {
|
public IPage<BaseCoupon> queryListPage(BaseCoupon pageReqVO, Page<BaseCoupon> page) {
|
||||||
return baseCouponMapper.queryListPage(pageReqVO, page);
|
return baseCouponMapper.queryListPage(pageReqVO, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不分页查询基础通告券列表
|
||||||
|
*
|
||||||
|
* @return java.util.List<com.ruoyi.base.domain.BaseCoupon>
|
||||||
|
* @author PQZ
|
||||||
|
* @date 13:54 2025/4/11
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<BaseCoupon> couponList() {
|
||||||
|
LambdaQueryWrapper<BaseCoupon> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(DlBaseEntity::getDelFlag,0)
|
||||||
|
.eq(BaseCoupon::getIsShow,1)
|
||||||
|
.orderByDesc(DlBaseEntity::getCreateTime);
|
||||||
|
return list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -31,8 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/member/coupon")
|
@RequestMapping("/member/coupon")
|
||||||
public class MemberCouponController extends BaseController
|
public class MemberCouponController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMemberCouponService memberCouponService;
|
private IMemberCouponService memberCouponService;
|
||||||
|
|
||||||
@ -41,8 +41,7 @@ public class MemberCouponController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('member:coupon:list')")
|
@PreAuthorize("@ss.hasPermi('member:coupon:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(MemberCoupon memberCoupon)
|
public AjaxResult list(MemberCoupon memberCoupon) {
|
||||||
{
|
|
||||||
|
|
||||||
List<MemberCoupon> list = memberCouponService.list();
|
List<MemberCoupon> list = memberCouponService.list();
|
||||||
return success(list);
|
return success(list);
|
||||||
@ -54,8 +53,7 @@ public class MemberCouponController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('member:coupon:export')")
|
@PreAuthorize("@ss.hasPermi('member:coupon:export')")
|
||||||
@Log(title = "用户通告券变动记录", businessType = BusinessType.EXPORT)
|
@Log(title = "用户通告券变动记录", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, MemberCoupon memberCoupon)
|
public void export(HttpServletResponse response, MemberCoupon memberCoupon) {
|
||||||
{
|
|
||||||
List<MemberCoupon> list = memberCouponService.list();
|
List<MemberCoupon> list = memberCouponService.list();
|
||||||
ExcelUtil<MemberCoupon> util = new ExcelUtil<MemberCoupon>(MemberCoupon.class);
|
ExcelUtil<MemberCoupon> util = new ExcelUtil<MemberCoupon>(MemberCoupon.class);
|
||||||
util.exportExcel(response, list, "用户通告券变动记录数据");
|
util.exportExcel(response, list, "用户通告券变动记录数据");
|
||||||
@ -66,8 +64,7 @@ public class MemberCouponController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('member:coupon:query')")
|
@PreAuthorize("@ss.hasPermi('member:coupon:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||||
{
|
|
||||||
return success(memberCouponService.getById(id));
|
return success(memberCouponService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,8 +74,7 @@ public class MemberCouponController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('member:coupon:add')")
|
@PreAuthorize("@ss.hasPermi('member:coupon:add')")
|
||||||
@Log(title = "用户通告券变动记录", businessType = BusinessType.INSERT)
|
@Log(title = "用户通告券变动记录", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody MemberCoupon memberCoupon)
|
public AjaxResult add(@RequestBody MemberCoupon memberCoupon) {
|
||||||
{
|
|
||||||
return toAjax(memberCouponService.save(memberCoupon));
|
return toAjax(memberCouponService.save(memberCoupon));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,8 +84,7 @@ public class MemberCouponController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('member:coupon:edit')")
|
@PreAuthorize("@ss.hasPermi('member:coupon:edit')")
|
||||||
@Log(title = "用户通告券变动记录", businessType = BusinessType.UPDATE)
|
@Log(title = "用户通告券变动记录", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody MemberCoupon memberCoupon)
|
public AjaxResult edit(@RequestBody MemberCoupon memberCoupon) {
|
||||||
{
|
|
||||||
return toAjax(memberCouponService.updateById(memberCoupon));
|
return toAjax(memberCouponService.updateById(memberCoupon));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,9 +93,8 @@ public class MemberCouponController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('member:coupon:remove')")
|
@PreAuthorize("@ss.hasPermi('member:coupon:remove')")
|
||||||
@Log(title = "用户通告券变动记录", businessType = BusinessType.DELETE)
|
@Log(title = "用户通告券变动记录", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable String[] ids)
|
public AjaxResult remove(@PathVariable String[] ids) {
|
||||||
{
|
|
||||||
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||||
return toAjax(memberCouponService.removeByIds(list));
|
return toAjax(memberCouponService.removeByIds(list));
|
||||||
}
|
}
|
||||||
|
@ -31,4 +31,14 @@ public interface IMemberCouponService extends IService<MemberCoupon> {
|
|||||||
**/
|
**/
|
||||||
void saveCoupon(Long userId, String type, String noticeId, Integer couponNum);
|
void saveCoupon(Long userId, String type, String noticeId, Integer couponNum);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询剩余通告券
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return java.lang.Integer
|
||||||
|
* @author PQZ
|
||||||
|
* @date 13:37 2025/4/11
|
||||||
|
**/
|
||||||
|
Integer getCoupon(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,7 @@ public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper,Memb
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public void dealMemberCoupon(MemberOrder order) {
|
public void dealMemberCoupon(MemberOrder order) {
|
||||||
BaseCoupon coupon = baseCouponService.getById(order.getGoodsId());
|
saveCoupon(order.getUserId(), "2",null,order.getGoodsNum());
|
||||||
saveCoupon(order.getUserId(), "2",null,coupon.getCouponNum());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,5 +81,27 @@ public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper,Memb
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询剩余通告券
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return java.lang.Integer
|
||||||
|
* @author PQZ
|
||||||
|
* @date 13:37 2025/4/11
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public Integer getCoupon(Long userId) {
|
||||||
|
LambdaQueryWrapper<MemberCoupon> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(DlBaseEntity::getDelFlag,0)
|
||||||
|
.eq(MemberCoupon::getUserId,userId)
|
||||||
|
.orderByDesc(DlBaseEntity::getCreateTime);
|
||||||
|
List<MemberCoupon> list = list(lambdaQueryWrapper);
|
||||||
|
if (list.isEmpty()){
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return list.get(0).getBalance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,8 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
|
|||||||
private IMemberPointsService pointsService;
|
private IMemberPointsService pointsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
|
@Resource
|
||||||
|
private IMemberCouponService couponService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,6 +141,8 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
|
|||||||
result.setPointsBalance(pointsService.getBloggerBalance(userId));
|
result.setPointsBalance(pointsService.getBloggerBalance(userId));
|
||||||
//报名
|
//报名
|
||||||
result.setReport(cardService.getCardReport(userId,"02"));
|
result.setReport(cardService.getCardReport(userId,"02"));
|
||||||
|
} else {
|
||||||
|
result.setCoupon(couponService.getCoupon(userId));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,8 @@ public class MemberUserVO extends MemberUser {
|
|||||||
int pointsBalance;
|
int pointsBalance;
|
||||||
/**报名次数*/
|
/**报名次数*/
|
||||||
int report;
|
int report;
|
||||||
|
/**剩余通告券*/
|
||||||
|
int coupon;
|
||||||
/**用户名*/
|
/**用户名*/
|
||||||
String userName;
|
String userName;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
<if test="entity.refundWay != null and entity.refundWay != ''"> and refund_way = #{entity.refundWay}</if>
|
<if test="entity.refundWay != null and entity.refundWay != ''"> and refund_way = #{entity.refundWay}</if>
|
||||||
<if test="entity.isPay != null "> and is_pay = #{entity.isPay}</if>
|
<if test="entity.isPay != null "> and is_pay = #{entity.isPay}</if>
|
||||||
<if test="entity.isRefund != null "> and is_refund = #{entity.isRefund}</if>
|
<if test="entity.isRefund != null "> and is_refund = #{entity.isRefund}</if>
|
||||||
|
<if test="entity.userId != null "> and user_id = #{entity.userId}</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
Loading…
Reference in New Issue
Block a user