订单列表

This commit is contained in:
haown 2025-08-11 10:22:03 +08:00
parent 6f71c6abb6
commit 91dab3510d
13 changed files with 181 additions and 65 deletions

View File

@ -1,7 +1,9 @@
package com.yf.exam.modules.exam.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yf.exam.core.api.ApiRest;
import com.yf.exam.core.api.controller.BaseController;
import com.yf.exam.core.api.dto.PagingReqDTO;
import com.yf.exam.modules.exam.dto.ExamRegistrationDTO;
import com.yf.exam.modules.exam.dto.response.ExamRegistrationVO;
import com.yf.exam.modules.exam.service.ExamRegistrationService;
@ -50,4 +52,16 @@ public class ExamRegistrationController extends BaseController {
List<ExamRegistrationVO> list = baseService.getRegExamList(examRegistrationDTO);
return super.success(list);
}
/**
* 分页查询考生列表
* @return
*/
@ApiOperation(value = "分页查询考生列表")
@RequestMapping(value = "/getRegUserList", method = {RequestMethod.POST})
public ApiRest<IPage<ExamRegistrationVO>> getRegUserList(@RequestBody PagingReqDTO<ExamRegistrationDTO> reqDTO) {
//分页查询并转换
IPage<ExamRegistrationVO> page = baseService.getRegUserList(reqDTO);
return super.success(page);
}
}

View File

@ -100,6 +100,12 @@ public class ExamDTO implements Serializable {
@ApiModelProperty(value = "考试费用", required=true)
private BigDecimal examFee;
/**
* 模拟考试有效期
*/
@ApiModelProperty(value = "模拟考试有效期", required=true)
private BigDecimal expirationDate;
/**
* 是否结束

View File

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -81,4 +82,28 @@ public class ExamRegistrationDTO extends UserAttachment implements Serializable
*/
@ApiModelProperty(value = "考试状态0未考试1已考试", required=true)
private Integer finishState;
/**
* 交费状态0未交费1已交费
*/
@ApiModelProperty(value = "交费状态0未交费1已交费", required=true)
private Integer paymentState;
/**
* 考试类型1模拟考试2正式考试3补考
* */
@ApiModelProperty(value = "考试类型1模拟考试2正式考试3补考", required=true)
private Integer examType;
/**
* 交费开始时间
* */
@ApiModelProperty(value = "交费开始时间", required=true)
private Date paymentStartDate;
/**
* 交费结束时间
* */
@ApiModelProperty(value = "交费结束时间", required=true)
private Date paymentEndDate;
}

View File

@ -1,19 +0,0 @@
package com.yf.exam.modules.exam.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description: 查询考试报名传输对象
* @author: haown
* @create: 2025-07-14 14:53
**/
@Data
public class ExamRegistrationDTO {
@ApiModelProperty(value = "用户主键", required=true)
private String userId;
@ApiModelProperty(value = "考试表主键", required=true)
private String examId;
}

View File

