Browse Source

文创办后台

master
liugw 5 years ago
parent
commit
3ec58653c3
34 changed files with 377 additions and 51 deletions
  1. 1
    1
      src/main/java/com/xdf/creative/base/params/creative/InfoBackQueryParam.java
  2. 3
    0
      src/main/java/com/xdf/creative/base/params/creative/InfoContentAddQueryParam.java
  3. 0
    1
      src/main/java/com/xdf/creative/base/params/creative/SysRoleQueryParam.java
  4. 1
    1
      src/main/java/com/xdf/creative/base/vo/creative/InfoBackQueryVo.java
  5. 21
    0
      src/main/java/com/xdf/creative/base/vo/creative/InfoContentAllQueryVo.java
  6. 10
    0
      src/main/java/com/xdf/creative/base/vo/creative/InfoContentBackSearchQueryVo.java
  7. 15
    0
      src/main/java/com/xdf/creative/base/vo/creative/InfoTypeQueryVo.java
  8. 5
    1
      src/main/java/com/xdf/creative/config/xss/XssHttpServletRequestWrapper.java
  9. 16
    6
      src/main/java/com/xdf/creative/enums/ServiceFileDirEnum.java
  10. 19
    1
      src/main/java/com/xdf/creative/module/controller/InfoBackController.java
  11. 16
    0
      src/main/java/com/xdf/creative/module/controller/InfoTypeController.java
  12. 1
    0
      src/main/java/com/xdf/creative/module/controller/SysPermissionController.java
  13. 11
    0
      src/main/java/com/xdf/creative/module/controller/SysUserController.java
  14. 1
    1
      src/main/java/com/xdf/creative/module/entity/InfoBack.java
  15. 9
    0
      src/main/java/com/xdf/creative/module/mapper/InfoTypeMapper.java
  16. 1
    0
      src/main/java/com/xdf/creative/module/mapper/SysPermissionMapper.java
  17. 12
    0
      src/main/java/com/xdf/creative/module/service/InfoTypeService.java
  18. 1
    0
      src/main/java/com/xdf/creative/module/service/SysPermissionService.java
  19. 10
    0
      src/main/java/com/xdf/creative/module/service/SysUserService.java
  20. 53
    3
      src/main/java/com/xdf/creative/module/service/impl/InfoContentServiceImpl.java
  21. 6
    0
      src/main/java/com/xdf/creative/module/service/impl/InfoTypeServiceImpl.java
  22. 5
    3
      src/main/java/com/xdf/creative/module/service/impl/SysPermissionServiceImpl.java
  23. 29
    14
      src/main/java/com/xdf/creative/module/service/impl/SysRoleServiceImpl.java
  24. 48
    0
      src/main/java/com/xdf/creative/module/service/impl/SysUserServiceImpl.java
  25. 1
    1
      src/main/java/com/xdf/creative/shiro/filter/ConfigPathInterceptor.java
  26. 29
    0
      src/main/java/com/xdf/creative/support/auth/LoginRefreshParam.java
  27. 23
    5
      src/main/java/com/xdf/creative/util/file/ServerUploadDirUtil.java
  28. 1
    0
      src/main/java/com/xdf/creative/util/tree/Utils.java
  29. 1
    0
      src/main/resources/application.properties
  30. 4
    1
      src/main/resources/application.yml
  31. 3
    3
      src/main/resources/mapper/InfoBackMapper.xml
  32. 9
    7
      src/main/resources/mapper/InfoContentMapper.xml
  33. 10
    0
      src/main/resources/mapper/InfoTypeMapper.xml
  34. 2
    2
      src/main/resources/mapper/SysPermissionMapper.xml

+ 1
- 1
src/main/java/com/xdf/creative/base/params/creative/InfoBackQueryParam.java View File

