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{
}
Java技术 文章被收录于专栏
JavaEE技术 编程开发经验 企业通用技术

查看10道真题和解析