对比新文件 |
| | |
| | | package com.gk.firework.Scheduls.DealSoldNoStock; |
| | | |
| | | import com.gk.firework.Domain.Enterprise; |
| | | import com.gk.firework.Domain.SoldNoStockInfo; |
| | | import com.gk.firework.Domain.UserInfo; |
| | | import com.gk.firework.Scheduls.GenerateCode.GenerateCodeTask; |
| | | import com.gk.firework.Service.EnterpriseService; |
| | | import com.gk.firework.Service.EntryService; |
| | | import com.gk.firework.Service.SoldNoStockService; |
| | | import com.gk.firework.Service.UserService; |
| | | import org.apache.log4j.LogManager; |
| | | import org.apache.log4j.Logger; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author : jingjy |
| | | * @date : 2021/4/14 15:05 |
| | | */ |
| | | @Configuration |
| | | @EnableScheduling |
| | | @ConditionalOnProperty(prefix = "scheduling",name = "enabled",havingValue = "true") |
| | | public class DealSoldNoStock { |
| | | private Logger logger = LogManager.getLogger(GenerateCodeTask.class); |
| | | @Autowired |
| | | private SoldNoStockService soldNoStockService; |
| | | @Autowired |
| | | private EnterpriseService enterpriseService; |
| | | @Autowired |
| | | private EntryService entryService; |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Scheduled(cron = "0 0 3 * * ?") |
| | | // @Scheduled(cron = "0/5 * * * * ?") //每隔5秒执行一次 |
| | | public void entryPatch(){ |
| | | |
| | | List<Enterprise>enterprises = enterpriseService.selectSaleEnterprise(); |
| | | for (Enterprise enterprise : enterprises){ |
| | | List<SoldNoStockInfo>soldNoStockInfos = soldNoStockService.selectSoldNoStocksUnprocessed(enterprise); |
| | | if (soldNoStockInfos.size() == 0){ |
| | | continue; |
| | | } |
| | | UserInfo userInfo = userService.selectByUser(soldNoStockInfos.get(0).getSalesperson()); |
| | | userInfo.setUsername("系统生成"); |
| | | String auth = "EYXWRK"; |
| | | entryService.entryPatch(soldNoStockInfos,userInfo, auth); |
| | | } |
| | | } |
| | | } |