Explorar o código

去掉无用模块代码

zoujiajian hai 1 ano
pai
achega
0d1d12d949
Modificáronse 100 ficheiros con 0 adicións e 22684 borrados
  1. 0 143
      netflix-web/src/main/java/com/cyksj/web/controller/advertisement/AdvertisementOrderDonController.java
  2. 0 51
      netflix-web/src/main/java/com/cyksj/web/controller/advertisement/AdvertisementPopularizeController.java
  3. 0 140
      netflix-web/src/main/java/com/cyksj/web/controller/advertisement/AdvertisementUserController.java
  4. 0 163
      netflix-web/src/main/java/com/cyksj/web/controller/channel/ChannelController.java
  5. 0 383
      netflix-web/src/main/java/com/cyksj/web/controller/coupon/CouponFrontController.java
  6. 0 107
      netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsApplyMoneyController.java
  7. 0 277
      netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsBackLoginController.java
  8. 0 222
      netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsDistribtueDataController.java
  9. 0 431
      netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsPopularizeController.java
  10. 0 182
      netflix-web/src/main/java/com/cyksj/web/controller/distribute/DistributeRankController.java
  11. 0 261
      netflix-web/src/main/java/com/cyksj/web/controller/distribute/EquipmentDistributeController.java
  12. 0 137
      netflix-web/src/main/java/com/cyksj/web/controller/external/ExternalController.java
  13. 0 96
      netflix-web/src/main/java/com/cyksj/web/controller/fission/UserMirrorFissionController.java
  14. 0 1367
      netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java
  15. 0 55
      netflix-web/src/main/java/com/cyksj/web/controller/gpt/ChatGptController.java
  16. 0 107
      netflix-web/src/main/java/com/cyksj/web/controller/group/GroupController.java
  17. 0 1197
      netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java
  18. 0 47
      netflix-web/src/main/java/com/cyksj/web/controller/group/MidJourneyGuideController.java
  19. 0 101
      netflix-web/src/main/java/com/cyksj/web/controller/information/InformationController.java
  20. 0 98
      netflix-web/src/main/java/com/cyksj/web/controller/invoice/UserInvoiceFrontController.java
  21. 0 54
      netflix-web/src/main/java/com/cyksj/web/controller/kf/CorpKfAppletController.java
  22. 0 42
      netflix-web/src/main/java/com/cyksj/web/controller/landing/CorpFollowActiveCodeController.java
  23. 0 304
      netflix-web/src/main/java/com/cyksj/web/controller/manage/AdminController.java
  24. 0 1244
      netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java
  25. 0 54
      netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsUserComplaintController.java
  26. 0 531
      netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsUserController.java
  27. 0 274
      netflix-web/src/main/java/com/cyksj/web/controller/manage/account/AccountTempController.java
  28. 0 1397
      netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java
  29. 0 410
      netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsGptCarController.java
  30. 0 151
      netflix-web/src/main/java/com/cyksj/web/controller/manage/active/UserActivityController.java
  31. 0 39
      netflix-web/src/main/java/com/cyksj/web/controller/manage/advertisement/CmsAdvertisementOrderDonController.java
  32. 0 86
      netflix-web/src/main/java/com/cyksj/web/controller/manage/advertisement/CmsAdvertisementPopularizeController.java
  33. 0 61
      netflix-web/src/main/java/com/cyksj/web/controller/manage/advertisement/CmsAdvertisementProjectController.java
  34. 0 38
      netflix-web/src/main/java/com/cyksj/web/controller/manage/advertisement/CmsAdvertisementUserController.java
  35. 0 102
      netflix-web/src/main/java/com/cyksj/web/controller/manage/article/ArticleController.java
  36. 0 110
      netflix-web/src/main/java/com/cyksj/web/controller/manage/benefits/UserBenefitsController.java
  37. 0 103
      netflix-web/src/main/java/com/cyksj/web/controller/manage/channel/CmsChannelController.java
  38. 0 163
      netflix-web/src/main/java/com/cyksj/web/controller/manage/channel/CmsChannelPopularizeController.java
  39. 0 316
      netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/CmsAdminUserController.java
  40. 0 123
      netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/CmsMenuController.java
  41. 0 142
      netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/CmsRoleController.java
  42. 0 35
      netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/CmsSysController.java
  43. 0 34
      netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/interceptor/StpInterfaceImpl.java
  44. 0 251
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CmsCorpFollowActiveCodeController.java
  45. 0 65
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpChatController.java
  46. 0 196
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpCustomerAcquistionLinkController.java
  47. 0 93
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpCustomerAcquistionLinkPopularizeController.java
  48. 0 131
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpInteractiveRadarController.java
  49. 0 130
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgAuditController.java
  50. 0 311
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgBulkTaskController.java
  51. 0 99
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgFollowController.java
  52. 0 225
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpTagController.java
  53. 0 41
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpUserController.java
  54. 0 138
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpWelcomeTemplateController.java
  55. 0 337
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/wxkf/CorpKfController.java
  56. 0 86
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/wxkf/CorpKfMsgController.java
  57. 0 550
      netflix-web/src/main/java/com/cyksj/web/controller/manage/coupon/CouponController.java
  58. 0 1340
      netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java
  59. 0 114
      netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributePosterController.java
  60. 0 128
      netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/EquipmentController.java
  61. 0 142
      netflix-web/src/main/java/com/cyksj/web/controller/manage/exchange/ExchangeCodeController.java
  62. 0 114
      netflix-web/src/main/java/com/cyksj/web/controller/manage/feedback/UserFeedbackController.java
  63. 0 185
      netflix-web/src/main/java/com/cyksj/web/controller/manage/form/FormController.java
  64. 0 94
      netflix-web/src/main/java/com/cyksj/web/controller/manage/form/QuestionnairePromotionController.java
  65. 0 208
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonCategoryController.java
  66. 0 264
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonController.java
  67. 0 276
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSkuController.java
  68. 0 128
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSpecController.java
  69. 0 301
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonWholeSaleController.java
  70. 0 119
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/GiftCardController.java
  71. 0 145
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/GoodsDonQuestionController.java
  72. 0 94
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/GoodsDonSkuSubsidyController.java
  73. 0 96
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/RegisterGoodsDonController.java
  74. 0 536
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/CmsYhShopGoodsController.java
  75. 0 171
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopGoodsController.java
  76. 0 172
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopLoginController.java
  77. 0 294
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopUserController.java
  78. 0 408
      netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupController.java
  79. 0 262
      netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupRelationController.java
  80. 0 158
      netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupsRelationExpiryController.java
  81. 0 93
      netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsHomeGroupController.java
  82. 0 80
      netflix-web/src/main/java/com/cyksj/web/controller/manage/gzh/GzhController.java
  83. 0 185
      netflix-web/src/main/java/com/cyksj/web/controller/manage/home/HomeManageConfigController.java
  84. 0 203
      netflix-web/src/main/java/com/cyksj/web/controller/manage/information/CmsInformationController.java
  85. 0 60
      netflix-web/src/main/java/com/cyksj/web/controller/manage/invoice/UserInvoiceController.java
  86. 0 141
      netflix-web/src/main/java/com/cyksj/web/controller/manage/market/LuckyDrawController.java
  87. 0 42
      netflix-web/src/main/java/com/cyksj/web/controller/manage/market/SignController.java
  88. 0 159
      netflix-web/src/main/java/com/cyksj/web/controller/manage/market/TaskController.java
  89. 0 105
      netflix-web/src/main/java/com/cyksj/web/controller/manage/mirror/CmsClaudeController.java
  90. 0 97
      netflix-web/src/main/java/com/cyksj/web/controller/manage/mirror/CmsMirrorController.java
  91. 0 234
      netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/UserMirrorShopController.java
  92. 0 180
      netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/manage/CmsUserMirrorNoticeController.java
  93. 0 159
      netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/manage/CmsUserMirrorShopController.java
  94. 0 231
      netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/manage/CmsUserMirrorShopDataController.java
  95. 0 173
      netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/manage/CmsUserMirrorShopLoginController.java
  96. 0 181
      netflix-web/src/main/java/com/cyksj/web/controller/manage/mj/MidJourneyController.java
  97. 0 107
      netflix-web/src/main/java/com/cyksj/web/controller/manage/mj/MidjourneyPaintingController.java
  98. 0 212
      netflix-web/src/main/java/com/cyksj/web/controller/manage/register/CmsRegisterController.java
  99. 0 132
      netflix-web/src/main/java/com/cyksj/web/controller/manage/renew/RenewUpgradePackageController.java
  100. 0 130
      netflix-web/src/main/java/com/cyksj/web/controller/manage/shop/ShopConfigController.java

+ 0 - 143
netflix-web/src/main/java/com/cyksj/web/controller/advertisement/AdvertisementOrderDonController.java

@@ -1,143 +0,0 @@
-package com.cyksj.web.controller.advertisement;
-
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Codec;
-import com.cyksj.common.util.IoKit;
-import com.cyksj.common.util.Xmls;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayApiCode;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.WxAppMapper;
-import com.cyksj.model.dto.H5JsPayParams;
-import com.cyksj.model.entity.AdvertisementOrderDon;
-import com.cyksj.model.entity.AdvertisementUser;
-import com.cyksj.model.entity.WxApp;
-import com.cyksj.model.request.WeChatPayRequest;
-import com.cyksj.model.views.PaySuccessViews;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.advertisement.AdvertisementOrderDonService;
-import com.cyksj.service.advertisement.AdvertisementUserService;
-import com.cyksj.web.util.StpUserUtil;
-import lombok.NonNull;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.OutputStream;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Stream;
-
-/**
- * @author chan
- * @date 2023/5/16 11:49 AM
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/applets/advertisement/order")
-public class AdvertisementOrderDonController {
-
-    private static final String OPEN_KEY = "openKey";
-    
-    private final HttpServletRequest request;
-    
-    private final AdvertisementUserService advertisementUserService;
-
-    private final AdvertisementOrderDonService advertisementOrderDonService;
-    
-    private final WxAppMapper wxAppMapper;
-    
-
-    @PostMapping("/post/pay")
-    public Result<H5JsPayParams> pay(@RequestBody @Validated WeChatPayRequest weChatPayRequest) throws Exception {
-        final String methodName = "广告投放微信支付";
-        BigDecimal donMoney = weChatPayRequest.getDonMoney();
-        log.info("{}[start] donMoney:{} params:{}", methodName, donMoney, weChatPayRequest);
-
-        if (StringUtils.isBlank(weChatPayRequest.getAppId())) {
-            throw BusinessRuntimeException.getInstance("缺少必填参数appId");
-        }
-        WxApp wxApp = wxAppMapper.selectOne(Wrappers.lambdaQuery(WxApp.class).eq(WxApp::getAppId, weChatPayRequest.getAppId()));
-        if (wxApp == null) {
-            throw BusinessRuntimeException.getInstance("app不存在.");
-        }
-        AdvertisementOrderDon.Source source;
-        AdvertisementUser user;
-        if ("小程序".equals(wxApp.getCategory())) {
-            
-            //小程序支付
-            user = advertisementUserService.getById(StpUserUtil.getLoginIdAsLong());
-            source = AdvertisementOrderDon.Source.Mini_Program;
-        }else {
-
-            source = AdvertisementOrderDon.Source.WeChat;
-            AtomicReference<String> openKey = new AtomicReference<>();
-            Cookie[] cookies = request.getCookies();
-            Stream.of(cookies).forEach((cookie) -> {
-                if (StringUtils.equals(cookie.getName(), OPEN_KEY)) {
-                    openKey.set(cookie.getValue());
-                }
-            });
-            if (StringUtils.isBlank(openKey.get())) {
-                throw BusinessRuntimeException.getInstance("您还未授权.");
-            }
-            String payOpenId = Codec.DoBase64.custom().setData(openKey.get()).decodeAsText();
-
-            user = new AdvertisementUser();
-            user.setOpenId(payOpenId);
-            user.setId(0L);
-        }
-        
-      
-        H5JsPayParams payParams = advertisementOrderDonService.pay(weChatPayRequest.getPopularizeId()
-                , donMoney.setScale(0, RoundingMode.DOWN), weChatPayRequest.getAppId(), user, source
-                , weChatPayRequest.getCallback(), weChatPayRequest.getCallbackType());
-
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult(payParams);
-    }
-
-    @GetMapping("/isPay/{orderId}")
-    public Result<PaySuccessViews> isPay(@PathVariable @NonNull Long orderId) {
-        return GatewayResponse.SUCCESS.newBuilder().toResult(advertisementOrderDonService.isPay(orderId));
-    }
-
-    @PostMapping("/prepay/notify")
-    public void prepayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
-
-        String xml = IoKit.toString(request.getInputStream());
-        log.info("=== 微信支付的回调: \n {}", xml);
-
-        // 解析xml
-        Map<String, String> map = Xmls.toMap(xml);
-
-        // 支付失败
-        if (!StringUtils.equals("SUCCESS", map.get("return_code")) || !StringUtils.equals("SUCCESS", map.get("result_code"))) {
-            throw BusinessRuntimeException.getInstance("支付失败.");
-        }
-
-        advertisementOrderDonService.prepayNotify(map);
-        String toWeChatXmlResponse = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
-
-        OutputStream out = null;
-        try {
-            out = response.getOutputStream();
-            IoKit.write(toWeChatXmlResponse, out);
-        } catch (Throwable e) {
-            throw new BusinessRuntimeException(e,"微信支付回调错误.");
-        } finally {
-            IoKit.close(out);
-        }
-    }
-}

+ 0 - 51
netflix-web/src/main/java/com/cyksj/web/controller/advertisement/AdvertisementPopularizeController.java

@@ -1,51 +0,0 @@
-package com.cyksj.web.controller.advertisement;
-
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.AdvertisementPopularize;
-import com.cyksj.model.entity.AdvertisementProject;
-import com.cyksj.model.views.AdvertisementPopularizeView;
-import com.cyksj.service.advertisement.AdvertisementPopularizeService;
-import com.cyksj.service.advertisement.AdvertisementProjectService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author chan
- * @date 2023/5/16 11:49 AM
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/applets/advertisement/popularize")
-public class AdvertisementPopularizeController {
-
-    private final AdvertisementPopularizeService advertisementPopularizeService;
-
-    private final AdvertisementProjectService advertisementProjectService;
-
-    @GetMapping("/{id}")
-    public Result<AdvertisementPopularizeView> get(@PathVariable Long id){
-        log.info("--------广告投放 链接获取详情------ \nid id:{}",id);
-        AdvertisementPopularize popularize = advertisementPopularizeService.getById(id);
-        if (popularize == null) {
-            throw BusinessRuntimeException.getInstance("链接不存在.");
-        }
-        AdvertisementProject project = advertisementProjectService.getById(popularize.getProjectId());
-
-        AdvertisementPopularizeView view = new AdvertisementPopularizeView();
-        view.setId(popularize.getId());
-        view.setName(project.getName());
-        view.setDetail(project.getDetail());
-        view.setSuccessImg(project.getSuccessImg());
-        view.setMoney(project.getMoney());
-        view.setImg(project.getImg());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(view);
-    }
-
-}

+ 0 - 140
netflix-web/src/main/java/com/cyksj/web/controller/advertisement/AdvertisementUserController.java

@@ -1,140 +0,0 @@
-package com.cyksj.web.controller.advertisement;
-
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.snowflake.Sequence;
-import com.cyksj.common.util.Codec;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.enums.WeChatAuthRedirectUrl;
-import com.cyksj.model.dto.AuthRedirect;
-import com.cyksj.model.dto.AuthToken;
-import com.cyksj.model.dto.UserWhoami;
-import com.cyksj.model.entity.AdvertisementUser;
-import com.cyksj.model.request.MiniProgramLoginPost;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.advertisement.AdvertisementUserService;
-import com.cyksj.service.wechat.WeChatService;
-import com.cyksj.web.util.StpUserUtil;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author chan
- * @date 2023/5/16 11:49 AM
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/applets/advertisement/user")
-public class AdvertisementUserController {
-
-    @Value("${advertisementwxapp.notify}")
-    private String notify;
-
-    @Value("${advertisementwxapp.appId}")
-    private String appId;
-
-    private final static Sequence SEQUENCE = new Sequence(0);
-
-    private final AdvertisementUserService advertisementUserService;
-
-    private final RedisService redisService;
-
-
-    private final WeChatService weChatService;
-
-    /**
-     * 小程序静默授权
-     */
-    @PostMapping(value = "/login")
-    @Transactional(rollbackFor = Exception.class)
-    public Result<String> wxlogin(@RequestBody MiniProgramLoginPost miniDataParams) throws Exception{
-        String methodName = "小程序静默授权";
-        log.info("{}[start] params:{}",methodName,miniDataParams);
-
-        if (StringUtils.isBlank(miniDataParams.getCode())) {
-            throw BusinessRuntimeException.getInstance("需要登录凭证code.");
-        }
-
-        final String code = miniDataParams.getCode();
-
-        // 用户token
-        AdvertisementUser user = advertisementUserService.wxlogin(code,miniDataParams.getAppId());
-        StpUserUtil.login(user.getId());
-
-        log.info("{}[end] uuid:{}",methodName, user.getId());
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult(StpUserUtil.getTokenValue());
-
-    }
-
-    @GetMapping(value = "/whoami")
-    public Result<UserWhoami> whoami(){
-        AdvertisementUser user = advertisementUserService.getById(StpUserUtil.getLoginIdAsLong());
-
-        UserWhoami userWhoami = advertisementUserService.whoami(user.getId());
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult(userWhoami);
-    }
-
-
-
-    @GetMapping(value = "/weChat")
-    public void base(String url, String authType, HttpServletResponse response) throws Exception {
-
-        log.info("微信授权转跳. url: {},authType:{}",url,authType);
-
-        // 无论是否为老用户 均转跳到授权页面
-        // 若授权过 则无需再次授权 直接回调 /user/wechat/redirect
-        // 新用户同意授权后 也会回调 /user/wechat/redirect
-
-        Long mappingId = SEQUENCE.nextId();
-        redisService.set(mappingId.toString(),url,60*60*24L);
-        AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId);
-        String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
-
-        response.sendRedirect(weChatService.createUrl(state, notify + "/applets/advertisement/user/weChat/silentRedirect", appId, WeChatAuthRedirectUrl.get(authType).getScope() ));
-
-    }
-
-    /**
-     * 静默授权
-     * @author chan
-     * @date 2021-10-11 上午11:58
-     */
-    @GetMapping("/weChat/silentRedirect")
-    @Transactional(rollbackFor = Throwable.class)
-    public void redirectV2(String code, String state, HttpServletResponse response) throws Exception {
-
-        // 转跳参数
-        String json = Codec.DoBase64.custom().setData(state).decodeAsText();
-        AuthRedirect re = Jsons.parseObject(json, AuthRedirect.class);
-
-        AuthToken token = weChatService.getAuthToken(code,appId);
-
-        //  查询用户期望转跳的url
-        String url = redisService.getStr(re.getMappingId().toString());
-        String data = Codec.DoBase64.custom().setData(token.getOpenid()).encodeAsText();
-
-        Cookie cookie = new Cookie("openKey",data);
-        cookie.setMaxAge(31536000);
-        cookie.setPath("/");
-        response.addCookie(cookie);
-
-        log.info("微信授权转跳. url: {}",url);
-        response.sendRedirect(url);
-
-    }
-
-
-
-
-}

+ 0 - 163
netflix-web/src/main/java/com/cyksj/web/controller/channel/ChannelController.java

@@ -1,163 +0,0 @@
-package com.cyksj.web.controller.channel;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.channel.ChannelPopularizeMapper;
-import com.cyksj.mapper.channel.ChannelPopularizeVisitMapper;
-import com.cyksj.mapper.channel.MoviesVisitRecordMapper;
-import com.cyksj.mapper.manage.coupon.CouponSkuMapper;
-import com.cyksj.mapper.sys.SysConfigMapper;
-import com.cyksj.model.entity.ChannelPopularizeVisit;
-import com.cyksj.model.entity.MoviesVisitRecord;
-import com.cyksj.model.entity.SysConfig;
-import com.cyksj.model.manage.dto.ChannelBaiDuDiscountDto;
-import com.cyksj.model.views.ChannelPopularizeFrontView;
-import com.cyksj.model.views.CouponTfPopularizeView;
-import com.cyksj.service.corp.CorpCustomerAcquistionService;
-import com.cyksj.web.util.StpUserUtil;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * @author chan
- * @date 2022/12/13 2:36 PM
- */
-@RequestMapping("/applets/channel")
-@RestController
-@RequiredArgsConstructor
-@Slf4j
-public class ChannelController {
-
-    private final HttpServletResponse response;
-
-    private final ChannelPopularizeVisitMapper channelPopularizeVisitMapper;
-
-    private final ChannelPopularizeMapper popularizeMapper;
-
-    private final MoviesVisitRecordMapper moviesVisitRecordMapper;
-
-    private final BeanSearcher beanSearcher;
-
-    private final CouponSkuMapper couponSkuMapper;
-
-    private final CorpCustomerAcquistionService corpCustomerAcquistionService;
-
-    private final SysConfigMapper sysConfigMapper;
-
-
-
-    @GetMapping("/get/{id}")
-    public Result<ChannelPopularizeFrontView> getById(@PathVariable Long id) {
-        ChannelPopularizeFrontView channelPopularize = beanSearcher.searchFirst(ChannelPopularizeFrontView.class, MapUtils.builder()
-                .put("id", String.format("id = %s", id))
-                .build());
-
-        if (channelPopularize == null) {
-            throw BusinessRuntimeException.getInstance("该链接不存在!");
-        }
-        if (StrUtil.isNotBlank(channelPopularize.getCouponIds())) {
-            try {
-                List<Long> couponIds = Jsons.parseList(channelPopularize.getCouponIds(), Long.class);
-                Long userId = StpUserUtil.getUserIdAfterLogin();
-                MapBuilder builder = MapUtils.builder().field(CouponTfPopularizeView::getCouponId, couponIds).op(Operator.InList);
-                if (userId != null) {
-                    builder.put("user_id", String.format("and cu.user_id = %s", userId));
-                }
-                List<CouponTfPopularizeView> couponTfPopularizeViews = beanSearcher.searchAll(CouponTfPopularizeView.class, builder.build());
-                couponTfPopularizeViews.forEach(data -> {
-                    String str = couponSkuMapper.selectGoodsSkuStr(data.getCouponId());
-                    data.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
-                });
-                channelPopularize.setCoupons(couponTfPopularizeViews);
-            } catch (Exception e) {
-                System.out.println(e.getMessage());
-            }
-        }
-        String channelName = channelPopularize.getChannelName();
-        if (channelName.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(0)) || channelName.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(1))) {
-            String key;
-            if (channelName.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(0))) {
-                key = Constant.CHANNEL_BAIDU_DISCOUNT_KEY;
-            } else {
-                key = Constant.CHANNEL_DY_DISCOUNT_KEY;
-            }
-            SysConfig baiduConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
-                    .eq(SysConfig::getSysKey, key).last("limit 1"));
-            if (baiduConfig != null) {
-                String sysValue = baiduConfig.getSysValue();
-                if (StrUtil.isNotBlank(sysValue)) {
-                    try {
-                        ChannelBaiDuDiscountDto baiDuDiscountDto = Jsons.parseObject(sysValue, ChannelBaiDuDiscountDto.class);
-                        if (baiDuDiscountDto != null && CollUtil.isNotEmpty(baiDuDiscountDto.getPopularizeIds()) && baiDuDiscountDto.getPopularizeIds().contains(id)) {
-                            channelPopularize.setIsSign(true);
-                            channelPopularize.setDiscount(baiDuDiscountDto.getDiscount());
-                        }
-                    } catch (Exception e) {
-                    }
-                }
-            }
-        }
-        ChannelPopularizeVisit channelPopularizeVisit = new ChannelPopularizeVisit();
-        channelPopularizeVisit.setPopularizeId(id);
-        channelPopularizeVisitMapper.insert(channelPopularizeVisit);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(channelPopularize);
-    }
-
-    /**
-     * 记录银河电影浏览量
-     */
-    @PostMapping("/movies/record/")
-    public Result<String> moviesVisitRecord() {
-        MoviesVisitRecord moviesVisitRecord = new MoviesVisitRecord();
-        moviesVisitRecord.setType(MoviesVisitRecord.Type.movies);
-        moviesVisitRecordMapper.insert(moviesVisitRecord);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 橙子建站带参跳转获客链接
-     */
-    @GetMapping("/customerAcquistion")
-    public void customerAcquistion(String projectid, String clickid, String callback, Long linkId) throws Exception {
-        log.info("橙子建站带参跳转获客链接 projectid:{} clickid:{},callback:{}", projectid, clickid, callback);
-        if (StrUtil.equals(projectid, "__PROJECT_ID__") && StrUtil.equals(clickid, "__CLICKID__") && linkId != null && linkId == 5) {
-            response.sendRedirect("https://www.chengzijianzhan.com/tetris/page/7321557902601240626/");
-            return;
-        }
-        String key = corpCustomerAcquistionService.saveClickid(projectid, clickid, callback, linkId);
-        String url = corpCustomerAcquistionService.getUrlByLinkId(linkId);
-
-        String redirect = url + "?customer_channel=" + "customer_" + key;
-        log.info("橙子建站带参跳转获客链接 跳转路径:{}", redirect);
-        response.sendRedirect(redirect);
-    }
-
-    /**
-     * 动态客服 链接
-     * acLinkId 获客链接id
-     */
-    @GetMapping("/customerAcquistion/{acLinkId}")
-    public void getCustomerAcquistionById(@PathVariable Long acLinkId) throws Exception {
-        log.info("动态客服获客链接跳转 acLinkId:{}", acLinkId);
-
-        String url = corpCustomerAcquistionService.getActiveCustomerAcquistionById(acLinkId);
-
-        String redirect = url + "?customer_channel=" + "customer_" + acLinkId;
-        log.info("动态客服获客链接 跳转路径:{}", redirect);
-        response.sendRedirect(redirect);
-    }
-}

+ 0 - 383
netflix-web/src/main/java/com/cyksj/web/controller/coupon/CouponFrontController.java

@@ -1,383 +0,0 @@
-package com.cyksj.web.controller.coupon;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.manage.coupon.CouponMapper;
-import com.cyksj.mapper.manage.coupon.CouponRecommendMapper;
-import com.cyksj.mapper.manage.coupon.CouponSkuMapper;
-import com.cyksj.mapper.manage.coupon.CouponUserMapper;
-import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
-import com.cyksj.mapper.manage.distribute.UserDistributeSharedMapper;
-import com.cyksj.model.dto.CouponPopularizeDto;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.request.ChannelPopularizeCouponReq;
-import com.cyksj.model.request.CouponCollectReq;
-import com.cyksj.model.views.*;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.coupon.CouponFontService;
-import com.cyksj.web.util.StpUserUtil;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/*
- *项目名: netflix
- *文件名: CouponFrontController
- *创建者: JavaZou
- *创建时间:2022/11/18 10:56
- */
-@RestController
-@RequestMapping("/applet/coupon")
-@RequiredArgsConstructor
-public class CouponFrontController {
-	private final CouponUserMapper couponUserMapper;
-
-	private final BeanSearcher beanSearcher;
-
-	private final CouponFontService couponFontService;
-
-	private final RedisService redisService;
-
-	private final CouponSkuMapper couponSkuMapper;
-
-	private final CouponMapper couponMapper;
-
-	private final UserDistributeMapper userDistributeMapper;
-
-	private final CouponRecommendMapper couponRecommendMapper;
-
-	private final UserDistributeSharedMapper userDistributeSharedMapper;
-
-	private final UserMapper userMapper;
-
-	/**
-	 * 优惠券领取中心列表
-	 */
-	@GetMapping("/center/list")
-	public Result<Page<CouponActiveView>> couponCenterList(@RequestParam(defaultValue = "1") Long start, @RequestParam(defaultValue = "5") Long limit) {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		Page<CouponActiveView> page = couponUserMapper.couponCenterList(userId, new Page<>(start, limit));
-		page.getRecords().forEach(data -> {
-			String str = couponSkuMapper.selectGoodsSkuStr(data.getCouponId());
-			data.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
-			List<CouponSkuView> couponSkus = couponSkuMapper.getGoodsSkuByCouponId(data.getCouponId());
-			try {
-				data.setGoodsSkuIds(Jsons.toJson(couponSkus));
-			} catch (Exception e) {
-
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
-	}
-
-	/**
-	 * 个人优惠券列表
-	 */
-	@GetMapping("/personal/list")
-	public Result<Page<CouponUserView>> couponPersonalList(@RequestParam(defaultValue = "1") Long start, @RequestParam(defaultValue = "5") Long limit, Long couponId) {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		Page<CouponUserView> page = couponUserMapper.couponPersonalList(userId, new Page<>(start, limit), couponId);
-		page.getRecords().forEach(data -> {
-			String str = couponSkuMapper.selectGoodsSkuStr(data.getCouponId());
-			data.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
-			List<CouponSkuView> couponSkus = couponSkuMapper.getGoodsSkuByCouponId(data.getCouponId());
-			try {
-				data.setGoodsSkuIds(Jsons.toJson(couponSkus));
-			} catch (Exception e) {
-
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
-	}
-
-	/**
-	 * 可用优惠券展示数量
-	 */
-	@GetMapping("/available/num")
-	public Result<Integer> availableCouponNum(Long skuId, Boolean isRenew) {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		Long goodsId = null;
-		//实物还是虚物
-		GoodsDonSkuView goodsDonSkuView = beanSearcher.searchFirst(GoodsDonSkuView.class, MapUtils.builder().field(GoodsDonSkuView::getSkuId, skuId).op(Operator.Equal).build());
-		if (goodsDonSkuView == null) {
-			throw BusinessRuntimeException.getInstance("规格不存在");
-		}
-		BigDecimal skuMoney = goodsDonSkuView.getMoney();
-		if (goodsDonSkuView.getType() == 2) {
-			goodsId = goodsDonSkuView.getGoodsId();
-		}
-		List<CouponUserView> couponUserViews = couponUserMapper.countAvailableCouponList(goodsId, skuId, userId, isRenew);
-		Integer total = couponUserViews.size();
-		if (goodsDonSkuView.getType() == 2) {
-			List<CouponUserView> collect = couponUserViews.stream().filter(coupon -> {
-				if (coupon.getType() == Coupon.Type.reduce && skuMoney.compareTo(coupon.getReduceCondition()) < 0) {
-					return false;
-				}
-				return true;
-			}).collect(Collectors.toList());
-			total = collect.size();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(total);
-	}
-
-	@GetMapping("/available/list")
-	public Result<Page<CouponUserView>> availableCouponList(Long skuId, Long couponId, Boolean isRenew, @RequestParam(defaultValue = "1") Long start, @RequestParam(defaultValue = "5") Long limit) {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		Page<CouponUserView> couponActiveViewList = couponFontService.getAvailableCouponList(skuId, couponId, userId, isRenew, start, limit);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(couponActiveViewList);
-	}
-
-	/**
-	 * 推荐优惠券列表
-	 */
-	@GetMapping("/recommend/list")
-	public Result<Page<CouponRecommendView>> getRecommendList(@RequestParam(defaultValue = "1") Long start, @RequestParam(defaultValue = "5") Long limit, Long couponId) {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		CouponNewUserView couponNewUserView = beanSearcher.searchFirst(CouponNewUserView.class, MapUtils.builder().field(CouponNewUserView::getUserId, userId).op(Operator.Equal).build());
-		Boolean isNewUser = true;
-		if (couponNewUserView != null) {
-			isNewUser = false;
-		}
-		Page<CouponRecommendView> page = couponRecommendMapper.getRecommendCouponViewList(userId, isNewUser, new Page<>(start, limit), couponId);
-		page.getRecords().forEach(data -> {
-			if (data.getCouponStatus() == CouponActiveView.CouponStatus.received) {
-				data.setValidStartTime(data.getUserValidStartTime());
-				data.setValidEndTime(data.getUserValidEndTime());
-			}
-			String str = couponSkuMapper.selectGoodsSkuStr(data.getCouponId());
-			data.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
-			List<CouponSkuView> couponSkus = couponSkuMapper.getGoodsSkuByCouponId(data.getCouponId());
-			try {
-				data.setGoodsSkuIds(Jsons.toJson(couponSkus));
-			} catch (Exception e) {
-
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
-	}
-
-	/**
-	 * 一键领取推荐优惠券
-	 */
-	@PostMapping("/collect/recommend/whole")
-	@NoSubmit
-	public Result<String> collectWholeRecommendCoupon() {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		couponFontService.collectWholeRecommendCoupon(userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("领取成功");
-	}
-
-	/**
-	 * 今日推荐优惠券弹窗已弹
-	 */
-	@GetMapping("/get/recommend/appear")
-	public Result<Boolean> recommendIsAppear() {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		String zero = DateUtil.beginOfDay(DateTime.now()).toString();
-		Object exists = redisService.get(RedisService.key.RECOMMEND_COUPON_DAY.getNameFormat(String.format("%s-%s", zero, userId)));
-		if (exists == null) {
-			redisService.set(RedisService.key.RECOMMEND_COUPON_DAY.getNameFormat(String.format("%s-%s", zero, userId)), userId, RedisService.key.RECOMMEND_COUPON_DAY.getTimeout());
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(exists == null ? false : true);
-	}
-
-	/**
-	 * 领取优惠券
-	 */
-	@PostMapping("/collect")
-	public Result<String> collectCoupon(@RequestBody CouponCollectReq couponCollectReq) {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		couponFontService.collectCoupon(couponCollectReq, userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("领取优惠券成功");
-	}
-
-	/**
-	 * 领取推荐优惠券
-	 */
-	@PostMapping("/recommend/collect")
-	public Result<String> collectRecommendCoupon(@RequestBody CouponCollectReq couponCollectReq) {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		couponFontService.collectRecommendCoupon(couponCollectReq, userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("领取优惠券成功");
-	}
-
-	/**
-	 * 查询有可以领取的推荐优惠券
-	 */
-	@GetMapping("/recommend/collect/num")
-	public Result<Integer> collectRecommendCouponNum() {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		CouponNewUserView couponNewUserView = beanSearcher.searchFirst(CouponNewUserView.class, MapUtils.builder().field(CouponNewUserView::getUserId, userId).op(Operator.Equal).build());
-		Boolean isNewUser = true;
-		if (couponNewUserView != null) {
-			isNewUser = false;
-		}
-		Integer num = couponFontService.collectRecommendCouponNum(userId, isNewUser);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(num);
-	}
-
-
-	/**
-	 * 优惠码详情
-	 */
-	@GetMapping("/get/exCode/detail")
-	public Result<CouponPopularizeDto> getExCodeDetail(Long skuId, String exCode, Boolean isRenew) {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		GoodsDonSkuView goodsDonSkuView = beanSearcher.searchFirst(GoodsDonSkuView.class, MapUtils.builder().field(GoodsDonSkuView::getSkuId, skuId).op(Operator.Equal).build());
-		if (goodsDonSkuView == null) {
-			throw BusinessRuntimeException.getInstance("该规格不存在");
-		}
-		BigDecimal skuMoney = goodsDonSkuView.getMoney();
-		if (goodsDonSkuView.getType() == 2) {
-			throw BusinessRuntimeException.getInstance("实物不支持使用优惠码");
-		}
-		CouponPopularizeDto dto = couponMapper.checkExCode(exCode);
-		if (dto == null) {
-			throw BusinessRuntimeException.getInstance("该优惠码不存在");
-		}
-		if (dto.getIsGeneral() != null) {
-			if (dto.getIsGeneral() && userId.equals(dto.getUserId())) {
-				throw BusinessRuntimeException.getInstance("不可以使用自己的优惠码");
-			}
-			if (!dto.getIsGeneral()) {
-				UserDistribute userDistribute = userDistributeMapper.selectById(dto.getDistributeId());
-				if (userDistribute != null && userDistribute.getUserId().equals(userId)) {
-					throw BusinessRuntimeException.getInstance("不可以使用自己的优惠码");
-				}
-			}
-			//是否有上下级关系
-			if (dto.getIsGeneral()) {
-				UserDistributeShared userDistributeShared = userDistributeSharedMapper.selectOne(Wrappers.lambdaQuery(UserDistributeShared.class)
-						.eq(UserDistributeShared::getUserId, userId).last("limit 1"));
-				if (userDistributeShared == null) {
-					//是否是 当天注册新用户 且下过单
-					User user = userMapper.selectById(userId);
-					if (user.getCreatedTime().before(DateUtil.beginOfDay(DateTime.now()))) {
-						throw BusinessRuntimeException.getInstance("该优惠码只适用于新用户");
-					}
-					CouponNewUserView couponNewUserView = beanSearcher.searchFirst(CouponNewUserView.class, MapUtils.builder().field(CouponNewUserView::getUserId, userId).op(Operator.Equal).build());
-					if (couponNewUserView != null) throw BusinessRuntimeException.getInstance("该优惠码只适用于新用户");
-				}
-				if (userDistributeShared != null && !userDistributeShared.getSharedId().equals(dto.getUserId())) {
-					throw BusinessRuntimeException.getInstance("您已有推广,无法使用其他人推广码");
-				}
-			}
-		}
-		if (dto.getScope() == Coupon.Scope.newUser) {
-			CouponNewUserView couponNewUserView = beanSearcher.searchFirst(CouponNewUserView.class, MapUtils.builder().field(CouponNewUserView::getUserId, userId).op(Operator.Equal).build());
-			if (couponNewUserView != null) {
-				throw BusinessRuntimeException.getInstance("该优惠码只适用于新用户");
-			}
-		}
-		if (isRenew != null && isRenew) {
-			Coupon.UseScope useScope = dto.getUseScope();
-			if (useScope == Coupon.UseScope.orders) {
-				throw BusinessRuntimeException.getInstance("该优惠码续费时不可使用");
-			}
-		}
-		if (isRenew == null || !isRenew) {
-			Coupon.UseScope useScope = dto.getUseScope();
-			if (useScope == Coupon.UseScope.renew) {
-				throw BusinessRuntimeException.getInstance("该优惠码下单时不可使用");
-			}
-		}
-		if (dto.getIsValidTime() && dto.getValidStartTime().after(DateTime.now())) {
-			throw BusinessRuntimeException.getInstance("该优惠码待生效");
-		}
-		if (dto.getIsValidTime() && dto.getValidEndTime().before(DateTime.now())) {
-			throw BusinessRuntimeException.getInstance("该优惠码已失效");
-		}
-		CouponSku couponSku = couponSkuMapper.selectOne(Wrappers.lambdaQuery(CouponSku.class)
-				.eq(CouponSku::getSkuId, skuId)
-				.eq(CouponSku::getCouponId, dto.getCouponId())
-				.select(CouponSku::getId).last("limit 1"));
-		if (couponSku == null) {
-			throw BusinessRuntimeException.getInstance("该优惠码不适用于该规格");
-		}
-		if (goodsDonSkuView.getType() == 2) {
-			if (dto.getType() == Coupon.Type.reduce && skuMoney.compareTo(dto.getReduceCondition()) < 0) {
-				throw BusinessRuntimeException.getInstance(String.format("满%s可用", dto.getReduceCondition().divide(BigDecimal.valueOf(100))));
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(dto);
-	}
-
-	/**
-	 * 查询优惠券
-	 */
-	@GetMapping("/get/couponList")
-	public Result<List<CouponView>> getCouponList(@RequestParam(value = "couponIds") List<Long> couponIds) {
-		if (couponIds.isEmpty()) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		List<CouponView> couponViews = beanSearcher.searchAll(CouponView.class, MapUtils.builder()
-				.field(CouponView::getId, couponIds).op(Operator.InList)
-				.orderBy(CouponView::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(couponViews);
-	}
-
-	/**
-	 * 渠道推广用户领取优惠券
-	 */
-	@PostMapping("/channel/popularize/receive")
-	public Result<String> receiveChannelPopularizeCoupon(@RequestBody @Validated ChannelPopularizeCouponReq req) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		req.setUserId(userId);
-		couponFontService.receiveChannelPopularizeCoupon(req);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("领取成功");
-	}
-
-	/**
-	 * 渠道推广一键领取优惠券
-	 */
-	@PostMapping("/channel/popularize/collectAll/{popularizeId}")
-	public Result<String> collectAllChannelCoupons(@PathVariable Long popularizeId) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		couponFontService.collectAllChannelCoupons(userId, popularizeId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("领取成功");
-	}
-
-	/**
-	 * 新用户福利 优惠券详情展示
-	 */
-	@GetMapping("/get/newUser/welfare")
-	public Result<CouponUserView> getNewUserWelfare() {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		DateTime now = DateTime.now();
-		CouponUserView couponUserView = couponFontService.getNewUserWelfareCoupons(userId, now);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(couponUserView);
-	}
-
-	@GetMapping("/get/coupon/detail/{couponId}")
-	public Result<CouponUserView> getCouponDetailById(@PathVariable Long couponId) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		CouponUserView couponUserView = couponFontService.getCouponDetailById(userId, couponId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(couponUserView);
-	}
-
-	/**
-	 * 领取优惠券
-	 */
-	@PostMapping("/receive/coupon/{couponId}")
-	public Result<CouponUserView> receiveCoupon(@PathVariable Long couponId) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		CouponUserView couponUserView = couponFontService.receiveCoupon(userId, couponId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(couponUserView);
-	}
-}

+ 0 - 107
netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsApplyMoneyController.java

@@ -1,107 +0,0 @@
-package com.cyksj.web.controller.cps;
-
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.manage.distribute.DistributeMoneyApplyMapper;
-import com.cyksj.model.entity.User;
-import com.cyksj.model.request.ApplyMoneyReq;
-import com.cyksj.model.views.CpsApplyMoneyView;
-import com.cyksj.model.views.CpsDistributeSubView;
-import com.cyksj.model.views.UserDistributeSubDetailView;
-import com.cyksj.model.views.UserSubApplyMoneyDetailView;
-import com.cyksj.service.pay.TransferFuncService;
-import com.cyksj.web.util.StpCpsManageUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-
-/**
- * cps后台/提现中心
- * 项目名: yhlxj
- * 文件名: CpsApplyMoneyController
- * 创建者: JavaZou
- * 创建时间:2023/10/31 15:26
- */
-@RestController
-@RequestMapping("/cps/manage/applyMoney")
-@RequiredArgsConstructor
-public class CpsApplyMoneyController {
-	private final TransferFuncService transferFuncService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final DistributeMoneyApplyMapper distributeMoneyApplyMapper;
-
-	private final UserMapper userMapper;
-
-	private final HttpServletRequest request;
-
-	/**
-	 * cps用户提现
-	 */
-	@PostMapping
-	public Result<String> applyMoney(@RequestBody ApplyMoneyReq applyMoneyReq) throws Exception {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		applyMoneyReq.setUserId(cpsUserId);
-		return transferFuncService.distributeApply(applyMoneyReq);
-	}
-
-	/**
-	 * 提现列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<CpsApplyMoneyView>> getApplyMoneyList() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		SearchResult<CpsApplyMoneyView> search = beanSearcher.search(CpsApplyMoneyView.class,
-				MapUtils.flatBuilder(request.getParameterMap())
-						.field(CpsApplyMoneyView::getUserId, cpsUserId)
-						.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 渠道关于下级渠道提现详情
-	 */
-	@GetMapping("/get/sub/applyMoney/detail")
-	public Result<UserSubApplyMoneyDetailView> getSubApplyMoneyDetail() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		UserSubApplyMoneyDetailView userSubApplyMoneyDetailView = new UserSubApplyMoneyDetailView();
-		BigDecimal gotMoney = distributeMoneyApplyMapper.getSubGotAppyMoney(cpsUserId);
-		userSubApplyMoneyDetailView.setGotMoney(gotMoney);
-		User user = userMapper.selectById(cpsUserId);
-		userSubApplyMoneyDetailView.setCanApplyMoney(user.getSubApplyMoney());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userSubApplyMoneyDetailView);
-	}
-
-	/**
-	 * 下级渠道数据
-	 */
-	@GetMapping("/get/sub")
-	public Result<SearchResult<CpsDistributeSubView>> getSubDistributeData() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("uid", String.format("user_id = %s", cpsUserId));
-		SearchResult<CpsDistributeSubView> search = beanSearcher.search(CpsDistributeSubView.class, builder.build());
-		search.getDataList().forEach(data -> {
-			data.setDetailView(beanSearcher.searchFirst(UserDistributeSubDetailView.class, MapUtils.builder().put("sid", data.getSubUserId()).build()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 下级渠道奖金提现
-	 */
-	@PostMapping("/sub")
-	public Result<String> subApplyMoney(@RequestBody ApplyMoneyReq applyMoneyReq) throws Exception {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		applyMoneyReq.setUserId(cpsUserId);
-		return transferFuncService.subApplyMoney(applyMoneyReq);
-	}
-}

+ 0 - 277
netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsBackLoginController.java

@@ -1,277 +0,0 @@
-package com.cyksj.web.controller.cps;
-
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.http.HttpUtil;
-import cn.hutool.json.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Assert;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.snowflake.Sequence;
-import com.cyksj.common.util.Codec;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.config.wxlogin.WxOpenPlatYHLXLoginConfig;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.CpsUserGuideRecordMapper;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.manage.cps.CpsUserAdRecordMapper;
-import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
-import com.cyksj.mapper.manage.distribute.equipment.UserDistributeEquipmentMapper;
-import com.cyksj.mapper.sys.SysConfigMapper;
-import com.cyksj.model.dto.AuthRedirect;
-import com.cyksj.model.dto.AuthToken;
-import com.cyksj.model.dto.CpsAuthDto;
-import com.cyksj.model.dto.GzhOAuth2UserInfo;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.request.LoginReq;
-import com.cyksj.model.response.GoogleLoginRep;
-import com.cyksj.model.response.UserAuthLoginResp;
-import com.cyksj.model.views.UserInfoView;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.authorization.AuthorizationService;
-import com.cyksj.service.cps.CpsManageService;
-import com.cyksj.service.user.UserService;
-import com.cyksj.service.wechat.WeChatService;
-import com.cyksj.web.util.StpCpsManageUser;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.HashMap;
-import java.util.Optional;
-
-/*
- *项目名: netflix
- *文件名: CpsBackLoginController
- *创建者: JavaZou
- *创建时间:2023/5/12 11:00
- */
-@RestController
-@RequestMapping("/cps/manage")
-@RequiredArgsConstructor
-@Slf4j
-public class CpsBackLoginController {
-	private final CpsManageService cpsManageService;
-
-	private final RedisService redisService;
-
-	private final static Sequence SEQUENCE = new Sequence(0);
-
-	private final WxOpenPlatYHLXLoginConfig wxOpenPlatYHLXLoginConfig;
-
-	private final AuthorizationService authorizationService;
-
-	private final WeChatService weChatService;
-
-	private final UserMapper userMapper;
-
-	private final UserDistributeMapper userDistributeMapper;
-
-	private final UserDistributeEquipmentMapper userDistributeEquipmentMapper;
-
-	private final CpsUserAdRecordMapper cpsUserAdRecordMapper;
-
-	private final SysConfigMapper sysConfigMapper;
-
-	private final CpsUserGuideRecordMapper cpsUserGuideRecordMapper;
-
-	private final HttpServletRequest request;
-
-	private final UserService userService;
-
-	/**
-	 * 获取登录验证码
-	 */
-	@GetMapping("/get/LoginCode")
-	@NoSubmit
-	public Result getLoginCode(@RequestParam(defaultValue = "1") Integer type, String login, Integer cid) {
-		cpsManageService.getLoginCode(type, login, cid);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 手机号、邮箱登录
-	 */
-	@PostMapping("/login")
-	public Result login(@RequestBody LoginReq loginReq) {
-		User user = cpsManageService.login(loginReq.getType(), loginReq.getLogin(), loginReq.getCode());
-		StpCpsManageUser.login(user.getId());
-		String cpsToken = StpCpsManageUser.getTokenValue();
-		JSONObject re = new JSONObject();
-		re.putOpt("satoken-cpsUser", cpsToken);
-		re.putOpt("img", user.getHeadimgurl());
-		re.putOpt("nickname", user.getNickname());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(re.toString());
-	}
-
-	/**
-	 * cps后台微信授权登录
-	 */
-	@GetMapping("/wx/authLogin")
-	public Result<CpsAuthDto> wxAuthorize(String redirectUrl) throws Exception {
-		CpsAuthDto cpsAuthDto = new CpsAuthDto();
-		Long mappingId = SEQUENCE.nextId();
-		String authState = mappingId.toString();
-		redisService.set(authState, authState, 60 * 60 * 24L);
-		AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId);
-		redirect.setUrl(redirectUrl);
-		String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
-		String wxAuthUrl = authorizationService.createWxAuthLoginUrl(state, wxOpenPlatYHLXLoginConfig.getAppId(), wxOpenPlatYHLXLoginConfig.getCpsRedirectUri());
-		cpsAuthDto.setAuthUrl(wxAuthUrl);
-		cpsAuthDto.setAuthState(authState);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(cpsAuthDto);
-	}
-
-	/**
-	 * 网页微信授权后跳转
-	 */
-	@GetMapping("/wx/authLogin/baseRedirect")
-	public void wxAuthLoginRedirect(String code, String state, HttpServletResponse response) throws Exception {
-		if (StrUtil.isEmpty(state)) throw BusinessRuntimeException.getInstance("授权错误,请重新授权");
-		String json = Codec.DoBase64.custom().setData(state).decodeAsText();
-		AuthRedirect re = Jsons.parseObject(json, AuthRedirect.class);
-		AuthToken token = weChatService.getAuthToken(code, wxOpenPlatYHLXLoginConfig.getAppId());
-		GzhOAuth2UserInfo userinfo = weChatService.getUserInfo(token.getAccessToken(), token.getOpenid());
-		String unionId = userinfo.getUnionid();
-		String openId = userinfo.getOpenid();
-		User user = Optional.ofNullable(
-				userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getUnionid, unionId)
-						.orderByAsc(User::getId)
-						.last("limit 1")))
-				.orElseGet(() -> userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getOpenId, openId)
-						.orderByAsc(User::getId)
-						.last("limit 1")));
-		if (user == null) throw BusinessRuntimeException.getInstance("用户信息不存在");
-		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, user.getId()).eq(UserDistribute::getDeleted, 1).select(UserDistribute::getId).last("limit 1"));
-		if (userDistribute == null) throw BusinessRuntimeException.getInstance("只支持渠道分销用户登录");
-		StpCpsManageUser.login(user.getId());
-		String cpsToken = StpCpsManageUser.getTokenValue();
-		String url = re.getUrl();
-		if (StrUtil.isNotBlank(url)) {
-			response.sendRedirect(url.contains("?") ? url + "&t=" + cpsToken : url + "?t=" + cpsToken);
-			return;
-		}
-		JSONObject res = new JSONObject();
-		res.putOpt("satoken-cpsUser", cpsToken);
-		res.putOpt("img", user.getHeadimgurl());
-		res.putOpt("nickname", user.getNickname());
-		redisService.set(RedisService.key.CPS_AUTH_SUCCESS_KEY.getNameFormat(re.getMappingId()), res.toString(), RedisService.key.CPS_BACK_LOGIN_KEY.getTimeout());
-		response.sendRedirect(wxOpenPlatYHLXLoginConfig.getCpsLoginUrl());
-	}
-
-	/**
-	 * 用户是否已授权
-	 */
-	@GetMapping("/get/userInfo")
-	public Result<String> getCpsUserInfo(String authState) {
-		String key = RedisService.key.CPS_AUTH_SUCCESS_KEY.getNameFormat(authState);
-		Object o = redisService.get(key);
-		if (o == null) return GatewayResponse.SUCCESS.newBuilder().toResult();
-		redisService.del(key);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(o.toString());
-	}
-
-	/**
-	 * 广告弹窗是否展示
-	 */
-	@GetMapping("/get/ad")
-	public Result<String> getAd() {
-		String key = Constant.CPS_AD_KEY;
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		CpsUserAdRecord cpsUserAdRecord = cpsUserAdRecordMapper.selectOne(Wrappers.lambdaQuery(CpsUserAdRecord.class)
-				.eq(CpsUserAdRecord::getUserId, cpsUserId)
-				.eq(CpsUserAdRecord::getSysKey, key)
-				.last("limit 1"));
-		if (cpsUserAdRecord == null) {
-			SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
-					.eq(SysConfig::getSysKey, key).last("limit 1"));
-			if (sysConfig != null){
-				cpsUserAdRecord = new CpsUserAdRecord();
-				cpsUserAdRecord.setUserId(cpsUserId);
-				cpsUserAdRecord.setSysKey(key);
-				cpsUserAdRecordMapper.insert(cpsUserAdRecord);
-				return GatewayResponse.SUCCESS.newBuilder().toResult(sysConfig.getSysValue());
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 获取cps用户基本信息
-	 */
-	@GetMapping("/get/redirect/userInfo")
-	public Result<UserInfoView> getUserInfoView() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		User user = userMapper.selectById(cpsUserId);
-		Assert.notNull(user, "用户不存在");
-		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, user.getId()).eq(UserDistribute::getDeleted, 1).select(UserDistribute::getId, UserDistribute::getIsPoster).last("limit 1"));
-		Assert.notNull(userDistribute, "只支持渠道分销用户登录");
-		UserInfoView userInfoView = new UserInfoView();
-		userInfoView.setImg(user.getHeadimgurl());
-		userInfoView.setNickname(user.getNickname());
-		Integer selectCount = userDistributeEquipmentMapper.selectCount(Wrappers.lambdaQuery(UserDistributeEquipment.class)
-				.eq(UserDistributeEquipment::getUserId, cpsUserId));
-		userInfoView.setIsEp(selectCount > 0 ? true : false);
-		userInfoView.setIsPoster(userDistribute.getIsPoster());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userInfoView);
-	}
-
-	/**
-	 * 是否首次进入cps后台
-	 */
-	@GetMapping("/get/first")
-	public Result<Boolean> firstLogin() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-
-		Integer selectCount = cpsUserGuideRecordMapper.selectCount(Wrappers.lambdaQuery(CpsUserGuideRecord.class)
-				.eq(CpsUserGuideRecord::getUserId, cpsUserId));
-		Boolean flag = false;
-		if (selectCount == 0) {
-			CpsUserGuideRecord cpsUserGuideRecord = new CpsUserGuideRecord();
-			cpsUserGuideRecord.setUserId(cpsUserId);
-			cpsUserGuideRecordMapper.insert(cpsUserGuideRecord);
-			flag = true;
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(flag);
-	}
-
-	/**
-	 * cps谷歌授权登录
-	 */
-	@PostMapping("/google/login")
-	public Result<UserAuthLoginResp> googleLogin(LoginReq loginReq, String credential) throws Exception {
-		log.info("google loginReq:{},credential:{}", loginReq, credential);
-		String result = HttpUtil.post("https://galaxyva.com/8081/api/auth/google/login/inner?credential=" + credential, new HashMap<>());
-		log.info("google result:{}", result);
-		GoogleLoginRep googleLoginRep = Jsons.parseObject(Jsons.toMap(result).get("data"), GoogleLoginRep.class);
-		loginReq.setType(3);
-		loginReq.setEmail(googleLoginRep.getEmail());
-		loginReq.setSubject(googleLoginRep.getSubject());
-		User user = userService.webLogin(loginReq, request);
-
-		//是否非cps分销用户
-		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class)
-				.eq(UserDistribute::getUserId, user.getId())
-				.eq(UserDistribute::getDeleted, 1).last("limit 1"));
-		if (userDistribute == null) {
-			throw BusinessRuntimeException.getInstance("只支持分销用户登录");
-		}
-
-		Optional.ofNullable(user.getIsBlack())
-				.ifPresent(black -> {
-					if (black) {
-						throw BusinessRuntimeException.getInstance("您的账号已被注销...");
-					}
-				});
-		//写回登陆信息
-		StpCpsManageUser.login(user.getId());
-		UserAuthLoginResp loginPhoneRep = new UserAuthLoginResp(StpCpsManageUser.getTokenValue(), user.getShowId(), user.getNickname(), user.getHeadimgurl());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(loginPhoneRep);
-	}
-}

+ 0 - 222
netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsDistribtueDataController.java

@@ -1,222 +0,0 @@
-package com.cyksj.web.controller.cps;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonMapper;
-import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.views.*;
-import com.cyksj.service.cps.CpsManageService;
-import com.cyksj.web.util.StpCpsManageUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- * 项目名: yhlxj2
- * 文件名: CpsDistribtueDataController
- * 创建者: JavaZou
- * 创建时间:2024/3/19 11:42
- * 分销数据控制层
- */
-@RestController
-@RequestMapping("/cps/manage")
-@RequiredArgsConstructor
-public class CpsDistribtueDataController {
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final GoodsDonMapper goodsDonMapper;
-
-	private final CpsManageService cpsManageService;
-
-	private final UserDistributeMapper userDistributeMapper;
-
-	/**
-	 * 个人分销平台数据详情
-	 */
-	@GetMapping("/get/distribute/detail")
-	public Result<CpsUserDistributeDetailView> getDistributeDetail() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		User user = beanSearcher.searchFirst(User.class, MapUtils.builder().field(User::getId, cpsUserId).onlySelect(User::getPoints).build());
-		BigDecimal thresholdPoints = BigDecimal.valueOf(1000);
-		BigDecimal wApplyMoney = user.getPoints().divide(thresholdPoints, 2, RoundingMode.DOWN);
-		//已提现
-		Number gotApplyMoney = beanSearcher.searchSum(DistributeMoneyApply.class, MapUtils.builder()
-				.field(DistributeMoneyApply::getUserId, cpsUserId)
-				.field(DistributeMoneyApply::getVerifyStatus, DistributeMoneyApply.Status.success.name())
-				.field(DistributeMoneyApply::getMType, DistributeMoneyApply.MType.ds.name())
-				.build(), "money");
-		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class)
-				.eq(UserDistribute::getUserId, cpsUserId)
-				.eq(UserDistribute::getDeleted, 1)
-				.last("limit 1"));
-		Number reMoneyPoints = beanSearcher.searchSum(DistributeWaitingSendPoints.class, MapUtils.builder().field(DistributeWaitingSendPoints::getSharedId, cpsUserId).field(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.success.name()).build(), "points");
-		Number wMoneyPoints = beanSearcher.searchSum(DistributeWaitingSendPoints.class, MapUtils.builder().field(DistributeWaitingSendPoints::getSharedId, cpsUserId).field(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.waiting.name()).build(), "points");
-		List<UserDistributeRateView> rateViews = beanSearcher.searchAll(UserDistributeRateView.class, MapUtils.builder()
-				.put("distribute_id", String.format("and distribute_id = (select id from user_distribute where user_id = %s and deleted is true limit 1)", cpsUserId))
-				.field(UserSkuDistributeView::getRate).op(Operator.NotNull)
-				.orderBy(UserDistributeRateView::getRate).desc()
-				.build());
-		CpsUserDistributeDetailView detailView = new CpsUserDistributeDetailView();
-		Map<String, List<UserDistributeRateView>> collect = rateViews.stream().filter(ct -> StrUtil.isNotBlank(ct.getCategoryName())).collect(Collectors.groupingBy(UserDistributeRateView::getCategoryName));
-
-		List<UserSkuDistributeView> skuRates = beanSearcher.searchAll(UserSkuDistributeView.class, MapUtils.builder()
-				.put("dis_id", String.format(" and up.distribute_id = %s", userDistribute.getId()))
-				.field(UserSkuDistributeView::getRate).op(Operator.NotNull)
-				.orderBy(UserSkuDistributeView::getGoodsId).asc()
-				.build());
-		//规格分销
-		detailView.setSkuRates(skuRates);
-
-		detailView.setRateViews(collect);
-		detailView.setWMoney(BigDecimal.valueOf(wMoneyPoints.doubleValue()).divide(thresholdPoints, 2, RoundingMode.DOWN));
-		detailView.setReMoney(BigDecimal.valueOf(reMoneyPoints.doubleValue()).divide(thresholdPoints, 2, RoundingMode.DOWN));
-
-		detailView.setWApplyMoney(wApplyMoney);
-		detailView.setGotApplyMoney(BigDecimal.valueOf(gotApplyMoney.doubleValue()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(detailView);
-	}
-
-	/**
-	 * 待入账数据统计
-	 */
-	@GetMapping("/get/wMoney/statisticsData")
-	public Result<BrokenLineCpsUserWMoneyView> getWMoneyStatisticsDataView(Long firstDate, Long lastDate) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		DateTime first = null;
-		DateTime end = null;
-		if (firstDate != null) {
-			first = DateUtil.date(firstDate);
-		}
-		if (lastDate != null) {
-			end = DateUtil.date(lastDate);
-		}
-		BrokenLineCpsUserWMoneyView brokenLineCpsUserWMoneyView = Optional.ofNullable(cpsManageService.getWMoneyStatisticsDate(cpsUserId, first, end)).orElse(new BrokenLineCpsUserWMoneyView());
-		List<CpsUserWMoneyStatisticsDataView> dataView = cpsManageService.getWMoneyStatisticsDataView(cpsUserId, first, end);
-		brokenLineCpsUserWMoneyView.setDataView(dataView);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineCpsUserWMoneyView);
-	}
-
-	/**
-	 * 分销订单收入统计
-	 */
-	@GetMapping("/get/distribute/orders/statistics")
-	public Result<SearchResult<UserDistributeOrdersStatisticsView>> getUserDistributeOrdersStatisticsView(Long firstDate, Long lastDate) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		String first = null;
-		String end = null;
-		String timeSql = StrUtil.EMPTY;
-		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time >= '%s'", first);
-		}
-		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time < '%s'", end);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("sharedId", String.format("shared_id = %s", cpsUserId));
-		if (StrUtil.isNotEmpty(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		SearchResult<UserDistributeOrdersStatisticsView> search = beanSearcher.search(UserDistributeOrdersStatisticsView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 分销订单收入详细
-	 */
-	@GetMapping("/get/distribute/orders/detail")
-	public Result<SearchResult<UserDistributeOrdersDetailView>> getUserDistributeOrdersDetailView(Long firstDate, Long lastDate) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		String first = null;
-		String end = null;
-		String timeSql = StrUtil.EMPTY;
-		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time >= '%s'", first);
-		}
-		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time < '%s'", end);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("sharedId", String.format("shared_id = %s", cpsUserId));
-		if (StrUtil.isNotEmpty(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		SearchResult<UserDistributeOrdersDetailView> search = beanSearcher.search(UserDistributeOrdersDetailView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 分销商品列表
-	 */
-	@GetMapping("/get/goods")
-	public Result<List<GoodsDon>> getGoodsList() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		List<GoodsDon> goodsDons = goodsDonMapper.getDistributeGoodsDetail(cpsUserId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDons);
-	}
-
-	/**
-	 * 数据中心折线图
-	 */
-	@GetMapping("/get/data/brokenLine")
-	public Result<CpsOrderDataStatisticsView> getDataBrokenLine(Long firstDate, Long lastDate) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		String first = null;
-		String end = null;
-		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd");
-		}
-		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
-		}
-		CpsOrderDataStatisticsView brokenLineObjView = Optional.ofNullable(userDistributeMapper.selectOrderBrokenLineMoney(cpsUserId, first, end))
-				.orElse(new CpsOrderDataStatisticsView());
-
-		if (brokenLineObjView != null) {
-			String timeSql = StrUtil.EMPTY;
-			if (firstDate != null) {
-				first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
-				timeSql += String.format(" and o.created_time >= '%s'", first);
-			}
-			if (lastDate != null) {
-				end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
-				timeSql += String.format(" and o.created_time < '%s'", end);
-			}
-			MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-			builder.put("sharedId", String.format("shared_id = %s", cpsUserId));
-			if (StrUtil.isNotEmpty(timeSql)) {
-				builder.put("time", timeSql);
-			}
-			builder.put("sharedId", String.format("shared_id = %s", cpsUserId));
-			List<CpsOrderView> views = beanSearcher.searchAll(CpsOrderView.class,builder.build());
-			Map<Long, List<CpsOrderView>> goodsMap = views.stream().collect(Collectors.groupingBy(CpsOrderView::getGoodsId));
-			brokenLineObjView.setGoodsData(goodsMap);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineObjView);
-	}
-}

+ 0 - 431
netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsPopularizeController.java

@@ -1,431 +0,0 @@
-package com.cyksj.web.controller.cps;
-
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.extra.qrcode.QrCodeUtil;
-import cn.hutool.extra.qrcode.QrConfig;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.EnvCommonService;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.DistributePopularizeClickRecordMapper;
-import com.cyksj.mapper.GoodsDonMapper;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.mapper.UserDistributePosterRecordMapper;
-import com.cyksj.mapper.manage.coupon.CouponDistributePopularizeMapper;
-import com.cyksj.mapper.manage.distribute.*;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.views.CpsGoodsDonDistributeView;
-import com.cyksj.model.views.DistributePosterGoodsCpsView;
-import com.cyksj.model.views.UserDistributePopularizeView;
-import com.cyksj.model.views.UserDistributePosterOrderDetailView;
-import com.cyksj.service.cps.CpsPopularizeService;
-import com.cyksj.service.user.UserBindRelationService;
-import com.cyksj.service.user.UserService;
-import com.cyksj.web.util.StpCpsManageUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Optional;
-
-/*
- *项目名: netflix
- *文件名: CpsPopularizeController
- *创建者: JavaZou
- *创建时间:2023/5/15 15:03
- */
-@RestController
-@RequestMapping("/cps/manage/popularize")
-@RequiredArgsConstructor
-public class CpsPopularizeController {
-	private final CpsPopularizeService cpsPopularizeService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final EnvCommonService envCommonService;
-
-	private final CouponDistributePopularizeMapper couponDistributePopularizeMapper;
-
-	private final UserService userService;
-
-	private final GoodsDonMapper goodsDonMapper;
-
-	private final DistributePopularizeClickRecordMapper distributePopularizeClickRecordMapper;
-
-	private final UserDistributeMapper userDistributeMapper;
-
-	private final UserPlatDistributeRateMapper userPlatDistributeRateMapper;
-
-	private final GoodsDonSkuMapper skuMapper;
-
-	private final UserPlatSkuDistributeRateMapper userPlatSkuDistributeRateMapper;
-
-	private final DistributeGeneralSkuRateMapper distributeGeneralSkuRateMapper;
-
-	private final UserDistributePosterRecordMapper userDistributePosterRecordMapper;
-
-	private final DistributePosterGoodsMapper distributePosterGoodsMapper;
-
-	private final UserBindRelationService userBindRelationService;
-
-	private final BusinessDistributeDefaultRateConfigMapper businessDistributeDefaultRateConfigMapper;
-
-	private final BusinessDistributeDefaultSkuRateConfigMapper businessDistributeDefaultSkuRateConfigMapper;
-
-	/**
-	 * 渠道推广链接列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<UserDistributePopularizeView>> getList(String startTime, String endTime) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("userId", String.format("and user_id = %s", cpsUserId));
-		String time = StrUtil.EMPTY;
-		if (startTime != null) {
-			time += String.format(" and od.created_time >= '%s'", startTime);
-		}
-		if (endTime != null) {
-			time += String.format(" and od.created_time < '%s'", endTime);
-		}
-		if (StrUtil.isNotBlank(time)) {
-			builder.put("time", time);
-		}
-		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class)
-				.eq(UserDistribute::getUserId, cpsUserId)
-				.eq(UserDistribute::getDeleted, 1)
-				.last("limit 1"));
-		SearchResult<UserDistributePopularizeView> search = beanSearcher.search(UserDistributePopularizeView.class, builder.build());
-		search.getDataList().forEach(data -> {
-			data.setPopularizeLink(String.format(envCommonService.DISTRIBUTE_DEFAULT_URL_PREFIX, data.getCode()));
-			Optional.ofNullable(goodsDonMapper.selectById(data.getGoodsId())).ifPresent(goods -> {
-				data.setTitle(goods.getTitle());
-				data.setLogo(goods.getLogo());
-				data.setPrice(goods.getMinPrice());
-				UserPlatDistributeRate userPlatDistributeRate = userPlatDistributeRateMapper.selectOne(Wrappers.lambdaQuery(UserPlatDistributeRate.class)
-						.eq(UserPlatDistributeRate::getDistributeId, userDistribute.getId())
-						.eq(UserPlatDistributeRate::getGoodsId, data.getGoodsId())
-						.last("limit 1"));
-				if (userPlatDistributeRate != null) {
-					data.setRate(userPlatDistributeRate.getRate());
-				} else {
-					BusinessDistributeDefaultRateConfig businessDistributeDefaultRateConfig = businessDistributeDefaultRateConfigMapper.selectOne(Wrappers.lambdaQuery(BusinessDistributeDefaultRateConfig.class)
-							.eq(BusinessDistributeDefaultRateConfig::getGoodsId, data.getGoodsId())
-							.last("limit 1"));
-					if (businessDistributeDefaultRateConfig != null) {
-						data.setRate(businessDistributeDefaultRateConfig.getRate());
-					}
-				}
-				if (goods.getIsSkuDistribute()) {
-					UserPlatSkuDistributeRate userPlatSkuDistributeRate = userPlatSkuDistributeRateMapper.selectOne(Wrappers.lambdaQuery(UserPlatSkuDistributeRate.class)
-							.eq(UserPlatSkuDistributeRate::getDistributeId, userDistribute.getId())
-							.eq(UserPlatSkuDistributeRate::getGoodsId, data.getGoodsId())
-							.ne(UserPlatSkuDistributeRate::getRate, 0)
-							//上架
-							.apply("exists (select 1 from goods_don_sku sku where sku.id = sku_id and sku.status is true limit 1)")
-							.orderByAsc(UserPlatSkuDistributeRate::getRate)
-							.last("limit 1"));
-					if (userPlatSkuDistributeRate != null) {
-						data.setRate(userPlatSkuDistributeRate.getRate());
-					} else {
-						BusinessDistributeDefaultSkuRateConfig businessDistributeDefaultSkuRateConfig = businessDistributeDefaultSkuRateConfigMapper.selectOne(Wrappers.lambdaQuery(BusinessDistributeDefaultSkuRateConfig.class)
-								.eq(BusinessDistributeDefaultSkuRateConfig::getGoodsId, data.getGoodsId())
-								.gt(BusinessDistributeDefaultSkuRateConfig::getRate, 0)
-								.apply("exists (select 1 from goods_don_sku sku where sku.id = sku_id and sku.status is true limit 1)")
-								.orderByAsc(BusinessDistributeDefaultSkuRateConfig::getRate)
-								.last("limit 1"));
-						if (businessDistributeDefaultSkuRateConfig != null) {
-							data.setRate(businessDistributeDefaultSkuRateConfig.getRate());
-						}
-					}
-				}
-			});
-			data.setClickNum(distributePopularizeClickRecordMapper.selectCount(Wrappers.lambdaQuery(DistributePopularizeClickRecord.class)
-					.eq(DistributePopularizeClickRecord::getPopularizeId, data.getId())
-					.ge(startTime != null, DistributePopularizeClickRecord::getCreatedTime, startTime)
-					.lt(endTime != null, DistributePopularizeClickRecord::getCreatedTime, endTime)));
-			String link = data.getPopularizeLink();
-			if (data.getGoodsId() != null && data.getGoodsId() > 0) {
-				if (!envCommonService.isPrdEnv()) {
-					link += "/test/web";
-				}
-				link += "/?gid=" + data.getGoodsId();
-			}
-			data.setUrlCode(QrCodeUtil.generateAsBase64(link, QrConfig.create(), "png"));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 默认链接详情
-	 */
-	@GetMapping("/get/default")
-	public Result<UserDistributePopularizeView> getDefaultDetail(String startTime, String endTime) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		User user = userService.getById(cpsUserId);
-		UserDistributePopularizeView view = Optional.ofNullable(cpsPopularizeService.getDefaultPopularizeDetail(cpsUserId, startTime, endTime)).orElseGet(() -> {
-			UserDistributePopularizeView newPopularizeView = new UserDistributePopularizeView();
-			newPopularizeView.setOrders(0);
-			newPopularizeView.setOrdersMoney(BigDecimal.ZERO);
-			newPopularizeView.setWMoney(BigDecimal.ZERO);
-			newPopularizeView.setGotMoney(BigDecimal.ZERO);
-			return newPopularizeView;
-		});
-		if (StrUtil.isEmpty(user.getShowId())) {
-			user.setShowId(userService.getUserShowId(user.getId()));
-		}
-		view.setPopularizeLink(String.format(envCommonService.DISTRIBUTE_DEFAULT_URL_PREFIX, user.getShowId()));
-		//优惠码
-		view.setCouponCode(couponDistributePopularizeMapper.getCouponCodeByUid(cpsUserId));
-		view.setClickNum(distributePopularizeClickRecordMapper.selectCount(Wrappers.lambdaQuery(DistributePopularizeClickRecord.class).eq(DistributePopularizeClickRecord::getShowId, user.getShowId())));
-		view.setUrlCode(QrCodeUtil.generateAsBase64(view.getPopularizeLink(), QrConfig.create(), "png"));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(view);
-	}
-
-	/**
-	 * 新增推广链接
-	 */
-	@PostMapping("/post")
-	@NoSubmit
-	public Result<String> insert(@RequestBody UserDistributePopularize popularize) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		popularize.setUserId(cpsUserId);
-		cpsPopularizeService.insert(popularize);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(String.format("%s?dsCode=%s", envCommonService.getDomain2(), popularize.getCode()));
-	}
-
-	/**
-	 * 编辑推广链接
-	 */
-	@PutMapping("/put")
-	@NoSubmit
-	public Result<String> update(@RequestBody UserDistributePopularize popularize) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		popularize.setUserId(cpsUserId);
-		cpsPopularizeService.update(popularize);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除推广链接
-	 */
-	@DeleteMapping("/delete/{id}")
-	@NoSubmit
-	public Result<String> deleteById(@PathVariable Long id) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		cpsPopularizeService.deleteById(cpsUserId, id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 获取所有平台列表
-	 */
-	@GetMapping("/get/all/goods")
-	public Result<List<CpsGoodsDonDistributeView>> getAllGoodsList(Boolean isNoBuyout, Boolean isRate) {
-		Long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (isRate != null && isRate) {
-			builder.field(CpsGoodsDonDistributeView::getRate, 0).op(Operator.GreaterThan);
-		}
-		List<CpsGoodsDonDistributeView> list = beanSearcher.searchAll(CpsGoodsDonDistributeView.class, builder
-				.put("distribute_id", String.format("and distribute_id = (select id from user_distribute where user_id = %s and deleted is true limit 1)", cpsUserId))
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	/**
-	 * 复制客服活码链接
-	 * 用于cps用户实物分销
-	 */
-	@GetMapping("/get/service/code")
-	public Result<String> getServiceCodeUrl() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		return GatewayResponse.SUCCESS.newBuilder().toResult(cpsPopularizeService.getServiceCodeUrl(cpsUserId));
-	}
-
-
-	/**
-	 * 推广平台海报列表
-	 */
-	@GetMapping("/get/ds/poster/goods")
-	public Result<List<DistributePosterGoodsCpsView>> getPosterGoods(String startTime, String endTime) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class)
-				.eq(UserDistribute::getUserId, cpsUserId)
-				.eq(UserDistribute::getDeleted, 1)
-				.last("limit 1"));
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		StringBuilder time = new StringBuilder();
-		if (startTime != null) {
-			time.append(String.format(" and od.created_time >= '%s'", startTime));
-		}
-		if (endTime != null) {
-			time.append(String.format(" and od.created_time < '%s'", endTime));
-		}
-		List<Long> userIdList = userBindRelationService.getRelationUserIdList(cpsUserId, null);
-		List<DistributePosterGoodsCpsView> searchAll = beanSearcher.searchAll(DistributePosterGoodsCpsView.class, builder.build());
-		searchAll.forEach(e -> {
-			if (userDistribute != null) {
-				UserPlatDistributeRate userPlatDistributeRate = userPlatDistributeRateMapper.selectOne(Wrappers.lambdaQuery(UserPlatDistributeRate.class)
-						.eq(UserPlatDistributeRate::getDistributeId, userDistribute.getId())
-						.eq(UserPlatDistributeRate::getGoodsId, e.getGoodsId())
-						.last("limit 1"));
-				if (userPlatDistributeRate != null) {
-					e.setRate(userPlatDistributeRate.getRate());
-				} else {
-					BusinessDistributeDefaultRateConfig businessDistributeDefaultRateConfig = businessDistributeDefaultRateConfigMapper.selectOne(Wrappers.lambdaQuery(BusinessDistributeDefaultRateConfig.class)
-							.eq(BusinessDistributeDefaultRateConfig::getGoodsId, e.getGoodsId())
-							.last("limit 1"));
-					if (businessDistributeDefaultRateConfig != null) {
-						e.setRate(businessDistributeDefaultRateConfig.getRate());
-					}
-				}
-			}
-			if (e.getIsSkuRate()) {
-				GoodsDonSku sku = skuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class)
-						.eq(GoodsDonSku::getGoodsId, e.getGoodsId())
-						.eq(GoodsDonSku::getStatus, 1)
-						.orderByAsc(GoodsDonSku::getPrice)
-						.last("limit 1"));
-				//先获取价格最低的规格对应的 比例
-				//渠道
-				if (userDistribute != null) {
-					UserPlatSkuDistributeRate minPriceSkuRate = userPlatSkuDistributeRateMapper.selectOne(Wrappers.lambdaQuery(UserPlatSkuDistributeRate.class)
-							.eq(UserPlatSkuDistributeRate::getDistributeId, userDistribute.getId())
-							.eq(UserPlatSkuDistributeRate::getGoodsId, e.getGoodsId())
-							.eq(UserPlatSkuDistributeRate::getSkuId, sku.getId())
-							.last("limit 1"));
-					if (minPriceSkuRate != null && minPriceSkuRate.getRate() != 0) {
-						e.setRate(minPriceSkuRate.getRate());
-					} else {
-						UserPlatSkuDistributeRate userPlatSkuDistributeRate = userPlatSkuDistributeRateMapper.selectOne(Wrappers.lambdaQuery(UserPlatSkuDistributeRate.class)
-								.eq(UserPlatSkuDistributeRate::getDistributeId, userDistribute.getId())
-								.eq(UserPlatSkuDistributeRate::getGoodsId, e.getGoodsId())
-								.ne(UserPlatSkuDistributeRate::getRate, 0)
-								//上架
-								.apply("exists (select 1 from goods_don_sku sku where sku.id = sku_id and sku.status is true limit 1)")
-								.orderByAsc(UserPlatSkuDistributeRate::getRate)
-								.last("limit 1"));
-						if (userPlatSkuDistributeRate != null) {
-							e.setRate(userPlatSkuDistributeRate.getRate());
-							sku = skuMapper.selectById(userPlatSkuDistributeRate.getSkuId());
-							e.setPrice(sku.getPrice());
-						} else {
-							BusinessDistributeDefaultSkuRateConfig businessDistributeDefaultSkuRateConfig = businessDistributeDefaultSkuRateConfigMapper.selectOne(Wrappers.lambdaQuery(BusinessDistributeDefaultSkuRateConfig.class)
-									.eq(BusinessDistributeDefaultSkuRateConfig::getGoodsId, e.getGoodsId())
-									.gt(BusinessDistributeDefaultSkuRateConfig::getRate, 0)
-									.apply("exists (select 1 from goods_don_sku sku where sku.id = sku_id and sku.status is true limit 1)")
-									.orderByAsc(BusinessDistributeDefaultSkuRateConfig::getRate)
-									.last("limit 1"));
-							if (businessDistributeDefaultSkuRateConfig != null) {
-								e.setRate(businessDistributeDefaultSkuRateConfig.getRate());
-							}
-						}
-					}
-				} else {
-					//普通
-					DistributeGeneralSkuRate minPriceRate = distributeGeneralSkuRateMapper.selectOne(Wrappers.lambdaQuery(DistributeGeneralSkuRate.class)
-							.eq(DistributeGeneralSkuRate::getGoodsId, e.getGoodsId())
-							.eq(DistributeGeneralSkuRate::getSkuId, sku.getId())
-							.last("limit 1"));
-					if (minPriceRate != null && minPriceRate.getRate() > 0) {
-						e.setRate(minPriceRate.getRate());
-					} else {
-						DistributeGeneralSkuRate distributeGeneralSkuRate = distributeGeneralSkuRateMapper.selectOne(Wrappers.lambdaQuery(DistributeGeneralSkuRate.class)
-								.eq(DistributeGeneralSkuRate::getGoodsId, e.getGoodsId())
-								.apply("exists (select 1 from goods_don_sku sku where sku.id = sku_id and sku.status is true limit 1)")
-								.ne(DistributeGeneralSkuRate::getRate, 0)
-								.orderByAsc(DistributeGeneralSkuRate::getRate)
-								.last("limit 1"));
-						if (distributeGeneralSkuRate != null) {
-							e.setRate(distributeGeneralSkuRate.getRate());
-							sku = skuMapper.selectById(distributeGeneralSkuRate.getSkuId());
-							e.setPrice(sku.getPrice());
-						}
-					}
-				}
-			}
-
-			//用户推广海报订单详情
-			MapBuilder posterOrderBuilder = MapUtils.flatBuilder(request.getParameterMap());
-			if (time.length() > 0) {
-				posterOrderBuilder.put("time", time.toString());
-			}
-			UserDistributePosterOrderDetailView distributePosterOrderDetailView = beanSearcher.searchFirst(UserDistributePosterOrderDetailView.class, posterOrderBuilder.put("condition", String.format(String.format(" where user_id = %s and poster_id = %s", cpsUserId, e.getId()))).build());
-			if (distributePosterOrderDetailView != null) {
-				e.setOrdersMoney(distributePosterOrderDetailView.getOrdersMoney());
-				e.setOrders(distributePosterOrderDetailView.getOrders());
-				e.setWMoney(distributePosterOrderDetailView.getWMoney());
-				e.setGotMoney(distributePosterOrderDetailView.getGotMoney());
-				e.setClickNum(distributePopularizeClickRecordMapper.selectCount(Wrappers.lambdaQuery(DistributePopularizeClickRecord.class)
-						.eq(DistributePopularizeClickRecord::getRid, distributePosterOrderDetailView.getId())
-						.ge(startTime != null, DistributePopularizeClickRecord::getCreatedTime, startTime)
-						.lt(endTime != null, DistributePopularizeClickRecord::getCreatedTime, endTime)));
-			}
-
-			UserDistributePosterRecord distributePosterRecord = userDistributePosterRecordMapper.selectOne(Wrappers.lambdaQuery(UserDistributePosterRecord.class)
-					.eq(UserDistributePosterRecord::getPosterId, e.getId())
-					.in(UserDistributePosterRecord::getUserId, userIdList)
-					.last("limit 1"));
-			if (distributePosterRecord != null) {
-				e.setRid(distributePosterRecord.getId());
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(searchAll);
-	}
-
-
-	/**
-	 * 用户下载海报记录
-	 */
-	@PostMapping("/poster/record/{posterId}")
-	public Result<Long> posterRecord(@PathVariable Long posterId) {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		DistributePosterGoods distributePosterGoods = distributePosterGoodsMapper.selectById(posterId);
-		if (distributePosterGoods == null) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		UserDistributePosterRecord distributePosterRecord = new UserDistributePosterRecord();
-		distributePosterRecord.setPosterId(posterId);
-		distributePosterRecord.setUserId(cpsUserId);
-		try {
-			userDistributePosterRecordMapper.insert(distributePosterRecord);
-		} catch (DuplicateKeyException e) {
-			distributePosterRecord = userDistributePosterRecordMapper.selectOne(Wrappers.lambdaQuery(UserDistributePosterRecord.class)
-					.eq(UserDistributePosterRecord::getUserId, cpsUserId)
-					.eq(UserDistributePosterRecord::getPosterId, posterId)
-					.last("limit 1"));
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(distributePosterRecord.getId());
-	}
-
-	/**
-	 * 更新推荐海报状态
-	 */
-	@PutMapping("/update/recommend/status")
-	public Result<String> updateRecommendStatus() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-
-		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class)
-				.eq(UserDistribute::getUserId, cpsUserId)
-				.eq(UserDistribute::getDeleted, 1)
-				.last("limit 1"));
-		if (userDistribute != null) {
-			Boolean isPoster = userDistribute.getIsPoster();
-			userDistributeMapper.update(null, Wrappers.lambdaUpdate(UserDistribute.class)
-					.set(UserDistribute::getIsPoster, !isPoster)
-					.eq(UserDistribute::getId, userDistribute.getId()));
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 182
netflix-web/src/main/java/com/cyksj/web/controller/distribute/DistributeRankController.java

@@ -1,182 +0,0 @@
-package com.cyksj.web.controller.distribute;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserDistributeRankStatisticsRecordMapper;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
-import com.cyksj.model.entity.User;
-import com.cyksj.model.entity.UserDistribute;
-import com.cyksj.model.views.*;
-import com.cyksj.web.util.StpUserUtil;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import java.time.DayOfWeek;
-import java.time.LocalDate;
-import java.time.temporal.ChronoField;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * server/分销排行
- * 项目名: yhlxj
- * 文件名: DistributeRankController
- * 创建者: JavaZou
- * 创建时间:2024/7/23 17:10
- */
-@RestController
-@RequestMapping("/applets/distribute/rank")
-@RequiredArgsConstructor
-public class DistributeRankController {
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserDistributeMapper userDistributeMapper;
-
-	private final UserDistributeRankStatisticsRecordMapper userDistributeRankStatisticsRecordMapper;
-
-	private final UserMapper userMapper;
-
-	/**
-	 * 分销排行活动详情
-	 */
-	@GetMapping("/get/activity/detail")
-	public Result<UserActivityDistributeDetailView> getActivityDetail() {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class)
-				.eq(UserDistribute::getUserId, userId)
-				.eq(UserDistribute::getDeleted, 1)
-				.last("limit 1"));
-		//非普通推广渠道
-		if (userDistribute != null) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		String dateStr = DateTime.now().toString();
-		String time = String.format(" and (ua.start_time is null or (ua.start_time < '%s' and ua.end_time > '%s'))", dateStr, dateStr);
-		UserActivityDistributeDetailView view = beanSearcher.searchFirst(UserActivityDistributeDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(UserActivityDistributeDetailView::getType, 1)
-				.put("time", time)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(view);
-	}
-
-	/**
-	 * 个人分销排行详情  以及所属分类排行列表
-	 */
-	@GetMapping("/get/personal")
-	public Result<DistributeUserRankPersonalView> getPersonal(@RequestParam(defaultValue = "0") Integer type, @RequestParam(defaultValue = "week") String statisticsType, @RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "5") Integer limit) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		DistributeUserRankPersonalView distributeUserRankPersonalView = new DistributeUserRankPersonalView();
-		String orderByField = Constant.money;
-		//订单排行
-		if (type == 1) {
-			orderByField = Constant.orders;
-		}
-		String statisticsTime;
-		if (Constant.week.equals(statisticsType)) {
-			//上周一
-			LocalDate monday = LocalDate.now().with(ChronoField.DAY_OF_WEEK, DayOfWeek.MONDAY.getValue());
-			statisticsTime = monday.toString();
-		} else {
-			DateTime beginOfMonth = DateUtil.beginOfMonth(DateTime.now());
-			statisticsTime = beginOfMonth.toDateStr();
-		}
-
-		DistributeUserRankView self = Optional.ofNullable(userDistributeRankStatisticsRecordMapper.getSelfRank(orderByField, userId, statisticsTime)).orElseGet(()->{
-			DistributeUserRankView distributeUserRankView = new DistributeUserRankView();
-			User user = userMapper.selectById(userId);
-			distributeUserRankView.setNickname(user.getNickname());
-			distributeUserRankView.setHeadimgurl(user.getHeadimgurl());
-			return distributeUserRankView;
-		});
-		if (self != null && self.getRankId() != null && self.getRankId() <= 10) {
-			self.setIsPrize(true);
-		}
-		distributeUserRankPersonalView.setSelf(self);
-
-		DistributeUserRankView more = userDistributeRankStatisticsRecordMapper.getMoreSelfRank(self.getRankId(), self.getOrders(), self.getMoney(), orderByField, statisticsTime);
-		if (more != null) {
-			if (type == 1) {
-				self.setGapOrders(more.getOrders() - self.getOrders());
-			} else {
-				self.setGapMoney(more.getMoney().subtract(self.getMoney()));
-			}
-		}
-
-		Page<DistributeUserRankView> ranks = userDistributeRankStatisticsRecordMapper.selectDistributeRanks(orderByField, statisticsTime, new Page<>(start, limit));
-		distributeUserRankPersonalView.setRanks(ranks);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(distributeUserRankPersonalView);
-	}
-
-	/**
-	 * 上期获奖名单
-	 */
-	@GetMapping("/get/previous/winners")
-	public Result<List<DistributeUserRankPreView>> getPreviousWinners(@RequestParam(defaultValue = "0") Integer type, @RequestParam(defaultValue = "week") String statisticsType) throws Exception {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		String lastTime;
-		if (Constant.week.equals(statisticsType)) {
-			//上周一
-			LocalDate monday = LocalDate.now().with(ChronoField.DAY_OF_WEEK, DayOfWeek.MONDAY.getValue()).plusWeeks(-1);
-			lastTime = monday.toString();
-		} else {
-			DateTime lastBeginOfMonth = DateUtil.offsetMonth(DateUtil.beginOfMonth(DateTime.now()), -1);
-			lastTime = lastBeginOfMonth.toDateStr();
-		}
-		List<DistributeUserRankPreView> ranks = beanSearcher.searchAll(DistributeUserRankPreView.class, MapUtils.builder().field(DistributeUserRankPreView::getType, type)
-				.field(DistributeUserRankPreView::getStatisticsStartTime, lastTime).build());
-
-		ranks.forEach(rank -> {
-			if (ObjectUtil.equal(userId, rank.getUserId())) {
-				//在前10
-				rank.setIsPrize(true);
-				rank.setUserId(null);
-			}
-		});
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult(ranks);
-	}
-
-	/**
-	 * 获奖明细
-	 */
-	@GetMapping("/get/reward/detail")
-	public Result<SearchResult<UserDistributeRankRewardDetailView>> getUserRewardDetailView() {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		SearchResult<UserDistributeRankRewardDetailView> search = beanSearcher.search(UserDistributeRankRewardDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(UserDistributeRankRewardDetailView::getUserId, userId)
-				.orderBy(UserDistributeRankRewardDetailView::getCreatedTime).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 返现明细
-	 */
-	@GetMapping("/get/distribute/returnMoney/detai")
-	public Result<SearchResult<userDistributeReturnMoneyDetail>> getReturnMoneyDetailView() {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		SearchResult<userDistributeReturnMoneyDetail> search = beanSearcher.search(userDistributeReturnMoneyDetail.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(userDistributeReturnMoneyDetail::getUserId, userId)
-				.orderBy(userDistributeReturnMoneyDetail::getCreatedTime).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-}

+ 0 - 261
netflix-web/src/main/java/com/cyksj/web/controller/distribute/EquipmentDistributeController.java

@@ -1,261 +0,0 @@
-package com.cyksj.web.controller.distribute;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.EnvCommonService;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.dto.UserSharedDto;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.OrderDonMapper;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.manage.distribute.equipment.EquipmentUserChanceMapper;
-import com.cyksj.mapper.manage.distribute.equipment.EquipmentUserDistributeInviteRecordMapper;
-import com.cyksj.model.dto.EquipmentConfigDto;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.manage.views.GroupsRelationView;
-import com.cyksj.model.request.LoginReq;
-import com.cyksj.model.request.ReceiveBenefitsReq;
-import com.cyksj.model.views.CouponUserView;
-import com.cyksj.model.views.EquipmentCouponView;
-import com.cyksj.model.views.EquipmentDistributeView;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.distribute.equipment.EquipmentDistributeFrontService;
-import com.cyksj.service.distribute.equipment.EquipmentDistributeService;
-import com.cyksj.service.sys.SysConfigService;
-import com.cyksj.service.user.UserService;
-import com.cyksj.web.util.StpUserUtil;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/*
- *项目名: netflix
- *文件名: EquipmentDistributeController
- *创建者: JavaZou
- *创建时间:2023/2/23 15:41
- */
-@RestController
-@RequestMapping("/applets/equipment")
-@RequiredArgsConstructor
-public class EquipmentDistributeController {
-	private final EquipmentUserChanceMapper equipmentUserChanceMapper;
-
-	private final EnvCommonService envCommonService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final SysConfigService sysConfigService;
-
-	private final EquipmentDistributeFrontService equipmentDistributeFrontService;
-
-	private final RedisService redisService;
-
-	private final UserMapper userMapper;
-
-	private final OrderDonMapper orderDonMapper;
-
-	private final UserService userService;
-
-	private final EquipmentDistributeService equipDistributeService;
-
-	private final EquipmentUserDistributeInviteRecordMapper inviteRecordMapper;
-	/**
-	 * 个人实物分销详情
-	 */
-	@GetMapping("/personal")
-	public Result<EquipmentDistributeView> getPersonalDetail() {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		EquipmentUserChance chance = equipmentUserChanceMapper.selectOne(Wrappers.lambdaQuery(EquipmentUserChance.class)
-				.eq(EquipmentUserChance::getUserId, userId).last("limit 1"));
-		EquipmentDistributeView view = new EquipmentDistributeView();
-		view.setNum(chance == null ? 0 : chance.getNum());
-		String equipDistributeUrl = String.format("%syinhe/web/detail/15?sharedId=%s&dsType=%s", envCommonService.getDomain(), userId, 2);
-		view.setUrl(equipDistributeUrl);
-		SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-				.eq(SysConfig::getSysKey, Constant.EQUIPMENT_DISTRIBUTE_KEY).last("limit 1"));
-		if (config != null) {
-			view.setEquipmentConfig(config.getSysValue());
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(view);
-	}
-
-	/**
-	 * 邀请好友明细
-	 */
-	@GetMapping("/get/invite/record")
-	public Result<SearchResult<EquipmentUserPayRecord>> getInviteRecord() {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		SearchResult<EquipmentUserPayRecord> search = beanSearcher.search(EquipmentUserPayRecord.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(EquipmentUserPayRecord::getShareId, userId)
-				.build());
-		search.getDataList().forEach(data -> {
-			Optional.ofNullable(userMapper.selectById(data.getUserId())).ifPresent(user -> {
-				data.setNickname(user.getNickname());
-				data.setHeadImg(user.getHeadimgurl());
-			});
-			Optional.ofNullable(orderDonMapper.selectById(data.getOrderId())).ifPresent(oder -> data.setPayTime(oder.getPayTime()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 增加权益的车票
-	 */
-	@GetMapping("/get/benefits/ticket")
-	public Result<List<GroupsRelationView>> getBenefitsTicket() throws Exception {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-				.eq(SysConfig::getSysKey, Constant.EQUIPMENT_DISTRIBUTE_KEY).last("limit 1"));
-		List<Long> goodsIds = null;
-		if (config != null) {
-			String sysValue = config.getSysValue();
-			if (StrUtil.isNotBlank(sysValue)) {
-				EquipmentConfigDto equipmentConfigDto = Jsons.parseObject(sysValue, EquipmentConfigDto.class);
-				if (CollUtil.isEmpty(equipmentConfigDto.getSkuList())) {
-					return GatewayResponse.SUCCESS.newBuilder().toResult();
-				}
-				goodsIds = equipmentConfigDto.getSkuList().stream().map(GoodsDonSku::getGoodsId).collect(Collectors.toList());
-			}
-		}
-		MapBuilder builder = MapUtils.builder()
-				.field(GroupsRelationView::getUserId, userId)
-				.field(GroupsRelationView::getGoodsType, 1)
-				.field(GroupsRelationView::getGoodsSecondType, 2)
-				.field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
-				.field(GroupsRelationView::getExpiryTime).op(Operator.NotNull);
-		if (!goodsIds.isEmpty()) {
-			builder.field(GroupsRelationView::getGoodsId, goodsIds).op(Operator.InList);
-		}
-		List<GroupsRelationView> list = beanSearcher.searchAll(GroupsRelationView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	/**
-	 * 领取权益
-	 */
-	@PostMapping("/use/benefits")
-	public Result<GroupsRelationView> useBenefits(@RequestBody @Validated ReceiveBenefitsReq req) throws Exception {
-		Long goodsId = req.getGoodsId(), skuId = req.getSkuId(), relationId = req.getRelationId();
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-				.eq(SysConfig::getSysKey, Constant.EQUIPMENT_DISTRIBUTE_KEY).last("limit 1"));
-		String sysValue = config.getSysValue();
-		if (StrUtil.isEmpty(sysValue)) {
-			throw BusinessRuntimeException.getInstance("");
-		}
-		EquipmentConfigDto equipmentConfigDto = Jsons.parseObject(sysValue, EquipmentConfigDto.class);
-		if (CollUtil.isEmpty(equipmentConfigDto.getSkuList())) {
-			throw BusinessRuntimeException.getInstance("暂无该车票权益");
-		}
-		Optional<GoodsDonSku> first = equipmentConfigDto.getSkuList().stream().filter(goodsDonSku -> {
-			if (goodsDonSku.getId().equals(skuId)) {
-				return true;
-			}
-			return false;
-		}).findFirst();
-		if (first.isEmpty()) {
-			throw BusinessRuntimeException.getInstance("暂无该车票权益");
-		}
-		GroupsRelationView groupsRelationView = equipmentDistributeFrontService.useBenefits(userId, goodsId, skuId, relationId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(groupsRelationView);
-	}
-
-	/**
-	 * 新用户领取后分销优惠券后弹窗
-	 */
-	@GetMapping("/get/couponList")
-	public Result<EquipmentCouponView> getEquipmentCouponList() {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		Object value = redisService.get(RedisService.key.EQUIPMENT_DISTRIBUTE_COUPON_KEY.getNameFormat(userId));
-		if (value != null) {
-			EquipmentCouponView equipmentCouponView = new EquipmentCouponView();
-			List<CouponUserView> couponUserViews = beanSearcher.searchAll(CouponUserView.class, MapUtils.builder()
-					.field(CouponUserView::getUserId, userId)
-					.field(CouponUserView::getChannel, CouponUser.Channel.equipment.name())
-					.orderBy(CouponUserView::getOrderBy).asc()
-					.build());
-			EquipmentUserDistributeInviteRecord record = inviteRecordMapper.selectOne(Wrappers.lambdaQuery(EquipmentUserDistributeInviteRecord.class)
-					.eq(EquipmentUserDistributeInviteRecord::getUserId, userId).last("limit 1"));
-			if (record != null) {
-				User user = userMapper.selectById(record.getShareId());
-				Optional.ofNullable(user).ifPresent(u->{
-					equipmentCouponView.setNickname(u.getNickname());
-					equipmentCouponView.setUserId(u.getId());
-					equipmentCouponView.setHeadImg(u.getHeadimgurl());
-				});
-			}
-			equipmentCouponView.setCouponList(couponUserViews);
-			return GatewayResponse.SUCCESS.newBuilder().toResult(equipmentCouponView);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 已登录的用户 实物分销
-	 */
-	@PostMapping("/hasLogged")
-	public Result<String> hasLogged(@RequestBody LoginReq req) {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		DateTime now = DateTime.now();
-		User user = userMapper.selectOne(Wrappers.lambdaQuery(User.class).eq(User::getId, userId)
-				.between(User::getCreatedTime, DateUtil.beginOfDay(now), DateUtil.endOfDay(now)).last("limit 1"));
-		Boolean isNewUser = user != null ? true : false;
-		Long sharedId = req.getSharedId();
-		String dsCode = req.getDsCode();
-		Integer dsType = req.getDsType();
-		if (StrUtil.isNotBlank(dsCode)) {
-			UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
-			if (userSharedDto != null) {
-				sharedId = userSharedDto.getSharedId();
-			}
-		}
-		//新旧用户都可实物分销
-		if (sharedId != null && dsType != null && dsType == 2) {
-			equipDistributeService.saveDistributionInvitation(sharedId, isNewUser, userId);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 是否是新用户
-	 */
-	@GetMapping("/get/isNewUser")
-	public Result<Boolean> isNewUser() {
-		Long userId = StpUserUtil.getLoginIdAsLong();
-		DateTime now = DateTime.now();
-		User user = userMapper.selectOne(Wrappers.lambdaQuery(User.class).eq(User::getId, userId)
-				.between(User::getCreatedTime, DateUtil.beginOfDay(now), DateUtil.endOfDay(now)).last("limit 1"));
-		if (user == null) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult(false);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(true);
-	}
-
-	/**
-	 * 实物分销绑定
-	 */
-	@GetMapping("/equipment/invite/bind")
-	public Result<String> equipmentInviteBind(String dsCode) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		userService.saveEpDistributeShared(userId, dsCode);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 137
netflix-web/src/main/java/com/cyksj/web/controller/external/ExternalController.java

@@ -1,137 +0,0 @@
-package com.cyksj.web.controller.external;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Assert;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonMapper;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.mapper.OrderDonMapper;
-import com.cyksj.mapper.manage.exchange.ExchangeCodeMapper;
-import com.cyksj.model.entity.ExchangeCode;
-import com.cyksj.model.entity.GoodsDon;
-import com.cyksj.model.entity.GoodsDonSku;
-import com.cyksj.model.entity.OrderDon;
-import com.cyksj.model.request.ExchangeCodeReq;
-import com.cyksj.model.views.ExternalExchangeCodeView;
-import com.cyksj.service.exchange.ExchangeCodeService;
-import com.cyksj.service.mange.MirrorUserCleatService;
-import com.cyksj.service.order.OrderCommonService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * 项目名: yhlxj
- * 文件名: ExternalController
- * 创建者: JavaZou
- * 创建时间:2024/6/11 15:01
- */
-@RestController
-@RequestMapping("/external/app")
-@RequiredArgsConstructor
-public class ExternalController {
-	private final HttpServletRequest request;
-
-	private final BeanSearcher beanSearcher;
-
-	private final ExchangeCodeMapper exchangeCodeMapper;
-
-	private final OrderDonMapper orderDonMapper;
-
-	private final OrderCommonService orderCommonService;
-
-	private final GoodsDonSkuMapper skuMapper;
-
-	private final GoodsDonMapper goodsDonMapper;
-
-	private final ExchangeCodeService exchangeCodeService;
-
-	private final MirrorUserCleatService mirrorUserCleatService;
-
-	/**
-	 * 知乎 特殊镜像规格 兑换码列表
-	 */
-	@GetMapping("/get/mirror")
-	public Result<SearchResult<ExternalExchangeCodeView>> getMirror() {
-		//目前只展示规格id 444 GPT基础镜像2月
-		List<Long> showSkuId = List.of(444l);
-		SearchResult<ExternalExchangeCodeView> search = beanSearcher.search(ExternalExchangeCodeView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(ExternalExchangeCodeView::getSkuIds, showSkuId.toString())
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 退款 成功 重新生成兑换码
-	 */
-	@PutMapping("/refund/{id}")
-	@Transactional(rollbackFor = Throwable.class)
-	public Result<String> refund(@PathVariable Long id) throws Exception {
-		ExchangeCode exchangeCode = exchangeCodeMapper.selectById(id);
-		Assert.notNull(exchangeCode, "系统异常");
-		if (!exchangeCode.getUseStatus()) {
-			throw BusinessRuntimeException.getInstance("兑换码未使用");
-		}
-		if (DateTime.now().after(DateUtil.offsetDay(exchangeCode.getUseTime(), 1))) {
-			throw BusinessRuntimeException.getInstance("用户使用超过24小时不可退款");
-		}
-		if (StrUtil.equals(exchangeCode.getOrderStatus(), "refund")) {
-			throw BusinessRuntimeException.getInstance("兑换码已退");
-		}
-		String skuIds = exchangeCode.getSkuIds();
-		List<Long> skuIdList = Jsons.parseList(skuIds, Long.class);
-		OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
-				.eq(OrderDon::getExCode, exchangeCode.getCode())
-				.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
-				.last("limit 1"));
-		if (orderDon == null) {
-			orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
-					.eq(OrderDon::getUserId, exchangeCode.getUserId())
-					.eq(OrderDon::getType, OrderDon.Type.EX_CODE)
-					.eq(OrderDon::getSkuId, skuIdList.get(0))
-					.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
-					.last("limit 1"));
-		}
-		if (orderDon != null) {
-			//将mirror车票清空
-			orderDon.setStatus(OrderDon.Status.refund);
-			orderDonMapper.updateById(orderDon);
-
-			exchangeCode.setOrderStatus("refund");
-			exchangeCodeMapper.updateById(exchangeCode);
-
-			//虚物订单退款,清出车队,车票变为已过期
-			try {
-				GoodsDon goodsDon = goodsDonMapper.selectById(orderDon.getGoodsId());
-				GoodsDonSku sku = skuMapper.selectById(orderDon.getSkuId());
-				orderCommonService.clearUnrealGoodsDetail(orderDon, goodsDon.getType(), sku);
-
-				//清除gtpUser
-				if (orderDon.getOrderType() == 1) {
-					mirrorUserCleatService.delMirrorUser(goodsDon.getId(), orderDon.getRelationId());
-				}
-
-				//重新生成兑换码
-				ExchangeCodeReq exchangeCodeReq = new ExchangeCodeReq();
-				exchangeCodeReq.setNumber(1);
-				exchangeCodeReq.setSkuIds(List.of(orderDon.getSkuId()).toString());
-				exchangeCodeService.createExchangeCode(exchangeCodeReq);
-			} catch (Exception e) {
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 96
netflix-web/src/main/java/com/cyksj/web/controller/fission/UserMirrorFissionController.java

@@ -1,96 +0,0 @@
-package com.cyksj.web.controller.fission;
-
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.UserMirrorFissionRecord;
-import com.cyksj.model.response.UserMirrorFissionReceiveResp;
-import com.cyksj.model.views.UserMirrorFissionReceiveRecordView;
-import com.cyksj.service.fission.UserMirrorFissionFrontService;
-import com.cyksj.web.util.StpUserUtil;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * server/镜像裂变
- * 项目名: yhlxj2
- * 文件名: UserMirrorFissionController
- * 创建者: JavaZou
- * 创建时间:2024/11/21 18:10
- */
-@Slf4j
-@RestController
-@RequestMapping("/applets/mirror/fission")
-@RequiredArgsConstructor
-public class UserMirrorFissionController {
-	private final UserMirrorFissionFrontService userMirrorFissionFrontService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-
-	/**
-	 * 是否购买过镜像车票
-	 */
-	@GetMapping("/get/purchased/mirror/status")
-	public Result<Boolean> getPurchasedMirrorStatus(@RequestParam(defaultValue = "18") Long goodsId) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		Boolean flag = userMirrorFissionFrontService.getPurchasedMirrorStatus(userId, goodsId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(flag);
-	}
-
-	/**
-	 * 领取镜像试用车票
-	 */
-	@PostMapping("/receive/trial/mirror/ticket/{code}")
-	public Result<String> receiveTrialMirrorTicket(@PathVariable String code) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		UserMirrorFissionReceiveResp resp = userMirrorFissionFrontService.receiveTrialMirrorTicket(userId, code);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(resp.getStatus().name());
-	}
-
-	/**
-	 * 镜像分裂车票
-	 */
-	@GetMapping("/get/present/ticket")
-	public Result<UserMirrorFissionRecord> getPresentFissionTicket() {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		UserMirrorFissionRecord userMirrorFissionRecord = userMirrorFissionFrontService.getPresentFissionTicket(userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userMirrorFissionRecord);
-	}
-
-	/**
-	 * 镜像分裂车票记录
-	 */
-	@PostMapping("/record/{relationId}")
-	public Result<UserMirrorFissionRecord> recordUserMirrorFission(@PathVariable Long relationId) throws Exception {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		UserMirrorFissionRecord userMirrorFissionRecord = userMirrorFissionFrontService.recordUserMirrorFission(userId, relationId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userMirrorFissionRecord);
-	}
-
-	/**
-	 * 镜像分裂车票 赠送记录
-	 */
-	@GetMapping("/get/receive/record/{code}")
-	public Result<SearchResult<UserMirrorFissionReceiveRecordView>> getFissionReceiveRecord(@PathVariable String code) {
-		SearchResult<UserMirrorFissionReceiveRecordView> search = beanSearcher.search(UserMirrorFissionReceiveRecordView.class, MapUtils.flatBuilder(request.getParameterMap()).field(UserMirrorFissionReceiveRecordView::getCode, code).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 是否可进行裂变活动
-	 */
-	@GetMapping("/get/permit/status")
-	public Result<Boolean> getPermitStatus(@RequestParam(defaultValue = "18") Long goodsId) throws Exception {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		Boolean flag = userMirrorFissionFrontService.getPermitStatus(userId, goodsId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(flag);
-	}
-}

+ 0 - 1367
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -1,1367 +0,0 @@
-package com.cyksj.web.controller.goods;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUnit;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.RandomUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.extra.servlet.ServletUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.common.util.StringUtil;
-import com.cyksj.dto.Result;
-import com.cyksj.dto.UserSharedDto;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GiftCardGoodsSkuMapper;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.mapper.OrderDonMapper;
-import com.cyksj.mapper.RegisterOrderDonMapper;
-import com.cyksj.mapper.manage.distribute.UserDistributeSharedMapper;
-import com.cyksj.mapper.shop.YhShopGoodsSkuMapper;
-import com.cyksj.mapper.sys.SysConfigMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.request.ClickRecordReq;
-import com.cyksj.model.views.*;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.goods.GoodsDonFrontService;
-import com.cyksj.service.home.ClickRecordFrontService;
-import com.cyksj.service.shop.YhShopFrontService;
-import com.cyksj.service.user.UserBindRelationService;
-import com.cyksj.service.user.UserService;
-import com.cyksj.web.util.StpUserUtil;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * @author chan
- * @date 2022/9/26 5:33 PM
- */
-@Slf4j
-@RestController
-@RequestMapping("/applets/goods")
-@RequiredArgsConstructor
-public class GoodsDonController {
-
-    private final HttpServletRequest request;
-
-    private final BeanSearcher beanSearcher;
-
-    private final OrderDonMapper orderDonMapper;
-
-    private final RegisterOrderDonMapper registerOrderDonMapper;
-
-    private final GoodsDonSkuMapper goodsDonSkuMapper;
-
-    private final YhShopGoodsSkuMapper yhShopGoodsSkuMapper;
-
-    private final RedisService redisService;
-
-    private final SysConfigMapper sysConfigMapper;
-
-    private final ClickRecordFrontService clickRecordFrontService;
-
-	private final YhShopFrontService yhShopFrontService;
-
-	private final UserService userService;
-
-	private final UserDistributeSharedMapper userDistributeSharedMapper;
-
-	private final GoodsDonFrontService goodsDonFrontService;
-
-	private final UserBindRelationService userBindRelationService;
-
-	private final GiftCardGoodsSkuMapper giftCardGoodsSkuMapper;
-
-	/**
-     * 获取平台商品分类
-     */
-    @GetMapping("/get/category")
-    public Result<List<GoodsDonCategoryFrontView>> getCategory(String customId) {
-	    Long yhsId = null;
-	    if (StrUtil.isNotBlank(customId)) {
-		    yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
-	    }
-	    String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category";
-	    if (yhsId != null) {
-		    key += ":yhShop:" + yhsId;
-	    }
-	    Object o = redisService.get(key);
-	    List<GoodsDonCategoryFrontView> list;
-	    MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-	    String condition = " and (select count(*) from goods_don_category_relate gcr inner join goods_don g on g.id = gcr.goods_id %s where gcr.category = gc.id) > 0";
-	    if (yhsId != null) {
-		    condition = String.format(condition, String.format(" and (select count(*) from yh_shop_goods_sku ys where ys.goods_id = g.id and ys.status is true and ys.deleted is true and g.is_distribute is true and ys.yhs_id = %s) > 0", yhsId));
-	    } else {
-		    condition = String.format(condition, StrUtil.EMPTY);
-	    }
-	    mapBuilder.put("condition", condition);
-	    if (o == null) {
-		    list = beanSearcher.searchAll(GoodsDonCategoryFrontView.class, mapBuilder
-				    .build());
-		    redisService.setNx(key, list, 30 * 60l);
-		    o = redisService.get(key);
-	    }
-	    list = Jsons.parseList(o, GoodsDonCategoryFrontView.class);
-	    return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-    }
-
-    /**
-     * 商品搜索
-     */
-    @GetMapping("/search")
-    public Result<SearchResult<GoodsDonSearchView>> search() {
-        SearchResult<GoodsDonSearchView> search = beanSearcher.search(GoodsDonSearchView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 获取商品列表
-     */
-    @GetMapping("/get")
-    public Result<SearchResult<GoodsDon>> get() {
-        SearchResult<GoodsDon> search = beanSearcher.search(GoodsDon.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(GoodsDon::getStatus, true)
-                .field(GoodsDon::getDeleted, true)
-                .orderBy(GoodsDon::getSortBy).asc()
-                .orderBy(GoodsDon::getId).asc()
-                .build()
-        );
-        search.getDataList().forEach(goods -> {
-            GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class).eq(GoodsDonSku::getGoodsId, goods.getId())
-                    .eq(GoodsDonSku::getStatus, true)
-                    .orderByAsc(GoodsDonSku::getPrice)
-                    .last("limit 1")
-                    .select(GoodsDonSku::getPrice));
-            Optional.ofNullable(goodsDonSku).ifPresent(sku -> {
-                goods.setPrice(goodsDonSku.getPrice());
-	            goods.setSoldNum(getGoodsSold(goods.getId(), goods.getVirtualSold()));
-            });
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 推广未登录,虚拟商品列表
-     */
-    @GetMapping("/get/popularize")
-    @Deprecated
-    public Result<SearchResult<GoodsDonPopularizeView>> getPopularizeVipGoods() {
-        SearchResult<GoodsDonPopularizeView> search = beanSearcher.search(GoodsDonPopularizeView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(GoodsDonPopularizeView::getStatus, true)
-                .field(GoodsDonPopularizeView::getDeleted, true)
-                .field(GoodsDonPopularizeView::getType, 1)
-                .orderBy(GoodsDonPopularizeView::getSortBy).asc()
-                .orderBy(GoodsDonPopularizeView::getId).asc()
-                .build());
-        DateTime now = DateTime.now();
-        search.getDataList().forEach(data -> {
-            data.setSpecs(beanSearcher.searchFirst(GoodsDonSpec.class, MapUtils.builder().field(GoodsDonSpec::getGoodsId, data.getId()).build()));
-            data.setSkuList(beanSearcher.searchAll(GoodsDonSku.class, MapUtils.builder().field(GoodsDonSku::getGoodsId, data.getId()).field(GoodsDonSku::getStatus, true).orderBy(GoodsDonSku::getPrice).asc().build()));
-	        data.setSold(getGoodsSold(data.getId(), data.getVirtualSold()));
-
-	        Optional.ofNullable(data.getSkuList()).ifPresent(skuList -> {
-                if (skuList.size() > 0) {
-                    GoodsDonSku goodsDonSku = skuList.get(0);
-                    data.setPrice(goodsDonSku.getPrice());
-                    data.setMonths(goodsDonSku.getMonths());
-                }
-            });
-            OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
-                    .eq(OrderDon::getGoodsId, data.getId())
-                    .notIn(OrderDon::getStatus, Constant.noOrderStatus).select(OrderDon::getCreatedTime, OrderDon::getPayTime, OrderDon::getId)
-                    .orderByDesc(OrderDon::getId)
-                    .last("limit 1"));
-            StringBuilder notifyMsg = new StringBuilder();
-            if (orderDon == null) {
-                notifyMsg.append("点击购买立即上车");
-                data.setNotifyMsg(notifyMsg.toString());
-                return;
-            } else {
-                Date payTime = orderDon.getPayTime();
-                Date startTime = payTime != null ? payTime : orderDon.getCreatedTime();
-                long hour = DateUtil.between(startTime, now, DateUnit.HOUR);
-                if (hour == 0) {
-                    long minute = DateUtil.between(startTime, now, DateUnit.MINUTE);
-                    if (minute == 0) {
-                        notifyMsg.append("1分钟");
-                    } else {
-                        notifyMsg.append(minute);
-                        notifyMsg.append("分钟");
-                    }
-                } else {
-                    if (hour > 3) {
-                        int hours = RandomUtil.randomInt(3) + 1;
-                        notifyMsg.append(hours);
-                    } else {
-                        notifyMsg.append(hour);
-                    }
-                    notifyMsg.append("小时");
-                }
-            }
-            notifyMsg.append("前有人购买");
-            data.setNotifyMsg(notifyMsg.toString());
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 官网首页 平台列表
-     */
-    @GetMapping("/get/list")
-    @Deprecated
-    public Result<? extends Object> getGoodsList(String customId) {
-	    if (StrUtil.isNotBlank(customId)) {
-		    Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
-		    return shopGoods;
-	    }
-	    //List<Long> filter_goodsIds = getFilterGoodsIds();
-	    List<Long> filter_goodsIds = null;
-	    String pcCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "PC";
-	    if (CollUtil.isNotEmpty(filter_goodsIds)) {
-		    pcCacheKey += ":hz-ip";
-	    }
-	    Long fUid = StpUserUtil.getUserIdAfterLogin();
-	    Object o = redisService.get(pcCacheKey);
-	    List<GoodsFrontListView> list = null;
-	    if (o == null) {
-		    MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		    if (CollUtil.isNotEmpty(filter_goodsIds)) {
-			    builder.field(GoodsFrontListView::getId, filter_goodsIds).op(Operator.NotIn);
-		    }
-		    builder.field(GoodsFrontListView::getType, 1);
-		    list = beanSearcher.searchAll(GoodsFrontListView.class, builder.build());
-		    redisService.setNx(pcCacheKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
-		    o = redisService.get(pcCacheKey);
-	    }
-	    if (list == null) {
-		    list = Jsons.parseList(o, GoodsFrontListView.class);
-	    }
-	    DateTime now = DateTime.now();
-	    list.forEach(data -> {
-		    data.setSold(getGoodsSold(data.getId(), data.getSold()));
-		    data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
-
-		    //设置特定价格
-		    setSpecificPrice(data, fUid, null);
-	    });
-	    return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
-    }
-
-    /**
-     * h5 银河首页平台展示
-     */
-    @GetMapping("/get/homePage")
-    @Deprecated
-    public Result<? extends Object> getGoodsHomePage(String customId) {
-	    if (StrUtil.isNotBlank(customId)) {
-		    Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
-		    return shopGoods;
-	    }
-	    //List<Long> filter_goodsIds = getFilterGoodsIds();
-		List<Long> filter_goodsIds = null;
-	    String h5CacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "H5";
-	    if (CollUtil.isNotEmpty(filter_goodsIds)) {
-		    h5CacheKey += ":hz-ip";
-	    }
-	    Long fUid = StpUserUtil.getUserIdAfterLogin();
-	    Object o = redisService.get(h5CacheKey);
-	    List<GoodsFrontListView> list = null;
-	    if (o == null) {
-		    MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		    if (CollUtil.isNotEmpty(filter_goodsIds)) {
-			    builder.field(GoodsFrontListView::getId, filter_goodsIds).op(Operator.NotIn);
-		    }
-		    list = beanSearcher.searchAll(GoodsFrontListView.class, builder.build());
-		    redisService.setNx(h5CacheKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
-		    o = redisService.get(h5CacheKey);
-	    }
-	    if (list == null) {
-		    list = Jsons.parseList(o, GoodsFrontListView.class);
-	    }
-
-	    DateTime now = DateTime.now();
-	    list.forEach(data -> {
-		    data.setSold(getGoodsSold(data.getId(), data.getSold()));
-		    data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
-
-		    //设置特定价格
-		    setSpecificPrice(data, fUid, null);
-	    });
-	    return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
-    }
-
-    /**
-     * 注册首页平台展示
-     */
-    @GetMapping("/get/register")
-    public Result<List<RegisterGoodsDonView>> getRegisterGoodsDon() {
-        String registerCacheKey = RedisService.key.REGISTER_HOME_PAGE_CACHE.getName();
-        Object value = redisService.get(registerCacheKey);
-        if (value != null) {
-            try {
-                List<RegisterGoodsDonView> list = Jsons.parseList(value, RegisterGoodsDonView.class);
-                if (CollUtil.isNotEmpty(list)) {
-                    return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-                }
-            } catch (Exception e) {
-            }
-        }
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        List<RegisterGoodsDonView> dataList = beanSearcher.searchAll(RegisterGoodsDonView.class, builder.build());
-        DateTime now = DateTime.now();
-        dataList.forEach(data -> {
-            Integer sold = registerOrderDonMapper.selectCount(Wrappers.lambdaQuery(RegisterOrderDon.class)
-                    .eq(RegisterOrderDon::getGoodsId, data.getId()).notIn(RegisterOrderDon::getStatus, Constant.noOrderStatus));
-            data.setSold(sold + data.getVirtualSold());
-            data.setNotifyMsg(getPayMsgTime(data.getId(), now, 2, null));
-        });
-        redisService.setNx(registerCacheKey, dataList, RedisService.key.REGISTER_HOME_PAGE_CACHE.getTimeout());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(dataList);
-    }
-
-
-	/**
-	 * 获取商品详情
-	 */
-	@GetMapping("/get/{id}")
-	public Result<? extends Object> getDetail(@PathVariable Long id, String customId, String dsCode) {
-		if (StrUtil.isNotBlank(customId) && id != 15) {
-			Result<YhShopGoodsFrontView> yhShopGoodsDetail = getGoodsDetailByYhsId(yhShopFrontService.getYhsIdByCustomId(customId), id);
-			return yhShopGoodsDetail;
-		}
-		String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "goods_detail:" + id;
-		//List<Long> filter_goodsIds = getFilterGoodsIds();
-		List<Long> filter_goodsIds = null;
-		//存在过滤平台 商品详情不返回
-		if (CollUtil.isNotEmpty(filter_goodsIds) && filter_goodsIds.contains(id)) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		Object o = redisService.get(goodsDetailKey);
-		if (o == null) {
-			GoodsFrontListView views = beanSearcher.searchFirst(GoodsFrontListView.class, MapUtils.builder().field(GoodsFrontListView::getId, id)
-					.build());
-			if (views == null) {
-				return GatewayResponse.SUCCESS.newBuilder().toResult();
-			}
-
-			views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
-			MapBuilder builder = MapUtils.builder().field(GoodsDonSkuFrontView::getGoodsId, views.getId()).field(GoodsDonSkuFrontView::getStatus, true);
-
-			if (views.getType() == 1) {
-				builder.orderBy(GoodsDonSkuFrontView::getSorted).asc();
-			}
-			views.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, builder.build()));
-			views.setSold(getGoodsSold(views.getId(), views.getSold()));
-			List<GoodsDonQaFrontView> donQaFrontViews = beanSearcher.searchAll(GoodsDonQaFrontView.class, MapUtils.builder().field(GoodsDonQaFrontView::getGoodsId, id).field(GoodsDonQaFrontView::getType, 1).build());
-			views.setQuestions(donQaFrontViews);
-			redisService.setNx(goodsDetailKey, views, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 60 * RandomUtil.randomInt(10));
-			o = redisService.get(goodsDetailKey);
-		}
-		Long fUid = StpUserUtil.getUserIdAfterLogin();
-		GoodsFrontListView views = Jsons.parseObject(o, GoodsFrontListView.class);
-		AtomicLong dsUserId = new AtomicLong();
-		AtomicBoolean existsChannel = new AtomicBoolean(true);
-		if (StrUtil.isNotBlank(dsCode)) {
-			UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
-			dsUserId.set(userSharedDto.getSharedId());
-		}
-		views.setIsGift(giftCardGoodsSkuMapper.selectCount(Wrappers.lambdaQuery(GiftCardGoodsSku.class)
-				.eq(GiftCardGoodsSku::getGcGoodsId, views.getId())
-				.eq(GiftCardGoodsSku::getStatus, 1)
-				.eq(GiftCardGoodsSku::getDeleted, 1)) > 0);
-		views.setSkuList(views.getSkuList().stream().filter(sku -> {
-			if (StrUtil.isNotBlank(sku.getUserOwns())) {
-				if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
-					Long sharedId = userService.getSharedIdByUserId(fUid);
-					if (sharedId == 0) {
-						existsChannel.set(false);
-					}
-					dsUserId.set(sharedId);
-				}
-				if (dsUserId.get() == 0 || !sku.getUserOwns().contains(String.valueOf(dsUserId.get()))) {
-					return false;
-				}
-			}
-			if (sku.getIsDp()) {
-				sku.setDpSkuViews(beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelationFrontView.class, MapUtils.builder()
-						.field(GoodsDiscountPlusPurchaseRelationFrontView::getSkuId, sku.getId())
-						.build()));
-			}
-			if (views.getIsSp()) {
-				if (fUid == null) {
-					sku.setSpecificPrice(null);
-					sku.setSpecificGoodsIds(null);
-				}else {
-					//设置特定价格
-					if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
-						sku.setSpecificGoodsIds(null);
-						sku.setSpecificPrice(null);
-					} else {
-						BigDecimal specificPrice = views.getSpecificPrice();
-
-						BigDecimal skuSpecificPrice = sku.getSpecificPrice();
-						Long specificSkuId = sku.getId();
-						if (specificPrice == null) {
-							views.setSpecificPrice(skuSpecificPrice);
-							views.setSpecificSkuId(specificSkuId);
-						} else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
-							views.setSpecificPrice(skuSpecificPrice);
-							views.setSpecificSkuId(specificSkuId);
-						}
-					}
-				}
-			}
-//			if (fUid != null && Constant.SPECIAL_PRICE_SKU_IDS.contains(sku.getId())) {
-//				UserDistributeShared distributeShared = userDistributeSharedMapper.selectOne(Wrappers.lambdaQuery(UserDistributeShared.class)
-//						.eq(UserDistributeShared::getUserId, fUid)
-//						.last("limit 1"));
-//				if (distributeShared != null) {
-//					Optional.ofNullable(sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
-//							.eq(SysConfig::getSysKey, Constant.MJ_SPECIAL_SKU_PRICE_KEY)
-//							.last("limit 1"))).ifPresent(sysConfig -> {
-//						if (StrUtil.isNotBlank(sysConfig.getSysValue())) {
-//							try {
-//								GoodsDonPriceDto goodsDonPriceDto = Jsons.parseObject(sysConfig.getSysValue(), GoodsDonPriceDto.class);
-//								sku.setPrice(goodsDonPriceDto.getPrice());
-//							} catch (Exception e) {
-//							}
-//						}
-//					});
-//				}
-//			}
-			return true;
-		}).collect(Collectors.toList()));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(views);
-	}
-
-    /**
-     * 获取商品推荐平台
-     */
-    @GetMapping("/get/recommend/{id}")
-    public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, String customId, String dsCode) throws Exception {
-	    String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "recommend:" + id;
-	    Long yhsId = null;
-	    if (StrUtil.isNotBlank(customId)) {
-		    yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
-		    key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId + ":recommend:" + id;
-	    }
-	    Object o = redisService.get(key);
-	    Long fUid = StpUserUtil.getUserIdAfterLogin();
-	    List<GoodsFrontListView> goodsRecommendViews = null;
-	    if (o == null) {
-		    GoodsDon goodsDon = beanSearcher.searchFirst(GoodsDon.class, MapUtils.builder()
-				    .field(GoodsDon::getId, id).field(GoodsDon::getStatus, true)
-				    .field(GoodsDon::getDeleted, true)
-				    .build());
-		    if (goodsDon != null && StrUtil.isNotEmpty(goodsDon.getRecommendGoods())) {
-			    List<Long> recommend_gidList = Jsons.parseList(goodsDon.getRecommendGoods(), Long.class);
-			    MapBuilder mapBuilder = MapUtils.builder();
-			    if (yhsId != null) {
-				    mapBuilder.put("condition", String.format(" and g.id in (select distinct goods_id from yh_shop_goods_sku where yhs_id = %s and status is true and deleted is true) and g.is_distribute is true", yhsId));
-			    }
-			    mapBuilder.field(GoodsFrontListView::getId, recommend_gidList).op(Operator.InList);
-			    goodsRecommendViews = beanSearcher.searchAll(GoodsFrontListView.class, mapBuilder.build());
-			    redisService.setNx(key, Jsons.toJson(goodsRecommendViews), 60 * 15l);
-			    o = redisService.get(key);
-		    } else {
-			    return GatewayResponse.SUCCESS.newBuilder().toResult();
-		    }
-	    }
-	    if (goodsRecommendViews == null) {
-		    goodsRecommendViews = Jsons.parseList(o.toString(), GoodsFrontListView.class);
-	    }
-	    AtomicLong dsUserId = new AtomicLong();
-	    AtomicBoolean existsChannel = new AtomicBoolean(true);
-	    if (StrUtil.isNotBlank(dsCode)) {
-		    UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
-		    dsUserId.set(userSharedDto.getSharedId());
-	    }
-	    goodsRecommendViews = goodsRecommendViews.stream().filter(data -> {
-		    if (data.getIsOwns()) {
-			    if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
-				    Long sharedId = userService.getSharedIdByUserId(fUid);
-				    if (sharedId == 0) {
-					    existsChannel.set(false);
-				    }
-				    dsUserId.set(sharedId);
-			    }
-			    GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getId(), dsUserId.get());
-			    if (minPriceUserOwnsSku == null) {
-				    return false;
-			    }
-			    data.setPrice(minPriceUserOwnsSku.getPrice());
-			    data.setMonths(minPriceUserOwnsSku.getMonths());
-			    data.setDays(minPriceUserOwnsSku.getDays());
-		    }
-			//销量
-		    data.setSold(getGoodsSold(data.getId(), data.getSold()));
-		    //设置特定价格
-		    setSpecificPrice(data, fUid, dsUserId.get());
-		    return true;
-	    }).collect(Collectors.toList());
-	    return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
-    }
-
-    /**
-     * 获取商品多规格列表
-     */
-    @GetMapping("/get/sku")
-    public Result<List<GoodsDonSkuView>> getGoodsDonSkuView(@RequestParam(value = "skuIds") List<Long> skuIds) {
-        if (skuIds.isEmpty()) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        List<GoodsDonSkuView> views = beanSearcher.searchAll(GoodsDonSkuView.class, MapUtils.builder()
-                .field(GoodsDonSkuView::getSkuId, skuIds).op(Operator.InList)
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(views);
-    }
-
-    /**
-     * 获取评价列表
-     */
-    @GetMapping("/get/comments")
-    public Result<SearchResult<OrderCommentFrontView>> getComments() {
-        SearchResult<OrderCommentFrontView> search = beanSearcher.search(OrderCommentFrontView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .orderBy(OrderCommentFrontView::getCommentTime).desc()
-                .orderBy(OrderCommentFrontView::getId).desc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 获取礼品卡平台性情
-     */
-    @GetMapping("/get/card/{id}")
-    public Result<Map<Integer, List<GiftCardGoodsSkuFrontView>>> getGiftCardDetail(@PathVariable Long id) {
-        List<GiftCardGoodsSkuFrontView> giftCardGoodsSkuFrontViews = beanSearcher.searchAll(GiftCardGoodsSkuFrontView.class, MapUtils.builder().field(GiftCardGoodsSkuFrontView::getGoodsId, id).build());
-        Map<Integer, List<GiftCardGoodsSkuFrontView>> map = giftCardGoodsSkuFrontViews.stream().collect(Collectors.groupingBy(GiftCardGoodsSkuFrontView::getGcType));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(map);
-    }
-
-	/**
-	 * 获取首页配置列表
-	 */
-	@GetMapping("/get/homeManage")
-	public Result<Map<String, List<HomeManagementFrontView>>> getHomeManagementFrontPage(String customId, String dsCode) {
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage";
-		Long yhsId = null;
-		if (StrUtil.isNotBlank(customId)) {
-			yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
-			key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId + ":homeManage";
-		}
-//		List<Long> filter_goodsIds = getFilterGoodsIds();
-		List<Long> filter_goodsIds = null;
-		AtomicBoolean isRemoveRg = new AtomicBoolean(false);
-//		if (isHzIp()) {
-//			key += ":hz-ip";
-//			isRemoveRg.set(true);
-//		}
-		Long fUid = StpUserUtil.getUserIdAfterLogin();
-		Object o = redisService.get(key);
-		if (o == null) {
-			String condition = "g.deleted is true and g.status is true";
-			if (yhsId != null) {
-				condition += String.format(" and g.id in (select distinct goods_id from yh_shop_goods_sku where yhs_id = %s and status is true and deleted is true) and g.is_distribute is true", yhsId);
-			}
-			Map<String, List<HomeManagementFrontView>> map = new ConcurrentHashMap<>();
-			final String conditionSql = condition;
-			Stream.of(HomeManagementConfig.Type.values())
-					.forEach(type -> {
-						if (isRemoveRg.get() && type == HomeManagementConfig.Type.rg) {
-							return;
-						}
-						MapBuilder builder = MapUtils.builder()
-								.field(HomeManagementFrontView::getType, type.name());
-						if (type == HomeManagementConfig.Type.ex || type == HomeManagementConfig.Type.vg) {
-							builder.put("condition", conditionSql);
-							if (CollUtil.isNotEmpty(filter_goodsIds)) {
-								builder.field(HomeManagementFrontView::getGoodsId, filter_goodsIds).op(Operator.NotIn);
-							}
-						}
-						List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
-						map.putIfAbsent(type.name(), homeManagementFrontViews);
-					});
-			redisService.setNx(key, map, 50 * 60l);
-			o = redisService.get(key);
-		}
-		AtomicLong dsUserId = new AtomicLong();
-		AtomicBoolean existsChannel = new AtomicBoolean(true);
-		if (StrUtil.isNotBlank(dsCode)) {
-			UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
-			dsUserId.set(userSharedDto.getSharedId());
-		}
-		Map<String, List<HomeManagementFrontView>> map = Jsons.parseObject(o, Map.class);
-		if (map.containsKey(HomeManagementConfig.Type.ex.name()) || map.containsKey(HomeManagementConfig.Type.vg.name())) {
-			try {
-				//精彩推荐
-				List<HomeManagementFrontView> exList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.ex.name())), HomeManagementFrontView.class);
-				setHomeConfigGoods(map, HomeManagementConfig.Type.ex, exList, dsUserId, existsChannel, fUid);
-
-				//虚拟平台
-				List<HomeManagementFrontView> vgList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.vg.name())), HomeManagementFrontView.class);
-				setHomeConfigGoods(map, HomeManagementConfig.Type.vg, vgList, dsUserId, existsChannel, fUid);
-			} catch (Exception e) {
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(map);
-	}
-
-	/**
-	 * 首页点击 记录
-	 */
-	@PostMapping("/homePage/click")
-	public Result<String> homeManageClick(@RequestBody ClickRecordReq request) {
-		Long userId = StpUserUtil.getUserIdAfterLogin();
-		clickRecordFrontService.click(userId, request);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-    public List<Long> getFilterGoodsIds() {
-        List<Long> filter_goodsIds = null;
-	    //获取当前ip地址
-	    if (StringUtil.getRealAddressByIP(ServletUtil.getClientIP(request)).contains("杭州")) {
-		    //过滤杭州Ai ChatGPT平台
-		    SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
-				    .eq(SysConfig::getSysKey, Constant.LOCATION_FOR_GOODS_IDS).last("limit 1"));
-		    if (sysConfig != null && StrUtil.isNotBlank(sysConfig.getSysValue())) {
-			    try {
-				    filter_goodsIds = Jsons.parseList(sysConfig.getSysValue(), Long.class);
-			    } catch (Exception e) {
-			    }
-		    }
-	    }
-        return filter_goodsIds;
-    }
-
-	public Boolean isHzIp() {
-		if (StringUtil.getRealAddressByIP(ServletUtil.getClientIP(request)).contains("无锡")) {
-			return true;
-		}
-		return false;
-	}
-
-    /**
-     * @param goodsId
-     * @param type    1、普通,2、注册平台
-     * @param yhsId   店铺id
-     * @return
-     */
-    public String getPayMsgTime(Long goodsId, DateTime now, Integer type, Long yhsId) {
-        Date startTime = null;
-        StringBuilder notifyMsg = new StringBuilder();
-        if (type == 1) {
-            OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
-                    .eq(OrderDon::getGoodsId, goodsId)
-                    .notIn(OrderDon::getStatus, Constant.noOrderStatus).select(OrderDon::getCreatedTime, OrderDon::getPayTime, OrderDon::getId)
-                    .eq(yhsId != null, OrderDon::getYhsId, yhsId)
-                    .orderByDesc(OrderDon::getId)
-                    .last("limit 1"));
-            if (orderDon == null) {
-                notifyMsg.append("点击购买立即上车");
-                return notifyMsg.toString();
-            }
-            startTime = orderDon.getPayTime() != null ? orderDon.getPayTime() : orderDon.getCreatedTime();
-        } else if (type == 2) {
-            RegisterOrderDon orderDon = registerOrderDonMapper.selectOne(Wrappers.lambdaQuery(RegisterOrderDon.class)
-                    .eq(RegisterOrderDon::getGoodsId, goodsId)
-                    .notIn(RegisterOrderDon::getStatus, Constant.noOrderStatus).select(RegisterOrderDon::getCreatedTime, RegisterOrderDon::getPayTime, RegisterOrderDon::getId)
-                    .orderByDesc(RegisterOrderDon::getId)
-                    .last("limit 1"));
-            if (orderDon == null) {
-                return null;
-            }
-            startTime = orderDon.getPayTime() != null ? orderDon.getPayTime() : orderDon.getCreatedTime();
-        }
-        long hour = DateUtil.between(startTime, now, DateUnit.HOUR);
-        if (hour == 0) {
-            long minute = DateUtil.between(startTime, now, DateUnit.MINUTE);
-            if (minute == 0) {
-                notifyMsg.append("1分钟");
-            } else {
-                notifyMsg.append(minute);
-                notifyMsg.append("分钟");
-            }
-        } else {
-            if (hour > 3) {
-                int hours = RandomUtil.randomInt(3) + 1;
-                notifyMsg.append(hours);
-            } else {
-                notifyMsg.append(hour);
-            }
-            notifyMsg.append("小时");
-        }
-        notifyMsg.append("前有人购买");
-        return notifyMsg.toString();
-    }
-
-    /**
-     * 是否购买过特定平台
-     */
-    public Boolean isPaySpecificGoodsIds(String specificGoodsIdsStr, Long userId) {
-        if (StrUtil.isNotBlank(specificGoodsIdsStr)) {
-            try {
-                Set<Long> specificGoodsIds = Jsons.parseSet(specificGoodsIdsStr, Long.class);
-                Number number = beanSearcher.searchCount(OrderDon.class, MapUtils.builder().field(OrderDon::getGoodsId, specificGoodsIds).op(Operator.InList)
-                        .field(OrderDon::getUserId, userId)
-                        .field(OrderDon::getStatus, Constant.noOrderAllStatus).op(Operator.NotIn)
-                        .build());
-                if (number.intValue() == 0) {
-                    return false;
-                }
-                return true;
-            } catch (Exception e) {
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 设置平台 特定价格
-     */
-    public void setSpecificPrice(GoodsFrontListView data, Long fUid, Long dsUserId) {
-	    if (fUid != null) {
-		    if (data.getIsSp()) {
-			    //查找所有特定规格最小价格 满足条件
-			    String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "specific:" + data.getId();
-			    Object speciObj = redisService.get(specificGoodsKey);
-			    List<GoodsDonSku> specificSkus = null;
-			    if (speciObj != null) {
-				    specificSkus = Jsons.parseList(speciObj, GoodsDonSku.class);
-			    } else {
-				    specificSkus = goodsDonSkuMapper.selectList(
-						    Wrappers.lambdaQuery(GoodsDonSku.class)
-								    .eq(GoodsDonSku::getGoodsId, data.getId())
-								    .eq(GoodsDonSku::getStatus, true)
-								    .gt(GoodsDonSku::getSpecificPrice, 0));
-				    redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
-			    }
-			    specificSkus.forEach(specificSku -> {
-				    if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
-					    return;
-				    }
-				    String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
-				    if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
-					    BigDecimal specificPrice = data.getSpecificPrice();
-					    BigDecimal skuSpecificPrice = specificSku.getSpecificPrice();
-					    Long specificSkuId = specificSku.getId();
-					    if (specificPrice == null) {
-						    data.setSpecificPrice(skuSpecificPrice);
-						    data.setSpecificSkuId(specificSkuId);
-					    } else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
-						    data.setSpecificPrice(skuSpecificPrice);
-						    data.setSpecificSkuId(specificSkuId);
-					    }
-				    }
-			    });
-			    List<GoodsDonSkuFrontView> skuList = data.getSkuList();
-			    if (CollUtil.isNotEmpty(skuList)) {
-				    skuList.forEach(sku -> {
-					    //设置特定价格
-					    if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
-						    sku.setSpecificGoodsIds(null);
-						    sku.setSpecificPrice(null);
-					    }
-				    });
-			    }
-		    }
-	    }
-    }
-
-	/**
-	 * 设置平台 特定价格
-	 */
-	public void setGcSpecificPrice(GoodsFrontListCategoryView data, Long fUid, Long dsUserId) {
-		if (fUid != null) {
-			if (data.getIsSp()) {
-				//查找所有特定规格最小价格 满足条件
-				String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "specific:" + data.getId();
-				Object speciObj = redisService.get(specificGoodsKey);
-				List<GoodsDonSku> specificSkus = null;
-				if (speciObj != null) {
-					specificSkus = Jsons.parseList(speciObj, GoodsDonSku.class);
-				} else {
-					specificSkus = goodsDonSkuMapper.selectList(
-							Wrappers.lambdaQuery(GoodsDonSku.class)
-									.eq(GoodsDonSku::getGoodsId, data.getId())
-									.eq(GoodsDonSku::getStatus, true)
-									.gt(GoodsDonSku::getSpecificPrice, 0));
-					redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
-				}
-				specificSkus.forEach(specificSku -> {
-					if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
-						return;
-					}
-					String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
-					if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
-						BigDecimal specificPrice = data.getSpecificPrice();
-						BigDecimal skuSpecificPrice = specificSku.getSpecificPrice();
-						Long specificSkuId = specificSku.getId();
-						if (specificPrice == null) {
-							data.setSpecificPrice(skuSpecificPrice);
-							data.setSpecificSkuId(specificSkuId);
-						} else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
-							data.setSpecificPrice(skuSpecificPrice);
-							data.setSpecificSkuId(specificSkuId);
-						}
-					}
-				});
-				List<GoodsDonSkuFrontView> skuList = data.getSkuList();
-				if (CollUtil.isNotEmpty(skuList)) {
-					skuList.forEach(sku -> {
-						//设置特定价格
-						if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
-							sku.setSpecificGoodsIds(null);
-							sku.setSpecificPrice(null);
-						}
-					});
-				}
-			}
-		}
-	}
-
-	/**
-	 * 获取特定规格
-	 */
-	public List<GoodsDonSku> getSpecificSku(Long goodsId) {
-		//查找所有特定规格最小价格 满足条件
-		String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "specific:" + goodsId;
-		Object speciObj = redisService.get(specificGoodsKey);
-		List<GoodsDonSku> specificSkus = null;
-		if (speciObj != null) {
-			specificSkus = Jsons.parseList(speciObj, GoodsDonSku.class);
-		} else {
-			specificSkus = goodsDonSkuMapper.selectList(
-					Wrappers.lambdaQuery(GoodsDonSku.class)
-							.eq(GoodsDonSku::getGoodsId, goodsId)
-							.eq(GoodsDonSku::getStatus, true)
-							.gt(GoodsDonSku::getSpecificPrice, 0));
-			redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
-		}
-		specificSkus = Optional.ofNullable(specificSkus).orElse(new ArrayList<>());
-		return specificSkus;
-	}
-
-	/**
-	 * 设置首页配置 涉及平台特定价格
-	 */
-	public void setHomeManageSpecific(List<HomeManagementFrontView> list, Long fUid, Long dsUserId) {
-		DateTime now = DateTime.now();
-		list.forEach(data -> {
-			if (data.getIsSp() != null && data.getIsSp() && fUid != null) {
-				//查找所有特定规格最小价格 满足条件
-				List<GoodsDonSku> specificSkus = getSpecificSku(data.getGoodsId());
-				specificSkus.forEach(specificSku -> {
-					if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
-						return;
-					}
-					String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
-					if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
-						BigDecimal specificPrice = data.getSpecificPrice();
-						BigDecimal skuSpecificPrice = specificSku.getSpecificPrice();
-						Long specificSkuId = specificSku.getId();
-						if (specificPrice == null) {
-							data.setSpecificPrice(skuSpecificPrice);
-							data.setSpecificSkuId(specificSkuId);
-						} else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
-							data.setSpecificPrice(skuSpecificPrice);
-							data.setSpecificSkuId(specificSkuId);
-						}
-					}
-				});
-			}
-			data.setSold(getGoodsSold(data.getGoodsId(), data.getSold()));
-			data.setNotifyMsg(getPayMsgTime(data.getGoodsId(), now, 1, null));
-		});
-	}
-
-	public void setHomeConfigGoods(Map<String, List<HomeManagementFrontView>> map, HomeManagementConfig.Type type, List<HomeManagementFrontView> list, AtomicLong dsUserId, AtomicBoolean existsChannel, Long fUid) throws Exception {
-		//设置特定价格
-		if (CollUtil.isNotEmpty(list)) {
-			list = list.stream().filter(data -> {
-				if (data.getIsOwns()) {
-					if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
-						Long sharedId = userService.getSharedIdByUserId(fUid);
-						if (sharedId == 0) {
-							existsChannel.set(false);
-						}
-						dsUserId.set(sharedId);
-					}
-					GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getGoodsId(), dsUserId.get());
-					if (minPriceUserOwnsSku == null) {
-						return false;
-					}
-					data.setPrice(minPriceUserOwnsSku.getPrice());
-					data.setMonths(minPriceUserOwnsSku.getMonths());
-					data.setDays(minPriceUserOwnsSku.getDays());
-				}
-				return true;
-			}).collect(Collectors.toList());
-			setHomeManageSpecific(list, fUid, dsUserId.get());
-			map.put(type.name(), list);
-		}
-	}
-
-    /**
-     * 店铺平台列表
-     */
-    @GetMapping("/get/shop/goods/{yhsId}")
-    public Result<List<YhShopGoodsFrontView>> getShopGoods(@PathVariable Long yhsId) {
-        String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId;
-        Object value = redisService.get(yhShopCacheKey);
-        List<YhShopGoodsFrontView> list = null;
-        if (value != null) {
-            try {
-                list = Jsons.parseList(value, YhShopGoodsFrontView.class);
-            } catch (Exception e) {
-            }
-        }
-        if (CollUtil.isEmpty(list)) {
-            MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-            builder.put("condition", String.format("and yhs_id = %s", yhsId));
-            list = beanSearcher.searchAll(YhShopGoodsFrontView.class, builder.build());
-            redisService.setNx(yhShopCacheKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
-        }
-        DateTime now = DateTime.now();
-	    list.forEach(data -> {
-		    data.setSold(getGoodsSold(data.getId(), data.getSold()));
-		    data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
-		    Optional.ofNullable(yhShopGoodsSkuMapper.selectOne(Wrappers.lambdaQuery(YhShopGoodsSku.class)
-				    .eq(YhShopGoodsSku::getYhsId, yhsId)
-				    .eq(YhShopGoodsSku::getGoodsId, data.getId())
-				    .eq(YhShopGoodsSku::getPrice, data.getPrice())
-				    .eq(YhShopGoodsSku::getStatus, 1)
-				    .eq(YhShopGoodsSku::getDeleted, 1)
-				    .last("limit 1"))).ifPresent(yhSku -> {
-			    GoodsDonSku sku = goodsDonSkuMapper.selectById(yhSku.getSkuId());
-			    if (sku != null) {
-				    data.setMonths(sku.getMonths());
-				    data.setDays(sku.getDays());
-			    }
-		    });
-	    });
-	    return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-    }
-
-    /**
-     * 店铺平台详情
-     */
-    @GetMapping("/get/shop/goods/detail/{yhsId}/{goodsId}")
-    public Result<YhShopGoodsFrontView> getGoodsDetailByYhsId(@PathVariable Long yhsId, @PathVariable Long goodsId) {
-	    String yhShopDetailCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId + ":goodsId:" + goodsId;
-	    Object value = redisService.get(yhShopDetailCacheKey);
-	    if (value == null) {
-		    MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		    String condition = String.format("and yhs_id = %s and ys.goods_id = %s", yhsId, goodsId);
-		    builder.put("condition", condition);
-		    YhShopGoodsFrontView goodsDetailView = beanSearcher.searchFirst(YhShopGoodsFrontView.class, builder.build());
-		    if (goodsDetailView == null) {
-			    throw BusinessRuntimeException.getInstance("该平台不存在或已下架,请刷新页面");
-		    }
-		    goodsDetailView.setSkuList(beanSearcher.searchAll(YhShopGoodsSkuFrontView.class, MapUtils.builder().put("condition", condition).orderBy(YhShopGoodsSkuFrontView::getSorted).asc().build()));
-		    goodsDetailView.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, goodsDetailView.getId()).build()));
-		    OrderCommentFrontView comments = beanSearcher.searchFirst(OrderCommentFrontView.class, MapUtils.builder()
-				    .field(OrderCommentFrontView::getGoodsId, goodsDetailView.getId())
-				    .orderBy(OrderCommentFrontView::getCommentTime).desc()
-				    .orderBy(OrderCommentFrontView::getId).desc()
-				    .build());
-		    goodsDetailView.setComments(comments);
-		    redisService.setNx(yhShopDetailCacheKey, goodsDetailView, RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getTimeout() + RandomUtil.randomInt(1000));
-		    value = redisService.get(yhShopDetailCacheKey);
-	    }
-	    YhShopGoodsFrontView goodsDetailView = Jsons.parseObject(value, YhShopGoodsFrontView.class);
-	    return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDetailView);
-    }
-
-	/**
-	 * 根据分类获取对应平台
-	 */
-	@GetMapping("/get/categoryGoods")
-	public Result<? extends Object> getGoodsByCategory(Long cgy, String customId, String dsCode) {
-		if (StrUtil.isNotBlank(customId)) {
-			Result<List<YhShopGoodsFrontCategoryView>> shopGoods = getShopCategoryGoods(yhShopFrontService.getYhsIdByCustomId(customId), cgy);
-			return shopGoods;
-		}
-		Long fUid = StpUserUtil.getUserIdAfterLogin();
-		String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category:goods";
-		if (cgy != null) {
-			categoryGoodsKey += ":" + cgy;
-		}
-		//List<Long> filter_goodsIds = getFilterGoodsIds();
-		List<Long> filter_goodsIds = null;
-		if (CollUtil.isNotEmpty(filter_goodsIds)) {
-			categoryGoodsKey += ":hz-ip";
-		}
-		Object o = redisService.get(categoryGoodsKey);
-		if (o == null) {
-			DateTime now = DateTime.now();
-			MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-			if (cgy != null) {
-				String condition = String.format(" and gcr.category = %s", cgy);
-				mapBuilder.put("condition", condition);
-			}
-			if (CollUtil.isNotEmpty(filter_goodsIds)) {
-				mapBuilder.field(GoodsFrontListCategoryView::getId, filter_goodsIds).op(Operator.NotIn);
-			}
-			List<GoodsFrontListCategoryView> goodsFrontListViews = beanSearcher.searchAll(GoodsFrontListCategoryView.class, mapBuilder.build());
-			goodsFrontListViews.forEach(data -> {
-				data.setSold(getGoodsSold(data.getId(), data.getSold()));;
-				data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
-			});
-			redisService.setNx(categoryGoodsKey, goodsFrontListViews, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 10 * 60);
-			o = redisService.get(categoryGoodsKey);
-		}
-		List<GoodsFrontListCategoryView> goodsFrontListViews = Jsons.parseList(o, GoodsFrontListCategoryView.class);
-		AtomicLong dsUserId = new AtomicLong();
-		AtomicBoolean existsChannel = new AtomicBoolean(true);
-		if (StrUtil.isNotBlank(dsCode)) {
-			UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
-			dsUserId.set(userSharedDto.getSharedId());
-		}
-		AtomicBoolean filterCourseGoods = new AtomicBoolean(false);
-		//增值服务分类
-		if (fUid != null && cgy != null && (cgy == 3 || cgy == 4)) {
-			//GPT Plus基础2月 课程不展示
-			List<Long> userIdList = userBindRelationService.getRelationUserIdList(fUid, null);
-			Integer orders = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-					.in(OrderDon::getUserId, userIdList)
-					.eq(OrderDon::getSkuId, 444)
-					.notIn(OrderDon::getStatus, Constant.noOrderStatus));
-			if (orders > 0) {
-				filterCourseGoods.set(true);
-			}
-		}
-		goodsFrontListViews = goodsFrontListViews.stream().filter(data -> {
-			if (data.getIsOwns()) {
-				if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
-					Long sharedId = userService.getSharedIdByUserId(fUid);
-					if (sharedId == 0) {
-						existsChannel.set(false);
-					}
-					dsUserId.set(sharedId);
-				}
-				GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getId(), dsUserId.get());
-				if (minPriceUserOwnsSku == null) {
-					return false;
-				}
-				data.setPrice(minPriceUserOwnsSku.getPrice());
-				data.setMonths(minPriceUserOwnsSku.getMonths());
-				data.setDays(minPriceUserOwnsSku.getDays());
-			}
-			//课件类型 且过滤
-			if (filterCourseGoods.get() && data.getSpecialType() != null && data.getSpecialType() == GoodsDon.SpecialType.courseware) {
-				return false;
-			}
-			//设置特定价格
-			setGcSpecificPrice(data, fUid, dsUserId.get());
-			return true;
-		}).collect(Collectors.toList());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsFrontListViews);
-	}
-
-	@GetMapping("/get/shop/categoryGoods/{yhsId}")
-	public Result<List<YhShopGoodsFrontCategoryView>> getShopCategoryGoods(@PathVariable Long yhsId, Long category) {
-		String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId + ":category";
-		if (category != null) {
-			categoryGoodsKey += ":" + category;
-		}
-		Object value = redisService.get(categoryGoodsKey);
-		if (value == null) {
-			DateTime now = DateTime.now();
-			MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-			builder.put("yhsId", String.format(" and yhs_id = %s", yhsId));
-			String condition = StrUtil.EMPTY;
-			if (category != null) {
-				condition += String.format(" and gcr.category = %s", category);
-			}
-			builder.put("condition", condition);
-			List<YhShopGoodsFrontCategoryView> list = beanSearcher.searchAll(YhShopGoodsFrontCategoryView.class, builder.build());
-			list.forEach(data->{
-				data.setSold(getGoodsSold(data.getId(), data.getSold()));
-				data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
-				//重新设置最低价格规格
-				YhShopGoodsSku sku = yhShopGoodsSkuMapper.selectMinPriceSkuByYhsId(yhsId, data.getId());
-				data.setPrice(sku.getPrice());
-				data.setSkuId(sku.getSkuId());
-			});
-			redisService.setNx(categoryGoodsKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 5 * 60);
-			value = redisService.get(categoryGoodsKey);
-		}
-		List<YhShopGoodsFrontCategoryView> list = Jsons.parseList(value, YhShopGoodsFrontCategoryView.class);
-		list.forEach(data->{
-			Optional.ofNullable(yhShopGoodsSkuMapper.selectOne(Wrappers.lambdaQuery(YhShopGoodsSku.class)
-					.eq(YhShopGoodsSku::getYhsId, yhsId)
-					.eq(YhShopGoodsSku::getGoodsId, data.getId())
-					.eq(YhShopGoodsSku::getPrice, data.getPrice())
-					.eq(YhShopGoodsSku::getStatus, 1)
-					.eq(YhShopGoodsSku::getDeleted, 1)
-					.last("limit 1"))).ifPresent(yhSku -> {
-				GoodsDonSku sku = goodsDonSkuMapper.selectById(yhSku.getSkuId());
-				if (sku != null) {
-					data.setMonths(sku.getMonths());
-					data.setDays(sku.getDays());
-				}
-			});
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	/**
-	 * 获取设备活动详情
-	 */
-	@GetMapping("/get/equipment/activity")
-	public Result<EquipmentActivityReduce> getEpActivity() {
-		DateTime now = DateTime.now();
-		EquipmentActivityReduce equipmentActivityReduce = beanSearcher.searchFirst(EquipmentActivityReduce.class, MapUtils.builder()
-				.field(EquipmentActivityReduce::getSt, now).op(Operator.LessEqual)
-				.field(EquipmentActivityReduce::getEt, now).op(Operator.GreaterThan)
-				.field(EquipmentActivityReduce::getDeleted, 1)
-				.onlySelect(EquipmentActivityReduce::getF, EquipmentActivityReduce::getQ, EquipmentActivityReduce::getTq, EquipmentActivityReduce::getSt, EquipmentActivityReduce::getEt)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(equipmentActivityReduce);
-	}
-
-	/**
-	 * 获取租赁商品列表
-	 */
-	@GetMapping("/get/deposit")
-	public Result<? extends Object> getDepositGoods() {
-		String depositGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "deposit";
-		Object o = redisService.get(depositGoodsKey);
-		if (o == null) {
-			List<GoodsDon> depositList = beanSearcher.searchAll(GoodsDon.class, MapUtils.builder()
-					.field(GoodsDon::getType, 4)
-					.field(GoodsDon::getStatus, true)
-					.field(GoodsDon::getDeleted, true)
-					.onlySelect(GoodsDon::getId, GoodsDon::getTitle, GoodsDon::getLogo)
-					.build());
-			if (CollUtil.isEmpty(depositList)) {
-				return GatewayResponse.SUCCESS.newBuilder().toResult();
-			}
-			redisService.setNx(depositGoodsKey, depositList, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 60 * RandomUtil.randomInt(10));
-			o = redisService.get(depositGoodsKey);
-		}
-		List<GoodsDon> depositList = Jsons.parseList(o, GoodsDon.class);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(depositList);
-	}
-
-	/**
-	 * 获取pc广告配置
-	 */
-	@GetMapping("/get/pc/homeManage")
-	public Result<Map<String, List<HomeManagementFrontView>>> getPcHomeManagementFrontPage() {
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "pc:homeManage";
-		//移除奈飞客厅 临时
-		Long filterConfigId = null;
-//		if (isHzIp()) {
-//			key += ":hz_ip";
-//			filterConfigId = 55l;
-//		}
-		Object o = redisService.get(key);
-		if (o == null) {
-			MapBuilder builder = MapUtils.builder()
-					.field(HomeManagementFrontView::getAdType, List.of(HomeManagementConfig.AdType.pc.name(), HomeManagementConfig.AdType.pcSec.name(), HomeManagementConfig.AdType.pcDis.name())).op(Operator.InList);
-			if (filterConfigId != null) {
-				builder.field(HomeManagementFrontView::getHomeManageConfigId, filterConfigId).op(Operator.NotEqual);
-			}
-			List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
-			Map<HomeManagementConfig.AdType, List<HomeManagementFrontView>> map = homeManagementFrontViews.stream().collect(Collectors.groupingBy(HomeManagementFrontView::getAdType));
-			redisService.setNx(key, map, 50 * 60l);
-			o = redisService.get(key);
-		}
-		Map<String, List<HomeManagementFrontView>> map = Jsons.parseObject(o, Map.class);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(map);
-	}
-
-	/**
-	 * 获取pc实物配置
-	 */
-	@GetMapping("/get/pc/realGoodsConfig")
-	public Result<? extends Object> getPcRealGoodsConfig() throws Exception {
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "pc:realHomePage";
-		Object o = redisService.get(key);
-		List<HomeManagementFrontView> list = null;
-		if (o == null) {
-			list = goodsDonFrontService.getRealGoodsConfig();
-			redisService.setNx(key, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 300);
-		}
-		if (list == null && o != null) {
-			list = Jsons.parseList(o, HomeManagementFrontView.class);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	/**
-	 * 百亿补贴
-	 * 补贴规格列表
-	 */
-	@GetMapping("/get/subsidy")
-	public Result<List<GoodsDonSkuSubsidyFrontView>> getSubsidyGoods() {
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "subsidy";
-		Object o = redisService.get(key);
-		if (o == null) {
-			List<GoodsDonSkuSubsidyFrontView> subsidyList = beanSearcher.searchAll(GoodsDonSkuSubsidyFrontView.class, MapUtils.builder().build());
-			subsidyList.forEach(e -> {
-				Optional.ofNullable(beanSearcher.searchFirst(GoodsDonSkuSubsidyDetailView.class, MapUtils.builder().field(GoodsDonSkuSubsidyDetailView::getGoodsId, e.getId()).field(GoodsDonSkuSubsidyDetailView::getPrice, e.getPrice()).build())).ifPresent(sku -> {
-					e.setOriPrice(sku.getOriPrice());
-					e.setMonths(sku.getMonths());
-					e.setDays(sku.getDays());
-					e.setSkuId(sku.getId());
-					e.setPicture(sku.getSubsidyPicture());
-				});
-			});
-			redisService.setNx(key, subsidyList, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 60 * RandomUtil.randomInt(10));
-			o = redisService.get(key);
-		}
-		List<GoodsDonSkuSubsidyFrontView> subsidyList = Jsons.parseList(o, GoodsDonSkuSubsidyFrontView.class);
-		if (CollUtil.isEmpty(subsidyList)) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult(subsidyList);
-		}
-		Long userId = StpUserUtil.getUserIdAfterLogin();
-		if (userId != null) {
-			List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
-			//过滤用户已经购买过平台
-			List<Long> goodsIds = orderDonMapper.getPayGoodsIds(relationUserIdList);
-			if (CollUtil.isNotEmpty(goodsIds)) {
-				subsidyList = subsidyList.stream().filter(data -> !goodsIds.contains(data.getId())).collect(Collectors.toList());
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(subsidyList);
-	}
-
-	/**
-	 * 百亿补贴规格详情
-	 */
-	@GetMapping("/get/subsidy/detail/{id}")
-	public Result<GoodsDonSubsidyDetailView> getSubsidyDetailById(@PathVariable Long id) throws Exception {
-		String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "subsidy:detail:" + id;
-		Object o = redisService.get(goodsDetailKey);
-		GoodsDonSubsidyDetailView subsidyDetail = null;
-		if (o == null) {
-			subsidyDetail = beanSearcher.searchFirst(GoodsDonSubsidyDetailView.class, MapUtils.builder().field(GoodsDonSubsidyDetailView::getId, id).build());
-			if (subsidyDetail == null) {
-				return GatewayResponse.SUCCESS.newBuilder().toResult();
-			}
-
-			subsidyDetail.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, subsidyDetail.getId()).build()));
-			MapBuilder builder = MapUtils.builder().field(GoodsDonSkuSubsidyDetailView::getGoodsId, subsidyDetail.getId());
-			subsidyDetail.setSkuList(beanSearcher.searchAll(GoodsDonSkuSubsidyDetailView.class, builder.build()));
-			subsidyDetail.setSold(getGoodsSold(subsidyDetail.getId(), subsidyDetail.getSold()));
-
-			redisService.setNx(goodsDetailKey, Jsons.toJson(subsidyDetail), RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 60 * RandomUtil.randomInt(10));
-		}
-		if (subsidyDetail == null) {
-			o = redisService.get(goodsDetailKey);
-			subsidyDetail = Jsons.parseObject(o.toString(), GoodsDonSubsidyDetailView.class);
-		}
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult(subsidyDetail);
-	}
-
-	/**
-	 * 可选百亿补贴规格列表
-	 */
-	@GetMapping("/get/available/subsidy/sku/{goodsId}")
-	public Result<List<GoodsDonSkuSubsidyAvailableView>> getAvailableSubsidySku(@PathVariable Long goodsId) {
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "subsidy:" + goodsId;
-		Object o = redisService.get(key);
-		if (o == null) {
-			List<GoodsDonSkuSubsidyAvailableView> goodsDonSkuSubsidyAvailableViews = beanSearcher.searchAll(GoodsDonSkuSubsidyAvailableView.class, MapUtils.builder().put("gid", String.format(" and goods_id = %s", goodsId)).build());
-			if (CollUtil.isEmpty(goodsDonSkuSubsidyAvailableViews)) {
-				return GatewayResponse.SUCCESS.newBuilder().toResult();
-			}
-			redisService.set(key, goodsDonSkuSubsidyAvailableViews, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + RandomUtil.randomInt(10000));
-			o = redisService.get(key);
-		}
-		List<GoodsDonSkuSubsidyAvailableView> goodsDonSkuSubsidyAvailableViews = Jsons.parseList(o, GoodsDonSkuSubsidyAvailableView.class);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDonSkuSubsidyAvailableViews);
-	}
-
-	/**
-	 * 获取用户店铺首页配置列表
-	 */
-	@GetMapping("/get/shop/homeManage")
-	public Result<Map<String, List<HomeManagementFrontView>>> getShopHomeManageConfig(String customId) {
-		//是否同意展示对应首页广告位
-		String key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + customId + ":homeManage";
-		Object o = redisService.get(key);
-		if (o == null) {
-			MapBuilder builder = MapUtils.builder()
-					.field(HomeManagementFrontView::getType, HomeManagementConfig.Type.ad.name())
-					.field(HomeManagementFrontView::getIsShop, 1);
-			List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
-			if (homeManagementFrontViews == null) {
-				return GatewayResponse.SUCCESS.newBuilder().toResult();
-			}
-			Map<String, List<HomeManagementFrontView>> map = new ConcurrentHashMap<>();
-			map.putIfAbsent(HomeManagementConfig.Type.ad.name(), homeManagementFrontViews);
-			redisService.setNx(key, map, 50 * 60l);
-			o = redisService.get(key);
-		}
-		Map map = Jsons.parseObject(o, Map.class);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(map);
-	}
-
-	/**
-	 * 获取套餐列表
-	 */
-	@GetMapping("/get/upgradePackage")
-	public Result<SearchResult<UpgradePackageView>> list(Long skuId) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		log.info("userId:{}获取套餐列表", userId);
-		Map<String, Object> build = MapUtils.flatBuilder(request.getParameterMap()).build();
-		if (skuId != null) {
-			build.put("sku", String.format(" and JSON_CONTAINS(up.sku_ids,'\"%s\"')", skuId));
-		}
-		SearchResult<UpgradePackageView> search = beanSearcher.search(UpgradePackageView.class, build);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 获取所有平台列表
-	 */
-	@GetMapping("/get/goods")
-	public Result<List<GoodsDon>> getAllGoodsList() {
-		List<GoodsDon> goodsDons = beanSearcher.searchAll(GoodsDon.class, MapUtils.flatBuilder(request.getParameterMap()).field(GoodsDon::getStatus, 1)
-				.onlySelect(GoodsDon::getId, GoodsDon::getTitle)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDons);
-	}
-
-
-	/**
-	 * 获取平台销量
-	 * @param goodsId
-	 * @param virtualSold
-	 * @return
-	 */
-	private Integer getGoodsSold(Long goodsId, Integer virtualSold) {
-		Object soldObj = redisService.get(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "sold:" + goodsId);
-		if (soldObj == null) {
-			Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-					.eq(OrderDon::getGoodsId, goodsId).notIn(OrderDon::getStatus, Constant.noOrderStatus));
-			soldObj = sold + virtualSold;
-			redisService.set(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "sold:" + goodsId, soldObj, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
-		}
-		return Integer.parseInt(soldObj.toString());
-	}
-
-
-}

+ 0 - 55
netflix-web/src/main/java/com/cyksj/web/controller/gpt/ChatGptController.java

@@ -1,55 +0,0 @@
-package com.cyksj.web.controller.gpt;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.Account;
-import com.cyksj.service.chatgpt.ChatGptAuthService;
-import com.cyksj.service.mange.CmsAccountService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * @author chan
- * @date 2023/6/2 5:19 PM
- */
-
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/chat")
-public class ChatGptController {
-    private final ChatGptAuthService chatGptAuthService;
-
-    private final CmsAccountService accountService;
-
-    @GetMapping("/getAccessToken")
-    private Result<String> getAccessToken(String username) throws Exception {
-
-        log.info("获取chatgpt 凭证 username:{}",username);
-        String accessToken = chatGptAuthService.getAccessToken(username);
-        log.info("获取chatgpt 凭证返回 token:{}",accessToken);
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult(accessToken);
-    }
-
-    @GetMapping("/init")
-    private Result<String> init() throws Exception {
-        List<Account> list = accountService.list(Wrappers.lambdaQuery(Account.class).eq(Account::getGoodsId, 18).eq(Account::getGptRefreshToken, ""));
-        for (Account account : list) {
-            log.info("账号:{} 正在执行获取token", account.getAccount());
-            try {
-                chatGptAuthService.getRefreshToken(account);
-            }catch (Exception e){
-                log.error("账号:{} 获取token 错误:{}",account.getAccount(), e.getMessage());
-            }
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-}

+ 0 - 107
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupController.java

@@ -1,107 +0,0 @@
-package com.cyksj.web.controller.group;
-
-import com.cyksj.common.constant.Constant;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.model.entity.GroupsRelation;
-import com.cyksj.model.manage.views.GroupsRelationView;
-import com.cyksj.model.views.GroupsView;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * @author chan
- * @date 2022/9/26 6:31 PM
- */
-@Slf4j
-@RequestMapping("/applets/group")
-@RestController
-@RequiredArgsConstructor
-public class GroupController {
-
-    private final HttpServletRequest request;
-
-    private final BeanSearcher beanSearcher;
-
-    private final GoodsDonSkuMapper goodsDonSkuMapper;
-
-    @GetMapping("/get")
-    @Deprecated
-    public Result<SearchResult<GroupsView>> get() {
-        SearchResult<GroupsView> search = beanSearcher.search(GroupsView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .orderBy(GroupsView::getOrderBy).asc()
-                .orderBy(GroupsView::getId).desc().build()
-        );
-        search.getDataList().forEach((groupsView) -> {
-            if (Constant.CHAT_GPT_SKU_IDS.contains(groupsView.getSkuId())) {
-                List<GroupsRelationView> relationViewList = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
-                        .field(GroupsRelationView::getGroupsId, groupsView.getId())
-                        .field(GroupsRelationView::getStatus, GroupsRelation.Status.outside.name()).op(Operator.NotEqual)
-                        .orderBy(GroupsRelationView::getUpdate_time).desc()
-                        .build());
-                List<GroupsRelationView> all = null;
-                //GPT 月付 暗改成20个 展示10个
-                if (groupsView.getSkuId().equals(Constant.CHAT_GPT_SKU_IDS.get(0)) && groupsView.getNum() == 20) {
-                    all = relationViewList.subList(0, 5);
-                    List<GroupsRelationView> after = relationViewList.subList(relationViewList.size() - 5, relationViewList.size());
-                    all.addAll(after);
-                }
-                //GPT 4人月付暗改成6个 展示4个
-                else if (groupsView.getSkuId().equals(Constant.CHAT_GPT_SKU_IDS.get(1)) && groupsView.getNum() == 6) {
-                    all = relationViewList.subList(0, 2);
-                    List<GroupsRelationView> after = relationViewList.subList(relationViewList.size() - 2, relationViewList.size());
-                    all.addAll(after);
-                }
-                //GPT 10人年付暗改成10个
-                else if (groupsView.getSkuId().equals(Constant.CHAT_GPT_SKU_IDS.get(2)) && groupsView.getNum() == 12) {
-                    all = relationViewList.subList(0, 5);
-                    List<GroupsRelationView> after = relationViewList.subList(relationViewList.size() - 5, relationViewList.size());
-                    all.addAll(after);
-                } else {
-                    all = relationViewList;
-                }
-                groupsView.setRelations(all);
-            } else if (Constant.MIDJOURNEY_SKU_IDS.contains(groupsView.getSkuId()) && groupsView.getNum() == 15) {
-                List<GroupsRelationView> relationViewList = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
-                        .field(GroupsRelationView::getGroupsId, groupsView.getId())
-                        .orderBy(GroupsRelationView::getUpdate_time).desc()
-                        .build());
-                List<GroupsRelationView> all = null;
-                //MIDJOURNEY 月付5个 暗改15个 展示5个
-                if (groupsView.getSkuId().equals(Constant.MIDJOURNEY_SKU_IDS.get(0)) && groupsView.getNum() == 15) {
-                    all = relationViewList.subList(0, 4);
-                    List<GroupsRelationView> after = relationViewList.subList(relationViewList.size() - 1, relationViewList.size());
-                    all.addAll(after);
-                }
-                //MIDJOURNEY 标准会员月付 Pro会员月付;Pro会员年付;标准会员年付;10个 暗改15个 展示10个
-                else if ((groupsView.getSkuId().equals(Constant.MIDJOURNEY_SKU_IDS.get(1)) || groupsView.getSkuId().equals(Constant.MIDJOURNEY_SKU_IDS.get(2))
-                        || groupsView.getSkuId().equals(Constant.MIDJOURNEY_SKU_IDS.get(3)) || groupsView.getSkuId().equals(Constant.MIDJOURNEY_SKU_IDS.get(4))) && groupsView.getNum() == 15) {
-	                all = relationViewList.subList(0, 5);
-	                List<GroupsRelationView> after = relationViewList.subList(relationViewList.size() - 5, relationViewList.size());
-	                all.addAll(after);
-                } else {
-	                all = relationViewList;
-                }
-                groupsView.setRelations(all);
-            } else {
-                groupsView.setRelations(beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
-                        .field(GroupsRelationView::getGroupsId, groupsView.getId())
-                        .field(GroupsRelationView::getStatus, GroupsRelation.Status.outside.name()).op(Operator.NotEqual)
-                        .build()));
-            }
-
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-}

+ 0 - 1197
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -1,1197 +0,0 @@
-package com.cyksj.web.controller.group;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUnit;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.lang.Assert;
-import cn.hutool.core.thread.ThreadUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.extra.servlet.ServletUtil;
-import cn.hutool.json.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.snowflake.Sequence;
-import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
-import com.cyksj.common.util.GoogleGenerator;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.common.util.StringUtil;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.*;
-import com.cyksj.mapper.manage.form.FormFieldsDataMapper;
-import com.cyksj.mapper.manage.form.QuestionnairePromotionMapper;
-import com.cyksj.model.dto.DoubleVerifyDto;
-import com.cyksj.model.dto.QuestionnaireView;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.manage.views.AccountView;
-import com.cyksj.model.manage.views.GroupsRelationView;
-import com.cyksj.model.request.*;
-import com.cyksj.model.response.GptStandbyResp;
-import com.cyksj.model.views.*;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.chatgpt.ChatGptAuthService;
-import com.cyksj.service.mange.CmsOrderDonService;
-import com.cyksj.service.mange.coupon.CouponCommonService;
-import com.cyksj.service.mange.ticket.TicketAdvertiseConfigClickRecordService;
-import com.cyksj.service.order.OrderDonService;
-import com.cyksj.service.relation.GroupRelationFrontService;
-import com.cyksj.service.relation.GroupsRelationNetflixService;
-import com.cyksj.service.user.UserBindRelationService;
-import com.cyksj.service.user.UserService;
-import com.cyksj.web.util.StpUserUtil;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.operator.LessEqual;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.stream.Collectors;
-
-/**
- * @author chan
- * @date 2022/9/27 11:48 AM
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/applets/group/relation")
-public class GroupRelationController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final OrderDonService orderDonService;
-
-    private final GroupsRelationMapper relationMapper;
-
-    private final GroupRelationFrontService groupRelationFrontService;
-
-    private final UserService userService;
-
-    private final UserBindRelationService userBindRelationService;
-
-    private final TicketPwdViewRecordMapper ticketPwdViewRecordMapper;
-
-    private final HttpServletRequest request;
-
-    private final AccountDoubleVerifyRecordMapper accountDoubleVerifyRecordMapper;
-
-    private final DoubleVerifyClickRecordMapper doubleVerifyRecordMapper;
-
-    private final RedisService redisService;
-
-    private final DoubleVerifyClickRefreshRecordMapper refreshRecordMapper;
-
-    private final QuestionResponseRecordMapper questionResponseRecordMapper;
-
-    private final CouponCommonService couponCommonService;
-
-    private final FormFieldsDataMapper formFieldsDataMapper;
-
-    private final QuestionnairePromotionMapper questionnairePromotionMapper;
-
-    private final TicketAdvertiseConfigClickRecordService ticketAdvertiseConfigClickRecordService;
-
-    private final GlobalThreadPoolTaskExecutor THREAD_POOL;
-
-    private final ChatGptAuthService chatGptAuthService;
-
-    private final GoodsCoursewareFileMapper goodsCoursewareFileMapper;
-
-    private final GptTicketStandbyMapper gptTicketStandbyMapper;
-
-    private final CmsOrderDonService cmsOrderDonService;
-
-    private final GoodsDonSkuMapper goodsDonSkuMapper;
-
-    private final AccountBlockedReplaceRecordMapper accountBlockedReplaceRecordMapper;
-
-    private final OrderDonMapper orderDonMapper;
-
-    private final UserGoodsNewbieGuideRecordMapper userGoodsNewbieGuideRecordMapper;
-
-    private final GroupsRelationNetflixService groupsRelationNetflixService;
-
-    private final ChatgptUserMapper chatgptUserMapper;
-
-    private final UpgradeOrderDonMapper upgradeOrderDonMapper;
-
-    private final UserBenefitsOrderRecordMapper userBenefitsOrderRecordMapper;
-
-    private final ClaudeUserMapper claudeUserMapper;
-
-    private final static Sequence SEQUENCE = new Sequence(0);
-
-    @RequestMapping("/get/renewal")
-    public Result<SearchResult<RenewalView>> get(Boolean isLoginPopularize, String customId, String account, String orderNo, Integer cmt) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        SearchResult<RenewalView> list = groupRelationFrontService.getMyTicket(userId, isLoginPopularize, customId, account, orderNo, cmt);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-    }
-
-    @GetMapping("/get/pay/goods")
-    public Result<List<RenewalView>> getHasPayGoods() {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<RenewalView> hasPayGoods = groupRelationFrontService.getHasPayGoods(userId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(hasPayGoods);
-    }
-
-    @PostMapping("/post/renewal")
-    public Result<OrderDon> renewal(@RequestBody OrderPayRequest payRequest) throws Exception {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        payRequest.setUserId(userId);
-
-        String ip = ServletUtil.getClientIP(request);
-        payRequest.setIp(ip);
-
-        OrderDon orderDon = orderDonService.renewal(payRequest);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);
-    }
-
-    @PutMapping("/update/set/account")
-    public Result<String> setAccount(@RequestBody GroupsRelation relation) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
-        GroupsRelation re = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
-                .eq(GroupsRelation::getId, relation.getId())
-                .in(GroupsRelation::getUserId, userIds)
-                .last(" limit 1"));
-        if (re == null) {
-            throw new BusinessRuntimeException("该车票不存在,请联系客服.");
-        }
-        LambdaUpdateWrapper<GroupsRelation> updateWrapper = Wrappers.lambdaUpdate(GroupsRelation.class)
-                .set(GroupsRelation::getAccount, relation.getAccount())
-                .set(GroupsRelation::getPassword, relation.getPassword())
-                .eq(GroupsRelation::getId, relation.getId());
-        if (re.getRechargeStatus() != null) {
-            if (re.getRechargeStatus() == GroupsRelation.RechargeStatus.complete) {
-                throw BusinessRuntimeException.getInstance("代充账号已充值");
-            }
-            if (StrUtil.isEmpty(relation.getAccount()) || StrUtil.isEmpty(relation.getPassword())) {
-                throw BusinessRuntimeException.getInstance("请输入正确的账号密码信息");
-            }
-            if (re.getRechargeStatus() == GroupsRelation.RechargeStatus.error) {
-                updateWrapper.set(GroupsRelation::getRechargeStatus, GroupsRelation.RechargeStatus.waiting);
-            }
-        }
-        relationMapper.update(relation, updateWrapper);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 查询是否加入了企业微信
-     */
-    @GetMapping("/check/joinCorpWx")
-    public Result<Boolean> isJoinCorpWx() {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        Boolean flag = groupRelationFrontService.isJoinCorpWx(userId, false, false);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(flag);
-    }
-
-    /**
-     * 获取全部车票
-     */
-    @GetMapping("/get")
-    public Result<List<UserTicketView>> getUserTicketView(Long goodsId, Long skuId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
-        List<UserTicketView> tickets = relationMapper.selectUserTickets(userIds, goodsId, skuId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(tickets);
-    }
-
-    /**
-     * 记录查看ChatGPT车票密码
-     */
-    @GetMapping("/recordView/{relationId}")
-    public Result<String> recordGPTPwdView(@PathVariable Long relationId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
-        GroupsRelationView groupsRelationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder()
-                .field(GroupsRelationView::getUserId, userIds).op(Operator.InList)
-                .field(GroupsRelationView::getId, relationId).build());
-        if (groupsRelationView == null) {
-            log.info("userId:{}查看relationId:{}车票不存在", userId, relationId);
-            throw BusinessRuntimeException.getInstance("该车票已不存在");
-        }
-        if (groupsRelationView.getAccountId() == null) throw BusinessRuntimeException.getInstance("该车队未配置账号");
-        if (groupRelationFrontService == null) throw BusinessRuntimeException.getInstance("车票已不存在");
-        TicketPwdViewRecord viewRecord = new TicketPwdViewRecord();
-        viewRecord.setUserId(userId);
-        viewRecord.setRelationId(relationId);
-        viewRecord.setSkuId(groupsRelationView.getSkuId());
-        viewRecord.setOperateLocation(ServletUtil.getClientIP(request));
-        viewRecord.setAccount(groupsRelationView.getTripsAccount());
-        viewRecord.setPassword(groupsRelationView.getTripsPassword());
-        ticketPwdViewRecordMapper.insert(viewRecord);
-        if (groupsRelationView.getGoodsId() == 18 && StrUtil.isEmpty(groupsRelationView.getApiSecret())) {
-            THREAD_POOL.execute(() -> {
-                //车队所有人查看密码
-                Integer num = groupsRelationView.getGtNum();
-                Integer viewNum = relationMapper.selectViewPwdCount(groupsRelationView.getGroupsId());
-                if (num <= viewNum) {
-                    AccountDoubleVerifyRecord exist = accountDoubleVerifyRecordMapper.selectOne(Wrappers.lambdaQuery(AccountDoubleVerifyRecord.class)
-                            .eq(AccountDoubleVerifyRecord::getAccountId, groupsRelationView.getAccountId())
-                            .eq(AccountDoubleVerifyRecord::getDeleted, true).last("limit 1"));
-                    if (exist == null) {
-                        if (redisService.setNx(String.format("%s-%s", groupsRelationView.getAccountId(), groupsRelationView.getId()), groupsRelationView.getId(), 60l)) {
-                            //记录
-                            AccountDoubleVerifyRecord accountDoubleVerifyRecord = new AccountDoubleVerifyRecord();
-                            accountDoubleVerifyRecord.setAccountId(groupsRelationView.getAccountId());
-                            accountDoubleVerifyRecord.setAccount(groupsRelationView.getTripsAccount());
-                            accountDoubleVerifyRecord.setGroupsId(groupsRelationView.getGroupsId());
-                            accountDoubleVerifyRecord.setSkuId(groupsRelationView.getSkuId());
-                            accountDoubleVerifyRecord.setRemark("车队所有人看过密码");
-                            accountDoubleVerifyRecordMapper.insert(accountDoubleVerifyRecord);
-                        }
-                    }
-                }
-            });
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(groupsRelationView.getTripsPassword());
-    }
-
-    /**
-     * 获取AI类 ChatGPT产品谷歌验证码
-     */
-    @GetMapping("/get/authCode")
-    public Result<String> getAuthCode(Long relationId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
-        if (relationId == null) throw BusinessRuntimeException.getInstance("车票不存在");
-        GroupsRelationView groupsRelationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder()
-                .field(GroupsRelationView::getId, relationId)
-                .field(GroupsRelationView::getUserId, userIds).op(Operator.InList).build());
-        if (groupsRelationView == null) throw BusinessRuntimeException.getInstance("车票不存在");
-        if (StrUtil.isEmpty(groupsRelationView.getApiSecret())) throw BusinessRuntimeException.getInstance("未开启验证");
-        DateTime now = DateTime.now();
-        Integer count = doubleVerifyRecordMapper.selectCount(Wrappers.lambdaQuery(DoubleVerifyClickRecord.class)
-                .in(DoubleVerifyClickRecord::getUserId, userIds)
-                .eq(DoubleVerifyClickRecord::getRelationId, relationId)
-                .eq(DoubleVerifyClickRecord::getAccountId, groupsRelationView.getAccountId())
-                .between(DoubleVerifyClickRecord::getCreatedTime, DateUtil.beginOfMonth(now), DateUtil.endOfMonth(now)));
-        //获取双重验证码
-        Boolean isHasVerifyCode = StrUtil.isNotBlank(groupsRelationView.getVerifyCode()) ? true : false;
-        //出去亚马逊 获取限制
-        if (groupsRelationView.getGoodsId() != 6) {
-            Integer num = groupRelationFrontService.getUserCodeNumBySkuId(userId, groupsRelationView.getSkuId(), isHasVerifyCode);
-            if (count >= num) throw BusinessRuntimeException.getInstance("获取双重验证码次数上限");
-        }
-        //一分钟内 只能一人获取
-        boolean b = redisService.setNx(RedisService.key.DOUBLE_VERIFY_CODE_VIEW_MINUTES_KEY.getName() + groupsRelationView.getTripsAccount(), relationId, RedisService.key.DOUBLE_VERIFY_CODE_VIEW_MINUTES_KEY.getTimeout());
-        if (!b) {
-            throw BusinessRuntimeException.getInstance("一分钟内已有人获取该账号验证码,请稍后获取..");
-        }
-        int second = now.second();
-        if (second < 30 && 30 - second < 3) {
-            ThreadUtil.sleep(30 - second + 1, TimeUnit.SECONDS);
-        } else if (second > 30 && 60 - second < 3) {
-            ThreadUtil.sleep(60 - second + 1, TimeUnit.SECONDS);
-        }
-        StringBuilder sb = new StringBuilder();
-        JSONObject re = new JSONObject();
-        try {
-            long code = GoogleGenerator.getCode(groupsRelationView.getApiSecret(), now.getTime());
-            sb.append(code);
-            while (sb.length() < 6) {
-                sb.insert(0, 0);
-            }
-            re.putOpt("code", sb.toString());
-            int nowSecond = DateTime.now().second();
-            int time = 0;
-            if (nowSecond < 30) {
-                time = 30 - nowSecond;
-            } else {
-                time = 60 - nowSecond;
-            }
-            re.putOpt("time", time);
-            DoubleVerifyClickRecord doubleVerifyClickRecord = new DoubleVerifyClickRecord();
-            doubleVerifyClickRecord.setRelationId(relationId);
-            doubleVerifyClickRecord.setUserId(userId);
-
-            doubleVerifyClickRecord.setAccountId(groupsRelationView.getAccountId());
-            doubleVerifyClickRecord.setAccount(groupsRelationView.getTripsAccount());
-            doubleVerifyClickRecord.setSkuId(groupsRelationView.getSkuId());
-            doubleVerifyClickRecord.setCode(sb.toString());
-            doubleVerifyClickRecord.setRemainTime(time);
-            doubleVerifyRecordMapper.insert(doubleVerifyClickRecord);
-
-            DoubleVerifyDto doubleVerifyDto = new DoubleVerifyDto();
-            doubleVerifyDto.setClickId(doubleVerifyClickRecord.getId());
-            doubleVerifyDto.setApiSecret(groupsRelationView.getApiSecret());
-            redisService.set(String.format("%s-%s", userId, sb.toString()), 0, 60 * 10l);
-            redisService.set(String.format("%s/%s", userId, sb.toString()), Jsons.toJson(doubleVerifyDto), 60 * 10l);
-        } catch (Exception e) {
-            throw BusinessRuntimeException.getInstance("获取双重验证码错误,请联系客服");
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(re.toString());
-    }
-
-    /**
-     * 刷新验证码
-     */
-    @GetMapping("/refresh/code")
-    public Result<String> refreshCode(String code) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        String numKey = String.format("%s-%s", userId, code);
-        Object num = redisService.get(numKey);
-
-        String objKey = String.format("%s/%s", userId, code);
-        Object objValue =  redisService.get(objKey);
-        if (objValue == null || num == null) {
-            throw BusinessRuntimeException.getInstance("请重新获取双重验证码");
-        }
-        Integer refreshNum = Integer.parseInt(num.toString());
-        String apiSecret = null;
-        Long clickId = 0l;
-        try {
-            DoubleVerifyDto dto = Jsons.parseObject(objValue.toString(), DoubleVerifyDto.class);
-            apiSecret = dto.getApiSecret();
-            clickId = dto.getClickId();
-        } catch (Exception e) {
-            apiSecret = objValue.toString();
-        }
-        if (refreshNum >= 3) {
-            redisService.del(numKey);
-            redisService.del(objKey);
-            throw BusinessRuntimeException.getInstance("刷新次数已达到3次,请重新获取验证码");
-        }
-        if (apiSecret == null) {
-            throw BusinessRuntimeException.getInstance("请重新获取双重验证码");
-        }
-        StringBuilder sb = new StringBuilder();
-        try {
-            long c = GoogleGenerator.getCode(apiSecret, DateTime.now().getTime());
-            sb.append(c);
-            while (sb.length() < 6) {
-                sb.insert(0, 0);
-            }
-            redisService.incr(numKey, 1l);
-
-        } catch (Exception e) {
-            throw BusinessRuntimeException.getInstance("刷新双重验证码错误,请联系客服");
-        }
-        if (clickId != 0) {
-            int nowSecond = DateTime.now().second();
-            int time = 0;
-            if (nowSecond < 30) {
-                time = 30 - nowSecond;
-            } else {
-                time = 60 - nowSecond;
-            }
-            //刷新双重验证码记录
-            DoubleVerifyClickRefreshRecord refreshRecord = new DoubleVerifyClickRefreshRecord();
-            refreshRecord.setClickId(clickId);
-            refreshRecord.setUserId(userId);
-            refreshRecord.setCode(sb.toString());
-            refreshRecord.setRemainTime(time);
-            refreshRecordMapper.insert(refreshRecord);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(sb.toString());
-    }
-
-    /**
-     * 获取双重验证码记录
-     */
-    @GetMapping("/get/doubleVerify/codeList")
-    public Result<List<DoubleVerifyCodeView>> getDoubleVerifyCodeList(Long relationId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<DoubleVerifyCodeView> views = doubleVerifyRecordMapper.getDoubleVerifyCodeList(userId, relationId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(views);
-    }
-
-    /**
-     * 用户是不是自然流量渠道
-     * 且未回答答题
-     */
-    @GetMapping("/natural/channel")
-    public Result<Boolean> isNaturalChannel() {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        String question_key = RedisService.key.QUESTION_RESPONSE_KEY.getNameFormat(userId);
-        if (redisService.get(question_key) != null) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult(false);
-        }
-        User user = userService.getById(userId);
-        if (user.getPopularizeId() != 0) {
-            redisService.set(question_key, userId, RedisService.key.QUESTION_RESPONSE_KEY.getTimeout());
-            return GatewayResponse.SUCCESS.newBuilder().toResult(false);
-        }
-        if (user.getPopularizeId() == 0) {
-            QuestionResponseRecord record = questionResponseRecordMapper.selectOne(Wrappers.lambdaQuery(QuestionResponseRecord.class)
-                    .eq(QuestionResponseRecord::getUserId, userId).select(QuestionResponseRecord::getId).last("limit 1"));
-            if (record != null) {
-                redisService.set(question_key, userId, RedisService.key.QUESTION_RESPONSE_KEY.getTimeout());
-                return GatewayResponse.SUCCESS.newBuilder().toResult(false);
-            }
-            return GatewayResponse.SUCCESS.newBuilder().toResult(true);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(false);
-    }
-
-    /**
-     * 问卷记录
-     */
-    @PostMapping("/record/replyQuestion")
-    public Result<String> recordReplyQuestion(@RequestBody @Validated QuestionResponseRecord record) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        User user = userService.getById(userId);
-        String nickname = user.getNickname();
-        String question_key = RedisService.key.QUESTION_RESPONSE_KEY.getNameFormat(userId);
-        QuestionResponseRecord dbRecord = questionResponseRecordMapper.selectOne(Wrappers.lambdaQuery(QuestionResponseRecord.class)
-                .eq(QuestionResponseRecord::getUserId, userId).select(QuestionResponseRecord::getId).last("limit 1"));
-        if (dbRecord == null) {
-            if (redisService.setNx(String.format("%s-%s", userId, nickname), userId, 10l)) {
-                record.setUserId(userId);
-                record.setNickname(nickname);
-                questionResponseRecordMapper.insert(record);
-                //发放优惠券
-                couponCommonService.sendCouponToUser(userId, 100l, 0l, 0l, 0l, CouponUser.Channel.ques_response);
-                redisService.set(question_key, userId, RedisService.key.QUESTION_RESPONSE_KEY.getTimeout());
-            }
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 获取对应的动态问卷
-     */
-    @GetMapping("/get/questionnaire")
-    public Result<List<QuestionnaireView>> getQuestionnaireView(Long promotionId) {
-        QuestionnairePromotion promotion = questionnairePromotionMapper.selectById(promotionId);
-        if (promotion == null || !promotion.getDeleted()) throw BusinessRuntimeException.getInstance("问卷不存在");
-        Long templateId = promotion.getTemplateId();
-        List<QuestionnaireView> questionnaireViews = beanSearcher.searchAll(QuestionnaireView.class, MapUtils.builder()
-                .field(QuestionnaireView::getPromotionId, promotionId)
-                .orderBy(QuestionnaireView::getSorted).asc()
-                .orderBy(QuestionnaireView::getFieldsId).asc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(questionnaireViews);
-    }
-
-    /**
-     * 记录问卷
-     */
-    @PostMapping("/record/questionnaire/{promotionId}")
-    @Transactional(rollbackFor = Exception.class)
-    @NoSubmit
-    public Result<String> recordQuestionnaire(@PathVariable Long promotionId, String showId, @RequestBody List<FormFieldsData> answers) {
-        Long userId = StpUserUtil.getUserIdAfterLogin();
-        Long groupsId = SEQUENCE.nextId();
-        List<QuestionnairePromotionFieldsListView> promotionFieldsListViews = beanSearcher.searchAll(QuestionnairePromotionFieldsListView.class, MapUtils.builder().field(QuestionnairePromotionFieldsListView::getPromotionId, promotionId).build());
-        if (CollUtil.isEmpty(promotionFieldsListViews)) throw BusinessRuntimeException.getInstance("问卷已结束");
-        if (promotionFieldsListViews.size() != answers.size()) throw BusinessRuntimeException.getInstance("请完成所有问题");
-        log.info("开始记录问卷:{}", promotionId);
-        answers.forEach(answer -> {
-//            if (StringUtil.isNotBlank(showId)) {
-//                answer.setUserId(userService.getUserIdByShowId(showId));
-//            }
-            answer.setUserId(userId);
-            Long fieldsId = answer.getFieldsId();
-            String content = answer.getContent();
-            if (fieldsId == null || StrUtil.isBlank(content)) {
-                throw BusinessRuntimeException.getInstance("必填项为空");
-            }
-            answer.setPromotionId(promotionId);
-            answer.setGroupsId(groupsId);
-            formFieldsDataMapper.insert(answer);
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 查询用户是否填写问卷
-     */
-    @GetMapping("/check/questionnaire/{promotionId}")
-    public Result<Boolean> checkQuestionnaire(@PathVariable Long promotionId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        Integer count = formFieldsDataMapper.selectCount(Wrappers.lambdaQuery(FormFieldsData.class).in(FormFieldsData::getUserId, userIdList).eq(FormFieldsData::getPromotionId, promotionId));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(count > 0);
-    }
-
-    /**
-     * 对应平台车票 广告配置列表
-     */
-    @GetMapping("/get/advertise")
-    public Result<List<TicketAdvertiseConfigFrontView>> getTicketAdvertiseConfig() {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<RenewalView> hasPayGoods = groupRelationFrontService.getHasPayGoods(userId);
-        if (CollUtil.isEmpty(hasPayGoods)) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        List<Long> goodsIds = hasPayGoods.stream().map(RenewalView::getGoodsId).collect(Collectors.toList());
-        log.info("userId:{}获取广告位配置", userId);
-        List<TicketAdvertiseConfigFrontView> views = beanSearcher.searchAll(TicketAdvertiseConfigFrontView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(TicketAdvertiseConfigFrontView::getGoodsId, goodsIds).op(Operator.InList)
-                .orderBy(TicketAdvertiseConfigFrontView::getSorted).desc()
-                .orderBy(TicketAdvertiseConfigFrontView::getGoodsId).asc()
-                .orderBy(TicketAdvertiseConfigFrontView::getConfigId).desc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(views);
-    }
-
-    /**
-     * 记录用户点击车票广告
-     */
-    @PostMapping("/click/ticket/advertise/record/{configId}")
-    public Result<String> recordClickTicketAdvertise(@PathVariable Long configId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        ticketAdvertiseConfigClickRecordService.recordUserClickTicketAdvertise(userId, configId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 推荐平台
-     */
-    @GetMapping("/get/recommend/goods")
-    public Result<Page<UserRecommendGoodsFrontView>> getRecommendGoodsViews(@RequestParam(defaultValue = "0") Integer start, @RequestParam(defaultValue = "5") Integer limit) {
-        //推荐用户未购买的车票平台 优先展示ai类平台 然后是影视流媒体
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
-        List<Long> filter_goods_id = relationMapper.getTicketGoodsId(userIds, List.of("validity", "overdue", "outside"));
-        //用户是否购买过奈飞产品
-        Boolean isPayNf = false;
-        if (filter_goods_id.contains(1l)) {
-            isPayNf = true;
-        } else {
-            int count = orderDonService.count(Wrappers.lambdaQuery(OrderDon.class)
-                    .eq(OrderDon::getGoodsId, 1)
-                    .eq(OrderDon::getUserId, userId)
-                    .notIn(OrderDon::getStatus, Constant.noOrderAllStatus));
-            if (count > 0) {
-                //优先展示路由器、ai、流媒体
-                isPayNf = true;
-            }
-        }
-        Boolean filterCourseGoods = false;
-        //GPT Plus基础2月 课程不展示
-        Integer orders = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-                .in(OrderDon::getUserId, userIds)
-                .eq(OrderDon::getSkuId, 444)
-                .notIn(OrderDon::getStatus, Constant.noOrderStatus));
-        if (orders > 0) {
-            filterCourseGoods = true;
-        }
-        Page<UserRecommendGoodsFrontView> page = groupRelationFrontService.getRecommendGoodsViews(isPayNf, filter_goods_id, filterCourseGoods, start, limit);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(page);
-    }
-
-    /**
-     * 查看GPT token
-     */
-    @GetMapping("/get/gptAccessToken")
-    public Result<String> getGptAccessToken(Long relationId) throws Exception {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
-        //存在该车票
-        RenewalView renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder()
-                .field(RenewalView::getRelationId, relationId)
-                .field(RenewalView::getUserId, userIds).op(Operator.InList).build());
-        Assert.notNull(renewalView, "您的车票不存在");
-        if (renewalView.getGoodsId() != 42) {
-            throw BusinessRuntimeException.getInstance("该平台类型车票无法获取GPT直连token");
-        }
-        String account = renewalView.getAccount();
-        String accessToken = chatGptAuthService.getAccessToken(account);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(accessToken);
-    }
-
-    /**
-     * 获取特殊类型课程 通过邮件发送课程
-     * 领取课件
-     */
-    @PostMapping("/courseware")
-    public Result<String> getCourseWare(@RequestBody SpecialGoodsTicketReq request) throws Exception {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        request.setUserId(userId);
-        groupRelationFrontService.sendCourseWare(request);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    //获取课程云盘链接
-    @GetMapping("/get/courseware")
-    public Result<GoodsCoursewareFile> getGoodsCourseware(Long relationId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        RenewalView relationView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder()
-                .field(RenewalView::getUserId, userIdList).op(Operator.InList)
-                .field(RenewalView::getRelationId, relationId).build());
-        if (relationView == null) {
-            throw BusinessRuntimeException.getInstance("您的车票不存在");
-        }
-        GoodsCoursewareFile goodsCoursewareFile = goodsCoursewareFileMapper.selectOne(Wrappers.lambdaQuery(GoodsCoursewareFile.class)
-                .eq(GoodsCoursewareFile::getGoodsId, relationView.getGoodsId())
-                .eq(GoodsCoursewareFile::getStatus, true)
-                .select(GoodsCoursewareFile::getLink, GoodsCoursewareFile::getCode)
-                .last("limit 1"));
-        if (goodsCoursewareFile == null) {
-            throw BusinessRuntimeException.getInstance("暂未配置课件链接地址,请联系客服");
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(goodsCoursewareFile);
-    }
-
-    /**
-     * 读取车票账号登录验证码
-     */
-    @PostMapping("/get/verifyCode")
-    public Result<String> getAiVerifyCode(@RequestBody TicketLoginReq loginReq) throws Exception {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        loginReq.setUserId(userId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(groupRelationFrontService.getAiVerifyCode(loginReq));
-    }
-
-    /**
-     * 车票后台登录
-     */
-    @PostMapping("/ticket/login")
-    public Result<GroupsRelation> ticketLogin(@RequestBody TicketLoginReq loginReq) {
-        GroupsRelation relation = groupRelationFrontService.ticketLogin(loginReq);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(relation);
-    }
-
-    /**
-     * 奈飞验证校验
-     */
-    @PostMapping("/ticket/verify")
-    public Result<String> outsideTicketVerify(@RequestBody TicketLoginReq loginReq) {
-        return GatewayResponse.SUCCESS.newBuilder().toResult(groupRelationFrontService.outsideTicketVerify(loginReq));
-    }
-
-    /**
-     * 是否有mid车票可候补
-     */
-    @GetMapping("/get/standby")
-    public Result<GptStandbyResp> getGptStandby() {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        String condition = "(a.account like '%@yinhe.ac.cn%' or exists (select id from account_blocked_replace_record abrr where abrr.account = a.account and abrr.goods_id = g.id limit 1))";
-        List<RenewalView> renewalViewList = beanSearcher.searchAll(RenewalView.class, MapUtils.builder()
-                .field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
-                .field(RenewalView::getGoodsId, 26)
-                .put("condition", condition)
-                .field(RenewalView::getExpiryTime).op(Operator.NotNull)
-                .onlySelect(RenewalView::getAccount, RenewalView::getExpiryTime)
-                .build());
-        GptStandbyResp gptStandbyResp = new GptStandbyResp();
-        if (renewalViewList.isEmpty()) {
-            gptStandbyResp.setIsHasAccount(false);
-            return GatewayResponse.SUCCESS.newBuilder().toResult(gptStandbyResp);
-        }
-
-        List<RenewalView> overTen = new ArrayList<>();
-        List<RenewalView> underTen = new ArrayList<>();
-        DateTime now = DateTime.now();
-        renewalViewList.forEach(e -> {
-            if (e.getExpiryTime().compareTo(DateUtil.offsetDay(now, 10)) > 0) {
-                overTen.add(e);
-            } else underTen.add(e);
-        });
-
-        Integer accountBlockedCount = 1;
-        if (overTen.size() > 1) {
-            List<String> accountList = overTen.stream().map(RenewalView::getAccount).distinct().collect(Collectors.toList());
-            accountBlockedCount = accountBlockedReplaceRecordMapper.selectCount(Wrappers.lambdaQuery(AccountBlockedReplaceRecord.class)
-                    .eq(AccountBlockedReplaceRecord::getGoodsId, 26)
-                    .in(AccountBlockedReplaceRecord::getAccount, accountList));
-        }
-        if (accountBlockedCount > 1) {
-            gptStandbyResp.setIsHasAccount(false);
-            return GatewayResponse.SUCCESS.newBuilder().toResult(gptStandbyResp);
-        }
-        gptStandbyResp.setIsHasAccount(true);
-        gptStandbyResp.setOverTen(overTen);
-        gptStandbyResp.setUnderTen(underTen);
-        Integer count = gptTicketStandbyMapper.selectCount(Wrappers.lambdaQuery(GptTicketStandby.class)
-                .in(GptTicketStandby::getUserId, relationUserIdList));
-        gptStandbyResp.setIsApply(count > 0 ? true : false);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(gptStandbyResp);
-    }
-
-    /**
-     * 申请候补
-     */
-    @PostMapping("/apply/standby")
-    @NoSubmit
-    public Result<Boolean> applyGptStandby() {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        String condition = "(a.account like '%@yinhe.ac.cn%' or exists (select id from account_blocked_replace_record abrr where abrr.account = a.account and abrr.goods_id = g.id limit 1))";
-        List<RenewalView> renewalViewList = beanSearcher.searchAll(RenewalView.class, MapUtils.builder()
-                .field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
-                .field(RenewalView::getGoodsId, 26)
-                .put("condition", condition)
-                .field(RenewalView::getExpiryTime, DateUtil.offsetDay(DateTime.now(), 10)).op(Operator.GreaterThan)
-                .onlySelect(RenewalView::getAccount)
-                .build());
-        if (renewalViewList.isEmpty()) {
-            throw BusinessRuntimeException.getInstance("你未有车票账号");
-        }
-        Integer count = gptTicketStandbyMapper.selectCount(Wrappers.lambdaQuery(GptTicketStandby.class)
-                .in(GptTicketStandby::getUserId, relationUserIdList));
-        if (count > 0) {
-            throw BusinessRuntimeException.getInstance("你已申请车票账号候补");
-        }
-        if (renewalViewList.size() > 1) {
-            Set<String> accountSet = renewalViewList.stream().map(RenewalView::getAccount).collect(Collectors.toSet());
-            Integer accountBlockedCount = accountBlockedReplaceRecordMapper.selectCount(Wrappers.lambdaQuery(AccountBlockedReplaceRecord.class)
-                    .eq(AccountBlockedReplaceRecord::getGoodsId, 26)
-                    .in(AccountBlockedReplaceRecord::getAccount, accountSet));
-            if (accountBlockedCount > 1) {
-                return GatewayResponse.SUCCESS.newBuilder().toResult(true);
-            }
-        }
-        GptTicketStandby gptTicketStandby = new GptTicketStandby();
-        gptTicketStandby.setUserId(userId);
-        gptTicketStandbyMapper.insert(gptTicketStandby);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(true);
-    }
-
-    /**
-     * midjourney车票退款
-     */
-    @PutMapping("/refund/ticketOrder/{relationId}")
-    @NoSubmit
-    public Result<String> ticketRefundOrders(@PathVariable Long relationId) throws Exception {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        String condition = "(a.account like '%@yinhe.ac.cn%' or exists (select id from account_blocked_replace_record abrr where abrr.account = a.account and abrr.goods_id = g.id limit 1))";
-        RenewalView renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder()
-                .field(RenewalView::getRelationId, relationId)
-                .field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
-                .put("condition", condition)
-                .field(RenewalView::getGoodsId, 26)
-                .field(RenewalView::getExpiryTime, DateUtil.offsetDay(DateTime.now(), 10)).op(Operator.LessEqual)
-                .build());
-        if (renewalView == null) {
-            throw BusinessRuntimeException.getInstance("你车票不存在或不符合退款要求");
-        }
-        OrderDon orderDon = orderDonService.getOne(Wrappers.lambdaQuery(OrderDon.class)
-                .in(OrderDon::getUserId, relationUserIdList)
-                .eq(OrderDon::getRelationId, relationId)
-                .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
-                .orderByDesc(OrderDon::getId)
-                .last("limit 1"));
-
-        if (orderDon == null) {
-            throw BusinessRuntimeException.getInstance("你对应车票的订单不存在");
-        }
-        GoodsDonSku sku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
-        if (sku == null) {
-            throw BusinessRuntimeException.getInstance("该车票规格不存在,请联系客服进行人工退款..");
-        }
-        Date expiryTime = renewalView.getExpiryTime();
-        long remainDay = DateUtil.between(DateTime.now(), expiryTime, DateUnit.DAY) + 1;
-        BigDecimal money = orderDon.getMoney();
-        BigDecimal refundMoney = null;
-        BigDecimal refundBalance= null;
-        String refundType = null;
-        if (money.compareTo(BigDecimal.ZERO) > 0) {
-            BigDecimal dayMoney = money.divide(BigDecimal.valueOf(sku.getMonths()).multiply(BigDecimal.valueOf(30)), 2, RoundingMode.HALF_DOWN);
-            refundMoney = BigDecimal.valueOf(remainDay).multiply(dayMoney);
-            refundType = "money";
-        }
-        OrderRefundReq refundReq = new OrderRefundReq();
-        if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
-            BigDecimal dayMoney = orderDon.getBalance().divide(BigDecimal.valueOf(sku.getMonths()).multiply(BigDecimal.valueOf(30)), 2, RoundingMode.HALF_DOWN);
-            refundBalance = BigDecimal.valueOf(remainDay).multiply(dayMoney);
-            refundReq.setIsOnly(true);
-        }
-        refundReq.setOrderId(orderDon.getId());
-        refundReq.setRefundDesc("失效车票退款");
-        refundReq.setRefundMoney(Optional.ofNullable(refundMoney).orElse(BigDecimal.ZERO));
-        refundReq.setRefundBalance(Optional.ofNullable(refundBalance).orElse(BigDecimal.ZERO));
-        refundReq.setRefundType(Optional.ofNullable(refundType).orElse("balance"));
-        cmsOrderDonService.unifiedRefund(refundReq);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 每日车票到期弹窗
-     */
-    @GetMapping("/get/expiry/notify")
-    public Result<List<RenewalView>> getExpiryRenewalNotify() {
-        Long userId = StpUserUtil.getLoginIdAsLong();
-        List<RenewalView> expiryRenewals = groupRelationFrontService.getExpiryRenewalNotify(userId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(expiryRenewals);
-    }
-
-    /**
-     * 车票详情
-     */
-    @GetMapping("/get/detail")
-    public Result<RenewalView> getTicketDetail(Long relationId) {
-        if (relationId == null) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        long userId = StpUserUtil.getLoginIdAsLong();
-        RenewalView ticketDetail = groupRelationFrontService.getTicketDetail(userId, relationId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(ticketDetail);
-    }
-
-    /**
-     * 车票售后常见问题
-     */
-    @GetMapping("/get/questions/{goodsId}")
-    public Result<List<GoodsDonQaFrontView>> getTicketQuestions(@PathVariable Long goodsId, @RequestParam(defaultValue = "1") Integer type) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        log.info("userId:{}查看车票:{}售后问题", userId, goodsId);
-        if (type < 1 || type > 2) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        String key = RedisService.key.YH_GOODS_QUESTIONS_DETAIL.getNameFormat(type, goodsId);
-        Object o = redisService.get(key);
-        if (o == null) {
-            List<GoodsDonQaFrontView> donQaFrontViews = beanSearcher.searchAll(GoodsDonQaFrontView.class, MapUtils.builder().field(GoodsDonQaFrontView::getGoodsId, goodsId).field(GoodsDonQaFrontView::getType, type).build());
-            if (CollUtil.isEmpty(donQaFrontViews)) {
-                return GatewayResponse.SUCCESS.newBuilder().toResult();
-            }
-            redisService.setNx(key, donQaFrontViews, RedisService.key.YH_GOODS_QUESTIONS_DETAIL.getTimeout());
-            o = redisService.get(key);
-        }
-        List<GoodsDonQaFrontView> donQaFrontViews = Jsons.parseList(o, GoodsDonQaFrontView.class);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(donQaFrontViews);
-    }
-
-    /**
-     * 车票所有常见问题
-     */
-    @GetMapping("/get/questions")
-    public Result<List<GoodsDonQaFrontView>> getAllTicketQuestions() {
-        List<GoodsDonQaFrontView> donQaFrontViews = beanSearcher.searchAll(GoodsDonQaFrontView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(donQaFrontViews);
-    }
-
-
-    /**
-     * 是否首次购买车票
-     */
-    @GetMapping("/get/first/pay/{goodsId}")
-    public Result<Boolean> getFirstPay(@PathVariable Long goodsId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        Number number = beanSearcher.searchCount(OrderDon.class, MapUtils.builder()
-                .field(OrderDon::getGoodsId, goodsId)
-                .field(OrderDon::getCreatedTime, new DateTime().toDateStr()).op(Operator.LessEqual)
-                .field(OrderDon::getUserId, userIdList).op(Operator.InList)
-                .field(OrderDon::getStatus, Constant.noOrderStatus).op(Operator.NotIn)
-                .build());
-        if (number.intValue() == 0) {
-            UserGoodsNewbieGuideRecord userGoodsNewbieGuideRecord = new UserGoodsNewbieGuideRecord();
-            userGoodsNewbieGuideRecord.setGoodsId(goodsId);
-            userGoodsNewbieGuideRecord.setUserId(userId);
-            userGoodsNewbieGuideRecordMapper.insert(userGoodsNewbieGuideRecord);
-            return GatewayResponse.SUCCESS.newBuilder().toResult(true);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(false);
-    }
-
-    /**
-     * 设置pin码
-     */
-    @PutMapping("/set/pin/{relationId}")
-    public Result<String> setPin(@PathVariable Long relationId, String code) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        JSONObject data = groupsRelationNetflixService.setNetflixPin(relationId, userId, code);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(data.toString());
-    }
-
-    /**
-     * 查询是否设置成功
-     */
-    @GetMapping("/get/pin/status/{taskId}")
-    public Result<Integer> getPinStatus(@PathVariable String taskId) throws Exception {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        log.info("userId:{}查看设置pin码状态", userId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(groupsRelationNetflixService.getPinStatus(taskId));
-    }
-
-    /**
-     * 踢出奈飞设备
-     */
-    @PostMapping("/kickOut/nf/{relationId}")
-    public Result<String> nfKickOut(@PathVariable Long relationId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        JSONObject data = groupsRelationNetflixService.nfKickOut(userId, relationId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(data.toString());
-    }
-
-    /**
-     * 奈飞同户装置链接
-     */
-    @GetMapping("/get/nf/household/device")
-    public Result<String> getNfHouseholdDevice(@NotNull Long relationId) throws Exception {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        String url = groupRelationFrontService.getNfHouseholdDevice(userId, relationId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(url);
-    }
-
-    /**
-     * 代点奈飞同户装置
-     */
-    @PostMapping("/click/nf/household/device")
-    public void clickNfHouseholdDevice(@RequestBody NfDeviceReq nfDeviceReq) {
-        groupsRelationNetflixService.clickNfHouseholdDevice(nfDeviceReq);
-    }
-
-    /**
-     * 可选 续费升级车票
-     */
-    @GetMapping("/get/renew/skus/{relationId}/{skuId}")
-    public Result<List<RenewUpgradePackageFrontView>> getRenewSkus(@PathVariable Long relationId, @PathVariable Long skuId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        ChatgptUser chatgptUser = chatgptUserMapper.selectOne(Wrappers.lambdaQuery(ChatgptUser.class)
-                .eq(ChatgptUser::getRelationId, relationId)
-                .last("limit 1"));
-        if (chatgptUser == null) return GatewayResponse.SUCCESS.newBuilder().toResult();
-        //目前续费升级的规格
-        Long renewSkuId = chatgptUser.getRenewSkuId();
-        GoodsDonSku sku = goodsDonSkuMapper.selectById(skuId);
-        AtomicInteger minMonths = new AtomicInteger(sku.getMonths());
-        AtomicInteger minNum = new AtomicInteger(chatgptUser.getLimitNum());
-        AtomicLong minTime = new AtomicLong(chatgptUser.getLimitTime());
-        if (renewSkuId != null) {
-            GoodsDonSku presentRenew = goodsDonSkuMapper.selectById(renewSkuId);
-            minMonths.set(presentRenew.getMonths());
-        }
-        if (chatgptUser.getPackageId() != 0) {
-            Long packageId = chatgptUser.getPackageId();
-            UpgradeOrderDon upgradeOrderDon = upgradeOrderDonMapper.selectOne(Wrappers.lambdaQuery(UpgradeOrderDon.class)
-                    .eq(UpgradeOrderDon::getPackageId, packageId)
-                    .eq(UpgradeOrderDon::getRelationId, relationId)
-                    .in(UpgradeOrderDon::getUserId, userIdList)
-                    .last("limit 1"));
-            Long upgradeOrderDonSkuId = upgradeOrderDon.getSkuId();
-            GoodsDonSku upgradeSku = goodsDonSkuMapper.selectById(upgradeOrderDonSkuId);
-            if (upgradeSku != null) {
-                if (upgradeSku.getMonths() > minMonths.get()) {
-                    minMonths.set(upgradeSku.getMonths());
-                }
-            }
-        }
-        List<RenewUpgradePackageFrontView> renewUpgradePackageFrontViews = beanSearcher.searchAll(RenewUpgradePackageFrontView.class, MapUtils.builder().field(RenewUpgradePackageFrontView::getSkuId, skuId).build());
-        renewUpgradePackageFrontViews.forEach(renew -> {
-            try {
-                List<Long> upgradeSkuIds = Jsons.parseList(renew.getUpgradeSkuIds(), Long.class);
-                //年付展示
-                MapBuilder builder = MapUtils.builder();
-//                if (minMonths.get() == 12) {
-//                    builder.field(RenewUpgradePackageFrontView.RenewSkuView::getMonths, minMonths.get()).op(Operator.GreaterEqual);
-//                    if (renewSkuId != null) {
-//                        upgradeSkuIds.remove(renewSkuId);
-//                    }
-//                } else {
-//                    builder.field(RenewUpgradePackageFrontView.RenewSkuView::getMonths, minMonths.get()).op(Operator.GreaterEqual);
-//                }
-                //GPT镜像2月规格 特殊处理
-                if (sku.getGoodsId() == 18 && sku.getMonths() == 2) {
-
-                } else {
-                    //同续费时间规格
-                    builder.field(RenewUpgradePackageFrontView.RenewSkuView::getMonths, minMonths.get()).op(Operator.GreaterEqual);
-                }
-                if (renewSkuId != null) {
-                    upgradeSkuIds.remove(renewSkuId);
-                }
-                List<RenewUpgradePackageFrontView.RenewSkuView> renewSkuViews = new ArrayList<>();
-                if (CollUtil.isNotEmpty(upgradeSkuIds)) {
-                    renewSkuViews = beanSearcher.searchAll(RenewUpgradePackageFrontView.RenewSkuView.class, builder
-                            .field(RenewUpgradePackageFrontView.RenewSkuView::getGptLimitNum, minNum.get()).op(Operator.GreaterEqual)
-                            .field(RenewUpgradePackageFrontView.RenewSkuView::getGptLimitTime, minTime.get()).op(LessEqual.class)
-                            .field(RenewUpgradePackageFrontView.RenewSkuView::getSkuId, upgradeSkuIds).op(Operator.InList)
-                            .build());
-                }
-                renew.setRenewSkus(renewSkuViews);
-            } catch (Exception e) {
-            }
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(renewUpgradePackageFrontViews);
-    }
-
-    /**
-     * 独立规格续费套餐列表
-     */
-    @GetMapping("/get/independent/renew/skus/{skuId}")
-    public Result<List<RenewUpgradePackageFrontView>> getRenewSkus(@PathVariable Long skuId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<RenewUpgradePackageFrontView> renewUpgradePackageFrontViews = beanSearcher.searchAll(RenewUpgradePackageFrontView.class, MapUtils.builder().field(RenewUpgradePackageFrontView::getSkuId, skuId).build());
-        renewUpgradePackageFrontViews.forEach(renew -> {
-            try {
-                List<Long> upgradeSkuIds = Jsons.parseList(renew.getUpgradeSkuIds(), Long.class);
-                MapBuilder builder = MapUtils.builder();
-                List<RenewUpgradePackageFrontView.RenewSkuView> renewSkuViews = beanSearcher.searchAll(RenewUpgradePackageFrontView.RenewSkuView.class, builder
-                        .field(RenewUpgradePackageFrontView.RenewSkuView::getSkuId, upgradeSkuIds).op(Operator.InList)
-                        .build());
-                renew.setRenewSkus(renewSkuViews);
-            } catch (Exception e) {
-            }
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(renewUpgradePackageFrontViews);
-    }
-
-    /**
-     * claude pro续费升级
-     */
-    @GetMapping("/get/claude/renew/skus/{relationId}/{skuId}")
-    public Result<List<RenewUpgradePackageFrontView> > getClaudeRenewSkus(@PathVariable Long relationId, @PathVariable Long skuId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        ClaudeUser claudeUser = claudeUserMapper.selectOne(Wrappers.lambdaQuery(ClaudeUser.class)
-                .eq(ClaudeUser::getRelationId, relationId)
-                .last("limit 1"));
-        if (claudeUser == null) return GatewayResponse.SUCCESS.newBuilder().toResult();
-        List<RenewUpgradePackageFrontView> renewUpgradePackageFrontViews = beanSearcher.searchAll(RenewUpgradePackageFrontView.class, MapUtils.builder().field(RenewUpgradePackageFrontView::getSkuId, skuId).build());
-        renewUpgradePackageFrontViews.forEach(renew -> {
-            try {
-                List<Long> upgradeSkuIds = Jsons.parseList(renew.getUpgradeSkuIds(), Long.class);
-                MapBuilder builder = MapUtils.builder();
-                List<RenewUpgradePackageFrontView.RenewSkuView> renewSkuViews = beanSearcher.searchAll(RenewUpgradePackageFrontView.RenewSkuView.class, builder
-                        .field(RenewUpgradePackageFrontView.RenewSkuView::getSkuId, upgradeSkuIds).op(Operator.InList)
-                        .field(RenewUpgradePackageFrontView.RenewSkuView::getGptLimitNum, claudeUser.getLimitNum()).op(Operator.GreaterEqual)
-                        .build());
-                renew.setRenewSkus(renewSkuViews);
-            } catch (Exception e) {
-            }
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(renewUpgradePackageFrontViews);
-    }
-
-    /**
-     * 已配置的续费升级规格ids
-     */
-    @GetMapping("/get/renew/skus/configured")
-    public Result<List<Long> > getClaudeRenewSkus() {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<RenewUpgradePackageFrontView> renewUpgradePackageFrontViews = beanSearcher.searchAll(RenewUpgradePackageFrontView.class, MapUtils.builder().onlySelect(RenewUpgradePackageFrontView::getSkuId).build());
-        List<Long> collect = renewUpgradePackageFrontViews.stream().map(RenewUpgradePackageFrontView::getSkuId).collect(Collectors.toList());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(collect);
-    }
-
-    /**
-     * 获取GPT PLUS登录验证码
-     */
-    @GetMapping("/get/verify/code")
-    public Result<String> getVerifyCode(@NotEmpty String account) throws Exception {
-        String code = groupRelationFrontService.getVerifyCode(account);
-        if (StrUtil.isEmpty(code)) {
-            throw BusinessRuntimeException.getInstance("请重新发送验证码");
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(code);
-    }
-
-    /**
-     * 独立规格续费减免
-     */
-    @GetMapping("/get/renew/reduce")
-    public Result<UserBenefitsFrontView> getRenewReduce(Long skuId, Long relationId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        UserBenefitsFrontView data = beanSearcher.searchFirst(UserBenefitsFrontView.class, MapUtils.builder().field(UserBenefitsFrontView::getSkuId, skuId).field(UserBenefitsFrontView::getType, UserBenefits.Type.RENEW.name()).build());
-        if (data == null) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        Date startTime = null;
-        if (relationId != null) {
-            GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
-                    .eq(GroupsRelation::getId, relationId)
-                    .in(GroupsRelation::getUserId, userIdList));
-            if (relation == null) {
-                throw BusinessRuntimeException.getInstance("车票不存在");
-            }
-            startTime = relation.getStartTime();
-        }
-        Integer renewCount = userBenefitsOrderRecordMapper.selectUseComboRecordByUid(userIdList, data.getType(), data.getGoodsId(), data.getSkuId(), Constant.noOrderAllStatus, null, startTime, relationId);
-        data.setRenewCount(renewCount);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(data);
-    }
-
-    /**
-     * 申请更换车票
-     */
-    @PostMapping("/change/ticket")
-    public Result<String> changeTicket(@RequestBody ChangeTicketReq changeTicketReq) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Long> relationIds = changeTicketReq.getRelationIds();
-        if (CollUtil.isEmpty(relationIds)) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        //奈飞超过3帐车票不给看
-        Number number = beanSearcher.searchCount(RenewalView.class, MapUtils.builder()
-                .field(RenewalView::getUserId, userIdList).op(Operator.InList)
-                .field(RenewalView::getGoodsId, 1)
-                .field(RenewalView::getExpiryTime, DateTime.now()).op(Operator.GreaterThan)
-                .build());
-        if (number.intValue() > 2) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        relationIds.forEach(relationId -> {
-            try {
-                groupRelationFrontService.changeTicket(userId, relationId);
-            } catch (Exception e) {
-                log.error("更换车票失败:{}", StringUtil.getErrorText(e));
-                if (relationIds.size() == 1) {
-                    throw BusinessRuntimeException.getInstance(e.getMessage());
-                }
-            }
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 查看临时账号
-     */
-    @GetMapping("/get/temp/account/{relationId}")
-    public Result<AccountView> getTempAccount(@PathVariable Long relationId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        AccountView accountView = groupRelationFrontService.getTempAccount(userId, relationId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(accountView);
-    }
-
-    /**
-     * 申请提交记录
-     */
-    @GetMapping("/get/netflix/get/error/submit/record")
-    public Result<List<NetflixUserAccountStatusRecord>> getUserNetflixSubmitRecord() {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<NetflixUserAccountStatusRecord> netflixUserAccountStatusRecords = groupRelationFrontService.getUserNetflixSubmitRecord(userId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(netflixUserAccountStatusRecords);
-    }
-
-    /**
-     * 奈飞账号异常检测提交
-     */
-    @PostMapping("/netflix/error/account/submit/{relationId}")
-    public Result<String> nfErrorAccountSubmit(@PathVariable Long relationId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        groupRelationFrontService.nfErrorAccountSubmit(userId, relationId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 奈飞账号检测结果
-     */
-    @GetMapping("/get/netflix/error/account/status/{relationId}")
-    public Result<Integer> getNetflixErrorAccountStatus(@PathVariable Long relationId) {
-        long userId = StpUserUtil.getLoginIdAsLong();
-        Integer state = groupRelationFrontService.getNetflixErrorAccountStatus(userId, relationId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(state);
-    }
-}

+ 0 - 47
netflix-web/src/main/java/com/cyksj/web/controller/group/MidJourneyGuideController.java

@@ -1,47 +0,0 @@
-package com.cyksj.web.controller.group;
-
-import com.cyksj.common.constant.Constant;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.service.ticket.UserReceiveTrialTicketRecordService;
-import com.cyksj.web.util.StpUserUtil;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 项目名: yhlxj
- * 文件名: MidJourneyGuideController
- * 创建者: JavaZou
- * 创建时间:2024/6/3 17:46
- */
-@Slf4j
-@RequestMapping("/applets/mj")
-@RestController
-@RequiredArgsConstructor
-public class MidJourneyGuideController {
-	private final UserReceiveTrialTicketRecordService userReceiveTrialTicketRecordService;
-
-	/**
-	 * 领取mj试用车票
-	 */
-	@PostMapping("/receive/trial")
-	public Result<String> receiveTrialTicket() {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		userReceiveTrialTicketRecordService.sendTicketAndRecord(userId, Constant.MIDJOURNEY_TRIAL_SKU_ID);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 是否已领取mj试用车票
-	 */
-	@GetMapping("/hasReceived")
-	public Result<Boolean> isReceiveTrialTicket() {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		Boolean flag = userReceiveTrialTicketRecordService.isReceiveTrialTicket(userId, Constant.MIDJOURNEY_TRIAL_SKU_ID);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(flag);
-	}
-}

+ 0 - 101
netflix-web/src/main/java/com/cyksj/web/controller/information/InformationController.java

@@ -1,101 +0,0 @@
-package com.cyksj.web.controller.information;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.RandomUtil;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.InformationCategory;
-import com.cyksj.model.views.GoodsFrontListView;
-import com.cyksj.model.views.InformationDetailView;
-import com.cyksj.model.views.InformationListView;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.information.InformationCategoryService;
-import com.cyksj.service.information.InformationService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * @author zwhui
- * @date 2023/10/12 17:20
- */
-@Slf4j
-@RestController
-@RequestMapping("/applets/information")
-@RequiredArgsConstructor
-public class InformationController {
-    private final BeanSearcher beanSearcher;
-
-    private final InformationCategoryService informationCategoryService;
-
-    private final InformationService informationService;
-
-    private final HttpServletRequest request;
-
-    private final RedisService redisService;
-
-    /**
-     * 查询发现页文章列表
-     */
-    @GetMapping("/get")
-    public Result<IPage<InformationListView>> getInformation(Long categoryId, @RequestParam(defaultValue = "0") Integer start, @RequestParam(defaultValue = "5") Integer limit) {
-        String key = RedisService.key.INFORMATION_KEY.getName() + String.format(":list:%s:%s", start, limit);
-        if (categoryId != null) {
-            key += ":ct:" + categoryId;
-        }
-        IPage<InformationListView> information  = (IPage<InformationListView>) redisService.get(key);
-        if (information == null) {
-            information = informationService.getInformation(categoryId, start, limit);
-            redisService.setNx(key, information, RedisService.key.INFORMATION_KEY.getTimeout() + RandomUtil.randomInt(10000));
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(information);
-    }
-
-
-    /**
-     * 查询分类
-     */
-    @GetMapping("/get/category")
-    public Result<List<InformationCategory>> getInformationCategory() {
-        String key = RedisService.key.INFORMATION_KEY.getName() + ":category";
-        List<InformationCategory> informationCategory = (List<InformationCategory>) redisService.get(key);
-        if (informationCategory == null) {
-            informationCategory = informationCategoryService.getInformationCategory();
-            if (CollUtil.isEmpty(informationCategory)) {
-                return GatewayResponse.SUCCESS.newBuilder().toResult();
-            }
-            redisService.setNx(key, informationCategory, RedisService.key.INFORMATION_KEY.getTimeout() + RandomUtil.randomInt(100000));
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(informationCategory);
-    }
-
-    /**
-     * 获取文章详情
-     */
-    @GetMapping("/get/detail/{id}")
-    public Result<InformationDetailView> getInformation(@PathVariable Long id) {
-        String key = RedisService.key.INFORMATION_KEY.getName() + "id:" + id;
-        InformationDetailView view = (InformationDetailView) redisService.get(key);
-        if (view == null){
-            view = beanSearcher.searchFirst(InformationDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
-                    .field(InformationDetailView::getId, id).build());
-            try {
-                List<Long> goodsIds = Jsons.parseList(view.getGoodsIds(), Long.class);
-                List<GoodsFrontListView> goodsList = beanSearcher.searchAll(GoodsFrontListView.class, MapUtils.flatBuilder(request.getParameterMap()).field(GoodsFrontListView::getId,goodsIds).op(Operator.InList).build());
-                view.setGoods(goodsList);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            redisService.setNx(key, view, RedisService.key.INFORMATION_KEY.getTimeout());
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(view);
-    }
-}

+ 0 - 98
netflix-web/src/main/java/com/cyksj/web/controller/invoice/UserInvoiceFrontController.java

@@ -1,98 +0,0 @@
-package com.cyksj.web.controller.invoice;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.request.UserInvoiceOrderReq;
-import com.cyksj.model.views.UserInvoiceChoseOrderViews;
-import com.cyksj.model.views.UserInvoiceFrontView;
-import com.cyksj.model.views.UserInvoiceOrderViews;
-import com.cyksj.service.invoice.UserInvoiceApplyRecordService;
-import com.cyksj.service.user.UserBindRelationService;
-import com.cyksj.web.util.StpUserUtil;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * 项目名: yhlxj
- * 文件名: UserInvoiceFrontController
- * 创建者: JavaZou
- * 创建时间:2024/12/13 16:22
- */
-@RestController
-@RequestMapping("/applets/invoice")
-@RequiredArgsConstructor
-public class UserInvoiceFrontController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserInvoiceApplyRecordService userInvoiceApplyRecordService;
-
-	private final UserBindRelationService userBindRelationService;
-
-	/**
-	 * 发票 用户可选AI车票订单
-	 */
-	@GetMapping("/get/orders")
-	public Result<SearchResult<UserInvoiceChoseOrderViews>> getOrders() {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-		String dateCondition;
-		DateTime now = DateTime.now();
-		String thisSixMontStr = DateUtil.thisYear() + "-06-01";
-		//当前时间达到6月份 可开发票的订单只能是24年的 去年的发票只能截至到次年5月底
-		if (now.isAfter(DateUtil.parse(thisSixMontStr))) {
-			dateCondition = String.format(" and o.created_time >= '%s'", DateUtil.beginOfYear(now));
-		} else {
-			dateCondition = String.format(" and o.created_time >= '%s'", DateUtil.offsetMonth(DateUtil.beginOfYear(now), -12));
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		//1月底后 过滤木棉订单
-		if (now.isAfter(DateUtil.parse("2025-02-01"))) {
-			builder.field(UserInvoiceChoseOrderViews::getShopId, "2021003171697073").op(Operator.NotEqual);
-		}
-		SearchResult<UserInvoiceChoseOrderViews> search = beanSearcher.search(UserInvoiceChoseOrderViews.class, builder
-				.put("dc", dateCondition)
-				.field(UserInvoiceChoseOrderViews::getUserId, userIdList).op(Operator.InList)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 提交发票申请
-	 */
-	@PostMapping("/apply")
-	public Result<Long> apply(@RequestBody UserInvoiceOrderReq req) {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		req.setUserId(userId);
-		Long recordId = userInvoiceApplyRecordService.applyOrderInvoice(req);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(recordId);
-	}
-
-	/**
-	 * 用户发票申请列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<UserInvoiceFrontView>> get() {
-		long userId = StpUserUtil.getLoginIdAsLong();
-		List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-		SearchResult<UserInvoiceFrontView> search = beanSearcher.search(UserInvoiceFrontView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(UserInvoiceFrontView::getUserId, userIdList).op(Operator.InList)
-				.orderBy(UserInvoiceFrontView::getId).desc()
-				.build());
-		search.getDataList().forEach(data->{
-			data.setOrderViews(beanSearcher.searchAll(UserInvoiceOrderViews.class, MapUtils.builder().field(UserInvoiceOrderViews::getRecordId, data.getId()).build()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 54
netflix-web/src/main/java/com/cyksj/web/controller/kf/CorpKfAppletController.java

@@ -1,54 +0,0 @@
-package com.cyksj.web.controller.kf;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.corp.kf.CorpKfAccountMapper;
-import com.cyksj.model.entity.CorpKfAccount;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.corp.WxCorpOps;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 项目名: yhlxj2
- * 文件名: CorpKfController
- * 创建者: JavaZou
- * 创建时间:2025/1/10 11:18
- */
-@RestController
-@RequestMapping("/applets/corp/kf")
-@RequiredArgsConstructor
-public class CorpKfAppletController {
-	private final CorpKfAccountMapper corpKfAccountMapper;
-
-	private final WxCorpOps wxCorpOps;
-
-	private final RedisService redisService;
-
-	/**
-	 * 获取微信客服
-	 */
-	@GetMapping("/get")
-	public Result<String> getCorpKf(Integer scene) throws Exception {
-		CorpKfAccount corpKfAccount = corpKfAccountMapper.selectOne(Wrappers.lambdaQuery(CorpKfAccount.class).eq(CorpKfAccount::getScene, scene).last("limit 1"));
-		//默认官网
-		if (corpKfAccount == null) {
-			corpKfAccount = corpKfAccountMapper.selectOne(Wrappers.lambdaQuery(CorpKfAccount.class).eq(CorpKfAccount::getScene, 1).last("limit 1"));
-			if (corpKfAccount == null) {
-				return GatewayResponse.SUCCESS.newBuilder().toResult();
-			}
-		}
-		String openKfId = corpKfAccount.getOpenKfId();
-		String key = RedisService.key.CORP_KF_ACCOUNT_URL.getName() + openKfId;
-		String url = redisService.getStr(key);
-		if (StrUtil.isEmpty(url)) {
-			url = wxCorpOps.getCorpKfUrl(openKfId, null);
-			redisService.setNx(key, url, RedisService.key.CORP_KF_ACCOUNT_URL.getTimeout());
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(url);
-	}
-}

+ 0 - 42
netflix-web/src/main/java/com/cyksj/web/controller/landing/CorpFollowActiveCodeController.java

@@ -1,42 +0,0 @@
-package com.cyksj.web.controller.landing;
-
-import cn.hutool.core.util.StrUtil;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.service.corp.CorpFollowActiveCodeFrontService;
-import com.cyksj.service.distribute.equipment.EquipmentDistributeService;
-import com.cyksj.service.user.UserService;
-import com.cyksj.web.util.StpUserUtil;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * 项目名: yhlxj
- * 文件名: CorpFollowActiveCodeController
- * 创建者: JavaZou
- * 创建时间:2023/10/10 14:31
- */
-@RestController
-@RequestMapping("/applets/landing")
-@RequiredArgsConstructor
-public class CorpFollowActiveCodeController {
-	private final CorpFollowActiveCodeFrontService corpFollowActiveCodeFrontService;
-
-	private final UserService userService;
-
-	private final EquipmentDistributeService equipDistributeService;
-
-	/**
-	 * 活动活码落地页 获取对应客服二维码
-	 */
-	@GetMapping("/get/corp/active/qrCode/{id}")
-	public Result<String> getCorpActiveQrCode(@PathVariable Long id, String dsCode) throws Exception {
-		String qrCode = corpFollowActiveCodeFrontService.getCorpActiveQrCode(id);
-		Long userId = StpUserUtil.getUserIdAfterLogin();
-		if (userId != null && StrUtil.isNotBlank(dsCode)) {
-			//绑定关系
-			userService.bindUserDistributeShared(userId, dsCode);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(qrCode);
-	}
-}

+ 0 - 304
netflix-web/src/main/java/com/cyksj/web/controller/manage/AdminController.java

@@ -1,304 +0,0 @@
-package com.cyksj.web.controller.manage;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.lang.Validator;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Codec;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.PhoneCodeMapper;
-import com.cyksj.model.entity.PhoneCode;
-import com.cyksj.model.manage.dto.AdminInfo;
-import com.cyksj.model.manage.entity.Admin;
-import com.cyksj.service.mail.MailService;
-import com.cyksj.service.mange.AdminService;
-import com.cyksj.web.util.StpUserUtil;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @description
- * @author chan
- * @date 2021-10-11 下午11:02
- */
-@RestController
-@RequestMapping("/manage/admin")
-@RequiredArgsConstructor
-@Slf4j
-public class AdminController {
-
-    private final AdminService adminService;
-
-    private final PhoneCodeMapper phoneCodeMapper;
-
-    private final MailService mailService;
-
-    private static final List<String> SEND_LIST = List.of(
-            "1935822056@qq.com",
-            "598488687@qq.com",
-            "1991846178@qq.com",
-            "3301493050@qq.com",
-            "1031494735@qq.com",
-            "1814454156@qq.com",
-            "1094366385@qq.com",
-            "1505704409@qq.com"
-    );
-
-    private static final String YOUTUBE_URL = "https://zhaoju666.com/youtube_subscribe/";
-
-    @PostMapping(value = "/login")
-    public Result<String> login(@RequestBody Admin adminRequest) throws Exception {
-        Admin admin = adminService.getOne(
-                new QueryWrapper<Admin>().lambda().eq(Admin::getPhone,adminRequest.getPhone()));
-
-        if (null == admin) {
-            throw BusinessRuntimeException.getInstance("该用户不存在.");
-        }
-        if (null == admin.getStatus() || !admin.getStatus()) {
-            throw BusinessRuntimeException.getInstance("无登录权限.");
-        }
-
-        // 对比密码
-        String encodePasscode = Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(adminRequest.getPassWord()).toBase64String();
-
-        if (!StringUtils.equals(admin.getPassWord(), encodePasscode)) {
-            throw BusinessRuntimeException.getInstance("密码有误.");
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @PostMapping("/post")
-    public Result<String> saveAdmin(@RequestBody @Validated Admin admin) throws Exception {
-        Long adminId = StpUtil.getLoginIdAsLong();
-        Admin exist = adminService.getById(adminId);
-        if (exist == null) {
-            throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
-        }
-        if (exist.getCategory() != Admin.Category.superoot) {
-            throw BusinessRuntimeException.getInstance("无超级管理员权限");
-        }
-        if (StringUtils.isNotBlank(admin.getPassWord())) {
-            admin.setPassWord(Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(admin.getPassWord()).toBase64String());
-        }
-        if (admin.getId() == null) {
-            Admin ad = adminService.getOne(new LambdaQueryWrapper<Admin>().eq(Admin::getPhone, admin.getPhone()));
-            if (ad != null) {
-                throw BusinessRuntimeException.getInstance("该账号已存在.");
-            }
-        }
-        boolean mobile = Validator.isMobile(admin.getPhone());
-        if (!mobile) {
-            throw BusinessRuntimeException.getInstance("请输入正确的手机号");
-        }
-
-        try {
-            adminService.saveOrUpdate(admin);
-        } catch (DuplicateKeyException e) {
-            throw BusinessRuntimeException.getInstance("手机号重复");
-        }
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 删除管理员
-     */
-    @DeleteMapping("/delete/{id}")
-    public Result<String> deleteAdminById(@PathVariable Long id) {
-        Long adminId = StpUtil.getLoginIdAsLong();
-        Admin exist = adminService.getById(adminId);
-        if (exist == null) {
-            throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
-        }
-        if (exist.getCategory() != Admin.Category.superoot) {
-            throw BusinessRuntimeException.getInstance("无超级管理员权限");
-        }
-        if (id.equals(adminId)) {
-            throw BusinessRuntimeException.getInstance("无法删除自己");
-        }
-        adminService.removeById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult("删除成功");
-    }
-
-    /**
-     * 编辑管理员
-     */
-    @PutMapping("/put")
-    public Result<String> editAdmin(@RequestBody Admin admin) throws Exception {
-        Long adminId = StpUtil.getLoginIdAsLong();
-        Admin exist = adminService.getById(adminId);
-        if (exist == null) {
-            throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
-        }
-        if (exist.getCategory() != Admin.Category.superoot) {
-            throw BusinessRuntimeException.getInstance("无超级管理员权限");
-        }
-        Admin user = adminService.getById(admin.getId());
-        if (admin.getId() == null || user == null) {
-            throw BusinessRuntimeException.getInstance("账号不存在");
-        }
-        Boolean flag = false;
-        if (StrUtil.isNotEmpty(admin.getPhone())) {
-            boolean mobile = Validator.isMobile(admin.getPhone());
-            if (!mobile) {
-                throw BusinessRuntimeException.getInstance("请输入正确的手机号");
-            }
-            if (!admin.getPhone().equals(user.getPhone())) {
-                flag = true;
-            }
-        }
-        if (StrUtil.isNotEmpty(admin.getPassWord())) {
-            String encodePwd = Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(admin.getPassWord()).toBase64String();
-            admin.setPassWord(encodePwd);
-            if (!encodePwd.equals(user.getPassWord())) {
-                flag = true;
-            }
-        }
-        adminService.saveOrUpdate(admin);
-        if (flag) {
-            StpUtil.logoutByLoginId(admin.getId());
-        }
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult("编辑成功");
-    }
-
-
-    /**
-     * 校验手机号获取登录信息
-     */
-    @GetMapping("/get/loginInfo")
-    public Result<AdminInfo> getLoginInfo(String phone, String code) {
-        Admin admin = adminService.getOne(
-                new QueryWrapper<Admin>().lambda().eq(Admin::getPhone, phone));
-        if (null == admin) {
-            throw BusinessRuntimeException.getInstance("该用户不存在.");
-        }
-        if (StrUtil.hasEmpty(phone, code)) {
-            throw BusinessRuntimeException.getInstance("请输入对应信息");
-        }
-        DateTime now = DateTime.now();
-        PhoneCode phoneCode = phoneCodeMapper.selectOne(Wrappers.lambdaQuery(PhoneCode.class).eq(PhoneCode::getPhone, phone).last("limit 1"));
-        if (phoneCode == null || StrUtil.isEmpty(phoneCode.getCode())) {
-            throw BusinessRuntimeException.getInstance("请重新获取手机验证码");
-        }
-        //3分钟失效
-        Date updateTime = phoneCode.getUpdateTime();
-        DateTime afterFiveMinutes = DateUtil.offsetMinute(updateTime, 3);
-        if (now.isAfter(afterFiveMinutes)) {
-            throw BusinessRuntimeException.getInstance("手机验证码已失效,请重新获取");
-        }
-        if (!StrUtil.equals(code, phoneCode.getCode())) {
-            throw BusinessRuntimeException.getInstance("手机验证码错误,请重新输入");
-        }
-        // 生成token
-
-        StpUtil.login(admin.getId());
-
-        String token = StpUtil.getTokenValue();
-
-        admin.setPassWord("");
-
-        AdminInfo info = new AdminInfo();
-        info.setInfo(admin);
-        info.setToken(token);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(info);
-    }
-
-    @GetMapping("/get/list")
-    public Result<Page<Admin>> list(@RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "5") Integer limit) {
-        Page<Admin> page = adminService.page(new Page<>(start, limit), new LambdaQueryWrapper<Admin>().eq(Admin::getStatus, true));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(page);
-    }
-
-    @GetMapping("/send/template")
-    public Result<String> sendTemplate(String title, String channel, String url) throws Exception {
-        for (String email : SEND_LIST) {
-//            WxMpTemplateMessage templateMessage = new WxMpTemplateMessage()
-//                    .setToUser(openId)
-//                    .setTemplateId(WeChatTemplateConst.VDIEO_NOTIFY)
-//                    .setUrl(" ");
-//            WxMpTemplateMessage.TemplateData data = templateMessage.getData();
-//            data.setFirst(new WxMpTemplateData("youtube频道有更新"));
-//            data.setKeyword1(new WxMpTemplateData(title));
-//            data.setKeyword2(new WxMpTemplateData(channel));
-//            data.setKeyword3(new WxMpTemplateData(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
-//            data.setKeyword4(new WxMpTemplateData("默认"));
-//            data.setRemark(new WxMpTemplateData(url));
-//            log.info("发送video模板消息至客服:{}","磨牙怪");
-//            weChatService.sendTemplateMessage(weChatService.getAccessToken(), Jsons.toJson(templateMessage));
-            String subject = "youtube频道有更新";
-            String msg = String.format("标题:%s\n频道:%s\n下载地址:%s", title, channel, YOUTUBE_URL);
-            mailService.sendEmailMsgToPeople(email, subject, msg);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @RequestMapping("/callback")
-    public String youtubeCallback(HttpServletRequest request, @RequestHeader Map<String, String> headers) throws IOException {
-        log.info("----------------打印请求全部消息开始----------------");
-        Enumeration<String> headerNames = request.getHeaderNames();
-        while (headerNames.hasMoreElements()) {
-            String name = headerNames.nextElement();
-            log.info("{} - {}", name, request.getHeader(name));
-        }
-        log.info("----------------打印请求全部消息结束----------------");
-        log.info("-----------------打印请求头消息开始-----------------");
-        headers.forEach((String key, String value) -> log.info(String.format("Header '%s' = %s", key, value)));
-        log.info("-----------------打印请求头消息结束-----------------");
-        Map<String, String[]> parameterMap = request.getParameterMap();
-        log.info("------------------打印全部参数开始------------------");
-        String result = "";
-        if (parameterMap.isEmpty()) {
-            log.info("请求参数为空");
-        }else {
-            parameterMap.forEach((String key, String[] value) -> {
-                for (String s : value) {
-                    log.info("Param '{}' = {}", key, s);
-                }
-            });
-            result = parameterMap.get("hub.challenge")[0];
-        }
-        log.info("------------------打印全部参数结束------------------");
-        log.info("-----------------打印Reader数据开始----------------");
-        StringBuilder buffer = new StringBuilder();
-        try (BufferedReader reader = request.getReader()){
-            String line;
-            while ((line = reader.readLine()) != null) {
-                buffer.append(line);
-            }
-        } catch (IOException e) {
-            log.error(e.getMessage(), e);
-        }
-        log.info("reader -> {}", buffer);
-        log.info("-----------------打印Reader数据结束----------------");
-        return result;
-    }
-
-    /**
-     * 银河用户token信息
-     */
-    @GetMapping("/get/yh/user/token")
-    public Result<String> getYhUserToken(Long userId) {
-        StpUserUtil.login(userId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(StpUserUtil.getTokenValue());
-    }
-}

+ 0 - 1244
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java

@@ -1,1244 +0,0 @@
-package com.cyksj.web.controller.manage;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
-import com.cyksj.common.util.IoKit;
-import com.cyksj.common.util.Xmls;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayApiCode;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.*;
-import com.cyksj.mapper.channel.ChannelPopularizeMapper;
-import com.cyksj.mapper.channel.UserPayEquipmentAvailableBenefitsMapper;
-import com.cyksj.mapper.channel.UserPayEquipmentReceiveBenefitsRecordMapper;
-import com.cyksj.mapper.manage.RealGoodsOrderHandleMapper;
-import com.cyksj.mapper.manage.cms.CmsUserMapper;
-import com.cyksj.mapper.manage.coupon.CouponMapper;
-import com.cyksj.mapper.shop.YhShopMapper;
-import com.cyksj.model.dto.OriSkuDto;
-import com.cyksj.model.dto.RenewOriOrderSkuDto;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.excel.*;
-import com.cyksj.model.manage.request.ReqSetLogisticsPost;
-import com.cyksj.model.manage.views.AccountView;
-import com.cyksj.model.manage.views.OrderDonBackView;
-import com.cyksj.model.manage.views.UpgradeOrderDonBackView;
-import com.cyksj.model.request.*;
-import com.cyksj.model.views.*;
-import com.cyksj.service.mange.CmsOrderDonService;
-import com.cyksj.service.order.OrderDonCommentService;
-import com.cyksj.service.user.UserBindRelationService;
-import com.cyksj.service.user.UserService;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import com.google.common.collect.Lists;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-
-/**
- * @author chan
- * @date 2021/10/12 下午11:05
- */
-@Slf4j
-@RequestMapping("/manage/order")
-@RestController
-@RequiredArgsConstructor
-public class CmsOrderController {
-    private final HttpServletRequest request;
-
-    private final CmsOrderDonService cmsOrderDonService;
-
-    private final UserService userService;
-
-    private final BeanSearcher beanSearcher;
-
-    private final RealGoodsInterestUserMapper realGoodsInterestUserMapper;
-
-    private final RealGoodsOrderHandleMapper realGoodsOrderHandleMapper;
-
-    private final CouponMapper couponMapper;
-
-	private final OrderCommentMapper orderCommentMapper;
-
-	private final OrderDonCommentService orderDonCommentService;
-
-	private final GoodsDonSkuMapper skuMapper;
-
-	private final ChannelPopularizeMapper channelPopularizeMapper;
-
-	private final GroupsRelationMapper relationMapper;
-
-	private final UserPayEquipmentReceiveBenefitsRecordMapper receiveBenefitsRecordMapper;
-
-	private final UserPayEquipmentAvailableBenefitsMapper availableBenefitsMapper;
-
-	private final YhShopMapper yhShopMapper;
-
-	private final CmsUserMapper cmsUserMapper;
-
-	private final UserMapper userMapper;
-
-	private final OrderDonMapper orderDonMapper;
-
-	private final OrderDonCustomerServiceRelateMapper orderDonCustomerServiceRelateMapper;
-
-	private final MidjourneyUserConversationMapper midjourneyUserConversationMapper;
-
-	private final MidjourneyUserMapper midjourneyUserMapper;
-
-	private final UserBindRelationService userBindRelationService;
-
-	private final OrderDonRenewRecordMapper orderDonRenewRecordMapper;
-
-	private final ChatgptUserMapper chatgptUserMapper;
-
-	private final UserBenefitsOrderRecordMapper userBenefitsOrderRecordMapper;
-
-	private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
-
-	@GetMapping("/get")
-	@SaCheckPermission("order:view")
-	public Result<SearchResult<OrderDonBackView>> get(Long channelId, String account, String showId, Long acId, String nickname, String register, Boolean isGoogle, Boolean isSubsidy, Boolean isRenewPackage, Integer otherOrderType, Long userMirrorShopId) {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (channelId != null) {
-			List<Long> popularizeIds = channelPopularizeMapper.getPopularizeIdByChannelId(channelId);
-			builder.field(OrderDonBackView::getPopularizeId, popularizeIds).op(Operator.InList);
-		}
-		if (StrUtil.isNotBlank(account)) {
-			GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
-					.eq(GroupsRelation::getAccount, account).last("limit 1"));
-			if (relation != null) {
-				builder.field(OrderDonBackView::getRelationId, relation.getId());
-			} else {
-				builder.field(OrderDonBackView::getRelationId).op(Operator.IsNull);
-			}
-		}
-		if (StrUtil.isNotBlank(showId)) {
-			builder.field(OrderDonBackView::getUserId, userService.getUserIdByShowId(showId));
-		}
-		String conditionSql = StrUtil.EMPTY;
-		if (acId != null) {
-			conditionSql += String.format(" o.user_id in (select user_id from corp_user where ac_id = %s)", acId);
-		}
-		if (!ObjectUtil.isAllEmpty(nickname, register, isGoogle)) {
-			if (StrUtil.isNotEmpty(conditionSql)) {
-				conditionSql += " and ";
-			}
-			conditionSql += " exists (select u.id from user u where u.id = o.user_id";
-			if (StrUtil.isNotEmpty(nickname)) {
-				conditionSql += String.format(" and u.nickname like '%s%%'", nickname);
-			}
-			if (StrUtil.isNotEmpty(register)) {
-				if ("phone".equals(register)) {
-					conditionSql += " and u.login_phone != ''";
-				} else if ("email".equals(register)) {
-					conditionSql += " and u.email != ''";
-				} else if ("wechat".equals(register)) {
-					conditionSql += " and u.unionid != ''";
-				}
-			}
-			if (isGoogle != null && isGoogle) {
-				conditionSql += String.format(" and u.is_google is %s", isGoogle);
-			}
-			conditionSql += " limit 1)";
-		}
-		if (isSubsidy != null) {
-			if (StrUtil.isNotEmpty(conditionSql)) {
-				conditionSql += " and ";
-			}
-			conditionSql += " exists (select 1 from order_don_subsidy_relate ocr where ocr.order_id = o.id limit 1)";
-		}
-		if (isRenewPackage != null) {
-			if (StrUtil.isNotEmpty(conditionSql)) {
-				conditionSql += " and ";
-			}
-			conditionSql += " exists (select 1 from order_don_renew_record odrr1 where odrr1.order_id = o.id limit 1)";
-		}
-		if (otherOrderType != null) {
-			//3.续费升级订单
-			if (otherOrderType == 3) {
-				builder.put("tb", String.format(" inner join order_don_renew_record odcr on odcr.order_id = o.id and odcr.order_type = 2"));
-			}
-			if (otherOrderType == 4) {
-				//4.用户权益订单
-				builder.put("tb", String.format(" inner join user_benefits_order_record ubor on ubor.order_id = o.id and ubor.type = 'RENEW'"));
-			}
-			if (otherOrderType == 6) {
-				//6.加盟订单
-				builder.put("tb", String.format(" inner join user_mirror_shop_order_relate umr on umr.order_id = o.id"));
-			}
-		}
-		if (userMirrorShopId != null) {
-			if (StrUtil.isNotEmpty(conditionSql)) {
-				conditionSql += " and ";
-			}
-			conditionSql += String.format(" exists (select 1 from user_mirror_shop_order_relate umr where mp_id = %s and umr.order_id = o.id limit 1)", userMirrorShopId);
-		}
-		if (StrUtil.isNotBlank(conditionSql)) {
-			builder.put("condition", conditionSql);
-		}
-		SearchResult<OrderDonBackView> search = beanSearcher.search(OrderDonBackView.class, builder.build());
-		search.getDataList().forEach(data -> {
-			if (data.getPopularizeId() != null) {
-				Optional.ofNullable(channelPopularizeMapper.selectChannelByPid(data.getPopularizeId()))
-						.ifPresent(channelName -> data.setChannel(channelName));
-			}
-
-			if (data.getGoodsDonType() != null && Constant.realGoodsType.contains(data.getGoodsDonType())) {
-				RealGoodsOrderHandle realGoodsOrderHandle = realGoodsOrderHandleMapper.selectOne(Wrappers.lambdaQuery(RealGoodsOrderHandle.class).eq(RealGoodsOrderHandle::getOrderId, data.getId()).last("limit 1"));
-				if (realGoodsOrderHandle != null) {
-					data.setBeforeServiceName(realGoodsOrderHandle.getBeforeServiceName());
-					data.setAfterServiceName(realGoodsOrderHandle.getAfterServiceName());
-				}
-			}
-
-			//使用优惠码
-			if (data.getCouponId() != null) {
-				Optional.ofNullable(couponMapper.selectById(data.getCouponId())).ifPresent(coupon -> data.setCouponName(coupon.getName()));
-				data.setCouponMoney(data.getCouponMoney() == null ? BigDecimal.ZERO : data.getCouponMoney());
-			}
-
-			if (data.getCouponUserId() != 0) {
-				data.setCouponName(couponMapper.getCouponNameByCouponUserId(data.getCouponUserId()));
-				data.setCouponMoney(data.getCouponMoney() == null ? BigDecimal.ZERO : data.getCouponMoney());
-			}
-
-			if (data.getRelationId() != 0) {
-				Optional.ofNullable(relationMapper.getGroupRelationAccountView(data.getRelationId()))
-						.ifPresent(e -> {
-							data.setGtAccount(e.getTripsAccount());
-							data.setAccount(e.getAccount());
-						});
-			}
-
-			if (data.getIsBenefits() != null && data.getIsBenefits() && !Constant.noOrderAllStatus.contains(data.getStatus())) {
-				//是否实物权益已发放
-				Integer count = receiveBenefitsRecordMapper.selectCount(Wrappers.lambdaQuery(UserPayEquipmentReceiveBenefitsRecord.class)
-						.eq(UserPayEquipmentReceiveBenefitsRecord::getRealOrderId, data.getId()));
-				if (count == 0) {
-					count = availableBenefitsMapper.selectCount(Wrappers.lambdaQuery(UserPayEquipmentAvailableBenefits.class)
-							.eq(UserPayEquipmentAvailableBenefits::getRealOrderId, data.getId()));
-				}
-				data.setIsHasBenefits(count == 0 ? true : false);
-				//是否是套餐优惠权益订单
-				if (data.getIsBenefits()) {
-					Integer selectCount = userBenefitsOrderRecordMapper.selectCount(Wrappers.lambdaQuery(UserBenefitsOrderRecord.class)
-							.eq(UserBenefitsOrderRecord::getOrderId, data.getId()));
-					if (selectCount > 0) {
-						data.setIsHasBenefits(false);
-					}
-				}
-			}
-
-			if (data.getYhsId() != 0) {
-				Optional.ofNullable(yhShopMapper.selectById(data.getYhsId()))
-						.ifPresent(e -> {
-							data.setShopName(e.getName());
-							data.setCustomId(e.getCustomId());
-						});
-			}
-
-			User user = userMapper.selectById(data.getUserId());
-			if (user != null) {
-				data.setNickname(user.getNickname());
-				data.setLoginPhone(user.getLoginPhone());
-				data.setEmail(user.getEmail());
-				data.setRegister(StrUtil.isNotEmpty(user.getUnionid()) ? "wechat" : StrUtil.isNotEmpty(user.getLoginPhone()) ? "phone" : "email");
-
-			}
-			if (data.getGoodsDonType() != null && data.getGoodsDonType() == 1) {
-				//获取订单关联客服
-				Optional.ofNullable(orderDonMapper.selectOrderRelate(data.getId())).ifPresent(e -> {
-					data.setCmsUserId(e.getCmsUserId());
-					data.setNickname(e.getNickname());
-				});
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 用户退款订单列表
-	 */
-	@GetMapping("/get/refund/list")
-	public Result<SearchResult<RefundOrderDonView>> getRefundOrderDonView() {
-		SearchResult<RefundOrderDonView> search = beanSearcher.search(RefundOrderDonView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.build());
-		search.getDataList().forEach(data -> {
-			Optional.ofNullable(userService.getById(data.getUserId()))
-					.ifPresent(user -> data.setNickname(user.getNickname()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 镜像规格使用详情
-	 */
-	@GetMapping("/get/order/mj/mirror/detail/{orderId}")
-	public Result<MidjourneyUserDetailView> getMjMirrorOrderDetail(@PathVariable Long orderId) {
-		OrderDon orderDon = orderDonMapper.selectById(orderId);
-		//续费订单
-		Date startTime = null;
-		Date expiryTime = null;
-		if (orderDon.getOrderType() == 2) {
-			GoodsDonSku sku = skuMapper.selectById(orderDon.getSkuId());
-			GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
-					.eq(GroupsRelation::getId, orderDon.getRelationId())
-					.eq(GroupsRelation::getUserId, orderDon.getUserId()).last("limit 1"));
-			if (relation == null) {
-				return GatewayResponse.SUCCESS.newBuilder().toResult();
-			}
-			startTime = relation.getStartTime();
-			startTime = DateUtil.offsetMonth(startTime, sku.getMonths());
-			expiryTime = relation.getExpiryTime();
-		}
-		MidjourneyUserDetailView midjourneyUserDetailView = midjourneyUserConversationMapper.getMjMirrorOrderDetail(orderDon.getRelationId(), startTime, expiryTime);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(midjourneyUserDetailView);
-	}
-
-	/**
-	 * 订单导出
-	 */
-	@GetMapping("/export")
-	@SaCheckPermission("order:export")
-	@Log(module = "订单管理/导出订单", businessType = BusinessType.EXPORT, isSaveRequestData = true)
-	public void exportOrders(HttpServletResponse response, Long channelId, String account, String showId, Long acId, String nickname, String register, Boolean isGoogle, Boolean isSubsidy, Boolean isRenewPackage, Integer otherOrderType, Long userMirrorShopId) throws InterruptedException {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (channelId != null) {
-			List<Long> popularizeIds = channelPopularizeMapper.getPopularizeIdByChannelId(channelId);
-			builder.field(ExcelOrderDonData::getPopularizeId, popularizeIds).op(Operator.InList);
-		}
-		if (StrUtil.isNotBlank(account)) {
-			GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
-					.eq(GroupsRelation::getAccount, account).last("limit 1"));
-			if (relation != null) {
-				builder.field(ExcelOrderDonData::getRelationId, relation.getId());
-			} else {
-				builder.field(ExcelOrderDonData::getRelationId).op(Operator.IsNull);
-			}
-		}
-		if (StrUtil.isNotBlank(showId)) {
-			builder.field(ExcelOrderDonData::getUserId, userService.getUserIdByShowId(showId));
-		}
-		String conditionSql = StrUtil.EMPTY;
-		if (acId != null) {
-			conditionSql += String.format(" o.user_id in (select user_id from corp_user where ac_id = %s)", acId);
-		}
-		if (!ObjectUtil.isAllEmpty(nickname, register, isGoogle)) {
-			if (StrUtil.isNotEmpty(conditionSql)) {
-				conditionSql += " and ";
-			}
-			conditionSql += " exists (select u.id from user u where u.id = o.user_id";
-			if (StrUtil.isNotEmpty(nickname)) {
-				conditionSql += String.format(" and u.nickname like '%s%%'", nickname);
-			}
-			if (StrUtil.isNotEmpty(register)) {
-				if ("phone".equals(register)) {
-					conditionSql += " and u.login_phone != ''";
-				} else if ("email".equals(register)) {
-					conditionSql += " and u.email != ''";
-				} else if ("wechat".equals(register)) {
-					conditionSql += " and u.unionid != ''";
-				}
-			}
-			if (isGoogle != null && isGoogle) {
-				conditionSql += String.format(" and u.is_google is %s", isGoogle);
-			}
-			conditionSql += " limit 1)";
-		}
-		if (isSubsidy != null) {
-			if (StrUtil.isNotEmpty(conditionSql)) {
-				conditionSql += " and ";
-			}
-			conditionSql += " exists (select 1 from order_don_subsidy_relate ocr where ocr.order_id = o.id limit 1)";
-		}
-		if (isRenewPackage != null) {
-			if (StrUtil.isNotEmpty(conditionSql)) {
-				conditionSql += " and ";
-			}
-			conditionSql += " exists (select 1 from order_don_renew_record odrr1 where odrr1.order_id = o.id limit 1)";
-		}
-		if (otherOrderType != null) {
-			//3.续费升级订单
-			if (otherOrderType == 3) {
-				builder.put("tb", String.format(" inner join order_don_renew_record odcr on odcr.order_id = o.id and odcr.order_type = 2"));
-			}
-			if (otherOrderType == 4) {
-				//4.用户权益订单
-				builder.put("tb", String.format(" inner join user_benefits_order_record ubor on ubor.order_id = o.id and ubor.type = 'RENEW'"));
-			}
-			if (otherOrderType == 6) {
-				//6.加盟订单
-				builder.put("tb", String.format(" inner join user_mirror_shop_order_relate umr on umr.order_id = o.id"));
-			}
-		}
-		if (userMirrorShopId != null) {
-			conditionSql += String.format(" exists (select 1 from user_mirror_shop_order_relate umr where mp_id = %s and umr.order_id = o.id limit 1)", userMirrorShopId);
-		}
-		if (StrUtil.isNotBlank(conditionSql)) {
-			builder.put("condition", conditionSql);
-		}
-		List<ExcelOrderDonData> list = beanSearcher.searchAll(ExcelOrderDonData.class, builder.build());
-		List<List<ExcelOrderDonData>> partition = Lists.partition(list, 500);
-		CountDownLatch countDownLatch = new CountDownLatch(partition.size());
-		for (List<ExcelOrderDonData> excelOrderDonData : partition) {
-			TASK_EXECUTOR.execute(() -> setExportOrderInfo(excelOrderDonData, countDownLatch));
-		}
-		countDownLatch.await(15, TimeUnit.MINUTES);
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelOrderDonData.class, list, "订单列表", "订单列表", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 导出实物模板 订单excel
-	 */
-	@GetMapping("/export/realGoods")
-	public void exportRealGoods(HttpServletResponse response) throws IOException {
-		List<ExcelRealGoodsOrderData> list = beanSearcher.searchAll(ExcelRealGoodsOrderData.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(ExcelOrderDonData::getGoodsDonType, Constant.realGoodsType).op(Operator.InList)
-				.build());
-//		AtomicInteger index = new AtomicInteger(1);
-		list.forEach(data -> {
-			data.setPayType("寄付现结");
-			if (data.getGoodsDonType() == Constant.realGoodsType.get(0)) {
-				data.setRealGoodName("路由器");
-			} else if (data.getGoodsDonType() == Constant.realGoodsType.get(1)) {
-				data.setRealGoodName("银河潮玩");
-			}
-//			data.setIndex(index.getAndIncrement());
-		});
-		if (CollUtil.isEmpty(list)) {
-			throw BusinessRuntimeException.getInstance("导出数据为空");
-		}
-
-		response.setContentType("application/x-download");
-		response.setContentType("application/vnd.ms-excel");
-		response.setCharacterEncoding("utf-8");
-		response.setHeader("Content-disposition",
-				"attachment;filename=" + new String("实物订单列表".getBytes("utf-8"), "ISO-8859-1") + ExcelTypeEnum.XLS.getValue());
-
-		EasyExcel.write(response.getOutputStream())
-				.head(ExcelRealGoodsOrderData.class)
-				//设置合并单元格策略
-//				.registerWriteHandler(new RealGoodsOrderLineStrategy())
-				.excelType(ExcelTypeEnum.XLS)
-				.sheet("实物订单列表")
-				//设置头部标题从那行开始
-//				.relativeHeadRowIndex(2)
-				.doWrite(list);
-	}
-
-	@PutMapping("/update/status")
-    public Result<String> upStatus(@RequestBody OrderDon orderDon){
-        cmsOrderDonService.update(Wrappers.lambdaUpdate(OrderDon.class).eq(OrderDon::getId,orderDon.getId()).set(OrderDon::getStatus,orderDon.getStatus()));
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-	/**
-	 * 编辑自定义订阅节点
-	 */
-	@PutMapping("/update/subNode")
-	public Result<String> updateSubNode(@RequestBody OrderDon orderDon) {
-		OrderDon en = cmsOrderDonService.getById(orderDon.getId());
-		if (en != null) {
-			en.setSubNode(orderDon.getSubNode());
-			cmsOrderDonService.updateById(en);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	@GetMapping("/get/transport/{orderId}")
-    public Result<OrderDonTransportView> getTransport(@PathVariable Long orderId){
-//        OrderDonTransport transport = cmsOrderDonService.getTransport(orderId);
-        OrderDonTransportView transportView = beanSearcher.searchFirst(OrderDonTransportView.class, MapUtils.builder().field(OrderDonTransportView::getOrderId, orderId).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(transportView);
-    }
-
-    @PostMapping("/post/setWaybill")
-    public Result<OrderDonWaybill> setWaybill(@RequestBody ReqSetLogisticsPost reqSetLogisticsPost){
-        OrderDonWaybill orderDonWaybill = cmsOrderDonService.setWaybill(reqSetLogisticsPost);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonWaybill);
-    }
-
-	/**
-	 * 用户购买实物商品意愿列表
-	 */
-	@GetMapping("/get/realGooods/interest/users")
-	@SaCheckPermission("interest:view")
-	public Result<SearchResult> getInterestUserList(RealGoodsInterestUser.Status interestStatus, HttpServletRequest request) {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		SearchResult<RealGoodsInterestUserView> search;
-		if (interestStatus == null) {
-			builder.field(RealGoodsInterestUserView::getInterestStatus, "hasPayment").op(Operator.NotEqual);
-			search = beanSearcher.search(RealGoodsInterestUserView.class, builder.build());
-		} else if (interestStatus != RealGoodsInterestUser.Status.hasPayment) {
-			builder.field(RealGoodsInterestUserView::getInterestStatus, interestStatus.name());
-			search = beanSearcher.search(RealGoodsInterestUserView.class, builder.build());
-		} else {
-			search = new SearchResult<>();
-			SearchResult<RealGoodsInterestUserHasPaymentView> search2 = beanSearcher.search(RealGoodsInterestUserHasPaymentView.class, builder.build());
-			search.setTotalCount(search2.getTotalCount());
-			List<RealGoodsInterestUserView> dataList = search.getDataList();
-			dataList.addAll(search2.getDataList());
-		}
-		search.getDataList().forEach(data -> {
-			Long goodsId = data.getGoodsId();
-			OrderDon order = cmsOrderDonService.getOne(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, data.getUserId()).eq(OrderDon::getGoodsId, goodsId).ne(OrderDon::getId, data.getId()).gt(OrderDon::getMoney, data.getMoney()).eq(OrderDon::getStatus, "close").last("limit 1"));
-			if (order != null) {
-				data.setOrderId(order.getId());
-				data.setSkuId(order.getSkuId());
-				data.setMoney(order.getMoney());
-				realGoodsInterestUserMapper.updateData(data.getId(), data.getSkuId(), data.getOrderCreatedTime(), data.getOrderId());
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 修改订单状态
-	 */
-	@PutMapping("/put/status/{orderId}")
-	public Result<String> updateOrderStatus(@PathVariable Long orderId) {
-		OrderDon orderDon = cmsOrderDonService.getById(orderId);
-		if (orderDon == null) {
-			throw BusinessRuntimeException.getInstance("该订单不存在");
-		}
-		if (orderDon.getStatus() == OrderDon.Status.complete) {
-			throw BusinessRuntimeException.getInstance("该订单已是已完成状态");
-		}
-		if (orderDon.getStatus() != OrderDon.Status.hasPayment) {
-			throw BusinessRuntimeException.getInstance("该订单不是未支付状态");
-		}
-		orderDon.setStatus(OrderDon.Status.complete);
-		cmsOrderDonService.updateById(orderDon);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("修改订单状态成功");
-	}
-
-    /**
-     * 修改购买意愿记录
-     */
-    @PutMapping("/put/interest")
-    public Result<String> updateInterest(@RequestBody @Validated UserRealGoodsInterestReq req) {
-        RealGoodsInterestUser realGoodsInterestUser = realGoodsInterestUserMapper.selectById(req.getId());
-        if (realGoodsInterestUser != null) {
-            if (req.getStatus() != null) {
-                realGoodsInterestUser.setInterestStatus(req.getStatus());
-            }
-            if (req.getRemark() != null) {
-                realGoodsInterestUser.setRemark(req.getRemark());
-            }
-            realGoodsInterestUserMapper.updateById(realGoodsInterestUser);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult("修改成功");
-    }
-
-	/**
-	 * 导出用户意愿列表
-	 */
-	@GetMapping("/export/interest")
-	public void exportInterest(RealGoodsInterestUser.Status interestStatus, HttpServletRequest request, HttpServletResponse response) {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		List<ExcelRealGoodsUserInterestData> excelRealGoodsUserInterestData;
-		if (interestStatus == null) {
-			builder.field(RealGoodsInterestUserView::getInterestStatus, "hasPayment").op(Operator.NotEqual);
-			excelRealGoodsUserInterestData = beanSearcher.searchAll(ExcelRealGoodsUserInterestData.class, builder.build());
-		} else {
-			List<ExcelRealGoodsUserInterestHasPaymentData> excelRealGoodsUserInterestData2 = beanSearcher.searchAll(ExcelRealGoodsUserInterestHasPaymentData.class, builder.build());
-			excelRealGoodsUserInterestData = new ArrayList<>(excelRealGoodsUserInterestData2);
-		}
-		excelRealGoodsUserInterestData.forEach(data -> {
-			Long goodsId = data.getGoodsId();
-			OrderDon order = cmsOrderDonService.getOne(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, data.getUserId()).eq(OrderDon::getGoodsId, goodsId).ne(OrderDon::getId, data.getId()).gt(OrderDon::getMoney, data.getMoney()).eq(OrderDon::getStatus, "close").last("limit 1"));
-			if (order != null) {
-				data.setOrderId(order.getId());
-				data.setSkuId(order.getSkuId());
-				data.setMoney(order.getMoney());
-				realGoodsInterestUserMapper.updateData(data.getId(), data.getSkuId(), data.getOrderCreatedTime(), data.getOrderId());
-			}
-			data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
-		});
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelRealGoodsUserInterestHasPaymentData.class, excelRealGoodsUserInterestData, "用户意愿列表", "用户意愿列表", ExcelTypeEnum.XLSX, null);
-	}
-
-    /**
-     * 实物订单配置售前售后客户
-     */
-    @PostMapping("/put/realGoods/service")
-    @NoSubmit
-    @Log(module = "订单管理/售前、售后客服", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> putRealGoodsService(@RequestBody @Validated RealGoodsServiceReq request) {
-        OrderDon orderDon = cmsOrderDonService.getById(request.getOrderId());
-        if (orderDon == null || orderDon.getRelationId() != 0) {
-            throw BusinessRuntimeException.getInstance("该订单不是实物订单");
-        }
-	    Boolean isBefore = false;
-	    Boolean isAfter = false;
-	    RealGoodsOrderHandle realGoodsOrderHandle = Optional.ofNullable(realGoodsOrderHandleMapper.selectOne(Wrappers.lambdaQuery(RealGoodsOrderHandle.class).eq(RealGoodsOrderHandle::getOrderId, request.getOrderId()).last("limit 1"))).orElse(new RealGoodsOrderHandle());
-	    if (StringUtils.isNotBlank(request.getBeforeServiceName())) {
-		    realGoodsOrderHandle.setBeforeServiceName(request.getBeforeServiceName());
-		    isBefore = true;
-	    }
-	    if (StringUtils.isNotBlank(request.getAfterServiceName())) {
-		    realGoodsOrderHandle.setAfterServiceName(request.getAfterServiceName());
-		    isAfter = true;
-	    }
-	    if (realGoodsOrderHandle.getId() == null) {
-		    realGoodsOrderHandle.setOrderId(request.getOrderId());
-		    realGoodsOrderHandleMapper.insert(realGoodsOrderHandle);
-	    } else {
-		    if (realGoodsOrderHandle.getBeforeOpNum() > 2) {
-			    throw BusinessRuntimeException.getInstance("售前客服已两次修改");
-		    }
-		    if (realGoodsOrderHandle.getAfterOpNum() > 2) {
-			    throw BusinessRuntimeException.getInstance("售后客服已两次修改");
-		    }
-		    if (isBefore) {
-			    realGoodsOrderHandle.setBeforeOpNum(realGoodsOrderHandle.getBeforeOpNum() + 1);
-		    }
-		    if (isAfter) {
-			    realGoodsOrderHandle.setAfterOpNum(realGoodsOrderHandle.getAfterOpNum() + 1);
-		    }
-		    realGoodsOrderHandleMapper.updateById(realGoodsOrderHandle);
-	    }
-        return GatewayResponse.SUCCESS.newBuilder().toResult("操作成功");
-    }
-
-	/**
-	 * 新增平台评论
-	 */
-	@PostMapping("/post/orderComment")
-	public Result<String> insertOrderComment(@RequestBody @Validated OrderComment orderComment) {
-		if (StrUtil.isEmpty(orderComment.getHeadImgUrl())) {
-			orderComment.setHeadImgUrl(Constant.DEFAULT_HEAD_IMG);
-		}
-		if (orderComment.getCommentTime() == null) {
-			orderComment.setCommentTime(DateTime.now().toDateStr());
-		}
-		orderComment.setVerifyStatus(OrderComment.VerifyStatus.success);
-		orderCommentMapper.insert(orderComment);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("新增成功");
-	}
-
-	/**
-	 * 编辑平台评论
-	 */
-	@PutMapping("/put/orderComment")
-	public Result<String> updateOrderComment(@RequestBody @Validated OrderComment orderComment) {
-		if (orderComment.getCommentTime() == null) {
-			orderComment.setCommentTime(DateTime.now().toDateStr());
-		}
-		if (orderComment.getVerifyStatus() == null) {
-			orderComment.setVerifyStatus(OrderComment.VerifyStatus.success);
-		}
-		orderCommentMapper.updateById(orderComment);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑成功");
-	}
-
-	/**
-	 * 删除平台评论
-	 */
-	@DeleteMapping("/delete/orderComment/{id}")
-	public Result<String> deleteOrderCommentById(@PathVariable Long id) {
-		orderCommentMapper.deleteById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除成功");
-	}
-
-	/**
-	 * 平台评论列表
-	 */
-	@GetMapping("/get/orderComment")
-	public Result<SearchResult<OrderCommentView>> getOrderCommentView() {
-		SearchResult<OrderCommentView> search = beanSearcher.search(OrderCommentView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 评论审核
-	 */
-	@PutMapping("/put/orderComment/status")
-	@NoSubmit
-	public Result<String> updateOrderCommentStatus(@RequestBody OrderComment orderCommentReq) throws Exception {
-		orderDonCommentService.verifyCommentStatus(orderCommentReq.getId(), orderCommentReq.getVerifyStatus());
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 配置订单平台评价列表
-	 */
-	@PostMapping("/post/orderComment/reward/config")
-	public Result<String> saveOrUpdateOrderCommentConfig(@RequestBody List<OrderCommentRewardConfig> configs) {
-		orderDonCommentService.saveOrUpdateOrderCommentConfig(configs);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 获取配置 订单平台评价
-	 */
-	@GetMapping("/get/orderComment/reward/config")
-	public Result<List<OrderCommentRewardConfigView>> getOrderCommentRewardConfig() {
-		List<OrderCommentRewardConfigView> views = beanSearcher.searchAll(OrderCommentRewardConfigView.class, MapUtils.builder()
-				.orderBy(OrderCommentRewardConfigView::getGoodsId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(views);
-	}
-
-	/**
-	 * 踢出车队
-	 */
-	@PutMapping("/kickOut")
-	@NoSubmit
-	public Result<String> kickOut(@RequestBody @Validated ClickOutReq req) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		cmsOrderDonService.kickOutRelationId(adminId, req);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 踢出车队列表
-	 */
-	@GetMapping("/get/kickOut/list")
-	public Result<SearchResult<UserKickOutView>> getKickOutList() {
-		SearchResult<UserKickOutView> search = beanSearcher.search(UserKickOutView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 客服修改订单来源
-	 */
-	@PutMapping("/update/order/source")
-	public Result<String> updateOrderSource(@RequestBody OrderDon orderDon) {
-		Long id = orderDon.getId();
-		String labelSource = orderDon.getLabelSource();
-		cmsOrderDonService.update(null, Wrappers.lambdaUpdate(OrderDon.class)
-				.set(OrderDon::getLabelSource, labelSource)
-				.eq(OrderDon::getId, id));
-
-		realGoodsOrderHandleMapper.update(null, Wrappers.lambdaUpdate(RealGoodsOrderHandle.class)
-				.set(RealGoodsOrderHandle::getLabelSource, labelSource)
-				.eq(RealGoodsOrderHandle::getOrderId, id));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 设置实物订单电视机类型
-	 */
-	@PutMapping("/update/order/tvType")
-	public Result<String> updateOrderTvType(@RequestBody OrderDon orderDon) {
-		Integer tvType = orderDon.getTvType();
-		Long id = orderDon.getId();
-		cmsOrderDonService.update(null, Wrappers.lambdaUpdate(OrderDon.class)
-				.set(OrderDon::getTvType, tvType)
-				.eq(OrderDon::getId, id));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 订单统一退款
-	 */
-	@PostMapping("/unified/refund")
-	@Log(module = "订单管理/统一退款", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> unifiedRefund(@RequestBody @Validated OrderRefundReq refundReq) throws Exception {
-		long adminId = StpUtil.getLoginIdAsLong();
-		CmsUser cmsUser = cmsUserMapper.selectById(adminId);
-		if (cmsUser == null) {
-			throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
-		}
-		refundReq.setOperator(cmsUser.getNickname());
-		cmsOrderDonService.unifiedRefund(refundReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("退款成功");
-	}
-
-	/**
-	 * 微信退款回调
-	 */
-	@PostMapping("/wx/refund/notify")
-	public void wxRefundNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
-		String xml = IoKit.toString(request.getInputStream());
-		log.info("=== 退款成功的回调: \n {}", xml);
-
-		// 解析xml
-		Map<String, String> map = Xmls.toMap(xml);
-
-		// 退款失败
-		if (!StrUtil.equals("SUCCESS", map.get("return_code"))) {
-			throw BusinessRuntimeException.getInstance("退款失败.");
-		}
-
-		cmsOrderDonService.wxRefundNotify(map);
-
-		String toWechatXmlResponse = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
-
-		OutputStream out = null;
-		try {
-			out = response.getOutputStream();
-			IoKit.write(toWechatXmlResponse, out);
-		} catch (Throwable e) {
-			throw BusinessRuntimeException.getInstance(e == null ? null : e.getMessage());
-		} finally {
-			IoKit.close(out);
-		}
-	}
-
-	/**
-	 * 更换用户车票
-	 */
-	@PutMapping("/put/sameSpec/empty/relation")
-	@Log(module = "更换用户车票", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> changeRelation(@RequestBody @Validated ChangeRelationReq req) throws Exception {
-		cmsOrderDonService.changeRelation(req);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 多余车位的空账号
-	 */
-	@GetMapping("/get/sameSpec/empty/relation")
-	public Result<SearchResult<EmptyGroupsRelationView>> getSameSpecEmptyRelation(Long skuId, Long groupsId, Long relationId, Boolean isNormal) {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap())
-				.field(EmptyGroupsRelationView::getStatus, GroupsTrips.Status.down.name()).op(Operator.NotEqual)
-				.field(EmptyGroupsRelationView::getSkuId, skuId).orderBy(EmptyGroupsRelationView::getAvailableNum)
-				.desc();
-		GoodsDonSku sku = skuMapper.selectById(skuId);
-		Date expiryTime = null;
-		if (relationId != null) {
-			GroupsRelation relation = relationMapper.selectById(relationId);
-			if (relation != null) expiryTime = relation.getExpiryTime();
-		}
-		if (groupsId != null) {
-			builder.field(EmptyGroupsRelationView::getGroupsId, groupsId).op(Operator.NotEqual);
-		}
-		String condition = StrUtil.EMPTY;
-		if (isNormal != null && isNormal) {
-			condition += String.format("gt.account_id not in (select account_id from work_order where sku_id = %s and account_id is not null)", skuId);
-		}
-		if (StrUtil.isNotEmpty(condition)) {
-			condition += " and ";
-		}
-		Integer maxNum = sku.getNum();
-		Integer extraNum = 5;
-		//GPT 4人月付
-		if (sku.getId() == 178l) {
-			extraNum = 2;
-		}
-		maxNum += extraNum;
-		condition += String.format("(available_parking_num = 0 or available_parking_num > (select count(*) from groups_relation gr where gr.groups_id = gt.id and gr.user_id != 0 and gr.num <= %s))", maxNum);
-		if (StrUtil.isNotEmpty(condition)) {
-			builder.put("condition", condition);
-		}
-		if (expiryTime != null) {
-			builder.field(AccountView::getExpiryTime, expiryTime).op(Operator.GreaterEqual);
-			builder.orderBy(AccountView::getExpiryTime).asc();
-		}
-		if (sku.getNum() == 1 || !Constant.AI_goodsIds.contains(sku.getGoodsId())) {
-			builder.field(EmptyGroupsRelationView::getAvailableNum, 0).op(Operator.GreaterThan);
-		}
-		SearchResult<EmptyGroupsRelationView> search = beanSearcher.search(EmptyGroupsRelationView.class,
-				builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 订单补差价,补差价退款到余额
-	 */
-	@PutMapping("/refund/price/differ")
-	@Log(module = "订单管理/订单补差价", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> refundPriceDiffer(@RequestBody OrderRefundReq orderRefundReq) throws Exception {
-		long adminId = StpUtil.getLoginIdAsLong();
-		CmsUser cmsUser = cmsUserMapper.selectById(adminId);
-		if (cmsUser == null) {
-			throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
-		}
-		orderRefundReq.setOperator(cmsUser.getNickname());
-		cmsOrderDonService.refundPriceDiffer(orderRefundReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 将余额清零 退款用户支付金额
-	 */
-	@PutMapping("/clear/balance/refundMoney")
-	@NoSubmit
-	public Result<String> clearBalanceToRefundMoney(@RequestBody @Validated OrderBalanceRefundReq refundReq) throws Exception {
-		cmsOrderDonService.clearBalanceToRefundMoney(refundReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 客服退款每月数据
-	 */
-	@GetMapping("/get/refundOrder/data")
-	public Result<SearchResult<RefundOrderDonServiceDataView>> getRefundOrderData(String startTime, String endTime, String operator) {
-		String time = StrUtil.EMPTY;
-		if (StrUtil.isNotBlank(startTime)) {
-			time += String.format(" and o.created_time >= '%s'", startTime);
-		}
-		if (StrUtil.isNotBlank(endTime)) {
-			time += String.format(" and o.created_time < '%s'", endTime);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (StrUtil.isNotBlank(time)) {
-			builder.put("time", time);
-		}
-		if (StrUtil.isEmpty(operator)) {
-			List<CmsUserVO> userVOS = beanSearcher.searchAll(CmsUserVO.class, MapUtils.builder().field(CmsUserVO::getRoleNames, "客服").op(Operator.Contain).build());
-			List<String> collect = userVOS.stream().map(CmsUserVO::getNickname).collect(Collectors.toList());
-			if (CollUtil.isNotEmpty(collect)) {
-				builder.field(RefundOrderDonServiceDataView::getOperator, collect).op(Operator.InList);
-			}
-		}
-		SearchResult<RefundOrderDonServiceDataView> search = beanSearcher.search(RefundOrderDonServiceDataView.class, builder.build());
-		search.getDataList().forEach(e->{
-			String goodsName = orderDonMapper.selectMaxRefundGoodsName(e.getOperator(), startTime, endTime);
-			e.setGoodsName(goodsName);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 设置订单客服
-	 */
-	@PutMapping("/set/service")
-	public Result<String> setOrderCustomerService(@RequestBody OrderDonCustomerServiceRelate relate) {
-		OrderDonCustomerServiceRelate orderDonCustomerServiceRelate = orderDonCustomerServiceRelateMapper.selectOne(Wrappers.lambdaQuery(OrderDonCustomerServiceRelate.class)
-				.eq(OrderDonCustomerServiceRelate::getOrderId, relate.getOrderId()).last("limit 1"));
-		if (orderDonCustomerServiceRelate != null) {
-			relate.setId(orderDonCustomerServiceRelate.getId());
-		}
-		try {
-			if (relate.getId() == null) {
-				orderDonCustomerServiceRelateMapper.insert(relate);
-			} else {
-				orderDonCustomerServiceRelateMapper.updateById(relate);
-
-			}
-		} catch (DuplicateKeyException e) {
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-
-	/**
-	 * 查询套餐订单列表
-	 */
-
-	@GetMapping("/upgrade/get")
-	@SaCheckPermission("upgradeOrder:view")
-	public Result<SearchResult<UpgradeOrderDonBackView>> getUpgradeOrder(String account, String showId, Long acId, String nickname, String register, Boolean isGoogle) {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-
-		if (StrUtil.isNotBlank(account)) {
-			GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
-					.eq(GroupsRelation::getAccount, account).last("limit 1"));
-			if (relation != null) {
-				builder.field(OrderDonBackView::getRelationId, relation.getId());
-			} else {
-				builder.field(OrderDonBackView::getRelationId).op(Operator.IsNull);
-			}
-		}
-		if (StrUtil.isNotBlank(showId)) {
-			builder.field(OrderDonBackView::getUserId, userService.getUserIdByShowId(showId));
-		}
-		String conditionSql = StrUtil.EMPTY;
-		if (acId != null) {
-			conditionSql += String.format(" o.user_id in (select user_id from corp_user where ac_id = %s)", acId);
-		}
-		if (!ObjectUtil.isAllEmpty(nickname, register, isGoogle)) {
-			if (StrUtil.isNotEmpty(conditionSql)) {
-				conditionSql += " and ";
-			}
-			conditionSql += " exists (select u.id from user u where u.id = o.user_id";
-			if (StrUtil.isNotEmpty(nickname)) {
-				conditionSql += String.format(" and u.nickname like '%s%%'", nickname);
-			}
-			if (StrUtil.isNotEmpty(register)) {
-				if ("phone".equals(register)) {
-					conditionSql += " and u.login_phone != ''";
-				} else if ("email".equals(register)) {
-					conditionSql += " and u.email != ''";
-				} else if ("wechat".equals(register)) {
-					conditionSql += " and u.unionid != ''";
-				}
-			}
-			if (isGoogle != null && isGoogle) {
-				conditionSql += String.format(" and u.is_google is %s", isGoogle);
-			}
-			conditionSql += " limit 1)";
-		}
-		if (StrUtil.isNotBlank(conditionSql)) {
-			builder.put("condition", conditionSql);
-		}
-		SearchResult<UpgradeOrderDonBackView> search = beanSearcher.search(UpgradeOrderDonBackView.class, builder.build());
-		search.getDataList().forEach(data -> {
-			User user = userMapper.selectById(data.getUserId());
-			if (user != null) {
-				data.setNickname(user.getNickname());
-				data.setLoginPhone(user.getLoginPhone());
-				data.setEmail(user.getEmail());
-				data.setRegister(StrUtil.isNotEmpty(user.getUnionid()) ? "wechat" : StrUtil.isNotEmpty(user.getLoginPhone()) ? "phone" : "email");
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 套餐退款订单列表
-	 */
-	@GetMapping("/get/upgrade/refund/list")
-	public Result<SearchResult<RefundUpdradeOrderDonView>> getRefundUpgradeOrderDonView(String nickname) {
-		List<Long> userIds = null;
-		if (StrUtil.isNotBlank(nickname)) {
-			userIds = userMapper.selectListByNickname(nickname);
-			if (CollUtil.isEmpty(userIds)) {
-				userIds.add(0l);
-			}
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (CollUtil.isNotEmpty(userIds)) {
-			builder.field(RealGoodsInterestUserView::getUserId, userIds).op(Operator.InList);
-		}
-		SearchResult<RefundUpdradeOrderDonView> search = beanSearcher.search(RefundUpdradeOrderDonView.class,
-				builder.build());
-		search.getDataList().forEach(data -> {
-			Optional.ofNullable(userService.getById(data.getUserId()))
-					.ifPresent(user -> data.setNickname(user.getNickname()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 套餐订单导出
-	 */
-	@GetMapping("/upgrade/export")
-	@SaCheckPermission("upgradeOrder:export")
-	@Log(module = "套餐订单管理/导出订单", businessType = BusinessType.EXPORT, isSaveRequestData = true)
-	public void exportUpgradeOrders(HttpServletResponse response) {
-		List<ExcelUpgradeOrderDonData> list = beanSearcher.searchAll(ExcelUpgradeOrderDonData.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		list.forEach(data -> {
-			data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
-			UpgradeOrderDon.Type type = data.getType();
-			data.setTypeStr(type != null ? type.getDesc() : "");
-			UpgradeOrderDon.Status status = data.getStatus();
-			data.setStatusStr(status != null ? status.getDesc() : "");
-		});
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelUpgradeOrderDonData.class, list, "订单列表", "订单列表", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 套餐订单统一退款
-	 */
-	@PostMapping("/unified/upgrade/refund")
-	@Log(module = "套餐订单管理/统一退款", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> unifiedUpgradeRefund(@RequestBody @Validated OrderRefundReq refundReq) throws Exception {
-		long adminId = StpUtil.getLoginIdAsLong();
-		CmsUser cmsUser = cmsUserMapper.selectById(adminId);
-		if (cmsUser == null) {
-			throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
-		}
-		refundReq.setOperator(cmsUser.getNickname());
-		cmsOrderDonService.unifiedUpgradeRefund(refundReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("退款成功");
-	}
-
-	/**
-	 * midjourney查询订单用户账号剩余次数
-	 */
-	@GetMapping("/get/midjourney/user")
-	public Result<MidjourneyUserDetailView> getMidjourneyUser(Long orderId) {
-		OrderDon orderDon = orderDonMapper.selectById(orderId);
-		//续费订单
-		Date startTime = null;
-		Date expiryTime = null;
-		if (orderDon.getOrderType() == 2) {
-			GoodsDonSku sku = skuMapper.selectById(orderDon.getSkuId());
-			GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
-					.eq(GroupsRelation::getId, orderDon.getRelationId())
-					.eq(GroupsRelation::getUserId, orderDon.getUserId()).last("limit 1"));
-			if (relation == null) {
-				return GatewayResponse.SUCCESS.newBuilder().toResult();
-			}
-			startTime = relation.getStartTime();
-			startTime = DateUtil.offsetMonth(startTime, sku.getMonths());
-			expiryTime = relation.getExpiryTime();
-		}
-		MidjourneyUser midjourneyUser = midjourneyUserMapper.selectOne(Wrappers.lambdaQuery(MidjourneyUser.class)
-				.eq(MidjourneyUser::getRelationId, orderDon.getRelationId())
-				.last("limit 1"));
-		if (midjourneyUser == null) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		MidjourneyUserDetailView midjourneyUserDetailView = midjourneyUserConversationMapper.getMjMirrorOrderDetail(orderDon.getRelationId(), startTime, expiryTime);
-		GoodsDonSku sku = skuMapper.selectById(orderDon.getSkuId());
-		midjourneyUserDetailView.setUserId(orderDon.getUserId());
-		midjourneyUserDetailView.setExpiryTime(midjourneyUser.getExpireTime());
-		midjourneyUserDetailView.setMjFastNum(sku.getMjFastNum() - midjourneyUserDetailView.getUseFastNum());
-		if (sku.getMjRelaxNum() == null) {
-			midjourneyUserDetailView.setMjRelaxNum(null);
-		} else {
-			midjourneyUserDetailView.setMjRelaxNum(sku.getMjRelaxNum() - midjourneyUserDetailView.getUseRelaxNum());
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(midjourneyUserDetailView);
-	}
-
-	/**
-	 * 用户退款详情
-	 */
-	@GetMapping("/get/user/refund/detail")
-	public Result<OrderDonUserRefundDetailView> getUserRefundDetail(Long userId) {
-		if (userId == null || userId == 0) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		List<Long> userIdList = null;
-		try {
-			userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-		} catch (Exception e) {
-		}
-		String userIds = null;
-		if (CollUtil.isNotEmpty(userIdList)) {
-			userIds = userIdList.toString().replaceAll("\\[", "").replaceAll("]", "");
-		}
-		MapBuilder builder = MapUtils.builder();
-		if (StrUtil.isNotBlank(userIds)) {
-			builder.put("uid", String.format(" and user_id in (%s)", userIds));
-		} else {
-			builder.put("uid", String.format(" and user_id = %s", userId));
-		}
-		OrderDonUserRefundDetailView orderDonUserRefundDetailView = beanSearcher.searchFirst(OrderDonUserRefundDetailView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonUserRefundDetailView);
-	}
-
-	/**
-	 *  用户订单列表
-	 */
-	@GetMapping("/get/user/orders")
-	public Result<SearchResult<OrderDonUserRefundDetailView.OrderDonDetailView>> getUserOrdersDetail(Long userId) {
-		if (userId == null || userId == 0) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		List<Long> userIdList = null;
-		try {
-			userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-		} catch (Exception e) {
-		}
-		if (userIdList == null) {
-			userIdList = new ArrayList<>();
-			userIdList.add(userId);
-		}
-		SearchResult<OrderDonUserRefundDetailView.OrderDonDetailView> search = beanSearcher.search(OrderDonUserRefundDetailView.OrderDonDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(OrderDonUserRefundDetailView.OrderDonDetailView::getUserId, userIdList).op(Operator.InList)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 续费升级订单详情
-	 */
-	@GetMapping("/renew/orders/detail")
-	public Result<RenewOriOrderSkuDto> getRenewOrdersDetail(Long orderId) {
-		OrderDon orderDon = orderDonMapper.selectById(orderId);
-		if (orderDon.getOrderType() == 2) {
-			OrderDonRenewRecord orderDonRenewRecord = orderDonRenewRecordMapper.selectOne(Wrappers.lambdaQuery(OrderDonRenewRecord.class)
-					.eq(OrderDonRenewRecord::getOrderId, orderDon.getId())
-					.last("limit 1"));
-			if (orderDonRenewRecord != null) {
-				GroupsRelation relation = relationMapper.selectById(orderDon.getRelationId());
-				GoodsDonSku sku = skuMapper.selectById(orderDon.getSkuId());
-				Date expiryTime = relation.getExpiryTime();
-				DateTime lastExpiryTIme = DateUtil.offsetMonth(expiryTime, -sku.getMonths());
-
-				RenewOriOrderSkuDto renewOriOrderSkuDto = new RenewOriOrderSkuDto();
-				OriSkuDto oriSku = skuMapper.selectRenewOriSku(orderDonRenewRecord.getOriSkuId());
-				renewOriOrderSkuDto.setOriSku(oriSku);
-				renewOriOrderSkuDto.setLastExpiryTime(lastExpiryTIme);
-				ChatgptUser chatgptUser = chatgptUserMapper.selectOne(Wrappers.lambdaQuery(ChatgptUser.class)
-						.eq(ChatgptUser::getRelationId, orderDon.getRelationId())
-						.last("limit 1"));
-				if (chatgptUser != null) {
-					renewOriOrderSkuDto.setOrderId(chatgptUser.getRenewOrderId());
-				}
-				return GatewayResponse.SUCCESS.newBuilder().toResult(renewOriOrderSkuDto);
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	public void setExportOrderInfo(List<ExcelOrderDonData> datas, CountDownLatch countDownLatch) {
-		datas.forEach(data -> {
-			data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
-			OrderDon.Type type = data.getType();
-			data.setTypeStr(type != null ? type.getDesc() : "");
-			OrderDon.Status status = data.getStatus();
-			data.setStatusStr(status != null ? status.getDesc() : "");
-			data.setChannel("自然流量渠道");
-			if (data.getPopularizeId() != null) {
-				Optional.ofNullable(channelPopularizeMapper.selectChannelByPid(data.getPopularizeId()))
-						.ifPresent(channelName -> data.setChannel(channelName));
-			}
-			User user = userMapper.selectById(data.getUserId());
-			if (user != null) {
-				data.setNickname(user.getNickname());
-				data.setRegister(StrUtil.isNotEmpty(user.getUnionid()) ? "wechat" : StrUtil.isNotEmpty(user.getLoginPhone()) ? "phone" : "email");
-
-			}
-			if (data.getGoodsDonType() != null && Constant.realGoodsType.contains(data.getGoodsDonType())) {
-				OrderDonTransportView transportView = beanSearcher.searchFirst(OrderDonTransportView.class, MapUtils.builder().field(OrderDonTransportView::getOrderId, data.getId()).build());
-				if (transportView != null) {
-					data.setTransportStr(String.format("%s%s%s%s", transportView.getProvince(), transportView.getCity(), transportView.getDistrict(), transportView.getAddress()));
-					data.setPhone(transportView.getPhone());
-					data.setReceiver(transportView.getReceiver());
-					data.setCodeCn(transportView.getCodeCn());
-					data.setTrackingNumber(transportView.getTrackingNumber());
-				}
-				RealGoodsOrderHandle realGoodsOrderHandle = realGoodsOrderHandleMapper.selectOne(Wrappers.lambdaQuery(RealGoodsOrderHandle.class).eq(RealGoodsOrderHandle::getOrderId, data.getId()).last("limit 1"));
-				if (realGoodsOrderHandle != null) {
-					data.setBeforeServiceName(realGoodsOrderHandle.getBeforeServiceName());
-					data.setAfterServiceName(realGoodsOrderHandle.getAfterServiceName());
-				}
-			}
-			//使用优惠码
-			if (data.getCouponId() != null) {
-				Optional.ofNullable(couponMapper.selectById(data.getCouponId())).ifPresent(coupon -> data.setCouponName(coupon.getName()));
-				data.setCouponMoney(data.getCouponMoney() == null ? BigDecimal.ZERO : data.getCouponMoney());
-			}
-			if (data.getCouponUserId() != 0) {
-				data.setCouponName(couponMapper.getCouponNameByCouponUserId(data.getCouponUserId()));
-				data.setCouponMoney(data.getCouponMoney() == null ? BigDecimal.ZERO : data.getCouponMoney());
-			}
-		});
-		countDownLatch.countDown();
-	}
-}

+ 0 - 54
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsUserComplaintController.java

@@ -1,54 +0,0 @@
-package com.cyksj.web.controller.manage;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.UserComplaint;
-import com.cyksj.model.views.UserComplaintView;
-import com.cyksj.service.user.UserComplaintService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/*
- *项目名: netflix
- *文件名: CmsUserComplaintController
- *创建者: JavaZou
- *创建时间:2023/6/16 11:34
- */
-@RestController
-@RequestMapping("/manage/user/complaint")
-@RequiredArgsConstructor
-public class CmsUserComplaintController {
-	private final UserComplaintService userComplaintService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	/**
-	 * 投诉列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<UserComplaintView>> get() {
-		SearchResult<UserComplaintView> search = beanSearcher.search(UserComplaintView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 修改投诉状态
-	 */
-	@PutMapping("/put")
-	public Result<String> updateUserComplaintStatus(@RequestBody UserComplaint userComplaint) {
-		Long id = userComplaint.getId();
-		UserComplaint.Status status = userComplaint.getStatus();
-		userComplaintService.update(null, Wrappers.lambdaUpdate(UserComplaint.class)
-				.set(UserComplaint::getStatus, status)
-				.eq(UserComplaint::getId, id));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 531
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsUserController.java

@@ -1,531 +0,0 @@
-package com.cyksj.web.controller.manage;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alipay.api.AlipayApiException;
-import com.baomidou.mybatisplus.core.toolkit.Assert;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.*;
-import com.cyksj.mapper.corp.CorpUserFollowRelationMapper;
-import com.cyksj.mapper.manage.cms.CmsUserMapper;
-import com.cyksj.mapper.market.task.UserBindDetailMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.manage.views.MaliceUserView;
-import com.cyksj.model.manage.views.UserView;
-import com.cyksj.model.request.UserBalanceReq;
-import com.cyksj.model.request.UserFuncPropertyReq;
-import com.cyksj.model.views.*;
-import com.cyksj.service.relation.GroupRelationClearService;
-import com.cyksj.service.user.UserBenefitsService;
-import com.cyksj.service.user.UserBindRelationService;
-import com.cyksj.service.user.UserPayOrderBlockService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * @author chan
- * @date 2022/9/27 4:42 PM
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/user")
-public class CmsUserController{
-
-    private final HttpServletRequest request;
-
-    private final BeanSearcher beanSearcher;
-
-    private final UserFuncPropertyMapper userFuncPropertyMapper;
-
-    private final UserMapper userMapper;
-
-    private final UserBindDetailMapper userBindDetailMapper;
-
-    private final GroupRelationClearService groupRelationClearService;
-
-    private final GroupsRelationMapper groupsRelationMapper;
-
-    private final UserBindRelationService userBindRelationService;
-
-    private final CorpUserFollowRelationMapper cmsUserFollowRelationMapper;
-
-    private final OrderDonMapper orderDonMapper;
-
-    private final UserBenefitsService userBenefitsService;
-
-    private final UserPayOrderBlockService userPayOrderBlockService;
-
-    private final CmsUserMapper cmsUserMapper;
-
-    private final UserCertRecordMapper userCertRecordMapper;
-
-    private final UserDoubleVerifyCodeChangeRecordMapper userDoubleVerifyCodeChangeRecordMapper;
-
-    private final List<Long> no_blacks_userIds = List.of(375274l, 545599l, 523937l, 507498l, 604146l, 613437l, 651728l, 614100l, 604148l);
-
-    @GetMapping("/get")
-    public Result<SearchResult<UserView>> get(Long id, String otherPhone, Long sharedId, String userid, Long businessId, String sort, String order, Boolean isCert, Boolean isAbroad) {
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        String otherSql = StrUtil.EMPTY;
-        if (StrUtil.isNotBlank(otherPhone)) {
-            otherSql += String.format("(u.id in (select user_id from user_bind_detail where phone like '%s%%') or u.login_phone like '%s%%')", otherPhone, otherPhone);
-        }
-        if (businessId != null) {
-            if (StrUtil.isNotBlank(otherSql)) {
-                otherSql += " and ";
-            }
-            otherSql += String.format("us.shared_id in (select user_id from user_distribute where business_id = %s)", businessId);
-        }
-        if (id != null) {
-            List<Long> relationUserIdList = null;
-            try {
-                relationUserIdList = userBindRelationService.getRelationUserIdList(id, null);
-            } catch (Exception e) {
-            }
-            if (CollUtil.isNotEmpty(relationUserIdList)) {
-                builder.field(UserView::getId, relationUserIdList).op(Operator.InList);
-            }
-        }
-        if (isCert != null) {
-            if (StrUtil.isNotBlank(otherSql)) {
-                otherSql += " and ";
-            }
-            otherSql += "exists (select 1 from user_cert_record where user_id = u.id)";
-        }
-        if (isAbroad != null) {
-            if (StrUtil.isNotBlank(otherSql)) {
-                otherSql += " and ";
-            }
-            otherSql += String.format(" %s (select 1 from phone_code pc where pc.phone = u.login_phone and cid is not null and cid != 86)", isAbroad ? "exists" : "not exists");
-        }
-        if (StrUtil.isNotBlank(otherSql)) {
-            builder.put("otherConditionSql", otherSql);
-        }
-        SearchResult<UserView> search = beanSearcher.search(UserView.class, builder.build());
-        search.getDataList().forEach(data -> {
-            Long userId = data.getId();
-            UserBindDetail userBindDetail = beanSearcher.searchFirst(UserBindDetail.class, MapUtils.builder().field(UserBindDetail::getUserId, userId).onlySelect(UserBindDetail::getPhone, UserBindDetail::getEmail).build());
-            Optional.ofNullable(userBindDetail).ifPresent(bind -> {
-                data.setBindEmail(bind.getEmail());
-                data.setBindPhone(bind.getPhone());
-            });
-            if (data.getSharedId() != null) {
-                UserDistributeBusinessInfoView userDistributeBusinessInfoView = beanSearcher.searchFirst(UserDistributeBusinessInfoView.class, MapUtils.builder().field(UserDistributeBusinessInfoView::getUserId, data.getSharedId()).build());
-                Optional.ofNullable(userDistributeBusinessInfoView).ifPresent(info -> {
-                    data.setDistributeName(info.getDistributeName());
-                    data.setBusinessName(info.getBusinessName());
-                });
-            }
-            Integer selectCount = userCertRecordMapper.selectCount(Wrappers.lambdaQuery(UserCertRecord.class)
-                    .eq(UserCertRecord::getUserId, userId));
-            data.setIsCert(selectCount > 0 ? true : false);
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 查看排除绑定重复用户数 真实用户数
-     */
-    @GetMapping("/get/real/userNum")
-    public Result<Integer> getRealUserNum() {
-        Integer unBindUserNum = userMapper.selectUnBindUserNum();
-        Integer bindUserNum = userBindDetailMapper.selectCount(null);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(unBindUserNum + bindUserNum);
-    }
-
-    /**
-     * 修改用户的拉黑状态
-     */
-    @PutMapping("/put/black/status/{id}")
-    @SaCheckPermission("user:black")
-    @Log(module = "用户管理/拉黑用户", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> putBlackStatus(@PathVariable Long id) {
-        if (no_blacks_userIds.contains(id)) {
-            throw BusinessRuntimeException.getInstance("张凯已处理");
-        }
-        User user = userMapper.selectById(id);
-        Optional.ofNullable(user).ifPresent(u -> {
-            u.setIsBlack(!u.getIsBlack());
-            if (u.getIsBlack()) {
-                List<Long> userIds = userBindRelationService.getRelationUserIdList(id, user);
-                List<RenewalView> groupsRelations = beanSearcher.searchAll(RenewalView.class, MapUtils.builder()
-                        .field(RenewalView::getUserId, 0).op(Operator.GreaterThan)
-                        .field(RenewalView::getUserId, userIds).op(Operator.InList)
-                        .field(RenewalView::getStatus, List.of("validity", "overdue", "outside")).op(Operator.InList)
-                        .orderBy(RenewalView::getExpiryTime).asc()
-                        .build());
-                groupsRelations.forEach(ticket -> {
-                    GroupsRelation relation = groupsRelationMapper.selectById(ticket.getRelationId());
-                    groupRelationClearService.clearTicket(relation, UserTicketClearedRecord.Source.black);
-                });
-            }
-            userMapper.updateById(u);
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 修改用户查看验证码次数
-     */
-    @PutMapping("/put/verifyCheck/num")
-    public Result<String> updateCheckCodeNum(@RequestBody UserFuncPropertyReq req) {
-        if (req.getUserId() == null) throw BusinessRuntimeException.getInstance("用户id为空");
-        if (req.getVerifyCheckNum() == null || req.getVerifyCheckNum() < 0) {
-            throw BusinessRuntimeException.getInstance("请输入正确的查看验证码次数");
-        }
-        UserFuncProperty userFuncProperty = userFuncPropertyMapper.selectOne(Wrappers.lambdaQuery(UserFuncProperty.class)
-                .eq(UserFuncProperty::getUserId, req.getUserId()).last("limit 1"));
-        Boolean isFirst = false;
-        if (userFuncProperty == null) {
-            try {
-                userFuncProperty = new UserFuncProperty();
-                userFuncProperty.setUserId(req.getUserId());
-                userFuncProperty.setVerifyCheckNum(req.getVerifyCheckNum());
-                userFuncPropertyMapper.insert(userFuncProperty);
-                isFirst = true;
-            } catch (DuplicateKeyException e) {
-
-            }
-        }
-        if (isFirst || (userFuncProperty.getVerifyCheckNum() != req.getVerifyCheckNum())) {
-            long adminId = StpUtil.getLoginIdAsLong();
-            UserDoubleVerifyCodeChangeRecord userDoubleVerifyCodeChangeRecord = new UserDoubleVerifyCodeChangeRecord();
-            userDoubleVerifyCodeChangeRecord.setUserId(req.getUserId());
-            Optional.ofNullable(cmsUserMapper.selectById(adminId))
-                    .ifPresent(cu -> userDoubleVerifyCodeChangeRecord.setOperator(cu.getNickname()));
-            userDoubleVerifyCodeChangeRecord.setOldVerifyCheckNum(isFirst ? 1 : userFuncProperty.getVerifyCheckNum());
-            userDoubleVerifyCodeChangeRecord.setVerifyCheckNum(req.getVerifyCheckNum());
-            userDoubleVerifyCodeChangeRecordMapper.insert(userDoubleVerifyCodeChangeRecord);
-        }
-        userFuncProperty.setVerifyCheckNum(req.getVerifyCheckNum());
-        userFuncPropertyMapper.updateById(userFuncProperty);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 查看用户验证码次数
-     */
-    @GetMapping("/get/verifyCheck/num")
-    public Result<Integer> getVerifyCheckNum(Long userId) {
-        if (userId==null) throw BusinessRuntimeException.getInstance("用户id为空");
-        UserFuncProperty userFuncProperty = userFuncPropertyMapper.selectOne(Wrappers.lambdaQuery(UserFuncProperty.class)
-                .eq(UserFuncProperty::getUserId, userId).last("limit 1"));
-        //默认0次
-        Integer verifyCheckNum = 0;
-        if (userFuncProperty != null) verifyCheckNum = userFuncProperty.getVerifyCheckNum();
-        return GatewayResponse.SUCCESS.newBuilder().toResult(verifyCheckNum);
-    }
-
-    /**
-     * 用户验证码更变记录列表展示
-     */
-    @GetMapping("/get/verifyCode/change/list/{userId}")
-    public Result<SearchResult<UserDoubleVerifyCodeChangeRecord>> getUserDoubleVerifyCodeChangeRecordByUserId(@PathVariable Long userId) {
-        SearchResult<UserDoubleVerifyCodeChangeRecord> search = beanSearcher.search(UserDoubleVerifyCodeChangeRecord.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(UserDoubleVerifyCodeChangeRecord::getUserId, userId)
-                .orderBy(UserDoubleVerifyCodeChangeRecord::getId).desc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-
-    /**
-     * 用户加入企业微信客服详情
-     */
-    @GetMapping("/get/corpFollow/detail/{userId}")
-    public Result<String> getCorpFollowDetailById(@PathVariable Long userId) {
-        User user = userMapper.selectById(userId);
-        if (user == null || StrUtil.isEmpty(user.getUnionid())) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        Long wxCorpId = 2l;
-        String corpCustomers = cmsUserFollowRelationMapper.selectCorpCustomers(user.getUnionid(), wxCorpId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(corpCustomers);
-    }
-
-    /**
-     * 企业微信客服列表
-     */
-    @GetMapping("/get/corpFollow")
-    public Result<List<CorpFollow>> getCorpFollow() {
-        List<CorpFollow> corpFollows = beanSearcher.searchAll(CorpFollow.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(CorpFollow::getWxCorpId, 2)
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(corpFollows);
-    }
-
-    /**
-     * 用户订单详情title
-     */
-    @GetMapping("/get/order/title")
-    public Result<UserView> getUserOrderDetailTitle(Long userId) {
-        UserView userView = new UserView();
-        List<OrderDon> orderDons = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class)
-                .eq(OrderDon::getUserId, userId)
-                .notIn(OrderDon::getStatus, Constant.noOrderStatus)
-                .orderByAsc(OrderDon::getId));
-        //首单产品
-        Optional<OrderDon> firstOrder = orderDons.stream().filter(don -> don.getStatus() != OrderDon.Status.refund).findFirst();
-        if (firstOrder.isPresent()) {
-            OrderDon orderDon = firstOrder.get();
-            BigDecimal money = orderDon.getMoney().divide(BigDecimal.valueOf(100));
-            Optional.ofNullable(beanSearcher.searchFirst(GoodsDonSkuView.class, MapUtils.builder().field(GoodsDonSkuView::getSkuId, orderDon.getSkuId()).onlySelect(GoodsDonSkuView::getGoodsTitle, GoodsDonSkuView::getSpecVal).build()))
-                    .ifPresent(goodsDonSkuView -> {
-                        String msg = String.format("%s%s %s元", goodsDonSkuView.getGoodsTitle(), goodsDonSkuView.getSpecVal(), money);
-                        if (orderDon.getCouponUserId() != 0) {
-                            BigDecimal subMoney = orderDon.getCouponMoney().divide(BigDecimal.valueOf(100));
-                            msg = String.format("%s(减免%s元)", msg, subMoney);
-                        }
-                        userView.setFirstOrderDetail(msg);
-                    });
-        }
-        //有无路由器订单
-        Optional<OrderDon> routeOrder = orderDons.stream().filter(don -> don.getGoodsId() == 15).findFirst();
-        userView.setIsHadRouteOrder(routeOrder.isPresent() ? true : false);
-
-        Integer noRefundOrders = 0;
-        Integer refundOrders = 0;
-        //除去退款 下单金额
-        BigDecimal orderMoney = BigDecimal.ZERO;
-        BigDecimal refundMoney = BigDecimal.ZERO;
-        for (OrderDon orderDon : orderDons) {
-            if (orderDon.getStatus() == OrderDon.Status.refund) {
-                refundOrders++;
-                if (orderDon.getRefundMoney() != null) {
-                    refundMoney = refundMoney.add(orderDon.getRefundMoney());
-                }
-            }else {
-                noRefundOrders++;
-                orderMoney = orderMoney.add(orderDon.getMoney());
-            }
-        }
-        BigDecimal refundRate = BigDecimal.ZERO;
-        if (!orderDons.isEmpty()) {
-            //退款率
-            refundRate = BigDecimal.valueOf(refundOrders).divide(BigDecimal.valueOf(orderDons.size()), 2, RoundingMode.HALF_UP);
-        }
-        userView.setOrderMoney(orderMoney);
-        userView.setNumOfOrder(noRefundOrders);
-        userView.setRefundMoney(refundMoney);
-        userView.setRefundRate(refundRate);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(userView);
-    }
-
-    /**
-     * 用户下单详情
-     */
-    @GetMapping("/get/order/list")
-    public Result<SearchResult<UserOrderDonDetail>> getUserOrderDetails() {
-        SearchResult<UserOrderDonDetail> search = beanSearcher.search(UserOrderDonDetail.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(UserOrderDonDetail::getStatus, Constant.noOrderAllStatus).op(Operator.NotIn)
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 问卷回答列表
-     */
-    @GetMapping("/get/question/response/list")
-    public Result<List<QuestionResponseRecordView>> getQuestionResponseList(String first, String end) {
-        String timeSql = StrUtil.EMPTY;
-        if (StrUtil.isNotBlank(first)) {
-            timeSql += String.format(" and created_time >= '%s'", first);
-        }
-        if (StrUtil.isNotBlank(end)) {
-            timeSql += String.format(" and created_time < '%s'", end);
-        }
-        MapBuilder builder = MapUtils.builder();
-        if (StrUtil.isNotBlank(timeSql)) {
-            builder.put("time", timeSql);
-        }
-        List<QuestionResponseRecordView> views = beanSearcher.searchAll(QuestionResponseRecordView.class, builder.build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(views);
-    }
-
-    /**
-     * 余额扣除
-     */
-    @PutMapping("/sub/balance")
-    @Transactional(rollbackFor = Throwable.class)
-    @Log(module = "用户管理/扣除用户余额", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> subBalance(@RequestBody @Validated UserBalanceReq balanceReq) {
-        BigDecimal deductBalance = balanceReq.getDeductBalance();
-        if (deductBalance.compareTo(BigDecimal.ZERO) <= 0) {
-            throw BusinessRuntimeException.getInstance("请扣除正确的余额数值");
-        }
-        Long userId = balanceReq.getUserId();
-        User user = userMapper.selectById(userId);
-        Assert.notNull(user, "用户不存在");
-        if (user.getBalance().compareTo(deductBalance) < 0) {
-            throw BusinessRuntimeException.getInstance("用户余额不足");
-        }
-        int update = userMapper.update(null, Wrappers.lambdaUpdate(User.class)
-                .set(User::getBalance, user.getBalance().subtract(deductBalance))
-                .eq(User::getId, userId)
-                .eq(User::getBalance, user.getBalance()));
-        if (update == 0) {
-            throw BusinessRuntimeException.getInstance("扣除用户余额失败,请重试...");
-        }
-        userBenefitsService.recordBalanceBySource(userId, deductBalance.negate(), UserBalanceSourceRecord.Source.manual, null, UserBalanceSourceRecord.Source.manual.getDesc());
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 新增用户下单拉黑记录
-     */
-    @PostMapping("/userOrder/block")
-    public Result<String> blockUserOrder(@RequestBody UserPayOrderBlock payOrderBlock) throws AlipayApiException {
-        String orderNo = payOrderBlock.getOrderNo();
-        Assert.notEmpty(orderNo, "请输入订单号");
-        userPayOrderBlockService.blockUserOrder(payOrderBlock);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 删除用户下单拉黑记录
-     */
-    @DeleteMapping("/userOrder/{id}")
-    public Result<String> delBlockUserOrder(@PathVariable Long id) {
-        userPayOrderBlockService.removeById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 用户下单拉黑 列表
-     */
-    @GetMapping("/userOrder")
-    public Result<SearchResult<UserPayOrderBlock>> getBlockUserOrder() {
-        SearchResult<UserPayOrderBlock> search = beanSearcher.search(UserPayOrderBlock.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 用户每日活跃登录记录
-     */
-    @GetMapping("/get/user/login/record/{userId}")
-    public Result<SearchResult<UserLoginRecord>> getUserLoginRecord(@PathVariable Long userId) {
-        SearchResult<UserLoginRecord> search = beanSearcher.search(UserLoginRecord.class, MapUtils.flatBuilder(request.getParameterMap()).field(UserLoginRecord::getUserId, userId)
-                .orderBy(UserLoginRecord::getCreatedTime).desc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 大额度用户 列表
-     */
-    @GetMapping("/get/consume/large/user")
-    public Result<SearchResult<UserView>> getLargeConsumer() {
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        String largeLimit = "200000";
-        String fu = String.format("(select distinct user_id from order_don o where o.relation_id != 0 and o.status not in ('close','noPayment','refund') group by user_id, date_format(o.created_time,'%%Y-%%m-%%d')" +
-                "having sum(money) > %s) ln inner join", largeLimit);
-        String fuOn = " on ln.user_id = u.id";
-        builder.put("fu", fu);
-        builder.put("fu_on", fuOn);
-        SearchResult<UserView> search = beanSearcher.search(UserView.class, builder.build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 是否有最新的用户产生
-     */
-    @GetMapping("/get/consume/large/newUser")
-    public Result<Boolean> getLargeNewConsumer() {
-        String largeLimit = "200000";
-        DateTime beginOfDay = DateUtil.beginOfDay(DateTime.now());
-        Integer newConsumerCount = userMapper.getLargeNewConsumer(beginOfDay, largeLimit);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(newConsumerCount > 0 ? true : false);
-    }
-
-    /**
-     * 超过恶意用户列表
-     * 使用五个以上得支付宝
-     */
-    @GetMapping("/get/malice/user")
-    public Result<SearchResult<MaliceUserView>> getMaliceUser() {
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        SearchResult<MaliceUserView> search = beanSearcher.search(MaliceUserView.class, builder
-                .orderBy(MaliceUserView::getId).asc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 是否有最新恶意用户
-     */
-    @GetMapping("get/malice/user/newUser")
-    public Result<Boolean> getNewMaliceUser() {
-        DateTime beginOfDay = DateUtil.beginOfDay(DateTime.now());
-        Integer newConsumerCount = userMapper.getNewMaliceUser(beginOfDay);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(newConsumerCount > 0 ? true : false);
-    }
-
-    /**
-     * 用户ip列表
-     */
-    @GetMapping("/get/ip/list")
-    public Result<SearchResult<OrderDonLocationRelateView>> orderDonLocationRelateResult(Long userId) {
-        if (userId == null) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        SearchResult<OrderDonLocationRelateView> search = beanSearcher.search(OrderDonLocationRelateView.class, MapUtils.flatBuilder(request.getParameterMap()).put("userId", String.format("where user_id in (%s)", userIdList.toString().replaceAll("\\[", "").replaceAll("]", ""))).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 用户支付宝列表
-     */
-    @GetMapping("/get/zfb/list")
-    public Result<List<OrderDonBuyerView>> getZfbBuyers(Long userId) {
-        if (userId == null) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-        List<OrderDonBuyerView> orderDonBuyerViews = beanSearcher.searchAll(OrderDonBuyerView.class, MapUtils.flatBuilder(request.getParameterMap()).field(OrderDonBuyerView::getUserId, userIdList).op(Operator.InList).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonBuyerViews);
-    }
-
-    /**
-     * 每月买过两单奈飞账号用户列表
-     */
-    @GetMapping("/get/more/netflix/user")
-    public Result<SearchResult<UserNfView>> getMoreNetflixUser() {
-        SearchResult<UserNfView> search = beanSearcher.search(UserNfView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        search.getDataList().forEach(data -> {
-            Long userId = data.getId();
-            UserBindDetail userBindDetail = beanSearcher.searchFirst(UserBindDetail.class, MapUtils.builder().field(UserBindDetail::getUserId, userId).onlySelect(UserBindDetail::getPhone, UserBindDetail::getEmail).build());
-            Optional.ofNullable(userBindDetail).ifPresent(bind -> {
-                data.setBindEmail(bind.getEmail());
-                data.setBindPhone(bind.getPhone());
-            });
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-}

+ 0 - 274
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/AccountTempController.java

@@ -1,274 +0,0 @@
-package com.cyksj.web.controller.manage.account;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUnit;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.context.AnalysisContext;
-import com.alibaba.excel.event.AnalysisEventListener;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.*;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.excel.ExcelPrepareAccountData;
-import com.cyksj.model.manage.views.AccountView;
-import com.cyksj.model.request.OrderRefundReq;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.mange.AccountCommonService;
-import com.cyksj.service.order.OrderCommonService;
-import com.cyksj.service.order.OrderRefundService;
-import com.cyksj.service.user.UserBenefitsService;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.List;
-
-/**
- * 项目名: yhlxj
- * 文件名: AccountTempController
- * 创建者: JavaZou
- * 创建时间:2024/10/28 17:17
- */
-@Slf4j
-@RequiredArgsConstructor
-@RequestMapping("/manage/account/temp")
-@RestController
-public class AccountTempController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final AccountMapper accountMapper;
-
-	private final AccountCommonService accountCommonService;
-
-	private final NetflixTempAccountUserMapper netflixTempAccountUserMapper;
-
-	private final GroupsMapper groupsMapper;
-
-	private final GroupsRelationMapper relationMapper;
-
-	private final OrderDonMapper orderDonMapper;
-
-	private final GoodsDonSkuMapper skuMapper;
-
-	private final OrderRefundService orderRefundService;
-
-	private final RedisService redisService;
-
-	private final OrderCommonService orderCommonService;
-
-	private final GoodsDonMapper goodsDonMapper;
-
-	private final UserBenefitsService userBenefitsService;
-
-	/**
-	 * 新增临时账号
-	 */
-	@PostMapping("/post")
-	public Result<String> post(@RequestBody Account account) {
-		account.setType(3);
-		accountMapper.insert(account);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑临时账号
-	 */
-	@PutMapping("/update")
-	public Result<String> update(@RequestBody Account account) {
-		accountMapper.updateById(account);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deletedById(@PathVariable Long id) {
-		Account account = accountMapper.selectById(id);
-		if (account != null && account.getType() == 3) {
-			accountMapper.deleteById(id);
-			netflixTempAccountUserMapper.delete(Wrappers.lambdaQuery(NetflixTempAccountUser.class)
-					.eq(NetflixTempAccountUser::getAccountId, account.getId()));
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 临时账号模板
-	 */
-	@GetMapping("/export/temp/template")
-	public void getTempTemplate(HttpServletResponse response) {
-		EasyExcelUtils.createTemplateExcel(response, ExcelPrepareAccountData.class, "临时账号导入模板", "临时账号导入模板", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 批量导入临时账号
-	 */
-	@PostMapping("/import")
-	public Result<String> batchImport(@RequestParam(defaultValue = "1") Long goodsId, MultipartFile file) throws IOException {
-		if (goodsId == null) {
-			throw BusinessRuntimeException.getInstance("请选择对应平台");
-		}
-		EasyExcel.read(file.getInputStream(), ExcelPrepareAccountData.class, new AnalysisEventListener<ExcelPrepareAccountData>() {
-			@Override
-			public void invoke(ExcelPrepareAccountData data, AnalysisContext analysisContext) {
-				String account = data.getAccount();
-				String password = data.getPassword();
-				if (StrUtil.isEmpty(account) || StrUtil.isEmpty(password)) {
-					return;
-				}
-				Account insert = new Account();
-				insert.setAccount(account.trim());
-				insert.setPassword(password.trim());
-				insert.setGoodsId(goodsId);
-				//临时账号
-				insert.setType(3);
-				insert.setStartTime(DateTime.now());
-				if (data.getExpiryTime() != null) {
-					insert.setExpiryTime(DateUtil.parse(data.getExpiryTime()));
-				} else {
-					insert.setExpiryTime(DateUtil.offsetMonth(DateTime.now(), 1));
-				}
-				insert.setBankCard(data.getBankCard());
-				//辅助邮箱
-				insert.setEmail(data.getSecondEmail());
-				//关联邮箱
-				insert.setRelateEmail(data.getRelateEmail());
-				//账号是否已经添加过
-				if (!insert.getAccount().contains("客服")) {
-					if (accountCommonService.checkIsDupAccount(insert.getGoodsId(), insert.getAccount())) {
-						return;
-					}
-				}
-				accountMapper.insert(insert);
-			}
-
-			@Override
-			public void doAfterAllAnalysed(AnalysisContext analysisContext) {
-
-			}
-		}).sheet().doRead();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 临时账号列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<AccountView>> get() {
-		SearchResult<AccountView> search = beanSearcher.search(AccountView.class, MapUtils.flatBuilder(request.getParameterMap()).field(AccountView::getType, 3).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * excel奈飞退款
-	 */
-	@PutMapping("/refund")
-	public void excelRefund(MultipartFile file) throws IOException {
-		if (!file.getOriginalFilename().contains(".xls")) {
-			throw BusinessRuntimeException.getInstance("请导入excel文件");
-		}
-		List<Object> accountList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(0).doReadSync();
-		accountList.forEach(account->{
-			Account dbAccount = accountMapper.selectOne(Wrappers.lambdaQuery(Account.class)
-					.eq(Account::getGoodsId, 1)
-					.eq(Account::getAccount, account)
-					.last("limit 1"));
-			if (dbAccount != null) {
-				GroupsTrips groupsTrips = groupsMapper.selectById(dbAccount.getId());
-				if (groupsTrips.getSkuId() != 4) {
-					return;
-				}
-				if (groupsTrips != null) {
-					//15天以内的自动退款
-					List<GroupsRelation> groupsRelations = relationMapper.selectList(Wrappers.lambdaQuery(GroupsRelation.class)
-							.eq(GroupsRelation::getGroupsId, groupsTrips.getId())
-							.gt(GroupsRelation::getExpiryTime, DateTime.now())
-							.le(GroupsRelation::getExpiryTime, DateUtil.offsetDay(DateTime.now(), 15)));
-					GoodsDon goodsDon = goodsDonMapper.selectById(1);
-					groupsRelations.forEach(relation->{
-						OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
-								.eq(OrderDon::getRelationId, relation.getId())
-								.eq(OrderDon::getUserId, relation.getUserId())
-								.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
-								.orderByDesc(OrderDon::getId)
-								.last("limit 1"));
-						BigDecimal money = orderDon.getMoney();
-						GoodsDonSku sku = skuMapper.selectById(orderDon.getSkuId());
-						Integer months = sku.getMonths();
-						BigDecimal single = sku.getPrice().divide(BigDecimal.valueOf(months * 30), 2, RoundingMode.DOWN);
-						long betDay = DateUtil.between(DateTime.now(), relation.getExpiryTime(), DateUnit.DAY);
-						BigDecimal refundMoney = single.multiply(BigDecimal.valueOf(betDay));
-						//退款
-						OrderRefundReq orderRefundReq = new OrderRefundReq();
-						orderRefundReq.setOrderId(orderDon.getId());
-						orderRefundReq.setRefundMoney(refundMoney);
-						orderDon.setRefundDesc("奈飞15天内过期自动退款");
-						String outNo = null;
-						try {
-							orderRefundReq.setRefundType("ALI_PAY");
-							outNo = orderRefundService.centerRefund(orderRefundReq, orderDon);
-							orderDon.setStatus(OrderDon.Status.refund);
-							orderDon.setRefundMoney(orderRefundReq.getRefundMoney());
-							orderDonMapper.updateById(orderDon);
-							clearUserLockingRelation(relationMapper.selectById(orderDon.getRelationId()), orderDon);
-							//记录退款
-							orderRefundService.refundRecord(orderDon, orderRefundReq.getRefundMoney(), null, goodsDon, sku, outNo, orderDon.getType().getType(), null);
-						} catch (Exception e) {
-							orderRefundReq.setRefundType("balance");
-							userBenefitsService.addUserBalance(relation.getUserId(), refundMoney, UserBalanceSourceRecord.Source.clear_valid, relation.getYhsId(), orderDon.getId(), goodsDon.getTitle() + UserBalanceSourceRecord.Source.clear_valid.getDesc(), true);
-							//修改订单状态 为退款
-							orderDon.setStatus(OrderDon.Status.refund);
-							orderDon.setRefundBalance(refundMoney);
-							orderDon.setRefundMoney(BigDecimal.ZERO);
-							orderDonMapper.updateById(orderDon);
-							orderRefundService.refundRecord(orderDon, orderRefundReq.getRefundMoney(), null, goodsDon, sku, outNo, "balance", null);
-						}
-					});
-
-				}
-			}
-		});
-
-	}
-
-	private void clearUserLockingRelation(GroupsRelation groupsRelation, OrderDon orderDon) {
-		if (groupsRelation == null) {
-			return;
-		}
-		if (GroupsRelation.Status.locking == groupsRelation.getStatus()) {
-			log.info("清理用户userId:{}未支付订单", orderDon.getUserId());
-			groupsRelation.setUserId(0L);
-			Long groupsId = groupsRelation.getGroupsId();
-			GroupsTrips groupsTrips = groupsMapper.selectById(groupsId);
-			if (groupsRelation.getNum() > groupsTrips.getNum()) {
-				groupsRelation.setStatus(GroupsRelation.Status.outside);
-
-				redisService.del(RedisService.key.GROUPS_TRIPS_OUTSIDE_RELATION.getNameFormat(groupsId, groupsRelation.getNum()));
-			} else {
-				groupsRelation.setStatus(GroupsRelation.Status.none);
-			}
-			groupsRelation.setYhsId(0l);
-			relationMapper.updateById(groupsRelation);
-			orderCommonService.delRelation(groupsRelation);
-		}
-	}
-}

+ 0 - 1397
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -1,1397 +0,0 @@
-package com.cyksj.web.controller.manage.account;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.extra.servlet.ServletUtil;
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.context.AnalysisContext;
-import com.alibaba.excel.event.AnalysisEventListener;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.baomidou.mybatisplus.core.toolkit.Assert;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
-import com.cyksj.common.util.J11HttpC;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.RedisKey;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.*;
-import com.cyksj.mapper.manage.cms.CmsUserMapper;
-import com.cyksj.mapper.sys.SysEmailMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.excel.*;
-import com.cyksj.model.manage.request.ReqAccountIncrExpiryTime;
-import com.cyksj.model.manage.views.AccountView;
-import com.cyksj.model.manage.views.GroupsRelationView;
-import com.cyksj.model.response.ExpiredAccountRep;
-import com.cyksj.model.response.OrderDonAccountRep;
-import com.cyksj.model.views.*;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.chatgpt.ChatGptAccountService;
-import com.cyksj.service.mange.AccountCommonService;
-import com.cyksj.service.mange.CmsAccountService;
-import com.cyksj.service.mange.CmsGroupService;
-import com.cyksj.service.mange.cms.CmsUserManager;
-import com.cyksj.service.template.TemplateCommonService;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.net.http.HttpResponse;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author chan
- * @date 2022/9/27 6:15 PM
- */
-@Slf4j
-@RequiredArgsConstructor
-@RequestMapping("/manage/account")
-@RestController
-public class CmsAccountController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final CmsAccountService accountService;
-
-    private final HomeGroupMapper homeGroupMapper;
-
-    private final GroupsMapper groupsMapper;
-
-	private final TemplateCommonService templateCommonService;
-
-	private final CmsGroupService cmsGroupService;
-
-	private final UserTicketClearedRecordMapper userTicketClearedRecordMapper;
-
-	private final UserMapper userMapper;
-
-	private final CmsUserMapper cmsUserMapper;
-
-	private final CmsUserManager cmsUserManager;
-
-	private final GroupsRelationMapper groupsRelationMapper;
-
-	private final AccountDoubleVerifyRecordMapper doubleVerifyRecordMapper;
-
-	private final AccountUpdatePasswordRecordMapper accountUpdatePasswordRecordMapper;
-
-	private final AccountCommonService accountCommonService;
-
-	private final RedisService redisService;
-
-	private final GoodsDonSkuMapper goodsDonSkuMapper;
-
-	private final SysEmailMapper sysEmailMapper;
-
-	private final AccountBlockedReplaceRecordMapper accountBlockedReplaceRecordMapper;
-
-	private final ChatGptAccountService chatGptAccountService;
-
-	private final MidjourneyAccountMapper midjourneyAccountMapper;
-
-	private final GoodsDonMapper goodsDonMapper;
-
-	private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
-
-	@GetMapping("/get")
-	@SaCheckPermission("account:view")
-	public Result<SearchResult<AccountView>> get(String title, Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths, Boolean isMjMirror) {
-		MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-		if (StrUtil.isNotEmpty(expiryStartTime) || StrUtil.isNotEmpty(expiryEndTime)) {
-			mapBuilder.field(AccountView::getExpiryTime, expiryStartTime, expiryEndTime)
-					.op(Operator.Between);
-		}
-		if (StrUtil.isNotBlank(title)) {
-			GoodsDon goodsDon = goodsDonMapper.selectOne(Wrappers.lambdaQuery(GoodsDon.class).eq(GoodsDon::getTitle, title)
-					.last("limit 1"));
-			if (goodsDon != null) {
-				mapBuilder.field(AccountView::getGoodsId, goodsDon.getId());
-				title = null;
-			}
-		}
-		if (StrUtil.isNotEmpty(showId)) {
-			userId = userMapper.getUserIdByShowId(showId);
-		}
-
-		if (userId != null || StringUtils.isNotBlank(nickName) || StringUtils.isNotBlank(submitAccount)) {
-			List<Long> accountIds = homeGroupMapper.getAccountIdsByUserIdOrNickNameOrSubmitAccount(userId, nickName, submitAccount);
-			if (accountIds.isEmpty()) {
-				return GatewayResponse.SUCCESS.newBuilder().toResult(new SearchResult<>());
-			}
-
-			mapBuilder.field(AccountView::getId, accountIds).op(Operator.InList);
-		}
-		String extra_sql = StrUtil.EMPTY;
-		if (expiredAll != null && expiredAll) {
-			extra_sql += "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=3,true,false)) = 1";
-		}
-
-		if (noChangeMonths != null) {
-			DateTime pastMonth = DateUtil.offsetMonth(DateTime.now(), -noChangeMonths);
-			List<Long> accountIds = accountUpdatePasswordRecordMapper.selectPasswordNotChangedThePastMonthAccountId(pastMonth);
-			mapBuilder.field(AccountView::getId, accountIds).op(Operator.InList);
-		}
-
-		if (existsExpired != null && existsExpired) {
-			if (StrUtil.isNotEmpty(extra_sql)) {
-				extra_sql += " and";
-			}
-			extra_sql += "(select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self') > 0";
-		}
-		if (existsExpiredToday != null) {
-			DateTime endOfDay = DateUtil.endOfDay(DateTime.now());
-			if (StrUtil.isNotEmpty(extra_sql)) {
-				extra_sql += " and";
-			}
-			if (existsExpiredToday) {
-				extra_sql += String.format(" (select min(expiry_time) from (select gt.id from groups_trips where account_id = a.id) gt inner join groups_relation gr on gr.groups_id = gt.id) <= '%s'", endOfDay);
-			} else {
-				extra_sql += String.format(" (select min(expiry_time) from (select gt.id from groups_trips where account_id = a.id) gt inner join groups_relation gr on gr.groups_id = gt.id) > '%s'", endOfDay);
-			}
-		}
-		if (isMjMirror != null) {
-			if (StrUtil.isNotEmpty(extra_sql)) {
-				extra_sql += " and";
-			}
-			extra_sql += String.format(" %s (select 1 from midjourney_account ma where ma.account_id = a.id limit 1)", isMjMirror ? "EXISTS" : "NOT EXISTS");
-		}
-		if (StrUtil.isNotEmpty(extra_sql)) {
-			mapBuilder.put("extra_sql", extra_sql);
-		}
-
-		SearchResult<AccountView> search = beanSearcher.search(AccountView.class, mapBuilder.build());
-		search.getDataList().forEach((accountView) -> {
-			Integer invited = homeGroupMapper.selectCount(Wrappers.lambdaQuery(HomeGroup.class).eq(HomeGroup::getAccountId, accountView.getId()).eq(HomeGroup::getStatus, "invited"));
-			GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class).eq(GroupsTrips::getAccountId, accountView.getId()).last(" limit 1"));
-			int total = groupsTrips == null ? 0 : groupsTrips.getNum() - groupsTrips.getAvailableNum();
-			Integer unInvited = Math.max(total - invited, 0);
-			accountView.setUnInvited(unInvited);
-			accountView.setInvited(invited);
-			accountView.setTotal(total);
-			List<AccountUpdatePasswordRecord> recordList = beanSearcher.searchList(AccountUpdatePasswordRecord.class,
-					MapUtils.builder().field(AccountUpdatePasswordRecord::getAccountId, accountView.getId())
-							.onlySelect(AccountUpdatePasswordRecord::getCreatedTime)
-							.orderBy(AccountUpdatePasswordRecord::getId)
-							.build());
-			accountView.setUpdatePwdNum(recordList.size());
-			if (accountView.getCustomerServiceId() != 0) {
-				CmsUser cmsUser = cmsUserMapper.selectById(accountView.getCustomerServiceId());
-				Optional.ofNullable(cmsUser).ifPresent(customer -> accountView.setCustomerServiceName(cmsUser.getNickname()));
-			}
-			if (recordList.size() > 0) {
-				accountView.setLastUpdatePwdDate(recordList.get(0).getCreatedTime());
-			}
-			Integer expiryCount = groupsMapper.countExpiredNum(accountView.getId());
-			accountView.setExpiryCount(expiryCount);
-
-			if (StrUtil.isEmpty(accountView.getEmailPassword())) {
-				Optional.ofNullable(sysEmailMapper.selectOne(Wrappers.lambdaQuery(SysEmail.class)
-								.eq(SysEmail::getEmail, accountView.getAccount()).select(SysEmail::getPassword)
-								.last("limit 1")))
-						.ifPresent(email -> accountView.setEmailPassword(email.getPassword()));
-			}
-			if (accountView.getGoodsId() == 26) {
-				Integer count = midjourneyAccountMapper.selectCount(Wrappers.lambdaQuery(MidjourneyAccount.class)
-						.eq(MidjourneyAccount::getAccountId, accountView.getId()));
-				accountView.setIsMjMirror(count > 0 ? true : false);
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-    /**
-     * 导出账号
-     */
-    @GetMapping("/export/account")
-    @SaCheckPermission("account:export")
-    @Log(module = "平台管理/导出账号", businessType = BusinessType.EXPORT, isSaveRequestData = true)
-	public void exportAccount(String title, Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths, HttpServletResponse response) {
-        MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-        if (StrUtil.isNotEmpty(expiryStartTime) || StrUtil.isNotEmpty(expiryEndTime)) {
-            mapBuilder.field(ExcelManageAccountData::getExpiryTime, expiryStartTime, expiryEndTime)
-                    .op(Operator.Between);
-        }
-	    if (StrUtil.isNotEmpty(showId)) {
-		    userId = userMapper.getUserIdByShowId(showId);
-	    }
-
-		if (StrUtil.isNotBlank(title)) {
-			GoodsDon goodsDon = goodsDonMapper.selectOne(Wrappers.lambdaQuery(GoodsDon.class).eq(GoodsDon::getTitle, title)
-					.last("limit 1"));
-			if (goodsDon != null) {
-				mapBuilder.field(ExcelManageAccountData::getGoodsId, goodsDon.getId());
-				title = null;
-			}
-		}
-
-        if (userId != null || StringUtils.isNotBlank(nickName) || StringUtils.isNotBlank(submitAccount)) {
-            List<Long> accountIds = homeGroupMapper.getAccountIdsByUserIdOrNickNameOrSubmitAccount(userId, nickName, submitAccount);
-            if (accountIds.isEmpty()) {
-                throw BusinessRuntimeException.getInstance("暂无数据!");
-            }
-
-            mapBuilder.field(ExcelManageAccountData::getId, accountIds).op(Operator.InList);
-        }
-	    String extra_sql = StrUtil.EMPTY;
-	    if (expiredAll != null && expiredAll) {
-		    extra_sql += "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=3,true,false)) = 1";
-	    }
-
-	    if (noChangeMonths != null) {
-		    DateTime pastMonth = DateUtil.offsetMonth(DateTime.now(), -noChangeMonths);
-		    List<Long> accountIds = accountUpdatePasswordRecordMapper.selectPasswordNotChangedThePastMonthAccountId(pastMonth);
-		    mapBuilder.field(AccountView::getId, accountIds).op(Operator.InList);
-	    }
-
-	    if (existsExpired != null && existsExpired) {
-		    if (StrUtil.isNotEmpty(extra_sql)) {
-			    extra_sql += " and";
-		    }
-		    extra_sql += "(select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self') > 0";
-	    }
-	    if (existsExpiredToday != null) {
-		    DateTime endOfDay = DateUtil.endOfDay(DateTime.now());
-		    if (StrUtil.isNotEmpty(extra_sql)) {
-			    extra_sql += " and";
-		    }
-		    if (existsExpiredToday) {
-			    extra_sql += String.format(" (select min(expiry_time) from (select gt.id from groups_trips where account_id = a.id) gt inner join groups_relation gr on gr.groups_id = gt.id) <= '%s'", endOfDay);
-		    } else {
-			    extra_sql += String.format(" (select min(expiry_time) from (select gt.id from groups_trips where account_id = a.id) gt inner join groups_relation gr on gr.groups_id = gt.id) > '%s'", endOfDay);
-		    }
-	    }
-	    if (StrUtil.isNotEmpty(extra_sql)) {
-		    mapBuilder.put("extra_sql", extra_sql);
-	    }
-	    List<ExcelManageAccountData> list = beanSearcher.searchAll(ExcelManageAccountData.class, mapBuilder.build());
-
-	    EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelManageAccountData.class, list, "账号列表", "账号列表", ExcelTypeEnum.XLSX, null);
-    }
-
-    /**
-     * 下载批量修改密码模板
-     */
-    @GetMapping("/get/account/template")
-    @SaCheckPermission("account:batchUpdatePwd")
-    public void getAccountTemplate(HttpServletResponse response) {
-        EasyExcelUtils.createTemplateExcel(response, ExcelImportAccountData.class, "账号批量修改密码模板", "账号批量修改密码模板", ExcelTypeEnum.XLSX, null);
-    }
-
-	/**
-	 * 导入文件,修改密码
-	 */
-	@PostMapping("/import/account")
-	public Result<String> importAccount(Long goodsId, MultipartFile file) throws Exception {
-		long userId = StpUtil.getLoginIdAsLong();
-		EasyExcel.read(file.getInputStream(), ExcelImportAccountData.class, new AnalysisEventListener<ExcelImportAccountData>() {
-			@SneakyThrows
-			@Override
-			public void invoke(ExcelImportAccountData data, AnalysisContext analysisContext) {
-				if (StrUtil.isNotBlank(data.getAccount())) {
-					Account account = accountService.getOne(Wrappers.lambdaQuery(Account.class)
-							.eq(Account::getGoodsId, goodsId)
-							.eq(Account::getAccount, data.getAccount().trim()));
-					Boolean flag = false;
-					Boolean isUpdatePwd = false;
-					if (account != null) {
-						if (StrUtil.isNotBlank(data.getBankCard())) {
-							account.setBankCard(data.getBankCard());
-							flag = true;
-						}
-						String oldPwd = account.getPassword();
-						if (StrUtil.isNotBlank(data.getExpiryTime())) {
-							account.setExpiryTime(DateUtil.parse(data.getExpiryTime()));
-							flag = true;
-						}
-						String new_pass = data.getPassword();
-						if (StrUtil.isNotBlank(new_pass) && !new_pass.trim().equals(account.getPassword())) {
-							account.setPassword(new_pass.trim());
-							account.setCustomerServiceId(0l);
-							flag = true;
-							isUpdatePwd = true;
-							//发放模板消息
-							templateCommonService.sendAccountTemplateMsg(account);
-
-							if (StrUtil.isNotBlank(account.getGptRefreshToken())) {
-								account.setGptRefreshToken(StrUtil.EMPTY);
-								//清除gpt token
-								redisService.del(RedisKey.CHATGPT_ACCESS_TOKEN + account.getAccount());
-								redisService.del(RedisService.key.CHAT_GPT_TOKEN_EXCEPTION_KEY.getName() + account.getAccount());
-							}
-						}
-						if (flag) {
-							account.setStartTime(null);
-							accountService.updateById(account);
-							if (isUpdatePwd) {
-								//清空过期账号 逻辑删除
-								userTicketClearedRecordMapper.update(null, Wrappers.lambdaUpdate(UserTicketClearedRecord.class)
-										.set(UserTicketClearedRecord::getDeleted, false)
-										.eq(UserTicketClearedRecord::getAccountId, account.getId()));
-								accountService.saveRecord(userId, account.getId(), oldPwd, account.getPassword(), "上传文件修改密码");
-							}
-						}
-					}
-				}
-			}
-
-			@Override
-			public void doAfterAllAnalysed(AnalysisContext analysisContext) {
-
-			}
-		}).sheet().doRead();
-		return GatewayResponse.SUCCESS.newBuilder().toResult("导入成功");
-	}
-
-	/**
-	 * 解析chatGpt独立账号excel
-	 */
-	@PostMapping("/analysis/chatGPT/account")
-	public Result<String> analysisChatGPTAccount(@RequestParam(required = false, defaultValue = "30") Long goodsId, @RequestParam(required = false, defaultValue = "198") Long skuId, MultipartFile file) throws IOException {
-		List<Object> accountList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(0).doReadSync();
-		accountService.analysisChatGPTAccount(goodsId, skuId, accountList);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 批量导入特殊格式excel平台账号
-	 */
-	@PostMapping("/import/special/goods/account")
-	public Result<String> analysisChatGptAccount(@RequestParam(required = true) Long goodsId, @RequestParam(required = true) Long skuId, MultipartFile file) throws IOException {
-		if (!file.getOriginalFilename().contains(".xls")) {
-			throw BusinessRuntimeException.getInstance("请导入excel文件");
-		}
-		List<Object> accountList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(0).doReadSync();
-		accountService.analysisChatGPTAccount(goodsId, skuId, accountList);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	@GetMapping("/test")
-	public Result<String> stest(MultipartFile file) throws IOException {
-		List<Object> objects = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(0).doReadSync();
-
-		String url = "https://plus1.caifree.com/api?email=%s";
-		objects.forEach(e->{
-			Map<String, Object> map = Jsons.toMap(e);
-			String account = String.valueOf(map.get("0"));
-			if (StrUtil.isNotEmpty(account)) {
-				String formatUrl = String.format(url, account);
-				try {
-					HttpResponse<String> send = J11HttpC.custom()
-							.ofGet()
-							.url(formatUrl)
-							.send(HttpResponse.BodyHandlers.ofString());
-					System.out.println(send.body());
-				} catch (Exception exception) {
-
-				}
-			}
-
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	public static void main(String[] args) {
-		String url = "https://plus1.caifree.com/api?email=sentzb99@gmail.com";
-		try {
-			HttpResponse<String> send = J11HttpC.custom()
-					.ofGet()
-					.url(url)
-					.send(HttpResponse.BodyHandlers.ofString());
-			System.out.println(send.body());
-		} catch (Exception exception) {
-
-		}
-	}
-
-    @PostMapping("/post")
-    @NoSubmit
-    @Transactional(rollbackFor = Throwable.class)
-    @SaCheckPermission("account:add")
-    @Log(module = "平台管理/新增账号", businessType = BusinessType.POST, isSaveRequestData = true)
-    public Result<String> add(@RequestBody Account account){
-		account.setAccount(account.getAccount().trim());
-		account.setPassword(account.getPassword().trim());
-	    //账号是否已经添加过
-	    if (!account.getAccount().contains("客服")) {
-		    if (accountCommonService.checkIsDupAccount(account.getGoodsId(), account.getAccount())) {
-			    throw BusinessRuntimeException.getInstance("该平台下已生成该账号");
-		    }
-	    }
-        accountService.save(account);
-	    if (account.getSkuId() != null) {
-		    //自动配置车队
-		    GroupsTrips groupsTrips = new GroupsTrips();
-
-		    //限制每天新车队前3天 停车数量
-		    Integer availableParkingNum = 0;
-		    if (account.getSkuId() == 161l) {
-			    availableParkingNum = 10;
-		    }
-		    if (account.getSkuId() == 178l) {
-			    availableParkingNum = 4;
-		    }
-			groupsTrips.setAvailableParkingNum(availableParkingNum);
-
-		    groupsTrips.setSkuId(account.getSkuId());
-		    groupsTrips.setAccountId(account.getId());
-		    cmsGroupService.issuance(groupsTrips, account.getVerifyCodes());
-	    }
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-	/**
-	 * 获取导入账号模板
-	 */
-	@GetMapping("/get/account/import/template")
-	public void getImportAccountTemplate(HttpServletResponse response) {
-		EasyExcelUtils.createTemplateExcel(response, ExcelImportAccountData.class, "导入账号模板", "导入账号模板", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 导入账号
-	 */
-	@PostMapping("/import/account/issuance")
-	public Result<String> importAccountAndIssuance(Long goodsId, Long skuId, MultipartFile file) throws Exception {
-		GoodsDonSkuView goodsDonSkuView = beanSearcher.searchFirst(GoodsDonSkuView.class, MapUtils.builder().field(GoodsDonSkuView::getGoodsId, goodsId).field(GoodsDonSkuView::getSkuId, skuId).build());
-		if (goodsDonSkuView == null) {
-			throw BusinessRuntimeException.getInstance("所选平台与规格不匹配");
-		}
-		EasyExcel.read(file.getInputStream(), ExcelImportAccountData.class, new AnalysisEventListener<ExcelImportAccountData>() {
-			@SneakyThrows
-			@Override
-			public void invoke(ExcelImportAccountData data, AnalysisContext analysisContext) {
-				String account = data.getAccount(), password = data.getPassword(), startTime = data.getStartTime(), expiryTime = data.getExpiryTime(), bankCard = data.getBankCard();
-				if (StrUtil.isNotBlank(data.getAccount())) {
-					//账号是否已经添加过
-					if (!account.contains("客服")) {
-						if (accountCommonService.checkIsDupAccount(goodsId, account)) {
-							log.info("该平台下:{}已生成该账号:{}", goodsId, account);
-							return;
-						}
-					}
-					Account at = new Account();
-					at.setAccount(account.trim());
-					at.setPassword(password.trim());
-					at.setGoodsId(goodsId);
-					at.setSkuId(skuId);
-					at.setBankCard(bankCard);
-					String isMonth = data.getIsMonth();
-					if (StrUtil.isNotBlank(isMonth)) {
-						at.setIsMonth(true);
-					}
-					String outsidePurchase = data.getOutsidePurchase();
-					if (StrUtil.isNotEmpty(outsidePurchase)) {
-						if (outsidePurchase.equals("是") || outsidePurchase.equals("1")) {
-							at.setOutsidePurchase(true);
-						}
-					}
-					at.setVerifyLink(data.getVerifyLink());
-					at.setRelateEmail(data.getRelateEmail());
-					at.setEmail(data.getSecondEmail());
-					if (StrUtil.isNotBlank(startTime)) {
-						at.setStartTime(DateUtil.parse(startTime));
-					} else {
-						at.setStartTime(DateTime.now());
-					}
-					if (StrUtil.isNotBlank(expiryTime)) {
-						at.setExpiryTime(DateUtil.parse(expiryTime));
-					} else {
-						at.setExpiryTime(DateUtil.offsetMonth(at.getStartTime(), 1));
-					}
-					accountService.save(at);
-					if (at.getSkuId() != null) {
-						//自动配置车队
-						GroupsTrips groupsTrips = new GroupsTrips();
-						//限制每天新车队前3天 停车数量
-						Integer availableParkingNum = 0;
-						if (at.getSkuId() == 161l) {
-							availableParkingNum = 10;
-						}
-						if (at.getSkuId() == 178l) {
-							availableParkingNum = 4;
-						}
-						groupsTrips.setAvailableParkingNum(availableParkingNum);
-						groupsTrips.setSkuId(at.getSkuId());
-						groupsTrips.setAccountId(at.getId());
-						cmsGroupService.issuance(groupsTrips, null);
-					}
-				}
-			}
-
-			@Override
-			public void doAfterAllAnalysed(AnalysisContext analysisContext) {
-
-			}
-		}).sheet().doRead();
-		return GatewayResponse.SUCCESS.newBuilder().toResult("导入账号成功");
-	}
-
-    @PutMapping("/update")
-    @SaCheckPermission("account:update")
-    @Log(module = "平台管理/编辑账号", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> update(@RequestBody Account account) throws Exception {
-	    Account db = accountService.getById(account.getId());
-	    if (db == null) {
-		    throw BusinessRuntimeException.getInstance("该账号不存在");
-	    }
-	    Boolean isClear = false;
-	    String dbAccount = db.getAccount();
-	    long userId = StpUtil.getLoginIdAsLong();
-	    if (!db.getPassword().equals(account.getPassword())) {
-		    account.setCustomerServiceId(0l);
-		    accountService.saveRecord(userId, account.getId(), db.getPassword(), account.getPassword(), "操作编辑");
-		    
-		    //清空过期账号 逻辑删除
-		    userTicketClearedRecordMapper.update(null, Wrappers.lambdaUpdate(UserTicketClearedRecord.class)
-				    .set(UserTicketClearedRecord::getDeleted, false)
-				    .eq(UserTicketClearedRecord::getAccountId, account.getId()));
-		    isClear = true;
-	    }
-	    if (!db.getAccount().equals(account.getAccount())){
-			account.setAccount(account.getAccount().trim());
-			//账号是否已经添加过
-			if (!account.getAccount().contains("客服")) {
-				if (accountCommonService.checkIsDupAccount(account.getGoodsId(), account.getAccount())) {
-					throw BusinessRuntimeException.getInstance("该平台下已生成该账号");
-				}
-			}
-		    if (!dbAccount.equals(account.getAccount())) {
-			    isClear = true;
-		    }
-		}
-	    if (StrUtil.isNotBlank(account.getPassword())){
-		    account.setPassword(account.getPassword().trim());
-	    }
-	    String verifyCodes = account.getVerifyCodes();
-	    if (StrUtil.isNotBlank(verifyCodes) && !StrUtil.equals(verifyCodes, db.getVerifyCodes())) {
-		    verifyCodes = verifyCodes.replaceAll("\n", "");
-		    String[] verifyCodesArray = verifyCodes.split("\\*");
-		    List<String> verifyCodeList = Arrays.stream(verifyCodesArray).filter(str -> StrUtil.isNotBlank(str)).map(str -> str.trim()).collect(Collectors.toList());
-		    List<GroupsRelationView> relationViews = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
-				    .field(GroupsRelationView::getAccountId, account.getId())
-				    .onlySelect(GroupsRelationView::getId)
-				    .build());
-		    if (CollUtil.isNotEmpty(relationViews)) {
-			    for (int i = 0; i < verifyCodeList.size(); i++) {
-				    if (i < relationViews.size()) {
-					    GroupsRelationView groupsRelationView = relationViews.get(i);
-					    groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
-							    .set(GroupsRelation::getVerifyCode, verifyCodeList.get(i))
-							    .eq(GroupsRelation::getId, groupsRelationView.getId()));
-				    }
-			    }
-		    }
-	    }
-	    String apiSecret = account.getApiSecret();
-	    if (StrUtil.isNotBlank(apiSecret)) {
-		    doubleVerifyRecordMapper.update(null, Wrappers.lambdaUpdate(AccountDoubleVerifyRecord.class)
-				    .set(AccountDoubleVerifyRecord::getDeleted, false)
-				    .set(AccountDoubleVerifyRecord::getApiSecret, apiSecret)
-				    .eq(AccountDoubleVerifyRecord::getAccountId, account.getId()));
-	    }
-	    account.setStartTime(null);
-	    if (isClear){
-		    account.setGptRefreshToken(StrUtil.EMPTY);
-		    //清除gpt token
-		    redisService.del(RedisKey.CHATGPT_ACCESS_TOKEN + dbAccount);
-		    redisService.del(RedisService.key.CHAT_GPT_TOKEN_EXCEPTION_KEY.getName() + dbAccount);
-		    templateCommonService.sendAccountTemplateMsg(account);
-	    }
-	    //时间有效
-	    if (account.getExpiryTime() != null && account.getExpiryTime().after(DateTime.now())) {
-		    groupsMapper.update(null, Wrappers.lambdaUpdate(GroupsTrips.class)
-				    .set(GroupsTrips::getStatus, GroupsTrips.Status.validity)
-				    .eq(GroupsTrips::getAccountId, account.getId())
-				    .eq(GroupsTrips::getStatus, GroupsTrips.Status.down));
-	    }
-	    accountService.updateById(account);
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-	/**
-	 * 修改密码并发送模板消息
-	 */
-	@PutMapping("/update/pwd")
-	@Log(module = "平台管理/批量修改密码", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> updatePwdAndSendMsg(@RequestBody List<Account> accounts) throws Exception {
-		long userId = StpUtil.getLoginIdAsLong();
-		accounts.forEach(account -> {
-			Account db = accountService.getById(account.getId());
-			if (db != null) {
-				String oldPwd = db.getPassword();
-				String updatePWd = account.getPassword().trim();
-				if (!oldPwd.equals(updatePWd)) {
-					db.setPassword(updatePWd);
-					db.setCustomerServiceId(0l);
-
-					if (StrUtil.isNotBlank(db.getGptRefreshToken())) {
-						db.setGptRefreshToken(StrUtil.EMPTY);
-						//清除gpt token
-						redisService.del(RedisKey.CHATGPT_ACCESS_TOKEN + db.getAccount());
-						redisService.del(RedisService.key.CHAT_GPT_TOKEN_EXCEPTION_KEY.getName() + db.getAccount());
-					}
-					accountService.updateById(db);
-					//记录
-					accountService.saveRecord(userId, account.getId(), oldPwd, updatePWd, "多选修改密码");
-					//清空过期账号 逻辑删除
-					userTicketClearedRecordMapper.update(null, Wrappers.lambdaUpdate(UserTicketClearedRecord.class)
-							.set(UserTicketClearedRecord::getDeleted, false)
-							.eq(UserTicketClearedRecord::getAccountId, account.getId()));
-					//发放模板消息
-					try {
-						account.setAccount(db.getAccount());
-						templateCommonService.sendAccountTemplateMsg(account);
-					} catch (Exception e) {
-						log.error("发送账号{}修改密码消息模板错误", account.getId());
-					}
-				}
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 账号已过期车票列表
-	 */
-	@GetMapping("/get/expired/ticket")
-	public Result<SearchResult<UserTicketClearedRecordView>> getUserHadExpiredTicket() {
-		SearchResult<UserTicketClearedRecordView> search = beanSearcher.search(UserTicketClearedRecordView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(UserTicketClearedRecordView::getSource, UserTicketClearedRecord.Source.self.name())
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 移除账号过期用户车票记录
-	 */
-	@DeleteMapping("/clear/expired/ticket/{recordId}")
-	public Result<String> clearExpiredTicket(@PathVariable Long recordId) {
-		userTicketClearedRecordMapper.update(null, Wrappers.lambdaUpdate(UserTicketClearedRecord.class)
-				.set(UserTicketClearedRecord::getDeleted, false)
-				.eq(UserTicketClearedRecord::getId, recordId));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 账号未过期车票列表
-	 */
-	@GetMapping("/get/valid/ticket")
-	public Result<SearchResult<GroupsRelationView>> getValidTicket() {
-		SearchResult<GroupsRelationView> search = beanSearcher.search(GroupsRelationView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-
-	@DeleteMapping("/delete/{id}")
-	@SaCheckPermission("account:delete")
-	@Log(module = "平台管理/删除账号", businessType = BusinessType.DELETE, isSaveRequestData = true)
-	public Result<String> update(@PathVariable Long id){
-	    //是否关联了车队
-	    Integer count = groupsMapper.selectCount(Wrappers.lambdaQuery(GroupsTrips.class).eq(GroupsTrips::getAccountId, id));
-	    if (count > 0) {
-		    throw BusinessRuntimeException.getInstance("已经发布账号,必须先删除车队才可删除账号");
-	    }
-        accountService.removeById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @PutMapping("/update/expiryTime")
-    @SaCheckPermission("account:addExpiryTime")
-    public Result<String> updateExpiryTime(@RequestBody ReqAccountIncrExpiryTime incrExpiryTime){
-        incrExpiryTime.getAccounts().forEach((accountId)->{
-            Account account = accountService.getById(accountId);
-            DateTime time = DateUtil.offsetDay(account.getExpiryTime(), incrExpiryTime.getDays());
-            accountService.update(Wrappers.lambdaUpdate(Account.class).eq(Account::getId,accountId).set(Account::getExpiryTime,time));
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-	/**
-	 * 需要修改主账号密码的平台
-	 */
-	@GetMapping("/get/expired/platform")
-	public Result<String> getExpiredPlatform() {
-		List<AccountView> expiredAllAccount = accountService.getExpiredAllAccount();
-		Set<String> platFormSet = expiredAllAccount.stream().map(AccountView::getTitle).collect(Collectors.toSet());
-		String platForms = platFormSet.stream().collect(Collectors.joining("、"));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(platForms);
-	}
-
-	/**
-	 * 账号修改密码记录详情列表
-	 */
-	@GetMapping("/get/updatePwd/record")
-	public Result<SearchResult<AccountUpdatePasswordRecord>> getUpdatePwdRecord() {
-		SearchResult<AccountUpdatePasswordRecord> search = beanSearcher.search(AccountUpdatePasswordRecord.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 拉取最近购买订单的列表
-	 */
-	@GetMapping("/get/latest/orders")
-	public Result<List<OrderDonAccountRep>> getLatestOrders() {
-		//最近五分钟
-		DateTime offFive = DateUtil.offsetMinute(DateTime.now(), -5);
-		List<OrderDonAccountRep> list = beanSearcher.searchAll(OrderDonAccountRep.class, MapUtils.builder()
-				.put("time", String.format("od.created_time >= '%s'", offFive))
-				.field(OrderDonAccountRep::getGoodsId, 1)
-				.orderBy(ExpiredAccountRep::getAccountId)
-				.orderBy(ExpiredAccountRep::getNum)
-				.build());
-		list.forEach(data->{
-			User user = userMapper.selectById(data.getUserId());
-			data.setNickname(user != null ? user.getNickname() : "");
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	/**
-	 * 15天要到期的账号列表
-	 */
-	@GetMapping("/get/expired/accounts")
-	public Result<List<ExpiredAccountRep>> getExpiredAccountsList() {
-		//十五天后
-		DateTime afterFif = DateUtil.offsetDay(DateTime.now(), 15);
-		List<ExpiredAccountRep> list = beanSearcher.searchAll(ExpiredAccountRep.class, MapUtils.builder()
-				.field(ExpiredAccountRep::getGoodsId, 1)
-				.field(ExpiredAccountRep::getExpiredTime, afterFif).op(Operator.LessEqual)
-				.orderBy(ExpiredAccountRep::getAccountId)
-				.orderBy(ExpiredAccountRep::getNum)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	/**
-	 * 修改账号密码 并发放模板消息
-	 */
-	@PutMapping("/put")
-	public Result<String> updateAccountPwd(@RequestBody Account accountReq) throws Exception {
-		if (accountReq.getId() == null || StrUtil.isEmpty(accountReq.getPassword())) {
-			return GatewayResponse.FAIL.newBuilder().toResult("缺少必填入参");
-		}
-		Account account = accountService.getById(accountReq.getId());
-		if (account == null) {
-			return GatewayResponse.FAIL.newBuilder().toResult("账号不存在");
-		}
-		if (account.getGoodsId() != 1l) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		Boolean flag = false;
-		String oldPwd = account.getPassword();
-		if (account != null) {
-			if (accountReq.getExpiryTime() != null) {
-				account.setExpiryTime(accountReq.getExpiryTime());
-				flag = true;
-			}
-			String new_pass = accountReq.getPassword();
-			if (StrUtil.isNotBlank(new_pass) && !new_pass.trim().equals(account.getPassword())) {
-				account.setPassword(new_pass.trim());
-				account.setCustomerServiceId(0l);
-				flag = true;
-				//发放模板消息
-				templateCommonService.sendAccountTemplateMsg(account);
-				//记录操作日志
-				accountService.recordAutoUpdatePwd(account.getId(), account.getAccount(), oldPwd, new_pass, ServletUtil.getClientIP(request));
-				if (StrUtil.isNotBlank(account.getGptRefreshToken())) {
-					account.setGptRefreshToken(StrUtil.EMPTY);
-					//清除gpt token
-					redisService.del(RedisKey.CHATGPT_ACCESS_TOKEN + account.getAccount());
-					redisService.del(RedisService.key.CHAT_GPT_TOKEN_EXCEPTION_KEY.getName() + account.getAccount());
-				}
-				//记录
-				accountService.saveRecord(0l, account.getId(), oldPwd, new_pass, "自动修改密码");
-			}
-			if (flag) {
-				accountService.updateById(account);
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 客服需要修改密码详情
-	 */
-	@GetMapping("/get/updatePwd/num")
-	public Result<CustomerServiceUpdatePwdDetail> updatePwdDetails() {
-		long userId = StpUtil.getLoginIdAsLong();
-		CmsUser user = cmsUserManager.getUser(userId);
-		MapBuilder builder = MapUtils.builder();
-		if (user != null && user.getRoleNames() != null && user.getRoleNames().contains("客服")) {
-			builder.field(AccountView::getCustomerServiceId, userId);
-		}
-		//需要修改密码
-		String extra_sql = "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=3,true,false)) = 1";
-		builder.put("extra_sql", extra_sql);
-		Number expireAll = beanSearcher.searchCount(AccountView.class, builder.build());
-		//存在过期
-		extra_sql = "(select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self') > 0";
-		builder.put("extra_sql", extra_sql);
-		Number existsExpired = beanSearcher.searchCount(AccountView.class, builder.build());
-
-		CustomerServiceUpdatePwdDetail updatePwdDetail = new CustomerServiceUpdatePwdDetail();
-		updatePwdDetail.setNumOfExpiredAllAccount(expireAll.intValue());
-		updatePwdDetail.setNumOfExpiredAccount(existsExpired.intValue());
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult(updatePwdDetail);
-	}
-
-	/**
-	 * 批量导入需要美区appid并发车
-	 */
-	@PostMapping("/import/america/appid")
-	public Result<String> importAmericaAppid(@RequestParam(required = false, defaultValue = "31") Long goodsId, @RequestParam(required = false, defaultValue = "214") Long skuId, MultipartFile file) throws IOException {
-		List<Object> accountList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(0).doReadSync();
-		accountService.analysisAmericaAppidAccount(goodsId, skuId, accountList);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 等待双重认证gpt账号列表
-	 */
-	@GetMapping("/get/doubleVerifyAccount")
-	public Result<SearchResult<DoubleVerifyAccountView>> getDoubleVerifyAccount() {
-		SearchResult<DoubleVerifyAccountView> search = beanSearcher.search(DoubleVerifyAccountView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 编辑双重认证账号
-	 */
-	@PutMapping("/put/doubleVerifyAccount")
-	public Result<String> updateDoubleVerifyAccount(@RequestBody Account account) throws Exception {
-		Long id = account.getId();
-		Account db = accountService.getById(id);
-		String dnPwd = db.getPassword();
-		String newPwd = account.getPassword();
-
-		String apiSecret = account.getApiSecret();
-		boolean isFlag = false;
-		if (StrUtil.isNotBlank(apiSecret)) {
-			db.setApiSecret(apiSecret);
-			isFlag = true;
-			doubleVerifyRecordMapper.update(null, Wrappers.lambdaUpdate(AccountDoubleVerifyRecord.class)
-					.set(AccountDoubleVerifyRecord::getDeleted, false)
-					.set(AccountDoubleVerifyRecord::getApiSecret, apiSecret)
-					.eq(AccountDoubleVerifyRecord::getAccountId, id));
-		}
-		if (StrUtil.isNotBlank(newPwd)) {
-			newPwd = newPwd.trim();
-			db.setPassword(newPwd);
-			isFlag = true;
-		}
-		if (isFlag) {
-			boolean b = accountService.updateById(db);
-			if (StrUtil.isNotBlank(newPwd) && !dnPwd.equals(newPwd) && b) {
-				account.setAccount(db.getAccount());
-				templateCommonService.sendAccountTemplateMsg(account);
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 导出双重验证账号列表
-	 */
-	@GetMapping("/doubleVerify/export")
-	public void exportDoubleVerifyAccount(HttpServletResponse response) {
-		List<ExcelDoubleVerifyAccountData> dataList = beanSearcher.searchAll(ExcelDoubleVerifyAccountData.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelDoubleVerifyAccountData.class, dataList, "账号待开启双重验证列表", "账号待开启双重验证列表", ExcelTypeEnum.XLS, null);
-	}
-
-
-	/**
-	 * 批量导入账号双重账号验证码
-	 */
-	@PostMapping("/doubleVerify/import")
-	public Result<String> importDoubleVerifyCode(MultipartFile file) throws Exception {
-		EasyExcel.read(file.getInputStream(), ExcelDoubleVerifyAccountData.class, new AnalysisEventListener<ExcelDoubleVerifyAccountData>() {
-			@Override
-			public void invoke(ExcelDoubleVerifyAccountData data, AnalysisContext analysisContext) {
-				String account = data.getAccount();
-				String apiSecret = data.getApiSecret();
-				if (StrUtil.isBlank(account) || StrUtil.isBlank(apiSecret)) {
-					return;
-				}
-				Account ac = accountService.getOne(Wrappers.lambdaQuery(Account.class)
-						.in(Account::getGoodsId, List.of(18, 26))
-						.eq(Account::getAccount, account.trim())
-						.eq(Account::getApiSecret, "")
-						.last("limit 1"));
-				if (ac == null) return;
-				ac.setApiSecret(apiSecret.trim());
-				accountService.updateById(ac);
-
-				doubleVerifyRecordMapper.update(null, Wrappers.lambdaUpdate(AccountDoubleVerifyRecord.class)
-						.set(AccountDoubleVerifyRecord::getDeleted, false)
-						.set(AccountDoubleVerifyRecord::getApiSecret, apiSecret.trim())
-						.eq(AccountDoubleVerifyRecord::getAccountId, ac.getId())
-						.eq(AccountDoubleVerifyRecord::getDeleted, true));
-			}
-
-			@Override
-			public void doAfterAllAnalysed(AnalysisContext analysisContext) {
-
-			}
-		}).sheet().doRead();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 双重认证导入模板
-	 */
-	@GetMapping("/export/doubleVerify/template")
-	public void exportDoubleVerifyAccountTemplate(HttpServletResponse response) {
-		EasyExcelUtils.createTemplateExcel(response, ExcelImportDoubleVerifyAccountData.class, "账号双重认证码导入模板", "账号双重认证码导入模板", ExcelTypeEnum.XLS, null);
-	}
-
-	/**
-	 * 查看账号双重认证验证码列表记录
-	 */
-	@GetMapping("/get/doubleVerify/viewList")
-	public Result<SearchResult<AccountDoubleVerifyUserListView>> getAccountDoubleVerifyUserListView() {
-		SearchResult<AccountDoubleVerifyUserListView> search = beanSearcher.search(AccountDoubleVerifyUserListView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 查看账号双重认证验证码列表刷新记录
-	 */
-	@GetMapping("/get/doubleVerify/clickRefresh/list")
-	public Result<List<DoubleVerifyClickRefreshRecord>> getDoubleVerifyClickRefreshRecord() {
-		List<DoubleVerifyClickRefreshRecord> search = beanSearcher.searchAll(DoubleVerifyClickRefreshRecord.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 用户车看车票账号密码 记录列表
-	 */
-	@GetMapping("/get/ticket/pwd/view")
-	public Result<SearchResult<TicketPwdViewRecordView>> getTicketPwdView() {
-		SearchResult<TicketPwdViewRecordView> search = beanSearcher.search(TicketPwdViewRecordView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.orderBy(TicketPwdViewRecordView::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * MidJourney、ChatGPT年付 ChatGpt独立月付未续费列表
-	 */
-	@GetMapping("/get/specific/account")
-	public Result<SearchResult<AccountSpecificView>> getSpecificAccount() {
-		//获取MidJourney、ChatGPT年付 ChatGpt独立月付 规格id
-		Long chatGptPlusGid = Constant.AI_goodsIds.get(0);
-		//年付
-		List<Long> yearSkuIds = goodsDonSkuMapper.getSpecificSkuIdsByGoodsIds(Constant.AI_goodsIds, 12);
-		//ChatGpt Plus 独立月付
-		List<Long> monthSkuIds = goodsDonSkuMapper.getSpecificSkuIdsByGoodsId(chatGptPlusGid, 1, 1);
-		Collection<Long> skuIds = CollUtil.addAll(yearSkuIds, monthSkuIds);
-		if (skuIds.isEmpty()) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		SearchResult<AccountSpecificView> search = beanSearcher.search(AccountSpecificView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.put("condition", String.format("and (select count(*) from groups_relation gr where gr.groups_id = gt.id and gr.user_id != 0 and gr.status in ('validity','outside')) > 0"))
-				.field(AccountSpecificView::getExpiryTime, DateTime.now()).op(Operator.LessThan)
-				.field(AccountSpecificView::getSkuId, skuIds).op(Operator.InList).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 编辑 未续费的账号
-	 */
-	@PutMapping("/update/renew/account")
-	public Result<String> updateRenewAccount(@RequestBody Account account) {
-		Long id = account.getId();
-		Date startTime = account.getStartTime();
-		Date expiryTime = account.getExpiryTime();
-		String remark = account.getRemark();
-		Account byId = accountService.getById(id);
-		Assert.notNull(byId, "账号不存在");
-		byId.setStartTime(startTime);
-		byId.setExpiryTime(expiryTime);
-		byId.setRemark(remark);
-		accountService.updateById(byId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 下载 替换错误账号模板
-	 */
-	@GetMapping("/get/replace/banned/template")
-	public void getReplaceBannedTemplate(HttpServletResponse response) {
-		EasyExcelUtils.createTemplateExcel(response, ExcelBannedAccountData.class, "封禁账号替换模板", "封禁账号替换模板", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 替换封禁账号
-	 */
-	@PostMapping("/replace/banned")
-	public Result<List<String>> replaceBannedAccount(Long goodsId, MultipartFile file) throws IOException {
-		List<String> repeat = new ArrayList<>();
-		List<Long> sendMsgList = new ArrayList<>();
-		EasyExcel.read(file.getInputStream(), ExcelBannedAccountData.class, new AnalysisEventListener<ExcelBannedAccountData>() {
-			@Override
-			public void invoke(ExcelBannedAccountData data, AnalysisContext analysisContext) {
-				String oldAccount = data.getOldAccount();
-				String account = data.getAccount();
-				String password = data.getPassword();
-				if (StrUtil.isEmpty(oldAccount) || StrUtil.isEmpty(account) || StrUtil.isEmpty(password)) {
-					return;
-				}
-				Account dbAccount = accountService.getOne(Wrappers.lambdaQuery(Account.class)
-						.eq(Account::getGoodsId, goodsId)
-						.eq(Account::getAccount, oldAccount.trim())
-						.last("limit 1"));
-				if (dbAccount == null) {
-					return;
-				}
-				account = account.trim();
-				password = password.trim();
-				if (accountCommonService.checkIsDupAccount(goodsId, account)) {
-					repeat.add(oldAccount);
-					return;
-				}
-				dbAccount.setAccount(account);
-				dbAccount.setPassword(password);
-				dbAccount.setStartTime(DateTime.now());
-				dbAccount.setExpiryTime(DateUtil.offsetMonth(DateTime.now(), 1));
-				if (StrUtil.isNotEmpty(data.getEmail())) {
-					dbAccount.setEmail(data.getEmail());
-				}
-				if (StrUtil.isNotEmpty(data.getRelateEmail())) {
-					dbAccount.setRelateEmail(data.getRelateEmail());
-				}
-				if (data.getExpiryTime() != null) {
-					dbAccount.setExpiryTime(DateUtil.parse(data.getExpiryTime()));
-				}
-				accountService.updateById(dbAccount);
-
-				GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class)
-						.eq(GroupsTrips::getAccountId, dbAccount.getId())
-						.eq(GroupsTrips::getStatus, GroupsTrips.Status.down)
-						.last("limit 1"));
-				if (groupsTrips != null) {
-					groupsTrips.setStatus(GroupsTrips.Status.validity);
-					groupsMapper.updateById(groupsTrips);
-				}
-				sendMsgList.add(dbAccount.getId());
-			}
-
-			@Override
-			public void doAfterAllAnalysed(AnalysisContext analysisContext) {
-
-			}
-		}).sheet().doRead();
-
-		if (CollUtil.isNotEmpty(sendMsgList)) {
-			TASK_EXECUTOR.execute(() -> {
-				sendMsgList.forEach(accountId -> {
-					GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class)
-							.eq(GroupsTrips::getAccountId, accountId).last("limit 1"));
-					if (groupsTrips != null) {
-						Account byId = accountService.getById(accountId);
-						cmsGroupService.sendChangeAccountMsg(groupsTrips.getId(), goodsId, byId.getAccount());
-					}
-				});
-			});
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(repeat);
-	}
-
-	/**
-	 * 导入备用账号模板
-	 */
-	@GetMapping("/export/prepare/template")
-	public void getPrepareTemplate(HttpServletResponse response) {
-		EasyExcelUtils.createTemplateExcel(response, ExcelPrepareAccountData.class, "导入备用账号模板", "导入备用账号模板", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 批量导入备用账号
-	 */
-	@PostMapping("/batch/import/prepare")
-	public Result<String> batchImportPrepare(Long goodsId, String preSkuIds, MultipartFile file) throws IOException {
-		if (goodsId == null) {
-			throw BusinessRuntimeException.getInstance("请选择对应平台");
-		}
-		if (goodsId == 26) {
-			if (StrUtil.isEmpty(preSkuIds)) {
-				throw BusinessRuntimeException.getInstance("请选择对应规格id");
-			}
-			String[] split = preSkuIds.split(",");
-			preSkuIds = Arrays.stream(split).distinct().collect(Collectors.joining(","));
-		}
-		final String f_skuIds = preSkuIds;
-		EasyExcel.read(file.getInputStream(), ExcelPrepareAccountData.class, new AnalysisEventListener<ExcelPrepareAccountData>() {
-			@Override
-			public void invoke(ExcelPrepareAccountData data, AnalysisContext analysisContext) {
-				String account = data.getAccount();
-				String password = data.getPassword();
-				if (StrUtil.isEmpty(account) || StrUtil.isEmpty(password)) {
-					return;
-				}
-				Account insert = new Account();
-				insert.setAccount(account.trim());
-				insert.setPassword(password.trim());
-				insert.setGoodsId(goodsId);
-				insert.setPreSkuIds(f_skuIds);
-				insert.setType(2);
-				insert.setStartTime(DateTime.now());
-				if (data.getExpiryTime() != null) {
-					insert.setExpiryTime(DateUtil.parse(data.getExpiryTime()));
-				} else {
-					insert.setExpiryTime(DateUtil.offsetMonth(DateTime.now(), 1));
-				}
-				insert.setBankCard(data.getBankCard());
-				//辅助邮箱
-				insert.setEmail(data.getSecondEmail());
-				//关联邮箱
-				insert.setRelateEmail(data.getRelateEmail());
-				//验证链接
-				insert.setVerifyLink(data.getVerifyLink());
-				if (StrUtil.isNotEmpty(data.getOutsidePurchaseStr())) {
-					if (data.getOutsidePurchaseStr().equals("是") || data.getOutsidePurchaseStr().equals("1")) {
-						insert.setOutsidePurchase(true);
-					}
-				}
-				//账号是否已经添加过
-				if (!insert.getAccount().contains("客服")) {
-					if (accountCommonService.checkIsDupAccount(insert.getGoodsId(), insert.getAccount())) {
-						return;
-					}
-				}
-				accountService.save(insert);
-			}
-
-			@Override
-			public void doAfterAllAnalysed(AnalysisContext analysisContext) {
-
-			}
-		}).sheet().doRead();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 新增预备账号
-	 */
-	@PostMapping("/post/prepare")
-	public Result<String> postPrepare(@RequestBody Account account) {
-		account.setAccount(account.getAccount().trim());
-		account.setPassword(account.getPassword().trim());
-		//账号是否已经添加过
-		if (!account.getAccount().contains("客服")) {
-			if (accountCommonService.checkIsDupAccount(account.getGoodsId(), account.getAccount())) {
-				throw BusinessRuntimeException.getInstance("该平台下已生成该账号");
-			}
-		}
-		account.setType(2);
-		if (account.getGoodsId() == 26) {
-			String preSkuIds = account.getPreSkuIds();
-			if (StrUtil.isEmpty(preSkuIds)) {
-				throw BusinessRuntimeException.getInstance("请选择对应规格id");
-			}
-			String[] split = preSkuIds.split(",");
-			String skuSetStr = Arrays.stream(split).distinct().collect(Collectors.joining(","));
-			account.setPreSkuIds(skuSetStr);
-		}
-		accountService.save(account);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 批量导入系统邮箱
-	 */
-	@PostMapping("/batch/import/email")
-	public Result<String> batchImportEmail(MultipartFile file) throws Exception {
-		accountService.readFileAndImportEmail(file);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 系统邮箱列表
-	 */
-	@GetMapping("/get/email")
-	public Result<SearchResult<SysEmail>> getEmail() {
-		SearchResult<SysEmail> search = beanSearcher.search(SysEmail.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(SysEmail::getDeleted, 1)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 新增邮箱
-	 */
-	@PostMapping("/post/email")
-	public Result postEmail(@RequestBody @Validated SysEmail sysEmail) {
-		try {
-			sysEmailMapper.insert(sysEmail);
-		} catch (DuplicateKeyException e) {
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 修改系统邮箱
-	 */
-	@PutMapping("/update/email")
-	public Result updateEmail(@RequestBody SysEmail sysEmail) {
-		sysEmailMapper.updateById(sysEmail);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除系统邮箱
-	 */
-	@DeleteMapping("/delete/email/{id}")
-	public Result deleteEmail(@PathVariable Long id) {
-		sysEmailMapper.deleteById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 批量导入被封禁平台账号
-	 */
-	@PostMapping("/batch/import/blocked")
-	public Result<String> batchImportBlockedAccount(MultipartFile file, Long goodsId) throws IOException {
-		Assert.notNull(goodsId, "请选择对应平台");
-		List<Object> accountBlockedList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(0).doReadSync();
-		accountService.batchImportBlockedAccount(goodsId, accountBlockedList);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除封禁平台账号
-	 */
-	@DeleteMapping("/delete/blocked/{id}")
-	public Result<String> deleteBlockedAccount(@PathVariable Long id) throws IOException {
-		accountBlockedReplaceRecordMapper.deleteById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 被封禁账号列表
-	 */
-	@GetMapping("/get/blocked")
-	public Result<SearchResult<AccountBlockedReplaceRecord>> getBlockedAccount() {
-		SearchResult<AccountBlockedReplaceRecord> search = beanSearcher.search(AccountBlockedReplaceRecord.class, MapUtils.flatBuilder(request.getParameterMap())
-				.orderBy(AccountBlockedReplaceRecord::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 禁用账号
-	 */
-	@PutMapping("/update/disable/{accountId}")
-	@Log(module = "平台管理/禁用账号", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> updateDisableAccount(@PathVariable Long accountId) {
-		Optional.ofNullable(accountService.getById(accountId))
-				.ifPresent(e -> {
-					e.setIsDisable(!e.getIsDisable());
-					accountService.updateById(e);
-				});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 账号禁用列表
-	 */
-	@GetMapping("/get/disable/acount")
-	public Result<SearchResult<AccountDisableView>> getDisableAccount() {
-		SearchResult<AccountDisableView> search = beanSearcher.search(AccountDisableView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(AccountDisableView::getIsDisable, 1).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-
-	/**
-	 * 奈飞同步用户更新装置
-	 */
-	@PostMapping("/nf/upgrade/device/{accountId}")
-	public Result<String> nfUpgradeDevice(@PathVariable Long accountId) throws Exception {
-		String url = accountService.nfUpgradeDevice(accountId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(url);
-	}
-
-	/**
-	 * 查看验证码
-	 */
-	@GetMapping("/get/account/email/code")
-	public Result<String> getAccountEmailCode(Long accountId) throws Exception {
-		String code = accountService.getAccountEmailCode(accountId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(code);
-	}
-
-	/**
-	 * 下载导入账号 辅助邮箱、关联邮箱模板
-	 */
-	@GetMapping("/get/export/email/template")
-	public void getAccountEmailTemplate(HttpServletResponse response) {
-		EasyExcelUtils.createTemplateExcel(response, ExcelAccountEmailBindData.class, "导入账号邮箱模板", "导入账号邮箱模板", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 导入账号 辅助邮箱、关联邮箱
-	 */
-	@PostMapping("/export/email")
-	public Result<String> exportEmail(MultipartFile file) throws IOException {
-		EasyExcel.read(file.getInputStream(), ExcelAccountEmailBindData.class, new AnalysisEventListener<ExcelAccountEmailBindData>() {
-			@Override
-			public void invoke(ExcelAccountEmailBindData data, AnalysisContext analysisContext) {
-				String account = data.getAccount();
-				String email = data.getEmail();
-				String relateEmail = data.getRelateEmail();
-				if (StrUtil.isAllEmpty(email, relateEmail)) {
-					return;
-				}
-				List<Account> list = accountService.list(Wrappers.lambdaQuery(Account.class)
-						.eq(Account::getAccount, account.trim()));
-				if (list.isEmpty()) return;
-
-				list.forEach(dbAccount->{
-					dbAccount.setEmail(email);
-					dbAccount.setRelateEmail(relateEmail);
-					accountService.updateById(dbAccount);
-				});
-			}
-
-			@Override
-			public void doAfterAllAnalysed(AnalysisContext analysisContext) {
-
-			}
-		}).sheet().doRead();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 410
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsGptCarController.java

@@ -1,410 +0,0 @@
-package com.cyksj.web.controller.manage.account;
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.RandomUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.http.HttpRequest;
-import cn.hutool.http.HttpResponse;
-import cn.hutool.http.HttpUtil;
-import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONObject;
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.context.AnalysisContext;
-import com.alibaba.excel.event.AnalysisEventListener;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.common.util.StringUtil;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.ChatgptSessionMapper;
-import com.cyksj.model.dto.ChatGptChangePasswordDto;
-import com.cyksj.model.dto.ChatgptChangeNodesDto;
-import com.cyksj.model.entity.ChatgptSession;
-import com.cyksj.model.entity.SysConfig;
-import com.cyksj.model.excel.ExcelGptMirrorAccountData;
-import com.cyksj.model.excel.ExcelGptSessionAccountData;
-import com.cyksj.model.views.ChatgptCarSessionView;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.chatgpt.ChatGptAccountService;
-import com.cyksj.service.mail.YhMailService;
-import com.cyksj.service.sys.SysConfigService;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.List;
-import java.util.Optional;
-
-/** admin/镜像车队账号管理
- * 项目名: yhlxj
- * 文件名: CmsGptCarController
- * 创建者: JavaZou
- * 创建时间:2024/4/12 15:12
- */
-@Slf4j
-@RequiredArgsConstructor
-@RequestMapping("/manage/account/gptCar")
-@RestController
-public class CmsGptCarController {
-	private final ChatGptAccountService chatGptAccountService;
-
-	private final ChatgptSessionMapper chatgptSessionMapper;
-
-	private final RedisService redisService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final YhMailService yhMailService;
-
-	private final SysConfigService sysConfigService;
-
-	/**
-	 * 获取镜像车队账号列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<ChatgptCarSessionView>> getMirrorCarSession() {
-		SearchResult<ChatgptCarSessionView> search = beanSearcher.search(ChatgptCarSessionView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.orderBy(ChatgptCarSessionView::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 编辑镜像车队账号列表
-	 */
-	@PutMapping("/update")
-	public Result<String> updateMirrorCarSession(@RequestBody ChatgptSession chatgptSession) {
-		Long id = chatgptSession.getId();
-		ChatgptSession dbChatSession = chatgptSessionMapper.selectById(id);
-		if (StrUtil.equals(chatgptSession.getOfficialSession(), dbChatSession.getOfficialSession())) {
-			if (!ObjectUtil.equal(dbChatSession.getEmail(), chatgptSession.getEmail()) || !ObjectUtil.equal(dbChatSession.getPassword(), chatgptSession.getPassword())) {
-				String gptSession = chatGptAccountService.getGptSession(dbChatSession.getEmail(), dbChatSession.getPassword());
-				chatgptSession.setOfficialSession(gptSession);
-			}
-		}
-		Integer selectCount = chatgptSessionMapper.selectCount(Wrappers.lambdaQuery(ChatgptSession.class)
-				.and(e -> e.eq(ChatgptSession::getEmail, chatgptSession.getEmail())
-						.or().eq(ChatgptSession::getCarId, chatgptSession.getCarId()))
-				.ne(ChatgptSession::getId, chatgptSession.getId()));
-		if (selectCount > 0) {
-			throw BusinessRuntimeException.getInstance("请检验车队ID或账号是否已存在");
-		}
-		refresh(chatgptSession.getId());
-		chatgptSessionMapper.updateById(chatgptSession);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除镜像车队账号
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteMirrorCarSession(@PathVariable Long id) {
-		Optional.ofNullable(chatgptSessionMapper.selectById(id))
-				.ifPresent(e -> {
-					String carId = e.getCarId();
-					if (StrUtil.isNotBlank(carId)) {
-						chatgptSessionMapper.deleteById(e.getId());
-
-						String highCarChatKey = RedisService.key.CHATGPT_CAR_HIGH_CHAT.getName() + carId;
-						String lowCarChatKey = RedisService.key.CHATGPT_CAR_LOW_CHAT.getName() + carId;
-						//从zSet中删除车队
-						String carScoresKey = RedisService.key.CHATGPT_CAR_SCORES.getName();
-						redisService.zRemove(carScoresKey, carId);
-						redisService.del(highCarChatKey);
-						redisService.del(lowCarChatKey);
-					}
-				});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 新增镜像车队账号
-	 */
-	@PostMapping("/post/mirror/car/session")
-	public Result<String> postMirrorCarSession(@RequestBody ChatgptSession chatgptSession) throws Exception {
-		Integer selectCount = chatgptSessionMapper.selectCount(Wrappers.lambdaQuery(ChatgptSession.class)
-				.eq(chatgptSession.getCarId() != null, ChatgptSession::getCarId, chatgptSession.getCarId()).or().eq(ChatgptSession::getEmail, chatgptSession.getEmail()));
-		if (selectCount > 0) {
-			throw BusinessRuntimeException.getInstance("请检验车队ID或账号是否已存在");
-		}
-		String gptSession = null;
-		if (StrUtil.isBlank(chatgptSession.getOfficialSession())) {
-			gptSession = chatGptAccountService.getGptSession(chatgptSession.getEmail(), chatgptSession.getPassword());
-			chatgptSession.setIsCar(true);
-			chatgptSession.setOfficialSession(gptSession);
-		}
-		chatgptSessionMapper.insert(chatgptSession);
-		if (gptSession != null && StringUtils.isBlank(chatgptSession.getCarId())) {
-			JSONObject jsonObject = new JSONObject(gptSession);
-			String planType = jsonObject.getJSONObject("accountCheckInfo").getStr("plan_type");
-			if ("plus".equals(planType)) {
-				chatgptSession.setCarId("P" + chatgptSession.getId());
-				chatgptSession.setCarName("P" + chatgptSession.getId());
-			} else if ("team".equals(planType)) {
-				chatgptSession.setCarId("T" + chatgptSession.getId());
-				chatgptSession.setCarName("T" + chatgptSession.getId());
-			} else {
-				chatgptSession.setCarId("P" + chatgptSession.getId());
-				chatgptSession.setCarName("P" + chatgptSession.getId());
-				chatgptSession.setIsPlus(0);
-			}
-		}else {
-			chatgptSession.setIsPlus(0);
-			chatgptSession.setStatus(0);
-			chatgptSession.setCarId("P" + chatgptSession.getId());
-			chatgptSession.setCarName("P" + chatgptSession.getId());
-		}
-		refresh(chatgptSession.getId());
-		chatgptSessionMapper.updateById(chatgptSession);
-
-		//同步session的会员类型
-		if (StrUtil.isNotEmpty(chatgptSession.getOfficialSession())) {
-			String officialSession = chatgptSession.getOfficialSession();
-			JSONObject session = Jsons.parseObject(officialSession, JSONObject.class);
-			String accessToken = session.getStr("accessToken");
-			if (StrUtil.isNotEmpty(accessToken)) {
-				getGptAccountInfo(request, chatgptSession.getId(), accessToken);
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	@PostMapping("/post/mirror/changePassword")
-	public Result<String> changePassword(@RequestBody ChatGptChangePasswordDto chatGptChangePasswordDto){
-		Long chatgptSessionId = chatGptChangePasswordDto.getChatgptSessionId();
-		ChatgptSession chatgptSession = chatgptSessionMapper.selectById(chatgptSessionId);
-		if(chatgptSession == null){
-			throw BusinessRuntimeException.getInstance("车队不存在");
-		}
-
-		HttpRequest request = HttpRequest.post("http://85.113.70.93:8282/change");
-		request.form("url", chatGptChangePasswordDto.getUrl());
-		if(StringUtils.isBlank(chatGptChangePasswordDto.getPassword())){
-			chatGptChangePasswordDto.setPassword(RandomUtil.randomString(12));
-		}
-		request.form("newpassword", chatGptChangePasswordDto.getPassword());
-		request.form("proxy", "nKeghbxuT2R2QO7G:2pSJmJSZln2CPGJ2_country-us_streaming-1@geo.iproyal.com:12321");
-		String body = request.execute().body();
-		JSONObject jsonResponse = new JSONObject(body);
-		int code = jsonResponse.getInt("code");
-
-		// Handle response
-		if (code == 1) {
-			//修改密码
-			chatgptSession.setPassword(chatGptChangePasswordDto.getPassword());
-			refresh(chatgptSession.getId());
-			chatgptSessionMapper.updateById(chatgptSession);
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		} else {
-			throw BusinessRuntimeException.getInstance("修改密码错误");
-		}
-	}
-
-
-	/**
-	 * 刷新gpt得officialSession
-	 */
-	@PutMapping("/flush/officialSession/{id}")
-	public Result<String> flushOfficialSession(@PathVariable Long id) {
-		ChatgptSession dbChatSession = chatgptSessionMapper.selectById(id);
-		if (dbChatSession != null) {
-			String gptSession = chatGptAccountService.getGptSession(dbChatSession.getEmail(), dbChatSession.getPassword());
-			dbChatSession.setOfficialSession(gptSession);
-			refresh(dbChatSession.getId());
-			chatgptSessionMapper.updateById(dbChatSession);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 导出gpt镜像账号
-	 */
-	@GetMapping("/export/mirror/account")
-	public void export(HttpServletResponse response) {
-		List<ExcelGptMirrorAccountData> dataList = beanSearcher.searchAll(ExcelGptMirrorAccountData.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		dataList.forEach(data -> {
-			String officialSession = data.getOfficialSession();
-			if (StrUtil.isNotEmpty(officialSession)) {
-				try {
-					JSONObject body = Jsons.parseObject(officialSession, JSONObject.class);
-					JSONObject accountCheckInfo = body.getJSONObject("accountCheckInfo");
-					String expiresAt = accountCheckInfo.getStr("expires_at");
-					data.setExpiryTime(DateUtil.parse(expiresAt));
-				} catch (Exception e) {
-				}
-			}
-		});
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelGptMirrorAccountData.class, dataList, "gpt镜像账号", "gpt镜像账号", ExcelTypeEnum.XLS, null);
-	}
-
-	/**
-	 * 查看gpt验证码
-	 */
-	@GetMapping("/get/account/verifyCode")
-	public Result<String> getAccountVerifyCode(Long id) {
-		ChatgptSession chatgptSession = chatgptSessionMapper.selectById(id);
-		String account = chatgptSession.getEmail();
-		if (StrUtil.isNotEmpty(chatgptSession.getRelateEmail())) {
-			account = chatgptSession.getRelateEmail();
-		}
-		String code = yhMailService.getGptCode(account);
-		JSONObject re = new JSONObject();
-		re.putOpt("code", code);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(re.toString());
-	}
-
-	/**
-	 * 读取GPT重置密码链接
-	 */
-	@GetMapping("/read/resetPassword/link")
-	public Result<String> readResetPwdResetLink(Long id) {
-		ChatgptSession chatgptSession = chatgptSessionMapper.selectById(id);
-		String account = chatgptSession.getEmail();
-		String relateEmail = chatgptSession.getRelateEmail();
-		if (StrUtil.isNotEmpty(relateEmail)) {
-			account = relateEmail;
-		}
-		String linkUrl = yhMailService.readResetPwdResetLink(account);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(linkUrl);
-	}
-
-	private void refresh(Long id){
-		try {
-			SysConfig one = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, "mirror_gpt_domain"));
-			List<String> array = new JSONArray(one.getSysValue()).toList(String.class);
-			array.forEach((domain)->{
-				String url = domain + "/backend-api/car/refresh?carId=" + id;
-				HttpUtil.get(url);
-			});
-		}catch (Exception e) {
-			log.error("刷新车队token异常:{}", StringUtil.getErrorText(e));
-		}
-	}
-
-	/**
-	 * gpt更换节点
-	 */
-	@PostMapping("/changeNodes")
-	public Result<String> changeNodes(@RequestBody ChatgptChangeNodesDto node){
-		SysConfig one = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, "gpt_car_nodes_list"));
-		List<String> nodeList = new JSONArray(one.getSysValue()).toList(String.class);
-		if (nodeList.contains(node.getNode())) {
-			//修改目前使用gpt节点值
-			sysConfigService.update(Wrappers.lambdaUpdate(SysConfig.class).eq(SysConfig::getSysKey,"gpt_car_nodes").set(SysConfig::getSysValue, node.getNode()));
-			SysConfig domainConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, "mirror_gpt_domain"));
-			List<String> domainList = new JSONArray(domainConfig.getSysValue()).toList(String.class);
-			domainList.forEach((domain)->{
-				HttpUtil.get(domain + "/backend-api/car/changeNodes");
-			});
-			log.info("切换成功");
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}else {
-			throw BusinessRuntimeException.getInstance("该节点不存在!");
-		}
-	}
-
-	/**
-	 * 获取 gpt用户信息
-	 */
-	@GetMapping("/getGptAccountInfo")
-	public Result<String> getGptAccountInfo(HttpServletRequest request, Long id, String accessToken) {
-		if (StringUtils.isBlank(accessToken)) {
-			ChatgptSession chatgptSession = chatgptSessionMapper.selectById(id);
-			String officialSession = chatgptSession.getOfficialSession();
-			JSONObject jsonObject = new JSONObject(officialSession);
-			String accessTokenJson = jsonObject.getStr("accessToken");
-			if (StringUtils.isBlank(accessTokenJson)) {
-				throw BusinessRuntimeException.getInstance("缺少accessToken");
-			} else {
-				accessToken = accessTokenJson;
-			}
-		}
-		log.info("accessToken:{}", accessToken);
-		HttpRequest httpRequest = new HttpRequest("https://chat-chan-87jztgkf257d.xyhelper.org/backend-api/accounts/check/v4-2023-04-27?timezone_offset_min=0");
-		httpRequest.header("User-Agent", request.getHeader("User-Agent"));
-		httpRequest.header("Authorization", accessToken);
-		try (HttpResponse execute = httpRequest.execute()) {
-			if (execute.getStatus() == 200) {
-				String result = execute.body();
-				chatgptSessionMapper.update(null, Wrappers.lambdaUpdate(ChatgptSession.class).eq(ChatgptSession::getId, id).set(ChatgptSession::getAccountInfo, result));
-				JSONObject resObj = new JSONObject(result);
-				JSONObject entitlement = resObj.getJSONObject("accounts").getJSONObject("default").getJSONObject("entitlement");
-				String subscriptionPlan = entitlement.getStr("subscription_plan");
-				if (StrUtil.isNotEmpty(subscriptionPlan)) {
-					if (subscriptionPlan.contains("chatgptpro")) {
-						chatgptSessionMapper.update(null, Wrappers.lambdaUpdate(ChatgptSession.class).eq(ChatgptSession::getId, id).set(ChatgptSession::getType, "Pro"));
-					}
-					if (subscriptionPlan.contains("chatgptplusplan")) {
-						chatgptSessionMapper.update(null, Wrappers.lambdaUpdate(ChatgptSession.class).eq(ChatgptSession::getId, id).set(ChatgptSession::getType, "Plus"));
-					}
-				} else {
-					chatgptSessionMapper.update(null, Wrappers.lambdaUpdate(ChatgptSession.class).eq(ChatgptSession::getId, id).set(ChatgptSession::getType, "普通"));
-				}
-				JSONArray accountOrdering = resObj.getJSONArray("account_ordering");
-				if (accountOrdering.size() > 1) {
-					chatgptSessionMapper.update(null, Wrappers.lambdaUpdate(ChatgptSession.class).eq(ChatgptSession::getId, id).set(ChatgptSession::getType, "Team"));
-				}
-				return GatewayResponse.SUCCESS.newBuilder().toResult(entitlement.getStr("expires_at"));
-			} else {
-				if (execute.getStatus() == 401) {
-					throw BusinessRuntimeException.getInstance("token失效");
-				}
-				throw BusinessRuntimeException.getInstance(execute.body());
-			}
-		}
-
-	}
-
-	/**
-	 * 下载GPT镜像车队模板
-	 */
-	@GetMapping("/export/gpt/session/template")
-	public void getGptSessionTemplate(HttpServletResponse response) {
-		EasyExcelUtils.createTemplateExcel(response, ExcelGptSessionAccountData.class, "导入GPT镜像车队账号模板", "导入GPT镜像车队账号模板", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 上传GPT镜像车队
-	 */
-	@PostMapping("/import/gpt/session")
-	public Result<String> importGptSession(MultipartFile file) throws IOException {
-		EasyExcel.read(file.getInputStream(), ExcelGptSessionAccountData.class, new AnalysisEventListener<ExcelGptSessionAccountData>() {
-			@Override
-			public void invoke(ExcelGptSessionAccountData data, AnalysisContext analysisContext) {
-				ChatgptSession session = new ChatgptSession();
-				BeanUtil.copyProperties(data, session);
-				session.setStatus(0);
-				if ("有效".equals(data.getStatusStr())) {
-					session.setStatus(1);
-				}
-				//生成gptSession
-				try {
-					postMirrorCarSession(session);
-				} catch (Exception e) {
-
-				}
-			}
-			@Override
-			public void doAfterAllAnalysed(AnalysisContext analysisContext) {
-
-			}
-		}).sheet().doRead();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-}

+ 0 - 151
netflix-web/src/main/java/com/cyksj/web/controller/manage/active/UserActivityController.java

@@ -1,151 +0,0 @@
-package com.cyksj.web.controller.manage.active;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserActivityRankRobotMapper;
-import com.cyksj.mapper.UserDistributeRankStatisticsRecordMapper;
-import com.cyksj.model.entity.UserActivity;
-import com.cyksj.model.entity.UserActivityRankRobot;
-import com.cyksj.model.views.ActivityOrderDataView;
-import com.cyksj.model.views.UserDistributeRankActivityView;
-import com.cyksj.service.user.UserActivityService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.time.DayOfWeek;
-import java.time.LocalDate;
-import java.time.temporal.ChronoField;
-import java.util.List;
-
-/**
- * admin/分销排行
- * 项目名: yhlxj
- * 文件名: UserActivityController
- * 创建者: JavaZou
- * 创建时间:2024/4/17 12:22
- */
-@RestController
-@RequestMapping("/manage/activity")
-@Slf4j
-@RequiredArgsConstructor
-public class UserActivityController {
-	private final UserActivityService userActivityService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserActivityRankRobotMapper rankRootMapper;
-
-	private final UserDistributeRankStatisticsRecordMapper userDistributeRankStatisticsRecordMapper;
-
-	/**
-	 * 新建活动
-	 */
-	@PostMapping("/post")
-	public Result<String> insertActivity(@RequestBody @Validated UserActivity userActivity) throws Exception {
-		userActivityService.saveOrUpdateActivity(userActivity);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑活动
-	 */
-	@PutMapping("/update")
-	public Result<String> updateActivity(@RequestBody @Validated UserActivity userActivity) throws Exception {
-		userActivityService.saveOrUpdateActivity(userActivity);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除活动
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteActivity(@PathVariable Long id) {
-		UserActivity activity = userActivityService.getById(id);
-		if (activity != null && activity.getDeleted()) {
-			activity.setDeleted(false);
-			userActivityService.updateById(activity);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 活动列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<UserActivity>> get() {
-		SearchResult<UserActivity> search = beanSearcher.search(UserActivity.class, MapUtils.flatBuilder(request.getParameterMap()).field(UserActivity::getDeleted, 1).build());
-		search.getDataList().forEach(e -> {
-			if (e.getType() == 1) {
-				String statisticsTime;
-				if (e.getStatisticsType().equals(Constant.week)) {
-					statisticsTime = LocalDate.now().with(ChronoField.DAY_OF_WEEK, DayOfWeek.MONDAY.getValue()).toString();
-				} else {
-					statisticsTime = LocalDate.now().with(ChronoField.DAY_OF_MONTH, DayOfWeek.MONDAY.getValue()).toString();
-				}
-				List<UserActivityRankRobot> userActivityRankRobots = rankRootMapper.selectList(Wrappers.lambdaQuery(UserActivityRankRobot.class)
-						.eq(UserActivityRankRobot::getAcId, e.getId()));
-				userActivityRankRobots.forEach(robot -> {
-					UserActivityRankRobot moneyRank = userDistributeRankStatisticsRecordMapper.getRobotRankInfo(robot.getId(), Constant.money, statisticsTime);
-					if (moneyRank != null) {
-						robot.setMoney(moneyRank.getMoney());
-						robot.setMoneyRank(moneyRank.getRankId());
-					}
-					UserActivityRankRobot orderRank = userDistributeRankStatisticsRecordMapper.getRobotRankInfo(robot.getId(), Constant.orders, statisticsTime);
-					if (orderRank != null) {
-						robot.setOrders(orderRank.getOrders());
-						robot.setOrderRank(orderRank.getRankId());
-					}
-				});
-				e.setRankRobots(userActivityRankRobots);
-
-				try {
-					if (StrUtil.isNotBlank(e.getRewardInfo())) {
-						List<UserActivity.RewardInfo> rewardInfos = Jsons.parseList(e.getRewardInfo(), UserActivity.RewardInfo.class);
-						e.setRewardInfoList(rewardInfos);
-					}
-				} catch (Exception ex) {
-				}
-
-				//活动数据
-				ActivityOrderDataView activityOrderDataView = userDistributeRankStatisticsRecordMapper.selectAcOrderDataView(e.getId());
-				e.setOrderDataView(activityOrderDataView);
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 分销排行列表
-	 */
-	@GetMapping("/get/rank/list")
-	public Result<Page<UserDistributeRankActivityView>> rankList(Long acId, String nickname, Long userId, String date, @RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "0") Integer type, String orderBy, String sort) {
-		String field = Constant.money;
-		if (type == 1) {
-			field = Constant.orders;
-		}
-		UserActivity activity = userActivityService.getById(acId);
-		if (date == null) {
-			if (activity.getStatisticsType().equals(Constant.week)) {
-				date = LocalDate.now().with(ChronoField.DAY_OF_WEEK, DayOfWeek.MONDAY.getValue()).toString();
-			} else {
-				date = LocalDate.now().with(ChronoField.DAY_OF_MONTH, DayOfWeek.MONDAY.getValue()).toString();
-			}
-		}
-		Page<UserDistributeRankActivityView> page = userDistributeRankStatisticsRecordMapper.rankPage(nickname, userId, date, new Page<>(start, limit), field, orderBy, sort);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
-	}
-
-}

+ 0 - 39
netflix-web/src/main/java/com/cyksj/web/controller/manage/advertisement/CmsAdvertisementOrderDonController.java

@@ -1,39 +0,0 @@
-package com.cyksj.web.controller.manage.advertisement;
-
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.AdvertisementOrderDon;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author chan
- * @date 2023/5/16 11:07 AM
- */
-@RestController
-@RequestMapping("manage/advertisement/order")
-@Slf4j
-@RequiredArgsConstructor
-public class CmsAdvertisementOrderDonController {
-
-    private final HttpServletRequest request;
-
-    private final BeanSearcher beanSearcher;
-
-    @GetMapping
-    public Result<SearchResult<AdvertisementOrderDon>> get() {
-        SearchResult<AdvertisementOrderDon> searchResult = beanSearcher.search(AdvertisementOrderDon.class,
-                MapUtils.flatBuilder(request.getParameterMap())
-                        .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(searchResult);
-    }
-
-}

+ 0 - 86
netflix-web/src/main/java/com/cyksj/web/controller/manage/advertisement/CmsAdvertisementPopularizeController.java

@@ -1,86 +0,0 @@
-package com.cyksj.web.controller.manage.advertisement;
-
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.AdvertisementPopularize;
-import com.cyksj.model.views.AdvertisementTencentView;
-import com.cyksj.service.advertisement.AdvertisementPopularizeService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * @author chan
- * @date 2023/5/16 11:06 AM
- */
-@RestController
-@RequestMapping("manage/advertisement/popularize")
-@Slf4j
-@RequiredArgsConstructor
-public class CmsAdvertisementPopularizeController {
-
-    private final HttpServletRequest request;
-
-    private final BeanSearcher beanSearcher;
-
-    private final AdvertisementPopularizeService advertisementPopularizeService;
-
-    @GetMapping
-    public Result<SearchResult<AdvertisementPopularize>> get() {
-        SearchResult<AdvertisementPopularize> searchResult = beanSearcher.search(AdvertisementPopularize.class,
-                MapUtils.flatBuilder(request.getParameterMap())
-                        .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(searchResult);
-    }
-
-    @PostMapping
-    public Result<AdvertisementPopularize> post(@RequestBody AdvertisementPopularize popularize) {
-        advertisementPopularizeService.save(popularize);
-        popularize.setUrl(popularize.getUrl() + "?fid=" + popularize.getId());
-        advertisementPopularizeService.updateById(popularize);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(advertisementPopularizeService.getById(popularize.getId()));
-    }
-
-    @PutMapping
-    public Result<String> put(@RequestBody AdvertisementPopularize popularize) {
-        advertisementPopularizeService.updateById(popularize);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @DeleteMapping("/{id}")
-    public Result<String> del(@PathVariable Long id) {
-        advertisementPopularizeService.removeById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    @GetMapping("/getDataIdList")
-    public Result<SearchResult<AdvertisementTencentView>> get(@RequestParam(required = false) Long accountId,
-                                                              @RequestParam(required = false) Long userActionSetId) throws Exception {
-
-        MapBuilder params = MapUtils.builder()
-                .field(AdvertisementTencentView::getAccountId, accountId)
-                .field(AdvertisementTencentView::getUserActionSetId, userActionSetId)
-                .orderBy(AdvertisementTencentView::getId, "desc");
-        // 选择数据源查询数据
-
-        params.field(AdvertisementTencentView::getName)
-                .op(Operator.NotNull)
-                .onlySelect(AdvertisementTencentView::getUserActionSetId, AdvertisementTencentView::getName);
-        List<AdvertisementTencentView> list = beanSearcher.searchAll(AdvertisementTencentView.class, params.build());
-        list.stream().forEach(advertiserTencentVo -> advertiserTencentVo.setName(advertiserTencentVo.getName() + "-" + advertiserTencentVo.getUserActionSetId()));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(new SearchResult<>(list));
-
-
-    }
-
-
-}

+ 0 - 61
netflix-web/src/main/java/com/cyksj/web/controller/manage/advertisement/CmsAdvertisementProjectController.java

@@ -1,61 +0,0 @@
-package com.cyksj.web.controller.manage.advertisement;
-
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.AdvertisementPopularize;
-import com.cyksj.model.entity.AdvertisementProject;
-import com.cyksj.service.advertisement.AdvertisementPopularizeService;
-import com.cyksj.service.advertisement.AdvertisementProjectService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author chan
- * @date 2023/5/16 11:06 AM
- */
-@RestController
-@RequestMapping("manage/advertisement/project")
-@Slf4j
-@RequiredArgsConstructor
-public class CmsAdvertisementProjectController{
-
-
-    private final HttpServletRequest request;
-
-    private final BeanSearcher beanSearcher;
-
-    private final AdvertisementProjectService advertisementProjectService;
-
-    @GetMapping
-    public Result<SearchResult<AdvertisementProject>> get() {
-        SearchResult<AdvertisementProject> searchResult = beanSearcher.search(AdvertisementProject.class,
-                MapUtils.flatBuilder(request.getParameterMap())
-                        .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(searchResult);
-    }
-
-    @PostMapping
-    public Result<AdvertisementProject> post(@RequestBody AdvertisementProject project){
-        advertisementProjectService.save(project);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(advertisementProjectService.getById(project.getId()));
-    }
-
-    @PutMapping
-    public Result<String> put(@RequestBody AdvertisementProject project){
-        advertisementProjectService.updateById(project);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @DeleteMapping("/{id}")
-    public Result<String> del(@PathVariable Long id){
-        advertisementProjectService.removeById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-}

+ 0 - 38
netflix-web/src/main/java/com/cyksj/web/controller/manage/advertisement/CmsAdvertisementUserController.java

@@ -1,38 +0,0 @@
-package com.cyksj.web.controller.manage.advertisement;
-
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.AdvertisementUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author chan
- * @date 2023/5/16 11:05 AM
- */
-@RestController
-@RequestMapping("manage/advertisement/user")
-@Slf4j
-@RequiredArgsConstructor
-public class CmsAdvertisementUserController {
-
-    private final HttpServletRequest request;
-
-    private final BeanSearcher beanSearcher;
-
-    @GetMapping
-    public Result<SearchResult<AdvertisementUser>> get() {
-        SearchResult<AdvertisementUser> searchResult = beanSearcher.search(AdvertisementUser.class,
-                MapUtils.flatBuilder(request.getParameterMap())
-                        .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(searchResult);
-    }
-}

+ 0 - 102
netflix-web/src/main/java/com/cyksj/web/controller/manage/article/ArticleController.java

@@ -1,102 +0,0 @@
-package com.cyksj.web.controller.manage.article;
-
-import cn.hutool.core.lang.Assert;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.mini.ArticleRecommendMapper;
-import com.cyksj.model.entity.Article;
-import com.cyksj.model.entity.ArticleRecommend;
-import com.cyksj.model.views.ArticleView;
-import com.cyksj.service.mange.article.ArticleService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.stream.Collectors;
-
-/*
- *项目名: netflix
- *文件名: ArticleController
- *创建者: JavaZou
- *创建时间:2023/6/27 15:02
- */
-@RestController
-@RequestMapping("/manage/article")
-@RequiredArgsConstructor
-public class ArticleController {
-	private final ArticleService articleService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final ArticleRecommendMapper articleRecommendMapper;
-
-	/**
-	 * 文章列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<ArticleView>> get() {
-		SearchResult<ArticleView> search = beanSearcher.search(ArticleView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data->{
-			data.setOtherArticleIds(articleRecommendMapper.selectList(Wrappers.lambdaQuery(ArticleRecommend.class)
-					.eq(ArticleRecommend::getRecommendId, data.getId())).stream().map(ArticleRecommend::getId).collect(Collectors.toList()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 新建文章
-	 */
-	@PostMapping("/post")
-	public Result<String> post(@RequestBody Article dto) {
-		articleService.saveOrUpdateArticle(dto);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 修改文章
-	 */
-	@PutMapping("/put")
-	public Result<String> update(@RequestBody Article dto) {
-		articleService.saveOrUpdateArticle(dto);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 文章详情
-	 */
-	@GetMapping("/get/detail/{id}")
-	public Result<Article> getArticleDetail(@PathVariable Long id) {
-		Article article = articleService.getArticleDetail(id);
-		Assert.notNull(article, "文章不存在");
-		return GatewayResponse.SUCCESS.newBuilder().toResult(article);
-	}
-
-	/**
-	 * 删除文章
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteById(@PathVariable Long id) {
-		articleService.update(null, Wrappers.lambdaUpdate(Article.class)
-				.set(Article::getDeleted, false)
-				.eq(Article::getId, id));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 上下架文章
-	 */
-	@PutMapping("/put/status/{id}")
-	public Result<String> updateStatus(@PathVariable Long id) {
-		Article article = articleService.getById(id);
-		Assert.notNull(article, "文章不存在");
-		article.setStatus(!article.getStatus());
-		articleService.updateById(article);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 110
netflix-web/src/main/java/com/cyksj/web/controller/manage/benefits/UserBenefitsController.java

@@ -1,110 +0,0 @@
-package com.cyksj.web.controller.manage.benefits;
-
-import cn.hutool.core.util.StrUtil;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.UserBenefits;
-import com.cyksj.model.views.UserBenefitsView;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.cyksj.service.user.UserBenefitsBackService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * 项目名: yhlxj2
- * 文件名: UserBenefitsController
- * 创建者: JavaZou
- * 创建时间:2024/9/23 14:27
- */
-@RestController
-@RequestMapping("/manage/user/benefits")
-@RequiredArgsConstructor
-public class UserBenefitsController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserBenefitsBackService userBenefitsBackService;
-
-	private final RefreshCacheService refreshCacheService;
-
-	/**
-	 * 用户权益列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<UserBenefitsView>> get() {
-		SearchResult<UserBenefitsView> search = beanSearcher.search(UserBenefitsView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.orderBy(UserBenefitsView::getSorted).asc()
-				.build());
-		search.getDataList().forEach(data->{
-			if (StrUtil.isNotBlank(data.getRenewConfig())) {
-				try {
-					data.setRenewConfigList(Jsons.parseList(data.getRenewConfig(), UserBenefits.RenewConfig.class));
-				} catch (Exception e) {
-				}
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 增加用户权益
-	 */
-	@PostMapping("/post")
-	public Result<String> saveUserBenefits(@RequestBody UserBenefits userBenefits) throws Exception {
-		userBenefitsBackService.saveOrUpdatePojo(userBenefits);
-		refreshCacheService.refreshUserBenefitsConfigCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑用户权益
-	 */
-	@PutMapping("/update")
-	public Result<String> updateUserBenefits(@RequestBody UserBenefits userBenefits) throws Exception {
-		userBenefitsBackService.saveOrUpdatePojo(userBenefits);
-		refreshCacheService.refreshUserBenefitsConfigCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除用户权益
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteById(@PathVariable Long id) {
-		userBenefitsBackService.removeById(id);
-		refreshCacheService.refreshUserBenefitsConfigCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 排序
-	 */
-	@PutMapping("/sorted")
-	public Result<String> sorted(@RequestBody UserBenefits userBenefits) {
-		Long id = userBenefits.getId();
-		UserBenefits byId = userBenefitsBackService.getById(id);
-		byId.setSorted(userBenefits.getSorted());
-		userBenefitsBackService.updateById(byId);
-		refreshCacheService.refreshUserBenefitsConfigCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 上下架
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		UserBenefits byId = userBenefitsBackService.getById(id);
-		byId.setStatus(!byId.getStatus());
-		userBenefitsBackService.updateById(byId);
-		refreshCacheService.refreshUserBenefitsConfigCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 103
netflix-web/src/main/java/com/cyksj/web/controller/manage/channel/CmsChannelController.java

@@ -1,103 +0,0 @@
-package com.cyksj.web.controller.manage.channel;
-
-import cn.dev33.satoken.stp.StpUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.Channel;
-import com.cyksj.model.entity.ChannelPopularize;
-import com.cyksj.model.views.ChannelView;
-import com.cyksj.service.mange.channel.ChannelPopularizeService;
-import com.cyksj.service.mange.channel.ChannelService;
-import com.cyksj.service.mange.cms.service.CmsUserService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * @author chan
- * @date 2022/12/13 2:29 PM
- */
-@RequestMapping("/manage/channel")
-@Slf4j
-@RestController
-@RequiredArgsConstructor
-public class CmsChannelController {
-
-    private final ChannelService channelService;
-
-    private final ChannelPopularizeService channelPopularizeService;
-
-    private final BeanSearcher beanSearcher;
-
-    private final CmsUserService cmsUserService;
-
-    private final HttpServletRequest request;
-
-    @GetMapping
-    public Result<SearchResult<ChannelView>> get(String startTime, String endTime) {
-        String timeSql = StringUtils.EMPTY;
-        long adminId = StpUtil.getLoginIdAsLong();
-        Boolean isRootRole = cmsUserService.isRootRole(adminId);
-        if (StringUtils.isNotBlank(startTime)) {
-            timeSql += String.format(" and o.created_time >= '%s'", startTime);
-        }
-        if (StringUtils.isNotBlank(endTime)) {
-            timeSql += String.format(" and o.created_time <= '%s'", endTime);
-        }
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        if (!isRootRole) {
-            builder.put("condition", String.format("FIND_IN_SET(%s,c.creator) > 0", adminId));
-        }
-        SearchResult<ChannelView> searchResult = beanSearcher.search(ChannelView.class,
-                builder.put("time", timeSql).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(searchResult);
-    }
-
-    /**
-     * 所有渠道列表
-     */
-    @GetMapping("/get/channelList")
-    public Result<List<Channel>> getChannels() {
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        long adminId = StpUtil.getLoginIdAsLong();
-        Boolean isRootRole = cmsUserService.isRootRole(adminId);
-        if (!isRootRole) {
-            builder.put("condition", String.format("FIND_IN_SET(%s,c.creator) > 0", adminId));
-        }
-        List<Channel> list = beanSearcher.searchAll(Channel.class, builder
-                .onlySelect(Channel::getId, Channel::getName)
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-    }
-
-    @PostMapping
-    public Result<String> post(@RequestBody Channel channel){
-        Long adminId = StpUtil.getLoginIdAsLong();
-        channel.setCreator(adminId.toString());
-        channelService.save(channel);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @PutMapping
-    public Result<String> put(@RequestBody Channel channel){
-        channelService.updateById(channel);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @DeleteMapping("/{id}")
-    public Result<String> del(@PathVariable Long id){
-        channelService.removeById(id);
-        channelPopularizeService.remove(Wrappers.lambdaQuery(ChannelPopularize.class).eq(ChannelPopularize::getChannelId,id));
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-}

+ 0 - 163
netflix-web/src/main/java/com/cyksj/web/controller/manage/channel/CmsChannelPopularizeController.java

@@ -1,163 +0,0 @@
-package com.cyksj.web.controller.manage.channel;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.OrderDonMapper;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.channel.ChannelPopularizeVisitMapper;
-import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkPopularizeMapper;
-import com.cyksj.mapper.sys.SysConfigMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.views.ChannelPopularizeDetailView;
-import com.cyksj.model.views.ChannelPopularizeView;
-import com.cyksj.service.mange.channel.ChannelPopularizeService;
-import com.cyksj.service.mange.cms.service.CmsUserService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * @author chan
- * @date 2022/12/13 2:29 PM
- */
-@RequestMapping("/manage/channel/popularize")
-@Slf4j
-@RestController
-@RequiredArgsConstructor
-public class CmsChannelPopularizeController {
-
-    private final ChannelPopularizeService channelPopularizeService;
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final UserMapper userMapper;
-
-    private final OrderDonMapper orderDonMapper;
-
-    private final ChannelPopularizeVisitMapper visitMapper;
-
-    private final CorpCustomerAcquisitionLinkPopularizeMapper acquisitionLinkPopularizeMapper;
-
-    private final CmsUserService cmsUserService;
-
-    private final SysConfigMapper sysConfigMapper;
-    @GetMapping
-    @SaCheckPermission("promotion:view")
-    public Result<SearchResult<ChannelPopularizeView>> get(String startTime, String endTime, Long goodsId) throws Exception {
-        long adminId = StpUtil.getLoginIdAsLong();
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        Boolean isRootRole = cmsUserService.isRootRole(adminId);
-        if (!isRootRole) {
-            String condition = String.format("FIND_IN_SET(%s,c.creator) > 0", adminId);
-            //渠道单独给管理员展示
-            SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
-                    .eq(SysConfig::getSysKey, Constant.POPULARIZE_USER_VIEWS)
-                    .last("limit 1"));
-            if (sysConfig != null && StrUtil.isNotBlank(sysConfig.getSysValue())) {
-                List<Long> userList = Jsons.parseList(sysConfig.getSysValue(), Long.class);
-                if (userList.contains(adminId)) {
-                    condition += String.format(" or FIND_IN_SET(%s,cp.creator) > 0", adminId);
-                }
-            }
-            builder.put("condition", "(" + condition + ")");
-        }
-        SearchResult<ChannelPopularizeView> searchResult = beanSearcher.search(ChannelPopularizeView.class, builder.build());
-        searchResult.getDataList().forEach(data -> {
-            Integer emailCount = userMapper.selectCount(Wrappers.lambdaQuery(User.class)
-                    .eq(User::getPopularizeId, data.getId())
-                    .ne(User::getEmail, ""));
-            data.setEmailCount(emailCount);
-            Integer phoneCount = userMapper.selectCount(Wrappers.lambdaQuery(User.class)
-                    .eq(User::getPopularizeId, data.getId())
-                    .ne(User::getLoginPhone, ""));
-            data.setPhoneCount(phoneCount);
-
-            Integer wechatCount = userMapper.selectCount(Wrappers.lambdaQuery(User.class)
-                    .eq(User::getPopularizeId, data.getId())
-                    .ne(User::getOpenId, ""));
-            data.setWechatCount(wechatCount);
-
-            Integer numOfOrderWebPay = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-                    .eq(OrderDon::getPopularizeId, data.getId())
-                    .eq(OrderDon::getIsWebPay, true)
-                    .notIn(OrderDon::getStatus, Constant.noOrderStatus));
-            data.setNumOfOrderWebPay(numOfOrderWebPay);
-            ChannelPopularizeView channelPopularizeView = orderDonMapper.countPopularizeOrderDetail(data.getId(), goodsId, startTime, endTime);
-            data.setOrderCount(channelPopularizeView.getOrderCount());
-            data.setOrderMoney(channelPopularizeView.getOrderMoney());
-            data.setRefundCount(channelPopularizeView.getRefundCount());
-            data.setRefundMoney(channelPopularizeView.getRefundMoney());
-            Integer visitCount = visitMapper.selectCount(Wrappers.lambdaQuery(ChannelPopularizeVisit.class)
-                    .eq(ChannelPopularizeVisit::getPopularizeId, data.getId())
-                    .ge(StrUtil.isNotEmpty(startTime), ChannelPopularizeVisit::getCreatedTime, startTime)
-                    .lt(StrUtil.isNotEmpty(endTime), ChannelPopularizeVisit::getCreatedTime, endTime));
-            data.setVisit(visitCount);
-
-            CorpCustomerAcquisitionLinkPopularize acquisitionLinkPopularize = acquisitionLinkPopularizeMapper.selectOne(Wrappers.lambdaQuery(CorpCustomerAcquisitionLinkPopularize.class)
-                    .eq(CorpCustomerAcquisitionLinkPopularize::getPopularizeId, data.getId())
-                    .last("limit 1"));
-            if (acquisitionLinkPopularize != null) {
-                data.setCorpCustomerLinkId(acquisitionLinkPopularize.getId());
-            }
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(searchResult);
-    }
-
-    @GetMapping("/{id}")
-    public Result<List<ChannelPopularizeDetailView>> getById(@PathVariable Long id, String startTime, String endTime){
-        String timeSql = StringUtils.EMPTY;
-        if(StringUtils.isNotBlank(startTime)){
-            timeSql += " o.created_time >= '" + startTime + "'";
-        }
-        if(StringUtils.isNotBlank(endTime)){
-            timeSql += " and o.created_time <= '" + endTime + "'";
-        }
-        List<ChannelPopularizeDetailView> result = beanSearcher.searchAll(ChannelPopularizeDetailView.class,
-                MapUtils.flatBuilder(request.getParameterMap())
-                        .field(ChannelPopularizeDetailView::getPopularizeId, id)
-                        .put("time", timeSql)
-                        .orderBy(ChannelPopularizeDetailView::getGoodsId).asc()
-                        .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(result);
-    }
-
-    @PostMapping
-    public Result<ChannelPopularize> post(@RequestBody ChannelPopularize popularize){
-        channelPopularizeService.save(popularize);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(channelPopularizeService.getById(popularize.getId()));
-    }
-
-    @PutMapping
-    public Result<String> put(@RequestBody ChannelPopularize popularize){
-        channelPopularizeService.updateById(popularize);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @DeleteMapping("/{id}")
-    public Result<String> del(@PathVariable Long id){
-        channelPopularizeService.removeById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @GetMapping("/get")
-    public Result<List<ChannelPopularize>> getAllPopularizeList() {
-        List<ChannelPopularize> list = beanSearcher.searchAll(ChannelPopularize.class, MapUtils.flatBuilder(request.getParameterMap()).onlySelect(ChannelPopularize::getId, ChannelPopularize::getName).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-    }
-}

+ 0 - 316
netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/CmsAdminUserController.java

@@ -1,316 +0,0 @@
-package com.cyksj.web.controller.manage.cms;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.lang.Validator;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Codec;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayApiCode;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.PhoneCodeMapper;
-import com.cyksj.mapper.manage.cms.CmsUserMapper;
-import com.cyksj.model.entity.CmsUser;
-import com.cyksj.model.entity.PhoneCode;
-import com.cyksj.model.manage.dto.AdminInfo;
-import com.cyksj.model.request.CmsUserReq;
-import com.cyksj.model.views.CmsUserVO;
-import com.cyksj.service.mange.CmsAccountService;
-import com.cyksj.service.mange.business.UserBusinessRateService;
-import com.cyksj.service.mange.cms.CmsUserManager;
-import com.cyksj.service.mange.cms.manager.service.CacheService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Date;
-
-/*
- *项目名: netflix
- *文件名: CmsAdminUserController
- *创建者: JavaZou
- *创建时间:2023/1/11 14:26
- */
-@RestController
-@RequestMapping("/manage/user")
-@RequiredArgsConstructor
-@Slf4j
-public class CmsAdminUserController {
-	private final CmsUserMapper cmsUserMapper;
-
-	private final PhoneCodeMapper phoneCodeMapper;
-
-	private final CmsUserManager cmsUserManager;
-
-	private final CacheService cacheService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final CmsAccountService cmsAccountService;
-
-	private final HttpServletRequest request;
-
-	private final UserBusinessRateService userBusinessRateService;
-
-	@PostMapping(value = "/login")
-	public Result<String> login(@RequestBody CmsUser adminRequest) throws Exception {
-		CmsUser admin = cmsUserMapper.selectOne(
-				new QueryWrapper<CmsUser>().lambda().eq(CmsUser::getPhone,adminRequest.getPhone()).last("limit 1"));
-
-		if (null == admin) {
-			throw BusinessRuntimeException.getInstance("该用户不存在.");
-		}
-		if (null == admin.getStatus() || !admin.getStatus()) {
-			throw BusinessRuntimeException.getInstance("无登录权限.");
-		}
-
-		// 对比密码
-		String encodePasscode = Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(adminRequest.getPassword()).toBase64String();
-
-		if (!StringUtils.equals(admin.getPassword(), encodePasscode)) {
-			throw BusinessRuntimeException.getInstance("密码有误.");
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	@PostMapping("/post")
-	@Log(module = "用户管理/新增用户", businessType = BusinessType.POST, isSaveRequestData = true)
-	@Transactional(rollbackFor = Throwable.class)
-	public Result<String> saveAdmin(@RequestBody @Validated CmsUserReq cmsUserReq) throws Exception {
-		Long adminId = StpUtil.getLoginIdAsLong();
-		CmsUser exist = cmsUserMapper.selectById(adminId);
-		if (exist == null) {
-			throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
-		}
-		CmsUser cmsUser = new CmsUser();
-		BeanUtil.copyProperties(cmsUserReq, cmsUser);
-		if (StringUtils.isNotBlank(cmsUserReq.getPassword())) {
-			cmsUser.setPassword(Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(cmsUserReq.getPassword()).toBase64String());
-		}
-		if (cmsUser.getId() == null) {
-			CmsUser ad = cmsUserMapper.selectOne(new LambdaQueryWrapper<CmsUser>().eq(CmsUser::getPhone, cmsUser.getPhone()).last("limit 1"));
-			if (ad != null) {
-				throw BusinessRuntimeException.getInstance("该账号已存在.");
-			}
-		}
-		boolean mobile = Validator.isMobile(cmsUser.getPhone());
-		if (!mobile) {
-			throw BusinessRuntimeException.getInstance("请输入正确的手机号");
-		}
-
-		try {
-			cmsUserMapper.insert(cmsUser);
-			//保存用户角色关系
-			cmsUserManager.saveUserRoleRelation(cmsUser.getId(), cmsUserReq.getRoleIds());
-		} catch (DuplicateKeyException e) {
-			throw BusinessRuntimeException.getInstance("手机号重复");
-		}
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除管理员
-	 */
-	@DeleteMapping("/delete/{id}")
-	@Log(module = "用户管理/删除用户", businessType = BusinessType.DELETE)
-	public Result<String> deleteAdminById(@PathVariable Long id) throws Exception {
-		Long adminId = StpUtil.getLoginIdAsLong();
-		CmsUser exist = cmsUserMapper.selectById(adminId);
-		if (exist == null) {
-			throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
-		}
-		//是不是客服
-		CmsUserVO isCustomer = beanSearcher.searchFirst(CmsUserVO.class, MapUtils.builder()
-				.field(CmsUserVO::getId, id)
-				.build());
-		if (isCustomer == null) {
-			throw BusinessRuntimeException.getInstance("被删除的用户不存在");
-		}
-
-		if (id.equals(adminId)) {
-			throw BusinessRuntimeException.getInstance("无法删除自己");
-		}
-		//是商务直接删除比例
-		userBusinessRateService.deleteBusinessRateByUid(adminId);
-
-		if (isCustomer.getRoleNames().contains("客服")) {
-			//是否未修改密码的账号
-			cmsAccountService.assignDeleteCustomerAccount(id);
-		}
-
-		//删除用户角色关联关系、缓存
-		cmsUserManager.delUserRoleRelation(id);
-		cmsUserMapper.deleteById(id);
-		//删除用户,将上线的用户踢下
-		StpUtil.logoutByLoginId(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除成功");
-	}
-
-	/**
-	 * 编辑管理员
-	 */
-	@PutMapping("/put")
-	@Log(module = "用户管理/编辑用户", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> editAdmin(@RequestBody CmsUserReq cmsUserReq) throws Exception {
-		Long adminId = StpUtil.getLoginIdAsLong();
-		CmsUser exist = cmsUserMapper.selectById(adminId);
-		if (exist == null) {
-			throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
-		}
-		CmsUser user = cmsUserMapper.selectById(cmsUserReq.getId());
-		if (cmsUserReq.getId() == null || user == null) {
-			throw BusinessRuntimeException.getInstance("账号不存在");
-		}
-		Boolean flag = false;
-		if (StrUtil.isNotEmpty(cmsUserReq.getPhone())) {
-			boolean mobile = Validator.isMobile(cmsUserReq.getPhone());
-			if (!mobile) {
-				throw BusinessRuntimeException.getInstance("请输入正确的手机号");
-			}
-			if (!cmsUserReq.getPhone().equals(user.getPhone())) {
-				flag = true;
-			}
-		}
-		if (StrUtil.isNotEmpty(cmsUserReq.getPassword())) {
-			String encodePwd = Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(cmsUserReq.getPassword()).toBase64String();
-			cmsUserReq.setPassword(encodePwd);
-			if (!encodePwd.equals(user.getPassword())) {
-				flag = true;
-				user.setPassword(encodePwd);
-			}
-		}
-		user.setNickname(cmsUserReq.getNickname());
-		if (StrUtil.isNotBlank(cmsUserReq.getRoleIds())) {
-			cmsUserManager.delUserRoleRelation(user.getId());
-			cmsUserManager.saveUserRoleRelationAndCache(user, cmsUserReq.getRoleIds());
-		}
-		user.setPhone(cmsUserReq.getPhone());
-		user.setModifiedBy(exist.getNickname());
-		cmsUserMapper.updateById(user);
-		if (flag) {
-			StpUtil.logoutByLoginId(cmsUserReq.getId());
-		}
-		//是不是客服
-		CmsUserVO isCustomer = beanSearcher.searchFirst(CmsUserVO.class, MapUtils.builder()
-				.field(CmsUserVO::getId, cmsUserReq.getId())
-				.build());
-		if (isCustomer != null && !isCustomer.getRoleNames().contains("客服")) {
-			//是否未修改密码的账号
-			cmsAccountService.assignDeleteCustomerAccount(cmsUserReq.getId());
-		}
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑成功");
-	}
-
-	@PutMapping("/put/status/{id}")
-	public Result<String> updateUserStatus(@PathVariable("id") Integer id) {
-		if (id == null || id < 1) {
-			throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_USER_NO_FIND);
-		}
-		CmsUser cmsUser = cmsUserMapper.selectById(id);
-		if (cmsUser == null) {
-			throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_USER_NO_FIND);
-		}
-		cmsUser.setStatus(!cmsUser.getStatus());
-		cmsUserMapper.updateById(cmsUser);
-		if (!cmsUser.getStatus()) {
-			//状态为禁用时,将上线的用户下线
-			StpUtil.logoutByLoginId(cmsUser.getId());
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("用户状态变更成功");
-	}
-
-	@SneakyThrows
-	@PutMapping("/put/reset/pwd/{id}")
-	public Result<String> resetPwd(@PathVariable("id") Integer id) {
-		CmsUser cmsUser = cmsUserMapper.selectById(id);
-		cmsUser.setPassword(Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(Constant.INITIAL_PASSWORD).toBase64String());
-		cmsUserMapper.updateById(cmsUser);
-		cacheService.saveUser(cmsUser.getId());
-		return GatewayResponse.SUCCESS.newBuilder().toResult("重置密码成功");
-	}
-
-	/**
-	 * 手机号获取登录信息
-	 */
-	@GetMapping("/get/loginInfo")
-	public Result<AdminInfo> getLoginInfo(String phone, String code) throws Exception {
-		CmsUser admin = cmsUserMapper.selectOne(
-				new QueryWrapper<CmsUser>().lambda().eq(CmsUser::getPhone, phone).last("limit 1"));
-		if (null == admin) {
-			throw BusinessRuntimeException.getInstance("该用户不存在.");
-		}
-		if (StrUtil.hasEmpty(phone, code)) {
-			throw BusinessRuntimeException.getInstance("请输入对应信息");
-		}
-		DateTime now = DateTime.now();
-		PhoneCode phoneCode = phoneCodeMapper.selectOne(Wrappers.lambdaQuery(PhoneCode.class).eq(PhoneCode::getPhone, phone).last("limit 1"));
-		if (phoneCode == null || StrUtil.isEmpty(phoneCode.getCode())) {
-			throw BusinessRuntimeException.getInstance("请重新获取手机验证码");
-		}
-		//3分钟失效
-		Date updateTime = phoneCode.getUpdateTime();
-		DateTime afterFiveMinutes = DateUtil.offsetMinute(updateTime, 3);
-		if (now.isAfter(afterFiveMinutes)) {
-			throw BusinessRuntimeException.getInstance("手机验证码已失效,请重新获取");
-		}
-		if (!StrUtil.equals(code, phoneCode.getCode())) {
-			throw BusinessRuntimeException.getInstance("手机验证码错误,请重新输入");
-		}
-		// 生成token
-
-		StpUtil.login(admin.getId());
-
-		String token = StpUtil.getTokenValue();
-
-		admin.setPassword("");
-
-		AdminInfo info = new AdminInfo();
-		info.setInfo2(admin);
-		info.setToken(token);
-
-		//缓存用户信息
-		cmsUserManager.loadUserRedisCache(admin);
-
-		//用户权限
-		info.setPermissions(cmsUserManager.getUserPermissions(admin.getId()));
-
-		//用户角色
-		info.setRoles(cmsUserManager.getUserRoles(admin.getId()));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(info);
-	}
-
-	@GetMapping("/get/list")
-	public Result<SearchResult<CmsUserVO>> list(String roleNames) {
-		long userId = StpUtil.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (StrUtil.isNotEmpty(roleNames) && roleNames.contains("客服")) {
-			CmsUser user = cmsUserManager.getUser(userId);
-			if (user != null && user.getRoleNames() != null && user.getRoleNames().contains("客服")) {
-				builder.field(CmsUserVO::getId, userId);
-			}
-		}
-		SearchResult<CmsUserVO> search = beanSearcher.search(CmsUserVO.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 123
netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/CmsMenuController.java

@@ -1,123 +0,0 @@
-package com.cyksj.web.controller.manage.cms;
-
-import cn.dev33.satoken.stp.StpUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.manage.cms.CmsMenuMapper;
-import com.cyksj.mapper.manage.cms.CmsRoleMenuMapper;
-import com.cyksj.model.entity.CmsMenu;
-import com.cyksj.model.entity.CmsRoleMenu;
-import com.cyksj.model.entity.CmsUser;
-import com.cyksj.model.views.CmsMenuVO;
-import com.cyksj.service.mange.cms.CmsUserManager;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/*
- *项目名: netflix
- *文件名: CmsMenuController
- *创建者: JavaZou
- *创建时间:2023/1/11 14:26
- */
-@RestController
-@RequestMapping("/manage/menu")
-@RequiredArgsConstructor
-@Slf4j
-public class CmsMenuController {
-	private final CmsMenuMapper cmsMenuMapper;
-
-	private final CmsUserManager cmsUserManager;
-
-	private final CmsRoleMenuMapper cmsRoleMenuMapper;
-
-	@PostMapping("/post")
-	public Result<String> addMenu(@RequestBody @Validated CmsMenu cmsMenu) {
-		cmsMenuMapper.insert(cmsMenu);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("新增菜单成功");
-	}
-
-	@PutMapping("/put")
-	public Result<String> putMenu(@RequestBody CmsMenu cmsMenu) throws Exception {
-		if (cmsMenu.getId() == null || cmsMenu.getId() < 1) {
-			throw BusinessRuntimeException.getInstance("菜单不存在");
-		}
-		CmsMenu menu = cmsMenuMapper.selectById( cmsMenu.getId());
-		BeanUtils.copyProperties(cmsMenu, menu);
-		cmsMenuMapper.updateById(menu);
-		//更新该菜单关联的权限
-		List<CmsUser> cmsUserList = cmsMenuMapper.getAllCmsUserByMenuId(cmsMenu.getId());
-		if (null != cmsUserList) {
-			for (CmsUser cmsUser : cmsUserList) {
-				cmsUserManager.loadUserRedisCache(cmsUser);
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑菜单成功");
-	}
-
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteMenuById(@PathVariable("id") Long id) throws Exception {
-		if (id == null || id < 1) {
-			throw BusinessRuntimeException.getInstance("菜单不存在");
-		}
-		List<CmsUser> cmsUserList = cmsMenuMapper.getAllCmsUserByMenuId(id);
-		if (null != cmsUserList) {
-			for (CmsUser cmsUser : cmsUserList) {
-				cmsUserManager.loadUserRedisCache(cmsUser);
-			}
-		}
-		cmsRoleMenuMapper.delete(Wrappers.lambdaQuery(CmsRoleMenu.class).eq(CmsRoleMenu::getMenuId, id));
-		cmsMenuMapper.deleteMenuAndChild(id);
-		cmsMenuMapper.delete(Wrappers.lambdaQuery(CmsMenu.class).eq(CmsMenu::getId, id).or().eq(CmsMenu::getParentId, id));
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除菜单成功");
-	}
-
-	@GetMapping("/get")
-	public Result<List<CmsMenuVO>> getMenuList() {
-		Map<Long, List<CmsMenuVO>> idMenusMap = cmsMenuMapper.getALlMenu().stream().collect(Collectors.groupingBy(CmsMenu::getParentId));
-		List<CmsMenuVO> list = cmsMenuMapper.getCmsMenusList();
-		for (CmsMenuVO cmsMenuVO : list) {
-			findChildMenu(cmsMenuVO, idMenusMap);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	@GetMapping("/get/noPerms")
-	public Result<List<CmsMenuVO>> getNoPermsALLMenu() {
-		Map<Long, List<CmsMenuVO>> idMenusMap = cmsMenuMapper.getALlMenu().stream().collect(Collectors.groupingBy(CmsMenu::getParentId));
-		List<CmsMenuVO> list = cmsMenuMapper.getCmsMenusList();
-		for (CmsMenuVO cmsMenuVO : list) {
-			findChildMenu(cmsMenuVO, idMenusMap);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	@GetMapping("/get/self/menu")
-	public Result<List<CmsMenuVO>> getSelfMenuList() {
-		List<CmsMenuVO> allSelf = cmsMenuMapper.getSelfCmsMenusList(StpUtil.getLoginIdAsLong());
-		Map<Long, List<CmsMenuVO>> idMenusMap = allSelf.stream().collect(Collectors.groupingBy(CmsMenu::getParentId));
-		List<CmsMenuVO> list = allSelf.stream().filter(vo -> vo.getParentId() == 0).collect(Collectors.toList());
-		for (CmsMenuVO cmsMenuVO : list) {
-			findChildMenu(cmsMenuVO, idMenusMap);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	private void findChildMenu(CmsMenuVO cmsMenuVO, Map<Long, List<CmsMenuVO>> idMenusMap) {
-		List<CmsMenuVO> list = idMenusMap.get(cmsMenuVO.getId());
-		cmsMenuVO.setHasChildren(false);
-		if (list != null && list.size() > 0) {
-			cmsMenuVO.setChild(list);
-			cmsMenuVO.setHasChildren(true);
-			list.forEach(child -> findChildMenu(child, idMenusMap));
-		}
-	}
-}

+ 0 - 142
netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/CmsRoleController.java

@@ -1,142 +0,0 @@
-package com.cyksj.web.controller.manage.cms;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.manage.cms.CmsRoleMapper;
-import com.cyksj.mapper.manage.cms.CmsRoleMenuMapper;
-import com.cyksj.model.entity.CmsRole;
-import com.cyksj.model.entity.CmsRoleMenu;
-import com.cyksj.model.entity.CmsUser;
-import com.cyksj.model.request.CmsRoleReq;
-import com.cyksj.service.mange.cms.CmsUserManager;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Arrays;
-import java.util.List;
-
-/*
- *项目名: netflix
- *文件名: CmsRoleController
- *创建者: JavaZou
- *创建时间:2023/1/11 14:26
- */
-@RestController
-@RequestMapping("/manage/role")
-@RequiredArgsConstructor
-@Slf4j
-public class CmsRoleController {
-	private final CmsRoleMapper cmsRoleMapper;
-
-	private final CmsRoleMenuMapper cmsRoleMenuMapper;
-
-	private final CmsUserManager cmsUserManager;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	@PostMapping("/post")
-	public Result<String> addRole(@RequestBody @Validated CmsRoleReq cmsRoleReq) {
-		try {
-			CmsRole cmsRole = new CmsRole();
-			BeanUtils.copyProperties(cmsRoleReq, cmsRole);
-			cmsRoleMapper.insert(cmsRole);
-			cmsRoleReq.setId(cmsRole.getId());
-			if (StrUtil.isNotEmpty(cmsRoleReq.getMenuIds())) {
-				saveRoleMenuRelation(cmsRoleReq);
-			}
-		} catch (DuplicateKeyException keyEx) {
-			throw BusinessRuntimeException.getInstance("角色名重复");
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("新增角色成功");
-	}
-
-	@PostMapping("/put")
-	public Result<String> putRole(@RequestBody CmsRoleReq cmsRoleReq) throws Exception {
-		if (cmsRoleReq.getId() == null || cmsRoleReq.getId() < 0) {
-			throw BusinessRuntimeException.getInstance("角色不存在");
-		}
-		if (StrUtil.isEmpty(cmsRoleReq.getMenuIds())) {
-			throw BusinessRuntimeException.getInstance("请选择对应的菜单");
-		}
-		CmsRole cmsRole = cmsRoleMapper.selectById(cmsRoleReq.getId());
-		Boolean isFlag = false;
-		if (StrUtil.isNotBlank(cmsRoleReq.getRoleName())) {
-			cmsRole.setRoleName(cmsRoleReq.getRoleName());
-			isFlag = true;
-		}
-		if (StrUtil.isNotBlank(cmsRoleReq.getRemark())) {
-			cmsRole.setRemark(cmsRoleReq.getRemark());
-			isFlag = true;
-		}
-		if (isFlag) {
-			cmsRoleMapper.updateById(cmsRole);
-		}
-		cmsRoleMenuMapper.delete(Wrappers.lambdaQuery(CmsRoleMenu.class).eq(CmsRoleMenu::getRoleId, cmsRoleReq.getId()));
-		if (StrUtil.isNotBlank(cmsRoleReq.getMenuIds())) {
-			this.saveRoleMenuRelation(cmsRoleReq);
-		}
-		//查出所关联该角色的所有用户
-		List<CmsUser> cmsUserList = cmsRoleMapper.getAllCmsUserByRoleId(cmsRoleReq.getId());
-		if (cmsUserList != null) {
-			for (CmsUser cmsUser : cmsUserList) {
-				//更新缓存
-				cmsUserManager.loadUserRedisCache(cmsUser);
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("更新角色成功");
-	}
-
-	@DeleteMapping("/delete/{id}")
-	public Result<String> delRoleById(@PathVariable("id") Long id) {
-		if (id == null || id < 0) {
-			throw BusinessRuntimeException.getInstance("角色不存在");
-		}
-		List<CmsUser> cmsUserList = cmsRoleMapper.getAllCmsUserByRoleId(id);
-		if (null != cmsUserList && !cmsUserList.isEmpty()) {
-			throw BusinessRuntimeException.getInstance("请先删除该角色关联下的用户");
-		}
-		cmsRoleMenuMapper.delete(Wrappers.lambdaQuery(CmsRoleMenu.class).eq(CmsRoleMenu::getRoleId, id));
-		cmsRoleMapper.deleteById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除角色成功");
-	}
-
-
-	@GetMapping("/get")
-	public Result<SearchResult<CmsRole>> getRoleList() {
-		SearchResult<CmsRole> search = beanSearcher.search(CmsRole.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-	@GetMapping("/get/menu")
-	public Result<List<String>> getMenuByRoleId(String roleId) {
-		if (StrUtil.isEmpty(roleId)) {
-			throw BusinessRuntimeException.getInstance("角色不存在");
-		}
-		//目前是单个角色
-		List<String> menus = cmsRoleMapper.getAllMenusByRoleIds(roleId.split(","));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(menus);
-	}
-
-	@GetMapping("/get/detail/{roleId}")
-	public Result<CmsRole> getDetailByRoleId(@PathVariable("roleId") Integer roleId) {
-		return GatewayResponse.SUCCESS.newBuilder().toResult(cmsRoleMapper.selectById(roleId));
-	}
-
-	private void saveRoleMenuRelation(CmsRoleReq cmsRoleReq) {
-		Arrays.stream(cmsRoleReq.getMenuIds().split(",")).forEach(menuId -> {
-			cmsRoleMenuMapper.insert(new CmsRoleMenu(cmsRoleReq.getId(), Long.valueOf(menuId)));
-		});
-	}
-}

+ 0 - 35
netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/CmsSysController.java

@@ -1,35 +0,0 @@
-package com.cyksj.web.controller.manage.cms;
-
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.SysLog;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-/*
- *项目名: netflix
- *文件名: CmsSysController
- *创建者: JavaZou
- *创建时间:2023/3/9 10:44
- */
-@RestController
-@RequestMapping("/manage/sysLog")
-@RequiredArgsConstructor
-public class CmsSysController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	@GetMapping
-	public Result<SearchResult<SysLog>> sysLogListByCondition(){
-		SearchResult<SysLog> search = beanSearcher.search(SysLog.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 34
netflix-web/src/main/java/com/cyksj/web/controller/manage/cms/interceptor/StpInterfaceImpl.java

@@ -1,34 +0,0 @@
-package com.cyksj.web.controller.manage.cms.interceptor;
-
-import cn.dev33.satoken.stp.StpInterface;
-import com.cyksj.service.mange.cms.CmsUserManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/*
- *项目名: yicang-admin
- *文件名: Inter
- *创建者: JavaZou
- *创建时间:2022/9/30 10:34
- */
-@Component
-public class StpInterfaceImpl implements StpInterface {
-	@Autowired
-	private CmsUserManager cmsUserManager;
-
-	/**
-	 * 用户权限列表
-	 */
-	@Override
-	public List<String> getPermissionList(Object loginId, String loginType) {
-		return new ArrayList<>(cmsUserManager.getUserPermissions(Long.valueOf(loginId.toString())));
-	}
-
-	@Override
-	public List<String> getRoleList(Object loginId, String loginType) {
-		return new ArrayList<>(cmsUserManager.getUserRoles(Long.valueOf(loginId.toString())));
-	}
-}

+ 0 - 251
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CmsCorpFollowActiveCodeController.java

@@ -1,251 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.OrderDonMapper;
-import com.cyksj.mapper.corp.CorpFollowMapper;
-import com.cyksj.mapper.corp.CorpUserMapper;
-import com.cyksj.mapper.corp.CorpWelcomeTemplateMapper;
-import com.cyksj.mapper.manage.coupon.CouponMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.request.corp.Attachments;
-import com.cyksj.model.request.corp.CorpFollowContact;
-import com.cyksj.model.views.*;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.corp.CorpFollowDynamicConfigService;
-import com.cyksj.service.corp.CorpFollowService;
-import com.cyksj.service.sys.SysConfigService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/** admin/企业微信/客服活码
- *项目名: netflix
- *文件名: CmsCorpFollowActiveCodeController
- *创建者: JavaZou
- *创建时间:2023/7/6 18:36
- */
-@RestController
-@RequestMapping("/manage/corp")
-@RequiredArgsConstructor
-public class CmsCorpFollowActiveCodeController {
-
-	private final CorpFollowDynamicConfigService corpFollowDynamicConfigService;
-
-	private final CorpFollowService corpFollowService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final CouponMapper couponMapper;
-
-	private final OrderDonMapper orderDonMapper;
-
-	private final CorpUserMapper corpUserMapper;
-
-	private final RedisService redisService;
-
-	private final CorpWelcomeTemplateMapper corpWelcomeTemplateMapper;
-
-	private final SysConfigService sysConfigService;
-
-	private final HttpServletRequest request;
-
-	private final CorpFollowMapper corpFollowMapper;
-
-	/**
-	 * 获取企业成员列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<CorpFollow>> getCorpFollow() {
-		SearchResult<CorpFollow> search = beanSearcher.search(CorpFollow.class, MapUtils.flatBuilder(request.getParameterMap())
-				.onlySelect(CorpFollow::getId, CorpFollow::getUserid, CorpFollow::getName)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 编辑企业成员
-	 */
-	@PutMapping("/update/follow")
-	public Result<String> updateFollow(@RequestBody CorpFollow corpFollow) {
-		corpFollowMapper.updateById(corpFollow);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 生成动态配置
-	 */
-	@PostMapping("/post/config")
-	public Result<String> getCorpFollowConcat(@RequestBody CorpFollowContact corpFollowContact) throws Exception {
-		String body = corpFollowDynamicConfigService.corpFollowContactConfig(corpFollowContact);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(body);
-	}
-
-	/**
-	 * 可选客服配置
-	 */
-	@GetMapping("/get/available/follow")
-	public Result<List<SysCorpFollowView>> getAvailableFollow() {
-		List<SysCorpFollowView> corpFollowServiceDtos = beanSearcher.searchAll(SysCorpFollowView.class, MapUtils.builder().build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpFollowServiceDtos);
-	}
-
-	/**
-	 * 创建活动活码
-	 */
-	@PostMapping("/post/active/code")
-	public Result<String> postActiveCode(@RequestBody @Validated CorpFollowActiveCode activeCode) throws Exception {
-		long adminId = StpUtil.getLoginIdAsLong();
-		corpFollowService.postActiveCode(adminId, activeCode);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑活动活码
-	 */
-	@PutMapping("/update/active/code")
-	public Result<String> upActiveCode(@RequestBody @Validated CorpFollowActiveCode activeCode) throws Exception {
-		corpFollowService.upActiveCode(activeCode);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除活码
-	 */
-	@DeleteMapping("/del/active/code/{id}")
-	public Result<String> deleteByAcCodeById(@PathVariable Long id) throws Exception {
-		corpFollowService.deleteActiveCodeById(id);
-		Set<String> keys = redisService.keys(RedisService.key.CORP_FOLLOW_ACTIVE_CODE_KEY.getNameFormat(id, "*"));
-		redisService.del(keys.toArray(String[]::new));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 活动活码列表
-	 */
-	@GetMapping("/get/active/code")
-	public Result<SearchResult<CorpFollowActiveCodeView>> getActiveCodeList() {
-		SearchResult<CorpFollowActiveCodeView> search = beanSearcher.search(CorpFollowActiveCodeView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			Integer numOfUser = corpUserMapper.selectCount(Wrappers.lambdaQuery(CorpUser.class)
-					.eq(CorpUser::getAcId, data.getId()));
-			data.setNumOfUser(numOfUser);
-			Integer orderNum = orderDonMapper.selectCountActiveCodeOrderByAcId(data.getId());
-			data.setOrderNum(orderNum);
-			try {
-				data.setUserIndxList(Jsons.parseList(data.getFollowStr(), Integer.class));
-				if (StrUtil.isNotBlank(data.getAttachmentsStr())) {
-					data.setAttachments(Jsons.parseList(data.getAttachmentsStr(), Attachments.class));
-				}
-			} catch (Exception e) {
-			}
-			CorpWelcomeTemplate corpWelcomeTemplate = corpWelcomeTemplateMapper.selectById(data.getMsgId());
-			if (corpWelcomeTemplate != null) {
-				data.setMsgName(corpWelcomeTemplate.getName());
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 查看活码人数列表
-	 */
-	@GetMapping("/get/active/code/userList")
-	public Result<SearchResult<CorpUser>> getCorpActiveCodeUser() {
-		MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-		SearchResult<CorpUser> search = beanSearcher.search(CorpUser.class, mapBuilder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 查看活码订单 详情
-	 */
-	@GetMapping("/get/active/code/orderDetail")
-	public Result<SearchResult<CorpActiveCodeOrderView>> getCorpActiveCodeOrderView(Long id) {
-		MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-		if (id != null) {
-			mapBuilder.put("acId", String.format(" and cu.ac_id = %s", id));
-		}
-		SearchResult<CorpActiveCodeOrderView> search = beanSearcher.search(CorpActiveCodeOrderView.class, mapBuilder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 活码 平台订单数据
-	 */
-	@GetMapping("/get/active/code/goods/order")
-	public Result<SearchResult<CorpActiveCodeGoodsOrderView>> getCorpActiveCodeGoodsOrder(Long id, String startTime, String endTime) {
-		String timeSql = StringUtils.EMPTY;
-		if (StringUtils.isNotBlank(startTime)) {
-			timeSql += " and o.created_time >= '" + startTime + "'";
-		}
-		if (StringUtils.isNotBlank(endTime)) {
-			timeSql += " and o.created_time <= '" + endTime + "'";
-		}
-		MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-		if (id != null) {
-			mapBuilder.put("acId", String.format(" and cu.ac_id = %s", id));
-		}
-		if (StrUtil.isNotBlank(timeSql)) {
-			mapBuilder.put("time", timeSql);
-		}
-		SearchResult<CorpActiveCodeGoodsOrderView> search = beanSearcher.search(CorpActiveCodeGoodsOrderView.class, mapBuilder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 活码订单详情头部信息
-	 */
-	@GetMapping("/get/active/code/order/headData")
-	public Result<CorpFollowActiveCodeView> getActiveCodeOrderHeadDataView(Long id, String startTime, String endTime) {
-		CorpFollowActiveCodeView view = new CorpFollowActiveCodeView();
-		view.setId(id);
-		MapBuilder builder = MapUtils.builder();
-		if (startTime != null && endTime != null) {
-			builder.field(CorpFollowActiveCodeClickRecord::getCreatedTime, startTime, endTime).op(Operator.Between);
-		}
-		Number clickNumber = beanSearcher.searchCount(CorpFollowActiveCodeClickRecord.class, builder.build());
-		Map<String, Object> map = orderDonMapper.selectActiveCodeOrderDetail(view.getId(), startTime, endTime);
-		Object orderNum = map.get("orderNum");
-		Object orderMoney = map.get("orderMoney");
-		view.setClickNum(clickNumber.intValue());
-		if (orderNum != null) {
-			view.setOrderNum(Integer.parseInt(orderNum.toString()));
-		}
-		if (orderMoney != null) {
-			view.setOrderMoney(BigDecimal.valueOf(Long.valueOf(orderMoney.toString())));
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(view);
-	}
-
-	/**
-	 * 活码人数每日添加详情
-	 * @param acId 活码记录id
-	 * @return
-	 */
-	@GetMapping("/get/statistics/user/data/{acId}")
-	public Result<SearchResult<CorpActiveCodeUserDayDataView>> getAcUserDayData(@PathVariable Long acId) {
-		String condition = String.format("ac_id = %s", acId);
-		SearchResult<CorpActiveCodeUserDayDataView> search = beanSearcher.search(CorpActiveCodeUserDayDataView.class, MapUtils.flatBuilder(request.getParameterMap()).put("condition", condition)
-				.orderBy(CorpActiveCodeUserDayDataView::getDate).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 65
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpChatController.java

@@ -1,65 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import cn.hutool.core.util.StrUtil;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.views.CorpGroupChatDetailView;
-import com.cyksj.model.views.CorpGroupChatView;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-/*
- *项目名: netflix
- *文件名: CorpChatController
- *创建者: JavaZou
- *创建时间:2023/6/26 16:24
- */
-@RestController
-@RequestMapping("/manage/corp/group/chat")
-@RequiredArgsConstructor
-public class CorpChatController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	/**
-	 * 客户群列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<CorpGroupChatView>> getGroupsChatList() {
-		SearchResult<CorpGroupChatView> search = beanSearcher.search(CorpGroupChatView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 客户群详情
-	 */
-	@GetMapping("/get/detail/{id}")
-	public Result<SearchResult<CorpGroupChatDetailView>> getGroupsDetail(@PathVariable Long id, Long goodsId, Boolean exists) {
-		String condition = StrUtil.EMPTY;
-		if (goodsId != null) {
-			String connect = (exists == null || exists) ? "in" : "not in";
-			condition += String.format("user_id %s (select gr.user_id from (select gt.id from groups_trips gt inner join goods_don_sku sku on sku.id = gt.sku_id and goods_id = %s) s inner join groups_relation gr on gr.groups_id = s.id)", connect, goodsId);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap())
-				.field(CorpGroupChatDetailView::getGroupChatId, id);
-		if (StrUtil.isNotBlank(condition)) {
-			builder.put("condition", condition);
-		}
-		SearchResult<CorpGroupChatDetailView> search = beanSearcher.search(CorpGroupChatDetailView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}
-
-
-
-

+ 0 - 196
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpCustomerAcquistionLinkController.java

@@ -1,196 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.SysCorpFollowRelateMapper;
-import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkExtraCustomerMapper;
-import com.cyksj.mapper.corp.CorpFollowMapper;
-import com.cyksj.mapper.corp.CorpTagMapper;
-import com.cyksj.mapper.corp.CorpWelcomeTemplateMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.views.CorpCustomerAcquisitionLinkExtraCustomerView;
-import com.cyksj.model.views.SysCorpFollowView;
-import com.cyksj.service.corp.CorpCustomerAcquisitionLinkService;
-import com.cyksj.service.sys.SysConfigService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- *  获客助手
- * @author chan
- * @date 2023/11/10 09:53
- */
-@RestController
-@RequestMapping("/manage/corp/customer/acuistion/link")
-@RequiredArgsConstructor
-public class CorpCustomerAcquistionLinkController {
-
-    private final CorpCustomerAcquisitionLinkService corpCustomerAcquisitionLinkService;
-
-    private final CorpFollowMapper corpFollowMapper;
-
-    private final CorpTagMapper corpTagMapper;
-
-    private final CorpWelcomeTemplateMapper corpWelcomeTemplateMapper;
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final SysConfigService sysConfigService;
-
-    private final CorpCustomerAcquisitionLinkExtraCustomerMapper corpCustomerAcquisitionLinkExtraCustomerMapper;
-
-    private final SysCorpFollowRelateMapper sysCorpFollowRelateMapper;
-
-    /**
-     * 新增获客助手链接
-     */
-    @PostMapping
-    public Result<String> add(@RequestBody CorpCustomerAcquisitionLink corpCustomerAcquisitionLink) throws Exception {
-        corpCustomerAcquisitionLinkService.add(corpCustomerAcquisitionLink);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 修改获客助手链接
-     */
-    @PutMapping
-    public Result<String> up(@RequestBody CorpCustomerAcquisitionLink corpCustomerAcquisitionLink) throws Exception {
-        corpCustomerAcquisitionLinkService.up(corpCustomerAcquisitionLink);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 删除获客助手链接
-     */
-    @DeleteMapping("/{id}")
-    public Result<String> up(@PathVariable Long id) throws Exception {
-        corpCustomerAcquisitionLinkService.del(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 获取获客助手链接
-     */
-    @GetMapping("/get")
-    public Result<SearchResult<CorpCustomerAcquisitionLink>> get() throws Exception {
-        SearchResult<CorpCustomerAcquisitionLink> search = beanSearcher.search(CorpCustomerAcquisitionLink.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-
-        List<SysCorpFollowView> corpFollowServiceDtos = beanSearcher.searchAll(SysCorpFollowView.class, MapUtils.builder().build());
-
-        search.getDataList().forEach(e -> {
-            try {
-                List<String> userStrList = corpFollowServiceDtos.stream().filter(cf -> {
-                    try {
-                        return Jsons.parseList(e.getUserList(), Long.class).contains(cf.getSid());
-                    } catch (Exception ex) {
-                    }
-                    return false;
-                }).map(SysCorpFollowView::getShowName).collect(Collectors.toList());
-                e.setUserStrList(userStrList);
-
-                if (StrUtil.isNotEmpty(e.getChooseDutyUsers())) {
-                    List<String> dutyUserList = corpFollowServiceDtos.stream().filter(cf -> {
-                        try {
-                            return Jsons.parseList(e.getChooseDutyUsers(), Long.class).contains(cf.getSid());
-                        } catch (Exception ex) {
-                        }
-                        return false;
-                    }).map(SysCorpFollowView::getShowName).collect(Collectors.toList());
-
-                    e.setChooseDutyUserList(dutyUserList);
-                }
-
-                List<String> tagStrList = corpTagMapper.selectList(Wrappers.lambdaQuery(CorpTag.class)
-                        .in(CorpTag::getId, Jsons.parseList(e.getTags(), Long.class))).stream().map(CorpTag::getName).collect(Collectors.toList());
-                e.setTagStrList(tagStrList);
-            } catch (Exception ex) {
-            }
-
-            CorpWelcomeTemplate corpWelcomeTemplate = corpWelcomeTemplateMapper.selectById(e.getMsgId());
-            if (corpWelcomeTemplate != null) {
-                e.setMsgName(corpWelcomeTemplate.getName());
-            }
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 针对获客链接添加额外客服
-     */
-    @PostMapping("/add/extra/service")
-    public Result<String> addExtraService(@RequestBody @Validated CorpCustomerAcquisitionLinkExtraCustomer extraCustomer) throws Exception {
-        Integer serviceId = extraCustomer.getServiceId();
-        SysCorpFollowRelate sysCorpFollowRelate = sysCorpFollowRelateMapper.selectById(serviceId);
-        extraCustomer.setFollowId(sysCorpFollowRelate.getFollowId());
-        corpCustomerAcquisitionLinkExtraCustomerMapper.insert(extraCustomer);
-        corpCustomerAcquisitionLinkService.handleCorpLinkSchedulerJob();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 修改获客链接添加额外客服
-     */
-    @PutMapping("/update/extra/service")
-    public Result<String> updateExtraService(@RequestBody @Validated CorpCustomerAcquisitionLinkExtraCustomer extraCustomer) throws Exception {
-        Integer serviceId = extraCustomer.getServiceId();
-        SysCorpFollowRelate sysCorpFollowRelate = sysCorpFollowRelateMapper.selectById(serviceId);
-        extraCustomer.setFollowId(sysCorpFollowRelate.getFollowId());
-	    corpCustomerAcquisitionLinkExtraCustomerMapper.updateById(extraCustomer);
-        corpCustomerAcquisitionLinkService.handleCorpLinkSchedulerJob();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 删除获客链接添加额外客服
-     */
-    @DeleteMapping("/del/extra/service/{id}")
-    public Result<String> delExtraService(@PathVariable Long id) {
-	    Optional.ofNullable(corpCustomerAcquisitionLinkExtraCustomerMapper.selectById(id))
-			    .ifPresent(e -> {
-				    if (e.getDeleted()) {
-                        try {
-                            e.setDeleted(false);
-                            corpCustomerAcquisitionLinkExtraCustomerMapper.updateById(e);
-                            corpCustomerAcquisitionLinkService.handleCorpLinkSchedulerJob();
-                        } catch (Exception ex) {
-                        }
-                    }
-			    });
-	    return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 获取获客链接添加额外客服
-     */
-    @GetMapping("/get/extra/service")
-    public Result<SearchResult<CorpCustomerAcquisitionLinkExtraCustomerView>> getExtraService() throws Exception {
-        SearchResult<CorpCustomerAcquisitionLinkExtraCustomerView> search = beanSearcher.search(CorpCustomerAcquisitionLinkExtraCustomerView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .orderBy(CorpCustomerAcquisitionLinkExtraCustomerView::getAcId).asc()
-                .orderBy(CorpCustomerAcquisitionLinkExtraCustomerView::getCreatedTime).desc()
-                .build());
-        List<SysCorpFollowView> corpFollowServiceDtos = beanSearcher.searchAll(SysCorpFollowView.class, MapUtils.builder().build());
-        Map<Long, List<SysCorpFollowView>> serviceMap = corpFollowServiceDtos.stream().collect(Collectors.groupingBy(SysCorpFollowView::getSid));
-        search.getDataList().forEach(e->{
-            Optional.ofNullable(serviceMap.get(e.getServiceId()))
-                    .ifPresent(service -> e.setServiceName(service.get(0).getShowName()));
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-}

+ 0 - 93
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpCustomerAcquistionLinkPopularizeController.java

@@ -1,93 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.EnvCommonService;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.CorpCustomerAcquisitionLinkPopularize;
-import com.cyksj.model.views.CorpCustomerAcquisitionLinkPopularizeView;
-import com.cyksj.service.corp.CorpCustomerAcquisitionLinkPopularizeService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- *  获客助手
- * @author chan
- * @date 2023/11/10 09:53
- */
-@RestController
-@RequestMapping("/v2/corp/customer/acuistion/popularize")
-@RequiredArgsConstructor
-public class CorpCustomerAcquistionLinkPopularizeController {
-    private final CorpCustomerAcquisitionLinkPopularizeService corpCustomerAcquisitionLinkPopularizeService;
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final EnvCommonService envCommonService;
-
-    /**
-     * 创建加粉链接
-     */
-    @PostMapping
-    public Result<String> add(@RequestBody CorpCustomerAcquisitionLinkPopularize corpCustomerAcquisitionLinkPopularize){
-        CorpCustomerAcquisitionLinkPopularize linkPopularize = corpCustomerAcquisitionLinkPopularizeService.add(corpCustomerAcquisitionLinkPopularize);
-        StringBuilder url = new StringBuilder();
-        url.append(envCommonService.getNotifyHost()).append("applets/channel/customerAcquistion?projectid=__PROJECT_ID__&clickid=__CLICKID__&linkId=").append(linkPopularize.getId());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(url.toString());
-    }
-
-    /**
-     * 获取加粉链接
-     * @param id 推广链接id
-     * @return 加粉链接
-     */
-    @GetMapping("/{id}")
-    public Result<CorpCustomerAcquisitionLinkPopularize> get(@PathVariable Long id){
-        CorpCustomerAcquisitionLinkPopularize linkPopularize = corpCustomerAcquisitionLinkPopularizeService.
-                getOne(Wrappers.lambdaQuery(CorpCustomerAcquisitionLinkPopularize.class)
-                        .eq(CorpCustomerAcquisitionLinkPopularize::getPopularizeId, id)
-                        .last("limit 1"));
-        if (linkPopularize == null) {
-            throw BusinessRuntimeException.getInstance("请先创建加粉链接。");
-        }
-
-        StringBuilder url = new StringBuilder();
-        url.append(envCommonService.getNotifyHost()).append("applets/channel/customerAcquistion?projectid=__PROJECT_ID__&clickid=__CLICKID__&linkId=").append(linkPopularize.getId());
-
-        linkPopularize.setUrl(url.toString());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(linkPopularize);
-    }
-
-
-    /**
-     * 编辑加粉链接
-     */
-    @PutMapping
-    public Result<String> up(@RequestBody CorpCustomerAcquisitionLinkPopularize corpCustomerAcquisitionLinkPopularize){
-        CorpCustomerAcquisitionLinkPopularize popularize = corpCustomerAcquisitionLinkPopularizeService.getById(corpCustomerAcquisitionLinkPopularize.getId());
-        if (popularize  == null) {
-            throw BusinessRuntimeException.getInstance("该加粉链接不存在.");
-        }
-        corpCustomerAcquisitionLinkPopularizeService.updateById(corpCustomerAcquisitionLinkPopularize);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 加粉链接列表
-     */
-    @GetMapping("/get")
-    public Result<SearchResult<CorpCustomerAcquisitionLinkPopularizeView>> get(){
-        SearchResult<CorpCustomerAcquisitionLinkPopularizeView> search = beanSearcher.search(CorpCustomerAcquisitionLinkPopularizeView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-
-}

+ 0 - 131
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpInteractiveRadarController.java

@@ -1,131 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.corp.CorpInteractiveRadarUserRecordMapper;
-import com.cyksj.model.entity.CorpInteractiveRadar;
-import com.cyksj.model.entity.CorpInteractiveReaderLink;
-import com.cyksj.model.views.CorpInteractiveRadarOrderDataView;
-import com.cyksj.model.views.CorpInteractiveReaderOrderDetailView;
-import com.cyksj.model.views.CorpInteractiveReaderView;
-import com.cyksj.service.corp.CorpInteractiveRadarService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Map;
-
-/*
- *项目名: netflix
- *文件名: CorpInteractiveRadarController
- *创建者: JavaZou
- *创建时间:2023/8/4 16:27
- */
-@RestController
-@RequestMapping("/manage/corp/interactive/reader")
-@RequiredArgsConstructor
-public class CorpInteractiveRadarController {
-	private final CorpInteractiveRadarService corpInteractiveRadarService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final CorpInteractiveRadarUserRecordMapper corpInteractiveRadarUserRecordMapper;
-
-	/**
-	 * 新增互动雷达
-	 */
-	@PostMapping
-	public Result<String> saveInteractiveReader(@RequestBody @Validated CorpInteractiveRadar radar) {
-		corpInteractiveRadarService.saveOrUpdateRadar(radar);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑互动雷达
-	 */
-	@PutMapping
-	public Result<String> updateInteractiveReader(@RequestBody @Validated CorpInteractiveRadar radar) {
-		if (radar.getId() == null || corpInteractiveRadarService.getById(radar.getId()) == null) {
-			throw BusinessRuntimeException.getInstance("雷达链接不存在");
-		}
-		corpInteractiveRadarService.saveOrUpdateRadar(radar);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除互动雷达
-	 */
-	@DeleteMapping("/{id}")
-	public Result<String> deleteById(@PathVariable Long id) {
-		corpInteractiveRadarService.removeById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 互动雷达列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<CorpInteractiveReaderView>> get() {
-		SearchResult<CorpInteractiveReaderView> search = beanSearcher.search(CorpInteractiveReaderView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			if (data.getType() == 1) {
-				String linkInfoStr = data.getLinkInfoStr();
-				try {
-					CorpInteractiveReaderLink linkInfo = Jsons.parseObject(linkInfoStr, CorpInteractiveReaderLink.class);
-					data.setLinkInfo(linkInfo);
-				} catch (Exception e) {
-				}
-			}
-
-			Map<String, Long> map = corpInteractiveRadarUserRecordMapper.selectClickRecord(data.getId());
-			Integer clickNum = map.get("clickNum").intValue();
-			data.setClickNum(clickNum);
-			Integer clickUserNum = map.get("clickUserNum").intValue();
-			data.setClickUserNum(clickUserNum);
-
-			CorpInteractiveReaderOrderDetailView detailView = beanSearcher.searchFirst(CorpInteractiveReaderOrderDetailView.class, MapUtils.builder().put("id", String.format("id = %s", data.getId())).build());
-			data.setPayNum(detailView.getTotal());
-			data.setPayNewUserNum(detailView.getNumOfNewUser());
-			data.setPayOldUserNum(detailView.getNumOfOldUser());
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 购买人数详情
-	 */
-	@GetMapping("/get/payNum/detail/{id}")
-	public Result<CorpInteractiveReaderOrderDetailView> getPayNumDetailById(@PathVariable Long id) {
-		CorpInteractiveReaderOrderDetailView detailView = beanSearcher.searchFirst(CorpInteractiveReaderOrderDetailView.class, MapUtils.builder().put("id", String.format("id = %s", id)).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(detailView);
-	}
-
-
-	/**
-	 * 雷达数据
-	 */
-	@GetMapping("/get/data/{id}")
-	public Result<CorpInteractiveRadarOrderDataView> corpInteractiveRadarOrderDataViewResult(@PathVariable Long id) {
-		CorpInteractiveRadarOrderDataView view = new CorpInteractiveRadarOrderDataView();
-		DateTime beginOfDay = DateUtil.beginOfDay(DateTime.now());
-		String idEq = String.format(" cr.radar_id = %s", id);
-		String conditionSql = String.format(" %s and cr.created_time >= '%s'", idEq, beginOfDay.toString());
-		CorpInteractiveRadarOrderDataView.CorpInteractiveRadarOrderData today = beanSearcher.searchFirst(CorpInteractiveRadarOrderDataView.CorpInteractiveRadarOrderData.class, MapUtils.builder().put("condition", conditionSql).build());
-
-		CorpInteractiveRadarOrderDataView.CorpInteractiveRadarOrderData history = beanSearcher.searchFirst(CorpInteractiveRadarOrderDataView.CorpInteractiveRadarOrderData.class, MapUtils.builder().put("condition", idEq).build());
-
-		view.setToday(today);
-		view.setHistory(history);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(view);
-	}
-}

+ 0 - 130
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgAuditController.java

@@ -1,130 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.json.JSONUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.corp.CorpUserPayIntentionMapper;
-import com.cyksj.model.entity.CorpUserPayIntention;
-import com.cyksj.model.entity.QyMsgContent;
-import com.cyksj.model.manage.views.CorpFollowMsgView;
-import com.cyksj.model.manage.views.CorpMsgAuditUserView;
-import com.cyksj.service.corp.CorpQyMsgContentService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.operator.InList;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author chan
- * @date 2024/1/22 14:25
- */
-@RequiredArgsConstructor
-@Slf4j
-@RestController
-@RequestMapping("/manage/corp/msg/audit")
-public class CorpMsgAuditController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final CorpQyMsgContentService corpQyMsgContentService;
-
-    private final CorpUserPayIntentionMapper corpUserPayIntentionMapper;
-
-
-
-    /**
-     * 会话存档用户列表
-     * @param textKey 关键词搜索
-     * @param tagIds 标签筛选
-     * @return
-     */
-    @GetMapping
-    public Result<SearchResult<CorpMsgAuditUserView>> get(String textKey, @RequestParam(value = "tagIds", required = false) List<String> tagIds, Integer intention, Long talkStartTime, Long talkEndTime) throws Exception {
-        long adminId = StpUtil.getLoginIdAsLong();
-        Set<String> userIds = new HashSet<>();
-        if(StringUtils.isNotBlank(textKey)){
-            List<QyMsgContent> text = corpQyMsgContentService.list(Wrappers.lambdaQuery(QyMsgContent.class).select(QyMsgContent::getFrom, QyMsgContent::getExternalUserid,QyMsgContent::getTolist).like(QyMsgContent::getText, textKey).eq(QyMsgContent::getRoomid,"").eq(QyMsgContent::getMsgtype, "text"));
-            userIds = text.stream().map(QyMsgContent::getExternalUserid).collect(Collectors.toSet());
-        }
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        if (userIds.size() > 0) {
-            builder.field(CorpMsgAuditUserView::getExternalUserid,userIds).op(InList.class);
-        }
-        if(CollUtil.isNotEmpty(tagIds)){
-            StringBuilder tagStr = new StringBuilder();
-            if (tagIds.size() == 1) {
-                tagStr.append("=").append("'").append(tagIds.get(0)).append("'");
-            } else {
-                tagStr.append("in").append(Jsons.toJson(tagIds).replaceAll("\\[", "(").replaceAll("]", ")"));
-            }
-            builder.put("tag", String.format( "and cr.id = t.relation_id and t.tag_id %s", tagStr));
-            builder.put("tagTable", ",corp_user_tag t");
-        }
-        //管理员
-        if (adminId == 75l) {
-            builder.put("tagTable", ",corp_user_tag t");
-            builder.put("tag", String.format("and cr.id = t.relation_id and t.tag_id =  'etvj2DPQAAxqh9QlGJG4N1EbdQBNYGAA'"));
-        }
-        if (intention != null) {
-            builder.put("intention", String.format("and exists (select 1 from corp_user_pay_intention cup where cup.union_id = c.unionid and intention = %s limit 1)", intention));
-        }
-        if (talkEndTime != null && talkStartTime != null) {
-            builder.put("talkTime", String.format(" and exists (select 1 from qy_msg_content qmc where qmc.external_userid = cu.external_userid and qmc.msgtime between %s and %s)", talkStartTime, talkEndTime));
-        }
-        SearchResult<CorpMsgAuditUserView> search = beanSearcher.search(CorpMsgAuditUserView.class, builder.build());
-        search.getDataList().forEach(e -> {
-            Optional.ofNullable(corpUserPayIntentionMapper.selectOne(Wrappers.lambdaQuery(CorpUserPayIntention.class)
-                    .eq(CorpUserPayIntention::getUnionId, e.getUnionId())
-                    .last("limit 1"))).ifPresent(cu -> e.setIntention(cu.getIntention()));
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-
-    }
-
-    /**
-     * 获取会话列表
-     */
-    @GetMapping("/msgList")
-    public Result<SearchResult<CorpFollowMsgView>> msgList(String keyword){
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        if(StringUtils.isNotBlank(keyword)){
-            builder.put("keyword", String.format("where q.text like '%s%%')",keyword));
-        }
-        SearchResult<CorpFollowMsgView> search = beanSearcher.search(CorpFollowMsgView.class, builder.build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-
-    /**
-     * 获取聊天记录
-     */
-    @GetMapping("/getMsgByFollowIdAndUserId")
-    public Result<SearchResult<QyMsgContent>> getMsgByFollowIdAndUserId(){
-        Map<String, Object> build = MapUtils.flatBuilder(request.getParameterMap()).build();
-        log.info("获取聊天记录 param:{}", JSONUtil.toJsonStr(build));
-        if (!build.containsKey("followId") || !build.containsKey("externalUserid")){
-            throw BusinessRuntimeException.getInstance("缺少必填参数.");
-        }
-        SearchResult<QyMsgContent> search = beanSearcher.search(QyMsgContent.class, build);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-}

+ 0 - 311
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgBulkTaskController.java

@@ -1,311 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.corp.CorpMsgBulkTaskCategoryMapper;
-import com.cyksj.mapper.corp.CorpTagMapper;
-import com.cyksj.mapper.manage.coupon.CouponMapper;
-import com.cyksj.model.dto.CornMetaDto;
-import com.cyksj.model.entity.CorpMsgBulkTask;
-import com.cyksj.model.entity.CorpMsgBulkTaskCategory;
-import com.cyksj.model.entity.CorpMsgBulkTaskRecord;
-import com.cyksj.model.entity.CorpTag;
-import com.cyksj.model.excel.ExcelCorpMsgBulkTaskSendRecordData;
-import com.cyksj.model.request.CorpActiveBulkMsg;
-import com.cyksj.model.request.corp.Attachments;
-import com.cyksj.model.views.CorpMsgBulkTaskCorpFollowSendRecordView;
-import com.cyksj.model.views.CorpMsgBulkTaskSendRecordView;
-import com.cyksj.service.corp.CorpMsgBulkTaskService;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.cyksj.xxljob.XxlJobUtil;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/*
- *项目名: netflix
- *文件名: CorpMsgBulkTaskController
- *创建者: JavaZou
- *创建时间:2023/6/21 9:31
- */
-@RestController
-@RequestMapping("/manage/corpMsgBulkTask")
-@RequiredArgsConstructor
-public class CorpMsgBulkTaskController {
-
-	private final CorpMsgBulkTaskService corpMsgBulkTaskService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final CouponMapper couponMapper;
-
-	private final HttpServletRequest request;
-
-	private final CorpTagMapper corpTagMapper;
-
-	private final CorpMsgBulkTaskCategoryMapper corpMsgBulkTaskCategoryMapper;
-
-
-	/**
-	 * 新建群发
-	 */
-	@PostMapping("/post")
-	public Result<String> saveCorpMsgBulkTask(@RequestBody @Validated CorpMsgBulkTask corpMsgBulkTask) throws Exception {
-		corpMsgBulkTaskService.saveOrUpdateMsgBulkTask(corpMsgBulkTask);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("新建群发成功");
-	}
-
-
-	/**
-	 * 编辑群发
-	 */
-	@PutMapping("/put")
-	public Result<String> updateCorpMsgBulkTask(@RequestBody @Validated CorpMsgBulkTask corpMsgBulkTask) throws Exception {
-		corpMsgBulkTaskService.saveOrUpdateMsgBulkTask(corpMsgBulkTask);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("修改群发成功");
-	}
-
-	/**
-	 * 群发列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<CorpMsgBulkTask>> getCorpMsgBulkTaskList(String[] tagIds) {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (tagIds != null && tagIds.length > 0) {
-			List<String> collect = corpTagMapper.selectList(Wrappers.lambdaQuery(CorpTag.class)
-					.in(CorpTag::getId, tagIds)).stream().map(CorpTag::getTagId).collect(Collectors.toList());
-			if (CollUtil.isNotEmpty(collect)) {
-				StringBuilder sb = new StringBuilder();
-				for (String tagId : collect) {
-					sb.append("\"" + tagId + "\"");
-					sb.append(",");
-					String substring = sb.substring(0, sb.lastIndexOf(","));
-					builder.put("tag_id", String.format("id in (select distinct task_id from corp_msg_bulk_task_tag_relation where tag_id in(%s))", substring));
-				}
-			}
-		}
-		SearchResult<CorpMsgBulkTask> search = beanSearcher.search(CorpMsgBulkTask.class, builder
-				.field(CorpMsgBulkTask::getDeleted, true)
-				.orderBy(CorpMsgBulkTask::getId).desc()
-				.build());
-		search.getDataList().forEach(data -> {
-			try {
-				List<String> tagList = Jsons.parseList(data.getChooseTagStr(), String.class);
-				data.setTagSize(tagList.size());
-
-				if (StringUtils.isNotBlank(data.getCorn())) {
-					String[] s = data.getCorn().split(" ");
-					CornMetaDto cornMetaDto = new CornMetaDto();
-					cornMetaDto.setHour(s[2]);
-					cornMetaDto.setDay(StringPool.ASTERISK.equals(s[3]) ? "" : s[3]);
-					cornMetaDto.setMonth(StringPool.ASTERISK.equals(s[4]) ? "" : s[4]);
-					cornMetaDto.setWeek(StringPool.QUESTION_MARK.equals(s[5]) ? "" : s[5]);
-					data.setCornDto(cornMetaDto);
-				}
-				if (StrUtil.isNotBlank(data.getAttachmentsStr())) {
-					data.setAttachments(Jsons.parseList(data.getAttachmentsStr(), Attachments.class));
-				}
-				if (StrUtil.isNotEmpty(data.getCouponIds())) {
-					List<Long> couponIds = Jsons.parseList(data.getCouponIds(), Long.class);
-					data.setCouponName(couponMapper.getCouponNameByIds(couponIds));
-				}
-				if (data.getCategory() != null && data.getCategory() > 0) {
-					Optional.ofNullable(corpMsgBulkTaskCategoryMapper.selectById(data.getCategory())).ifPresent(e -> data.setCategoryName(e.getName()));
-				}
-			} catch (Exception e) {
-
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 标签详情
-	 */
-	@GetMapping("/get/tag/detail/{id}")
-	public Result<Map<String, List<CorpTag>>> getTagDetail(@PathVariable Long id) throws Exception {
-		Map<String, List<CorpTag>> collect = corpMsgBulkTaskService.getTagDetail(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(collect);
-	}
-
-	/**
-	 * 删除群发
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteBulkTaskList(@PathVariable Long id) throws Exception {
-		CorpMsgBulkTask task = corpMsgBulkTaskService.getById(id);
-		if (task == null || !task.getDeleted()) {
-			throw BusinessRuntimeException.getInstance("群发任务不存在");
-		}
-		task.setDeleted(!task.getDeleted());
-		corpMsgBulkTaskService.updateById(task);
-
-		if (task.getJobId() != null) {
-			XxlJobUtil.deleteJob(task.getJobId());
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 群发记录
-	 */
-	@GetMapping("/get/sendRecord/{id}")
-	public Result<SearchResult<CorpMsgBulkTaskSendRecordView>> getSendRecord(@PathVariable Long id, Long startTime, Long endTime) {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("task_id", String.format("task_id = %s", id));
-		String time = StrUtil.EMPTY;
-		if (startTime != null) {
-			time += String.format(" and created_time >= '%s'", DateTime.of(startTime));
-		}
-		if (endTime != null) {
-			time += String.format(" and created_time < '%s'", DateTime.of(endTime));
-		}
-		if (StrUtil.isNotEmpty(time)) {
-			builder.put("time", time);
-		}
-		SearchResult<CorpMsgBulkTaskSendRecordView> search = beanSearcher.search(CorpMsgBulkTaskSendRecordView.class, builder
-				.orderBy(CorpMsgBulkTaskSendRecordView::getCreateTime).desc()
-				.build());
-		search.getDataList().forEach(e -> {
-			e.setTotal(beanSearcher.searchSum(CorpMsgBulkTaskRecord.class, MapUtils.builder().field(CorpMsgBulkTaskRecord::getSendId, e.getSenId()).build(), "total").intValue());
-			e.setNotSend(e.getTotal() - e.getSend());
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 导出某任务群发记录
-	 */
-	@GetMapping("/export/sendRecord/{id}")
-	public void exportSendRecord(@PathVariable Long id, Long startTime, Long endTime, HttpServletResponse response) {
-		CorpMsgBulkTask byId = corpMsgBulkTaskService.getById(id);
-		if (byId == null) {
-			throw BusinessRuntimeException.getInstance("群发任务不存在");
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("task_id", String.format("task_id = %s", id));
-		String time = StrUtil.EMPTY;
-		if (startTime != null) {
-			time += String.format(" and created_time >= '%s'", DateTime.of(startTime));
-		}
-		if (endTime != null) {
-			time += String.format(" and created_time < '%s'", DateTime.of(endTime));
-		}
-		if (StrUtil.isNotEmpty(time)) {
-			builder.put("time", time);
-		}
-		List<ExcelCorpMsgBulkTaskSendRecordData> list = beanSearcher.searchAll(ExcelCorpMsgBulkTaskSendRecordData.class, builder
-				.orderBy(ExcelCorpMsgBulkTaskSendRecordData::getCreateTime).desc()
-				.build());
-		String fileName = String.format("%s群发任务发送记录", byId.getName());
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelCorpMsgBulkTaskSendRecordData.class, list, fileName, fileName, ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 群发记录 客服发送详情
-	 */
-	@GetMapping("/get/corpFollow/sendRecord/{id}")
-	public Result<SearchResult<CorpMsgBulkTaskCorpFollowSendRecordView>> getCorpFollowSendRecord(@PathVariable Long id) {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("send_id", String.format("send_id = %s", id));
-		SearchResult<CorpMsgBulkTaskCorpFollowSendRecordView> search = beanSearcher.search(CorpMsgBulkTaskCorpFollowSendRecordView.class, builder
-				.orderBy(CorpMsgBulkTaskCorpFollowSendRecordView::getCreateTime).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 提醒群发
-	 */
-	@PutMapping("/remind/{msgid}")
-	public Result<String> remindBulkTask(@PathVariable String msgid) {
-		corpMsgBulkTaskService.remindBulkTask(msgid);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("提醒群发成功");
-	}
-
-	/**
-	 * 立即执行 打动态标签
-	 */
-	@PostMapping("/execute/dynamicRuleTag/{tagId}")
-	public Result<String> executeDynamicRuleTagTask(@PathVariable Long tagId) throws Exception {
-		corpMsgBulkTaskService.executeDynamicRuleTagTask(tagId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 群发任务通知
-	 */
-	@PostMapping("/send/active/corpBulkMsg")
-	public Result<String> sendActiveCorpBulkMsg(@RequestBody CorpActiveBulkMsg msg) {
-		corpMsgBulkTaskService.sendActiveCorpBulkMsg(msg);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 新增分类
-	 */
-	@PostMapping("/category/post")
-	public Result<String> postCategory(@RequestBody @Validated CorpMsgBulkTaskCategory corpMsgBulkTaskCategory) {
-		try {
-			corpMsgBulkTaskCategoryMapper.insert(corpMsgBulkTaskCategory);
-		} catch (DuplicateKeyException e) {
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑分类
-	 */
-	@PutMapping("/category/update")
-	public Result<String> upCategory(@RequestBody @Validated CorpMsgBulkTaskCategory corpMsgBulkTaskCategory) {
-		try {
-			corpMsgBulkTaskCategoryMapper.updateById(corpMsgBulkTaskCategory);
-		} catch (DuplicateKeyException e) {
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除分类
-	 */
-	@DeleteMapping("/category/delete/{id}")
-	public Result<String> delCategory(@PathVariable Long id) {
-		int count = corpMsgBulkTaskService.count(Wrappers.lambdaQuery(CorpMsgBulkTask.class).eq(CorpMsgBulkTask::getCategory, id).eq(CorpMsgBulkTask::getDeleted, 1));
-		if (count > 0) {
-			throw BusinessRuntimeException.getInstance("存在该分类下的群发任务");
-		}
-		corpMsgBulkTaskCategoryMapper.deleteById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 分类列表
-	 */
-	@GetMapping("/category/get")
-	public Result<SearchResult<CorpMsgBulkTaskCategory>> getCategory() {
-		SearchResult<CorpMsgBulkTaskCategory> search = beanSearcher.search(CorpMsgBulkTaskCategory.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 99
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgFollowController.java

@@ -1,99 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.config.corp.YHLXWxCorpConfig;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.CorpMsgFollowAssociation;
-import com.cyksj.model.manage.views.CorpMsgFollowAssociationView;
-import com.cyksj.service.corp.CorpMsgFollowAssociationService;
-import com.cyksj.service.corp.WxCorpOps;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * @author chan
- * @date 2024/1/18 12:14
- */
-@Slf4j
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/manage/msg/follow")
-public class CorpMsgFollowController {
-
-    private final CorpMsgFollowAssociationService corpMsgFollowAssociationService;
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final WxCorpOps wxCorpOps;
-
-    private final YHLXWxCorpConfig corpConfig;
-
-    /**
-     *  会话存档开启成员列表
-     * @author chan
-     * @date 2024-01-18 17:27
-     */
-    @GetMapping
-    public Result<SearchResult<CorpMsgFollowAssociationView>> getPermitUserList() throws Exception {
-        List<String> res = wxCorpOps.getPermitUserList(corpConfig.getCorpId(), null);
-        SearchResult<CorpMsgFollowAssociationView> search = beanSearcher.search(CorpMsgFollowAssociationView.class, MapUtils.flatBuilder(request.getParameterMap()).field(CorpMsgFollowAssociationView::getUserid, res).op(Operator.InList).build());
-        search.getDataList().forEach((data)->{
-            List<CorpMsgFollowAssociation> corpMsgFollowAssociations = beanSearcher.searchAll(CorpMsgFollowAssociation.class, MapUtils.builder().field(CorpMsgFollowAssociation::getFollowId, data.getUserid()).build());
-            List<String> followIds = corpMsgFollowAssociations.stream().map(CorpMsgFollowAssociation::getAssociationFollowId).collect(Collectors.toList());
-            if(followIds.size() > 0 ){
-                List<CorpMsgFollowAssociationView> corpMsgFollowAssociationViews = beanSearcher.searchAll(CorpMsgFollowAssociationView.class, MapUtils.builder().field(CorpMsgFollowAssociationView::getUserid, followIds).op(Operator.InList).build());
-                data.setAssociationList(corpMsgFollowAssociationViews);
-            }else {
-                data.setAssociationList(new ArrayList<>());
-            }
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     *
-     * @return
-     */
-    @GetMapping("/all")
-    public Result<List<CorpMsgFollowAssociationView>> getAll() throws Exception {
-        List<String> res = wxCorpOps.getPermitUserList(corpConfig.getCorpId(), null);
-        List<CorpMsgFollowAssociationView> search = beanSearcher.searchAll(CorpMsgFollowAssociationView.class, MapUtils.flatBuilder(request.getParameterMap()).field(CorpMsgFollowAssociationView::getUserid, res).op(Operator.InList).build());
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 新增会话存档关系
-     * @author chan
-     * @date 2024-01-18 17:26
-     */
-    @PostMapping
-    public Result<String> addAssociation(@RequestBody CorpMsgFollowAssociation corpMsgFollowAssociation){
-        corpMsgFollowAssociationService.save(corpMsgFollowAssociation);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 删除会话存档关系
-     * @author chan
-     * @date 2024-01-18 17:26
-     */
-    @DeleteMapping
-    public Result<String> delAssociation(@RequestBody CorpMsgFollowAssociation corpMsgFollowAssociation){
-        corpMsgFollowAssociationService.remove(Wrappers.lambdaQuery(CorpMsgFollowAssociation.class).eq(CorpMsgFollowAssociation::getAssociationFollowId,corpMsgFollowAssociation.getAssociationFollowId()).eq(CorpMsgFollowAssociation::getFollowId,corpMsgFollowAssociation.getFollowId()));
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-}

+ 0 - 225
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpTagController.java

@@ -1,225 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.lang.Assert;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.CorpTag;
-import com.cyksj.model.entity.CorpTagRule;
-import com.cyksj.model.entity.CorpTagRuleRelation;
-import com.cyksj.model.excel.CorpUserTagExcelData;
-import com.cyksj.model.request.CorpDelTagReq;
-import com.cyksj.model.views.*;
-import com.cyksj.service.corp.CorpTagService;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/*
- *项目名: netflix
- *文件名: CorpTagController
- *创建者: JavaZou
- *创建时间:2023/6/20 16:01
- */
-@RestController
-@RequestMapping("/manage/corp")
-@RequiredArgsConstructor
-public class CorpTagController {
-
-	private final CorpTagService corpTagService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-
-	/**
-	 * 添加企业标签组
-	 */
-	@PostMapping("/addGroup")
-	public Result<CorpTagGroupView> addGroup(@RequestBody CorpTagGroupView tagGroup) throws Exception {
-		CorpTagGroupView corpTagGroupView = corpTagService.addGroup(tagGroup);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpTagGroupView);
-	}
-
-	/**
-	 * 添加企业标签组及标签
-	 */
-	@PostMapping("/addCorpTagGroup")
-	public Result<CorpTagGroupView> addCorpTagGroup(@RequestBody CorpTagGroupView tagGroup) throws Exception {
-		CorpTagGroupView corpTagGroupView = corpTagService.addCorpTagGroup(tagGroup);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpTagGroupView);
-	}
-
-	/**
-	 * 编辑企业标签
-	 */
-	@PutMapping("/editCorpTag")
-	public Result<String> editCorpTag(@RequestBody CorpTagGroupView tagGroup) throws Exception {
-		corpTagService.editCorpTag(tagGroup);
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除企业标签组、标签
-	 */
-	@PutMapping("/del")
-	public Result<String> delTags(@RequestBody CorpDelTagReq req) throws Exception {
-		corpTagService.delTags(req);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 获取企业微信标签列表
-	 *
-	 * @author chan
-	 * @date 2022-03-24 下午1:58
-	 */
-	@RequestMapping("/get/corpTagList")
-	public Result<Page<CorpTagGroupView>> getCorpTagList(String groupName, @RequestParam(defaultValue = "0") Integer start, @RequestParam(defaultValue = "10") Integer limit) {
-		Page<CorpTagGroupView> tagGroupList = corpTagService.getCorpTagList(groupName, start, limit);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(tagGroupList);
-	}
-
-	/**
-	 * 规则列表展示
-	 */
-	@GetMapping("/get/ruleList")
-	public Result<List<CorpTagRule>> rules() {
-		List<CorpTagRule> corpTagRules = beanSearcher.searchAll(CorpTagRule.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpTagRules);
-	}
-
-	/**
-	 * 新增规则
-	 */
-	@PostMapping("/post/rule")
-	public Result<String> postRule(CorpTagRule rule) {
-		corpTagService.saveOrUpdateRule(rule);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑规则
-	 */
-	@PutMapping("/put/rule")
-	public Result<String> updateRule(CorpTagRule rule) {
-		corpTagService.saveOrUpdateRule(rule);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 标签管理详情
-	 */
-	@GetMapping("/get/corpTag")
-	public Result<Page<CorpTagBackView>> getCorpTagBackView(@RequestParam(defaultValue = "0") Integer start, @RequestParam(defaultValue = "10") Integer limit, @RequestParam(required = false, defaultValue = "1") Integer type, String name, String[] groupIds, String sort, String order, String tagIdStr) throws Exception {
-		Long adminId = StpUtil.getLoginIdAsLong();
-		//指定管理员可查看标签
-		//马慧文
-		if (adminId == 75l) {
-			tagIdStr = "etvj2DPQAAxqh9QlGJG4N1EbdQBNYGAA";
-		}
-		Page<CorpTagBackView> corpTagBackViews = corpTagService.getCorpTagBackView(start, limit, type, name, groupIds, sort, order, tagIdStr);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpTagBackViews);
-	}
-
-	/**
-	 * 标签对应规则详情
-	 */
-	@GetMapping("/get/corpTag/rule/detail/{id}")
-	public Result<List<CorpTagRuleRelation>> getCorpTagRuleDetail(@PathVariable Long id) {
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpTagService.getCorpTagRuleDetail(id));
-	}
-
-	/**
-	 * 客户详情
-	 */
-	@GetMapping("/get/corpUser/detail")
-	public Result<Page<CorpUserView>> getCorpUserDetail(String tagId, String groupId, @RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit) {
-		Page<CorpUserView> result = corpTagService.getCorpUserDetail(tagId, groupId, start, limit);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(result);
-	}
-
-	/**
-	 * 标签组内标签详情
-	 */
-	@GetMapping("/get/groupTag/detail/{groupId}")
-	public Result<List<CorpTag>> getGroupTagDetail(@PathVariable String groupId) {
-		List<CorpTag> corpTags = corpTagService.getGroupTagDetail(groupId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpTags);
-	}
-
-	/**
-	 * 导出标签下所有客户
-	 */
-	@GetMapping("/export")
-	public void export(String[] tagId, String[] groupId, HttpServletResponse response) {
-		List<CorpUserTagExcelData> list = corpTagService.exportUserTagDetail(tagId, groupId);
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, CorpUserTagExcelData.class, list, "标签下客户详情", "标签下客户详情", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 企业微信标签 头部数据
-	 */
-	@GetMapping("/get/headData")
-	public Result<CorpTagHeadDataView> getCorpTagHeadDataView() {
-		CorpTagHeadDataView corpTagHeadDataView = corpTagService.getCorpTagHeadDataView();
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpTagHeadDataView);
-	}
-
-	/**
-	 * 按照标签时间,消费时间 查看用户总览
-	 */
-	@GetMapping("/get/tagUser/headData")
-	public Result<UserOrderDetailView> tagUserHeadData(@RequestParam(required = true) String tagIdStr, String startTime, String endTime, String consumeStTime, String consumeEtTime) {
-		Assert.notEmpty(tagIdStr, "请输入对应标签");
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpTagService.tagUserHeadData(tagIdStr,startTime,endTime,consumeStTime,consumeEtTime));
-	}
-
-	/**
-	 * 通过标签 查找进粉订单记录
-	 */
-	@GetMapping("/get/tagUser/fansData")
-	public Result<Page<UserOrderDetailView> > getTagUserData(@RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit, @RequestParam(required = true) String tagIdStr, String startTime, String endTime, String consumeStTime, String consumeEtTime) {
-		Assert.notEmpty(tagIdStr, "请输入对应标签");
-		Page<UserOrderDetailView>  page = corpTagService.getTagUserData(start, limit, tagIdStr, startTime, endTime, consumeStTime, consumeEtTime);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
-	}
-
-	/**
-	 * 通过标签 查找标签用户历史订单记录
-	 */
-	@GetMapping("/get/tagUser/pastData")
-	public Result<Page<UserOrderDetailView>> getTagUserPastRecord(@RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit, @RequestParam(required = true) String tagIdStr, String startTime, String endTime, String consumeStTime, String consumeEtTime) {
-		Assert.notEmpty(tagIdStr, "请输入对应标签");
-		Page<UserOrderDetailView> page = corpTagService.getTagUserPastRecord(start, limit, tagIdStr, startTime, endTime, consumeStTime, consumeEtTime);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
-	}
-
-	/**
-	 * 当日进粉户订单详情
-	 */
-	@GetMapping("/get/tagUser/time/orderData")
-	public Result<Page<CorpTagUserOrderDataView>> getTagUserTimeOrderData(@RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit, @RequestParam(required = true) String tagIdStr, String toDate, String startTime, String endTime) {
-		Page<CorpTagUserOrderDataView> page = corpTagService.getTagUserTimeOrderData(start, limit, tagIdStr, toDate, startTime, endTime);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
-	}
-
-	/**
-	 * 当日标签用户 本月下单情况
-	 */
-	@GetMapping("/get/fans/toMonth/orders")
-	public Result<UserOrderDetailView> getFansUserToMonthOrdersDetail(String tagId, String date) {
-		UserOrderDetailView userOrderDetailView = corpTagService.getFansUserToMonthOrdersDetail(tagId, date);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userOrderDetailView);
-	}
-}

+ 0 - 41
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpUserController.java

@@ -1,41 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.manage.views.CorpUserView;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * 企业微信/用户列表
- * @author chan
- * @date 2024/1/19 10:48
- */
-@Slf4j
-@RestController
-@RequestMapping("/manage/corp/user")
-@RequiredArgsConstructor
-public class CorpUserController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    /**
-     * 企业微信用户列表
-     */
-    @GetMapping
-    public Result<SearchResult<CorpUserView>> get(){
-        SearchResult<CorpUserView> search = beanSearcher.search(CorpUserView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-}

+ 0 - 138
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpWelcomeTemplateController.java

@@ -1,138 +0,0 @@
-package com.cyksj.web.controller.manage.corp;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkMapper;
-import com.cyksj.mapper.corp.CorpFollowActiveCodeMapper;
-import com.cyksj.mapper.manage.coupon.CouponMapper;
-import com.cyksj.model.entity.CorpCustomerAcquisitionLink;
-import com.cyksj.model.entity.CorpFollowActiveCode;
-import com.cyksj.model.entity.CorpWelcomeTemplate;
-import com.cyksj.model.request.corp.Attachments;
-import com.cyksj.service.corp.CorpWelcomeTemplateService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * admin/企业微信/欢迎语模板
- * 项目名: yhlxj
- * 文件名: CorpWelcomeTemplateController
- * 创建者: JavaZou
- * 创建时间:2023/12/5 18:23
- */
-@RestController
-@RequestMapping("/manage/corp/welcome")
-@RequiredArgsConstructor
-public class CorpWelcomeTemplateController {
-
-	private final CorpWelcomeTemplateService corpWelcomeTemplateService;
-
-	private final CouponMapper couponMapper;
-
-	private final CorpFollowActiveCodeMapper corpFollowActiveCodeMapper;
-
-	private final CorpCustomerAcquisitionLinkMapper acquisitionLinkMapper;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	/**
-	 * 新增欢迎语 模板
-	 */
-	@PostMapping("/post")
-	public Result<String> post(@RequestBody @Validated CorpWelcomeTemplate template) throws Exception {
-		corpWelcomeTemplateService.saveOrUpdateTemplate(template);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除欢迎语 模板
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteById(@PathVariable Long id) {
-		CorpWelcomeTemplate byId = corpWelcomeTemplateService.getById(id);
-		Integer count = null;
-		if (byId.getType() == 0) {
-			int count1 = corpWelcomeTemplateService.count(Wrappers.lambdaQuery(CorpWelcomeTemplate.class)
-					.eq(CorpWelcomeTemplate::getType, 0).eq(CorpWelcomeTemplate::getDeleted, 1));
-			if (count1 == 0) {
-				throw BusinessRuntimeException.getInstance("自然渠道欢迎语默认存在一条");
-			}
-		} else if (byId.getType() == 1) {
-			count = corpFollowActiveCodeMapper.selectCount(Wrappers.lambdaQuery(CorpFollowActiveCode.class)
-					.eq(CorpFollowActiveCode::getDeleted, 1)
-					.eq(CorpFollowActiveCode::getMsgId, byId.getId()));
-		} else if (byId.getType() == 2) {
-			count = acquisitionLinkMapper.selectCount(Wrappers.lambdaQuery(CorpCustomerAcquisitionLink.class)
-					.eq(CorpCustomerAcquisitionLink::getMsgId, byId.getId()));
-		}
-		if (count != null && count > 0) {
-			throw BusinessRuntimeException.getInstance("该欢迎语已使用");
-		}
-		if (byId != null) {
-			byId.setDeleted(false);
-			corpWelcomeTemplateService.updateById(byId);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 修改欢迎语 模板
-	 */
-	@PutMapping("/update")
-	public Result<String> update(@RequestBody CorpWelcomeTemplate template) throws Exception {
-		corpWelcomeTemplateService.saveOrUpdateTemplate(template);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 欢迎语模板列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<CorpWelcomeTemplate>> get() {
-		SearchResult<CorpWelcomeTemplate> search = beanSearcher.search(CorpWelcomeTemplate.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(CorpWelcomeTemplate::getDeleted, 1)
-				.build());
-		search.getDataList().forEach(e -> {
-			String attachmentsStr = e.getAttachmentsStr();
-			if (StrUtil.isNotEmpty(attachmentsStr)) {
-				try {
-					e.setAttachments(Jsons.parseList(attachmentsStr, Attachments.class));
-				} catch (Exception ex) {
-				}
-			}
-			if (StrUtil.isNotBlank(e.getCouponIds())) {
-				try {
-					List<Long> couponIds = Jsons.parseList(e.getCouponIds(), Long.class);
-					e.setCouponName(couponMapper.getCouponNameByIds(couponIds));
-				} catch (Exception ex) {
-				}
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 不分页 欢迎语模板
-	 */
-	@GetMapping("/get/all")
-	public Result<List<CorpWelcomeTemplate>> getAll() {
-		List<CorpWelcomeTemplate> list = beanSearcher.searchAll(CorpWelcomeTemplate.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(CorpWelcomeTemplate::getDeleted, 1)
-				.onlySelect(CorpWelcomeTemplate::getId, CorpWelcomeTemplate::getType, CorpWelcomeTemplate::getName).build());
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-}

+ 0 - 337
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/wxkf/CorpKfController.java

@@ -1,337 +0,0 @@
-package com.cyksj.web.controller.manage.corp.wxkf;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.corp.CorpFollowMapper;
-import com.cyksj.mapper.corp.kf.CorpKfAccountUserChangeRecordMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.request.CorpKfDutySetReq;
-import com.cyksj.model.request.corp.kf.CorpKfDutyReq;
-import com.cyksj.model.views.CorpKfDutyServicersStatusView;
-import com.cyksj.model.views.CorpKfServicerStatisticView;
-import com.cyksj.model.views.CorpKfUserChatRecordView;
-import com.cyksj.model.views.SysCorpFollowView;
-import com.cyksj.service.corp.kf.CorpKfService;
-import com.cyksj.service.mange.cms.service.CmsUserService;
-import com.cyksj.service.user.UserBindRelationService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- * admin/微信客服
- * 项目名: yhlxj2
- * 文件名: CorpWxKfController
- * 创建者: JavaZou
- * 创建时间:2024/12/30 18:02
- */
-@RestController
-@RequestMapping("/manage/corp/kf")
-@RequiredArgsConstructor
-public class CorpKfController {
-	private final CorpKfService corpKfService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final CmsUserService cmsUserService;
-
-	private final CorpFollowMapper corpFollowMapper;
-
-	private final CorpKfAccountUserChangeRecordMapper corpKfAccountUserChangeRecordMapper;
-
-	private final UserBindRelationService userBindRelationService;
-
-	private final UserMapper userMapper;
-
-
-	/**
-	 * 添加客服账号
-	 */
-	@PostMapping("/account/add")
-	public Result<String> addKfAccount(@RequestBody CorpKfAccount corpKfAccount) throws Exception {
-		corpKfService.addKfAccount(corpKfAccount);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除客服账号
-	 */
-	@DeleteMapping("/account/del/{id}")
-	public Result<String> delKfAccount(@PathVariable Long id) throws Exception {
-		corpKfService.delKfAccount(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 修改客服账号
-	 */
-	@PutMapping("/account/update")
-	public Result<String> updateKfAccount(@RequestBody CorpKfAccount corpKfAccount) throws Exception {
-		corpKfService.updateKfAccount(corpKfAccount);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 客服账号列表
-	 */
-	@GetMapping("/account/get")
-	public Result<SearchResult<CorpKfAccount>> getKfAccount() {
-		SearchResult<CorpKfAccount> search = beanSearcher.search(CorpKfAccount.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 获取客服账号链接
-	 */
-	@GetMapping("/get/url")
-	public Result<String> getUrl(String openKfId, String scene) throws Exception {
-		String url = corpKfService.getUrl(openKfId, scene);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(url);
-	}
-
-	//===============================================账号会话设置========================================================================
-
-	/**
-	 * 设置规则
-	 */
-	@PostMapping("/set/rule")
-	public Result<String> setKfAccountRule(@RequestBody CorpKfAccountSessionConfig CorpKfAccountSessionConfig) {
-		corpKfService.setKfAccountRuleOrAutoReply(CorpKfAccountSessionConfig);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 获取规则设置
-	 */
-	@GetMapping("/get/rule")
-	public Result<CorpKfAccountSessionConfig> getRule(String openKfId) {
-		CorpKfAccountSessionConfig corpKfAccountSessionConfig = beanSearcher.searchFirst(CorpKfAccountSessionConfig.class, MapUtils.flatBuilder(request.getParameterMap()).field(CorpKfAccountSessionConfig::getOpenKfId, openKfId).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpKfAccountSessionConfig);
-	}
-
-	/**
-	 * 设置自动回复
-	 */
-	@PostMapping("/set/auto/reply")
-	public Result<String> setKfAccountAutoReply(@RequestBody CorpKfAccountSessionConfig CorpKfAccountSessionConfig) {
-		corpKfService.setKfAccountRuleOrAutoReply(CorpKfAccountSessionConfig);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 获取自动回复设置
-	 */
-	@GetMapping("/get/auto/reply")
-	public Result<CorpKfAccountSessionConfig> getAutoReply(String openKfId) {
-		CorpKfAccountSessionConfig corpKfAccountSessionConfig = beanSearcher.searchFirst(CorpKfAccountSessionConfig.class, MapUtils.flatBuilder(request.getParameterMap()).field(CorpKfAccountSessionConfig::getOpenKfId, openKfId).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpKfAccountSessionConfig);
-	}
-
-
-
-
-	//===============================================账号值班设置========================================================================
-	/**
-	 * 设置值班时间
-	 */
-	@PostMapping("/set/duty")
-	public Result<String> setKfDuty(@RequestBody CorpKfDutyReq dutyReq) throws Exception {
-		long adminId = StpUtil.getLoginIdAsLong();
-		dutyReq.setAdminId(adminId);
-		corpKfService.setKfDuty(dutyReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 客服变更记录
-	 */
-	@GetMapping("/get/follow/change/logs")
-	public Result<SearchResult<CorpKfFollowChangeRecord>> getChangeLogs() {
-		SearchResult<CorpKfFollowChangeRecord> search = beanSearcher.search(CorpKfFollowChangeRecord.class, MapUtils.flatBuilder(request.getParameterMap()).orderBy(CorpKfFollowChangeRecord::getId).desc().build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 获取账号值班设置
-	 */
-	@GetMapping("/get/duty")
-	public Result<List<CorpKfAccountFollow>> getKfDuty(String openKfId) {
-		List<CorpKfAccountFollow> corpKfAccountFollows = beanSearcher.searchAll(CorpKfAccountFollow.class, MapUtils.flatBuilder(request.getParameterMap()).field(CorpKfAccountFollow::getOpenKfId, openKfId).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpKfAccountFollows);
-	}
-
-	//===============================================数据统计========================================================================
-
-	/**
-	 * 数据统计
-	 */
-	@GetMapping("/get/statistics")
-	public Result<SearchResult<CorpKfServicerStatisticView>> getStatisticsData(String startTime, String endTime) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		Boolean rootRole = cmsUserService.isRootRole(adminId);
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (!rootRole) {
-			List<String> userids = corpFollowMapper.selectList(Wrappers.lambdaQuery(CorpFollow.class)
-					.eq(CorpFollow::getCmsUserId, adminId)).stream().map(CorpFollow::getUserid).collect(Collectors.toList());
-			builder.field(CorpKfServicerStatistic::getServicerUserid, userids).op(Operator.InList);
-		}
-		String timeSql = StrUtil.EMPTY;
-		if (startTime != null) {
-			timeSql += String.format(" statistics_date>= '%s'", startTime);
-		}
-		if (endTime != null) {
-			timeSql += String.format(" and statistics_date <= '%s'", endTime);
-		}
-		if (StrUtil.isNotEmpty(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		SearchResult<CorpKfServicerStatisticView> search = beanSearcher.search(CorpKfServicerStatisticView.class, builder.build());
-		search.getDataList().forEach(data -> {
-			SysCorpFollowView sysCorpFollowView = beanSearcher.searchFirst(SysCorpFollowView.class, MapUtils.builder().field(SysCorpFollowView::getFollowId, data.getServicerUserid()).build());
-			if (sysCorpFollowView != null) {
-				data.setName(sysCorpFollowView.getName());
-				data.setFollowName(sysCorpFollowView.getFollowName());
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	//===============================================聊天记录========================================================================
-
-	/**
-	 * 会话记录
-	 */
-	@GetMapping("/get/session")
-	public Result<SearchResult<CorpKfUserChatRecordView>> getSession(Long userId, String keyword) {
-		String unionId = getUnionid(userId);
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (unionId != null) {
-			builder.field(CorpKfUserChatRecordView::getUnionid, unionId);
-		}
-		if (StringUtils.isNotBlank(keyword)) {
-			builder.put("keyword", String.format(" and exist (select 1 from corp_kf_account_session_chat ct where ct.session_id = cr.id and ct.msg_content like '%s%%')", keyword));
-		}
-		SearchResult<CorpKfUserChatRecordView> search = beanSearcher.search(CorpKfUserChatRecordView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-
-	/**
-	 * 获取聊天记录
-	 */
-	@GetMapping("/get/session/chat")
-	public Result<SearchResult<CorpKfAccountSessionChat>> getSessionChat(){
-		Map<String, Object> build = MapUtils.flatBuilder(request.getParameterMap()).build();
-		SearchResult<CorpKfAccountSessionChat> search = beanSearcher.search(CorpKfAccountSessionChat.class, build);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 客服上下班
-	 */
-	@PutMapping("/servicer/commute")
-	@Log(module = "微信客服/客服上下班", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> servicerCommute(@RequestBody CorpKfDutySetReq corpKfDutySetReq) throws Exception {
-		long cmsUserId = StpUtil.getLoginIdAsLong();
-		corpKfService.servicerCommute(cmsUserId, corpKfDutySetReq.getOpenKfId(), corpKfDutySetReq.getStatus());
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 目前值班人员变化
-	 */
-	@GetMapping("/get/duty/{openKfId}")
-	public Result<List<CorpKfDutyServicersStatusView>> getDutyFollowByOpenKfId(@PathVariable String openKfId) throws Exception {
-		long cmsUserId = StpUtil.getLoginIdAsLong();
-		List<CorpKfDutyServicersStatusView> dutyStatuses = corpKfService.getDutyFollowByOpenKfId(cmsUserId, openKfId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(dutyStatuses);
-	}
-
-	/**
-	 * 目前用户值班微信客服
-	 */
-	@GetMapping("/get/duty/accounts")
-	public Result<List<CorpKfAccount>> getCorpKfAccountByUId() {
-		long cmsUserId = StpUtil.getLoginIdAsLong();
-		List<CorpKfAccount> corpKfAccounts = corpKfService.getCorpKfAccountByUId(cmsUserId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpKfAccounts);
-	}
-
-	/**
-	 * 记录用户切换客服记录
-	 */
-	@PostMapping("/change/account/record/{openKfId}")
-	public Result<String> recordUserAccountRecord(@PathVariable String openKfId) {
-		long cmsUserId = StpUtil.getLoginIdAsLong();
-		CorpKfAccountUserChangeRecord corpKfAccountUserChangeRecord = Optional.ofNullable(corpKfAccountUserChangeRecordMapper.selectOne(Wrappers.lambdaQuery(CorpKfAccountUserChangeRecord.class)
-				.eq(CorpKfAccountUserChangeRecord::getCmsUserId, cmsUserId)
-				.last("limit 1"))).orElse(new CorpKfAccountUserChangeRecord());
-		corpKfAccountUserChangeRecord.setCmsUserId(cmsUserId);
-		corpKfAccountUserChangeRecord.setOpenKfId(openKfId);
-		if (corpKfAccountUserChangeRecord.getId() == null) {
-			try {
-				corpKfAccountUserChangeRecordMapper.insert(corpKfAccountUserChangeRecord);
-			} catch (DuplicateKeyException e) {
-			}
-		} else {
-			corpKfAccountUserChangeRecordMapper.updateById(corpKfAccountUserChangeRecord);
-		}
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 用户切换德微信账号
-	 */
-	@GetMapping("/get/change/account")
-	public Result<CorpKfAccountUserChangeRecord> getChangeAccount() {
-		long cmsUserId = StpUtil.getLoginIdAsLong();
-		CorpKfAccountUserChangeRecord corpKfAccountUserChangeRecord = Optional.ofNullable(corpKfAccountUserChangeRecordMapper.selectOne(Wrappers.lambdaQuery(CorpKfAccountUserChangeRecord.class)
-				.eq(CorpKfAccountUserChangeRecord::getCmsUserId, cmsUserId)
-				.last("limit 1"))).orElse(new CorpKfAccountUserChangeRecord());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpKfAccountUserChangeRecord);
-	}
-
-	public String getUnionid(Long userId) {
-		String unionId = null;
-		if (userId != null) {
-			try {
-				unionId = StrUtil.COLON;
-				List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-				if (CollUtil.isNotEmpty(userIdList)) {
-					User user = userMapper.selectOne(Wrappers.lambdaQuery(User.class)
-							.in(User::getId, userIdList)
-							.ne(User::getUnionid, StrUtil.EMPTY)
-							.last("limit 1"));
-					if (user != null) {
-						unionId = user.getUnionid();
-					}
-				}
-			} catch (Exception e) {
-			}
-		}
-		return unionId;
-	}
-
-}

+ 0 - 86
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/wxkf/CorpKfMsgController.java

@@ -1,86 +0,0 @@
-package com.cyksj.web.controller.manage.corp.wxkf;
-
-import cn.hutool.core.bean.BeanUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.corp.kf.CorpKfServicerSessionRecordMapper;
-import com.cyksj.mapper.corp.kf.CorpKfUserMapper;
-import com.cyksj.model.entity.CorpKfServicerSessionRecord;
-import com.cyksj.model.entity.CorpKfUser;
-import com.cyksj.model.kf.CorpKfUserInfo;
-import com.cyksj.service.corp.WxCorpOps;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 项目名: yhlxj2
- * 文件名: CorpKfMsgController
- * 创建者: JavaZou
- * 创建时间:2025/1/2 13:59
- */
-@RestController
-@RequestMapping("/manage/corp/kf")
-@RequiredArgsConstructor
-public class CorpKfMsgController {
-	private final WxCorpOps wxCorpOps;
-
-	private final CorpKfServicerSessionRecordMapper corpKfServicerSessionRecordMapper;
-
-	private final CorpKfUserMapper corpKfUserMapper;
-
-	/**
-	 * 发送满意度调查消息
-	 */
-	@PostMapping("/send/satisfaction/msg")
-	public void sendSatisfactionMsg(Long id) throws Exception {
-		CorpKfServicerSessionRecord corpKfServicerSessionRecord = corpKfServicerSessionRecordMapper.selectById(id);
-		//更新发送满意度字段
-		if (corpKfServicerSessionRecord != null) {
-			corpKfServicerSessionRecord.setSendSatisfaction(true);
-			corpKfServicerSessionRecordMapper.updateById(corpKfServicerSessionRecord);
-			wxCorpOps.sendSatisfactionMsg(corpKfServicerSessionRecord.getMsgid(), corpKfServicerSessionRecord.getOpenKfId(), corpKfServicerSessionRecord.getExternalUserid(), null);
-		}
-	}
-
-	/**
-	 * 获取客户用户信息
-	 */
-	@GetMapping("/get/user/info")
-	public Result<CorpKfUserInfo> getUserInfo(String externalUserid) throws Exception {
-		CorpKfUserInfo corpKfUserInfo = wxCorpOps.getCorpKfUserInfo(externalUserid);
-		CorpKfUser corpKfUser = corpKfUserMapper.selectOne(Wrappers.lambdaQuery(CorpKfUser.class)
-				.eq(CorpKfUser::getExternalUserid, externalUserid)
-				.last("limit 1"));
-		if (corpKfUser == null) {
-			try {
-				corpKfUser = new CorpKfUser();
-				BeanUtil.copyProperties(corpKfUserInfo, corpKfUser);
-				corpKfUserMapper.insert(corpKfUser);
-			} catch (Exception e) {
-			}
-		} else {
-			corpKfUser.setAvatar(corpKfUserInfo.getAvatar());
-			corpKfUser.setNickname(corpKfUserInfo.getNickname());
-			corpKfUser.setGender(corpKfUserInfo.getGender());
-			corpKfUserMapper.updateById(corpKfUser);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpKfUserInfo);
-	}
-
-	/**
-	 * 查询用户会话
-	 */
-	@GetMapping("/get/user/session")
-	public Result<CorpKfServicerSessionRecord> getUserSession(String userid, String externalUserid) {
-		CorpKfServicerSessionRecord corpKfServicerSessionRecord = corpKfServicerSessionRecordMapper.selectOne(Wrappers.lambdaQuery(CorpKfServicerSessionRecord.class)
-				.eq(CorpKfServicerSessionRecord::getServicerUserid, userid)
-				.eq(CorpKfServicerSessionRecord::getExternalUserid, externalUserid)
-				.eq(CorpKfServicerSessionRecord::getServiceState, 0)
-				.last("limit 1"));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(corpKfServicerSessionRecord);
-	}
-}

+ 0 - 550
netflix-web/src/main/java/com/cyksj/web/controller/manage/coupon/CouponController.java

@@ -1,550 +0,0 @@
-package com.cyksj.web.controller.manage.coupon;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.config.corp.WeChatCorpFactory;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.OrderDonMapper;
-import com.cyksj.mapper.corp.CorpUserAuthMapper;
-import com.cyksj.mapper.corp.CorpUserMapper;
-import com.cyksj.mapper.manage.coupon.*;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.request.CorpCouponSendReq;
-import com.cyksj.model.request.CouponActiveReq;
-import com.cyksj.model.request.CouponClassificationReq;
-import com.cyksj.model.request.CouponDistributeReq;
-import com.cyksj.model.request.corp.CorpXmlMessage;
-import com.cyksj.model.views.*;
-import com.cyksj.service.corp.msg.CorpEventActionService;
-import com.cyksj.service.coupon.EquipmentActivityReduceService;
-import com.cyksj.service.mange.coupon.CouponCommonService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.Assert;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.constraints.Min;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/*
- *项目名: netflix
- *文件名: CouponController
- *创建者: JavaZou
- *创建时间:2022/11/17 13:44
- */
-@RestController
-@RequestMapping("/manage/coupon")
-@RequiredArgsConstructor
-@Slf4j
-public class CouponController {
-	private final CouponCommonService couponCommonService;
-
-	private final CouponMapper couponMapper;
-
-	private final BeanSearcher beanSearcher;
-
-	private final CouponRecommendMapper couponRecommendMapper;
-
-	private final CouponDistributePopularizeMapper couponDistributePopularizeMapper;
-
-	private final CouponActiveMapper couponActiveMapper;
-
-	private final CouponUserMapper couponUserMapper;
-
-	private final CouponSkuMapper couponSkuMapper;
-
-	private final CorpUserMapper corpUserMapper;
-
-	private final CorpEventActionService corpEventActionService;
-
-	private final CorpUserAuthMapper corpUserAuthMapper;
-
-	private final CouponClassificationMapper couponClassificationMapper;
-
-	private final OrderDonMapper orderDonMapper;
-
-	private final HttpServletRequest request;
-
-	private final EquipmentActivityReduceService equipmentActivityReduceService;
-
-	/**
-	 * 新增优惠券
-	 */
-	@PostMapping
-	@Log(module = "优惠券/新增优惠券", businessType = BusinessType.POST, isSaveRequestData = true)
-	public Result<String> couponSave(@RequestBody @Validated Coupon coupon) throws Exception {
-		couponCommonService.saveCoupon(coupon);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("新增优惠券成功");
-	}
-
-	/**
-	 * 删除优惠券
-	 */
-	@DeleteMapping("/{id}")
-	@Transactional(rollbackFor = Throwable.class)
-	@Log(module = "优惠券/删除优惠券", businessType = BusinessType.DELETE)
-	public Result<String> couponSave(@PathVariable Long id) throws Exception {
-		couponMapper.deleteById(id);
-		couponSkuMapper.deleteByCid(id);
-		couponActiveMapper.deleteByCouponId(id);
-		couponRecommendMapper.deleteByCouponId(id);
-		couponDistributePopularizeMapper.deleteByCouponId(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除优惠券成功");
-	}
-
-	/**
-	 * 修改优惠券
-	 */
-	@PutMapping
-	@Log(module = "优惠券/编辑优惠券", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> putCoupon(@RequestBody @Validated Coupon coupon) throws Exception {
-		couponCommonService.updateCoupon(coupon);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("修改优惠券成功");
-	}
-
-	/**
-	 * 发放优惠券
-	 */
-	@PostMapping("/send")
-	@Log(module = "优惠券/发放优惠券", businessType = BusinessType.POST, isSaveRequestData = true)
-	public Result<String> senCoupon(@RequestBody @Validated CouponActiveReq couponActiveReq) throws Exception {
-		couponCommonService.sendCoupon(couponActiveReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("发放优惠券成功");
-	}
-
-	/**
-	 * 优惠券 设置为推荐优惠券
-	 */
-	@PutMapping("/set/hot/{couponId}")
-	@Log(module = "优惠券/推荐优惠券", businessType = BusinessType.POST)
-	public Result<String> setHotCoupon(@PathVariable @Min(value = 1) Long couponId, @RequestBody CouponRecommend recommend) {
-		recommend.setCouponId(couponId);
-		couponCommonService.setHotCoupon(recommend);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("推荐优惠券成功");
-	}
-
-	/**
-	 * 优惠券关联固定推广者
-	 */
-	@PostMapping("/set/relation")
-	public Result<String> setPopularizeRelation(@RequestBody CouponDistributeReq couponDistributeReq) {
-		couponCommonService.setPopularizeRelation(couponDistributeReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("优惠券关联固定推广者成功");
-	}
-
-	/**
-	 * 设置固定推广者兑换码
-	 */
-	@PutMapping("/set/relation/exCode")
-	public Result<String> setPopularizeRelationCode(@RequestBody CouponDistributePopularize couponDistributePopularize) {
-		couponCommonService.setPopularizeRelationCode(couponDistributePopularize);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("设置固定推广者兑换码成功");
-	}
-
-	/**
-	 * 关联某优惠券列表
-	 */
-	@GetMapping("/get/relation/list")
-	public Result<SearchResult<CouponDistributePopularizeView>> getRelationList(HttpServletRequest request) {
-		SearchResult<CouponDistributePopularizeView> search = beanSearcher.search(CouponDistributePopularizeView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			Integer usedNum = orderDonMapper.selectCouponCodeUserNum(data.getId(), data.getExCode(), Constant.noOrderAllStatus);
-			data.setUsedNum(usedNum);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 删除固定推广者关联
-	 */
-	@DeleteMapping("/relation/del/{relationId}")
-	public Result<String> deleteRelationById(@PathVariable Long relationId) {
-		couponDistributePopularizeMapper.deleteById(relationId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除推广者关联成功");
-	}
-
-	/**
-	 * 优惠券列表
-	 */
-	@GetMapping
-	public Result<SearchResult<CouponView>> couponList(HttpServletRequest request) {
-		SearchResult<CouponView> search = beanSearcher.search(CouponView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			data.setRelationNum(couponDistributePopularizeMapper.selectCount(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getDeleted, 1).eq(CouponDistributePopularize::getCouponId, data.getId())));
-
-			Map<String, Long> couponUserNumData = couponUserMapper.selectCouponUserNumData(data.getId());
-			Integer usedNum = Integer.parseInt(couponUserNumData.get("usedNum").toString());
-			data.setUsedNum(usedNum);
-			Integer receiptNum = Integer.parseInt(couponUserNumData.get("receiptNum").toString());
-			data.setReceiptNum(receiptNum);
-
-			List<GoodsDonSkuView> skuViewList = couponSkuMapper.selectGoodsSkuViewList(data.getId());
-			data.setSkuViewList(skuViewList);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 所有优惠券列表
-	 */
-	@GetMapping("/get/couponList")
-	public Result<List<Coupon>> getCouponList() {
-		List<Coupon> couponList = beanSearcher.searchAll(Coupon.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(Coupon::getDeleted, true)
-				.onlySelect(Coupon::getId, Coupon::getName)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(couponList);
-	}
-
-	/**
-	 * 优惠券发放列表
-	 */
-	@GetMapping("/active/list")
-	public Result<SearchResult<CouponActiveView>> couponActiveList(HttpServletRequest request) {
-		SearchResult<CouponActiveView> search = beanSearcher.search(CouponActiveView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			Integer usedNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
-					.eq(CouponUser::getCouponActiveId, data.getId()).eq(CouponUser::getStatus, CouponUser.Status.used));
-			Integer receiptNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
-					.eq(CouponUser::getCouponActiveId, data.getId()));
-			data.setReceiptNum(receiptNum);
-			data.setUsedNum(usedNum);
-
-			List<GoodsDonSkuView> skuViewList = couponSkuMapper.selectGoodsSkuViewList(data.getCouponId());
-			data.setSkuViewList(skuViewList);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 发放优惠券停用
-	 */
-	@PutMapping("/active/putStatus/{couponActiveId}")
-	public Result<String> activePutStatus(@PathVariable Long couponActiveId) {
-		CouponActive couponActive = couponActiveMapper.selectById(couponActiveId);
-		if (couponActive == null || !couponActive.getDeleted()) {
-			throw BusinessRuntimeException.getInstance("发放记录已不存在");
-		}
-		if (!couponActive.getStatus()) {
-			throw BusinessRuntimeException.getInstance("该发放优惠券已停用");
-		}
-		couponActive.setStatus(false);
-		couponActiveMapper.updateById(couponActive);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("停用发放优惠券成功");
-	}
-
-	/**
-	 * 发放优惠券失效
-	 */
-	@PutMapping("/active/putExpiryStatus/{couponActiveId}")
-	public Result<String> activePutExpiryStatus(@PathVariable Long couponActiveId) {
-		CouponActive couponActive = couponActiveMapper.selectById(couponActiveId);
-		if (couponActive == null || !couponActive.getDeleted()) {
-			throw BusinessRuntimeException.getInstance("发放记录已不存在");
-		}
-		if (!couponActive.getExpiryStatus()) {
-			throw BusinessRuntimeException.getInstance("该发放优惠券已失效");
-		}
-		couponActive.setExpiryStatus(false);
-		couponActive.setStatus(false);
-		couponActiveMapper.updateById(couponActive);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("失效发放优惠券成功");
-	}
-
-
-	/**
-	 * 推荐发放列表
-	 */
-	@GetMapping("/recommend/list")
-	public Result<SearchResult<CouponRecommendView>> couponRecommendList(HttpServletRequest request) {
-		SearchResult<CouponRecommendView> search = beanSearcher.search(CouponRecommendView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			Integer usedNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
-					.eq(CouponUser::getRecommendId, data.getId()).eq(CouponUser::getStatus, CouponUser.Status.used));
-			Integer receiptNum = couponUserMapper.selectCount(Wrappers.lambdaQuery(CouponUser.class)
-					.eq(CouponUser::getRecommendId, data.getId()));
-			data.setReceiptNum(receiptNum);
-			data.setUsedNum(usedNum);
-
-			List<GoodsDonSkuView> skuViewList = couponSkuMapper.selectGoodsSkuViewList(data.getCouponId());
-			data.setSkuViewList(skuViewList);
-			//重置优惠券推荐状态
-			if (data.getStatus() && data.getDownTime() != null && DateTime.now().isAfter(data.getDownTime())) {
-				data.setStatus(false);
-				couponRecommendMapper.update(null, Wrappers.lambdaUpdate(CouponRecommend.class)
-						.set(CouponRecommend::getStatus, false)
-						.eq(CouponRecommend::getId, data.getId())
-						.eq(CouponRecommend::getStatus, true));
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 推荐优惠券设置/取消推荐
-	 */
-	@PutMapping("/recommend/putStatus/{recommendId}")
-	public Result<String> putRecommendStatusById(@PathVariable Long recommendId, @RequestBody CouponRecommend couponRecommend) {
-		CouponRecommend dbRecommend = couponRecommendMapper.selectById(recommendId);
-		if (dbRecommend == null || !dbRecommend.getDeleted()) {
-			throw BusinessRuntimeException.getInstance("该推荐优惠券不存在");
-		}
-		if (couponRecommend.getUpTime() == null) {
-			dbRecommend.setUpTime(null);
-		}
-		if (couponRecommend.getDownTime() == null) {
-			dbRecommend.setDownTime(null);
-		}
-		dbRecommend.setStatus(!dbRecommend.getStatus());
-		dbRecommend.setUpTime(couponRecommend.getUpTime());
-		dbRecommend.setDownTime(couponRecommend.getDownTime());
-		couponRecommendMapper.updateById(dbRecommend);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("操作成功");
-	}
-
-	/**
-	 * 删除推荐优惠券
-	 */
-	@DeleteMapping("/recommend/del/{recommendId}")
-	public Result<String> deleteRecommendById(@PathVariable Long recommendId) {
-		CouponRecommend couponRecommend = couponRecommendMapper.selectById(recommendId);
-		if (couponRecommend == null || !couponRecommend.getDeleted()) {
-			throw BusinessRuntimeException.getInstance("该推荐优惠券不存在");
-		}
-		if (couponRecommend.getStatus()) {
-			throw BusinessRuntimeException.getInstance("取消推荐优惠券,才可删除");
-		}
-		couponRecommendMapper.deleteById(recommendId);
-		Coupon coupon = couponMapper.selectById(couponRecommend.getCouponId());
-		if (coupon != null && coupon.getDeleted()) {
-			coupon.setHotStatus(false);
-			couponMapper.updateById(coupon);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除推荐优惠券成功");
-	}
-
-	/**
-	 * 企业微信发放优惠券
-	 */
-	@PostMapping("/corp/send")
-	public Result<String> corpSendCoupon(@RequestBody @Validated CorpCouponSendReq corpCouponSendReq) throws Exception {
-		String corpId = corpCouponSendReq.getCorpId();
-		String externalUserId = corpCouponSendReq.getExternalUserId();
-		String unionid = getUnionId(corpId, externalUserId);
-		Long couponId = corpCouponSendReq.getCouponId();
-		if (StrUtil.isEmpty(unionid)) {
-			throw BusinessRuntimeException.getInstance("该用户不是微信用户");
-		}
-		couponCommonService.corpSendCoupon(unionid, couponId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("发放优惠券成功");
-	}
-
-	/**
-	 * 新增优惠券分类
-	 */
-	@PostMapping("/post/classification")
-	public Result<String> saveClassification(@RequestBody @Validated CouponClassification classification) {
-		try {
-			couponClassificationMapper.insert(classification);
-		} catch (DuplicateKeyException e) {
-			throw BusinessRuntimeException.getInstance("优惠券名称重复");
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("新增优惠券成功");
-	}
-
-	/**
-	 * 删除优惠券分类
-	 */
-	@DeleteMapping("/delete/classification/{classificationId}")
-	public Result<String> deletedClassificationById(@PathVariable Long classificationId) {
-		Integer count = couponMapper.selectCount(Wrappers.lambdaQuery(Coupon.class)
-				.eq(Coupon::getClassificationId, classificationId)
-				.eq(Coupon::getDeleted, true));
-		if (count > 0) {
-			throw BusinessRuntimeException.getInstance("分类存在优惠券");
-		}
-		couponClassificationMapper.deleteById(classificationId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除优惠券分类成功");
-	}
-
-	/**
-	 * 优惠券转移分类
-	 */
-	@PutMapping("/update/coupon/classification")
-	public Result<String> changeCouponClassificationByClassificationId(@RequestBody @Validated CouponClassificationReq req) {
-		Long classificationId = req.getId();
-		Long newClassificationId = req.getNewClassificationId();
-		List<Coupon> coupons = couponMapper.selectList(Wrappers.lambdaQuery(Coupon.class)
-				.eq(Coupon::getClassificationId, classificationId)
-				.eq(Coupon::getDeleted, true)
-				.select(Coupon::getId));
-		if (coupons.isEmpty()) {
-			throw BusinessRuntimeException.getInstance("该分类下无优惠券");
-		}
-		CouponClassification couponClassification = couponClassificationMapper.selectById(newClassificationId);
-		if (couponClassification == null) {
-			throw BusinessRuntimeException.getInstance("要转移分类不存在");
-		}
-		couponMapper.update(null, Wrappers.lambdaUpdate(Coupon.class)
-				.set(Coupon::getClassificationId, newClassificationId)
-				.in(Coupon::getId, coupons.stream().map(Coupon::getId).collect(Collectors.toList())));
-		return GatewayResponse.SUCCESS.newBuilder().toResult("转移优惠券分类成功");
-	}
-
-	/**
-	 * 编辑优惠券分类
-	 */
-	@PutMapping("/update/classification")
-	public Result<String> updateClassification(@RequestBody @Validated CouponClassification classification) {
-		Long classificationId = classification.getId();
-		Assert.notNull(classificationId, "分类id为空");
-		CouponClassification couponClassification = couponClassificationMapper.selectById(classificationId);
-		if (couponClassification == null) {
-			throw BusinessRuntimeException.getInstance("该分类不存在");
-		}
-		couponClassificationMapper.updateById(classification);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑分类成功");
-	}
-
-	/**
-	 * 优惠券分类列表
-	 */
-	@GetMapping("/get/classification")
-	public Result<SearchResult<CouponClassificationView>> classificationView() {
-		SearchResult<CouponClassificationView> search = beanSearcher.search(CouponClassificationView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 优惠券所有分类
-	 */
-	@GetMapping("/get/classificationList")
-	public Result<List<CouponClassification>> getClassificationList() {
-		List<CouponClassification> CouponClassifications = beanSearcher.searchAll(CouponClassification.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(CouponClassifications);
-	}
-
-	public String getUnionId(String corpId, String externalUserId) throws Exception {
-		WxCorpApp wxCorpApp = WeChatCorpFactory.getCorpConfigStrategy(corpId);
-		LambdaQueryWrapper<CorpUserAuth> corpUserAuthWrapper = Wrappers.lambdaQuery(CorpUserAuth.class)
-				.eq(CorpUserAuth::getExternalUserid, externalUserId)
-				.eq(CorpUserAuth::getWxCorpId, wxCorpApp.getId()).last("limit 1");
-		CorpUserAuth corpUserAuth = corpUserAuthMapper.selectOne(corpUserAuthWrapper);
-		CorpUser corpUser = null;
-		if (corpUserAuth == null) {
-			//尝试添加客户
-			CorpXmlMessage message = new CorpXmlMessage();
-			message.setToUserName(wxCorpApp.getCorpId());
-			message.setExternalUserId(externalUserId);
-			corpEventActionService.addExternalContact(message, null);
-			corpUserAuth = corpUserAuthMapper.selectOne(corpUserAuthWrapper);
-			if (corpUserAuth != null) {
-				corpUser = corpUserMapper.selectOne(Wrappers.lambdaQuery(CorpUser.class).eq(CorpUser::getId, corpUserAuth.getCorpUserId()).last("limit 1"));
-			}
-		} else {
-			corpUser = corpUserMapper.selectOne(Wrappers.lambdaQuery(CorpUser.class).eq(CorpUser::getId, corpUserAuth.getCorpUserId()).last("limit 1"));
-		}
-		if (corpUser == null) {
-			log.info("该客户{}不存在", externalUserId);
-			throw BusinessRuntimeException.getInstance("该企业微信用户不存在..");
-		}
-		return corpUser.getUnionid();
-	}
-
-
-	/**
-	 * 设置 设备活动满减配置
-	 */
-	@PostMapping("/set/equipment/activity/reduce")
-	public Result<String> setEquipmentAcReduceConfig(@RequestBody EquipmentActivityReduce equipmentActivityReduce) {
-		equipmentActivityReduceService.saveOrUpdateEquipmentAcReduceConfig(equipmentActivityReduce);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑 设备活动满减配置
-	 */
-	@PutMapping("/put/equipment/activity/reduce")
-	public Result<String> updateEquipmentAcReduceConfig(@RequestBody EquipmentActivityReduce equipmentActivityReduce) {
-		if (equipmentActivityReduce.getId() == null) {
-			throw BusinessRuntimeException.getInstance("记录不存在..");
-		}
-		equipmentActivityReduceService.saveOrUpdateEquipmentAcReduceConfig(equipmentActivityReduce);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 设备活动满减列表
-	 */
-	@GetMapping("/get/equipment/activity/reduce")
-	public Result<SearchResult<EquipmentActivityReduce>> getEquipmentAcReduceConfig() {
-		SearchResult<EquipmentActivityReduce> search = beanSearcher.search(EquipmentActivityReduce.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(EquipmentActivityReduce::getDeleted, true)
-				.orderBy(EquipmentActivityReduce::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-
-	/**
-	 * 删除设备满减活动
-	 */
-	@DeleteMapping("/del/equipment/activity/reduce/{id}")
-	public Result<String> getEquipmentAcReduceConfig(@PathVariable Long id) {
-		Optional.ofNullable(equipmentActivityReduceService.getById(id)).ifPresent(e -> {
-			e.setDeleted(false);
-			equipmentActivityReduceService.updateById(e);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 优惠券领取详情
-	 */
-	@GetMapping("/get/receipt/detail/{couponId}")
-	public Result<SearchResult<CouponReceiptDetailView>> getReceiptDetail(@PathVariable Long couponId) {
-		SearchResult<CouponReceiptDetailView> search = beanSearcher.search(CouponReceiptDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.put("cid",String.format("and id = %s", couponId))
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 优惠券使用详情
-	 */
-	@GetMapping("/get/used/detail/{couponId}")
-	public Result<SearchResult<CouponUsedDetailView>> getUsedDetail(@PathVariable Long couponId) {
-		SearchResult<CouponUsedDetailView> search = beanSearcher.search(CouponUsedDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.put("cid",String.format("and id = %s", couponId))
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 使用优惠券订单金额
-	 */
-	@GetMapping("/get/used/money/{couponId}")
-	public Result<BigDecimal> getUsedMoney(@PathVariable Long couponId) {
-		BigDecimal money = Optional.ofNullable(orderDonMapper.getCouponUsedMoney(couponId)).orElse(BigDecimal.ZERO);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(money.divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
-	}
-}

+ 0 - 1340
netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java

@@ -1,1340 +0,0 @@
-package com.cyksj.web.controller.manage.distribute;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.BetweenFormater;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.excel.EasyExcel;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.StringUtil;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.*;
-import com.cyksj.mapper.manage.cms.CmsUserMapper;
-import com.cyksj.mapper.manage.coupon.CouponDistributePopularizeMapper;
-import com.cyksj.mapper.manage.distribute.*;
-import com.cyksj.mapper.manage.distribute.equipment.UserDistributeEquipmentMapper;
-import com.cyksj.mapper.manage.distribute.sub.UserDistributeSubMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.request.BusinessDistributeDefaultRateDetailReq;
-import com.cyksj.model.request.DistributeApplyMoneyReq;
-import com.cyksj.model.request.UserDistributeReq;
-import com.cyksj.model.views.*;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.distribute.DistributeService;
-import com.cyksj.service.distribute.UserDistributeReturnMoneyDetailService;
-import com.cyksj.service.mange.business.UserBusinessRateService;
-import com.cyksj.service.mange.statistics.StatisticsDataService;
-import com.cyksj.service.sys.SysConfigService;
-import com.cyksj.service.user.UserBenefitsService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.stream.Collectors;
-
-/** admin/分销管理
- *项目名: netflix
- *文件名: DistributeController
- *创建者: JavaZou
- *创建时间:2022/11/14 12:06
- */
-@RestController
-@RequestMapping("/manage/distribute")
-@RequiredArgsConstructor
-@Slf4j
-public class DistributeController {
-
-	private final DistributeService distributeService;
-
-	private final UserDistributeMapper userDistributeMapper;
-
-	private final BeanSearcher beanSearcher;
-
-	private final DistributeMoneyApplyMapper distributeMoneyApplyMapper;
-
-	private final DistributePointsExchangeMoneyMapper distributePointsExchangeMoneyMapper;
-
-	private final GoodsDonMapper goodsDonMapper;
-
-	private final UserMapper userMapper;
-
-	private final GoodsDonSkuMapper goodsDonSkuMapper;
-
-	private final StatisticsDataService statisticsDataService;
-
-	private final UserBusinessRateService userBusinessRateService;
-
-	private final UserDistributeBusinessRateMapper userDistributeBusinessRateMapper;
-
-	private final HttpServletRequest request;
-
-	private final CmsUserMapper cmsUserMapper;
-
-	private final UserBusinessDefaultRateConfigMapper defaultRateConfigMapper;
-
-	private final BusinessDistributeDefaultRateConfigMapper businessDefaultRateConfigMapper;
-
-	private final BusinessDistributeDefaultSkuRateConfigMapper businessDistributeDefaultSkuRateConfigMapper;
-
-	private final UserBenefitsService userBenefitsService;
-
-	private final CouponDistributePopularizeMapper couponDistributePopularizeMapper;
-
-	private final SysConfigService sysConfigService;
-
-	private final RedisService redisService;
-
-	private final DistributeGoodsSkuAlertMapper distributeGoodsSkuAlertMapper;
-
-	private final UserDistributeRuleOrderRecordMapper userDistributeRuleOrderRecordMapper;
-
-	private final UserDistributeBusinessGeneralRateMapper businessGeneralRateMapper;
-
-	private final OrderDonMapper orderDonMapper;
-
-	private final UserDistributeTargetAlertMapper targetAlertMapper;
-
-	private final UserDistributeTargetAlertRecordMapper targetAlertRecordMapper;
-
-	private final UserDistributeSharedWhiteMapper userDistributeSharedWhiteMapper;
-
-	private final UserDistributeEquipmentMapper userDistributeEquipmentMapper;
-
-	private final UserDistributeSubMapper userDistributeSubMapper;
-
-	private final UserDistributeReturnMoneyDetailService userDistributeReturnMoneyDetailService;
-	/**
-	 * 添加固定推广者
-	 */
-	@PostMapping
-	@SaCheckPermission("distribute:add")
-	@Log(module = "分销管理/增加推广者", businessType = BusinessType.POST, isSaveRequestData = true)
-	public Result<String> saveDistributes(@RequestBody @NotNull UserDistributeReq userDistributeReq) {
-		try {
-			distributeService.insertDistribute(userDistributeReq);
-			Long businessId = userDistributeReq.getBusinessId();
-			//保存商务人员提成比例
-			userBusinessRateService.saveBusinessRate(businessId);
-			//清除 之前有普通推广专属码
-			couponDistributePopularizeMapper.update(null, Wrappers.lambdaUpdate(CouponDistributePopularize.class)
-					.set(CouponDistributePopularize::getDeleted, 0)
-					.eq(CouponDistributePopularize::getUserId, userDistributeReq.getUserId())
-					.eq(CouponDistributePopularize::getIsGeneral, true));
-		} catch (Exception e) {
-			String cacheKey = RedisService.key.USER_DISTRIBUTE_ADD_KEY.getNameFormat(userDistributeReq.getUserId());
-			if (redisService.hasKey(cacheKey)) {
-				redisService.del(cacheKey);
-			}
-			throw BusinessRuntimeException.getInstance(e.getMessage());
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("添加成功");
-	}
-
-	/**
-	 * 删除固定推广者
-	 */
-	@DeleteMapping("/del/{id}")
-	@SaCheckPermission("distribute:delete")
-	@Log(module = "分销管理/删除推广者", businessType = BusinessType.DELETE, isSaveRequestData = true)
-	public Result<String> deleteDistributesById(@PathVariable Long id) {
-		if (id == null || id < 1) {
-			throw BusinessRuntimeException.getInstance("id不存在");
-		}
-		userDistributeMapper.deleteById(id);
-		userDistributeEquipmentMapper.delete(Wrappers.lambdaQuery(UserDistributeEquipment.class)
-				.eq(UserDistributeEquipment::getDistributeId, id));
-		//删除对应的优惠码关联
-		couponDistributePopularizeMapper.update(null, Wrappers.lambdaUpdate(CouponDistributePopularize.class)
-				.set(CouponDistributePopularize::getDeleted, 0)
-				.eq(CouponDistributePopularize::getDistributeId, id)
-				.eq(CouponDistributePopularize::getDeleted, 1));
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除成功");
-	}
-
-	/**
-	 * 推广者编辑
-	 */
-	@PutMapping
-	@SaCheckPermission("distribute:update")
-	@Log(module = "分销管理/编辑推广者", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> editDistribute(@RequestBody UserDistributeReq userDistributeReq) {
-		distributeService.editDistribute(userDistributeReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑成功");
-	}
-
-	/**
-	 * 固定推广者详情
-	 */
-	@GetMapping("/get/detail/{id}")
-	public Result<UserDistributeRateDetailView> getDetailById(@PathVariable Long id) {
-		UserDistributeRateDetailView rateDetailView = new UserDistributeRateDetailView();
-		List<UserDistributeView> rates = beanSearcher.searchAll(UserDistributeView.class, MapUtils.builder()
-				.put("dis_id", String.format(" and up.distribute_id = %s", id))
-				.orderBy(UserDistributeView::getGoodsId).asc()
-				.build());
-		rateDetailView.setRates(rates);
-		List<UserSkuDistributeView> skuRates = beanSearcher.searchAll(UserSkuDistributeView.class, MapUtils.builder()
-				.put("dis_id", String.format(" and up.distribute_id = %s", id))
-				.orderBy(UserSkuDistributeView::getGoodsId).asc()
-				.build());
-		rateDetailView.setSkuRates(skuRates);
-
-		List<CouponDistributePopularizeDetailView> distributePopularizes = beanSearcher.searchAll(CouponDistributePopularizeDetailView.class, MapUtils.builder()
-				.field(CouponDistributePopularizeDetailView::getDistributeId, id)
-				.build());
-		rateDetailView.setCouponRelates(distributePopularizes);
-
-		List<UserDistributeTargetAlert> targets = targetAlertMapper.selectList(Wrappers.lambdaQuery(UserDistributeTargetAlert.class)
-				.eq(UserDistributeTargetAlert::getDistributeId, id));
-		rateDetailView.setTargets(targets);
-		rateDetailView.setEpRate(userDistributeEquipmentMapper.selectOne(Wrappers.lambdaQuery(UserDistributeEquipment.class)
-				.eq(UserDistributeEquipment::getDistributeId, id).last("limit 1")));
-
-		rateDetailView.setUserDistributeSub(beanSearcher.searchFirst(UserDistributeSub.class, MapUtils.builder()
-				.field(UserDistributeSub::getSubDistributeId, id)
-				.build()));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(rateDetailView);
-	}
-
-	/**
-	 * 下级渠道
-	 */
-	@GetMapping("/get/sub/{distributeId}")
-	public Result<SearchResult<UserDistributeSub>> getSub(@PathVariable Long distributeId) {
-		SearchResult<UserDistributeSub> search = beanSearcher.search(UserDistributeSub.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(UserDistributeSub::getDistributeId, distributeId)
-				.orderBy(UserDistributeSub::getCreatedTime).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 删除下级渠道
-	 */
-	@DeleteMapping("/delete/sub/{id}")
-	public Result<String> deleteSubById(@PathVariable Long id) {
-		userDistributeSubMapper.deleteById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除成功");
-
-	}
-
-	/**
-	 * 固定渠道平台分销详情 趋势图
-	 */
-	@GetMapping("/get/distribute/plat/brokenLine/{sharedId}")
-	public Result<BrokenLineObjView> getDsPlatBrokenLine(@PathVariable Long sharedId, Long firstDate, Long lastDate) {
-		String first = null;
-		String end = null;
-		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd");
-		}
-		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
-		}
-		BrokenLineObjView brokenLineObjView = Optional.ofNullable(orderDonMapper.selectDsPlatBrokenLineMoney(sharedId, first, end))
-				.orElse(new BrokenLineObjView());
-
-		if (brokenLineObjView != null) {
-			List<DistributePlatOrderDonBrokenLineView> views = beanSearcher.searchAll(DistributePlatOrderDonBrokenLineView.class, MapUtils.flatBuilder(request.getParameterMap())
-					.field(DistributePlatOrderDonBrokenLineView::getDate, first, end).op(Operator.Between)
-					.put("sid", String.format("where shared_id = %s", sharedId))
-					.orderBy(DistributePlatOrderDonBrokenLineView::getDate).asc()
-					.build());
-			Map<Long, List<DistributePlatOrderDonBrokenLineView>> goodsMap = views.stream().collect(Collectors.groupingBy(DistributePlatOrderDonBrokenLineView::getGoodsId));
-			brokenLineObjView.setDsGoodsData(goodsMap);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineObjView);
-	}
-
-	/**
-	 * 固定推广者列表
-	 */
-	@GetMapping
-	public Result<SearchResult<UserDistributeViews>> distributeList(String nickname, String showId, String startTime, String endTime, Boolean isSpecialEp) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		//是否是商务人员
-		if (userBusinessRateService.isBusiness(adminId)) {
-			builder.field(UserDistributeViews::getBusinessId, adminId);
-		}
-		if (StrUtil.isNotBlank(showId)) {
-			builder.field(UserDistributeViews::getUserId, userMapper.getUserIdByShowId(showId));
-		}
-		if (StrUtil.isNotBlank(nickname)) {
-			List<Long> userIds = userMapper.selectListByNickname(nickname);
-			if (CollUtil.isNotEmpty(userIds)) {
-				builder.field(UserDistributeViews::getUserId, userIds).op(Operator.InList);
-			}
-		}
-		String timeSql = StrUtil.EMPTY;
-		if (StrUtil.isNotBlank(startTime)) {
-			timeSql += String.format("and od.created_time >= '%s'", startTime);
-		}
-		if (StrUtil.isNotBlank(endTime)) {
-			timeSql += String.format("and od.created_time < '%s'", endTime);
-		}
-		if (StrUtil.isNotBlank(timeSql)) {
-			builder.put("time", timeSql);
-			//按时间筛选 固定推广人分销情况 倒序
-			builder.orderBy(UserDistributeViews::getDistributeOrdersMoney).desc();
-		}
-		if (isSpecialEp != null) {
-			//是否是特殊设备分销渠道商
-			String condition = String.format(" and %s (select 1 from user_distribute_equipment up where up.distribute_id = ud.id limit 1)", isSpecialEp ? "exists" : "not exists");
-			builder.put("condition", condition);
-		}
-		Map<Long, String> businessNameMap = new ConcurrentHashMap<>();
-		SearchResult<UserDistributeViews> search = beanSearcher.search(UserDistributeViews.class,
-				builder.build());
-		search.getDataList().forEach(view -> {
-			if (view.getDistributeOrdersMoney().compareTo(BigDecimal.ZERO) > 0) {
-				Optional.ofNullable(userDistributeMapper.selectSoldMaxGoods(view.getUserId())).ifPresent(title -> view.setGoodsTitle(title));
-			}
-			String businessName = businessNameMap.get(view.getBusinessId());
-			view.setBusinessName(businessName);
-			if (StrUtil.isEmpty(businessName)) {
-				Optional.ofNullable(cmsUserMapper.selectById(view.getBusinessId()))
-						.ifPresent(cmsUser -> {
-							businessNameMap.putIfAbsent(view.getBusinessId(), cmsUser.getNickname());
-							view.setBusinessName(cmsUser.getNickname());
-						});
-			}
-			Optional.ofNullable(userMapper.selectById(view.getUserId()))
-					.ifPresent(user -> view.setNickname(user.getNickname()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 渠道推广者查询列表
-	 */
-	@GetMapping("/search")
-	public Result<SearchResult<DistributeSearchView>> searchDistribute() {
-		SearchResult<DistributeSearchView> search = beanSearcher.search(DistributeSearchView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 所有固定推广者列表
-	 */
-	@GetMapping("/get/all")
-	public Result<List<UserDistributeVo>> getAllDistributes() {
-		List<UserDistributeVo> userDistributes = beanSearcher.searchAll(UserDistributeVo.class, MapUtils.flatBuilder(request.getParameterMap())
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userDistributes);
-	}
-
-	/**
-	 * 获取平台分销比例
-	 */
-	@GetMapping("/get/plat")
-	public Result<List<GoodsDon>> getGoodsDistributeRate() {
-		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDonMapper.selectList(Wrappers.lambdaQuery(GoodsDon.class).in(GoodsDon::getType, Constant.dsGoodsIds).eq(GoodsDon::getDeleted, true)
-				.eq(GoodsDon::getStatus, true).orderByAsc(GoodsDon::getType)
-				.eq(GoodsDon::getIsDistribute, true)
-				.orderByAsc(GoodsDon::getId)
-				.select(GoodsDon::getId, GoodsDon::getType, GoodsDon::getTitle, GoodsDon::getRate, GoodsDon::getSecondRate)));
-	}
-
-	/**
-	 * 平台开启规格分销
-	 */
-	@GetMapping("/get/sku/rate")
-	public Result<List<GoodsDonSkuRateView>> getSkuRate() {
-		List<GoodsDonSkuRateView> goodsDonSkuRateViews = beanSearcher.searchAll(GoodsDonSkuRateView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.orderBy(GoodsDonSkuRateView::getGoodsId).asc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDonSkuRateViews);
-	}
-
-	/**
-	 * 设置普通分销平台规格比例
-	 */
-	@PutMapping("/set/common/sku/rate")
-	public Result<String> setDistributeCommonSkuRate(@RequestBody List<DistributeGeneralSkuRate> skuRates) {
-		distributeService.setDistributeCommonSkuRate(skuRates);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 获取推广者分销订单详情
-	 */
-	@GetMapping("/get/distribute/order/detail")
-	public Result<SearchResult<DistributeOrdersDetailView>> getDistributeOrderDetail() {
-		SearchResult<DistributeOrdersDetailView> search = beanSearcher.search(DistributeOrdersDetailView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 新注册分销人数
-	 */
-	@GetMapping("/get/register/distribute/user")
-	public Result<SearchResult<RegisterDistributeOrdersView>> getRegisterDistributeUserDetail() {
-		SearchResult<RegisterDistributeOrdersView> search = beanSearcher.search(RegisterDistributeOrdersView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			List<RegisterDistributeOrdersDetailView> ordersDetailViewList = beanSearcher.searchAll(RegisterDistributeOrdersDetailView.class, MapUtils.flatBuilder(request.getParameterMap()).field(RegisterDistributeOrdersDetailView::getUserId, data.getUserId()).op(Operator.Equal).build());
-			data.setOrderNums(ordersDetailViewList.size());
-			Optional<BigDecimal> money = ordersDetailViewList.stream().filter(order -> {
-				if (!Constant.noOrderAllStatus.contains(order.getStatus().name())) {
-					return true;
-				}
-				return false;
-			}).map(RegisterDistributeOrdersDetailView::getMoney).reduce(BigDecimal::add);
-			data.setMoney(money.isPresent() ? money.get() : BigDecimal.ZERO);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 获取新注册的分销用户订单数据
-	 */
-	@GetMapping("/get/register/distribute/user/order/detail")
-	public Result<SearchResult<RegisterDistributeOrdersDetailView>> getRegisterDistributeOrderDetail() {
-		SearchResult<RegisterDistributeOrdersDetailView> search = beanSearcher.search(RegisterDistributeOrdersDetailView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			User user = userMapper.selectById(data.getUserId());
-			GoodsDonSku sku = goodsDonSkuMapper.selectById(data.getSkuId());
-			data.setNickname(user != null ? user.getNickname() : "");
-			data.setSpecVal(sku != null ? sku.getSpecVal() : "");
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 平台分销比例修改
-	 */
-	@PutMapping("/put/goods/rate")
-	@Log(module = "分销管理/修改平台分销比例", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> editGoodsDistributeRate(@RequestBody UserDistributeReq userDistributeReq) {
-		for (UserPlatDistributeRate rate : userDistributeReq.getRates()) {
-			if (rate.getRate() == null) {
-				rate.setRate(0);
-			}
-			if (rate.getSecondRate() == null) {
-				rate.setSecondRate(0);
-			}
-			if (rate.getRate() < 0 || rate.getRate() > 100) {
-				throw new BusinessRuntimeException("比例错误");
-			}
-			GoodsDon goodsDon = goodsDonMapper.selectById(rate.getGoodsId());
-			if (goodsDon == null || goodsDon.getType() == 3) {
-				throw new BusinessRuntimeException("平台错误");
-			}
-			goodsDon.setRate(rate.getRate());
-			goodsDon.setSecondRate(rate.getSecondRate());
-			goodsDonMapper.updateById(goodsDon);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑成功");
-	}
-
-	/**
-	 * 提现title
-	 */
-	@GetMapping("/get/applyMoney/title")
-	public Result<MoneyApplyView> applyMoneyTitle() {
-		MoneyApplyView moneyApplyView = new MoneyApplyView();
-		moneyApplyView.setThreshold(distributePointsExchangeMoneyMapper.selectOne(null));
-		List<DistributeMoneyApply> distributeMoneyApplies = distributeMoneyApplyMapper.selectList(Wrappers.lambdaQuery(DistributeMoneyApply.class).eq(DistributeMoneyApply::getVerifyStatus, DistributeMoneyApply.Status.success).select(DistributeMoneyApply::getMoney));
-		Optional<BigDecimal> reduce = distributeMoneyApplies.stream().map(DistributeMoneyApply::getMoney).reduce(BigDecimal::add);
-		moneyApplyView.setGotMoney(reduce.isPresent() ? reduce.get() : BigDecimal.ZERO);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(moneyApplyView);
-	}
-
-	/**
-	 * 提现列表
-	 */
-	@GetMapping("/get/applyMoney/list")
-	@SaCheckPermission("distribute:applyView")
-	public Result<SearchResult<DistributeMoneyApplyView>> applyMoneyList() {
-		SearchResult<DistributeMoneyApplyView> search = beanSearcher.search(DistributeMoneyApplyView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 提现审核
-	 */
-	@PutMapping("/verify/applyMoney")
-	public Result<String> verifyApplyMoney(@RequestBody @Validated DistributeApplyMoneyReq distributeApplyMoneyReq) {
-		DistributeMoneyApply.Status status = DistributeMoneyApply.Status.checkStatus(distributeApplyMoneyReq.getVerifyStatus());
-		if (status == null || status == DistributeMoneyApply.Status.verifying) {
-			throw BusinessRuntimeException.getInstance("审核状态错误");
-		}
-		DistributeMoneyApply distributeMoneyApply = distributeMoneyApplyMapper.selectById(distributeApplyMoneyReq.getId());
-		if (distributeMoneyApply == null) {
-			throw BusinessRuntimeException.getInstance("提现记录不存在");
-		}
-		if (distributeMoneyApply.getVerifyStatus() != DistributeMoneyApply.Status.verifying) {
-			throw BusinessRuntimeException.getInstance("该提现记录已处理,无法再进行审核");
-		}
-		distributeMoneyApply.setVerifyStatus(status);
-		if (DistributeMoneyApply.Status.fail.name().equals(distributeApplyMoneyReq.getVerifyStatus()) && StrUtil.isEmpty(distributeApplyMoneyReq.getReason())) {
-			throw BusinessRuntimeException.getInstance("拒绝原因为空");
-		}
-		if (DistributeMoneyApply.Status.fail.name().equals(distributeApplyMoneyReq.getVerifyStatus())) {
-			distributeMoneyApply.setReason(distributeApplyMoneyReq.getReason());
-			Long userId = distributeMoneyApply.getUserId();
-			userBenefitsService.addDistributePoints(userId, distributeMoneyApply.getPoints());
-			log.info("归还积分:{}至用户{}结束", distributeMoneyApply.getPoints(), userId);
-			//记录返现明细
-			userDistributeReturnMoneyDetailService.recordDistributeReturnMoney(distributeMoneyApply.getUserId(), distributeMoneyApply.getMoney(), "提现失败");
-		}
-		if (DistributeMoneyApply.Status.success.name().equals(distributeApplyMoneyReq.getVerifyStatus())) {
-//			if (StrUtil.isBlank(distributeApplyMoneyReq.getImg())) {
-//				throw BusinessRuntimeException.getInstance("审核成功时,打款图片不存在");
-//			}
-			distributeMoneyApply.setImg(distributeApplyMoneyReq.getImg());
-		}
-		distributeMoneyApplyMapper.updateById(distributeMoneyApply);
-
-		if (distributeMoneyApply.getVerifyStatus() == DistributeMoneyApply.Status.fail) {
-			String key = String.format(RedisService.key.APPLY_MONEY_DAY_LIMIT_KEY.getName(), DateTime.now().toDateStr(), DistributeMoneyApply.MType.ds.name(), distributeMoneyApply.getUserId());
-			redisService.del(key);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("审核操作成功");
-	}
-
-	/**
-	 * 审核成功,编辑打款截图
-	 */
-	@PutMapping("/verify/applyMoney/img")
-	public Result<String> putApplyMoneyImg(@RequestBody @Validated DistributeApplyMoneyReq distributeApplyMoneyReq) {
-		DistributeMoneyApply entity = distributeMoneyApplyMapper.selectById(distributeApplyMoneyReq.getId());
-		if (entity == null || entity.getVerifyStatus() != DistributeMoneyApply.Status.success) {
-			throw BusinessRuntimeException.getInstance("审核记录错误");
-		}
-//		if (StrUtil.isBlank(distributeApplyMoneyReq.getImg())) {
-//			throw BusinessRuntimeException.getInstance("打款截图为空");
-//		}
-		DistributeMoneyApply apply = new DistributeMoneyApply();
-		apply.setImg(distributeApplyMoneyReq.getImg());
-		apply.setId(distributeApplyMoneyReq.getId());
-		distributeMoneyApplyMapper.updateById(apply);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑成功");
-	}
-
-	/**
-	 * 获取分销head
-	 */
-	@GetMapping("/get/headData")
-	public Result<BackgroundDataView> getDistributeHeadData(Long startTime, Long endTime) {
-		BackgroundDataView backgroundDataView = new BackgroundDataView();
-		Date startDate = null;
-		Date endDate = null;
-		if (startTime != null) {
-			startDate = DateUtil.date(startTime);
-		}
-		if (endTime != null) {
-			endDate = DateUtil.date(endTime);
-		}
-		//分销金额数据统计
-		statisticsDataService.distribute(backgroundDataView, startDate, endDate);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(backgroundDataView);
-	}
-
-	/**
-	 * 实物设备分销邀请新用户人数
-	 */
-	@GetMapping("/get/equipment/distribute/newUser")
-	public Result<Integer> getEquipmentDistributeNewUser() {
-		Number number = beanSearcher.searchCount(EquipmentDistributeNewUserView.class, MapUtils.builder()
-				.field(EquipmentDistributeNewUserView::getIsNewUser, true)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(number.intValue());
-	}
-
-	/**
-	 * 绑定固定分销者的商务人员详情
-	 */
-	@GetMapping("/get/business/list")
-	public Result<SearchResult<DistributeBusinessView>> getDistributeBusinessView() {
-		long adminId = StpUtil.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		DateTime beginOfMonth = DateUtil.beginOfMonth(DateTime.now());
-		String thisMonth = beginOfMonth.toString("yyyy-MM");
-		//是否是商务人员
-		if (userBusinessRateService.isBusiness(adminId)) {
-			builder.field(DistributeBusinessView::getBusinessId, adminId);
-		}
-		builder.put("time", String.format("date_format(ubr.order_created_time,'%%Y-%%m') = '%s'", thisMonth));
-		SearchResult<DistributeBusinessView> search = beanSearcher.search(DistributeBusinessView.class, builder.build());
-		search.getDataList().forEach(data -> {
-			Number numOfRelation = beanSearcher.searchCount(UserDistribute.class, MapUtils.builder().field(UserDistribute::getBusinessId, data.getBusinessId()).field(UserDistribute::getDeleted, true).build());
-			data.setNumOfRelation(numOfRelation.intValue());
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 商务人员列表
-	 */
-	@GetMapping("/get/businessList")
-	public Result<List<DistributeBusinessListVo>> getBusinessList() {
-		long adminId = StpUtil.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		//是否是商务人员
-		if (userBusinessRateService.isBusiness(adminId)) {
-			builder.field(DistributeBusinessListVo::getBusinessId, adminId);
-		}
-		List<DistributeBusinessListVo> list = beanSearcher.searchAll(DistributeBusinessListVo.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	/**
-	 * 商务人员提成详情
-	 */
-	@GetMapping("/get/takeMoney/detail")
-	public Result<SearchResult<BusinessTakeMoneyDetail>> getTakeMoneyDetail(String firstMonthDate, String secondMonthDate) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		//是否是商务人员
-		if (userBusinessRateService.isBusiness(adminId)) {
-			builder.field(BusinessTakeMoneyDetail::getBusinessId, adminId);
-		}
-		String timeSql = StringUtil.EMPTY;
-		if (StrUtil.isNotBlank(firstMonthDate)) {
-			timeSql += String.format("date_format(ubr.order_created_time,'%%Y-%%m') >= '%s'", firstMonthDate);
-		}
-		if (StrUtil.isNotBlank(secondMonthDate)) {
-			timeSql += String.format("and date_format(ubr.order_created_time,'%%Y-%%m') <= '%s'", secondMonthDate);
-		}
-		if (StrUtil.isNotBlank(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		SearchResult<BusinessTakeMoneyDetail> search = beanSearcher.search(BusinessTakeMoneyDetail.class, builder.build());
-		search.getDataList().forEach(data -> {
-			User user = userMapper.selectById(data.getUserId());
-			Optional.ofNullable(user).ifPresent(u -> {
-				data.setNickname(u.getNickname());
-				data.setCreatedTime(u.getCreatedTime());
-			});
-			CmsUser business = cmsUserMapper.selectById(data.getBusinessId());
-			Optional.ofNullable(business).ifPresent(bs -> data.setBusinessName(bs.getNickname()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 商务提成head
-	 */
-	@GetMapping("/get/business/headData")
-	public Result<BusinessTakeMoneyHeadView> getTakeMoneyHeadDetail(String firstMonthDate, String secondMonthDate) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		//是否是商务人员
-		if (userBusinessRateService.isBusiness(adminId)) {
-			builder.field(BusinessTakeMoneyHeadView::getBusinessId, adminId);
-		}
-		String timeSql = StringUtil.EMPTY;
-		if (StrUtil.isNotBlank(firstMonthDate)) {
-			timeSql += String.format("date_format(ubr.order_created_time,'%%Y-%%m') >= '%s'", firstMonthDate);
-		}
-		if (StrUtil.isNotBlank(secondMonthDate)) {
-			timeSql += String.format("and date_format(ubr.order_created_time,'%%Y-%%m') <= '%s'", secondMonthDate);
-		}
-		if (StrUtil.isNotBlank(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		BusinessTakeMoneyHeadView headView = beanSearcher.searchFirst(BusinessTakeMoneyHeadView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(headView);
-	}
-
-	/**
-	 * 查看商务人员提成比例
-	 */
-	@GetMapping("/get/business/rate")
-	public Result<List<UserDistributeBusinessRateRecordView>> getUserDistributeBusinessRateDetail(Long businessId, Integer type) {
-		if (type == null) type = 1;
-		List<UserDistributeBusinessRateRecordView> userDistributeBusinessRate = beanSearcher.searchAll(UserDistributeBusinessRateRecordView.class, MapUtils.builder()
-				.put("business_id", String.format(" and ur.business_id = %s", businessId))
-				.field(UserDistributeBusinessRateRecordView::getType, type)
-				.orderBy(UserDistributeBusinessRateRecordView::getGoodsId).asc()
-				.orderBy(UserDistributeBusinessRateRecordView::getSkuId).asc()
-				.build());
-		userDistributeBusinessRate.forEach(data -> {
-			data.setBusinessId(businessId);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userDistributeBusinessRate);
-	}
-
-	/**
-	 * 修改商务人员提成比例
-	 */
-	@PutMapping("/put/business/rate")
-	@Log(module = "分销管理/修改商务人员比例", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> updateBusinessRate(@RequestBody @Validated List<UserDistributeBusinessRate> rates) {
-		List<Long> newDsSkuIds = new ArrayList<>();
-		rates.forEach(userDistributeBusinessRate -> {
-			Long rateId = userDistributeBusinessRate.getId();
-			UserDistributeBusinessRate businessRate = Optional.ofNullable(userDistributeBusinessRateMapper.selectById(rateId)).orElse(new UserDistributeBusinessRate());
-			BeanUtil.copyProperties(userDistributeBusinessRate, businessRate);
-			Number number = beanSearcher.searchCount(GoodsDonSkuView.class, MapUtils.builder()
-					.field(GoodsDonSkuView::getGoodsId, userDistributeBusinessRate.getGoodsId())
-					.field(GoodsDonSkuView::getSkuId, userDistributeBusinessRate.getSkuId())
-					.field(GoodsDonSkuView::getGoodsDonDeleted, true)
-					.build());
-			if (number.intValue() == 0) {
-				userDistributeBusinessRateMapper.delete(Wrappers.lambdaQuery(UserDistributeBusinessRate.class)
-						.eq(UserDistributeBusinessRate::getBusinessId, userDistributeBusinessRate.getBusinessId())
-						.eq(UserDistributeBusinessRate::getGoodsId, userDistributeBusinessRate.getGoodsId())
-						.eq(UserDistributeBusinessRate::getSkuId, userDistributeBusinessRate.getSkuId()));
-				return;
-			}
-			if (businessRate.getId() == null) {
-				try {
-					userDistributeBusinessRateMapper.insert(businessRate);
-
-					newDsSkuIds.add(businessRate.getSkuId());
-				} catch (DuplicateKeyException e) {
-				}
-			} else {
-				userDistributeBusinessRateMapper.updateById(businessRate);
-			}
-		});
-
-		if (CollUtil.isNotEmpty(newDsSkuIds)) {
-			//删除存在告警的平台规格
-			distributeGoodsSkuAlertMapper.delete(Wrappers.lambdaQuery(DistributeGoodsSkuAlert.class)
-					.in(DistributeGoodsSkuAlert::getSkuId, newDsSkuIds));
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult("修改比例成功");
-	}
-
-	/**
-	 * 商务默认分配平台比例
-	 */
-	@GetMapping("/get/defaultRateConfig")
-	public Result<List<UserBusinessDefaultRateConfigView>> getDefaultRateConfig() {
-		List<UserBusinessDefaultRateConfigView> search = beanSearcher.searchAll(UserBusinessDefaultRateConfigView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 编辑商务默认平台比例
-	 */
-	@PutMapping("/update/business/defaultRate")
-	public Result<String> updateBusinessDefaultRate(@RequestBody List<UserBusinessDefaultRateConfig> configs) {
-		configs.forEach(rateConfig -> {
-			Long rateConfigId = rateConfig.getId();
-			UserBusinessDefaultRateConfig config = Optional.ofNullable(defaultRateConfigMapper.selectById(rateConfigId)).orElse(new UserBusinessDefaultRateConfig());
-			BeanUtil.copyProperties(rateConfig, config);
-			Number number = beanSearcher.searchCount(GoodsDonSkuView.class, MapUtils.builder()
-					.field(GoodsDonSkuView::getGoodsId, rateConfig.getGoodsId())
-					.field(GoodsDonSkuView::getGoodsDonDeleted, true)
-					.build());
-			if (number.intValue() == 0) {
-				defaultRateConfigMapper.delete(Wrappers.lambdaQuery(UserBusinessDefaultRateConfig.class)
-						.eq(UserBusinessDefaultRateConfig::getGoodsId, rateConfig.getGoodsId()));
-				return;
-			}
-			if (rateConfig.getId() == null) {
-				try {
-					defaultRateConfigMapper.insert(config);
-					return;
-				} catch (DuplicateKeyException e) {
-
-				}
-			}
-			defaultRateConfigMapper.updateById(config);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 商务人员推广平台分销比例默认配置列表
-	 */
-	@GetMapping("/get/business/distribute/rate")
-	public Result<BusinessDistributeRateDetailView> getBusinessDistributeRateConfigList() {
-		BusinessDistributeRateDetailView rateDetailView = new BusinessDistributeRateDetailView();
-		List<BusinessDistributeRateView> rates = beanSearcher.searchAll(BusinessDistributeRateView.class,
-				MapUtils.flatBuilder(request.getParameterMap())
-						.build());
-		rateDetailView.setRates(rates);
-		List<BusinessDistributeSkuRateView> skuRates = beanSearcher.searchAll(BusinessDistributeSkuRateView.class,
-				MapUtils.flatBuilder(request.getParameterMap())
-						.build());
-		rateDetailView.setSkuRates(skuRates);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(rateDetailView);
-	}
-
-	/**
-	 * 编辑商务人员推广平台分销比例默认配置列表
-	 */
-	@PutMapping("/put/business/distribute/rate")
-	@Transactional(rollbackFor = Throwable.class)
-	public Result<String> updateBusinessDistributeRate(@RequestBody BusinessDistributeDefaultRateDetailReq req) {
-		List<BusinessDistributeDefaultRateConfig> rates = req.getRates();
-		List<BusinessDistributeDefaultSkuRateConfig> skuRates = req.getSkuRates();
-		List<Long> alertGoodsId = new ArrayList<>();
-		if (CollUtil.isNotEmpty(rates)) {
-			rates.forEach(config -> {
-				Long id = config.getId();
-				Long goodsId = config.getGoodsId();
-				if (config.getRate() == null) {
-					config.setRate(0);
-				}
-				Integer rate = config.getRate();
-				if (goodsId == null) {
-					throw BusinessRuntimeException.getInstance("平台id为空");
-				}
-				if (rate < 0 && rate > 100) {
-					throw BusinessRuntimeException.getInstance("请输入正确的比例");
-				}
-				if (id == null) {
-					try {
-						businessDefaultRateConfigMapper.insert(config);
-						alertGoodsId.add(config.getGoodsId());
-					} catch (DuplicateKeyException e) {
-					}
-				} else {
-					businessDefaultRateConfigMapper.updateById(config);
-				}
-			});
-		}
-
-		//sku规格比例设置
-		if (CollUtil.isNotEmpty(skuRates)) {
-			List<Long> collect = skuRates.stream().map(BusinessDistributeDefaultSkuRateConfig::getSkuId).collect(Collectors.toList());
-			if (CollUtil.isNotEmpty(collect)) {
-				businessDistributeDefaultSkuRateConfigMapper.delete(Wrappers.lambdaQuery(BusinessDistributeDefaultSkuRateConfig.class)
-						.notIn(BusinessDistributeDefaultSkuRateConfig::getSkuId, collect));
-			}
-			skuRates.forEach(config -> {
-				if (config.getRate() == null) {
-					config.setRate(0);
-				}
-				Integer rate = config.getRate();
-				if (rate < 0 && rate > 100) {
-					throw BusinessRuntimeException.getInstance("请输入正确的比例");
-				}
-				if (config.getId() == null) {
-					try {
-						businessDistributeDefaultSkuRateConfigMapper.insert(config);
-						alertGoodsId.add(config.getGoodsId());
-					} catch (DuplicateKeyException e) {
-					}
-				} else {
-					businessDistributeDefaultSkuRateConfigMapper.updateById(config);
-				}
-			});
-		}
-
-		if (CollUtil.isNotEmpty(alertGoodsId)) {
-			//删除存在告警的平台
-			distributeGoodsSkuAlertMapper.delete(Wrappers.lambdaQuery(DistributeGoodsSkuAlert.class)
-					.in(DistributeGoodsSkuAlert::getGoodsId, alertGoodsId));
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 商务人员数据表
-	 */
-	@GetMapping("/get/business/data")
-	@SaCheckPermission("business:dataView")
-	public Result<SearchResult<BusinessDistributesDataView>> getBusinessDistributesData(String startTime, String endTime) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		String time1Sql = StrUtil.EMPTY;
-		String time2Sql = StrUtil.EMPTY;
-		String time3Sql = StrUtil.EMPTY;
-		if (StrUtil.isNotBlank(startTime)) {
-			time1Sql += String.format(" and ud.business_bind_time >= '%s'", startTime);
-			time2Sql += String.format(" and us.created_time >= '%s'", startTime);
-			time3Sql += String.format(" and od.created_time >= '%s'", startTime);
-		}
-		if (StrUtil.isNotBlank(endTime)) {
-			time1Sql += String.format(" and ud.business_bind_time < '%s'", endTime);
-			time2Sql += String.format(" and us.created_time < '%s'", endTime);
-			time3Sql += String.format(" and od.created_time < '%s'", endTime);
-		}
-		if (StrUtil.isNotBlank(time1Sql)) {
-			builder.put("time1", time1Sql);
-		}
-		if (StrUtil.isNotBlank(time2Sql)) {
-			builder.put("time2", time2Sql);
-		}
-		if (StrUtil.isNotBlank(time3Sql)) {
-			builder.put("time3", time3Sql);
-		}
-		//是否是商务人员
-		if (userBusinessRateService.isBusiness(adminId)) {
-			builder.field(BusinessDistributesDataView::getBusinessId, adminId);
-		}
-		SearchResult<BusinessDistributesDataView> search = beanSearcher.search(BusinessDistributesDataView.class, builder.build());
-		search.getDataList().forEach(data -> {
-			Optional.ofNullable(cmsUserMapper.selectById(data.getBusinessId()))
-					.ifPresent(cmsUser -> data.setBusinessName(cmsUser.getNickname()));
-
-		});
-//		search.getDataList().forEach(data -> {
-//			Map<String, Object> reMap = orderDonMapper.selectNumOfDistributeOrders(data.getBusinessId(), startTime, endTime, Constant.noOrderAllStatus);
-//			Object num = reMap.get("num");
-//			Object money = reMap.get("money");
-//			data.setNumOfDistributeOrders(Integer.parseInt(num.toString()));
-//			data.setDistributeOrdersMoney(BigDecimal.valueOf(Long.valueOf(money.toString())));
-//			Integer numOfNewUser = userDistributeSharedMapper.countByBusinessId(data.getBusinessId(), startTime, endTime);
-//			data.setNumOfNewUser(numOfNewUser);
-//		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 渠道积分提现详情
-	 */
-	@GetMapping("/get/apply/detail/{userId}")
-	public Result<UserDistributeViews> getApplyDetail(@PathVariable Long userId) {
-		UserDistributeViews userDistributeViews = userDistributeMapper.getApplyDetailByUserId(userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userDistributeViews);
-	}
-
-	/**
-	 * 获取渠道分销规则开启 状态
-	 */
-	@GetMapping("/get/rule/status")
-	public Result<Boolean> getRuleStatus() {
-		String ruleKey = Constant.DISTRIBUTE_RULE_KEY;
-		SysConfig ruleConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-				.eq(SysConfig::getSysKey, ruleKey).last("limit 1"));
-		if (ruleConfig == null) {
-			ruleConfig = new SysConfig();
-			ruleConfig.setSysKey(ruleKey);
-			ruleConfig.setRemark("渠道分销规则key");
-			//默认开启
-			ruleConfig.setSysValue(Constant.ONE_STR);
-			if (redisService.setNx(ruleKey, 1, 5l)) {
-				sysConfigService.save(ruleConfig);
-			}
-		}
-		if (StrUtil.equals(Constant.ONE_STR, ruleConfig.getSysValue())) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult(true);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(false);
-	}
-
-	/**
-	 * 开启/关闭 渠道分销规则 默认开启
-	 */
-	@PutMapping("/update/status/rule")
-	public Result<String> updateDsRuleStatus() {
-		String ruleKey = Constant.DISTRIBUTE_RULE_KEY;
-		SysConfig ruleConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-				.eq(SysConfig::getSysKey, ruleKey).last("limit 1"));
-		if (ruleConfig == null) {
-			throw BusinessRuntimeException.getInstance("渠道分销规则配置不存在");
-		}
-		if (Constant.ZERO_STR.equals(ruleConfig.getSysValue())) {
-			ruleConfig.setSysValue(Constant.ONE_STR);
-		} else {
-			ruleConfig.setSysValue(Constant.ZERO_STR);
-		}
-		sysConfigService.saveOrUpdate(ruleConfig);
-		//记录关闭打开状态
-		//关闭 记录一次
-		//距离上一次时间
-		UserDistributeRuleOrderRecord userDistributeRuleOrderRecord = Optional.ofNullable(userDistributeRuleOrderRecordMapper.selectOne(Wrappers.lambdaQuery(UserDistributeRuleOrderRecord.class)
-				.orderByDesc(UserDistributeRuleOrderRecord::getId).last("limit 1"))).orElse(new UserDistributeRuleOrderRecord());
-		if (StrUtil.equals(Constant.ZERO_STR, ruleConfig.getSysValue())) {
-			//距离上次关闭时间少于10分钟 不记录关闭时间
-			if (userDistributeRuleOrderRecord.getId() == null) {
-				if (redisService.setNx(RedisService.key.DISTRIBUTE_RULE_TIME_KEY.getName(), 1, RedisService.key.DISTRIBUTE_RULE_TIME_KEY.getTimeout())) {
-					userDistributeRuleOrderRecord.setEndTime(DateTime.now());
-					userDistributeRuleOrderRecordMapper.insert(userDistributeRuleOrderRecord);
-				}
-			} else {
-				if (userDistributeRuleOrderRecord.getStartTime() != null) {
-					Date startTime = userDistributeRuleOrderRecord.getStartTime();
-					if (DateTime.now().isAfter(DateUtil.offsetMinute(startTime, 10))) {
-						if (redisService.setNx(RedisService.key.DISTRIBUTE_RULE_TIME_KEY.getName(), 1, RedisService.key.DISTRIBUTE_RULE_TIME_KEY.getTimeout())) {
-							UserDistributeRuleOrderRecord newRecord = new UserDistributeRuleOrderRecord();
-							newRecord.setEndTime(DateTime.now());
-							userDistributeRuleOrderRecordMapper.insert(newRecord);
-						}
-					}
-				}
-			}
-		} else {
-			if (userDistributeRuleOrderRecord.getId() != null && userDistributeRuleOrderRecord.getStartTime() == null) {
-				if (DateTime.now().isAfter(DateUtil.offsetMinute(userDistributeRuleOrderRecord.getEndTime(), 10))) {
-					userDistributeRuleOrderRecord.setStartTime(DateTime.now());
-					userDistributeRuleOrderRecord.setDuration(DateUtil.formatBetween(userDistributeRuleOrderRecord.getEndTime(), userDistributeRuleOrderRecord.getStartTime(), BetweenFormater.Level.SECOND));
-					userDistributeRuleOrderRecordMapper.updateById(userDistributeRuleOrderRecord);
-				}
-			}
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 渠道分销规则列表
-	 */
-	@GetMapping("/get/rule/list")
-	public Result<SearchResult<UserDistributeRuleOrderRecordView>> getDistributeRuleList() {
-		SearchResult<UserDistributeRuleOrderRecordView> search = beanSearcher.search(UserDistributeRuleOrderRecordView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			Date endTime = data.getEndTime();
-			Date startTime = data.getStartTime();
-			String time = StrUtil.EMPTY;
-			if (endTime != null) {
-				time = String.format("created_time >= '%s'", DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"));
-			}
-			if (startTime != null) {
-				if (StrUtil.isNotBlank(time)) {
-					time += " and ";
-				}
-				time += String.format("created_time < '%s'", DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"));
-			}
-			String condition = "where is_rule is true";
-			if (StrUtil.isNotBlank(time)) {
-				condition += String.format(" and %s", time);
-			}
-			DistributeWaitingOrderPointsRuleView ruleView = beanSearcher.searchFirst(DistributeWaitingOrderPointsRuleView.class, MapUtils.builder()
-					.put("condition", condition).build());
-			data.setNumOfOrder(ruleView.getNumOfOrder());
-			data.setOrderAmount(ruleView.getOrderAmount() == null ? BigDecimal.ZERO : ruleView.getOrderAmount());
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 商务分销当月渠道商以及历史渠道商在当月的数据
-	 */
-	@GetMapping("/get/business/distribute/monthlyData")
-	public Result<List<BusinessDistributesMonthlyDataView>> getBusinessMonthlyData(String firstMonthDate, String secondMonthDate) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		if (StrUtil.isEmpty(firstMonthDate)) {
-			firstMonthDate = DateUtil.beginOfMonth(DateTime.now()).toDateStr();
-		}
-		if (StrUtil.isEmpty(secondMonthDate)) {
-			secondMonthDate = DateUtil.offsetMonth(DateUtil.beginOfMonth(DateTime.now()), 1).toDateStr();
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		//是否是商务人员
-		Boolean isBusiness = userBusinessRateService.isBusiness(adminId);
-		if (isBusiness) {
-			builder.field(BusinessDistributesMonthlyDataView::getBusinessId, adminId);
-		}
-		builder.put("n", "(select nickname from cms_user where id = ur.business_id limit 1)");
-		//当月渠道本月数据
-		String time1Sql = StrUtil.EMPTY;
-		String time2Sql = StrUtil.EMPTY;
-		String time3Sql = StrUtil.EMPTY;
-		if (StrUtil.isNotBlank(firstMonthDate)) {
-			time1Sql += String.format(" and ud.business_bind_time >= '%s'", firstMonthDate);
-			time2Sql += String.format(" and us.created_time >= '%s'", firstMonthDate);
-			time3Sql += String.format(" and od.created_time >= '%s'", firstMonthDate);
-		}
-		if (StrUtil.isNotBlank(secondMonthDate)) {
-			time1Sql += String.format(" and ud.business_bind_time < '%s'", secondMonthDate);
-			time2Sql += String.format(" and us.created_time < '%s'", secondMonthDate);
-			time3Sql += String.format(" and od.created_time < '%s'", secondMonthDate);
-		}
-		if (StrUtil.isNotBlank(time1Sql)) {
-			builder.put("time1", time1Sql);
-		}
-		if (StrUtil.isNotBlank(time2Sql)) {
-			builder.put("time2", time2Sql);
-		}
-		if (StrUtil.isNotBlank(time3Sql)) {
-			builder.put("time3", time3Sql);
-		}
-		builder.put("type", 1);
-		builder.put("sorted", 0);
-		List<BusinessDistributesMonthlyDataView> search = beanSearcher.searchAll(BusinessDistributesMonthlyDataView.class, builder.build());
-		//历史渠道 当月数据
-		time1Sql = StrUtil.EMPTY;
-		time2Sql = StrUtil.EMPTY;
-		time3Sql = StrUtil.EMPTY;
-		if (StrUtil.isNotBlank(firstMonthDate)) {
-			time1Sql += String.format(" and ud.business_bind_time < '%s'", firstMonthDate);
-			time2Sql += String.format(" and us.created_time >= '%s'", firstMonthDate);
-			time3Sql += String.format(" and od.created_time >= '%s'", firstMonthDate);
-		}
-		if (StrUtil.isNotBlank(secondMonthDate)) {
-			time2Sql += String.format(" and us.created_time < '%s'", secondMonthDate);
-			time3Sql += String.format(" and od.created_time < '%s'", secondMonthDate);
-		}
-		if (StrUtil.isNotBlank(time1Sql)) {
-			builder.put("time1", time1Sql);
-		}
-		if (StrUtil.isNotBlank(time2Sql)) {
-			builder.put("time2", time2Sql);
-		}
-		if (StrUtil.isNotBlank(time3Sql)) {
-			builder.put("time3", time3Sql);
-		}
-		builder.put("type", 2);
-		builder.put("sorted", 99);
-
-		List<BusinessDistributesMonthlyDataView> search2 = beanSearcher.searchAll(BusinessDistributesMonthlyDataView.class, builder.build());
-
-		time1Sql = StrUtil.EMPTY;
-		time2Sql = StrUtil.EMPTY;
-		time3Sql = StrUtil.EMPTY;
-		if (StrUtil.isNotBlank(firstMonthDate)) {
-			time1Sql += String.format(" and ud.business_bind_time between '%s' and '%s'", DateUtil.offsetMonth(DateUtil.parse(firstMonthDate, "yyyy-MM-dd"), -1), firstMonthDate);
-			time2Sql += String.format(" and us.created_time >= '%s'", firstMonthDate);
-			time3Sql += String.format(" and od.created_time >= '%s'", firstMonthDate);
-		}
-		if (StrUtil.isNotBlank(secondMonthDate)) {
-			time2Sql += String.format(" and us.created_time < '%s'", secondMonthDate);
-			time3Sql += String.format(" and od.created_time < '%s'", secondMonthDate);
-		}
-		if (StrUtil.isNotBlank(time1Sql)) {
-			builder.put("time1", time1Sql);
-		}
-		if (StrUtil.isNotBlank(time2Sql)) {
-			builder.put("time2", time2Sql);
-		}
-		if (StrUtil.isNotBlank(time3Sql)) {
-			builder.put("time3", time3Sql);
-		}
-		builder.put("type", 3);
-		builder.put("sorted", 1);
-		//上个月渠道在本月历史数据
-		List<BusinessDistributesMonthlyDataView> search3 = beanSearcher.searchAll(BusinessDistributesMonthlyDataView.class, builder.build());
-
-		Collection<BusinessDistributesMonthlyDataView> businessDistributesDataViews = CollUtil.addAll(search, search2);
-		businessDistributesDataViews = CollUtil.addAll(businessDistributesDataViews, search3);
-		List<BusinessDistributesMonthlyDataView> collect = businessDistributesDataViews.stream().sorted(Comparator.comparing(BusinessDistributesMonthlyDataView::getBusinessId).thenComparing(BusinessDistributesMonthlyDataView::getSorted)).collect(Collectors.toList());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(collect);
-	}
-
-	/**
-	 * 针对商务
-	 * 获取商务 分销平台通用比例
-	 */
-	@GetMapping("/get/business/general/rate")
-	public Result<List<UserDistributeBusinessGeneralRateView>> getBusinessGeneralRate(@RequestParam(defaultValue = "1") Integer type) {
-		List<UserDistributeBusinessGeneralRateView> userDistributeBusinessGeneralRateViews = beanSearcher.searchAll(UserDistributeBusinessGeneralRateView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(UserDistributeBusinessGeneralRateView::getType, type).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userDistributeBusinessGeneralRateViews);
-	}
-
-	/**
-	 * 编辑商务 分销平台通用比例
-	 * 商务的平台规格提成 根据这个改变
-	 */
-	@PutMapping("/put/business/general/rate")
-	@Transactional(rollbackFor = Throwable.class)
-	public Result<String> updateBusinessGeneralRate(@RequestBody List<UserDistributeBusinessGeneralRate> generalRates) {
-		List<CmsUserVO> userVOS = beanSearcher.searchAll(CmsUserVO.class, MapUtils.builder().field(CmsUserVO::getRoleNames, "商务").op(Operator.Contain).build());
-		List<Long> collect = userVOS.stream().map(CmsUserVO::getId).collect(Collectors.toList());
-		final List<Long> businessIds = collect;
-		List<Long> newDsSkuIds = new ArrayList<>();
-		generalRates.forEach(data -> {
-			if (data.getId() == null) {
-				try {
-					//新增
-					UserDistributeBusinessGeneralRate businessGeneralRate = new UserDistributeBusinessGeneralRate();
-					if (data.getGoodsId() == null || data.getSkuId() == null) {
-						throw BusinessRuntimeException.getInstance("缺少必要参数");
-					}
-					businessGeneralRate.setGoodsId(data.getGoodsId());
-					businessGeneralRate.setSkuId(data.getSkuId());
-					Integer firstOrderRate = Optional.ofNullable(data.getFirstOrderRate()).orElse(0);
-					businessGeneralRate.setFirstOrderRate(firstOrderRate);
-					Integer renewOrderRate = Optional.ofNullable(data.getRenewOrderRate()).orElse(0);
-					businessGeneralRate.setRenewOrderRate(renewOrderRate);
-					businessGeneralRateMapper.insert(businessGeneralRate);
-					if (CollUtil.isNotEmpty(businessIds)) {
-						userDistributeBusinessRateMapper.insertOrUpdateBusinessGoodsSkuRate(businessIds, data.getGoodsId(), data.getSkuId(), firstOrderRate, renewOrderRate);
-					}
-					newDsSkuIds.add(data.getSkuId());
-				} catch (DuplicateKeyException e) {
-				}
-				return;
-			}
-			UserDistributeBusinessGeneralRate dbGeneralRate = businessGeneralRateMapper.selectById(data.getId());
-			if (dbGeneralRate != null) {
-				Integer firstOrderRate_new = null;
-				Integer renewOrderRate_new = null;
-				AtomicBoolean is_change = new AtomicBoolean(false);
-				//需要更新首单比例
-				if (data.getFirstOrderRate() != null && dbGeneralRate.getFirstOrderRate() != data.getFirstOrderRate()) {
-					firstOrderRate_new = data.getFirstOrderRate();
-					is_change.set(true);
-				}
-				//需要更新续费比例
-				if (data.getRenewOrderRate() != null && dbGeneralRate.getRenewOrderRate() != data.getRenewOrderRate()) {
-					renewOrderRate_new = data.getRenewOrderRate();
-					is_change.set(true);
-				}
-				if (is_change.get()) {
-					businessGeneralRateMapper.updateById(data);
-					newDsSkuIds.add(data.getSkuId());
-					if (CollUtil.isNotEmpty(businessIds)) {
-						//获取所有商务
-						userDistributeBusinessRateMapper.insertOrUpdateBusinessGoodsSkuRate(businessIds, data.getGoodsId(), data.getSkuId(), firstOrderRate_new, renewOrderRate_new);
-					}
-				}
-			}
-
-			if (CollUtil.isNotEmpty(newDsSkuIds)) {
-				//删除存在告警的平台规格
-				distributeGoodsSkuAlertMapper.delete(Wrappers.lambdaQuery(DistributeGoodsSkuAlert.class)
-						.in(DistributeGoodsSkuAlert::getSkuId, newDsSkuIds));
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 是否有未配置比例的规格
-	 */
-	@GetMapping("/get/goodsSku/alert")
-	public Result<Boolean> getGoodsSkuAlert() {
-		Integer count = distributeGoodsSkuAlertMapper.selectCountByCondition();
-		return GatewayResponse.SUCCESS.newBuilder().toResult(count > 0 ? true : false);
-	}
-
-	/**
-	 * 渠道预警列表
-	 */
-	@GetMapping("/get/target/alert/list")
-	public Result<SearchResult<UserDistributeTargetAlertView>> getTargetAlertList() {
-		long adminId = StpUtil.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		//是否是商务人员
-		if (userBusinessRateService.isBusiness(adminId)) {
-			builder.field(UserDistributeTargetAlertView::getBusinessId, adminId);
-		}
-		SearchResult<UserDistributeTargetAlertView> search = beanSearcher.search(UserDistributeTargetAlertView.class, builder
-				.orderBy(UserDistributeTargetAlertView::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 跟进渠道预警
-	 */
-	@PutMapping("/update/target/alert/status/{id}")
-	public Result<String> updateTargetAlertStatus(@PathVariable Long id) {
-		UserDistributeTargetAlertRecord record = targetAlertRecordMapper.selectById(id);
-		if (record != null && !record.getStatus()) {
-			record.setStatus(true);
-			targetAlertRecordMapper.updateById(record);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 批量待解绑的用户渠道关联关系记录
-	 */
-	@PostMapping("/import/unbind/distribute/shared")
-	public Result<String> unbindUserDistributeShared(MultipartFile file) throws Exception {
-		if (!file.getOriginalFilename().contains(".xls")) {
-			throw BusinessRuntimeException.getInstance("请导入excel文件");
-		}
-		List<Object> userBind = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(0).doReadSync();
-		distributeService.unbindUserDistributeShared(userBind);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 解绑渠道关系下单金额,以及佣金
-	 */
-	@GetMapping("/get/unbind/orderMoney/detail")
-	public Result<UserDistributeUnbindOrderMoneyView> getUnbindDistributeOrderMoneyDetail(String startTime, String endTime) {
-		String timeSql = StrUtil.EMPTY;
-		if (startTime != null) {
-			timeSql += String.format(" and o.created_time >= '%s'", startTime);
-		}
-		if (endTime != null) {
-			timeSql += String.format(" and o.created_time < '%s'", endTime);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (StrUtil.isNotEmpty(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		UserDistributeUnbindOrderMoneyView userDistributeUnbindOrderMoneyView = beanSearcher.searchFirst(UserDistributeUnbindOrderMoneyView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userDistributeUnbindOrderMoneyView);
-	}
-
-	/**
-	 * 新增分销渠道白名单
-	 */
-	@PostMapping("/post/white")
-	@Log(module = "分销管理/渠道分销/新增渠道白名单", businessType = BusinessType.POST, isSaveRequestData = true)
-	public Result<String> postDistributeWhite(@RequestBody UserDistributeSharedWhite sharedWhite) {
-		if (sharedWhite.getUserId() == null) {
-			throw BusinessRuntimeException.getInstance("请指定对应渠道用户");
-		}
-		UserDistributeSharedWhite userDistributeSharedWhite = userDistributeSharedWhiteMapper.selectOne(Wrappers.lambdaQuery(UserDistributeSharedWhite.class)
-				.eq(UserDistributeSharedWhite::getUserId, sharedWhite.getUserId())
-				.last("limit 1"));
-		if (userDistributeSharedWhite != null) {
-			throw BusinessRuntimeException.getInstance("已添加该渠道用户");
-		}
-		userDistributeSharedWhiteMapper.insert(sharedWhite);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除渠道用户白名单
-	 */
-	@DeleteMapping("/del/white/{id}")
-	@Log(module = "分销管理/渠道分销/删除渠道白名单", businessType = BusinessType.DELETE, isSaveRequestData = true)
-	public Result<String> delDistributeWhite(@PathVariable Long id) {
-		userDistributeSharedWhiteMapper.deleteById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 用户白名单列表
-	 */
-	@GetMapping("/get/white")
-	public Result<SearchResult<UserDistributeSharedWhite>> getDistributeWhite() {
-		SearchResult<UserDistributeSharedWhite> search = beanSearcher.search(UserDistributeSharedWhite.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 普通渠道列表
-	 */
-	@GetMapping("/get/common/distribute")
-	public Result<SearchResult<UserCommonDistributeView>> getCommonDistribute(Long userId, String nickname) {
-		String condition = StrUtil.EMPTY;
-		if (userId != null) {
-			condition += String.format(" and id = %s", userId);
-		}
-		if (StrUtil.isNotEmpty(nickname)) {
-			condition += String.format(" and nickname like '%%%s%%'", nickname);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (StrUtil.isNotEmpty(condition)) {
-			builder.put("condition", condition);
-		}
-		SearchResult<UserCommonDistributeView> search = beanSearcher.search(UserCommonDistributeView.class,
-				builder.build());
-		search.getDataList().forEach(view -> {
-			if (view.getDistributeOrdersMoney().compareTo(BigDecimal.ZERO) > 0) {
-				Optional.ofNullable(userDistributeMapper.selectSoldMaxGoods(view.getUserId())).ifPresent(title -> view.setGoodsTitle(title));
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 114
netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributePosterController.java

@@ -1,114 +0,0 @@
-package com.cyksj.web.controller.manage.distribute;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.model.entity.DistributePosterGoods;
-import com.cyksj.model.entity.GoodsDonSku;
-import com.cyksj.model.views.DistributePosterGoodsView;
-import com.cyksj.service.distribute.DistributePosterGoodsService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- * 项目名: yhlxj
- * 文件名: DistributePosterController
- * 创建者: JavaZou
- * 创建时间:2024/6/24 15:38
- */
-
-@RestController
-@RequestMapping("/manage/distribute/poster")
-@RequiredArgsConstructor
-public class DistributePosterController {
-	private final DistributePosterGoodsService distributePosterGoodsService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final GoodsDonSkuMapper skuMapper;
-
-	/**
-	 * 新增海报
-	 */
-	@PostMapping("/post")
-	public Result<String> post(@RequestBody DistributePosterGoods distributePosterGoods) throws Exception {
-		distributePosterGoodsService.saveOrUpdatePo(distributePosterGoods);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除海报
-	 */
-	@DeleteMapping("/del/{id}")
-	public Result<String> del(@PathVariable Long id) {
-		distributePosterGoodsService.removeById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑海报
-	 */
-	@PutMapping("/update")
-	public Result<String> update(@RequestBody DistributePosterGoods distributePosterGoods) throws Exception {
-		distributePosterGoodsService.saveOrUpdatePo(distributePosterGoods);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 海报列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<DistributePosterGoodsView>> get() {
-		SearchResult<DistributePosterGoodsView> search = beanSearcher.search(DistributePosterGoodsView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(e -> {
-			if (StrUtil.isNotBlank(e.getSkuIds())) {
-				try {
-					String specVal = skuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
-									.in(GoodsDonSku::getId, Jsons.parseSet(e.getSkuIds(), Long.class)))
-							.stream().map(GoodsDonSku::getSpecVal).collect(Collectors.joining(","));
-					e.setSpecVal(specVal);
-				} catch (Exception ex) {
-				}
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 海报上下架
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatus(@PathVariable Long id) {
-		Optional.ofNullable(distributePosterGoodsService.getById(id))
-				.ifPresent(e -> {
-					e.setStatus(!e.getStatus());
-					distributePosterGoodsService.updateById(e);
-				});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 关联平台
-	 */
-	@GetMapping("/get/relate/goods")
-	public Result<List<DistributePosterGoodsView>> getRelateGoods() {
-		List<DistributePosterGoodsView> distributePosterGoodsViews = beanSearcher.searchAll(DistributePosterGoodsView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.onlySelect(DistributePosterGoodsView::getGoodsId, DistributePosterGoodsView::getTitle)
-				.orderBy(DistributePosterGoodsView::getGoodsId).asc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(distributePosterGoodsViews);
-	}
-}

+ 0 - 128
netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/EquipmentController.java

@@ -1,128 +0,0 @@
-package com.cyksj.web.controller.manage.distribute;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.manage.coupon.CouponMapper;
-import com.cyksj.mapper.manage.distribute.equipment.EquipmentUserOrderVerifyRecordMapper;
-import com.cyksj.mapper.manage.distribute.equipment.EquipmentUserPayRecordMapper;
-import com.cyksj.model.entity.EquipmentUserOrderVerifyRecord;
-import com.cyksj.model.entity.EquipmentUserPayRecord;
-import com.cyksj.model.entity.GoodsDonSku;
-import com.cyksj.model.entity.User;
-import com.cyksj.model.views.EquipmentBenefitsView;
-import com.cyksj.model.views.EquipmentUserDistributeDetailView;
-import com.cyksj.model.views.EquipmentUserDistributeViews;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.Optional;
-
-/*
- *项目名: netflix
- *文件名: EquipmentController
- *创建者: JavaZou
- *创建时间:2023/2/24 9:39
- */
-@RestController
-@RequestMapping("/manage/equipment/distribute")
-@RequiredArgsConstructor
-public class EquipmentController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserMapper userMapper;
-
-	private final CouponMapper couponMapper;
-
-	private final EquipmentUserPayRecordMapper payRecordMapper;
-
-	private final GoodsDonSkuMapper goodsDonSkuMapper;
-
-	private final EquipmentUserOrderVerifyRecordMapper equipmentUserOrderVerifyRecordMapper;
-
-	/**
-	 * 实物分销列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<EquipmentUserDistributeViews>> getEquipmentDistribute() {
-		SearchResult<EquipmentUserDistributeViews> search = beanSearcher.search(EquipmentUserDistributeViews.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			data.setRecordNum(payRecordMapper.selectCount(Wrappers.lambdaQuery(EquipmentUserPayRecord.class)
-					.eq(EquipmentUserPayRecord::getShareId, data.getShareId())));
-			data.setBenefitsViews(beanSearcher.searchAll(EquipmentBenefitsView.class, MapUtils.builder().field(EquipmentBenefitsView::getSharId, data.getShareId()).build()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 分销明细
-	 */
-	@GetMapping("/get/detail/{shareId}")
-	public Result<SearchResult<EquipmentUserDistributeDetailView>> getDistributeDetail(@PathVariable Long shareId) {
-		SearchResult<EquipmentUserDistributeDetailView> search = beanSearcher.search(EquipmentUserDistributeDetailView.class,
-				MapUtils.flatBuilder(request.getParameterMap())
-						.field(EquipmentUserDistributeDetailView::getShareId, shareId)
-						.build());
-		search.getDataList().forEach(data -> {
-			User user = userMapper.selectById(data.getUserId());
-			Optional.ofNullable(user).ifPresent(u -> data.setNickname(u.getNickname()));
-			String couponName = couponMapper.getCouponNameByCouponUserId(data.getCouponUserId());
-			data.setCouponName(couponName);
-			GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectById(data.getSkuId());
-			Optional.ofNullable(goodsDonSku).ifPresent(sku -> data.setSpecVal(sku.getSpecVal()));
-			EquipmentUserOrderVerifyRecord equipmentUserOrderVerifyRecord = equipmentUserOrderVerifyRecordMapper.selectOne(Wrappers.lambdaQuery(EquipmentUserOrderVerifyRecord.class)
-					.eq(EquipmentUserOrderVerifyRecord::getOrderId, data.getOrderId())
-					.last("limit 1"));
-			data.setVerifyRecord(equipmentUserOrderVerifyRecord);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 发送奖励记录
-	 */
-	@PutMapping("/verify/reward/record")
-	public Result<SearchResult> verifyRewardRecord(@RequestBody EquipmentUserOrderVerifyRecord verifyRecord) {
-		Long orderId = verifyRecord.getOrderId();
-		EquipmentUserPayRecord equipmentUserPayRecord = payRecordMapper.selectOne(Wrappers.lambdaQuery(EquipmentUserPayRecord.class).eq(EquipmentUserPayRecord::getOrderId, orderId).last("limit 1"));
-		if (equipmentUserPayRecord == null) {
-			throw BusinessRuntimeException.getInstance("实物分销订单不存在");
-		}
-		if (equipmentUserPayRecord.getStatus() == EquipmentUserPayRecord.Status.refund) {
-			throw BusinessRuntimeException.getInstance("实物分销订单已退款");
-		}
-		BigDecimal money = verifyRecord.getMoney();
-		String img = verifyRecord.getImg();
-		if (StrUtil.isEmpty(img)) {
-			throw BusinessRuntimeException.getInstance("转账截图不为空");
-		}
-		if (money == null) {
-			throw BusinessRuntimeException.getInstance("转账金额不为空");
-		}
-		if (verifyRecord.getId() == null) {
-			verifyRecord.setSharedId(equipmentUserPayRecord.getShareId());
-			verifyRecord.setUserId(equipmentUserPayRecord.getUserId());
-			try {
-				equipmentUserOrderVerifyRecordMapper.insert(verifyRecord);
-			} catch (DuplicateKeyException e) {
-				throw BusinessRuntimeException.getInstance("其他客服已转账..");
-			}
-		} else {
-			equipmentUserOrderVerifyRecordMapper.updateById(verifyRecord);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-}

+ 0 - 142
netflix-web/src/main/java/com/cyksj/web/controller/manage/exchange/ExchangeCodeController.java

@@ -1,142 +0,0 @@
-package com.cyksj.web.controller.manage.exchange;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.mapper.OrderDonMapper;
-import com.cyksj.mapper.manage.cms.CmsUserMapper;
-import com.cyksj.model.entity.CmsUser;
-import com.cyksj.model.excel.ExcelExchangeCodeData;
-import com.cyksj.model.request.ExchangeCodeReq;
-import com.cyksj.model.views.ExchangeCodeView;
-import com.cyksj.service.exchange.ExchangeCodeService;
-import com.cyksj.service.mange.cms.service.CmsUserService;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/*
- *项目名: netflix
- *文件名: ExchangeCodeController
- *创建者: JavaZou
- *创建时间:2022/11/7 14:37
- */
-@RestController
-@RequestMapping("/manage/exchange/code")
-@RequiredArgsConstructor
-public class ExchangeCodeController {
-
-	private final HttpServletRequest request;
-
-	private final BeanSearcher beanSearcher;
-
-	private final ExchangeCodeService exchangeCodeService;
-
-	private final CmsUserMapper cmsUserMapper;
-
-	private final GoodsDonSkuMapper skuMapper;
-
-	private final OrderDonMapper orderDonMapper;
-
-	private final CmsUserService cmsUserService;
-
-	/**
-	 * 生成兑换码 并导出
-	 */
-	@GetMapping("/createAndExport")
-	@SaCheckPermission("exchangeCode:add")
-	@Log(module = "兑换码/生成兑换码", businessType = BusinessType.POST, isSaveRequestData = true)
-	public void createAndExportCode(ExchangeCodeReq exchangeCodeReq, HttpServletResponse response) throws Exception {
-		if (ObjectUtil.hasEmpty(exchangeCodeReq.getSkuIds(), exchangeCodeReq.getNumber())) {
-			throw BusinessRuntimeException.getInstance("必填项为空");
-		}
-		long adminId = StpUtil.getLoginIdAsLong();
-		CmsUser cmsUser = cmsUserMapper.selectById(adminId);
-		exchangeCodeReq.setOperator(cmsUser.getNickname());
-		List<ExcelExchangeCodeData> data =  exchangeCodeService.createExchangeCode(exchangeCodeReq);
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelExchangeCodeData.class, data, "银河兑换码","银河兑换码", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 兑换码列表
-	 */
-	@GetMapping("/get")
-	@SaCheckPermission("exchangeCode:view")
-	public Result<SearchResult<ExchangeCodeView>> getExchangeCodeView(Long goodsId, Long skuId) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		String condition = StrUtil.EMPTY;
-		if (goodsId != null) {
-			condition = String.format(" and JSON_CONTAINS(goods_ids,'%s')", goodsId);
-		}
-		if (skuId != null) {
-			condition += String.format(" and JSON_CONTAINS(sku_ids,'%s')", skuId);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (StrUtil.isNotEmpty(condition)) {
-			builder.put("condition", condition);
-		}
-		if (!cmsUserService.isRootRole(adminId)) {
-			CmsUser cmsUser = cmsUserMapper.selectById(adminId);
-			builder.field(ExchangeCodeView::getOperator, cmsUser.getNickname());
-		}
-		SearchResult<ExchangeCodeView> search = beanSearcher.search(ExchangeCodeView.class, builder.build());
-		search.getDataList().forEach(data -> {
-			try {
-				List<Long> skuIds = Jsons.parseList(data.getSkuIds(), Long.class);
-				data.setTitle(skuMapper.selectExchangeTitle(skuIds));
-//				if (data.getUseStatus()) {
-//					Optional.ofNullable(orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
-//							.eq(OrderDon::getExCode, data.getCode())
-//							.last("limit 1"))).ifPresent(exCodeOrder -> data.setOrderId(exCodeOrder.getId()));
-//				}
-			} catch (Exception e) {
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 导出兑换码
-	 */
-	@GetMapping("/export")
-	@SaCheckPermission("exchangeCode:export")
-	public void exportExchangeCode(HttpServletResponse response, Long goodsId, Long skuId) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		String condition = StrUtil.EMPTY;
-		if (goodsId != null) {
-			condition = String.format(" and JSON_CONTAINS(goods_ids,'%s')", goodsId);
-		}
-		if (skuId != null) {
-			condition += String.format(" and JSON_CONTAINS(sku_ids,'%s')", skuId);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (StrUtil.isNotEmpty(condition)) {
-			builder.put("condition", condition);
-		}
-		if (!cmsUserService.isRootRole(adminId)) {
-			CmsUser cmsUser = cmsUserMapper.selectById(adminId);
-			builder.field(ExchangeCodeView::getOperator, cmsUser.getNickname());
-		}
-		List<ExcelExchangeCodeData> data = beanSearcher.searchAll(ExcelExchangeCodeData.class, builder.build());
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelExchangeCodeData.class, data, "银河兑换码", "银河兑换码", ExcelTypeEnum.XLSX, null);
-	}
-}

+ 0 - 114
netflix-web/src/main/java/com/cyksj/web/controller/manage/feedback/UserFeedbackController.java

@@ -1,114 +0,0 @@
-package com.cyksj.web.controller.manage.feedback;
-
-import cn.dev33.satoken.stp.StpUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserFeedbackProgressRecordMapper;
-import com.cyksj.mapper.UserFeedbackRecordMapper;
-import com.cyksj.mapper.manage.cms.CmsUserMapper;
-import com.cyksj.model.entity.CmsUser;
-import com.cyksj.model.entity.UserFeedbackProgressRecord;
-import com.cyksj.model.entity.UserFeedbackRecord;
-import com.cyksj.model.views.UserFeedbackRecordView;
-import com.cyksj.model.views.UserRecommendGoodsRecordView;
-import com.cyksj.model.views.UserRecommendGoodsUserView;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * admin/投诉与建议
- * 项目名: yhlxj2
- * 文件名: UserFeedbackController
- * 创建者: JavaZou
- * 创建时间:2024/10/11 15:35
- */
-@RestController
-@RequestMapping("/manage/suggest")
-@RequiredArgsConstructor
-public class UserFeedbackController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserFeedbackRecordMapper userFeedbackRecordMapper;
-
-	private final CmsUserMapper cmsUserMapper;
-
-	private final UserFeedbackProgressRecordMapper userFeedbackProgressRecordMapper;
-
-	/**
-	 * 使用建议列表
-	 */
-	@GetMapping("/feedback/list")
-	public Result<SearchResult<UserFeedbackRecordView>> getFeedbackList() {
-		SearchResult<UserFeedbackRecordView> search = beanSearcher.search(UserFeedbackRecordView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 标记解决
-	 */
-	@PutMapping("/feedback/mark/status/{id}")
-	public Result<String> markUserFeedbackStatus(@PathVariable Long id) {
-		userFeedbackRecordMapper.update(null, Wrappers.lambdaUpdate(UserFeedbackRecord.class)
-				.set(UserFeedbackRecord::getStatus, 1)
-				.eq(UserFeedbackRecord::getId, id)
-				.eq(UserFeedbackRecord::getStatus, 0));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 用户反馈留言进度列表
-	 */
-	@GetMapping("/feedback/progress/list")
-	public Result<SearchResult<UserFeedbackProgressRecord>> getFeedbackProgressList() {
-		SearchResult<UserFeedbackProgressRecord> search = beanSearcher.search(UserFeedbackProgressRecord.class, MapUtils.flatBuilder(request.getParameterMap()).orderBy(UserFeedbackProgressRecord::getId).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-
-	/**
-	 * 留言回复
-	 */
-	@PostMapping("/feedback/reply")
-	public Result<String> replyFeedback(@RequestBody UserFeedbackProgressRecord userFeedbackProgressRecord) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		CmsUser cmsUser = cmsUserMapper.selectById(adminId);
-		userFeedbackProgressRecord.setNickname(cmsUser.getNickname());
-		userFeedbackProgressRecordMapper.insert(userFeedbackProgressRecord);
-
-		UserFeedbackRecord userFeedbackRecord = userFeedbackRecordMapper.selectById(userFeedbackProgressRecord.getFeedbackId());
-		userFeedbackRecord.setIsNewReply(true);
-		userFeedbackRecordMapper.updateById(userFeedbackRecord);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-
-	//====================================推荐新品======================================
-
-	/**
-	 * 推荐新品列表
-	 */
-	@GetMapping("/recommend/list")
-	public Result<SearchResult<UserRecommendGoodsRecordView>> getRecommendList() {
-		SearchResult<UserRecommendGoodsRecordView> search = beanSearcher.search(UserRecommendGoodsRecordView.class, MapUtils.flatBuilder(request.getParameterMap()).orderBy(UserRecommendGoodsRecordView::getUpdateTime).desc().build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-
-	/**
-	 * 按推荐人数查看列表
-	 */
-	@GetMapping("/recommend/user/list")
-	public Result<SearchResult<UserRecommendGoodsUserView>> getRecommendGoodsUserList() {
-		SearchResult<UserRecommendGoodsUserView> search = beanSearcher.search(UserRecommendGoodsUserView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 185
netflix-web/src/main/java/com/cyksj/web/controller/manage/form/FormController.java

@@ -1,185 +0,0 @@
-package com.cyksj.web.controller.manage.form;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.manage.form.FormFieldsDataMapper;
-import com.cyksj.mapper.manage.form.FormFieldsMapper;
-import com.cyksj.mapper.manage.form.FormTemplateMapper;
-import com.cyksj.model.dto.FormTemplateDataDto;
-import com.cyksj.model.entity.FormFields;
-import com.cyksj.model.entity.FormFieldsDefault;
-import com.cyksj.model.entity.FormTemplate;
-import com.cyksj.model.entity.QuestionnairePromotion;
-import com.cyksj.model.views.FormFieldsDataView;
-import com.cyksj.service.mange.form.FormService;
-import com.cyksj.service.mange.form.QuestionnairePromotionService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/*
- *项目名: netflix
- *文件名: FormController
- *创建者: JavaZou
- *创建时间:2023/6/12 9:58
- */
-@RestController
-@RequestMapping("/manage/form")
-@RequiredArgsConstructor
-public class FormController {
-
-	private final FormFieldsMapper formFieldsMapper;
-
-	private final FormFieldsDataMapper formFieldsDataMapper;
-
-	private final FormTemplateMapper formTemplateMapper;
-
-	private final FormService formService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final QuestionnairePromotionService promotionService;
-
-	private final HttpServletRequest request;
-
-	/**
-	 * 新增模板 以及对应模板字段
-	 */
-	@PostMapping("/template/post")
-	public Result<String> insertTemplateAndRelationFields(@RequestBody FormTemplateDataDto dataDto) {
-		formService.saveOrUpdateTemplateAndRelationFields(dataDto);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑模板以及对应模板字段
-	 */
-	@PutMapping("/template/put")
-	public Result<String> updateTemplateAndRelationFields(@RequestBody FormTemplateDataDto dataDto) {
-		formService.saveOrUpdateTemplateAndRelationFields(dataDto);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 选择模板 生成对应问题
-	 */
-	@PostMapping("/template/fields/value")
-	public Result<String> postTemplateFieldsValue(@RequestBody List<FormFieldsDefault> values) {
-		formService.saveOrUpdateTemplateFieldsValue(values);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 选择模板 修改对应问题
-	 */
-	@PutMapping("/template/fields/value")
-	public Result<String> updateTemplateFieldsValue(@RequestBody List<FormFieldsDefault> values) {
-		formService.saveOrUpdateTemplateFieldsValue(values);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除模板
-	 */
-	@PutMapping("/template/del/{id}")
-	public Result<String> delTid(@PathVariable Long id) {
-		formTemplateMapper.update(null, Wrappers.lambdaUpdate(FormTemplate.class)
-				.set(FormTemplate::getDeleted, false)
-				.eq(FormTemplate::getId, id));
-
-		formFieldsMapper.update(null, Wrappers.lambdaUpdate(FormFields.class)
-				.set(FormFields::getDeleted, false)
-				.eq(FormFields::getTemplateId, id));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 问卷表单模板列表
-	 */
-	@GetMapping("/template/get")
-	public Result<SearchResult<FormTemplate>> getTemplate() {
-		SearchResult<FormTemplate> search = beanSearcher.search(FormTemplate.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(FormTemplate::getDeleted, true)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 问卷表单模板 对应模板字段列表
-	 */
-	@GetMapping("/template/fields/get")
-	public Result<SearchResult<FormFields>> getTemplateFields() {
-		SearchResult<FormFields> search = beanSearcher.search(FormFields.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(FormFields::getDeleted, true)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 用户问卷回答列表
-	 */
-	@GetMapping("/get/question/resp/data")
-	public Result<SearchResult<FormFieldsDataView>> getData(Long promotionId, Long fieldsId, Long startTime, Long endTime) {
-		DateTime startDate = null;
-		DateTime endDate = null;
-		if (startTime != null) {
-			startDate = DateUtil.date(startTime);
-		}
-		if (endTime != null) {
-			endDate = DateUtil.date(endTime);
-		}
-		if (promotionId != null) {
-			QuestionnairePromotion byId = promotionService.getById(promotionId);
-			if (byId == null) throw BusinessRuntimeException.getInstance("问卷不存在");
-			if (byId.getName().contains("商务")) {
-				FormFields fields = formFieldsMapper.selectOne(Wrappers.lambdaQuery(FormFields.class).eq(FormFields::getTemplateId, byId.getTemplateId())
-						.like(FormFields::getFieldsName, "渠道").last("limit 1"));
-				if (fields != null) {
-					fieldsId = fields.getId();
-				}
-			}
-		}
-		String timeSql = StrUtil.EMPTY;
-		if (startDate != null) {
-			timeSql += String.format(" and fa.created_time >= '%s'", startDate);
-		}
-		if (endDate != null) {
-			timeSql += String.format(" and fa.created_time < '%s'", endDate);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap())
-				.field(FormFieldsDataView::getFieldsId, fieldsId);
-		if (StrUtil.isNotBlank(timeSql)) {
-			builder.put("time_sql", timeSql);
-		}
-		SearchResult<FormFieldsDataView> search = beanSearcher.search(FormFieldsDataView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * @param promotionId
-	 */
-	@GetMapping("/export/question/resp/data")
-	public void exportQuestionInfo(@RequestParam(required = false, defaultValue = "1") Long promotionId, Long startTime, Long endTime, String charset, HttpServletResponse response) throws Exception {
-		DateTime startDate = null;
-		DateTime endDate = null;
-		if (startTime != null) {
-			startDate = DateUtil.date(startTime);
-		}
-		if (endTime != null) {
-			endDate = DateUtil.date(endTime);
-		}
-		formService.exportQuestionInfo(promotionId, startDate, endDate, response);
-	}
-}

+ 0 - 94
netflix-web/src/main/java/com/cyksj/web/controller/manage/form/QuestionnairePromotionController.java

@@ -1,94 +0,0 @@
-package com.cyksj.web.controller.manage.form;
-
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.dto.QuestionnaireFieldsView;
-import com.cyksj.model.entity.QuestionnairePromotion;
-import com.cyksj.service.mange.form.QuestionnairePromotionService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/*
- *项目名: netflix
- *文件名: QuestionnairePromotionController
- *创建者: JavaZou
- *创建时间:2023/6/14 11:36
- */
-@RestController
-@RequestMapping("/manage/questionnaire")
-@RequiredArgsConstructor
-public class QuestionnairePromotionController {
-	private final QuestionnairePromotionService promotionService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	@PostMapping("/post")
-	public Result<Long> saveQuestionnaire(@RequestBody @Validated QuestionnairePromotion promotion) {
-		Long promotionId = promotionService.saveOrUpdatePromotion(promotion);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(promotionId);
-	}
-
-	@PutMapping("/put")
-	public Result<String> updateQuestionnaire(@RequestBody @Validated QuestionnairePromotion promotion) {
-		promotionService.saveOrUpdatePromotion(promotion);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	@DeleteMapping("/delete/{id}")
-	public Result<String> delById(@PathVariable Long id) {
-		QuestionnairePromotion byId = promotionService.getById(id);
-		if (byId == null || !byId.getDeleted()) throw BusinessRuntimeException.getInstance("该记录已被删除");
-		byId.setDeleted(false);
-		promotionService.updateById(byId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	@GetMapping("/get")
-	public Result<SearchResult<QuestionnairePromotion>> getPromotions() {
-		SearchResult<QuestionnairePromotion> search = beanSearcher.search(QuestionnairePromotion.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(QuestionnairePromotion::getDeleted, true).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 问卷详情 问卷字段以及答案列表
-	 */
-	@GetMapping("/template/get/detail/{promotionId}")
-	public Result<SearchResult<QuestionnaireFieldsView>> getFieldsView(@PathVariable Long promotionId) {
-		QuestionnairePromotion byId = promotionService.getById(promotionId);
-		if (byId==null) throw BusinessRuntimeException.getInstance("问卷不存在");
-		SearchResult<QuestionnaireFieldsView> search = beanSearcher.search(QuestionnaireFieldsView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(QuestionnaireFieldsView::getTemplateId, byId.getTemplateId())
-				.put("promotion_id", String.format(" and fd.promotion_id = %s", promotionId))
-				.orderBy(QuestionnaireFieldsView::getSorted).asc()
-				.orderBy(QuestionnaireFieldsView::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 上下架问卷
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		QuestionnairePromotion promotion = promotionService.getById(id);
-		Boolean status = promotion.getStatus();
-		Boolean isUp = promotion.getIsUp();
-		//上架
-		if (!status && !isUp) {
-			promotion.setIsUp(true);
-		}
-		promotion.setStatus(!status);
-		promotionService.updateById(promotion);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 208
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonCategoryController.java

@@ -1,208 +0,0 @@
-package com.cyksj.web.controller.manage.goods;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.lang.Assert;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsClickUserRecordMapper;
-import com.cyksj.model.entity.GoodsClickUserRecord;
-import com.cyksj.model.entity.GoodsDon;
-import com.cyksj.model.entity.GoodsDonCategory;
-import com.cyksj.model.entity.GoodsDonCategoryRelate;
-import com.cyksj.model.views.GoodsDonCategoryGoodsView;
-import com.cyksj.model.views.GoodsDonCategoryView;
-import com.cyksj.service.mange.CmsGoodsDonService;
-import com.cyksj.service.mange.GoodsDonCategoryRelateService;
-import com.cyksj.service.mange.GoodsDonCategoryService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.List;
-
-/*
- *项目名: netflix
- *文件名: CmsGoodsDonCategoryController
- *创建者: JavaZou
- *创建时间:2023/8/11 13:40
- */
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/goods/category")
-public class CmsGoodsDonCategoryController {
-	private final GoodsDonCategoryService goodsDonCategoryService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final GoodsClickUserRecordMapper goodsClickUserRecordMapper;
-
-	private final CmsGoodsDonService goodsDonService;
-
-	private final GoodsDonCategoryRelateService goodsDonCategoryRelateService;
-
-	private final RefreshCacheService refreshCacheService;
-
-	/**
-	 * 新增分类
-	 */
-	@PostMapping("/post")
-	public Result<GoodsDonCategory> saveGoodsDonCategory(@RequestBody @Validated GoodsDonCategory category) {
-		goodsDonCategoryService.saveOrUpdateGoods(category);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(category);
-	}
-
-	/**
-	 * 编辑分类
-	 */
-	@PutMapping("/put")
-	public Result<String> updateGoodsDonCategory(@RequestBody List<GoodsDonCategory> categorys) {
-		categorys.forEach(category -> goodsDonCategoryService.saveOrUpdateGoods(category));
-		refreshCacheService.refreshYhHomeCategoryPageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 分类上下架
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		GoodsDonCategory byId = goodsDonCategoryService.getById(id);
-		Assert.notNull(byId, "分类不存在");
-		byId.setStatus(!byId.getStatus());
-		goodsDonCategoryService.updateById(byId);
-		refreshCacheService.refreshYhHomeCategoryPageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 根据id删除分类
-	 */
-	@DeleteMapping("/del/{id}")
-	public Result<String> del(@PathVariable Long id) {
-		int count = goodsDonService.count(Wrappers.lambdaQuery(GoodsDon.class)
-				.eq(GoodsDon::getCategory, id));
-		if (count > 0) {
-			throw BusinessRuntimeException.getInstance("存在该分类下平台");
-		}
-		goodsDonCategoryService.delById(id);
-		refreshCacheService.refreshYhHomeCategoryPageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 修改分类排序
-	 */
-	@PutMapping("/sort")
-	public Result<String> sortCategory(@RequestBody GoodsDonCategory category) {
-		Long id = category.getId();
-		Assert.notNull(id, "分类不存在");
-		GoodsDonCategory byId = goodsDonCategoryService.getById(id);
-		if (category.getSorted() != null) {
-			byId.setSorted(category.getSorted());
-			goodsDonCategoryService.updateById(byId);
-			refreshCacheService.refreshYhHomeCategoryPageCache();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 分类列表 分页
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<GoodsDonCategoryView>> getCategory() {
-		SearchResult<GoodsDonCategoryView> search = beanSearcher.search(GoodsDonCategoryView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data->{
-			Integer count = goodsClickUserRecordMapper.selectCount(Wrappers.lambdaQuery(GoodsClickUserRecord.class)
-					.eq(GoodsClickUserRecord::getCategory, data.getId()));
-			data.setClick(count);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 分类平台列表
-	 */
-	@GetMapping("/get/goods")
-	public Result<SearchResult<GoodsDonCategoryGoodsView>> getCategoryGoodsView() {
-		MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-		SearchResult<GoodsDonCategoryGoodsView> search = beanSearcher.search(GoodsDonCategoryGoodsView.class, mapBuilder.build());
-		search.getDataList().forEach(data->{
-			Integer count = goodsClickUserRecordMapper.selectCount(Wrappers.lambdaQuery(GoodsClickUserRecord.class)
-					.eq(GoodsClickUserRecord::getGoodsId, data.getGoodsId()));
-			data.setClick(count);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 修改平台排序
-	 */
-	@PutMapping("/sort/goods")
-	public Result<String> sortGoods(@RequestBody List<GoodsDonCategoryGoodsView> request) {
-		List<GoodsDonCategoryRelate> updateList = new ArrayList<>(request.size());
-		request.forEach(data->{
-			Long goodsId = data.getGoodsId();
-			Integer sorted = data.getSorted();
-			GoodsDonCategoryRelate relate = goodsDonCategoryRelateService.getOne(Wrappers.lambdaQuery(GoodsDonCategoryRelate.class)
-					.eq(GoodsDonCategoryRelate::getCategory, data.getCategory())
-					.eq(GoodsDonCategoryRelate::getGoodsId, goodsId).last("limit 1"));
-			if (sorted != null && sorted != relate.getSorted()) {
-				relate.setSorted(sorted);
-				updateList.add(relate);
-			}
-		});
-		if (CollUtil.isNotEmpty(updateList)) {
-			goodsDonCategoryRelateService.updateBatchById(updateList);
-			refreshCacheService.refreshYhHomeCategoryPageCache();
-		}
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 移除分类下的平台
-	 */
-	@DeleteMapping("/delete/{relateId}")
-	public Result<String> deleteCategoryByRelateId(@PathVariable Long relateId) {
-		goodsDonCategoryRelateService.removeById(relateId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 获取所有分类列表
-	 */
-	@GetMapping("/get/all")
-	public Result<List<GoodsDonCategory>> getAll() {
-		List<GoodsDonCategory> search = beanSearcher.searchAll(GoodsDonCategory.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 获取所有分类下平台 树形结构
-	 */
-	@GetMapping("/get/goods/tree")
-	public Result<List<GoodsDonCategory>> getCategoryGoodsTreeView() {
-		List<GoodsDonCategory> all = beanSearcher.searchAll(GoodsDonCategory.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(GoodsDonCategory::getStatus, true)
-				.orderBy(GoodsDonCategory::getSorted).desc()
-				.build());
-		all.forEach(data -> {
-			List<GoodsDonCategoryGoodsView> categoryGoodsViewList = beanSearcher.searchAll(GoodsDonCategoryGoodsView.class, MapUtils.
-					builder().field(GoodsDonCategoryGoodsView::getCategory, data.getId())
-					.field(GoodsDonCategoryGoodsView::getStatus, true).build());
-			data.setCategoryGoodsList(categoryGoodsViewList);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(all);
-	}
-}

+ 0 - 264
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonController.java

@@ -1,264 +0,0 @@
-package com.cyksj.web.controller.manage.goods;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.model.entity.GoodsDon;
-import com.cyksj.model.entity.GoodsDonCategory;
-import com.cyksj.model.entity.GoodsDonSku;
-import com.cyksj.model.manage.request.ReqGoodsSpuInsert;
-import com.cyksj.model.manage.views.GoodsDonViewer;
-import com.cyksj.model.views.GoodsDetailView;
-import com.cyksj.model.views.GoodsDonCategoryDetailView;
-import com.cyksj.service.mange.CmsGoodsDonService;
-import com.cyksj.service.mange.GoodsDonCategoryService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * @author chan
- * @date 2022/9/27 4:45 PM
- */
-
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/goods")
-public class CmsGoodsDonController {
-
-    private final HttpServletRequest request;
-
-    private final BeanSearcher beanSearcher;
-
-    private final CmsGoodsDonService goodsDonService;
-
-    private final RefreshCacheService refreshCacheService;
-
-    private final GoodsDonCategoryService goodsDonCategoryService;
-
-    private final GoodsDonSkuMapper skuMapper;
-
-    @GetMapping("/get")
-    public Result<SearchResult<GoodsDonCategoryDetailView>> get(){
-        SearchResult<GoodsDonCategoryDetailView> search = beanSearcher.search(GoodsDonCategoryDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(GoodsDonCategoryDetailView::getDeleted,true)
-		        .put("condition", "(special_type is null or special_type != 'giftCard')")
-		        .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 商品详情
-     */
-    @GetMapping("/get/{id}")
-    public Result<GoodsDonViewer> getById(@PathVariable Long id) throws Exception {
-        GoodsDonViewer goodsDonViewer = beanSearcher.searchFirst(GoodsDonViewer.class, MapUtils.builder().field(GoodsDonViewer::getId, id).build());
-        if (StrUtil.isNotBlank(goodsDonViewer.getRecommendGoods())) {
-            goodsDonViewer.setRecommendGoodsList(Jsons.parseList(goodsDonViewer.getRecommendGoods(), Long.class));
-        }
-        List<GoodsDonCategory> categoryView = goodsDonCategoryService.getCateGoryViewByGoodsId(id);
-        goodsDonViewer.setCategoryList(categoryView.stream().map(GoodsDonCategory::getId).collect(Collectors.toList()));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDonViewer);
-    }
-
-    /**
-     * 商品规格详情
-     */
-    @GetMapping("/get/sku/{id}")
-    public Result<List<GoodsDonSku>> getSkuById(@PathVariable Long id, HttpServletRequest request) {
-        List<GoodsDonSku> goodsDonSkus = beanSearcher.searchAll(GoodsDonSku.class, MapUtils.flatBuilder(request.getParameterMap()).field(GoodsDonSku::getGoodsId, id)
-                .orderBy(GoodsDonSku::getSorted).asc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDonSkus);
-    }
-
-    /**
-     * 新增 商品spu
-     */
-    @PostMapping(value = "/post")
-    @SaCheckPermission("platform:add")
-    @Log(module = "平台管理/新增平台", businessType = BusinessType.POST, isSaveRequestData = true)
-    public Result<Long> spuInsert(@Validated @RequestBody ReqGoodsSpuInsert spu) throws Exception {
-        // 新增商品
-        GoodsDon goods = new GoodsDon();
-        if (spu.getSecondType() == null) {
-            spu.setSecondType(2);
-        }
-        BeanUtil.copyProperties(spu, goods);
-        if (StrUtil.isNotEmpty(goods.getRecommendTitle())) {
-            if (CollUtil.isEmpty(spu.getRecommendGoodsList())) {
-                throw BusinessRuntimeException.getInstance("请选择推荐的对应平台");
-            }
-        }
-        goodsDonService.save(goods);
-        //保存平台 分类的 关联
-        List<Long> categoryList = spu.getCategoryList();
-        if (CollUtil.isNotEmpty(categoryList)) {
-            goodsDonCategoryService.saveBatchRelate(goods.getId(), categoryList);
-        }
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult(goods.getId());
-    }
-
-    /**
-     * 修改 商品spu
-     */
-    @PutMapping(value = "/update")
-    @SaCheckPermission("platform:update")
-    @Log(module = "平台管理/编辑平台", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> spuUpdate(@Validated @RequestBody ReqGoodsSpuInsert spu) throws Exception{
-        GoodsDon goods = new GoodsDon();
-        BeanUtil.copyProperties(spu,goods);
-        if (spu.getSpecialType() == null) {
-            goods.setSpecialType(null);
-        }
-        if (StrUtil.isNotEmpty(goods.getRecommendTitle())) {
-            if (CollUtil.isEmpty(spu.getRecommendGoodsList())) {
-                throw BusinessRuntimeException.getInstance("请选择推荐的对应平台");
-            }
-        }
-        if (CollUtil.isNotEmpty(spu.getRecommendGoodsList())) {
-            Set<Long> re_goodsIds = new HashSet<>(spu.getRecommendGoodsList());
-            //去除自己
-            re_goodsIds.remove(spu.getId());
-            goods.setRecommendGoods(Jsons.toJson(re_goodsIds));
-        }
-        if (StrUtil.isEmpty(goods.getRecommendTitle())) {
-            goods.setRecommendTitle(null);
-        }
-        if (StrUtil.isEmpty(goods.getVideo())) {
-            goods.setVideo(null);
-        }
-        if (CollUtil.isNotEmpty(spu.getRecommendGoodsList())) {
-            Set<Long> re_goodsIds = new HashSet<>(spu.getRecommendGoodsList());
-            //去除自己
-            re_goodsIds.remove(spu.getId());
-            goods.setRecommendGoods(Jsons.toJson(re_goodsIds));
-        }
-        //平台 分类关系
-        goodsDonCategoryService.handleGoodsRelate(goods.getId(), spu.getCategoryList());
-        goodsDonService.updateById(goods);
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    @PutMapping("/put/status/{id}")
-    @SaCheckPermission("platform:updateStatus")
-    @Log(module = "平台管理/平台上下架", businessType = BusinessType.PUT, isSaveRequestData = true, isSaveResponseData = true)
-    public Result<Boolean> updateStatus(@PathVariable Long id) {
-        GoodsDon goods = goodsDonService.getById(id);
-        if (goods == null) {
-            throw BusinessRuntimeException.getInstance("平台不存在");
-        }
-        goods.setStatus(!goods.getStatus());
-        goodsDonService.updateById(goods);
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult(goods.getStatus());
-    }
-
-    @DeleteMapping("/delete/{id}")
-    @SaCheckPermission("platform:delete")
-    @Log(module = "平台管理/删除平台", businessType = BusinessType.DELETE, isSaveRequestData = true, isSaveResponseData = true)
-    public Result<Long> deleteById(@PathVariable Long id) {
-        GoodsDon goods = goodsDonService.getById(id);
-        if (goods == null) {
-            throw BusinessRuntimeException.getInstance("平台不存在");
-        }
-        goods.setDeleted(false);
-        goodsDonService.updateById(goods);
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult(id);
-    }
-
-    /**
-     * 获取所有平台列表
-     */
-    @GetMapping("/get/all")
-    public Result<List<GoodsDon>> getAllGoodsList(Boolean isNoBuyout) {
-        MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-        //过滤买断制 平台
-        String conditionSql;
-        if (isNoBuyout != null && isNoBuyout) {
-            mapBuilder.field(GoodsDon::getSpecialType).op(Operator.IsNull);
-            conditionSql = "(select count(*) from goods_don_sku sku where sku.goods_id = g.id and sku.months = 300) = 0";
-        } else {
-            conditionSql = "(special_type is null or special_type != 'giftCard')";
-        }
-        conditionSql += "  and exists (select id from goods_don_sku sku where sku.goods_id = g.id limit 1)";
-        List<GoodsDon> goodsDons = beanSearcher.searchAll(GoodsDon.class, mapBuilder
-                .put("condition", conditionSql)
-                .field(GoodsDon::getDeleted, true)
-                .onlySelect(GoodsDon::getId, GoodsDon::getCategory, GoodsDon::getType, GoodsDon::getTitle, GoodsDon::getSecondType).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDons);
-    }
-
-    /**
-     * 获取礼品卡平台
-     */
-    @GetMapping("/get/giftCard")
-    public Result<GoodsDon> getGiftCard() {
-        GoodsDon goodsDon = beanSearcher.searchFirst(GoodsDon.class, MapUtils.builder()
-                .field(GoodsDon::getSpecialType, GoodsDon.SpecialType.giftCard.name())
-                .build());
-        List<GoodsDonCategory> categoryView = goodsDonCategoryService.getCateGoryViewByGoodsId(goodsDon.getId());
-        goodsDon.setCategoryList(categoryView.stream().map(GoodsDonCategory::getId).collect(Collectors.toList()));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDon);
-    }
-
-    /**
-     * 获取所有平台以及其规格
-     */
-    @GetMapping("/get/all/goods/sku")
-    public Result<List<GoodsDetailView>> getAllGoodsDetail(Boolean isNoBuyout) {
-        MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-        //过滤买断制 平台
-        String conditionSql;
-        if (isNoBuyout != null && isNoBuyout) {
-            mapBuilder.field(GoodsDon::getSpecialType).op(Operator.IsNull);
-            conditionSql = "(select count(*) from goods_don_sku sku where sku.goods_id = g.id and sku.months = 300) = 0";
-        } else {
-            conditionSql = "(special_type is null or special_type != 'giftCard')";
-        }
-        conditionSql += "  and exists (select id from goods_don_sku sku where sku.goods_id = g.id limit 1)";
-
-        List<GoodsDetailView> goodsDons = beanSearcher.searchAll(GoodsDetailView.class, mapBuilder
-                .put("condition", conditionSql)
-                .field(GoodsDetailView::getType, 1)
-                .field(GoodsDetailView::getStatus, 1)
-                .field(GoodsDetailView::getDeleted, true)
-                .onlySelect(GoodsDetailView::getId, GoodsDetailView::getTitle)
-                .build());
-        goodsDons.forEach(e->{
-            List<GoodsDonSku> donSkus = skuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
-                    .eq(GoodsDonSku::getGoodsId, e.getId())
-                    .eq(GoodsDonSku::getStatus, 1).select(GoodsDonSku::getId, GoodsDonSku::getSpecVal));
-            e.setSkuList(donSkus);
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDons);
-    }
-
-}

+ 0 - 276
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSkuController.java

@@ -1,276 +0,0 @@
-package com.cyksj.web.controller.manage.goods;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Assert;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.GoodsDiscountPlusPurchaseRelation;
-import com.cyksj.model.entity.GoodsDon;
-import com.cyksj.model.entity.GoodsDonSku;
-import com.cyksj.model.manage.request.ReqGoodsSkuInsert;
-import com.cyksj.model.request.CombinationSkuReq;
-import com.cyksj.model.views.DistributeSearchView;
-import com.cyksj.service.mange.CmsGoodsDonService;
-import com.cyksj.service.mange.CmsGoodsDonSkuService;
-import com.cyksj.service.mange.CmsGoodsDonSpecService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author chan
- * @date 2022/9/27 5:25 PM
- */
-@Slf4j
-@RequiredArgsConstructor
-@RequestMapping("/manage/goods/sku")
-@RestController
-public class CmsGoodsDonSkuController {
-
-
-    private final CmsGoodsDonService goodsDonService;
-
-    private final CmsGoodsDonSpecService goodsDonSpecService;
-
-    private final CmsGoodsDonSkuService goodsDonSkuService;
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final RefreshCacheService refreshCacheService;
-
-
-    /**
-     * 新增 商品spec & sku
-     */
-    @PostMapping(value = "/post/spec-sku")
-    @Log(module = "平台管理/新增商品sku&spec", businessType = BusinessType.POST, isSaveRequestData = true)
-    public Result<String> skuInsert(@Validated @RequestBody ReqGoodsSkuInsert insert) throws Exception{
-        goodsDonSpecService.insertOrUpdateSkuSpec(insert, false);
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 更新 spec
-     */
-    @PutMapping("/update/spec")
-    public Result<String> updateGoodsSpec(@Validated @RequestBody ReqGoodsSkuInsert insert) throws Exception {
-        goodsDonSpecService.insertOrUpdateSkuSpec(insert, true);
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 追加 商品sku
-     */
-    @Transactional(rollbackFor = Throwable.class)
-    @PostMapping(value = "/post")
-    @Log(module = "平台管理/新增规格", businessType = BusinessType.POST, isSaveRequestData = true)
-    public Result<String> skuAppend(@Validated @RequestBody ReqGoodsSkuInsert insert) throws Exception{
-
-        GoodsDon goods = goodsDonService.getById(insert.getGoodsId());
-        if (null == goods) {
-            throw new RuntimeException("找不到商品spu.");
-        }
-        goodsDonSpecService.skuAppend(insert, goods);
-        //给平台更新额外属性
-        goodsDonService.updateGoodsSkuPrice(goods.getId(), goods);
-        refreshCacheService.refreshYhHomePageCache();
-       return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 修改 sku
-     */
-    @Transactional(rollbackFor = Throwable.class)
-    @PutMapping(value = "/update")
-    @Log(module = "平台管理/编辑规格", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> skuUpdate(@RequestBody GoodsDonSku sku) throws Exception {
-        Long skuId = sku.getId();
-        GoodsDonSku dbSku = goodsDonSkuService.getById(skuId);
-        Assert.notNull(dbSku, "规格不存在");
-        Long goodsId = sku.getGoodsId();
-        GoodsDon goods = goodsDonService.getById(goodsId);
-        if (goods.getType() == 1) {
-            if (sku.getMonths() != null && sku.getMonths() > 0 && sku.getDays() != null && sku.getDays() > 0)
-                throw BusinessRuntimeException.getInstance("续费天数和续费月数不能同时存在");
-            if (sku.getMonths() == null && sku.getDays() == null)
-                throw BusinessRuntimeException.getInstance("请输入对应续费时间");
-        }
-        if (sku.getMonths() == null) {
-            sku.setMonths(null);
-        }
-        if (sku.getDays() == null) {
-            sku.setDays(null);
-        }
-        if (sku.getMjRelaxNum() == null) {
-            sku.setMjRelaxNum(null);
-        }
-        String specificGoodsIds = sku.getSpecificGoodsIds();
-        if (StrUtil.isEmpty(specificGoodsIds)) {
-            sku.setSpecificPrice(BigDecimal.ZERO);
-        } else {
-            Set<Long> specificGids = Jsons.parseSet(specificGoodsIds, Long.class);
-            if (specificGids.isEmpty()) {
-                sku.setSpecificPrice(BigDecimal.ZERO);
-            } else {
-                Integer count = goodsDonService.count(Wrappers.lambdaQuery(GoodsDon.class)
-                        .in(GoodsDon::getId, specificGids)
-                        .eq(GoodsDon::getStatus, true)
-                        .eq(GoodsDon::getDeleted, true));
-                if (count != specificGids.size()) {
-                    throw BusinessRuntimeException.getInstance("存在被删除或已下架的平台");
-                }
-                BigDecimal specificPrice = sku.getSpecificPrice();
-                if (specificPrice == null || specificPrice.compareTo(BigDecimal.ZERO) <= 0) {
-                    throw BusinessRuntimeException.getInstance("请输入正确的特定价格");
-                }
-            }
-        }
-        if (StrUtil.isNotEmpty(sku.getUserOwns())) {
-            List<Long> userOwnsList = Jsons.parseList(sku.getUserOwns(), Long.class);
-            if (CollUtil.isEmpty(userOwnsList)) {
-                sku.setUserOwns(null);
-            }else {
-                sku.setUserOwns(userOwnsList.toString());
-            }
-        }
-        //优惠加购
-        goodsDonSkuService.handleDiscountPurchaseGoods(sku, sku.getDpSku());
-
-        String benefitsList = sku.getBenefitsList();
-        if (StrUtil.isNotBlank(benefitsList)) {
-            Set<GoodsDonSku> benefitsSkuIds = Jsons.parseSet(benefitsList, GoodsDonSku.class);
-            sku.setBenefitsList(Jsons.toJson(benefitsSkuIds));
-        }
-        goodsDonSkuService.updateMirrorCarUserNum(sku);
-        goodsDonSkuService.saveOrUpdate(sku);
-        //给平台更新额外属性
-        goodsDonService.updateGoodsSkuPrice(sku.getGoodsId(), null);
-        //前后两次价格不同 下架店铺低于这个折扣最低价格
-        BigDecimal oldPrice = dbSku.getPrice();
-        BigDecimal newPrice = sku.getPrice();
-        //规格新价 变高
-        //下架店铺低于这个规格价格的品
-        goodsDonSkuService.setBelowPriceShopSkuDown(skuId, newPrice);
-        //套餐包关联规格
-        goodsDonSkuService.handleGptPackageSku(dbSku,sku);
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 删除 sku
-     */
-    @Transactional(rollbackFor = Throwable.class)
-    @DeleteMapping("/delete/{skuId}")
-    @Log(module = "平台管理/删除规格", businessType = BusinessType.DELETE)
-    public Result<String> skuDelete(@PathVariable Long skuId) {
-        //给平台更新额外属性
-        GoodsDonSku sku = goodsDonSkuService.getById(skuId);
-        goodsDonSkuService.handleDiscountPurchaseGoods(sku, null);
-        goodsDonSkuService.removeById(skuId);
-        goodsDonService.updateGoodsSkuPrice(sku.getGoodsId(), null);
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 新 生成排列组合规格
-     */
-    @PostMapping("/post/combination/{goodsId}")
-    @Transactional(rollbackFor = Throwable.class)
-    public Result<String> postCombinationSku(@PathVariable Long goodsId, @RequestBody List<CombinationSkuReq> combinations) throws Exception {
-        goodsDonSpecService.combinationSku(goodsId, combinations);
-        return GatewayResponse.SUCCESS.newBuilder().toResult("新增规格成功");
-    }
-
-    /**
-     * 获取平台规格列表
-     */
-    @GetMapping("/get/list")
-    public Result<SearchResult<GoodsDonSku>> getGoodsSkuList(@RequestParam(defaultValue = "0") Boolean filterPack) {
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        if (filterPack) {
-            String condition = " spec_json not like '%套餐%'";
-            builder.put("condition", condition);
-        }
-        SearchResult<GoodsDonSku> skuViewList = beanSearcher.search(GoodsDonSku.class, builder
-                .orderBy(GoodsDonSku::getSorted).orderBy(GoodsDonSku::getCreatedTime).desc()
-                .build());
-        skuViewList.getDataList().forEach(sku->{
-            if (sku.getIsDp()) {
-                sku.setDpSku(beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelation.class, MapUtils.builder()
-                        .field(GoodsDiscountPlusPurchaseRelation::getSkuId, sku.getId())
-                        .build()));
-            }
-
-            if (StrUtil.isNotEmpty(sku.getUserOwns())) {
-                try {
-                    sku.setUserOwnsList(beanSearcher.searchAll(DistributeSearchView.class, MapUtils.builder().field(DistributeSearchView::getUserId, Jsons.parseList(sku.getUserOwns(), Long.class)).op(Operator.InList).build()));
-                } catch (Exception e) {
-                }
-            }
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(skuViewList);
-    }
-
-    /**
-     * 批量上架
-     */
-    @PutMapping("/batch/update/status/{goodsId}")
-    public Result<String> batchUpdateStatus(@PathVariable Long goodsId, @RequestBody List<Long> skuIds) {
-        GoodsDon goodsDon = goodsDonService.getById(goodsId);
-        if (goodsDon == null || !goodsDon.getDeleted()) {
-            throw BusinessRuntimeException.getInstance("商品不存在");
-        }
-        boolean update = goodsDonSkuService.update(null, Wrappers.lambdaUpdate(GoodsDonSku.class)
-                .set(GoodsDonSku::getStatus, true)
-                .eq(GoodsDonSku::getGoodsId, goodsId)
-                .in(GoodsDonSku::getId, skuIds)
-                .eq(GoodsDonSku::getStatus, false));
-        if (update) {
-            goodsDonService.updateGoodsSkuPrice(goodsId, null);
-            refreshCacheService.refreshYhHomePageCache();
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 规格排序
-     */
-    @PutMapping("/sorted")
-    public Result<String> sorted(@RequestBody GoodsDonSku sku) {
-        Long id = sku.getId();
-        Integer sorted = sku.getSorted();
-        Assert.notNull(id, "请选择指定的规格");
-        goodsDonSkuService.update(null, Wrappers.lambdaUpdate(GoodsDonSku.class)
-                .eq(GoodsDonSku::getId, id)
-                .set(GoodsDonSku::getSorted, sorted));
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-}

+ 0 - 128
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSpecController.java

@@ -1,128 +0,0 @@
-package com.cyksj.web.controller.manage.goods;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.GoodsDon;
-import com.cyksj.model.entity.GoodsDonSpec;
-import com.cyksj.model.manage.request.ReqGoodsSkuSpec;
-import com.cyksj.model.manage.request.ReqGoodsSpecSingle;
-import com.cyksj.service.mange.CmsGoodsDonService;
-import com.cyksj.service.mange.CmsGoodsDonSpecService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.util.MapUtils;
-import com.fasterxml.jackson.databind.JavaType;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author chan
- * @date 2022/9/27 4:48 PM
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/goods/spec")
-public class CmsGoodsDonSpecController {
-
-    private final HttpServletRequest request;
-
-    private final BeanSearcher beanSearcher;
-
-    private final CmsGoodsDonSpecService goodsDonSpecService;
-
-    private final CmsGoodsDonService goodsDonService;
-
-    @PostMapping("/post")
-    public Result<String> specAppend(@RequestBody ReqGoodsSpecSingle specSingle) throws Exception {
-
-        GoodsDon goodsDon = beanSearcher.searchFirst(GoodsDon.class, MapUtils.builder().field(GoodsDon::getId, specSingle.getGoodsId()).build());
-
-        if (null == goodsDon) {
-            throw new BusinessRuntimeException("","找不到商品spu.");
-        }
-
-        GoodsDonSpec v2spec = beanSearcher.searchFirst(GoodsDonSpec.class,MapUtils.builder().field(GoodsDonSpec::getGoodsId,goodsDon.getId()).build());
-        if (null == v2spec) {
-            throw new BusinessRuntimeException("","该商品未设置总规格, 请设置总规格.");
-        }
-
-        List<ReqGoodsSkuSpec> specs = Jsons.parseList(v2spec.getSpecsJson(), ReqGoodsSkuSpec.class);
-        for (ReqGoodsSkuSpec e : specs) {
-            if (StringUtils.equals(e.getKey(), specSingle.getKey())) {
-                List<ReqGoodsSkuSpec.Node> values = e.getValues();
-
-                ReqGoodsSkuSpec.Node node = new ReqGoodsSkuSpec.Node();
-                node.setId(specSingle.getId());
-                node.setValue(specSingle.getName());
-                values.add(node);
-
-                break;
-            }
-        }
-        String specsJson = Jsons.toJson(specs);
-
-        JavaType type = Jsons.javaType().constructMapType(HashMap.class, Integer.class, ReqGoodsSpecSingle.class);
-        Map<Integer, ReqGoodsSpecSingle> map = Jsons.parseObject(v2spec.getSpecMapping(), type);
-        map.put(specSingle.getId(), specSingle);
-        String specMapping = Jsons.toJson(map);
-
-        v2spec.setMaxId(specSingle.getMaxId());
-        v2spec.setSpecsJson(specsJson);
-        v2spec.setSpecMapping(specMapping);
-
-        goodsDonSpecService.saveOrUpdate(v2spec);
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 删除 商品spec
-     */
-    @DeleteMapping(value = "/delete")
-    public Result<String> delete(Integer specId, Long goodsId) throws Exception {
-        //TODO
-        GoodsDonSpec loveSpec = goodsDonSpecService.getOne(Wrappers.lambdaQuery(GoodsDonSpec.class).eq(GoodsDonSpec::getGoodsId,goodsId).last(" limit 1"));
-        if (null == loveSpec) {
-            throw new RuntimeException("该商品未设置总规格, 请设置总规格.");
-        }
-        if (specId > loveSpec.getMaxId()) {
-            throw new RuntimeException("错误规格属性id.");
-        }
-
-        JavaType type = Jsons.javaType().constructMapType(HashMap.class, Integer.class, ReqGoodsSpecSingle.class);
-        Map<Long, ReqGoodsSpecSingle> map = Jsons.parseObject(loveSpec.getSpecMapping(), type);
-        if (!map.containsKey(specId)) {
-            throw new RuntimeException("该id指向的规格属性 不存在.");
-        }
-        ReqGoodsSpecSingle spec = map.remove(specId);
-        String specMapping = Jsons.toJson(map);
-
-        List<ReqGoodsSkuSpec> specs = Jsons.parseList(loveSpec.getSpecsJson(), ReqGoodsSkuSpec.class);
-        for (ReqGoodsSkuSpec e : specs) {
-            if (StringUtils.equals(e.getKey(), spec.getKey())) {
-                e.getValues().removeIf(node -> node.getId().equals(specId));
-                break;
-            }
-        }
-        String specsJson = Jsons.toJson(specs);
-
-        loveSpec.setSpecsJson(specsJson);
-        loveSpec.setSpecMapping(specMapping);
-        goodsDonSpecService.saveOrUpdate(loveSpec);
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-
-}

+ 0 - 301
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonWholeSaleController.java

@@ -1,301 +0,0 @@
-package com.cyksj.web.controller.manage.goods;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.excel.EasyExcel;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.IoKit;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.common.util.Xmls;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsWholesaleOrderDonMapper;
-import com.cyksj.mapper.GoodsWholesaleUserAccountMapper;
-import com.cyksj.model.entity.GoodsWholesale;
-import com.cyksj.model.entity.GoodsWholesaleUserAccount;
-import com.cyksj.model.entity.GoodsWholesaleUserDeposit;
-import com.cyksj.model.request.OrderRefundReq;
-import com.cyksj.model.views.GoodsWholesaleOrderView;
-import com.cyksj.model.views.GoodsWholesaleView;
-import com.cyksj.model.views.WholesaleUserRequirementView;
-import com.cyksj.service.goods.GoodsWholesaleService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.cyksj.service.user.UserBindRelationService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.List;
-import java.util.Map;
-
-/**
- * admin/批发下单
- * 项目名: yhlxj
- * 文件名: CmsGoodsDonWholeSaleController
- * 创建者: JavaZou
- * 创建时间:2024/8/26 11:46
- */
-@RequestMapping("/manage/goods/whole/sale")
-@RestController
-@RequiredArgsConstructor
-@Slf4j
-public class CmsGoodsDonWholeSaleController {
-	private final GoodsWholesaleService goodsWholesaleService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserBindRelationService userBindRelationService;
-
-	private final GoodsWholesaleOrderDonMapper goodsWholesaleOrderDonMapper;
-
-	private final RefreshCacheService refreshCacheService;
-
-	private final GoodsWholesaleUserAccountMapper wholesaleUserAccountMapper;
-
-	/**
-	 * 新增批发平台
-	 */
-	@PostMapping("/post")
-	public Result<String> saveWholesale(@RequestBody GoodsWholesale wholesale) throws Exception {
-		goodsWholesaleService.saveOrUpdateWholesale(wholesale);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 编辑批发平台
-	 */
-	@PutMapping("/update")
-	public Result<String> updateWholesale(@RequestBody GoodsWholesale wholesale) throws Exception {
-		goodsWholesaleService.saveOrUpdateWholesale(wholesale);
-		refreshCacheService.refreshWholesaleGoods();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 平台批发排序
-	 */
-	@PutMapping("/sorted")
-	public Result<String> sortedWholesale(@RequestBody GoodsWholesale wholesale) throws Exception {
-		Long id = wholesale.getId();
-		Integer sorted = wholesale.getSorted();
-		GoodsWholesale byId = goodsWholesaleService.getById(id);
-		if (byId != null) {
-			byId.setSorted(sorted);
-			goodsWholesaleService.updateById(byId);
-			refreshCacheService.refreshWholesaleGoods();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除批发平台
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteWholesaleById(@PathVariable Long id) {
-		GoodsWholesale byId = goodsWholesaleService.getById(id);
-		if (byId != null) {
-			byId.setDeleted(false);
-			goodsWholesaleService.updateById(byId);
-			refreshCacheService.refreshWholesaleGoods();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 批发平台列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<GoodsWholesaleView>> getWholesale() {
-		SearchResult<GoodsWholesaleView> search = beanSearcher.search(GoodsWholesaleView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data->{
-			try {
-				data.setWholesaleConfig(Jsons.parseList(data.getConfig(), GoodsWholesale.GoodsWholesaleConfig.class));
-			} catch (Exception e) {
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 批发平台上下架
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		GoodsWholesale byId = goodsWholesaleService.getById(id);
-		if (byId != null) {
-			byId.setStatus(!byId.getStatus());
-			goodsWholesaleService.updateById(byId);
-			refreshCacheService.refreshWholesaleGoods();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 用户批发情况
-	 */
-	@GetMapping("/get/user/requirement/info")
-	public Result<SearchResult<WholesaleUserRequirementView>> userRequirementInfo() {
-		SearchResult<WholesaleUserRequirementView> search = beanSearcher.search(WholesaleUserRequirementView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data->{
-			List<Long> userIdList = null;
-			try {
-				userIdList = userBindRelationService.getRelationUserIdList(data.getUserId(), null);
-				Integer total = goodsWholesaleOrderDonMapper.getUserWholesaleNumByUserIds(userIdList, null);
-				data.setTotal(total);
-				String content = data.getContent();
-				if (StrUtil.isNotBlank(content)) {
-					String[] split = content.split("\\|");
-					String str = split[1];
-					if (str.contains("[")) {
-						data.setSource(str);
-						data.setNum(split[0]);
-					} else {
-						data.setNum(str);
-						data.setSource(split[0]);
-					}
-				}
-			} catch (Exception e) {
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-
-	//----------------------------------------------------------------------- 押金管理
-
-	/**
-	 * 押金列表
-	 * @return
-	 */
-	@GetMapping("/get/deposit")
-	public Result<SearchResult<GoodsWholesaleUserDeposit>> getDeposit() {
-		SearchResult<GoodsWholesaleUserDeposit> search = beanSearcher.search(GoodsWholesaleUserDeposit.class, MapUtils.flatBuilder(request.getParameterMap())
-				.build());
-		search.getDataList().forEach(data -> {
-			List<Long> userIdList = userBindRelationService.getRelationUserIdList(data.getUserId(), null);
-			Integer total = goodsWholesaleOrderDonMapper.getUserWholesaleNumByUserIds(userIdList, null);
-			data.setTotal(total);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 押金退款
-	 */
-	@PostMapping("/deposit/refund/{id}")
-	@Log(module = "批发押金退款", businessType = BusinessType.POST, isSaveRequestData = true)
-	public Result<String> depositRefund(@PathVariable Long id) throws Exception {
-		long adminId = StpUtil.getLoginIdAsLong();
-		goodsWholesaleService.depositRefund(id, adminId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 押金退款回调
-	 */
-	@PostMapping("/deposit/refund/notify")
-	public Result<String> depositRefundWxNotify(HttpServletResponse response) throws Exception {
-		String xml = IoKit.toString(request.getInputStream());
-		log.info("=== 押金退款成功的回调: \n {}", xml);
-
-		// 解析xml
-		Map<String, String> map = Xmls.toMap(xml);
-
-		// 退款失败
-		if (!StrUtil.equals("SUCCESS", map.get("return_code"))) {
-			throw BusinessRuntimeException.getInstance("退款失败.");
-		}
-
-		goodsWholesaleService.wxRefundNotify(map);
-
-		String toWechatXmlResponse = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
-
-		OutputStream out = null;
-		try {
-			out = response.getOutputStream();
-			IoKit.write(toWechatXmlResponse, out);
-		} catch (Throwable e) {
-			throw BusinessRuntimeException.getInstance(e == null ? null : e.getMessage());
-		} finally {
-			IoKit.close(out);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 批发订单
-	 */
-	@GetMapping("/get/order/list")
-	public Result<SearchResult<GoodsWholesaleOrderView>> getOrderList() {
-		SearchResult<GoodsWholesaleOrderView> search = beanSearcher.search(GoodsWholesaleOrderView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.orderBy(GoodsWholesaleOrderView::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 批发订单退款
-	 */
-	@PostMapping("/refund/order")
-	@Log(module = "批发订单退款", businessType = BusinessType.POST, isSaveRequestData = true)
-	public Result<String> wholesaleOrderRefund(@RequestBody @Validated OrderRefundReq refundReq) throws Exception {
-		long adminId = StpUtil.getLoginIdAsLong();
-		refundReq.setAdminId(adminId);
-		goodsWholesaleService.wholesaleOrderRefund(refundReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 上传账号
-	 */
-	@GetMapping("/upload/account")
-	public Result<String> uploadAccount(MultipartFile file, Long orderId) throws IOException {
-		List<Object> acountList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(0).doReadSync();
-		goodsWholesaleService.uploadAccount(acountList, orderId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 订单账号详情
-	 */
-	@GetMapping("/get/order/account/{orderId}")
-	public Result<SearchResult<GoodsWholesaleUserAccount>> getOrderAccount(@PathVariable Long orderId) {
-		SearchResult<GoodsWholesaleUserAccount> search = beanSearcher.search(GoodsWholesaleUserAccount.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(GoodsWholesaleUserAccount::getOrderId, orderId)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 新增订单账号信息
-	 */
-	@PostMapping("/post/order/account")
-	public Result<String> insertOrderAccount(@RequestBody List<GoodsWholesaleUserAccount> goodsWholesaleUserAccounts) {
-		goodsWholesaleService.insertOrderAccount(goodsWholesaleUserAccounts);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 编辑订单账号信息
-	 */
-	@PutMapping("/update/order/account")
-	public Result<String> updateOrderAccount(@RequestBody List<GoodsWholesaleUserAccount> goodsWholesaleUserAccounts) {
-		goodsWholesaleService.updateOrderAccount(goodsWholesaleUserAccounts);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-}

+ 0 - 119
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/GiftCardController.java

@@ -1,119 +0,0 @@
-package com.cyksj.web.controller.manage.goods;
-
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonMapper;
-import com.cyksj.model.entity.GiftCardGoodsSku;
-import com.cyksj.model.request.GiftCardGoodsSkuReq;
-import com.cyksj.model.views.GiftCardGoodsSkuView;
-import com.cyksj.model.views.GiftCardUserPayView;
-import com.cyksj.service.giftcard.GiftCardGoodsSkuService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/*
- *项目名: netflix
- *文件名: GiftCardController
- *创建者: JavaZou
- *创建时间:2023/8/29 18:15
- */
-@RequestMapping("/manage/giftCard")
-@RestController
-@RequiredArgsConstructor
-public class GiftCardController {
-	private final GiftCardGoodsSkuService giftCardGoodsSkuService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final GoodsDonMapper goodsDonMapper;
-
-	/**
-	 * 设置礼品卡 规格
-	 */
-	@PostMapping("/set")
-	public Result<String> setGiftCardSku(@RequestBody GiftCardGoodsSkuReq req) {
-		giftCardGoodsSkuService.setGiftCardSku(req);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 修改礼品卡 规格
-	 */
-	@PutMapping("/put")
-	public Result<String> updateGiftCardSku(@RequestBody GiftCardGoodsSku giftCardSku) {
-		if (giftCardSku.getId() == null) {
-			throw BusinessRuntimeException.getInstance("请指定要修改的礼品卡");
-		}
-		giftCardGoodsSkuService.setOrUpdateGiftCardSku(giftCardSku);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 获取礼品卡规格 配置
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<GiftCardGoodsSkuView>> getGiftCardGoodsSku() {
-		SearchResult<GiftCardGoodsSkuView> list = beanSearcher.search(GiftCardGoodsSkuView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-	}
-
-	/**
-	 * 礼品卡用户购买成功 记录
-	 */
-	@GetMapping("/get/pay")
-	public Result<SearchResult<GiftCardUserPayView>> getGiftCardPayRecord() {
-		SearchResult<GiftCardUserPayView> search = beanSearcher.search(GiftCardUserPayView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(GiftCardUserPayView::getIsPay, true)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 礼品卡上下架
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		GiftCardGoodsSku byId = giftCardGoodsSkuService.getById(id);
-		if (byId == null) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-//		if (!byId.getStatus()) {
-//			//校验礼品卡已上架多少个 最多上架三个
-//			int count = giftCardGoodsSkuService.count(Wrappers.lambdaQuery(GiftCardGoodsSku.class)
-//					.eq(GiftCardGoodsSku::getStatus, true)
-//					.eq(GiftCardGoodsSku::getDeleted, true)
-//					.eq(GiftCardGoodsSku::getGcType, byId.getGcType()));
-//			if (count > 2) {
-//				throw BusinessRuntimeException.getInstance(String.format("%s最多上架三个", byId.getGcType() == 1 ? "现金卡" : "虚拟卡"));
-//			}
-//		}
-		byId.setStatus(!byId.getStatus());
-		giftCardGoodsSkuService.updateById(byId);
-		//设置对应礼品卡平台 最低价格
-		giftCardGoodsSkuService.setGiftCardGoodsStat(goodsDonMapper.selectById(byId.getGoodsId()));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除礼品卡
-	 */
-	@DeleteMapping("/del/{id}")
-	public Result<String> delById(@PathVariable Long id) {
-		GiftCardGoodsSku byId = giftCardGoodsSkuService.getById(id);
-		if (byId == null) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		byId.setDeleted(false);
-		giftCardGoodsSkuService.updateById(byId);
-		giftCardGoodsSkuService.setGiftCardGoodsStat(goodsDonMapper.selectById(byId.getGoodsId()));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 145
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/GoodsDonQuestionController.java

@@ -1,145 +0,0 @@
-package com.cyksj.web.controller.manage.goods;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonQaRelateMapper;
-import com.cyksj.model.entity.GoodsDonQa;
-import com.cyksj.model.entity.GoodsDonQaRelate;
-import com.cyksj.model.views.GoodsDonQaView;
-import com.cyksj.service.mange.GoodsDonQaService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/** admin/平台管理/常见问题
- * 项目名: yhlxj2
- * 文件名: GoodsDonQuestionController
- * 创建者: JavaZou
- * 创建时间:2024/5/24 15:52
- */
-@RequestMapping("/manage/goods/question")
-@RestController
-@RequiredArgsConstructor
-public class GoodsDonQuestionController {
-
-	private final GoodsDonQaService goodsDonQaService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final RefreshCacheService refreshCacheService;
-
-	private final GoodsDonQaRelateMapper goodsDonQaRelateMapper;
-
-
-	/**
-	 * 新增问题
-	 */
-	@PostMapping("/post")
-	public Result<String> post(@RequestBody GoodsDonQa goodsDonQa) {
-		goodsDonQaService.saveOrdUpdateQa(goodsDonQa);
-		refreshCacheService.goodsQuestionCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 删除问题
-	 */
-	@DeleteMapping("/del/{id}")
-	public Result<String> delById(@PathVariable Long id) {
-		GoodsDonQa byId = goodsDonQaService.getById(id);
-		if (byId != null && byId.getDeleted()) {
-			byId.setDeleted(false);
-			goodsDonQaService.updateById(byId);
-			goodsDonQaRelateMapper.update(null, Wrappers.lambdaUpdate(GoodsDonQaRelate.class)
-					.set(GoodsDonQaRelate::getDeleted, 0)
-					.eq(GoodsDonQaRelate::getQuestionId, id)
-					.eq(GoodsDonQaRelate::getDeleted, 1));
-			refreshCacheService.goodsQuestionCache();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 更新问题
-	 */
-	@PutMapping("/update")
-	public Result<String> update(@RequestBody GoodsDonQa goodsDonQa) {
-		goodsDonQaService.saveOrdUpdateQa(goodsDonQa);
-		refreshCacheService.goodsQuestionCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 上下架
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		GoodsDonQa byId = goodsDonQaService.getById(id);
-		if (byId != null) {
-			byId.setStatus(!byId.getStatus());
-			goodsDonQaService.updateById(byId);
-			refreshCacheService.goodsQuestionCache();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 批量上下架
-	 */
-	@PutMapping("/update/status/batch")
-	public Result<String> batchUpdateStatusByIds(@RequestParam("ids") List<Long> ids, Boolean status) {
-		goodsDonQaService.update(null, Wrappers.lambdaUpdate(GoodsDonQa.class)
-				.set(GoodsDonQa::getStatus, status)
-				.ne(GoodsDonQa::getStatus, status)
-				.in(GoodsDonQa::getId, ids)
-				.eq(GoodsDonQa::getDeleted, 1));
-		refreshCacheService.goodsQuestionCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 问题列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<GoodsDonQaView>> get() {
-		SearchResult<GoodsDonQaView> search = beanSearcher.search(GoodsDonQaView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 问题详情
-	 */
-	@GetMapping("/get/detail/{id}")
-	public Result<GoodsDonQa> getDetailById(@PathVariable Long id) {
-		GoodsDonQa byId = goodsDonQaService.getDetailById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(byId);
-	}
-
-	/**
-	 * 排序
-	 */
-	@PutMapping("/sorted")
-	public Result<String> sorted(@RequestBody GoodsDonQa goodsDonQa) {
-		Long id = goodsDonQa.getId();
-		Integer sorted = goodsDonQa.getSorted();
-		GoodsDonQa byId = goodsDonQaService.getById(id);
-		if (byId != null) {
-			byId.setSorted(sorted);
-			goodsDonQaService.updateById(byId);
-			refreshCacheService.goodsQuestionCache();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 94
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/GoodsDonSkuSubsidyController.java

@@ -1,94 +0,0 @@
-package com.cyksj.web.controller.manage.goods;
-
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.GoodsDonSkuSubsidy;
-import com.cyksj.model.views.GoodsDonSkuSubsidyView;
-import com.cyksj.service.mange.GoodsDonSkuSubsidyService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/** admin/百亿补贴
- * 项目名: yhlxj2
- * 文件名: GoodsDonSkuSubsidyController
- * 创建者: JavaZou
- * 创建时间:2024/4/11 12:05
- */
-@Slf4j
-@RequiredArgsConstructor
-@RequestMapping("/manage/goods/sku/subsidy")
-@RestController
-public class GoodsDonSkuSubsidyController {
-	private final GoodsDonSkuSubsidyService goodsDonSkuSubsidyService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final RefreshCacheService refreshCacheService;
-
-	/**
-	 * 新增补贴规格
-	 */
-	@PostMapping("/insert")
-	public Result<String> insertGoodsDonSkuSubsidy(@RequestBody @Validated GoodsDonSkuSubsidy goodsDonSkuSubsidy) {
-		goodsDonSkuSubsidyService.saveOrUpdateSubsidy(goodsDonSkuSubsidy);
-		refreshCacheService.refreshGoodsSkuSubsidyPageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 更新补贴规格
-	 */
-	@PutMapping("/update")
-	public Result<String> updateGoodsDonSkuSubsidy(@RequestBody @Validated GoodsDonSkuSubsidy goodsDonSkuSubsidy) {
-		goodsDonSkuSubsidyService.saveOrUpdateSubsidy(goodsDonSkuSubsidy);
-		refreshCacheService.refreshGoodsSkuSubsidyPageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除商品补贴价格记录
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteGoodsDonSkuSubsidy(@PathVariable Long id) {
-		GoodsDonSkuSubsidy byId = goodsDonSkuSubsidyService.getById(id);
-		if (byId != null && byId.getDeleted()) {
-			byId.setDeleted(false);
-			goodsDonSkuSubsidyService.updateById(byId);
-			refreshCacheService.refreshGoodsSkuSubsidyPageCache();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 上下架补贴规格
-	 */
-	@PutMapping("/status/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		GoodsDonSkuSubsidy byId = goodsDonSkuSubsidyService.getById(id);
-		if (byId != null) {
-			byId.setStatus(!byId.getStatus());
-			goodsDonSkuSubsidyService.updateById(byId);
-			refreshCacheService.refreshGoodsSkuSubsidyPageCache();
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 查询商品补贴价格记录 列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<GoodsDonSkuSubsidyView>> getGoodsDonSkuSubsidy() {
-		SearchResult<GoodsDonSkuSubsidyView> search = beanSearcher.search(GoodsDonSkuSubsidyView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 96
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/RegisterGoodsDonController.java

@@ -1,96 +0,0 @@
-package com.cyksj.web.controller.manage.goods;
-
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.RegisterGoodsDonMapper;
-import com.cyksj.model.entity.RegisterGoodsDon;
-import com.cyksj.redis.RedisService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Set;
-
-/*
- *项目名: netflix
- *文件名: RegisterGoodsDonController
- *创建者: JavaZou
- *创建时间:2023/7/3 15:03
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/register/goods")
-public class RegisterGoodsDonController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final RegisterGoodsDonMapper registerGoodsDonMapper;
-
-	private final RedisService redisService;
-
-	@GetMapping("/get")
-	public Result<SearchResult<RegisterGoodsDon>> get(){
-		SearchResult<RegisterGoodsDon> search = beanSearcher.search(RegisterGoodsDon.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(RegisterGoodsDon::getDeleted,true)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 新增 商品spu
-	 */
-	@PostMapping(value = "/post")
-	public Result<Long> spuInsert(@Validated @RequestBody RegisterGoodsDon registerGoodsDon) throws Exception {
-		// 新增商品
-		registerGoodsDonMapper.insert(registerGoodsDon);
-		Set<String> keys = redisService.keys(RedisService.key.REGISTER_HOME_PAGE_CACHE.getName() + "*");
-		redisService.del(keys.toArray(String[]::new));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(registerGoodsDon.getId());
-	}
-
-	/**
-	 * 修改 商品spu
-	 */
-	@PutMapping(value = "/update")
-	public Result<String> spuUpdate(@Validated @RequestBody RegisterGoodsDon registerGoodsDon) throws Exception{
-		registerGoodsDonMapper.updateById(registerGoodsDon);
-		Set<String> keys = redisService.keys(RedisService.key.REGISTER_HOME_PAGE_CACHE.getName() + "*");
-		redisService.del(keys.toArray(String[]::new));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	@PutMapping("/put/status/{id}")
-	public Result<Boolean> updateStatus(@PathVariable Long id) {
-		RegisterGoodsDon registerGoodsDon = registerGoodsDonMapper.selectById(id);
-		if (registerGoodsDon == null) {
-			throw BusinessRuntimeException.getInstance("平台不存在");
-		}
-		registerGoodsDon.setStatus(!registerGoodsDon.getStatus());
-		registerGoodsDonMapper.updateById(registerGoodsDon);
-		Set<String> keys = redisService.keys(RedisService.key.REGISTER_HOME_PAGE_CACHE.getName() + "*");
-		redisService.del(keys.toArray(String[]::new));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(registerGoodsDon.getStatus());
-	}
-
-	@DeleteMapping("/delete/{id}")
-	public Result<Long> deleteById(@PathVariable Long id) {
-		RegisterGoodsDon registerGoodsDon = registerGoodsDonMapper.selectById(id);
-		if (registerGoodsDon == null) {
-			throw BusinessRuntimeException.getInstance("平台不存在");
-		}
-		registerGoodsDon.setDeleted(false);
-		registerGoodsDonMapper.updateById(registerGoodsDon);
-		Set<String> keys = redisService.keys(RedisService.key.REGISTER_HOME_PAGE_CACHE.getName() + "*");
-		redisService.del(keys.toArray(String[]::new));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(id);
-	}
-}

+ 0 - 536
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/CmsYhShopGoodsController.java

@@ -1,536 +0,0 @@
-package com.cyksj.web.controller.manage.goods.shop;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.StringUtil;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.manage.cms.CmsUserMapper;
-import com.cyksj.mapper.shop.YhShopMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.request.DistributeApplyMoneyReq;
-import com.cyksj.model.request.GoodsDonShopRateReq;
-import com.cyksj.model.request.YhShopUserPlatDistributeRateReq;
-import com.cyksj.model.request.YhShopVerifyReq;
-import com.cyksj.model.views.*;
-import com.cyksj.service.mange.CmsGoodsDonSkuService;
-import com.cyksj.service.mange.CmsYhShopCommonService;
-import com.cyksj.service.mange.CmsYhShopGoodsRateService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.cyksj.service.mange.business.UserBusinessRateService;
-import com.cyksj.service.mange.statistics.StatisticsDataService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-/**
- * admin/小店店铺/银河后台/商务管理
- * @author zwhui
- * @date 2023/9/14 16:42
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/shop")
-public class CmsYhShopGoodsController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final CmsYhShopGoodsRateService yhShopGoodsRateService;
-
-    private final CmsYhShopCommonService cmsYhShopCommonService;
-
-    private final HttpServletRequest request;
-
-    private final UserBusinessRateService userBusinessRateService;
-
-    private final UserMapper userMapper;
-
-    private final CmsUserMapper cmsUserMapper;
-
-    private final YhShopMapper yhShopMapper;
-
-    private final StatisticsDataService statisticsDataService;
-
-    private final GoodsDonSkuMapper skuMapper;
-
-    private final CmsGoodsDonSkuService goodsDonSkuService;
-
-    private final RefreshCacheService refreshCacheService;
-
-
-    /**
-     * 获取店铺平台价格
-     */
-    @GetMapping("/get/goods")
-    public Result<SearchResult<YhShopGoodsRateView>> shopGoodsList(){
-        SearchResult<YhShopGoodsRateView> search = beanSearcher.search(YhShopGoodsRateView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        search.getDataList().forEach(e -> e.setList(beanSearcher.searchList(YhShopGoodsRateView.YhShopGoodsSkuRateView.class,MapUtils.builder().field(YhShopGoodsRateView.YhShopGoodsSkuRateView::getGoodsId,e.getGoodsId()).build())));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 设置店铺平台价格浮动比例
-     */
-    @PutMapping("/put/goods/rate")
-    @Transactional(rollbackFor = Throwable.class)
-    public Result<Void> updShopGoodsRate(@RequestBody GoodsDonShopRateReq req) {
-        req.getList().forEach(e -> {
-            if (e.getRate() == null) {
-                e.setRate(0);
-            }
-            Integer rate = e.getRate();
-            if (rate < 0 && rate > 100) {
-                throw BusinessRuntimeException.getInstance("请输入正确的比例");
-            }
-            YhShopGoodsRate one = yhShopGoodsRateService.getOne(Wrappers.lambdaQuery(YhShopGoodsRate.class)
-                    .eq(YhShopGoodsRate::getSkuId, e.getSkuId()).last("limit 1"));
-            if (one == null) {
-                one = new YhShopGoodsRate();
-                one.setRate(e.getRate());
-                one.setGoodsId(e.getGoodsId());
-                one.setSkuId(e.getSkuId());
-            } else {
-                one.setRate(e.getRate());
-            }
-            yhShopGoodsRateService.saveOrUpdate(one);
-
-            GoodsDonSku sku = skuMapper.selectById(one.getSkuId());
-            //下架店铺低于这个规格价格的品
-            goodsDonSkuService.setBelowPriceShopSkuDown(e.getSkuId(), sku.getPrice());
-        });
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 一键设置 店铺平台通用浮动比例
-     */
-    @PutMapping("/oneKey/set/goods/rate")
-    @Transactional(rollbackFor = Throwable.class)
-    public Result<Void> setShopGoodsGeneralRate(@RequestBody GoodsDonShopRateReq req) {
-        Integer rate = Optional.ofNullable(req.getRate()).orElse(0);
-        if (rate < 0 && rate > 100) {
-            throw BusinessRuntimeException.getInstance("请输入正确的比例");
-        }
-        List<Long> goodsIds = req.getGoodsIds();
-        goodsIds.forEach(goodsId -> {
-            List<YhShopGoodsRate> yhShopGoodsRates = beanSearcher.searchList(YhShopGoodsRate.class, MapUtils.builder().field(YhShopGoodsRate::getGoodsId, goodsId).build());
-            yhShopGoodsRates.forEach(data -> {
-                data.setRate(rate);
-            });
-            yhShopGoodsRateService.saveOrUpdateBatch(yhShopGoodsRates);
-
-            List<GoodsDonSku> goodsDonSkus = goodsDonSkuService.list(Wrappers.lambdaQuery(GoodsDonSku.class)
-                    .eq(GoodsDonSku::getGoodsId, goodsId));
-            goodsDonSkus.forEach(sku -> {
-                //下架店铺低于这个规格价格的品
-                goodsDonSkuService.setBelowPriceShopSkuDown(sku.getId(), sku.getPrice());
-            });
-        });
-        refreshCacheService.refreshYhHomePageCache();
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 店铺管理列表
-     */
-    @GetMapping("/get")
-    public Result<SearchResult<YhShopDistributeView>> getYhShopDistributeView(String showId, String nickname, String startTime, String endTime) {
-        long adminId = StpUtil.getLoginIdAsLong();
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        //是否是商务人员
-        if (userBusinessRateService.isBusiness(adminId)) {
-            builder.field(YhShopDistributeView::getBusinessId, adminId);
-        }
-        if (StrUtil.isNotBlank(showId)) {
-            builder.field(YhShopDistributeView::getUserId, userMapper.getUserIdByShowId(showId));
-        }
-        if (StrUtil.isNotBlank(nickname)) {
-            List<Long> userIds = userMapper.selectListByNickname(nickname);
-            builder.field(YhShopDistributeView::getUserId, userIds).op(Operator.InList);
-        }
-        String timeSql = StrUtil.EMPTY;
-        if (StrUtil.isNotBlank(startTime)) {
-            timeSql += String.format("and od.created_time >= '%s'", startTime);
-        }
-        if (StrUtil.isNotBlank(endTime)) {
-            timeSql += String.format("and od.created_time < '%s'", endTime);
-        }
-        if (StrUtil.isNotBlank(timeSql)) {
-            builder.put("time", timeSql);
-            //按时间筛选 固定推广人分销情况 倒序
-            builder.orderBy(YhShopDistributeView::getDistributeOrdersMoney).desc();
-        }
-        Map<Long, String> businessNameMap = new ConcurrentHashMap<>();
-        SearchResult<YhShopDistributeView> search = beanSearcher.search(YhShopDistributeView.class, builder.build());
-        search.getDataList().forEach(view -> {
-            if (view.getDistributeOrdersMoney().compareTo(BigDecimal.ZERO) > 0) {
-                Optional.ofNullable(yhShopMapper.selectSoldMaxGoods(view.getUserId())).ifPresent(title -> view.setGoodsTitle(title));
-            }
-            String businessName = businessNameMap.get(view.getBusinessId());
-            view.setBusinessName(businessName);
-            if (StrUtil.isEmpty(businessName)) {
-                Optional.ofNullable(cmsUserMapper.selectById(view.getBusinessId())).ifPresent(cmsUser -> {
-                    businessNameMap.putIfAbsent(view.getBusinessId(), cmsUser.getNickname());
-                    view.setBusinessName(cmsUser.getNickname());
-                });
-            }
-            Optional.ofNullable(userMapper.selectById(view.getUserId())).ifPresent(user -> view.setNickname(user.getNickname()));
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 店铺关闭
-     */
-    @PutMapping("/update/status")
-    public Result<String> updateShopStatus(@RequestBody YhShop yhShop) {
-        Long id = yhShop.getId();
-        YhShop dbShop = yhShopMapper.selectById(id);
-        if (dbShop != null) {
-            dbShop.setStatus(!dbShop.getStatus());
-            dbShop.setRemark(yhShop.getRemark());
-            yhShopMapper.updateById(dbShop);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 设置店铺对应商务
-     */
-    @PutMapping("/set/business")
-    public Result<String> setYhShopBusiness(@RequestBody YhShop yhShop) {
-        cmsYhShopCommonService.setYhShopBusiness(yhShop);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 店铺提现记录详情
-     */
-    @GetMapping("/get/apply/detail/{shopUserId}")
-    public Result<YhShopDistributeView> getYhShopApplyDetail(@PathVariable Long shopUserId) {
-        YhShopDistributeView yhShopDistributeOrderView = yhShopMapper.getApplyDetailByUserId(shopUserId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(yhShopDistributeOrderView);
-    }
-
-    /**
-     * 设置店铺提成比例
-     */
-    @PutMapping("/set/rate")
-    public Result<String> setYhShopGoodsRate(@RequestBody @Validated YhShopUserPlatDistributeRateReq req) {
-        Long businessId = req.getBusinessId();
-        YhShop yhShop = new YhShop();
-        yhShop.setId(req.getId());
-        yhShop.setBusinessId(businessId);
-        yhShop.setRemark(req.getRemark());
-        cmsYhShopCommonService.setYhShopBusiness(yhShop);
-        List<YhShopUserPlatDistributeRate> yhShopUserPlatDistributeRates = req.getRates();
-        if (CollUtil.isEmpty(yhShopUserPlatDistributeRates)) {
-            throw BusinessRuntimeException.getInstance("请选择店铺用户对应平台比例");
-        }
-        cmsYhShopCommonService.setYhShopGoodsRate(yhShopUserPlatDistributeRates,yhShop.getBusinessId(), yhShop.getUserId());
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 店铺提成比例详情
-     */
-    @GetMapping("/get/detail/{userId}")
-    public Result<List<YhShopUserPlatDistributeRate>> getDetailById(@PathVariable Long userId) {
-        return GatewayResponse.SUCCESS.newBuilder().toResult(beanSearcher.searchAll(YhShopUserPlatDistributeRate.class, MapUtils.builder()
-                .put("uid", String.format("and ydr.user_id = %s", userId))
-                .orderBy(YhShopUserPlatDistributeRate::getGoodsId).asc()
-                .build()));
-    }
-
-    /**
-     * 店铺注册人数列表
-     */
-    @GetMapping("/get/register/detail/{shopUserId}")
-    public Result<SearchResult<YhShopRegisterDetail>> getRegisterDetail(@PathVariable Long shopUserId) {
-        SearchResult<YhShopRegisterDetail> search = beanSearcher.search(YhShopRegisterDetail.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(YhShopRegisterDetail::getShopUserId, shopUserId)
-                .build());
-        search.getDataList().forEach(data -> {
-            List<YhShopRegisterDistributeOrdersDetailView> ordersDetailViewList = beanSearcher.searchAll(YhShopRegisterDistributeOrdersDetailView.class, MapUtils.builder()
-                    .field(YhShopRegisterDistributeOrdersDetailView::getShopUserId, shopUserId)
-                    .field(YhShopRegisterDistributeOrdersDetailView::getUserId, data.getUserId())
-                    .build());
-            data.setOrderNums(ordersDetailViewList.size());
-            Optional<BigDecimal> money = ordersDetailViewList.stream().filter(order -> {
-                if (!Constant.noOrderAllStatus.contains(order.getStatus().name())) {
-                    return true;
-                }
-                return false;
-            }).map(YhShopRegisterDistributeOrdersDetailView::getMoney).reduce(BigDecimal::add);
-            data.setMoney(money.isPresent() ? money.get() : BigDecimal.ZERO);
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 店铺注册人数 订单详情
-     */
-    @GetMapping("/get/register/order/detail/{shopUserId}/{userId}")
-    public Result<SearchResult<YhShopRegisterOrderDetail>> getRegisterOrderDetail(@PathVariable Long shopUserId, @PathVariable Long userId) {
-        String condition = String.format("where ys.user_id = %s and o.user_id = %s", shopUserId, userId);
-        SearchResult<YhShopRegisterOrderDetail> search = beanSearcher.search(YhShopRegisterOrderDetail.class, MapUtils.flatBuilder(request.getParameterMap())
-                .put("condition", condition)
-                .build());
-        String nickname = StrUtil.EMPTY;
-        for (YhShopRegisterOrderDetail data : search.getDataList()) {
-            if (StrUtil.isEmpty(nickname)) {
-                User user = userMapper.selectById(data.getUserId());
-                nickname = user.getNickname();
-                data.setNickname(nickname);
-                continue;
-            }
-            data.setNickname(nickname);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 店铺订单详情
-     */
-    @GetMapping("/get/order/detail/{shopUserId}")
-    public Result<SearchResult<YhShopDistributeOrderView>> getOrderDetail(@PathVariable Long shopUserId) {
-        SearchResult<YhShopDistributeOrderView> search = beanSearcher.search(YhShopDistributeOrderView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .put("suId", String.format("where shop_user_id = %s", shopUserId))
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 商务人员列表 详情
-     */
-    @GetMapping("/get/business/list")
-    public Result<SearchResult<YhShopDistributeBusinessView>> getDistributeBusinessView() {
-        long adminId = StpUtil.getLoginIdAsLong();
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        DateTime beginOfMonth = DateUtil.beginOfMonth(DateTime.now());
-        String thisMonth = beginOfMonth.toString("yyyy-MM");
-        //是否是商务人员
-        if (userBusinessRateService.isBusiness(adminId)) {
-            builder.field(YhShopDistributeBusinessView::getBusinessId, adminId);
-        }
-        builder.put("time", String.format("date_format(ubr.order_created_time,'%%Y-%%m') = '%s'", thisMonth));
-        SearchResult<YhShopDistributeBusinessView> search = beanSearcher.search(YhShopDistributeBusinessView.class, builder.build());
-        search.getDataList().forEach(data -> {
-            Number numOfRelation = beanSearcher.searchCount(YhShop.class, MapUtils.builder().field(YhShop::getBusinessId, data.getBusinessId()).build());
-            data.setNumOfRelation(numOfRelation.intValue());
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 商务人员提成详情
-     */
-    @GetMapping("/get/takeMoney/detail")
-    public Result<SearchResult<YhShopBusinessTakeMoneyDetail>> getTakeMoneyDetail(String firstMonthDate, String secondMonthDate) {
-        long adminId = StpUtil.getLoginIdAsLong();
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        //是否是商务人员
-        if (userBusinessRateService.isBusiness(adminId)) {
-            builder.field(YhShopBusinessTakeMoneyDetail::getBusinessId, adminId);
-        }
-        String timeSql = StringUtil.EMPTY;
-        if (StrUtil.isNotBlank(firstMonthDate)) {
-            timeSql += String.format("date_format(ubr.order_created_time,'%%Y-%%m') >= '%s'", firstMonthDate);
-        }
-        if (StrUtil.isNotBlank(secondMonthDate)) {
-            timeSql += String.format("and date_format(ubr.order_created_time,'%%Y-%%m') <= '%s'", secondMonthDate);
-        }
-        if (StrUtil.isNotBlank(timeSql)) {
-            builder.put("time", timeSql);
-        }
-        SearchResult<YhShopBusinessTakeMoneyDetail> search = beanSearcher.search(YhShopBusinessTakeMoneyDetail.class, builder.build());
-        search.getDataList().forEach(data -> {
-            User user = userMapper.selectById(data.getUserId());
-            Optional.ofNullable(user).ifPresent(u -> {
-                data.setNickname(u.getNickname());
-                data.setCreatedTime(u.getCreatedTime());
-            });
-            CmsUser business = cmsUserMapper.selectById(data.getBusinessId());
-            Optional.ofNullable(business).ifPresent(bs -> data.setBusinessName(bs.getNickname()));
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 商务提成head
-     */
-    @GetMapping("/get/business/headData")
-    public Result<YhShopBusinessTakeMoneyHeadView> getTakeMoneyHeadDetail(String firstMonthDate, String secondMonthDate) {
-        long adminId = StpUtil.getLoginIdAsLong();
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        //是否是商务人员
-        if (userBusinessRateService.isBusiness(adminId)) {
-            builder.field(YhShopBusinessTakeMoneyHeadView::getBusinessId, adminId);
-        }
-        String timeSql = StringUtil.EMPTY;
-        if (StrUtil.isNotBlank(firstMonthDate)) {
-            timeSql += String.format("date_format(ubr.order_created_time,'%%Y-%%m') >= '%s'", firstMonthDate);
-        }
-        if (StrUtil.isNotBlank(secondMonthDate)) {
-            timeSql += String.format("and date_format(ubr.order_created_time,'%%Y-%%m') <= '%s'", secondMonthDate);
-        }
-        if (StrUtil.isNotBlank(timeSql)) {
-            builder.put("time", timeSql);
-        }
-        YhShopBusinessTakeMoneyHeadView headView = beanSearcher.searchFirst(YhShopBusinessTakeMoneyHeadView.class, builder.build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(headView);
-    }
-
-    /**
-     * 店铺商务 数据列表
-     */
-    @GetMapping("/get/business/data")
-    public Result<SearchResult<YhShopBusinessDistributesDataView>> getBusinessDistributesData(String startTime, String endTime) {
-        long adminId = StpUtil.getLoginIdAsLong();
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        String time1Sql = StrUtil.EMPTY;
-        String time2Sql = StrUtil.EMPTY;
-        String time3Sql = StrUtil.EMPTY;
-        if (StrUtil.isNotBlank(startTime)) {
-            time1Sql += String.format(" and ys.business_bind_time >= '%s'", startTime);
-            time2Sql += String.format(" and us.created_time >= '%s'", startTime);
-            time3Sql += String.format(" and od.created_time >= '%s'", startTime);
-        }
-        if (StrUtil.isNotBlank(endTime)) {
-            time1Sql += String.format(" and ys.business_bind_time < '%s'", endTime);
-            time2Sql += String.format(" and us.created_time < '%s'", endTime);
-            time3Sql += String.format(" and od.created_time < '%s'", endTime);
-        }
-        if (StrUtil.isNotBlank(time1Sql)) {
-            builder.put("time1", time1Sql);
-        }
-        if (StrUtil.isNotBlank(time2Sql)) {
-            builder.put("time2", time2Sql);
-        }
-        if (StrUtil.isNotBlank(time3Sql)) {
-            builder.put("time3", time3Sql);
-        }
-        //是否是商务人员
-        if (userBusinessRateService.isBusiness(adminId)) {
-            builder.field(YhShopBusinessDistributesDataView::getBusinessId, adminId);
-        }
-        SearchResult<YhShopBusinessDistributesDataView> search = beanSearcher.search(YhShopBusinessDistributesDataView.class, builder.build());
-        search.getDataList().forEach(data -> {
-            Optional.ofNullable(cmsUserMapper.selectById(data.getBusinessId()))
-                    .ifPresent(cmsUser -> data.setBusinessName(cmsUser.getNickname()));
-
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 店铺提现 列表
-     */
-    @GetMapping("/get/applyMoney")
-    public Result<SearchResult<YhShopDistributeMoneyApplyView>> applyMoneyList() {
-        SearchResult<YhShopDistributeMoneyApplyView> search = beanSearcher.search(YhShopDistributeMoneyApplyView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 店铺提现 审核
-     */
-    @PutMapping("/verify/applyMoney")
-    @NoSubmit
-    public Result<String> verifyApplyMoney(@RequestBody @Validated DistributeApplyMoneyReq distributeApplyMoneyReq) {
-        cmsYhShopCommonService.verifyYhShopApplyMoney(distributeApplyMoneyReq);
-        return GatewayResponse.SUCCESS.newBuilder().toResult("审核操作成功");
-    }
-
-    /**
-     * 修改审核图片
-     */
-    @PutMapping("/verify/applyMoney/img")
-    public Result<String> updateVerifyImg(@RequestBody DistributeApplyMoneyReq distributeApplyMoneyReq) {
-        cmsYhShopCommonService.updateVerifyImg(distributeApplyMoneyReq);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 开店审核列表
-     */
-    @GetMapping("/get/apply")
-    public Result<SearchResult<YhShopView>> getUserShopApply() {
-        SearchResult<YhShopView> search = beanSearcher.search(YhShopView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 一键审核
-     */
-    @PutMapping("/batch/verify")
-    public Result<String> batchVerify(@RequestBody YhShopVerifyReq verifyReq) {
-	    List<Long> ids = verifyReq.getIds();
-	    if (CollUtil.isEmpty(ids)) {
-		    throw BusinessRuntimeException.getInstance("请选择对应的审核记录");
-	    }
-	    ids.forEach(id -> {
-		    verifyReq.setId(id);
-		    cmsYhShopCommonService.verifyYhShopApply(verifyReq);
-	    });
-	    return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 店铺审核
-     */
-    @PutMapping("/verify")
-    public Result<String> verifyYhShopApply(@RequestBody YhShopVerifyReq verifyReq) {
-        cmsYhShopCommonService.verifyYhShopApply(verifyReq);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 店铺头部数据
-     */
-    @GetMapping("/get/head/data")
-    public Result<BackgroundDataView> getHeadData(Long startTime, Long endTime) {
-        BackgroundDataView backgroundDataView = new BackgroundDataView();
-        Date startDate = null;
-        Date endDate = null;
-        if (startTime != null) {
-            startDate = DateUtil.date(startTime);
-        }
-        if (endTime != null) {
-            endDate = DateUtil.date(endTime);
-        }
-        //分销金额数据统计
-        statisticsDataService.yhShopDistribute(backgroundDataView, startDate, endDate);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(backgroundDataView);
-    }
-}

+ 0 - 171
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopGoodsController.java

@@ -1,171 +0,0 @@
-package com.cyksj.web.controller.manage.goods.shop;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.shop.YhShopMapper;
-import com.cyksj.model.dto.YhShopSkuDownInfo;
-import com.cyksj.model.entity.YhShop;
-import com.cyksj.model.entity.YhShopGoodsSku;
-import com.cyksj.model.views.YhShopAvailableGoodsView;
-import com.cyksj.model.views.YhShopGoodsRateView;
-import com.cyksj.model.views.YhShopGoodsView;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.cyksj.service.shop.YhShopGoodsSkuService;
-import com.cyksj.web.util.StpYhShopManageUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/*
- *项目名: yhlxj
- *文件名: ShopController
- *创建者: JavaZou
- *创建时间:2023/9/20 14:12
- */
-@Slf4j
-@RestController
-@RequestMapping("/yhShop/manage/goods")
-@RequiredArgsConstructor
-public class YhShopGoodsController {
-	private final BeanSearcher beanSearcher;
-
-	private final YhShopGoodsSkuService yhShopGoodsSkuService;
-
-	private final RedisService redisService;
-
-	private final YhShopMapper yhShopMapper;
-
-	private final HttpServletRequest request;
-
-	private final RefreshCacheService refreshCacheService;
-
-	/**
-	 * 新增平台
-	 */
-	@PostMapping("/post")
-	public Result<Void> saveGoods(@RequestBody List<Long> goodsIds){
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		yhShopGoodsSkuService.saveGoods(goodsIds, userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 设置店铺平台价格
-	 */
-	@PutMapping("/put")
-	public Result<Void> updShopGoodsRate(@RequestBody List<YhShopGoodsSku> goodsSkus){
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, userId).last("limit 1"));
-		goodsSkus.forEach(sku -> {
-			YhShopGoodsRateView.YhShopGoodsSkuRateView yhShopGoodsSkuRateView = beanSearcher.searchFirst(YhShopGoodsRateView.YhShopGoodsSkuRateView.class, MapUtils.builder().field(YhShopGoodsRateView.YhShopGoodsSkuRateView::getSkuId,sku.getSkuId()).build());
-			if (sku.getPrice().compareTo(yhShopGoodsSkuRateView.getMaxPrice()) > 0 || sku.getPrice().compareTo(yhShopGoodsSkuRateView.getMinPrice()) < 0){
-				throw BusinessRuntimeException.getInstance("价格不能超出区间范围");
-			}
-			sku.setUserId(userId);
-			sku.setYhsId(yhShop.getId());
-		});
-		yhShopGoodsSkuService.saveOrUpdateBatch(goodsSkus);
-		refreshCacheService.refreshShopUserIdCacheByYshId(yhShop.getId());
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 上下架
-	 */
-	@PutMapping("/put/goodsStatus/{goodsId}")
-	public Result<Void> updGoodsStatus(@PathVariable Long goodsId, Boolean status) {
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, userId).last("limit 1"));
-		List<YhShopGoodsView.YhShopGoodsSkuView> list = beanSearcher.searchAll(YhShopGoodsView.YhShopGoodsSkuView.class, MapUtils.builder().put("uid", String.format("and ysgs.user_id = %s", userId))
-				.field(YhShopGoodsView.YhShopGoodsSkuView::getGoodsId, goodsId).build());
-		list.forEach(sku -> {
-			YhShopGoodsRateView.YhShopGoodsSkuRateView yhShopGoodsSkuRateView = beanSearcher.searchFirst(YhShopGoodsRateView.YhShopGoodsSkuRateView.class, MapUtils.builder().field(YhShopGoodsRateView.YhShopGoodsSkuRateView::getSkuId, sku.getSkuId()).build());
-			if (sku.getShopSkuPrice().compareTo(yhShopGoodsSkuRateView.getMaxPrice()) > 0 || sku.getShopSkuPrice().compareTo(yhShopGoodsSkuRateView.getMinPrice()) < 0) {
-				throw BusinessRuntimeException.getInstance("价格不能超出区间范围");
-			}
-		});
-		yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getDeleted, true).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getStatus, status));
-		refreshCacheService.refreshShopUserIdCacheByYshId(yhShop.getId());
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 删除平台
-	 */
-	@PutMapping("/del/{goodsId}")
-	public Result<Void> updGoodsStatus(@PathVariable Long goodsId){
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, userId).last("limit 1"));
-		yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getDeleted, false));
-		refreshCacheService.refreshShopUserIdCacheByYshId(yhShop.getId());
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 查询可选择的平台
-	 */
-	@GetMapping("/get/available/goods")
-	public Result<SearchResult<YhShopAvailableGoodsView>> getAvailableGoods(){
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		SearchResult<YhShopAvailableGoodsView> search = beanSearcher.search(YhShopAvailableGoodsView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.put("condition", String.format("and (select count(*) from yh_shop_goods_sku where user_id = %s and goods_id = yr.goods_id and deleted is true) = 0", userId))
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-
-	/**
-	 * 查询平台
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<YhShopGoodsView>> goodsList(){
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		SearchResult<YhShopGoodsView> search = beanSearcher.search(YhShopGoodsView.class, MapUtils.flatBuilder(request.getParameterMap()).field(YhShopGoodsView::getUserId, userId).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 平台详情
-	 */
-	@GetMapping("/get/goods/detail/{goodsId}")
-	public Result<List<YhShopGoodsView.YhShopGoodsSkuView>> getGoodsDetail(@PathVariable Long goodsId) {
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		List<YhShopGoodsView.YhShopGoodsSkuView> views = beanSearcher.searchAll(YhShopGoodsView.YhShopGoodsSkuView.class, MapUtils.builder().put("uid", String.format("and ysgs.user_id = %s", userId))
-				.field(YhShopGoodsView.YhShopGoodsSkuView::getGoodsId, goodsId).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(views);
-	}
-
-	/**
-	 * 小店规格被下架提示
-	 * @return
-	 */
-	@GetMapping("/get/sku/down/info")
-	public Result<List<YhShopSkuDownInfo>> yhShopSkuSysStatusDownInfo() {
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		List<YhShopSkuDownInfo> infos = yhShopGoodsSkuService.yhShopSkuSysStatusDownInfo(userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(infos);
-	}
-
-	/**
-	 * 删除提示
-	 */
-	@DeleteMapping("/delete/sku/down/info")
-	public Result<String> deleteSkuDownInfo() {
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		yhShopGoodsSkuService.deleteSkuDownInfo(userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 172
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopLoginController.java

@@ -1,172 +0,0 @@
-package com.cyksj.web.controller.manage.goods.shop;
-
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.snowflake.Sequence;
-import com.cyksj.common.util.Codec;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.config.wxlogin.WxOpenPlatYHLXLoginConfig;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.shop.YhShopMapper;
-import com.cyksj.model.dto.AuthRedirect;
-import com.cyksj.model.dto.AuthToken;
-import com.cyksj.model.dto.CpsAuthDto;
-import com.cyksj.model.dto.GzhOAuth2UserInfo;
-import com.cyksj.model.entity.User;
-import com.cyksj.model.entity.YhShop;
-import com.cyksj.model.request.LoginReq;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.authorization.AuthorizationService;
-import com.cyksj.service.cps.shop.YhShopManageService;
-import com.cyksj.service.wechat.WeChatService;
-import com.cyksj.web.util.StpUserUtil;
-import com.cyksj.web.util.StpYhShopManageUser;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Optional;
-
-/*
- *项目名: yhlxj
- *文件名: YhShopController
- *创建者: JavaZou
- *创建时间:2023/9/19 17:34
- */
-@RestController
-@RequestMapping("/yhShop/manage")
-@RequiredArgsConstructor
-public class YhShopLoginController {
-	private final YhShopManageService yhShopManageService;
-
-	private final RedisService redisService;
-
-	private final static Sequence SEQUENCE = new Sequence(0);
-
-	private final WxOpenPlatYHLXLoginConfig wxOpenPlatYHLXLoginConfig;
-
-	private final AuthorizationService authorizationService;
-
-	private final WeChatService weChatService;
-
-	private final UserMapper userMapper;
-
-	private final YhShopMapper yhShopMapper;
-
-	/**
-	 * 获取登录验证码
-	 */
-	@GetMapping("/get/LoginCode")
-	@NoSubmit
-	public Result getLoginCode(@RequestParam(defaultValue = "1") Integer type, String login, Integer cid) {
-		yhShopManageService.getLoginCode(type, login, cid);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 跳转店铺后台 是否是店铺主
-	 */
-	@GetMapping("/redirect")
-	public void yhShopManageRedirect(String redirectUrl, HttpServletResponse response) throws IOException {
-		//银河官网token值
-		long userId = StpUserUtil.getLoginIdAsLong();
-		yhShopManageService.yhShopManageRedirect(userId);
-		//校验通过重定向
-		StpYhShopManageUser.login(userId);
-		response.sendRedirect(redirectUrl.contains("?") ? redirectUrl + "&t=" + StpYhShopManageUser.getTokenValue() : redirectUrl + "?t=" + StpYhShopManageUser.getTokenValue());
-	}
-
-
-	/**
-	 * 手机号、邮箱登录
-	 */
-	@PostMapping("/login")
-	public Result login(@RequestBody LoginReq loginReq) {
-		User user = yhShopManageService.login(loginReq.getType(), loginReq.getLogin(), loginReq.getCode());
-		StpYhShopManageUser.login(user.getId());
-		String yhShopToken = StpYhShopManageUser.getTokenValue();
-		JSONObject re = new JSONObject();
-		re.putOpt("satoken-ump", yhShopToken);
-		re.putOpt("img", user.getHeadimgurl());
-		re.putOpt("nickname", user.getNickname());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(re.toString());
-	}
-
-	/**
-	 * 小店后台微信授权登录
-	 */
-	@GetMapping("/wx/authLogin")
-	public Result<CpsAuthDto> wxAuthorize() throws Exception {
-		Object authUrlObj = redisService.get(RedisService.key.WX_LOGIN_AUTH_URI.getNameFormat("yhShop", wxOpenPlatYHLXLoginConfig.getAppId()));
-		if (authUrlObj != null) {
-			CpsAuthDto cpsAuthDto = Jsons.parseObject(authUrlObj.toString(), CpsAuthDto.class);
-			return GatewayResponse.SUCCESS.newBuilder().toResult(cpsAuthDto);
-		}
-		CpsAuthDto cpsAuthDto = new CpsAuthDto();
-		Long mappingId = SEQUENCE.nextId();
-		String authState = mappingId.toString();
-		redisService.set(authState, authState, 60 * 60 * 24L);
-		AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId);
-		String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
-		String wxAuthUrl = authorizationService.createWxAuthLoginUrl(state, wxOpenPlatYHLXLoginConfig.getAppId(), wxOpenPlatYHLXLoginConfig.getYhShopRedirectUri());
-		cpsAuthDto.setAuthUrl(wxAuthUrl);
-		cpsAuthDto.setAuthState(authState);
-		redisService.set(RedisService.key.WX_LOGIN_AUTH_URI.getNameFormat("yhShop", wxOpenPlatYHLXLoginConfig.getAppId()), Jsons.toJson(cpsAuthDto), RedisService.key.WX_LOGIN_AUTH_URI.getTimeout());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(cpsAuthDto);
-	}
-
-	/**
-	 * 网页微信授权后跳转
-	 */
-	@GetMapping("/wx/authLogin/baseRedirect")
-	public void wxAuthLoginRedirect(String code, String state, HttpServletResponse response) throws Exception {
-		if (StrUtil.isEmpty(state)) throw BusinessRuntimeException.getInstance("授权错误,请重新授权");
-		String json = Codec.DoBase64.custom().setData(state).decodeAsText();
-		AuthRedirect re = Jsons.parseObject(json, AuthRedirect.class);
-		AuthToken token = weChatService.getAuthToken(code, wxOpenPlatYHLXLoginConfig.getAppId());
-		GzhOAuth2UserInfo userinfo = weChatService.getUserInfo(token.getAccessToken(), token.getOpenid());
-		String unionId = userinfo.getUnionid();
-		String openId = userinfo.getOpenid();
-		User user = Optional.ofNullable(
-						userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getUnionid, unionId)
-								.orderByAsc(User::getId)
-								.last("limit 1")))
-				.orElseGet(() -> userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getOpenId, openId)
-						.orderByAsc(User::getId)
-						.last("limit 1")));
-		if (user == null) throw BusinessRuntimeException.getInstance("用户信息不存在");
-		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getVerifyStatus, YhShop.Status.success)
-				.eq(YhShop::getUserId, user.getId()).last("limit 1"));
-		if (yhShop == null) {
-			throw BusinessRuntimeException.getInstance("您不是银河小店店铺主");
-		}
-		JSONObject res = new JSONObject();
-		StpYhShopManageUser.login(user.getId());
-		String cpsToken = StpYhShopManageUser.getTokenValue();
-		res.putOpt("satoken-yhShop", cpsToken);
-		res.putOpt("img", user.getHeadimgurl());
-		res.putOpt("nickname", user.getNickname());
-		redisService.set(RedisService.key.YH_SHOP_AUTH_SUCCESS_KEY.getNameFormat(re.getMappingId()), res.toString(), RedisService.key.YH_SHOP_AUTH_SUCCESS_KEY.getTimeout());
-		response.sendRedirect(wxOpenPlatYHLXLoginConfig.getYhShopLoginUrl());
-	}
-
-	/**
-	 * 店铺用户是否已授权
-	 */
-	@GetMapping("/get/userInfo")
-	public Result<String> getCpsUserInfo(String authState) {
-		String key = RedisService.key.YH_SHOP_AUTH_SUCCESS_KEY.getNameFormat(authState);
-		Object o = redisService.get(key);
-		if (o == null) return GatewayResponse.SUCCESS.newBuilder().toResult();
-		redisService.del(key);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(o.toString());
-	}
-}

+ 0 - 294
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopUserController.java

@@ -1,294 +0,0 @@
-package com.cyksj.web.controller.manage.goods.shop;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonMapper;
-import com.cyksj.mapper.shop.YhShopApplyRecordMapper;
-import com.cyksj.mapper.shop.YhShopMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.request.YhShopApplyMoneyReq;
-import com.cyksj.model.views.*;
-import com.cyksj.service.cps.shop.YhShopManageService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.cyksj.web.util.StpYhShopManageUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/*
- * admin/小店店铺/用户店铺后台
- *项目名: yhlxj
- *文件名: YhShopUserController
- *创建者: JavaZou
- *创建时间:2023/9/20 14:19
- */
-@RestController
-@RequestMapping("/yhShop/manage")
-@RequiredArgsConstructor
-public class YhShopUserController {
-	private final YhShopManageService yhShopManageService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final GoodsDonMapper goodsDonMapper;
-
-	private final YhShopMapper yhShopMapper;
-
-	private final YhShopApplyRecordMapper yhShopApplyRecordMapper;
-
-	private final RefreshCacheService refreshCacheService;
-
-	/**
-	 * 店铺 信息详情
-	 */
-	@GetMapping("/get/shop/detail/data")
-	public Result<YhShopDetailView> getShopDetail() {
-		long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
-		YhShopDetailView detailView = beanSearcher.searchFirst(YhShopDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(YhShopDetailView::getUserId, yhShopUserId)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(detailView);
-	}
-
-	/**
-	 * 设置联系方式
-	 */
-	@PutMapping("/set/shop/contact")
-	public Result<String> setShopContact(@RequestBody YhShop yhShop) {
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		String contact = yhShop.getContact();
-		YhShop dbShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, userId).last("limit 1"));
-		if (dbShop == null) {
-			throw BusinessRuntimeException.getInstance("店铺不存在");
-		}
-		dbShop.setContact(contact);
-		yhShopMapper.updateById(dbShop);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 设置是否展示广告位
-	 */
-	@PutMapping("/set/shop/ad")
-	public Result<String> setShopAd() {
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		YhShop dbShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, userId).last("limit 1"));
-		if (dbShop == null) {
-			throw BusinessRuntimeException.getInstance("店铺不存在");
-		}
-		dbShop.setIsShowAd(!dbShop.getIsShowAd());
-		yhShopMapper.updateById(dbShop);
-		refreshCacheService.refreshUserShopMangeCache(dbShop.getCustomId());
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 申请修改
-	 */
-	@PutMapping("/update/shop")
-	@Transactional(rollbackFor = Throwable.class)
-	public Result<String> updateShop(@RequestBody YhShopApplyRecord record) {
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, userId).last("limit 1"));
-		String name = record.getName();
-		if (yhShop == null) {
-			throw BusinessRuntimeException.getInstance("店铺不存在");
-		}
-		if (StrUtil.isEmpty(name)) {
-			throw BusinessRuntimeException.getInstance("请输入申请修改的店铺名");
-		}
-		//是否存在正在修改的提交记录
-		YhShopApplyRecord yhShopApplyRecord = yhShopApplyRecordMapper.selectOne(Wrappers.lambdaQuery(YhShopApplyRecord.class)
-				.eq(YhShopApplyRecord::getUserId, userId)
-				.eq(YhShopApplyRecord::getVerifyStatus, YhShopApplyRecord.Status.verify).last("limit 1"));
-
-		if (yhShopApplyRecord != null) {
-			throw BusinessRuntimeException.getInstance("您提交的修改申请正在审核中..");
-		}
-		//三个月可修改一次
-		Integer count = yhShopApplyRecordMapper.selectCount(Wrappers.lambdaQuery(YhShopApplyRecord.class)
-				.eq(YhShopApplyRecord::getUserId, userId)
-				.isNull(YhShopApplyRecord::getCustomId)
-				.ge(YhShopApplyRecord::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -3)));
-		if (count > 0) {
-			throw BusinessRuntimeException.getInstance("近三个月只可修改一次");
-		}
-		yhShopApplyRecord = new YhShopApplyRecord();
-		yhShopApplyRecord.setVerifyStatus(YhShopApplyRecord.Status.verify);
-		yhShopApplyRecord.setName(name);
-		yhShopApplyRecord.setUserId(userId);
-		yhShopApplyRecord.setBusinessId(yhShop.getBusinessId());
-		yhShopApplyRecordMapper.insert(yhShopApplyRecord);
-
-		if (StrUtil.isNotBlank(yhShop.getReason())) {
-			yhShop.setReason(null);
-			yhShopMapper.updateById(yhShop);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 店铺分销平台数据详情
-	 */
-	@GetMapping("/get/distribute/detail/data")
-	public Result<YhShopUserDistributeDetailView> getDistributeDetail() {
-		long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
-		User user = beanSearcher.searchFirst(User.class, MapUtils.builder().field(User::getId, yhShopUserId).onlySelect(User::getYhsMoney).build());
-		BigDecimal wApplyMoney = user.getYhsMoney().divide(BigDecimal.valueOf(100),2, RoundingMode.DOWN);
-		//已提现
-		Number gotApplyMoney = beanSearcher.searchSum(YhShopDistributeMoneyApply.class, MapUtils.builder()
-				.field(YhShopDistributeMoneyApply::getUserId, yhShopUserId)
-				.field(YhShopDistributeMoneyApply::getVerifyStatus, YhShopDistributeMoneyApply.Status.success.name())
-				.build(), "money");
-		Number reMoneyPoints = beanSearcher.searchSum(YhShopDistributeWaitingSendPoints.class, MapUtils.builder().field(YhShopDistributeWaitingSendPoints::getShopUserId, yhShopUserId).field(YhShopDistributeWaitingSendPoints::getSendStatus, YhShopDistributeWaitingSendPoints.Status.success.name()).build(), "money");
-		Number wMoneyPoints = beanSearcher.searchSum(YhShopDistributeWaitingSendPoints.class, MapUtils.builder().field(YhShopDistributeWaitingSendPoints::getShopUserId, yhShopUserId).field(YhShopDistributeWaitingSendPoints::getSendStatus, YhShopDistributeWaitingSendPoints.Status.waiting.name()).build(), "money");
-
-		List<YhShopUserDistributeRateView> rateViews = beanSearcher.searchAll(YhShopUserDistributeRateView.class, MapUtils.builder()
-				.put("uid", String.format("and user_id = %s", yhShopUserId))
-				.orderBy(YhShopUserDistributeRateView::getRate).desc()
-				.build());
-		YhShopUserDistributeDetailView detailView = new YhShopUserDistributeDetailView();
-		Map<String, List<YhShopUserDistributeRateView>> collect = rateViews.stream().filter(ct -> StrUtil.isNotBlank(ct.getCategoryName()) && ct.getRate() > 0).collect(Collectors.groupingBy(YhShopUserDistributeRateView::getCategoryName));
-		detailView.setRateViews(collect);
-		detailView.setWMoney(BigDecimal.valueOf(wMoneyPoints.doubleValue()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
-		detailView.setReMoney(BigDecimal.valueOf(reMoneyPoints.doubleValue()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
-
-		detailView.setWApplyMoney(wApplyMoney);
-		detailView.setGotApplyMoney(BigDecimal.valueOf(gotApplyMoney.doubleValue()).divide(BigDecimal.valueOf(100),2, RoundingMode.DOWN));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(detailView);
-	}
-
-	/**
-	 * 店铺待入账数据统计
-	 */
-	@GetMapping("/get/wMoney/statisticsData")
-	public Result<YhShopBrokenLineCpsUserWMoneyView> getWMoneyStatisticsDataView(Long firstDate, Long lastDate) {
-		long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
-		DateTime first = null;
-		DateTime end = null;
-		if (firstDate != null) {
-			first = DateUtil.date(firstDate);
-		}
-		if (lastDate != null) {
-			end = DateUtil.date(lastDate);
-		}
-		YhShopBrokenLineCpsUserWMoneyView brokenLineCpsUserWMoneyView = Optional.ofNullable(yhShopManageService.getWMoneyStatisticsDate(yhShopUserId, first, end)).orElse(new YhShopBrokenLineCpsUserWMoneyView());
-		List<YhShopUserWMoneyStatisticsDataView> dataView = yhShopManageService.getWMoneyStatisticsDataView(yhShopUserId, first, end);
-		brokenLineCpsUserWMoneyView.setDataView(dataView);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineCpsUserWMoneyView);
-	}
-
-	/**
-	 * 店铺分销订单收入统计
-	 */
-	@GetMapping("/get/distribute/orders/statisticsData")
-	public Result<SearchResult<YhShopUserDistributeOrdersStatisticsView>> getUserDistributeOrdersStatisticsView(Long firstDate, Long lastDate) {
-		long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
-		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, yhShopUserId).last("limit 1"));
-		String first = null;
-		String end = null;
-		String timeSql = StrUtil.EMPTY;
-		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time >= '%s'", first);
-		}
-		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time < '%s'", end);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("yhs_id", String.format("yhs_id = %s", yhShop.getId()));
-		if (StrUtil.isNotEmpty(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		SearchResult<YhShopUserDistributeOrdersStatisticsView> search = beanSearcher.search(YhShopUserDistributeOrdersStatisticsView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 店铺分销订单收入详细
-	 */
-	@GetMapping("/get/distribute/orders/detail/data")
-	public Result<SearchResult<YhShopUserDistributeOrdersDetailView>> getUserDistributeOrdersDetailView(Long firstDate, Long lastDate) {
-		long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
-		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, yhShopUserId).last("limit 1"));
-		String first = null;
-		String end = null;
-		String timeSql = StrUtil.EMPTY;
-		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time >= '%s'", first);
-		}
-		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time < '%s'", end);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("yhs_id", String.format("yhs_id = %s", yhShop.getId()));
-		if (StrUtil.isNotEmpty(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		SearchResult<YhShopUserDistributeOrdersDetailView> search = beanSearcher.search(YhShopUserDistributeOrdersDetailView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 店铺分销商品列表
-	 */
-	@GetMapping("/get/orders/goods")
-	public Result<List<GoodsDon>> getGoodsList() {
-		long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
-		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, yhShopUserId)
-				.eq(YhShop::getVerifyStatus, YhShop.Status.success)
-				.last("limit 1"));
-		if (yhShop == null) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		List<GoodsDon> goodsDons = goodsDonMapper.getYhShopDistributeGoodsDetail(yhShop.getId());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDons);
-	}
-
-	/**
-	 * 申请 提现
-	 */
-	@PostMapping("/apply/money")
-	public Result<String> yhShopApplyMoney(@RequestBody YhShopApplyMoneyReq applyMoneyReq) throws Exception {
-		long userId = StpYhShopManageUser.getLoginIdAsLong();
-		applyMoneyReq.setUserId(userId);
-		return yhShopManageService.applyMoney(applyMoneyReq);
-	}
-
-	/**
-	 * 后台添加用户店铺
-	 */
-	@PostMapping("/add/user/shop")
-	public Result<String> addUserShop(@RequestBody YhShop yhShop) {
-		yhShopManageService.addUserShop(yhShop);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 408
netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupController.java

@@ -1,408 +0,0 @@
-package com.cyksj.web.controller.manage.group;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.lang.Validator;
-import cn.hutool.core.thread.ThreadUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONObject;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.baomidou.mybatisplus.core.toolkit.Assert;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.GoogleGenerator;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GroupsRelationAlertMapper;
-import com.cyksj.mapper.GroupsRelationMapper;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.excel.ExcelGroupRelationData;
-import com.cyksj.model.request.AccountGroupsReq;
-import com.cyksj.model.request.ReplaceTripsAccountReq;
-import com.cyksj.model.views.CloseGroupsTripsView;
-import com.cyksj.model.views.GoodsDonSkuView;
-import com.cyksj.model.views.GroupsTripsWaitingView;
-import com.cyksj.service.mange.AccountCommonService;
-import com.cyksj.service.mange.CmsAccountService;
-import com.cyksj.service.mange.CmsGroupService;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author chan
- * @date 2022/9/27 6:26 PM
- */
-@Slf4j
-@RequiredArgsConstructor
-@RequestMapping("/manage/group")
-@RestController
-public class CmsGroupController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final CmsGroupService groupService;
-
-    private final CmsAccountService accountService;
-
-    private final GroupsRelationMapper relationMapper;
-
-    private final AccountCommonService accountCommonService;
-
-    private final GroupsRelationAlertMapper alertMapper;
-
-    private final UserMapper userMapper;
-
-    @GetMapping("/get")
-    @SaCheckPermission("group:view")
-    public Result<SearchResult<GroupsTrips>> get(String account, Long userId, String showId, String nickName, String submitAccount, Boolean isEmpty) {
-        MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-        if (StrUtil.isNotBlank(showId)) {
-            userId = userMapper.getUserIdByShowId(showId);
-        }
-        if (userId != null || StringUtils.isNotBlank(nickName) || StringUtils.isNotBlank(submitAccount)) {
-            List<Long> ids = relationMapper.getAccountIdsByUserIdOrNickNameOrSubmitAccount(userId, nickName, submitAccount);
-            if (ids.isEmpty()) {
-                return GatewayResponse.SUCCESS.newBuilder().toResult(new SearchResult<>());
-            }
-
-            mapBuilder.field(GroupsTrips::getGroupId, ids).op(Operator.InList);
-        }
-        if (isEmpty != null && isEmpty) {
-            mapBuilder.field(GroupsTrips::getNum, GroupsTrips::getAvailableNum).sql("$1 = $2");
-        }
-
-        SearchResult<GroupsTrips> search = beanSearcher.search(GroupsTrips.class, mapBuilder
-                .field(GroupsTrips::getAccount, StringUtils.isBlank(account) ? null : account).op(Operator.EndWith)
-                .build()
-        );
-        search.getDataList().forEach(data->{
-            Number count = beanSearcher.searchCount(GroupsRelation.class, MapUtils.builder()
-                    .field(GroupsRelation::getGroupsId, data.getId())
-                    .field(GroupsRelation::getUserId, 0).op(Operator.NotEqual)
-                    .build());
-            data.setIsExists(count.intValue() > 0 ? true : false);
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 导出车票列表
-     */
-    @GetMapping("/export")
-    public void export(String account, Long userId, String showId, String nickName, String submitAccount, Boolean isEmpty, HttpServletResponse response) {
-        MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-        if (StrUtil.isNotBlank(showId)) {
-            userId = userMapper.getUserIdByShowId(showId);
-        }
-        if (userId != null || StringUtils.isNotBlank(nickName) || StringUtils.isNotBlank(submitAccount)) {
-            List<Long> ids = relationMapper.getAccountIdsByUserIdOrNickNameOrSubmitAccount(userId, nickName, submitAccount);
-            if (ids.isEmpty()) {
-                throw BusinessRuntimeException.getInstance("暂无数据..");
-            }
-
-            mapBuilder.field(ExcelGroupRelationData::getGroupId, ids).op(Operator.InList);
-        }
-        if (isEmpty != null && isEmpty) {
-            mapBuilder.field(ExcelGroupRelationData::getNum, ExcelGroupRelationData::getAvailableNum).sql("$1 = $2");
-        }
-
-        List<ExcelGroupRelationData> list = beanSearcher.searchAll(ExcelGroupRelationData.class, mapBuilder
-                .field(ExcelGroupRelationData::getAccount, StringUtils.isBlank(account) ? null : account).op(Operator.EndWith)
-                .build()
-        );
-        EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelGroupRelationData.class, list, "发布车票列表", "发布车票列表", ExcelTypeEnum.XLSX, null);
-    }
-
-    /**
-     * 各平台待发车详情
-     */
-    @GetMapping("/get/plat/waiting")
-    public Result<List<GroupsTripsWaitingView>> getPlatWaiting() {
-        return GatewayResponse.SUCCESS.newBuilder().toResult(beanSearcher.searchAll(GroupsTripsWaitingView.class, null));
-    }
-
-    @PostMapping("/post")
-    @NoSubmit
-    @SaCheckPermission("group:add")
-    @Log(module = "发布车票/新增车队", businessType = BusinessType.POST, isSaveRequestData = true)
-    public Result<GroupsTrips> add(@RequestBody GroupsTrips groups){
-
-        GroupsTrips groupsTrips = groupService.issuance(groups, null);
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult(groupsTrips);
-    }
-
-    @PutMapping("/update")
-    @Log(module = "发布车票/编辑车队", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> update(@RequestBody GroupsTrips groups){
-        groupService.updateById(groups);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @DeleteMapping("/delete/{id}")
-    @Log(module = "发布车票/删除车队", businessType = BusinessType.DELETE, isSaveRequestData = true)
-    public Result<String> delete(@PathVariable Long id){
-        groupService.close(id);
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 配置已有账号
-     */
-    @PutMapping("/update/set/account")
-    @Log(module = "发布车票/配置账号", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> setAccount(@RequestBody GroupsTrips groupsTrips) throws Exception {
-        Account account = accountService.getById(groupsTrips.getAccountId());
-        if(account == null){
-            throw new BusinessRuntimeException("id : " + groupsTrips.getAccount() + " 该账号不存在!");
-        }
-        groupService.setAccount(groupsTrips);
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 配置新账号并绑定车队
-     */
-    @PostMapping("/post/account/bind")
-    public Result<String> createNewAccountBind(@RequestBody @Validated AccountGroupsReq req) throws Exception {
-        Account account = new Account();
-        BeanUtil.copyProperties(req, account);
-        GroupsTrips groupsTrips = groupService.getById(req.getGroupsId());
-        if (groupsTrips.getAccountId() != null) {
-            throw BusinessRuntimeException.getInstance("该车队已配置账号");
-        }
-        Long skuId = groupsTrips.getSkuId();
-        GoodsDonSkuView goodsDonSkuView = beanSearcher.searchFirst(GoodsDonSkuView.class, MapUtils.builder()
-                .field(GoodsDonSkuView::getGoodsId, req.getGoodsId())
-                .field(GoodsDonSkuView::getSkuId, skuId).build());
-        if (goodsDonSkuView == null) {
-            throw BusinessRuntimeException.getInstance("该车队规格不属于该账号平台");
-        }
-        //账号是否已经添加过
-        if (!account.getAccount().contains("客服")) {
-            if (accountCommonService.checkIsDupAccount(account.getGoodsId(), account.getAccount())) {
-                throw BusinessRuntimeException.getInstance("该平台下已生成该账号");
-            }
-        }
-        accountService.save(account);
-        groupsTrips.setAccountId(account.getId());
-        groupsTrips.setVerifyCodes(account.getVerifyCodes());
-        //独立车位 车队下架
-        if (goodsDonSkuView.getNum() != null && goodsDonSkuView.getNum() == 1) {
-            Number number = beanSearcher.searchCount(GroupsRelation.class, MapUtils.builder()
-                    .field(GroupsRelation::getGroupsId, groupsTrips.getId())
-                    .field(GroupsRelation::getUserId, 0).op(Operator.NotEqual)
-                    .field(GroupsRelation::getStatus, GroupsRelation.Status.validity.name())
-                    .build());
-            if (number.intValue() > 0) {
-                groupsTrips.setStatus(GroupsTrips.Status.down);
-            }
-        }
-        groupService.setAccount(groupsTrips);
-        return GatewayResponse.SUCCESS.newBuilder().toResult("车队配置新账号成功");
-    }
-
-
-    /**
-     * 车队替换账号
-     */
-    @PutMapping("/account/replace")
-    public Result<String> replaceTripsAccount(@RequestBody ReplaceTripsAccountReq req) {
-        long adminId = StpUtil.getLoginIdAsLong();
-        req.setAdminId(adminId);
-        groupService.replaceTripsAccount(req);
-        return GatewayResponse.SUCCESS.newBuilder().toResult("车队替换账号成功");
-    }
-
-    /**
-     * 车队替换账号记录
-     */
-    @GetMapping("/get/account/replace/record")
-    public Result<SearchResult<GroupsTripsAccountReplaceRecord>> getAccountReplaceRecord() {
-        SearchResult<GroupsTripsAccountReplaceRecord> search = beanSearcher.search(GroupsTripsAccountReplaceRecord.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 已下架的车队列表展示
-     */
-    @GetMapping("/get/down/trips")
-    public Result<SearchResult<CloseGroupsTripsView>> getDownGroups() {
-        SearchResult<CloseGroupsTripsView> search = beanSearcher.search(CloseGroupsTripsView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(CloseGroupsTripsView::getGroupsStatus, GroupsTrips.Status.down.name())
-                .orderBy(CloseGroupsTripsView::getIsAbandon).asc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 重新上架过期车队
-     */
-    @PutMapping("/up/trips/{groupsId}")
-    @Log(module = "过期账号/上架过期车队", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> upGroupsTrips(@PathVariable Long groupsId) {
-        groupService.update(null, Wrappers.lambdaUpdate(GroupsTrips.class)
-                .set(GroupsTrips::getStatus, GroupsTrips.Status.validity)
-                .eq(GroupsTrips::getStatus, GroupsTrips.Status.down)
-                .eq(GroupsTrips::getId, groupsId));
-        return GatewayResponse.SUCCESS.newBuilder().toResult("上架成功");
-    }
-
-    /**
-     * 下架车队
-     */
-    @PutMapping("/down/trips/{groupsId}")
-    public Result<String> setGroupsDown(@PathVariable Long groupsId) {
-        groupService.update(null, Wrappers.lambdaUpdate(GroupsTrips.class)
-                .set(GroupsTrips::getStatus, GroupsTrips.Status.down)
-                .eq(GroupsTrips::getId, groupsId));
-        return GatewayResponse.SUCCESS.newBuilder().toResult("下架成功");
-    }
-
-    /**
-     * 上下架车队
-     */
-    @PutMapping("/put/trips/status/{groupsId}")
-    @Log(module = "过期账号/上下架过期车队", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> updateTripsStatus(@PathVariable Long groupsId) {
-        GroupsTrips groupsTrips = groupService.getById(groupsId);
-        GroupsTrips.Status status = groupsTrips.getStatus();
-        if (status == GroupsTrips.Status.waiting) {
-            throw BusinessRuntimeException.getInstance("待发车车队无需上下架");
-        }
-        if (status == GroupsTrips.Status.validity) {
-            groupsTrips.setStatus(GroupsTrips.Status.down);
-        }
-        if (status == GroupsTrips.Status.down) {
-            groupsTrips.setStatus(GroupsTrips.Status.validity);
-        }
-        groupService.updateById(groupsTrips);
-        return GatewayResponse.SUCCESS.newBuilder().toResult("操作成功");
-    }
-
-    /**
-     * 弃用账号
-     */
-    @PutMapping("/down/account/{accountId}")
-    @Log(module = "过期账号/废弃过期车队", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> putDownAccount(@PathVariable Long accountId) {
-        accountService.update(null, Wrappers.lambdaUpdate(Account.class)
-                .set(Account::getIsAbandon, true)
-                .eq(Account::getIsAbandon, false)
-                .eq(Account::getId, accountId));
-        return GatewayResponse.SUCCESS.newBuilder().toResult("弃用成功");
-    }
-
-    /**
-     * 获取双重验证码
-     */
-    @GetMapping("/get/verifyCode")
-    public Result<String> getVerifyCode(String apiSecret) {
-        if (StrUtil.isBlank(apiSecret)) throw BusinessRuntimeException.getInstance("双重密钥为空");
-        DateTime now = DateTime.now();
-        int second = now.second();
-        if (second < 30 && 30 - second < 5) {
-            ThreadUtil.sleep(30 - second + 1, TimeUnit.SECONDS);
-        } else if (second > 30 && 60 - second < 5) {
-            ThreadUtil.sleep(60 - second + 1, TimeUnit.SECONDS);
-        }
-        StringBuilder sb = new StringBuilder();
-        try {
-            long code = GoogleGenerator.getCode(apiSecret, now.getTime());
-            sb.append(code);
-            while (sb.length() < 6) {
-                sb.insert(0, 0);
-            }
-        } catch (Exception e) {
-            throw BusinessRuntimeException.getInstance("双重验证密钥错误,请生成新的验证密钥");
-        }
-        JSONObject re = new JSONObject();
-        re.putOpt("code", sb.toString());
-        int nowSecond = DateTime.now().second();
-        int time = 0;
-        if (nowSecond < 30) {
-            time = 30 - nowSecond;
-        } else {
-            time = 60 - nowSecond;
-        }
-        re.putOpt("time", time);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(re.toString());
-    }
-
-    /**
-     * 获取该规格下可用车位数
-     */
-    @GetMapping("/get/available/relation")
-    public Result<Integer> getAvailableRelation(Long goodsId, Long skuId) {
-        Integer available = groupService.getAvailableRelation(goodsId, skuId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(available);
-    }
-
-    /**
-     * 设置库存预警通知
-     */
-    @PutMapping("/set/relation/alert")
-    public Result<String> setGroupsRelationAlert(@RequestBody @Validated GroupsRelationAlert groupsRelationAlert) throws Exception {
-        if (groupsRelationAlert.getId() == null) {
-            try {
-                alertMapper.insert(groupsRelationAlert);
-            } catch (DuplicateKeyException e) {
-            }
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        Long id = groupsRelationAlert.getId();
-        Assert.notNull(id, "预警id不存在");
-        GroupsRelationAlert dbAlert = alertMapper.selectById(id);
-        Assert.notNull(dbAlert, "预警不存在");
-        String phoneStr = groupsRelationAlert.getPhoneStr();
-        List<String> phoneList = Jsons.parseList(phoneStr, String.class);
-        phoneList.forEach(phone -> {
-            if (!Validator.isMobile(phone)) {
-                throw BusinessRuntimeException.getInstance("请输入正确的手机格式");
-            }
-        });
-        Integer dbNum = dbAlert.getNum();
-        Integer num = groupsRelationAlert.getNum();
-        if (dbNum != num) {
-            groupsRelationAlert.setIsReset(true);
-        }
-        alertMapper.updateById(groupsRelationAlert);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 库存预警通知
-     */
-    @GetMapping("/get/relation/alert")
-    public Result<GroupsRelationAlert> getGroupsRelationAlert(@RequestParam(required = true) Long skuId) {
-        GroupsRelationAlert groupsRelationAlert = alertMapper.selectOne(Wrappers.lambdaQuery(GroupsRelationAlert.class)
-                .eq(GroupsRelationAlert::getSkuId, skuId).last("limit 1"));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(groupsRelationAlert);
-    }
-}

+ 0 - 262
netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupRelationController.java

@@ -1,262 +0,0 @@
-package com.cyksj.web.controller.manage.group;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.lang.Assert;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.*;
-import com.cyksj.mapper.manage.cms.CmsUserMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.manage.views.AccountView;
-import com.cyksj.model.manage.views.GroupsRelationBackView;
-import com.cyksj.model.views.DisableAccountView;
-import com.cyksj.model.views.GroupsRelationIndependentView;
-import com.cyksj.model.views.GroupsRelationRechargeView;
-import com.cyksj.model.views.OrderDonRenewView;
-import com.cyksj.service.relation.GroupRelationClearService;
-import com.cyksj.service.scheduler.SchedulerService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- * @author chan
- * @date 2022/9/27 6:45 PM
- */
-@Slf4j
-@RequestMapping("/manage/group/relation")
-@RestController
-@RequiredArgsConstructor
-public class CmsGroupRelationController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final SchedulerService schedulerService;
-
-    private final GroupsRelationMapper groupsRelationMapper;
-
-    private final CmsUserMapper cmsUserMapper;
-
-    private final OrderDonMapper orderDonMapper;
-
-    private final GoodsDonSkuMapper goodsDonSkuMapper;
-
-    private final GroupsRelationIndependentRenewMapper groupsRelationIndependentRenewMapper;
-
-    private final GroupRelationClearService groupRelationClearService;
-
-    @GetMapping("/get")
-    public Result<List<GroupsRelationBackView>> get(){
-        List<GroupsRelationBackView> search = beanSearcher.searchAll(GroupsRelationBackView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(GroupsRelationBackView::getStatus, List.of(GroupsRelation.Status.none.name(), GroupsRelation.Status.locking.name())).op(Operator.NotIn).build()
-        );
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 账号被封,重新分配用户车票
-     */
-    @PutMapping("/disable/{groupsId}")
-    @NoSubmit
-    public Result<String> disable(@PathVariable Long groupsId) {
-        schedulerService.assignUserGroupsRelation(groupsId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult("车队账号禁用成功");
-    }
-
-    /**
-     * 代充平台 用户账号车票列表
-     */
-    @GetMapping("/get/recharge")
-    public Result<SearchResult<GroupsRelationRechargeView>> getRechargeList() {
-        SearchResult<GroupsRelationRechargeView> search = beanSearcher.search(GroupsRelationRechargeView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(GroupsRelationRechargeView::getStatus, List.of(GroupsRelation.Status.validity.name(), GroupsRelation.Status.outside.name())).op(Operator.InList)
-                .field(GroupsRelationRechargeView::getSpecialType, GoodsDon.SpecialType.recharge.name())
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 代充账号 状态变更
-     */
-    @PostMapping("/set/recharge")
-    @Transactional(rollbackFor = Throwable.class)
-    public Result<String> updateRechargeStatus(@RequestBody GroupsRelationRechargeView rechargeView) {
-        long adminId = StpUtil.getLoginIdAsLong();
-        Long relationId = rechargeView.getRelationId();
-        GroupsRelation relation = groupsRelationMapper.selectById(relationId);
-        Assert.notNull(relation, "代充车票不存在");
-        if (relation.getRenewStatus() == null || relation.getRechargeStatus() == GroupsRelation.RechargeStatus.complete) {
-            throw BusinessRuntimeException.getInstance("");
-        }
-        CmsUser cmsUser = cmsUserMapper.selectById(adminId);
-        GroupsRelation.RechargeStatus relation_rechargeStatus = relation.getRechargeStatus();
-        GroupsRelation.RechargeStatus rechargeStatus = rechargeView.getRechargeStatus();
-        if (relation_rechargeStatus == rechargeStatus) {
-            throw BusinessRuntimeException.getInstance("状态重复");
-        }
-        relation.setRechargeStatus(rechargeStatus);
-        relation.setOperator(cmsUser.getNickname());
-        if (rechargeStatus == GroupsRelation.RechargeStatus.complete) {
-            relation.setSendTime(DateTime.now());
-            OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
-                    .eq(OrderDon::getUserId, relation.getUserId())
-                    .eq(OrderDon::getRelationId, relationId)
-                    .notIn(OrderDon::getStatus, Constant.noOrderStatus)
-                    .orderByDesc(OrderDon::getId)
-                    .last("limit 1"));
-            if (orderDon == null) throw BusinessRuntimeException.getInstance("该代充订单不存在");
-            if (orderDon.getStatus() == OrderDon.Status.refund){
-                throw BusinessRuntimeException.getInstance("该代充订单已退款");
-            }
-            orderDon.setStatus(OrderDon.Status.complete);
-
-            orderDonMapper.updateById(orderDon);
-
-            relation.setStartTime(DateTime.now());
-            GoodsDonSku sku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
-            DateTime expiryTime;
-            if (sku.getDays() != null && sku.getDays() > 0) {
-                expiryTime = DateUtil.offsetDay(relation.getStartTime(), sku.getDays());
-            } else {
-                expiryTime = DateUtil.offsetMonth(relation.getStartTime(), sku.getMonths());
-            }
-            relation.setExpiryTime(expiryTime);
-        }
-        groupsRelationMapper.updateById(relation);
-        return GatewayResponse.SUCCESS.newBuilder().toResult("状态修改成功");
-    }
-
-    /**
-     * 代充账号 待处理列表
-     */
-    @GetMapping("/get/recharge/waiting")
-    public Result<Boolean> getRechargeWaiting() {
-        Number number = beanSearcher.searchCount(GroupsRelationRechargeView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(GroupsRelationRechargeView::getSpecialType, GoodsDon.SpecialType.recharge.name())
-                .field(GroupsRelationRechargeView::getRechargeStatus, GroupsRelation.RechargeStatus.waiting.name())
-                .build());
-        if (number.intValue() > 0) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult(true);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult(false);
-    }
-
-    /**
-     * Chat GPT独立规格续费 列表
-     */
-    @GetMapping("/get/chatGPT/independent/renew")
-    public Result<SearchResult<GroupsRelationIndependentView>> getIndependentRenew(String account) {
-        String condition = " o.sku_id in (select id from goods_don_sku sku where sku.goods_id in (18,26) and sku.num = 1)" +
-                " and o.status not in ('close','noPayment','refund') and o.order_type = 2";
-        if (StrUtil.isNotEmpty(account)) {
-            List<AccountView> dbAccounts = beanSearcher.searchAll(AccountView.class, MapUtils.builder().field(AccountView::getAccount, account).op(Operator.Contain).build());
-            if (CollUtil.isNotEmpty(dbAccounts)) {
-                String collect = dbAccounts.stream().map(e -> String.valueOf(e.getGroupsId())).collect(Collectors.joining(","));
-                condition += String.format(" and groups_id in (%s)", collect);
-            }
-        }
-        SearchResult<GroupsRelationIndependentView> search = beanSearcher.search(GroupsRelationIndependentView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .put("condition", condition)
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 编辑车票独立续费状态
-     */
-    @PutMapping("/update/independent/renew/status")
-    public Result<String> updateRenewStatus(@RequestBody GroupsRelationIndependentView view) {
-        long adminId = StpUtil.getLoginIdAsLong();
-        Long relationId = view.getRelationId();
-        Long userId = view.getUserId();
-        Boolean isRenew = view.getIsRenew();
-        if (ObjectUtil.hasEmpty(relationId, userId, isRenew)) {
-            throw BusinessRuntimeException.getInstance("参数错误");
-        }
-        GroupsRelationIndependentRenew groupsRelationIndependentRenew = Optional.ofNullable(groupsRelationIndependentRenewMapper.selectOne(Wrappers.lambdaQuery(GroupsRelationIndependentRenew.class)
-                .eq(GroupsRelationIndependentRenew::getOrderId, view.getOrderId())
-                .eq(GroupsRelationIndependentRenew::getUserId, userId)
-                .eq(GroupsRelationIndependentRenew::getRelationId, relationId).last("limit 1"))).orElse(new GroupsRelationIndependentRenew());
-        CmsUser cmsUser = cmsUserMapper.selectById(adminId);
-        if (cmsUser != null) {
-            groupsRelationIndependentRenew.setOperator(cmsUser.getNickname());
-        }
-        groupsRelationIndependentRenew.setOrderId(view.getOrderId());
-
-        if (groupsRelationIndependentRenew.getId() == null) {
-            groupsRelationIndependentRenew.setRelationId(relationId);
-            groupsRelationIndependentRenew.setUserId(userId);
-            groupsRelationIndependentRenew.setIsRenew(isRenew);
-            groupsRelationIndependentRenewMapper.insert(groupsRelationIndependentRenew);
-        } else {
-            groupsRelationIndependentRenew.setIsRenew(isRenew);
-            groupsRelationIndependentRenewMapper.updateById(groupsRelationIndependentRenew);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 独立账号续费记录
-     */
-    @GetMapping("/get/independent/renew/record")
-    public Result<SearchResult<OrderDonRenewView>> getIndependentRenewRecord(Long userId, Long relationId) {
-        if (ObjectUtil.hasEmpty(relationId, userId)) {
-            throw BusinessRuntimeException.getInstance("参数错误");
-        }
-        SearchResult<OrderDonRenewView> search = beanSearcher.search(OrderDonRenewView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(OrderDonRenewView::getUserId, userId)
-                .field(OrderDonRenewView::getRelationId, relationId)
-                .field(OrderDonRenewView::getOrderType, 2)
-                .field(OrderDonRenewView::getStatus, Constant.noOrderAllStatus).op(Operator.NotIn)
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 删除用户对应车票
-     */
-    @DeleteMapping("/clear/ticket/{relationId}")
-    @Log(module = "删除用户车票", businessType = BusinessType.DELETE, isSaveRequestData = true)
-    public Result<String> clearUserTicket(@PathVariable Long relationId) {
-        GroupsRelation relation = groupsRelationMapper.selectById(relationId);
-        if (relation == null) {
-            throw BusinessRuntimeException.getInstance("车票不存在");
-        }
-        groupRelationClearService.clearTicket(relation, UserTicketClearedRecord.Source.manual);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * GPT PLUS 禁用账号列表
-     */
-    @GetMapping("/get/disable/account")
-    public Result<SearchResult<DisableAccountView>> getDisableAccount() {
-        SearchResult<DisableAccountView> search = beanSearcher.search(DisableAccountView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(DisableAccountView::getGoodsId, 18)
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-}

+ 0 - 158
netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupsRelationExpiryController.java

@@ -1,158 +0,0 @@
-package com.cyksj.web.controller.manage.group;
-
-import cn.dev33.satoken.stp.StpUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GroupsRelationCustomerServiceFollowRecordMapper;
-import com.cyksj.mapper.GroupsRelationExpiryRecordMapper;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.corp.CorpUserMapper;
-import com.cyksj.mapper.market.task.UserBindDetailMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.views.RenewFollowStatisticsView;
-import com.cyksj.service.user.UserBackService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Optional;
-
-/*
- *项目名: netflix
- *文件名: CmsGroupsRelationExpiryController
- *创建者: JavaZou
- *创建时间:2023/9/5 12:08
- */
-@RestController
-@RequestMapping("/manage/relation/track")
-@RequiredArgsConstructor
-public class CmsGroupsRelationExpiryController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserBackService userBackService;
-
-	private final GroupsRelationExpiryRecordMapper groupsRelationExpiryRecordMapper;
-
-	private final GroupsRelationCustomerServiceFollowRecordMapper relationCustomerServiceFollowRecordMapper;
-
-	private final UserMapper userMapper;
-
-	private final UserBindDetailMapper userBindDetailMapper;
-
-	private final CorpUserMapper corpUserMapper;
-
-	/**
-	 * 到期用户 客服跟进续费列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<GroupsRelationExpiryRecord>> get(String showId) {
-		long adminId = StpUtil.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (userBackService.isCustomer(adminId)) {
-			builder.field(GroupsRelationExpiryRecord::getCustomerServiceId, adminId);
-		}
-		if (StrUtil.isNotBlank(showId)) {
-			User user = userMapper.selectOne(Wrappers.lambdaQuery(User.class).eq(User::getShowId, showId).last("limit 1"));
-			if (user != null) {
-				builder.field(GroupsRelationExpiryRecord::getUserId, user.getId());
-			}
-		}
-		SearchResult<GroupsRelationExpiryRecord> search = beanSearcher.search(GroupsRelationExpiryRecord.class, builder
-				.field(GroupsRelationExpiryRecord::getIsFollow, false)
-				.orderBy(GroupsRelationExpiryRecord::getAssignTime).desc()
-				.orderBy(GroupsRelationExpiryRecord::getIsFollow).asc()
-				.build());
-		search.getDataList().forEach(data -> {
-			if (Constant.TRACK_RENEW_TYPE.contains(data.getRegister())) {
-				UserBindDetail userBindDetail = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
-						.eq(Constant.TRACK_RENEW_TYPE.get(0).equals(data.getRegister()), UserBindDetail::getEmailUserId, data.getUserId())
-						.eq(Constant.TRACK_RENEW_TYPE.get(1).equals(data.getRegister()), UserBindDetail::getUserId, data.getUserId())
-						.ne(UserBindDetail::getPhone, StrUtil.EMPTY)
-						.last("limit 1"));
-				if (userBindDetail != null) {
-					data.setContact(userBindDetail.getPhone());
-				}
-				if (Constant.TRACK_RENEW_TYPE.get(1).equals(data.getRegister())) {
-					//实时获取企业微信昵称
-					Optional.ofNullable(corpUserMapper.selectOne(Wrappers.lambdaQuery(CorpUser.class)
-									.eq(CorpUser::getUserId, data.getUserId()).last("limit 1")))
-							.ifPresent(cu -> {
-								data.setCorpUserName(cu.getName());
-								data.setCorpHeadImgUrl(cu.getAvatar());
-							});
-				}
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 跟进记录列表
-	 */
-	@GetMapping("/get/reBuy/record/{trackId}")
-	public Result<SearchResult<GroupsRelationCustomerServiceFollowRecord>> getReBuyRecord(@PathVariable Long trackId) {
-		SearchResult<GroupsRelationCustomerServiceFollowRecord> search = beanSearcher.search(GroupsRelationCustomerServiceFollowRecord.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(GroupsRelationCustomerServiceFollowRecord::getEcId, trackId)
-				.orderBy(GroupsRelationCustomerServiceFollowRecord::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 客服进行跟进
-	 */
-	@PostMapping("/reBuy")
-	@Transactional(rollbackFor = Throwable.class)
-	public Result<String> recordReBuy(@RequestBody GroupsRelationCustomerServiceFollowRecord record) {
-		Long ecId = record.getEcId();
-		if (ecId == null) {
-			throw BusinessRuntimeException.getInstance("请选择对应的跟进车票");
-		}
-		GroupsRelationExpiryRecord groupsRelationExpiryRecord = groupsRelationExpiryRecordMapper.selectById(ecId);
-		if (groupsRelationExpiryRecord == null) {
-			throw BusinessRuntimeException.getInstance("请选择对应的跟进车票");
-		}
-		if (StrUtil.isAllBlank(record.getContent(), record.getImgs())) {
-			throw BusinessRuntimeException.getInstance("请完善对应跟进信息");
-		}
-		relationCustomerServiceFollowRecordMapper.insert(record);
-		groupsRelationExpiryRecord.setIsFollow(true);
-		groupsRelationExpiryRecordMapper.updateById(groupsRelationExpiryRecord);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 跟进统计
-	 */
-	@GetMapping("/get/renewFollow/statistics")
-	public Result<List<RenewFollowStatisticsView>> getRenewFollowStatisticsData(String startTime, String endTime) {
-		MapBuilder builder = MapUtils.builder();
-		String timeSql = StrUtil.EMPTY;
-		if (StrUtil.isNotEmpty(startTime)) {
-			timeSql += String.format("assign_time >= '%s'", startTime);
-		}
-		if (StrUtil.isNotEmpty(endTime)) {
-			if (StrUtil.isNotEmpty(timeSql)) {
-				timeSql += " and ";
-			}
-			timeSql += String.format("assign_time < '%s'", endTime);
-		}
-		List<RenewFollowStatisticsView> renewFollowStatisticsViews = beanSearcher.searchAll(RenewFollowStatisticsView.class, builder
-				.put("time", timeSql)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(renewFollowStatisticsViews);
-	}
-
-}

+ 0 - 93
netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsHomeGroupController.java

@@ -1,93 +0,0 @@
-package com.cyksj.web.controller.manage.group;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.HomeGroup;
-import com.cyksj.model.entity.OrderDon;
-import com.cyksj.model.manage.views.HomeGroupView;
-import com.cyksj.model.manage.views.HomeUserView;
-import com.cyksj.service.mange.CmsHomeGroupService;
-import com.cyksj.service.mange.CmsOrderDonService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * @author chan
- * @date 2022/10/12 11:54 AM
- */
-@Slf4j
-@RequestMapping("/manage/home")
-@RequiredArgsConstructor
-@RestController
-public class CmsHomeGroupController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final CmsHomeGroupService homeGroupService;
-
-    private final CmsOrderDonService orderDonService;
-
-
-
-    @GetMapping("/get")
-    public Result<List<HomeGroupView>> get() {
-        List<HomeGroupView> homeGroupViews = beanSearcher.searchAll(HomeGroupView.class, MapUtils.flat(request.getParameterMap()));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(homeGroupViews);
-    }
-
-    @PutMapping("/update")
-    public Result<String> update(@RequestBody HomeGroup homeGroup) {
-        homeGroupService.updateById(homeGroup);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    @Transactional(rollbackFor = Throwable.class)
-    @PostMapping("/post")
-    @Log(module = "平台管理/家庭组管理新增用户", businessType = BusinessType.POST, isSaveRequestData = true)
-    public Result<String> post(@RequestBody HomeGroup homeGroup) {
-        OrderDon orderDon = orderDonService.getOne(Wrappers.lambdaQuery(OrderDon.class)
-                .eq(OrderDon::getUserId, homeGroup.getUserId())
-                .eq(OrderDon::getRelationId, homeGroup.getRelationId())
-                .eq(OrderDon::getStatus,OrderDon.Status.hasPayment)
-                .orderByDesc(OrderDon::getId)
-                .last(" limit 1")
-        );
-        if(orderDon != null){
-            log.info("添加家庭组 修改 订单状态 为已完成 orderId:{}",orderDon.getId());
-            orderDon.setStatus(OrderDon.Status.complete);
-            orderDonService.updateById(orderDon);
-        }
-
-        homeGroupService.save(homeGroup);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @DeleteMapping("/delete/{id}")
-    @Log(module = "平台管理/家庭组管理删除用户", businessType = BusinessType.DELETE, isSaveRequestData = true)
-    public Result<String> delete(@PathVariable Long id) {
-        homeGroupService.removeById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    @GetMapping("/get/user/unInvited")
-    public Result<SearchResult<HomeUserView>> getUser() {
-        SearchResult<HomeUserView> search = beanSearcher.search(HomeUserView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-}

+ 0 - 80
netflix-web/src/main/java/com/cyksj/web/controller/manage/gzh/GzhController.java

@@ -1,80 +0,0 @@
-package com.cyksj.web.controller.manage.gzh;
-
-import cn.hutool.core.util.StrUtil;
-import com.cyksj.common.util.IoKit;
-import com.cyksj.common.util.StringUtil;
-import com.cyksj.common.util.Xmls;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.dto.MsgEvent;
-import com.cyksj.service.gzh.GzhService;
-import com.cyksj.service.wechat.WeChatService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-
-/*
- *项目名: netflix
- *文件名: GzhController
- *创建者: JavaZou
- *创建时间:2023/1/13 16:50
- */
-@RestController
-@RequestMapping("/manage/gzh")
-@RequiredArgsConstructor
-@Slf4j
-public class GzhController {
-	private final HttpServletRequest request;
-
-	private final GzhService gzhService;
-
-	private final WeChatService weChatService;
-
-	@RequestMapping(value = "/msg/notify", method = {RequestMethod.GET, RequestMethod.POST})
-	public String msgNotify(@RequestParam(value = "echostr", required = false) String echoStr) throws IOException {
-		if (StrUtil.endWithIgnoreCase(request.getMethod(), RequestMethod.GET.name())) {
-			if (StrUtil.isBlank(echoStr)) {
-				return StrUtil.EMPTY;
-			}
-			//验证消息推送URL是否正确
-			return echoStr;
-		}
-
-		String content = IoKit.toString(request.getInputStream(), IoKit.Charsets.UTF_8);
-		log.info("公众号消息推送通知: \n{}", content);
-
-		if (StringUtils.isBlank(content)) {
-			return StringUtil.EMPTY;
-		}
-		MsgEvent msgEvent;
-		try {
-			msgEvent = Xmls.parseObject(content, MsgEvent.class);
-		} catch (Exception e) {
-			log.warn(" ! 解析公众号推送XML 失败.");
-			return "";
-		}
-		if (null == msgEvent) {
-			return "";
-		}
-
-		if (msgEvent.getMsgType() == null) {
-			return "";
-		}
-
-		return gzhService.gzhMsg(msgEvent);
-	}
-
-	/**
-	 * 生成永久渠道二维码
-	 */
-	@GetMapping("/get/notExpired/popularizeCode")
-	public Result<String> getNotExpiredPopularizeCode(String sceneKey) throws Exception {
-		//获取gzh带参数的二维码
-		String url = weChatService.getNotExpiredWxGzhQrCode(sceneKey);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(url);
-	}
-}

+ 0 - 185
netflix-web/src/main/java/com/cyksj/web/controller/manage/home/HomeManageConfigController.java

@@ -1,185 +0,0 @@
-package com.cyksj.web.controller.manage.home;
-
-import com.baomidou.mybatisplus.core.toolkit.Assert;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.GoodsDonCategory;
-import com.cyksj.model.entity.HomeManagementConfig;
-import com.cyksj.model.entity.HomeManagementConfigUserClickRecord;
-import com.cyksj.model.request.HomeConfigTimingReq;
-import com.cyksj.model.request.HomeManageConfigReq;
-import com.cyksj.model.views.HomeManagementAvailableGoodsView;
-import com.cyksj.model.views.HomeManagementConfigView;
-import com.cyksj.service.home.HomeManagementConfigService;
-import com.cyksj.service.mange.GoodsDonCategoryService;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/** admin/首页管理/首页配置管理
- *项目名: netflix
- *文件名: HomeManageConfigController
- *创建者: JavaZou
- *创建时间:2023/8/17 16:46
- */
-@RestController
-@RequestMapping("/manage/homeManage/config")
-@RequiredArgsConstructor
-public class HomeManageConfigController {
-	private final HomeManagementConfigService homeManagementConfigService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final RefreshCacheService refreshCacheService;
-
-	private final GoodsDonCategoryService goodsDonCategoryService;
-
-	/**
-	 * 新增首页配置
-	 */
-	@PostMapping("/post")
-	public Result<String> saveConfig(@RequestBody HomeManageConfigReq config) {
-		homeManagementConfigService.saveOrUpdateConfig(config);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 更新首页配置
-	 */
-	@PutMapping("/put")
-	public Result<String> updateConfig(@RequestBody HomeManageConfigReq config) {
-		homeManagementConfigService.saveOrUpdateConfig(config);
-		refreshCacheService.refreshYhHomePageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 上下架配置
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		HomeManagementConfig byId = homeManagementConfigService.getById(id);
-		Assert.notNull(byId, "配置不存在");
-		byId.setStatus(!byId.getStatus());
-		byId.setTime(null);
-		byId.setPreStatus(null);
-		homeManagementConfigService.updateById(byId);
-		refreshCacheService.refreshYhHomePageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 配置 一键上下架
-	 */
-	@PutMapping("/batch/update/status/{status}")
-	public Result<String> batchUpdateStatus(@RequestBody List<Long> ids, @PathVariable Boolean status) {
-		homeManagementConfigService.update(null, Wrappers.lambdaUpdate(HomeManagementConfig.class)
-				.set(HomeManagementConfig::getTime, null)
-				.set(HomeManagementConfig::getPreStatus, null)
-				.set(HomeManagementConfig::getStatus, status)
-				.in(HomeManagementConfig::getId, ids));
-		//批量取消定时上下架状态
-		homeManagementConfigService.batchCancelTimingStatus(ids);
-		refreshCacheService.refreshYhHomePageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 分类 一键上下架
-	 */
-	@PutMapping("/batch/update/category/status/{status}")
-	public Result<String> batchUpdateCategoryStatus(@RequestBody List<Long> ids, @PathVariable Boolean status) {
-		goodsDonCategoryService.update(null, Wrappers.lambdaUpdate(GoodsDonCategory.class)
-				.set(GoodsDonCategory::getStatus, status)
-				.in(GoodsDonCategory::getId, ids));
-		refreshCacheService.refreshYhHomePageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 配置排序
-	 */
-	@PutMapping("/sort")
-	public Result<String> sortConfig(@RequestBody HomeManageConfigReq config) {
-		Long id = config.getId();
-		HomeManagementConfig byId = homeManagementConfigService.getById(id);
-		Assert.notNull(byId, "配置不存在");
-		Integer sorted = config.getSorted();
-		byId.setSorted(sorted);
-		homeManagementConfigService.updateById(byId);
-		refreshCacheService.refreshYhHomePageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除首页配置
-	 */
-	@DeleteMapping("/del/{id}")
-	public Result<String> delById(@PathVariable Long id) {
-		homeManagementConfigService.update(null, Wrappers.lambdaUpdate(HomeManagementConfig.class)
-						.set(HomeManagementConfig::getDeleted, false)
-						.eq(HomeManagementConfig::getId, id)
-						.eq(HomeManagementConfig::getDeleted, true));
-		refreshCacheService.refreshYhHomePageCache();
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 首页配置列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<HomeManagementConfigView>> get(@RequestParam(defaultValue = "ad") HomeManagementConfig.Type type) {
-		SearchResult<HomeManagementConfigView> search = beanSearcher.search(HomeManagementConfigView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(HomeManagementConfigView::getType, type.name())
-				.build());
-		search.getDataList().forEach(data -> {
-			Number number = beanSearcher.searchCount(HomeManagementConfigUserClickRecord.class, MapUtils.builder()
-					.field(HomeManagementConfigUserClickRecord::getConfigId, data.getId()).build());
-			data.setClick(number.intValue());
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 首页配置 可选平台
-	 */
-	@GetMapping("/get/goods")
-	public Result<List<HomeManagementAvailableGoodsView>> getAvailableGoodsDon(HomeManagementConfig.Type type) {
-		Assert.notNull(type, "首页配置类型为空");
-		List<HomeManagementAvailableGoodsView> views = beanSearcher.searchAll(HomeManagementAvailableGoodsView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.put("type", String.format("type = '%s' and ", type.name()))
-				.field(HomeManagementAvailableGoodsView::getGoodsType, 1)
-				.field(HomeManagementAvailableGoodsView::getStatus, true)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(views);
-	}
-
-	/**
-	 * 定时上下架时间
-	 */
-	@PutMapping("/timing/update/status")
-	public Result<String> timingUpdateStatus(@RequestBody HomeConfigTimingReq req) {
-		homeManagementConfigService.timingUpdateStatus(req);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 取消定时上下架
-	 */
-	@PutMapping("/timing/cancel/{id}")
-	public Result<String> timingCancel(@PathVariable Long id) {
-		homeManagementConfigService.timingCancel(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-}

+ 0 - 203
netflix-web/src/main/java/com/cyksj/web/controller/manage/information/CmsInformationController.java

@@ -1,203 +0,0 @@
-package com.cyksj.web.controller.manage.information;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonMapper;
-import com.cyksj.mapper.InformationClickUserRecordMapper;
-import com.cyksj.mapper.OrderDonMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.views.InformationView;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.information.InformationCategoryService;
-import com.cyksj.service.information.InformationService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * @author zwhui
- * @date 2023/10/12 14:41
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/information")
-public class CmsInformationController {
-    private final InformationService informationService;
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final InformationCategoryService informationCategoryService;
-
-    private final GoodsDonMapper goodsDonMapper;
-
-    private final RedisService redisService;
-
-    private final InformationClickUserRecordMapper informationClickUserRecordMapper;
-
-    private final OrderDonMapper orderDonMapper;
-
-    /**
-     * 保存文章
-     */
-    @PostMapping("/post")
-    public Result<String> saveInformation(@RequestBody Information information) {
-        informationService.save(information);
-        Set<String> keys = redisService.keys(RedisService.key.INFORMATION_KEY.getName() + "*");
-        redisService.del(keys.toArray(String[]::new));
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 修改文章
-     */
-    @PutMapping("/put")
-    public Result<String> updateInformation(@RequestBody Information information) {
-        if (information.getId() == null) {
-            throw BusinessRuntimeException.getInstance("请指定要修改的文章");
-        }
-        informationService.updateById(information);
-        Set<String> keys = redisService.keys(RedisService.key.INFORMATION_KEY.getName() + "*");
-        redisService.del(keys.toArray(String[]::new));
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 文章排序
-     */
-    @PutMapping("/sorted")
-    public Result<String> sortedInformation(@RequestBody Information information) {
-        if (information.getId() == null) {
-            throw BusinessRuntimeException.getInstance("请指定要排序的文章");
-        }
-        Integer sorted = information.getSorted();
-        if (sorted != null && sorted >= 0) {
-            Information byId = informationService.getById(information.getId());
-            if (byId != null && byId.getSorted() != sorted) {
-                byId.setSorted(sorted);
-                informationService.updateById(byId);
-                Set<String> keys = redisService.keys(RedisService.key.INFORMATION_KEY.getName() + "*");
-                redisService.del(keys.toArray(String[]::new));
-            }
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 获取文章
-     */
-    @GetMapping("/get")
-    public Result<SearchResult<InformationView>> getInformation(Long category) {
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        if (category != null) {
-            builder.put("ct", String.format(" and JSON_CONTAINS(i.category_ids,'\"%s\"')", category));
-        }
-        SearchResult<InformationView> list = beanSearcher.search(InformationView.class, builder.build());
-        list.getDataList().forEach(data -> {
-            try {
-                List<Long> goodsIds = Jsons.parseList(data.getGoodsIds(), Long.class);
-                data.setGoodsTitles(goodsDonMapper.selectList(Wrappers.lambdaQuery(GoodsDon.class)
-                        .select(GoodsDon::getTitle)
-                        .in(GoodsDon::getId, goodsIds)
-                        .eq(GoodsDon::getStatus, true)
-                        .eq(GoodsDon::getDeleted,true)).stream().map(GoodsDon::getTitle).collect(Collectors.toList()));
-                List<Long> categoryIds = Jsons.parseList(data.getCategoryIds(), Long.class);
-                data.setCategoryNames(informationCategoryService.list(Wrappers.lambdaQuery(InformationCategory.class)
-                        .select(InformationCategory::getName)
-                        .in(InformationCategory::getId,categoryIds)).stream().map(InformationCategory::getName).collect(Collectors.toList()));
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(list);
-    }
-
-    /**
-     * 修改文章状态
-     */
-    @PutMapping("/update/status")
-    public Result<String> updateStatus(@RequestBody Information information) {
-        if (information.getId() == null) {
-            throw BusinessRuntimeException.getInstance("请指定要修改的文章");
-        }
-        informationService.updateById(information);
-        Set<String> keys = redisService.keys(RedisService.key.INFORMATION_KEY.getName() + "*");
-        redisService.del(keys.toArray(String[]::new));
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 删除文章
-     */
-    @DeleteMapping("/del/{id}")
-    public Result<String> delById(@PathVariable Long id) {
-        Information byId = informationService.getById(id);
-        if (byId == null) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        byId.setDeleted(false);
-        informationService.updateById(byId);
-        Set<String> keys = redisService.keys(RedisService.key.INFORMATION_KEY.getName() + "*");
-        redisService.del(keys.toArray(String[]::new));
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 保存文章类型
-     */
-    @PostMapping("/post/category")
-    public Result<String> saveInformationCategory(@RequestBody List<InformationCategory> informationCategorys) {
-        log.info("保存文章类型 categorys:{}",informationCategorys);
-        informationCategoryService.saveBatch(informationCategorys);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 修改文章类型
-     */
-    @PutMapping("/put/category")
-    public Result<String> updateInformationCategory(@RequestBody List<InformationCategory> informationCategorys) {
-        informationCategoryService.updateBatchById(informationCategorys);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 获取文章类型
-     */
-    @GetMapping("/get/category")
-    public Result<List<InformationCategory>> getInformationCategory() {
-        return GatewayResponse.SUCCESS.newBuilder().toResult(informationCategoryService.list(Wrappers.lambdaQuery(InformationCategory.class).orderByAsc(InformationCategory::getSortBy)));
-    }
-
-    /**
-     * 删除文章类型
-     */
-    @DeleteMapping("/del/category/{id}")
-    public Result<String> delCategoryById(@PathVariable Long id) {
-        int count = informationService.count(Wrappers.lambdaQuery(Information.class).apply("JSON_CONTAINS(category_ids,'\"" + id + "\"')").eq(Information::getDeleted, true));
-        if (count > 0){
-            throw BusinessRuntimeException.getInstance("该类型下存在文章,无法删除");
-        }
-        informationCategoryService.removeById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-}

+ 0 - 60
netflix-web/src/main/java/com/cyksj/web/controller/manage/invoice/UserInvoiceController.java

@@ -1,60 +0,0 @@
-package com.cyksj.web.controller.manage.invoice;
-
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserInvoiceApplyRecordMapper;
-import com.cyksj.model.entity.UserInvoiceApplyRecord;
-import com.cyksj.model.views.UserInvoiceApplyRecordView;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * admin/发票管理
- * 项目名: yhlxj
- * 文件名: UserInvoiceController
- * 创建者: JavaZou
- * 创建时间:2024/12/13 15:43
- */
-@RestController
-@RequestMapping("/manage/invoice")
-@RequiredArgsConstructor
-public class UserInvoiceController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserInvoiceApplyRecordMapper userInvoiceApplyRecordMapper;
-
-	/**
-	 * 用户发票申请记录
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<UserInvoiceApplyRecordView>> get() {
-		SearchResult<UserInvoiceApplyRecordView> search = beanSearcher.search(UserInvoiceApplyRecordView.class, MapUtils.flatBuilder(request.getParameterMap()).orderBy(UserInvoiceApplyRecordView::getUpdateTime).desc().build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 配置发票
-	 */
-	@PutMapping("/set/invoiceImg")
-	public Result<String> setInvoiceImg(@RequestBody UserInvoiceApplyRecord userInvoiceApplyRecord) {
-		String invoiceImg = userInvoiceApplyRecord.getInvoiceImg();
-		Long id = userInvoiceApplyRecord.getId();
-		UserInvoiceApplyRecord invoiceApplyRecord = userInvoiceApplyRecordMapper.selectById(id);
-		if (invoiceApplyRecord.getStatus() == 2) {
-			throw BusinessRuntimeException.getInstance("发票已发送");
-		}
-		invoiceApplyRecord.setFileName(userInvoiceApplyRecord.getFileName());
-		invoiceApplyRecord.setStatus(1);
-		invoiceApplyRecord.setInvoiceImg(invoiceImg);
-		userInvoiceApplyRecordMapper.updateById(invoiceApplyRecord);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 141
netflix-web/src/main/java/com/cyksj/web/controller/manage/market/LuckyDrawController.java

@@ -1,141 +0,0 @@
-package com.cyksj.web.controller.manage.market;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.manage.coupon.CouponUserMapper;
-import com.cyksj.mapper.manage.exchange.ExchangeCodeMapper;
-import com.cyksj.mapper.market.draw.LuckyDrawMapper;
-import com.cyksj.mapper.market.draw.LuckyDrawRecordMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.views.DrawRecordDetail;
-import com.cyksj.model.views.LuckyDrawView;
-import com.cyksj.service.market.draw.LuckyDrawService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/*
- *项目名: netflix
- *文件名: LuckyDrawController
- *创建者: JavaZou
- *创建时间:2022/12/27 13:33
- */
-@RestController
-@RequestMapping("/manage/market/luckyDraw")
-@RequiredArgsConstructor
-public class LuckyDrawController {
-	private final LuckyDrawService luckyDrawService;
-
-	private final LuckyDrawMapper luckyDrawMapper;
-
-	private final BeanSearcher beanSearcher;
-
-	private final LuckyDrawRecordMapper luckyDrawRecordMapper;
-
-	private final UserMapper userMapper;
-
-	private final ExchangeCodeMapper exchangeCodeMapper;
-
-	private final CouponUserMapper couponUserMapper;
-
-	/**
-	 * 新增抽奖奖品
-	 */
-	@PostMapping("/post")
-	public Result<String> saveLuckyDraw(@RequestBody @Validated LuckyDraw luckyDraw) throws Exception {
-		luckyDrawService.saveLuckyDraw(luckyDraw);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("新增奖品成功");
-	}
-
-	/**
-	 * 上下架奖品
-	 */
-	@PutMapping("/put/status/{id}")
-	public Result<String> putStatus(@PathVariable Long id) throws Exception {
-		luckyDrawService.putStatus(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("操作成功");
-	}
-
-	/**
-	 * 编辑奖品
-	 */
-	@PutMapping("/put")
-	public Result<String> updateLuckyDraw(@RequestBody LuckyDraw luckyDraw) throws Exception {
-		luckyDrawService.updateLuckyDraw(luckyDraw);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("操作成功");
-	}
-
-	/**
-	 * 删除奖品
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteLuckyDraw(@PathVariable Long id) {
-		LuckyDraw luckyDraw = luckyDrawMapper.selectById(id);
-		if (luckyDraw == null || !luckyDraw.getDeleted()) {
-			throw BusinessRuntimeException.getInstance("该奖品已不存在");
-		}
-		luckyDraw.setDeleted(!luckyDraw.getDeleted());
-		luckyDrawMapper.updateById(luckyDraw);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除奖品成功");
-	}
-
-	/**
-	 * 奖品列表
-	 */
-	@GetMapping("/get")
-	@SaCheckPermission("raffle:view")
-	public Result<SearchResult<LuckyDrawView>> get(HttpServletRequest request) {
-		SearchResult<LuckyDrawView> search = beanSearcher.search(LuckyDrawView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.build());
-		search.getDataList().forEach(data->{
-			Integer lotteryNum = luckyDrawRecordMapper.getLotteryNum(data.getId());
-			data.setLotteryNum(lotteryNum);
-			Integer lotteryCount = luckyDrawRecordMapper.selectCount(Wrappers.lambdaQuery(LuckyDrawRecord.class)
-					.eq(LuckyDrawRecord::getDrawId, data.getId()));
-			data.setLotteryCount(lotteryCount);
-			Integer luckyOrderCount = luckyDrawRecordMapper.selectCount(Wrappers.lambdaQuery(LuckyDrawRecord.class)
-					.eq(LuckyDrawRecord::getDrawId, data.getId())
-					.eq(LuckyDrawRecord::getStatus, LuckyDrawRecord.Status.success));
-			data.setLuckyOrderCount(luckyOrderCount);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 奖品中奖明细
-	 */
-	@GetMapping("/get/detail")
-	public Result<SearchResult<DrawRecordDetail>> getDrawRecordDetail(HttpServletRequest request) {
-		SearchResult<DrawRecordDetail> search = beanSearcher.search(DrawRecordDetail.class, MapUtils.flatBuilder(request.getParameterMap())
-				.build());
-		search.getDataList().forEach(data -> {
-			User user = userMapper.selectById(data.getUserId());
-			data.setNickname(user != null ? user.getNickname() : "");
-			if (data.getType() == LuckyDraw.Type.virtualGoods) {
-				ExchangeCode code = exchangeCodeMapper.selectOne(Wrappers.lambdaQuery(ExchangeCode.class)
-						.eq(ExchangeCode::getUserId, data.getUserId())
-						.eq(ExchangeCode::getCode, data.getExCode()).select(ExchangeCode::getUseStatus).last("limit 1"));
-				if (code != null) {
-					data.setDrawStatus(code.getUseStatus() ? LuckyDrawRecord.Status.success : LuckyDrawRecord.Status.pending);
-				}
-			} else if (data.getType() == LuckyDraw.Type.coupon) {
-				CouponUser couponUser = couponUserMapper.selectOne(Wrappers.lambdaQuery(CouponUser.class)
-						.eq(CouponUser::getUserId, data.getUserId())
-						.eq(CouponUser::getCouponId, data.getCouponId()).select(CouponUser::getStatus).last("limit 1"));
-				if (couponUser != null) {
-					data.setDrawStatus(couponUser.getStatus() != CouponUser.Status.unused ? LuckyDrawRecord.Status.success : LuckyDrawRecord.Status.pending);
-				}
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 42
netflix-web/src/main/java/com/cyksj/web/controller/manage/market/SignController.java

@@ -1,42 +0,0 @@
-package com.cyksj.web.controller.manage.market;
-
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.market.sign.SignConfigMapper;
-import com.cyksj.model.entity.SignConfig;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("/manage/market/sign")
-@RequiredArgsConstructor
-public class SignController {
-    private final SignConfigMapper signConfigMapper;
-
-    /**
-     * 每日签到设置明细
-     */
-    @GetMapping("/get")
-    public Result<List<SignConfig>> getSign() {
-        return GatewayResponse.SUCCESS.newBuilder().toResult(signConfigMapper.selectList(Wrappers.lambdaQuery(SignConfig.class).orderByAsc(SignConfig::getId)));
-    }
-
-    /**
-     * 编辑每日签到设置
-     */
-    @PutMapping("/put")
-    public Result<String> getSign(@RequestBody List<SignConfig> signConfigs) {
-        signConfigs.forEach(signConfig->{
-            if (signConfig.getId() == null || signConfig.getId() < 1) {
-                throw BusinessRuntimeException.getInstance("id为空");
-            }
-            signConfigMapper.updateById(signConfig);
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult("编辑成功");
-    }
-}

+ 0 - 159
netflix-web/src/main/java/com/cyksj/web/controller/manage/market/TaskController.java

@@ -1,159 +0,0 @@
-package com.cyksj.web.controller.manage.market;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.market.task.TaskFollowPlatVerifyMapper;
-import com.cyksj.mapper.market.task.TaskMapper;
-import com.cyksj.mapper.market.task.TaskTypeMapper;
-import com.cyksj.mapper.market.task.TaskUserCompleteRecordMapper;
-import com.cyksj.model.entity.Task;
-import com.cyksj.model.entity.TaskFollowPlatVerify;
-import com.cyksj.model.entity.TaskType;
-import com.cyksj.model.views.TaskFollowVerifyView;
-import com.cyksj.model.views.TaskView;
-import com.cyksj.service.market.task.TaskService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.List;
-
-/*
- *项目名: netflix
- *文件名: GoodsDonSkuFrontView
- *创建者: JavaZou
- *创建时间:2022/12/27 13:34
- */
-@RestController
-@RequestMapping("/manage/market/task")
-@RequiredArgsConstructor
-public class TaskController {
-	private final TaskTypeMapper taskTypeMapper;
-
-	private final TaskMapper taskMapper;
-
-	private final TaskService taskService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final TaskUserCompleteRecordMapper taskUserCompleteRecordMapper;
-
-	private final TaskFollowPlatVerifyMapper taskFollowPlatVerifyMapper;
-
-	/**
-	 * 任务分类列表
-	 */
-	@GetMapping("/get/type")
-	public Result<List<TaskType>> getType() {
-		return GatewayResponse.SUCCESS.newBuilder().toResult(taskTypeMapper.selectList(null));
-	}
-
-	/**
-	 * 新增任务
-	 */
-	@PostMapping("/post")
-	public Result<String> saveTask(@RequestBody @Validated Task task) {
-		taskService.saveTask(task);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("新增任务成功");
-	}
-
-	/**
-	 * 删除任务
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteTask(@PathVariable Long id) {
-		Task task = taskMapper.selectById(id);
-		if (task == null || !task.getDeleted()) {
-			throw BusinessRuntimeException.getInstance("该任务已不存在");
-		}
-		task.setDeleted(!task.getDeleted());
-		taskMapper.updateById(task);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("删除任务成功");
-	}
-
-	/**
-	 * 修改任务
-	 */
-	@PutMapping("/put")
-	public Result<String> updateTask(@RequestBody Task task) {
-		if (task.getId() == null || task.getId() < 1) {
-			throw BusinessRuntimeException.getInstance("任务id错误");
-		}
-		taskService.updateTask(task);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑任务成功");
-	}
-
-	/**
-	 * 任务上下架
-	 */
-	@PutMapping("/put/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		Task task = taskMapper.selectById(id);
-		if (task == null || !task.getDeleted()) {
-			throw BusinessRuntimeException.getInstance("该任务已不存在");
-		}
-		task.setStatus(!task.getStatus());
-		taskMapper.updateById(task);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("任务上下架成功");
-	}
-
-	/**
-	 * 任务列表
-	 */
-	@GetMapping("/get")
-	@SaCheckPermission("sign:view")
-	public Result<SearchResult<TaskView>> getTask(HttpServletRequest request) {
-		DateTime now = DateTime.now();
-		DateTime beginOfDay = DateUtil.beginOfDay(now);
-		DateTime endOfDay = DateUtil.endOfDay(now);
-		SearchResult<TaskView> search = beanSearcher.search(TaskView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		search.getDataList().forEach(data -> {
-			Integer todayCompleteNum = taskUserCompleteRecordMapper.getTodayCompleteNum(data.getId(),beginOfDay,endOfDay);
-			data.setTodayCompleteNum(todayCompleteNum);
-			Integer sumCompleteNum = taskUserCompleteRecordMapper.getSumCompleteNum(data.getId());
-			data.setSumCompleteNum(sumCompleteNum);
-			Integer todayPoints = taskUserCompleteRecordMapper.sumTodayPoints(data.getId(), beginOfDay, endOfDay);
-			data.setTodayPoints(todayPoints);
-			Integer sumPoints = taskUserCompleteRecordMapper.sumPoints(data.getId());
-			data.setSumPoints(sumPoints);
-			BigDecimal todayBalance = taskUserCompleteRecordMapper.sumTodayBalance(data.getId(), beginOfDay, endOfDay);
-			data.setTodayBalance(todayBalance);
-			BigDecimal sumBalance = taskUserCompleteRecordMapper.sumBalance(data.getId());
-			data.setSumBalance(sumBalance);
-			//关注任务待审核数量
-			data.setVerifyNum(taskFollowPlatVerifyMapper.selectCount(Wrappers.lambdaQuery(TaskFollowPlatVerify.class)
-					.eq(TaskFollowPlatVerify::getTaskId, data.getId())
-					.eq(TaskFollowPlatVerify::getStatus, TaskFollowPlatVerify.Status.verifying)));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 关注任务 待审核详情
-	 */
-	@GetMapping("/get/follow/detail")
-	public Result<SearchResult<TaskFollowVerifyView>> getFollowDetail(HttpServletRequest request) {
-		SearchResult<TaskFollowVerifyView> search = beanSearcher.search(TaskFollowVerifyView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 批量审核 关注任务
-	 */
-	@PutMapping("/batch/verify/follow")
-	public Result<String> batchVerifyFollow(@RequestBody List<TaskFollowPlatVerify> taskFollowPlatVerifyList) {
-		taskService.batchVerifyFollow(taskFollowPlatVerifyList);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("审核成功");
-	}
-}
-

+ 0 - 105
netflix-web/src/main/java/com/cyksj/web/controller/manage/mirror/CmsClaudeController.java

@@ -1,105 +0,0 @@
-package com.cyksj.web.controller.manage.mirror;
-
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.ClaudeSession;
-import com.cyksj.model.views.ChatgptCarSessionView;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.claude.ClaudeSessionService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Optional;
-
-/**
- * @author chan
- * @date 2024/8/9 10:02
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/mirror/claude")
-public class CmsClaudeController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final ClaudeSessionService claudeSessionService;
-
-    private final RedisService redisService;
-
-    private final HttpServletRequest request;
-
-    /**
-     * 获取镜像车队账号列表
-     */
-    @GetMapping("/get")
-    public Result<SearchResult<ChatgptCarSessionView>> getMirrorCarSession() {
-        SearchResult<ChatgptCarSessionView> search = beanSearcher.search(ChatgptCarSessionView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .orderBy(ChatgptCarSessionView::getId).desc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 编辑镜像车队账号列表
-     */
-    @PutMapping("/update")
-    public Result<String> updateMirrorCarSession(@RequestBody ClaudeSession claudeSession) {
-        Long id = claudeSession.getId();
-        ClaudeSession dbChatSession = claudeSessionService.getById(id);
-        if (!ObjectUtil.equal(dbChatSession.getEmail(), claudeSession.getEmail()) || !ObjectUtil.equal(dbChatSession.getPassword(), claudeSession.getPassword())) {
-            claudeSessionService.getSession(dbChatSession.getEmail(), dbChatSession.getPassword(), claudeSession.getOfficialSession(), claudeSession.getIsPlus());
-        }
-        Integer selectCount = claudeSessionService.getBaseMapper().selectCount(Wrappers.lambdaQuery(ClaudeSession.class)
-                .and(e -> e.eq(ClaudeSession::getEmail, claudeSession.getEmail())
-                        .or().eq(ClaudeSession::getCarID, claudeSession.getCarID()))
-                .ne(ClaudeSession::getId, claudeSession.getId()));
-        if (selectCount > 0) {
-            throw BusinessRuntimeException.getInstance("请检验车队ID或账号是否已存在");
-        }
-        claudeSessionService.updateById(claudeSession);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 删除镜像车队账号
-     */
-    @DeleteMapping("/delete/{id}")
-    public Result<String> deleteMirrorCarSession(@PathVariable Long id) {
-        Optional.ofNullable(claudeSessionService.getById(id))
-                .ifPresent(e -> {
-                    String carId = e.getCarID();
-                    if (StrUtil.isNotBlank(carId)) {
-                        claudeSessionService.removeById(e.getId());
-                        String highCarChatKey = RedisService.key.CLAUDE_CAR_CHAT.getName() + carId;
-                        redisService.del(highCarChatKey);
-                    }
-                });
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 新增镜像车队账号
-     */
-    @PostMapping("/post/mirror/car/session")
-    public Result<String> postMirrorCarSession(@RequestBody ClaudeSession claudeSession) {
-        Integer selectCount = claudeSessionService.getBaseMapper().selectCount(Wrappers.lambdaQuery(ClaudeSession.class)
-                .eq(ClaudeSession::getCarID, claudeSession.getCarID()).or().eq(ClaudeSession::getEmail, claudeSession.getEmail()));
-        if (selectCount > 0) {
-            throw BusinessRuntimeException.getInstance("请检验车队ID或账号是否已存在");
-        }
-       claudeSessionService.getSession(claudeSession.getEmail(), claudeSession.getPassword(), claudeSession.getOfficialSession(),claudeSession.getIsPlus());
-
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-}

+ 0 - 97
netflix-web/src/main/java/com/cyksj/web/controller/manage/mirror/CmsMirrorController.java

@@ -1,97 +0,0 @@
-package com.cyksj.web.controller.manage.mirror;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.lang.UUID;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.cyksj.common.constant.Constant;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.ChatgptUserTokenPrepareMapper;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.model.entity.ChatgptUserTokenPrepare;
-import com.cyksj.model.entity.GoodsDonSku;
-import com.cyksj.model.request.ChatGptUserTokenGenerateReq;
-import com.cyksj.model.views.ChatgptUserTokenPrepareView;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import com.google.common.collect.Lists;
-import lombok.RequiredArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * 项目名: yhlxj2
- * 文件名: CmsMirrorController
- * 创建者: JavaZou
- * 创建时间:2024/4/18 17:45
- */
-@RestController
-@RequestMapping("/manage/mirror/gpt")
-@RequiredArgsConstructor
-public class CmsMirrorController {
-
-	private final GoodsDonSkuMapper goodsDonSkuMapper;
-
-	private final ChatgptUserTokenPrepareMapper chatgptUserTokenPrepareMapper;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	/**
-	 * 生成并导出gpt会话
-	 */
-	@GetMapping("/generateAndExport/gpt/session")
-	@Transactional(rollbackFor = Exception.class)
-	public void generateAndExportGptSession(ChatGptUserTokenGenerateReq gptUserTokenGenerateReq, HttpServletResponse response) {
-		Integer num = gptUserTokenGenerateReq.getNum();
-		if (num == null || num <= 0) {
-			throw new IllegalArgumentException("生成数量必须大于0");
-		}
-		Long skuId = gptUserTokenGenerateReq.getSkuId();
-		GoodsDonSku sku = goodsDonSkuMapper.selectById(skuId);
-		if (sku == null) {
-			throw new IllegalArgumentException("镜像规格不存在");
-		}
-		if (!sku.getIsCar()) {
-			throw new IllegalArgumentException("不是gpt车队规格");
-		}
-		String name = Optional.ofNullable(gptUserTokenGenerateReq.getName()).orElse(Constant.YH_GPT_USER_NAME);
-		String img = Optional.ofNullable(gptUserTokenGenerateReq.getName()).orElse(Constant.DEFAULT_HEAD_IMG);
-		List<ChatgptUserTokenPrepare> prepares = new ArrayList<>(num);
-		ChatgptUserTokenPrepare chatgptUserTokenPrepare = null;
-
-		for (int i = 0; i < num; i++) {
-			chatgptUserTokenPrepare = new ChatgptUserTokenPrepare();
-			chatgptUserTokenPrepare.setUserToken(UUID.randomUUID().toString());
-			chatgptUserTokenPrepare.setName(name);
-			chatgptUserTokenPrepare.setImg(img);
-			chatgptUserTokenPrepare.setSkuId(skuId);
-			chatgptUserTokenPrepare.setSkuName(sku.getSpecVal());
-			prepares.add(chatgptUserTokenPrepare);
-		}
-		if (CollUtil.isNotEmpty(prepares)) {
-			Lists.partition(prepares, 500).forEach(e -> chatgptUserTokenPrepareMapper.batchInsert(e));
-		}
-		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ChatgptUserTokenPrepare.class, prepares, "用户token","用户token", ExcelTypeEnum.XLSX, null);
-	}
-
-	/**
-	 * 镜像车队token 列表
-	 */
-	@GetMapping("/get/list")
-	public Result<SearchResult<ChatgptUserTokenPrepareView>> getList() {
-		SearchResult<ChatgptUserTokenPrepareView> search = beanSearcher.search(ChatgptUserTokenPrepareView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.orderBy(ChatgptUserTokenPrepareView::getId).desc()
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 234
netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/UserMirrorShopController.java

@@ -1,234 +0,0 @@
-package com.cyksj.web.controller.manage.mirrorshop;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.mirrorshop.UserMirrorShopDistributeMoneyApplyMapper;
-import com.cyksj.mapper.mirrorshop.UserMirrorShopMapper;
-import com.cyksj.model.entity.UserMirrorShopDistributeMoneyApply;
-import com.cyksj.model.request.DistributeApplyMoneyReq;
-import com.cyksj.model.request.UserMirrorShopInfoApplyReq;
-import com.cyksj.model.views.*;
-import com.cyksj.service.mange.statistics.StatisticsDataService;
-import com.cyksj.service.mange.usermirror.UserMirrorCommonService;
-import com.cyksj.web.util.StpCpsManageUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * admin/镜像店铺
- * 项目名: yhlxj2
- * 文件名: UserMirrorShopController
- * 创建者: JavaZou
- * 创建时间:2024/10/18 17:07
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/mirror/shop")
-public class UserMirrorShopController {
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserMapper userMapper;
-
-	private final UserMirrorShopMapper userMirrorShopMapper;
-
-	private final UserMirrorCommonService userMirrorCommonService;
-
-	private final UserMirrorShopDistributeMoneyApplyMapper moneyApplyMapper;
-
-	private final StatisticsDataService statisticsDataService;
-
-
-	/**
-	 * 店铺列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<UserMirrorShopView>> getYhShopDistributeView(String nickname, String startTime, String endTime) {
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (StrUtil.isNotBlank(nickname)) {
-			List<Long> userIds = userMapper.selectListByNickname(nickname);
-			builder.field(YhShopDistributeView::getUserId, userIds).op(Operator.InList);
-		}
-		String timeSql = StrUtil.EMPTY;
-		if (StrUtil.isNotBlank(startTime)) {
-			timeSql += String.format("and od.created_time >= '%s'", startTime);
-		}
-		if (StrUtil.isNotBlank(endTime)) {
-			timeSql += String.format("and od.created_time < '%s'", endTime);
-		}
-		if (StrUtil.isNotBlank(timeSql)) {
-			builder.put("time", timeSql);
-			//按时间筛选 固定推广人分销情况 倒序
-			builder.orderBy(YhShopDistributeView::getDistributeOrdersMoney).desc();
-		}
-		SearchResult<UserMirrorShopView> search = beanSearcher.search(UserMirrorShopView.class, builder.build());
-		search.getDataList().forEach(view -> {
-			if (view.getDistributeOrdersMoney().compareTo(BigDecimal.ZERO) > 0) {
-				Optional.ofNullable(userMirrorShopMapper.selectSoldMaxGoods(view.getUserId())).ifPresent(title -> view.setGoodsTitle(title));
-			}
-			Optional.ofNullable(userMapper.selectById(view.getUserId())).ifPresent(user -> view.setNickname(user.getNickname()));
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 修改店铺状态
-	 */
-	@PutMapping("/update/shop/status/{id}")
-	public Result<String> updateShopStatusById(@PathVariable Long id) {
-		Optional.ofNullable(userMirrorShopMapper.selectById(id)).ifPresent(shop->{
-			shop.setStatus(!shop.getStatus());
-			userMirrorShopMapper.updateById(shop);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 提现详情记录
-	 */
-	@GetMapping("/get/user/apply/detail/record/{userId}")
-	public Result<UserMirrorShopView> getUserApplyDetailRecord(@PathVariable Long userId) {
-		UserMirrorShopView userDistributeViews = moneyApplyMapper.getApplyDetailByUserId(userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(userDistributeViews);
-	}
-
-	//--------------------------------------提现管理-----------------------------------------------
-
-	/**
-	 * 提现列表
-	 */
-	@GetMapping("/get/apply/list")
-	public Result<SearchResult<UserMirrorShopDistributeMoneyApplyView>> applyMoneyList() {
-		SearchResult<UserMirrorShopDistributeMoneyApplyView> search = beanSearcher.search(UserMirrorShopDistributeMoneyApplyView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 店铺提现 审核
-	 */
-	@PutMapping("/verify/applyMoney")
-	@NoSubmit
-	public Result<String> verifyApplyMoney(@RequestBody @Validated DistributeApplyMoneyReq distributeApplyMoneyReq) {
-		userMirrorCommonService.verifyApplyMoney(distributeApplyMoneyReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult("审核操作成功");
-	}
-
-	/**
-	 * 修改审核图片
-	 */
-	@PutMapping("/verify/applyMoney/img")
-	public Result<String> updateVerifyImg(@RequestBody DistributeApplyMoneyReq distributeApplyMoneyReq) {
-		userMirrorCommonService.updateVerifyImg(distributeApplyMoneyReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	//--------------------------------------加盟费管理-----------------------------------------------
-
-	/**
-	 * 加盟费 订单列表
-	 */
-	@GetMapping("/get/fee/list")
-	public Result<SearchResult<UserMirrorShopFeeOrderDonView>> getFeeList() {
-		SearchResult<UserMirrorShopFeeOrderDonView> search = beanSearcher.search(UserMirrorShopFeeOrderDonView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 加盟费 退款
-	 */
-	@PutMapping("/fee/refund/{orderId}")
-	public Result<String> refundUserMirrorShopFee(@PathVariable Long orderId) throws Exception {
-		userMirrorCommonService.refundUserMirrorShopFee(orderId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 店铺申请修改记录列表
-	 */
-	@GetMapping("/get/apply/info/list")
-	public Result<SearchResult<UserMirrorShopApplyInfoView>> getUserShopApply() {
-		SearchResult<UserMirrorShopApplyInfoView> search = beanSearcher.search(UserMirrorShopApplyInfoView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 店铺审核修改店铺信息
-	 */
-	@PutMapping("/verify")
-	public Result<String> verifyYhShopApply(@RequestBody UserMirrorShopInfoApplyReq applyReq) {
-		userMirrorCommonService.verifyUserMIrrorShopApply(applyReq);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 一键审核店铺信息
-	 */
-	@PutMapping("/batch/verify")
-	public Result<String> batchVerify(@RequestBody UserMirrorShopInfoApplyReq verifyReq) {
-		List<Long> ids = verifyReq.getIds();
-		if (CollUtil.isEmpty(ids)) {
-			throw BusinessRuntimeException.getInstance("请选择对应的审核记录");
-		}
-		ids.forEach(id -> {
-			verifyReq.setId(id);
-			userMirrorCommonService.verifyUserMIrrorShopApply(verifyReq);
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 店铺头部数据
-	 */
-	@GetMapping("/get/head/data")
-	public Result<BackgroundDataView> getHeadData(Long startTime, Long endTime) {
-		BackgroundDataView backgroundDataView = new BackgroundDataView();
-		Date startDate = null;
-		Date endDate = null;
-		if (startTime != null) {
-			startDate = DateUtil.date(startTime);
-		}
-		if (endTime != null) {
-			endDate = DateUtil.date(endTime);
-		}
-		//分销金额数据统计
-		statisticsDataService.userMirrorShopDistribute(backgroundDataView, startDate, endDate);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(backgroundDataView);
-	}
-
-	/**
-	 * 提现列表
-	 */
-	@GetMapping("/get/applyMoney/list")
-	public Result<SearchResult<UserMirrorShopDistributeMoneyApply>> getApplyMoneyList() {
-		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
-		SearchResult<UserMirrorShopDistributeMoneyApply> search = beanSearcher.search(UserMirrorShopDistributeMoneyApply.class,
-				MapUtils.flatBuilder(request.getParameterMap())
-						.field(UserMirrorShopDistributeMoneyApply::getUserId, cpsUserId)
-						.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 180
netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/manage/CmsUserMirrorNoticeController.java

@@ -1,180 +0,0 @@
-package com.cyksj.web.controller.manage.mirrorshop.manage;
-
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.MirrorNoticeMapper;
-import com.cyksj.mapper.mirrorshop.MirrorNoticeUserMapper;
-import com.cyksj.mapper.mirrorshop.MirrorNoticeUserReviewRecordMapper;
-import com.cyksj.model.entity.MirrorNotice;
-import com.cyksj.model.entity.MirrorNoticeUser;
-import com.cyksj.model.entity.MirrorNoticeUserReviewRecord;
-import com.cyksj.model.request.BatchIdsReq;
-import com.cyksj.service.mange.RefreshCacheService;
-import com.cyksj.web.util.StpUserMirrorShopManageUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Optional;
-
-/**
- * admin/镜像店铺后台/公告
- * 项目名: yhlxj2
- * 文件名: CmsUserMirrorAdvertiseController
- * 创建者: JavaZou
- * 创建时间:2024/11/7 12:04
- */
-@RestController
-@RequestMapping("/mirrorShop/manage/notice")
-@RequiredArgsConstructor
-public class CmsUserMirrorNoticeController {
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final MirrorNoticeUserMapper noticeUserMapper;
-
-	private final RefreshCacheService refreshCacheService;
-
-	private final MirrorNoticeMapper mirrorNoticeMapper;
-
-	private final MirrorNoticeUserReviewRecordMapper mirrorNoticeUserReviewRecordMapper;
-
-	/**
-	 * 店铺公告列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult> get(@RequestParam(defaultValue = "1") Boolean self) {
-		long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (self) {
-			SearchResult<MirrorNoticeUser> search = beanSearcher.search(MirrorNoticeUser.class, builder.field(MirrorNoticeUser::getUserId, userId).orderBy(MirrorNoticeUser::getUpdateTime).desc().build());
-			return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-		}
-		builder.put("ruid", String.format(" and myr.user_id = %s", userId));
-		SearchResult<MirrorNotice> search = beanSearcher.search(MirrorNotice.class, builder.orderBy(MirrorNotice::getUpdateTime).desc().build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-
-	/**
-	 * 新增店铺公告
-	 */
-	@PostMapping("/post")
-	public Result<String> post(@RequestBody MirrorNoticeUser notice) {
-		long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		notice.setUserId(userId);
-		noticeUserMapper.insert(notice);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 编辑店铺公告
-	 */
-	@PutMapping("/update")
-	public Result<String> update(@RequestBody MirrorNoticeUser notice) {
-		Long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		MirrorNoticeUser byId = noticeUserMapper.selectById(notice.getId());
-		if (byId == null || !ObjectUtil.equal(userId, byId.getUserId())) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		noticeUserMapper.updateById(notice);
-		refreshCacheService.refreshUserMirrorShopAdvertiseCache(userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 上下架店铺公告
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatusById(@PathVariable Long id) {
-		Long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		Optional.ofNullable(noticeUserMapper.selectById(id))
-				.ifPresent(en -> {
-					en.setStatus(!en.getStatus());
-					noticeUserMapper.updateById(en);
-					refreshCacheService.refreshUserMirrorShopAdvertiseCache(userId);
-				});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除店铺公告
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteById(@PathVariable Long id) {
-		Long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		noticeUserMapper.delete(Wrappers.lambdaQuery(MirrorNoticeUser.class)
-				.eq(MirrorNoticeUser::getId, id)
-				.eq(MirrorNoticeUser::getUserId, userId));
-		refreshCacheService.refreshUserMirrorShopAdvertiseCache(userId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 标记公告已读
-	 */
-	@PostMapping("/mark/{id}")
-	public Result<String> markNotice(@PathVariable Long id) {
-		Long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		MirrorNoticeUserReviewRecord mirrorNoticeUserReviewRecord = Optional.ofNullable(mirrorNoticeUserReviewRecordMapper.selectOne(Wrappers.lambdaQuery(MirrorNoticeUserReviewRecord.class)
-				.eq(MirrorNoticeUserReviewRecord::getNoticeId, id)
-				.eq(MirrorNoticeUserReviewRecord::getUserId, userId)
-				.last("limit 1"))).orElse(new MirrorNoticeUserReviewRecord());
-
-		try {
-			if (mirrorNoticeUserReviewRecord.getId() == null) {
-				mirrorNoticeUserReviewRecord.setNoticeId(id);
-				mirrorNoticeUserReviewRecord.setUserId(userId);
-				mirrorNoticeUserReviewRecordMapper.insert(mirrorNoticeUserReviewRecord);
-			}
-		} catch (DuplicateKeyException e) {
-
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 批量同步银河后台公告
-	 */
-	@PostMapping("/sync/background/notice")
-	public Result<String> syncBackgroundNotice(@RequestBody @Validated BatchIdsReq batchIdsReq) {
-		Long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		mirrorNoticeMapper.selectBatchIds(batchIdsReq.getIds()).forEach(backNotice -> {
-			MirrorNoticeUser mirrorNoticeUser = noticeUserMapper.selectOne(Wrappers.lambdaQuery(MirrorNoticeUser.class)
-					.eq(MirrorNoticeUser::getNoticeId, backNotice.getId())
-					.eq(MirrorNoticeUser::getUserId, userId)
-					.last("limit 1"));
-			if (mirrorNoticeUser == null) {
-				try {
-					mirrorNoticeUser = new MirrorNoticeUser();
-					mirrorNoticeUser.setNoticeId(backNotice.getId());
-					mirrorNoticeUser.setPlatform(backNotice.getPlatform());
-					mirrorNoticeUser.setTitle(backNotice.getTitle());
-					mirrorNoticeUser.setText(backNotice.getText());
-					mirrorNoticeUser.setUserId(userId);
-					noticeUserMapper.insert(mirrorNoticeUser);
-
-					MirrorNoticeUserReviewRecord mirrorNoticeUserReviewRecord = new MirrorNoticeUserReviewRecord();
-					mirrorNoticeUserReviewRecord.setNoticeId(backNotice.getId());
-					mirrorNoticeUserReviewRecord.setUserId(userId);
-					mirrorNoticeUserReviewRecordMapper.insert(mirrorNoticeUserReviewRecord);
-				} catch (DuplicateKeyException e) {
-
-				}
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 159
netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/manage/CmsUserMirrorShopController.java

@@ -1,159 +0,0 @@
-package com.cyksj.web.controller.manage.mirrorshop.manage;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserCertRecordMapper;
-import com.cyksj.mapper.mirrorshop.UserMirrorShopApplyRecordMapper;
-import com.cyksj.mapper.mirrorshop.UserMirrorShopMapper;
-import com.cyksj.model.entity.UserCertRecord;
-import com.cyksj.model.entity.UserMirrorShop;
-import com.cyksj.model.entity.UserMirrorShopApplyRecord;
-import com.cyksj.model.request.UserMirrorShopApplyMoneyReq;
-import com.cyksj.model.views.UserMirrorShopApplyInfoView;
-import com.cyksj.service.mirrorshop.CmsUserMirrorShopService;
-import com.cyksj.web.util.StpUserMirrorShopManageUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * admin/镜像店铺后台/店铺设置
- * 项目名: yhlxj2
- * 文件名: CmsUserMirrorShopController
- * 创建者: JavaZou
- * 创建时间:2024/11/7 16:10
- */
-@RestController
-@RequestMapping("/mirrorShop/manage")
-@RequiredArgsConstructor
-public class CmsUserMirrorShopController {
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final UserMirrorShopMapper userMirrorShopMapper;
-
-	private final UserMirrorShopApplyRecordMapper userMirrorShopApplyRecordMapper;
-
-	private final CmsUserMirrorShopService cmsUserMirrorShopService;
-
-	private final UserCertRecordMapper userCertRecordMapper;
-
-	/**
-	 * 店铺 信息详情
-	 */
-	@GetMapping("/get/shop/detail/data")
-	public Result<UserMirrorShop> getShopDetail() {
-		long yhShopUserId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		UserMirrorShop detailView = beanSearcher.searchFirst(UserMirrorShop.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(UserMirrorShop::getUserId, yhShopUserId)
-				.build());
-		UserMirrorShopApplyInfoView userMirrorShopApplyInfoView = beanSearcher.searchFirst(UserMirrorShopApplyInfoView.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(UserMirrorShopApplyInfoView::getUserId, yhShopUserId).orderBy(UserMirrorShopApplyInfoView::getId).desc().build());
-		detailView.setApplyInfoView(userMirrorShopApplyInfoView);
-
-		UserMirrorShopApplyRecord userMirrorShopApplyRecord = userMirrorShopApplyRecordMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShopApplyRecord.class)
-				.eq(UserMirrorShopApplyRecord::getUserId, yhShopUserId)
-				.ne(UserMirrorShopApplyRecord::getVerifyStatus, UserMirrorShopApplyRecord.Status.fail)
-				.orderByDesc(UserMirrorShopApplyRecord::getId)
-				.last("limit 1"));
-		if (userMirrorShopApplyRecord != null) {
-			detailView.setModifyTime(userMirrorShopApplyRecord.getCreatedTime());
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(detailView);
-	}
-
-	/**
-	 * 设置联系方式
-	 */
-	@PutMapping("/set/shop/contact")
-	public Result<String> setShopContact(@RequestBody UserMirrorShop yhShop) {
-		long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		String contact = yhShop.getContact();
-		UserMirrorShop userMirrorShop = userMirrorShopMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShop.class)
-				.eq(UserMirrorShop::getUserId, userId).last("limit 1"));
-		if (userMirrorShop == null) {
-			throw BusinessRuntimeException.getInstance("店铺不存在");
-		}
-		userMirrorShop.setContact(contact);
-		userMirrorShop.setQrCode(yhShop.getQrCode());
-		userMirrorShopMapper.updateById(userMirrorShop);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 申请修改
-	 */
-	@PutMapping("/update/shop")
-	@Transactional(rollbackFor = Throwable.class)
-	public Result<String> updateShop(@RequestBody UserMirrorShopApplyRecord record) {
-		long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		UserMirrorShop userMirrorShop = userMirrorShopMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShop.class)
-				.eq(UserMirrorShop::getUserId, userId).last("limit 1"));
-		String name = record.getName();
-		if (userMirrorShop == null) {
-			throw BusinessRuntimeException.getInstance("店铺不存在");
-		}
-		if (StrUtil.isEmpty(name)) {
-			throw BusinessRuntimeException.getInstance("请输入申请修改的店铺名");
-		}
-		//是否存在正在修改的提交记录
-		UserMirrorShopApplyRecord userMirrorShopApplyRecord = userMirrorShopApplyRecordMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShopApplyRecord.class)
-				.eq(UserMirrorShopApplyRecord::getUserId, userId)
-				.eq(UserMirrorShopApplyRecord::getVerifyStatus, UserMirrorShopApplyRecord.Status.verify).last("limit 1"));
-
-		if (userMirrorShopApplyRecord != null) {
-			throw BusinessRuntimeException.getInstance("您提交的修改申请正在审核中..");
-		}
-		//三个月可修改一次
-		Integer count = userMirrorShopApplyRecordMapper.selectCount(Wrappers.lambdaQuery(UserMirrorShopApplyRecord.class)
-				.eq(UserMirrorShopApplyRecord::getUserId, userId)
-				.isNull(UserMirrorShopApplyRecord::getCustomId)
-				.eq(UserMirrorShopApplyRecord::getVerifyStatus, UserMirrorShopApplyRecord.Status.success)
-				.ge(UserMirrorShopApplyRecord::getCreatedTime, DateUtil.offsetMonth(DateTime.now(), -3)));
-		if (count > 0) {
-			throw BusinessRuntimeException.getInstance("近三个月只可修改一次");
-		}
-		userMirrorShopApplyRecord = new UserMirrorShopApplyRecord();
-		userMirrorShopApplyRecord.setVerifyStatus(UserMirrorShopApplyRecord.Status.verify);
-		userMirrorShopApplyRecord.setName(name);
-		userMirrorShopApplyRecord.setLogo(record.getLogo());
-		userMirrorShopApplyRecord.setUserId(userId);
-		userMirrorShopApplyRecordMapper.insert(userMirrorShopApplyRecord);
-
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 申请 提现
-	 */
-	@PostMapping("/apply/money")
-	public Result<String> yhShopApplyMoney(@RequestBody UserMirrorShopApplyMoneyReq applyMoneyReq) throws Exception {
-		long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		applyMoneyReq.setUserId(userId);
-		return cmsUserMirrorShopService.applyMoney(applyMoneyReq);
-	}
-
-
-	/**
-	 * 身份认证信息
-	 */
-	@GetMapping("/get/cert/info")
-	public Result<UserCertRecord> getCertInfo() {
-		long userId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		UserCertRecord record = userCertRecordMapper.selectOne(Wrappers.lambdaQuery(UserCertRecord.class)
-				.eq(UserCertRecord::getUserId, userId)
-				.last("limit 1"));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(record);
-	}
-}

+ 0 - 231
netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/manage/CmsUserMirrorShopDataController.java

@@ -1,231 +0,0 @@
-package com.cyksj.web.controller.manage.mirrorshop.manage;
-
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonMapper;
-import com.cyksj.mapper.mirrorshop.UserMirrorShopMapper;
-import com.cyksj.model.entity.*;
-import com.cyksj.model.views.*;
-import com.cyksj.service.mirrorshop.CmsUserMirrorShopService;
-import com.cyksj.web.util.StpUserMirrorShopManageUser;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- * admin/镜像店铺后台/数据
- * 项目名: yhlxj2
- * 文件名: CmsUserMirrorShopDataController
- * 创建者: JavaZou
- * 创建时间:2024/11/7 12:03
- */
-@RestController
-@RequestMapping("/mirrorShop/manage/data")
-@RequiredArgsConstructor
-public class CmsUserMirrorShopDataController {
-	private final UserMirrorShopMapper userMirrorShopMapper;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	private final CmsUserMirrorShopService cmsUserMirrorShopService;
-
-	private final GoodsDonMapper goodsDonMapper;
-
-
-
-	/**
-	 * 店铺分销平台数据详情
-	 */
-	@GetMapping("/get/distribute/detail/data")
-	public Result<YhShopUserDistributeDetailView> getDistributeDetail() {
-		long yhShopUserId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		User user = beanSearcher.searchFirst(User.class, MapUtils.builder().field(User::getId, yhShopUserId).onlySelect(User::getMpMoney).build());
-		BigDecimal wApplyMoney = user.getMpMoney().divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN);
-		//已提现
-		Number gotApplyMoney = beanSearcher.searchSum(UserMirrorShopDistributeMoneyApply.class, MapUtils.builder()
-				.field(UserMirrorShopDistributeMoneyApply::getUserId, yhShopUserId)
-				.field(UserMirrorShopDistributeMoneyApply::getVerifyStatus, YhShopDistributeMoneyApply.Status.success.name())
-				.build(), "money");
-		Number reMoneyPoints = beanSearcher.searchSum(UserMirrorShopDistributeWaitingSendPoints.class, MapUtils.builder().field(UserMirrorShopDistributeWaitingSendPoints::getShopUserId, yhShopUserId).field(UserMirrorShopDistributeWaitingSendPoints::getSendStatus, UserMirrorShopDistributeWaitingSendPoints.Status.success.name()).build(), "money");
-		Number wMoneyPoints = beanSearcher.searchSum(UserMirrorShopDistributeWaitingSendPoints.class, MapUtils.builder().field(UserMirrorShopDistributeWaitingSendPoints::getShopUserId, yhShopUserId).field(UserMirrorShopDistributeWaitingSendPoints::getSendStatus, UserMirrorShopDistributeWaitingSendPoints.Status.waiting.name()).build(), "money");
-
-		YhShopUserDistributeDetailView detailView = new YhShopUserDistributeDetailView();
-		detailView.setWMoney(BigDecimal.valueOf(wMoneyPoints.doubleValue()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
-		detailView.setReMoney(BigDecimal.valueOf(reMoneyPoints.doubleValue()).divide(BigDecimal.valueOf(100),2,RoundingMode.DOWN));
-
-		detailView.setWApplyMoney(wApplyMoney);
-		detailView.setGotApplyMoney(BigDecimal.valueOf(gotApplyMoney.doubleValue()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
-		return GatewayResponse.SUCCESS.newBuilder().toResult(detailView);
-	}
-
-
-
-	/**
-	 * 店铺待入账数据统计
-	 */
-	@GetMapping("/get/wMoney/statisticsData")
-	public Result<YhShopBrokenLineCpsUserWMoneyView> getWMoneyStatisticsDataView(Long firstDate, Long lastDate) {
-		long yhShopUserId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		DateTime first = null;
-		DateTime end = null;
-		if (firstDate != null) {
-			first = DateUtil.date(firstDate);
-		}
-		if (lastDate != null) {
-			end = DateUtil.date(lastDate);
-		}
-		YhShopBrokenLineCpsUserWMoneyView brokenLineCpsUserWMoneyView = Optional.ofNullable(cmsUserMirrorShopService.getWMoneyStatisticsDate(yhShopUserId, first, end)).orElse(new YhShopBrokenLineCpsUserWMoneyView());
-		List<YhShopUserWMoneyStatisticsDataView> dataView = cmsUserMirrorShopService.getWMoneyStatisticsDataView(yhShopUserId, first, end);
-		brokenLineCpsUserWMoneyView.setDataView(dataView);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineCpsUserWMoneyView);
-	}
-
-	/**
-	 * 数据中心折线图
-	 */
-	@GetMapping("/get/data/brokenLine")
-	public Result<UserMirrorShopOrderDataStatisticsView> getDataBrokenLine(Long firstDate, Long lastDate) {
-		long yhShopUserId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		UserMirrorShop userMirrorShop = userMirrorShopMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShop.class)
-				.eq(UserMirrorShop::getUserId, yhShopUserId)
-				.last("limit 1"));
-		String first = null;
-		String end = null;
-		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd");
-		}
-		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
-		}
-		UserMirrorShopOrderDataStatisticsView brokenLineObjView = Optional.ofNullable(userMirrorShopMapper.selectOrderBrokenLineMoney(userMirrorShop.getId(), first, end))
-				.orElse(new UserMirrorShopOrderDataStatisticsView());
-
-		if (brokenLineObjView != null) {
-			String timeSql = StrUtil.EMPTY;
-			if (firstDate != null) {
-				first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
-				timeSql += String.format(" and o.created_time >= '%s'", first);
-			}
-			if (lastDate != null) {
-				end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
-				timeSql += String.format(" and o.created_time < '%s'", end);
-			}
-			MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-			if (StrUtil.isNotEmpty(timeSql)) {
-				builder.put("time", timeSql);
-			}
-			builder.put("mid", String.format(" and mp_id = %s", userMirrorShop.getId()));
-			List<UserMirrorShopOrderView> views = beanSearcher.searchAll(UserMirrorShopOrderView.class,builder.build());
-			Map<Long, List<UserMirrorShopOrderView>> goodsMap = views.stream().collect(Collectors.groupingBy(UserMirrorShopOrderView::getGoodsId));
-			brokenLineObjView.setGoodsData(goodsMap);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineObjView);
-	}
-
-	/**
-	 * 店铺分销订单收入统计
-	 */
-	@GetMapping("/get/distribute/orders/statisticsData")
-	public Result<SearchResult<UserMirrorShopDsOrderStatisticsView>> getUserDistributeOrdersStatisticsView(Long firstDate, Long lastDate) {
-		long yhShopUserId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		UserMirrorShop yhShop = userMirrorShopMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShop.class)
-				.eq(UserMirrorShop::getUserId, yhShopUserId).last("limit 1"));
-		String first = null;
-		String end = null;
-		String timeSql = StrUtil.EMPTY;
-		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time >= '%s'", first);
-		}
-		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time < '%s'", end);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("yhs_id", String.format("uor.mp_id = %s", yhShop.getId()));
-		if (StrUtil.isNotEmpty(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		SearchResult<UserMirrorShopDsOrderStatisticsView> search = beanSearcher.search(UserMirrorShopDsOrderStatisticsView.class, builder.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 店铺分销订单收入详细
-	 */
-	@GetMapping("/get/distribute/orders/detail/data")
-	public Result<SearchResult> getUserDistributeOrdersDetailView(@RequestParam(defaultValue = "1") Integer type, Long firstDate, Long lastDate) {
-		long yhShopUserId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		UserMirrorShop yhShop = userMirrorShopMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShop.class)
-				.eq(UserMirrorShop::getUserId, yhShopUserId).last("limit 1"));
-		String first = null;
-		String end = null;
-		String timeSql = StrUtil.EMPTY;
-		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time >= '%s'", first);
-		}
-		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
-			timeSql += String.format(" and o.created_time < '%s'", end);
-		}
-		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		builder.put("yhs_id", String.format("mp_id = %s", yhShop.getId()));
-		if (StrUtil.isNotEmpty(timeSql)) {
-			builder.put("time", timeSql);
-		}
-		SearchResult search;
-		if (type == 1) {
-			search = beanSearcher.search(UserMirrorShopDsOrderDetailView.class, builder.build());
-		} else {
-			//加盟订单提成
-			search = beanSearcher.search(UserMirrorShopDsJoinOrderDetailView.class, builder.build());
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 店铺分销商品列表
-	 */
-	@GetMapping("/get/orders/goods")
-	public Result<List<GoodsDon>> getGoodsList() {
-		long yhShopUserId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		UserMirrorShop yhShop = userMirrorShopMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShop.class)
-				.eq(UserMirrorShop::getUserId, yhShopUserId).last("limit 1"));
-		if (yhShop == null) {
-			return GatewayResponse.SUCCESS.newBuilder().toResult();
-		}
-		List<GoodsDon> goodsDons = goodsDonMapper.getUserMirrorShopShopDistributeGoodsDetail(yhShop.getId());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDons);
-	}
-
-	/**
-	 * 提现记录
-	 */
-	@GetMapping("/get/apply/money")
-	public Result<SearchResult<UserMirrorShopDistributeMoneyApply>> getApplyMoney() {
-		long yhShopUserId = StpUserMirrorShopManageUser.getLoginIdAsLong();
-		SearchResult<UserMirrorShopDistributeMoneyApply> search = beanSearcher.search(UserMirrorShopDistributeMoneyApply.class, MapUtils.flatBuilder(request.getParameterMap()).field(UserMirrorShopDistributeMoneyApply::getUserId, yhShopUserId).orderBy(UserMirrorShopDistributeMoneyApply::getId).desc().build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 173
netflix-web/src/main/java/com/cyksj/web/controller/manage/mirrorshop/manage/CmsUserMirrorShopLoginController.java

@@ -1,173 +0,0 @@
-package com.cyksj.web.controller.manage.mirrorshop.manage;
-
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.NoSubmit;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.snowflake.Sequence;
-import com.cyksj.common.util.Codec;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.config.wxlogin.WxOpenPlatYHLXLoginConfig;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.mirrorshop.UserMirrorShopMapper;
-import com.cyksj.model.dto.AuthRedirect;
-import com.cyksj.model.dto.AuthToken;
-import com.cyksj.model.dto.CpsAuthDto;
-import com.cyksj.model.dto.GzhOAuth2UserInfo;
-import com.cyksj.model.entity.User;
-import com.cyksj.model.entity.UserMirrorShop;
-import com.cyksj.model.request.LoginReq;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.authorization.AuthorizationService;
-import com.cyksj.service.mirrorshop.CmsUserMirrorShopService;
-import com.cyksj.service.wechat.WeChatService;
-import com.cyksj.web.util.StpUserMirrorShopManageUser;
-import com.cyksj.web.util.StpUserUtil;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Optional;
-
-/**
- * admin/镜像店铺后台/登录
- * 项目名: yhlxj2
- * 文件名: CmsUserMirrorShopLoginController
- * 创建者: JavaZou
- * 创建时间:2024/11/7 12:03
- */
-@RestController
-@RequestMapping("/mirrorShop/manage")
-@RequiredArgsConstructor
-public class CmsUserMirrorShopLoginController {
-	private final CmsUserMirrorShopService cmsUserMirrorShopService;
-
-	private final RedisService redisService;
-
-	private final static Sequence SEQUENCE = new Sequence(0);
-
-	private final WxOpenPlatYHLXLoginConfig wxOpenPlatYHLXLoginConfig;
-
-	private final AuthorizationService authorizationService;
-
-	private final WeChatService weChatService;
-
-	private final UserMapper userMapper;
-
-	private final UserMirrorShopMapper userMirrorShopMapper;
-
-	/**
-	 * 获取登录验证码
-	 */
-	@GetMapping("/get/LoginCode")
-	@NoSubmit
-	public Result getLoginCode(@RequestParam(defaultValue = "1") Integer type, String login, Integer cid) {
-		cmsUserMirrorShopService.getLoginCode(type, login, cid);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 跳转店铺后台 是否是店铺主
-	 */
-	@GetMapping("/redirect")
-	public void yhShopManageRedirect(String redirectUrl, HttpServletResponse response) throws IOException {
-		//银河官网token值
-		long userId = StpUserUtil.getLoginIdAsLong();
-		cmsUserMirrorShopService.yhShopManageRedirect(userId);
-		//校验通过重定向
-		StpUserMirrorShopManageUser.login(userId);
-		response.sendRedirect(redirectUrl.contains("?") ? redirectUrl + "&t=" + StpUserMirrorShopManageUser.getTokenValue() : redirectUrl + "?t=" + StpUserMirrorShopManageUser.getTokenValue());
-	}
-
-
-	/**
-	 * 手机号、邮箱登录
-	 */
-	@PostMapping("/login")
-	public Result login(@RequestBody LoginReq loginReq) {
-		User user = cmsUserMirrorShopService.login(loginReq.getType(), loginReq.getLogin(), loginReq.getCode());
-		StpUserMirrorShopManageUser.login(user.getId());
-		String yhShopToken = StpUserMirrorShopManageUser.getTokenValue();
-		JSONObject re = new JSONObject();
-		re.putOpt("satoken-ump", yhShopToken);
-		re.putOpt("img", user.getHeadimgurl());
-		re.putOpt("nickname", user.getNickname());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(re.toString());
-	}
-
-	/**
-	 * 小店后台微信授权登录
-	 */
-	@GetMapping("/wx/authLogin")
-	public Result<CpsAuthDto> wxAuthorize() throws Exception {
-		Object authUrlObj = redisService.get(RedisService.key.WX_LOGIN_AUTH_URI.getNameFormat("ump", wxOpenPlatYHLXLoginConfig.getAppId()));
-		if (authUrlObj != null) {
-			CpsAuthDto cpsAuthDto = Jsons.parseObject(authUrlObj.toString(), CpsAuthDto.class);
-			return GatewayResponse.SUCCESS.newBuilder().toResult(cpsAuthDto);
-		}
-		CpsAuthDto cpsAuthDto = new CpsAuthDto();
-		Long mappingId = SEQUENCE.nextId();
-		String authState = mappingId.toString();
-		redisService.set(authState, authState, 60 * 60 * 24L);
-		AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId);
-		String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
-		String wxAuthUrl = authorizationService.createWxAuthLoginUrl(state, wxOpenPlatYHLXLoginConfig.getAppId(), wxOpenPlatYHLXLoginConfig.getUserMirrorShopRedirectUri());
-		cpsAuthDto.setAuthUrl(wxAuthUrl);
-		cpsAuthDto.setAuthState(authState);
-		redisService.set(RedisService.key.WX_LOGIN_AUTH_URI.getNameFormat("ump", wxOpenPlatYHLXLoginConfig.getAppId()), Jsons.toJson(cpsAuthDto), RedisService.key.WX_LOGIN_AUTH_URI.getTimeout());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(cpsAuthDto);
-	}
-
-	/**
-	 * 网页微信授权后跳转
-	 */
-	@GetMapping("/wx/authLogin/baseRedirect")
-	public void wxAuthLoginRedirect(String code, String state, HttpServletResponse response) throws Exception {
-		if (StrUtil.isEmpty(state)) throw BusinessRuntimeException.getInstance("授权错误,请重新授权");
-		String json = Codec.DoBase64.custom().setData(state).decodeAsText();
-		AuthRedirect re = Jsons.parseObject(json, AuthRedirect.class);
-		AuthToken token = weChatService.getAuthToken(code, wxOpenPlatYHLXLoginConfig.getAppId());
-		GzhOAuth2UserInfo userinfo = weChatService.getUserInfo(token.getAccessToken(), token.getOpenid());
-		String unionId = userinfo.getUnionid();
-		String openId = userinfo.getOpenid();
-		User user = Optional.ofNullable(
-						userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getUnionid, unionId)
-								.orderByAsc(User::getId)
-								.last("limit 1")))
-				.orElseGet(() -> userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getOpenId, openId)
-						.orderByAsc(User::getId)
-						.last("limit 1")));
-		if (user == null) throw BusinessRuntimeException.getInstance("用户信息不存在");
-		//是否是店铺主
-		UserMirrorShop shop = userMirrorShopMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShop.class)
-				.eq(UserMirrorShop::getUserId, user.getId()).last("limit 1"));
-		if (shop == null) {
-			throw BusinessRuntimeException.getInstance("您不是小店店铺主");
-		}
-		JSONObject res = new JSONObject();
-		StpUserMirrorShopManageUser.login(user.getId());
-		String cpsToken = StpUserMirrorShopManageUser.getTokenValue();
-		res.putOpt("satoken-ump", cpsToken);
-		res.putOpt("img", user.getHeadimgurl());
-		res.putOpt("nickname", user.getNickname());
-		redisService.set(RedisService.key.USER_MIRROR_SHOP_AUTH_SUCCESS_KEY.getNameFormat(re.getMappingId()), res.toString(), RedisService.key.USER_MIRROR_SHOP_AUTH_SUCCESS_KEY.getTimeout());
-		response.sendRedirect(wxOpenPlatYHLXLoginConfig.getUserMirrorShopLoginUrl());
-	}
-
-	/**
-	 * 店铺用户是否已授权
-	 */
-	@GetMapping("/get/userInfo")
-	public Result<String> getCpsUserInfo(String authState) {
-		String key = RedisService.key.USER_MIRROR_SHOP_AUTH_SUCCESS_KEY.getNameFormat(authState);
-		Object o = redisService.get(key);
-		if (o == null) return GatewayResponse.SUCCESS.newBuilder().toResult();
-		redisService.del(key);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(o.toString());
-	}
-}

+ 0 - 181
netflix-web/src/main/java/com/cyksj/web/controller/manage/mj/MidJourneyController.java

@@ -1,181 +0,0 @@
-package com.cyksj.web.controller.manage.mj;
-
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONObject;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.MidjourneySessionMapper;
-import com.cyksj.model.entity.ChatgptSession;
-import com.cyksj.model.entity.MidjourneyAccount;
-import com.cyksj.model.entity.MidjourneySession;
-import com.cyksj.model.manage.views.AccountView;
-import com.cyksj.model.views.ChatgptCarSessionView;
-import com.cyksj.model.views.MidjourneyAccountView;
-import com.cyksj.model.views.MidjourneyCarSessionView;
-import com.cyksj.redis.RedisService;
-import com.cyksj.service.midjourney.MidjourneyAccountService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Optional;
-
-/**
- * @author zwhui
- * @date 2024/4/15 14:38
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/mj")
-public class MidJourneyController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final MidjourneyAccountService midjourneyAccountService;
-
-    private final MidjourneySessionMapper midjourneySessionMapper;
-
-    private final RedisService redisService;
-
-
-    /**
-     * 移入MJ账号池
-     */
-    @PostMapping("/addAccount")
-    public Result<Void> addAccount(@RequestBody MidjourneyAccount midjourneyAccount) throws Exception {
-        log.info("移入MJ账号池 midjourneyAccount:{}", midjourneyAccount);
-        midjourneyAccountService.addAccount(midjourneyAccount);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 移除MJ账号池
-     */
-    @DeleteMapping("/removeAccount/{id}")
-    public Result<Void> removeAccount(@PathVariable Long id) {
-        log.info("移除MJ账号池 id:{}", id);
-        midjourneyAccountService.removeAccount(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 修改MJ账号池
-     */
-    @PutMapping("/updateAccount")
-    public Result<Void> updateAccount(@RequestBody MidjourneyAccount midjourneyAccount) {
-        log.info("修改MJ账号池 midjourneyAccount:{}", midjourneyAccount);
-        midjourneyAccountService.updateAccount(midjourneyAccount);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 上下架MJ账号
-     */
-    @PutMapping("/updateStatus/{id}")
-    public Result<Void> updateStatus(@PathVariable Long id) {
-        log.info("上下架MJ账号 id:{}", id);
-        midjourneyAccountService.updateStatus(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 同步账号信息
-     */
-    @PutMapping("/syncAccount/{id}")
-    public Result<Void> syncAccount(@PathVariable Long id) {
-        log.info("同步账号信息 id:{}", id);
-        midjourneyAccountService.syncAccount(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 查询账号池列表
-     */
-    @GetMapping("/getAccount")
-    public Result<SearchResult<MidjourneyAccountView>> getAccount(String expiryStartTime, String expiryEndTime) {
-        log.info("查询账号池列表");
-        MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
-        if (StrUtil.isNotEmpty(expiryStartTime) || StrUtil.isNotEmpty(expiryEndTime)) {
-            mapBuilder.field(MidjourneyAccountView::getExpiryTime, expiryStartTime, expiryEndTime)
-                    .op(Operator.Between);
-        }
-        SearchResult<MidjourneyAccountView> search = beanSearcher.search(MidjourneyAccountView.class, mapBuilder.build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-
-
-    /**
-     * 获取镜像车队账号列表
-     */
-    @GetMapping("/get/midjourneyCar")
-    public Result<SearchResult<MidjourneyCarSessionView>> getMirrorCarSession() {
-        SearchResult<MidjourneyCarSessionView> search = beanSearcher.search(MidjourneyCarSessionView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .orderBy(MidjourneyCarSessionView::getId).desc()
-                .build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 编辑镜像车队账号列表
-     */
-    @PutMapping("/update/midjourneyCar")
-    public Result<String> updateMirrorCarSession(@RequestBody MidjourneySession midjourneySession) {
-        Integer selectCount = midjourneySessionMapper.selectCount(Wrappers.lambdaQuery(MidjourneySession.class)
-                .and(e -> e.eq(MidjourneySession::getEmail, midjourneySession.getEmail())
-                        .or().eq(MidjourneySession::getCarId, midjourneySession.getCarId()))
-                .ne(MidjourneySession::getId, midjourneySession.getId()));
-        if (selectCount > 0) {
-            throw BusinessRuntimeException.getInstance("请检验车队ID或账号是否已存在");
-        }
-        midjourneySessionMapper.updateById(midjourneySession);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 删除镜像车队账号
-     */
-    @DeleteMapping("/delete/midjourneyCar/{id}")
-    public Result<String> deleteMirrorCarSession(@PathVariable Long id) {
-        Optional.ofNullable(midjourneySessionMapper.selectById(id))
-                .ifPresent(e -> {
-                    String carId = e.getCarId();
-                    if (StrUtil.isNotBlank(carId)) {
-                        midjourneySessionMapper.deleteById(e.getId());
-                        String carKey = RedisService.key.MIDJOURNEY_CAR_TASK.getName() + carId;
-                        //从zSet中删除车队
-                        redisService.del(carKey);
-                    }
-                });
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 新增镜像车队账号
-     */
-    @PostMapping("/post/midjourney/car/session")
-    public Result<String> postMirrorCarSession(@RequestBody MidjourneySession midjourneySession) {
-        Integer selectCount = midjourneySessionMapper.selectCount(Wrappers.lambdaQuery(MidjourneySession.class)
-                .eq(MidjourneySession::getCarId, midjourneySession.getCarId()).or().eq(MidjourneySession::getEmail, midjourneySession.getEmail()));
-        if (selectCount > 0) {
-            throw BusinessRuntimeException.getInstance("请检验车队ID或账号是否已存在");
-        }
-        midjourneySessionMapper.insert(midjourneySession);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-}

+ 0 - 107
netflix-web/src/main/java/com/cyksj/web/controller/manage/mj/MidjourneyPaintingController.java

@@ -1,107 +0,0 @@
-package com.cyksj.web.controller.manage.mj;
-
-import cn.hutool.core.collection.CollUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.MidjourneyPaintingPlaza;
-import com.cyksj.service.midjourney.MidjourneyPaintingPlazaService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * 项目名: yhlxj
- * 文件名: MidjourneyPaintingController
- * 创建者: JavaZou
- * 创建时间:2024/6/3 17:24
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/mj/painting")
-public class MidjourneyPaintingController {
-	private final MidjourneyPaintingPlazaService midjourneyPaintingPlazaService;
-
-	private final BeanSearcher beanSearcher;
-
-	private final HttpServletRequest request;
-
-	/**
-	 * 新增记录
-	 */
-	@PostMapping("/post")
-	public Result<String> savePainting(@RequestBody MidjourneyPaintingPlaza midjourneyPaintingPlaza) {
-		midjourneyPaintingPlazaService.saveOrUpdatePainting(midjourneyPaintingPlaza);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除记录
-	 */
-	@DeleteMapping("/delete/{id}")
-	public Result<String> deleteById(@PathVariable Long id) {
-		MidjourneyPaintingPlaza byId = midjourneyPaintingPlazaService.getById(id);
-		if (byId != null && byId.getDeleted()) {
-			byId.setDeleted(false);
-			midjourneyPaintingPlazaService.updateById(byId);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-
-	/**
-	 * 修改记录
-	 */
-	@PutMapping("/update")
-	public Result<String> updatePainting(@RequestBody MidjourneyPaintingPlaza midjourneyPaintingPlaza) {
-		midjourneyPaintingPlazaService.saveOrUpdatePainting(midjourneyPaintingPlaza);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 列表
-	 */
-	@GetMapping("/get")
-	public Result<SearchResult<MidjourneyPaintingPlaza>> saveOrUpdatePainting() {
-		SearchResult<MidjourneyPaintingPlaza> search = beanSearcher.search(MidjourneyPaintingPlaza.class, MapUtils.flatBuilder(request.getParameterMap())
-				.field(MidjourneyPaintingPlaza::getDeleted, 1)
-				.build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-
-	/**
-	 * 上下架
-	 */
-	@PutMapping("/update/status/{id}")
-	public Result<String> updateStatus(@PathVariable Long id) {
-		MidjourneyPaintingPlaza byId = midjourneyPaintingPlazaService.getById(id);
-		if (byId != null) {
-			byId.setStatus(!byId.getStatus());
-			midjourneyPaintingPlazaService.updateById(byId);
-		}
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 批量上下架
-	 */
-	@PutMapping("/update/status")
-	public Result<String> updateStatus(@RequestParam(value = "ids") List<Long> ids, Boolean status) {
-		if (CollUtil.isEmpty(ids) || status == null) {
-			throw BusinessRuntimeException.getInstance("参数错误");
-		}
-		midjourneyPaintingPlazaService.update(null, Wrappers.lambdaUpdate(MidjourneyPaintingPlaza.class)
-				.set(MidjourneyPaintingPlaza::getStatus, status)
-				.in(MidjourneyPaintingPlaza::getId, ids)
-				.ne(MidjourneyPaintingPlaza::getStatus, status));
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-}

+ 0 - 212
netflix-web/src/main/java/com/cyksj/web/controller/manage/register/CmsRegisterController.java

@@ -1,212 +0,0 @@
-package com.cyksj.web.controller.manage.register;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.support.ExcelTypeEnum;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.IoKit;
-import com.cyksj.common.util.Xmls;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.AppleAutoRegisterDataMapper;
-import com.cyksj.mapper.SpotifyUnLimitRecordMapper;
-import com.cyksj.model.entity.AppleAutoRegisterData;
-import com.cyksj.model.entity.RegisterOrderDon;
-import com.cyksj.model.entity.SpotifyUnLimitRecord;
-import com.cyksj.model.excel.ExcelAppleIdTemplateData;
-import com.cyksj.model.excel.listener.ExcelAppleDataListener;
-import com.cyksj.model.request.OrderRefundReq;
-import com.cyksj.model.views.AppleIdCountryOrAreaDataView;
-import com.cyksj.model.views.AppleIdHeadDataView;
-import com.cyksj.model.views.AppleIdRegisterView;
-import com.cyksj.service.mange.SpotifySendMsgService;
-import com.cyksj.service.register.RegisterOrderDonService;
-import com.cyksj.web.util.EasyExcelUtils;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.OutputStream;
-import java.util.Map;
-
-/**
- * @author chan
- * @date 2022/11/7 1:49 PM
- */
-@Slf4j
-@RestController
-@RequestMapping("/manage/register")
-@RequiredArgsConstructor
-public class CmsRegisterController {
-
-    private final RegisterOrderDonService registerOrderDonService;
-
-    private final BeanSearcher beanSearcher;
-
-    private final HttpServletRequest request;
-
-    private final AppleAutoRegisterDataMapper appleAutoRegisterDataMapper;
-
-    private final SpotifyUnLimitRecordMapper spotifyUnLimitRecordMapper;
-
-    private final SpotifySendMsgService spotifySendMsgService;
-
-    @GetMapping("/get")
-    @SaCheckPermission("sign:view")
-    public Result<SearchResult<RegisterOrderDon>> get(Boolean appleIsAutoType) {
-        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        if (appleIsAutoType != null) {
-            if (appleIsAutoType) {
-                builder.field(RegisterOrderDon::getAppleAutoId).op(Operator.NotNull);
-            }else {
-                builder.field(RegisterOrderDon::getAppleAutoId).op(Operator.IsNull);
-            }
-        }
-        SearchResult<RegisterOrderDon> search = beanSearcher.search(RegisterOrderDon.class, builder.build());
-        search.getDataList().forEach(data->{
-            if (data.getAppleIsAutoType()) {
-                data.setCountry(data.getCountryOrArea().getDesc());
-                data.setEmail(data.getApplePwdId());
-            }
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    @PutMapping("/update")
-    public Result<RegisterOrderDon> update(@RequestBody RegisterOrderDon registerOrderDon){
-        registerOrderDonService.updateById(registerOrderDon);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(registerOrderDon);
-    }
-
-    /**
-     * 下载apple id 导入模板
-     */
-    @GetMapping("/get/appleId/template")
-    public void appleIdTemplate(HttpServletResponse response) {
-        EasyExcelUtils.createTemplateExcel(response, ExcelAppleIdTemplateData.class, "导入模板", "导入模板", ExcelTypeEnum.XLSX, null);
-    }
-
-    /**
-     * 导入apple Id注册数据
-     */
-    @PostMapping("/export/appleId/data")
-    public Result<String> exportRegisterAppleData(MultipartFile file, String remark, String countryOrArea) throws Exception {
-        EasyExcel.read(file.getInputStream(), ExcelAppleIdTemplateData.class, new ExcelAppleDataListener(appleAutoRegisterDataMapper, countryOrArea, remark)).sheet().doRead();
-        return GatewayResponse.SUCCESS.newBuilder().toResult("导入数据成功");
-    }
-
-    /**
-     * apple ID注册数据列表
-     */
-    @GetMapping("/get/appleId/list")
-    public Result<SearchResult<AppleIdRegisterView>> getAppleIdList(HttpServletRequest request) {
-        return GatewayResponse.SUCCESS.newBuilder().toResult(beanSearcher.search(AppleIdRegisterView.class, MapUtils.flatBuilder(request.getParameterMap()).build()));
-    }
-
-    /**
-     * apple ID头部数据
-     */
-    @GetMapping("/get/appleId/head")
-    public Result<AppleIdHeadDataView> getAppleIdHeadDataView() {
-        AppleIdCountryOrAreaDataView appleIdCountryOrAreaDataView = new AppleIdCountryOrAreaDataView();
-        appleIdCountryOrAreaDataView.setJapanAvaNum(appleAutoRegisterDataMapper.selectAreaDataView(AppleAutoRegisterData.CountryOrArea.JAPAN));
-        appleIdCountryOrAreaDataView.setHongKongAvaNum(appleAutoRegisterDataMapper.selectAreaDataView(AppleAutoRegisterData.CountryOrArea.CN_HongKong));
-        appleIdCountryOrAreaDataView.setUsAvaNum(appleAutoRegisterDataMapper.selectAreaDataView(AppleAutoRegisterData.CountryOrArea.US));
-        appleIdCountryOrAreaDataView.setTaiWanAvaNum(appleAutoRegisterDataMapper.selectAreaDataView(AppleAutoRegisterData.CountryOrArea.CN_TaiWan));
-        AppleIdHeadDataView appleIdHeadDataView = new AppleIdHeadDataView();
-        appleIdHeadDataView.setAreaDataView(appleIdCountryOrAreaDataView);
-        Integer avaAppleIdNum = appleAutoRegisterDataMapper.selectCount(Wrappers.lambdaQuery(AppleAutoRegisterData.class).eq(AppleAutoRegisterData::getStatus, false));
-        appleIdHeadDataView.setAvaAppleIdNum(avaAppleIdNum);
-        Integer usedAppleIdNum = appleAutoRegisterDataMapper.selectCount(Wrappers.lambdaQuery(AppleAutoRegisterData.class).eq(AppleAutoRegisterData::getStatus, true));
-        appleIdHeadDataView.setUsedAppleIdNum(usedAppleIdNum);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(appleIdHeadDataView);
-    }
-    /**
-     * 微信订单退款
-     */
-    @PostMapping("/wx/refund")
-    @SaCheckPermission("sign:refund")
-    public Result<String> wxRefund(@RequestBody @Validated OrderRefundReq refundReq) throws Exception {
-        RegisterOrderDon registerOrderDon = registerOrderDonService.getById(refundReq.getOrderId());
-        if (registerOrderDon==null) throw BusinessRuntimeException.getInstance("");
-        return registerOrderDonService.wxRefund(refundReq, registerOrderDon);
-    }
-
-    /**
-     * 微信退款回调
-     */
-    @PostMapping("/wx/refund/notify")
-    public void wxRefundNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        String xml = IoKit.toString(request.getInputStream());
-        log.info("=== 注册账号退款成功的回调: \n {}", xml);
-
-        // 解析xml
-        Map<String, String> map = Xmls.toMap(xml);
-
-        // 退款失败
-        if (!StrUtil.equals("SUCCESS", map.get("return_code"))) {
-            throw BusinessRuntimeException.getInstance("退款失败.");
-        }
-
-        registerOrderDonService.wxRefundNotify(map);
-
-        String toWechatXmlResponse = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
-
-        OutputStream out = null;
-        try {
-            out = response.getOutputStream();
-            IoKit.write(toWechatXmlResponse, out);
-        } catch (Throwable e) {
-            throw BusinessRuntimeException.getInstance(e == null ? null : e.getMessage());
-        } finally {
-            IoKit.close(out);
-        }
-    }
-
-    /**
-     * 注册 统一退款
-     */
-    @PostMapping("/unified/refund")
-    public Result<String> unifiedRefund(@RequestBody OrderRefundReq refundReq) throws Exception {
-        registerOrderDonService.unifiedRefund(refundReq);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 获取需要解除限制的账号列表
-     */
-    @GetMapping("/unLimit")
-    public Result<SearchResult<SpotifyUnLimitRecord>> getUnLimit(){
-        SearchResult<SpotifyUnLimitRecord> search = beanSearcher.search(SpotifyUnLimitRecord.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(SpotifyUnLimitRecord::getStatus,"Processing").build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-    }
-
-    /**
-     * 修改解除限制状态
-     */
-    @PutMapping("/unLimit")
-    public Result<String> upUnLimit(@RequestBody SpotifyUnLimitRecord spotifyUnLimitRecord) throws Exception {
-        spotifyUnLimitRecordMapper.update(null, Wrappers.lambdaUpdate(SpotifyUnLimitRecord.class)
-                .eq(SpotifyUnLimitRecord::getId, spotifyUnLimitRecord.getId())
-                .set(SpotifyUnLimitRecord::getStatus, spotifyUnLimitRecord.getStatus())
-                .set(SpotifyUnLimitRecord::getUpdateTime, DateTime.now())
-        );
-        if (spotifyUnLimitRecord.getStatus() == SpotifyUnLimitRecord.Status.Success) {
-            spotifySendMsgService.sendSpotifyUnLimitSuccessMsg(spotifyUnLimitRecord);
-        }
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-}

+ 0 - 132
netflix-web/src/main/java/com/cyksj/web/controller/manage/renew/RenewUpgradePackageController.java

@@ -1,132 +0,0 @@
-package com.cyksj.web.controller.manage.renew;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.annotation.Log;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.common.util.Jsons;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.BusinessType;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.model.entity.GoodsDonSku;
-import com.cyksj.model.entity.RenewUpgradePackage;
-import com.cyksj.model.views.RenewUpgradePackageView;
-import com.cyksj.service.mange.renew.RenewUpgradePackageService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * 项目名: yhlxj2
- * 文件名: RenewUpgradePackageController
- * 创建者: JavaZou
- * 创建时间:2024/7/18 16:59
- */
-@Slf4j
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/manage/renew/upgrade")
-public class RenewUpgradePackageController {
-	private final RenewUpgradePackageService renewUpgradePackageService;
-
-	private final HttpServletRequest request;
-
-	private final BeanSearcher beanSearcher;
-
-	private final GoodsDonSkuMapper goodsDonSkuMapper;
-
-	/**
-	 * 新增套餐
-	 */
-	@PostMapping
-	@SaCheckPermission("upgrade:add")
-	@Log(module = "套餐管理/新增套餐", businessType = BusinessType.POST, isSaveRequestData = true)
-	public Result<String> post(@RequestBody RenewUpgradePackage upgradePackage){
-		log.info("新增套餐:{}", upgradePackage);
-		renewUpgradePackageService.save(upgradePackage);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 修改套餐
-	 */
-	@PutMapping
-	@SaCheckPermission("upgrade:edit")
-	@Log(module = "套餐管理/修改套餐", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<String> put(@RequestBody RenewUpgradePackage upgradePackage){
-		log.info("修改套餐:{}", upgradePackage);
-		renewUpgradePackageService.updateById(upgradePackage);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 删除套餐
-	 */
-	@DeleteMapping("/{id}")
-	@SaCheckPermission("upgrade:delete")
-	@Log(module = "套餐管理/删除套餐", businessType = BusinessType.DELETE, isSaveRequestData = true)
-	public Result<String> delete(@PathVariable Long id){
-		log.info("删除套餐:{}", id);
-		RenewUpgradePackage byId = renewUpgradePackageService.getById(id);
-		if (byId == null){
-			throw BusinessRuntimeException.getInstance("套餐不存在");
-		}
-		byId.setDeleted(false);
-		renewUpgradePackageService.updateById(byId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult();
-	}
-
-	/**
-	 * 上下架套餐
-	 */
-	@PutMapping("/put/status/{id}")
-	@SaCheckPermission("upgrade:putStatus")
-	@Log(module = "套餐管理/上下架套餐", businessType = BusinessType.PUT, isSaveRequestData = true)
-	public Result<Boolean> putStatus(@PathVariable Long id){
-		log.info("上下架套餐:{}", id);
-		RenewUpgradePackage byId = renewUpgradePackageService.getById(id);
-		if (byId == null){
-			throw BusinessRuntimeException.getInstance("套餐不存在");
-		}
-		byId.setStatus(!byId.getStatus());
-		renewUpgradePackageService.updateById(byId);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(byId.getStatus());
-	}
-
-	/**
-	 * 获取套餐
-	 */
-	@GetMapping("/{id}")
-	public Result<RenewUpgradePackage> get(@PathVariable Long id){
-		log.info("获取套餐:{}", id);
-		RenewUpgradePackage byId = renewUpgradePackageService.getById(id);
-		return GatewayResponse.SUCCESS.newBuilder().toResult(byId);
-	}
-
-	/**
-	 * 获取套餐列表
-	 */
-	@GetMapping
-	public Result<SearchResult<RenewUpgradePackageView>> list(Long skuId) {
-		log.info("获取套餐列表");
-		Map<String, Object> build = MapUtils.flatBuilder(request.getParameterMap()).build();
-		SearchResult<RenewUpgradePackageView> search = beanSearcher.search(RenewUpgradePackageView.class, build);
-		search.getDataList().forEach(upgradePackageView -> {
-			try {
-				String specVal = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class).in(GoodsDonSku::getId, Jsons.parseList(upgradePackageView.getUpgradeSkuIds(), Long.class))).stream().map(GoodsDonSku::getSpecVal).collect(Collectors.joining(","));
-				upgradePackageView.setUpgradeSpecVal(specVal);
-			} catch (Exception e) {
-				throw BusinessRuntimeException.getInstance("获取套餐规格失败");
-			}
-		});
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
-	}
-}

+ 0 - 130
netflix-web/src/main/java/com/cyksj/web/controller/manage/shop/ShopConfigController.java

@@ -1,130 +0,0 @@
-package com.cyksj.web.controller.manage.shop;
-
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.hutool.core.util.RandomUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.mapper.ZfbShopOrderDayLimitMapper;
-import com.cyksj.model.entity.Channel;
-import com.cyksj.model.entity.ShopConfig;
-import com.cyksj.model.entity.ZfbShopOrderDayLimit;
-import com.cyksj.model.request.ChannelPayReq;
-import com.cyksj.service.mange.channel.ChannelService;
-import com.cyksj.service.mange.shop.ShopConfigService;
-import com.ejlchina.searcher.BeanSearcher;
-import com.ejlchina.searcher.SearchResult;
-import com.ejlchina.searcher.util.MapUtils;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * @author chan
- * @date 2022/12/13 4:53 PM
- */
-@RestController
-@RequestMapping("/manage/shop")
-@RequiredArgsConstructor
-@Slf4j
-public class ShopConfigController {
-
-    private final BeanSearcher beanSearcher;
-
-    private final ShopConfigService shopConfigService;
-
-    private final HttpServletRequest request;
-
-    private final ChannelService channelService;
-
-    private final ZfbShopOrderDayLimitMapper zfbShopOrderDayLimitMapper;
-
-    @GetMapping
-    @SaCheckPermission("merchant:view")
-    public Result<SearchResult<ShopConfig>> get(){
-        SearchResult<ShopConfig> searchResult = beanSearcher.search(ShopConfig.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        searchResult.getDataList().forEach((shopConfig)->{
-            shopConfig.setChannelCount(channelService.count(Wrappers.lambdaQuery(Channel.class).eq(Channel::getWxShopId,shopConfig.getAppId()).or().eq(Channel::getZfbShopId,shopConfig.getAppId())));
-        });
-        return GatewayResponse.SUCCESS.newBuilder().toResult(searchResult);
-    }
-
-    @PostMapping
-    public Result<String> post(@RequestBody ShopConfig shopConfig){
-        shopConfigService.save(shopConfig);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @PutMapping
-    public Result<String> put(@RequestBody ShopConfig shopConfig){
-        shopConfigService.updateById(shopConfig);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    @DeleteMapping("/{id}")
-    public Result<String> del(@PathVariable Long id){
-        shopConfigService.removeById(id);
-       return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 更换渠道支付方式
-     */
-    @PutMapping("/update/channel/pay")
-    @SaCheckPermission("merchant:updateChannelShop")
-    public Result<String> updateChannelPay(@RequestBody ChannelPayReq req) {
-        String wxShopId = req.getWxShopId();
-        String zfbShopId = req.getZfbShopId();
-        if (StrUtil.isAllEmpty(wxShopId, zfbShopId)) {
-            return GatewayResponse.SUCCESS.newBuilder().toResult();
-        }
-        channelService.update(Wrappers.lambdaUpdate(Channel.class)
-                .eq(StrUtil.isNotBlank(wxShopId), Channel::getWxShopId, wxShopId)
-                .eq(StrUtil.isNotBlank(zfbShopId), Channel::getZfbShopId, zfbShopId));
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 支付宝每日限单数 配置列表
-     */
-    @GetMapping("/get/zfb/limit")
-    public Result<List<ZfbShopOrderDayLimit>> getZfbShopOrderDayLimit() {
-        List<ZfbShopOrderDayLimit> orderDayLimits = beanSearcher.searchAll(ZfbShopOrderDayLimit.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-        return GatewayResponse.SUCCESS.newBuilder().toResult(orderDayLimits);
-    }
-
-    /**
-     * 编辑支付宝限制单数配置
-     */
-    @PutMapping("/update/zfb/limit")
-    public Result<String> updateZfbShopOrderDayLimit(ZfbShopOrderDayLimit zfbShopOrderDayLimit) {
-        zfbShopOrderDayLimitMapper.updateById(zfbShopOrderDayLimit);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-    /**
-     * 新增支付宝限制单数配置
-     */
-    @PostMapping("/save/zfb/limit")
-    public Result<String> saveZfbShopOrderDayLimit(@RequestBody ZfbShopOrderDayLimit zfbShopOrderDayLimit) {
-        zfbShopOrderDayLimit.setHourLimitOrders(RandomUtil.randomInt(zfbShopOrderDayLimit.getHourRandOrdersSt(), zfbShopOrderDayLimit.getHourRandOrdersEnd()));
-        zfbShopOrderDayLimit.setHourRemainOrders(zfbShopOrderDayLimit.getHourLimitOrders());
-        zfbShopOrderDayLimit.setDayRemainOrders(zfbShopOrderDayLimit.getDayLimitOrders());
-        zfbShopOrderDayLimitMapper.insert(zfbShopOrderDayLimit);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-    /**
-     * 新增支付宝限制单数配置
-     */
-    @DeleteMapping("/delete/zfb/limit/{id}")
-    public Result<String> saveZfbShopOrderDayLimit(@PathVariable Long id) {
-        zfbShopOrderDayLimitMapper.deleteById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-}

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio