Browse Source

更新实体类 处理编辑用户信息BUG

lutong 2 months ago
parent
commit
57e2d8d278

+ 16 - 0
alien-dining/src/main/java/shop/alien/dining/controller/DiningCouponController.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import io.swagger.annotations.ApiSort;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -85,4 +86,19 @@ public class DiningCouponController {
         String authorization = request.getHeader("Authorization");
         return diningCouponService.getStoreUserUsableCouponList(authorization, storeId, amount);
     }
+
+    /**
+     * 查询用户拥有的优惠券(按符合支付条件优先,其次优惠力度大的优先)
+     */
+    @ApiOperation(value = "查询用户拥有的优惠券", notes = "需登录。查询用户拥有的优惠券,排序:符合支付条件的优先,其次优惠力度大的优先")
+    @GetMapping("/userOwned")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "storeId", value = "门店ID(可选,如果提供则只查询该门店的优惠券)", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "amount", value = "当前消费金额(用于判断是否符合支付条件)", dataType = "BigDecimal", paramType = "query", required = false)
+    })
+    public R<List<LifeDiscountCouponVo>> getUserOwnedCoupons(
+            @ApiParam(value = "门店ID(可选)") @RequestParam(required = false) String storeId,
+            @ApiParam(value = "当前消费金额(可选,用于判断是否符合支付条件)") @RequestParam(required = false) BigDecimal amount) {
+        return diningCouponService.getUserOwnedCoupons(storeId, amount);
+    }
 }

+ 30 - 10
alien-dining/src/main/java/shop/alien/dining/controller/DiningUserController.java

@@ -12,6 +12,7 @@ import shop.alien.dining.dto.UserProfileUpdateDto;
 import shop.alien.dining.dto.VerifyTokenDto;
 import shop.alien.dining.dto.WeChatLoginDto;
 import shop.alien.dining.service.DiningUserService;
+import shop.alien.dining.util.TokenUtil;
 import shop.alien.dining.vo.DiningUserVo;
 import shop.alien.dining.vo.TokenVerifyVo;
 import org.apache.commons.lang3.StringUtils;
@@ -55,25 +56,36 @@ public class DiningUserController {
         return R.data(userVo);
     }
 
-    @ApiOperation(value = "获取用户信息", notes = "根据用户ID获取用户详细信息")
+    @ApiOperation(value = "获取用户信息", notes = "获取当前登录用户详细信息(从token中获取用户ID)")
     @GetMapping("/getUserInfo")
