Commit dab5d4a2 authored by 赵啸非's avatar 赵啸非

删除部分过时类

parent 2148b2a3
......@@ -23,7 +23,7 @@
<properties>
<profiles.active>develop</profiles.active>
<profiles.platform.type>standalone</profiles.platform.type>
<profiles.server.port>11086</profiles.server.port>
<profiles.server.port>21086</profiles.server.port>
<profiles.server.path>/enterprise</profiles.server.path>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
......@@ -41,7 +41,7 @@
<properties>
<profiles.active>test</profiles.active>
<profiles.platform.type>cloud</profiles.platform.type>
<profiles.server.port>11086</profiles.server.port>
<profiles.server.port>21086</profiles.server.port>
<profiles.server.path>/enterprise</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
......
package com.mortals.xhx.daemon.task;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.common.code.FinishMethodEnum;
import com.mortals.xhx.common.code.MeetStatusEnum;
import com.mortals.xhx.module.metting.model.MettingRecordEntity;
import com.mortals.xhx.module.metting.model.MettingRecordQuery;
import com.mortals.xhx.module.metting.service.MettingRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 同步更新会议状态
*/
@Slf4j
@Service("SyncMeetStatusTask")
public class SyncMeetStatusTaskImpl implements ITaskExcuteService {
@Autowired
private MettingRecordService mettingRecordService;
@Override
public void excuteTask(ITask task) throws AppException {
log.debug("同步更新会议状态");
syncMeetStatus();
log.debug("同步更新会议状态完成");
}
private void syncMeetStatus() {
MettingRecordQuery mettingRecordQuery = new MettingRecordQuery();
//mettingRecordQuery.setFinishMethod(FinishMethodEnum.自动结束.getValue());
mettingRecordQuery.setMeetStatus(MeetStatusEnum.等待中.getValue());
List<MettingRecordEntity> recordEntities = mettingRecordService.find(mettingRecordQuery);
for (MettingRecordEntity recordEntity : recordEntities) {
if(new Date().getTime()>recordEntity.getMeetTimeStart().getTime()){
//更新状态
recordEntity.setMeetStatus(MeetStatusEnum.进行中.getValue());
recordEntity.setUpdateTime(new Date());
recordEntity.setUpdateUserId(1L);
mettingRecordService.update(recordEntity);
}
/*
//判断当前时间是否已经在区间范围内,如果在 更新状态
boolean in = DateUtil.isIn(new Date(), recordEntity.getMeetTimeStart(), recordEntity.getMeetTimeEnd());
if (in) {
//更新状态
recordEntity.setMeetStatus(MeetStatusEnum.进行中.getValue());
recordEntity.setUpdateTime(new Date());
recordEntity.setUpdateUserId(1L);
mettingRecordService.update(recordEntity);
}*/
}
mettingRecordQuery = new MettingRecordQuery();
//mettingRecordQuery.setFinishMethod(FinishMethodEnum.自动结束.getValue());
mettingRecordQuery.setMeetStatus(MeetStatusEnum.进行中.getValue());
List<MettingRecordEntity> pendRecordEntities = mettingRecordService.find(mettingRecordQuery);
for (MettingRecordEntity pendRecordEntity : pendRecordEntities) {
boolean in = DateUtil.isIn(new Date(), pendRecordEntity.getMeetTimeStart(), pendRecordEntity.getMeetTimeEnd());
if (!in) {
//更新状态
pendRecordEntity.setMeetStatus(MeetStatusEnum.已结束.getValue());
pendRecordEntity.setFinishMethod(FinishMethodEnum.自动结束.getValue());
pendRecordEntity.setUpdateTime(new Date());
pendRecordEntity.setUpdateUserId(1L);
mettingRecordService.update(pendRecordEntity);
}
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
package com.mortals.xhx.daemon.task;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.feign.user.IUserFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.List;
/**
* 同步门户用户,唯一标识为用户名。
*/
@Slf4j
//@Service("SyncUserTask")
//@ConditionalOnExpression("'${spring.profiles.active}'!='develop'")
public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired
private IUserFeign userFeign;
@Autowired
private UserService userService;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("同步用户任务");
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> resp = userFeign.list(userPdu);
if (resp.getCode() == YesNoEnum.YES.getValue()) {
//同步更新用户,以loginname为唯一标识,密码默认与用户相同
resp.getData().getData().forEach(user -> {
//log.info("loginName:{}", user.getLoginName());
UserEntity tempEntity = userService.selectOne(new UserQuery().loginName(user.getLoginName()));
if (ObjectUtils.isEmpty(tempEntity)) {
UserEntity userEntity = new UserEntity();
BeanUtils.copyProperties(user, userEntity, new String[]{"id","lastLoginTime", "lastLoginAddress"});
//log.info("新增:{}", JSON.toJSONString(userEntity));
userService.getUserDao().insert(userEntity);
}else {
//更新基本信息
UserEntity userEntity = new UserEntity();
BeanUtils.copyProperties(user, userEntity, new String[]{"loginPwd","userType","status","lastLoginTime", "lastLoginAddress"});
// log.info("更新:{}", JSON.toJSONString(userEntity));
userService.getUserDao().update(userEntity);
}
});
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
public static void main(String[] args) {
System.out.println(StrUtil.cleanBlank("sss aaa"));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment