无关风月
2024-07-24 b23b243473fc9ab20ca62eebf3668c143e2e7d23
cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java
@@ -104,6 +104,8 @@
    @Resource
    private ParticipantClient participantClient;
    @Autowired
    private CoursePackageClient coursePackageClient;
    @Autowired
    private PayMoneyUtil payMoneyUtil;
@@ -122,11 +124,12 @@
    @Override
    public ResultUtil addStuOfAppUser(StuDetailsReq stu, Integer appUserId) throws Exception {
        TStudent student = new TStudent();
        if (ToolUtil.isNotEmpty(stu.getName()) && ToolUtil.isNotEmpty(stu.getIdCard())) {
            Boolean aBoolean = JuHeUtil.idcardAuthentication(stu.getIdCard(), stu.getName());
            if (!aBoolean) {
                return ResultUtil.error("身份证和姓名不匹配");
            }
        if(ToolUtil.isEmpty(stu.getIdCard())){
            return ResultUtil.error("请填写身份证号");
        }
        Boolean aBoolean = JuHeUtil.idcardAuthentication(stu.getIdCard(), stu.getName());
        if (!aBoolean) {
            return ResultUtil.error("身份证和姓名不匹配");
        }
        student.setAppUserId(appUserId);
        student.setName(stu.getName());
@@ -384,7 +387,7 @@
        packagePayment.setStatus(1);
        packagePayment.setState(1);
        packagePayment.setInsertTime(new Date());
        couPayClient.savePaymentCoursePackage(packagePayment);
//        couPayClient.savePaymentCoursePackage(packagePayment);
        Integer hour = couPayClient.getClassHour(request.getCourseConfigId());
@@ -448,7 +451,7 @@
                                Map<String, String> data1 = resultUtil.getData();
                                String s = data1.get("trade_state");
                                String transaction_id = data1.get("transaction_id");
                                if ("REFUND".equals(s) || "NOTPAY".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10) {
                                if ("REFUND".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10) {
                                    coursePackagePayment.setState(3);
                                    couPayClient.delPaymentCoursePackage(coursePackagePayment.getId());
                                    break;
@@ -461,7 +464,7 @@
                                    couPayClient.updatePaymentCoursePackage(coursePackagePayment);
                                    break;
                                }
                                if ("USERPAYING".equals(s)) {
                                if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) {
                                    num++;
                                }
                            }
@@ -474,9 +477,24 @@
        }
        return weixinpay;
    }
    private String smid = "2088330203191220";//平台支付宝商户号
    public ResultUtil AlipayPayment(String code, BigDecimal amount, Integer hour) {
        ResultUtil alipay = payMoneyUtil.alipay("课包续费", "课包续费", "", code, amount.toString(),
        TCoursePackagePayment coursePackagePayment = couPayClient.getCoursePackagePaymentByCode(code);
        Integer coursePackageId = coursePackagePayment.getCoursePackageId();
        // 判断这个课包是属于哪个运营商的
        CoursePackage coursePackage = coursePackageClient.queryCoursePackageById(coursePackageId);
        Integer storeId = coursePackage.getStoreId();
        Store store = storeClient.queryStoreById(storeId);
        String smid1= "";
        if (store.getOperatorId()==null){
            // 平台
            smid1 = smid;
        }else{
            String smidByOperatorId = storeClient.getSMIDByOperatorId(store.getOperatorId());
            smid1 = smidByOperatorId;
        }
        ResultUtil alipay = payMoneyUtil.alipay(smid1,"课包续费", "课包续费", "", code, amount.toString(),
                "/base/coursePackage/alipayPaymentCallback");
        if (alipay.getCode() == 200) {
            new Thread(new Runnable() {
@@ -494,7 +512,6 @@
                                break;
                            }
                            AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code);
                            if (resultUtil.getCode().equals("10000") && coursePackagePayment.getPayStatus() == 1) {
                                /**
                                 * WAIT_BUYER_PAY(交易创建,等待买家付款)、
@@ -519,8 +536,20 @@
                                    coursePackagePayment.setLaveClassHours(hour);
                                    coursePackagePayment.setOrderNumber(tradeNo);
                                    couPayClient.updatePaymentCoursePackage(coursePackagePayment);
                                    Integer coursePackageId = coursePackagePayment.getCoursePackageId();
                                    // 判断这个课包是属于哪个运营商的
                                    CoursePackage coursePackage = coursePackageClient.queryCoursePackageById(coursePackageId);
                                    Integer storeId = coursePackage.getStoreId();
                                    Store store = storeClient.queryStoreById(storeId);
                                    String smid1= "";
                                    if (store.getOperatorId()==null){
                                        // 平台
                                        smid1 = smid;
                                    }else{
                                        String smidByOperatorId = storeClient.getSMIDByOperatorId(store.getOperatorId());
                                        smid1 = smidByOperatorId;
                                    }
                                    payMoneyUtil.confirm(smid1,code,tradeNo,amount.toString());
                                    break;
                                }
                                if ("WAIT_BUYER_PAY".equals(tradeStatus)) {
@@ -714,30 +743,16 @@
        citycodeResp.setLatitude(longitude);
        List<StoreDetailList> queryStoreList = storeClient.getQueryStoreList(citycodeResp);
        if (queryStoreList.size() > 0) {
            if (ToolUtil.isEmpty(space) || space ==1) {
                queryStoreList = queryStoreList.stream().sorted(Comparator.comparing(o -> o.getStoreDistance())).collect(Collectors.toList());
            } else {
                queryStoreList = queryStoreList.stream()
                        .sorted(Comparator.comparing(StoreDetailList::getStoreDistance).reversed())
                        .collect(Collectors.toList());
            }
//            if (ToolUtil.isEmpty(space) || space == 2) {
//                queryStoreList = queryStoreList.stream()
//                        .sorted(Comparator.comparing(StoreDetailList::getStoreDistance).reversed())
//                        .collect(Collectors.toList());
//
//            } else {
//                queryStoreList = queryStoreList.stream().sorted(Comparator.comparing(o -> o.getStoreDistance())).collect(Collectors.toList());
//            }
            if (ToolUtil.isNotEmpty(search)) {
                queryStoreList = queryStoreList.stream().filter(o -> o.getStoreName().contains(search)).collect(Collectors.toList());
            }
        }
        return queryStoreList;
    }