|
@@ -75,7 +75,7 @@ public class DesignerServiceImpl implements IDesignerService {
|
|
|
* @author: zianY
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<Map<String,Object>> getHotVideoData(String userId) {
|
|
|
+ public List<Map<String,Object>> getHotVideoData(String userId,String yearTime,String monthTime) {
|
|
|
String roleName = null;
|
|
|
//查询用户角色
|
|
|
String roleCode = roleService.getRoleCodeByUserId(userId);
|
|
@@ -86,8 +86,11 @@ public class DesignerServiceImpl implements IDesignerService {
|
|
|
}else if (roleCode.contains("plan")){
|
|
|
roleName = "plan";
|
|
|
}
|
|
|
- //取当前时间的季度的月份
|
|
|
- Map<String,Object> timeMap = DateUtils.getCurrentQuarterMonths(DateUtils.dateToStringTime(new Date()));
|
|
|
+
|
|
|
+ //获取季度的开始和截止时间
|
|
|
+ Map<String,String> map = DateUtils.quarterStartEndDate(Integer.valueOf(yearTime),Integer.valueOf(monthTime));
|
|
|
+ //取时间的季度的月份
|
|
|
+ Map<String,Object> timeMap = DateUtils.getCurrentQuarterMonths(map.get("endDate"));
|
|
|
String[] quarterStr = (String[])timeMap.get("quarter");
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>();
|
|
|
List<Map<String,Object>> byteDanceList = new ArrayList<>();
|
|
@@ -96,12 +99,12 @@ public class DesignerServiceImpl implements IDesignerService {
|
|
|
Map<String,Object> kuaishouMap = new HashMap<>();
|
|
|
for (String month : quarterStr ){
|
|
|
//头条
|
|
|
- JSONObject bytedanceJson = designerMapper.getHotVideoData(userId,roleName,"1",timeMap.get("yearTime")+"",month);
|
|
|
+ JSONObject bytedanceJson = designerMapper.getHotVideoData(userId,roleName,"1",yearTime,month);
|
|
|
bytedanceJson.put("monthTime",month);
|
|
|
byteDanceList.add(bytedanceJson);
|
|
|
bytedanceMap.put("byteDance",byteDanceList);
|
|
|
//快手
|
|
|
- JSONObject kuaishouJson = designerMapper.getHotVideoData(userId,roleName,"2",timeMap.get("yearTime")+"",month);
|
|
|
+ JSONObject kuaishouJson = designerMapper.getHotVideoData(userId,roleName,"2",yearTime,month);
|
|
|
kuaishouJson.put("monthTime",month);
|
|
|
kuaishouList.add(kuaishouJson);
|
|
|
kuaishouMap.put("kuaishou",kuaishouList);
|
|
@@ -113,9 +116,11 @@ public class DesignerServiceImpl implements IDesignerService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public Map<String,Object> getDesignerAchievements(String userId) {
|
|
|
- //取当前时间的季度的月份
|
|
|
- Map<String,Object> timeMap = DateUtils.getCurrentQuarterMonths(DateUtils.dateToStringTime(new Date()));
|
|
|
+ public Map<String,Object> getDesignerAchievements(String userId,String yearTime,String monthTime) {
|
|
|
+ //获取季度的开始和截止时间
|
|
|
+ Map<String,String> map = DateUtils.quarterStartEndDate(Integer.valueOf(yearTime),Integer.valueOf(monthTime));
|
|
|
+ //取当前时间的季度的月份
|
|
|
+ Map<String,Object> timeMap = DateUtils.getCurrentQuarterMonths(map.get("endDate"));
|
|
|
String[] quarterStr = (String[])timeMap.get("quarter");
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
List<Map<String,Object>> byteDanceList = new ArrayList<>();
|
|
@@ -125,13 +130,13 @@ public class DesignerServiceImpl implements IDesignerService {
|
|
|
Map<String,Object> bytedanceMap = new HashMap<>();
|
|
|
Map<String,Object> kuaishouMap = new HashMap<>();
|
|
|
//头条
|
|
|
- List<JSONObject> bytedanceJson = designerMapper.getDesignerAchievementsBytedance(userId,timeMap.get("yearTime")+"",month);
|
|
|
+ List<JSONObject> bytedanceJson = designerMapper.getDesignerAchievementsBytedance(userId,yearTime,month);
|
|
|
bytedanceMap.put("monthTime",month );
|
|
|
bytedanceMap.put("yearTime",timeMap.get("yearTime")+"" );
|
|
|
bytedanceMap.put("byteDance",bytedanceJson);
|
|
|
byteDanceList.add(bytedanceMap);
|
|
|
//快手
|
|
|
- List<JSONObject> kuaishouJson = designerMapper.getDesignerAchievementsBytedance(userId,timeMap.get("yearTime")+"",month);
|
|
|
+ List<JSONObject> kuaishouJson = designerMapper.getDesignerAchievementsKuaishou(userId,yearTime,month);
|
|
|
kuaishouMap.put("monthTime",month );
|
|
|
bytedanceMap.put("yearTime",timeMap.get("yearTime")+"" );
|
|
|
kuaishouMap.put("kuaiShou",kuaishouJson);
|
|
@@ -236,24 +241,27 @@ public class DesignerServiceImpl implements IDesignerService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public JSONObject getDesignerCommission(String userId) {
|
|
|
- //取当前时间的季度的月份
|
|
|
- Map<String,Object> timeMap = DateUtils.getCurrentQuarterMonths(DateUtils.dateToStringTime(new Date()));
|
|
|
+ public JSONObject getDesignerCommission(String userId,String yearTime,String monthTime) {
|
|
|
+ //获取季度的开始和截止时间
|
|
|
+ Map<String,String> map = DateUtils.quarterStartEndDate(Integer.valueOf(yearTime),Integer.valueOf(monthTime));
|
|
|
+ //取当前时间的季度的月份
|
|
|
+ Map<String,Object> timeMap = DateUtils.getCurrentQuarterMonths(map.get("endDate"));
|
|
|
String[] quarterStr = (String[])timeMap.get("quarter");
|
|
|
-
|
|
|
//人员离职信息
|
|
|
JSONObject userFrozen = designerMapper.getUserFrozenInfo(userId);
|
|
|
|
|
|
-
|
|
|
//季度 分媒体 素材消耗
|
|
|
- List<JSONObject> quarterCost = designerMapper.getDesignerBytedanceAndKuaishouQuaterCost(userId);
|
|
|
+ List<JSONObject> quarterCost = designerMapper.getDesignerBytedanceAndKuaishouQuaterCost(userId,yearTime,monthTime);
|
|
|
userFrozen.put("quarterCostList",quarterCost);
|
|
|
|
|
|
//季度素材 总消耗
|
|
|
Double tatolCost = quarterCost.stream().mapToDouble(json -> json.getDouble("cost")).reduce(Double::sum).orElse(new Double("0"));
|
|
|
userFrozen.put("tatolQuarterCost",tatolCost);
|
|
|
|
|
|
- //消耗是否达标
|
|
|
+ //管理消耗
|
|
|
+ JSONObject leaderCost = designerMapper.getDesignerManagerLeaderCost(userId,yearTime,monthTime);
|
|
|
+ userFrozen.put("leaderCost",leaderCost.getString("cost"));
|
|
|
+
|
|
|
|
|
|
//离职时间
|
|
|
String frozenTime = userFrozen.getString("frozenTime");
|
|
@@ -307,7 +315,7 @@ public class DesignerServiceImpl implements IDesignerService {
|
|
|
Double bytedanceCommission = bytedanceJson.stream().mapToDouble(json -> json.getDouble("commission")).reduce(Double::sum).orElse(new Double("0"));
|
|
|
|
|
|
//快手提成
|
|
|
- List<JSONObject> kuaishouJson = designerMapper.getDesignerAchievementsBytedance(userId, timeMap.get("yearTime") + "", month);
|
|
|
+ List<JSONObject> kuaishouJson = designerMapper.getDesignerAchievementsKuaishou(userId, timeMap.get("yearTime") + "", month);
|
|
|
Double kuaishouCommission = kuaishouJson.stream().mapToDouble(json -> json.getDouble("commission")).reduce(Double::sum).orElse(new Double("0"));
|
|
|
|
|
|
commissionJson.put("monthTime", month);
|
|
@@ -371,7 +379,7 @@ public class DesignerServiceImpl implements IDesignerService {
|
|
|
//基础信息 + 爆款信息
|
|
|
PageInfo<JSONObject> baseics = getDesignBasicsInfoList(userId,pageNum,pageSize);
|
|
|
for (JSONObject jsonObject : baseics.getList()) {
|
|
|
- List<Map<String,Object>> hotVideo = getHotVideoData(jsonObject.getString("userId"));
|
|
|
+ List<Map<String,Object>> hotVideo = getHotVideoData(jsonObject.getString("userId"),yearTime,monthTime);
|
|
|
jsonObject.put("hotVideoInfo",hotVideo);
|
|
|
}
|
|
|
return Result.successMsg("基础+爆款查询成功。",baseics);
|
|
@@ -381,18 +389,28 @@ public class DesignerServiceImpl implements IDesignerService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public Result getDesignerBasicsAndAchAndComInfo(String userId,String yearTime,String monthTime,int pageNum,int pageSize){
|
|
|
- //基础信息 + 绩效+提成
|
|
|
+ public Result getDesignerBasicsAndAch(String userId,String yearTime,String monthTime,int pageNum,int pageSize){
|
|
|
+ //基础信息 + 绩效
|
|
|
PageInfo<JSONObject> baseics = getDesignBasicsInfoList(userId,pageNum,pageSize);
|
|
|
for (JSONObject jsonObject : baseics.getList()) {
|
|
|
//绩效
|
|
|
- Map<String,Object> achievementsMap = getDesignerAchievements(jsonObject.getString("userId"));
|
|
|
+ Map<String,Object> achievementsMap = getDesignerAchievements(jsonObject.getString("userId"),yearTime,monthTime);
|
|
|
jsonObject.put("achievementsMap",achievementsMap);
|
|
|
+ }
|
|
|
+ return Result.successMsg("基础+绩效查询成功。",baseics);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getDesignerBasicsAndAchAndComInfo(String userId,String yearTime,String monthTime,int pageNum,int pageSize){
|
|
|
+ //基础信息 +提成
|
|
|
+ PageInfo<JSONObject> baseics = getDesignBasicsInfoList(userId,pageNum,pageSize);
|
|
|
+ for (JSONObject jsonObject : baseics.getList()) {
|
|
|
//提成
|
|
|
- JSONObject userFrozen = getDesignerCommission(jsonObject.getString("userId"));
|
|
|
+ JSONObject userFrozen = getDesignerCommission(jsonObject.getString("userId"),yearTime,monthTime);
|
|
|
jsonObject.put("userFrozen",userFrozen);
|
|
|
}
|
|
|
- return Result.successMsg("基础+绩效+提成查询成功。",baseics);
|
|
|
+ return Result.successMsg("基础+提成查询成功。",baseics);
|
|
|
}
|
|
|
|
|
|
|