| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.ChronoUnit; |
| | |
| | | } else { |
| | | appUserTree.setIsSign(2); |
| | | } |
| | | if (temp >= 120) { |
| | | if (temp >= 3600) { |
| | | if (appUserTree.getTaskOne() == 2) { |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | |
| | | } |
| | | appUserTree.setTaskOne(1); |
| | | appUserTree.setTaskTwo(1); |
| | | } else if (temp >= 60) { |
| | | } else if (temp >= 1800) { |
| | | if (appUserTree.getTaskOne() == 2) { |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | |
| | | appUserTree.setTotalEnergyValue(byId.getTotalEnergyValue()); |
| | | return R.ok(appUserTree); |
| | | } else { |
| | | if (temp >= 120) { |
| | | if (temp >= 3600) { |
| | | if (one.getTaskOne() == 2) { |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | |
| | | } |
| | | one.setTaskOne(1); |
| | | one.setTaskTwo(1); |
| | | } else if (temp >= 60) { |
| | | } else if (temp >= 1800) { |
| | | if (one.getTaskOne() == 2) { |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | |
| | | Long userId = loginUser.getUserid(); |
| | | // 给用户加10能量 |
| | | AppUser byId = appUserService.getById(userId); |
| | | if (byId.getSignTime()!=null |
| | | && byId.getSignTime().toLocalDate().equals(LocalDate.now())){ |
| | | return R.fail("您今日已签到"); |
| | | } |
| | | byId.setEnergyValue(byId.getEnergyValue()+10); |
| | | byId.setSignTime(LocalDateTime.now()); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+10); |