From ca90224ae08ff40b78daad37175639cae71c0855 Mon Sep 17 00:00:00 2001 From: “djh” <“3298565835@qq.com”> Date: 星期四, 20 二月 2025 14:16:59 +0800 Subject: [PATCH] 煤矿缴费修改 --- exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml | 2 ++ exam-system/src/test/java/TextPay.java | 2 +- exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java | 13 +++++++++++++ exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java | 31 +++++++++++++++++++++---------- exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayStudentController.java | 4 ++++ 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayStudentController.java b/exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayStudentController.java index 2e72368..5402826 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayStudentController.java +++ b/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); diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java b/exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java index 30365e4..7ad64e3 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java +++ b/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; + } } diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java index cbf03bc..90039df 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayStudentServiceImpl.java +++ b/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()); diff --git a/exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml b/exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml index 9b3fcaf..11ba69f 100644 --- a/exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml +++ b/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> diff --git a/exam-system/src/test/java/TextPay.java b/exam-system/src/test/java/TextPay.java index d2ff3a8..e757025 100644 --- a/exam-system/src/test/java/TextPay.java +++ b/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); } -- Gitblit v1.9.2