Browse Source

Merge branch 'master' into lih

# Conflicts:
#	yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentDitchServiceImpl.java
hidewnd 5 days ago
parent
commit
3660ee8313

+ 11 - 8
ReadMe.md

@@ -820,7 +820,8 @@ question-service.jar > quick.log 2>&1 &
 
 ```shell
 # 青柠檬ios lemonios
-# 10.206.16.11  10.206.16.15
+# 10.206.16.11  
+# 10.206.16.15
 nohup java -jar -Xms3072m -Xmx3072m -XX:MaxMetaspaceSize=256M -XX:+UseCompressedOops \
 -XX:+UseG1GC -XX:ConcGCThreads=2 -XX:InitiatingHeapOccupancyPercent=35 \
 -XX:G1ReservePercent=10 -XX:MaxGCPauseMillis=300 \
@@ -833,7 +834,8 @@ lemonios-service.jar > lemonios.log 2>&1 &
 
 ```shell
 # 咕噜日记ios gollumios
-# 10.206.16.11  10.206.16.15
+# 10.206.16.11  
+# 10.206.16.15
 nohup java -jar -Xms2048m -Xmx2048m -XX:MaxMetaspaceSize=256M -XX:+UseCompressedOops \
 -XX:+UseG1GC -XX:ConcGCThreads=2 -XX:InitiatingHeapOccupancyPercent=35 \
 -XX:G1ReservePercent=10 -XX:MaxGCPauseMillis=300 \
@@ -857,7 +859,7 @@ lemonios-service.jar > warehouseios.log 2>&1 &
 
 ```
 
-#### IOS: maintainios maintainios
+#### IOS: IOSMaintain light state maintainios
 
 ```shell
 # maintainios maintainios
@@ -872,21 +874,22 @@ lemonios-service.jar > maintainios.log 2>&1 &
 ```
 
 
-#### IOS: linefunios linefunios
+#### IOS: Line Fun linefunios
 
 ```shell
 # linefunios linefunios
+# 10.206.0.3
 # 10.206.16.10
 nohup java -jar -Xms1024m -Xmx1024m -XX:MaxMetaspaceSize=256M -XX:+UseCompressedOops \
 -XX:+UseG1GC -XX:ConcGCThreads=2 -XX:InitiatingHeapOccupancyPercent=35 \
 -XX:G1ReservePercent=10 -XX:MaxGCPauseMillis=300 \
--XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/www/app/ytpm/service-ios-linefun/lemonios.hprof \
+-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/www/app/ytpm/service-ios-linefun/linefunios.hprof \
 lemonios-service.jar > linefunios.log 2>&1 &
 
 ```
 
 
-#### IOS: sortingios sortingios
+#### IOS: IOSCelestial Sorting sortingios
 
 ```shell
 # sortingios sortingios
@@ -901,7 +904,7 @@ lemonios-service.jar > sortingios.log 2>&1 &
 ```
 
 
-#### IOS: guardios guardios
+#### IOS: IOSExpiryGuard guardios
 
 ```shell
 # guardios guardios
@@ -916,7 +919,7 @@ lemonios-service.jar > guardios.log 2>&1 &
 ```
 
 
-#### IOS: deliveryios deliveryios
+#### IOS: [] deliveryios
 
 ```shell
 # deliveryios

+ 1 - 0
yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentAppServiceImpl.java

