puzhibing
2024-03-11 2b6370e31f46eb49dfea453def3be734745e936c
修改bug
5个文件已修改
120 ■■■■■ 已修改文件
cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java
@@ -104,6 +104,11 @@
                        detail.setConsumeName("社区世界杯获胜");
                        detail.setDetailsType(2);
                        break;
                    case 8:
                        detail.setConsumeAmount("" + (userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral()));
                        detail.setConsumeName("社区世界杯调整比分");
                        detail.setDetailsType(1);
                        break;
                    default:
                        break;
                }
@@ -139,7 +144,7 @@
        tauMapper.updateById(appUser);
        userIntegralChanges.setNewIntegral(appUser.getIntegral());
        userIntegralChanges.setInsertTime(new Date());
        userIntegralChanges.setCategory(1);
        userIntegralChanges.setCategory(vo.getIntegral() > 0 ? 1 : 2);
        userIntegralChanges.setRemark(vo.getRemark());
        this.save(userIntegralChanges);
    }
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
@@ -288,12 +288,9 @@
                    worldCupCompetitor.setWinIntegral(0);
                    if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && blue_score.compareTo(red_score) >= 0){
                        worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral());
                        AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId());
                        appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral());
                        appUserClient.updateAppUser(appUser);
                        //增加积分明细
                        SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
                        vo.setAppUserId(appUser.getId());
                        vo.setAppUserId(worldCupCompetitor.getAppUserId());
                        vo.setIntegral(worldCup.getWinIntegral());
                        vo.setType(7);
                        userIntegralChangesClient.saveUserIntegralChanges(vo);
@@ -308,12 +305,9 @@
                    worldCupCompetitor.setWinIntegral(0);
                    if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && red_score.compareTo(blue_score) >= 0){
                        worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral());
                        AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId());
                        appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral());
                        appUserClient.updateAppUser(appUser);
                        //增加积分明细
                        SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
                        vo.setAppUserId(appUser.getId());
                        vo.setAppUserId(worldCupCompetitor.getAppUserId());
                        vo.setIntegral(worldCup.getWinIntegral());
                        vo.setType(7);
                        userIntegralChangesClient.saveUserIntegralChanges(vo);
@@ -474,7 +468,7 @@
            map.put("score", cupCompetitor.getOurScore().compareTo(cupCompetitor.getOpponentScore()) > 0 ?
                    cupCompetitor.getOurScore() + ":" + cupCompetitor.getOpponentScore() :
                    cupCompetitor.getOpponentScore() + ":" + cupCompetitor.getOurScore());
            map.put("matchResult", cupCompetitor.getMatchResult() == 1 ? "胜" : "负");
            map.put("matchResult", cupCompetitor.getMatchResult() == 1 ? "胜" : cupCompetitor.getMatchResult() == 0 ? "平" : "负");
            mapList.add(map);
        }
        Map<String, Object> map = new HashMap<>();
