<version>3.2.5.RELEASE</version> | <version>3.2.5.RELEASE</version> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.quartz-scheduler</groupId> | |||||
<artifactId>quartz</artifactId> | |||||
<version>2.3.0</version> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>com.mchange</groupId> | |||||
<artifactId>c3p0</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
import org.springframework.boot.web.servlet.ServletComponentScan; | import org.springframework.boot.web.servlet.ServletComponentScan; | ||||
import org.springframework.context.annotation.Bean; | import org.springframework.context.annotation.Bean; | ||||
import org.springframework.context.annotation.ComponentScan; | import org.springframework.context.annotation.ComponentScan; | ||||
import org.springframework.scheduling.annotation.EnableScheduling; | |||||
import org.springframework.transaction.annotation.EnableTransactionManagement; | import org.springframework.transaction.annotation.EnableTransactionManagement; | ||||
import org.springframework.web.context.request.RequestContextListener; | import org.springframework.web.context.request.RequestContextListener; | ||||
import springfox.documentation.swagger2.annotations.EnableSwagger2; | import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||||
@EnableTransactionManagement | @EnableTransactionManagement | ||||
@SpringBootApplication | @SpringBootApplication | ||||
@ServletComponentScan | @ServletComponentScan | ||||
@EnableScheduling | |||||
public class CreativeApplication { | public class CreativeApplication { | ||||
public static void main(String[] args) { | public static void main(String[] args) { |
private Integer state; | private Integer state; | ||||
@ApiModelProperty(value = "用户名") | @ApiModelProperty(value = "用户名") | ||||
private String username; | |||||
private String userName; | |||||
@ApiModelProperty(value = "昵称") | @ApiModelProperty(value = "昵称") | ||||
private String nickname; | |||||
private String nickName; | |||||
@ApiModelProperty(value = "是否置顶 0否 1是") | @ApiModelProperty(value = "是否置顶 0否 1是") | ||||
private Integer istop; | private Integer istop; | ||||
@ApiModelProperty(value = "上下状态 0 下线 1上线") | @ApiModelProperty(value = "上下状态 0 下线 1上线") | ||||
private Integer onlineType; | private Integer onlineType; | ||||
private Long userId; | |||||
} | } |
package com.xdf.creative.base.params.creative; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.xdf.creative.base.params.QueryParam; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 角色类型 查询参数对象 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @date 2020-04-02 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(value = "InfoRoleTypeQueryParam对象", description = "角色类型查询参数") | |||||
public class InfoRoleImpowerTypeQueryParam extends QueryParam { | |||||
private static final long serialVersionUID = 1L; | |||||
private Long roleId; | |||||
@ApiModelProperty(value = "权限id集合") | |||||
private List<String> infoTypeList; | |||||
} |
package com.xdf.creative.base.params.creative; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.xdf.creative.base.params.QueryParam; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.util.Date; | |||||
/** | |||||
* <p> | |||||
* 角色类型 查询参数对象 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @date 2020-04-02 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(value = "InfoRoleTypeQueryParam对象", description = "角色类型查询参数") | |||||
public class InfoRoleTypeQueryParam extends QueryParam { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "主键id") | |||||
@TableId(value = "id", type = IdType.ID_WORKER) | |||||
private Long id; | |||||
@ApiModelProperty(value = "栏目主键id") | |||||
private Long infoTypeId; | |||||
@ApiModelProperty(value = "角色id") | |||||
private Long roleId; | |||||
@ApiModelProperty(value = "创建时间") | |||||
private Date createTime; | |||||
@ApiModelProperty(value = "修改时间") | |||||
private Date updateTime; | |||||
} |
package com.xdf.creative.base.params.creative; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.xdf.creative.base.params.QueryParam; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.util.Date; | |||||
/** | |||||
* <p> | |||||
* 文件库 查询参数对象 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @date 2020-03-31 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(value = "InfoStoreQueryParam对象", description = "文件库查询参数") | |||||
public class InfoStoreAddParam extends QueryParam { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "主键id") | |||||
@TableId(value = "id", type = IdType.AUTO) | |||||
private Long id; | |||||
@ApiModelProperty(value = "图片名称") | |||||
@NotBlank(message = "图片名称不能为空!") | |||||
private String name; | |||||
@ApiModelProperty(value = "图片地址") | |||||
@NotBlank(message = "图片地址不能为空!") | |||||
private String address; | |||||
@ApiModelProperty(value = "创建时间") | |||||
private Date createTime; | |||||
@ApiModelProperty(value = "上传人id") | |||||
private Long createUserId; | |||||
@ApiModelProperty(value = "资源类型 1、图片 2、文件") | |||||
@NotNull(message = "资源类型不能为空!") | |||||
private Integer type; | |||||
@ApiModelProperty(value = "文件类型") | |||||
@NotBlank(message = "文件类型不能为空!") | |||||
private String fileType; | |||||
@ApiModelProperty(value = "状态 0、不可用 1、可用") | |||||
private Integer state; | |||||
} |
package com.xdf.creative.base.params.creative; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.xdf.creative.base.params.QueryParam; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.util.Date; | |||||
/** | |||||
* <p> | |||||
* 文件库 查询参数对象 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @date 2020-03-31 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(value = "InfoStoreQueryParam对象", description = "文件库查询参数") | |||||
public class InfoStoreQueryParam extends QueryParam { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "主键id") | |||||
@TableId(value = "id", type = IdType.AUTO) | |||||
private Long id; | |||||
@ApiModelProperty(value = "图片名称") | |||||
private String name; | |||||
@ApiModelProperty(value = "图片地址") | |||||
private String address; | |||||
@ApiModelProperty(value = "开始创建时间") | |||||
private Date startCreateTime; | |||||
@ApiModelProperty(value = "结束创建时间") | |||||
private Date endCreateTime; | |||||
@ApiModelProperty(value = "上传人id") | |||||
private Long createUserId; | |||||
@ApiModelProperty(value = "资源类型 1、图片 2、文件") | |||||
private Integer type; | |||||
@ApiModelProperty(value = "文件类型") | |||||
private String fileType; | |||||
@ApiModelProperty(value = "状态 0、不可用 1、可用") | |||||
private Integer state; | |||||
} |
package com.xdf.creative.base.params.creative; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.xdf.creative.base.params.QueryParam; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
/** | |||||
* <p> | |||||
* 文件库 查询参数对象 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @date 2020-03-31 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@ApiModel(value = "InfoStoreQueryParam对象", description = "文件库查询参数") | |||||
public class InfoStoreUrlEntityParam { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "图片编号") | |||||
private int number; | |||||
@ApiModelProperty(value = "图片路径") | |||||
private String url; | |||||
@ApiModelProperty(value = "图片类型") | |||||
private String type; | |||||
} |
package com.xdf.creative.base.params.creative; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.xdf.creative.base.params.QueryParam; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 文件库 查询参数对象 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @date 2020-03-31 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(value = "InfoStoreQueryParam对象", description = "文件库查询参数") | |||||
public class InfoStoreUrlParam extends QueryParam { | |||||
private static final long serialVersionUID = 1L; | |||||
private String filePath; | |||||
@ApiModelProperty(value = "图片地址") | |||||
private List<InfoStoreUrlEntityParam> urlList; | |||||
} |
@ApiModelProperty(value = "置顶时间") | @ApiModelProperty(value = "置顶时间") | ||||
private Date istopTime; | private Date istopTime; | ||||
@ApiModelProperty(value = "终审时间") | |||||
private Date finalAuditTime; | |||||
@ApiModelProperty(value = "栏目类型id") | @ApiModelProperty(value = "栏目类型id") | ||||
private String typeId; | private String typeId; |
package com.xdf.creative.base.vo.creative; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.experimental.Accessors; | |||||
import java.io.Serializable; | |||||
import java.util.Date; | |||||
/** | |||||
* <p> | |||||
* 角色类型 查询结果对象 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @date 2020-04-02 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@ApiModel(value = "InfoRoleTypeQueryVo对象", description = "角色类型查询参数") | |||||
public class InfoRoleTypeQueryVo implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "主键id") | |||||
private Long id; | |||||
@ApiModelProperty(value = "栏目主键id") | |||||
private Long infoTypeId; | |||||
@ApiModelProperty(value = "角色id") | |||||
private Long roleId; | |||||
@ApiModelProperty(value = "创建时间") | |||||
private Date createTime; | |||||
@ApiModelProperty(value = "修改时间") | |||||
private Date updateTime; | |||||
} |
package com.xdf.creative.base.vo.creative; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.experimental.Accessors; | |||||
import java.io.Serializable; | |||||
import java.util.Date; | |||||
/** | |||||
* <p> | |||||
* 文件库 查询结果对象 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @date 2020-03-31 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@ApiModel(value = "InfoStoreQueryVo对象", description = "文件库查询参数") | |||||
public class InfoStoreQueryVo implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "主键id") | |||||
private Long id; | |||||
@ApiModelProperty(value = "图片名称") | |||||
private String name; | |||||
@ApiModelProperty(value = "图片地址") | |||||
private String address; | |||||
@ApiModelProperty(value = "创建时间") | |||||
private Date createTime; | |||||
@ApiModelProperty(value = "上传人id") | |||||
private Long createUserId; | |||||
@ApiModelProperty(value = "资源类型 1、图片 2、文件") | |||||
private Integer type; | |||||
@ApiModelProperty(value = "文件类型") | |||||
private String fileType; | |||||
@ApiModelProperty(value = "状态 0、不可用 1、可用") | |||||
private Integer state; | |||||
} |
import java.io.IOException; | import java.io.IOException; | ||||
import com.xdf.creative.enums.ApiCode; | |||||
import com.xdf.creative.support.exception.SysLoginException; | |||||
import com.xdf.creative.util.page.ApiResult; | import com.xdf.creative.util.page.ApiResult; | ||||
import org.springframework.web.bind.annotation.ExceptionHandler; | import org.springframework.web.bind.annotation.ExceptionHandler; | ||||
import org.springframework.web.bind.annotation.RestControllerAdvice; | import org.springframework.web.bind.annotation.RestControllerAdvice; | ||||
public class CustomExceptionHandler { | public class CustomExceptionHandler { | ||||
@ExceptionHandler(MaxUploadSizeExceededException.class) | @ExceptionHandler(MaxUploadSizeExceededException.class) | ||||
public ApiResult uploadException(MaxUploadSizeExceededException e) throws IOException { | public ApiResult uploadException(MaxUploadSizeExceededException e) throws IOException { | ||||
return ApiResult.fail("最大上传文件为1M,上传文件大小超出限制!"); | |||||
return ApiResult.fail("最大上传文件为5M,上传文件大小超出限制!"); | |||||
} | } | ||||
} | } |
package com.xdf.creative.config; | |||||
import lombok.Getter; | |||||
import lombok.Setter; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.context.annotation.Configuration; | |||||
import org.springframework.scheduling.Trigger; | |||||
import org.springframework.scheduling.TriggerContext; | |||||
import org.springframework.scheduling.annotation.SchedulingConfigurer; | |||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar; | |||||
import org.springframework.scheduling.support.CronTrigger; | |||||
import java.io.File; | |||||
import java.text.SimpleDateFormat; | |||||
import java.util.Calendar; | |||||
import java.util.Date; | |||||
@Slf4j | |||||
@Getter | |||||
@Setter | |||||
@Configuration | |||||
public class CustomScheduled implements SchedulingConfigurer { | |||||
private String cron = "0 0 0 */1 * ?"; | |||||
@Value("${upload_basePath}") | |||||
private String basePath; | |||||
@Value("${wx_basePath}") | |||||
private String wxPath; | |||||
public CustomScheduled() { | |||||
this.cron = cron; | |||||
} | |||||
@Override | |||||
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { | |||||
scheduledTaskRegistrar.addTriggerTask(doTask(), getTrigger()); | |||||
} | |||||
/** | |||||
* 业务执行方法 | |||||
* | |||||
* @return | |||||
*/ | |||||
private Runnable doTask() { | |||||
return new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |||||
Date date = new Date(); | |||||
Calendar calendar = Calendar.getInstance();//new一个Calendar类,把Date放进去 | |||||
calendar.setTime(date); | |||||
//控制台打印的日期为明天日期,2019-06-11 | |||||
//此时的日期为明天的日期,要实现昨天,日期应该减二 | |||||
calendar.add(Calendar.DATE, -1); | |||||
String indexFileName = simpleDateFormat.format(calendar.getTime()); | |||||
File file = new File(basePath+wxPath);//里面输入特定目录 | |||||
File temp = null; | |||||
File[] filelist = file.listFiles(); | |||||
for (int i = 0; i < filelist.length; i++) { | |||||
temp = filelist[i]; | |||||
if (temp.getName().startsWith(indexFileName))//获得文件名,如果后缀为“”,这个你自己写,就删除文件 | |||||
{ | |||||
temp.delete();//删除文件 | |||||
System.out.println(); | |||||
} | |||||
} | |||||
log.error("后缀文件为"+indexFileName+"删除"); | |||||
} | |||||
}; | |||||
} | |||||
/** | |||||
* 业务触发器 | |||||
* | |||||
* @return | |||||
*/ | |||||
private Trigger getTrigger() { | |||||
return new Trigger() { | |||||
@Override | |||||
public Date nextExecutionTime(TriggerContext triggerContext) { | |||||
// 触发器 | |||||
CronTrigger trigger = new CronTrigger(cron); | |||||
return trigger.nextExecutionTime(triggerContext); | |||||
} | |||||
}; | |||||
} | |||||
} |
REFRESH_TOKEN_ERROR(4410, "刷新令牌异常"), | REFRESH_TOKEN_ERROR(4410, "刷新令牌异常"), | ||||
REFRESH_TOKEN_SUCCESS(4411, "刷新令牌正常"), | |||||
FAIL(5500, "操作失败"), | FAIL(5500, "操作失败"), | ||||
LOGIN_EXCEPTION(4000, "登陆失败"), | LOGIN_EXCEPTION(4000, "登陆失败"), |
SERVICE_FILE_DIR_PUBLIC_ACTIVITY(107, "activity"), | SERVICE_FILE_DIR_PUBLIC_ACTIVITY(107, "activity"), | ||||
//政策导航 | //政策导航 | ||||
SERVICE_FILE_DIR_POLICY(108, "policy "), | |||||
SERVICE_FILE_DIR_POLICY(108, "policy"), | |||||
//专项资金 | //专项资金 | ||||
SERVICE_FILE_DIR_SUPPORT(110, "support"), | SERVICE_FILE_DIR_SUPPORT(110, "support"), |
AUTH_UPDATE_VERIFY_ERROR(000003, "存在非法访问,请刷新后再试!"), | AUTH_UPDATE_VERIFY_ERROR(000003, "存在非法访问,请刷新后再试!"), | ||||
FORM_AUDIT_STATE_VERIFY(000004, "只能操作待审核的数据!"), | FORM_AUDIT_STATE_VERIFY(000004, "只能操作待审核的数据!"), | ||||
FORM_AUDIT_BACK_IDEA_VERIFY(000010,"退回意见不能为空!"), | FORM_AUDIT_BACK_IDEA_VERIFY(000010,"退回意见不能为空!"), | ||||
FORM_UPDATE_STATE_VERIFY(000005, "只能操作草稿状态的数据!"), | |||||
FORM_UPDATE_STATE_VERIFY(000005, "只能操作草稿、退回状态的数据!"), | |||||
FORM_AUDIT_FINAL_AUDIT_PASS_VERIFY(000011,"只能操作终审通过的信息!"), | FORM_AUDIT_FINAL_AUDIT_PASS_VERIFY(000011,"只能操作终审通过的信息!"), | ||||
FORM_INFO_CONTENT_SORT_VERIFY(000012,"请输入排序号!"), | FORM_INFO_CONTENT_SORT_VERIFY(000012,"请输入排序号!"), | ||||
FORM_INFO_CONTENT_DELETE_VERIFY(000013,"存在信息非法删除!"), | FORM_INFO_CONTENT_DELETE_VERIFY(000013,"存在信息非法删除!"), | ||||
SYS_USER_ROLE_DELETE(100003,"删除角色失败!"), | SYS_USER_ROLE_DELETE(100003,"删除角色失败!"), | ||||
SYS_ROLE_PERMISSION_DELETE(100004,"删除角色权限关系失败!"), | SYS_ROLE_PERMISSION_DELETE(100004,"删除角色权限关系失败!"), | ||||
SYS_ROLE_EXIST_NO(100005,"该角色不存在!"), | SYS_ROLE_EXIST_NO(100005,"该角色不存在!"), | ||||
SYS_ROLE_PERMISSION_EXIST(100006,"未发现有效得URL!"), | |||||
SYS_ROLE_PERMISSION_EXIST(100006,"未发现有效资源!"), | |||||
SYS_USER_NAME_EXIST(101001,"当前用户名已存在!"), | SYS_USER_NAME_EXIST(101001,"当前用户名已存在!"), | ||||
SYS_USER_ROLE_VERIFY_EXIST(101002,"用户所选角色不存在!"), | SYS_USER_ROLE_VERIFY_EXIST(101002,"用户所选角色不存在!"), |
package com.xdf.creative.module.controller; | |||||
import com.xdf.creative.base.controller.BaseController; | |||||
import com.xdf.creative.base.params.IdParam; | |||||
import com.xdf.creative.base.params.creative.InfoRoleImpowerTypeQueryParam; | |||||
import com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam; | |||||
import com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo; | |||||
import com.xdf.creative.module.entity.InfoRoleType; | |||||
import com.xdf.creative.module.service.InfoRoleTypeService; | |||||
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; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
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.validation.Valid; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 角色类型 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-04-02 | |||||
*/ | |||||
@Slf4j | |||||
@RestController | |||||
@RequestMapping("/infoRoleType") | |||||
@Api("角色类型 API") | |||||
public class InfoRoleTypeController extends BaseController { | |||||
@Autowired | |||||
private InfoRoleTypeService infoRoleTypeService; | |||||
/** | |||||
* 角色授权资源类型 | |||||
* @param infoRoleImpowerTypeQueryParam | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
@PostMapping("/setTypeToRole") | |||||
@ApiOperation(value = "添加InfoRoleType对象", notes = "添加角色类型", response = ApiResult.class) | |||||
public ApiResult setTypeToRole(@Valid @RequestBody InfoRoleImpowerTypeQueryParam infoRoleImpowerTypeQueryParam) throws Exception { | |||||
return infoRoleTypeService.setTypeToRole(infoRoleImpowerTypeQueryParam); | |||||
} | |||||
/** | |||||
* 角色授权查询资源树 | |||||
*/ | |||||
@PostMapping("/impowerTypeTreeList") | |||||
@ApiOperation(value = "获取授权菜单列表", notes = "获取所有菜单列表", response = Object.class) | |||||
public ApiResult impowerTypeTreeList(@Valid @RequestBody IdParam idParam) throws Exception { | |||||
List<Object> list = infoRoleTypeService.impowerTypeTreeList(idParam.getId()); | |||||
TreeConfig config = new TreeConfig("typeId", "typeParentId", "typeParentId", "0", ""); | |||||
return ApiResult.ok(Utils.tree(list, config)); | |||||
} | |||||
/** | |||||
* 获取当前用户查询资源树 | |||||
*/ | |||||
@PostMapping("/getCurrentTypeTreeList") | |||||
@ApiOperation(value = "获取当前用户拥有菜单列表", notes = "获取所有菜单列表", response = Object.class) | |||||
public ApiResult getCurrentTypeTreeList() throws Exception { | |||||
List<Object> list = infoRoleTypeService.getRoleTypeTreeList(); | |||||
TreeConfig config = new TreeConfig("typeId", "typeParentId", "typeParentId", "0", ""); | |||||
return ApiResult.ok(Utils.tree(list, config)); | |||||
} | |||||
} | |||||
package com.xdf.creative.module.controller; | |||||
import com.xdf.creative.base.controller.BaseController; | |||||
import com.xdf.creative.base.params.IdParam; | |||||
import com.xdf.creative.base.params.creative.InfoStoreAddParam; | |||||
import com.xdf.creative.base.params.creative.InfoStoreQueryParam; | |||||
import com.xdf.creative.base.params.creative.InfoStoreUrlParam; | |||||
import com.xdf.creative.base.vo.creative.InfoStoreQueryVo; | |||||
import com.xdf.creative.module.entity.InfoStore; | |||||
import com.xdf.creative.module.service.InfoStoreService; | |||||
import com.xdf.creative.util.page.ApiResult; | |||||
import com.xdf.creative.util.page.PageTool; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
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.validation.Valid; | |||||
/** | |||||
* <p> | |||||
* 文件库 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-03-31 | |||||
*/ | |||||
@Slf4j | |||||
@RestController | |||||
@RequestMapping("/infoStore") | |||||
@Api("文件库 API") | |||||
public class InfoStoreController extends BaseController { | |||||
@Autowired | |||||
private InfoStoreService infoStoreService; | |||||
@Value("${upload_basePath}") | |||||
private String basePath; | |||||
@Value("${wx_basePath}") | |||||
private String wxPath; | |||||
/** | |||||
* 添加文件库 | |||||
*/ | |||||
@PostMapping("/addStore") | |||||
@ApiOperation(value = "添加InfoStore对象", notes = "添加文件库", response = ApiResult.class) | |||||
public ApiResult addStore(@Valid @RequestBody InfoStoreAddParam infoStoreAddParam) throws Exception { | |||||
return infoStoreService.addStore(infoStoreAddParam); | |||||
} | |||||
/** | |||||
* 停用图片 | |||||
*/ | |||||
@PostMapping("/delStore") | |||||
@ApiOperation(value = "添加InfoStore对象", notes = "添加文件库", response = ApiResult.class) | |||||
public ApiResult delStore(@Valid @RequestBody IdParam idParam) throws Exception { | |||||
return infoStoreService.delStore(idParam.getId()); | |||||
} | |||||
/** | |||||
* 前台调用图片库 | |||||
*/ | |||||
@PostMapping("/getUserStorePage") | |||||
@ApiOperation(value = "获取InfoStore分页列表", notes = "文件库分页列表", response = InfoStoreQueryVo.class) | |||||
public ApiResult<PageTool<InfoStoreQueryVo>> getUserStorePage(@Valid @RequestBody InfoStoreQueryParam infoStoreQueryParam) throws Exception { | |||||
PageTool<InfoStoreQueryVo> pageList = infoStoreService.getUserStorePage(infoStoreQueryParam); | |||||
return ApiResult.ok(pageList); | |||||
} | |||||
/** | |||||
* 文件库分页列表 | |||||
*/ | |||||
@PostMapping("/getPageList") | |||||
@ApiOperation(value = "获取InfoStore分页列表", notes = "文件库分页列表", response = InfoStoreQueryVo.class) | |||||
public ApiResult<PageTool<InfoStoreQueryVo>> getInfoStorePageList(@Valid @RequestBody InfoStoreQueryParam infoStoreQueryParam) throws Exception { | |||||
PageTool<InfoStoreQueryVo> pageList = infoStoreService.getInfoStorePageList(infoStoreQueryParam); | |||||
return ApiResult.ok(pageList); | |||||
} | |||||
/** | |||||
* 前台调用图片库 | |||||
*/ | |||||
@PostMapping("/getUrlStort") | |||||
@ApiOperation(value = "获取InfoStore分页列表", notes = "文件库分页列表", response = InfoStoreQueryVo.class) | |||||
public ApiResult getUrlStort(@Valid @RequestBody InfoStoreUrlParam infoStoreUrlParam) throws Exception { | |||||
infoStoreUrlParam.setFilePath(basePath+wxPath); | |||||
return infoStoreService.getUrlStort(infoStoreUrlParam); | |||||
} | |||||
/** | |||||
* 添加文件库 | |||||
*/ | |||||
@PostMapping("/add") | |||||
@ApiOperation(value = "添加InfoStore对象", notes = "添加文件库", response = ApiResult.class) | |||||
public ApiResult<Boolean> addInfoStore(@Valid @RequestBody InfoStore infoStore) throws Exception { | |||||
boolean flag = infoStoreService.save(infoStore); | |||||
return ApiResult.result(flag); | |||||
} | |||||
/** | |||||
* 修改文件库 | |||||
*/ | |||||
@PostMapping("/update") | |||||
@ApiOperation(value = "修改InfoStore对象", notes = "修改文件库", response = ApiResult.class) | |||||
public ApiResult<Boolean> updateInfoStore(@Valid @RequestBody InfoStore infoStore) throws Exception { | |||||
boolean flag = infoStoreService.updateById(infoStore); | |||||
return ApiResult.result(flag); | |||||
} | |||||
/** | |||||
* 删除文件库 | |||||
*/ | |||||
@PostMapping("/delete") | |||||
@ApiOperation(value = "删除InfoStore对象", notes = "删除文件库", response = ApiResult.class) | |||||
public ApiResult<Boolean> deleteInfoStore(@Valid @RequestBody IdParam idParam) throws Exception { | |||||
boolean flag = infoStoreService.removeById(idParam.getId()); | |||||
return ApiResult.result(flag); | |||||
} | |||||
/** | |||||
* 获取文件库 | |||||
*/ | |||||
@PostMapping("/info") | |||||
@ApiOperation(value = "获取InfoStore对象详情", notes = "查看文件库", response = InfoStoreQueryVo.class) | |||||
public ApiResult<InfoStoreQueryVo> getInfoStore(@Valid @RequestBody IdParam idParam) throws Exception { | |||||
InfoStoreQueryVo infoStoreQueryVo = infoStoreService.getInfoStoreById(idParam.getId()); | |||||
return ApiResult.ok(infoStoreQueryVo); | |||||
} | |||||
} | |||||
@PostMapping("/login") | @PostMapping("/login") | ||||
@ApiOperation(value = "登陆", notes = "系统用户登陆", response = ApiResult.class) | @ApiOperation(value = "登陆", notes = "系统用户登陆", response = ApiResult.class) | ||||
public ApiResult login(@Valid @RequestBody LoginParam loginParam, HttpServletResponse response) throws Exception { | public ApiResult login(@Valid @RequestBody LoginParam loginParam, HttpServletResponse response) throws Exception { | ||||
LoginSysUserTokenVo loginSysUserTokenVo = sysUserService.login(loginParam); | |||||
return ApiResult.ok(loginSysUserTokenVo, "登陆成功"); | |||||
return sysUserService.login(loginParam); | |||||
} | } | ||||
package com.xdf.creative.module.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.xdf.creative.base.entity.BaseEntity; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.util.Date; | |||||
/** | |||||
* <p> | |||||
* 角色类型 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-04-02 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(value = "InfoRoleType对象", description = "角色类型") | |||||
public class InfoRoleType extends BaseEntity { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "主键id") | |||||
@TableId(value = "id", type = IdType.AUTO) | |||||
private Long id; | |||||
@ApiModelProperty(value = "栏目主键id") | |||||
private Long infoTypeId; | |||||
@ApiModelProperty(value = "角色id") | |||||
private Long roleId; | |||||
@ApiModelProperty(value = "创建时间") | |||||
private Date createTime; | |||||
@ApiModelProperty(value = "修改时间") | |||||
private Date updateTime; | |||||
} |
package com.xdf.creative.module.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.xdf.creative.base.entity.BaseEntity; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import io.swagger.models.auth.In; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.util.Date; | |||||
/** | |||||
* <p> | |||||
* 文件库 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-03-31 | |||||
*/ | |||||
@Data | |||||
@Accessors(chain = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@ApiModel(value = "InfoStore对象", description = "文件库") | |||||
public class InfoStore extends BaseEntity { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "主键id") | |||||
@TableId(value = "id", type = IdType.AUTO) | |||||
private Long id; | |||||
@ApiModelProperty(value = "图片名称") | |||||
private String name; | |||||
@ApiModelProperty(value = "图片地址") | |||||
private String address; | |||||
@ApiModelProperty(value = "创建时间") | |||||
private Date createTime; | |||||
@ApiModelProperty(value = "上传人id") | |||||
private Long createUserId; | |||||
@ApiModelProperty(value = "资源类型 1、图片 2、文件") | |||||
private Integer type; | |||||
@ApiModelProperty(value = "文件类型") | |||||
private String fileType; | |||||
@ApiModelProperty(value = "状态 0、不可用 1、可用") | |||||
private Integer state; | |||||
} |
package com.xdf.creative.module.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam; | |||||
import com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo; | |||||
import com.xdf.creative.module.entity.InfoRoleType; | |||||
import org.apache.ibatis.annotations.Param; | |||||
import org.springframework.stereotype.Repository; | |||||
import java.io.Serializable; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 角色类型 Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-04-02 | |||||
*/ | |||||
@Repository | |||||
public interface InfoRoleTypeMapper extends BaseMapper<InfoRoleType> { | |||||
/** | |||||
* 获取角色拥有的资源树 | |||||
* | |||||
* @param userId 用户id | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
List<Object> getRoleTypeTreeList(@Param("userId")Long userId) throws Exception; | |||||
/** | |||||
* 获取用户角色授权资源 树 | |||||
*/ | |||||
List<Object> impowerTypeTreeList(@Param("roleId") Long roleId) throws Exception; | |||||
/** | |||||
* 根据ID获取查询对象 | |||||
* | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
InfoRoleTypeQueryVo getInfoRoleTypeById(Serializable id); | |||||
/** | |||||
* 获取分页对象 | |||||
* | |||||
* @param page | |||||
* @param infoRoleTypeQueryParam | |||||
* @return | |||||
*/ | |||||
IPage<InfoRoleTypeQueryVo> getInfoRoleTypePageList(@Param("page") Page page, @Param("param") InfoRoleTypeQueryParam infoRoleTypeQueryParam); | |||||
} |
package com.xdf.creative.module.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.xdf.creative.base.params.creative.InfoStoreQueryParam; | |||||
import com.xdf.creative.base.vo.creative.InfoStoreQueryVo; | |||||
import com.xdf.creative.module.entity.InfoStore; | |||||
import org.apache.ibatis.annotations.Param; | |||||
import org.springframework.stereotype.Repository; | |||||
import java.io.Serializable; | |||||
/** | |||||
* <p> | |||||
* 文件库 Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-03-31 | |||||
*/ | |||||
@Repository | |||||
public interface InfoStoreMapper extends BaseMapper<InfoStore> { | |||||
/** | |||||
* 根据ID获取查询对象 | |||||
* | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
InfoStoreQueryVo getInfoStoreById(Serializable id); | |||||
/** | |||||
* 后台获取分页对象 | |||||
* | |||||
* @param page | |||||
* @param infoStoreQueryParam | |||||
* @return | |||||
*/ | |||||
IPage<InfoStoreQueryVo> getInfoStorePageList(@Param("page") Page page, @Param("param") InfoStoreQueryParam infoStoreQueryParam); | |||||
/** | |||||
* 前端用户调用图片文件库 | |||||
* | |||||
* @param page | |||||
* @param infoStoreQueryParam | |||||
* @return | |||||
*/ | |||||
IPage<InfoStoreQueryVo> getUserStorePage(@Param("page") Page page, @Param("param") InfoStoreQueryParam infoStoreQueryParam); | |||||
} |
package com.xdf.creative.module.service; | |||||
import com.xdf.creative.base.params.creative.InfoRoleImpowerTypeQueryParam; | |||||
import com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam; | |||||
import com.xdf.creative.base.service.BaseService; | |||||
import com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo; | |||||
import com.xdf.creative.module.entity.InfoRoleType; | |||||
import com.xdf.creative.util.page.ApiResult; | |||||
import com.xdf.creative.util.page.PageTool; | |||||
import java.io.Serializable; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 角色类型 服务类 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-04-02 | |||||
*/ | |||||
public interface InfoRoleTypeService extends BaseService<InfoRoleType> { | |||||
/** | |||||
* 跟角色授权栏目类型 | |||||
* @param infoRoleImpowerTypeQueryParam | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
ApiResult setTypeToRole(InfoRoleImpowerTypeQueryParam infoRoleImpowerTypeQueryParam) throws Exception; | |||||
/** | |||||
*获取当前用户拥有的tree | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
List<Object> getRoleTypeTreeList() throws Exception; | |||||
/** | |||||
* 获取角色授权栏目类型树 | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
List<Object> impowerTypeTreeList(Long roleId) throws Exception; | |||||
/** | |||||
* 根据ID获取查询对象 | |||||
* | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
InfoRoleTypeQueryVo getInfoRoleTypeById(Serializable id) throws Exception; | |||||
/** | |||||
* 获取分页对象 | |||||
* | |||||
* @param infoRoleTypeQueryParam | |||||
* @return | |||||
*/ | |||||
PageTool<InfoRoleTypeQueryVo> getInfoRoleTypePageList(InfoRoleTypeQueryParam infoRoleTypeQueryParam) throws Exception; | |||||
} |
package com.xdf.creative.module.service; | |||||
import com.xdf.creative.base.params.creative.InfoStoreAddParam; | |||||
import com.xdf.creative.base.params.creative.InfoStoreQueryParam; | |||||
import com.xdf.creative.base.params.creative.InfoStoreUrlParam; | |||||
import com.xdf.creative.base.service.BaseService; | |||||
import com.xdf.creative.base.vo.creative.InfoStoreQueryVo; | |||||
import com.xdf.creative.module.entity.InfoStore; | |||||
import com.xdf.creative.util.page.ApiResult; | |||||
import com.xdf.creative.util.page.PageTool; | |||||
import java.io.Serializable; | |||||
/** | |||||
* <p> | |||||
* 文件库 服务类 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-03-31 | |||||
*/ | |||||
public interface InfoStoreService extends BaseService<InfoStore> { | |||||
/** | |||||
* 添加文件库 | |||||
* @param infoStoreAddParam | |||||
* @return | |||||
*/ | |||||
ApiResult addStore(InfoStoreAddParam infoStoreAddParam); | |||||
/** | |||||
* 更改图片状态 | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
ApiResult delStore(Serializable id); | |||||
/** | |||||
* 获取分页对象 | |||||
* | |||||
* @param infoStoreQueryParam | |||||
* @return | |||||
*/ | |||||
PageTool<InfoStoreQueryVo> getUserStorePage(InfoStoreQueryParam infoStoreQueryParam) throws Exception; | |||||
/** | |||||
* 根据ID获取查询对象 | |||||
* | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
InfoStoreQueryVo getInfoStoreById(Serializable id) throws Exception; | |||||
/** | |||||
* 获取分页对象 | |||||
* | |||||
* @param infoStoreQueryParam | |||||
* @return | |||||
*/ | |||||
PageTool<InfoStoreQueryVo> getInfoStorePageList(InfoStoreQueryParam infoStoreQueryParam) throws Exception; | |||||
ApiResult getUrlStort(InfoStoreUrlParam infoStoreUrlParam); | |||||
} |
* @return | * @return | ||||
* @throws Exception | * @throws Exception | ||||
*/ | */ | ||||
LoginSysUserTokenVo login(LoginParam loginParam) throws Exception; | |||||
ApiResult login(LoginParam loginParam) throws Exception; | |||||
/** | /** |
if (null == infoContent) { | if (null == infoContent) { | ||||
return ApiResult.error(StatusCode.FORM_SUBMIT_UPDATE_VERIFY); | return ApiResult.error(StatusCode.FORM_SUBMIT_UPDATE_VERIFY); | ||||
} | } | ||||
if (!InfoStateTypeEnum.INFO_STATE_TYPE_DRAFT.getCode().equals(infoContent.getState())) { | |||||
if (!InfoStateTypeEnum.INFO_STATE_TYPE_DRAFT.getCode().equals(infoContent.getState()) | |||||
&&!InfoStateTypeEnum.INFO_STATE_TYPE_FIRST_AUDIT_BACK.getCode().equals(infoContent.getState()) | |||||
&&!InfoStateTypeEnum.INFO_STATE_TYPE_FINAL_AUDIT_BACK.getCode().equals(infoContent.getState())) { | |||||
return ApiResult.error(StatusCode.FORM_UPDATE_STATE_VERIFY); | return ApiResult.error(StatusCode.FORM_UPDATE_STATE_VERIFY); | ||||
} | } | ||||
infoContent.setSubmitTime(new Date()); | infoContent.setSubmitTime(new Date()); | ||||
*/ | */ | ||||
@Override | @Override | ||||
public PageTool<InfoContentBackSearchQueryVo> getInfoContentByAdd(InfoContentBackSearchQueryParam infoContentBackSearchQueryParam) throws Exception { | public PageTool<InfoContentBackSearchQueryVo> getInfoContentByAdd(InfoContentBackSearchQueryParam infoContentBackSearchQueryParam) throws Exception { | ||||
infoContentBackSearchQueryParam.setUserId(getUserId()); | |||||
Page page = setPageParam(infoContentBackSearchQueryParam); | Page page = setPageParam(infoContentBackSearchQueryParam); | ||||
IPage<InfoContentBackSearchQueryVo> iPage = infoContentMapper.getInfoContentByAdd(page, infoContentBackSearchQueryParam); | IPage<InfoContentBackSearchQueryVo> iPage = infoContentMapper.getInfoContentByAdd(page, infoContentBackSearchQueryParam); | ||||
return new PageTool(iPage); | return new PageTool(iPage); |
package com.xdf.creative.module.service.impl; | |||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.xdf.creative.base.params.creative.InfoRoleImpowerTypeQueryParam; | |||||
import com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam; | |||||
import com.xdf.creative.base.service.impl.BaseServiceImpl; | |||||
import com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo; | |||||
import com.xdf.creative.base.vo.creative.SysRoleQueryVo; | |||||
import com.xdf.creative.enums.StatusCode; | |||||
import com.xdf.creative.module.entity.InfoRoleType; | |||||
import com.xdf.creative.module.entity.InfoType; | |||||
import com.xdf.creative.module.entity.SysRole; | |||||
import com.xdf.creative.module.entity.SysUser; | |||||
import com.xdf.creative.module.mapper.InfoRoleTypeMapper; | |||||
import com.xdf.creative.module.service.InfoRoleTypeService; | |||||
import com.xdf.creative.module.service.InfoTypeService; | |||||
import com.xdf.creative.module.service.SysRoleService; | |||||
import com.xdf.creative.module.service.SysUserService; | |||||
import com.xdf.creative.util.page.ApiResult; | |||||
import com.xdf.creative.util.page.PageTool; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.io.Serializable; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 角色类型 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-04-02 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public class InfoRoleTypeServiceImpl extends BaseServiceImpl<InfoRoleTypeMapper, InfoRoleType> implements InfoRoleTypeService { | |||||
@Autowired | |||||
private InfoRoleTypeMapper infoRoleTypeMapper; | |||||
@Autowired | |||||
private SysRoleService sysRoleService; | |||||
@Autowired | |||||
private InfoTypeService infoTypeService; | |||||
@Autowired | |||||
private SysUserService sysUserService; | |||||
/** | |||||
* 给角色授权新闻类型 | |||||
* @param infoRoleImpowerTypeQueryParam | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
@Override | |||||
public ApiResult setTypeToRole(InfoRoleImpowerTypeQueryParam infoRoleImpowerTypeQueryParam) throws Exception { | |||||
SysRole sysRole = sysRoleService.getById(infoRoleImpowerTypeQueryParam.getRoleId()); | |||||
if(null ==sysRole){ | |||||
return ApiResult.error(StatusCode.SYS_ROLE_EXIST_NO); | |||||
} | |||||
if(infoRoleImpowerTypeQueryParam.getInfoTypeList().isEmpty()){ | |||||
return ApiResult.error(StatusCode.SYS_ROLE_PERMISSION_EXIST); | |||||
} | |||||
this.remove(new QueryWrapper<InfoRoleType>().eq("role_id",sysRole.getId())); | |||||
for (String typeId:infoRoleImpowerTypeQueryParam.getInfoTypeList() | |||||
) { | |||||
InfoType infoType = infoTypeService.getOne(new QueryWrapper<InfoType>().eq("type_id",typeId)); | |||||
if(null!=infoType){ | |||||
InfoRoleType infoRoleType = new InfoRoleType(); | |||||
infoRoleType.setRoleId(sysRole.getId()); | |||||
infoRoleType.setCreateTime(new Date()); | |||||
infoRoleType.setUpdateTime(new Date()); | |||||
infoRoleType.setInfoTypeId(infoType.getId()); | |||||
this.saveOrUpdate(infoRoleType); | |||||
} | |||||
} | |||||
return ApiResult.ok(); | |||||
} | |||||
/** | |||||
* 获取用户拥有的栏目类型树 | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
@Override | |||||
public List<Object> getRoleTypeTreeList() throws Exception { | |||||
SysUser sysUser = sysUserService.getById(getUserId()); | |||||
if(null!=sysUser){ | |||||
ApiResult.fail("当前用户已失效,请刷新后登录!"); | |||||
} | |||||
return baseMapper.getRoleTypeTreeList(sysUser.getId()); | |||||
} | |||||
/** | |||||
* 获取角色授权栏目类型树 | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
@Override | |||||
public List<Object> impowerTypeTreeList(Long roleId) throws Exception { | |||||
SysRole sysRole = sysRoleService.getById(roleId); | |||||
if(null==sysRole){ | |||||
ApiResult.fail("所选角色不存在或已经删除,请刷新后再试!"); | |||||
} | |||||
return baseMapper.impowerTypeTreeList(roleId); | |||||
} | |||||
@Override | |||||
public InfoRoleTypeQueryVo getInfoRoleTypeById(Serializable id) throws Exception { | |||||
return infoRoleTypeMapper.getInfoRoleTypeById(id); | |||||
} | |||||
@Override | |||||
public PageTool<InfoRoleTypeQueryVo> getInfoRoleTypePageList(InfoRoleTypeQueryParam infoRoleTypeQueryParam) throws Exception { | |||||
Page page = setPageParam(infoRoleTypeQueryParam); | |||||
IPage<InfoRoleTypeQueryVo> iPage = infoRoleTypeMapper.getInfoRoleTypePageList(page, infoRoleTypeQueryParam); | |||||
return new PageTool(iPage); | |||||
} | |||||
} |
package com.xdf.creative.module.service.impl; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.xdf.creative.base.params.creative.InfoStoreAddParam; | |||||
import com.xdf.creative.base.params.creative.InfoStoreQueryParam; | |||||
import com.xdf.creative.base.params.creative.InfoStoreUrlEntityParam; | |||||
import com.xdf.creative.base.params.creative.InfoStoreUrlParam; | |||||
import com.xdf.creative.base.service.impl.BaseServiceImpl; | |||||
import com.xdf.creative.base.vo.creative.InfoStoreQueryVo; | |||||
import com.xdf.creative.enums.StateEnum; | |||||
import com.xdf.creative.enums.StatusCode; | |||||
import com.xdf.creative.module.entity.InfoStore; | |||||
import com.xdf.creative.module.mapper.InfoStoreMapper; | |||||
import com.xdf.creative.module.service.InfoStoreService; | |||||
import com.xdf.creative.util.StringUtil; | |||||
import com.xdf.creative.util.UUIDUtil; | |||||
import com.xdf.creative.util.image.ImageUtils; | |||||
import com.xdf.creative.util.page.ApiResult; | |||||
import com.xdf.creative.util.page.PageTool; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.stereotype.Service; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.io.Serializable; | |||||
import java.text.SimpleDateFormat; | |||||
import java.util.ArrayList; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 文件库 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author lgw | |||||
* @since 2020-03-31 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public class InfoStoreServiceImpl extends BaseServiceImpl<InfoStoreMapper, InfoStore> implements InfoStoreService { | |||||
@Autowired | |||||
private InfoStoreMapper infoStoreMapper; | |||||
@Value("${wx_basePath}") | |||||
private String wxPath; | |||||
public static ArrayList<String> fileTypeList = new ArrayList<String>() {{ | |||||
add("PDF"); | |||||
add("DOC"); | |||||
add("DOCX"); | |||||
add("XLS"); | |||||
add("XLSX"); | |||||
add("PPT"); | |||||
add("PPTX"); | |||||
add("PNG"); | |||||
add("JPG"); | |||||
add("TXT"); | |||||
}}; | |||||
/** | |||||
* 增加文件到图片库 | |||||
* @param infoStoreAddParam | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public ApiResult addStore(InfoStoreAddParam infoStoreAddParam) { | |||||
InfoStore infoStore = new InfoStore(); | |||||
BeanUtils.copyProperties(infoStoreAddParam,infoStore); | |||||
infoStore.setCreateTime(new Date()); | |||||
infoStore.setState(StateEnum.ENABLE.getKey()); | |||||
infoStore.setCreateUserId(getUserId()); | |||||
this.saveOrUpdate(infoStore); | |||||
return ApiResult.ok(); | |||||
} | |||||
/** | |||||
* 把图片停用启用 | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public ApiResult delStore(Serializable id) { | |||||
InfoStore infoStore = this.getById(id); | |||||
if(null==infoStore){ | |||||
return ApiResult.error(StatusCode.FORM_SUBMIT_UPDATE_VERIFY); | |||||
} | |||||
if(StateEnum.DISABLE.getKey().equals(infoStore.getState())){ | |||||
infoStore.setState(StateEnum.ENABLE.getKey()); | |||||
}else{ | |||||
infoStore.setState(StateEnum.DISABLE.getKey()); | |||||
} | |||||
this.saveOrUpdate(infoStore); | |||||
return ApiResult.ok(); | |||||
} | |||||
/** | |||||
* 用户图片库调用列表 | |||||
* @param infoStoreQueryParam | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
@Override | |||||
public PageTool<InfoStoreQueryVo> getUserStorePage(InfoStoreQueryParam infoStoreQueryParam) throws Exception { | |||||
Page page = setPageParam(infoStoreQueryParam); | |||||
IPage<InfoStoreQueryVo> iPage = infoStoreMapper.getUserStorePage(page, infoStoreQueryParam); | |||||
return new PageTool(iPage); | |||||
} | |||||
@Override | |||||
public InfoStoreQueryVo getInfoStoreById(Serializable id) throws Exception { | |||||
return infoStoreMapper.getInfoStoreById(id); | |||||
} | |||||
/** | |||||
* 后台管理图片库列表 | |||||
* @param infoStoreQueryParam | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
@Override | |||||
public PageTool<InfoStoreQueryVo> getInfoStorePageList(InfoStoreQueryParam infoStoreQueryParam) throws Exception { | |||||
Page page = setPageParam(infoStoreQueryParam); | |||||
IPage<InfoStoreQueryVo> iPage = infoStoreMapper.getInfoStorePageList(page, infoStoreQueryParam); | |||||
return new PageTool(iPage); | |||||
} | |||||
@Override | |||||
public ApiResult getUrlStort(InfoStoreUrlParam infoStoreUrlParam) { | |||||
List<InfoStoreUrlEntityParam> fileList = new ArrayList<InfoStoreUrlEntityParam>(); | |||||
Date dt = new Date(); | |||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||||
String indexName = sdf.format(dt); | |||||
List<InfoStoreUrlEntityParam> urlList = infoStoreUrlParam.getUrlList(); | |||||
for (InfoStoreUrlEntityParam infoStoreUrlEntityParam:urlList | |||||
) { | |||||
if(!StringUtil.isEmpty(infoStoreUrlEntityParam.getType())&&fileTypeList.contains(infoStoreUrlEntityParam.getType().toUpperCase())&&!StringUtil.isEmpty(infoStoreUrlParam.getFilePath())) { | |||||
String fileName = indexName + UUIDUtil.getUUID(); | |||||
if (ImageUtils.readFileByUrl(infoStoreUrlParam.getFilePath(), fileName, infoStoreUrlEntityParam.getType(), | |||||
infoStoreUrlEntityParam.getUrl())) { | |||||
InfoStoreUrlEntityParam infoStoreUrlEntityParamNew = new InfoStoreUrlEntityParam(); | |||||
infoStoreUrlEntityParamNew.setNumber(infoStoreUrlEntityParam.getNumber()).setUrl( | |||||
wxPath + fileName + "." + infoStoreUrlEntityParam.getType()).setType( | |||||
infoStoreUrlEntityParam.getType() | |||||
); | |||||
fileList.add(infoStoreUrlEntityParamNew); | |||||
} | |||||
} | |||||
} | |||||
return ApiResult.ok(fileList); | |||||
} | |||||
} |
/*登录*/ | /*登录*/ | ||||
@Override | @Override | ||||
public LoginSysUserTokenVo login(LoginParam loginParam) throws Exception { | |||||
public ApiResult login(LoginParam loginParam) throws Exception { | |||||
// 校验验证码 | // 校验验证码 | ||||
String userName = loginParam.getUsername(); | String userName = loginParam.getUsername(); | ||||
SysUser sysUser = getSysUserByUserName(userName); | SysUser sysUser = getSysUserByUserName(userName); | ||||
if (sysUser == null) { | if (sysUser == null) { | ||||
log.error("登陆失败,用户名不正确,loginParam:{}", loginParam); | log.error("登陆失败,用户名不正确,loginParam:{}", loginParam); | ||||
this.loginFail(userName,loginParam.getPassword(),"登陆失败,用户名不正确!"); | this.loginFail(userName,loginParam.getPassword(),"登陆失败,用户名不正确!"); | ||||
throw new SysLoginException(ApiCode.USERNAME_ERROR); | |||||
return ApiResult.fail(ApiCode.USERNAME_ERROR); | |||||
} | } | ||||
if (StateEnum.DISABLE.getKey().equals(sysUser.getState())) { | if (StateEnum.DISABLE.getKey().equals(sysUser.getState())) { | ||||
log.debug("登陆失败,用户不可用,loginParam:{}", loginParam); | log.debug("登陆失败,用户不可用,loginParam:{}", loginParam); | ||||
this.loginFail(userName,loginParam.getPassword(),"登陆失败,用户不可用!"); | this.loginFail(userName,loginParam.getPassword(),"登陆失败,用户不可用!"); | ||||
throw new SysLoginException(ApiCode.USERNAME_ERROR); | |||||
return ApiResult.fail(ApiCode.USERNAME_ERROR); | |||||
} | } | ||||
String encryptPassword = PasswordUtil.encrypt(loginParam.getPassword(), sysUser.getSalt()); | String encryptPassword = PasswordUtil.encrypt(loginParam.getPassword(), sysUser.getSalt()); | ||||
SysOrganizeQueryVo sysOrganizeQueryVo = sysOrganizeService.getSysOrganizeById(sysUser.getOrganizeId()); | SysOrganizeQueryVo sysOrganizeQueryVo = sysOrganizeService.getSysOrganizeById(sysUser.getOrganizeId()); | ||||
if (sysOrganizeQueryVo == null) { | if (sysOrganizeQueryVo == null) { | ||||
throw new BusinessException("组织不存在"); | |||||
return ApiResult.fail("组织不存在"); | |||||
} | } | ||||
if (!StateEnum.ENABLE.getKey().equals(sysOrganizeQueryVo.getState())) { | if (!StateEnum.ENABLE.getKey().equals(sysOrganizeQueryVo.getState())) { | ||||
throw new BusinessException("组织已禁用"); | |||||
return ApiResult.fail("组织已禁用"); | |||||
} | } | ||||
// 将系统用户对象转换成登陆用户对象 | // 将系统用户对象转换成登陆用户对象 | ||||
LoginSysUserVo loginSysUserVo = SysUserConvert.INSTANCE.sysUserToLoginSysUserVo(sysUser); | LoginSysUserVo loginSysUserVo = SysUserConvert.INSTANCE.sysUserToLoginSysUserVo(sysUser); | ||||
List<SysRoleQueryVo> sysRoleQueryVoList = sysRoleService.getUserRoleByUserId(sysUser.getId()); | List<SysRoleQueryVo> sysRoleQueryVoList = sysRoleService.getUserRoleByUserId(sysUser.getId()); | ||||
if (CollectionUtil.isEmpty(sysRoleQueryVoList)) { | if (CollectionUtil.isEmpty(sysRoleQueryVoList)) { | ||||
this.loginFail(userName,loginParam.getPassword(),"角色不存在!"); | this.loginFail(userName,loginParam.getPassword(),"角色不存在!"); | ||||
throw new BusinessException("角色不存在"); | |||||
return ApiResult.fail("角色不存在"); | |||||
} | } | ||||
sysRoleQueryVoList.stream().forEach(sysRoleQueryVo -> { | sysRoleQueryVoList.stream().forEach(sysRoleQueryVo -> { | ||||
roleIdSet.add(sysRoleQueryVo.getId()); | roleIdSet.add(sysRoleQueryVo.getId()); | ||||
loginSysUserTokenVo.setToken(token); | loginSysUserTokenVo.setToken(token); | ||||
loginSysUserTokenVo.setLoginSysUserVo(loginSysUserVo); | loginSysUserTokenVo.setLoginSysUserVo(loginSysUserVo); | ||||
this.loginSuccess(sysUser.getId()); | this.loginSuccess(sysUser.getId()); | ||||
return loginSysUserTokenVo; | |||||
return ApiResult.ok(loginSysUserTokenVo); | |||||
} | } | ||||
@Override | @Override | ||||
sysAccountLog.setContent("登录账号:"+username+";密码:"+password+" 原因:"+nameValue); | sysAccountLog.setContent("登录账号:"+username+";密码:"+password+" 原因:"+nameValue); | ||||
sysAccountLog.setCreateTime(new Date()); | sysAccountLog.setCreateTime(new Date()); | ||||
//获取用户名 | //获取用户名 | ||||
sysAccountLog.setUserId(getUserId()); | |||||
// if(null==getUserId()) { | |||||
// | |||||
// }else{ | |||||
// sysAccountLog.setUserId(getUserId()); | |||||
// } | |||||
sysAccountLog.setType(LogTypeEnum.LOG_TYPE_FAIL.getCode()); | sysAccountLog.setType(LogTypeEnum.LOG_TYPE_FAIL.getCode()); | ||||
//获取用户ip地址 | //获取用户ip地址 | ||||
sysAccountLog.setIp(IpUtil.getRequestIp()); | sysAccountLog.setIp(IpUtil.getRequestIp()); |
import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
import com.xdf.creative.base.vo.creative.OauthTokenQueryVo; | import com.xdf.creative.base.vo.creative.OauthTokenQueryVo; | ||||
import com.xdf.creative.enums.ApiCode; | import com.xdf.creative.enums.ApiCode; | ||||
import com.xdf.creative.module.entity.OauthToken; | |||||
import com.xdf.creative.module.entity.SysUser; | import com.xdf.creative.module.entity.SysUser; | ||||
import com.xdf.creative.module.service.OauthTokenService; | import com.xdf.creative.module.service.OauthTokenService; | ||||
import com.xdf.creative.module.service.SysPermissionService; | import com.xdf.creative.module.service.SysPermissionService; | ||||
import com.xdf.creative.module.service.SysUserService; | import com.xdf.creative.module.service.SysUserService; | ||||
import com.xdf.creative.shiro.jwt.JwtProperties; | |||||
import com.xdf.creative.shiro.jwt.JwtUtil; | import com.xdf.creative.shiro.jwt.JwtUtil; | ||||
import com.xdf.creative.shiro.jwt.SaltUtil; | |||||
import com.xdf.creative.util.BeanUtil; | import com.xdf.creative.util.BeanUtil; | ||||
import com.xdf.creative.util.StringUtil; | import com.xdf.creative.util.StringUtil; | ||||
import com.xdf.creative.util.page.ApiResult; | import com.xdf.creative.util.page.ApiResult; | ||||
import org.apache.shiro.web.util.WebUtils; | import org.apache.shiro.web.util.WebUtils; | ||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.web.servlet.HandlerInterceptor; | import org.springframework.web.servlet.HandlerInterceptor; | ||||
import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
import java.text.SimpleDateFormat; | |||||
import java.time.Duration; | |||||
import java.util.*; | import java.util.*; | ||||
/** | /** | ||||
private SysUserService sysUserService; | private SysUserService sysUserService; | ||||
@Autowired | @Autowired | ||||
private OauthTokenService oauthTokenService; | private OauthTokenService oauthTokenService; | ||||
@Autowired | |||||
private JwtProperties jwtProperties; | |||||
@Override | @Override | ||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | ||||
String token = request.getHeader("Authorization"); | String token = request.getHeader("Authorization"); | ||||
if (null == token||StringUtil.isEmpty(token)) { | |||||
if (null == token||StringUtil.isEmpty(token)||token.length()<50) { | |||||
ApiResult result = new ApiResult(); | ApiResult result = new ApiResult(); | ||||
result.setCode(ApiCode.TOKEN_INVALID.getCode()); | result.setCode(ApiCode.TOKEN_INVALID.getCode()); | ||||
result.setMsg(ApiCode.TOKEN_INVALID.getMsg()); | result.setMsg(ApiCode.TOKEN_INVALID.getMsg()); | ||||
public boolean verifyToken(String token,HttpServletRequest request, HttpServletResponse response) { | public boolean verifyToken(String token,HttpServletRequest request, HttpServletResponse response) { | ||||
String requestUrl = request.getRequestURI(); | String requestUrl = request.getRequestURI(); | ||||
ApiResult result = new ApiResult(); | ApiResult result = new ApiResult(); | ||||
//token失效 | |||||
//token失效 先检查是否存在 不存在则直接令牌过去重新登录 | |||||
if (JwtUtil.isExpired(token)) { | if (JwtUtil.isExpired(token)) { | ||||
log.error("令牌过期"); | |||||
result.setCode(ApiCode.TOKEN_INVALID.getCode()); | |||||
result.setMsg(ApiCode.TOKEN_INVALID.getMsg()); | |||||
getResponseResult(response, result); | |||||
return false; | |||||
//先查token是否存在 | |||||
OauthTokenQueryVo oauthTokenQueryVo =oauthTokenService.getOauthTokenByToken(token); | |||||
if(null==oauthTokenQueryVo){ | |||||
log.error("令牌过期"); | |||||
result.setCode(ApiCode.TOKEN_INVALID.getCode()); | |||||
result.setMsg(ApiCode.TOKEN_INVALID.getMsg()); | |||||
getResponseResult(response, result); | |||||
return false; | |||||
}else{ | |||||
setJwtPropertiesBean(); | |||||
if(new Date().getTime()-oauthTokenQueryVo.getUpdateTime().getTime()>jwtProperties.getExpireSecond()*1000){ | |||||
result.setCode(ApiCode.TOKEN_INVALID.getCode()); | |||||
result.setMsg(ApiCode.TOKEN_INVALID.getMsg()); | |||||
getResponseResult(response, result); | |||||
return false; | |||||
}else{ | |||||
return true; | |||||
} | |||||
// setJwtPropertiesBean(); | |||||
// String oldToken = oauthTokenQueryVo.getAccessToken(); | |||||
// Long userId = oauthTokenQueryVo.getUserId(); | |||||
// SysUser sysUser = sysUserService.getById(userId); | |||||
// // 获取数据库中保存的盐值 | |||||
// String newSalt = SaltUtil.getSalt(sysUser.getSalt(), jwtProperties); | |||||
// Long expireSecond = jwtProperties.getExpireSecond(); | |||||
// String newToken = JwtUtil.generateToken(userId, sysUser.getUsername(), sysUser.getOrganizeId(), sysUser.getUserType(), newSalt, Duration.ofSeconds(expireSecond)); | |||||
// log.error("令牌过期"); | |||||
// oauthTokenQueryVo.setAccessToken(newToken); | |||||
// oauthTokenQueryVo.setExpireTime(JwtUtil.getExpireDate(newToken)); | |||||
// OauthToken oauthToken = new OauthToken(); | |||||
// BeanUtils.copyProperties(oauthTokenQueryVo,oauthToken); | |||||
// oauthTokenService.saveOrUpdate(oauthToken); | |||||
// | |||||
// result.setCode(ApiCode.REFRESH_TOKEN_SUCCESS.getCode()); | |||||
// result.setMsg(ApiCode.REFRESH_TOKEN_SUCCESS.getMsg()); | |||||
// result.setData(newToken); | |||||
// getResponseResult(response, result); | |||||
// return true; | |||||
} | |||||
} | } | ||||
String userName = JwtUtil.getUsername(token); | String userName = JwtUtil.getUsername(token); | ||||
Long userId = JwtUtil.getUserId(token); | Long userId = JwtUtil.getUserId(token); | ||||
result.setMsg(ApiCode.TOKEN_INVALID.getMsg()); | result.setMsg(ApiCode.TOKEN_INVALID.getMsg()); | ||||
getResponseResult(response, result); | getResponseResult(response, result); | ||||
return false; | return false; | ||||
}else{ | |||||
//更新更新时间 | |||||
OauthToken oauthToken = new OauthToken(); | |||||
BeanUtils.copyProperties(oauthTokenQueryVo,oauthToken); | |||||
oauthToken.setUpdateTime(new Date()); | |||||
oauthTokenService.saveOrUpdate(oauthToken); | |||||
} | } | ||||
//根据用户名去数据库查询用户信息 | //根据用户名去数据库查询用户信息 | ||||
SysUser user = null; | SysUser user = null; | ||||
getResponseResult(response, result); | getResponseResult(response, result); | ||||
return false; | return false; | ||||
} | } | ||||
/* List<String> permissionList = Arrays.asList(oauthTokenQueryVo.getPermissions().trim().split(",")); | |||||
List<String> permissionList = Arrays.asList(oauthTokenQueryVo.getPermissions().trim().split(",")); | |||||
boolean permissionflag = false; | boolean permissionflag = false; | ||||
for (String permissionUrl:permissionList ) { | for (String permissionUrl:permissionList ) { | ||||
if(permissionUrl.contains(requestUrl)){ | if(permissionUrl.contains(requestUrl)){ | ||||
result.setMsg(ApiCode.NOT_PERMISSION.getMsg()); | result.setMsg(ApiCode.NOT_PERMISSION.getMsg()); | ||||
getResponseResult(response, result); | getResponseResult(response, result); | ||||
return false; | return false; | ||||
}*/ | |||||
// if (!permissionList.contains(requestUrl)) { | |||||
// log.error("该用户没有权限访问"+requestUrl); | |||||
// result.setCode(ApiCode.NOT_PERMISSION.getCode()); | |||||
// result.setMsg(ApiCode.NOT_PERMISSION.getMsg()); | |||||
// getResponseResult(response, result); | |||||
// return false; | |||||
// } | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
/* | /* | ||||
oauthTokenService = BeanUtil.getBean(OauthTokenService.class); | oauthTokenService = BeanUtil.getBean(OauthTokenService.class); | ||||
} | } | ||||
} | } | ||||
public void setJwtPropertiesBean() { | |||||
if (null == jwtProperties) { | |||||
jwtProperties = BeanUtil.getBean(JwtProperties.class); | |||||
} | |||||
} | |||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
return decodedJWT.getIssuedAt(); | return decodedJWT.getIssuedAt(); | ||||
} | } | ||||
/** | /** |
if (!saveDir.exists()) { | if (!saveDir.exists()) { | ||||
boolean flag = saveDir.mkdirs(); | boolean flag = saveDir.mkdirs(); | ||||
if (!flag) { | if (!flag) { | ||||
throw new RuntimeException("创建" + saveDir + "目录失败!"); | |||||
log.error("创建" + saveDir + "目录失败!"); | |||||
} | } | ||||
} | } | ||||
String originalFilename = multipartFile.getOriginalFilename(); | String originalFilename = multipartFile.getOriginalFilename(); |
package com.xdf.creative.util.image; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import java.io.*; | |||||
import java.net.HttpURLConnection; | |||||
import java.net.MalformedURLException; | |||||
import java.net.URL; | |||||
public class ImageUtils { | |||||
private static Logger log = LoggerFactory.getLogger(ImageUtils.class); | |||||
public static void main(String[] args) throws Exception { | |||||
// String path ="https://mmbiz.qpic.cn/mmbiz_png/qdWB7wH8tTr9fREsrH8pjYA86OuqHoP2IAWiaicNW88AFWwQFALKb27tVFhIGHrWRNlD5dAtK07o6C4oe0t8ic15Q/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1"; | |||||
String path = "https://mmbiz.qpic.cn/mmbiz_jpg/mic9Ll6Oy4sP9xwic0EgKSSRfNmAAV9S0ukMicFFOxKThvRK1ejJY1Isz1EKhPOO3GWpbWsLS94HHib8e5Gm6Ir6hA/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1"; | |||||
//new一个URL对象 | |||||
} | |||||
public static boolean readFileByUrl(String filePath, String filename, String fileType, String path) { | |||||
URL url = null; | |||||
try { | |||||
url = new URL(path); | |||||
//打开链接 | |||||
HttpURLConnection conn = null; | |||||
conn = (HttpURLConnection) url.openConnection(); | |||||
//设置请求方式为"GET" | |||||
conn.setRequestMethod("GET"); | |||||
//超时响应时间为5秒 | |||||
conn.setConnectTimeout(5 * 1000); | |||||
//通过输入流获取图片数据 | |||||
InputStream inStream = conn.getInputStream(); | |||||
//得到图片的二进制数据,以二进制封装得到数据,具有通用性 | |||||
byte[] data = readInputStream(inStream); | |||||
//new一个文件对象用来保存图片,默认保存当前工程根目录 | |||||
File imageFile = new File(filePath+filename+"."+fileType); | |||||
//创建输出流 | |||||
FileOutputStream outStream = new FileOutputStream(imageFile); | |||||
//写入数据 | |||||
outStream.write(data); | |||||
//关闭输出流 | |||||
outStream.close(); | |||||
} catch (MalformedURLException e) { | |||||
e.printStackTrace(); | |||||
log.error("获取网络图片URL初始化异常,地址:"+path); | |||||
return false; | |||||
} catch (IOException e) { | |||||
e.printStackTrace(); | |||||
log.error("获取网络图片连接异常,地址:"+path); | |||||
return false; | |||||
} catch (Exception e) { | |||||
e.printStackTrace(); | |||||
log.error("获取网络图文件输出流异常,地址:"+path); | |||||
return false; | |||||
} | |||||
return true; | |||||
} | |||||
/** | |||||
* 写入文件 | |||||
* | |||||
* @param inStream | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
public static byte[] readInputStream(InputStream inStream) throws Exception { | |||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream(); | |||||
//创建一个Buffer字符串 | |||||
byte[] buffer = new byte[1024]; | |||||
//每次读取的字符串长度,如果为-1,代表全部读取完毕 | |||||
int len = 0; | |||||
//使用一个输入流从buffer里把数据读取出来 | |||||
while ((len = inStream.read(buffer)) != -1) { | |||||
//用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度 | |||||
outStream.write(buffer, 0, len); | |||||
} | |||||
//关闭输入流 | |||||
inStream.close(); | |||||
//把outStream里的数据写入内存 | |||||
return outStream.toByteArray(); | |||||
} | |||||
} |
#upload_basePath=/mnt/dfzx/nfs01/dfzx_creative/ | #upload_basePath=/mnt/dfzx/nfs01/dfzx_creative/ | ||||
upload_basePath=D:/xdf_image/xdf/ | upload_basePath=D:/xdf_image/xdf/ | ||||
wx_basePath=wx/ | |||||
#xss¹¥»÷À¹½Ø | #xss¹¥»÷À¹½Ø | ||||
xss.enabled=true | xss.enabled=true |
driver-class-name: com.mysql.jdbc.Driver | driver-class-name: com.mysql.jdbc.Driver | ||||
platform: mysql | platform: mysql | ||||
type: com.alibaba.druid.pool.DruidDataSource | 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://127.0.0.1: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 | # url: jdbc:mysql://172.19.175.249:3306/creative_db?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true | ||||
username: root | username: root | ||||
password: 123456 | password: 123456 | ||||
max-file-size: 5MB | max-file-size: 5MB | ||||
max-request-size: 10MB | max-request-size: 10MB | ||||
############################ JWT start ############################# | ############################ JWT start ############################# | ||||
spring-boot-plus: | spring-boot-plus: | ||||
jwt: | jwt: | ||||
# 观众 | # 观众 | ||||
audience: web | audience: web | ||||
# 默认过期时间1小时,单位:秒 | # 默认过期时间1小时,单位:秒 | ||||
expire-second: 3600 | |||||
expire-second: 7200 | |||||
# 是否刷新token | # 是否刷新token | ||||
refresh-token: true | refresh-token: true | ||||
# 刷新token的时间间隔,默认10分钟,单位:秒 | # 刷新token的时间间隔,默认10分钟,单位:秒 | ||||
type-aliases-package: com.xdf.creative.module.entity | type-aliases-package: com.xdf.creative.module.entity | ||||
################################ mybatis-plus end ################################## | ################################ mybatis-plus end ################################## | ||||
<!-- 解决SpringBootAdmin错误日志问题 --> | <!-- 解决SpringBootAdmin错误日志问题 --> | ||||
<logger name="org.apache.catalina.connector.CoyoteAdapter" level="OFF"/> | <logger name="org.apache.catalina.connector.CoyoteAdapter" level="OFF"/> | ||||
<logger name="com.xdf.creative.module.mapper" level="DEBUG"/> | |||||
<root level="INFO"> | <root level="INFO"> | ||||
<appender-ref ref="CONSOLE"/> | <appender-ref ref="CONSOLE"/> |
</sql> | </sql> | ||||
<sql id="Base_If_Condition"> | <sql id="Base_If_Condition"> | ||||
<if test="param.id !=null and param.id!=''"> | |||||
and ${alias}.id=#{param.id} | |||||
</if> | |||||
<if test="param.title !=null and param.title!=''"> | |||||
and ${alias}.title like CONCAT('%',#{param.title},'%') | |||||
</if> | |||||
<if test="param.state !=null and param.state!=''"> | |||||
and ${alias}.state=#{param.state} | |||||
</if> | |||||
<if test="param.istop !=null and param.istop!=''"> | |||||
and ${alias}.istop=#{param.istop} | |||||
</if> | |||||
<if test="param.onlineType !=null and param.onlineType!=''"> | |||||
and ${alias}.online_type=#{param.onlineType} | |||||
</if> | |||||
<if test="param.id !=null and param.id!=''"> | |||||
and ${alias}.id=#{param.id} | |||||
</if> | |||||
<if test="param.title !=null and param.title!=''"> | |||||
and ${alias}.title like CONCAT('%',#{param.title},'%') | |||||
</if> | |||||
<if test="param.state !=null"> | |||||
and ${alias}.state=#{param.state} | |||||
</if> | |||||
<if test="param.istop !=null"> | |||||
and ${alias}.istop=#{param.istop} | |||||
</if> | |||||
<if test="param.onlineType !=null"> | |||||
and ${alias}.online_type=#{param.onlineType} | |||||
</if> | |||||
</sql> | </sql> | ||||
<sql id="Base_User_If_Condition"> | <sql id="Base_User_If_Condition"> | ||||
<if test="param.userName !=null and param.userName!=''"> | <if test="param.userName !=null and param.userName!=''"> | ||||
and ${alias}.username like CONCAT('%',#{param.userName},'%') | |||||
and ${alias}.username like CONCAT('%',#{param.userName},'%') | |||||
</if> | </if> | ||||
<if test="param.nickName !=null and param.nickName!=''"> | <if test="param.nickName !=null and param.nickName!=''"> | ||||
and ${alias}.nickname like CONCAT('%',#{param.nickName},'%') | |||||
and ${alias}.nickname like CONCAT('%',#{param.nickName},'%') | |||||
</if> | </if> | ||||
</sql> | </sql> | ||||
<sql id="Base_Type_If_Condition"> | <sql id="Base_Type_If_Condition"> | ||||
<if test="param.infoTypeId !=null and param.infoTypeId!=''"> | <if test="param.infoTypeId !=null and param.infoTypeId!=''"> | ||||
and ${alias}.type_id like CONCAT('',#{param.infoTypeId},'%') | |||||
and ${alias}.type_id like CONCAT('',#{param.infoTypeId},'%') | |||||
</if> | </if> | ||||
</sql> | </sql> | ||||
<select id="getHomePageInfo" | <select id="getHomePageInfo" | ||||
resultType="com.xdf.creative.base.vo.creative.InfoContentHomePageQueryVo" | resultType="com.xdf.creative.base.vo.creative.InfoContentHomePageQueryVo" | ||||
parameterType="com.xdf.creative.base.params.creative.InfoContentHomePageQueryParam"> | parameterType="com.xdf.creative.base.params.creative.InfoContentHomePageQueryParam"> | ||||
select a.id,a.title,a.final_audit_time,a.sort,a.image_url,a.istop,a.istop_time,b.type_id,b.info_name,c.hyperlink,a.content_type from info_content a | |||||
select | |||||
a.id,a.title,a.final_audit_time,a.sort,a.image_url,a.istop,a.istop_time,b.type_id,b.info_name,c.hyperlink,a.content_type | |||||
from info_content a | |||||
left join info_type b on a.info_type_id =b.id | left join info_type b on a.info_type_id =b.id | ||||
left join info_detail c on a.foreign_id = c.foreign_id | left join info_detail c on a.foreign_id = c.foreign_id | ||||
where a.deleted=0 and a.online_type=1 and a.state = 3 | where a.deleted=0 and a.online_type=1 and a.state = 3 | ||||
and b.type_id like CONCAT('',#{param.typeId},'%') | and b.type_id like CONCAT('',#{param.typeId},'%') | ||||
</if> | </if> | ||||
order by a.istop DESC,a.sort | order by a.istop DESC,a.sort | ||||
DESC,a.final_audit_time ASC LIMIT #{param.contentSize} | |||||
DESC,a.final_audit_time DESC LIMIT #{param.contentSize} | |||||
</select> | </select> | ||||
<select id="getSearchWebInfo" | <select id="getSearchWebInfo" | ||||
resultType="com.xdf.creative.base.vo.creative.InfoContentWebSearchQueryVo" | resultType="com.xdf.creative.base.vo.creative.InfoContentWebSearchQueryVo" | ||||
parameterType="com.xdf.creative.base.params.creative.InfoContentWebSearchQueryParam"> | parameterType="com.xdf.creative.base.params.creative.InfoContentWebSearchQueryParam"> | ||||
select a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type | |||||
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 | |||||
<!-- select a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type | |||||
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},'%') | |||||
</if> | |||||
<if test="param.title !=null and param.title!=''"> | |||||
and ( a.title like CONCAT('%',#{param.title},'%') | |||||
or c.digest like CONCAT('%',#{param.title},'%') | |||||
or c.content like CONCAT('%',#{param.title},'%') | |||||
) | |||||
</if>--> | |||||
select | |||||
a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type | |||||
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!=''"> | <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> | ||||
<if test="param.title !=null and param.title!=''"> | <if test="param.title !=null and param.title!=''"> | ||||
and ( a.title like CONCAT('%',#{param.title},'%') | |||||
or c.digest like CONCAT('%',#{param.title},'%') | |||||
or c.content like CONCAT('%',#{param.title},'%') | |||||
) | |||||
and a.title like CONCAT('%',#{param.title},'%') | |||||
</if> | |||||
union select | |||||
a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type | |||||
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},'%') | |||||
</if> | |||||
<if test="param.title !=null and param.title!=''"> | |||||
and c.digest like CONCAT('%',#{param.title},'%') | |||||
</if> | </if> | ||||
order by a.istop DESC,a.sort DESC,a.final_audit_time ASC | |||||
union select | |||||
a.id,a.title,a.final_audit_time,a.image_url,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink,a.content_type | |||||
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},'%') | |||||
</if> | |||||
<!-- select * from ( select a.id,a.title,a.final_audit_time,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink 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 | |||||
<if test="param.typeId !=null and 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},'%') | |||||
</if> | |||||
union select a.id,a.title,a.final_audit_time,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink 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 | |||||
<if test="param.typeId !=null and param.typeId!=''"> | |||||
and b.type_id like CONCAT('%',#{param.typeId},'%') | |||||
</if> | |||||
<if test="param.title !=null and param.title!=''"> | |||||
and c.digest like CONCAT('%',#{param.title},'%') | |||||
</if> | |||||
union select a.id,a.title,a.final_audit_time,a.sort,a.istop,a.istop_time,b.type_id,b.info_name,c.digest,c.hyperlink 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 | |||||
<if test="param.typeId !=null and param.typeId!=''"> | |||||
and b.type_id like CONCAT('%',#{param.typeId},'%') | |||||
</if> | |||||
<if test="param.title !=null and param.title!=''"> | |||||
and c.content like CONCAT('%',#{param.title},'%') | |||||
</if> | |||||
)a order by a.istop DESC,a.sort DESC,a.final_audit_time ASC--> | |||||
<if test="param.title !=null and param.title!=''"> | |||||
and c.content like CONCAT('%',#{param.title},'%') | |||||
</if> | |||||
</select> | </select> | ||||
<select id="getInfoContentByAdd" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo" | |||||
<select id="getInfoContentByAdd" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo" | |||||
parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam"> | parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam"> | ||||
select | select | ||||
<include refid="Base_Column_List"> | <include refid="Base_Column_List"> | ||||
<property name="alias" value="a"/> | <property name="alias" value="a"/> | ||||
</include>, | |||||
</include> | |||||
, | |||||
<include refid="Base_User_Column_List"> | <include refid="Base_User_Column_List"> | ||||
<property name="alias" value="c"/> | <property name="alias" value="c"/> | ||||
</include>, | |||||
</include> | |||||
, | |||||
<include refid="Base_Type_Column_List"> | <include refid="Base_Type_Column_List"> | ||||
<property name="alias" value="b"/> | <property name="alias" value="b"/> | ||||
</include>, | |||||
</include> | |||||
, | |||||
d.reason,d.back_time | 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 | |||||
from (select m.* from info_content m where m.info_type_id in(select info_type_id from info_role_type where role_id in (select role_id from sys_user_role where user_id = #{param.userId})))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 | left join (select * from info_back order by back_time desc limit 1 )d on a.id =d.info_id | ||||
<where> | <where> | ||||
a.deleted = 0 | |||||
a.deleted = 0 | |||||
<include refid="Base_If_Condition"> | <include refid="Base_If_Condition"> | ||||
<property name="alias" value="a"/> | <property name="alias" value="a"/> | ||||
</include> | </include> | ||||
</include> | </include> | ||||
</where> | </where> | ||||
</select> | |||||
order by a.create_time desc | |||||
</select> | |||||
<select id="getInfoContentByFirstAudit" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo" | |||||
<select id="getInfoContentByFirstAudit" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo" | |||||
parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam"> | parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam"> | ||||
select | select | ||||
<include refid="Base_Column_List"> | <include refid="Base_Column_List"> | ||||
<property name="alias" value="a"/> | <property name="alias" value="a"/> | ||||
</include>, | |||||
</include> | |||||
, | |||||
<include refid="Base_User_Column_List"> | <include refid="Base_User_Column_List"> | ||||
<property name="alias" value="c"/> | <property name="alias" value="c"/> | ||||
</include>, | |||||
</include> | |||||
, | |||||
<include refid="Base_Type_Column_List"> | <include refid="Base_Type_Column_List"> | ||||
<property name="alias" value="b"/> | <property name="alias" value="b"/> | ||||
</include> | </include> | ||||
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 | 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 | ||||
<where> | <where> | ||||
a.deleted = 0 and a.state in(1,2,3,4,5) | |||||
a.deleted = 0 and a.state in(1,2,3,4,5) | |||||
<include refid="Base_If_Condition"> | <include refid="Base_If_Condition"> | ||||
<property name="alias" value="a"/> | <property name="alias" value="a"/> | ||||
</include> | </include> | ||||
</include> | </include> | ||||
</where> | </where> | ||||
order by a.submit_time desc | |||||
</select> | </select> | ||||
<select id="getInfoContentByFinalAudit" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo" | |||||
<select id="getInfoContentByFinalAudit" resultType="com.xdf.creative.base.vo.creative.InfoContentBackSearchQueryVo" | |||||
parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam"> | parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam"> | ||||
select | select | ||||
<include refid="Base_Column_List"> | <include refid="Base_Column_List"> | ||||
<property name="alias" value="a"/> | <property name="alias" value="a"/> | ||||
</include>, | |||||
</include> | |||||
, | |||||
<include refid="Base_User_Column_List"> | <include refid="Base_User_Column_List"> | ||||
<property name="alias" value="c"/> | <property name="alias" value="c"/> | ||||
</include>, | |||||
</include> | |||||
, | |||||
<include refid="Base_Type_Column_List"> | <include refid="Base_Type_Column_List"> | ||||
<property name="alias" value="b"/> | <property name="alias" value="b"/> | ||||
</include> | </include> | ||||
<property name="alias" value="b"/> | <property name="alias" value="b"/> | ||||
</include> | </include> | ||||
</where> | </where> | ||||
order by a.submit_time desc | |||||
</select> | </select> | ||||
<!-- 内容回收站列表--> | |||||
<!-- 内容回收站列表--> | |||||
<select id="getInfoContentByRecycle" resultType="com.xdf.creative.base.vo.creative.InfoContentRecycleSearchQueryVo" | |||||
<select id="getInfoContentByRecycle" resultType="com.xdf.creative.base.vo.creative.InfoContentRecycleSearchQueryVo" | |||||
parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam"> | parameterType="com.xdf.creative.base.params.creative.InfoContentBackSearchQueryParam"> | ||||
select | select | ||||
<include refid="Base_Column_List"> | <include refid="Base_Column_List"> | ||||
<property name="alias" value="a"/> | <property name="alias" value="a"/> | ||||
</include>, | |||||
</include> | |||||
, | |||||
<include refid="Base_User_Column_List"> | <include refid="Base_User_Column_List"> | ||||
<property name="alias" value="c"/> | <property name="alias" value="c"/> | ||||
</include>, | |||||
</include> | |||||
, | |||||
<include refid="Base_Type_Column_List"> | <include refid="Base_Type_Column_List"> | ||||
<property name="alias" value="b"/> | <property name="alias" value="b"/> | ||||
</include> | </include> | ||||
</select> | </select> | ||||
<!--根据ID查询--> | <!--根据ID查询--> | ||||
<select id="getInfoContentById" resultType="com.xdf.creative.base.vo.creative.InfoContentQueryVo"> | <select id="getInfoContentById" resultType="com.xdf.creative.base.vo.creative.InfoContentQueryVo"> | ||||
select | select |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.xdf.creative.module.mapper.InfoRoleTypeMapper"> | |||||
<!-- 通用查询结果列 --> | |||||
<sql id="Base_Column_List"> | |||||
id, info_type_id, role_id, create_time, update_time | |||||
</sql> | |||||
<sql id="Base_If_Condition"> | |||||
<where> | |||||
<if test="param.id !=null and param.id!=''"> | |||||
and id=#{param.id} | |||||
</if> | |||||
<if test="param.infoTypeId !=null and param.infoTypeId!=''"> | |||||
and info_type_id=#{param.infoTypeId} | |||||
</if> | |||||
<if test="param.roleId !=null and param.roleId!=''"> | |||||
and role_id=#{param.roleId} | |||||
</if> | |||||
<if test="param.createTime !=null and param.createTime!=''"> | |||||
and create_time=#{param.createTime} | |||||
</if> | |||||
<if test="param.updateTime !=null and param.updateTime!=''"> | |||||
and update_time=#{param.updateTime} | |||||
</if> | |||||
</where> | |||||
</sql> | |||||
<!--获取角色拥有的类型tree下拉--> | |||||
<select id="getRoleTypeTreeList" resultType="com.xdf.creative.base.vo.creative.InfoTypeQueryVo"> | |||||
select a.* from info_type a right join info_role_type b on a.id = b.info_type_id | |||||
where b.role_id in (select role_id from sys_user_role where user_id = #{userId}) order by a.type_id asc | |||||
</select> | |||||
<!--角色授权类型tree--> | |||||
<select id="impowerTypeTreeList" resultType="com.xdf.creative.base.vo.creative.InfoTypeQueryVo"> | |||||
select a.*,case when ISNULL(b.info_type_id)=0 and LENGTH(trim(b.info_type_id))>0 then 'true' else 'false' | |||||
end as checked from info_type a left join (select distinct info_type_id from info_role_type where role_id = #{roleId})b on a.id =b.info_type_id order by a.type_id asc | |||||
</select> | |||||
<!--根据ID查询--> | |||||
<select id="getInfoRoleTypeById" resultType="com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo"> | |||||
select | |||||
<include refid="Base_Column_List"/> | |||||
from info_role_type where id = #{id} | |||||
</select> | |||||
<!--分页查询--> | |||||
<select id="getInfoRoleTypePageList" | |||||
resultType="com.xdf.creative.base.vo.creative.InfoRoleTypeQueryVo" | |||||
parameterType="com.xdf.creative.base.params.creative.InfoRoleTypeQueryParam"> | |||||
select | |||||
<include refid="Base_Column_List"/> | |||||
from info_role_type | |||||
<include refid="Base_If_Condition"/> | |||||
</select> | |||||
</mapper> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.xdf.creative.module.mapper.InfoStoreMapper"> | |||||
<!-- 通用查询结果列 --> | |||||
<sql id="Base_Column_List"> | |||||
id, name, address, create_time, create_user_id, type, file_type,state | |||||
</sql> | |||||
<sql id="Base_If_Condition"> | |||||
<if test="param.id !=null and param.id!=''"> | |||||
and id=#{param.id} | |||||
</if> | |||||
<if test="param.name !=null and param.name!=''"> | |||||
and name like CONCAT('%',#{param.name},'%') | |||||
</if> | |||||
<if test="param.startCreateTime !=null and param.endCreateTime !=null "> | |||||
and create_time >= #{param.startCreateTime} and create_time <=#{param.endCreateTime} | |||||
</if> | |||||
<if test="param.type !=null and param.type!=''"> | |||||
and type=#{param.type} | |||||
</if> | |||||
<if test="param.fileType !=null and param.fileType!=''"> | |||||
and file_type like CONCAT('%',#{param.fileType},'%') | |||||
</if> | |||||
</sql> | |||||
<!--根据ID查询--> | |||||
<select id="getInfoStoreById" resultType="com.xdf.creative.base.vo.creative.InfoStoreQueryVo"> | |||||
select | |||||
<include refid="Base_Column_List"/> | |||||
from info_store where id = #{id} | |||||
</select> | |||||
<!--分页查询--> | |||||
<select id="getInfoStorePageList" | |||||
resultType="com.xdf.creative.base.vo.creative.InfoStoreQueryVo" | |||||
parameterType="com.xdf.creative.base.params.creative.InfoStoreQueryParam"> | |||||
select | |||||
<include refid="Base_Column_List"/> | |||||
from info_store | |||||
<where> | |||||
<include refid="Base_If_Condition"/> | |||||
</where> | |||||
</select> | |||||
<!--分页查询--> | |||||
<select id="getUserStorePage" | |||||
resultType="com.xdf.creative.base.vo.creative.InfoStoreQueryVo" | |||||
parameterType="com.xdf.creative.base.params.creative.InfoStoreQueryParam"> | |||||
select | |||||
<include refid="Base_Column_List"/> | |||||
from info_store | |||||
<where> | |||||
state = 1 | |||||
<include refid="Base_If_Condition"/> | |||||
</where> | |||||
</select> | |||||
</mapper> |
<!--分页查询--> | <!--分页查询--> | ||||
<select id="getInfoTypePageList" | <select id="getInfoTypePageList" | ||||
resultType="com.xdf.creative.base.vo.creative.InfoTypeQueryVo" | resultType="com.xdf.creative.base.vo.creative.InfoTypeQueryVo" |
and sp.deleted = 0 | and sp.deleted = 0 | ||||
) and state = 1 | ) and state = 1 | ||||
and deleted = 0 | and deleted = 0 | ||||
and type = 2 | |||||
and (type = 2 or type = 1) | |||||
</select> | </select> | ||||
<if test="param.email !=null and param.email!=''"> | <if test="param.email !=null and param.email!=''"> | ||||
and email like CONCAT('%',#{param.email},'%') | and email like CONCAT('%',#{param.email},'%') | ||||
</if> | </if> | ||||
<if test="param.state !=null and param.state!=''"> | |||||
<if test="param.state !=null"> | |||||
and state=#{param.state} | and state=#{param.state} | ||||
</if> | </if> | ||||
<if test="param.gender !=null and param.gender!=''"> | <if test="param.gender !=null and param.gender!=''"> |