2021与蓝度共同重构项目,服务端
liuhaonan
2021-11-26 05052488d9ea5cdbd49bc681c5421034f31208e6
ximon-admin/src/main/java/com/sandu/ximon/admin/security/CountSet.java
@@ -2,10 +2,10 @@
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;
@@ -15,22 +15,19 @@
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");
@@ -49,15 +46,16 @@
        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);
    }
}