@@ -34,7 +34,7 @@ public class InfoBackQueryParam extends QueryParam {
private Long id;

@ApiModelProperty(value = "外键id")
private String foreignId;
private Long infoId;

@ApiModelProperty(value = "链接名称")
private String reason;

+ 3
- 0
src/main/java/com/xdf/creative/base/params/creative/InfoContentAddQueryParam.java View File

@@ -64,6 +64,9 @@ public class InfoContentAddQueryParam extends QueryParam {
@ApiModelProperty(value = "排序")
private Integer sort;

@ApiModelProperty(value = "保持類型 0 保存 1保持提交")
private Integer saveType;


/**
* 信息详情

+ 0
- 1
src/main/java/com/xdf/creative/base/params/creative/SysRoleQueryParam.java View File

@@ -38,7 +38,6 @@ public class SysRoleQueryParam extends QueryParam {
private String name;

@ApiModelProperty(value = "角色唯一编码")
@NotBlank(message = "角色编码不能为空")
private String code;



+ 1
- 1
src/main/java/com/xdf/creative/base/vo/creative/InfoBackQueryVo.java View File

@@ -26,7 +26,7 @@ public class InfoBackQueryVo implements Serializable {
private Long id;

@ApiModelProperty(value = "外键id")
private String foreignId;
private Long infoId;

@ApiModelProperty(value = "链接名称")
private String reason;

+ 21
- 0
src/main/java/com/xdf/creative/base/vo/creative/InfoContentAllQueryVo.java View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xdf.creative.base.params.QueryParam;
import com.xdf.creative.module.entity.InfoAttachment;
import com.xdf.creative.module.entity.InfoBack;
import com.xdf.creative.module.entity.InfoDetail;
import com.xdf.creative.module.entity.InfoUrl;
import io.swagger.annotations.ApiModel;
@@ -70,12 +71,18 @@ public class InfoContentAllQueryVo extends QueryParam {
@ApiModelProperty(value = "初审人员")
private Long firstAuditUser;

@ApiModelProperty(value = "初审人员姓名")
private String firstAuditUserName;

@ApiModelProperty(value = "初审时间")
private Date firstAuditTime;

@ApiModelProperty(value = "终审人员")
private Long finalAuditUser;

@ApiModelProperty(value = "终审人员姓名")
private String finalAuditUserName;

@ApiModelProperty(value = "终审时间")
private Date finalAuditTime;

@@ -94,11 +101,21 @@ public class InfoContentAllQueryVo extends QueryParam {
@ApiModelProperty(value = "逻辑删除,0:未删除,1:已删除")
private Integer deleted;

/**
* 类型名称
*/
private List<String> typeNameArr;

/**
* 信息详情
*/
private InfoDetail infoDetail;

/**
* 信息退回
*/
private InfoBack infoBack;

/**
* 附件列表
*/
@@ -108,4 +125,8 @@ public class InfoContentAllQueryVo extends QueryParam {
* url列表
*/
private List<InfoUrl> urlList;

/**
* 退回
*/
}

+ 10
- 0
src/main/java/com/xdf/creative/base/vo/creative/InfoContentBackSearchQueryVo.java View File

@@ -70,4 +70,14 @@ public class InfoContentBackSearchQueryVo implements Serializable {
@ApiModelProperty(value = "上下状态 0 下线 1上线")
private Integer onlineType;

/**
* 退回内容
*/
private String reason;

/**
* 退回时间
*/
private String backTime;

}

+ 15
- 0
src/main/java/com/xdf/creative/base/vo/creative/InfoTypeQueryVo.java View File

@@ -1,12 +1,15 @@
package com.xdf.creative.base.vo.creative;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
* <p>
@@ -49,4 +52,16 @@ public class InfoTypeQueryVo implements Serializable {
@ApiModelProperty(value = "创建用户")
private Long createUserId;

/**
* 用于构造树
*/
@TableField(exist = false)
protected List<InfoTypeQueryVo> children = new ArrayList<InfoTypeQueryVo>();

@TableField(exist = false)
protected Boolean leaf;

@TableField(exist = false)
protected Boolean checked;

}

+ 5
- 1
src/main/java/com/xdf/creative/config/xss/XssHttpServletRequestWrapper.java View File

@@ -8,6 +8,7 @@

package com.xdf.creative.config.xss;

import com.xdf.creative.util.XssUtil;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpHeaders;
@@ -51,6 +52,8 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
return super.getInputStream();
}



//xss过滤
json = xssEncode(json);
final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8"));
@@ -123,7 +126,8 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
}

private String xssEncode(String input) {
return htmlFilter.filter(input);
//return htmlFilter.filter(input);
return XssUtil.stripSqlXss(input);
}

/**

+ 16
- 6
src/main/java/com/xdf/creative/enums/ServiceFileDirEnum.java View File

@@ -9,15 +9,25 @@ import lombok.Getter;
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ServiceFileDirEnum {
//0 banner 1 动态新闻 2活动 3专项资金 4政策导航 5 其他
SERVICE_FILE_DIR_PUBLIC_BANNER(0, "banner"),
SERVICE_FILE_DIR_PUBLIC_BANNER(1, "banner"),
//信息发布文件
SERVICE_FILE_DIR_PUBLIC_DYNAMIC(1, "dynamic"),
SERVICE_FILE_DIR_PUBLIC_NOTICE(2, "notice"),
//信息发布文件
SERVICE_FILE_DIR_PUBLIC_DYNAMIC(3, "dynamic"),
//区划信息
SERVICE_FILE_DIR_PUBLIC_DIVISION(7, "division"),
//园区信息
SERVICE_FILE_DIR_PUBLIC_PARK(8, "park"),
//活动发布图片
SERVICE_FILE_DIR_PUBLIC_ACTIVITY(2, "activity"),
//专项资金
SERVICE_FILE_DIR_SUPPORT(3, "support"),
SERVICE_FILE_DIR_PUBLIC_ACTIVITY(9, "activity"),
//文化速递
SERVICE_FILE_DIR_PUBLIC_EXPRESS(13, "express"),
//政策导航
SERVICE_FILE_DIR_POLICY(4, "policy "),
SERVICE_FILE_DIR_POLICY(14, "policy "),
//他山之石
SERVICE_FILE_DIR_STONE(19, "stone"),
//专项资金
SERVICE_FILE_DIR_SUPPORT(22, "support"),
//其他
SERVICE_FILE_DIR_OTHER(5, "other");


+ 19
- 1
src/main/java/com/xdf/creative/module/controller/InfoBackController.java View File

@@ -1,5 +1,6 @@
package com.xdf.creative.module.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xdf.creative.base.controller.BaseController;
import com.xdf.creative.base.params.IdParam;
import com.xdf.creative.base.params.creative.InfoBackQueryParam;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
* <p>
@@ -36,6 +38,22 @@ public class InfoBackController extends BaseController {
@Autowired
private InfoBackService infoBackService;


/**
* 获取信息最新退回信息
*/
@PostMapping("/getInfoBack")
@ApiOperation(value = "获取InfoBack对象详情", notes = "查看信息退回", response = InfoBackQueryVo.class)
public ApiResult getInfoBack(@Valid @RequestBody IdParam idParam) throws Exception {
List<InfoBack> infoBackList = infoBackService.list(new QueryWrapper<InfoBack>(). eq("info_id",idParam.getId()).orderByDesc("back_time"));
if(infoBackList.size()>0){
return ApiResult.ok(infoBackList.get(0));
}else{
return ApiResult.ok();
}
}


