From 70d2a5d0f9c6951b2d4cac954041ed73582ff7eb Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期一, 09 六月 2025 11:54:00 +0800 Subject: [PATCH] 6.9新增登录失败冻结逻辑 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java | 202 ++++++++++++++++++++++++++++++++------------------ 1 files changed, 129 insertions(+), 73 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java index a845ddf..0db992d 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java @@ -24,11 +24,15 @@ import com.panzhihua.common.constants.HttpStatus; import com.panzhihua.common.model.dtos.PageBaseDTO; import com.panzhihua.common.model.dtos.community.ActivityInviteDTO; +import com.panzhihua.common.model.vos.jinhui.JinhuiCoinGeneralTableVO; +import com.panzhihua.common.model.vos.jinhui.JinhuiGoldCoinRecordVO; +import com.panzhihua.common.service.jinhui.JinhuiCommunityService; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_community.dao.ComActNeighborCircleDAO; import com.panzhihua.service_community.dao.ComActNeighborCircleTopicWestMapper; import com.panzhihua.service_community.dao.ComPbMemberDAO; import com.panzhihua.service_community.entity.ComActActivityInvite; +import com.panzhihua.service_community.entity.JinhuiCoinGeneralTable; import com.panzhihua.service_community.model.dos.ComActNeighborCircleTopicWestDO; import com.panzhihua.service_community.service.ComActActivityInviteService; import com.panzhihua.service_community.util.WxMaConfiguration; @@ -146,6 +150,8 @@ private ComActNeighborCircleDAO comActNeighborCircleDAO; @Resource private WxMaConfiguration wxMaConfiguration; + @Resource + private JinhuiCommunityService jinhuiCommunityService; /** * 新增社区活动 @@ -177,7 +183,9 @@ comActActivityDO.setIsProject(1); } if(comActActivityVO.getType()==5){ - comPbCheckUnitDao.selectOne(new QueryWrapper<ComPbCheckUnit>().lambda().eq(ComPbCheckUnit::getAdminPhone,comActActivityVO.getPhone()).last("limit 1")); + //TODO 查询然后呢? 值都没给... + comPbCheckUnitDao.selectOne(new QueryWrapper<ComPbCheckUnit>().lambda() + .eq(ComPbCheckUnit::getAdminPhone,comActActivityVO.getPhone()).last("limit 1")); } boolean save = this.save(comActActivityDO); @@ -741,7 +749,7 @@ if(!isNull(type)){ comActActivityDOS=comActActivityDOS.stream().filter(comActActivityDO -> comActActivityDO.getType().equals(type)).collect(Collectors.toList()); } - if (!comActActivityDOS.isEmpty()) { + if (comActActivityDOS != null ) { comActActivityDOS.forEach(comActActivityDO -> { ComActActivityVO comActActivityVO = new ComActActivityVO(); BeanUtils.copyProperties(comActActivityDO, comActActivityVO); @@ -753,7 +761,7 @@ comActActivityVO.setIsRegist(0); ActivitySignVO activitySignVO = collect.get(0); Integer activityStatus = comActActivityVO.getStatus(); - if (activityStatus.intValue() == 3) { + if (activityStatus !=null && activityStatus == 3) { comActActivityVO.setStatus(4); } Date createAt = null; @@ -836,7 +844,7 @@ // 修改报名状态 变为报名中 // int num1 = comActActivityDAO.updateStatusToBeginSign(); // log.info("定时任务--修改社区活动报名状态活动数量【{}】", num1); - // 查询已经结束的活动,需要计算积分 + //报名结束 通知参与用户 List<Long> activityEndIds = comActActivityDAO.selectBeginIds(); WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); if(!CollectionUtils.isEmpty(activityEndIds)){ @@ -854,6 +862,7 @@ } }); } + //报名时间结束 活动变更 进行中 int num3 = comActActivityDAO.updateStatusToBeginAfterSingEnd(); log.info("定时任务--报名结束修改社区活动进行状态活动数量【{}】", num3); // 修改进行状态 变为进行中或者已结束 @@ -861,6 +870,7 @@ if(!CollectionUtils.isEmpty(ids)){ int num2 = comActActivityDAO.updateStatusToBeginActiveOrEnd(); log.info("定时任务--修改社区活动进行状态活动数量【{}】", num2); + //通知用户 活动结束 ids.forEach(id ->{ List<String> openIds=comActActivityDAO.selectOpenIdByActivityId(id); if(!CollectionUtils.isEmpty(openIds)){ @@ -902,12 +912,12 @@ page.setCurrent(pageNum); Long communityId = comActActivityVO.getCommunityId(); if (null != communityId){ - List<Long> communityIds = comActDAO.selectIds(communityId); - if (CollUtil.isEmpty(communityIds)) { - communityIds = new ArrayList<>(); - communityIds.add(communityId); - } - comActActivityVO.setCommunityIds(communityIds); +// List<Long> communityIds = comActDAO.selectIds(communityId); +// if (CollUtil.isEmpty(communityIds)) { +// communityIds = new ArrayList<>(); +// communityIds.add(communityId); +// } + comActActivityVO.setCommunityIds(Arrays.asList( comActActivityVO.getCommunityId() )); } IPage<ComActActivityVO> iPage = comActActivityDAO.pageActivityCommunityBack(page, comActActivityVO); iPage.getRecords().forEach(vo ->{ @@ -1358,10 +1368,10 @@ ComActActivityInvite activityInvite = comActActivityInviteService.getBaseMapper().selectOne(new LambdaQueryWrapper<ComActActivityInvite>() .eq(ComActActivityInvite::getActivityId, activityId).eq(ComActActivityInvite::getUserId, userId)); if (isNull(activityInvite)) { - int count = pbMemberDAO.checkIsPbMember(userId); - if (count < 1) { - return R.fail(HttpStatus.NOT_ACCEPTABLE, "您还不是党员"); - } +// int count = pbMemberDAO.checkIsPbMember(userId); +// if (count < 1) { +// return R.fail(HttpStatus.NOT_ACCEPTABLE, "您还不是党员"); +// } // 查询当前活动下参与志愿者 Integer partyMemberCount = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda() .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getSignIdentity, 2) @@ -1378,10 +1388,10 @@ if (volunteerMax == null) { return R.fail("活动暂未对志愿者开放"); } - int count = pbMemberDAO.checkIsVolunteer(userId); - if (count < 1) { - return R.fail(HttpStatus.NOT_ACCEPTABLE, "您还不是志愿者"); - } +// int count = pbMemberDAO.checkIsVolunteer(userId); +// if (count < 1) { +// return R.fail(HttpStatus.NOT_ACCEPTABLE, "您还不是志愿者"); +// } // 查询当前活动下参与志愿者 Integer volunteerCount = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda() .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getSignIdentity, 3).eq(ComActActSignDO::getStatus, 1)); @@ -1434,37 +1444,37 @@ if(!StringUtils.isEmpty(actActivityDO.getJinhuiCoinPunishment()) && !StringUtils.equals(actActivityDO.getJinhuiCoinPunishment(),"0")) { //查询个人金汇币总额 -// R<JinhuiCoinGeneralTable> jinhuiCoinGeneralTable=jinhuiCommunityService.coinTableGetDetails(userId+""); -// if(jinhuiCoinGeneralTable!=null) -// { -// if (!StringUtils.isEmpty(jinhuiCoinGeneralTable.getData().getGoldCoin())) -// { -// JinhuiCoinGeneralTableVO jinhuiVO=new JinhuiCoinGeneralTableVO(); -// jinhuiVO.setId(jinhuiCoinGeneralTable.getData().getId()); -// -// int punishmentGold=Integer.valueOf(actActivityDO.getJinhuiCoinPunishment()); -// int allGold=Integer.valueOf(jinhuiCoinGeneralTable.getData().getGoldCoin()); -// if(punishmentGold>=allGold) -// { -// jinhuiVO.setGoldCoin("0"); -// } -// else -// { -// allGold=allGold-punishmentGold; -// jinhuiVO.setGoldCoin(allGold+""); -// } -// jinhuiCommunityService.coinTableEditData(jinhuiVO); -// } -// } + JinhuiCoinGeneralTable jinhuiCoinGeneralTable=comActActRegistDAO.getDetails(userId+""); + if(jinhuiCoinGeneralTable!=null) + { + if (!StringUtils.isEmpty(jinhuiCoinGeneralTable.getGoldCoin())) + { + JinhuiCoinGeneralTableVO jinhuiVO=new JinhuiCoinGeneralTableVO(); + jinhuiVO.setId(jinhuiCoinGeneralTable.getId()); -// JinhuiGoldCoinRecordVO jVo=new JinhuiGoldCoinRecordVO(); -// jVo.setCommunityId(actActivityDO.getCommunityId()+""); -// jVo.setTitle("取消志愿者活动"); -// jVo.setUserId(userId+""); -// jVo.setRemark("取消志愿者活动"); -// jVo.setType("2"); -// jVo.setGoldCoin(actActivityDO.getJinhuiCoinPunishment()); -// jinhuiCommunityService.recordAddData(jVo); + int punishmentGold=Integer.valueOf(actActivityDO.getJinhuiCoinPunishment()); + int allGold=Integer.valueOf(jinhuiCoinGeneralTable.getGoldCoin()); + if(punishmentGold>=allGold) + { + jinhuiVO.setGoldCoin("0"); + } + else + { + allGold=allGold-punishmentGold; + jinhuiVO.setGoldCoin(allGold+""); + } + jinhuiCommunityService.coinTableEditData(jinhuiVO); + } + } + + JinhuiGoldCoinRecordVO jVo=new JinhuiGoldCoinRecordVO(); + jVo.setCommunityId(actActivityDO.getCommunityId()+""); + jVo.setTitle("取消志愿者活动"); + jVo.setUserId(userId+""); + jVo.setRemark("取消志愿者活动"); + jVo.setType("2"); + jVo.setGoldCoin(actActivityDO.getJinhuiCoinPunishment()); + jinhuiCommunityService.recordAddData(jVo); } @@ -1515,10 +1525,48 @@ if (comActActActRegistDO.getEndTime() != null) { return R.fail("无法重复签退"); } - int retrieveIntegral = 0; + + //1.居民 2.党员 3.志愿者 + switch (comActActActRegistDO.getSignIdentity()) + { + case 1: + if(comActActivityDO.getParticipantRewardWay()==2) + { + int hours = com.panzhihua.common.utlis.DateUtils.getHour(comActActActRegistDO.getStartTime(), comActActActRegistDO.getEndTime()); + if(hours>1) + { + rewardIntegral=rewardIntegral * hours; + } + } + break; + + case 2: + if(comActActivityDO.getPbRewardWay()==2) + { + int hours = com.panzhihua.common.utlis.DateUtils.getHour(comActActActRegistDO.getStartTime(), comActActActRegistDO.getEndTime()); + if(hours>1) + { + rewardIntegral=rewardIntegral * hours; + } + } + break; + + case 3: + if(comActActivityDO.getVolunteerRewardWay()==2) + { + int hours = com.panzhihua.common.utlis.DateUtils.getHour(comActActActRegistDO.getStartTime(), comActActActRegistDO.getEndTime()); + if(hours>1) + { + rewardIntegral=rewardIntegral * hours; + } + } + break; + } + comActActRegistDO.setId(comActActActRegistDO.getId()); comActActRegistDO.setEndTime(nowDate); - comActActRegistDO.setAward(retrieveIntegral); + comActActRegistDO.setAward(rewardIntegral); + int result = comActActRegistDAO.updateById(comActActRegistDO); if (result > 0) { if (isHave) { @@ -1533,29 +1581,37 @@ // comActIntegralUserTradeService.addIntegralTradeAdmin(addComActIntegralUserDTO); //查询个人金汇币总额 -// R<JinhuiCoinGeneralTable> jinhuiCoinGeneralTable=jinhuiCommunityService.coinTableGetDetails(userId+""); -// if(jinhuiCoinGeneralTable!=null) -// { -// if (!StringUtils.isEmpty(jinhuiCoinGeneralTable.getData().getGoldCoin())) -// { -// JinhuiCoinGeneralTableVO jinhuiVO=new JinhuiCoinGeneralTableVO(); -// jinhuiVO.setId(jinhuiCoinGeneralTable.getData().getId()); -// -// int allGold=Integer.valueOf(jinhuiCoinGeneralTable.getData().getGoldCoin()); -// allGold=allGold+rewardIntegral; -// jinhuiVO.setGoldCoin(allGold+""); -// jinhuiCommunityService.coinTableEditData(jinhuiVO); -// } -// } -// -// JinhuiGoldCoinRecordVO jVo=new JinhuiGoldCoinRecordVO(); -// jVo.setCommunityId(comActActivityDO.getCommunityId()+""); -// jVo.setTitle("志愿者活动奖励"); -// jVo.setUserId(userId+""); -// jVo.setRemark("志愿者活动奖励"); -// jVo.setType("1"); -// jVo.setGoldCoin(rewardIntegral+""); -// jinhuiCommunityService.recordAddData(jVo); + JinhuiCoinGeneralTable jinhuiCoinGeneralTable=comActActRegistDAO.getDetails(userId+""); + if(jinhuiCoinGeneralTable!=null) + { + JinhuiCoinGeneralTableVO jinhuiVO=new JinhuiCoinGeneralTableVO(); + jinhuiVO.setId(jinhuiCoinGeneralTable.getId()); + int allGold=0; + if (!StringUtils.isEmpty(jinhuiCoinGeneralTable.getGoldCoin())) + { + allGold=Integer.valueOf(jinhuiCoinGeneralTable.getGoldCoin()); + } + allGold=allGold+rewardIntegral; + jinhuiVO.setGoldCoin(allGold+""); + jinhuiCommunityService.coinTableEditData(jinhuiVO); + } + else + { + JinhuiCoinGeneralTableVO jinhuiVO=new JinhuiCoinGeneralTableVO(); + jinhuiVO.setCommunityId(comActActivityDO.getCommunityId()+""); + jinhuiVO.setGoldCoin(rewardIntegral+""); + jinhuiVO.setUserId(userId+""); + jinhuiCommunityService.coinTableAddData(jinhuiVO); + } + + JinhuiGoldCoinRecordVO jVo=new JinhuiGoldCoinRecordVO(); + jVo.setCommunityId(comActActivityDO.getCommunityId()+""); + jVo.setTitle("志愿者活动奖励"); + jVo.setUserId(userId+""); + jVo.setRemark("志愿者活动奖励"); + jVo.setType("1"); + jVo.setGoldCoin(rewardIntegral+""); + jinhuiCommunityService.recordAddData(jVo); return R.ok(); } else { return R.ok(); -- Gitblit v1.7.1