修改定时器存储
This commit is contained in:
parent
e5c4d96560
commit
4f9092ab13
|
|
@ -72,34 +72,36 @@ public class SltInfoVo {
|
||||||
@ApiModelProperty(value = "租赁费用小计")
|
@ApiModelProperty(value = "租赁费用小计")
|
||||||
private BigDecimal leaseCost;
|
private BigDecimal leaseCost;
|
||||||
|
|
||||||
|
private BigDecimal aqLeaseCost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修费用小计
|
* 维修费用小计
|
||||||
*/
|
*/
|
||||||
@Excel(name = "维修费用",sort = 6,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
@Excel(name = "维修费用",sort = 6,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
||||||
@ApiModelProperty(value = "维修费用小计")
|
@ApiModelProperty(value = "维修费用小计")
|
||||||
private BigDecimal repairCost;
|
private BigDecimal repairCost;
|
||||||
|
private BigDecimal aqRepairCost;
|
||||||
/**
|
/**
|
||||||
* 报废费用小计
|
* 报废费用小计
|
||||||
*/
|
*/
|
||||||
@Excel(name = "报废费用",sort = 8,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
@Excel(name = "报废费用",sort = 8,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
||||||
@ApiModelProperty(value = "报废费用小计")
|
@ApiModelProperty(value = "报废费用小计")
|
||||||
private BigDecimal scrapCost;
|
private BigDecimal scrapCost;
|
||||||
|
private BigDecimal aqScrapCost;
|
||||||
/**
|
/**
|
||||||
* 丢失费用小计
|
* 丢失费用小计
|
||||||
*/
|
*/
|
||||||
@Excel(name = "丢失费用",sort = 7,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
@Excel(name = "丢失费用",sort = 7,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
||||||
@ApiModelProperty(value = "丢失费用小计")
|
@ApiModelProperty(value = "丢失费用小计")
|
||||||
private BigDecimal loseCost;
|
private BigDecimal loseCost;
|
||||||
|
private BigDecimal aqLoseCost;
|
||||||
/**
|
/**
|
||||||
* 减免费用小计
|
* 减免费用小计
|
||||||
*/
|
*/
|
||||||
@Excel(name = "减免费用",sort = 9,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
@Excel(name = "减免费用",sort = 9,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
||||||
@ApiModelProperty(value = "减免费用小计")
|
@ApiModelProperty(value = "减免费用小计")
|
||||||
private BigDecimal reductionCost;
|
private BigDecimal reductionCost;
|
||||||
|
private BigDecimal aqReductionCost;
|
||||||
/**
|
/**
|
||||||
* 合计
|
* 合计
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.bonus.material.warning;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.ah.sbd.SmsTool;
|
||||||
|
import com.ah.sbd.utils.param.SmsParam;
|
||||||
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||||
|
import com.bonus.common.biz.constant.BmConfigItems;
|
||||||
|
import com.bonus.common.biz.domain.SmsSendResult;
|
||||||
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
|
import com.bonus.material.back.domain.BackApplyInfo;
|
||||||
|
import com.bonus.material.back.mapper.BackApplyInfoMapper;
|
||||||
|
import com.bonus.material.basic.domain.RetainedEquipmentInfo;
|
||||||
|
import com.bonus.material.basic.mapper.ComplexQueryMapper;
|
||||||
|
import com.bonus.material.warningAnalysis.mapper.UseMaintenanceWarningMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||||
|
import org.springframework.scheduling.support.CronTrigger;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.bonus.common.biz.constant.MaterialConstants.SEND_FAILURE;
|
||||||
|
import static com.bonus.common.biz.constant.MaterialConstants.SEND_SUCCESS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务定时推送相关人员任务控制器
|
||||||
|
* @author ma_sh
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class ScheduledStorageTasks {
|
||||||
|
|
||||||
|
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ComplexQueryMapper complexQueryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ScheduledTaskRegistrar scheduledTaskRegistrar;
|
||||||
|
/**
|
||||||
|
* 定时任务执行频率,每天凌晨2点执行一次
|
||||||
|
*/
|
||||||
|
private String cronExpression = "0 0 2 * * ?";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化定时任务
|
||||||
|
*/
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
cronExpression = getCronFromDatabase();
|
||||||
|
updateCronTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新定时任务
|
||||||
|
*/
|
||||||
|
private void updateCronTask() {
|
||||||
|
scheduledTaskRegistrar.getScheduler().schedule(() -> {
|
||||||
|
taskWithFixedRate();
|
||||||
|
}, new CronTrigger(cronExpression));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从数据库中获取 cron 表达式
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getCronFromDatabase() {
|
||||||
|
// 这里假设从数据库中获取 cron 表达式
|
||||||
|
//return "0 */1 * * * ?";
|
||||||
|
return "0 0 2 * * ?";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退料人未签字三天推送一次给李勇
|
||||||
|
* 每三天的上午9点执行
|
||||||
|
*/
|
||||||
|
public void taskWithFixedRate() {
|
||||||
|
log.info("开始执行保有量存储任务");
|
||||||
|
RetainedEquipmentInfo bean = new RetainedEquipmentInfo();
|
||||||
|
List<RetainedEquipmentInfo> recordList = complexQueryMapper.getRetainedEquipmentList(bean);
|
||||||
|
complexQueryMapper.insertHisStorage(recordList);
|
||||||
|
// 记录任务执行时间
|
||||||
|
log.info("保有量存储任务执行时间:" + LocalDateTime.now().format(FORMATTER));
|
||||||
|
System.out.println("保有量存储任务执行时间:" + LocalDateTime.now().format(FORMATTER));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue