AI员工推荐系统用户模块系统设计 rotation

package com.microsoft.controller;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.UUID;

import com.microsoft.domain.coderoilstation.aiRecomandation.RetGoodAndReplyStatistic;

public class MicrosoftCoderOilStationController {
	public static void main(String[] args) {
		System.out.println("Hello World!");
	}
	
	//AI员工推荐系统用户模块系统设计 rotation 
	/**
	 * 统计输入字符串(”1234“)
	 * 1 是回帖王1
	 * 2 是点赞王2
	 * 3 是跟风王3 根据帖子排序 copy tag1 data 回帖 or tag2 data 点赞
	 * 4 是潜水王 什么都不干
	 * 返回点赞数量和回帖数量
	 * @param inputArticleUserTypeTag
	 * @return
	 */
	public static int[] getRetGoodAndReplyStatistic(String inputArticleUserTypeTag) {
	    if (inputArticleUserTypeTag == null) {
	        return null;
	    }
	    if (inputArticleUserTypeTag.isEmpty()) {
	        return null;
	    }
	    String trim = inputArticleUserTypeTag.trim();
	    if (trim.isEmpty()) {
	        return null;
	    }
	    String[] split = trim.split("\\s");
	    if (split.length < 1) {
	        return null;
	    }
	    int intVal=10;
	    for (int i = 0; i < 5; i++) {
	        intVal*=5;
	    }
	    if (split.length > intVal) {
	        return null;
	    }
	    String testStrTagPattern="1234";
	    for (int i = 0; i < split.length; i++) {
	        if (!testStrTagPattern.contains(split[i])) {
	            return null;
	        }
	    }
	    HashMap<String, Integer> stringStringHashMap = new HashMap<>();
	    for (int i = 0; i < split.length; i++) {
	        String tempArticleTyptTag=split[i].trim();
	        if (stringStringHashMap.containsKey(tempArticleTyptTag)) {
	            stringStringHashMap.put(tempArticleTyptTag,stringStringHashMap.get(tempArticleTyptTag)+1);
	        }else {
	            stringStringHashMap.put(tempArticleTyptTag,1);
	        }
	    }
	    ArrayList<RetGoodAndReplyStatistic> goodAndReplyStatisticArrayList = new ArrayList<>();
	    stringStringHashMap.forEach((k,v)->{
	        RetGoodAndReplyStatistic retGoodAndReplyStatistic = new RetGoodAndReplyStatistic();
	        retGoodAndReplyStatistic.setId(UUID.randomUUID().toString());
	        if (k.equals("2")){
	            retGoodAndReplyStatistic.setName(k+"good1_reply0");
	            retGoodAndReplyStatistic.setGoodTypeTag(k+"");
	            retGoodAndReplyStatistic.setReplyTypeTag("-");
	            retGoodAndReplyStatistic.setGoodTypeTagCount(v);
	            retGoodAndReplyStatistic.setReplyTypeTagCount(0);
	        } else if (k.equals("1")) {
	            retGoodAndReplyStatistic.setName(k+"good0_reply1");
	            retGoodAndReplyStatistic.setGoodTypeTag("-");
	            retGoodAndReplyStatistic.setReplyTypeTag(k+"-");
	            retGoodAndReplyStatistic.setGoodTypeTagCount(0);
	            retGoodAndReplyStatistic.setReplyTypeTagCount(v);
	        } else if (k.equals("3")) {
	            Collections.sort(goodAndReplyStatisticArrayList,new Comparator<RetGoodAndReplyStatistic>() {
	                @Override
	                public int compare(RetGoodAndReplyStatistic o1, RetGoodAndReplyStatistic o2) {
	                    if (o1.getGoodTypeTag().equals("2") && o2.getGoodTypeTag().equals("2")) {
	                        if (o1.getGoodTypeTagCount() > o2.getGoodTypeTagCount()) {
	                            return 1;
	                        } else if (o1.getGoodTypeTagCount()<o2.getGoodTypeTagCount()) {
	                            return -1;
	                        }
	                        return 0;
	                    }else if (o1.getGoodTypeTag().equals("1") && o2.getGoodTypeTag().equals("1")) {
	                        if (o1.getReplyTypeTagCount() > o2.getReplyTypeTagCount()) {
	                            return 1;
	                        } else if (o1.getReplyTypeTagCount()<o1.getReplyTypeTagCount()) {
	                            return -1;
	                        }
	                        return 0;
	                    }
	                    return 0;
	                }
	            });
	            Collections.sort(goodAndReplyStatisticArrayList,new Comparator<RetGoodAndReplyStatistic>() {
	                @Override
	                public int compare(RetGoodAndReplyStatistic o1, RetGoodAndReplyStatistic o2) {
	                    if (o1.getGoodTypeTag().equals("2") && o2.getGoodTypeTag().equals("2")) {
	                        return 1;
	                    } else if (o1.getReplyTypeTag().equals(1)&&o2.getReplyTypeTag().equals(1)) {
	                        return -1;
	                    }
	                    return 0;
	                }
	            });
	            RetGoodAndReplyStatistic retGoodAndReplyStatistic1 = goodAndReplyStatisticArrayList.get(0);
	            if (retGoodAndReplyStatistic1.getGoodTypeTag().equals("2")) {
	                retGoodAndReplyStatistic.setName(k+"good1_reply0");
	                retGoodAndReplyStatistic.setGoodTypeTag(k+"");
	                retGoodAndReplyStatistic.setReplyTypeTag("-");
	                retGoodAndReplyStatistic.setGoodTypeTagCount(v+1);
	                retGoodAndReplyStatistic.setReplyTypeTagCount(0);
	            }else if (retGoodAndReplyStatistic1.getReplyTypeTag().equals("1")) {
	                retGoodAndReplyStatistic.setName(k+"good0_reply1");
	                retGoodAndReplyStatistic.setGoodTypeTag("-");
	                retGoodAndReplyStatistic.setReplyTypeTag(k+"-");
	                retGoodAndReplyStatistic.setGoodTypeTagCount(0);
	                retGoodAndReplyStatistic.setReplyTypeTagCount(v+1);
	            }
	        }
	    });
	    RetGoodAndReplyStatistic retGoodAndReplyStatisticGood = goodAndReplyStatisticArrayList.get(0);
	    RetGoodAndReplyStatistic retGoodAndReplyStatisticReply = goodAndReplyStatisticArrayList.get(1);
	    int[] ints = new int[2];
	    ints[0] = retGoodAndReplyStatisticGood.getGoodTypeTagCount();
	    ints[1] = retGoodAndReplyStatisticGood.getReplyTypeTagCount();
	    return ints;
	}
	
	//根据点赞数量和回帖数量统计推荐用户方式接口排序
	public static void getAIRecomandationUserList(RetGoodAndReplyStatistic retGoodAndReplyStatistic) {
		if(retGoodAndReplyStatistic==null) {
			return ;
		}
		Integer goodTypeTagCount = retGoodAndReplyStatistic.getGoodTypeTagCount();
		Integer replyTypeTagCount = retGoodAndReplyStatistic.getReplyTypeTagCount();
		int goodTypeTagCountPlusReplyCount=goodTypeTagCount+replyTypeTagCount;
		
		return ;
	}
}

class UserFunctionInterfaceRecomandationAI{
	private String id;
	private String name;
	
}

class StatisticUserGoodFeedback{
	private String id;
	private String name;
	private Integer userGoodTypeTagCountPlusReplyCount;
	private String userFunctionInterfaceRecomandationAIId;
	
}

// open to public user data,this is first step by using free policy to get more good users
// do statistics generate this range page to get vip good user
class OpenToPublicUser{
	private String id;
	private String name;
}
class LeaderBoard{
	private String id;
	private String name;
	private String openToPublicsUserId;
}
class OpenToPublicUserLeaderBoardDetail{
	private String id;
	private String name;
	private String openToPublicUserId;
	private String leaderBoardId;
}

// generate leader board data: zone injection this module
class LeaderBoardZoneInjection{
	
}

#我的求职进度条##想做Agent可以做哪些岗位?##如果春招能重来,我会___##面试官拷打AI项目都会问什么?##你觉得最好用的AI编程工具是_#
Java技术 文章被收录于专栏

JavaEE技术 编程开发经验 企业通用技术

全部评论

相关推荐

开场:&nbsp;1、熟悉的语言八股:2、Java&nbsp;当中的常见集合介绍下3、ConcurrentHashMap&nbsp;Segment&nbsp;分段锁有什么弊端4、StringBuilder&nbsp;和&nbsp;StringBuffer&nbsp;的区别,**StringBuffer&nbsp;如何保证线程安全的**5、JVM&nbsp;内存结构了解吗6、JVM&nbsp;常见问题排查常用命令知道吗7、Java&nbsp;基本数据类型和包装类型的区别8、int&nbsp;a&nbsp;=&nbsp;2;&nbsp;Integer&nbsp;b&nbsp;=&nbsp;2;&nbsp;a&nbsp;==&nbsp;b;&nbsp;以及&nbsp;Integer&nbsp;a&nbsp;=&nbsp;200;&nbsp;Integer&nbsp;b&nbsp;=&nbsp;200;&nbsp;a&nbsp;==&nbsp;b;&nbsp;结果分别是9、B&nbsp;树和&nbsp;B+&nbsp;树的区别10、Redis&nbsp;了解吗11、Redis&nbsp;持久化方式介绍下12、先后执行&nbsp;set&nbsp;name&nbsp;张三&nbsp;和&nbsp;set&nbsp;name&nbsp;李四&nbsp;在&nbsp;AOF&nbsp;持久化过程中都写入&nbsp;AOF&nbsp;文件吗13、场景:类似&nbsp;12306&nbsp;买车票,如何保证多个请求不会发生超卖14、Redis&nbsp;高可用方案知道哪些15、Redis&nbsp;Cluster&nbsp;集群如何分配&nbsp;key&nbsp;在哪个&nbsp;slot16、一般什么情况下会用&nbsp;Redis17、String&nbsp;类型,如果&nbsp;value&nbsp;大小几十兆会怎么样18、Set&nbsp;类型元素个数过多怎么办19、SQL&nbsp;语句性能问题如何排查优化20、MySQL&nbsp;什么情况下会锁表21、场景:一个表,name&nbsp;字段是非唯一索引,有多条&nbsp;name&nbsp;=&nbsp;张三,这个时候查询&nbsp;where&nbsp;name&nbsp;=&nbsp;张三,是什么锁22、场景:一个表,用户余额进行扣减,只在MySQL层面,如何保证并发安全23、MySQL&nbsp;什么情况下加记录锁24、TCP&nbsp;和&nbsp;UDP&nbsp;区别,HTTP&nbsp;用的哪个传输协议25、HTTP&nbsp;报文有哪些部分,响应体有哪些类型26、TCP&nbsp;三次握手和四次挥手过程,为什么不是五次六次其他:27、平时写代码有什么注意的点或者规范吗28、一个大型项目,你会怎么对代码分层29、平时写代码会用到&nbsp;AI&nbsp;吗,哪些场景会用30、到岗时间、实习时间、实习地点相关反问:
查看30道真题和解析
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务