浏览代码

feat: 联调调整提交

hidewnd 4 周之前
父节点
当前提交
084f814991

+ 1 - 1
yt-agent/agent-service/src/main/java/com/ytpm/controller/PromoterUserController.java

@@ -35,7 +35,7 @@ public class PromoterUserController {
     @Resource
     private PromoterUserService promoterUserService;
 
-    @ApiOperation("查询渠道所属用户列表")
+    @ApiOperation("查询渠道所属推广人用户列表")
     @PostMapping("/queryList")
     public ResultTable<YtPlatformUser> queryList(@RequestBody PromoterUserParam userParam,
                                                  @ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo) {

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

@@ -78,7 +78,7 @@ public class AgentAppServiceImpl implements AgentAppService {
     public ResultTable<AgentAppView> searchAppList(AppListParam appListParam) {
         PageHelper.startPage(appListParam.getPage(), appListParam.getLimit());
         YtPlatformUser platformUser = agentUserMapper.selectPrimary(appListParam.getUserId());
-        if (platformUser != null && UserTypeEnum.PLATFORM_USER.getCode().equals(platformUser.getUserType())) {
+        if (platformUser != null && UserTypeEnum.APP_PROMOTER.getCode().equals(platformUser.getUserType())) {
             List<YtPlatformUserPromoter> list = promoterUserMapper.selectPromoterByUserId(platformUser.getUserId());
             appListParam.setAppIds(list.stream().map(YtPlatformUserPromoter::getAppId).filter(StrUtil::isNotEmpty).collect(Collectors.toList()));
         }

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

@@ -44,7 +44,7 @@ public class AgentDitchServiceImpl implements AgentDitchService {
     public ResultTable<AgentDitchView> ditchList(DitchListParam param) {
         PageHelper.startPage(param.getPage(), param.getLimit());
         YtPlatformUser platformUser = agentUserMapper.selectPrimary(param.getUserId());
-        if (platformUser != null && UserTypeEnum.PLATFORM_USER.getCode().equals(platformUser.getUserType())) {
+        if (platformUser != null && UserTypeEnum.APP_PROMOTER.getCode().equals(platformUser.getUserType())) {
             List<YtPlatformUserPromoter> list = promoterUserMapper.selectPromoterByUserId(platformUser.getUserId());
             param.setDitchIds(list.stream().map(YtPlatformUserPromoter::getDitchId).filter(Objects::nonNull).collect(Collectors.toList()));
         }

+ 4 - 2
yt-agent/agent-service/src/main/java/com/ytpm/service/impl/PromoterUserServiceImpl.java

@@ -123,14 +123,16 @@ public class PromoterUserServiceImpl implements PromoterUserService {
         if (promoter != null) {
             throw new CustomerException("该应用已绑定推广人!");
         }
+        // 校验推广分成比例合法性,数据处理
         if (StrUtil.isNotEmpty(assignParam.getShareRate())) {
             BigDecimal shareRate = NumberUtils.rateToBigDecimal(assignParam.getShareRate());
             if (BigDecimal.ZERO.compareTo(shareRate) > 0) {
                 throw new CustomerException("分成比例不得小于0");
             }
-            if (new BigDecimal("1").compareTo(shareRate) < 0) {
+            if (BigDecimal.ONE.compareTo(shareRate) < 0) {
                 throw new CustomerException("分成比例不得大于100%");
             }
+            assignParam.setShareRate(StrUtil.trim(assignParam.getShareRate().replace("%", "")));
         }
         // 开始时间为空则默认当前时间
         if (assignParam.getStartTime() == null) {
@@ -148,7 +150,7 @@ public class PromoterUserServiceImpl implements PromoterUserService {
         promoter.setOperatorId(userInfo.getUserId());
         promoter.setOperatorTime(new Date());
         promoterUserMapper.insertPromoter(promoter);
-        log.info("[agent promoter]渠道商为应用{}指派推广人{}", ytApp.getAppId(), assignParam.getUserId());
+        log.info("[agent promoter]渠道商为应用{}指派推广人:{}", ytApp.getAppId(), assignParam.getUserId());
         return RepMessage.SAVE_SUCCESS;
     }
 

+ 7 - 1
yt-agent/agent-service/src/main/resources/mapper/AgentAppMapper.xml

@@ -63,11 +63,17 @@
             GROUP_CONCAT( acr.channel_name ) channel_name,
             GROUP_CONCAT( acr.network_app_id ) network_app_id,
             GROUP_CONCAT( acr.network_app_name ) network_app_name,
-            u.nick_name
+            u.nick_name,
+            upu.user_id as promoter_user_id,
+            upu.login_name as promoter_user_login_name,
+            upu.nick_name as promoter_user_nick_name,
+            up.share_rate as promoter_user_share_rate
         FROM yt_app ya
         JOIN yt_platform_user_app pua on ya.superior_id = pua.app_id
         LEFT JOIN yt_app_channel_relative acr ON ya.app_id = acr.app_id
         LEFT JOIN yt_platform_user u ON ya.user_id = u.user_id
+        LEFT JOIN yt_platform_user_promoter up on up.app_id = ya.app_id and (up.end_time is null or up.end_time <![CDATA[ <= ]]> current_date())
+        left join yt_platform_user upu on up.promoter_user_id = upu.user_id
         WHERE ya.enabled = 1
         <if test="appIds == null">
             and ya.user_id = #{userId}

+ 13 - 3
yt-agent/agent-service/src/main/resources/mapper/AgentUserMapper.xml

@@ -36,9 +36,19 @@
             super_admin,
             parent_user_id
         from yt_platform_user ypu
-        where ypu.user_type = 11
-          and ypu.parent_user_id = #{param.parentUserId}
-          and ypu.account_status = 1
+        <where>
+            ypu.user_type = 11 and ypu.account_status = 1 and ypu.parent_user_id = #{param.parentUserId}
+            <if test="param.loginName != null and param.loginName != ''">
+                and ypu.login_name like concat('%', #{param.loginName} ,'%')
+            </if>
+            <if test="param.nickName != null and param.nickName != ''">
+                and ypu.nick_name like concat('%', #{param.nickName} ,'%')
+            </if>
+            <if test="param.phone != null and param.phone != ''">
+                and ypu.phone like concat('%', #{param.phone} ,'%')
+            </if>
+        </where>
+
         order by ypu.registry_time
     </select>
 

+ 12 - 0
yt-common/src/main/java/com/ytpm/agent/param/PromoterUserParam.java

@@ -3,10 +3,12 @@ package com.ytpm.agent.param;
 
 import com.ytpm.general.PageMeta;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
+import springfox.documentation.annotations.ApiIgnore;
 
 /**
  * @author lih
@@ -19,6 +21,16 @@ import lombok.NoArgsConstructor;
 @ApiModel("渠道管理列表入参")
 public class PromoterUserParam extends PageMeta {
 
+    @ApiModelProperty(hidden = true)
     private String parentUserId;
 
+    @ApiModelProperty("登陆用户名")
+    private String loginName;
+
+    @ApiModelProperty("用户昵称")
+    private String nickName;
+
+    @ApiModelProperty("手机号码")
+    private String phone;
+
 }

+ 7 - 0
yt-common/src/main/java/com/ytpm/agent/view/AgentAppView.java

@@ -41,6 +41,13 @@ public class AgentAppView {
     private String nickName;
     private boolean showKey;
 
+    @ApiModelProperty("应用推广人")
+    private String promoterUserId;
+    private String promoterUserLoginName;
+    private String promoterUserNickName;
+    @ApiModelProperty("应用推广人分成比例")
+    private String promoterUserShareRate;
+
     /**
      * 是否应用商店上架 1-否 2-是
      */

+ 5 - 7
yt-common/src/main/java/com/ytpm/util/NumberUtils.java

@@ -17,7 +17,7 @@ public class NumberUtils extends NumberUtil {
      * 百分比字符串转换为BigDecimal
      *
      * @param str “51.12%” | "51.00"
-     * @return BigDecimal
+     * @return BigDecimal 0.5112 | 0.51
      */
     public static BigDecimal rateToBigDecimal(String str) {
         return rateToBigDecimal(str, 5, RoundingMode.HALF_UP);
@@ -27,15 +27,13 @@ public class NumberUtils extends NumberUtil {
         if (StrUtil.isBlank(str)) {
             throw new IllegalArgumentException("输入字符串不能为空");
         }
+        String numStr = StrUtil.trim(str);
         // 处理带百分号的情况
         if (str.contains("%")) {
             // 去除百分号并 trim 空格
-            String numStr = StrUtil.trim(str.replace("%", ""));
-            // 转换为BigDecimal后除以100,并指定精度和舍入模式
-            return toBigDecimal(numStr)
-                    .divide(new BigDecimal("100"), scale, roundingMode);
+            numStr = StrUtil.trim(str.replace("%", ""));
         }
-        // 处理普通数字字符串(直接转换)
-        return toBigDecimal(StrUtil.trim(str));
+        return toBigDecimal(numStr)
+                .divide(new BigDecimal("100"), scale, roundingMode);
     }
 }