From eb6b6dbb35a9f029e0b7d269773685c19fd40976 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 11 七月 2024 10:47:51 +0800
Subject: [PATCH] 玩湃微信商户认证代码

---
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java |  130 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 115 insertions(+), 15 deletions(-)

diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java
index 8f39ecc..bf025a0 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java
@@ -12,6 +12,7 @@
 import com.dsh.course.feignClient.course.CoursePackagePaymentConfigClient;
 import com.dsh.course.feignClient.course.model.*;
 import com.dsh.course.model.AuditDiscount;
+import com.dsh.guns.config.UserExt;
 import com.dsh.guns.core.base.controller.BaseController;
 import com.dsh.guns.core.base.tips.ErrorTip;
 import com.dsh.guns.core.base.tips.SuccessTip;
@@ -71,6 +72,7 @@
     public String index(Model model) {
         List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
         model.addAttribute("list",list);
+        model.addAttribute("role",UserExt.getUser().getObjectType());
         return PREFIX + "TDiscount.html";
     }
     @RequestMapping("/audit")
@@ -141,11 +143,13 @@
     private CoursePackageDiscountClient coursePackageDiscountClient;
     @RequestMapping("/info")
     public String info( Integer id, Model model) {
-        TCoursePackage tCoursePackage1 = courseClient.queryByDiscountId(id);
-        TCoursePackage tCoursePackage = coursePackageService.queryById(tCoursePackage1.getId());
+        TCoursePackage tCoursePackage = coursePackageService.queryById(id);
         model.addAttribute("item", tCoursePackage);
         List<CoursePackagePaymentConfig> list4 = coursePackagePaymentConfigClient.queryCoursePackagePaymentConfigList(id);
         List<Map<String, Object>> list = new ArrayList<>();
+        // 拒绝理由
+        StringBuilder reasons = new StringBuilder("");
+        int a =0;
         for (CoursePackagePaymentConfig coursePackagePaymentConfig : list4) {
             if(coursePackagePaymentConfig.getCashPayment() == 0){
                 continue;
@@ -162,29 +166,69 @@
             }
             map.put("payment",  payment);
             map.put("cashPayment", coursePackagePaymentConfig.getCashPayment());
+
             List<TCoursePackageDiscount> tCoursePackageDiscounts = coursePackageDiscountClient.queryCoursePackageDiscount(coursePackagePaymentConfig.getId());
+            for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) {
+                if (tCoursePackageDiscount.getAuditStatus()==3){
+                    a = 3;
+                    model.addAttribute("type1",3);
+                    break;
+                }else if (tCoursePackageDiscount.getAuditStatus()==2){
+                    a=2;
+                    model.addAttribute("type1",-1);
+                }else{
+                    a=1;
+                    model.addAttribute("type1",-1);
+                    break;
+                }
+            }
+            for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) {
+                if (tCoursePackageDiscount.getAuditStatus()==3){
+                    reasons.append(tCoursePackageDiscount.getAuditRemark()+",");
+                }
+            }
             map.put("coursePackageDiscount", tCoursePackageDiscounts);
             list.add(map);
         }
+        model.addAttribute("role",UserExt.getUser().getObjectType());
+        Integer type1 = tCoursePackage.getType();
+        // 审核状态
+        StringBuilder stringBuilder = new StringBuilder("");
+
+        switch (a){
+            case 1:
+                stringBuilder.append("待审核");
+                break;
+            case 2:
+                stringBuilder.append("已通过");
+                break;
+            case 3:
+                stringBuilder.append("未通过");
+                break;
+        }
+        model.addAttribute("type",stringBuilder);
+
+        String string = reasons.toString();
+        if (!string.equals("")){
+            int index = string.indexOf(",");
+            String result = string.substring(0, index);
+            model.addAttribute("reasons", result);
+        }else{
+            model.addAttribute("reasons", "");
+        }
         model.addAttribute("coursePackagePaymentConfig", JSON.toJSONString(list));
