Browse Source

Merge remote-tracking branch 'origin/master'

SheepHy 23 giờ trước cách đây
mục cha
commit
8128ff963a

+ 16 - 13
src/main/java/com/zsElectric/boot/business/controller/applet/AppletOrderController.java

@@ -1,28 +1,24 @@
 package com.zsElectric.boot.business.controller.applet;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.zsElectric.boot.business.model.entity.RechargeLevel;
-import com.zsElectric.boot.business.model.form.applet.LevelOrderForm;
-import com.zsElectric.boot.business.model.form.applet.UserPayForm;
+import com.zsElectric.boot.business.model.form.applet.AppLevelOrderForm;
+import com.zsElectric.boot.business.model.form.applet.AppUserPayForm;
+import com.zsElectric.boot.business.model.query.applet.AppUserOrderInfoQuery;
+import com.zsElectric.boot.business.model.vo.UserOrderInfoVO;
 import com.zsElectric.boot.business.service.RechargeLevelService;
 import com.zsElectric.boot.business.service.UserOrderInfoService;
-import com.zsElectric.boot.common.annotation.RepeatSubmit;
 import com.zsElectric.boot.common.constant.SystemConstants;
-import com.zsElectric.boot.core.pay.WechatCallbackRefundData;
-import com.zsElectric.boot.core.pay.WechatRefundCallback;
 import com.zsElectric.boot.core.web.Result;
 import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import java.io.IOException;
-import java.text.ParseException;
 import java.util.List;
 import java.util.Map;
 
@@ -48,16 +44,23 @@ public class AppletOrderController {
         return Result.success(list);
     }
 
+    @Operation(summary = "购券记录(券订单记录)")
+    @GetMapping("/getTicketRecords")
+    public Result<IPage<UserOrderInfoVO>> getTicketRecords(@RequestBody AppUserOrderInfoQuery queryParams) {
+        IPage<UserOrderInfoVO> page = userOrderInfoService.getTicketRecords(queryParams);
+        return Result.success(page);
+    }
+
     /**
      * 创建订单
      *
-     * @param levelOrderForm
+     * @param appLevelOrderForm
      * @return
      */
     @Operation(summary = "创建订单")
     @PostMapping("/createOrder")
