exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayStudent.java
@@ -31,6 +31,7 @@ @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 缴费id */ @@ -78,12 +79,24 @@ /** * 是否缴款0否1是 */ @ApiModelProperty("是否缴款") @ApiModelProperty("是否缴款0否1是") private Long payStatus; @ApiModelProperty("缴费类型1个人 2团体") private Long payType; @ApiModelProperty("订单编号") private String orderNo; @ApiModelProperty("财政订单编号") private String orderId; @ApiModelProperty("财政缴款凭证") private String fileData; @ApiModelProperty("财政缴费状态0未缴费1缴费中2完成缴费") private Long govPayStatus; /** * 删除标志(0代表存在2代表删除) */ @@ -187,4 +200,37 @@ public void setPayType(Long payType) { this.payType = payType; } public String getOrderNo() { return orderNo; } public void setOrderNo(String orderNo) { this.orderNo = orderNo; } public String getOrderId() { return orderId; } public void setOrderId(String orderId) { this.orderId = orderId; } public String getFileData() { return fileData; } public void setFileData(String fileData) { this.fileData = fileData; } public Long getGovPayStatus() { return govPayStatus; } public void setGovPayStatus(Long govPayStatus) { this.govPayStatus = govPayStatus; } } exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java
@@ -12,6 +12,7 @@ import com.gkhy.exam.pay.mapper.NonCoalPayStudentMapper; import com.gkhy.exam.pay.service.NonCoalPayStudentService; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.RandomUtil; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import org.springframework.stereotype.Service; @@ -71,6 +72,8 @@ checkSameData(nonCoalPayStudent); NonCoalPay nonCoalPay = checkNonCoalPay(nonCoalPayStudent.getNonCoalPayId()); nonCoalPayStudent.setPayType(nonCoalPay.getPayPersonType().longValue()); nonCoalPayStudent.setOrderNo(RandomUtil.generateOrderNumber()); nonCoalPayStudent.setGovPayStatus(0L); nonCoalPayStudent.setCreateBy(SecurityUtils.getUsername()); return nonCoalPayStudentMapper.insertNonCoalPayStudent(nonCoalPayStudent); } @@ -86,6 +89,7 @@ checkData(nonCoalPayStudent.getId()); checkSameData(nonCoalPayStudent); nonCoalPayStudent.setPayType(null); nonCoalPayStudent.setOrderNo(null); nonCoalPayStudent.setUpdateBy(SecurityUtils.getUsername()); return nonCoalPayStudentMapper.updateNonCoalPayStudent(nonCoalPayStudent); } @@ -209,6 +213,8 @@ stu1.setName(stu.getName()); stu1.setIdCard(stu.getIdCard()); stu1.setPhone(stu.getPhone()); stu1.setGovPayStatus(0L); stu1.setOrderNo(RandomUtil.generateOrderNumber()); stu1.setSex(StudentSex.BOY.getStatus().equals(stu.getSex().trim()) ? 0L : 1L); nonCoalPayStudentMapper.insertNonCoalPayStudent(stu1); successNum++; exam-system/src/main/resources/mapper/pay/NonCoalPayStudentMapper.xml
@@ -19,6 +19,10 @@ <result property="createTime" column="create_time"/> <result property="delFlag" column="del_flag"/> <result property="payType" column="pay_type"/> <result property="orderNo" column="order_no"/> <result property="orderId" column="order_id"/> <result property="fileData" column="file_data"/> <result property="govPayStatus" column="gov_pay_status"/> </resultMap> <sql id="selectNonCoalPayStudentVo"> @@ -35,7 +39,11 @@ create_by, create_time, del_flag, pay_type pay_type, order_no, order_id, file_data, gov_pay_status from non_coal_pay_student </sql> @@ -71,6 +79,7 @@ <if test="sex != null">sex,</if> <if test="payCode != null">pay_code,</if> <if test="payType != null">pay_type,</if> <if test="orderNo != null and orderNo != '' ">order_no,</if> <if test="payStatus != null">pay_status,</if> <if test="updateBy != null">update_by,</if> <if test="updateTime != null">update_time,</if> @@ -87,6 +96,7 @@ <if test="sex != null">#{sex},</if> <if test="payCode != null">#{payCode},</if> <if test="payType != null">#{payType},</if> <if test="orderNo != null and orderNo != '' ">#{orderNo},</if> <if test="payStatus != null">#{payStatus},</if> <if test="updateBy != null">#{updateBy},</if> <if test="updateTime != null">#{updateTime},</if> @@ -111,6 +121,9 @@ <if test="idCard != null and idCard != ''">id_card = #{idCard},</if> <if test="phone != null and phone != ''">phone = #{phone},</if> <if test="sex != null">sex = #{sex},</if> <if test="orderId != null and orderId != ''">order_id = #{orderId},</if> <if test="fileData != null and fileData != ''">file_data = #{fileData},</if> <if test="govPayStatus != null">gov_pay_status = #{govPayStatus},</if> <if test="payType != null">pay_type = #{payType},</if> <if test="payCode != null">pay_code = #{payCode},</if> <if test="payStatus != null">pay_status = #{payStatus},</if> ruoyi-common/src/main/java/com/ruoyi/common/utils/RandomUtil.java
@@ -1,7 +1,10 @@ package com.ruoyi.common.utils; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; public class RandomUtil { /** @@ -15,11 +18,9 @@ "6", "7", "8", "9", "0" }; /** * * 根据指定的长度生成的含有大小写字母及数字的字符串 * * @param length * 指定的长度 * @param length 指定的长度 * @return 按照指定的长度生成的含有大小写字母及数字的字符串 */ public static String generateRandomString(int length) { @@ -34,7 +35,20 @@ public static void main(String[] args) { String s = generateRandomString(26); System.out.println(s); System.out.println(generateOrderNumber()); } private static final AtomicInteger SEQUENCE = new AtomicInteger(0); private static final int MAX_SEQUENCE = 99999;// 5位数的序列号 private static final String ORDER_PER = "SN"; public static synchronized String generateOrderNumber() { String datePart = new SimpleDateFormat("yyyyMMddhhmm").format(new Date()); int sequencePart = SEQUENCE.getAndIncrement() % MAX_SEQUENCE; String sequenceStr = String.format("%05d", sequencePart); // 保证序列号是5位数,不足的前面补0 return ORDER_PER + datePart + sequenceStr; } }