From 0bc560591385dc1a4b9be8bd4779bf6b539888b1 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期五, 20 十月 2023 17:25:31 +0800
Subject: [PATCH] 10.20.4

---
 cloud-server-competition/src/main/java/com/dsh/competition/entity/OperatorUser.java                 |   36 ++++
 cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_edit.html                   |   41 ++++
 cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java            |  121 +++++++++++++
 cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java                    |    7 
 cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js   |  148 ++++++++++++++++
 cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java |  116 ++++++++++++
 cloud-server-competition/src/main/java/com/dsh/competition/feignclient/other/StoreClient.java       |    4 
 cloud-server-account/src/main/java/com/dsh/account/feignclient/other/StoreClient.java               |    4 
 cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_add.html                    |    8 
 cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java        |    1 
 10 files changed, 471 insertions(+), 15 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/StoreClient.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/StoreClient.java
index cdd5a74..14d268e 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/StoreClient.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/StoreClient.java
@@ -1,5 +1,6 @@
 package com.dsh.account.feignclient.other;
 
+import com.dsh.account.entity.OperatorUser;
 import com.dsh.account.feignclient.course.model.QueryStoreList;
 import com.dsh.account.feignclient.other.model.*;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -15,7 +16,8 @@
 
 
 
-
+    @PostMapping("/store/queryByStoreId")
+    OperatorUser queryByStoreId(Integer storeId);
 
 
     /**
diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
index 03f305a..1b2bbee 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -1,6 +1,16 @@
 package com.dsh.account.service.impl;
 
 
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.AlipayClient;
+import com.alipay.api.DefaultAlipayClient;
+import com.alipay.api.domain.AlipayTradeOrderSettleModel;
+import com.alipay.api.domain.OpenApiRoyaltyDetailInfoPojo;
+import com.alipay.api.domain.RoyaltyDetailInfos;
+import com.alipay.api.request.AlipayTradeOrderSettleRequest;
+import com.alipay.api.request.AlipayTradeRoyaltyRelationBindRequest;
+import com.alipay.api.response.AlipayTradeOrderSettleResponse;
+import com.alipay.api.response.AlipayTradeRoyaltyRelationBindResponse;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -156,6 +166,16 @@
 
     @Autowired
     private IntroduceRewardsClient introduceRewardsClient;
+
+    private String aliAppid = "2021004105665036";//支付宝appid
+
+    private String appPrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUE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6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==";//支付宝开发者应用私钥
+
+    private String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAouYvZ1v4RiydwNOnGcU0Hb4hQu0x6XUooaE2Bi6/atNOobtFdunnATGP6OMOW7yF9DpP8qH5mbFXAiaQD721y/7qlayI50UcV4mngRU4ZcaAVE3bp721Eg2H85RISa+Tb1CiOh+pc9p4l5UBseKsvB2ruHHForfZDPI8FL7AVUKBYCQPsa4zL6KAO2C6KULaTg/lCa+bYQKU0n9ca569VtdsqJUyxB9eSZjVd+9nKl62FLqp2NELGj7cXqiVBgDnBnVS5ZUO3mrBM5z/AxQbw3RwE3JqdkhzUA1BFjejAlT2zIGNOjUFagF8ao0wGElYfuk0bum6Hz5qWAt02QdNNwIDAQAB";//支付宝应用公钥
+
+    private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥
+
+
     @Override
     public List<QueryAppUserVO> listAll(QueryAppUser query) {
        return appUserMapper.listAll(query);
@@ -1269,6 +1289,7 @@
                                         userPointsMerchandise.setPayType(2);
                                         mcClient.updateDetailsUserPointMercase(userPointsMerchandise);
                                     }
+                                    moneyOut(tradeNo,tradeNo);
                                     break;
                                 }
                                 if("WAIT_BUYER_PAY".equals(s)){
@@ -1286,6 +1307,106 @@
         return alipay;
     }
 
+
+
+    @Resource
+    private  MerChandiseClient merChandiseClient;
+
+
+    public void moneyOut(String outNum,String tradeNo) throws AlipayApiException {
+
+
+        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2");
+        AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest();
+        AlipayTradeOrderSettleModel model = new AlipayTradeOrderSettleModel();
+        model.setOutRequestNo(outNum);
+        model.setTradeNo(tradeNo);
+        List<RoyaltyDetailInfos> royaltyDetailInfos = new ArrayList<>();
+//
+
+        AlipayTradeRoyaltyRelationBindRequest request1 = new AlipayTradeRoyaltyRelationBindRequest();
+
+
+        request1.setBizContent("{" +
+                "  \"receiver_list\":[" +
+                "    {" +
+                "      \"type\":\"loginName\"," +
+                "      \"account\":\"19522115070\"," +
+                "      \"name\":\"罗易胜\"," +
+                "      \"memo\":\"分账给测试商户\"," +
+                "    }" +
+                "  ]," +
+                "  \"out_request_no\":\""+tradeNo+"\"" +
+                "}");
+        AlipayTradeRoyaltyRelationBindResponse response = alipayClient.execute(request1);
+        if(response.isSuccess()){
+            System.out.println("绑定调用成功");
+        } else {
+            System.out.println("调用失败");
+        }
+
+
+
+//        RoyaltyDetailInfos royaltyDetailInfos1 = new RoyaltyDetailInfos();
+//        royaltyDetailInfos1.setTransOutType("loginName");
+//        royaltyDetailInfos1.setTransOut("happysports@weparklife.com");
+//        royaltyDetailInfos1.setTransInType("loginName");
+//        royaltyDetailInfos1.setTransIn("19522115070");
+////        royaltyDetailInfos1.setAmount("0.01");
+//        royaltyDetailInfos1.setAmountPercentage("100");
+
+//        royaltyDetailInfos.add(royaltyDetailInfos1);
+
+
+        List<UserPointsMerchandise> userPointsMerchandises = merChandiseClient.queryUserPointMerchaseByCode(outNum);
+//        PaymentCompetition code = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("code", outNum));
+        Integer storeId = userPointsMerchandises.get(0).getStoreId();
+
+//        Competition byId1 = competitionService.getById(code.getCompetitionId());
+
+
+//        TCoursePackage byId = coursePackageService.getById(one.getCoursePackageId());
+
+
+
+        OperatorUser operatorUser =  storeClient.queryByStoreId(storeId);
+
+
+
+//        Integer paymentCompetitions = competitionsClient.queryByCode(outTradeNo);
+//        Integer siteBookings = siteClient.queryByCode(outTradeNo);
+//        List<Integer> stores = new ArrayList<>();
+//        stores.add(coursePackagePayments);
+//        stores.add(paymentCompetitions);
+//        stores.add(siteBookings);
+//        OperatorUser operatorUser = siteClient.queryOperator(stores);
+
+
+
+
+        OpenApiRoyaltyDetailInfoPojo op = new OpenApiRoyaltyDetailInfoPojo();
+        op.setTransOutType("loginName");
+        op.setTransOut("happysports@weparklife.com");
+        op.setTransInType("userId");
+        op.setTransIn(operatorUser.getAlipayNum());
+        op.setAmountPercentage(Long.valueOf(operatorUser.getAlipayProportion()));
+
+        List<OpenApiRoyaltyDetailInfoPojo> ops = new ArrayList<>();
+        ops.add(op);
+        model.setRoyaltyParameters(ops);
+
+        request.setBizModel(model);
+
+
+        AlipayTradeOrderSettleResponse response1 = alipayClient.execute(request);
+        if(response1.isSuccess()){
+            System.out.println("调用成功");
+        } else {
+            System.out.println("调用失败");
+        }
+    }
+
+
     private ResultUtil WechatPayment(BigDecimal cash, String code) throws Exception {
         ResultUtil weixinpay = payMoneyUtil.weixinpay("课包", "", code, cash.toString(),
                 "/base/pointMer/exchangeGoodPaymentWeChatCallback", "APP", "");
diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/entity/OperatorUser.java b/cloud-server-competition/src/main/java/com/dsh/competition/entity/OperatorUser.java
new file mode 100644
index 0000000..489e375
--- /dev/null
+++ b/cloud-server-competition/src/main/java/com/dsh/competition/entity/OperatorUser.java
@@ -0,0 +1,36 @@
+package com.dsh.competition.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@TableName("t_operator_user")
+@Data
+public class OperatorUser {
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+    @TableField(value = "userId")
+    private Integer userId;
+    @TableField(value = "alipay")
+    private String alipay;
+    @TableField(value = "alipayProportion")
+    private String alipayProportion;
+    @TableField(value = "alipayNum")
+    private String alipayNum;
+    @TableField(value = "wechat")
+    private String wechat;
+    @TableField(value = "wechatProportion")
+    private String wechatProportion;
+    @TableField(value = "wechatNum")
+    private String wechatNum;
+    @TableField(value = "alipayType")
+    private Integer alipayType;
+    @TableField(value = "wechatType")
+    private Integer wechatType;
+    @TableField(value = "operatorId")
+    private Integer operatorId;
+}
diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/feignclient/other/StoreClient.java b/cloud-server-competition/src/main/java/com/dsh/competition/feignclient/other/StoreClient.java
index 03861a6..3b87c94 100644
--- a/cloud-server-competition/src/main/java/com/dsh/competition/feignclient/other/StoreClient.java
+++ b/cloud-server-competition/src/main/java/com/dsh/competition/feignclient/other/StoreClient.java
@@ -1,5 +1,6 @@
 package com.dsh.competition.feignclient.other;
 
+import com.dsh.competition.entity.OperatorUser;
 import com.dsh.competition.feignclient.other.model.Store;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -34,5 +35,8 @@
     @PostMapping("/store/addBackRecord")
     void addBackRecord(String s);
 
+    @PostMapping("/store/queryByStoreId")
+    OperatorUser queryByStoreId(Integer storeId);
+
 
 }
diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
index 5522269..88a7efb 100644
--- a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
+++ b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
@@ -1,12 +1,19 @@
 package com.dsh.competition.service.impl;
 
 import com.alibaba.nacos.common.utils.UuidUtils;
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.AlipayClient;
+import com.alipay.api.DefaultAlipayClient;
+import com.alipay.api.domain.AlipayTradeOrderSettleModel;
+import com.alipay.api.domain.OpenApiRoyaltyDetailInfoPojo;
+import com.alipay.api.domain.RoyaltyDetailInfos;
+import com.alipay.api.request.AlipayTradeOrderSettleRequest;
+import com.alipay.api.request.AlipayTradeRoyaltyRelationBindRequest;
+import com.alipay.api.response.AlipayTradeOrderSettleResponse;
+import com.alipay.api.response.AlipayTradeRoyaltyRelationBindResponse;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.dsh.competition.entity.Competition;
-import com.dsh.competition.entity.Participant;
-import com.dsh.competition.entity.PaymentCompetition;
-import com.dsh.competition.entity.UserCompetition;
+import com.dsh.competition.entity.*;
 import com.dsh.competition.feignclient.account.AppUserClient;
 import com.dsh.competition.feignclient.account.StudentClient;
 import com.dsh.competition.feignclient.account.model.AppUser;
@@ -67,6 +74,15 @@
     @Autowired
     private PayMoneyUtil payMoneyUtil;
 
+
+
+    private String aliAppid = "2021004105665036";//支付宝appid
+
+    private String appPrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzl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1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==";//支付宝开发者应用私钥
+
+    private String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAouYvZ1v4RiydwNOnGcU0Hb4hQu0x6XUooaE2Bi6/atNOobtFdunnATGP6OMOW7yF9DpP8qH5mbFXAiaQD721y/7qlayI50UcV4mngRU4ZcaAVE3bp721Eg2H85RISa+Tb1CiOh+pc9p4l5UBseKsvB2ruHHForfZDPI8FL7AVUKBYCQPsa4zL6KAO2C6KULaTg/lCa+bYQKU0n9ca569VtdsqJUyxB9eSZjVd+9nKl62FLqp2NELGj7cXqiVBgDnBnVS5ZUO3mrBM5z/AxQbw3RwE3JqdkhzUA1BFjejAlT2zIGNOjUFagF8ao0wGElYfuk0bum6Hz5qWAt02QdNNwIDAQAB";//支付宝应用公钥
+
+    private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥
 
 
     /**
@@ -388,6 +404,10 @@
                                     paymentCompetition.setPayTime(new Date());
                                     paymentCompetition.setPayOrderNo(tradeNo);
                                     paymentCompetitionService.updateById(paymentCompetition);
+
+                                    //分账
+                                    moneyOut(tradeNo,tradeNo);
+
                                     break;
                                 }
                                 if("WAIT_BUYER_PAY".equals(s)){
@@ -404,6 +424,94 @@
         return alipay;
     }
 
+//    @Autowired
+//private IPaymentCompetitionService paymentCompetitionService;
+
+    @Autowired
+    private CompetitionService competitionService;
+    public void moneyOut(String outNum,String tradeNo) throws AlipayApiException {
+        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2");
+        AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest();
+        AlipayTradeOrderSettleModel model = new AlipayTradeOrderSettleModel();
+        model.setOutRequestNo(outNum);
+        model.setTradeNo(tradeNo);
+        List<RoyaltyDetailInfos> royaltyDetailInfos = new ArrayList<>();
+//
+
+        AlipayTradeRoyaltyRelationBindRequest request1 = new AlipayTradeRoyaltyRelationBindRequest();
+
+
+        request1.setBizContent("{" +
+                "  \"receiver_list\":[" +
+                "    {" +
+                "      \"type\":\"loginName\"," +
+                "      \"account\":\"19522115070\"," +
+                "      \"name\":\"罗易胜\"," +
+                "      \"memo\":\"分账给测试商户\"," +
+                "    }" +
+                "  ]," +
+                "  \"out_request_no\":\""+tradeNo+"\"" +
+                "}");
+        AlipayTradeRoyaltyRelationBindResponse response = alipayClient.execute(request1);
+        if(response.isSuccess()){
+            System.out.println("绑定调用成功");
+        } else {
+            System.out.println("调用失败");
+        }
+
+
+
+//        RoyaltyDetailInfos royaltyDetailInfos1 = new RoyaltyDetailInfos();
+//        royaltyDetailInfos1.setTransOutType("loginName");
+//        royaltyDetailInfos1.setTransOut("happysports@weparklife.com");
+//        royaltyDetailInfos1.setTransInType("loginName");
+//        royaltyDetailInfos1.setTransIn("19522115070");
+////        royaltyDetailInfos1.setAmount("0.01");
+//        royaltyDetailInfos1.setAmountPercentage("100");
+
+//        royaltyDetailInfos.add(royaltyDetailInfos1);
+
+
+        PaymentCompetition code = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("code", outNum));
+        Competition byId1 = competitionService.getById(code.getCompetitionId());
+
+//        TCoursePackage byId = coursePackageService.getById(one.getCoursePackageId());
+        OperatorUser operatorUser =  storeClient.queryByStoreId(byId1.getOperatorId());
+
+
+
+//        Integer paymentCompetitions = competitionsClient.queryByCode(outTradeNo);
+//        Integer siteBookings = siteClient.queryByCode(outTradeNo);
+//        List<Integer> stores = new ArrayList<>();
+//        stores.add(coursePackagePayments);
+//        stores.add(paymentCompetitions);
+//        stores.add(siteBookings);
+//        OperatorUser operatorUser = siteClient.queryOperator(stores);
+
+
+
+
+        OpenApiRoyaltyDetailInfoPojo op = new OpenApiRoyaltyDetailInfoPojo();
+        op.setTransOutType("loginName");
+        op.setTransOut("happysports@weparklife.com");
+        op.setTransInType("userId");
+        op.setTransIn(operatorUser.getAlipayNum());
+        op.setAmountPercentage(Long.valueOf(operatorUser.getAlipayProportion()));
+
+        List<OpenApiRoyaltyDetailInfoPojo> ops = new ArrayList<>();
+        ops.add(op);
+        model.setRoyaltyParameters(ops);
+
+        request.setBizModel(model);
+
+
+        AlipayTradeOrderSettleResponse response1 = alipayClient.execute(request);
+        if(response1.isSuccess()){
+            System.out.println("调用成功");
+        } else {
+            System.out.println("调用失败");
+        }
+    }
 
     /**
      * 定时任务修改赛事状态
diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
index d1a4033..5adfe3f 100644
--- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
+++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
@@ -1065,7 +1065,6 @@
 //        stores.add(coursePackagePayments);
 //        stores.add(paymentCompetitions);
 //        stores.add(siteBookings);
-//
 //        OperatorUser operatorUser = siteClient.queryOperator(stores);
 
 
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_add.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_add.html
index bb09f64..8135144 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_add.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_add.html
@@ -378,10 +378,10 @@
 
         if (selectedValue === "智慧场地") {
             console.log("=============智慧场地=")
-            priceLabel.innerText = "元/15min";
-            priceLabel1.innerText = "元/15min";
-            priceLabel3.innerText = "元/15min";
-            priceLabel4.innerText = "元/15min";
+            priceLabel.innerText = "元/15分钟";
+            priceLabel1.innerText = "元/15分钟";
+            priceLabel3.innerText = "元/15分钟";
+            priceLabel4.innerText = "元/15分钟";
         } else {
             priceLabel.innerText = "元/半小时";
             priceLabel1.innerText = "元/半小时";
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_edit.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_edit.html
index b10d0ab..7b51d0c 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_edit.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_edit.html
@@ -114,7 +114,7 @@
                 <label class="col-sm-3 control-label">*现金价格:</label>
                 <div class="col-sm-9" style="display: flex;">
                     <input style="width: 300px" class="form-control" id="cashPrice" name="playPaiCoin" type="text" value="${list.cashPrice}">
-                    <span style="margin-left: 5px;margin-top: 5px">元/半小时</span>
+                    <span style="margin-left: 5px;margin-top: 5px" id="priceLabel">元/半小时</span>
                 </div>
             </div>
 
@@ -122,7 +122,7 @@
                 <label class="col-sm-3 control-label">*玩湃币价格:</label>
                 <div class="col-sm-9" style="display: flex;">
                     <input style="width: 300px" class="form-control" id="playPaiCoin" name="playPaiCoin" type="text" value="${list.playPaiCoin}">
-                    <span style="margin-left: 5px;margin-top: 5px">币/半小时</span>
+                    <span style="margin-left: 5px;margin-top: 5px" id="priceLabel1">币/半小时</span>
                 </div>
             </div>
 
@@ -154,7 +154,7 @@
                     <label class="col-sm-3 control-label">*现金价格:</label>
                     <div class="col-sm-9" style="display: flex;">
                         <input style="width: 300px" class="form-control" id="cashPriceOne" name="playPaiCoin" placeholder="请输入价格" type="text" value="${list.cashPriceOne}">
-                        <span style="margin-left: 5px;margin-top: 5px">元/半小时</span>
+                        <span style="margin-left: 5px;margin-top: 5px" id="priceLabel3">元/半小时</span>
                     </div>
                 </div>
 
@@ -162,7 +162,7 @@
                     <label class="col-sm-3 control-label">*玩湃币价格:</label>
                     <div class="col-sm-9" style="display: flex;">
                         <input style="width: 300px" class="form-control" id="playPaiCoinOne" name="playPaiCoin" placeholder="请输入价格" type="text" value="${list.playPaiCoinOne}">
-                        <span style="margin-left: 5px;margin-top: 5px">币/半小时</span>
+                        <span style="margin-left: 5px;margin-top: 5px" id="priceLabel4">币/半小时</span>
                     </div>
                 </div>
 
@@ -260,6 +260,35 @@
 <script src="${ctxPath}/js/elementui/index.js"></script>
 <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css">
 <script>
+
+    function updateTime1() {
+        var selectedValue = document.getElementById("siteTypeOne").value;
+        var priceLabel = document.getElementById("priceLabel");
+        var priceLabel1 = document.getElementById("priceLabel1");
+        var priceLabel3 = document.getElementById("priceLabel3");
+        var priceLabel4 = document.getElementById("priceLabel4");
+
+        if (selectedValue === "智慧场地") {
+            console.log("=============智慧场地=")
+            priceLabel.innerText = "元/15分钟";
+            priceLabel1.innerText = "元/15分钟";
+            priceLabel3.innerText = "元/15分钟";
+            priceLabel4.innerText = "元/15分钟";
+        } else {
+            priceLabel.innerText = "元/半小时";
+            priceLabel1.innerText = "元/半小时";
+            priceLabel3.innerText = "元/半小时";
+            priceLabel4.innerText = "元/半小时";
+        }
+
+
+
+        // $("#end-time").val('');
+        // $("#start-time").val('');
+    }
+
+
+
     let id = "${list.imgs}"
     let obj = []
     console.log("看看")
@@ -332,6 +361,10 @@
 
 
     window.onload = function(){
+        var siteTypeOne = document.getElementById('siteTypeOne');
+        siteTypeOne.onchange(); // Trigger the onchange event
+
+
         console.log("${list.operatorId}")
         if("${list.operatorId}"==0){
             console.log(233232)
diff --git a/cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js b/cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js
index f69558a..01ab8b9 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js
@@ -273,7 +273,7 @@
             return
         }
         if (null == codeTime || '' == codeTime) {
-            Feng.error("扣除课时数不能为空不能为空");
+            Feng.error("扣除课时数不能为空");
             return
         }
         if (null == classStartTime || '' == classStartTime) {
@@ -463,6 +463,152 @@
     //     Feng.error("周不能为空");
     //     return
     // }
+    if (type == 1 ) {
+
+        var checkboxes1 = document.getElementsByName('payType');
+        var isChecked1 = false;
+
+        for (var i = 0; i < checkboxes1.length; i++) {
+            if (checkboxes1[i].checked) {
+                isChecked1 = true;
+                break;
+            }
+        }
+
+        if (isChecked1) {
+            console.log("At least one checkbox is selected.");
+        } else {
+            Feng.error("请选择支付方式")
+            return;
+        }
+
+
+        var checkboxes = document.getElementsByName('payType');
+        var isChecked = false;
+        var isChecked1 = false;
+
+        for (var i = 0; i < checkboxes.length; i++) {
+            if (checkboxes[i].checked && checkboxes[i].value === '1') {
+                isChecked = true;
+                break;
+            }
+        }
+
+        for (var i = 0; i < checkboxes.length; i++) {
+            if (checkboxes[i].checked && checkboxes[i].value === '2') {
+                isChecked1 = true;
+                break;
+            }
+        }
+
+        if (isChecked1) {
+            var elements3 = document.getElementsByClassName('paiCoin');
+
+            for (var i = 0; i < elements3.length; i++) {
+                var value = elements3[i].value.trim();
+
+                if (value === '') {
+                    Feng.error("请输入玩湃币价格")
+                    return;
+                    // Value is empty
+                    // Perform your desired action
+                } else {
+                    // Value is not empty
+                    // Perform other actions
+                }
+            }
+
+
+        }
+
+
+
+        if (isChecked) {
+            var elements2 = document.getElementsByClassName('cash');
+
+            for (var i = 0; i < elements2.length; i++) {
+                var value = elements2[i].value.trim();
+
+                if (value === '') {
+                    Feng.error("请输入现金价格")
+                    return;
+                    // Value is empty
+                    // Perform your desired action
+                } else {
+                    // Value is not empty
+                    // Perform other actions
+                }
+            }
+
+
+        }
+
+
+        var elements1 = document.getElementsByClassName('classNumber');
+
+        for (var i = 0; i < elements1.length; i++) {
+            var value = elements1[i].value.trim();
+
+            if (value === '') {
+                Feng.error("请输入课时数")
+                return;
+                // Value is empty
+                // Perform your desired action
+            } else {
+                // Value is not empty
+                // Perform other actions
+            }
+        }
+
+
+
+
+        var elements = document.querySelectorAll('[name="classStartTime"]');
+        var isEmpty = false;
+
+        for (var i = 0; i < elements.length; i++) {
+            if (elements[i].value.trim() === '') {
+                isEmpty = true;
+                break;
+            }
+        }
+
+        if (isEmpty) {
+            Feng.error("请输入上课时间")
+            return;
+            console.log("At least one element with the name 'yourName' is empty.");
+        } else {
+            console.log("All elements with the name 'yourName' are filled.");
+        }
+
+
+
+        if (null == maxSubscribeNumber || '' == maxSubscribeNumber) {
+            Feng.error("最多预约人数不能为空");
+            return
+        }
+        if (null == codeTime || '' == codeTime) {
+            Feng.error("扣除课时数不能为空");
+            return
+        }
+        if (null == classStartTime || '' == classStartTime) {
+            Feng.error("上课时间不能为空");
+            return
+        }
+        if (null == classWeeks || '' == classWeeks) {
+            Feng.error("上课时间不能为空");
+            return
+        }
+
+
+
+        if (null == validDays || '' == validDays) {
+            Feng.error("课时有效期不能为空");
+            return
+        }
+    }
+
+
     classWeeks = classWeeks.substring(0, classWeeks.length - 1);
 
     if(null == coverDrawing || '' == coverDrawing){
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
index 3efad9a..fe3d8d1 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -181,6 +181,7 @@
             siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).like("times",day));
         }
 
+
         System.out.println("=======siteBookings======"+siteBookings);
         for (SiteBooking siteBooking : siteBookings) {
 
@@ -193,6 +194,12 @@
                     strings.add(convertedValue);
                 }
             }else {
+                if (halfName==null){
+                    for (String s : split) {
+                        String convertedValue = s.substring(11);
+                        strings.add(convertedValue);
+                    }
+                }
 
                 if (siteBooking.getHalfName().equals(halfName)){
                     for (String s : split) {

--
Gitblit v1.7.1