-    public R<DiningUserVo> getUserInfo(@RequestParam("userId") Long userId) {
-        log.info("获取用户信息: userId={}", userId);
-
+    public R<DiningUserVo> getUserInfo() {
+        // 从 token 获取当前用户ID
+        Integer userId = TokenUtil.getCurrentUserId();
         if (userId == null) {
-            return R.fail("用户ID不能为空");
+            return R.fail("用户未登录");
         }
-        DiningUserVo userVo = diningUserService.getUserInfo(userId);
+
+        log.info("获取用户信息: userId={}", userId);
+
+        DiningUserVo userVo = diningUserService.getUserInfo(userId.longValue());
         if (userVo == null) {
             return R.fail("用户不存在或状态异常");
         }
         return R.data(userVo);
     }
 
-    @ApiOperation(value = "更新用户个人信息", notes = "登录后完善资料,支持更新昵称、头像、性别、生日等")
+    @ApiOperation(value = "更新用户个人信息", notes = "登录后完善资料,支持更新昵称、头像、性别、生日等(从token中获取用户ID)")
     @PostMapping("/updateProfile")
     public R<DiningUserVo> updateProfile(@Valid @RequestBody UserProfileUpdateDto dto) {
-        log.info("更新用户个人信息: userId={}", dto.getUserId());
+        // 从 token 获取当前用户ID
+        Integer userId = TokenUtil.getCurrentUserId();
+        if (userId == null) {
+            return R.fail("用户未登录");
+        }
+
+        // 使用 token 中的用户ID,忽略 DTO 中的 userId(防止用户修改其他用户的信息)
+        dto.setUserId(userId.longValue());
+        log.info("更新用户个人信息: userId={}", userId);
 
         DiningUserVo userVo = diningUserService.updateProfile(dto);
         if (userVo == null) {
@@ -82,10 +94,18 @@ public class DiningUserController {
         return R.data(userVo);
     }
 
-    @ApiOperation(value = "更换手机号", notes = "校验验证码后更新 user_phone,成功后需重新登录")
+    @ApiOperation(value = "更换手机号", notes = "校验验证码后更新 user_phone,成功后需重新登录(从token中获取用户ID)")
     @PostMapping("/changePhone")
     public R<DiningUserVo> changePhone(@Valid @RequestBody ChangePhoneDto dto) {
-        log.info("更换手机号: userId={}, newPhone={}", dto.getUserId(), dto.getNewPhone());
+        // 从 token 获取当前用户ID
+        Integer userId = TokenUtil.getCurrentUserId();
+        if (userId == null) {
+            return R.fail("用户未登录");
+        }
+
+        // 使用 token 中的用户ID,忽略 DTO 中的 userId(防止用户修改其他用户的手机号)
+        dto.setUserId(userId.longValue());
+        log.info("更换手机号: userId={}, newPhone={}", userId, dto.getNewPhone());
 
         DiningUserVo userVo = diningUserService.changePhone(dto);
         if (userVo == null) {

+ 21 - 0
alien-dining/src/main/java/shop/alien/dining/controller/StoreOrderController.java

@@ -436,6 +436,27 @@ public class StoreOrderController {
         }
     }
 
+    @ApiOperation(value = "查询我的订单", notes = "通过标识查询我的未支付订单或历史订单。type: 0或unpaid-未支付订单, 1或history-历史订单")
+    @GetMapping("/my-orders")
+    public R<IPage<StoreOrder>> getMyOrders(
+            @ApiParam(value = "页码", required = true) @RequestParam(defaultValue = "1") Long current,
+            @ApiParam(value = "每页数量", required = true) @RequestParam(defaultValue = "10") Long size,
+            @ApiParam(value = "订单类型(0或unpaid:未支付订单, 1或history:历史订单)", required = true) @RequestParam String type) {
+        try {
+            // 从 token 获取用户信息
+            Integer userId = TokenUtil.getCurrentUserId();
+            if (userId == null) {
+                return R.fail("用户未登录");
+            }
+            Page<StoreOrder> page = new Page<>(current, size);
+            IPage<StoreOrder> result = orderService.getMyOrders(page, type);
+            return R.data(result);
+        } catch (Exception e) {
+            log.error("查询我的订单失败: {}", e.getMessage(), e);
+            return R.fail("查询我的订单失败: " + e.getMessage());
+        }
+    }
+
     @ApiOperation(value = "换桌", notes = "换桌并迁移购物车")
     @PostMapping("/change-table")
     public R<CartDTO> changeTable(@Valid @RequestBody ChangeTableDTO dto) {

+ 9 - 0
alien-dining/src/main/java/shop/alien/dining/service/DiningCouponService.java

@@ -45,4 +45,13 @@ public interface DiningCouponService {
      * @return R.data 为 Map:canUseLifeDiscountCouponVos、forbidUseLifeDiscountCouponVos
      */
     R<Map<String, Object>> getStoreUserUsableCouponList(String authorization, String storeId, BigDecimal amount);
+
+    /**
+     * 查询用户拥有的优惠券(按符合支付条件优先,其次优惠力度大的优先)
+     *
+     * @param storeId 门店ID(可选,如果提供则只查询该门店的优惠券)
+     * @param amount  当前消费金额(用于判断是否符合支付条件)
+     * @return 优惠券列表
+     */
+    R<List<LifeDiscountCouponVo>> getUserOwnedCoupons(String storeId, BigDecimal amount);
 }

+ 9 - 0
alien-dining/src/main/java/shop/alien/dining/service/StoreOrderService.java

@@ -128,4 +128,13 @@ public interface StoreOrderService extends IService<StoreOrder> {
      * @param tableId 餐桌ID
      */
     void resetTableAfterPayment(Integer tableId);
+
+    /**
+     * 查询我的订单(通过标识查询未支付订单或历史订单)
+     *
+     * @param page 分页参数
+     * @param type 订单类型(0或"unpaid":未支付订单, 1或"history":历史订单)
+     * @return 订单分页列表
+     */
+    IPage<StoreOrder> getMyOrders(Page<StoreOrder> page, String type);
 }

+ 139 - 0
alien-dining/src/main/java/shop/alien/dining/service/impl/DiningCouponServiceImpl.java

@@ -1,16 +1,26 @@
 package shop.alien.dining.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 import shop.alien.dining.feign.AlienStoreFeign;
 import shop.alien.dining.service.DiningCouponService;
+import shop.alien.dining.util.TokenUtil;
 import shop.alien.entity.result.R;
+import shop.alien.entity.store.LifeDiscountCoupon;
+import shop.alien.entity.store.LifeDiscountCouponUser;
 import shop.alien.entity.store.vo.LifeDiscountCouponVo;
+import shop.alien.mapper.LifeDiscountCouponMapper;
+import shop.alien.mapper.LifeDiscountCouponUserMapper;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 点餐模块-优惠券服务实现(透传 Feign 调 store,满足小程序我的优惠券/详情/选券)
@@ -25,6 +35,8 @@ import java.util.Map;
 public class DiningCouponServiceImpl implements DiningCouponService {
 
     private final AlienStoreFeign alienStoreFeign;
+    private final LifeDiscountCouponUserMapper lifeDiscountCouponUserMapper;
+    private final LifeDiscountCouponMapper lifeDiscountCouponMapper;
 
     @Override
     public R<List<LifeDiscountCouponVo>> getUserCouponList(String authorization, int page, int size, String tabType) {
@@ -70,4 +82,131 @@ public class DiningCouponServiceImpl implements DiningCouponService {
             return R.fail("获取门店可用优惠券列表失败");
         }
     }
+
+    @Override
+    public R<List<LifeDiscountCouponVo>> getUserOwnedCoupons(String storeId, BigDecimal amount) {
+        log.info("查询用户拥有的优惠券, storeId={}, amount={}", storeId, amount);
+
+        try {
+            // 获取当前用户ID
+            Integer userId = TokenUtil.getCurrentUserId();
+            if (userId == null) {
+                return R.fail("用户未登录");
+            }
+
+            // 查询用户拥有的优惠券(未使用且未过期的)
+            LambdaQueryWrapper<LifeDiscountCouponUser> userWrapper = new LambdaQueryWrapper<>();
+            userWrapper.eq(LifeDiscountCouponUser::getUserId, userId);
+            userWrapper.eq(LifeDiscountCouponUser::getStatus, 0); // 0:待使用
+            userWrapper.eq(LifeDiscountCouponUser::getDeleteFlag, 0);
+            userWrapper.ge(LifeDiscountCouponUser::getExpirationTime, LocalDate.now()); // 未过期
+            List<LifeDiscountCouponUser> userCoupons = lifeDiscountCouponUserMapper.selectList(userWrapper);
+
+            if (userCoupons == null || userCoupons.isEmpty()) {
+                log.info("用户没有可用的优惠券, userId={}", userId);
+                return R.data(new ArrayList<>());
+            }
+
+            // 获取优惠券ID列表
+            List<Integer> couponIds = userCoupons.stream()
+                    .map(LifeDiscountCouponUser::getCouponId)
+                    .collect(Collectors.toList());
+
+            // 查询优惠券详情
+            LambdaQueryWrapper<LifeDiscountCoupon> couponWrapper = new LambdaQueryWrapper<>();
+            couponWrapper.in(LifeDiscountCoupon::getId, couponIds);
+            couponWrapper.eq(LifeDiscountCoupon::getDeleteFlag, 0);
+            if (StringUtils.hasText(storeId)) {
+                couponWrapper.eq(LifeDiscountCoupon::getStoreId, storeId);
+            }
+            List<LifeDiscountCoupon> coupons = lifeDiscountCouponMapper.selectList(couponWrapper);
+
+            if (coupons == null || coupons.isEmpty()) {
+                log.info("未找到优惠券详情, userId={}, couponIds={}", userId, couponIds);
+                return R.data(new ArrayList<>());
+            }
+
+            // 转换为VO并设置用户券ID
+            List<LifeDiscountCouponVo> couponVos = new ArrayList<>();
+            for (LifeDiscountCoupon coupon : coupons) {
+                // 找到对应的用户券
+                LifeDiscountCouponUser userCoupon = userCoupons.stream()
+                        .filter(uc -> uc.getCouponId().equals(coupon.getId()))
+                        .findFirst()
+                        .orElse(null);
+
+                if (userCoupon == null) {
+                    continue;
+                }
+
+                LifeDiscountCouponVo vo = convertToVo(coupon, userCoupon);
+                couponVos.add(vo);
+            }
+
+            // 排序:符合支付条件的优先,其次优惠力度大的优先
+            if (amount != null) {
+                couponVos.sort((vo1, vo2) -> {
+                    // 判断是否符合支付条件(满足最低消费要求)
+                    boolean vo1CanUse = vo1.getMinimumSpendingAmount() == null
+                            || vo1.getMinimumSpendingAmount().compareTo(amount) <= 0;
+                    boolean vo2CanUse = vo2.getMinimumSpendingAmount() == null
+                            || vo2.getMinimumSpendingAmount().compareTo(amount) <= 0;
+
+                    // 第一优先级:符合支付条件的优先
+                    if (vo1CanUse && !vo2CanUse) {
+                        return -1; // vo1 排在前面
+                    }
+                    if (!vo1CanUse && vo2CanUse) {
+                        return 1; // vo2 排在前面
+                    }
+
+                    // 第二优先级:优惠力度大的优先(nominalValue 大的)
+                    BigDecimal nominalValue1 = vo1.getNominalValue() != null ? vo1.getNominalValue() : BigDecimal.ZERO;
+                    BigDecimal nominalValue2 = vo2.getNominalValue() != null ? vo2.getNominalValue() : BigDecimal.ZERO;
+                    return nominalValue2.compareTo(nominalValue1); // 降序排列
+                });
+            } else {
+                // 如果没有提供金额,只按优惠力度排序
+                couponVos.sort((vo1, vo2) -> {
+                    BigDecimal nominalValue1 = vo1.getNominalValue() != null ? vo1.getNominalValue() : BigDecimal.ZERO;
+                    BigDecimal nominalValue2 = vo2.getNominalValue() != null ? vo2.getNominalValue() : BigDecimal.ZERO;
+                    return nominalValue2.compareTo(nominalValue1); // 降序排列
+                });
+            }
+
+            log.info("查询用户拥有的优惠券成功, userId={}, count={}", userId, couponVos.size());
+            return R.data(couponVos);
+
+        } catch (Exception e) {
+            log.error("查询用户拥有的优惠券失败: {}", e.getMessage(), e);
+            return R.fail("查询用户拥有的优惠券失败: " + e.getMessage());
+        }
+    }
+
+    /**
+     * 将优惠券实体转换为VO
+     */
+    private LifeDiscountCouponVo convertToVo(LifeDiscountCoupon coupon, LifeDiscountCouponUser userCoupon) {
+        LifeDiscountCouponVo vo = new LifeDiscountCouponVo();
+        vo.setId(coupon.getId());
+        vo.setUserCouponId(userCoupon.getId());
+        vo.setStoreId(coupon.getStoreId());
+        vo.setUserId(String.valueOf(userCoupon.getUserId()));
+        vo.setCouponId(coupon.getId());
+        vo.setName(coupon.getName());
+        vo.setNominalValue(coupon.getNominalValue());
+        vo.setExpirationDate(coupon.getExpirationDate());
+        vo.setStartDate(coupon.getStartDate());
+        vo.setEndDate(coupon.getEndDate());
+        vo.setSingleQty(coupon.getSingleQty());
+        vo.setSupplementaryInstruction(coupon.getSupplementaryInstruction());
+        vo.setGetStatus(coupon.getGetStatus());
+        vo.setRestrictedQuantity(coupon.getRestrictedQuantity());
+        vo.setMinimumSpendingAmount(coupon.getMinimumSpendingAmount());
+        vo.setType(coupon.getType());
+        vo.setAttentionCanReceived(coupon.getAttentionCanReceived());
+        vo.setExpirationTime(userCoupon.getExpirationTime());
+        vo.setCreatedTime(coupon.getCreatedTime());
+        return vo;
+    }
 }

+ 37 - 17
alien-dining/src/main/java/shop/alien/dining/service/impl/DiningUserServiceImpl.java

@@ -2,6 +2,7 @@ package shop.alien.dining.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -13,6 +14,7 @@ import shop.alien.dining.dto.ChangePhoneDto;
 import shop.alien.dining.dto.UserProfileUpdateDto;
 import shop.alien.dining.feign.AlienStoreFeign;
 import shop.alien.dining.service.DiningUserService;
+import shop.alien.dining.util.TokenUtil;
 import shop.alien.dining.util.WeChatMiniProgramUtil;
 import shop.alien.dining.util.WeChatMiniProgramUtil.WeChatSessionInfo;
 import shop.alien.entity.result.R;
@@ -340,51 +342,69 @@ public class DiningUserServiceImpl implements DiningUserService {
             return null;
         }
 
-        // 2. 更新用户信息(只更新非空字段)
+        // 2. 获取当前用户ID(用于设置 updatedUserId)
+        Integer currentUserId = TokenUtil.getCurrentUserId();
+        if (currentUserId == null) {
+            currentUserId = dto.getUserId().intValue(); // 如果没有 token,使用被更新的用户ID
+        }
+
+        // 3. 使用 LambdaUpdateWrapper 只更新需要更新的字段,避免更新不应该更新的字段
+        LambdaUpdateWrapper<LifeUser> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.eq(LifeUser::getId, dto.getUserId().intValue());
+
+        // 只更新非空字段
         if (StringUtils.isNotBlank(dto.getNickName())) {
-            user.setUserName(dto.getNickName());
+            updateWrapper.set(LifeUser::getUserName, dto.getNickName());
         }
         if (StringUtils.isNotBlank(dto.getAvatarUrl())) {
-            user.setUserImage(dto.getAvatarUrl());
+            updateWrapper.set(LifeUser::getUserImage, dto.getAvatarUrl());
         }
         if (StringUtils.isNotBlank(dto.getGender())) {
-            user.setUserSex(dto.getGender());
+            updateWrapper.set(LifeUser::getUserSex, dto.getGender());
         }
         if (dto.getBirthday() != null) {
-            user.setUserBirthday(dto.getBirthday());
+            updateWrapper.set(LifeUser::getUserBirthday, dto.getBirthday());
         }
         if (StringUtils.isNotBlank(dto.getRealName())) {
-            user.setRealName(dto.getRealName());
+            updateWrapper.set(LifeUser::getRealName, dto.getRealName());
         }
         if (StringUtils.isNotBlank(dto.getProvince())) {
-            user.setProvince(dto.getProvince());
+            updateWrapper.set(LifeUser::getProvince, dto.getProvince());
         }
         if (StringUtils.isNotBlank(dto.getCity())) {
-            user.setCity(dto.getCity());
+            updateWrapper.set(LifeUser::getCity, dto.getCity());
         }
         if (StringUtils.isNotBlank(dto.getDistrict())) {
-            user.setDistrict(dto.getDistrict());
+            updateWrapper.set(LifeUser::getDistrict, dto.getDistrict());
         }
         if (StringUtils.isNotBlank(dto.getAddress())) {
-            user.setAddress(dto.getAddress());
+            updateWrapper.set(LifeUser::getAddress, dto.getAddress());
         }
         if (StringUtils.isNotBlank(dto.getJianjie())) {
-            user.setJianjie(dto.getJianjie());
+            updateWrapper.set(LifeUser::getJianjie, dto.getJianjie());
         }
 
-        // 3. 设置更新时间
-        user.setUpdatedTime(new Date());
+        // 设置更新时间和更新人ID
+        updateWrapper.set(LifeUser::getUpdatedTime, new Date());
+        updateWrapper.set(LifeUser::getUpdatedUserId, currentUserId);
 
         // 4. 执行更新
-        int result = lifeUserMapper.updateById(user);
+        int result = lifeUserMapper.update(null, updateWrapper);
         if (result != 1) {
             log.error("更新用户信息失败, userId={}", dto.getUserId());
             return null;
         }
-        log.info("用户信息更新成功, userId={}", dto.getUserId());
+        log.info("用户信息更新成功, userId={}, updatedUserId={}", dto.getUserId(), currentUserId);
 
-        // 5. 返回更新后的用户信息
-        return buildDiningUserVo(user);
+        // 5. 重新查询用户信息(因为使用 updateWrapper 后,user 对象不会自动更新)
+        LifeUser updatedUser = lifeUserMapper.selectById(dto.getUserId().intValue());
+        if (updatedUser == null) {
+            log.error("更新后查询用户信息失败, userId={}", dto.getUserId());
+            return null;
+        }
+
+        // 6. 返回更新后的用户信息
+        return buildDiningUserVo(updatedUser);
     }
 
     @Override

+ 34 - 0
alien-dining/src/main/java/shop/alien/dining/service/impl/StoreOrderServiceImpl.java

@@ -865,6 +865,40 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
     }
 
     @Override
+    public IPage<StoreOrder> getMyOrders(Page<StoreOrder> page, String type) {
+        log.info("查询我的订单, type={}", type);
+
+        // 获取当前用户ID
+        Integer userId = TokenUtil.getCurrentUserId();
+        if (userId == null) {
+            throw new RuntimeException("用户未登录");
+        }
+
+        LambdaQueryWrapper<StoreOrder> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(StoreOrder::getDeleteFlag, 0);
+        wrapper.eq(StoreOrder::getCreatedUserId, userId); // 查询当前用户创建的订单
+
+        // 根据类型过滤订单
+        if ("0".equals(type) || "unpaid".equalsIgnoreCase(type)) {
+            // 未支付订单:orderStatus=0 且 payStatus=0
+            wrapper.eq(StoreOrder::getOrderStatus, 0);
+            wrapper.eq(StoreOrder::getPayStatus, 0);
+            log.info("查询未支付订单, userId={}", userId);
+        } else if ("1".equals(type) || "history".equalsIgnoreCase(type)) {
+            // 历史订单:已支付或已完成的订单(orderStatus=1 或 3,payStatus=1)
+            wrapper.and(w -> w.and(w1 -> w1.eq(StoreOrder::getOrderStatus, 1).eq(StoreOrder::getPayStatus, 1))
+                    .or(w2 -> w2.eq(StoreOrder::getOrderStatus, 3).eq(StoreOrder::getPayStatus, 1)));
+            log.info("查询历史订单, userId={}", userId);
+        } else {
+            // 如果类型不明确,返回所有订单
+            log.warn("订单类型不明确, type={}, 返回所有订单", type);
+        }
+
+        wrapper.orderByDesc(StoreOrder::getCreatedTime);
+        return this.page(page, wrapper);
+    }
+
+    @Override
     public OrderInfoVO getOrderInfo(Integer orderId) {
         log.info("查询订单信息, orderId={}", orderId);
         

+ 58 - 15
alien-entity/src/main/java/shop/alien/entity/store/LifeUser.java

@@ -3,77 +3,92 @@ package shop.alien.entity.store;
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
- * 用户
+ * 用户表
+ *
+ * @author system
+ * @since 2025-01-XX
  */
 @Data
 @JsonInclude
 @TableName("life_user")
+@ApiModel(value = "LifeUser对象", description = "用户表")
 public class LifeUser implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    @ApiModelProperty(value = "主键")
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
+    @ApiModelProperty(value = "用户姓名")
     @TableField("user_name")
     private String userName;
 
-    @TableField("real_name")
-    private String realName;
-
+    @ApiModelProperty(value = "用户性别")
     @TableField("user_sex")
     private String userSex;
 
+    @ApiModelProperty(value = "用户生日")
     @TableField(value = "user_brithday")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date userBirthday;
 
+    @ApiModelProperty(value = "官方号码")
     @TableField("guanfang_phone")
     private String guanfangPhone;
 
+    @ApiModelProperty(value = "用户手机号")
     @TableField("user_phone")
     private String userPhone;
 
-    @TableField("id_card")
-    private String idCard;
-
+    @ApiModelProperty(value = "用户头像照片")
     @TableField("user_image")
     private String userImage;
 
+    @ApiModelProperty(value = "消费时间")
     @TableField("xiaofei_time")
     private Integer xiaofeiTime;
 
+    @ApiModelProperty(value = "消费金额")
     @TableField("xiaofei_amount")
-    private double xiaofeiAmount;
+    private BigDecimal xiaofeiAmount;
 
+    @ApiModelProperty(value = "差评时间")
     @TableField(value = "chaping_time")
     private Integer chapingTime;
 
+    @ApiModelProperty(value = "真实姓名")
+    @TableField("real_name")
+    private String realName;
+
+    @ApiModelProperty(value = "省")
     @TableField(value = "province")
     private String province;
 
+    @ApiModelProperty(value = "市")
     @TableField(value = "city")
     private String city;
 
+    @ApiModelProperty(value = "区")
     @TableField(value = "district")
     private String district;
 
+    @ApiModelProperty(value = "地址")
     @TableField(value = "address")
     private String address;
 
+    @ApiModelProperty(value = "个人简介")
     @TableField(value = "jianjie")
     private String jianjie;
 
-    @ApiModelProperty(value = "邀请码")
-    @TableField("invited_num")
-    private String invitedNum;
-
     @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
     @TableField("delete_flag")
     @TableLogic
@@ -89,7 +104,7 @@ public class LifeUser implements Serializable {
     private Integer createdUserId;
 
     @ApiModelProperty(value = "修改时间")
-    @TableField(value = "updated_time", fill = FieldFill.UPDATE)
+    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date updatedTime;
 
@@ -97,6 +112,14 @@ public class LifeUser implements Serializable {
     @TableField("updated_user_id")
     private Integer updatedUserId;
 
+    @ApiModelProperty(value = "身份证")
+    @TableField("id_card")
+    private String idCard;
+
+    @ApiModelProperty(value = "邀请码")
+    @TableField("invited_num")
+    private String invitedNum;
+
     @ApiModelProperty(value = "注销标记, 0:未注销, 1:已注销")
     @TableField("logout_flag")
     private Integer logoutFlag;
@@ -106,7 +129,7 @@ public class LifeUser implements Serializable {
     private String logoutReason;
 
     @ApiModelProperty(value = "注销申请时间")
-    @TableField(value = "logout_time", fill = FieldFill.INSERT)
+    @TableField(value = "logout_time")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date logoutTime;
 
@@ -114,7 +137,11 @@ public class LifeUser implements Serializable {
     @TableField("clock_img_id")
     private Integer clockImgId;
 
-    @ApiModelProperty(value = "个人邀请码")
+    @ApiModelProperty(value = "是否同步")
+    @TableField("is_sync")
+    private Integer isSync;
+
+    @ApiModelProperty(value = "邀请码")
     @TableField("invite_code")
     private String inviteCode;
 
@@ -122,6 +149,22 @@ public class LifeUser implements Serializable {
     @TableField("bind_invite_code")
     private String bindInviteCode;
 
+    @ApiModelProperty(value = "用户积分")
+    @TableField("user_point")
+    private Integer userPoint;
+
+    @ApiModelProperty(value = "支付宝账户")
+    @TableField("alipay_account")
+    private String alipayAccount;
+
+    @ApiModelProperty(value = "账户余额")
+    @TableField("money")
+    private BigDecimal money;
+
+    @ApiModelProperty(value = "支付密码")
+    @TableField("pay_password")
+    private String payPassword;
+
     @ApiModelProperty(value = "是否被封禁(0-否  1-是)")
     @TableField("is_banned")
     private Integer isBanned;