+        model.addAttribute("type2",tCoursePackage.getType());
         return PREFIX + "coursePackageDiscount.html";
     }
     @RequestMapping("/infoOne")
     public String infoOne( Integer id, Model model) {
-        Integer state = courseClient.queryDiscountById(id);
-        if(state==1){
-            model.addAttribute("stateStr","待审核");
-            model.addAttribute("state",1);
-        }else {
-            model.addAttribute("stateStr","未通过");
-            model.addAttribute("state",3);
-        }
-
-        TCoursePackage tCoursePackage1 = courseClient.queryByDiscountId(id);
-        TCoursePackage tCoursePackage = coursePackageService.queryById(tCoursePackage1.getId());
+        TCoursePackage tCoursePackage = coursePackageService.queryById(id);
         model.addAttribute("item", tCoursePackage);
         List<CoursePackagePaymentConfig> list4 = coursePackagePaymentConfigClient.queryCoursePackagePaymentConfigList(id);
         List<Map<String, Object>> list = new ArrayList<>();
+        // 拒绝理由
+        StringBuilder reasons = new StringBuilder("");
+        int a =0;
         for (CoursePackagePaymentConfig coursePackagePaymentConfig : list4) {
             if(coursePackagePaymentConfig.getCashPayment() == 0){
                 continue;
@@ -201,11 +245,59 @@
             }
             map.put("payment",  payment);
             map.put("cashPayment", coursePackagePaymentConfig.getCashPayment());
-            List<TCoursePackageDiscount> tCoursePackageDiscounts = coursePackageDiscountClient.queryCoursePackageDiscountOne(coursePackagePaymentConfig.getId());
+
+            List<TCoursePackageDiscount> tCoursePackageDiscounts = coursePackageDiscountClient.queryCoursePackageDiscount(coursePackagePaymentConfig.getId());
+            for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) {
+                if (tCoursePackageDiscount.getAuditStatus()==3){
+                    a = 3;
+                    model.addAttribute("type1",3);
+                    break;
+                }else if (tCoursePackageDiscount.getAuditStatus()==2){
+                    a=2;
+                    model.addAttribute("type1",-1);
+                }else{
+                    a=1;
+                    model.addAttribute("type1",-1);
+                    break;
+                }
+            }
+            for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) {
+                if (tCoursePackageDiscount.getAuditStatus()==3){
+                    reasons.append(tCoursePackageDiscount.getAuditRemark()+",");
+                }
+            }
             map.put("coursePackageDiscount", tCoursePackageDiscounts);
             list.add(map);
         }
+        model.addAttribute("role",UserExt.getUser().getObjectType());
+        Integer type1 = tCoursePackage.getType();
+        // 审核状态
+        StringBuilder stringBuilder = new StringBuilder("");
+
+        switch (a){
+            case 1:
+                stringBuilder.append("待审核");
+                break;
+            case 2:
+                stringBuilder.append("已通过");
+                break;
+            case 3:
+                stringBuilder.append("未通过");
+                break;
+        }
+        model.addAttribute("type",stringBuilder);
+
+        String string = reasons.toString();
+        if (!string.equals("")){
+            int index = string.indexOf(",");
+            String result = string.substring(0, index);
+            model.addAttribute("reasons", result);
+        }else{
+            model.addAttribute("reasons", "");
+        }
         model.addAttribute("coursePackagePaymentConfig", JSON.toJSONString(list));
+        model.addAttribute("type2",tCoursePackage.getType());
+
         return PREFIX1 + "coursePackageDiscount.html";
     }
 
@@ -217,9 +309,17 @@
         if(ToolUtil.isNotEmpty(shopName)){
             wrapper.like(TStore::getName, shopName);
         }
+        if(UserExt.getUser().getObjectType()==3){
+            wrapper.eq(TStore::getId, UserExt.getUser().getObjectId());
+        }
+        if(UserExt.getUser().getObjectType()==2){
+            wrapper.eq(TStore::getOperatorId, UserExt.getUser().getObjectId());
+        }
         List<TStore> list = storeService.list(wrapper);
         Page<DiscountList> page = new PageFactory<DiscountList>().defaultPage();
-        List<DiscountList> discountLists = courseClient.queryDiscountList(new QueryDiscountList(page.getCurrent(),page.getSize(),provinceCode,cityCode,name,type,list.stream().map(TStore::getId).collect(Collectors.toList())));
+        List<DiscountList> discountLists = courseClient.queryDiscountList(new QueryDiscountList
+                (page.getCurrent(),page.getSize(),provinceCode,cityCode,name,type,
+                        list.stream().map(TStore::getId).collect(Collectors.toList())));
         for (DiscountList discountList : discountLists) {
             for (TStore tStore : list) {
                 if(discountList.getStoreId().equals(tStore.getId())){

--
Gitblit v1.7.1