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