夏文涛 2 mesi fa
parent
commit
d9dad3f524

+ 24 - 5
src/main/java/com/template/controller/WelcomeStudentController.java

@@ -495,6 +495,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
 
         String nstartTime = null;
         String nendTime = null;
+        boolean isNowYear = false;
         boolean lastYear = TimeExchange.CompareDate(TimeExchange.getDate(), TimeExchange.getYear() + "-07-01", "yyyy-MM-dd");
         if (yearId == null) {
             Integer yearInt = Integer.valueOf(TimeExchange.getYear());
@@ -503,6 +504,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
                 nstartTime = (yearInt - 1) + "-06-01";
                 nendTime = yearInt + "-06-01";
             } else {//今年
+                isNowYear = true;
                 nstartTime = yearInt + "-06-01";
                 nendTime = (yearInt + 1) + "-06-01";
             }
@@ -533,7 +535,8 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         if (result != null && result.getList() != null && result.getList().size() > 0) {
             List<StudentPageVo> students = result.getList().stream().filter(e -> e.getIsPay().intValue() == 0).collect(Collectors.toList());
             //只处理本学期的未达标人员的数据同步一下支付数据
-            if (students != null && students.size() > 0 && !lastYear) {
+            if (students != null && students.size() > 0 && isNowYear) {
+                List<PayDetailsVo> pdvs = new ArrayList<>();
                 List<Integer> ids = new ArrayList<>();
                 for (StudentPageVo student : students) {
 
@@ -560,6 +563,11 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
                             if (studentPay.compareTo(paySettings.getPayAmount()) >= 0) {
                                 student.setIsPay(1);
                                 ids.add(student.getId());
+                                PayDetailsVo pdv = new PayDetailsVo();
+                                pdv.setId(student.getId());
+                                pdv.setPayAmount(studentPay);
+                                pdv.setAmountPayable(yjPayAmount);
+                                pdvs.add(pdv);
                             } else {
                                 student.setIsPay(0);
                             }
@@ -571,10 +579,21 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
                     }
                 }
                 if (ids != null && ids.size() > 0) {
-                    int update = welcomeStudentService.updateStudents(ids);
-                    if (update < 0) {
-                        logger.error("获取支付信息导致学校信息查询失败");
-                        return CommonResult.fail("查询失败");
+                    List<WelcomeStudent> studentDatas = welcomeStudentService.queryStudents(ids);
+                    if(studentDatas != null && studentDatas.size() > 0){
+                        for (WelcomeStudent ws:studentDatas){
+                            Optional<PayDetailsVo> opdv = pdvs.stream().filter(e -> e.getId().intValue() == ws.getId().intValue()).findFirst();
+                            if(opdv != null && opdv.isPresent()){
+                                ws.setAmountPayable(opdv.get().getAmountPayable());
+                                ws.setPayAmount(opdv.get().getPayAmount());
+                            }
+                            ws.setIsPay(1);
+                        }
+                        boolean update = welcomeStudentService.updateBatchById(studentDatas);
+                        if (!update) {
+                            logger.error("获取支付信息导致学校信息查询失败");
+                            return CommonResult.fail("查询失败");
+                        }
                     }
                 }
             }

+ 24 - 0
src/main/java/com/template/model/vo/PayDetailsVo.java

@@ -0,0 +1,24 @@
+package com.template.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author: xwt
+ * @Date: 2025/6/16 星期一 11:28
+ * @Description: com.template.model.vo
+ * @Version: 1.0
+ */
+@Data
+public class PayDetailsVo {
+    @ApiModelProperty(value = "数据ID")
+    private Integer id;
+
+    @ApiModelProperty(value = "应缴金额")
+    private BigDecimal amountPayable;
+
+    @ApiModelProperty(value = "实付金额")
+    private BigDecimal payAmount;
+}

+ 2 - 0
src/main/java/com/template/services/WelcomeStudentService.java

@@ -86,4 +86,6 @@ public interface WelcomeStudentService extends IService<WelcomeStudent> {
     int studentTotalCount(Integer collegeId, String startTime, String endTime);
 
     int updateStudents(List<Integer> ids);
+
+    List<WelcomeStudent> queryStudents(List<Integer> ids);
 }

+ 8 - 0
src/main/java/com/template/services/impl/WelcomeStudentServiceImpl.java

@@ -271,4 +271,12 @@ public class WelcomeStudentServiceImpl extends ServiceImpl<WelcomeStudentMapper,
         System.out.println("更新了 " + rows + " 条记录");
         return rows;
     }
+
+    @Override
+    public List<WelcomeStudent> queryStudents(List<Integer> ids) {
+        QueryWrapper<WelcomeStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in(ids != null && ids.size() > 0, "id", ids);//身份证号
+        List<WelcomeStudent> result = welcomeStudentMapper.selectList(queryWrapper);
+        return result;
+    }
 }