Browse Source

Merge remote-tracking branch 'origin/master'

kk 1 month ago
parent
commit
4cd9d14e62

+ 18 - 6
game-business/src/main/java/com/game/business/controller/AppAgentController.java

@@ -80,13 +80,25 @@ public class AppAgentController extends BaseController {
         AppUserAgentJournalIndexVO vo = new AppUserAgentJournalIndexVO();
         Date curDate = DateUtil.date();
         if(agentIndexDto.getType() == 1){
-            curDate = DateUtil.offsetMonth(curDate,-1); //上个月
+//            curDate = DateUtil.offsetMonth(curDate,-1); //上个月
+            //上一个周期
+            curDate = DateUtil.offsetDay(curDate,-15);
         }
         String formatP = "yyyy-MM-dd";
-        Date beginDate = DateUtil.beginOfMonth(curDate);
-        Date endDate = DateUtil.endOfMonth(curDate);
-        Date weekBegin = DateUtil.beginOfWeek(now);
-        Date weekend = DateUtil.endOfWeek(now);
+        /*Date beginDate = DateUtil.beginOfMonth(curDate);
+        Date endDate = DateUtil.endOfMonth(curDate);*/
+        int curDay = Integer.parseInt(DateUtil.format(curDate,"dd"));
+
+        Date weekBegin = null;
+        Date weekend = null;
+        if(curDay <= 15){
+            weekBegin = DateUtil.beginOfMonth(curDate);
+            weekend = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 23:59:59")),"yyyy-MM-dd HH:mm:ss");
+        }else{
+            weekBegin = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
+            weekend = DateUtil.endOfMonth(curDate);
+        }
+
         List<AppUserCount> appUserCountList = appUserCountService.getAppUserCountNew(userId,DateUtil.format(weekBegin,formatP),DateUtil.format(weekend,formatP));
         AppUserAgent queryAppUserAgent = new AppUserAgent();
         queryAppUserAgent.setPid(userId);
@@ -170,7 +182,7 @@ public class AppAgentController extends BaseController {
                 compareTime(e.getCreateTime(),yesterDay,yesterDay)
         ).collect(Collectors.toList()).size());
         vo.setMonthUser(appUserAgentList.stream().filter(e->
-                compareTime(e.getCreateTime(),beginDate,endDate)
+                compareTime(e.getCreateTime(),DateUtil.beginOfMonth(new Date()),DateUtil.endOfMonth(new Date()))
         ).collect(Collectors.toList()).size());
 
         return HttpRet.success(MessageUtils.message("11022"),vo);

+ 1 - 0
game-business/src/main/java/com/game/business/controller/AppUserController.java

@@ -141,6 +141,7 @@ public class AppUserController extends BaseController
             AppUsersCharge appUsersCharge = new AppUsersCharge();
 //            appUsersCharge.id = charge.id;
             appUsersCharge.setTouid(appUser.getUserid());
+            appUsersCharge.setUid(appUser.getUserid());
 
             appUsersCharge.setCoin(BigDecimal.valueOf(userChargeDto.getAmount()));
             appUsersCharge.setCoinType(Long.parseLong(String.valueOf(userChargeDto.getType())));

+ 24 - 10
game-business/src/main/java/com/game/business/service/impl/AppGameCommissionServiceImpl.java

@@ -106,17 +106,31 @@ public class AppGameCommissionServiceImpl extends ServiceImpl<AppGameCommissionM
         List<AppGameCommission> list = appGameCommissionMapper.selectList(queryWrapper);
         if(null != list && list.size() > 0){
             List<Long> gameIds = list.stream().map(e->e.getGameId()).collect(Collectors.toList());
-            List<AppGame> games = appGameService.selectByIds(gameIds);
-            Map<String,String> map = new HashMap<>();
-            if(null != games && games.size() > 0){
-                map = games.stream().collect(Collectors.toMap(j->String.valueOf(j.getId()),AppGame::getName,(k1,k2)->k1));
-            }
-            Map<String, String> finalMap = map;
-            list.forEach(e->{
-                if(null != finalMap.get(String.valueOf(e.getGameId()))){
-                    e.setGameName(finalMap.get(String.valueOf(e.getGameId())));
+            AppGame queryGame = new AppGame();
+//            queryGame.setStatus(1L);
+            List<AppGame> games = appGameService.selectAppGameList(queryGame);
+            for(AppGame game:games){
+                Map<String,Boolean> userMap = new HashMap<>();
+                for(AppGameCommission appGameCommission : list){
+                    if(game.getId().equals(appGameCommission.getGameId())){
+                        if(null == userMap.get(appGameCommission.getUserId())){
+                            userMap.put(String.valueOf(appGameCommission.getUserId()),true);
+                        }
+                        appGameCommission.setGameName(game.getName());
+                    }
+                }
+
+                List<Long> unIds = ids.stream().filter(e->null==userMap.get(String.valueOf(e))).collect(Collectors.toList());
+                for(Long unId:unIds){
+                    //未设置过该游戏
+                    AppGameCommission appGameCommission = new AppGameCommission();
+                    appGameCommission.setGameId(game.getId());
+                    appGameCommission.setGameRate(0L);
+                    appGameCommission.setGameName(game.getName());
+                    appGameCommission.setUserId(unId);
+                    list.add(appGameCommission);
                 }
-            });
+            }
         }
         return list;
     }

