Commit 680c5f19 authored by 赵啸非's avatar 赵啸非

修改用户登录,权限分配等

parent 06fd481b
...@@ -13,6 +13,7 @@ import com.mortals.framework.model.Result; ...@@ -13,6 +13,7 @@ import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.xhx.base.system.menu.model.MenuEntity; import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.user.dao.UserDao;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import java.util.List; import java.util.List;
...@@ -115,6 +116,6 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -115,6 +116,6 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
UserDao getUserDao();
} }
\ No newline at end of file
...@@ -313,6 +313,11 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -313,6 +313,11 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
return true; return true;
} }
@Override
public UserDao getUserDao() {
return getDao();
}
@Override @Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException { protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
Arrays.asList(ids).stream().peek(userId->{ Arrays.asList(ids).stream().peek(userId->{
......
...@@ -7,10 +7,15 @@ import com.mortals.framework.common.Rest; ...@@ -7,10 +7,15 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; 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.SendStatusEnum; import com.mortals.xhx.common.code.SendStatusEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.pdu.user.UserPdu; import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.common.utils.SendSmsTask; import com.mortals.xhx.common.utils.SendSmsTask;
import com.mortals.xhx.common.utils.SendTaskThreadPool; import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.feign.user.IUserFeign; import com.mortals.xhx.feign.user.IUserFeign;
...@@ -19,8 +24,10 @@ import com.mortals.xhx.module.alarm.model.AlarmSmsSendQuery; ...@@ -19,8 +24,10 @@ import com.mortals.xhx.module.alarm.model.AlarmSmsSendQuery;
import com.mortals.xhx.module.alarm.service.AlarmSmsSendService; import com.mortals.xhx.module.alarm.service.AlarmSmsSendService;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.List; import java.util.List;
...@@ -33,6 +40,8 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -33,6 +40,8 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private IUserFeign userFeign; private IUserFeign userFeign;
@Autowired
private UserService userService;
@Override @Override
...@@ -41,9 +50,21 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -41,9 +50,21 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
UserPdu userPdu = new UserPdu(); UserPdu userPdu = new UserPdu();
userPdu.setPage(1); userPdu.setPage(1);
userPdu.setSize(-1); userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu); Rest<RespData<List<UserPdu>>> resp = userFeign.list(userPdu);
if (resp.getCode() == YesNoEnum.YES.getValue()) {
//同步更新用户,以loginname为唯一标识,密码默认与用户相同
resp.getData().getData().forEach(user -> {
UserEntity tempEntity = userService.selectOne(new UserQuery().loginName(user.getLoginName()));
if (ObjectUtils.isEmpty(tempEntity)) {
UserEntity userEntity = new UserEntity();
BeanUtils.copyProperties(user, userEntity, new String[]{"lastLoginTime","lastLoginAddress"});
userService.getUserDao().insert(userEntity);
}
});
}
log.info("syncUserResp:{}", JSON.toJSONString(list)); log.info("syncUserResp:{}", JSON.toJSONString(resp));
// return; // return;
// UserPdu userPdu = new UserPdu(); // UserPdu userPdu = new UserPdu();
......
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