| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.service.LampCountService; |
| | | import com.sandu.ximon.dao.domain.LampCount; |
| | | import com.sandu.ximon.dao.mapper.LampCountMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | |
| | | |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | @AllArgsConstructor |
| | | @RestController |
| | | @RequestMapping("aaa") |
| | | @EnableScheduling |
| | | public class CountSet extends BaseServiceImpl<LampCountMapper,LampCount> { |
| | | public class CountSet { |
| | | private final LampCountService lampCountService; |
| | | public String aVoid() { |
| | | LampCount one = getOne(Wrappers.lambdaQuery(LampCount.class)); |
| | | //LampCount one = getOne(Wrappers.lambdaQuery(LampCount.class));// |
| | | LampCount one= lampCountService.list().get(0); |
| | | int count=one.getCount(); |
| | | String number =null; |
| | | |
| | | DateFormat df = new SimpleDateFormat("yy"); |
| | | DateFormat df1 = new SimpleDateFormat("MM"); |
| | | DateFormat df2 = new SimpleDateFormat("dd"); |
| | |
| | | |
| | | count++; |
| | | one.setCount(count); |
| | | updateById(one); |
| | | lampCountService.updateById(one); |
| | | |
| | | return formattedDate+formattedDate1+formattedDate2+number; |
| | | |
| | | } |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void reset(){ |
| | | LampCount one = getOne(Wrappers.lambdaQuery(LampCount.class)); |
| | | //LampCount one = getOne(Wrappers.lambdaQuery(LampCount.class)); |
| | | LampCount one= lampCountService.list().get(0); |
| | | one.setCount(4); |
| | | updateById(one); |
| | | lampCountService.updateById(one); |
| | | } |
| | | } |