-    public Result<UserPayForm> createOrder(@RequestBody LevelOrderForm levelOrderForm) {
-        UserPayForm payForm = userOrderInfoService.createOrder(levelOrderForm);
+    public Result<AppUserPayForm> createOrder(@RequestBody AppLevelOrderForm appLevelOrderForm) {
+        AppUserPayForm payForm = userOrderInfoService.createOrder(appLevelOrderForm);
         return Result.success(payForm);
     }
 
@@ -69,7 +72,7 @@ public class AppletOrderController {
      */
     @Operation(summary = "订单-支付")
     @PutMapping("/payOrder/{orderId}")
-    public Result<UserPayForm> payOrder(@PathVariable("orderId") String orderId) {
+    public Result<AppUserPayForm> payOrder(@PathVariable("orderId") String orderId) {
         return Result.success(userOrderInfoService.payOrder(orderId));
     }
 

+ 32 - 4
src/main/java/com/zsElectric/boot/business/controller/applet/AppletUserController.java

@@ -1,15 +1,22 @@
 package com.zsElectric.boot.business.controller.applet;
 
-import com.zsElectric.boot.business.model.vo.UserInfoVO;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.zsElectric.boot.business.model.entity.UserFeedback;
+import com.zsElectric.boot.business.model.form.UserFeedbackForm;
+import com.zsElectric.boot.business.model.form.applet.AppFeedbackForm;
+import com.zsElectric.boot.business.model.query.applet.AppUserOrderInfoQuery;
 import com.zsElectric.boot.business.model.vo.applet.AppletUserInfoVO;
+import com.zsElectric.boot.business.service.UserFeedbackService;
 import com.zsElectric.boot.business.service.UserInfoService;
 import com.zsElectric.boot.core.web.Result;
+import com.zsElectric.boot.security.util.SecurityUtils;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
 import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 @Tag(name = "用户相关接口")
 @RestController
@@ -19,10 +26,31 @@ public class AppletUserController {
 
     private final UserInfoService userInfoService;
 
+    private final UserFeedbackService userFeedbackService;
+
     @Operation(summary = "微信小程序获取当前登录信息")
     @GetMapping("/getUserInfo")
     public Result<AppletUserInfoVO> getUserInfo() {
         AppletUserInfoVO userInfoVO = userInfoService.getAppletUserInfo();
         return Result.success(userInfoVO);
     }
+
+    @Operation(summary = "小程序用户反馈")
+    @PostMapping("/addUserFeedback")
+    public Result<Void> addUserFeedback(@RequestBody @Valid AppFeedbackForm formData ) {
+        UserFeedbackForm userFeedbackForm = new UserFeedbackForm();
+        userFeedbackForm.setType(formData.getType());
+        userFeedbackForm.setDescription(formData.getDescription());
+        userFeedbackForm.setImages(formData.getImages());
+        userFeedbackForm.setContactWay(formData.getContactWay());
+        boolean result = userFeedbackService.saveUserFeedback(userFeedbackForm);
+        return Result.judge(result);
+    }
+
+    @Operation(summary = "用户反馈答复")
+    @GetMapping("/myFeedback")
+    public Result<List<UserFeedback>> addUserFeedback() {
+        List<UserFeedback> list = userFeedbackService.list(Wrappers.<UserFeedback>lambdaQuery().eq(UserFeedback::getUserId, SecurityUtils.getUserId()));
+        return Result.success(list);
+    }
 }

+ 39 - 0
src/main/java/com/zsElectric/boot/business/model/form/applet/AppFeedbackForm.java

@@ -0,0 +1,39 @@
+package com.zsElectric.boot.business.model.form.applet;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.Size;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 用户反馈表单对象
+ *
+ * @author wzq
+ * @since 2025-11-26 15:37
+ */
+@Getter
+@Setter
+@Schema(description = "用户反馈表单对象")
+public class AppFeedbackForm implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    @Schema(description = "问题类型(1投诉吐槽,2功能异常,3体验问题,4功能建议,9其他 )")
+    private Integer type;
+
+    @Schema(description = "问题描述")
+    @Size(max=500, message="问题描述长度不能超过500个字符")
+    private String description;
+
+    @Schema(description = "相关图片地址")
+    @Size(max=600, message="相关图片地址长度不能超过600个字符")
+    private String images;
+
+    @Schema(description = "联系方式(手机号或者邮箱)")
+    @Size(max=255, message="联系方式(手机号或者邮箱)长度不能超过255个字符")
+    private String contactWay;
+}

+ 1 - 1
src/main/java/com/zsElectric/boot/business/model/form/applet/LevelOrderForm.java → src/main/java/com/zsElectric/boot/business/model/form/applet/AppLevelOrderForm.java

@@ -11,7 +11,7 @@ import java.io.Serializable;
 @Getter
 @Setter
 @Schema(description = "档位下单表单对象")
-public class LevelOrderForm implements Serializable {
+public class AppLevelOrderForm implements Serializable {
 
     @Serial
     private static final long serialVersionUID = 1L;

+ 1 - 1
src/main/java/com/zsElectric/boot/business/model/form/applet/UserPayForm.java → src/main/java/com/zsElectric/boot/business/model/form/applet/AppUserPayForm.java

@@ -12,7 +12,7 @@ import java.util.Map;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
 @Schema(description = "支付表单对象")
-public class UserPayForm implements Serializable {
+public class AppUserPayForm implements Serializable {
 
     private static final long serialVersionUID = 1L;
 

+ 3 - 0
src/main/java/com/zsElectric/boot/business/model/query/UserOrderInfoQuery.java

@@ -18,4 +18,7 @@ import java.math.BigDecimal;
 @Setter
 public class UserOrderInfoQuery extends BasePageQuery {
 
+    @Schema(description = "用户ID")
+    private Long userId;
+
 }

+ 19 - 0
src/main/java/com/zsElectric/boot/business/model/query/applet/AppUserOrderInfoQuery.java

@@ -0,0 +1,19 @@
+package com.zsElectric.boot.business.model.query.applet;
+
+import com.zsElectric.boot.common.base.BasePageQuery;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 用户支付订单信息分页查询对象
+ *
+ * @author zsElectric
+ * @since 2025-12-16 16:25
+ */
+@Schema(description = "用户支付订单信息查询对象")
+@Getter
+@Setter
+public class AppUserOrderInfoQuery extends BasePageQuery {
+
+}

+ 7 - 4
src/main/java/com/zsElectric/boot/business/service/UserOrderInfoService.java

@@ -2,9 +2,10 @@ package com.zsElectric.boot.business.service;
 
 import com.zsElectric.boot.business.model.entity.UserOrderInfo;
 import com.zsElectric.boot.business.model.form.UserOrderInfoForm;
-import com.zsElectric.boot.business.model.form.applet.LevelOrderForm;
-import com.zsElectric.boot.business.model.form.applet.UserPayForm;
+import com.zsElectric.boot.business.model.form.applet.AppLevelOrderForm;
+import com.zsElectric.boot.business.model.form.applet.AppUserPayForm;
 import com.zsElectric.boot.business.model.query.UserOrderInfoQuery;
+import com.zsElectric.boot.business.model.query.applet.AppUserOrderInfoQuery;
 import com.zsElectric.boot.business.model.vo.UserOrderInfoVO;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -61,9 +62,9 @@ public interface UserOrderInfoService extends IService<UserOrderInfo> {
      */
     boolean deleteUserOrderInfos(String ids);
 
-    UserPayForm createOrder(LevelOrderForm levelOrderForm);
+    AppUserPayForm createOrder(AppLevelOrderForm appLevelOrderForm);
 
-    UserPayForm payOrder(String orderId);
+    AppUserPayForm payOrder(String orderId);
 
     String orderQuery(String orderNo) throws Exception;
 
@@ -74,4 +75,6 @@ public interface UserOrderInfoService extends IService<UserOrderInfo> {
     String refundOrder() throws Exception;
 
     Map<String, Object> refundCallback(HttpServletRequest request, HttpServletResponse response);
+
+    IPage<UserOrderInfoVO> getTicketRecords(AppUserOrderInfoQuery queryParams);
 }

+ 1 - 1
src/main/java/com/zsElectric/boot/business/service/impl/UserInfoServiceImpl.java

@@ -162,7 +162,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
         }
 
         // 查询用户是否已存在
-        UserInfo existingUser = getUserInfoByOpenid(phone);
+        UserInfo existingUser = getUserInfoByOpenid(openId);
 
         if (existingUser != null) {
             log.info("用户已存在,ID: {}, 手机号: {},openid: {}", existingUser.getId(), phone,openId);

+ 24 - 16
src/main/java/com/zsElectric/boot/business/service/impl/UserOrderInfoServiceImpl.java

@@ -1,10 +1,7 @@
 package com.zsElectric.boot.business.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.json.JSON;
 import com.aliyun.oss.ServiceException;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.google.gson.Gson;
@@ -12,9 +9,9 @@ import com.google.gson.JsonObject;
 import com.zsElectric.boot.business.UserRefundsOrderInfo;
 import com.zsElectric.boot.business.mapper.*;
 import com.zsElectric.boot.business.model.entity.*;
-import com.zsElectric.boot.business.model.form.applet.LevelOrderForm;
-import com.zsElectric.boot.business.model.form.applet.UserPayForm;
-import com.zsElectric.boot.business.model.vo.UserInfoVO;
+import com.zsElectric.boot.business.model.form.applet.AppLevelOrderForm;
+import com.zsElectric.boot.business.model.form.applet.AppUserPayForm;
+import com.zsElectric.boot.business.model.query.applet.AppUserOrderInfoQuery;
 import com.zsElectric.boot.business.service.*;
 import com.zsElectric.boot.common.constant.SystemConstants;
 import com.zsElectric.boot.core.exception.BusinessException;
@@ -24,7 +21,6 @@ import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import netscape.javascript.JSObject;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
@@ -42,9 +38,7 @@ import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.util.*;
-import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.locks.ReentrantLock;
-import java.util.stream.Collectors;
 
 import cn.hutool.core.lang.Assert;
 import cn.hutool.core.util.StrUtil;
@@ -148,14 +142,28 @@ public class UserOrderInfoServiceImpl extends ServiceImpl<UserOrderInfoMapper, U
         return this.removeByIds(idList);
     }
 
+
+    @Override
+    public IPage<UserOrderInfoVO> getTicketRecords(AppUserOrderInfoQuery queryParams) {
+
+        UserOrderInfoQuery userOrderInfoQuery = new UserOrderInfoQuery();
+        userOrderInfoQuery.setUserId(SecurityUtils.getUserId());
+
+        Page<UserOrderInfoVO> pageVO = this.baseMapper.getUserOrderInfoPage(
+                new Page<>(queryParams.getPageNum(), queryParams.getPageSize()),
+                userOrderInfoQuery
+        );
+        return pageVO;
+    }
+
     /**
      * 创建订单
      *
-     * @param levelOrderForm
+     * @param appLevelOrderForm
      * @return
      */
     @Override
-    public UserPayForm createOrder(LevelOrderForm levelOrderForm) {
+    public AppUserPayForm createOrder(AppLevelOrderForm appLevelOrderForm) {
         Long userId = SecurityUtils.getUserId();
         String userOpenId = userInfoMapper.getAppletUserInfo(userId).getOpenid();
         String orderNo = createOrderNo("SP", userId);
@@ -163,17 +171,17 @@ public class UserOrderInfoServiceImpl extends ServiceImpl<UserOrderInfoMapper, U
         UserOrderInfo orderInfo = new UserOrderInfo();
         orderInfo.setUserId(userId);
         orderInfo.setOrderNo(orderNo);
-        orderInfo.setLevelId(levelOrderForm.getLevelId());
+        orderInfo.setLevelId(appLevelOrderForm.getLevelId());
         orderInfo.setOpenid(userOpenId);
 
         this.save(orderInfo);
 
         //构建支付表单返回给前端支撑JsApi支付调用
-        UserPayForm payForm = new UserPayForm();
+        AppUserPayForm payForm = new AppUserPayForm();
         payForm.setOrderId(orderInfo.getId()).setOrderNo(orderNo);
 
         //查询档位
-        RechargeLevel level = rechargeLevelMapper.selectById(levelOrderForm.getLevelId());
+        RechargeLevel level = rechargeLevelMapper.selectById(appLevelOrderForm.getLevelId());
 
         Map<String, Object> result = payment(userOpenId, orderNo, level.getMoney());
         payForm.setParams(result);
@@ -187,10 +195,10 @@ public class UserOrderInfoServiceImpl extends ServiceImpl<UserOrderInfoMapper, U
      * @return
      */
     @Override
-    public UserPayForm payOrder(String orderId) {
+    public AppUserPayForm payOrder(String orderId) {
         UserOrderInfo orderInfo = this.getById(orderId);
         //构建支付表单
-        UserPayForm payForm = new UserPayForm();
+        AppUserPayForm payForm = new AppUserPayForm();
         payForm.setOrderId(orderInfo.getId()).setOrderNo(orderInfo.getOrderNo());
 
         //查询档位

+ 1 - 1
src/main/resources/mapper/business/UserInfoMapper.xml

@@ -9,7 +9,7 @@
                 ec_id,
                 nick_name,
                 phone,
-                wechat,
+                openid,
                 integral_num,
                 group_id,
                 create_time,

+ 5 - 1
src/main/resources/mapper/business/UserOrderInfoMapper.xml

@@ -25,8 +25,12 @@
         is_deleted
         FROM
         c_user_order_info
-        <where>
+        <where> is_deleted = 0
+        <if test="queryParams.userId != null">
+            AND user_id = #{queryParams.userId}
+        </if>
         </where>
+        ORDER BY create_time DESC
     </select>
 
 </mapper>