新增:签到积分功能
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
package com.gxwebsoft.booking.controller;
|
package com.gxwebsoft.booking.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
|
import com.gxwebsoft.common.core.security.JwtSubject;
|
||||||
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
|
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.booking.service.IntegralService;
|
import com.gxwebsoft.booking.service.IntegralService;
|
||||||
import com.gxwebsoft.booking.entity.Integral;
|
import com.gxwebsoft.booking.entity.Integral;
|
||||||
@@ -10,12 +17,18 @@ import com.gxwebsoft.common.core.web.PageParam;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.common.system.service.UserService;
|
||||||
|
import io.jsonwebtoken.Claims;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,6 +43,8 @@ import java.util.List;
|
|||||||
public class IntegralController extends BaseController {
|
public class IntegralController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private IntegralService integralService;
|
private IntegralService integralService;
|
||||||
|
@Resource
|
||||||
|
private ConfigProperties configProperties;
|
||||||
|
|
||||||
@ApiOperation("分页查询签到积分")
|
@ApiOperation("分页查询签到积分")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@@ -44,6 +59,18 @@ public class IntegralController extends BaseController {
|
|||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(integralService.listRel(param));
|
return success(integralService.listRel(param));
|
||||||
}
|
}
|
||||||
|
@ApiOperation("本月签到数据")
|
||||||
|
@GetMapping("/getSignData")
|
||||||
|
public ApiResult<?> getSignData(IntegralParam param) {
|
||||||
|
System.out.println("param.getDateTime() = " + param.getDateTime());
|
||||||
|
final User loginUser = getLoginUser();
|
||||||
|
if(loginUser == null){
|
||||||
|
return fail("请先登录");
|
||||||
|
}
|
||||||
|
String message = integralService.count(new LambdaUpdateWrapper<Integral>().eq(Integral::getUserId,getLoginUser().getUserId()).eq(Integral::getDateTime, DateUtil.today())) > 0 ? "您今天已经签到过了" : "操作成功";
|
||||||
|
final List<Integral> list = integralService.list(new LambdaUpdateWrapper<Integral>().eq(Integral::getUserId,loginUser.getUserId()).like(Integral::getDateTime, param.getDateTime()));
|
||||||
|
return success(message,list);
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('booking:integral:list')")
|
@PreAuthorize("hasAuthority('booking:integral:list')")
|
||||||
@ApiOperation("根据id查询签到积分")
|
@ApiOperation("根据id查询签到积分")
|
||||||
@@ -55,16 +82,41 @@ public class IntegralController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("添加签到积分")
|
@ApiOperation("添加签到积分")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody Integral integral) {
|
public ApiResult<?> save(@RequestBody Integral integral, HttpServletRequest request) {
|
||||||
// 记录当前登录用户id
|
// 记录当前登录用户id
|
||||||
// User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
// if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
// integral.setUserId(loginUser.getUserId());
|
integral.setUserId(loginUser.getUserId());
|
||||||
// }
|
integral.setUsername(loginUser.getNickname());
|
||||||
if (integralService.save(integral)) {
|
integral.setPhone(loginUser.getPhone());
|
||||||
return success("添加成功");
|
integral.setIntegral(new BigDecimal("1"));
|
||||||
}
|
integral.setDateTime(DateUtil.today());
|
||||||
return fail("添加失败");
|
integral.setDay(DateUtil.thisDayOfMonth());
|
||||||
|
integral.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
|
||||||
|
if (integralService.count(new LambdaUpdateWrapper<Integral>().eq(Integral::getUserId,getLoginUser().getUserId()).eq(Integral::getDateTime, DateUtil.today())) > 0) {
|
||||||
|
// return fail("您今天已经签到过了.");
|
||||||
|
}
|
||||||
|
if (integralService.save(integral)) {
|
||||||
|
// 累计积分
|
||||||
|
String access_token = JwtUtil.getAccessToken(request);
|
||||||
|
Claims claims = JwtUtil.parseToken(access_token, configProperties.getTokenKey());
|
||||||
|
JwtSubject jwtSubject = JwtUtil.getJwtSubject(claims);
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("userId", loginUser.getUserId());
|
||||||
|
map.put("points",loginUser.getPoints() + 1);
|
||||||
|
map.put("tenantId", jwtSubject.getTenantId());
|
||||||
|
// 链式构建请求
|
||||||
|
String result = HttpRequest.post("https://server.gxwebsoft.com/api/system/user/update")
|
||||||
|
.header("Authorization", access_token)
|
||||||
|
.header("Tenantid", jwtSubject.getTenantId().toString())
|
||||||
|
.body(JSONUtil.toJSONString(map))//表单内容
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute().body();
|
||||||
|
return success("签到成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fail("签到失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改签到积分")
|
@ApiOperation("修改签到积分")
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class UserCouponController extends BaseController {
|
|||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<UserCoupon>> page(UserCouponParam param) {
|
public ApiResult<PageResult<UserCoupon>> page(UserCouponParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
|
param.setUserId(getLoginUserId());
|
||||||
return success(userCouponService.pageRel(param));
|
return success(userCouponService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package com.gxwebsoft.booking.controller;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.booking.service.UserInvoiceService;
|
||||||
|
import com.gxwebsoft.booking.entity.UserInvoice;
|
||||||
|
import com.gxwebsoft.booking.param.UserInvoiceParam;
|
||||||
|
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.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-05-23 16:27:08
|
||||||
|
*/
|
||||||
|
@Api(tags = "发票管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/booking/user-invoice")
|
||||||
|
public class UserInvoiceController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private UserInvoiceService userInvoiceService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询发票")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<UserInvoice>> page(UserInvoiceParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(userInvoiceService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部发票")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<UserInvoice>> list(UserInvoiceParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(userInvoiceService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('booking:userInvoice:list')")
|
||||||
|
@ApiOperation("根据id查询发票")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<UserInvoice> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(userInvoiceService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加发票")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody UserInvoice userInvoice) {
|
||||||
|
// 记录当前登录用户id
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
userInvoice.setUserId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
if (userInvoiceService.save(userInvoice)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改发票")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody UserInvoice userInvoice) {
|
||||||
|
if (userInvoiceService.updateById(userInvoice)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除发票")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (userInvoiceService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加发票")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<UserInvoice> list) {
|
||||||
|
if (userInvoiceService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改发票")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<UserInvoice> batchParam) {
|
||||||
|
if (batchParam.update(userInvoiceService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除发票")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (userInvoiceService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -42,12 +42,12 @@ public class Integral implements Serializable {
|
|||||||
private String dateTime;
|
private String dateTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "天")
|
@ApiModelProperty(value = "天")
|
||||||
private String day;
|
private Integer day;
|
||||||
|
|
||||||
@ApiModelProperty(value = "租户id")
|
@ApiModelProperty(value = "租户id")
|
||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "签到时间")
|
@ApiModelProperty(value = "签到时间")
|
||||||
private Integer createTime;
|
private Long createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.gxwebsoft.booking.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 java.util.Date;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-05-23 16:27:08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "UserInvoice对象", description = "发票")
|
||||||
|
public class UserInvoice implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发票类型(0纸质 1电子)")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发票名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开票类型(0铺票 1专票)")
|
||||||
|
private Integer invoiceType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "税号")
|
||||||
|
private String invoiceCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "公司地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "公司电话")
|
||||||
|
private String tel;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开户行")
|
||||||
|
private String bankName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开户账号")
|
||||||
|
private String bankAccount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号码")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "电子邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0待使用, 1已使用, 2已失效")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户ID")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "修改时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.booking.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.booking.entity.UserInvoice;
|
||||||
|
import com.gxwebsoft.booking.param.UserInvoiceParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-05-23 16:27:08
|
||||||
|
*/
|
||||||
|
public interface UserInvoiceMapper extends BaseMapper<UserInvoice> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<UserInvoice>
|
||||||
|
*/
|
||||||
|
List<UserInvoice> selectPageRel(@Param("page") IPage<UserInvoice> page,
|
||||||
|
@Param("param") UserInvoiceParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<UserInvoice> selectListRel(@Param("param") UserInvoiceParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*
|
SELECT a.*
|
||||||
FROM user_coupon a
|
FROM booking_user_coupon a
|
||||||
<where>
|
<where>
|
||||||
<if test="param.id != null">
|
<if test="param.id != null">
|
||||||
AND a.id = #{param.id}
|
AND a.id = #{param.id}
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<?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.booking.mapper.UserInvoiceMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM user_invoice a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.type != null">
|
||||||
|
AND a.type = #{param.type}
|
||||||
|
</if>
|
||||||
|
<if test="param.name != null">
|
||||||
|
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.invoiceType != null">
|
||||||
|
AND a.invoice_type = #{param.invoiceType}
|
||||||
|
</if>
|
||||||
|
<if test="param.invoiceCode != null">
|
||||||
|
AND a.invoice_code LIKE CONCAT('%', #{param.invoiceCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.address != null">
|
||||||
|
AND a.address LIKE CONCAT('%', #{param.address}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.tel != null">
|
||||||
|
AND a.tel LIKE CONCAT('%', #{param.tel}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.bankName != null">
|
||||||
|
AND a.bank_name LIKE CONCAT('%', #{param.bankName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.bankAccount != null">
|
||||||
|
AND a.bank_account LIKE CONCAT('%', #{param.bankAccount}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.phone != null">
|
||||||
|
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.email != null">
|
||||||
|
AND a.email LIKE CONCAT('%', #{param.email}, '%')
|
||||||
|
</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.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.userId != null">
|
||||||
|
AND a.user_id = #{param.userId}
|
||||||
|
</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.booking.entity.UserInvoice">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.UserInvoice">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.gxwebsoft.booking.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.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-05-23 16:27:07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "UserInvoiceParam对象", description = "发票查询参数")
|
||||||
|
public class UserInvoiceParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发票类型(0纸质 1电子)")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发票名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开票类型(0铺票 1专票)")
|
||||||
|
private Integer invoiceType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "税号")
|
||||||
|
private String invoiceCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "公司地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "公司电话")
|
||||||
|
private String tel;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开户行")
|
||||||
|
private String bankName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开户账号")
|
||||||
|
private String bankAccount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号码")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "电子邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0待使用, 1已使用, 2已失效")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.gxwebsoft.booking.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.booking.entity.UserInvoice;
|
||||||
|
import com.gxwebsoft.booking.param.UserInvoiceParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-05-23 16:27:08
|
||||||
|
*/
|
||||||
|
public interface UserInvoiceService extends IService<UserInvoice> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<UserInvoice>
|
||||||
|
*/
|
||||||
|
PageResult<UserInvoice> pageRel(UserInvoiceParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<UserInvoice>
|
||||||
|
*/
|
||||||
|
List<UserInvoice> listRel(UserInvoiceParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return UserInvoice
|
||||||
|
*/
|
||||||
|
UserInvoice getByIdRel(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ public class IntegralLogServiceImpl extends ServiceImpl<IntegralLogMapper, Integ
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<IntegralLog> pageRel(IntegralLogParam param) {
|
public PageResult<IntegralLog> pageRel(IntegralLogParam param) {
|
||||||
PageParam<IntegralLog, IntegralLogParam> page = new PageParam<>(param);
|
PageParam<IntegralLog, IntegralLogParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
List<IntegralLog> list = baseMapper.selectPageRel(page, param);
|
List<IntegralLog> list = baseMapper.selectPageRel(page, param);
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ public class IntegralLogServiceImpl extends ServiceImpl<IntegralLogMapper, Integ
|
|||||||
List<IntegralLog> list = baseMapper.selectListRel(param);
|
List<IntegralLog> list = baseMapper.selectListRel(param);
|
||||||
// 排序
|
// 排序
|
||||||
PageParam<IntegralLog, IntegralLogParam> page = new PageParam<>();
|
PageParam<IntegralLog, IntegralLogParam> page = new PageParam<>();
|
||||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
return page.sortRecords(list);
|
return page.sortRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class IntegralServiceImpl extends ServiceImpl<IntegralMapper, Integral> i
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<Integral> pageRel(IntegralParam param) {
|
public PageResult<Integral> pageRel(IntegralParam param) {
|
||||||
PageParam<Integral, IntegralParam> page = new PageParam<>(param);
|
PageParam<Integral, IntegralParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
List<Integral> list = baseMapper.selectPageRel(page, param);
|
List<Integral> list = baseMapper.selectPageRel(page, param);
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ public class IntegralServiceImpl extends ServiceImpl<IntegralMapper, Integral> i
|
|||||||
List<Integral> list = baseMapper.selectListRel(param);
|
List<Integral> list = baseMapper.selectListRel(param);
|
||||||
// 排序
|
// 排序
|
||||||
PageParam<Integral, IntegralParam> page = new PageParam<>();
|
PageParam<Integral, IntegralParam> page = new PageParam<>();
|
||||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
return page.sortRecords(list);
|
return page.sortRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gxwebsoft.booking.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.booking.mapper.UserInvoiceMapper;
|
||||||
|
import com.gxwebsoft.booking.service.UserInvoiceService;
|
||||||
|
import com.gxwebsoft.booking.entity.UserInvoice;
|
||||||
|
import com.gxwebsoft.booking.param.UserInvoiceParam;
|
||||||
|
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 2024-05-23 16:27:08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserInvoiceServiceImpl extends ServiceImpl<UserInvoiceMapper, UserInvoice> implements UserInvoiceService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<UserInvoice> pageRel(UserInvoiceParam param) {
|
||||||
|
PageParam<UserInvoice, UserInvoiceParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
List<UserInvoice> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserInvoice> listRel(UserInvoiceParam param) {
|
||||||
|
List<UserInvoice> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<UserInvoice, UserInvoiceParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserInvoice getByIdRel(Integer id) {
|
||||||
|
UserInvoiceParam param = new UserInvoiceParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -57,7 +57,9 @@ public class BookingGenerator {
|
|||||||
// "booking_integral_log"
|
// "booking_integral_log"
|
||||||
// "booking_order"
|
// "booking_order"
|
||||||
// "booking_emergency",
|
// "booking_emergency",
|
||||||
"user_coupon"
|
// "user_coupon",
|
||||||
|
// "user_invoice"
|
||||||
|
"user_card"
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
private static final String[] TABLE_PREFIX = new String[]{
|
private static final String[] TABLE_PREFIX = new String[]{
|
||||||
|
|||||||
Reference in New Issue
Block a user