/**
* 添加信息退回
*/
@@ -71,7 +89,7 @@ public class InfoBackController extends BaseController {
*/
@PostMapping("/info")
@ApiOperation(value = "获取InfoBack对象详情", notes = "查看信息退回", response = InfoBackQueryVo.class)
public ApiResult<InfoBackQueryVo> getInfoBack(@Valid @RequestBody IdParam idParam) throws Exception {
public ApiResult<InfoBackQueryVo> info(@Valid @RequestBody IdParam idParam) throws Exception {
InfoBackQueryVo infoBackQueryVo = infoBackService.getInfoBackById(idParam.getId());
return ApiResult.ok(infoBackQueryVo);
}

+ 16
- 0
src/main/java/com/xdf/creative/module/controller/InfoTypeController.java View File

@@ -9,6 +9,8 @@ import com.xdf.creative.module.service.InfoTypeService;
import com.xdf.creative.support.aop.OperateLogger;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;
import com.xdf.creative.util.tree.TreeConfig;
import com.xdf.creative.util.tree.Utils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -19,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
* <p>
@@ -59,6 +62,19 @@ public class InfoTypeController extends BaseController {



/**
* 栏目类型Tree列表
*/
@PostMapping("/getInfoTypeTreeList")
@ApiOperation(value = "获取栏目类型Tree列表", notes = "栏目类型Tree列表", response = InfoTypeQueryVo.class)
public ApiResult getInfoTypeTreeList() throws Exception {
List<Object> list =infoTypeService.getInfoTypeTreeList();
TreeConfig config = new TreeConfig("typeId", "typeParentId", "typeParentId", "0", "");
return ApiResult.ok(Utils.tree(list, config));
}





/**

+ 1
- 0
src/main/java/com/xdf/creative/module/controller/SysPermissionController.java View File

@@ -6,6 +6,7 @@ import com.xdf.creative.base.params.IdParam;
import com.xdf.creative.base.params.creative.SysPermissionQueryParam;
import com.xdf.creative.base.params.creative.SysRoleImpowerPermissionQueryParam;
import com.xdf.creative.base.vo.creative.SysPermissionQueryVo;
import com.xdf.creative.module.entity.InfoType;
import com.xdf.creative.module.entity.SysPermission;
import com.xdf.creative.module.service.SysPermissionService;
import com.xdf.creative.util.page.ApiResult;

+ 11
- 0
src/main/java/com/xdf/creative/module/controller/SysUserController.java View File

@@ -13,6 +13,7 @@ import com.xdf.creative.shiro.jwt.JwtUtil;
import com.xdf.creative.support.aop.AccountLogger;
import com.xdf.creative.support.aop.OperateLogger;
import com.xdf.creative.support.auth.LoginParam;
import com.xdf.creative.support.auth.LoginRefreshParam;
import com.xdf.creative.support.auth.LoginSysUserTokenVo;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;
@@ -61,6 +62,16 @@ public class SysUserController extends BaseController {
return ApiResult.ok(loginSysUserTokenVo, "登陆成功");
}


@PostMapping("/refresh")
@ApiOperation(value = "登陆", notes = "系统用户登陆", response = ApiResult.class)
public ApiResult refresh(@Valid @RequestBody LoginRefreshParam loginRefreshParam, HttpServletResponse response) throws Exception {
return sysUserService.refresh(loginRefreshParam);
}




/**
* 用户登出
*

+ 1
- 1
src/main/java/com/xdf/creative/module/entity/InfoBack.java View File

@@ -32,7 +32,7 @@ public class InfoBack extends BaseEntity {
private Long id;

@ApiModelProperty(value = "外键id")
private String foreignId;
private Long infoId;

@ApiModelProperty(value = "链接名称")
private String reason;

+ 9
- 0
src/main/java/com/xdf/creative/module/mapper/InfoTypeMapper.java View File

@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;

/**
* <p>
@@ -39,4 +40,12 @@ public interface InfoTypeMapper extends BaseMapper<InfoType> {
*/
IPage<InfoTypeQueryVo> getInfoTypePageList(@Param("page") Page page, @Param("param") InfoTypeQueryParam infoTypeQueryParam);

/**
* 获取类型资源树
*
* @return
* @throws Exception
*/
List<Object> getInfoTypeTreeList() throws Exception;

}

+ 1
- 0
src/main/java/com/xdf/creative/module/mapper/SysPermissionMapper.java View File

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xdf.creative.base.params.creative.SysPermissionQueryParam;
import com.xdf.creative.base.vo.creative.SysPermissionQueryVo;
import com.xdf.creative.module.entity.InfoType;
import com.xdf.creative.module.entity.SysPermission;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

+ 12
- 0
src/main/java/com/xdf/creative/module/service/InfoTypeService.java View File

@@ -8,6 +8,7 @@ import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;

import java.io.Serializable;
import java.util.List;

/**
* <p>
@@ -32,6 +33,17 @@ public interface InfoTypeService extends BaseService<InfoType> {
*/
InfoTypeQueryVo getInfoTypeById(Serializable id) throws Exception;


/**
* 获取类型资源树
*
* @return
* @throws Exception
*/
List<Object> getInfoTypeTreeList() throws Exception;



/**
* 获取分页对象
*

+ 1
- 0
src/main/java/com/xdf/creative/module/service/SysPermissionService.java View File

@@ -6,6 +6,7 @@ import com.xdf.creative.base.params.creative.SysPermissionQueryParam;
import com.xdf.creative.base.params.creative.SysRoleImpowerPermissionQueryParam;
import com.xdf.creative.base.service.BaseService;
import com.xdf.creative.base.vo.creative.SysPermissionQueryVo;
import com.xdf.creative.module.entity.InfoType;
import com.xdf.creative.module.entity.SysPermission;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;

+ 10
- 0
src/main/java/com/xdf/creative/module/service/SysUserService.java View File

@@ -10,6 +10,7 @@ import com.xdf.creative.base.vo.creative.SysUserInfoQueryVo;
import com.xdf.creative.base.vo.creative.SysUserQueryVo;
import com.xdf.creative.module.entity.SysUser;
import com.xdf.creative.support.auth.LoginParam;
import com.xdf.creative.support.auth.LoginRefreshParam;
import com.xdf.creative.support.auth.LoginSysUserTokenVo;
import com.xdf.creative.util.page.ApiResult;
import com.xdf.creative.util.page.PageTool;
@@ -36,6 +37,15 @@ public interface SysUserService extends BaseService<SysUser> {
*/
LoginSysUserTokenVo login(LoginParam loginParam) throws Exception;


/**
* 刷新token
* @param loginRefreshParam
* @return
* @throws Exception
*/
ApiResult refresh(LoginRefreshParam loginRefreshParam) throws Exception;

/**
* 添加用户
* @return

+ 53
- 3
src/main/java/com/xdf/creative/module/service/impl/InfoContentServiceImpl.java View File

@@ -21,8 +21,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;


/**
@@ -48,6 +50,10 @@ public class InfoContentServiceImpl extends BaseServiceImpl<InfoContentMapper, I
private InfoUrlService infoUrlService;
@Autowired
private InfoBackService infoBackService;
@Autowired
private InfoTypeService infoTypeService;
@Autowired
private SysUserService sysUserService;

/**
* t添加信息内容
@@ -69,7 +75,14 @@ public class InfoContentServiceImpl extends BaseServiceImpl<InfoContentMapper, I
}
infoContent.setCreateUser(getUserId());
infoContent.setDeleted(StateEnum.DISABLE.getKey());
infoContent.setState(InfoStateTypeEnum.INFO_STATE_TYPE_DRAFT.getCode());
if(InfoStateTypeEnum.INFO_STATE_TYPE_FIRST_AUDIT.getCode().equals(infoContentAddQueryParam.getSaveType())){
infoContent.setState(InfoStateTypeEnum.INFO_STATE_TYPE_FIRST_AUDIT.getCode());
infoContent.setSubmitTime(new Date());
}else if(InfoStateTypeEnum.INFO_STATE_TYPE_DRAFT.getCode().equals(infoContentAddQueryParam.getSaveType())){
infoContent.setState(InfoStateTypeEnum.INFO_STATE_TYPE_DRAFT.getCode());
}


infoContent.setIstop(StateEnum.DISABLE.getKey());
infoContent.setOnlineType(StateEnum.ENABLE.getKey());
infoContent.setId((long) 0);
@@ -110,6 +123,18 @@ public class InfoContentServiceImpl extends BaseServiceImpl<InfoContentMapper, I
}
InfoContentAllQueryVo infoContentAllQueryVo = new InfoContentAllQueryVo();
BeanUtils.copyProperties(infoContent, infoContentAllQueryVo);
//获取初审人员姓名
if(null!=infoContent.getFirstAuditUser()) {
SysUser userAudit = sysUserService.getById(infoContent.getFirstAuditUser());
infoContentAllQueryVo.setFirstAuditUserName(userAudit.getUsername());
}
//获取终审人员姓名
if(null!=infoContent.getFinalAuditUser()){
SysUser userFinalAudit = sysUserService.getById(infoContent.getFinalAuditUser());
infoContentAllQueryVo.setFinalAuditUserName(userFinalAudit.getUsername());
}


if (StringUtil.isNotEmpty(infoContent.getForeignId())) {
InfoDetail infoDetail = infoDetailService.getOne(new QueryWrapper<InfoDetail>().eq("foreign_id", infoContent.getForeignId()));
if (null != infoDetail) {
@@ -124,6 +149,30 @@ public class InfoContentServiceImpl extends BaseServiceImpl<InfoContentMapper, I
infoContentAllQueryVo.setUrlList(infoUrlList);
}
}

List<InfoBack> infoBackList = infoBackService.list(new QueryWrapper<InfoBack>().
eq("info_id",infoContent.getId()).orderByDesc("back_time"));
if(infoBackList.size()>0){
infoContentAllQueryVo.setInfoBack(infoBackList.get(0));
}

//获取类型
InfoType infoType = infoTypeService.getById(infoContent.getInfoTypeId());
if(null!=infoType){
List<String> selectTypeArray = new ArrayList<>();

int typeIdLength =infoType.getTypeId().length();
for(int i=0 ;i<typeIdLength/3;i++){
selectTypeArray.add(infoType.getTypeId().substring(0,3*(i+1)));
}

List<InfoType> infoTypeList = infoTypeService.list(new QueryWrapper<InfoType>().in("type_id",selectTypeArray).orderByAsc("type_id"));

List<String> typeNameArr=infoTypeList.stream().map(InfoType::getInfoName).collect(Collectors.toList());
infoContentAllQueryVo.setTypeNameArr(typeNameArr);
}


return ApiResult.ok(infoContentAllQueryVo);
}

@@ -164,6 +213,7 @@ public class InfoContentServiceImpl extends BaseServiceImpl<InfoContentMapper, I
return ApiResult.error(StatusCode.FORM_SUBMIT_UPDATE_VERIFY);
}
BeanUtils.copyProperties(infoContentAddQueryParam, infoContentNew);
infoContentNew.setUpdateTime(new Date());
InfoDetail infoDetail = infoContentAddQueryParam.getInfoDetail();
if (null != infoDetail) {
if (StringUtil.isEmpty(infoContentNew.getForeignId())) {
@@ -239,7 +289,7 @@ public class InfoContentServiceImpl extends BaseServiceImpl<InfoContentMapper, I
InfoBack infoBack = new InfoBack();
infoBack.setBackTime(new Date());
infoBack.setBackType(InfoBackTypeEnum.INFO_STATE_TYPE_AUDIT_BACK_FIRST.getCode());
infoBack.setForeignId(infoContent.getForeignId());
infoBack.setInfoId(infoContent.getId());
infoBack.setReason(infoContentAuditQueryParam.getBackIdea());
infoBack.setCreateUser(getUserId());
infoBackService.saveOrUpdate(infoBack);
@@ -284,7 +334,7 @@ public class InfoContentServiceImpl extends BaseServiceImpl<InfoContentMapper, I
InfoBack infoBack = new InfoBack();
infoBack.setBackTime(new Date());
infoBack.setBackType(InfoBackTypeEnum.INFO_STATE_TYPE_AUDIT_BACK_FINAL.getCode());
infoBack.setForeignId(infoContent.getForeignId());
infoBack.setInfoId(infoContent.getId());
infoBack.setReason(infoContentAuditQueryParam.getBackIdea());
infoBack.setCreateUser(getUserId());
infoBackService.saveOrUpdate(infoBack);

+ 6
- 0
src/main/java/com/xdf/creative/module/service/impl/InfoTypeServiceImpl.java View File

@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;


/**
@@ -48,6 +49,11 @@ public class InfoTypeServiceImpl extends BaseServiceImpl<InfoTypeMapper, InfoTyp
return infoTypeMapper.getInfoTypeById(id);
}

@Override
public List<Object> getInfoTypeTreeList( ) throws Exception {
return infoTypeMapper.getInfoTypeTreeList();
}

@Override
public PageTool<InfoTypeQueryVo> getInfoTypePageList(InfoTypeQueryParam infoTypeQueryParam) throws Exception {
Page page = setPageParam(infoTypeQueryParam);

+ 5
- 3
src/main/java/com/xdf/creative/module/service/impl/SysPermissionServiceImpl.java View File

@@ -117,9 +117,11 @@ public class SysPermissionServiceImpl extends BaseServiceImpl<SysPermissionMappe
}
//删除角色下面用户的token
List<SysUserRole> userRoleList = sysUserRoleService.list(new QueryWrapper<SysUserRole>().eq("role_id",sysRole.getId()));
if(!oauthTokenService.removeTokenByUserList(userRoleList)){
log.error("角色变更授权,对应用户token未重置");
};
if(userRoleList.size()>0) {
if (!oauthTokenService.removeTokenByUserList(userRoleList)) {
log.error("角色变更授权,对应用户token未重置");
}
}
return ApiResult.ok();
}


+ 29
- 14
src/main/java/com/xdf/creative/module/service/impl/SysRoleServiceImpl.java View File

@@ -60,9 +60,12 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
@Resource
private SysUserService sysUserService;

@Autowired
@Resource
private SysUserRoleService sysUserRoleService;

@Autowired
private SysRoleService sysRoleService;

/**
* 添加角色
* @param sysRoleQueryParam
@@ -70,15 +73,25 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
*/
@Override
public ApiResult addSysRole(SysRoleQueryParam sysRoleQueryParam) {


List<SysRole> sysRoleManage =sysRoleService.list(new QueryWrapper<SysRole>().orderByDesc("id"));
//取最大角色id
SysRole sysRole = new SysRole();
BeanUtils.copyProperties(sysRoleQueryParam,sysRole);
if (sysRoleManage.size() > 0) {
sysRole.setCode("role"+sysRoleManage.get(0).getId());
}else{
sysRole.setCode("role1");
}
try {
if (isExistsByCode(sysRoleQueryParam.getCode())) {
if (isExistsByCode(sysRole.getCode())) {
throw new BusinessException("角色编码已存在");
}
} catch (Exception e) {
return ApiResult.ok(StatusCode.SYS_USER_ROLE_EXIST);
return ApiResult.error(StatusCode.SYS_USER_ROLE_EXIST);
}
SysRole sysRole = new SysRole();
BeanUtils.copyProperties(sysRoleQueryParam,sysRole);

sysRole.setState(StateEnum.ENABLE.getKey());
sysRole.setType(StateEnum.ENABLE.getKey());
sysRole.setDeleted(StateEnum.DISABLE.getKey());
@@ -98,16 +111,18 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
}
SysRole sysRole = this.getById(sysRoleQueryParam.getId());
if(null==sysRole){
return ApiResult.ok(StatusCode.FORM_SUBMIT_UPDATE_VERIFY);
return ApiResult.error(StatusCode.FORM_SUBMIT_UPDATE_VERIFY);
}
try {
if (isExistsByCode(sysRoleQueryParam.getCode())) {
return ApiResult.ok(StatusCode.SYS_USER_ROLE_EXIST);
}
} catch (Exception e) {
return ApiResult.ok(StatusCode.SYS_USER_ROLE_EXIST);
}
BeanUtils.copyProperties(sysRoleQueryParam,sysRole);
// try {
// if (isExistsByCode(sysRoleQueryParam.getCode())) {
// return ApiResult.ok(StatusCode.SYS_USER_ROLE_EXIST);
// }
// } catch (Exception e) {
// return ApiResult.ok(StatusCode.SYS_USER_ROLE_EXIST);
// }
// BeanUtils.copyProperties(sysRoleQueryParam,sysRole);
sysRole.setName(sysRoleQueryParam.getName());
sysRole.setRemark(sysRoleQueryParam.getRemark());
sysRole.setUpdateTime(new Date());
this.saveOrUpdate(sysRole);
return ApiResult.ok();

+ 48
- 0
src/main/java/com/xdf/creative/module/service/impl/SysUserServiceImpl.java View File

@@ -18,6 +18,7 @@ import com.xdf.creative.shiro.jwt.JwtUtil;
import com.xdf.creative.shiro.jwt.SaltUtil;
import com.xdf.creative.support.aop.AccountLogger;
import com.xdf.creative.support.auth.LoginParam;
import com.xdf.creative.support.auth.LoginRefreshParam;
import com.xdf.creative.support.auth.LoginSysUserTokenVo;
import com.xdf.creative.support.auth.LoginSysUserVo;
import com.xdf.creative.support.exception.BusinessException;
@@ -166,6 +167,52 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
return loginSysUserTokenVo;
}

@Override
@Transactional
public ApiResult refresh(LoginRefreshParam loginRefreshParam) throws Exception {
SysUser sysUser = this.getById(loginRefreshParam.getUserId());
if(null==sysUser||StateEnum.DISABLE.getKey().equals(sysUser.getState())){
return ApiResult.fail("用户不存在或已被停用!");
}
OauthTokenQueryVo oauthTokenOld =oauthTokenService.getOauthTokenByToken(loginRefreshParam.getToken());
if(null==oauthTokenOld||sysUser.getId().intValue()!=oauthTokenOld.getUserId().intValue()){
return ApiResult.fail("token验证失败!");
}
// 获取数据库中保存的盐值
String newSalt = SaltUtil.getSalt(sysUser.getSalt(), jwtProperties);
// 生成token字符串并返回
Long expireSecond = jwtProperties.getExpireSecond();
String token = JwtUtil.generateToken(sysUser.getId(), sysUser.getUsername(), sysUser.getOrganizeId(), sysUser.getUserType(), newSalt, Duration.ofSeconds(expireSecond));
oauthTokenService.removeTokenByUserId(sysUser.getId());
OauthToken oauthToken = new OauthToken();
oauthTokenService.removeTokenByUserId(sysUser.getId());
oauthToken.setAccessToken(token);

//获取角色id、名称、code
HashSet<Long> roleIdSet = new HashSet<>();
HashSet<String> roleNameSet = new HashSet<>();
HashSet<String> roleCodeSet = new HashSet<>();

List<SysRoleQueryVo> sysRoleQueryVoList = sysRoleService.getUserRoleByUserId(sysUser.getId());
if (CollectionUtil.isEmpty(sysRoleQueryVoList)) {
log.error("角色不存在,用户id:"+sysUser.getId());
}
sysRoleQueryVoList.stream().forEach(sysRoleQueryVo -> {
roleIdSet.add(sysRoleQueryVo.getId());
roleNameSet.add(sysRoleQueryVo.getName());
roleCodeSet.add(sysRoleQueryVo.getCode());
});

if (!sysRoleQueryVoList.isEmpty()) {
oauthToken.setRoles(roleCodeSet.toString());
}
oauthToken.setRefreshToken(StateEnum.DISABLE.getKey());
oauthToken.setUserId(sysUser.getId());
oauthToken.setExpireTime(JwtUtil.getExpireDate(token));
oauthTokenService.save(oauthToken);
return ApiResult.ok(token);
}

/**
* 添加用户
* @param sysUserAddQueryParam
@@ -216,6 +263,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
}
if(sysUser.getState().equals(StateEnum.ENABLE.getKey())){
sysUser.setState(StateEnum.DISABLE.getKey());
oauthTokenService.removeTokenByUserId(sysUser.getId());
}else{
sysUser.setState(StateEnum.ENABLE.getKey());
}

+ 1
- 1
src/main/java/com/xdf/creative/shiro/filter/ConfigPathInterceptor.java View File

@@ -44,7 +44,7 @@ public class ConfigPathInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String token = request.getHeader("Authorization");
if (null == token) {
if (null == token||StringUtil.isEmpty(token)) {
ApiResult result = new ApiResult();
result.setCode(ApiCode.TOKEN_INVALID.getCode());
result.setMsg(ApiCode.TOKEN_INVALID.getMsg());

+ 29
- 0
src/main/java/com/xdf/creative/support/auth/LoginRefreshParam.java View File

@@ -0,0 +1,29 @@

package com.xdf.creative.support.auth;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
* 登录参数
*
* @author DeanYe
* @date 2019-05-15
**/
@Data
@ApiModel("登录参数")
public class LoginRefreshParam {

@ApiModelProperty("Token")
@NotBlank(message = "token不能为空")
private String token;

@ApiModelProperty("userId")
@NotNull(message = "userId不能为空")
private Long userId;

}

+ 23
- 5
src/main/java/com/xdf/creative/util/file/ServerUploadDirUtil.java View File

@@ -29,22 +29,40 @@ public class ServerUploadDirUtil {
String uploadDir = "";
switch (type) {
case 1:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_DYNAMIC.getName();
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_BANNER.getName();
break;
case 2:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_ACTIVITY.getName();
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_NOTICE.getName();
break;
case 3:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_SUPPORT.getName();
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_DYNAMIC.getName();
break;
case 7:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_DIVISION.getName();
break;
case 4:
case 8:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_PARK.getName();
break;
case 9:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_ACTIVITY.getName();
break;
case 13:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_EXPRESS.getName();
break;
case 14:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_POLICY.getName();
break;
case 19:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_STONE.getName();
break;
case 22:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_SUPPORT.getName();
break;
case 5:
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_OTHER.getName();
break;
default: //可选
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_PUBLIC_BANNER.getName();
uploadDir = ServiceFileDirEnum.SERVICE_FILE_DIR_OTHER.getName();
}
return uploadDir;
}

+ 1
- 0
src/main/java/com/xdf/creative/util/tree/Utils.java View File

@@ -1,5 +1,6 @@
package com.xdf.creative.util.tree;

import com.xdf.creative.module.entity.InfoType;
import org.apache.commons.lang.StringUtils;

import java.lang.reflect.InvocationTargetException;

+ 1
- 0
src/main/resources/application.properties View File

@@ -13,6 +13,7 @@ auth_skip_urls=\



#upload_basePath=/mnt/dfzx/nfs01/dfzx_creative/
upload_basePath=D:/xdf_image/xdf/



+ 4
- 1
src/main/resources/application.yml View File

@@ -7,6 +7,7 @@ server:
tomcat:
max-threads: 1000
min-spare-threads: 30
max-http-header-size: 8192
uri-encoding: utf-8


@@ -34,8 +35,10 @@ spring:
platform: mysql
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://192.168.1.101:3306/creative_db?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
# url: jdbc:mysql://172.19.175.249:3306/creative_db?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
#password: SwNspCVZt7,S!6
druid:
filter:
slf4j:
@@ -86,7 +89,7 @@ spring-boot-plus:
# 是否刷新token
refresh-token: true
# 刷新token的时间间隔,默认10分钟,单位:秒
refresh-token-countdown: 600
refresh-token-countdown: 3600
# redis校验jwt token是否存在,可选
redis-check: true
# true: 同一个账号只能是最后一次登陆token有效,false:同一个账号可多次登陆

+ 3
- 3
src/main/resources/mapper/InfoBackMapper.xml View File

@@ -5,7 +5,7 @@

<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, foreign_id, reason, back_type, create_user, back_time
id, info_id, reason, back_type, create_user, back_time
</sql>

<sql id="Base_If_Condition">
@@ -13,8 +13,8 @@
<if test="param.id !=null and param.id!=''">
and id=#{param.id}
</if>
<if test="param.foreignId !=null and param.foreignId!=''">
and foreign_id=#{param.foreignId}
<if test="param.infoId !=null and param.infoId!=''">
and info_id=#{param.infoId}
</if>
<if test="param.reason !=null and param.reason!=''">
and reason=#{param.reason}

+ 9
- 7
src/main/resources/mapper/InfoContentMapper.xml View File

@@ -22,7 +22,7 @@
and ${alias}.id=#{param.id}
</if>
<if test="param.title !=null and param.title!=''">
and ${alias}.title like CONCAT('',#{param.title},'%')
and ${alias}.title like CONCAT('%',#{param.title},'%')
</if>
<if test="param.state !=null and param.state!=''">
and ${alias}.state=#{param.state}
@@ -37,16 +37,16 @@

<sql id="Base_User_If_Condition">
<if test="param.userName !=null and param.userName!=''">
and ${alias}.username like CONCAT('',#{param.userName},'%')
and ${alias}.username like CONCAT('%',#{param.userName},'%')
</if>
<if test="param.nickName !=null and param.nickName!=''">
and ${alias}.nickname like CONCAT('',#{param.nickName},'%')
and ${alias}.nickname like CONCAT('%',#{param.nickName},'%')
</if>
</sql>

<sql id="Base_Type_If_Condition">
<if test="param.infoTypeId !=null and param.infoTypeId!=''">
and ${alias}.type_id =#{param.infoTypeId}
and ${alias}.type_id like CONCAT('',#{param.infoTypeId},'%')
</if>
</sql>

@@ -57,7 +57,7 @@
select a.id,a.title,a.final_audit_time,a.sort,a.istop,a.istop_time,b.type_id,b.info_name from info_content a
left join info_type b on a.info_type_id =b.id where a.deleted=0 and a.online_type=1 and a.state = 3
<if test="param.typeId !=null and param.typeId!=''">
and b.type_id like CONCAT('%',#{param.typeId},'%')
and b.type_id like CONCAT('',#{param.typeId},'%')
</if>
order by a.istop DESC,a.sort
DESC,a.final_audit_time ASC LIMIT #{param.contentSize}
@@ -71,7 +71,7 @@
from info_content a left join info_detail c on a.foreign_id = c.foreign_id left join info_type b on a.info_type_id =b.id where
a.deleted=0 and a.online_type=1 and a.state = 3
<if test="param.typeId !=null and param.typeId!=''">
and b.type_id like CONCAT('%',#{param.typeId},'%')
and b.type_id like CONCAT('',#{param.typeId},'%')
</if>
<if test="param.title !=null and param.title!=''">
and ( a.title like CONCAT('%',#{param.title},'%')
@@ -122,8 +122,10 @@
</include>,
<include refid="Base_Type_Column_List">
<property name="alias" value="b"/>
</include>
</include>,
d.reason,d.back_time
from info_content a left join info_type b on a.info_type_id =b.id left join sys_user c on a.create_user = c.id
left join (select * from info_back order by back_time desc limit 1 )d on a.id =d.info_id
<where>
a.deleted = 0
<include refid="Base_If_Condition">

+ 10
- 0
src/main/resources/mapper/InfoTypeMapper.xml View File

@@ -48,6 +48,16 @@
from info_type where id = #{id}
</select>



<select id="getInfoTypeTreeList" resultType="com.xdf.creative.base.vo.creative.InfoTypeQueryVo">
select
<include refid="Base_Column_List"/>
from info_type order by type_id asc
</select>



<!--分页查询-->
<select id="getInfoTypePageList"
resultType="com.xdf.creative.base.vo.creative.InfoTypeQueryVo"

+ 2
- 2
src/main/resources/mapper/SysPermissionMapper.xml View File

@@ -85,7 +85,7 @@
and sr.deleted = 0
and sp.state = 1
and sp.deleted = 0
and sp.type =1
and sp.type =1 order by sp.resource_id asc
</select>


@@ -94,7 +94,7 @@
resultType="com.xdf.creative.module.entity.SysPermission">
select a.*,case when b.state =1 then 'true' else 'false' end as checked from sys_permission a
left join (select distinct permission_id,state from sys_role_permission where role_id = #{roleId})b
on a.resource_id =b.permission_id where a.state = 1 and a.deleted = 0 and a.code <![CDATA[ <> ]]> "0"
on a.resource_id =b.permission_id where a.state = 1 and a.deleted = 0 and a.code <![CDATA[ <> ]]> "0" order by a.resource_id asc
</select>



Loading…
Cancel
Save