+ 25 - 7
game-business/src/main/java/com/game/business/service/impl/AppUserAgentServiceImpl.java

@@ -9,10 +9,7 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.rmi.ServerException;
 import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import com.game.business.domain.*;
@@ -198,8 +195,23 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
             teamDto.setPid(SecurityUtils.getUserId());
         }
         if(StringUtils.isBlank(teamDto.getBeginTime()) || StringUtils.isBlank(teamDto.getEndTime())){
-            teamDto.setBeginTime(DateUtil.format(DateUtil.beginOfMonth(DateUtils.getNowDate()), "yyyy-MM-dd"));
-            teamDto.setEndTime(DateUtil.format(DateUtil.endOfMonth(DateUtils.getNowDate()), "yyyy-MM-dd"));
+            /*teamDto.setBeginTime(DateUtil.format(DateUtil.beginOfMonth(DateUtils.getNowDate()), "yyyy-MM-dd"));
+            teamDto.setEndTime(DateUtil.format(DateUtil.endOfMonth(DateUtils.getNowDate()), "yyyy-MM-dd"));*/
+            //默认查询当前周期
+            Date now = DateUtils.getNowDate();
+            int curDay = Integer.parseInt(DateUtil.format(now,"dd"));
+
+            Date weekBegin = null;
+            Date weekend = null;
+            if(curDay <= 15){
+                weekBegin = DateUtil.beginOfMonth(now);
+                weekend = DateUtil.parse(DateUtil.format(now,"yyyy-MM-".concat("15").concat(" 23:59:59")),"yyyy-MM-dd HH:mm:ss");
+            }else{
+                weekBegin = DateUtil.parse(DateUtil.format(now,"yyyy-MM-".concat("15").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
+                weekend = DateUtil.endOfMonth(now);
+            }
+            teamDto.setBeginTime(DateUtil.format(weekBegin,"yyyy-MM-dd"));
+            teamDto.setEndTime(DateUtil.format(weekend,"yyyy-MM-dd"));
         }
         List<AppAgentTeamVo> list = appUserAgentMapper.teamListNew(teamDto);
         if(null != list && list.size() > 0){
@@ -212,7 +224,13 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
                         collect(Collectors.groupingBy(j->String.valueOf(j.getUserId())));
                 list.forEach(e->{
                     if(null != map.get(String.valueOf(e.getUserId()))){
-                        e.setGameCommissionList(map.get(String.valueOf(e.getUserId())));
+                        List<AppGameCommission> commissionList = map.get(String.valueOf(e.getUserId()));
+                        commissionList.forEach(commission->{
+                            if(null == commission.getPid()){
+                                commission.setPid(e.getPid());
+                            }
+                        });
+                        e.setGameCommissionList(commissionList);
                     }else if(null != gameList && gameList.size() > 0){
                         e.setGameCommissionList(gameList.stream().map(j->{
                             AppGameCommission gameCommission = new AppGameCommission();

+ 12 - 0
game-business/src/main/java/com/game/business/task/AppUserCountTask.java

@@ -376,6 +376,18 @@ public class AppUserCountTask {
         }
         Date beginTime = DateUtil.beginOfWeek(curDate);
         Date endTime = DateUtil.endOfWeek(curDate);
+
+        Date weekBegin = null;
+        Date weekend = null;
+        int curDay = Integer.parseInt(DateUtil.format(curDate,"dd"));
+        if(curDay <= 15){
+            weekBegin = DateUtil.beginOfMonth(curDate);
+            weekend = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 23:59:59")),"yyyy-MM-dd HH:mm:ss");
+        }else{
+            weekBegin = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
+            weekend = DateUtil.endOfMonth(curDate);
+        }
+
         resDate = DateUtil.format(endTime, "yyyy-MM-dd");
         //查询所有总代理用户
         AppUser queryUser = new AppUser();

+ 1 - 1
game-business/src/main/resources/mapper/business/AppUserAgentMapper.xml

@@ -198,7 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             IFNULL(sum(b.recharge_give),0) as rechargeGive,
             a.live_rate as liveRate,
             a.dividend_guarantee_rate as dividendGuaranteeRate
-        from app_user_agent as a inner join app_user_count as b on a.user_id = b.user_id left join mugozbg_live.app_user as c on a.user_id = c.userid
+        from app_user_agent as a left join app_user_count as b on a.user_id = b.user_id left join mugozbg_live.app_user as c on a.user_id = c.userid
         where (a.pid = #{teamDto.pid} or a.user_id = #{teamDto.pid})
         <if test="teamDto.userId != null ">
              and a.user_id = #{teamDto.userId}

+ 1 - 0
game-business/src/main/resources/mapper/business/AppUserMapper.xml

@@ -171,6 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectAppUserList" parameterType="com.game.business.domain.AppUser" resultMap="AppUserResult">
         <include refid="selectAppUserVo"/>
         <where>  
+            <if test="userid != null"> and userid = #{userid}</if>
             <if test="address != null  and address != ''"> and address = #{address}</if>
             <if test="agentId != null "> and agent_id = #{agentId}</if>
             <if test="amount != null "> and amount = #{amount}</if>