@@ -142,6 +142,7 @@ public class AgentAppServiceImpl implements AgentAppService {
             appMapper.insertOne(app);
             //新增APP时要生成 app_default_config
             generateDefaultConfig(param,app);
+            // ios应用同步生成渠道表
             if (param.getAppType() == 2){
                 saveDitch(app);
             }

+ 21 - 1
yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentDitchServiceImpl.java

@@ -1,13 +1,16 @@
 package com.ytpm.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ytpm.agent.enums.UserTypeEnum;
 import com.ytpm.agent.model.YtApp;
 import com.ytpm.agent.model.YtDitch;
+import com.ytpm.agent.model.YtPlatformUserApp;
 import com.ytpm.agent.model.YtPlatformUserPromoter;
 import com.ytpm.agent.param.DitchListParam;
 import com.ytpm.agent.view.AgentDitchView;
+import com.ytpm.dao.AgentAppMapper;
 import com.ytpm.dao.AgentDitchMapper;
 import com.ytpm.dao.AgentUserMapper;
 import com.ytpm.dao.AppMapper;
@@ -17,6 +20,8 @@ import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
 import com.ytpm.oauth.model.YtPlatformUser;
 import com.ytpm.service.AgentDitchService;
+import com.ytpm.utils.FeignClientInvoker;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -26,12 +31,12 @@ import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
+@Slf4j
 @Service
 public class AgentDitchServiceImpl implements AgentDitchService {
 
     @Resource
     private AgentDitchMapper agentDitchMapper;
-
     @Resource
     private AppMapper appMapper;
     @Resource
@@ -39,6 +44,10 @@ public class AgentDitchServiceImpl implements AgentDitchService {
     @Resource
     private PromoterUserMapper promoterUserMapper;
 
+    @Resource
+    private FeignClientInvoker feignInvoker;
+    @Resource
+    private AgentAppMapper agentAppMapper;
 
     @Override
     public ResultTable<AgentDitchView> ditchList(DitchListParam param) {
@@ -89,6 +98,17 @@ public class AgentDitchServiceImpl implements AgentDitchService {
             List<String> ids = Collections.singletonList(ytApp.getAppId());
             appMapper.deleteAppIds(ids);
             appMapper.deleteRisks(ids);
+            // ios应用 feign调用更新子库 记录
+            if (ytApp.getAppType() == 2 && StrUtil.isNotEmpty(ytApp.getSuperiorId())) {
+                try {
+                    YtPlatformUserApp superior = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
+                    if (superior != null) {
+                        feignInvoker.invoke(superior.getServiceName(), "delDitchByAppId", ytApp.getAppId());
+                    }
+                }catch (Exception ignored){
+                    log.error("同步 ditch删除失败, appId:{}", ytApp.getAppId());
+                }
+            }
         }
         return Result.resultOk(RepMessage.DELETE_SUCCESS);
     }

+ 4 - 0
yt-ios-lemon/lemon-ios-feign/src/main/java/com/ytpm/lemonios/feign/base/BaseFeign.java

@@ -19,6 +19,7 @@ import com.ytpm.general.ResultTable;
 import com.ytpm.middle.view.DashboardRankingListVO;
 import com.ytpm.middle.view.DashboardRevenueVO;
 import com.ytpm.middle.view.DashboardRiskVO;
+import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -94,6 +95,9 @@ public interface BaseFeign {
     @PostMapping("/ditch/addDitch")
     Result<?> addDitch(@RequestBody YtApp app);
 
+    @DeleteMapping("/ditch/delDitch")
+    Result<?> delDitchByAppId(@RequestParam(name = "appId") String appId);
+
     @PostMapping("/user/queryTodayBanned")
     List<YtDyzUser> queryTodayBanned(@RequestBody AppUserTodayBannedParam appUserTodayBannedParam);
 

+ 16 - 4
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/controller/DitchController.java

@@ -1,9 +1,8 @@
 package com.ytpm.lemonios.controller;
 
+import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageInfo;
 import com.ytpm.agent.model.YtApp;
-import com.ytpm.agent.model.YtDitch;
-import com.ytpm.agent.param.AppParam;
 import com.ytpm.agent.param.DitchListForIosParam;
 import com.ytpm.agent.param.DitchListParam;
 import com.ytpm.agent.view.AgentDitchView;
@@ -13,10 +12,14 @@ import com.ytpm.general.ResultTable;
 import com.ytpm.lemonios.service.DitchService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import java.util.Date;
 import java.util.List;
 
 @Api(tags = "渠道类型管理模块")
@@ -57,4 +60,13 @@ public class DitchController {
     public Result<?> add(@RequestBody YtApp app) {
         return Result.resultOk(RepMessage.SAVE_SUCCESS, agentDitchService.save(app));
     }
+
+    @ApiOperation("删除渠道")
+    @DeleteMapping("/delDitch")
+    public Result<?> delDitch(@RequestParam(name = "appId") String appId) {
+        if (StrUtil.isNotEmpty(appId)) {
+            agentDitchService.deleteByAppId(appId);
+        }
+        return Result.resultOk(RepMessage.SAVE_SUCCESS);
+    }
 }

+ 2 - 0
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/controller/WxController.java

@@ -364,6 +364,8 @@ public class WxController {
         List<WxDefaultConfig> dyzConfig = appUserMapper.getConfigByIds(appId);
         if(CollUtil.isNotEmpty(dyzConfig)){
             appUserMapper.delByAppId(appId);
+            // 同步删除渠道记录
+            ditchMapper.deleteByAppId(appId);
         }
     }
 }

+ 5 - 0
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/dao/DitchMapper.java

@@ -15,4 +15,9 @@ public interface DitchMapper {
     Integer insertOne(YtDitch ytDitch);
 
     YtDitch selectById(@Param("ditchId") Long ditchId);
+
+    /**
+     * 逻辑删除渠道记录
+     */
+    void deleteByAppId(@Param("appId") String appId);
 }

+ 3 - 2
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/service/DitchService.java

@@ -1,8 +1,6 @@
 package com.ytpm.lemonios.service;
 
 import com.ytpm.agent.model.YtApp;
-import com.ytpm.agent.model.YtDitch;
-import com.ytpm.agent.param.AppParam;
 import com.ytpm.agent.param.DitchListParam;
 import com.ytpm.agent.view.AgentDitchView;
 
@@ -23,4 +21,7 @@ public interface DitchService {
      * @return
      */
     Integer save(YtApp app);
+
+
+    void deleteByAppId(String appId);
 }

+ 6 - 0
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/service/impl/DitchServiceImpl.java

@@ -37,4 +37,10 @@ public class DitchServiceImpl implements DitchService {
         ytDitch.setCreateTime(new Date());
         return agentDitchMapper.insertOne(ytDitch);
     }
+
+    @Override
+    public void deleteByAppId(String appId) {
+        // 逻辑删除
+        agentDitchMapper.deleteByAppId(appId);
+    }
 }

+ 3 - 3
yt-ios-lemon/lemon-ios-service/src/main/resources/bootstrap.yml

@@ -4,8 +4,8 @@ spring:
   main:
     allow-bean-definition-overriding: true
   application:
-    name: gollumios-service
-    name-zh: '咕噜记账IOS'
+    name: lemonios-service
+    name-zh: '青柠檬IOS'
   profiles:
     active: local
 yt:
@@ -14,7 +14,7 @@ yt:
   # 本地环境
   local:
     addr: 127.0.0.1
-    namespace: 059740b0-1325-454c-8d86-5208d036caba
+    namespace: 1aff43c9-b617-4d0b-8c3a-9d8b44a8beae
   # 测试环境
   dev:
     addr: 127.0.0.1

+ 8 - 7
yt-ios-lemon/lemon-ios-service/src/main/resources/mapper/DitchMapper.xml

@@ -23,14 +23,15 @@
                 #{createTime}
             )
     </insert>
+    <delete id="deleteByAppId">
+        update yt_ditch set is_delete = 1 where app_id = #{appId}
+    </delete>
     <select id="ditchList" resultType="com.ytpm.agent.view.AgentDitchView">
-        select
-        ditch_id, ditch_name, create_time
+        select ditch_id,
+               ditch_name,
+               create_time
         from yt_ditch
-        <where>
-            user_id = #{userId}
-            and is_delete=0
-        </where>
+        where user_id = #{userId} and is_delete = 0
     </select>
     <select id="ditchListForIos" resultType="com.ytpm.agent.view.AgentDitchView">
         select
@@ -47,6 +48,6 @@
         select
             ditch_id, ditch_name, user_id, app_id, app_type, is_delete, create_time
         from yt_ditch
-        where ditch_id = #{ditchId}
+        where is_delete = 0 and ditch_id = #{ditchId}
     </select>
 </mapper>