ソースを参照

修改分红周期

dos 1 ヶ月 前
コミット
2a83a91010

+ 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())));

+ 18 - 6
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){

+ 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>