| | |
| | | import com.panzhihua.common.model.dtos.partybuilding.NeedProblemClaimDTO; |
| | | import com.panzhihua.common.model.dtos.partybuilding.NeedProblemInventoryDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActActRegistVO; |
| | | import com.panzhihua.common.utlis.Snowflake; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_dangjian.dao.NeedProblemClaimDAO; |
| | |
| | | import com.panzhihua.service_dangjian.entity.UserTrade; |
| | | import com.panzhihua.service_dangjian.service.NeedProblemClaimService; |
| | | import com.panzhihua.service_dangjian.service.NeedProblemInventoryService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | NeedProblemInventoryDTO dto=inventoryService.getDetails(taskId,userId); |
| | | UserTrade userTrade=new UserTrade(); |
| | | //增加积分 |
| | | UserIntegral integral = baseMapper.getUserIntegral(userId); |
| | | UserIntegral integral = baseMapper.getUserIntegral(userId,dto.getCommunityId()); |
| | | if (integral == null) { |
| | | UserIntegral addIn = new UserIntegral(); |
| | | addIn.setId(Snowflake.getId()+""); |
| | |
| | | } |
| | | else |
| | | { |
| | | int award=Integer.valueOf(dto.getAward()); |
| | | int integralAvailableSum=Integer.valueOf(integral.getIntegralAvailableSum())+award; |
| | | int integralSum=Integer.valueOf(integral.getIntegralSum())+award; |
| | | int award=0; |
| | | int integralAvailableSum=0; |
| | | int integralSum=0; |
| | | |
| | | if(!StringUtils.isEmpty(dto.getAward())) |
| | | { |
| | | award=Integer.valueOf(dto.getAward()); |
| | | } |
| | | |
| | | if(!StringUtils.isEmpty(integral.getIntegralAvailableSum())) |
| | | { |
| | | integralAvailableSum=Integer.valueOf(integral.getIntegralAvailableSum())+award; |
| | | } |
| | | |
| | | if(!StringUtils.isEmpty(integral.getIntegralSum())) |
| | | { |
| | | integralSum=Integer.valueOf(integral.getIntegralSum())+award; |
| | | } |
| | | |
| | | userTrade.setIntegralId(integral.getId()); |
| | | integral.setIntegralAvailableSum(integralAvailableSum+""); |
| | | integral.setIntegralSum(integralSum+""); |
| | |
| | | } |
| | | return baseMapper.editData(item); |
| | | } |
| | | |
| | | @Override |
| | | public R upNewFightNeedProblemClaimEndTime() |
| | | { |
| | | |
| | | //获取未签退的活动id |
| | | List<String> activityList=baseMapper.getNotTimeTaskList(); |
| | | if(activityList!=null && activityList.size()>0) |
| | | { |
| | | for (String aId:activityList) |
| | | { |
| | | NeedProblemInventoryDTO comActActivityDO=baseMapper.getActivityEndTime(aId); |
| | | |
| | | if(comActActivityDO!=null) |
| | | { |
| | | if(comActActivityDO.getNeedEndTime().getTime()<new Date().getTime()) |
| | | { |
| | | List<NeedProblemClaimDTO> timeList=baseMapper.getNotTimeId(aId); |
| | | for (NeedProblemClaimDTO user:timeList) |
| | | { |
| | | long time=comActActivityDO.getNeedEndTime().getTime()-user.getPunchStartTime().getTime(); |
| | | baseMapper.updateEndTime(user.getId(),time+"",comActActivityDO.getNeedEndTime()); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | List<NeedProblemClaimDTO> timeList=baseMapper.getNotTimeId(aId); |
| | | for (NeedProblemClaimDTO user:timeList) |
| | | { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(user.getPunchStartTime()); |
| | | calendar.add(Calendar.HOUR_OF_DAY, 3); // 加3小时 |
| | | Date newDate = calendar.getTime(); |
| | | long time=newDate.getTime()-user.getPunchStartTime().getTime(); |
| | | |
| | | baseMapper.updateEndTime(user.getId(),time+"",newDate); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |