exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayStudentController.java
@@ -2,10 +2,12 @@ import com.gkhy.exam.pay.entity.CoalPayStudent; import com.gkhy.exam.pay.service.CoalPayStudentService; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; @@ -65,6 +67,8 @@ * 批量导入学生 */ @PostMapping("/import") @Anonymous @ApiModelProperty(value = "导入学员") public AjaxResult uploadStudent(@RequestParam("file") MultipartFile file, @RequestParam("coalPayId") Long coalPayId) { try { return coalPayStudentService.uploadStudent(file, coalPayId); exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java
@@ -99,6 +99,11 @@ */ private Integer govPayStatus; /** * 培训机构 */ private String train; /** * 创建者 @@ -282,4 +287,12 @@ public void setPayTime(Date payTime) { this.payTime = payTime; } public String getTrain() { return train; } public void setTrain(String train) { this.train = train; } } exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java
@@ -10,10 +10,8 @@ import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.SecurityUtils; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import com.ruoyi.common.utils.StringUtils; import org.apache.poi.ss.usermodel.*; import org.aspectj.weaver.loadtime.Aj; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -94,13 +92,26 @@ coalPayStudent.setCoalPayId(coalPayId); if (row!=null){ coalPayStudent.setName(row.getCell(0).getStringCellValue()); coalPayStudent.setIdCard(row.getCell(1).getStringCellValue()); String idCard = row.getCell(1).getStringCellValue(); coalPayStudent.setIdCard(idCard); coalPayStudent.setPhone(row.getCell(2).getStringCellValue()); String stringCellValue = row.getCell(3).getStringCellValue(); if (stringCellValue.equals("男")){ coalPayStudent.setSex(0L); }else if (stringCellValue.equals("女")){ coalPayStudent.setSex(1L); Cell cell = row.getCell(3); if (cell!=null){ if (StringUtils.isEmpty(cell.getStringCellValue())){ coalPayStudent.setTrain("-"); }else{ coalPayStudent.setTrain(cell.getStringCellValue()); } } char c = idCard.charAt(idCard.length() - 1); if (Character.isDigit(c)){ int genderDigit = Character.getNumericValue(c); if (genderDigit % 2 == 1) { coalPayStudent.setSex(0L); } else { coalPayStudent.setSex(1L); } } coalPayStudent.setPayStatus(0L); coalPayStudent.setCreateBy(loginUser.getUsername()); exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml
@@ -41,6 +41,7 @@ <if test="orderNo != null and orderNo != '' ">order_no,</if> <if test="fileData!=null">file_data,</if> <if test="govPayStatus!=null">gov_pay_status,</if> <if test="train!=null and train!=''">train,</if> <if test="createBy != null">create_by,</if> <if test="createTime != null">create_time,</if> <if test="updateBy != null">update_by,</if> @@ -61,6 +62,7 @@ <if test="orderNo != null and orderNo != '' ">#{orderNo},</if> <if test="fileData!=null">#{fileData},</if> <if test="govPayStatus!=null">#{govPayStatus},</if> <if test="train!=null and train!=''">#{train},</if> <if test="createBy != null">#{createBy},</if> <if test="createTime != null">#{createTime},</if> <if test="updateBy != null">#{updateBy},</if> exam-system/src/test/java/TextPay.java
@@ -124,7 +124,7 @@ PayUtils payUtils = new PayUtils(); ResultVo resultVo = payUtils.uploadXml("CO202502140115634461", fileData.getBytes()); ResultVo resultVo = payUtils.uploadXml("CO202502140115634461", fileData); log.info("请求结果为:"+resultVo); }