@ -21,6 +21,24 @@ public class ExamRegistrationVO {
*/
@ApiModelProperty(value = "用户主键", required=true)
private String userId;
/**
* 用户名考生账号的用户名是身份证号
*/
@ApiModelProperty(value = "用户名(考生账号的用户名是身份证号)", required=true)
private String userName;
/**
* 真实姓名
*/
@ApiModelProperty(value = "姓名", required=true)
private String realName;
/**
* 手机号
*/
@ApiModelProperty(value = "手机号", required=true)
private String phone;
/**
* 报名时间
*/
@ -35,6 +53,12 @@ public class ExamRegistrationVO {
@ApiModelProperty(value = "考试状态0未考试1已考试", required=true)
private Integer finishState;
/**
* 交费状态0未交费1已交费
*/
@ApiModelProperty(value = "交费状态0未交费1已交费", required=true)
private Integer paymentState;
@ApiModelProperty(value = "考试主键", required=true)
private String examId;

View File

@ -122,5 +122,11 @@ public class Exam extends Model<Exam> {
*/
@TableField("exam_fee")
private BigDecimal examFee;
/**
* 模拟考试有效期
*/
@TableField("expiration_date")
private BigDecimal expirationDate;
}

View File

@ -75,6 +75,16 @@ public class ExamRegistration extends UserAttachment {
*/
private Integer finishState;
/**
* 交费状态0未交费1已交费
*/
private Integer paymentState;
/**
* 交费时间
*/
private Date paymentDate;
/**
* 创建时间
*/

View File

@ -1,10 +1,13 @@
package com.yf.exam.modules.exam.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yf.exam.modules.exam.dto.ExamRegistrationDTO;
import com.yf.exam.modules.exam.dto.response.ExamRegistrationVO;
import com.yf.exam.modules.exam.entity.ExamRegistration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
/**
* <p>
@ -19,4 +22,6 @@ public interface ExamRegistrationMapper extends BaseMapper<ExamRegistration> {
List<ExamRegistrationVO> getRegExamList(ExamRegistrationDTO examRegistrationDTO);
void updateFinishState(ExamRegistration examRegistration);
IPage<ExamRegistrationVO> getRegUserList(Page page, @Param("query") ExamRegistrationDTO examRegistrationDTO);
}

View File

@ -1,6 +1,8 @@
package com.yf.exam.modules.exam.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yf.exam.core.api.dto.PagingReqDTO;
import com.yf.exam.modules.exam.dto.ExamRegistrationDTO;
import com.yf.exam.modules.exam.dto.response.ExamRegistrationVO;
import com.yf.exam.modules.exam.entity.ExamRegistration;
@ -32,4 +34,14 @@ public interface ExamRegistrationService extends IService<ExamRegistration> {
List<ExamRegistrationVO> getRegExamList(ExamRegistrationDTO examRegistrationDTO);
void updateFinishState(ExamRegistration examRegistration);
/**
* @description 查询考生列表
* @Param
* @return null
* @Author haown
* @Date 2025-7-30 10:32
*/
IPage<ExamRegistrationVO> getRegUserList(PagingReqDTO<ExamRegistrationDTO> examRegistrationDTO);
}

View File

@ -1,8 +1,11 @@
package com.yf.exam.modules.exam.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yf.exam.core.api.dto.PagingReqDTO;
import com.yf.exam.core.exception.ServiceException;
import com.yf.exam.modules.exam.dto.ExamRegistrationDTO;
import com.yf.exam.modules.exam.dto.response.ExamRegistrationVO;
@ -64,4 +67,14 @@ public class ExamRegistrationServiceImpl extends ServiceImpl<ExamRegistrationMap
@Override public void updateFinishState(ExamRegistration examRegistration) {
baseMapper.updateFinishState(examRegistration);
}
@Override public IPage<ExamRegistrationVO> getRegUserList(PagingReqDTO<ExamRegistrationDTO> reqDTO) {
// 创建分页对象
Page page = new Page(reqDTO.getCurrent(), reqDTO.getSize());
// 查找分页
IPage<ExamRegistrationVO> pageData = baseMapper.getRegUserList(page, reqDTO.getParams());
return pageData;
}
}

View File

@ -1,28 +1,11 @@
package com.yf.exam.modules.payment.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.yf.exam.config.WeChatPaymentUrlConfig;
import com.yf.exam.config.XylWeChatPaymentConfig;
import com.yf.exam.core.exception.ServiceException;
import com.yf.exam.modules.payment.service.PaymentService;
import com.yf.exam.modules.payment.vo.WeChatAppletSignVO;
import com.yf.exam.modules.utils.WeChatUtil;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.Signature;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Resource;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
import org.springframework.util.Base64Utils;
/**
* @description:
@ -70,7 +53,7 @@ public class PaymentServiceImpl implements PaymentService {
* @return 结果
* @throws Exception 异常信息
*/
private String requestH5Interface(String jsApiParams, PaymentDTO paymentDTO, String prepayId) throws Exception {
/*private String requestH5Interface(String jsApiParams, PaymentDTO paymentDTO, String prepayId) throws Exception {
//log.info("JsApi请求下单参数 ====> {}", jsApiParams);
StringEntity stringEntity = new StringEntity(jsApiParams, StandardCharsets.UTF_8);
stringEntity.setContentType("application/json");
@ -113,7 +96,7 @@ public class PaymentServiceImpl implements PaymentService {
}
}
return prepayId;
}
}*/
/**
* 构建微信小程序调起支付参数设置
@ -123,30 +106,30 @@ public class PaymentServiceImpl implements PaymentService {
* @return 参数信息
* @throws Exception 异常信息
*/
private WeChatAppletSignVO getSignInfo(String prepayId, String buySource) throws Exception {
//根据购买来源判断使用泉医到家小程序id还是泉医助手小程序id
String appId = BuySourceEnum.TRAINING.getInfo().equals(buySource) ? nurseAppletChatConfig.getAppletId() : appletChatConfig.getAppletId();
//随机字符串
String nonceStr = UUID.randomUUID().toString().replace("-", "");
//时间戳
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
//获取商户私钥
PrivateKey privateKey = null;
privateKey = weChatUtil.getPrivateKey(xylWeChatPaymentConfig.getXylPrivateKeyPath());
if (privateKey == null) {
throw new ServiceException("获取商户私钥失败,请联系管理员!");
}
//计算签名信息
prepayId = "prepay_id=" + prepayId;
String signatureStr = Stream.of(appId, timestamp, nonceStr, prepayId)
.collect(Collectors.joining("\n", "", "\n"));
log.info("计算签名认证信息 =====> {}", signatureStr);
Signature sign = Signature.getInstance(SIGNATURE_ALGORITHM);
sign.initSign(privateKey);
sign.update(signatureStr.getBytes(StandardCharsets.UTF_8));
String paySign = Base64Utils.encodeToString(sign.sign());
return WeChatAppletSignVO.builder().appId(appId).timeStamp(timestamp).nonceStr(nonceStr).prepayId(prepayId)
.signType(SIGN_TYPE).paySign(paySign).build();
}
//private WeChatAppletSignVO getSignInfo(String prepayId, String buySource) throws Exception {
// //根据购买来源判断使用泉医到家小程序id还是泉医助手小程序id
// String appId = BuySourceEnum.TRAINING.getInfo().equals(buySource) ? nurseAppletChatConfig.getAppletId() : appletChatConfig.getAppletId();
// //随机字符串
// String nonceStr = UUID.randomUUID().toString().replace("-", "");
// //时间戳
// String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
// //获取商户私钥
// PrivateKey privateKey = null;
// privateKey = weChatUtil.getPrivateKey(xylWeChatPaymentConfig.getXylPrivateKeyPath());
// if (privateKey == null) {
// throw new ServiceException("获取商户私钥失败,请联系管理员!");
// }
// //计算签名信息
// prepayId = "prepay_id=" + prepayId;
// String signatureStr = Stream.of(appId, timestamp, nonceStr, prepayId)
// .collect(Collectors.joining("\n", "", "\n"));
// log.info("计算签名认证信息 =====> {}", signatureStr);
// Signature sign = Signature.getInstance(SIGNATURE_ALGORITHM);
// sign.initSign(privateKey);
// sign.update(signatureStr.getBytes(StandardCharsets.UTF_8));
// String paySign = Base64Utils.encodeToString(sign.sign());
// return WeChatAppletSignVO.builder().appId(appId).timeStamp(timestamp).nonceStr(nonceStr).prepayId(prepayId)
// .signType(SIGN_TYPE).paySign(paySign).build();
//}
}

View File

@ -19,6 +19,8 @@
<result column="total_score" property="totalScore" />
<result column="total_time" property="totalTime" />
<result column="qualify_score" property="qualifyScore" />
<result column="exam_fee" property="examFee" />
<result column="expiration_date" property="expirationDate" />
</resultMap>
<!-- 通用查询结果列 -->

View File

@ -29,6 +29,8 @@
<result column="sign_picture" property="signPicture" />
<result column="reg_time" property="regTime" />
<result column="finish_state" property="finishState" />
<result column="payment_state" property="paymentState" />
<result column="payment_date" property="paymentDate" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
@ -37,12 +39,12 @@
<sql id="Base_Column_List">
id,user_id,user_name,real_name,phone,exam_id,title,email,address,education,graduate_school,major,reg_type,
train_institution,train_start_date,train_end_date,card_front,card_back,card_copy,photo,certificate,physical_report,sign_picture,
reg_time,finish_state,create_time,update_time
reg_time,finish_state,payment_state,create_time,update_time
</sql>
<select id="getRegExamList" resultType="com.yf.exam.modules.exam.dto.response.ExamRegistrationVO">
SELECT reg.user_id as userId, reg.reg_time, reg.finish_state, ex.id as examId, ex.title, ex.content
SELECT reg.user_id as userId, reg.reg_time, reg.payment_state, reg.finish_state, ex.id as examId, ex.title, ex.content
, ex.exam_type, ex.start_date, ex.end_date, ex.start_time, ex.end_time
,ex.total_score, ex.total_time, ex.qualify_score, ex.exam_fee
FROM el_exam_registration reg
@ -54,6 +56,12 @@
<if test="finishState!=null">
AND reg.finish_state=#{finishState}
</if>
<if test="paymentState!=null">
AND reg.payment_state=#{paymentState}
</if>
<if test="examType!=null">
AND ex.exam_type=#{examType}
</if>
<if test="examId!=null">
AND reg.exam_id=#{examId}
</if>
@ -70,4 +78,31 @@
where user_id = #{userId} and exam_id = #{examId}
</update>
<select id="getRegUserList" resultType="com.yf.exam.modules.exam.dto.response.ExamRegistrationVO">
SELECT reg.user_id as userId, reg.user_name, reg.real_name, reg.phone, reg.payment_state, ex.id as examId, ex.title, ex.content
, ex.exam_type, ex.start_date, ex.end_date, ex.start_time, ex.end_time
,ex.total_score, ex.total_time, ex.qualify_score, ex.exam_fee
FROM el_exam_registration reg
left join el_exam ex on reg.exam_id = ex.id
WHERE ex.state=0
<if test="query!=null">
<if test="query.title!=null and query.title!=''">
AND ex.title LIKE CONCAT('%',#{query.title},'%')
</if>
<if test="query.userId!=null">
AND reg.user_id=#{query.userId}
</if>
<if test="query.examType!=null">
AND ex.exam_type=#{query.examType}
</if>
<if test="query.paymentStartDate!=null">
AND reg.payment_date &lt;= #{query.paymentStartDate}
</if>
<if test="query.paymentEndDate!=null">
AND reg.payment_date >= #{query.paymentEndDate}
</if>
</if>
order by reg.reg_time desc
</select>
</mapper>