新增热门活动自动更新状态
All checks were successful
Build and Push to Target Registry / 构建并推送镜像到目标仓库 (push) Successful in 6m50s
All checks were successful
Build and Push to Target Registry / 构建并推送镜像到目标仓库 (push) Successful in 6m50s
This commit is contained in:
parent
a056feae53
commit
3a44280abe
@ -0,0 +1,41 @@
|
|||||||
|
package org.dromara.property.domain.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yuyongle
|
||||||
|
* @Date:2025/7/4 10:35
|
||||||
|
* @Description:活动状态枚举
|
||||||
|
**/
|
||||||
|
@Getter
|
||||||
|
public enum ActivitiesStatusEnum {
|
||||||
|
/**
|
||||||
|
* 未开始
|
||||||
|
*/
|
||||||
|
NOTSTARTED("未开始", "1"),
|
||||||
|
/**
|
||||||
|
* 待提货
|
||||||
|
*/
|
||||||
|
INPROGRESS("待提货", "2"),
|
||||||
|
/**
|
||||||
|
* 已结束
|
||||||
|
*/
|
||||||
|
HASENDED("已结束", "3");
|
||||||
|
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
ActivitiesStatusEnum(String name, String value) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.property.domain.enums.ActivitiesStatusEnum;
|
||||||
import org.dromara.property.domain.vo.CustomerNoticesVo;
|
import org.dromara.property.domain.vo.CustomerNoticesVo;
|
||||||
import org.dromara.system.api.RemoteUserService;
|
import org.dromara.system.api.RemoteUserService;
|
||||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||||
@ -21,11 +22,9 @@ import org.dromara.property.domain.vo.PopularActivitiesVo;
|
|||||||
import org.dromara.property.domain.PopularActivities;
|
import org.dromara.property.domain.PopularActivities;
|
||||||
import org.dromara.property.mapper.PopularActivitiesMapper;
|
import org.dromara.property.mapper.PopularActivitiesMapper;
|
||||||
import org.dromara.property.service.IPopularActivitiesService;
|
import org.dromara.property.service.IPopularActivitiesService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.logging.Handler;
|
import java.util.logging.Handler;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -130,6 +129,7 @@ public class PopularActivitiesServiceImpl implements IPopularActivitiesService {
|
|||||||
* @return 是否新增成功
|
* @return 是否新增成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insertByBo(PopularActivitiesBo bo) {
|
public Boolean insertByBo(PopularActivitiesBo bo) {
|
||||||
PopularActivities add = MapstructUtils.convert(bo, PopularActivities.class);
|
PopularActivities add = MapstructUtils.convert(bo, PopularActivities.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
@ -147,9 +147,10 @@ public class PopularActivitiesServiceImpl implements IPopularActivitiesService {
|
|||||||
* @return 是否修改成功
|
* @return 是否修改成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean updateByBo(PopularActivitiesBo bo) {
|
public Boolean updateByBo(PopularActivitiesBo bo) {
|
||||||
PopularActivities update = MapstructUtils.convert(bo, PopularActivities.class);
|
PopularActivities update = MapstructUtils.convert(bo, PopularActivities.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeUpdate(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +158,18 @@ public class PopularActivitiesServiceImpl implements IPopularActivitiesService {
|
|||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(PopularActivities entity) {
|
private void validEntityBeforeSave(PopularActivities entity) {
|
||||||
|
//TODO拿当前时间和开始时间和结束时间做对比修改状态
|
||||||
|
Date now = new Date();
|
||||||
|
entity.setStatus(
|
||||||
|
now.before(entity.getStartTime()) ? ActivitiesStatusEnum.NOTSTARTED.getValue() :
|
||||||
|
now.after(entity.getEndTime()) ? ActivitiesStatusEnum.HASENDED.getValue() : ActivitiesStatusEnum.INPROGRESS.getValue()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeUpdate(PopularActivities entity) {
|
||||||
//TODO 做一些数据校验,如唯一约束
|
//TODO 做一些数据校验,如唯一约束
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package org.dromara.property.tasks;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.property.domain.PopularActivities;
|
||||||
|
import org.dromara.property.domain.enums.ActivitiesStatusEnum;
|
||||||
|
import org.dromara.property.mapper.PopularActivitiesMapper;
|
||||||
|
import org.dromara.property.service.IPopularActivitiesService;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyongle
|
||||||
|
* @version 1.0
|
||||||
|
* @description: TODO
|
||||||
|
* @date 2025/8/20 10:22
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PopularActivitiesTasks {
|
||||||
|
private final PopularActivitiesMapper popularActivitiesMapper;
|
||||||
|
/**
|
||||||
|
* 修改活动到期的活动状态
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Scheduled(cron = "0 0 */1 * * ?")
|
||||||
|
//@GetMapping("/serviceWorkOrderTaskId")
|
||||||
|
private void handlePopularActivities() {
|
||||||
|
List<PopularActivities> popularActivities = popularActivitiesMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<PopularActivities>()
|
||||||
|
.ne(PopularActivities::getStatus, ActivitiesStatusEnum.HASENDED.getValue())
|
||||||
|
);
|
||||||
|
Date now = new Date();
|
||||||
|
popularActivities.stream().forEach(entity ->{
|
||||||
|
//TODO拿当前时间和开始时间和结束时间做对比修改状态
|
||||||
|
entity.setStatus(
|
||||||
|
now.before(entity.getStartTime()) ? ActivitiesStatusEnum.NOTSTARTED.getValue() :
|
||||||
|
now.after(entity.getEndTime()) ? ActivitiesStatusEnum.HASENDED.getValue() : ActivitiesStatusEnum.INPROGRESS.getValue()
|
||||||
|
);
|
||||||
|
});
|
||||||
|
popularActivitiesMapper.updateBatchById(popularActivities);
|
||||||
|
}
|
||||||
|
}
|
@ -48,9 +48,9 @@ public class ServiceWorkOrderTasks {
|
|||||||
/**
|
/**
|
||||||
* 查询状态为创建工单的工单,查询当天排班人员,为工单自动派单
|
* 查询状态为创建工单的工单,查询当天排班人员,为工单自动派单
|
||||||
*/
|
*/
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
// @Scheduled(cron = "0 0 */1 * * ?")
|
@Scheduled(cron = "0 0 */1 * * ?")
|
||||||
@GetMapping("/serviceWorkOrderTaskId")
|
//@GetMapping("/serviceWorkOrderTaskId")
|
||||||
private void handleServiceWorkOrder() {
|
private void handleServiceWorkOrder() {
|
||||||
List<ServiceWorkOrders> serviceWorkOrderList = workOrdersMapper.selectList(
|
List<ServiceWorkOrders> serviceWorkOrderList = workOrdersMapper.selectList(
|
||||||
new LambdaQueryWrapper<ServiceWorkOrders>()
|
new LambdaQueryWrapper<ServiceWorkOrders>()
|
||||||
@ -88,9 +88,9 @@ public class ServiceWorkOrderTasks {
|
|||||||
/**
|
/**
|
||||||
* 处理超过30分钟的工单
|
* 处理超过30分钟的工单
|
||||||
*/
|
*/
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
// @Scheduled(cron = "0 0 */1 * * ?")
|
@Scheduled(cron = "0 0 */1 * * ?")
|
||||||
@GetMapping("/thirtyWorkOrderTaskId")
|
// @GetMapping("/thirtyWorkOrderTaskId")
|
||||||
private void thirtyHandleServiceWorkOrder() {
|
private void thirtyHandleServiceWorkOrder() {
|
||||||
// 1. 查询当前状态为“已派单”的工单
|
// 1. 查询当前状态为“已派单”的工单
|
||||||
List<ServiceWorkOrders> serviceWorkOrderList = workOrdersMapper.selectList(
|
List<ServiceWorkOrders> serviceWorkOrderList = workOrdersMapper.selectList(
|
||||||
|
Loading…
Reference in New Issue
Block a user