@@ -494,23 +488,42 @@
        Integer blue = changeScore.getBlue();
        Integer red = changeScore.getRed();
        WorldCupCompetitor worldCupCompetitor = this.getById(id);
        List<WorldCupCompetitor> blueList = this.list(new QueryWrapper<WorldCupCompetitor>().eq("code", worldCupCompetitor.getCode()).eq("participant", 1));
        List<WorldCupCompetitor> blueList = this.list(new QueryWrapper<WorldCupCompetitor>().eq("code", worldCupCompetitor.getCode())
                .eq("participant", 1));
        WorldCup worldCup = worldCupService.getById(blueList.get(0).getWorldCupId());
        for (WorldCupCompetitor cupCompetitor : blueList) {
            //如果之前输了,现在赢了,需要增加积分
            if(cupCompetitor.getMatchResult() == -1 && blue.compareTo(red) > 0){
                AppUser appUser = appUserClient.getAppUser(cupCompetitor.getAppUserId());
                appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral());
                appUserClient.updateAppUser(appUser);
            //如果之前输了,现在赢/平了,需要增加积分
            if(cupCompetitor.getMatchResult() == -1 && (blue.compareTo(red) > 0 || blue.compareTo(red) == 0)){
                //增加积分明细
                SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
                vo.setAppUserId(cupCompetitor.getAppUserId());
                vo.setIntegral(worldCup.getWinIntegral());
                vo.setType(7);
                userIntegralChangesClient.saveUserIntegralChanges(vo);
                cupCompetitor.setMatchResult(1);
                cupCompetitor.setWinIntegral(worldCup.getWinIntegral());
            }
            //如果之前赢了,现在输了,需要扣减积分
            if(cupCompetitor.getMatchResult() == 1 && blue.compareTo(red) < 0){
                AppUser appUser = appUserClient.getAppUser(cupCompetitor.getAppUserId());
                appUser.setIntegral(appUser.getIntegral() - worldCup.getWinIntegral());
                appUserClient.updateAppUser(appUser);
                //增加积分明细
                SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
                vo.setAppUserId(cupCompetitor.getAppUserId());
                vo.setIntegral(worldCup.getWinIntegral() * -1);
                vo.setType(8);
                userIntegralChangesClient.saveUserIntegralChanges(vo);
                cupCompetitor.setMatchResult(-1);
                cupCompetitor.setWinIntegral(0);
            }
            //如果之前平了,现在输了,需要扣减积分
            if(cupCompetitor.getMatchResult() == 0 && blue.compareTo(red) < 0){
                //增加积分明细
                SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
                vo.setAppUserId(cupCompetitor.getAppUserId());
                vo.setIntegral(worldCup.getWinIntegral() * -1);
                vo.setType(8);
                userIntegralChangesClient.saveUserIntegralChanges(vo);
                cupCompetitor.setMatchResult(-1);
                cupCompetitor.setWinIntegral(0);
@@ -522,20 +535,38 @@
        List<WorldCupCompetitor> redList = this.list(new QueryWrapper<WorldCupCompetitor>().eq("code", worldCupCompetitor.getCode()).eq("participant", 2));
        for (WorldCupCompetitor cupCompetitor : redList) {
            //如果之前输了,现在赢了,需要增加积分
            if(cupCompetitor.getMatchResult() == -1 && red.compareTo(blue) > 0){
                AppUser appUser = appUserClient.getAppUser(cupCompetitor.getAppUserId());
                appUser.setIntegral(appUser.getIntegral() + worldCup.getWinIntegral());
                appUserClient.updateAppUser(appUser);
            //如果之前输了,现在赢/平了,需要增加积分
            if(cupCompetitor.getMatchResult() == -1 && (red.compareTo(blue) > 0 || red.compareTo(blue) == 0)){
                //增加积分明细
                SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
                vo.setAppUserId(cupCompetitor.getAppUserId());
                vo.setIntegral(worldCup.getWinIntegral());
                vo.setType(7);
                userIntegralChangesClient.saveUserIntegralChanges(vo);
                cupCompetitor.setMatchResult(1);
                cupCompetitor.setWinIntegral(worldCup.getWinIntegral());
            }
            //如果之前赢了,现在输了,需要扣减积分
            if(cupCompetitor.getMatchResult() == 1 && red.compareTo(blue) < 0){
                AppUser appUser = appUserClient.getAppUser(cupCompetitor.getAppUserId());
                appUser.setIntegral(appUser.getIntegral() - worldCup.getWinIntegral());
                appUserClient.updateAppUser(appUser);
                //增加积分明细
                SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
                vo.setAppUserId(cupCompetitor.getAppUserId());
                vo.setIntegral(worldCup.getWinIntegral() * -1);
                vo.setType(8);
                userIntegralChangesClient.saveUserIntegralChanges(vo);
                cupCompetitor.setMatchResult(-1);
                cupCompetitor.setWinIntegral(0);
            }
            //如果之前平了,现在输了,需要扣减积分
            if(cupCompetitor.getMatchResult() == 0 && red.compareTo(blue) < 0){
                //增加积分明细
                SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
                vo.setAppUserId(cupCompetitor.getAppUserId());
                vo.setIntegral(worldCup.getWinIntegral() * -1);
                vo.setType(8);
                userIntegralChangesClient.saveUserIntegralChanges(vo);
                cupCompetitor.setMatchResult(-1);
                cupCompetitor.setWinIntegral(0);
@@ -579,7 +610,7 @@
            map.put("score", ourScore.compareTo(opponentScore) > 0 ?
                    ourScore + ":" + opponentScore :
                    opponentScore + ":" + ourScore);
            map.put("matchResult", matchResult == 1 ? "胜" : "负");
            map.put("matchResult", matchResult == 1 ? "胜" : matchResult == 0 ? "平" :"负");
            mapList.add(map);
        }
        Map<String, Object> map = new HashMap<>();
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java
@@ -32,6 +32,7 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -380,7 +381,7 @@
            userGameRecordList.put("win", win);
            Integer lose = totalSession - win;
            userGameRecordList.put("lose", lose);
            userGameRecordList.put("winRate", totalSession == 0 ? 0 : win / totalSession * 100);
            userGameRecordList.put("winRate", totalSession == 0 ? 0 : new BigDecimal(win).divide(new BigDecimal(totalSession), new MathContext(4, RoundingMode.HALF_EVEN)).multiply(new BigDecimal(100)).doubleValue());
            userGameRecordList.put("participantType", participantType);
            userGameRecordList.put("participantId", participantId);
            AppUser appUser = appUserClient.getAppUser(appUserId);
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -151,12 +151,9 @@
            //添加参赛奖励
            if(null != worldCup.getParticipationIntegral() && 0 < worldCup.getParticipationIntegral()){
                worldCupCompetitor.setParticipationIntegral(worldCup.getParticipationIntegral());
                AppUser appUser = appUserClient.getAppUser(worldCupCompetitor.getAppUserId());
                appUser.setIntegral(appUser.getIntegral() + worldCup.getParticipationIntegral());
                appUserClient.updateAppUser(appUser);
                //增加积分明细
                SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo();
                vo.setAppUserId(appUser.getId());
                vo.setAppUserId(worldCupCompetitor.getAppUserId());
                vo.setIntegral(worldCup.getParticipationIntegral());
                vo.setType(6);
                userIntegralChangesClient.saveUserIntegralChanges(vo);
cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
@@ -64,7 +64,7 @@
                appUserId,
                count(*) as num
                from t_world_cup_competitor
                where 1 = 1
                where matchResult is not null
                <if test="null != item.year">
                    and DATE_FORMAT(startTime, '%Y') = #{item.year}
                </if>
@@ -83,7 +83,7 @@
                appUserId,
                count(*) as num
                from t_world_cup_competitor
                where matchResult = 1
                where matchResult != -1
                <if test="null != item.year">
                    and DATE_FORMAT(startTime, '%Y') = #{item.year}
                </if>
@@ -122,7 +122,7 @@
                    appUserId,
                    count(*) as num
                    from t_world_cup_competitor
                    where 1 = 1
                    where matchResult is not null
                    <if test="null != appUserIds and appUserIds.size() > 0">
                        and appUserId in
                        <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")">
@@ -138,7 +138,7 @@
                    appUserId,
                    count(*) as num
                    from t_world_cup_competitor
                    where matchResult = 1
                    where matchResult != -1
                    <if test="null != appUserIds and appUserIds.size() > 0">
                        and appUserId in
                        <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")">
@@ -159,7 +159,7 @@
            participantId,
            appUserId
            from t_world_cup_competitor
            where 1 = 1
            where matchResult is not null
            <if test="null != appUserIds and appUserIds.size() > 0">
                and appUserId in
                <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")">
@@ -195,7 +195,7 @@
                appUserId,
                count(*) as num
                from t_world_cup_competitor
                where 1 = 1
                where matchResult is not null
                <if test="null != worldCupId">
                    and worldCupId = #{worldCupId}
                </if>
@@ -208,7 +208,7 @@
                appUserId,
                count(*) as num
                from t_world_cup_competitor
                where matchResult = 1
                where matchResult != -1
                <if test="null != worldCupId">
                    and worldCupId = #{worldCupId}
                </if>
@@ -229,7 +229,7 @@
        b.`name`
        from t_world_cup_competitor a
        left join t_world_cup b on (a.worldCupId = b.id)
        where 1 = 1
        where matchResult is not null
        <if test="null != name and '' != name">
            and b.name like CONCAT('%', #{name}, '%')
        </if>
@@ -253,7 +253,7 @@
            appUserId,
            count(*) as num
            from t_world_cup_competitor
            where 1 = 1
            where matchResult is not null
            <if test="null != participantType">
                and participantType = #{participantType}
            </if>
@@ -269,7 +269,7 @@
            appUserId,
            count(*) as num
            from t_world_cup_competitor
            where matchResult = 1
            where matchResult != -1
            <if test="null != participantType">
                and participantType = #{participantType}
            </if>