Merge branch 'pr_14' into dev-V0.4.5
commit
83b2a05dee
|
@ -1,7 +1,6 @@
|
|||
package cc.iotkit.model.system;
|
||||
|
||||
import cc.iotkit.model.Id;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
@ -14,7 +13,7 @@ import java.util.Date;
|
|||
* @date 2023-02-07
|
||||
*/
|
||||
@Data
|
||||
public class SysLogininfor implements Id<Long>,Serializable {
|
||||
public class SysLoginInfo implements Id<Long>,Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
|
@ -2,7 +2,7 @@ package cc.iotkit.data.system;
|
|||
|
||||
import cc.iotkit.data.ICommonData;
|
||||
import cc.iotkit.common.api.Paging;
|
||||
import cc.iotkit.model.system.SysLogininfor;
|
||||
import cc.iotkit.model.system.SysLoginInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -11,17 +11,17 @@ import java.util.List;
|
|||
*
|
||||
* @author sjg
|
||||
*/
|
||||
public interface ISysLogininforData extends ICommonData<SysLogininfor, Long> {
|
||||
public interface ISysLogininforData extends ICommonData<SysLoginInfo, Long> {
|
||||
|
||||
/**
|
||||
* 按条件查询
|
||||
*/
|
||||
List<SysLogininfor> findByConditions(SysLogininfor cond);
|
||||
List<SysLoginInfo> findByConditions(SysLoginInfo cond);
|
||||
|
||||
/**
|
||||
* 按条件分页查询
|
||||
*/
|
||||
Paging<SysLogininfor> findByConditions(SysLogininfor cond, int page, int size);
|
||||
Paging<SysLoginInfo> findByConditions(SysLoginInfo cond, int page, int size);
|
||||
|
||||
/**
|
||||
* 按租户清除登录日志
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cc.iotkit.data.model;
|
||||
|
||||
import cc.iotkit.model.system.SysLogininfor;
|
||||
import cc.iotkit.model.system.SysLoginInfo;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -21,7 +21,7 @@ import java.util.Date;
|
|||
@Data
|
||||
@Entity
|
||||
@Table(name = "sys_logininfor")
|
||||
@AutoMapper(target = SysLogininfor.class)
|
||||
@AutoMapper(target = SysLoginInfo.class)
|
||||
public class TbSysLogininfor extends BaseEntity {
|
||||
/**
|
||||
* ID
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package cc.iotkit.data.model;
|
||||
|
||||
import cc.iotkit.data.model.BaseEntity;
|
||||
import cc.iotkit.model.system.SysLogininfor;
|
||||
import cc.iotkit.model.system.SysNotice;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cc.iotkit.data.model;
|
||||
|
||||
import cc.iotkit.common.constant.UserConstants;
|
||||
import cc.iotkit.data.model.BaseEntity;
|
||||
import cc.iotkit.model.system.SysTenant;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cc.iotkit.data.model;
|
||||
|
||||
import cc.iotkit.common.constant.UserConstants;
|
||||
import cc.iotkit.data.model.BaseEntity;
|
||||
import cc.iotkit.model.system.SysTenantPackage;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
|
@ -8,7 +8,6 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.springframework.boot.context.properties.bind.DefaultValue;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
package cc.iotkit.data.model;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
|
|
@ -10,7 +10,7 @@ import cc.iotkit.data.model.TbSysLogininfor;
|
|||
import cc.iotkit.data.system.ISysLogininforData;
|
||||
import cc.iotkit.data.util.PageBuilder;
|
||||
import cc.iotkit.data.util.PredicateBuilder;
|
||||
import cc.iotkit.model.system.SysLogininfor;
|
||||
import cc.iotkit.model.system.SysLoginInfo;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -30,7 +30,7 @@ import static cc.iotkit.data.model.QTbSysLogininfor.tbSysLogininfor;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysLogininfoDataImpl implements ISysLogininforData, IJPACommData<SysLogininfor, Long> {
|
||||
public class SysLogininfoDataImpl implements ISysLogininforData, IJPACommData<SysLoginInfo, Long> {
|
||||
|
||||
private final SysLogininforRepository logininfoRepository;
|
||||
|
||||
|
@ -50,22 +50,22 @@ public class SysLogininfoDataImpl implements ISysLogininforData, IJPACommData<Sy
|
|||
|
||||
@Override
|
||||
public Class getTClass() {
|
||||
return SysLogininfor.class;
|
||||
return SysLoginInfo.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysLogininfor> findAll(PageRequest<SysLogininfor> pageRequest) {
|
||||
return PageBuilder.toPaging(logininfoRepository.findAll(genPredicate(pageRequest.getData()), PageBuilder.toPageable(pageRequest))).to(SysLogininfor.class);
|
||||
public Paging<SysLoginInfo> findAll(PageRequest<SysLoginInfo> pageRequest) {
|
||||
return PageBuilder.toPaging(logininfoRepository.findAll(genPredicate(pageRequest.getData()), PageBuilder.toPageable(pageRequest))).to(SysLoginInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysLogininfor> findByConditions(SysLogininfor data) {
|
||||
public List<SysLoginInfo> findByConditions(SysLoginInfo data) {
|
||||
List<TbSysLogininfor> ret=jpaQueryFactory.selectFrom(tbSysLogininfor).where(genPredicate(data))
|
||||
.orderBy(tbSysLogininfor.id.desc()).fetch();
|
||||
return MapstructUtils.convert(ret, SysLogininfor.class);
|
||||
return MapstructUtils.convert(ret, SysLoginInfo.class);
|
||||
}
|
||||
|
||||
private static Predicate genPredicate(SysLogininfor data) {
|
||||
private static Predicate genPredicate(SysLoginInfo data) {
|
||||
return PredicateBuilder.instance()
|
||||
.and(StringUtils.isNotBlank(data.getIpaddr()), () -> tbSysLogininfor.ipaddr.like(data.getIpaddr()))
|
||||
.and(StringUtils.isNotBlank(data.getStatus()), () -> tbSysLogininfor.status.eq(data.getStatus()))
|
||||
|
@ -74,9 +74,9 @@ public class SysLogininfoDataImpl implements ISysLogininforData, IJPACommData<Sy
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysLogininfor> findByConditions(SysLogininfor cond, int page, int size) {
|
||||
public Paging<SysLoginInfo> findByConditions(SysLoginInfo cond, int page, int size) {
|
||||
Page<TbSysLogininfor> all = logininfoRepository.findAll(genPredicate(cond), PageBuilder.buildPageable(page, size));
|
||||
return PageBuilder.toPaging(all, SysLogininfor.class);
|
||||
return PageBuilder.toPaging(all, SysLoginInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -241,7 +241,7 @@ public class ExampleDataInit implements SmartInitializingSingleton {
|
|||
initData("sys_dict_type", sysDictTypeData, new TypeReference<List<SysDictType>>() {
|
||||
});
|
||||
|
||||
initData("sys_logininfor", sysLogininforData, new TypeReference<List<SysLogininfor>>() {
|
||||
initData("sys_logininfor", sysLogininforData, new TypeReference<List<SysLoginInfo>>() {
|
||||
});
|
||||
initData("sys_menu", sysMenuData, new TypeReference<List<SysMenu>>() {
|
||||
});
|
||||
|
|
|
@ -149,17 +149,17 @@ public class ScreenServiceImpl implements IScreenService {
|
|||
@Override
|
||||
public void publishStatusChange(PublishChangeBo data) {
|
||||
Screen screen = getAndCheckBigScreen(data.getId());
|
||||
if (screen.STATE_RUNNING.equals(data.getState())) {//发布状态
|
||||
if (Screen.STATE_RUNNING.equals(data.getState())) {//发布状态
|
||||
List<ScreenApi> screenApis=screenApiData.findByScreenId(screen.getId());
|
||||
if(screenApis==null||screenApis.size()==0){
|
||||
throw new BizException(ErrCode.API_LIST_BLANK);
|
||||
}
|
||||
screen.setState(screen.STATE_RUNNING);
|
||||
screen.setState(Screen.STATE_RUNNING);
|
||||
screenManager.register(screen);
|
||||
screenManager.publish(screen);
|
||||
} else {//取消发布
|
||||
screen.setState(screen.STATE_STOPPED);
|
||||
screenManager.unpublish(screen);
|
||||
screen.setState(Screen.STATE_STOPPED);
|
||||
screenManager.unPublish(screen);
|
||||
}
|
||||
screenData.save(screen);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -75,7 +76,7 @@ public class ScreenManager {
|
|||
states.put(id, true);
|
||||
}
|
||||
|
||||
public void unpublish(Screen screen) {
|
||||
public void unPublish(Screen screen) {
|
||||
Long id = screen.getId();
|
||||
ScreenComponent screenComponent = screens.get(id);
|
||||
if (screenComponent == null) {
|
||||
|
@ -83,7 +84,7 @@ public class ScreenManager {
|
|||
}
|
||||
screens.remove(id);
|
||||
states.remove(id);
|
||||
screenComponent.unpublish();
|
||||
screenComponent.unPublish();
|
||||
}
|
||||
|
||||
public void previewApis(Screen screen,List<ScreenApi> screenApis) {
|
||||
|
@ -99,7 +100,7 @@ public class ScreenManager {
|
|||
Long id = screen.getId();
|
||||
ScreenComponent screenComponent = screens.get(id);
|
||||
if (screenComponent == null) {
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return screenComponent.getScreenApis();
|
||||
}
|
||||
|
|
|
@ -68,9 +68,9 @@ public class ScreenComponent {
|
|||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void unpublish() {
|
||||
public void unPublish() {
|
||||
screenVerticle.stop();
|
||||
Future<Void> future = vertx.undeploy(deployedId);
|
||||
future.onSuccess(unused -> log.info("unpublish screen success"));
|
||||
future.onSuccess(unused -> log.info("unPublish screen success"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ScreenVerticle extends AbstractVerticle {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
public void start() {
|
||||
httpServer = vertx.createHttpServer();
|
||||
Router router = Router.router(vertx);
|
||||
router.route(screenConfig.screenAdmin + "/*").handler(StaticHandler.create(screenConfig.getScreenDir()+"/"+apiHandler.getScreenId()+"/"+packageName));
|
||||
|
@ -62,7 +62,7 @@ public class ScreenVerticle extends AbstractVerticle {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
public void stop() {
|
||||
httpServer.close(voidAsyncResult -> log.info("close screen server..."));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cc.iotkit.system.config;
|
||||
|
||||
import io.github.linpeilie.annotations.ComponentModelConfig;
|
||||
import io.github.linpeilie.annotations.MapperConfig;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,7 @@ import cc.iotkit.common.log.enums.BusinessType;
|
|||
import cc.iotkit.common.redis.utils.RedisUtils;
|
||||
import cc.iotkit.common.validate.QueryGroup;
|
||||
import cc.iotkit.common.web.core.BaseController;
|
||||
import cc.iotkit.system.dto.bo.SysLogininforBo;
|
||||
import cc.iotkit.system.dto.bo.SysLoginInfoBo;
|
||||
import cc.iotkit.system.dto.vo.SysLogininforVo;
|
||||
import cc.iotkit.system.service.ISysLogininforService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
@ -43,7 +43,7 @@ public class SysLogininforController extends BaseController {
|
|||
@ApiOperation("获取系统访问记录列表")
|
||||
@SaCheckPermission("monitor:logininfor:list")
|
||||
@PostMapping("/list")
|
||||
public Paging<SysLogininforVo> list(@RequestBody @Validated(QueryGroup.class) PageRequest<SysLogininforBo> query) {
|
||||
public Paging<SysLogininforVo> list(@RequestBody @Validated(QueryGroup.class) PageRequest<SysLoginInfoBo> query) {
|
||||
return logininforService.findAll(query);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class SysLogininforController extends BaseController {
|
|||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@SaCheckPermission("monitor:logininfor:export")
|
||||
@PostMapping("/export")
|
||||
public void export(SysLogininforBo logininfor, HttpServletResponse response) {
|
||||
public void export(SysLoginInfoBo logininfor, HttpServletResponse response) {
|
||||
List<SysLogininforVo> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil.exportExcel(list, "登录日志", SysLogininforVo.class, response);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class SysLogininforController extends BaseController {
|
|||
@PostMapping("/unlockByUserName")
|
||||
public void unlock(@Validated @RequestBody Request<String> bo) {
|
||||
String loginName = GlobalConstants.PWD_ERR_CNT_KEY + bo.getData();
|
||||
if (RedisUtils.hasKey(loginName)) {
|
||||
if (Boolean.TRUE.equals(RedisUtils.hasKey(loginName))) {
|
||||
RedisUtils.deleteObject(loginName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public class SysMenuController extends BaseController {
|
|||
}, mode = SaMode.OR)
|
||||
@SaCheckPermission("system:menu:query")
|
||||
@PostMapping("/treeselect")
|
||||
public List<Tree<Long>> treeselect(@Validated @RequestBody Request<SysMenuBo> menu) {
|
||||
public List<Tree<Long>> treeSelect(@Validated @RequestBody Request<SysMenuBo> menu) {
|
||||
List<SysMenuVo> menus = menuService.selectMenuList(menu.getData(), LoginHelper.getUserId());
|
||||
return menuService.buildMenuTreeSelect(menus);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class SysMenuController extends BaseController {
|
|||
}, mode = SaMode.OR)
|
||||
@SaCheckPermission("system:menu:query")
|
||||
@PostMapping(value = "/roleMenuTreeselectByRoleId")
|
||||
public MenuTreeSelectVo roleMenuTreeselect(@Validated @RequestBody Request<Long> bo) {
|
||||
public MenuTreeSelectVo roleMenuTreeSelect(@Validated @RequestBody Request<Long> bo) {
|
||||
List<SysMenuVo> menus = menuService.selectMenuList(LoginHelper.getUserId());
|
||||
MenuTreeSelectVo selectVo = new MenuTreeSelectVo();
|
||||
selectVo.setCheckedKeys(menuService.selectMenuListByRoleId(bo.getData()));
|
||||
|
|
|
@ -8,14 +8,16 @@ import cc.iotkit.common.log.enums.BusinessType;
|
|||
import cc.iotkit.common.web.core.BaseController;
|
||||
import cc.iotkit.system.dto.bo.SysNoticeBo;
|
||||
import cc.iotkit.system.dto.vo.SysNoticeVo;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cc.iotkit.system.service.ISysNoticeService;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,6 @@ import cc.iotkit.system.service.ISysOssService;
|
|||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -24,7 +23,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,10 +17,12 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -66,7 +66,7 @@ public class SysProfileController extends BaseController {
|
|||
public void updateProfile(@RequestBody Request<SysUserProfileBo> bo) {
|
||||
SysUserProfileBo profile = bo.getData();
|
||||
SysUserBo user = BeanUtil.toBean(profile, SysUserBo.class);
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) {
|
||||
fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
|
|
|
@ -20,8 +20,6 @@ import com.baomidou.lock.annotation.Lock4j;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
|
@ -153,15 +153,13 @@ public class SysUserController extends BaseController {
|
|||
SysUserBo user = reqUser.getData();
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
} else if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) {
|
||||
fail("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
if (TenantHelper.isEnable()) {
|
||||
if (!tenantService.checkAccountBalance(TenantHelper.getTenantId())) {
|
||||
fail("当前租户下用户名额不足,请联系管理员");
|
||||
}
|
||||
if (TenantHelper.isEnable() && !tenantService.checkAccountBalance(TenantHelper.getTenantId())) {
|
||||
fail("当前租户下用户名额不足,请联系管理员");
|
||||
}
|
||||
user.setPassword(BCrypt.hashpw(user.getPassword()));
|
||||
user.setUserType("sys_user");
|
||||
|
@ -181,7 +179,7 @@ public class SysUserController extends BaseController {
|
|||
userService.checkUserDataScope(user.getId());
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
} else if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) {
|
||||
fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
|
|
|
@ -84,9 +84,6 @@ public class SysUserOnlineController extends BaseController {
|
|||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@PostMapping("/kickoutByTokenValue")
|
||||
public void forceLogout(@RequestBody @Validated Request<String> bo) {
|
||||
try {
|
||||
StpUtil.kickoutByTokenValue(bo.getData());
|
||||
} catch (NotLoginException ignored) {
|
||||
}
|
||||
StpUtil.kickoutByTokenValue(bo.getData());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,6 @@ package cc.iotkit.system.dto.bo;
|
|||
|
||||
import cc.iotkit.common.api.BaseDto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cc.iotkit.system.dto.bo;
|
||||
|
||||
import cc.iotkit.model.system.SysLogininfor;
|
||||
import cc.iotkit.model.system.SysLoginInfo;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -15,8 +15,8 @@ import java.util.Map;
|
|||
*/
|
||||
|
||||
@Data
|
||||
@AutoMapper(target = SysLogininfor.class, reverseConvertGenerate = false)
|
||||
public class SysLogininforBo {
|
||||
@AutoMapper(target = SysLoginInfo.class, reverseConvertGenerate = false)
|
||||
public class SysLoginInfoBo {
|
||||
|
||||
/**
|
||||
* 访问ID
|
|
@ -1,15 +1,8 @@
|
|||
package cc.iotkit.system.dto.bo;
|
||||
|
||||
import cc.iotkit.common.api.BaseDto;
|
||||
import cc.iotkit.common.constant.UserConstants;
|
||||
import cc.iotkit.common.validate.AddGroup;
|
||||
import cc.iotkit.common.validate.EditGroup;
|
||||
import cc.iotkit.model.system.SysRole;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -32,7 +25,6 @@ public class SysRoleAuthBo extends BaseDto {
|
|||
|
||||
|
||||
@ApiModelProperty(value = "用户ID列表")
|
||||
|
||||
private Long[] userIds;
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
package cc.iotkit.system.dto.bo;
|
||||
|
||||
import cc.iotkit.common.api.BaseDto;
|
||||
import cc.iotkit.common.constant.UserConstants;
|
||||
import cc.iotkit.model.system.SysUser;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
|
@ -2,7 +2,7 @@ package cc.iotkit.system.dto.vo;
|
|||
|
||||
import cc.iotkit.common.excel.annotation.ExcelDictFormat;
|
||||
import cc.iotkit.common.excel.convert.ExcelDictConvert;
|
||||
import cc.iotkit.model.system.SysLogininfor;
|
||||
import cc.iotkit.model.system.SysLoginInfo;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
|
@ -21,7 +21,7 @@ import java.util.Date;
|
|||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SysLogininfor.class)
|
||||
@AutoMapper(target = SysLoginInfo.class)
|
||||
public class SysLogininforVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.alibaba.excel.context.AnalysisContext;
|
|||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -62,7 +63,7 @@ public class SysUserImportListener extends AnalysisEventListener<SysUserImportVo
|
|||
userService.insertUser(user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>").append(successNum).append("、账号 ").append(user.getUserName()).append(" 导入成功");
|
||||
} else if (isUpdateSupport) {
|
||||
} else if (Boolean.TRUE.equals(isUpdateSupport)) {
|
||||
Long userId = sysUser.getId();
|
||||
SysUserBo user = BeanUtil.toBean(userVo, SysUserBo.class);
|
||||
user.setId(userId);
|
||||
|
@ -107,12 +108,12 @@ public class SysUserImportListener extends AnalysisEventListener<SysUserImportVo
|
|||
|
||||
@Override
|
||||
public List<SysUserImportVo> getList() {
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getErrorList() {
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class SystemApplicationRunner implements ApplicationRunner {
|
|||
private final ISysOssConfigService ossConfigService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
public void run(ApplicationArguments args) {
|
||||
ossConfigService.init();
|
||||
log.info("初始化OSS配置成功");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package cc.iotkit.system.service;
|
|||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.api.Paging;
|
||||
import cc.iotkit.system.dto.bo.SysLogininforBo;
|
||||
import cc.iotkit.system.dto.bo.SysLoginInfoBo;
|
||||
import cc.iotkit.system.dto.vo.SysLogininforVo;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -22,7 +22,7 @@ public interface ISysLogininforService {
|
|||
*
|
||||
* @param bo 访问日志对象
|
||||
*/
|
||||
void insertLogininfor(SysLogininforBo bo);
|
||||
void insertLogininfor(SysLoginInfoBo bo);
|
||||
|
||||
/**
|
||||
* 查询系统登录日志集合
|
||||
|
@ -30,7 +30,7 @@ public interface ISysLogininforService {
|
|||
* @param logininfor 访问日志对象
|
||||
* @return 登录记录集合
|
||||
*/
|
||||
List<SysLogininforVo> selectLogininforList(SysLogininforBo logininfor);
|
||||
List<SysLogininforVo> selectLogininforList(SysLoginInfoBo logininfor);
|
||||
|
||||
/**
|
||||
* 批量删除系统登录日志
|
||||
|
@ -45,5 +45,5 @@ public interface ISysLogininforService {
|
|||
*/
|
||||
void cleanLogininfor();
|
||||
|
||||
Paging<SysLogininforVo> findAll(PageRequest<SysLogininforBo> query);
|
||||
Paging<SysLogininforVo> findAll(PageRequest<SysLoginInfoBo> query);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import cc.iotkit.system.dto.bo.SysOssBo;
|
|||
import cc.iotkit.system.dto.vo.SysOssVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
|
@ -9,8 +9,8 @@ import cc.iotkit.common.utils.StringUtils;
|
|||
import cc.iotkit.common.utils.ip.AddressUtils;
|
||||
import cc.iotkit.common.web.utils.ServletUtils;
|
||||
import cc.iotkit.data.system.ISysLogininforData;
|
||||
import cc.iotkit.model.system.SysLogininfor;
|
||||
import cc.iotkit.system.dto.bo.SysLogininforBo;
|
||||
import cc.iotkit.model.system.SysLoginInfo;
|
||||
import cc.iotkit.system.dto.bo.SysLoginInfoBo;
|
||||
import cc.iotkit.system.dto.vo.SysLogininforVo;
|
||||
import cc.iotkit.system.service.ISysLogininforService;
|
||||
import cn.hutool.http.useragent.UserAgent;
|
||||
|
@ -64,7 +64,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
|||
// 获取客户端浏览器
|
||||
String browser = userAgent.getBrowser().getName();
|
||||
// 封装对象
|
||||
SysLogininforBo logininfor = new SysLogininforBo();
|
||||
SysLoginInfoBo logininfor = new SysLoginInfoBo();
|
||||
logininfor.setTenantId(logininforEvent.getTenantId());
|
||||
logininfor.setUserName(logininforEvent.getUsername());
|
||||
logininfor.setIpaddr(ip);
|
||||
|
@ -97,8 +97,8 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
|||
* @param bo 访问日志对象
|
||||
*/
|
||||
@Override
|
||||
public void insertLogininfor(SysLogininforBo bo) {
|
||||
SysLogininfor logininfor = MapstructUtils.convert(bo, SysLogininfor.class);
|
||||
public void insertLogininfor(SysLoginInfoBo bo) {
|
||||
SysLoginInfo logininfor = MapstructUtils.convert(bo, SysLoginInfo.class);
|
||||
logininfor.setLoginTime(new Date());
|
||||
sysLogininforData.save(logininfor);
|
||||
}
|
||||
|
@ -110,10 +110,10 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
|||
* @return 登录记录集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysLogininforVo> selectLogininforList(SysLogininforBo logininfor) {
|
||||
public List<SysLogininforVo> selectLogininforList(SysLoginInfoBo logininfor) {
|
||||
return MapstructUtils.convert(
|
||||
sysLogininforData.findByConditions(
|
||||
MapstructUtils.convert(logininfor, SysLogininfor.class)
|
||||
MapstructUtils.convert(logininfor, SysLoginInfo.class)
|
||||
), SysLogininforVo.class
|
||||
);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysLogininforVo> findAll(PageRequest<SysLogininforBo> query) {
|
||||
return sysLogininforData.findAll(query.to(SysLogininfor.class)).to(SysLogininforVo.class);
|
||||
public Paging<SysLogininforVo> findAll(PageRequest<SysLoginInfoBo> query) {
|
||||
return sysLogininforData.findAll(query.to(SysLoginInfo.class)).to(SysLogininforVo.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,10 @@ import cc.iotkit.data.system.ISysNoticeData;
|
|||
import cc.iotkit.model.system.SysNotice;
|
||||
import cc.iotkit.system.dto.bo.SysNoticeBo;
|
||||
import cc.iotkit.system.dto.vo.SysNoticeVo;
|
||||
import cc.iotkit.system.dto.vo.SysUserVo;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cc.iotkit.system.service.ISysNoticeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 对象存储配置Service业务层处理
|
||||
|
@ -52,10 +53,10 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||
List<SysOssConfig> list = baseData.findAll();
|
||||
Map<String, List<SysOssConfig>> map = StreamUtils.groupByKey(list, SysOssConfig::getTenantId);
|
||||
try {
|
||||
for (String tenantId : map.keySet()) {
|
||||
TenantHelper.setDynamic(tenantId);
|
||||
// 加载OSS初始化配置
|
||||
for (SysOssConfig config : map.get(tenantId)) {
|
||||
|
||||
for (Map.Entry<String, List<SysOssConfig>> stringListEntry : map.entrySet()) {
|
||||
TenantHelper.setDynamic(stringListEntry.getKey());
|
||||
for (SysOssConfig config : stringListEntry.getValue()) {
|
||||
String configKey = config.getConfigKey();
|
||||
if ("0".equals(config.getStatus())) {
|
||||
RedisUtils.setCacheObject(OssConstant.DEFAULT_CONFIG_KEY, configKey);
|
||||
|
@ -75,12 +76,10 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||
|
||||
@Override
|
||||
public Paging<SysOssConfigVo> queryPageList(PageRequest<SysOssConfigBo> query) {
|
||||
return baseData.findAll(query.to(SysOssConfig.class)).to(SysOssConfigVo.class);
|
||||
return baseData.findAll(query.to(SysOssConfig.class)).to(SysOssConfigVo.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean insertByBo(SysOssConfigBo bo) {
|
||||
SysOssConfig config = MapstructUtils.convert(bo, SysOssConfig.class);
|
||||
|
@ -105,17 +104,15 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||
*/
|
||||
private void validEntityBeforeSave(SysOssConfig entity) {
|
||||
if (StringUtils.isNotEmpty(entity.getConfigKey())
|
||||
&& !checkConfigKeyUnique(entity)) {
|
||||
&& !checkConfigKeyUnique(entity)) {
|
||||
throw new BizException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
if (CollUtil.containsAny(ids, OssConstant.SYSTEM_DATA_IDS)) {
|
||||
if (Objects.equals(Boolean.TRUE, isValid) && CollUtil.containsAny(ids, OssConstant.SYSTEM_DATA_IDS)) {
|
||||
throw new BizException("系统内置, 不可删除!");
|
||||
}
|
||||
}
|
||||
List<SysOssConfig> list = CollUtil.newArrayList();
|
||||
for (Long configId : ids) {
|
||||
|
@ -124,12 +121,9 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||
}
|
||||
// TODO: 2021/8/13 删除数据校验
|
||||
baseData.deleteByIds(ids);
|
||||
boolean flag = true;
|
||||
if (flag) {
|
||||
list.forEach(sysOssConfig ->
|
||||
list.forEach(sysOssConfig ->
|
||||
CacheUtils.evict(CacheNames.SYS_OSS_CONFIG, sysOssConfig.getConfigKey()));
|
||||
}
|
||||
return flag;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,10 +134,7 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||
SysOssConfig q = new SysOssConfig();
|
||||
q.setConfigKey(sysOssConfig.getConfigKey());
|
||||
SysOssConfig info = baseData.findOneByCondition(q);
|
||||
if (ObjectUtil.isNotNull(info) && info.getId() != ossConfigId) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !ObjectUtil.isNotNull(info) || info.getId() == ossConfigId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 文件上传 服务层实现
|
||||
|
@ -77,13 +76,16 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void download(Long ossId) throws IOException {
|
||||
public void download(Long ossId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysOssVo upload(MultipartFile file) {
|
||||
String originalfileName = file.getOriginalFilename();
|
||||
String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length());
|
||||
String originalFileName = file.getOriginalFilename();
|
||||
if(originalFileName ==null){
|
||||
throw new BizException("文件名为空,获取失败");
|
||||
}
|
||||
String suffix = StringUtils.substring(originalFileName, originalFileName.lastIndexOf("."), originalFileName.length());
|
||||
OssClient storage = OssFactory.instance();
|
||||
UploadResult uploadResult;
|
||||
try {
|
||||
|
@ -96,7 +98,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||
oss.setUrl(uploadResult.getUrl());
|
||||
oss.setFileSuffix(suffix);
|
||||
oss.setFileName(uploadResult.getFilename());
|
||||
oss.setOriginalName(originalfileName);
|
||||
oss.setOriginalName(originalFileName);
|
||||
oss.setService(storage.getConfigKey());
|
||||
sysOssData.save(oss);
|
||||
SysOssVo sysOssVo = MapstructUtils.convert(oss, SysOssVo.class);
|
||||
|
@ -105,7 +107,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||
|
||||
@Override
|
||||
public void deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
if (Boolean.TRUE.equals(isValid)) {
|
||||
// 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
List<SysOss> list = sysOssData.findByIds(ids);
|
||||
|
|
|
@ -19,7 +19,6 @@ import cc.iotkit.model.system.SysUserRole;
|
|||
import cc.iotkit.system.dto.bo.SysRoleBo;
|
||||
import cc.iotkit.system.dto.vo.SysRoleVo;
|
||||
import cc.iotkit.system.service.ISysRoleService;
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
@ -279,7 +278,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||
rm.setMenuId(menuId);
|
||||
list.add(rm);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
rows = iSysRoleMenuData.insertBatch(list);
|
||||
}
|
||||
return Integer.parseInt(rows + "");
|
||||
|
@ -300,7 +299,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||
rd.setDeptId(deptId);
|
||||
list.add(rd);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
rows = iSysRoleDeptData.insertBatch(list);
|
||||
}
|
||||
return Integer.parseInt(rows + "");
|
||||
|
@ -417,10 +416,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||
}
|
||||
LoginUser loginUser = LoginHelper.getLoginUser(token);
|
||||
if (loginUser.getRoles().stream().anyMatch(r -> r.getId().equals(roleId))) {
|
||||
try {
|
||||
StpUtil.logoutByTokenValue(token);
|
||||
} catch (NotLoginException ignored) {
|
||||
}
|
||||
StpUtil.logoutByTokenValue(token);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -57,12 +57,12 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||
|
||||
@Override
|
||||
public Boolean insertByBo(SysTenantBo bo) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByBo(SysTenantBo bo) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +77,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,6 +104,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||
|
||||
@Override
|
||||
public Boolean syncTenantPackage(String tenantId, String packageId) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||
private ISysUserPostData sysUserPostData;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String selectUserNameById(Long userId) {
|
||||
return null;
|
||||
|
@ -69,33 +68,33 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||
|
||||
@Override
|
||||
public List<SysUserVo> selectUserList(SysUserBo user) {
|
||||
return MapstructUtils.convert(sysUserData.findAllByCondition(user.to(SysUser.class)),SysUserVo.class);
|
||||
return MapstructUtils.convert(sysUserData.findAllByCondition(user.to(SysUser.class)), SysUserVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysUserVo> selectAllocatedList( PageRequest<SysUserBo> query) {
|
||||
public Paging<SysUserVo> selectAllocatedList(PageRequest<SysUserBo> query) {
|
||||
return sysUserData.selectAllocatedList(query.to(SysUser.class)).to(SysUserVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysUserVo> selectUnallocatedList( PageRequest<SysUserBo> query) {
|
||||
public Paging<SysUserVo> selectUnallocatedList(PageRequest<SysUserBo> query) {
|
||||
return sysUserData.selectUnallocatedList(query.to(SysUser.class)).to(SysUserVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUserVo selectUserByUserName(String userName) {
|
||||
return MapstructUtils.convert(sysUserData.selectUserByUserName(userName),SysUserVo.class);
|
||||
return MapstructUtils.convert(sysUserData.selectUserByUserName(userName), SysUserVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUserVo selectUserByPhonenumber(String phonenumber) {
|
||||
return MapstructUtils.convert(sysUserData.findByPhonenumber(phonenumber),SysUserVo.class);
|
||||
return MapstructUtils.convert(sysUserData.findByPhonenumber(phonenumber), SysUserVo.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUserVo selectUserById(Long userId) {
|
||||
return MapstructUtils.convert(sysUserData.findById(userId),SysUserVo.class);
|
||||
return MapstructUtils.convert(sysUserData.findById(userId), SysUserVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,20 +109,17 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||
|
||||
@Override
|
||||
public boolean checkUserNameUnique(SysUserBo user) {
|
||||
boolean exist = sysUserData.checkUserNameUnique(user.to(SysUser.class));
|
||||
return exist;
|
||||
return sysUserData.checkUserNameUnique(user.to(SysUser.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPhoneUnique(SysUserBo user) {
|
||||
boolean exist = sysUserData.checkPhoneUnique(user.to(SysUser.class));
|
||||
return exist;
|
||||
return sysUserData.checkPhoneUnique(user.to(SysUser.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEmailUnique(SysUserBo user) {
|
||||
boolean exist = sysUserData.checkEmailUnique(user.to(SysUser.class));
|
||||
return exist;
|
||||
return sysUserData.checkEmailUnique(user.to(SysUser.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,13 +145,13 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||
@Override
|
||||
public int insertUser(SysUserBo user) {
|
||||
// 新增用户信息
|
||||
SysUser newUser=sysUserData.save(user.to(SysUser.class));
|
||||
SysUser newUser = sysUserData.save(user.to(SysUser.class));
|
||||
user.setId(newUser.getId());
|
||||
// 新增用户岗位关联
|
||||
insertUserPost(user,false);
|
||||
insertUserPost(user, false);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user, false);
|
||||
return newUser!=null?1:0;
|
||||
return newUser != null ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -244,11 +240,10 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
||||
// 防止错误更新后导致的数据误删除
|
||||
SysUser ret = sysUserData.save(sysUser);
|
||||
if (ret==null) {
|
||||
if (ret == null) {
|
||||
throw new BizException("修改用户" + user.getUserName() + "信息失败");
|
||||
}
|
||||
return ret==null?1:0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -259,21 +254,21 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||
|
||||
@Override
|
||||
public int updateUserStatus(Long userId, String status) {
|
||||
SysUser user=sysUserData.findById(userId);
|
||||
SysUser user = sysUserData.findById(userId);
|
||||
user.setStatus(status);
|
||||
return sysUserData.save(user)!=null?1:0;
|
||||
return sysUserData.save(user) != null ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateUserProfile(SysUserBo user) {
|
||||
SysUser oldUser=sysUserData.findById(user.getId());
|
||||
if(ObjectUtil.isNotNull(user.getNickName())){
|
||||
SysUser oldUser = sysUserData.findById(user.getId());
|
||||
if (ObjectUtil.isNotNull(user.getNickName())) {
|
||||
oldUser.setNickName(user.getNickName());
|
||||
}
|
||||
oldUser.setPhonenumber(user.getPhonenumber());
|
||||
oldUser.setPhonenumber(user.getPhoneNumber());
|
||||
oldUser.setEmail(user.getEmail());
|
||||
oldUser.setSex(user.getSex());
|
||||
return sysUserData.save(oldUser)!=null?1:0;
|
||||
return sysUserData.save(oldUser) != null ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -283,9 +278,9 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||
|
||||
@Override
|
||||
public int resetUserPwd(Long userId, String password) {
|
||||
SysUser user=sysUserData.findById(userId);
|
||||
SysUser user = sysUserData.findById(userId);
|
||||
user.setPassword(password);
|
||||
return sysUserData.save(user)!=null?1:0;
|
||||
return sysUserData.save(user) != null ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue