新增案例展示接口,调用项目数据并进去脱敏处理
This commit is contained in:
@@ -23,7 +23,7 @@ public class DomainServiceImpl extends ServiceImpl<DomainMapper, Domain> impleme
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<Domain> pageRel(DomainParam param) {
|
public PageResult<Domain> pageRel(DomainParam param) {
|
||||||
PageParam<Domain, DomainParam> page = new PageParam<>(param);
|
PageParam<Domain, DomainParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("status desc,create_time desc");
|
page.setDefaultOrder("sort_number asc, status desc,create_time desc");
|
||||||
List<Domain> list = baseMapper.selectPageRel(page, param);
|
List<Domain> list = baseMapper.selectPageRel(page, param);
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ public class DomainServiceImpl extends ServiceImpl<DomainMapper, Domain> impleme
|
|||||||
List<Domain> list = baseMapper.selectListRel(param);
|
List<Domain> list = baseMapper.selectListRel(param);
|
||||||
// 排序
|
// 排序
|
||||||
PageParam<Domain, DomainParam> page = new PageParam<>();
|
PageParam<Domain, DomainParam> page = new PageParam<>();
|
||||||
page.setDefaultOrder("status desc,create_time desc");
|
page.setDefaultOrder("sort_number asc, status desc,create_time desc");
|
||||||
return page.sortRecords(list);
|
return page.sortRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.oa.controller;
|
package com.gxwebsoft.oa.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.DesensitizedUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||||
@@ -19,7 +20,10 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.gxwebsoft.common.core.constants.AppUserConstants.ADMINISTRATOR;
|
import static com.gxwebsoft.common.core.constants.AppUserConstants.ADMINISTRATOR;
|
||||||
@@ -78,6 +82,10 @@ public class AppController extends BaseController {
|
|||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<App>> page(AppParam param) {
|
public ApiResult<PageResult<App>> page(AppParam param) {
|
||||||
final User loginUser = getLoginUser();
|
final User loginUser = getLoginUser();
|
||||||
|
// 未登录情况
|
||||||
|
if(loginUser == null){
|
||||||
|
return success("案例列表",caseList(param));
|
||||||
|
}
|
||||||
final Integer userId = loginUser.getUserId();
|
final Integer userId = loginUser.getUserId();
|
||||||
loginUser.getRoles().forEach(d -> {
|
loginUser.getRoles().forEach(d -> {
|
||||||
if(!StrUtil.equals(d.getRoleCode(),"superAdmin") && !StrUtil.equals(d.getRoleCode(),"admin")){
|
if(!StrUtil.equals(d.getRoleCode(),"superAdmin") && !StrUtil.equals(d.getRoleCode(),"admin")){
|
||||||
@@ -96,6 +104,16 @@ public class AppController extends BaseController {
|
|||||||
return success(appService.pageRel(param));
|
return success(appService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 读取案例列表
|
||||||
|
private PageResult<App> caseList(AppParam param){
|
||||||
|
param.setShowCase(true);
|
||||||
|
final PageResult<App> appPageResult = appService.pageRel(param);
|
||||||
|
appPageResult.getList().forEach(d -> {
|
||||||
|
d.setContent(null);
|
||||||
|
});
|
||||||
|
return appPageResult;
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("查询全部应用管理记录表")
|
@ApiOperation("查询全部应用管理记录表")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<App>> list(AppParam param) {
|
public ApiResult<List<App>> list(AppParam param) {
|
||||||
@@ -107,6 +125,10 @@ public class AppController extends BaseController {
|
|||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<App> get(@PathVariable("id") Integer id) {
|
public ApiResult<App> get(@PathVariable("id") Integer id) {
|
||||||
final User loginUser = getLoginUser();
|
final User loginUser = getLoginUser();
|
||||||
|
// 未登录情况
|
||||||
|
if(loginUser == null){
|
||||||
|
return success("案例详情",getDesensitizedApp(id));
|
||||||
|
}
|
||||||
if (!CommonUtil.hasRole(loginUser.getRoles(),"superAdmin") && !CommonUtil.hasRole(loginUser.getRoles(),"admin")) {
|
if (!CommonUtil.hasRole(loginUser.getRoles(),"superAdmin") && !CommonUtil.hasRole(loginUser.getRoles(),"admin")) {
|
||||||
// 查询权限
|
// 查询权限
|
||||||
if (appUserService.count(new LambdaQueryWrapper<AppUser>().eq(AppUser::getUserId, getLoginUserId()).eq(AppUser::getAppId,id)) == 0) {
|
if (appUserService.count(new LambdaQueryWrapper<AppUser>().eq(AppUser::getUserId, getLoginUserId()).eq(AppUser::getAppId,id)) == 0) {
|
||||||
@@ -117,7 +139,16 @@ public class AppController extends BaseController {
|
|||||||
return success(appService.getByIdRel(id));
|
return success(appService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("添加应用管理记录表")
|
private App getDesensitizedApp(Integer id) {
|
||||||
|
final App app = appService.getByIdRel(id);
|
||||||
|
app.setPhone(DesensitizedUtil.mobilePhone(app.getPhone()));
|
||||||
|
app.setCompanyName(
|
||||||
|
StrUtil.hide(app.getCompanyName(), 2, app.getCompanyName().length() - 2));
|
||||||
|
app.setRequirement(DesensitizedUtil.chineseName(app.getCompanyName()));
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加应用管理记录表")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody App app) {
|
public ApiResult<?> save(@RequestBody App app) {
|
||||||
// 记录当前登录用户id、租户id、商户编号
|
// 记录当前登录用户id、租户id、商户编号
|
||||||
|
|||||||
@@ -198,6 +198,9 @@ public class App implements Serializable {
|
|||||||
@ApiModelProperty(value = "应用状态")
|
@ApiModelProperty(value = "应用状态")
|
||||||
private String appStatus;
|
private String appStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否作为案例展示")
|
||||||
|
private Boolean showCase;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,9 @@
|
|||||||
<if test="param.appCode != null">
|
<if test="param.appCode != null">
|
||||||
AND a.app_code LIKE CONCAT('%', #{param.appCode}, '%')
|
AND a.app_code LIKE CONCAT('%', #{param.appCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.showCase != null">
|
||||||
|
AND a.show_case = #{param.showCase}
|
||||||
|
</if>
|
||||||
<if test="param.parentId != null">
|
<if test="param.parentId != null">
|
||||||
AND a.parent_id = #{param.parentId}
|
AND a.parent_id = #{param.parentId}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -221,4 +221,8 @@ public class AppParam extends BaseParam {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Set<Integer> appIds;
|
private Set<Integer> appIds;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否作为案例展示")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean showCase;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user