Forráskód Böngészése

获取支付信息

夏文涛 1 éve
szülő
commit
34483031aa

+ 67 - 1
src/main/java/com/template/controller/WelcomeStudentController.java

@@ -1625,7 +1625,73 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
 
     @Override
     public CommonResult queryStudentInfo(String admissNum) {
-        return null;
+        WelcomeStudent ws = welcomeStudentService.getDataByNum(admissNum);
+        if(ws == null){
+            return CommonResult.fail("当前学生信息已失效,查询失败");
+        }
+        List<PayDetailVO> pdvs = new ArrayList<>();
+        System.out.println("进支付比较");
+        List<JsonPayVo> payInfos = WelcomePayController.queryStudentPayInfo(ws.getAdmissNum(), TimeExchange.getYear());
+        BigDecimal payAmount = new BigDecimal(BigInteger.ZERO);//实缴金额
+        BigDecimal yjPayAmount = new BigDecimal(BigInteger.ZERO);//应缴金额
+        for (JsonPayVo pi : payInfos) {
+            payAmount = payAmount.add(pi.getSJJE());
+            yjPayAmount = yjPayAmount.add(pi.getYJJE());
+            PayDetailVO pdv = new PayDetailVO();
+            pdv.setPayName(pi.getSFXMMC());
+            pdv.setYJJE(pi.getYJJE());
+            pdv.setSJJE(pi.getSJJE());
+            pdvs.add(pdv);
+        }
+        ws.setPayAmount(payAmount);
+        ws.setAmountPayable(yjPayAmount);
+        System.out.println("进支付比较1" + JSON.toJSON(payInfos));
+        if (payInfos != null && payInfos.size() > 0) {
+            System.out.println("进支付比较2");
+            List<WelcomePaySetting> paySettings = welcomePaySettingService.queryPaySettings(ws.getSchool());
+            System.out.println("进支付比较3" + JSON.toJSON(paySettings));
+            if (paySettings != null && paySettings.size() > 0) {
+                System.out.println("进支付比较4");
+                for (WelcomePaySetting pay : paySettings) {
+                    System.out.println("进支付比较5");
+                    BigDecimal money = pay.getPayAmount();
+                    if (pay.getMethod().equals("全部")) {
+                        BigDecimal totalSj = new BigDecimal(BigInteger.ZERO);
+                        for (JsonPayVo jpv : payInfos) {
+                            totalSj = totalSj.add(jpv.getSJJE());
+                        }
+
+                        if (totalSj.compareTo(money) >= 0) {
+                            ws.setIsPay(1);
+                        }
+                    }
+                    Optional<JsonPayVo> ojpv = payInfos.stream().filter(e -> e.getSFXMMC().equals(pay.getMethod())).findFirst();
+                    if (ojpv != null && ojpv.isPresent()) {
+                        if (ojpv.get().getSJJE().compareTo(money) >= 0) {
+                            ws.setIsPay(1);
+                        }
+                    }
+                }
+            } else {
+                ws.setIsPay(0);
+            }
+        } else {
+            ws.setIsPay(0);
+        }
+        if(!(ws.getIsPay() != null && ws.getIsPay().intValue() == 1)){
+            int updateResult = welcomeStudentService.updateWelcomeStudent(ws);
+            if(updateResult < 0){
+                return CommonResult.fail("查询支付信息失败");
+            }
+        }
+
+        PayInfoVO result = new PayInfoVO();
+        result.setId(ws.getId());
+        result.setName(ws.getName());
+        result.setAdmissNum(ws.getAdmissNum());
+        result.setIsPay(ws.getIsPay());
+        result.setPays(pdvs);
+        return CommonResult.ok(result);
     }
 }
 

+ 27 - 0
src/main/java/com/template/model/vo/PayDetailVO.java

@@ -0,0 +1,27 @@
+package com.template.model.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author: codingliang
+ * @Description: 登录用户vo
+ * @Date: 2022-08-04 9:58
+ * @Version: V1.0
+ **/
+
+@Data
+public class PayDetailVO {
+    /**
+     * 支付类别
+     */
+    private String payName;
+
+    //应缴金额
+    private BigDecimal YJJE;
+
+    //实缴金额
+    private BigDecimal SJJE;
+
+}

+ 38 - 0
src/main/java/com/template/model/vo/PayInfoVO.java

@@ -0,0 +1,38 @@
+package com.template.model.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author: codingliang
+ * @Description: 登录用户vo
+ * @Date: 2022-08-04 9:58
+ * @Version: V1.0
+ **/
+
+@Data
+public class PayInfoVO {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+    /**
+     * 录取号(学号)
+     */
+    private String admissNum;
+    /**
+     * 姓名
+     */
+    private String name;
+    /**
+     * 是否已支付
+     * 未支付:0
+     * 已支付:1
+     */
+    private Integer isPay;
+    /**
+     * 支付明细数据
+     */
+    private List<PayDetailVO> pays;
+}

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

@@ -56,4 +56,6 @@ public interface WelcomeStudentService extends IService<WelcomeStudent> {
     int payCount();
 
     List<WelcomeStudent> getStudent(CheckInVo checkInVo);
+
+    WelcomeStudent getDataByNum(String admissNum);
 }

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

@@ -175,6 +175,16 @@ public class WelcomeStudentServiceImpl extends ServiceImpl<WelcomeStudentMapper,
     }
 
     @Override
+    public WelcomeStudent getDataByNum(String admissNum) {
+        QueryWrapper<WelcomeStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(StringUtils.hasText(admissNum), "admiss_num", admissNum);
+        queryWrapper.eq("iden_type",1);
+        List<WelcomeStudent> result = welcomeStudentMapper.selectList(queryWrapper);
+        return (result != null && result.size() > 0) ? result.get(0) : null;
+    }
+
+
+    @Override
     public List<WelcomeStudent> queryStudentByCardId(List<String> cardIds) {
         QueryWrapper<WelcomeStudent> queryWrapper = new QueryWrapper<>();
         queryWrapper.in(cardIds != null && cardIds.size() > 0, "card_id", cardIds);//身份证号