Initial commit
This commit is contained in:
commit
9bb02f1a49
|
@ -0,0 +1,145 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>alive</artifactId>
|
||||||
|
<groupId>com.alive</groupId>
|
||||||
|
<version>4.7.2</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<artifactId>alive-admin</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
web服务入口
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot集成thymeleaf模板 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- spring-boot-devtools -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>1.7.28</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-simple</artifactId>
|
||||||
|
<version>1.7.28</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.web3j</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>5.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.9.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger3-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
<version>1.6.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql驱动包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alive</groupId>
|
||||||
|
<artifactId>alive-framework</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alive</groupId>
|
||||||
|
<artifactId>alive-quartz</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 代码生成-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alive</groupId>
|
||||||
|
<artifactId>alive-generator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 业务服务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alive</groupId>
|
||||||
|
<artifactId>alive-server</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>jul-to-slf4j</artifactId>
|
||||||
|
<version>1.7.36</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>2.1.1.RELEASE</version>
|
||||||
|
<configuration>
|
||||||
|
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
<warName>${project.artifactId}</warName>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.ruoyi;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动程序
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@EnableCaching // 启用缓存功能
|
||||||
|
@EnableScheduling // 开启定时任务功能
|
||||||
|
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||||
|
public class AliveAdminApplication
|
||||||
|
{
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
SpringApplication.run(AliveAdminApplication.class, args);
|
||||||
|
System.out.println("(♥◠‿◠)ノ゙ NODE ლ(´ڡ`ლ)゙ 启动完成");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.ruoyi;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web容器中进行部署
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class FaiServletInitializer extends SpringBootServletInitializer
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||||
|
{
|
||||||
|
return application.sources(AliveAdminApplication.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,183 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.ActivityConfig;
|
||||||
|
import com.ruoyi.system.service.ActivityConfigService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动配置Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-04-24
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/activityConfig")
|
||||||
|
public class ActivityConfigController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/activityConfig";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ActivityConfigService activityConfigService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询出每个任务完成人数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityConfigCount:view")
|
||||||
|
@GetMapping("/activityConfigCount")
|
||||||
|
public String activityConfigCount()
|
||||||
|
{
|
||||||
|
return prefix + "/activityConfigCount";
|
||||||
|
}
|
||||||
|
@RequiresPermissions("project:activityConfigCount:list")
|
||||||
|
@PostMapping("/listCount")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo listCount()
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ActivityConfig> list = activityConfigService.findActivityConfigCount();
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequiresPermissions("project:activityConfig:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String activityConfig()
|
||||||
|
{
|
||||||
|
return prefix + "/activityConfigList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询活动配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityConfig:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(ActivityConfig activityConfig)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ActivityConfig> list = activityConfigService.selectActivityConfigList(activityConfig);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询活动配置对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityConfig:activityConfig")
|
||||||
|
@PostMapping("/activityConfig")
|
||||||
|
@ResponseBody
|
||||||
|
public ActivityConfig findActivityConfig(ActivityConfig activityConfig)
|
||||||
|
{
|
||||||
|
activityConfig = activityConfigService.findActivityConfig(activityConfig);
|
||||||
|
return activityConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出活动配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityConfig:export")
|
||||||
|
@Log(title = "活动配置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(ActivityConfig activityConfig)
|
||||||
|
{
|
||||||
|
List<ActivityConfig> list = activityConfigService.selectActivityConfigList(activityConfig);
|
||||||
|
ExcelUtil<ActivityConfig> util = new ExcelUtil<ActivityConfig>(ActivityConfig.class);
|
||||||
|
return util.exportExcel(list, "活动配置");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增活动配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/activityConfigAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增活动配置
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("activityConfig", activityConfigService.selectActivityConfigById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/activityConfigAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存活动配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityConfig:add")
|
||||||
|
@Log(title = "活动配置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(ActivityConfig activityConfig)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
activityConfig.setCreateBy(sysUser.getUserName());
|
||||||
|
if(!activityConfig.getType().equals(2) && !activityConfig.getType().equals(4) && activityConfig.getActivityNumber().equals(1)){
|
||||||
|
return error("该任务不支持每天完成");
|
||||||
|
}
|
||||||
|
return toAjax(activityConfigService.updateOrAddActivityConfig(activityConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改活动配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
ActivityConfig activityConfig = activityConfigService.selectActivityConfigById(id);
|
||||||
|
mmap.put("activityConfig", activityConfig);
|
||||||
|
return prefix + "/activityConfigEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存活动配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityConfig:edit")
|
||||||
|
@Log(title = "活动配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(ActivityConfig activityConfig)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
activityConfig.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(activityConfigService.updateOrAddActivityConfig(activityConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除活动配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityConfig:remove")
|
||||||
|
@Log(title = "活动配置", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(activityConfigService.deleteActivityConfigByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.ActivityLog;
|
||||||
|
import com.ruoyi.system.service.ActivityLogService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动任务日志Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-04-24
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/activityLog")
|
||||||
|
public class ActivityLogController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/activityLog";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ActivityLogService activityLogService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:activityLog:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String activityLog()
|
||||||
|
{
|
||||||
|
return prefix + "/activityLogList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询活动任务日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityLog:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(ActivityLog activityLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
if(!org.apache.commons.lang3.StringUtils.isBlank(activityLog.getAddress())){
|
||||||
|
activityLog.setAddress(activityLog.getAddress().toLowerCase());
|
||||||
|
}
|
||||||
|
List<ActivityLog> list = activityLogService.selectActivityLogList(activityLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询活动任务日志对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityLog:activityLog")
|
||||||
|
@PostMapping("/activityLog")
|
||||||
|
@ResponseBody
|
||||||
|
public ActivityLog findActivityLog(ActivityLog activityLog)
|
||||||
|
{
|
||||||
|
activityLog = activityLogService.findActivityLog(activityLog);
|
||||||
|
return activityLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出活动任务日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityLog:export")
|
||||||
|
@Log(title = "活动任务日志", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(ActivityLog activityLog)
|
||||||
|
{
|
||||||
|
List<ActivityLog> list = activityLogService.selectActivityLogList(activityLog);
|
||||||
|
ExcelUtil<ActivityLog> util = new ExcelUtil<ActivityLog>(ActivityLog.class);
|
||||||
|
return util.exportExcel(list, "活动任务日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增活动任务日志
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/activityLogAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增活动任务日志
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("activityLog", activityLogService.selectActivityLogById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/activityLogAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存活动任务日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityLog:add")
|
||||||
|
@Log(title = "活动任务日志", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(ActivityLog activityLog)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
activityLog.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(activityLogService.updateOrAddActivityLog(activityLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改活动任务日志
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
ActivityLog activityLog = activityLogService.selectActivityLogById(id);
|
||||||
|
mmap.put("activityLog", activityLog);
|
||||||
|
return prefix + "/activityLogEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存活动任务日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityLog:edit")
|
||||||
|
@Log(title = "活动任务日志", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(ActivityLog activityLog)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
activityLog.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(activityLogService.updateOrAddActivityLog(activityLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除活动任务日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityLog:remove")
|
||||||
|
@Log(title = "活动任务日志", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(activityLogService.deleteActivityLogByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.ActivityStatistics;
|
||||||
|
import com.ruoyi.system.service.ActivityStatisticsService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业绩统计Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-04-24
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/activityStatistics")
|
||||||
|
public class ActivityStatisticsController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/activityStatistics";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ActivityStatisticsService activityStatisticsService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:activityStatistics:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String activityStatistics()
|
||||||
|
{
|
||||||
|
return prefix + "/activityStatisticsList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询业绩统计列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityStatistics:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(ActivityStatistics activityStatistics)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
if(!org.apache.commons.lang3.StringUtils.isBlank(activityStatistics.getAddress())){
|
||||||
|
activityStatistics.setAddress(activityStatistics.getAddress().toLowerCase());
|
||||||
|
}
|
||||||
|
List<ActivityStatistics> list = activityStatisticsService.selectActivityStatisticsList(activityStatistics);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询业绩统计对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityStatistics:activityStatistics")
|
||||||
|
@PostMapping("/activityStatistics")
|
||||||
|
@ResponseBody
|
||||||
|
public ActivityStatistics findActivityStatistics(ActivityStatistics activityStatistics)
|
||||||
|
{
|
||||||
|
activityStatistics = activityStatisticsService.findActivityStatistics(activityStatistics);
|
||||||
|
return activityStatistics;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出业绩统计列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityStatistics:export")
|
||||||
|
@Log(title = "业绩统计", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(ActivityStatistics activityStatistics)
|
||||||
|
{
|
||||||
|
List<ActivityStatistics> list = activityStatisticsService.selectActivityStatisticsList(activityStatistics);
|
||||||
|
ExcelUtil<ActivityStatistics> util = new ExcelUtil<ActivityStatistics>(ActivityStatistics.class);
|
||||||
|
return util.exportExcel(list, "业绩统计");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增业绩统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/activityStatisticsAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增业绩统计
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("activityStatistics", activityStatisticsService.selectActivityStatisticsById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/activityStatisticsAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存业绩统计
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityStatistics:add")
|
||||||
|
@Log(title = "业绩统计", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(ActivityStatistics activityStatistics)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
activityStatistics.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(activityStatisticsService.updateOrAddActivityStatistics(activityStatistics));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改业绩统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
ActivityStatistics activityStatistics = activityStatisticsService.selectActivityStatisticsById(id);
|
||||||
|
mmap.put("activityStatistics", activityStatistics);
|
||||||
|
return prefix + "/activityStatisticsEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存业绩统计
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityStatistics:edit")
|
||||||
|
@Log(title = "业绩统计", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(ActivityStatistics activityStatistics)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
activityStatistics.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(activityStatisticsService.updateOrAddActivityStatistics(activityStatistics));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除业绩统计
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:activityStatistics:remove")
|
||||||
|
@Log(title = "业绩统计", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(activityStatisticsService.deleteActivityStatisticsByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.CoinConfig;
|
||||||
|
import com.ruoyi.system.service.CoinConfigService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 币种配置Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-05-27
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/coinConfig")
|
||||||
|
public class CoinConfigController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/coinConfig";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CoinConfigService coinConfigService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:coinConfig:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String coinConfig()
|
||||||
|
{
|
||||||
|
return prefix + "/coinConfigList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询币种配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:coinConfig:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(CoinConfig coinConfig)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<CoinConfig> list = coinConfigService.selectCoinConfigList(coinConfig);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询币种配置对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:coinConfig:coinConfig")
|
||||||
|
@PostMapping("/coinConfig")
|
||||||
|
@ResponseBody
|
||||||
|
public CoinConfig findCoinConfig(CoinConfig coinConfig)
|
||||||
|
{
|
||||||
|
coinConfig = coinConfigService.findCoinConfig(coinConfig);
|
||||||
|
return coinConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出币种配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:coinConfig:export")
|
||||||
|
@Log(title = "币种配置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(CoinConfig coinConfig)
|
||||||
|
{
|
||||||
|
List<CoinConfig> list = coinConfigService.selectCoinConfigList(coinConfig);
|
||||||
|
ExcelUtil<CoinConfig> util = new ExcelUtil<CoinConfig>(CoinConfig.class);
|
||||||
|
return util.exportExcel(list, "币种配置");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增币种配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/coinConfigAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增币种配置
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("coinConfig", coinConfigService.selectCoinConfigById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/coinConfigAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存币种配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:coinConfig:add")
|
||||||
|
@Log(title = "币种配置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(CoinConfig coinConfig)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
coinConfig.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(coinConfigService.updateOrAddCoinConfig(coinConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改币种配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
CoinConfig coinConfig = coinConfigService.selectCoinConfigById(id);
|
||||||
|
mmap.put("coinConfig", coinConfig);
|
||||||
|
return prefix + "/coinConfigEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存币种配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:coinConfig:edit")
|
||||||
|
@Log(title = "币种配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(CoinConfig coinConfig)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
coinConfig.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(coinConfigService.updateOrAddCoinConfig(coinConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除币种配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:coinConfig:remove")
|
||||||
|
@Log(title = "币种配置", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(coinConfigService.deleteCoinConfigByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,169 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.NodeAwardSetting;
|
||||||
|
import com.ruoyi.system.service.NodeAwardSettingService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点奖励设置Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-02-24
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/nodeAwardSetting")
|
||||||
|
public class NodeAwardSettingController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/nodeAwardSetting";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodeAwardSettingService nodeAwardSettingService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:nodeAwardSetting:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String nodeAwardSetting()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeAwardSettingList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点奖励设置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeAwardSetting:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(NodeAwardSetting nodeAwardSetting)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<NodeAwardSetting> list = nodeAwardSettingService.selectNodeAwardSettingList(nodeAwardSetting);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点奖励设置对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeAwardSetting:nodeAwardSetting")
|
||||||
|
@PostMapping("/nodeAwardSetting")
|
||||||
|
@ResponseBody
|
||||||
|
public NodeAwardSetting findNodeAwardSetting(NodeAwardSetting nodeAwardSetting)
|
||||||
|
{
|
||||||
|
nodeAwardSetting = nodeAwardSettingService.findNodeAwardSetting(nodeAwardSetting);
|
||||||
|
return nodeAwardSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出节点奖励设置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeAwardSetting:export")
|
||||||
|
@Log(title = "节点奖励设置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(NodeAwardSetting nodeAwardSetting)
|
||||||
|
{
|
||||||
|
List<NodeAwardSetting> list = nodeAwardSettingService.selectNodeAwardSettingList(nodeAwardSetting);
|
||||||
|
ExcelUtil<NodeAwardSetting> util = new ExcelUtil<NodeAwardSetting>(NodeAwardSetting.class);
|
||||||
|
return util.exportExcel(list, "节点奖励设置");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增节点奖励设置
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeAwardSettingAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增节点奖励设置
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("nodeAwardSetting", nodeAwardSettingService.selectNodeAwardSettingById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/nodeAwardSettingAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存节点奖励设置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeAwardSetting:add")
|
||||||
|
@Log(title = "节点奖励设置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(NodeAwardSetting nodeAwardSetting)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeAwardSetting.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodeAwardSettingService.updateOrAddNodeAwardSetting(nodeAwardSetting));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改节点奖励设置
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
NodeAwardSetting nodeAwardSetting = nodeAwardSettingService.findNodeAwardSetting(new NodeAwardSetting().setNodeSettingId(id));
|
||||||
|
if(nodeAwardSetting != null){
|
||||||
|
nodeAwardSetting.setRebate(new BigDecimal(nodeAwardSetting.getRebate().stripTrailingZeros().toPlainString()));
|
||||||
|
nodeAwardSetting.setRbitAmount(new BigDecimal(nodeAwardSetting.getRbitAmount().stripTrailingZeros().toPlainString()));
|
||||||
|
nodeAwardSetting.setRbitOne(new BigDecimal(nodeAwardSetting.getRbitOne().stripTrailingZeros().toPlainString()));
|
||||||
|
nodeAwardSetting.setRebateTwo(new BigDecimal(nodeAwardSetting.getRebateTwo().stripTrailingZeros().toPlainString()));
|
||||||
|
nodeAwardSetting.setNftAmount(new BigDecimal(nodeAwardSetting.getNftAmount().stripTrailingZeros().toPlainString()));
|
||||||
|
nodeAwardSetting.setNftOne(new BigDecimal(nodeAwardSetting.getNftOne().stripTrailingZeros().toPlainString()));
|
||||||
|
nodeAwardSetting.setNftTwo(new BigDecimal(nodeAwardSetting.getNftTwo().stripTrailingZeros().toPlainString()));
|
||||||
|
}
|
||||||
|
mmap.put("nodeAwardSetting", nodeAwardSetting);
|
||||||
|
return prefix + "/nodeAwardSettingEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存节点奖励设置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeAwardSetting:edit")
|
||||||
|
@Log(title = "节点奖励设置", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(NodeAwardSetting nodeAwardSetting)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeAwardSetting.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodeAwardSettingService.updateOrAddNodeAwardSetting(nodeAwardSetting));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除节点奖励设置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeAwardSetting:remove")
|
||||||
|
@Log(title = "节点奖励设置", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(nodeAwardSettingService.deleteNodeAwardSettingByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,220 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.system.domain.NodeSetting;
|
||||||
|
import com.ruoyi.system.domain.TMember;
|
||||||
|
import com.ruoyi.system.service.NodeSettingService;
|
||||||
|
import com.ruoyi.system.service.TMemberService;
|
||||||
|
import com.ruoyi.system.utils.NumberUtil;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.NodeBuyLog;
|
||||||
|
import com.ruoyi.system.service.NodeBuyLogService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点认购记录Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-08
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/nodeSubscribe")
|
||||||
|
public class NodeBuyLogController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/nodeBuyLog";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodeBuyLogService nodeSubscribeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodeSettingService nodeSettingService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TMemberService tMemberService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:nodeSubscribe:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String nodeSubscribe()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeSubscribeList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点认购记录列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSubscribe:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(NodeBuyLog nodeSubscribe)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEmpty(nodeSubscribe.getTopAddress())){
|
||||||
|
TMember tMember = tMemberService.findTMember(new TMember().setAccount(nodeSubscribe.getTopAddress()));
|
||||||
|
if(tMember == null || tMember.getTopUser().equals(0)){
|
||||||
|
return getDataTable(new ArrayList<>());
|
||||||
|
}
|
||||||
|
nodeSubscribe.setTopUserId(tMember.getId());
|
||||||
|
}
|
||||||
|
startPage();
|
||||||
|
List<NodeBuyLog> list = nodeSubscribeService.selectNodeSubscribeList(nodeSubscribe);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点认购记录对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSubscribe:nodeSubscribe")
|
||||||
|
@PostMapping("/nodeSubscribe")
|
||||||
|
@ResponseBody
|
||||||
|
public NodeBuyLog findNodeSubscribe(NodeBuyLog nodeSubscribe)
|
||||||
|
{
|
||||||
|
nodeSubscribe = nodeSubscribeService.findNodeSubscribe(nodeSubscribe);
|
||||||
|
return nodeSubscribe;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出节点认购记录列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSubscribe:export")
|
||||||
|
@Log(title = "节点认购记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(NodeBuyLog nodeSubscribe)
|
||||||
|
{
|
||||||
|
List<NodeBuyLog> list = nodeSubscribeService.selectNodeSubscribeList(nodeSubscribe);
|
||||||
|
ExcelUtil<NodeBuyLog> util = new ExcelUtil<NodeBuyLog>(NodeBuyLog.class);
|
||||||
|
return util.exportExcel(list, "节点认购记录");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增节点认购记录
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeSubscribeAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增节点认购记录
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("nodeSubscribe", nodeSubscribeService.selectNodeSubscribeById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/nodeSubscribeAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存节点认购记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSubscribe:add")
|
||||||
|
@Log(title = "节点认购记录", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(NodeBuyLog nodeSubscribe)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeSubscribe.setCreateBy(sysUser.getUserName());
|
||||||
|
nodeSubscribe.setAddress(nodeSubscribe.getWalletAddress().toLowerCase());
|
||||||
|
TMember tMember = tMemberService.findTMember(new TMember().setAccount(nodeSubscribe.getAddress()));
|
||||||
|
if(tMember == null){
|
||||||
|
return error("该地址未注册");
|
||||||
|
}
|
||||||
|
nodeSubscribe.setInputAddress("无");
|
||||||
|
nodeSubscribe.setOutAddress("无");
|
||||||
|
//查询当前生效的节点
|
||||||
|
NodeSetting nodeSetting = nodeSettingService.findNodeSetting(new NodeSetting().setStatus(1));
|
||||||
|
if(nodeSetting == null){
|
||||||
|
return error("当前没有可分配的NFT");
|
||||||
|
}
|
||||||
|
nodeSubscribe.setNodeSettingId(nodeSetting.getId().intValue());
|
||||||
|
nodeSubscribe.setOrderNumber("0x000000000000");
|
||||||
|
nodeSubscribe.setIllustrate("后台手动分配");
|
||||||
|
nodeSubscribe.setStatus(2);
|
||||||
|
nodeSubscribe.setUserId(tMember.getId().intValue());
|
||||||
|
nodeSubscribe.setPayCoin("USDT");
|
||||||
|
return toAjax(nodeSubscribeService.updateOrAddNodeSubscribe(nodeSubscribe));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改节点认购记录
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
NodeBuyLog nodeSubscribe = nodeSubscribeService.selectNodeSubscribeById(id);
|
||||||
|
mmap.put("nodeSubscribe", nodeSubscribe);
|
||||||
|
return prefix + "/nodeSubscribeEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存节点认购记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSubscribe:edit")
|
||||||
|
@Log(title = "节点认购记录", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(NodeBuyLog nodeSubscribe)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeSubscribe.setUpdateBy(sysUser.getUserName());
|
||||||
|
NodeBuyLog log = nodeSubscribeService.findNodeSubscribe(new NodeBuyLog().setHash(nodeSubscribe.getHash()));
|
||||||
|
if(log != null){
|
||||||
|
return error("hash不能重复绑定");
|
||||||
|
}
|
||||||
|
log = nodeSubscribeService.selectNodeSubscribeById(nodeSubscribe.getId().intValue());
|
||||||
|
if(log == null || !org.apache.commons.lang3.StringUtils.isBlank(log.getHash())){
|
||||||
|
return error("无法重复绑定hash");
|
||||||
|
}
|
||||||
|
nodeSubscribe.setStatus(2);
|
||||||
|
nodeSubscribe.setCreateTime(new Date());
|
||||||
|
return toAjax(nodeSubscribeService.updateOrAddNodeSubscribe(nodeSubscribe));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "结算数据", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping( "/settlement")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult settlement(String ids)
|
||||||
|
{
|
||||||
|
System.out.printf(ids);
|
||||||
|
String[] arr = ids.split(",");
|
||||||
|
Integer code = nodeSubscribeService.countLogTop(arr);
|
||||||
|
if(arr.length != code){
|
||||||
|
return error("只有未结算的数据才能结算哦!");
|
||||||
|
}
|
||||||
|
return toAjax(nodeSubscribeService.updateBuyLogTop(arr));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除节点认购记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSubscribe:remove")
|
||||||
|
@Log(title = "节点认购记录", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(nodeSubscribeService.deleteNodeSubscribeByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.Node;
|
||||||
|
import com.ruoyi.system.service.NodeService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户节点Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-11
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/node")
|
||||||
|
public class NodeController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/node";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodeService nodeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:node:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String node()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户节点列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:node:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(Node node)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEmpty(node.getAddress())){
|
||||||
|
node.setAddress(node.getAddress().toLowerCase());
|
||||||
|
}
|
||||||
|
startPage();
|
||||||
|
List<Node> list = nodeService.selectNodeList(node);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户节点对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:node:node")
|
||||||
|
@PostMapping("/node")
|
||||||
|
@ResponseBody
|
||||||
|
public Node findNode(Node node)
|
||||||
|
{
|
||||||
|
node = nodeService.findNode(node);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出用户节点列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:node:export")
|
||||||
|
@Log(title = "用户节点", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(Node node)
|
||||||
|
{
|
||||||
|
List<Node> list = nodeService.selectNodeList(node);
|
||||||
|
ExcelUtil<Node> util = new ExcelUtil<Node>(Node.class);
|
||||||
|
return util.exportExcel(list, "用户节点");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户节点
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增用户节点
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("node", nodeService.selectNodeById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/nodeAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存用户节点
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:node:add")
|
||||||
|
@Log(title = "用户节点", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(Node node)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
node.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodeService.updateOrAddNode(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户节点
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
Node node = nodeService.selectNodeById(id);
|
||||||
|
mmap.put("node", node);
|
||||||
|
return prefix + "/nodeEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存用户节点
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:node:edit")
|
||||||
|
@Log(title = "用户节点", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(Node node)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
node.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodeService.updateOrAddNode(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户节点
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:node:remove")
|
||||||
|
@Log(title = "用户节点", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(nodeService.deleteNodeByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,187 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.system.service.NodeSettingService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.NodePriceConfig;
|
||||||
|
import com.ruoyi.system.service.NodePriceConfigService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点价格区间配置Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-08
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/nodePriceConfig")
|
||||||
|
public class NodePriceConfigController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/nodePriceConfig";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodePriceConfigService nodePriceConfigService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NodeSettingService nodeSettingService;
|
||||||
|
|
||||||
|
public Map<Long,Long> map = new HashMap<>();
|
||||||
|
|
||||||
|
@RequiresPermissions("project:nodePriceConfig:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String nodePriceConfig(Long id)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
map.put(sysUser.getUserId(),id);
|
||||||
|
return prefix + "/nodePriceConfigList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点价格区间配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodePriceConfig:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(NodePriceConfig nodePriceConfig)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodePriceConfig.setNodeSettingId(map.get(sysUser.getUserId()).intValue());
|
||||||
|
List<NodePriceConfig> list = nodePriceConfigService.selectNodePriceConfigList(nodePriceConfig);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点价格区间配置对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodePriceConfig:nodePriceConfig")
|
||||||
|
@PostMapping("/nodePriceConfig")
|
||||||
|
@ResponseBody
|
||||||
|
public NodePriceConfig findNodePriceConfig(NodePriceConfig nodePriceConfig)
|
||||||
|
{
|
||||||
|
nodePriceConfig = nodePriceConfigService.findNodePriceConfig(nodePriceConfig);
|
||||||
|
return nodePriceConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出节点价格区间配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodePriceConfig:export")
|
||||||
|
@Log(title = "节点价格区间配置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(NodePriceConfig nodePriceConfig)
|
||||||
|
{
|
||||||
|
List<NodePriceConfig> list = nodePriceConfigService.selectNodePriceConfigList(nodePriceConfig);
|
||||||
|
ExcelUtil<NodePriceConfig> util = new ExcelUtil<NodePriceConfig>(NodePriceConfig.class);
|
||||||
|
return util.exportExcel(list, "节点价格区间配置");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增节点价格区间配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/nodePriceConfigAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增节点价格区间配置
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("nodePriceConfig", nodePriceConfigService.selectNodePriceConfigById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/nodePriceConfigAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存节点价格区间配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodePriceConfig:add")
|
||||||
|
@Log(title = "节点价格区间配置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(NodePriceConfig nodePriceConfig)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
if(nodeSettingService.countPriceConfig(nodePriceConfig.getStartNum(),nodePriceConfig.getEndNum(),null,map.get(sysUser.getUserId()).intValue()) > 0){
|
||||||
|
return error("该区间的配置已存在");
|
||||||
|
}
|
||||||
|
if(nodePriceConfig.getStartNum() >= nodePriceConfig.getEndNum()){
|
||||||
|
return error("配置区间错误");
|
||||||
|
}
|
||||||
|
nodePriceConfig.setNodeSettingId(map.get(sysUser.getUserId()).intValue());
|
||||||
|
nodePriceConfig.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodePriceConfigService.updateOrAddNodePriceConfig(nodePriceConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改节点价格区间配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
NodePriceConfig nodePriceConfig = nodePriceConfigService.selectNodePriceConfigById(id);
|
||||||
|
mmap.put("nodePriceConfig", nodePriceConfig);
|
||||||
|
return prefix + "/nodePriceConfigEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存节点价格区间配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodePriceConfig:edit")
|
||||||
|
@Log(title = "节点价格区间配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(NodePriceConfig nodePriceConfig)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
if(nodeSettingService.countPriceConfig(nodePriceConfig.getStartNum(),nodePriceConfig.getEndNum(),nodePriceConfig.getId().intValue(),map.get(sysUser.getUserId()).intValue()) > 0){
|
||||||
|
return error("该区间的配置已存在");
|
||||||
|
}
|
||||||
|
if(nodePriceConfig.getStartNum() >= nodePriceConfig.getEndNum()){
|
||||||
|
return error("配置区间错误");
|
||||||
|
}
|
||||||
|
nodePriceConfig.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodePriceConfigService.updateOrAddNodePriceConfig(nodePriceConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除节点价格区间配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodePriceConfig:remove")
|
||||||
|
@Log(title = "节点价格区间配置", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(nodePriceConfigService.deleteNodePriceConfigByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,193 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.system.domain.NodeAwardSetting;
|
||||||
|
import com.ruoyi.system.service.NodeAwardSettingService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.NodeSetting;
|
||||||
|
import com.ruoyi.system.service.NodeSettingService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点设置Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-08
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/nodeSetting")
|
||||||
|
public class NodeSettingController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/nodeSetting";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodeSettingService nodeSettingService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodeAwardSettingService nodeAwardSettingService;
|
||||||
|
|
||||||
|
|
||||||
|
@RequiresPermissions("project:nodeSetting:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String nodeSetting()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeSettingList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点设置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSetting:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(NodeSetting nodeSetting)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<NodeSetting> list = nodeSettingService.selectNodeSettingList(nodeSetting);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点设置对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSetting:nodeSetting")
|
||||||
|
@PostMapping("/nodeSetting")
|
||||||
|
@ResponseBody
|
||||||
|
public NodeSetting findNodeSetting(NodeSetting nodeSetting)
|
||||||
|
{
|
||||||
|
nodeSetting = nodeSettingService.findNodeSetting(nodeSetting);
|
||||||
|
return nodeSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出节点设置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSetting:export")
|
||||||
|
@Log(title = "节点设置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(NodeSetting nodeSetting)
|
||||||
|
{
|
||||||
|
List<NodeSetting> list = nodeSettingService.selectNodeSettingList(nodeSetting);
|
||||||
|
ExcelUtil<NodeSetting> util = new ExcelUtil<NodeSetting>(NodeSetting.class);
|
||||||
|
return util.exportExcel(list, "节点设置");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增节点设置
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeSettingAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增节点设置
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("nodeSetting", nodeSettingService.selectNodeSettingById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/nodeSettingAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存节点设置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSetting:add")
|
||||||
|
@Log(title = "节点设置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(NodeSetting nodeSetting)
|
||||||
|
{
|
||||||
|
nodeSetting.setNodeName(nodeSetting.getNodeNamePs());
|
||||||
|
if(nodeSettingService.findNodeSetting(new NodeSetting().setNodeGrade(nodeSetting.getNodeGrade())) != null){
|
||||||
|
return error("该等级的盒子已存在");
|
||||||
|
}
|
||||||
|
if(nodeSetting.getStatus() == 1 && nodeSettingService.findNodeSetting(new NodeSetting().setStatus(1)) != null){
|
||||||
|
return error("只能同时存在一个可销售盒子");
|
||||||
|
}
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeSetting.setCreateBy(sysUser.getUserName());
|
||||||
|
nodeSettingService.updateOrAddNodeSetting(nodeSetting);
|
||||||
|
//开始创建奖励配置
|
||||||
|
NodeAwardSetting nodeAwardSetting = new NodeAwardSetting();
|
||||||
|
nodeAwardSetting.setNodeSettingId(nodeSetting.getId().intValue());
|
||||||
|
nodeAwardSetting.setRebate(BigDecimal.ZERO);
|
||||||
|
nodeAwardSetting.setRbitAmount(BigDecimal.ZERO);
|
||||||
|
nodeAwardSetting.setRbitOne(BigDecimal.ZERO);
|
||||||
|
nodeAwardSetting.setNftAmount(BigDecimal.ZERO);
|
||||||
|
nodeAwardSetting.setNftOne(BigDecimal.ZERO);
|
||||||
|
nodeAwardSetting.setNftTwo(BigDecimal.ZERO);
|
||||||
|
nodeAwardSettingService.updateOrAddNodeAwardSetting(nodeAwardSetting);
|
||||||
|
return toAjax(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改节点设置
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
NodeSetting nodeSetting = nodeSettingService.selectNodeSettingById(id);
|
||||||
|
nodeSetting.setNodeNamePs(nodeSetting.getNodeName());
|
||||||
|
mmap.put("nodeSetting", nodeSetting);
|
||||||
|
return prefix + "/nodeSettingEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存节点设置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSetting:edit")
|
||||||
|
@Log(title = "节点设置", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(NodeSetting nodeSetting)
|
||||||
|
{
|
||||||
|
if(nodeSetting.getStatus() == 1){
|
||||||
|
NodeSetting nod = nodeSettingService.findNodeSetting(new NodeSetting().setStatus(1));
|
||||||
|
if(nod != null && !nod.getId().equals(nodeSetting.getId())){
|
||||||
|
return error("只能同时存在一个可销售盒子");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodeSetting.setNodeName(nodeSetting.getNodeNamePs());
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeSetting.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodeSettingService.updateOrAddNodeSetting(nodeSetting));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除节点设置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeSetting:remove")
|
||||||
|
@Log(title = "节点设置", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(nodeSettingService.deleteNodeSettingByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.NodeTask;
|
||||||
|
import com.ruoyi.system.service.NodeTaskService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NEER任务配置Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-02-24
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/nodeTask")
|
||||||
|
public class NodeTaskController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/nodeTask";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodeTaskService nodeTaskService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:nodeTask:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String nodeTask()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeTaskList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询NEER任务配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTask:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(NodeTask nodeTask)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<NodeTask> list = nodeTaskService.selectNodeTaskList(nodeTask);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询NEER任务配置对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTask:nodeTask")
|
||||||
|
@PostMapping("/nodeTask")
|
||||||
|
@ResponseBody
|
||||||
|
public NodeTask findNodeTask(NodeTask nodeTask)
|
||||||
|
{
|
||||||
|
nodeTask = nodeTaskService.findNodeTask(nodeTask);
|
||||||
|
return nodeTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出NEER任务配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTask:export")
|
||||||
|
@Log(title = "NEER任务配置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(NodeTask nodeTask)
|
||||||
|
{
|
||||||
|
List<NodeTask> list = nodeTaskService.selectNodeTaskList(nodeTask);
|
||||||
|
ExcelUtil<NodeTask> util = new ExcelUtil<NodeTask>(NodeTask.class);
|
||||||
|
return util.exportExcel(list, "NEER任务配置");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增NEER任务配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeTaskAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增NEER任务配置
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("nodeTask", nodeTaskService.selectNodeTaskById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/nodeTaskAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存NEER任务配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTask:add")
|
||||||
|
@Log(title = "NEER任务配置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(NodeTask nodeTask)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeTask.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodeTaskService.updateOrAddNodeTask(nodeTask));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改NEER任务配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
NodeTask nodeTask = nodeTaskService.selectNodeTaskById(id);
|
||||||
|
mmap.put("nodeTask", nodeTask);
|
||||||
|
return prefix + "/nodeTaskEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存NEER任务配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTask:edit")
|
||||||
|
@Log(title = "NEER任务配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(NodeTask nodeTask)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeTask.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodeTaskService.updateOrAddNodeTask(nodeTask));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除NEER任务配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTask:remove")
|
||||||
|
@Log(title = "NEER任务配置", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(nodeTaskService.deleteNodeTaskByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.NodeTaskLog;
|
||||||
|
import com.ruoyi.system.service.NodeTaskLogService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的任务奖励Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-02-24
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/nodeTaskLog")
|
||||||
|
public class NodeTaskLogController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/nodeTaskLog";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodeTaskLogService nodeTaskLogService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:nodeTaskLog:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String nodeTaskLog()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeTaskLogList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的任务奖励列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTaskLog:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(NodeTaskLog nodeTaskLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<NodeTaskLog> list = nodeTaskLogService.selectNodeTaskLogList(nodeTaskLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的任务奖励对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTaskLog:nodeTaskLog")
|
||||||
|
@PostMapping("/nodeTaskLog")
|
||||||
|
@ResponseBody
|
||||||
|
public NodeTaskLog findNodeTaskLog(NodeTaskLog nodeTaskLog)
|
||||||
|
{
|
||||||
|
nodeTaskLog = nodeTaskLogService.findNodeTaskLog(nodeTaskLog);
|
||||||
|
return nodeTaskLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出我的任务奖励列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTaskLog:export")
|
||||||
|
@Log(title = "我的任务奖励", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(NodeTaskLog nodeTaskLog)
|
||||||
|
{
|
||||||
|
List<NodeTaskLog> list = nodeTaskLogService.selectNodeTaskLogList(nodeTaskLog);
|
||||||
|
ExcelUtil<NodeTaskLog> util = new ExcelUtil<NodeTaskLog>(NodeTaskLog.class);
|
||||||
|
return util.exportExcel(list, "我的任务奖励");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增我的任务奖励
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/nodeTaskLogAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增我的任务奖励
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("nodeTaskLog", nodeTaskLogService.selectNodeTaskLogById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/nodeTaskLogAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存我的任务奖励
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTaskLog:add")
|
||||||
|
@Log(title = "我的任务奖励", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(NodeTaskLog nodeTaskLog)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeTaskLog.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodeTaskLogService.updateOrAddNodeTaskLog(nodeTaskLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改我的任务奖励
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
NodeTaskLog nodeTaskLog = nodeTaskLogService.selectNodeTaskLogById(id);
|
||||||
|
mmap.put("nodeTaskLog", nodeTaskLog);
|
||||||
|
return prefix + "/nodeTaskLogEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存我的任务奖励
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTaskLog:edit")
|
||||||
|
@Log(title = "我的任务奖励", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(NodeTaskLog nodeTaskLog)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
nodeTaskLog.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(nodeTaskLogService.updateOrAddNodeTaskLog(nodeTaskLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除我的任务奖励
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:nodeTaskLog:remove")
|
||||||
|
@Log(title = "我的任务奖励", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(nodeTaskLogService.deleteNodeTaskLogByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.Notice;
|
||||||
|
import com.ruoyi.system.service.NoticeService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-08
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/notice")
|
||||||
|
public class NoticeController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/notice";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NoticeService noticeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:notice:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String notice()
|
||||||
|
{
|
||||||
|
return prefix + "/noticeList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公告列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:notice:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(Notice notice)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Notice> list = noticeService.selectNoticeList(notice);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公告对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:notice:notice")
|
||||||
|
@PostMapping("/notice")
|
||||||
|
@ResponseBody
|
||||||
|
public Notice findNotice(Notice notice)
|
||||||
|
{
|
||||||
|
notice = noticeService.findNotice(notice);
|
||||||
|
return notice;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出公告列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:notice:export")
|
||||||
|
@Log(title = "公告", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(Notice notice)
|
||||||
|
{
|
||||||
|
List<Notice> list = noticeService.selectNoticeList(notice);
|
||||||
|
ExcelUtil<Notice> util = new ExcelUtil<Notice>(Notice.class);
|
||||||
|
return util.exportExcel(list, "公告");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增公告
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/noticeAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增公告
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("notice", noticeService.selectNoticeById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/noticeAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:notice:add")
|
||||||
|
@Log(title = "公告", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(Notice notice)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
notice.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(noticeService.updateOrAddNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改公告
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
Notice notice = noticeService.selectNoticeById(id);
|
||||||
|
mmap.put("notice", notice);
|
||||||
|
return prefix + "/noticeEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:notice:edit")
|
||||||
|
@Log(title = "公告", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(Notice notice)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
notice.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(noticeService.updateOrAddNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:notice:remove")
|
||||||
|
@Log(title = "公告", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.PayCoinLog;
|
||||||
|
import com.ruoyi.system.service.PayCoinLogService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 兑换币种日志Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-05-27
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/payCoinLog")
|
||||||
|
public class PayCoinLogController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/payCoinLog";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PayCoinLogService payCoinLogService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:payCoinLog:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String payCoinLog()
|
||||||
|
{
|
||||||
|
return prefix + "/payCoinLogList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询兑换币种日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:payCoinLog:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(PayCoinLog payCoinLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<PayCoinLog> list = payCoinLogService.selectPayCoinLogList(payCoinLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询兑换币种日志对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:payCoinLog:payCoinLog")
|
||||||
|
@PostMapping("/payCoinLog")
|
||||||
|
@ResponseBody
|
||||||
|
public PayCoinLog findPayCoinLog(PayCoinLog payCoinLog)
|
||||||
|
{
|
||||||
|
payCoinLog = payCoinLogService.findPayCoinLog(payCoinLog);
|
||||||
|
return payCoinLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出兑换币种日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:payCoinLog:export")
|
||||||
|
@Log(title = "兑换币种日志", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(PayCoinLog payCoinLog)
|
||||||
|
{
|
||||||
|
List<PayCoinLog> list = payCoinLogService.selectPayCoinLogList(payCoinLog);
|
||||||
|
ExcelUtil<PayCoinLog> util = new ExcelUtil<PayCoinLog>(PayCoinLog.class);
|
||||||
|
return util.exportExcel(list, "兑换币种日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增兑换币种日志
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/payCoinLogAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增兑换币种日志
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("payCoinLog", payCoinLogService.selectPayCoinLogById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/payCoinLogAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存兑换币种日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:payCoinLog:add")
|
||||||
|
@Log(title = "兑换币种日志", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(PayCoinLog payCoinLog)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
payCoinLog.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(payCoinLogService.updateOrAddPayCoinLog(payCoinLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改兑换币种日志
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
PayCoinLog payCoinLog = payCoinLogService.selectPayCoinLogById(id);
|
||||||
|
mmap.put("payCoinLog", payCoinLog);
|
||||||
|
return prefix + "/payCoinLogEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存兑换币种日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:payCoinLog:edit")
|
||||||
|
@Log(title = "兑换币种日志", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(PayCoinLog payCoinLog)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
payCoinLog.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(payCoinLogService.updateOrAddPayCoinLog(payCoinLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除兑换币种日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:payCoinLog:remove")
|
||||||
|
@Log(title = "兑换币种日志", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(payCoinLogService.deletePayCoinLogByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.TMember;
|
||||||
|
import com.ruoyi.system.domain.vo.InviteResp;
|
||||||
|
import com.ruoyi.system.service.TMemberService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推荐记录
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-11
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/inviteResp")
|
||||||
|
public class RecommendController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/tMember";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TMemberService tMemberService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:inviteResp:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String tMember()
|
||||||
|
{
|
||||||
|
return prefix + "/InviteRespList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:inviteResp:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(InviteResp tMember)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<InviteResp> list = tMemberService.findInviteRespList(tMember);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.TConfig;
|
||||||
|
import com.ruoyi.system.service.TConfigService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-11
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/tConfig")
|
||||||
|
public class TConfigController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/tConfig";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TConfigService tConfigService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:tConfig:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String tConfig()
|
||||||
|
{
|
||||||
|
return prefix + "/tConfigList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tConfig:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(TConfig tConfig)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<TConfig> list = tConfigService.selectTConfigList(tConfig);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配置对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tConfig:tConfig")
|
||||||
|
@PostMapping("/tConfig")
|
||||||
|
@ResponseBody
|
||||||
|
public TConfig findTConfig(TConfig tConfig)
|
||||||
|
{
|
||||||
|
tConfig = tConfigService.findTConfig(tConfig);
|
||||||
|
return tConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tConfig:export")
|
||||||
|
@Log(title = "配置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(TConfig tConfig)
|
||||||
|
{
|
||||||
|
List<TConfig> list = tConfigService.selectTConfigList(tConfig);
|
||||||
|
ExcelUtil<TConfig> util = new ExcelUtil<TConfig>(TConfig.class);
|
||||||
|
return util.exportExcel(list, "配置");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/tConfigAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增配置
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("tConfig", tConfigService.selectTConfigById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/tConfigAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tConfig:add")
|
||||||
|
@Log(title = "配置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(TConfig tConfig)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
tConfig.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(tConfigService.updateOrAddTConfig(tConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
TConfig tConfig = tConfigService.selectTConfigById(id);
|
||||||
|
mmap.put("tConfig", tConfig);
|
||||||
|
return prefix + "/tConfigEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tConfig:edit")
|
||||||
|
@Log(title = "配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(TConfig tConfig)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
tConfig.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(tConfigService.updateOrAddTConfig(tConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tConfig:remove")
|
||||||
|
@Log(title = "配置", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(tConfigService.deleteTConfigByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,264 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.system.domain.TMemberWalletLog;
|
||||||
|
import com.ruoyi.system.service.TMemberWalletLogService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.TMember;
|
||||||
|
import com.ruoyi.system.service.TMemberService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-11
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/tMember")
|
||||||
|
public class TMemberController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/tMember";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TMemberService tMemberService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TMemberWalletLogService walletLogService;
|
||||||
|
|
||||||
|
public static Map<Long,Integer> sysUserIds = new HashMap<>();
|
||||||
|
public static Integer userId = null;
|
||||||
|
public static Integer types = null;
|
||||||
|
|
||||||
|
@PostMapping("/getTeamNodeNumber")
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String,Integer> getTeamNodeNumber(String address)
|
||||||
|
{
|
||||||
|
Map<String,Integer> map = new HashMap<>();
|
||||||
|
TMember tMember = tMemberService.findTMember(new TMember().setAccount(address));
|
||||||
|
map.put("result",tMemberService.getTeamNodeNumber(tMember.getId()));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("project:tMember:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String tMember()
|
||||||
|
{
|
||||||
|
return prefix + "/tMemberList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下级列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/subordinateList")
|
||||||
|
public String subordinateList(Integer referId)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
sysUserIds.put(sysUser.getUserId(),referId);
|
||||||
|
return prefix + "/subordinateList";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置特定用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMember:specific")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping( "/specific")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult specific(String ids)
|
||||||
|
{
|
||||||
|
TMember tMember = new TMember().setTopUser(1);
|
||||||
|
tMember.setId(Long.parseLong(ids));
|
||||||
|
TMember me = tMemberService.selectTMemberById(Integer.parseInt(ids));
|
||||||
|
//查询上级是否有存在特定顶级用户的
|
||||||
|
String[] arr = me.getAllPid().substring(1,me.getAllPid().length() - 1).split(",");
|
||||||
|
if(tMemberService.countUserByTopUser(arr,me.getId()) != 0){
|
||||||
|
return error("该用户上下级已存在特定的用户账号");
|
||||||
|
}
|
||||||
|
if(me.getReferId() != 0){
|
||||||
|
return error("只能设置顶级用户为特定用户");
|
||||||
|
}
|
||||||
|
return toAjax(tMemberService.updateOrAddTMember(tMember));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询下级用户列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:subordinateList:list")
|
||||||
|
@PostMapping("/subordinateList")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo subordinateList(TMember tMember)
|
||||||
|
{
|
||||||
|
if(!org.apache.commons.lang3.StringUtils.isBlank(tMember.getAccount())){
|
||||||
|
tMember.setAccount(tMember.getAccount().toLowerCase());
|
||||||
|
}
|
||||||
|
startPage();
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
tMember.setReferId(sysUserIds.get(sysUser.getUserId()));
|
||||||
|
List<TMember> list = tMemberService.findTMemberList(tMember);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1=返佣,2=BRIT,3=积分,4=配件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:getRebateList:view")
|
||||||
|
@GetMapping("/getRebateList")
|
||||||
|
public String getRebateList(String id)
|
||||||
|
{
|
||||||
|
String[] arr = id.split(",");
|
||||||
|
userId = Integer.parseInt(arr[0]);
|
||||||
|
types = Integer.parseInt(arr[1]);
|
||||||
|
return prefix + "/awardLogList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户列表资产流水明细
|
||||||
|
*/
|
||||||
|
@PostMapping("/walletLogList")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo walletLogList(TMemberWalletLog tMemberWalletLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
tMemberWalletLog.setMemberId(userId);
|
||||||
|
tMemberWalletLog.setTypes(types);
|
||||||
|
List<TMemberWalletLog> list = walletLogService.selectTMemberWalletLogList(tMemberWalletLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMember:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(TMember tMember)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<TMember> list = tMemberService.selectTMemberList(tMember);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMember:tMember")
|
||||||
|
@PostMapping("/tMember")
|
||||||
|
@ResponseBody
|
||||||
|
public TMember findTMember(TMember tMember)
|
||||||
|
{
|
||||||
|
tMember = tMemberService.findTMember(tMember);
|
||||||
|
return tMember;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出用户列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMember:export")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(TMember tMember)
|
||||||
|
{
|
||||||
|
List<TMember> list = tMemberService.selectTMemberList(tMember);
|
||||||
|
ExcelUtil<TMember> util = new ExcelUtil<TMember>(TMember.class);
|
||||||
|
return util.exportExcel(list, "用户");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/tMemberAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("tMember", tMemberService.selectTMemberById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/tMemberAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMember:add")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(TMember tMember)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
tMember.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(tMemberService.updateOrAddTMember(tMember));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
TMember tMember = tMemberService.selectTMemberById(id);
|
||||||
|
mmap.put("tMember", tMember);
|
||||||
|
return prefix + "/tMemberEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMember:edit")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(TMember tMember)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
tMember.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(tMemberService.updateOrAddTMember(tMember));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMember:remove")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(tMemberService.deleteTMemberByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.TMemberWallet;
|
||||||
|
import com.ruoyi.system.service.TMemberWalletService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-11
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/tMemberWallet")
|
||||||
|
public class TMemberWalletController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/tMemberWallet";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TMemberWalletService tMemberWalletService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:tMemberWallet:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String tMemberWallet()
|
||||||
|
{
|
||||||
|
return prefix + "/tMemberWalletList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询资产列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWallet:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(TMemberWallet tMemberWallet)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<TMemberWallet> list = tMemberWalletService.selectTMemberWalletList(tMemberWallet);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询资产对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWallet:tMemberWallet")
|
||||||
|
@PostMapping("/tMemberWallet")
|
||||||
|
@ResponseBody
|
||||||
|
public TMemberWallet findTMemberWallet(TMemberWallet tMemberWallet)
|
||||||
|
{
|
||||||
|
tMemberWallet = tMemberWalletService.findTMemberWallet(tMemberWallet);
|
||||||
|
return tMemberWallet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出资产列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWallet:export")
|
||||||
|
@Log(title = "资产", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(TMemberWallet tMemberWallet)
|
||||||
|
{
|
||||||
|
List<TMemberWallet> list = tMemberWalletService.selectTMemberWalletList(tMemberWallet);
|
||||||
|
ExcelUtil<TMemberWallet> util = new ExcelUtil<TMemberWallet>(TMemberWallet.class);
|
||||||
|
return util.exportExcel(list, "资产");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增资产
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/tMemberWalletAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增资产
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("tMemberWallet", tMemberWalletService.selectTMemberWalletById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/tMemberWalletAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存资产
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWallet:add")
|
||||||
|
@Log(title = "资产", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(TMemberWallet tMemberWallet)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
tMemberWallet.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(tMemberWalletService.updateOrAddTMemberWallet(tMemberWallet));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改资产
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
TMemberWallet tMemberWallet = tMemberWalletService.selectTMemberWalletById(id);
|
||||||
|
mmap.put("tMemberWallet", tMemberWallet);
|
||||||
|
return prefix + "/tMemberWalletEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存资产
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWallet:edit")
|
||||||
|
@Log(title = "资产", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(TMemberWallet tMemberWallet)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
tMemberWallet.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(tMemberWalletService.updateOrAddTMemberWallet(tMemberWallet));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除资产
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWallet:remove")
|
||||||
|
@Log(title = "资产", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(tMemberWalletService.deleteTMemberWalletByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.TMemberWalletLog;
|
||||||
|
import com.ruoyi.system.service.TMemberWalletLogService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产流水Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2024-01-11
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/tMemberWalletLog")
|
||||||
|
public class TMemberWalletLogController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/tMemberWalletLog";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TMemberWalletLogService tMemberWalletLogService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:tMemberWalletLog:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String tMemberWalletLog()
|
||||||
|
{
|
||||||
|
return prefix + "/tMemberWalletLogList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询资产流水列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWalletLog:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(TMemberWalletLog tMemberWalletLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<TMemberWalletLog> list = tMemberWalletLogService.findTMemberWalletLogList(tMemberWalletLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询资产流水对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWalletLog:tMemberWalletLog")
|
||||||
|
@PostMapping("/tMemberWalletLog")
|
||||||
|
@ResponseBody
|
||||||
|
public TMemberWalletLog findTMemberWalletLog(TMemberWalletLog tMemberWalletLog)
|
||||||
|
{
|
||||||
|
tMemberWalletLog = tMemberWalletLogService.findTMemberWalletLog(tMemberWalletLog);
|
||||||
|
return tMemberWalletLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出资产流水列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWalletLog:export")
|
||||||
|
@Log(title = "资产流水", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(TMemberWalletLog tMemberWalletLog)
|
||||||
|
{
|
||||||
|
List<TMemberWalletLog> list = tMemberWalletLogService.selectTMemberWalletLogList(tMemberWalletLog);
|
||||||
|
ExcelUtil<TMemberWalletLog> util = new ExcelUtil<TMemberWalletLog>(TMemberWalletLog.class);
|
||||||
|
return util.exportExcel(list, "资产流水");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增资产流水
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/tMemberWalletLogAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增资产流水
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("tMemberWalletLog", tMemberWalletLogService.selectTMemberWalletLogById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/tMemberWalletLogAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存资产流水
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWalletLog:add")
|
||||||
|
@Log(title = "资产流水", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(TMemberWalletLog tMemberWalletLog)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
tMemberWalletLog.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(tMemberWalletLogService.updateOrAddTMemberWalletLog(tMemberWalletLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改资产流水
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
TMemberWalletLog tMemberWalletLog = tMemberWalletLogService.selectTMemberWalletLogById(id);
|
||||||
|
mmap.put("tMemberWalletLog", tMemberWalletLog);
|
||||||
|
return prefix + "/tMemberWalletLogEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存资产流水
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWalletLog:edit")
|
||||||
|
@Log(title = "资产流水", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(TMemberWalletLog tMemberWalletLog)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
tMemberWalletLog.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(tMemberWalletLogService.updateOrAddTMemberWalletLog(tMemberWalletLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除资产流水
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:tMemberWalletLog:remove")
|
||||||
|
@Log(title = "资产流水", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(tMemberWalletLogService.deleteTMemberWalletLogByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,177 @@
|
||||||
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.ruoyi.system.utils.HttpUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.config.ServerConfig;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
|
|
||||||
|
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用请求处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class CommonController
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ServerConfig serverConfig;
|
||||||
|
|
||||||
|
private static final String FILE_DELIMETER = ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用下载请求
|
||||||
|
*
|
||||||
|
* @param fileName 文件名称
|
||||||
|
* @param delete 是否删除
|
||||||
|
*/
|
||||||
|
@GetMapping("common/download")
|
||||||
|
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!FileUtils.checkAllowDownload(fileName))
|
||||||
|
{
|
||||||
|
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||||
|
}
|
||||||
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||||
|
String filePath = RuoYiConfig.getDownloadPath() + fileName;
|
||||||
|
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||||
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
|
if (delete)
|
||||||
|
{
|
||||||
|
FileUtils.deleteFile(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("下载文件失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("${ruoyi.addImg}")
|
||||||
|
private String remoteUpload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用上传请求
|
||||||
|
*/
|
||||||
|
@PostMapping("/common/upload")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
String url = HttpUtils.gettesthttpclient(file,remoteUpload);
|
||||||
|
if(url == null){
|
||||||
|
return error("上传失败");
|
||||||
|
}
|
||||||
|
String code = JSON.parseObject(url).getString("code");
|
||||||
|
if(!code.equals("0")){
|
||||||
|
return error("上传文件失败");
|
||||||
|
}
|
||||||
|
String data = JSON.parseObject(url).getString("data");
|
||||||
|
String name = JSON.parseObject(data).getString("fileName");
|
||||||
|
String url1 = JSON.parseObject(data).getString("fullUrl");
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("fileName", name);
|
||||||
|
ajax.put("url", url1);
|
||||||
|
return ajax;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error("失败了");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用上传请求(多个)
|
||||||
|
*/
|
||||||
|
@PostMapping("/common/uploads")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 上传文件路径
|
||||||
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
|
List<String> urls = new ArrayList<String>();
|
||||||
|
List<String> fileNames = new ArrayList<String>();
|
||||||
|
List<String> newFileNames = new ArrayList<String>();
|
||||||
|
List<String> originalFilenames = new ArrayList<String>();
|
||||||
|
for (MultipartFile file : files)
|
||||||
|
{
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
|
String url = serverConfig.getUrl() + fileName;
|
||||||
|
urls.add(url);
|
||||||
|
fileNames.add(fileName);
|
||||||
|
newFileNames.add(FileUtils.getName(fileName));
|
||||||
|
originalFilenames.add(file.getOriginalFilename());
|
||||||
|
}
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||||
|
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||||
|
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||||
|
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地资源通用下载
|
||||||
|
*/
|
||||||
|
@GetMapping("/common/download/resource")
|
||||||
|
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!FileUtils.checkAllowDownload(resource))
|
||||||
|
{
|
||||||
|
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||||
|
}
|
||||||
|
// 本地资源路径
|
||||||
|
String localPath = RuoYiConfig.getProfile();
|
||||||
|
// 数据库资源地址
|
||||||
|
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||||
|
// 下载名称
|
||||||
|
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||||
|
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("下载文件失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模态窗口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/modal")
|
||||||
|
public class DemoDialogController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/modal";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模态窗口
|
||||||
|
*/
|
||||||
|
@GetMapping("/dialog")
|
||||||
|
public String dialog()
|
||||||
|
{
|
||||||
|
return prefix + "/dialog";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弹层组件
|
||||||
|
*/
|
||||||
|
@GetMapping("/layer")
|
||||||
|
public String layer()
|
||||||
|
{
|
||||||
|
return prefix + "/layer";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单
|
||||||
|
*/
|
||||||
|
@GetMapping("/form")
|
||||||
|
public String form()
|
||||||
|
{
|
||||||
|
return prefix + "/form";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格
|
||||||
|
*/
|
||||||
|
@GetMapping("/table")
|
||||||
|
public String table()
|
||||||
|
{
|
||||||
|
return prefix + "/table";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格check
|
||||||
|
*/
|
||||||
|
@GetMapping("/check")
|
||||||
|
public String check()
|
||||||
|
{
|
||||||
|
return prefix + "/table/check";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格radio
|
||||||
|
*/
|
||||||
|
@GetMapping("/radio")
|
||||||
|
public String radio()
|
||||||
|
{
|
||||||
|
return prefix + "/table/radio";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格回传父窗体
|
||||||
|
*/
|
||||||
|
@GetMapping("/parent")
|
||||||
|
public String parent()
|
||||||
|
{
|
||||||
|
return prefix + "/table/parent";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多层窗口frame1
|
||||||
|
*/
|
||||||
|
@GetMapping("/frame1")
|
||||||
|
public String frame1()
|
||||||
|
{
|
||||||
|
return prefix + "/table/frame1";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多层窗口frame2
|
||||||
|
*/
|
||||||
|
@GetMapping("/frame2")
|
||||||
|
public String frame2()
|
||||||
|
{
|
||||||
|
return prefix + "/table/frame2";
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图标相关
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/icon")
|
||||||
|
public class DemoIconController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/icon";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FontAwesome图标
|
||||||
|
*/
|
||||||
|
@GetMapping("/fontawesome")
|
||||||
|
public String fontAwesome()
|
||||||
|
{
|
||||||
|
return prefix + "/fontawesome";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Glyphicons图标
|
||||||
|
*/
|
||||||
|
@GetMapping("/glyphicons")
|
||||||
|
public String glyphicons()
|
||||||
|
{
|
||||||
|
return prefix + "/glyphicons";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,326 @@
|
||||||
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.PageDomain;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.page.TableSupport;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.web.controller.demo.domain.CustomerModel;
|
||||||
|
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作控制
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/operate")
|
||||||
|
public class DemoOperateController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/operate";
|
||||||
|
|
||||||
|
private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>();
|
||||||
|
{
|
||||||
|
users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
||||||
|
users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||||
|
users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||||
|
users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
|
||||||
|
users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
|
||||||
|
users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||||
|
users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
|
||||||
|
users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||||
|
users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||||
|
users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||||
|
users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
|
||||||
|
users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
|
||||||
|
users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||||
|
users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
|
||||||
|
users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||||
|
users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
|
||||||
|
users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||||
|
users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||||
|
users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||||
|
users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
|
||||||
|
users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
|
||||||
|
users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||||
|
users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
|
users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格
|
||||||
|
*/
|
||||||
|
@GetMapping("/table")
|
||||||
|
public String table()
|
||||||
|
{
|
||||||
|
return prefix + "/table";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他
|
||||||
|
*/
|
||||||
|
@GetMapping("/other")
|
||||||
|
public String other()
|
||||||
|
{
|
||||||
|
return prefix + "/other";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(UserOperateModel userModel)
|
||||||
|
{
|
||||||
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
|
List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
|
||||||
|
// 查询条件过滤
|
||||||
|
if (StringUtils.isNotEmpty(userModel.getSearchValue()))
|
||||||
|
{
|
||||||
|
userList.clear();
|
||||||
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||||
|
{
|
||||||
|
if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
|
||||||
|
{
|
||||||
|
userList.add(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(userModel.getUserName()))
|
||||||
|
{
|
||||||
|
userList.clear();
|
||||||
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||||
|
{
|
||||||
|
if (entry.getValue().getUserName().equals(userModel.getUserName()))
|
||||||
|
{
|
||||||
|
userList.add(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||||
|
{
|
||||||
|
rspData.setRows(userList);
|
||||||
|
rspData.setTotal(userList.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||||
|
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||||
|
if (pageSize > userList.size())
|
||||||
|
{
|
||||||
|
pageSize = userList.size();
|
||||||
|
}
|
||||||
|
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||||
|
rspData.setTotal(userList.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add(ModelMap mmap)
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存用户
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(UserOperateModel user)
|
||||||
|
{
|
||||||
|
Integer userId = users.size() + 1;
|
||||||
|
user.setUserId(userId);
|
||||||
|
return AjaxResult.success(users.put(userId, user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存主子表信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/customer/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(CustomerModel customerModel)
|
||||||
|
{
|
||||||
|
System.out.println(customerModel.toString());
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{userId}")
|
||||||
|
public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("user", users.get(userId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存用户
|
||||||
|
*/
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(UserOperateModel user)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
*/
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(UserOperateModel user)
|
||||||
|
{
|
||||||
|
List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values());
|
||||||
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
|
return util.exportExcel(list, "用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载模板
|
||||||
|
*/
|
||||||
|
@GetMapping("/importTemplate")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult importTemplate()
|
||||||
|
{
|
||||||
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
|
return util.importTemplateExcel("用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/importData")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||||
|
{
|
||||||
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
|
List<UserOperateModel> userList = util.importExcel(file.getInputStream());
|
||||||
|
String message = importUser(userList, updateSupport);
|
||||||
|
return AjaxResult.success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*/
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
Integer[] userIds = Convert.toIntArray(ids);
|
||||||
|
for (Integer userId : userIds)
|
||||||
|
{
|
||||||
|
users.remove(userId);
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看详细
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail/{userId}")
|
||||||
|
public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("user", users.get(userId));
|
||||||
|
return prefix + "/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/clean")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
users.clear();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入用户数据
|
||||||
|
*
|
||||||
|
* @param userList 用户数据列表
|
||||||
|
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNull(userList) || userList.size() == 0)
|
||||||
|
{
|
||||||
|
throw new ServiceException("导入用户数据不能为空!");
|
||||||
|
}
|
||||||
|
int successNum = 0;
|
||||||
|
int failureNum = 0;
|
||||||
|
StringBuilder successMsg = new StringBuilder();
|
||||||
|
StringBuilder failureMsg = new StringBuilder();
|
||||||
|
for (UserOperateModel user : userList)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 验证是否存在这个用户
|
||||||
|
boolean userFlag = false;
|
||||||
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||||
|
{
|
||||||
|
if (entry.getValue().getUserName().equals(user.getUserName()))
|
||||||
|
{
|
||||||
|
userFlag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!userFlag)
|
||||||
|
{
|
||||||
|
Integer userId = users.size() + 1;
|
||||||
|
user.setUserId(userId);
|
||||||
|
users.put(userId, user);
|
||||||
|
successNum++;
|
||||||
|
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功");
|
||||||
|
}
|
||||||
|
else if (isUpdateSupport)
|
||||||
|
{
|
||||||
|
users.put(user.getUserId(), user);
|
||||||
|
successNum++;
|
||||||
|
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
failureNum++;
|
||||||
|
failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
failureNum++;
|
||||||
|
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
||||||
|
failureMsg.append(msg + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (failureNum > 0)
|
||||||
|
{
|
||||||
|
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||||
|
throw new ServiceException(failureMsg.toString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||||
|
}
|
||||||
|
return successMsg.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报表
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/report")
|
||||||
|
public class DemoReportController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/report";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百度ECharts
|
||||||
|
*/
|
||||||
|
@GetMapping("/echarts")
|
||||||
|
public String echarts()
|
||||||
|
{
|
||||||
|
return prefix + "/echarts";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图表插件
|
||||||
|
*/
|
||||||
|
@GetMapping("/peity")
|
||||||
|
public String peity()
|
||||||
|
{
|
||||||
|
return prefix + "/peity";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线状图插件
|
||||||
|
*/
|
||||||
|
@GetMapping("/sparkline")
|
||||||
|
public String sparkline()
|
||||||
|
{
|
||||||
|
return prefix + "/sparkline";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图表组合
|
||||||
|
*/
|
||||||
|
@GetMapping("/metrics")
|
||||||
|
public String metrics()
|
||||||
|
{
|
||||||
|
return prefix + "/metrics";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,846 @@
|
||||||
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.PageDomain;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.page.TableSupport;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格相关
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/table")
|
||||||
|
public class DemoTableController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/table";
|
||||||
|
|
||||||
|
private final static List<UserTableModel> users = new ArrayList<UserTableModel>();
|
||||||
|
{
|
||||||
|
users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
||||||
|
users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||||
|
users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||||
|
users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
|
||||||
|
users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
|
||||||
|
users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||||
|
users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
|
||||||
|
users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||||
|
users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||||
|
users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||||
|
users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
|
||||||
|
users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
|
||||||
|
users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||||
|
users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
|
||||||
|
users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||||
|
users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
|
||||||
|
users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||||
|
users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||||
|
users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||||
|
users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
|
||||||
|
users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
|
||||||
|
users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||||
|
users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
|
users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static List<AreaModel> areas = new ArrayList<AreaModel>();
|
||||||
|
{
|
||||||
|
areas.add(new AreaModel(1, 0, "广东省", "440000", "GDS", "GuangDongSheng", 1));
|
||||||
|
areas.add(new AreaModel(2, 0, "湖南省", "430000", "HNS", "HuNanSheng", 1));
|
||||||
|
areas.add(new AreaModel(3, 0, "河南省", "410000", "HNS", "HeNanSheng", 0));
|
||||||
|
areas.add(new AreaModel(4, 0, "湖北省", "420000", "HBS", "HuBeiSheng", 0));
|
||||||
|
areas.add(new AreaModel(5, 0, "辽宁省", "210000", "LNS", "LiaoNingSheng", 0));
|
||||||
|
areas.add(new AreaModel(6, 0, "山东省", "370000", "SDS", "ShanDongSheng", 0));
|
||||||
|
areas.add(new AreaModel(7, 0, "陕西省", "610000", "SXS", "ShanXiSheng", 0));
|
||||||
|
areas.add(new AreaModel(8, 0, "贵州省", "520000", "GZS", "GuiZhouSheng", 0));
|
||||||
|
areas.add(new AreaModel(9, 0, "上海市", "310000", "SHS", "ShangHaiShi", 0));
|
||||||
|
areas.add(new AreaModel(10, 0, "重庆市", "500000", "CQS", "ChongQingShi", 0));
|
||||||
|
areas.add(new AreaModel(11, 0, "若依省", "666666", "YYS", "RuoYiSheng", 0));
|
||||||
|
areas.add(new AreaModel(12, 0, "安徽省", "340000", "AHS", "AnHuiSheng", 0));
|
||||||
|
areas.add(new AreaModel(13, 0, "福建省", "350000", "FJS", "FuJianSheng", 0));
|
||||||
|
areas.add(new AreaModel(14, 0, "海南省", "460000", "HNS", "HaiNanSheng", 0));
|
||||||
|
areas.add(new AreaModel(15, 0, "江苏省", "320000", "JSS", "JiangSuSheng", 0));
|
||||||
|
areas.add(new AreaModel(16, 0, "青海省", "630000", "QHS", "QingHaiSheng", 0));
|
||||||
|
areas.add(new AreaModel(17, 0, "广西壮族自治区", "450000", "GXZZZZQ", "GuangXiZhuangZuZiZhiQu", 0));
|
||||||
|
areas.add(new AreaModel(18, 0, "宁夏回族自治区", "640000", "NXHZZZQ", "NingXiaHuiZuZiZhiQu", 0));
|
||||||
|
areas.add(new AreaModel(19, 0, "内蒙古自治区", "150000", "NMGZZQ", "NeiMengGuZiZhiQu", 0));
|
||||||
|
areas.add(new AreaModel(20, 0, "新疆维吾尔自治区", "650000", "XJWWEZZQ", "XinJiangWeiWuErZiZhiQu", 0));
|
||||||
|
areas.add(new AreaModel(21, 0, "江西省", "360000", "JXS", "JiangXiSheng", 0));
|
||||||
|
areas.add(new AreaModel(22, 0, "浙江省", "330000", "ZJS", "ZheJiangSheng", 0));
|
||||||
|
areas.add(new AreaModel(23, 0, "河北省", "130000", "HBS", "HeBeiSheng", 0));
|
||||||
|
areas.add(new AreaModel(24, 0, "天津市", "120000", "TJS", "TianJinShi", 0));
|
||||||
|
areas.add(new AreaModel(25, 0, "山西省", "140000", "SXS", "ShanXiSheng", 0));
|
||||||
|
areas.add(new AreaModel(26, 0, "台湾省", "710000", "TWS", "TaiWanSheng", 0));
|
||||||
|
areas.add(new AreaModel(27, 0, "甘肃省", "620000", "GSS", "GanSuSheng", 0));
|
||||||
|
areas.add(new AreaModel(28, 0, "四川省", "510000", "SCS", "SiChuanSheng", 0));
|
||||||
|
areas.add(new AreaModel(29, 0, "云南省", "530000", "YNS", "YunNanSheng", 0));
|
||||||
|
areas.add(new AreaModel(30, 0, "北京市", "110000", "BJS", "BeiJingShi", 0));
|
||||||
|
areas.add(new AreaModel(31, 0, "香港特别行政区", "810000", "XGTBXZQ", "XiangGangTeBieXingZhengQu", 0));
|
||||||
|
areas.add(new AreaModel(32, 0, "澳门特别行政区", "820000", "AMTBXZQ", "AoMenTeBieXingZhengQu", 0));
|
||||||
|
|
||||||
|
areas.add(new AreaModel(100, 1, "深圳市", "440300", "SZS", "ShenZhenShi", 1));
|
||||||
|
areas.add(new AreaModel(101, 1, "广州市", "440100", "GZS", "GuangZhouShi", 0));
|
||||||
|
areas.add(new AreaModel(102, 1, "东莞市", "441900", "DGS", "DongGuanShi", 0));
|
||||||
|
areas.add(new AreaModel(103, 2, "长沙市", "410005", "CSS", "ChangShaShi", 1));
|
||||||
|
areas.add(new AreaModel(104, 2, "岳阳市", "414000", "YYS", "YueYangShi", 0));
|
||||||
|
|
||||||
|
areas.add(new AreaModel(1000, 100, "龙岗区", "518172", "LGQ", "LongGangQu", 0));
|
||||||
|
areas.add(new AreaModel(1001, 100, "南山区", "518051", "NSQ", "NanShanQu", 0));
|
||||||
|
areas.add(new AreaModel(1002, 100, "宝安区", "518101", "BAQ", "BaoAnQu", 0));
|
||||||
|
areas.add(new AreaModel(1003, 100, "福田区", "518081", "FTQ", "FuTianQu", 0));
|
||||||
|
areas.add(new AreaModel(1004, 103, "天心区", "410004", "TXQ", "TianXinQu", 0));
|
||||||
|
areas.add(new AreaModel(1005, 103, "开福区", "410008", "KFQ", "KaiFuQu", 0));
|
||||||
|
areas.add(new AreaModel(1006, 103, "芙蓉区", "410011", "FRQ", "FuRongQu", 0));
|
||||||
|
areas.add(new AreaModel(1007, 103, "雨花区", "410011", "YHQ", "YuHuaQu", 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static List<UserTableColumn> columns = new ArrayList<UserTableColumn>();
|
||||||
|
{
|
||||||
|
columns.add(new UserTableColumn("用户ID", "userId"));
|
||||||
|
columns.add(new UserTableColumn("用户编号", "userCode"));
|
||||||
|
columns.add(new UserTableColumn("用户姓名", "userName"));
|
||||||
|
columns.add(new UserTableColumn("用户手机", "userPhone"));
|
||||||
|
columns.add(new UserTableColumn("用户邮箱", "userEmail"));
|
||||||
|
columns.add(new UserTableColumn("用户状态", "status"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索相关
|
||||||
|
*/
|
||||||
|
@GetMapping("/search")
|
||||||
|
public String search()
|
||||||
|
{
|
||||||
|
return prefix + "/search";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据汇总
|
||||||
|
*/
|
||||||
|
@GetMapping("/footer")
|
||||||
|
public String footer()
|
||||||
|
{
|
||||||
|
return prefix + "/footer";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组合表头
|
||||||
|
*/
|
||||||
|
@GetMapping("/groupHeader")
|
||||||
|
public String groupHeader()
|
||||||
|
{
|
||||||
|
return prefix + "/groupHeader";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格导出
|
||||||
|
*/
|
||||||
|
@GetMapping("/export")
|
||||||
|
public String export()
|
||||||
|
{
|
||||||
|
return prefix + "/export";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格导出选择列
|
||||||
|
*/
|
||||||
|
@GetMapping("/exportSelected")
|
||||||
|
public String exportSelected()
|
||||||
|
{
|
||||||
|
return prefix + "/exportSelected";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/exportData")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult exportSelected(UserTableModel userModel, String userIds)
|
||||||
|
{
|
||||||
|
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
|
||||||
|
Collections.copy(userList, users);
|
||||||
|
|
||||||
|
// 条件过滤
|
||||||
|
if (StringUtils.isNotEmpty(userIds))
|
||||||
|
{
|
||||||
|
userList.clear();
|
||||||
|
for (Long userId : Convert.toLongArray(userIds))
|
||||||
|
{
|
||||||
|
for (UserTableModel user : users)
|
||||||
|
{
|
||||||
|
if (user.getUserId() == userId)
|
||||||
|
{
|
||||||
|
userList.add(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ExcelUtil<UserTableModel> util = new ExcelUtil<UserTableModel>(UserTableModel.class);
|
||||||
|
return util.exportExcel(userList, "用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻页记住选择
|
||||||
|
*/
|
||||||
|
@GetMapping("/remember")
|
||||||
|
public String remember()
|
||||||
|
{
|
||||||
|
return prefix + "/remember";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转至指定页
|
||||||
|
*/
|
||||||
|
@GetMapping("/pageGo")
|
||||||
|
public String pageGo()
|
||||||
|
{
|
||||||
|
return prefix + "/pageGo";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义查询参数
|
||||||
|
*/
|
||||||
|
@GetMapping("/params")
|
||||||
|
public String params()
|
||||||
|
{
|
||||||
|
return prefix + "/params";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多表格
|
||||||
|
*/
|
||||||
|
@GetMapping("/multi")
|
||||||
|
public String multi()
|
||||||
|
{
|
||||||
|
return prefix + "/multi";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击按钮加载表格
|
||||||
|
*/
|
||||||
|
@GetMapping("/button")
|
||||||
|
public String button()
|
||||||
|
{
|
||||||
|
return prefix + "/button";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直接加载表格数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/data")
|
||||||
|
public String data(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("users", users);
|
||||||
|
return prefix + "/data";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格冻结列
|
||||||
|
*/
|
||||||
|
@GetMapping("/fixedColumns")
|
||||||
|
public String fixedColumns()
|
||||||
|
{
|
||||||
|
return prefix + "/fixedColumns";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义触发事件
|
||||||
|
*/
|
||||||
|
@GetMapping("/event")
|
||||||
|
public String event()
|
||||||
|
{
|
||||||
|
return prefix + "/event";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格细节视图
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public String detail()
|
||||||
|
{
|
||||||
|
return prefix + "/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格父子视图
|
||||||
|
*/
|
||||||
|
@GetMapping("/child")
|
||||||
|
public String child()
|
||||||
|
{
|
||||||
|
return prefix + "/child";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格图片预览
|
||||||
|
*/
|
||||||
|
@GetMapping("/image")
|
||||||
|
public String image()
|
||||||
|
{
|
||||||
|
return prefix + "/image";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态增删改查
|
||||||
|
*/
|
||||||
|
@GetMapping("/curd")
|
||||||
|
public String curd()
|
||||||
|
{
|
||||||
|
return prefix + "/curd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格行拖拽操作
|
||||||
|
*/
|
||||||
|
@GetMapping("/reorderRows")
|
||||||
|
public String reorderRows()
|
||||||
|
{
|
||||||
|
return prefix + "/reorderRows";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格列拖拽操作
|
||||||
|
*/
|
||||||
|
@GetMapping("/reorderColumns")
|
||||||
|
public String reorderColumns()
|
||||||
|
{
|
||||||
|
return prefix + "/reorderColumns";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格列宽拖动
|
||||||
|
*/
|
||||||
|
@GetMapping("/resizable")
|
||||||
|
public String resizable()
|
||||||
|
{
|
||||||
|
return prefix + "/resizable";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格行内编辑操作
|
||||||
|
*/
|
||||||
|
@GetMapping("/editable")
|
||||||
|
public String editable()
|
||||||
|
{
|
||||||
|
return prefix + "/editable";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主子表提交
|
||||||
|
*/
|
||||||
|
@GetMapping("/subdata")
|
||||||
|
public String subdata()
|
||||||
|
{
|
||||||
|
return prefix + "/subdata";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格自动刷新
|
||||||
|
*/
|
||||||
|
@GetMapping("/refresh")
|
||||||
|
public String refresh()
|
||||||
|
{
|
||||||
|
return prefix + "/refresh";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格打印配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/print")
|
||||||
|
public String print()
|
||||||
|
{
|
||||||
|
return prefix + "/print";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格标题格式化
|
||||||
|
*/
|
||||||
|
@GetMapping("/headerStyle")
|
||||||
|
public String headerStyle()
|
||||||
|
{
|
||||||
|
return prefix + "/headerStyle";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格动态列
|
||||||
|
*/
|
||||||
|
@GetMapping("/dynamicColumns")
|
||||||
|
public String dynamicColumns()
|
||||||
|
{
|
||||||
|
return prefix + "/dynamicColumns";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义视图分页
|
||||||
|
*/
|
||||||
|
@GetMapping("/customView")
|
||||||
|
public String customView()
|
||||||
|
{
|
||||||
|
return prefix + "/customView";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步加载表格树
|
||||||
|
*/
|
||||||
|
@GetMapping("/asynTree")
|
||||||
|
public String asynTree()
|
||||||
|
{
|
||||||
|
return prefix + "/asynTree";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格其他操作
|
||||||
|
*/
|
||||||
|
@GetMapping("/other")
|
||||||
|
public String other()
|
||||||
|
{
|
||||||
|
return prefix + "/other";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态获取列
|
||||||
|
*/
|
||||||
|
@PostMapping("/ajaxColumns")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult ajaxColumns(UserTableColumn userColumn)
|
||||||
|
{
|
||||||
|
List<UserTableColumn> columnList = new ArrayList<UserTableColumn>(Arrays.asList(new UserTableColumn[columns.size()]));
|
||||||
|
Collections.copy(columnList, columns);
|
||||||
|
if (userColumn != null && "userBalance".equals(userColumn.getField()))
|
||||||
|
{
|
||||||
|
columnList.add(new UserTableColumn("用户余额", "userBalance"));
|
||||||
|
}
|
||||||
|
return AjaxResult.success(columnList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(UserTableModel userModel)
|
||||||
|
{
|
||||||
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
|
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
|
||||||
|
Collections.copy(userList, users);
|
||||||
|
// 查询条件过滤
|
||||||
|
if (StringUtils.isNotEmpty(userModel.getUserName()))
|
||||||
|
{
|
||||||
|
userList.clear();
|
||||||
|
for (UserTableModel user : users)
|
||||||
|
{
|
||||||
|
if (user.getUserName().equals(userModel.getUserName()))
|
||||||
|
{
|
||||||
|
userList.add(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||||
|
{
|
||||||
|
rspData.setRows(userList);
|
||||||
|
rspData.setTotal(userList.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||||
|
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||||
|
if (pageSize > userList.size())
|
||||||
|
{
|
||||||
|
pageSize = userList.size();
|
||||||
|
}
|
||||||
|
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||||
|
rspData.setTotal(userList.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询树表数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/tree/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo treeList(AreaModel areaModel)
|
||||||
|
{
|
||||||
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
|
List<AreaModel> areaList = new ArrayList<AreaModel>(Arrays.asList(new AreaModel[areas.size()]));
|
||||||
|
// 默认查询条件 parentId 0
|
||||||
|
Collections.copy(areaList, areas);
|
||||||
|
areaList.clear();
|
||||||
|
if (StringUtils.isNotEmpty(areaModel.getAreaName()))
|
||||||
|
{
|
||||||
|
for (AreaModel area : areas)
|
||||||
|
{
|
||||||
|
if (area.getParentId() == 0 && area.getAreaName().equals(areaModel.getAreaName()))
|
||||||
|
{
|
||||||
|
areaList.add(area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (AreaModel area : areas)
|
||||||
|
{
|
||||||
|
if (area.getParentId() == 0)
|
||||||
|
{
|
||||||
|
areaList.add(area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||||
|
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||||
|
if (pageSize > areaList.size())
|
||||||
|
{
|
||||||
|
pageSize = areaList.size();
|
||||||
|
}
|
||||||
|
rspData.setRows(areaList.subList(pageNum, pageSize));
|
||||||
|
rspData.setTotal(areaList.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询树表子节点数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/tree/listChild")
|
||||||
|
@ResponseBody
|
||||||
|
public List<AreaModel> listChild(AreaModel areaModel)
|
||||||
|
{
|
||||||
|
List<AreaModel> areaList = new ArrayList<AreaModel>(Arrays.asList(new AreaModel[areas.size()]));
|
||||||
|
// 查询条件 parentId
|
||||||
|
Collections.copy(areaList, areas);
|
||||||
|
areaList.clear();
|
||||||
|
if (StringUtils.isNotEmpty(areaModel.getAreaName()))
|
||||||
|
{
|
||||||
|
for (AreaModel area : areas)
|
||||||
|
{
|
||||||
|
if (area.getParentId().intValue() == areaModel.getParentId().intValue() && area.getAreaName().equals(areaModel.getAreaName()))
|
||||||
|
{
|
||||||
|
areaList.add(area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (AreaModel area : areas)
|
||||||
|
{
|
||||||
|
if (area.getParentId().intValue() == areaModel.getParentId().intValue())
|
||||||
|
{
|
||||||
|
areaList.add(area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return areaList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserTableColumn
|
||||||
|
{
|
||||||
|
/** 表头 */
|
||||||
|
private String title;
|
||||||
|
/** 字段 */
|
||||||
|
private String field;
|
||||||
|
|
||||||
|
public UserTableColumn()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserTableColumn(String title, String field)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
this.field = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField()
|
||||||
|
{
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField(String field)
|
||||||
|
{
|
||||||
|
this.field = field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserTableModel
|
||||||
|
{
|
||||||
|
/** 用户ID */
|
||||||
|
private int userId;
|
||||||
|
|
||||||
|
/** 用户编号 */
|
||||||
|
@Excel(name = "用户编号", cellType = ColumnType.NUMERIC)
|
||||||
|
private String userCode;
|
||||||
|
|
||||||
|
/** 用户姓名 */
|
||||||
|
@Excel(name = "用户姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/** 用户性别 */
|
||||||
|
private String userSex;
|
||||||
|
|
||||||
|
/** 用户手机 */
|
||||||
|
@Excel(name = "用户手机")
|
||||||
|
private String userPhone;
|
||||||
|
|
||||||
|
/** 用户邮箱 */
|
||||||
|
@Excel(name = "用户邮箱")
|
||||||
|
private String userEmail;
|
||||||
|
|
||||||
|
/** 用户余额 */
|
||||||
|
@Excel(name = "用户余额", cellType = ColumnType.NUMERIC)
|
||||||
|
private double userBalance;
|
||||||
|
|
||||||
|
/** 用户状态(0正常 1停用) */
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public UserTableModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||||
|
String userEmail, double userBalance, String status)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
this.userCode = userCode;
|
||||||
|
this.userName = userName;
|
||||||
|
this.userSex = userSex;
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
this.userBalance = userBalance;
|
||||||
|
this.status = status;
|
||||||
|
this.createTime = DateUtils.getNowDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(int userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserCode()
|
||||||
|
{
|
||||||
|
return userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserCode(String userCode)
|
||||||
|
{
|
||||||
|
this.userCode = userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName)
|
||||||
|
{
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserSex()
|
||||||
|
{
|
||||||
|
return userSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserSex(String userSex)
|
||||||
|
{
|
||||||
|
this.userSex = userSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserPhone()
|
||||||
|
{
|
||||||
|
return userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserPhone(String userPhone)
|
||||||
|
{
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserEmail()
|
||||||
|
{
|
||||||
|
return userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserEmail(String userEmail)
|
||||||
|
{
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getUserBalance()
|
||||||
|
{
|
||||||
|
return userBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserBalance(double userBalance)
|
||||||
|
{
|
||||||
|
this.userBalance = userBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus()
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime()
|
||||||
|
{
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime)
|
||||||
|
{
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class AreaModel
|
||||||
|
{
|
||||||
|
/** 编号 */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 父编号 */
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/** 区域名称 */
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
/** 区域代码 */
|
||||||
|
private String areaCode;
|
||||||
|
|
||||||
|
/** 名称首字母 */
|
||||||
|
private String simplePy;
|
||||||
|
|
||||||
|
/** 名称全拼 */
|
||||||
|
private String pinYin;
|
||||||
|
|
||||||
|
/** 是否有子节点(0无 1有) */
|
||||||
|
private Integer isTreeLeaf = 1;
|
||||||
|
|
||||||
|
public AreaModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public AreaModel(int id, int parentId, String areaName, String areaCode, String simplePy, String pinYin, Integer isTreeLeaf)
|
||||||
|
{
|
||||||
|
this.id = Long.valueOf(id);
|
||||||
|
this.parentId = Long.valueOf(parentId);
|
||||||
|
this.areaName = areaName;
|
||||||
|
this.areaCode = areaCode;
|
||||||
|
this.simplePy = simplePy;
|
||||||
|
this.pinYin = pinYin;
|
||||||
|
this.isTreeLeaf = isTreeLeaf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getParentId()
|
||||||
|
{
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(Long parentId)
|
||||||
|
{
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAreaName()
|
||||||
|
{
|
||||||
|
return areaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAreaName(String areaName)
|
||||||
|
{
|
||||||
|
this.areaName = areaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAreaCode()
|
||||||
|
{
|
||||||
|
return areaCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAreaCode(String areaCode)
|
||||||
|
{
|
||||||
|
this.areaCode = areaCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSimplePy()
|
||||||
|
{
|
||||||
|
return simplePy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSimplePy(String simplePy)
|
||||||
|
{
|
||||||
|
this.simplePy = simplePy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPinYin()
|
||||||
|
{
|
||||||
|
return pinYin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPinYin(String pinYin)
|
||||||
|
{
|
||||||
|
this.pinYin = pinYin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsTreeLeaf()
|
||||||
|
{
|
||||||
|
return isTreeLeaf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsTreeLeaf(Integer isTreeLeaf)
|
||||||
|
{
|
||||||
|
this.isTreeLeaf = isTreeLeaf;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.ruoyi.web.controller.demo.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户测试信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class CustomerModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 客户姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户手机
|
||||||
|
*/
|
||||||
|
private String phonenumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户性别
|
||||||
|
*/
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户生日
|
||||||
|
*/
|
||||||
|
private String birthday;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户描述
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品信息
|
||||||
|
*/
|
||||||
|
private List<GoodsModel> goods;
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhonenumber()
|
||||||
|
{
|
||||||
|
return phonenumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhonenumber(String phonenumber)
|
||||||
|
{
|
||||||
|
this.phonenumber = phonenumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getSex()
|
||||||
|
{
|
||||||
|
return sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSex(String sex)
|
||||||
|
{
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBirthday()
|
||||||
|
{
|
||||||
|
return birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirthday(String birthday)
|
||||||
|
{
|
||||||
|
this.birthday = birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark()
|
||||||
|
{
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark)
|
||||||
|
{
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GoodsModel> getGoods()
|
||||||
|
{
|
||||||
|
return goods;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoods(List<GoodsModel> goods)
|
||||||
|
{
|
||||||
|
this.goods = goods;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("name", getName())
|
||||||
|
.append("phonenumber", getPhonenumber())
|
||||||
|
.append("sex", getSex())
|
||||||
|
.append("birthday", getBirthday())
|
||||||
|
.append("goods", getGoods())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
package com.ruoyi.web.controller.demo.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品测试信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class GoodsModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品重量
|
||||||
|
*/
|
||||||
|
private Integer weight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品价格
|
||||||
|
*/
|
||||||
|
private Double price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品日期
|
||||||
|
*/
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品种类
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getWeight()
|
||||||
|
{
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeight(Integer weight)
|
||||||
|
{
|
||||||
|
this.weight = weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getPrice()
|
||||||
|
{
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Double price)
|
||||||
|
{
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate()
|
||||||
|
{
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date)
|
||||||
|
{
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("name", getName())
|
||||||
|
.append("weight", getWeight())
|
||||||
|
.append("price", getPrice())
|
||||||
|
.append("date", getDate())
|
||||||
|
.append("type", getType())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
package com.ruoyi.web.controller.demo.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.annotation.Excel.Type;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
|
||||||
|
public class UserOperateModel extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private int userId;
|
||||||
|
|
||||||
|
@Excel(name = "用户编号")
|
||||||
|
private String userCode;
|
||||||
|
|
||||||
|
@Excel(name = "用户姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||||
|
private String userSex;
|
||||||
|
|
||||||
|
@Excel(name = "用户手机")
|
||||||
|
private String userPhone;
|
||||||
|
|
||||||
|
@Excel(name = "用户邮箱")
|
||||||
|
private String userEmail;
|
||||||
|
|
||||||
|
@Excel(name = "用户余额")
|
||||||
|
private double userBalance;
|
||||||
|
|
||||||
|
@Excel(name = "用户状态", readConverterExp = "0=正常,1=停用")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public UserOperateModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||||
|
String userEmail, double userBalance, String status)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
this.userCode = userCode;
|
||||||
|
this.userName = userName;
|
||||||
|
this.userSex = userSex;
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
this.userBalance = userBalance;
|
||||||
|
this.status = status;
|
||||||
|
this.createTime = DateUtils.getNowDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(int userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserCode()
|
||||||
|
{
|
||||||
|
return userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserCode(String userCode)
|
||||||
|
{
|
||||||
|
this.userCode = userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName)
|
||||||
|
{
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserSex()
|
||||||
|
{
|
||||||
|
return userSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserSex(String userSex)
|
||||||
|
{
|
||||||
|
this.userSex = userSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserPhone()
|
||||||
|
{
|
||||||
|
return userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserPhone(String userPhone)
|
||||||
|
{
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserEmail()
|
||||||
|
{
|
||||||
|
return userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserEmail(String userEmail)
|
||||||
|
{
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getUserBalance()
|
||||||
|
{
|
||||||
|
return userBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserBalance(double userBalance)
|
||||||
|
{
|
||||||
|
this.userBalance = userBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus()
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getCreateTime()
|
||||||
|
{
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCreateTime(Date createTime)
|
||||||
|
{
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.ruoyi.web.controller.file;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.system.domain.User;
|
||||||
|
import com.ruoyi.system.utils.HttpUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片上传API接口
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2021-03-11
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/file")
|
||||||
|
public class FileController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
@Value("${ruoyi.addImg}")
|
||||||
|
private String remoteUpload;
|
||||||
|
|
||||||
|
@Value("${ruoyi.getImg}")
|
||||||
|
private String getImg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传图片!返回地址
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateAvatar")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult updateAvatar(@RequestParam("file") MultipartFile file)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//返回文件名
|
||||||
|
String fileName = UUID.randomUUID().toString().replaceAll("-", "")+".png";
|
||||||
|
File dest = new File(new File(remoteUpload+"/activity").getAbsolutePath()+ "/" + fileName);
|
||||||
|
if (!dest.getParentFile().exists()) {
|
||||||
|
dest.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
file.transferTo(dest); // 保存文件
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return AjaxResult.success(getImg+"activity/"+fileName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("失败了");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.framework.web.service.CacheService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/cache")
|
||||||
|
public class CacheController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/cache";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CacheService cacheService;
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:cache:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String cache(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("cacheNames", cacheService.getCacheNames());
|
||||||
|
return prefix + "/cache";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:cache:view")
|
||||||
|
@PostMapping("/getNames")
|
||||||
|
public String getCacheNames(String fragment, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("cacheNames", cacheService.getCacheNames());
|
||||||
|
return prefix + "/cache::" + fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:cache:view")
|
||||||
|
@PostMapping("/getKeys")
|
||||||
|
public String getCacheKeys(String fragment, String cacheName, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("cacheName", cacheName);
|
||||||
|
mmap.put("cacheKyes", cacheService.getCacheKeys(cacheName));
|
||||||
|
return prefix + "/cache::" + fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:cache:view")
|
||||||
|
@PostMapping("/getValue")
|
||||||
|
public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("cacheName", cacheName);
|
||||||
|
mmap.put("cacheKey", cacheKey);
|
||||||
|
mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey));
|
||||||
|
return prefix + "/cache::" + fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:cache:view")
|
||||||
|
@PostMapping("/clearCacheName")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clearCacheName(String cacheName, ModelMap mmap)
|
||||||
|
{
|
||||||
|
cacheService.clearCacheName(cacheName);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:cache:view")
|
||||||
|
@PostMapping("/clearCacheKey")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap)
|
||||||
|
{
|
||||||
|
cacheService.clearCacheKey(cacheName, cacheKey);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:cache:view")
|
||||||
|
@GetMapping("/clearAll")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clearAll(ModelMap mmap)
|
||||||
|
{
|
||||||
|
cacheService.clearAll();
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* druid 监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/data")
|
||||||
|
public class DruidController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "/druid";
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:data:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String index()
|
||||||
|
{
|
||||||
|
return redirect(prefix + "/index.html");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.framework.web.domain.Server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/server")
|
||||||
|
public class ServerController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/server";
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:server:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String server(ModelMap mmap) throws Exception
|
||||||
|
{
|
||||||
|
Server server = new Server();
|
||||||
|
server.copyTo();
|
||||||
|
mmap.put("server", server);
|
||||||
|
return prefix + "/server";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
|
import com.ruoyi.system.service.ISysLogininforService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统访问记录
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/logininfor")
|
||||||
|
public class SysLogininforController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/logininfor";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysLogininforService logininforService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String logininfor()
|
||||||
|
{
|
||||||
|
return prefix + "/logininfor";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysLogininfor logininfor)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("monitor:logininfor:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysLogininfor logininfor)
|
||||||
|
{
|
||||||
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
|
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||||
|
return util.exportExcel(list, "登录日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:remove")
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:remove")
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||||
|
@PostMapping("/clean")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
logininforService.cleanLogininfor();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:unlock")
|
||||||
|
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/unlock")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult unlock(String loginName)
|
||||||
|
{
|
||||||
|
passwordService.clearLoginRecordCache(loginName);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志记录
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/operlog")
|
||||||
|
public class SysOperlogController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/operlog";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysOperLogService operLogService;
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:operlog:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String operlog()
|
||||||
|
{
|
||||||
|
return prefix + "/operlog";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:operlog:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysOperLog operLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("monitor:operlog:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysOperLog operLog)
|
||||||
|
{
|
||||||
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
|
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||||
|
return util.exportExcel(list, "操作日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(operLogService.deleteOperLogByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:operlog:detail")
|
||||||
|
@GetMapping("/detail/{operId}")
|
||||||
|
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
||||||
|
return prefix + "/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||||
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
|
@PostMapping("/clean")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
operLogService.cleanOperLog();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.enums.OnlineStatus;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
|
import com.ruoyi.framework.shiro.session.OnlineSession;
|
||||||
|
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||||
|
import com.ruoyi.system.domain.SysUserOnline;
|
||||||
|
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线用户监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/online")
|
||||||
|
public class SysUserOnlineController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/online";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserOnlineService userOnlineService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OnlineSessionDAO onlineSessionDAO;
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:online:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String online()
|
||||||
|
{
|
||||||
|
return prefix + "/online";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:online:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysUserOnline userOnline)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
|
||||||
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
|
@PostMapping("/batchForceLogout")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult batchForceLogout(String ids)
|
||||||
|
{
|
||||||
|
for (String sessionId : Convert.toStrArray(ids))
|
||||||
|
{
|
||||||
|
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||||
|
if (online == null)
|
||||||
|
{
|
||||||
|
return error("用户已下线");
|
||||||
|
}
|
||||||
|
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||||
|
if (onlineSession == null)
|
||||||
|
{
|
||||||
|
return error("用户已下线");
|
||||||
|
}
|
||||||
|
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||||
|
{
|
||||||
|
return error("当前登录用户无法强退");
|
||||||
|
}
|
||||||
|
onlineSessionDAO.delete(onlineSession);
|
||||||
|
online.setStatus(OnlineStatus.off_line);
|
||||||
|
userOnlineService.saveOnline(online);
|
||||||
|
userOnlineService.removeUserCache(online.getLoginName(), sessionId);
|
||||||
|
}
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.ruoyi.web.controller.publicAccess;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公共资源方法
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2020-11-18
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/publicAccess")
|
||||||
|
public class PublicController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
private String prefix = "project/webSocket";
|
||||||
|
|
||||||
|
@GetMapping("/socket")
|
||||||
|
public String awardConfig()
|
||||||
|
{
|
||||||
|
return prefix + "/socket";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/fileList")
|
||||||
|
@ResponseBody
|
||||||
|
public Boolean list(String value) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import com.google.code.kaptcha.Constants;
|
||||||
|
import com.google.code.kaptcha.Producer;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片验证码(支持算术形式)
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/captcha")
|
||||||
|
public class SysCaptchaController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource(name = "captchaProducer")
|
||||||
|
private Producer captchaProducer;
|
||||||
|
|
||||||
|
@Resource(name = "captchaProducerMath")
|
||||||
|
private Producer captchaProducerMath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证码生成
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/captchaImage")
|
||||||
|
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
{
|
||||||
|
ServletOutputStream out = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
response.setDateHeader("Expires", 0);
|
||||||
|
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||||
|
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
|
||||||
|
response.setHeader("Pragma", "no-cache");
|
||||||
|
response.setContentType("image/jpeg");
|
||||||
|
|
||||||
|
String type = request.getParameter("type");
|
||||||
|
String capStr = null;
|
||||||
|
String code = null;
|
||||||
|
BufferedImage bi = null;
|
||||||
|
if ("math".equals(type))
|
||||||
|
{
|
||||||
|
String capText = captchaProducerMath.createText();
|
||||||
|
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||||
|
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||||
|
bi = captchaProducerMath.createImage(capStr);
|
||||||
|
}
|
||||||
|
else if ("char".equals(type))
|
||||||
|
{
|
||||||
|
capStr = code = captchaProducer.createText();
|
||||||
|
bi = captchaProducer.createImage(capStr);
|
||||||
|
}
|
||||||
|
session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
|
||||||
|
out = response.getOutputStream();
|
||||||
|
ImageIO.write(bi, "jpg", out);
|
||||||
|
out.flush();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (out != null)
|
||||||
|
{
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数配置 信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/config")
|
||||||
|
public class SysConfigController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/config";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:config:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String config()
|
||||||
|
{
|
||||||
|
return prefix + "/config";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询参数配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysConfig config)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:config:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysConfig config)
|
||||||
|
{
|
||||||
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||||
|
return util.exportExcel(list, "参数数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增参数配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:add")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysConfig config)
|
||||||
|
{
|
||||||
|
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
|
{
|
||||||
|
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setCreateBy(getLoginName());
|
||||||
|
return toAjax(configService.insertConfig(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:edit")
|
||||||
|
@GetMapping("/edit/{configId}")
|
||||||
|
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("config", configService.selectConfigById(configId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:edit")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysConfig config)
|
||||||
|
{
|
||||||
|
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
|
{
|
||||||
|
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setUpdateBy(getLoginName());
|
||||||
|
return toAjax(configService.updateConfig(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:remove")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
configService.deleteConfigByIds(ids);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新参数缓存
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:remove")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||||
|
@GetMapping("/refreshCache")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult refreshCache()
|
||||||
|
{
|
||||||
|
configService.resetConfigCache();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验参数键名
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkConfigKeyUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkConfigKeyUnique(SysConfig config)
|
||||||
|
{
|
||||||
|
return configService.checkConfigKeyUnique(config);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,210 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/dept")
|
||||||
|
public class SysDeptController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/dept";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dept:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String dept()
|
||||||
|
{
|
||||||
|
return prefix + "/dept";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dept:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public List<SysDept> list(SysDept dept)
|
||||||
|
{
|
||||||
|
List<SysDept> deptList = deptService.selectDeptList(dept);
|
||||||
|
return deptList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增部门
|
||||||
|
*/
|
||||||
|
@GetMapping("/add/{parentId}")
|
||||||
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (!getSysUser().isAdmin())
|
||||||
|
{
|
||||||
|
parentId = getSysUser().getDeptId();
|
||||||
|
}
|
||||||
|
mmap.put("dept", deptService.selectDeptById(parentId));
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存部门
|
||||||
|
*/
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("system:dept:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysDept dept)
|
||||||
|
{
|
||||||
|
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
|
{
|
||||||
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
|
}
|
||||||
|
dept.setCreateBy(getLoginName());
|
||||||
|
return toAjax(deptService.insertDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改部门
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dept:edit")
|
||||||
|
@GetMapping("/edit/{deptId}")
|
||||||
|
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
|
SysDept dept = deptService.selectDeptById(deptId);
|
||||||
|
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
||||||
|
{
|
||||||
|
dept.setParentName("无");
|
||||||
|
}
|
||||||
|
mmap.put("dept", dept);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存部门
|
||||||
|
*/
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:dept:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysDept dept)
|
||||||
|
{
|
||||||
|
Long deptId = dept.getDeptId();
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
|
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
|
{
|
||||||
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
|
}
|
||||||
|
else if (dept.getParentId().equals(deptId))
|
||||||
|
{
|
||||||
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
|
}
|
||||||
|
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
||||||
|
{
|
||||||
|
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||||
|
}
|
||||||
|
dept.setUpdateBy(getLoginName());
|
||||||
|
return toAjax(deptService.updateDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("system:dept:remove")
|
||||||
|
@GetMapping("/remove/{deptId}")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
||||||
|
{
|
||||||
|
if (deptService.selectDeptCount(deptId) > 0)
|
||||||
|
{
|
||||||
|
return AjaxResult.warn("存在下级部门,不允许删除");
|
||||||
|
}
|
||||||
|
if (deptService.checkDeptExistUser(deptId))
|
||||||
|
{
|
||||||
|
return AjaxResult.warn("部门存在用户,不允许删除");
|
||||||
|
}
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验部门名称
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkDeptNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkDeptNameUnique(SysDept dept)
|
||||||
|
{
|
||||||
|
return deptService.checkDeptNameUnique(dept);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择部门树
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @param excludeId 排除ID
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
|
||||||
|
public String selectDeptTree(@PathVariable("deptId") Long deptId,
|
||||||
|
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dept", deptService.selectDeptById(deptId));
|
||||||
|
mmap.put("excludeId", excludeId);
|
||||||
|
return prefix + "/tree";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载部门列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> treeData()
|
||||||
|
{
|
||||||
|
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载部门列表树(排除下级)
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeData/{excludeId}")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
|
||||||
|
{
|
||||||
|
SysDept dept = new SysDept();
|
||||||
|
dept.setExcludeId(excludeId);
|
||||||
|
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载角色部门(数据权限)列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/roleDeptTreeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> deptTreeData(SysRole role)
|
||||||
|
{
|
||||||
|
List<Ztree> ztrees = deptService.roleDeptTreeData(role);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,121 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/dict/data")
|
||||||
|
public class SysDictDataController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/dict/data";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictDataService dictDataService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dict:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String dictData()
|
||||||
|
{
|
||||||
|
return prefix + "/data";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
@RequiresPermissions("system:dict:list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysDictData dictData)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:dict:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysDictData dictData)
|
||||||
|
{
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||||
|
return util.exportExcel(list, "字典数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@GetMapping("/add/{dictType}")
|
||||||
|
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dictType", dictType);
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典类型
|
||||||
|
*/
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("system:dict:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setCreateBy(getLoginName());
|
||||||
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:edit")
|
||||||
|
@GetMapping("/edit/{dictCode}")
|
||||||
|
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型
|
||||||
|
*/
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:dict:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setUpdateBy(getLoginName());
|
||||||
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("system:dict:remove")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
dictDataService.deleteDictDataByIds(ids);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,189 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/dict")
|
||||||
|
public class SysDictTypeController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/dict/type";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dict:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String dictType()
|
||||||
|
{
|
||||||
|
return prefix + "/type";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
@RequiresPermissions("system:dict:list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysDictType dictType)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:dict:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysDictType dictType)
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||||
|
return util.exportExcel(list, "字典类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典类型
|
||||||
|
*/
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("system:dict:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysDictType dict)
|
||||||
|
{
|
||||||
|
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
|
{
|
||||||
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setCreateBy(getLoginName());
|
||||||
|
return toAjax(dictTypeService.insertDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:edit")
|
||||||
|
@GetMapping("/edit/{dictId}")
|
||||||
|
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型
|
||||||
|
*/
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:dict:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysDictType dict)
|
||||||
|
{
|
||||||
|
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
|
{
|
||||||
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setUpdateBy(getLoginName());
|
||||||
|
return toAjax(dictTypeService.updateDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("system:dict:remove")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
dictTypeService.deleteDictTypeByIds(ids);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新字典缓存
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:remove")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
|
@GetMapping("/refreshCache")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult refreshCache()
|
||||||
|
{
|
||||||
|
dictTypeService.resetDictCache();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典详细
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:list")
|
||||||
|
@GetMapping("/detail/{dictId}")
|
||||||
|
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||||
|
mmap.put("dictList", dictTypeService.selectDictTypeAll());
|
||||||
|
return "system/dict/data/data";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典类型
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkDictTypeUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkDictTypeUnique(SysDictType dictType)
|
||||||
|
{
|
||||||
|
return dictTypeService.checkDictTypeUnique(dictType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择字典树
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectDictTree/{columnId}/{dictType}")
|
||||||
|
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
|
||||||
|
ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("columnId", columnId);
|
||||||
|
mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
|
||||||
|
return prefix + "/tree";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载字典列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> treeData()
|
||||||
|
{
|
||||||
|
List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType());
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,178 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.constant.ShiroConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.utils.CookieUtils;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页 业务处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class SysIndexController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
// 系统首页
|
||||||
|
@GetMapping("/index")
|
||||||
|
public String index(ModelMap mmap)
|
||||||
|
{
|
||||||
|
// 取身份信息
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
// 根据用户id取出菜单
|
||||||
|
List<SysMenu> menus = menuService.selectMenusByUser(user);
|
||||||
|
mmap.put("menus", menus);
|
||||||
|
mmap.put("user", user);
|
||||||
|
mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
|
||||||
|
mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
|
||||||
|
Boolean footer = Convert.toBool(configService.selectConfigByKey("sys.index.footer"), true);
|
||||||
|
Boolean tagsView = Convert.toBool(configService.selectConfigByKey("sys.index.tagsView"), true);
|
||||||
|
mmap.put("footer", footer);
|
||||||
|
mmap.put("tagsView", tagsView);
|
||||||
|
mmap.put("mainClass", contentMainClass(footer, tagsView));
|
||||||
|
mmap.put("copyrightYear", RuoYiConfig.getCopyrightYear());
|
||||||
|
mmap.put("demoEnabled", RuoYiConfig.isDemoEnabled());
|
||||||
|
mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
||||||
|
mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
||||||
|
mmap.put("isMobile", ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")));
|
||||||
|
|
||||||
|
// 菜单导航显示风格
|
||||||
|
String menuStyle = configService.selectConfigByKey("sys.index.menuStyle");
|
||||||
|
// 移动端,默认使左侧导航菜单,否则取默认配置
|
||||||
|
String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle;
|
||||||
|
|
||||||
|
// 优先Cookie配置导航菜单
|
||||||
|
Cookie[] cookies = ServletUtils.getRequest().getCookies();
|
||||||
|
for (Cookie cookie : cookies)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName()))
|
||||||
|
{
|
||||||
|
indexStyle = cookie.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index";
|
||||||
|
return webIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 锁定屏幕
|
||||||
|
@GetMapping("/lockscreen")
|
||||||
|
public String lockscreen(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("user", getSysUser());
|
||||||
|
ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true);
|
||||||
|
return "lock";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解锁屏幕
|
||||||
|
@PostMapping("/unlockscreen")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult unlockscreen(String password)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
if (StringUtils.isNull(user))
|
||||||
|
{
|
||||||
|
return AjaxResult.error("服务器超时,请重新登录");
|
||||||
|
}
|
||||||
|
if (passwordService.matches(user, password))
|
||||||
|
{
|
||||||
|
ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
return AjaxResult.error("密码不正确,请重新输入。");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换主题
|
||||||
|
@GetMapping("/system/switchSkin")
|
||||||
|
public String switchSkin()
|
||||||
|
{
|
||||||
|
return "skin";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换菜单
|
||||||
|
@GetMapping("/system/menuStyle/{style}")
|
||||||
|
public void menuStyle(@PathVariable String style, HttpServletResponse response)
|
||||||
|
{
|
||||||
|
CookieUtils.setCookie(response, "nav-style", style);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 系统介绍
|
||||||
|
@GetMapping("/system/main")
|
||||||
|
public String main(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("version", RuoYiConfig.getVersion());
|
||||||
|
return "main";
|
||||||
|
}
|
||||||
|
|
||||||
|
// content-main class
|
||||||
|
public String contentMainClass(Boolean footer, Boolean tagsView)
|
||||||
|
{
|
||||||
|
if (!footer && !tagsView)
|
||||||
|
{
|
||||||
|
return "tagsview-footer-hide";
|
||||||
|
}
|
||||||
|
else if (!footer)
|
||||||
|
{
|
||||||
|
return "footer-hide";
|
||||||
|
}
|
||||||
|
else if (!tagsView)
|
||||||
|
{
|
||||||
|
return "tagsview-hide";
|
||||||
|
}
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查初始密码是否提醒修改
|
||||||
|
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
||||||
|
{
|
||||||
|
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
|
||||||
|
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查密码是否过期
|
||||||
|
public boolean passwordIsExpiration(Date pwdUpdateDate)
|
||||||
|
{
|
||||||
|
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
|
||||||
|
if (passwordValidateDays != null && passwordValidateDays > 0)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNull(pwdUpdateDate))
|
||||||
|
{
|
||||||
|
// 如果从未修改过初始密码,直接提醒过期
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Date nowDate = DateUtils.getNowDate();
|
||||||
|
return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.UserPassword;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.system.service.UserPasswordService;
|
||||||
|
import com.ruoyi.web.util.EcRecoverUtil;
|
||||||
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
|
import org.apache.shiro.subject.Subject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.web.service.ConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录验证
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class SysLoginController extends BaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 是否开启记住我功能
|
||||||
|
*/
|
||||||
|
@Value("${shiro.rememberMe.enabled: false}")
|
||||||
|
private boolean rememberMe;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserPasswordService userPasswordService;
|
||||||
|
|
||||||
|
@GetMapping("/login")
|
||||||
|
public String login(HttpServletRequest request, HttpServletResponse response, ModelMap mmap)
|
||||||
|
{
|
||||||
|
// 如果是Ajax请求,返回Json字符串。
|
||||||
|
if (ServletUtils.isAjaxRequest(request))
|
||||||
|
{
|
||||||
|
return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
|
||||||
|
}
|
||||||
|
// 是否开启记住我
|
||||||
|
mmap.put("isRemembered", rememberMe);
|
||||||
|
// 是否开启用户注册
|
||||||
|
mmap.put("isAllowRegister", Convert.toBool(configService.getKey("sys.account.registerUser"), false));
|
||||||
|
return "login";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/login")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe,String sing)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEmpty(sing)){
|
||||||
|
rememberMe = false;
|
||||||
|
boolean result = EcRecoverUtil.checkEcRecover("Login please",sing,username);
|
||||||
|
if(result){
|
||||||
|
UserPassword userPassword = userPasswordService.findUserPassword(new UserPassword().setAddress(username));
|
||||||
|
if(userPassword == null){
|
||||||
|
return AjaxResult.error("钱包无效登录");
|
||||||
|
}
|
||||||
|
password = userPassword.getPassword();
|
||||||
|
username = userPassword.getUserName();
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error("签名错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
|
||||||
|
Subject subject = SecurityUtils.getSubject();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
subject.login(token);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
catch (AuthenticationException e)
|
||||||
|
{
|
||||||
|
String msg = "用户或密码错误";
|
||||||
|
if (StringUtils.isNotEmpty(e.getMessage()))
|
||||||
|
{
|
||||||
|
msg = e.getMessage();
|
||||||
|
}
|
||||||
|
return error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/unauth")
|
||||||
|
public String unauth()
|
||||||
|
{
|
||||||
|
return "error/unauth";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,198 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
|
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
||||||
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/menu")
|
||||||
|
public class SysMenuController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/menu";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:menu:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String menu()
|
||||||
|
{
|
||||||
|
return prefix + "/menu";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:menu:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public List<SysMenu> list(SysMenu menu)
|
||||||
|
{
|
||||||
|
Long userId = ShiroUtils.getUserId();
|
||||||
|
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
||||||
|
return menuList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除菜单
|
||||||
|
*/
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("system:menu:remove")
|
||||||
|
@GetMapping("/remove/{menuId}")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||||
|
{
|
||||||
|
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
||||||
|
{
|
||||||
|
return AjaxResult.warn("存在子菜单,不允许删除");
|
||||||
|
}
|
||||||
|
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
||||||
|
{
|
||||||
|
return AjaxResult.warn("菜单已分配,不允许删除");
|
||||||
|
}
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
return toAjax(menuService.deleteMenuById(menuId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@GetMapping("/add/{parentId}")
|
||||||
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysMenu menu = null;
|
||||||
|
if (0L != parentId)
|
||||||
|
{
|
||||||
|
menu = menuService.selectMenuById(parentId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu = new SysMenu();
|
||||||
|
menu.setMenuId(0L);
|
||||||
|
menu.setMenuName("主目录");
|
||||||
|
}
|
||||||
|
mmap.put("menu", menu);
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存菜单
|
||||||
|
*/
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("system:menu:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysMenu menu)
|
||||||
|
{
|
||||||
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||||
|
{
|
||||||
|
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
|
}
|
||||||
|
menu.setCreateBy(getLoginName());
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
return toAjax(menuService.insertMenu(menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改菜单
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:menu:edit")
|
||||||
|
@GetMapping("/edit/{menuId}")
|
||||||
|
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存菜单
|
||||||
|
*/
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:menu:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysMenu menu)
|
||||||
|
{
|
||||||
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||||
|
{
|
||||||
|
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
|
}
|
||||||
|
menu.setUpdateBy(getLoginName());
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
return toAjax(menuService.updateMenu(menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择菜单图标
|
||||||
|
*/
|
||||||
|
@GetMapping("/icon")
|
||||||
|
public String icon()
|
||||||
|
{
|
||||||
|
return prefix + "/icon";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验菜单名称
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkMenuNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkMenuNameUnique(SysMenu menu)
|
||||||
|
{
|
||||||
|
return menuService.checkMenuNameUnique(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载角色菜单列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/roleMenuTreeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> roleMenuTreeData(SysRole role)
|
||||||
|
{
|
||||||
|
Long userId = ShiroUtils.getUserId();
|
||||||
|
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载所有菜单列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/menuTreeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> menuTreeData()
|
||||||
|
{
|
||||||
|
Long userId = ShiroUtils.getUserId();
|
||||||
|
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择菜单树
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectMenuTree/{menuId}")
|
||||||
|
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
|
return prefix + "/tree";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告 信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/notice")
|
||||||
|
public class SysNoticeController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/notice";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysNoticeService noticeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:notice:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String notice()
|
||||||
|
{
|
||||||
|
return prefix + "/notice";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公告列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysNotice notice)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增公告
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:add")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysNotice notice)
|
||||||
|
{
|
||||||
|
notice.setCreateBy(getLoginName());
|
||||||
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:edit")
|
||||||
|
@GetMapping("/edit/{noticeId}")
|
||||||
|
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:edit")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysNotice notice)
|
||||||
|
{
|
||||||
|
notice.setUpdateBy(getLoginName());
|
||||||
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:remove")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,163 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.SysPost;
|
||||||
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/post")
|
||||||
|
public class SysPostController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/post";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysPostService postService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:post:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String operlog()
|
||||||
|
{
|
||||||
|
return prefix + "/post";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:post:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysPost post)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:post:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysPost post)
|
||||||
|
{
|
||||||
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
|
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||||
|
return util.exportExcel(list, "岗位数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:post:remove")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return toAjax(postService.deletePostByIds(ids));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增岗位
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存岗位
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:add")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysPost post)
|
||||||
|
{
|
||||||
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||||
|
{
|
||||||
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
}
|
||||||
|
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||||
|
{
|
||||||
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
}
|
||||||
|
post.setCreateBy(getLoginName());
|
||||||
|
return toAjax(postService.insertPost(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改岗位
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:edit")
|
||||||
|
@GetMapping("/edit/{postId}")
|
||||||
|
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("post", postService.selectPostById(postId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存岗位
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:edit")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysPost post)
|
||||||
|
{
|
||||||
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||||
|
{
|
||||||
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
}
|
||||||
|
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||||
|
{
|
||||||
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
}
|
||||||
|
post.setUpdateBy(getLoginName());
|
||||||
|
return toAjax(postService.updatePost(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验岗位名称
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkPostNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkPostNameUnique(SysPost post)
|
||||||
|
{
|
||||||
|
return postService.checkPostNameUnique(post);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验岗位编码
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkPostCodeUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkPostCodeUnique(SysPost post)
|
||||||
|
{
|
||||||
|
return postService.checkPostCodeUnique(post);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,196 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import com.ruoyi.system.service.UserPasswordService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息 业务处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/user/profile")
|
||||||
|
public class SysProfileController extends BaseController
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
||||||
|
|
||||||
|
private String prefix = "system/user/profile";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserPasswordService userPasswordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息
|
||||||
|
*/
|
||||||
|
@GetMapping()
|
||||||
|
public String profile(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
mmap.put("user", user);
|
||||||
|
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
||||||
|
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
||||||
|
return prefix + "/profile";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/checkPassword")
|
||||||
|
@ResponseBody
|
||||||
|
public boolean checkPassword(String password)
|
||||||
|
{
|
||||||
|
//password = Md5Utils.hash(password);
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
if (passwordService.matches(user, password))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/resetPwd")
|
||||||
|
public String resetPwd(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
|
return prefix + "/resetPwd";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "修改密码", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/resetPwd")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult resetPwd(String oldPassword, String newPassword)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
String password = newPassword;
|
||||||
|
if (!passwordService.matches(user, oldPassword))
|
||||||
|
{
|
||||||
|
return error("修改密码失败,旧密码错误");
|
||||||
|
}
|
||||||
|
if (passwordService.matches(user, newPassword))
|
||||||
|
{
|
||||||
|
return error("新密码不能与旧密码相同");
|
||||||
|
}
|
||||||
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
||||||
|
user.setPwdUpdateDate(DateUtils.getNowDate());
|
||||||
|
if (userService.resetUserPwd(user) > 0)
|
||||||
|
{
|
||||||
|
setSysUser(userService.selectUserById(user.getUserId()));
|
||||||
|
//存储用户密码
|
||||||
|
user.setPassword(password);
|
||||||
|
userPasswordService.userPasswordAddByUpdateuserPas(user);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error("修改密码异常,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit")
|
||||||
|
public String edit(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改头像
|
||||||
|
*/
|
||||||
|
@GetMapping("/avatar")
|
||||||
|
public String avatar(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = getSysUser();
|
||||||
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
|
return prefix + "/avatar";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/update")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult update(SysUser user)
|
||||||
|
{
|
||||||
|
SysUser currentUser = getSysUser();
|
||||||
|
currentUser.setUserName(user.getUserName());
|
||||||
|
currentUser.setEmail(user.getEmail());
|
||||||
|
currentUser.setPhonenumber(user.getPhonenumber());
|
||||||
|
currentUser.setSex(user.getSex());
|
||||||
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
|
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(currentUser)))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
|
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(currentUser)))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
if (userService.updateUserInfo(currentUser) > 0)
|
||||||
|
{
|
||||||
|
setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存头像
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/updateAvatar")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
||||||
|
{
|
||||||
|
SysUser currentUser = getSysUser();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!file.isEmpty())
|
||||||
|
{
|
||||||
|
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
|
||||||
|
currentUser.setAvatar(avatar);
|
||||||
|
if (userService.updateUserInfo(currentUser) > 0)
|
||||||
|
{
|
||||||
|
setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("修改头像失败!", e);
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysRegisterService;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册验证
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class SysRegisterController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private SysRegisterService registerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@GetMapping("/register")
|
||||||
|
public String register()
|
||||||
|
{
|
||||||
|
return "register";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/register")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult ajaxRegister(SysUser user)
|
||||||
|
{
|
||||||
|
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||||
|
{
|
||||||
|
return error("当前系统没有开启注册功能!");
|
||||||
|
}
|
||||||
|
String msg = registerService.register(user);
|
||||||
|
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,306 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
||||||
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/role")
|
||||||
|
public class SysRoleController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/role";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:role:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String role()
|
||||||
|
{
|
||||||
|
return prefix + "/role";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:role:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysRole role)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:role:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysRole role)
|
||||||
|
{
|
||||||
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
|
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||||
|
return util.exportExcel(list, "角色数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增角色
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存角色
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:add")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysRole role)
|
||||||
|
{
|
||||||
|
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||||
|
{
|
||||||
|
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
|
}
|
||||||
|
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||||
|
{
|
||||||
|
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
|
}
|
||||||
|
role.setCreateBy(getLoginName());
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
return toAjax(roleService.insertRole(role));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改角色
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:edit")
|
||||||
|
@GetMapping("/edit/{roleId}")
|
||||||
|
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
roleService.checkRoleDataScope(roleId);
|
||||||
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存角色
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:edit")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysRole role)
|
||||||
|
{
|
||||||
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
|
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||||
|
{
|
||||||
|
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
|
}
|
||||||
|
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||||
|
{
|
||||||
|
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
|
}
|
||||||
|
role.setUpdateBy(getLoginName());
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
return toAjax(roleService.updateRole(role));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色分配数据权限
|
||||||
|
*/
|
||||||
|
@GetMapping("/authDataScope/{roleId}")
|
||||||
|
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
|
return prefix + "/dataScope";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存角色分配数据权限
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:edit")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/authDataScope")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult authDataScopeSave(SysRole role)
|
||||||
|
{
|
||||||
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
|
role.setUpdateBy(getLoginName());
|
||||||
|
if (roleService.authDataScope(role) > 0)
|
||||||
|
{
|
||||||
|
setSysUser(userService.selectUserById(getUserId()));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:role:remove")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.deleteRoleByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验角色名称
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkRoleNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkRoleNameUnique(SysRole role)
|
||||||
|
{
|
||||||
|
return roleService.checkRoleNameUnique(role);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验角色权限
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkRoleKeyUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkRoleKeyUnique(SysRole role)
|
||||||
|
{
|
||||||
|
return roleService.checkRoleKeyUnique(role);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择菜单树
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectMenuTree")
|
||||||
|
public String selectMenuTree()
|
||||||
|
{
|
||||||
|
return prefix + "/tree";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色状态修改
|
||||||
|
*/
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:role:edit")
|
||||||
|
@PostMapping("/changeStatus")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult changeStatus(SysRole role)
|
||||||
|
{
|
||||||
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
|
return toAjax(roleService.changeStatus(role));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:edit")
|
||||||
|
@GetMapping("/authUser/{roleId}")
|
||||||
|
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
|
return prefix + "/authUser";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已分配用户角色列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:list")
|
||||||
|
@PostMapping("/authUser/allocatedList")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo allocatedList(SysUser user)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectAllocatedList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消授权
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:edit")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PostMapping("/authUser/cancel")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult cancelAuthUser(SysUserRole userRole)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.deleteAuthUser(userRole));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量取消授权
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:edit")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PostMapping("/authUser/cancelAll")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
|
||||||
|
{
|
||||||
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/authUser/selectUser/{roleId}")
|
||||||
|
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
|
return prefix + "/selectUser";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询未分配用户角色列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:list")
|
||||||
|
@PostMapping("/authUser/unallocatedList")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo unallocatedList(SysUser user)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量选择用户授权
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:edit")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PostMapping("/authUser/selectAll")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
|
||||||
|
{
|
||||||
|
roleService.checkRoleDataScope(roleId);
|
||||||
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,346 @@
|
||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.UserPassword;
|
||||||
|
import com.ruoyi.system.service.UserPasswordService;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
|
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
||||||
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/user")
|
||||||
|
public class SysUserController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/user";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysPostService postService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserPasswordService userPasswordService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:user:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String user()
|
||||||
|
{
|
||||||
|
return prefix + "/user";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:user:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysUser user)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
if(!StringUtils.isEmpty(user.getAddress())){
|
||||||
|
List<UserPassword> userPasswordList = userPasswordService.selectUserPasswordList(new UserPassword().setAddress(user.getAddress().toLowerCase()));
|
||||||
|
if(userPasswordList == null || userPasswordList.size() == 0){
|
||||||
|
return getDataTable(new ArrayList<>());
|
||||||
|
}
|
||||||
|
UserPassword userPassword = userPasswordList.get(0);
|
||||||
|
if(!StringUtils.isEmpty(user.getLoginName()) && !user.getLoginName().equals(userPassword.getUserName())){
|
||||||
|
return getDataTable(new ArrayList<>());
|
||||||
|
}
|
||||||
|
user.setLoginName(userPassword.getUserName());
|
||||||
|
}
|
||||||
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
|
List<UserPassword> userPasswordList = userPasswordService.selectUserPasswordList(new UserPassword());
|
||||||
|
for (SysUser sysUser : list) {
|
||||||
|
for (UserPassword userPassword : userPasswordList) {
|
||||||
|
if(!StringUtils.isEmpty(sysUser.getLoginName()) && !StringUtils.isEmpty(userPassword.getUserName())){
|
||||||
|
if(sysUser.getLoginName().equals(userPassword.getUserName())){
|
||||||
|
sysUser.setAddress(userPassword.getAddress());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:user:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysUser user)
|
||||||
|
{
|
||||||
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
return util.exportExcel(list, "用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
|
@RequiresPermissions("system:user:import")
|
||||||
|
@PostMapping("/importData")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||||
|
{
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||||
|
String message = userService.importUser(userList, updateSupport, getLoginName());
|
||||||
|
return AjaxResult.success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:user:view")
|
||||||
|
@GetMapping("/importTemplate")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult importTemplate()
|
||||||
|
{
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
return util.importTemplateExcel("用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
|
mmap.put("posts", postService.selectPostAll());
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:user:add")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysUser user)
|
||||||
|
{
|
||||||
|
String password = user.getPassword();
|
||||||
|
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
|
||||||
|
{
|
||||||
|
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
|
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
|
{
|
||||||
|
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
|
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
|
{
|
||||||
|
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
if(!StringUtils.isEmpty(user.getAddress())){
|
||||||
|
user.setAddress(user.getAddress().toLowerCase());
|
||||||
|
}
|
||||||
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
|
//存储用户密码
|
||||||
|
user.setPassword(password);
|
||||||
|
UserPassword userPassword = userPasswordService.userPasswordAddByUpdateuserPas(user);
|
||||||
|
user.setPassword(passwordService.encryptPassword(userPassword.getUserName(), user.getPassword(), user.getSalt()));
|
||||||
|
user.setCreateBy(getLoginName());
|
||||||
|
return toAjax(userService.insertUser(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:user:edit")
|
||||||
|
@GetMapping("/edit/{userId}")
|
||||||
|
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
userService.checkUserDataScope(userId);
|
||||||
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
|
mmap.put("user", userService.selectUserById(userId));
|
||||||
|
mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
|
mmap.put("posts", postService.selectPostsByUserId(userId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:user:edit")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysUser user)
|
||||||
|
{
|
||||||
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
|
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
|
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
user.setUpdateBy(getLoginName());
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
if(!org.apache.commons.lang3.StringUtils.isBlank(user.getAddress())){
|
||||||
|
user.setAddress(user.getAddress().toLowerCase());
|
||||||
|
userPasswordService.userPasswordAddByUpdateuserPas(user);
|
||||||
|
}
|
||||||
|
return toAjax(userService.updateUser(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:user:resetPwd")
|
||||||
|
@GetMapping("/resetPwd/{userId}")
|
||||||
|
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("user", userService.selectUserById(userId));
|
||||||
|
return prefix + "/resetPwd";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:user:resetPwd")
|
||||||
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/resetPwd")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult resetPwdSave(SysUser user)
|
||||||
|
{
|
||||||
|
|
||||||
|
String password = user.getPassword();
|
||||||
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||||
|
if (userService.resetUserPwd(user) > 0)
|
||||||
|
{
|
||||||
|
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
|
||||||
|
{
|
||||||
|
setSysUser(userService.selectUserById(user.getUserId()));
|
||||||
|
}
|
||||||
|
//存储用户密码
|
||||||
|
user.setPassword(password);
|
||||||
|
userPasswordService.userPasswordAddByUpdateuserPas(user);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入授权角色页
|
||||||
|
*/
|
||||||
|
@GetMapping("/authRole/{userId}")
|
||||||
|
public String authRole(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = userService.selectUserById(userId);
|
||||||
|
// 获取用户所属的角色列表
|
||||||
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
|
mmap.put("user", user);
|
||||||
|
mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
|
return prefix + "/authRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户授权角色
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:user:edit")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||||
|
@PostMapping("/authRole/insertAuthRole")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
||||||
|
{
|
||||||
|
userService.checkUserDataScope(userId);
|
||||||
|
userService.insertUserAuth(userId, roleIds);
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:user:remove")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId()))
|
||||||
|
{
|
||||||
|
return error("当前用户不能删除");
|
||||||
|
}
|
||||||
|
return toAjax(userService.deleteUserByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验用户名
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkLoginNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkLoginNameUnique(SysUser user)
|
||||||
|
{
|
||||||
|
return userService.checkLoginNameUnique(user.getLoginName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验手机号码
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkPhoneUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkPhoneUnique(SysUser user)
|
||||||
|
{
|
||||||
|
return userService.checkPhoneUnique(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验email邮箱
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkEmailUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkEmailUnique(SysUser user)
|
||||||
|
{
|
||||||
|
return userService.checkEmailUnique(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户状态修改
|
||||||
|
*/
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:user:edit")
|
||||||
|
@PostMapping("/changeStatus")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult changeStatus(SysUser user)
|
||||||
|
{
|
||||||
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
|
return toAjax(userService.changeStatus(user));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.ruoyi.web.controller.user;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.User;
|
||||||
|
import com.ruoyi.system.service.UserService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Controller
|
||||||
|
*
|
||||||
|
* @author HayDen
|
||||||
|
* @date 2022-11-11
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/project/user")
|
||||||
|
public class UserController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "project/user";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@RequiresPermissions("project:user:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String user()
|
||||||
|
{
|
||||||
|
return prefix + "/userList";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:user:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(User user)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<User> list = userService.selectUserList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户对象
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:user:user")
|
||||||
|
@PostMapping("/user")
|
||||||
|
@ResponseBody
|
||||||
|
public User findUser(User user)
|
||||||
|
{
|
||||||
|
user = userService.findUser(user);
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出用户列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:user:export")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(User user)
|
||||||
|
{
|
||||||
|
List<User> list = userService.selectUserList(user);
|
||||||
|
ExcelUtil<User> util = new ExcelUtil<User>(User.class);
|
||||||
|
return util.exportExcel(list, "用户");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/userAdd";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("user", userService.selectUserById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/userAdd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:user:add")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(User user)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
user.setCreateBy(sysUser.getUserName());
|
||||||
|
return toAjax(userService.updateOrAddUser(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
User user = userService.selectUserById(id);
|
||||||
|
mmap.put("user", user);
|
||||||
|
return prefix + "/userEdit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:user:edit")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(User user)
|
||||||
|
{
|
||||||
|
SysUser sysUser = getSysUser();
|
||||||
|
user.setUpdateBy(sysUser.getUserName());
|
||||||
|
return toAjax(userService.updateOrAddUser(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("project:user:remove")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(userService.deleteUserByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
//用来获取springboot创建好的工厂
|
||||||
|
@Component // 此类必须交给springboot管理
|
||||||
|
public class ApplicationContextUtils implements ApplicationContextAware {
|
||||||
|
|
||||||
|
// 保留下来工厂
|
||||||
|
private static ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
// 将创建好工厂以参数形式传递给这个类
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
ApplicationContextUtils.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
// 根据类在工厂的唯一id从spring容器中获取javabean
|
||||||
|
public static Object getBeanById(String beanName) {
|
||||||
|
return applicationContext.getBean(beanName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据class的名字从spring容器中获取javabean
|
||||||
|
public static <T> T getBeanByName(Class<T> targetClass) {
|
||||||
|
return applicationContext.getBean(targetClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RedisConfig {
|
||||||
|
@Bean
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
||||||
|
RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
|
||||||
|
template.setConnectionFactory(factory);
|
||||||
|
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
|
||||||
|
ObjectMapper om = new ObjectMapper();
|
||||||
|
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||||
|
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
||||||
|
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||||
|
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||||
|
// key采用String的序列化方式
|
||||||
|
template.setKeySerializer(stringRedisSerializer);
|
||||||
|
// hash的key也采用String的序列化方式
|
||||||
|
template.setHashKeySerializer(stringRedisSerializer);
|
||||||
|
// value序列化方式采用jackson
|
||||||
|
template.setValueSerializer(jackson2JsonRedisSerializer);
|
||||||
|
// hash的value序列化方式采用jackson
|
||||||
|
template.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||||
|
template.afterPropertiesSet();
|
||||||
|
return template;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.service.ApiInfo;
|
||||||
|
import springfox.documentation.service.Contact;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Swagger2的接口配置
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class SwaggerConfig
|
||||||
|
{
|
||||||
|
/** 是否开启swagger */
|
||||||
|
@Value("${swagger.enabled}")
|
||||||
|
private boolean enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建API
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Docket createRestApi()
|
||||||
|
{
|
||||||
|
return new Docket(DocumentationType.OAS_30)
|
||||||
|
// 是否启用Swagger
|
||||||
|
.enable(enabled)
|
||||||
|
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||||
|
.apiInfo(apiInfo())
|
||||||
|
// 设置哪些接口暴露给Swagger展示
|
||||||
|
.select()
|
||||||
|
// 扫描所有有注解的api,用这种方式更灵活
|
||||||
|
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||||
|
// 扫描指定包中的swagger注解
|
||||||
|
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
||||||
|
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||||
|
.paths(PathSelectors.any())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加摘要信息
|
||||||
|
*/
|
||||||
|
private ApiInfo apiInfo()
|
||||||
|
{
|
||||||
|
// 用ApiInfoBuilder进行定制
|
||||||
|
return new ApiInfoBuilder()
|
||||||
|
// 设置标题
|
||||||
|
.title("标题:若依管理系统_接口文档")
|
||||||
|
// 描述
|
||||||
|
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||||
|
// 作者信息
|
||||||
|
.contact(new Contact(RuoYiConfig.getName(), null, null))
|
||||||
|
// 版本
|
||||||
|
.version("版本号:" + RuoYiConfig.getVersion())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.ruoyi.web.test;
|
||||||
|
|
||||||
|
public class Ac implements Brand{
|
||||||
|
@Override
|
||||||
|
public String getValue() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "这里是AC的实现类";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.ruoyi.web.test;
|
||||||
|
|
||||||
|
public interface Brand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getValue();
|
||||||
|
|
||||||
|
String getName();
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.ruoyi.web.test;
|
||||||
|
|
||||||
|
public class Dc implements Brand{
|
||||||
|
@Override
|
||||||
|
public String getValue() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "这里是DC的实现类";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.ruoyi.web.test;
|
||||||
|
|
||||||
|
public class LongTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("开始测试对数据");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.ruoyi.web.test;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RunoobTest extends Object {
|
||||||
|
|
||||||
|
private List synchedList;
|
||||||
|
|
||||||
|
public RunoobTest() {
|
||||||
|
// 创建一个同步列表
|
||||||
|
synchedList = Collections.synchronizedList(new LinkedList());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除列表中的元素
|
||||||
|
public String removeElement() throws InterruptedException {
|
||||||
|
synchronized (synchedList){
|
||||||
|
// 列表为空就等待
|
||||||
|
while (synchedList.isEmpty()) {
|
||||||
|
System.out.println("线程等待中");
|
||||||
|
synchedList.wait();
|
||||||
|
System.out.println("我被唤醒然后执行了...");
|
||||||
|
}
|
||||||
|
String element = (String) synchedList.remove(0);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加元素到列表
|
||||||
|
public void addElement(String element) {
|
||||||
|
System.out.println("添加元素开始");
|
||||||
|
synchronized (synchedList) {
|
||||||
|
// 添加一个元素,并通知元素已存在
|
||||||
|
synchedList.add(element);
|
||||||
|
System.out.println("添加了一个元素'" + element + "'");
|
||||||
|
synchedList.notifyAll();
|
||||||
|
System.out.println("唤醒其他线程");
|
||||||
|
}
|
||||||
|
System.out.println("添加元素到列表完毕");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
final RunoobTest demo = new RunoobTest();
|
||||||
|
|
||||||
|
Runnable runA = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
String item = demo.removeElement();
|
||||||
|
System.out.println("----" + item);
|
||||||
|
} catch (InterruptedException ix) {
|
||||||
|
System.out.println("错误1");
|
||||||
|
} catch (Exception x) {
|
||||||
|
System.out.println("错误2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Runnable runB = new Runnable() {
|
||||||
|
// 执行添加元素操作,并开始循环
|
||||||
|
public void run() {
|
||||||
|
demo.addElement("我是被添加的元素7");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread threadA1 = new Thread(runA, "Google");
|
||||||
|
threadA1.start();
|
||||||
|
|
||||||
|
Thread.sleep(1000);
|
||||||
|
|
||||||
|
Thread threadB = new Thread(runB, "Taobao");
|
||||||
|
threadB.start();
|
||||||
|
|
||||||
|
Thread.sleep(3000);
|
||||||
|
System.out.println("已完结");
|
||||||
|
} catch (InterruptedException x) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.ruoyi.web.util;
|
||||||
|
|
||||||
|
import org.web3j.crypto.ECDSASignature;
|
||||||
|
import org.web3j.crypto.Hash;
|
||||||
|
import org.web3j.crypto.Keys;
|
||||||
|
import org.web3j.crypto.Sign;
|
||||||
|
import org.web3j.utils.Numeric;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public final class EcRecoverUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验签名,还原地址
|
||||||
|
*
|
||||||
|
* @param message 消息
|
||||||
|
* @param signature 签名结果
|
||||||
|
* @return 返回可能的结果,有多个
|
||||||
|
*/
|
||||||
|
public static List<String> ecRecover(String message, String signature) {
|
||||||
|
if (message == null || signature == null || signature.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
String newMessage = "\u0019Ethereum Signed Message:\n" + message.length() + message;
|
||||||
|
|
||||||
|
byte[] msgHash = Hash.sha3(newMessage.getBytes());
|
||||||
|
byte[] signatureBytes = Numeric.hexStringToByteArray(signature);
|
||||||
|
if (signatureBytes.length <= 64) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
byte v = signatureBytes[64];
|
||||||
|
if (v < 27) {
|
||||||
|
v += 27;
|
||||||
|
}
|
||||||
|
Sign.SignatureData sd =
|
||||||
|
new Sign.SignatureData(v,
|
||||||
|
Arrays.copyOfRange(signatureBytes, 0, 32),
|
||||||
|
Arrays.copyOfRange(signatureBytes, 32, 64));
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
|
||||||
|
// Iterate for each possible key to recover
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
BigInteger publicKey =
|
||||||
|
Sign.recoverFromSignature((byte) i,
|
||||||
|
new ECDSASignature(new BigInteger(1, sd.getR()), new BigInteger(1, sd.getS())),
|
||||||
|
msgHash);
|
||||||
|
|
||||||
|
if (publicKey != null) {
|
||||||
|
result.add("0x" + Keys.getAddress(publicKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验签名是否正确
|
||||||
|
*
|
||||||
|
* @param message 消息
|
||||||
|
* @param signature 签名结果
|
||||||
|
* @param address 期望地址
|
||||||
|
* @return true 地址正确, false 错误
|
||||||
|
*/
|
||||||
|
public static boolean checkEcRecover(String message, String signature, String address) {
|
||||||
|
if (address == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<String> result = ecRecover(message, signature);
|
||||||
|
return result.stream().anyMatch(address::equalsIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,661 @@
|
||||||
|
package com.ruoyi.web.util;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.connection.DataType;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class RedisUtil {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 key 是否存在
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @return 如果存在 key 则返回 true,否则返回 false
|
||||||
|
*/
|
||||||
|
public Boolean exists(String key) {
|
||||||
|
return redisTemplate.hasKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 Key 的类型
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
*/
|
||||||
|
public String type(String key) {
|
||||||
|
DataType dataType = redisTemplate.type(key);
|
||||||
|
assert dataType != null;
|
||||||
|
return dataType.code();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定缓存失效时间
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param time 时间(秒)
|
||||||
|
* @return 30
|
||||||
|
*/
|
||||||
|
public boolean expire(String key, long time) {
|
||||||
|
try {
|
||||||
|
if (time > 0) {
|
||||||
|
redisTemplate.expire(key, time, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据key 获取过期时间
|
||||||
|
*
|
||||||
|
* @param key 键 不能为null
|
||||||
|
* @return 时间(秒) 返回0代表为永久有效
|
||||||
|
*/
|
||||||
|
public long getExpire(String key) {
|
||||||
|
|
||||||
|
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断key是否存在
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @return true 存在 false不存在
|
||||||
|
*/
|
||||||
|
public boolean hasKey(String key) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.hasKey(key);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除 key
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
*/
|
||||||
|
public Long delete(String... key) {
|
||||||
|
if (key == null || key.length < 1) {
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
return redisTemplate.delete(Arrays.asList(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有的keys
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Set<String> keys() {
|
||||||
|
Set<String> keys1 = redisTemplate.keys("*");
|
||||||
|
|
||||||
|
return keys1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有的keys得所有的值
|
||||||
|
*
|
||||||
|
* @param keys
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public HashMap<Object, Object> getKeysValue(String keys) {
|
||||||
|
|
||||||
|
Set<String> keys1 = redisTemplate.keys("*");
|
||||||
|
|
||||||
|
HashMap<Object, Object> hashMap = new HashMap<Object, Object>();
|
||||||
|
for (String s : keys1) {
|
||||||
|
Object o = redisTemplate.opsForValue().get(keys + s);
|
||||||
|
System.out.println("o=" + o);
|
||||||
|
hashMap.put(keys1, o);
|
||||||
|
}
|
||||||
|
return hashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除缓存
|
||||||
|
*
|
||||||
|
* @param key 可以传一个值 或多个
|
||||||
|
*/
|
||||||
|
public void del(String... key) {
|
||||||
|
if (key != null && key.length > 0) {
|
||||||
|
if (key.length == 1) {
|
||||||
|
redisTemplate.delete(key[0]);
|
||||||
|
} else {
|
||||||
|
redisTemplate.delete((Collection<String>) CollectionUtils.arrayToList(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================String=============================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通缓存获取
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @return 值
|
||||||
|
*/
|
||||||
|
public Object get(String key) {
|
||||||
|
return key == null ? null : redisTemplate.opsForValue().get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通缓存放入
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
* @return true成功 false失败
|
||||||
|
*/
|
||||||
|
public boolean set(String key, Object value) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForValue().set(key, value);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通缓存放入并设置时间
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
|
||||||
|
* @return true成功 false 失败
|
||||||
|
*/
|
||||||
|
public boolean set(String key, Object value, long time) {
|
||||||
|
try {
|
||||||
|
if (time > 0) {
|
||||||
|
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
|
||||||
|
} else {
|
||||||
|
set(key, value);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递增
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param delta 要增加几(大于0)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public long incr(String key, long delta) {
|
||||||
|
if (delta < 0) {
|
||||||
|
throw new RuntimeException("递增因子必须大于0");
|
||||||
|
}
|
||||||
|
return redisTemplate.opsForValue().increment(key, delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递减
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param delta 要减少几(小于0)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public long decr(String key, long delta) {
|
||||||
|
if (delta < 0) {
|
||||||
|
throw new RuntimeException("递减因子必须大于0");
|
||||||
|
}
|
||||||
|
return redisTemplate.opsForValue().increment(key, -delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================Map=================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HashGet
|
||||||
|
*
|
||||||
|
* @param key 键 不能为null
|
||||||
|
* @param item 项 不能为null
|
||||||
|
* @return 值
|
||||||
|
*/
|
||||||
|
public Object hget(String key, String item) {
|
||||||
|
return redisTemplate.opsForHash().get(key, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取hashKey对应的所有键值
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @return 对应的多个键值
|
||||||
|
*/
|
||||||
|
public Map<Object, Object> hmget(String key) {
|
||||||
|
return redisTemplate.opsForHash().entries(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HashSet
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param map 对应多个键值
|
||||||
|
* @return true 成功 false 失败
|
||||||
|
*/
|
||||||
|
public boolean hmset(String key, Map<String, Object> map) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForHash().putAll(key, map);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HashSet 并设置时间
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param map 对应多个键值
|
||||||
|
* @param time 时间(秒)
|
||||||
|
* @return true成功 false失败
|
||||||
|
*/
|
||||||
|
public boolean hmset(String key, Map<String, Object> map, long time) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForHash().putAll(key, map);
|
||||||
|
if (time > 0) {
|
||||||
|
expire(key, time);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向一张hash表中放入数据,如果不存在将创建
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param item 项
|
||||||
|
* @param value 值
|
||||||
|
* @return true 成功 false失败
|
||||||
|
*/
|
||||||
|
public boolean hset(String key, String item, Object value) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForHash().put(key, item, value);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向一张hash表中放入数据,如果不存在将创建
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param item 项
|
||||||
|
* @param value 值
|
||||||
|
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
|
||||||
|
* @return true 成功 false失败
|
||||||
|
*/
|
||||||
|
public boolean hset(String key, String item, Object value, long time) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForHash().put(key, item, value);
|
||||||
|
if (time > 0) {
|
||||||
|
expire(key, time);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除hash表中的值
|
||||||
|
*
|
||||||
|
* @param key 键 不能为null
|
||||||
|
* @param item 项 可以使多个 不能为null
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void hdel(String key, Object... item) {
|
||||||
|
redisTemplate.opsForHash().delete(key, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断hash表中是否有该项的值
|
||||||
|
*
|
||||||
|
* @param key 键 不能为null
|
||||||
|
* @param item 项 不能为null
|
||||||
|
* @return true 存在 false不存在
|
||||||
|
*/
|
||||||
|
public boolean hHasKey(String key, String item) {
|
||||||
|
return redisTemplate.opsForHash().hasKey(key, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hash递增 如果不存在,就会创建一个 并把新增后的值返回
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param item 项
|
||||||
|
* @param by 要增加几(大于0)
|
||||||
|
* @return 274
|
||||||
|
*/
|
||||||
|
public double hincr(String key, String item, double by) {
|
||||||
|
return redisTemplate.opsForHash().increment(key, item, by);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hash递减
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param item 项
|
||||||
|
* @param by 要减少记(小于0)
|
||||||
|
* @return 285
|
||||||
|
*/
|
||||||
|
public double hdecr(String key, String item, double by) {
|
||||||
|
return redisTemplate.opsForHash().increment(key, item, -by);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================set=============================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据key获取Set中的所有值
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @return 295
|
||||||
|
*/
|
||||||
|
public Set<Object> sGet(String key) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForSet().members(key);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据value从一个set中查询,是否存在
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
* @return true 存在 false不存在
|
||||||
|
*/
|
||||||
|
public boolean sHasKey(String key, Object value) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForSet().isMember(key, value);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将数据放入set缓存
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param values 值 可以是多个
|
||||||
|
* @return 成功个数
|
||||||
|
*/
|
||||||
|
public long sSet(String key, Object... values) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForSet().add(key, values);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将set数据放入缓存
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param time 时间(秒)
|
||||||
|
* @param values 值 可以是多个
|
||||||
|
* @return 成功个数
|
||||||
|
*/
|
||||||
|
public long sSetAndTime(String key, long time, Object... values) {
|
||||||
|
try {
|
||||||
|
Long count = redisTemplate.opsForSet().add(key, values);
|
||||||
|
if (time > 0){
|
||||||
|
expire(key, time);
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取set缓存的长度
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public long sGetSetSize(String key) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForSet().size(key);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除值为value的
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param values 值 可以是多个
|
||||||
|
* @return 移除的个数
|
||||||
|
*/
|
||||||
|
public long setRemove(String key, Object... values) {
|
||||||
|
try {
|
||||||
|
Long count = redisTemplate.opsForSet().remove(key, values);
|
||||||
|
return count;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===============================list=================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取list缓存的内容
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param start 开始
|
||||||
|
* @param end 结束 0 到 -1代表所有值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Object> lGet(String key, long start, long end) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForList().range(key, start, end);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取list缓存的内容
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param start 开始
|
||||||
|
* @param end 结束 0 到 -1代表所有值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Object> getList(String key, long start, long end) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForList().range(key, start, end);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取list缓存的长度
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public long lGetListSize(String key) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForList().size(key);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过索引 获取list中的值
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Object lGetIndex(String key, long index) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForList().index(key, index);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将list放入缓存
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean lSet(String key, Object value) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForList().rightPush(key, value);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将list放入缓存
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
* @param time 时间(秒)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean lSet(String key, Object value, long time) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForList().rightPush(key, value);
|
||||||
|
if (time > 0){
|
||||||
|
expire(key, time);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将list放入缓存
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean lSet(String key, List<Object> value) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForList().rightPushAll(key, value);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将list放入缓存
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
* @param time 时间(秒)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean lSet(String key, List<Object> value, long time) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForList().rightPushAll(key, value);
|
||||||
|
if (time > 0){
|
||||||
|
expire(key, time);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据索引修改list中的某条数据
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param index 索引
|
||||||
|
* @param value 值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean lUpdateIndex(String key, long index, Object value) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForList().set(key, index, value);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除N个值为value
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param count 移除多少个
|
||||||
|
* @param value 值
|
||||||
|
* @return 移除的个数
|
||||||
|
*/
|
||||||
|
public long lRemove(String key, long count, Object value) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Long remove = redisTemplate.opsForList().remove(key, count, value);
|
||||||
|
return remove;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
# 数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
druid:
|
||||||
|
# 主库数据源
|
||||||
|
master:
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/alive_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
# 从库数据源
|
||||||
|
slave:
|
||||||
|
# 从数据源开关/默认关闭
|
||||||
|
enabled: false
|
||||||
|
url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
# 初始连接数
|
||||||
|
initialSize: 5
|
||||||
|
# 最小连接池数量
|
||||||
|
minIdle: 10
|
||||||
|
# 最大连接池数量
|
||||||
|
maxActive: 20
|
||||||
|
# 配置获取连接等待超时的时间
|
||||||
|
maxWait: 60000
|
||||||
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
|
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||||
|
minEvictableIdleTimeMillis: 300000
|
||||||
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
|
maxEvictableIdleTimeMillis: 900000
|
||||||
|
# 配置检测连接是否有效
|
||||||
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
|
testWhileIdle: true
|
||||||
|
testOnBorrow: false
|
||||||
|
testOnReturn: false
|
||||||
|
webStatFilter:
|
||||||
|
enabled: true
|
||||||
|
statViewServlet:
|
||||||
|
enabled: true
|
||||||
|
# 设置白名单,不填则允许所有访问
|
||||||
|
allow:
|
||||||
|
url-pattern: /druid/*
|
||||||
|
# 控制台管理用户名和密码
|
||||||
|
login-username:
|
||||||
|
login-password:
|
||||||
|
filter:
|
||||||
|
stat:
|
||||||
|
enabled: true
|
||||||
|
# 慢SQL记录
|
||||||
|
log-slow-sql: true
|
||||||
|
slow-sql-millis: 1000
|
||||||
|
merge-sql: true
|
||||||
|
wall:
|
||||||
|
config:
|
||||||
|
multi-statement-allow: true
|
||||||
|
redis:
|
||||||
|
host: 192.168.1.60
|
||||||
|
database: 0
|
||||||
|
password: 123456
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 20
|
||||||
|
max-idle: 16
|
||||||
|
max-wait: 1000ms
|
||||||
|
min-idle: 10
|
||||||
|
|
||||||
|
# 项目相关配置
|
||||||
|
ruoyi:
|
||||||
|
# 名称
|
||||||
|
name: MTXM
|
||||||
|
# 版本
|
||||||
|
version: 4.7.3
|
||||||
|
# 版权年份
|
||||||
|
copyrightYear: 2022
|
||||||
|
# 实例演示开关
|
||||||
|
demoEnabled: true
|
||||||
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /data/nginx/data/upload)
|
||||||
|
profile: D:/ruoyi/uploadPath # D:/ruoyi/uploadPath
|
||||||
|
# 获取ip地址开关
|
||||||
|
addressEnabled: false
|
||||||
|
#--------------本地----------------------
|
||||||
|
getImg: http://192.168.10.166:9090/img/
|
||||||
|
addImg: D:/img/fai
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
# 数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
druid:
|
||||||
|
# 主库数据源
|
||||||
|
master:
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/alive_prod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
|
||||||
|
username: alive_prod
|
||||||
|
password: 6jD2S3CGwGYhRXNp
|
||||||
|
# 从库数据源
|
||||||
|
slave:
|
||||||
|
# 从数据源开关/默认关闭
|
||||||
|
enabled: false
|
||||||
|
url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
# 初始连接数
|
||||||
|
initialSize: 5
|
||||||
|
# 最小连接池数量
|
||||||
|
minIdle: 10
|
||||||
|
# 最大连接池数量
|
||||||
|
maxActive: 20
|
||||||
|
# 配置获取连接等待超时的时间
|
||||||
|
maxWait: 60000
|
||||||
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
|
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||||
|
minEvictableIdleTimeMillis: 300000
|
||||||
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
|
maxEvictableIdleTimeMillis: 900000
|
||||||
|
# 配置检测连接是否有效
|
||||||
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
|
testWhileIdle: true
|
||||||
|
testOnBorrow: false
|
||||||
|
testOnReturn: false
|
||||||
|
webStatFilter:
|
||||||
|
enabled: true
|
||||||
|
statViewServlet:
|
||||||
|
enabled: true
|
||||||
|
# 设置白名单,不填则允许所有访问
|
||||||
|
allow:
|
||||||
|
url-pattern: /druid/*
|
||||||
|
# 控制台管理用户名和密码
|
||||||
|
login-username:
|
||||||
|
login-password:
|
||||||
|
filter:
|
||||||
|
stat:
|
||||||
|
enabled: true
|
||||||
|
# 慢SQL记录
|
||||||
|
log-slow-sql: true
|
||||||
|
slow-sql-millis: 1000
|
||||||
|
merge-sql: true
|
||||||
|
wall:
|
||||||
|
config:
|
||||||
|
multi-statement-allow: true
|
||||||
|
redis:
|
||||||
|
host: 127.0.0.1
|
||||||
|
database: 7
|
||||||
|
password:
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 20
|
||||||
|
max-idle: 16
|
||||||
|
max-wait: 1000ms
|
||||||
|
min-idle: 10
|
||||||
|
|
||||||
|
# 项目相关配置
|
||||||
|
ruoyi:
|
||||||
|
# 名称
|
||||||
|
name: MTXM
|
||||||
|
# 版本
|
||||||
|
version: 4.7.3
|
||||||
|
# 版权年份
|
||||||
|
copyrightYear: 2022
|
||||||
|
# 实例演示开关
|
||||||
|
demoEnabled: true
|
||||||
|
# 获取ip地址开关
|
||||||
|
addressEnabled: false
|
||||||
|
#图片读取域名
|
||||||
|
getImg: https://file.fireandice.space/fai/
|
||||||
|
#图片上传域名
|
||||||
|
addImg: /data/file/fai
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
# 数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
druid:
|
||||||
|
# 主库数据源 _Admin123
|
||||||
|
master:
|
||||||
|
url: jdbc:mysql://172.17.0.1:3307/node_roos_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
# 从库数据源
|
||||||
|
slave:
|
||||||
|
# 从数据源开关/默认关闭
|
||||||
|
enabled: false
|
||||||
|
url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
# 初始连接数
|
||||||
|
initialSize: 5
|
||||||
|
# 最小连接池数量
|
||||||
|
minIdle: 10
|
||||||
|
# 最大连接池数量
|
||||||
|
maxActive: 20
|
||||||
|
# 配置获取连接等待超时的时间
|
||||||
|
maxWait: 60000
|
||||||
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
|
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||||
|
minEvictableIdleTimeMillis: 300000
|
||||||
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
|
maxEvictableIdleTimeMillis: 900000
|
||||||
|
# 配置检测连接是否有效
|
||||||
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
|
testWhileIdle: true
|
||||||
|
testOnBorrow: false
|
||||||
|
testOnReturn: false
|
||||||
|
webStatFilter:
|
||||||
|
enabled: true
|
||||||
|
statViewServlet:
|
||||||
|
enabled: true
|
||||||
|
# 设置白名单,不填则允许所有访问
|
||||||
|
allow:
|
||||||
|
url-pattern: /druid/*
|
||||||
|
# 控制台管理用户名和密码
|
||||||
|
login-username:
|
||||||
|
login-password:
|
||||||
|
filter:
|
||||||
|
stat:
|
||||||
|
enabled: true
|
||||||
|
# 慢SQL记录
|
||||||
|
log-slow-sql: true
|
||||||
|
slow-sql-millis: 1000
|
||||||
|
merge-sql: true
|
||||||
|
wall:
|
||||||
|
config:
|
||||||
|
multi-statement-allow: true
|
||||||
|
redis:
|
||||||
|
host: 192.168.1.60
|
||||||
|
database: 0
|
||||||
|
password: 123456
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 20
|
||||||
|
max-idle: 16
|
||||||
|
max-wait: 1000ms
|
||||||
|
min-idle: 10
|
||||||
|
|
||||||
|
# 项目相关配置
|
||||||
|
ruoyi:
|
||||||
|
# 名称
|
||||||
|
name: MTXM
|
||||||
|
# 版本
|
||||||
|
version: 4.7.3
|
||||||
|
# 版权年份
|
||||||
|
copyrightYear: 2022
|
||||||
|
# 实例演示开关
|
||||||
|
demoEnabled: true
|
||||||
|
# 获取ip地址开关
|
||||||
|
addressEnabled: false
|
||||||
|
#图片读取域名
|
||||||
|
getImg: http://file.odctest.top/fai/
|
||||||
|
#图片上传域名
|
||||||
|
addImg: /data/file/fai/
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
# 项目相关配置
|
||||||
|
ruoyi:
|
||||||
|
# 名称
|
||||||
|
name: MTXM
|
||||||
|
# 版本
|
||||||
|
version: 4.7.3
|
||||||
|
# 版权年份
|
||||||
|
copyrightYear: 2022
|
||||||
|
# 实例演示开关
|
||||||
|
demoEnabled: true
|
||||||
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||||
|
profile: D:/ruoyi/uploadPath
|
||||||
|
# 获取ip地址开关
|
||||||
|
addressEnabled: false
|
||||||
|
|
||||||
|
# 开发环境配置
|
||||||
|
server:
|
||||||
|
# 服务器的HTTP端口,默认为80
|
||||||
|
port: 8180
|
||||||
|
servlet:
|
||||||
|
# 应用的访问路径
|
||||||
|
context-path: /
|
||||||
|
tomcat:
|
||||||
|
# tomcat的URI编码
|
||||||
|
uri-encoding: UTF-8
|
||||||
|
# 连接数满后的排队数,默认为100
|
||||||
|
accept-count: 1000
|
||||||
|
threads:
|
||||||
|
# tomcat最大线程数,默认为200
|
||||||
|
max: 800
|
||||||
|
# Tomcat启动初始化的线程数,默认值10
|
||||||
|
min-spare: 100
|
||||||
|
|
||||||
|
# 日志配置
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.ruoyi: debug
|
||||||
|
org.springframework: warn
|
||||||
|
|
||||||
|
# 用户配置
|
||||||
|
user:
|
||||||
|
password:
|
||||||
|
# 密码错误{maxRetryCount}次锁定10分钟
|
||||||
|
maxRetryCount: 100
|
||||||
|
|
||||||
|
# Spring配置
|
||||||
|
spring:
|
||||||
|
# 模板引擎
|
||||||
|
thymeleaf:
|
||||||
|
mode: HTML
|
||||||
|
encoding: utf-8
|
||||||
|
# 禁用缓存
|
||||||
|
cache: false
|
||||||
|
# 资源信息
|
||||||
|
messages:
|
||||||
|
# 国际化资源文件路径
|
||||||
|
basename: static/i18n/messages
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
profiles:
|
||||||
|
active: dev
|
||||||
|
# 文件上传
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
# 单个文件大小
|
||||||
|
max-file-size: 10MB
|
||||||
|
# 设置总上传的文件大小
|
||||||
|
max-request-size: 20MB
|
||||||
|
# 服务模块
|
||||||
|
devtools:
|
||||||
|
restart:
|
||||||
|
# 热部署开关
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# MyBatis
|
||||||
|
mybatis:
|
||||||
|
# 搜索指定包别名
|
||||||
|
typeAliasesPackage: com.ruoyi.**.domain
|
||||||
|
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||||
|
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||||
|
# 加载全局的配置文件
|
||||||
|
configLocation: classpath:mybatis/mybatis-config.xml
|
||||||
|
|
||||||
|
# PageHelper分页插件
|
||||||
|
pagehelper:
|
||||||
|
helperDialect: mysql
|
||||||
|
supportMethodsArguments: true
|
||||||
|
params: count=countSql
|
||||||
|
|
||||||
|
# Shiro
|
||||||
|
shiro:
|
||||||
|
user:
|
||||||
|
# 登录地址
|
||||||
|
loginUrl: /login
|
||||||
|
# 权限认证失败地址
|
||||||
|
unauthorizedUrl: /unauth
|
||||||
|
# 首页地址
|
||||||
|
indexUrl: /index
|
||||||
|
# 验证码开关
|
||||||
|
captchaEnabled: false
|
||||||
|
# 验证码类型 math 数组计算 char 字符
|
||||||
|
captchaType: math
|
||||||
|
cookie:
|
||||||
|
# 设置Cookie的域名 默认空,即当前访问的域名
|
||||||
|
domain:
|
||||||
|
# 设置cookie的有效访问路径
|
||||||
|
path: /
|
||||||
|
# 设置HttpOnly属性
|
||||||
|
httpOnly: true
|
||||||
|
# 设置Cookie的过期时间,天为单位
|
||||||
|
maxAge: 30
|
||||||
|
# 设置密钥,务必保持唯一性(生成方式,直接拷贝到main运行即可)Base64.encodeToString(CipherUtils.generateNewKey(128, "AES").getEncoded()) (默认启动生成随机秘钥,随机秘钥会导致之前客户端RememberMe Cookie无效,如设置固定秘钥RememberMe Cookie则有效)
|
||||||
|
cipherKey:
|
||||||
|
session:
|
||||||
|
# Session超时时间,-1代表永不过期(默认30分钟)
|
||||||
|
expireTime: -1
|
||||||
|
# 同步session到数据库的周期(默认1分钟)
|
||||||
|
dbSyncPeriod: 1
|
||||||
|
# 相隔多久检查一次session的有效性,默认就是10分钟
|
||||||
|
validationInterval: 10
|
||||||
|
# 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制)
|
||||||
|
maxSession: -1
|
||||||
|
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
|
||||||
|
kickoutAfter: false
|
||||||
|
rememberMe:
|
||||||
|
# 是否开启记住我
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# 防止XSS攻击
|
||||||
|
xss:
|
||||||
|
# 过滤开关
|
||||||
|
enabled: true
|
||||||
|
# 排除链接(多个用逗号分隔)
|
||||||
|
excludes: /system/notice/*
|
||||||
|
# 匹配链接
|
||||||
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
||||||
|
# Swagger配置
|
||||||
|
swagger:
|
||||||
|
# 是否开启swagger
|
||||||
|
enabled: true
|
|
@ -0,0 +1,2 @@
|
||||||
|
Application Version: ${ruoyi.version}
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ehcache name="ruoyi" updateCheck="false">
|
||||||
|
|
||||||
|
<!-- 磁盘缓存位置 -->
|
||||||
|
<diskStore path="java.io.tmpdir"/>
|
||||||
|
|
||||||
|
<!-- maxEntriesLocalHeap:堆内存中最大缓存对象数,0没有限制 -->
|
||||||
|
<!-- maxElementsInMemory: 在内存中缓存的element的最大数目。-->
|
||||||
|
<!-- eternal:elements是否永久有效,如果为true,timeouts将被忽略,element将永不过期 -->
|
||||||
|
<!-- timeToIdleSeconds:失效前的空闲秒数,当eternal为false时,这个属性才有效,0为不限制 -->
|
||||||
|
<!-- timeToLiveSeconds:失效前的存活秒数,创建时间到失效时间的间隔为存活时间,当eternal为false时,这个属性才有效,0为不限制 -->
|
||||||
|
<!-- overflowToDisk: 如果内存中数据超过内存限制,是否要缓存到磁盘上 -->
|
||||||
|
<!-- statistics:是否收集统计信息。如果需要监控缓存使用情况,应该打开这个选项。默认为关闭(统计会影响性能)。设置statistics="true"开启统计 -->
|
||||||
|
|
||||||
|
<!-- 默认缓存 -->
|
||||||
|
<defaultCache
|
||||||
|
maxEntriesLocalHeap="1000"
|
||||||
|
eternal="false"
|
||||||
|
timeToIdleSeconds="3600"
|
||||||
|
timeToLiveSeconds="3600"
|
||||||
|
overflowToDisk="false">
|
||||||
|
</defaultCache>
|
||||||
|
|
||||||
|
<!-- 登录记录缓存 锁定10分钟 -->
|
||||||
|
<cache name="loginRecordCache"
|
||||||
|
maxEntriesLocalHeap="2000"
|
||||||
|
eternal="false"
|
||||||
|
timeToIdleSeconds="600"
|
||||||
|
timeToLiveSeconds="0"
|
||||||
|
overflowToDisk="false"
|
||||||
|
statistics="false">
|
||||||
|
</cache>
|
||||||
|
|
||||||
|
<!-- 系统活跃用户缓存 -->
|
||||||
|
<cache name="sys-userCache"
|
||||||
|
maxEntriesLocalHeap="10000"
|
||||||
|
overflowToDisk="false"
|
||||||
|
eternal="false"
|
||||||
|
diskPersistent="false"
|
||||||
|
timeToLiveSeconds="0"
|
||||||
|
timeToIdleSeconds="0"
|
||||||
|
statistics="false">
|
||||||
|
</cache>
|
||||||
|
|
||||||
|
<!-- 系统用户授权缓存 没必要过期 -->
|
||||||
|
<cache name="sys-authCache"
|
||||||
|
maxEntriesLocalHeap="10000"
|
||||||
|
overflowToDisk="false"
|
||||||
|
eternal="false"
|
||||||
|
diskPersistent="false"
|
||||||
|
timeToLiveSeconds="0"
|
||||||
|
timeToIdleSeconds="0"
|
||||||
|
memoryStoreEvictionPolicy="LRU"
|
||||||
|
statistics="false"/>
|
||||||
|
|
||||||
|
<!-- 系统缓存 -->
|
||||||
|
<cache name="sys-cache"
|
||||||
|
maxEntriesLocalHeap="1000"
|
||||||
|
eternal="true"
|
||||||
|
overflowToDisk="true"
|
||||||
|
statistics="false">
|
||||||
|
</cache>
|
||||||
|
|
||||||
|
<!-- 系统参数缓存 -->
|
||||||
|
<cache name="sys-config"
|
||||||
|
maxEntriesLocalHeap="1000"
|
||||||
|
eternal="true"
|
||||||
|
overflowToDisk="true"
|
||||||
|
statistics="false">
|
||||||
|
</cache>
|
||||||
|
|
||||||
|
<!-- 系统字典缓存 -->
|
||||||
|
<cache name="sys-dict"
|
||||||
|
maxEntriesLocalHeap="1000"
|
||||||
|
eternal="true"
|
||||||
|
overflowToDisk="true"
|
||||||
|
statistics="false">
|
||||||
|
</cache>
|
||||||
|
|
||||||
|
<!-- 系统会话缓存 -->
|
||||||
|
<cache name="shiro-activeSessionCache"
|
||||||
|
maxEntriesLocalHeap="10000"
|
||||||
|
overflowToDisk="false"
|
||||||
|
eternal="false"
|
||||||
|
diskPersistent="false"
|
||||||
|
timeToLiveSeconds="0"
|
||||||
|
timeToIdleSeconds="0"
|
||||||
|
statistics="false"/>
|
||||||
|
|
||||||
|
</ehcache>
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="/home/ruoyi/logs" />
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/sys-info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/sys-error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 用户访问日志输出 -->
|
||||||
|
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/sys-user.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 按天回滚 daily -->
|
||||||
|
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.ruoyi" level="info" />
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn" />
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info" />
|
||||||
|
<appender-ref ref="file_error" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统用户操作日志-->
|
||||||
|
<logger name="sys-user" level="info">
|
||||||
|
<appender-ref ref="sys-user"/>
|
||||||
|
</logger>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE configuration
|
||||||
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
<configuration>
|
||||||
|
<!-- 全局参数 -->
|
||||||
|
<settings>
|
||||||
|
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||||
|
<setting name="cacheEnabled" value="true" />
|
||||||
|
<!-- 允许JDBC 支持自动生成主键 -->
|
||||||
|
<setting name="useGeneratedKeys" value="true" />
|
||||||
|
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||||
|
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||||
|
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||||
|
<setting name="logImpl" value="SLF4J" />
|
||||||
|
<!-- 使用驼峰命名法转换字段 -->
|
||||||
|
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||||
|
</settings>
|
||||||
|
|
||||||
|
</configuration>
|
|
@ -0,0 +1,617 @@
|
||||||
|
/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */
|
||||||
|
/*
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2007-2013 Einar Lielmanis and contributors.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation files
|
||||||
|
(the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge,
|
||||||
|
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
Style HTML
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Written by Nochum Sossonko, (nsossonko@hotmail.com)
|
||||||
|
|
||||||
|
Based on code initially developed by: Einar Lielmanis, <elfz@laacz.lv>
|
||||||
|
http://jsbeautifier.org/
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
style_html(html_source);
|
||||||
|
|
||||||
|
style_html(html_source, options);
|
||||||
|
|
||||||
|
The options are:
|
||||||
|
indent_size (default 4) — indentation size,
|
||||||
|
indent_char (default space) — character to indent with,
|
||||||
|
max_char (default 250) - maximum amount of characters per line (0 = disable)
|
||||||
|
brace_style (default "collapse") - "collapse" | "expand" | "end-expand"
|
||||||
|
put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line.
|
||||||
|
unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted
|
||||||
|
indent_scripts (default normal) - "keep"|"separate"|"normal"
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
style_html(html_source, {
|
||||||
|
'indent_size': 2,
|
||||||
|
'indent_char': ' ',
|
||||||
|
'max_char': 78,
|
||||||
|
'brace_style': 'expand',
|
||||||
|
'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u']
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
function style_html(html_source, options, js_beautify, css_beautify) {
|
||||||
|
//Wrapper function to invoke all the necessary constructors and deal with the output.
|
||||||
|
|
||||||
|
var multi_parser,
|
||||||
|
indent_size,
|
||||||
|
indent_character,
|
||||||
|
max_char,
|
||||||
|
brace_style,
|
||||||
|
unformatted;
|
||||||
|
|
||||||
|
options = options || {};
|
||||||
|
indent_size = options.indent_size || 4;
|
||||||
|
indent_character = options.indent_char || ' ';
|
||||||
|
brace_style = options.brace_style || 'collapse';
|
||||||
|
max_char = options.max_char === 0 ? Infinity : options.max_char || 250;
|
||||||
|
unformatted = options.unformatted || ['a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
||||||
|
|
||||||
|
function Parser() {
|
||||||
|
|
||||||
|
this.pos = 0; //Parser position
|
||||||
|
this.token = '';
|
||||||
|
this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT
|
||||||
|
this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values
|
||||||
|
parent: 'parent1',
|
||||||
|
parentcount: 1,
|
||||||
|
parent1: ''
|
||||||
|
};
|
||||||
|
this.tag_type = '';
|
||||||
|
this.token_text = this.last_token = this.last_text = this.token_type = '';
|
||||||
|
|
||||||
|
this.Utils = { //Uilities made available to the various functions
|
||||||
|
whitespace: "\n\r\t ".split(''),
|
||||||
|
single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?='.split(','), //all the single tags for HTML
|
||||||
|
extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them
|
||||||
|
in_array: function (what, arr) {
|
||||||
|
for (var i=0; i<arr.length; i++) {
|
||||||
|
if (what === arr[i]) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.get_content = function () { //function to capture regular content between tags
|
||||||
|
|
||||||
|
var input_char = '',
|
||||||
|
content = [],
|
||||||
|
space = false; //if a space is needed
|
||||||
|
|
||||||
|
while (this.input.charAt(this.pos) !== '<') {
|
||||||
|
if (this.pos >= this.input.length) {
|
||||||
|
return content.length?content.join(''):['', 'TK_EOF'];
|
||||||
|
}
|
||||||
|
|
||||||
|
input_char = this.input.charAt(this.pos);
|
||||||
|
this.pos++;
|
||||||
|
this.line_char_count++;
|
||||||
|
|
||||||
|
if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
|
||||||
|
if (content.length) {
|
||||||
|
space = true;
|
||||||
|
}
|
||||||
|
this.line_char_count--;
|
||||||
|
continue; //don't want to insert unnecessary space
|
||||||
|
}
|
||||||
|
else if (space) {
|
||||||
|
if (this.line_char_count >= this.max_char) { //insert a line when the max_char is reached
|
||||||
|
content.push('\n');
|
||||||
|
for (var i=0; i<this.indent_level; i++) {
|
||||||
|
content.push(this.indent_string);
|
||||||
|
}
|
||||||
|
this.line_char_count = 0;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
content.push(' ');
|
||||||
|
this.line_char_count++;
|
||||||
|
}
|
||||||
|
space = false;
|
||||||
|
}
|
||||||
|
content.push(input_char); //letter at-a-time (or string) inserted to an array
|
||||||
|
}
|
||||||
|
return content.length?content.join(''):'';
|
||||||
|
};
|
||||||
|
|
||||||
|
this.get_contents_to = function (name) { //get the full content of a script or style to pass to js_beautify
|
||||||
|
if (this.pos === this.input.length) {
|
||||||
|
return ['', 'TK_EOF'];
|
||||||
|
}
|
||||||
|
var input_char = '';
|
||||||
|
var content = '';
|
||||||
|
var reg_match = new RegExp('</' + name + '\\s*>', 'igm');
|
||||||
|
reg_match.lastIndex = this.pos;
|
||||||
|
var reg_array = reg_match.exec(this.input);
|
||||||
|
var end_script = reg_array?reg_array.index:this.input.length; //absolute end of script
|
||||||
|
if(this.pos < end_script) { //get everything in between the script tags
|
||||||
|
content = this.input.substring(this.pos, end_script);
|
||||||
|
this.pos = end_script;
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.record_tag = function (tag){ //function to record a tag and its parent in this.tags Object
|
||||||
|
if (this.tags[tag + 'count']) { //check for the existence of this tag type
|
||||||
|
this.tags[tag + 'count']++;
|
||||||
|
this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
|
||||||
|
}
|
||||||
|
else { //otherwise initialize this tag type
|
||||||
|
this.tags[tag + 'count'] = 1;
|
||||||
|
this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
|
||||||
|
}
|
||||||
|
this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent)
|
||||||
|
this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
|
||||||
|
};
|
||||||
|
|
||||||
|
this.retrieve_tag = function (tag) { //function to retrieve the opening tag to the corresponding closer
|
||||||
|
if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it
|
||||||
|
var temp_parent = this.tags.parent; //check to see if it's a closable tag.
|
||||||
|
while (temp_parent) { //till we reach '' (the initial value);
|
||||||
|
if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree
|
||||||
|
}
|
||||||
|
if (temp_parent) { //if we caught something
|
||||||
|
this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly
|
||||||
|
this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent
|
||||||
|
}
|
||||||
|
delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference...
|
||||||
|
delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself
|
||||||
|
if (this.tags[tag + 'count'] === 1) {
|
||||||
|
delete this.tags[tag + 'count'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.tags[tag + 'count']--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.get_tag = function (peek) { //function to get a full tag and parse its type
|
||||||
|
var input_char = '',
|
||||||
|
content = [],
|
||||||
|
comment = '',
|
||||||
|
space = false,
|
||||||
|
tag_start, tag_end,
|
||||||
|
orig_pos = this.pos,
|
||||||
|
orig_line_char_count = this.line_char_count;
|
||||||
|
|
||||||
|
peek = peek !== undefined ? peek : false;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (this.pos >= this.input.length) {
|
||||||
|
if (peek) {
|
||||||
|
this.pos = orig_pos;
|
||||||
|
this.line_char_count = orig_line_char_count;
|
||||||
|
}
|
||||||
|
return content.length?content.join(''):['', 'TK_EOF'];
|
||||||
|
}
|
||||||
|
|
||||||
|
input_char = this.input.charAt(this.pos);
|
||||||
|
this.pos++;
|
||||||
|
this.line_char_count++;
|
||||||
|
|
||||||
|
if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space
|
||||||
|
space = true;
|
||||||
|
this.line_char_count--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input_char === "'" || input_char === '"') {
|
||||||
|
if (!content[1] || content[1] !== '!') { //if we're in a comment strings don't get treated specially
|
||||||
|
input_char += this.get_unformatted(input_char);
|
||||||
|
space = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input_char === '=') { //no space before =
|
||||||
|
space = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (content.length && content[content.length-1] !== '=' && input_char !== '>' && space) {
|
||||||
|
//no space after = or before >
|
||||||
|
if (this.line_char_count >= this.max_char) {
|
||||||
|
this.print_newline(false, content);
|
||||||
|
this.line_char_count = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content.push(' ');
|
||||||
|
this.line_char_count++;
|
||||||
|
}
|
||||||
|
space = false;
|
||||||
|
}
|
||||||
|
if (input_char === '<') {
|
||||||
|
tag_start = this.pos - 1;
|
||||||
|
}
|
||||||
|
content.push(input_char); //inserts character at-a-time (or string)
|
||||||
|
} while (input_char !== '>');
|
||||||
|
|
||||||
|
var tag_complete = content.join('');
|
||||||
|
var tag_index;
|
||||||
|
if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
|
||||||
|
tag_index = tag_complete.indexOf(' ');
|
||||||
|
}
|
||||||
|
else { //otherwise go with the tag ending
|
||||||
|
tag_index = tag_complete.indexOf('>');
|
||||||
|
}
|
||||||
|
var tag_check = tag_complete.substring(1, tag_index).toLowerCase();
|
||||||
|
if (tag_complete.charAt(tag_complete.length-2) === '/' ||
|
||||||
|
this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /)
|
||||||
|
if ( ! peek) {
|
||||||
|
this.tag_type = 'SINGLE';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (tag_check === 'script') { //for later script handling
|
||||||
|
if ( ! peek) {
|
||||||
|
this.record_tag(tag_check);
|
||||||
|
this.tag_type = 'SCRIPT';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content)
|
||||||
|
if ( ! peek) {
|
||||||
|
this.record_tag(tag_check);
|
||||||
|
this.tag_type = 'STYLE';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags
|
||||||
|
comment = this.get_unformatted('</'+tag_check+'>', tag_complete); //...delegate to get_unformatted function
|
||||||
|
content.push(comment);
|
||||||
|
// Preserve collapsed whitespace either before or after this tag.
|
||||||
|
if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)){
|
||||||
|
content.splice(0, 0, this.input.charAt(tag_start - 1));
|
||||||
|
}
|
||||||
|
tag_end = this.pos - 1;
|
||||||
|
if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)){
|
||||||
|
content.push(this.input.charAt(tag_end + 1));
|
||||||
|
}
|
||||||
|
this.tag_type = 'SINGLE';
|
||||||
|
}
|
||||||
|
else if (tag_check.charAt(0) === '!') { //peek for <!-- comment
|
||||||
|
if (tag_check.indexOf('[if') !== -1) { //peek for <!--[if conditional comment
|
||||||
|
if (tag_complete.indexOf('!IE') !== -1) { //this type needs a closing --> so...
|
||||||
|
comment = this.get_unformatted('-->', tag_complete); //...delegate to get_unformatted
|
||||||
|
content.push(comment);
|
||||||
|
}
|
||||||
|
if ( ! peek) {
|
||||||
|
this.tag_type = 'START';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (tag_check.indexOf('[endif') !== -1) {//peek for <!--[endif end conditional comment
|
||||||
|
this.tag_type = 'END';
|
||||||
|
this.unindent();
|
||||||
|
}
|
||||||
|
else if (tag_check.indexOf('[cdata[') !== -1) { //if it's a <[cdata[ comment...
|
||||||
|
comment = this.get_unformatted(']]>', tag_complete); //...delegate to get_unformatted function
|
||||||
|
content.push(comment);
|
||||||
|
if ( ! peek) {
|
||||||
|
this.tag_type = 'SINGLE'; //<![CDATA[ comments are treated like single tags
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
comment = this.get_unformatted('-->', tag_complete);
|
||||||
|
content.push(comment);
|
||||||
|
this.tag_type = 'SINGLE';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( ! peek) {
|
||||||
|
if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending
|
||||||
|
this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors
|
||||||
|
this.tag_type = 'END';
|
||||||
|
}
|
||||||
|
else { //otherwise it's a start-tag
|
||||||
|
this.record_tag(tag_check); //push it on the tag stack
|
||||||
|
this.tag_type = 'START';
|
||||||
|
}
|
||||||
|
if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line
|
||||||
|
this.print_newline(true, this.output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (peek) {
|
||||||
|
this.pos = orig_pos;
|
||||||
|
this.line_char_count = orig_line_char_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
return content.join(''); //returns fully formatted tag
|
||||||
|
};
|
||||||
|
|
||||||
|
this.get_unformatted = function (delimiter, orig_tag) { //function to return unformatted content in its entirety
|
||||||
|
|
||||||
|
if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
var input_char = '';
|
||||||
|
var content = '';
|
||||||
|
var space = true;
|
||||||
|
do {
|
||||||
|
|
||||||
|
if (this.pos >= this.input.length) {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
input_char = this.input.charAt(this.pos);
|
||||||
|
this.pos++;
|
||||||
|
|
||||||
|
if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
|
||||||
|
if (!space) {
|
||||||
|
this.line_char_count--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (input_char === '\n' || input_char === '\r') {
|
||||||
|
content += '\n';
|
||||||
|
/* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect <pre> tags if they are specified in the 'unformatted array'
|
||||||
|
for (var i=0; i<this.indent_level; i++) {
|
||||||
|
content += this.indent_string;
|
||||||
|
}
|
||||||
|
space = false; //...and make sure other indentation is erased
|
||||||
|
*/
|
||||||
|
this.line_char_count = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
content += input_char;
|
||||||
|
this.line_char_count++;
|
||||||
|
space = true;
|
||||||
|
|
||||||
|
|
||||||
|
} while (content.toLowerCase().indexOf(delimiter) === -1);
|
||||||
|
return content;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.get_token = function () { //initial handler for token-retrieval
|
||||||
|
var token;
|
||||||
|
|
||||||
|
if (this.last_token === 'TK_TAG_SCRIPT' || this.last_token === 'TK_TAG_STYLE') { //check if we need to format javascript
|
||||||
|
var type = this.last_token.substr(7);
|
||||||
|
token = this.get_contents_to(type);
|
||||||
|
if (typeof token !== 'string') {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
return [token, 'TK_' + type];
|
||||||
|
}
|
||||||
|
if (this.current_mode === 'CONTENT') {
|
||||||
|
token = this.get_content();
|
||||||
|
if (typeof token !== 'string') {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return [token, 'TK_CONTENT'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.current_mode === 'TAG') {
|
||||||
|
token = this.get_tag();
|
||||||
|
if (typeof token !== 'string') {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var tag_name_type = 'TK_TAG_' + this.tag_type;
|
||||||
|
return [token, tag_name_type];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.get_full_indent = function (level) {
|
||||||
|
level = this.indent_level + level || 0;
|
||||||
|
if (level < 1) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array(level + 1).join(this.indent_string);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.is_unformatted = function(tag_check, unformatted) {
|
||||||
|
//is this an HTML5 block-level link?
|
||||||
|
if (!this.Utils.in_array(tag_check, unformatted)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tag_check.toLowerCase() !== 'a' || !this.Utils.in_array('a', unformatted)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//at this point we have an tag; is its first child something we want to remain
|
||||||
|
//unformatted?
|
||||||
|
var next_tag = this.get_tag(true /* peek. */);
|
||||||
|
|
||||||
|
// tets next_tag to see if it is just html tag (no external content)
|
||||||
|
var tag = (next_tag || "").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);
|
||||||
|
|
||||||
|
// if next_tag comes back but is not an isolated tag, then
|
||||||
|
// let's treat the 'a' tag as having content
|
||||||
|
// and respect the unformatted option
|
||||||
|
if (!tag || this.Utils.in_array(tag, unformatted)){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.printer = function (js_source, indent_character, indent_size, max_char, brace_style) { //handles input/output and some other printing functions
|
||||||
|
|
||||||
|
this.input = js_source || ''; //gets the input for the Parser
|
||||||
|
this.output = [];
|
||||||
|
this.indent_character = indent_character;
|
||||||
|
this.indent_string = '';
|
||||||
|
this.indent_size = indent_size;
|
||||||
|
this.brace_style = brace_style;
|
||||||
|
this.indent_level = 0;
|
||||||
|
this.max_char = max_char;
|
||||||
|
this.line_char_count = 0; //count to see if max_char was exceeded
|
||||||
|
|
||||||
|
for (var i=0; i<this.indent_size; i++) {
|
||||||
|
this.indent_string += this.indent_character;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.print_newline = function (ignore, arr) {
|
||||||
|
this.line_char_count = 0;
|
||||||
|
if (!arr || !arr.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!ignore) { //we might want the extra line
|
||||||
|
while (this.Utils.in_array(arr[arr.length-1], this.Utils.whitespace)) {
|
||||||
|
arr.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
arr.push('\n');
|
||||||
|
for (var i=0; i<this.indent_level; i++) {
|
||||||
|
arr.push(this.indent_string);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.print_token = function (text) {
|
||||||
|
this.output.push(text);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.indent = function () {
|
||||||
|
this.indent_level++;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.unindent = function () {
|
||||||
|
if (this.indent_level > 0) {
|
||||||
|
this.indent_level--;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*_____________________--------------------_____________________*/
|
||||||
|
|
||||||
|
multi_parser = new Parser(); //wrapping functions Parser
|
||||||
|
multi_parser.printer(html_source, indent_character, indent_size, max_char, brace_style); //initialize starting values
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
var t = multi_parser.get_token();
|
||||||
|
multi_parser.token_text = t[0];
|
||||||
|
multi_parser.token_type = t[1];
|
||||||
|
|
||||||
|
if (multi_parser.token_type === 'TK_EOF') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (multi_parser.token_type) {
|
||||||
|
case 'TK_TAG_START':
|
||||||
|
multi_parser.print_newline(false, multi_parser.output);
|
||||||
|
multi_parser.print_token(multi_parser.token_text);
|
||||||
|
multi_parser.indent();
|
||||||
|
multi_parser.current_mode = 'CONTENT';
|
||||||
|
break;
|
||||||
|
case 'TK_TAG_STYLE':
|
||||||
|
case 'TK_TAG_SCRIPT':
|
||||||
|
multi_parser.print_newline(false, multi_parser.output);
|
||||||
|
multi_parser.print_token(multi_parser.token_text);
|
||||||
|
multi_parser.current_mode = 'CONTENT';
|
||||||
|
break;
|
||||||
|
case 'TK_TAG_END':
|
||||||
|
//Print new line only if the tag has no content and has child
|
||||||
|
if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
|
||||||
|
var tag_name = multi_parser.token_text.match(/\w+/)[0];
|
||||||
|
var tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length -1].match(/<\s*(\w+)/);
|
||||||
|
if (tag_extracted_from_last_output === null || tag_extracted_from_last_output[1] !== tag_name) {
|
||||||
|
multi_parser.print_newline(true, multi_parser.output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
multi_parser.print_token(multi_parser.token_text);
|
||||||
|
multi_parser.current_mode = 'CONTENT';
|
||||||
|
break;
|
||||||
|
case 'TK_TAG_SINGLE':
|
||||||
|
// Don't add a newline before elements that should remain unformatted.
|
||||||
|
var tag_check = multi_parser.token_text.match(/^\s*<([a-z]+)/i);
|
||||||
|
if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)){
|
||||||
|
multi_parser.print_newline(false, multi_parser.output);
|
||||||
|
}
|
||||||
|
multi_parser.print_token(multi_parser.token_text);
|
||||||
|
multi_parser.current_mode = 'CONTENT';
|
||||||
|
break;
|
||||||
|
case 'TK_CONTENT':
|
||||||
|
if (multi_parser.token_text !== '') {
|
||||||
|
multi_parser.print_token(multi_parser.token_text);
|
||||||
|
}
|
||||||
|
multi_parser.current_mode = 'TAG';
|
||||||
|
break;
|
||||||
|
case 'TK_STYLE':
|
||||||
|
case 'TK_SCRIPT':
|
||||||
|
if (multi_parser.token_text !== '') {
|
||||||
|
multi_parser.output.push('\n');
|
||||||
|
var text = multi_parser.token_text,
|
||||||
|
_beautifier,
|
||||||
|
script_indent_level = 1;
|
||||||
|
if (multi_parser.token_type === 'TK_SCRIPT') {
|
||||||
|
_beautifier = typeof js_beautify === 'function' && js_beautify;
|
||||||
|
} else if (multi_parser.token_type === 'TK_STYLE') {
|
||||||
|
_beautifier = typeof css_beautify === 'function' && css_beautify;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.indent_scripts === "keep") {
|
||||||
|
script_indent_level = 0;
|
||||||
|
} else if (options.indent_scripts === "separate") {
|
||||||
|
script_indent_level = -multi_parser.indent_level;
|
||||||
|
}
|
||||||
|
|
||||||
|
var indentation = multi_parser.get_full_indent(script_indent_level);
|
||||||
|
if (_beautifier) {
|
||||||
|
// call the Beautifier if avaliable
|
||||||
|
text = _beautifier(text.replace(/^\s*/, indentation), options);
|
||||||
|
} else {
|
||||||
|
// simply indent the string otherwise
|
||||||
|
var white = text.match(/^\s*/)[0];
|
||||||
|
var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1;
|
||||||
|
var reindent = multi_parser.get_full_indent(script_indent_level -_level);
|
||||||
|
text = text.replace(/^\s*/, indentation)
|
||||||
|
.replace(/\r\n|\r|\n/g, '\n' + reindent)
|
||||||
|
.replace(/\s*$/, '');
|
||||||
|
}
|
||||||
|
if (text) {
|
||||||
|
multi_parser.print_token(text);
|
||||||
|
multi_parser.print_newline(true, multi_parser.output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
multi_parser.current_mode = 'TAG';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
multi_parser.last_token = multi_parser.token_type;
|
||||||
|
multi_parser.last_text = multi_parser.token_text;
|
||||||
|
}
|
||||||
|
return multi_parser.output.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're running a web page and don't have either of the above, add our one global
|
||||||
|
window.html_beautify = function(html_source, options) {
|
||||||
|
return style_html(html_source, options, window.js_beautify, window.css_beautify);
|
||||||
|
};
|
||||||
|
|
||||||
|
}());
|
|
@ -0,0 +1,620 @@
|
||||||
|
/*!
|
||||||
|
* jQuery blockUI plugin
|
||||||
|
* Version 2.70.0-2014.11.23
|
||||||
|
* Requires jQuery v1.7 or later
|
||||||
|
*
|
||||||
|
* Examples at: http://malsup.com/jquery/block/
|
||||||
|
* Copyright (c) 2007-2013 M. Alsup
|
||||||
|
* Dual licensed under the MIT and GPL licenses:
|
||||||
|
* http://www.opensource.org/licenses/mit-license.php
|
||||||
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
|
*
|
||||||
|
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
|
||||||
|
*/
|
||||||
|
|
||||||
|
;(function() {
|
||||||
|
/*jshint eqeqeq:false curly:false latedef:false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function setup($) {
|
||||||
|
$.fn._fadeIn = $.fn.fadeIn;
|
||||||
|
|
||||||
|
var noOp = $.noop || function() {};
|
||||||
|
|
||||||
|
// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
|
||||||
|
// confusing userAgent strings on Vista)
|
||||||
|
var msie = /MSIE/.test(navigator.userAgent);
|
||||||
|
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
|
||||||
|
var mode = document.documentMode || 0;
|
||||||
|
var setExpr = $.isFunction( document.createElement('div').style.setExpression );
|
||||||
|
|
||||||
|
// global $ methods for blocking/unblocking the entire page
|
||||||
|
$.blockUI = function(opts) { install(window, opts); };
|
||||||
|
$.unblockUI = function(opts) { remove(window, opts); };
|
||||||
|
|
||||||
|
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
|
||||||
|
$.growlUI = function(title, message, timeout, onClose) {
|
||||||
|
var $m = $('<div class="growlUI"></div>');
|
||||||
|
if (title) $m.append('<h1>'+title+'</h1>');
|
||||||
|
if (message) $m.append('<h2>'+message+'</h2>');
|
||||||
|
if (timeout === undefined) timeout = 3000;
|
||||||
|
|
||||||
|
// Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
|
||||||
|
var callBlock = function(opts) {
|
||||||
|
opts = opts || {};
|
||||||
|
|
||||||
|
$.blockUI({
|
||||||
|
message: $m,
|
||||||
|
fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
|
||||||
|
fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
|
||||||
|
timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
|
||||||
|
centerY: false,
|
||||||
|
showOverlay: false,
|
||||||
|
onUnblock: onClose,
|
||||||
|
css: $.blockUI.defaults.growlCSS
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
callBlock();
|
||||||
|
var nonmousedOpacity = $m.css('opacity');
|
||||||
|
$m.mouseover(function() {
|
||||||
|
callBlock({
|
||||||
|
fadeIn: 0,
|
||||||
|
timeout: 30000
|
||||||
|
});
|
||||||
|
|
||||||
|
var displayBlock = $('.blockMsg');
|
||||||
|
displayBlock.stop(); // cancel fadeout if it has started
|
||||||
|
displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
|
||||||
|
}).mouseout(function() {
|
||||||
|
$('.blockMsg').fadeOut(1000);
|
||||||
|
});
|
||||||
|
// End konapun additions
|
||||||
|
};
|
||||||
|
|
||||||
|
// plugin method for blocking element content
|
||||||
|
$.fn.block = function(opts) {
|
||||||
|
if ( this[0] === window ) {
|
||||||
|
$.blockUI( opts );
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
|
||||||
|
this.each(function() {
|
||||||
|
var $el = $(this);
|
||||||
|
if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
|
||||||
|
return;
|
||||||
|
$el.unblock({ fadeOut: 0 });
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.each(function() {
|
||||||
|
if ($.css(this,'position') == 'static') {
|
||||||
|
this.style.position = 'relative';
|
||||||
|
$(this).data('blockUI.static', true);
|
||||||
|
}
|
||||||
|
this.style.zoom = 1; // force 'hasLayout' in ie
|
||||||
|
install(this, opts);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// plugin method for unblocking element content
|
||||||
|
$.fn.unblock = function(opts) {
|
||||||
|
if ( this[0] === window ) {
|
||||||
|
$.unblockUI( opts );
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return this.each(function() {
|
||||||
|
remove(this, opts);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$.blockUI.version = 2.70; // 2nd generation blocking at no extra cost!
|
||||||
|
|
||||||
|
// override these in your code to change the default behavior and style
|
||||||
|
$.blockUI.defaults = {
|
||||||
|
// message displayed when blocking (use null for no message)
|
||||||
|
message: '<div class="loaderbox"><div class="loading-activity"></div> 加载中......</div>',
|
||||||
|
|
||||||
|
title: null, // title string; only used when theme == true
|
||||||
|
draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
|
||||||
|
|
||||||
|
theme: false, // set to true to use with jQuery UI themes
|
||||||
|
|
||||||
|
// styles for the message when blocking; if you wish to disable
|
||||||
|
// these and use an external stylesheet then do this in your code:
|
||||||
|
// $.blockUI.defaults.css = {};
|
||||||
|
css: {
|
||||||
|
padding: 0,
|
||||||
|
margin: 0,
|
||||||
|
width: '30%',
|
||||||
|
top: '40%',
|
||||||
|
left: '35%',
|
||||||
|
textAlign: 'center',
|
||||||
|
color: '#000',
|
||||||
|
border: '0px',
|
||||||
|
backgroundColor:'transparent',
|
||||||
|
cursor: 'wait'
|
||||||
|
},
|
||||||
|
|
||||||
|
// minimal style set used when themes are used
|
||||||
|
themedCSS: {
|
||||||
|
width: '30%',
|
||||||
|
top: '40%',
|
||||||
|
left: '35%'
|
||||||
|
},
|
||||||
|
|
||||||
|
// styles for the overlay
|
||||||
|
overlayCSS: {
|
||||||
|
backgroundColor: '#000',
|
||||||
|
opacity: 0.6,
|
||||||
|
cursor: 'wait'
|
||||||
|
},
|
||||||
|
|
||||||
|
// style to replace wait cursor before unblocking to correct issue
|
||||||
|
// of lingering wait cursor
|
||||||
|
cursorReset: 'default',
|
||||||
|
|
||||||
|
// styles applied when using $.growlUI
|
||||||
|
growlCSS: {
|
||||||
|
width: '350px',
|
||||||
|
top: '10px',
|
||||||
|
left: '',
|
||||||
|
right: '10px',
|
||||||
|
border: 'none',
|
||||||
|
padding: '5px',
|
||||||
|
opacity: 0.6,
|
||||||
|
cursor: 'default',
|
||||||
|
color: '#fff',
|
||||||
|
backgroundColor: '#000',
|
||||||
|
'-webkit-border-radius':'10px',
|
||||||
|
'-moz-border-radius': '10px',
|
||||||
|
'border-radius': '10px'
|
||||||
|
},
|
||||||
|
|
||||||
|
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
|
||||||
|
// (hat tip to Jorge H. N. de Vasconcelos)
|
||||||
|
/*jshint scripturl:true */
|
||||||
|
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
|
||||||
|
|
||||||
|
// force usage of iframe in non-IE browsers (handy for blocking applets)
|
||||||
|
forceIframe: false,
|
||||||
|
|
||||||
|
// z-index for the blocking overlay
|
||||||
|
baseZ: 1000,
|
||||||
|
|
||||||
|
// set these to true to have the message automatically centered
|
||||||
|
centerX: true, // <-- only effects element blocking (page block controlled via css above)
|
||||||
|
centerY: true,
|
||||||
|
|
||||||
|
// allow body element to be stetched in ie6; this makes blocking look better
|
||||||
|
// on "short" pages. disable if you wish to prevent changes to the body height
|
||||||
|
allowBodyStretch: true,
|
||||||
|
|
||||||
|
// enable if you want key and mouse events to be disabled for content that is blocked
|
||||||
|
bindEvents: true,
|
||||||
|
|
||||||
|
// be default blockUI will supress tab navigation from leaving blocking content
|
||||||
|
// (if bindEvents is true)
|
||||||
|
constrainTabKey: true,
|
||||||
|
|
||||||
|
// fadeIn time in millis; set to 0 to disable fadeIn on block
|
||||||
|
fadeIn: 200,
|
||||||
|
|
||||||
|
// fadeOut time in millis; set to 0 to disable fadeOut on unblock
|
||||||
|
fadeOut: 400,
|
||||||
|
|
||||||
|
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
|
||||||
|
timeout: 0,
|
||||||
|
|
||||||
|
// disable if you don't want to show the overlay
|
||||||
|
showOverlay: true,
|
||||||
|
|
||||||
|
// if true, focus will be placed in the first available input field when
|
||||||
|
// page blocking
|
||||||
|
focusInput: true,
|
||||||
|
|
||||||
|
// elements that can receive focus
|
||||||
|
focusableElements: ':input:enabled:visible',
|
||||||
|
|
||||||
|
// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
|
||||||
|
// no longer needed in 2012
|
||||||
|
// applyPlatformOpacityRules: true,
|
||||||
|
|
||||||
|
// callback method invoked when fadeIn has completed and blocking message is visible
|
||||||
|
onBlock: null,
|
||||||
|
|
||||||
|
// callback method invoked when unblocking has completed; the callback is
|
||||||
|
// passed the element that has been unblocked (which is the window object for page
|
||||||
|
// blocks) and the options that were passed to the unblock call:
|
||||||
|
// onUnblock(element, options)
|
||||||
|
onUnblock: null,
|
||||||
|
|
||||||
|
// callback method invoked when the overlay area is clicked.
|
||||||
|
// setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
|
||||||
|
onOverlayClick: null,
|
||||||
|
|
||||||
|
// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
|
||||||
|
quirksmodeOffsetHack: 4,
|
||||||
|
|
||||||
|
// class name of the message block
|
||||||
|
blockMsgClass: 'blockMsg',
|
||||||
|
|
||||||
|
// if it is already blocked, then ignore it (don't unblock and reblock)
|
||||||
|
ignoreIfBlocked: false
|
||||||
|
};
|
||||||
|
|
||||||
|
// private data and functions follow...
|
||||||
|
|
||||||
|
var pageBlock = null;
|
||||||
|
var pageBlockEls = [];
|
||||||
|
|
||||||
|
function install(el, opts) {
|
||||||
|
var css, themedCSS;
|
||||||
|
var full = (el == window);
|
||||||
|
var msg = (opts && opts.message !== undefined ? opts.message : undefined);
|
||||||
|
opts = $.extend({}, $.blockUI.defaults, opts || {});
|
||||||
|
|
||||||
|
if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
|
||||||
|
return;
|
||||||
|
|
||||||
|
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
|
||||||
|
css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
|
||||||
|
if (opts.onOverlayClick)
|
||||||
|
opts.overlayCSS.cursor = 'pointer';
|
||||||
|
|
||||||
|
themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
|
||||||
|
msg = msg === undefined ? opts.message : msg;
|
||||||
|
|
||||||
|
// remove the current block (if there is one)
|
||||||
|
if (full && pageBlock)
|
||||||
|
remove(window, {fadeOut:0});
|
||||||
|
|
||||||
|
// if an existing element is being used as the blocking content then we capture
|
||||||
|
// its current place in the DOM (and current display style) so we can restore
|
||||||
|
// it when we unblock
|
||||||
|
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
|
||||||
|
var node = msg.jquery ? msg[0] : msg;
|
||||||
|
var data = {};
|
||||||
|
$(el).data('blockUI.history', data);
|
||||||
|
data.el = node;
|
||||||
|
data.parent = node.parentNode;
|
||||||
|
data.display = node.style.display;
|
||||||
|
data.position = node.style.position;
|
||||||
|
if (data.parent)
|
||||||
|
data.parent.removeChild(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(el).data('blockUI.onUnblock', opts.onUnblock);
|
||||||
|
var z = opts.baseZ;
|
||||||
|
|
||||||
|
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
|
||||||
|
// layer1 is the iframe layer which is used to supress bleed through of underlying content
|
||||||
|
// layer2 is the overlay layer which has opacity and a wait cursor (by default)
|
||||||
|
// layer3 is the message content that is displayed while blocking
|
||||||
|
var lyr1, lyr2, lyr3, s;
|
||||||
|
if (msie || opts.forceIframe)
|
||||||
|
lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>');
|
||||||
|
else
|
||||||
|
lyr1 = $('<div class="blockUI" style="display:none"></div>');
|
||||||
|
|
||||||
|
if (opts.theme)
|
||||||
|
lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>');
|
||||||
|
else
|
||||||
|
lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
|
||||||
|
|
||||||
|
if (opts.theme && full) {
|
||||||
|
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
|
||||||
|
if ( opts.title ) {
|
||||||
|
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>';
|
||||||
|
}
|
||||||
|
s += '<div class="ui-widget-content ui-dialog-content"></div>';
|
||||||
|
s += '</div>';
|
||||||
|
}
|
||||||
|
else if (opts.theme) {
|
||||||
|
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
|
||||||
|
if ( opts.title ) {
|
||||||
|
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>';
|
||||||
|
}
|
||||||
|
s += '<div class="ui-widget-content ui-dialog-content"></div>';
|
||||||
|
s += '</div>';
|
||||||
|
}
|
||||||
|
else if (full) {
|
||||||
|
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
|
||||||
|
}
|
||||||
|
lyr3 = $(s);
|
||||||
|
|
||||||
|
// if we have a message, style it
|
||||||
|
if (msg) {
|
||||||
|
if (opts.theme) {
|
||||||
|
lyr3.css(themedCSS);
|
||||||
|
lyr3.addClass('ui-widget-content');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lyr3.css(css);
|
||||||
|
}
|
||||||
|
|
||||||
|
// style the overlay
|
||||||
|
if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
|
||||||
|
lyr2.css(opts.overlayCSS);
|
||||||
|
lyr2.css('position', full ? 'fixed' : 'absolute');
|
||||||
|
|
||||||
|
// make iframe layer transparent in IE
|
||||||
|
if (msie || opts.forceIframe)
|
||||||
|
lyr1.css('opacity',0.0);
|
||||||
|
|
||||||
|
//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
|
||||||
|
var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
|
||||||
|
$.each(layers, function() {
|
||||||
|
this.appendTo($par);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (opts.theme && opts.draggable && $.fn.draggable) {
|
||||||
|
lyr3.draggable({
|
||||||
|
handle: '.ui-dialog-titlebar',
|
||||||
|
cancel: 'li'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
|
||||||
|
var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
|
||||||
|
if (ie6 || expr) {
|
||||||
|
// give body 100% height
|
||||||
|
if (full && opts.allowBodyStretch && $.support.boxModel)
|
||||||
|
$('html,body').css('height','100%');
|
||||||
|
|
||||||
|
// fix ie6 issue when blocked element has a border width
|
||||||
|
if ((ie6 || !$.support.boxModel) && !full) {
|
||||||
|
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
|
||||||
|
var fixT = t ? '(0 - '+t+')' : 0;
|
||||||
|
var fixL = l ? '(0 - '+l+')' : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// simulate fixed position
|
||||||
|
$.each(layers, function(i,o) {
|
||||||
|
var s = o[0].style;
|
||||||
|
s.position = 'absolute';
|
||||||
|
if (i < 2) {
|
||||||
|
if (full)
|
||||||
|
s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
|
||||||
|
else
|
||||||
|
s.setExpression('height','this.parentNode.offsetHeight + "px"');
|
||||||
|
if (full)
|
||||||
|
s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
|
||||||
|
else
|
||||||
|
s.setExpression('width','this.parentNode.offsetWidth + "px"');
|
||||||
|
if (fixL) s.setExpression('left', fixL);
|
||||||
|
if (fixT) s.setExpression('top', fixT);
|
||||||
|
}
|
||||||
|
else if (opts.centerY) {
|
||||||
|
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
|
||||||
|
s.marginTop = 0;
|
||||||
|
}
|
||||||
|
else if (!opts.centerY && full) {
|
||||||
|
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
|
||||||
|
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
|
||||||
|
s.setExpression('top',expression);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// show the message
|
||||||
|
if (msg) {
|
||||||
|
if (opts.theme)
|
||||||
|
lyr3.find('.ui-widget-content').append(msg);
|
||||||
|
else
|
||||||
|
lyr3.append(msg);
|
||||||
|
if (msg.jquery || msg.nodeType)
|
||||||
|
$(msg).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((msie || opts.forceIframe) && opts.showOverlay)
|
||||||
|
lyr1.show(); // opacity is zero
|
||||||
|
if (opts.fadeIn) {
|
||||||
|
var cb = opts.onBlock ? opts.onBlock : noOp;
|
||||||
|
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
|
||||||
|
var cb2 = msg ? cb : noOp;
|
||||||
|
if (opts.showOverlay)
|
||||||
|
lyr2._fadeIn(opts.fadeIn, cb1);
|
||||||
|
if (msg)
|
||||||
|
lyr3._fadeIn(opts.fadeIn, cb2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (opts.showOverlay)
|
||||||
|
lyr2.show();
|
||||||
|
if (msg)
|
||||||
|
lyr3.show();
|
||||||
|
if (opts.onBlock)
|
||||||
|
opts.onBlock.bind(lyr3)();
|
||||||
|
}
|
||||||
|
|
||||||
|
// bind key and mouse events
|
||||||
|
bind(1, el, opts);
|
||||||
|
|
||||||
|
if (full) {
|
||||||
|
pageBlock = lyr3[0];
|
||||||
|
pageBlockEls = $(opts.focusableElements,pageBlock);
|
||||||
|
if (opts.focusInput)
|
||||||
|
setTimeout(focus, 20);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
center(lyr3[0], opts.centerX, opts.centerY);
|
||||||
|
|
||||||
|
if (opts.timeout) {
|
||||||
|
// auto-unblock
|
||||||
|
var to = setTimeout(function() {
|
||||||
|
if (full)
|
||||||
|
$.unblockUI(opts);
|
||||||
|
else
|
||||||
|
$(el).unblock(opts);
|
||||||
|
}, opts.timeout);
|
||||||
|
$(el).data('blockUI.timeout', to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the block
|
||||||
|
function remove(el, opts) {
|
||||||
|
var count;
|
||||||
|
var full = (el == window);
|
||||||
|
var $el = $(el);
|
||||||
|
var data = $el.data('blockUI.history');
|
||||||
|
var to = $el.data('blockUI.timeout');
|
||||||
|
if (to) {
|
||||||
|
clearTimeout(to);
|
||||||
|
$el.removeData('blockUI.timeout');
|
||||||
|
}
|
||||||
|
opts = $.extend({}, $.blockUI.defaults, opts || {});
|
||||||
|
bind(0, el, opts); // unbind events
|
||||||
|
|
||||||
|
if (opts.onUnblock === null) {
|
||||||
|
opts.onUnblock = $el.data('blockUI.onUnblock');
|
||||||
|
$el.removeData('blockUI.onUnblock');
|
||||||
|
}
|
||||||
|
|
||||||
|
var els;
|
||||||
|
if (full) // crazy selector to handle odd field errors in ie6/7
|
||||||
|
els = $('body').children().filter('.blockUI').add('body > .blockUI');
|
||||||
|
else
|
||||||
|
els = $el.find('>.blockUI');
|
||||||
|
|
||||||
|
// fix cursor issue
|
||||||
|
if ( opts.cursorReset ) {
|
||||||
|
if ( els.length > 1 )
|
||||||
|
els[1].style.cursor = opts.cursorReset;
|
||||||
|
if ( els.length > 2 )
|
||||||
|
els[2].style.cursor = opts.cursorReset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (full)
|
||||||
|
pageBlock = pageBlockEls = null;
|
||||||
|
|
||||||
|
if (opts.fadeOut) {
|
||||||
|
count = els.length;
|
||||||
|
els.stop().fadeOut(opts.fadeOut, function() {
|
||||||
|
if ( --count === 0)
|
||||||
|
reset(els,data,opts,el);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
reset(els, data, opts, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
// move blocking element back into the DOM where it started
|
||||||
|
function reset(els,data,opts,el) {
|
||||||
|
var $el = $(el);
|
||||||
|
if ( $el.data('blockUI.isBlocked') )
|
||||||
|
return;
|
||||||
|
|
||||||
|
els.each(function(i,o) {
|
||||||
|
// remove via DOM calls so we don't lose event handlers
|
||||||
|
if (this.parentNode)
|
||||||
|
this.parentNode.removeChild(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data && data.el) {
|
||||||
|
data.el.style.display = data.display;
|
||||||
|
data.el.style.position = data.position;
|
||||||
|
data.el.style.cursor = 'default'; // #59
|
||||||
|
if (data.parent)
|
||||||
|
data.parent.appendChild(data.el);
|
||||||
|
$el.removeData('blockUI.history');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($el.data('blockUI.static')) {
|
||||||
|
$el.css('position', 'static'); // #22
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof opts.onUnblock == 'function')
|
||||||
|
opts.onUnblock(el,opts);
|
||||||
|
|
||||||
|
// fix issue in Safari 6 where block artifacts remain until reflow
|
||||||
|
var body = $(document.body), w = body.width(), cssW = body[0].style.width;
|
||||||
|
body.width(w-1).width(w);
|
||||||
|
body[0].style.width = cssW;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bind/unbind the handler
|
||||||
|
function bind(b, el, opts) {
|
||||||
|
var full = el == window, $el = $(el);
|
||||||
|
|
||||||
|
// don't bother unbinding if there is nothing to unbind
|
||||||
|
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$el.data('blockUI.isBlocked', b);
|
||||||
|
|
||||||
|
// don't bind events when overlay is not in use or if bindEvents is false
|
||||||
|
if (!full || !opts.bindEvents || (b && !opts.showOverlay))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// bind anchors and inputs for mouse and key events
|
||||||
|
var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
|
||||||
|
if (b)
|
||||||
|
$(document).bind(events, opts, handler);
|
||||||
|
else
|
||||||
|
$(document).unbind(events, handler);
|
||||||
|
|
||||||
|
// former impl...
|
||||||
|
// var $e = $('a,:input');
|
||||||
|
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
// event handler to suppress keyboard/mouse events when blocking
|
||||||
|
function handler(e) {
|
||||||
|
// allow tab navigation (conditionally)
|
||||||
|
if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
|
||||||
|
if (pageBlock && e.data.constrainTabKey) {
|
||||||
|
var els = pageBlockEls;
|
||||||
|
var fwd = !e.shiftKey && e.target === els[els.length-1];
|
||||||
|
var back = e.shiftKey && e.target === els[0];
|
||||||
|
if (fwd || back) {
|
||||||
|
setTimeout(function(){focus(back);},10);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var opts = e.data;
|
||||||
|
var target = $(e.target);
|
||||||
|
if (target.hasClass('blockOverlay') && opts.onOverlayClick)
|
||||||
|
opts.onOverlayClick(e);
|
||||||
|
|
||||||
|
// allow events within the message content
|
||||||
|
if (target.parents('div.' + opts.blockMsgClass).length > 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// allow events for content that is not being blocked
|
||||||
|
return target.parents().children().filter('div.blockUI').length === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function focus(back) {
|
||||||
|
if (!pageBlockEls)
|
||||||
|
return;
|
||||||
|
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
|
||||||
|
if (e)
|
||||||
|
e.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function center(el, x, y) {
|
||||||
|
var p = el.parentNode, s = el.style;
|
||||||
|
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
|
||||||
|
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
|
||||||
|
if (x) s.left = l > 0 ? (l+'px') : '0';
|
||||||
|
if (y) s.top = t > 0 ? (t+'px') : '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
function sz(el, p) {
|
||||||
|
return parseInt($.css(el,p),10)||0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*global define:true */
|
||||||
|
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
|
||||||
|
define(['jquery'], setup);
|
||||||
|
} else {
|
||||||
|
setup(jQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
|
@ -0,0 +1,671 @@
|
||||||
|
/*!
|
||||||
|
* bootstrap-fileinput v5.2.4
|
||||||
|
* http://plugins.krajee.com/file-input
|
||||||
|
*
|
||||||
|
* Krajee default styling for bootstrap-fileinput.
|
||||||
|
*
|
||||||
|
* Author: Kartik Visweswaran
|
||||||
|
* Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com
|
||||||
|
*
|
||||||
|
* Licensed under the BSD-3-Clause
|
||||||
|
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
|
||||||
|
*/
|
||||||
|
|
||||||
|
.file-loading input[type=file],
|
||||||
|
input[type=file].file-loading {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-no-browse {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 20%;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
font-size: 0;
|
||||||
|
opacity: 0;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kv-hidden,
|
||||||
|
.file-caption-icon,
|
||||||
|
.file-zoom-dialog .modal-header:before,
|
||||||
|
.file-zoom-dialog .modal-header:after,
|
||||||
|
.file-input-new .file-preview,
|
||||||
|
.file-input-new .close,
|
||||||
|
.file-input-new .glyphicon-file,
|
||||||
|
.file-input-new .fileinput-remove-button,
|
||||||
|
.file-input-new .fileinput-upload-button,
|
||||||
|
.file-input-new .no-browse .input-group-btn,
|
||||||
|
.file-input-ajax-new .fileinput-remove-button,
|
||||||
|
.file-input-ajax-new .fileinput-upload-button,
|
||||||
|
.file-input-ajax-new .no-browse .input-group-btn,
|
||||||
|
.hide-content .kv-file-content,
|
||||||
|
.is-locked .fileinput-upload-button,
|
||||||
|
.is-locked .fileinput-remove-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-file input[type=file],
|
||||||
|
.file-caption-icon,
|
||||||
|
.file-preview .fileinput-remove,
|
||||||
|
.krajee-default .file-thumb-progress,
|
||||||
|
.file-zoom-dialog .btn-navigate,
|
||||||
|
.file-zoom-dialog .floating-buttons {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption-icon .kv-caption-icon {
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-input,
|
||||||
|
.file-loading:before,
|
||||||
|
.btn-file,
|
||||||
|
.file-caption,
|
||||||
|
.file-preview,
|
||||||
|
.krajee-default.file-preview-frame,
|
||||||
|
.krajee-default .file-thumbnail-footer,
|
||||||
|
.file-zoom-dialog .modal-dialog {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-error-message pre,
|
||||||
|
.file-error-message ul,
|
||||||
|
.krajee-default .file-actions,
|
||||||
|
.krajee-default .file-other-error {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-error-message pre,
|
||||||
|
.file-error-message ul {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-drag-handle,
|
||||||
|
.krajee-default .file-upload-indicator {
|
||||||
|
float: left;
|
||||||
|
margin-top: 10px;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-thumb-progress .progress,
|
||||||
|
.file-thumb-progress .progress-bar {
|
||||||
|
font-family: Verdana, Helvetica, sans-serif;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-thumb-progress .progress,
|
||||||
|
.kv-upload-progress .progress {
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-caption-info,
|
||||||
|
.krajee-default .file-size-info {
|
||||||
|
display: block;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 160px;
|
||||||
|
height: 15px;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content > .file-object.type-video,
|
||||||
|
.file-zoom-content > .file-object.type-flash,
|
||||||
|
.file-zoom-content > .file-object.type-image {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content > .file-object.type-video,
|
||||||
|
.file-zoom-content > .file-object.type-flash {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content > .file-object.type-pdf,
|
||||||
|
.file-zoom-content > .file-object.type-html,
|
||||||
|
.file-zoom-content > .file-object.type-text,
|
||||||
|
.file-zoom-content > .file-object.type-default {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-loading:before {
|
||||||
|
content: " Loading...";
|
||||||
|
display: inline-block;
|
||||||
|
padding-left: 20px;
|
||||||
|
line-height: 16px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-variant: small-caps;
|
||||||
|
color: #999;
|
||||||
|
background: transparent url(loading.gif) top left no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-object {
|
||||||
|
margin: 0 0 -5px 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-file {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-file input[type=file] {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
min-width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
text-align: right;
|
||||||
|
opacity: 0;
|
||||||
|
background: none repeat scroll 0 0 transparent;
|
||||||
|
cursor: inherit;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-file ::-ms-browse {
|
||||||
|
font-size: 10000px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption.icon-visible .file-caption-icon {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption.icon-visible .file-caption-name {
|
||||||
|
padding-left: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption.icon-visible > .input-group-lg .file-caption-name {
|
||||||
|
padding-left: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption.icon-visible > .input-group-sm .file-caption-name {
|
||||||
|
padding-left: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption-name:not(.file-caption-disabled) {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption-name.file-processing {
|
||||||
|
font-style: italic;
|
||||||
|
border-color: #bbb;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption-icon {
|
||||||
|
padding: 7px 5px;
|
||||||
|
left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group-lg .file-caption-icon {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group-sm .file-caption-icon {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-error-message {
|
||||||
|
color: #a94442;
|
||||||
|
background-color: #f2dede;
|
||||||
|
margin: 5px;
|
||||||
|
border: 1px solid #ebccd1;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-error-message pre {
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption-disabled {
|
||||||
|
background-color: #eee;
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-preview {
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 8px;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-preview .btn-xs {
|
||||||
|
padding: 1px 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-preview .fileinput-remove {
|
||||||
|
top: 1px;
|
||||||
|
right: 1px;
|
||||||
|
line-height: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-preview .clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-preview-image {
|
||||||
|
font: 40px Impact, Charcoal, sans-serif;
|
||||||
|
color: #008000;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default.file-preview-frame {
|
||||||
|
margin: 8px;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||||
|
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
padding: 6px;
|
||||||
|
float: left;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default.file-preview-frame .kv-file-content {
|
||||||
|
width: 213px;
|
||||||
|
height: 160px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-preview-other-frame {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default.file-preview-frame[data-template="audio"] .kv-file-content {
|
||||||
|
width: 240px;
|
||||||
|
height: 55px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default.file-preview-frame .file-thumbnail-footer {
|
||||||
|
height: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default.file-preview-frame:not(.file-preview-error):hover {
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
|
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-preview-text {
|
||||||
|
color: #428bca;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
outline: none;
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-preview-html {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-other-icon {
|
||||||
|
font-size: 6em;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-footer-buttons {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-footer-caption {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 4px;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #777;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-upload-stats {
|
||||||
|
font-size: 10px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kv-upload-progress .file-upload-stats {
|
||||||
|
font-size: 12px;
|
||||||
|
margin: -10px 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-preview-error {
|
||||||
|
opacity: 0.65;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-thumb-progress {
|
||||||
|
top: 37px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default.kvsortable-ghost {
|
||||||
|
background: #e1edf7;
|
||||||
|
border: 2px solid #a1abff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-preview-other:hover {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kv-upload-progress .progress {
|
||||||
|
height: 20px;
|
||||||
|
margin: 10px 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kv-upload-progress .progress-bar {
|
||||||
|
height: 20px;
|
||||||
|
font-family: Verdana, Helvetica, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*noinspection CssOverwrittenProperties*/
|
||||||
|
|
||||||
|
.file-zoom-dialog .file-other-icon {
|
||||||
|
font-size: 22em;
|
||||||
|
font-size: 50vmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .modal-dialog {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .modal-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .btn-navigate {
|
||||||
|
margin: 0 0.1rem;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
width: 2.4rem;
|
||||||
|
height: 2.4rem;
|
||||||
|
top: 50%;
|
||||||
|
border-radius: 50%;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-navigate * {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .floating-buttons {
|
||||||
|
top: 5px;
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .btn-kv-prev {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .btn-kv-next {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .kv-zoom-caption {
|
||||||
|
max-width: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .kv-zoom-header {
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .kv-zoom-body {
|
||||||
|
padding: 0.25rem 0.5rem 0.25rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .kv-zoom-description {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0.8;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
padding: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
color: #fff;
|
||||||
|
left: 15%;
|
||||||
|
right: 15%;
|
||||||
|
bottom: 15%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .kv-desc-hide {
|
||||||
|
float: right;
|
||||||
|
color: #fff;
|
||||||
|
padding: 0 0.1rem;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .kv-desc-hide:hover {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .kv-desc-hide:focus {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-input-new .no-browse .form-control {
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-input-ajax-new .no-browse .form-control {
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-caption {
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-thumb-loading {
|
||||||
|
background: transparent url(loading.gif) no-repeat scroll center center content-box !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-drop-zone {
|
||||||
|
border: 1px dashed #aaa;
|
||||||
|
min-height: 260px;
|
||||||
|
border-radius: 4px;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 12px 15px 12px 12px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-drop-zone.clickable:hover {
|
||||||
|
border: 2px dashed #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-drop-zone.clickable:focus {
|
||||||
|
border: 2px solid #5acde2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-drop-zone .file-preview-thumbnails {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-drop-zone-title {
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 1.6em;
|
||||||
|
text-align: center;
|
||||||
|
padding: 85px 10px;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-highlighted {
|
||||||
|
border: 2px dashed #999 !important;
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-uploading {
|
||||||
|
background: url(loading-sm.gif) no-repeat center bottom 10px;
|
||||||
|
opacity: 0.65;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-fullscreen .modal-dialog {
|
||||||
|
min-width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-fullscreen .modal-content {
|
||||||
|
border-radius: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-fullscreen .kv-zoom-body {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.floating-buttons {
|
||||||
|
z-index: 3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.floating-buttons .btn-kv {
|
||||||
|
margin-left: 3px;
|
||||||
|
z-index: 3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kv-zoom-actions .btn-kv {
|
||||||
|
margin-left: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content {
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
min-height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content:hover {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content > * {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content .kv-spacer {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content .file-preview-image {
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content .file-preview-video {
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content > .file-object.type-image {
|
||||||
|
height: auto;
|
||||||
|
min-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-content > .file-object.type-audio {
|
||||||
|
width: auto;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 576px) {
|
||||||
|
.file-zoom-dialog .modal-dialog {
|
||||||
|
max-width: 500px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
.file-zoom-dialog .modal-lg {
|
||||||
|
max-width: 800px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
.file-preview-thumbnails {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-zoom-dialog .modal-header {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 350px) {
|
||||||
|
.krajee-default.file-preview-frame:not([data-template="audio"]) .kv-file-content {
|
||||||
|
width: 160px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 420px) {
|
||||||
|
.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-loading[dir=rtl]:before {
|
||||||
|
background: transparent url(loading.gif) top right no-repeat;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clickable .file-drop-zone-title {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-sortable .file-drag-handle:hover {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-sortable .file-drag-handle {
|
||||||
|
cursor: grab;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-grabbing,
|
||||||
|
.file-grabbing * {
|
||||||
|
cursor: not-allowed !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-grabbing .file-preview-thumbnails * {
|
||||||
|
cursor: grabbing !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-preview-frame.sortable-chosen {
|
||||||
|
background-color: #d9edf7;
|
||||||
|
border-color: #17a2b8;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-preview .kv-zoom-cache {
|
||||||
|
display: none;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
12
alive-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css
vendored
Normal file
12
alive-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
11
alive-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js
vendored
Normal file
11
alive-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 847 B |
459
alive-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css
vendored
Normal file
459
alive-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css
vendored
Normal file
|
@ -0,0 +1,459 @@
|
||||||
|
/*!
|
||||||
|
* Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select)
|
||||||
|
*
|
||||||
|
* Copyright 2012-2020 SnapAppointments, LLC
|
||||||
|
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
|
||||||
|
*/
|
||||||
|
|
||||||
|
@-webkit-keyframes bs-notify-fadeOut {
|
||||||
|
0% {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@-o-keyframes bs-notify-fadeOut {
|
||||||
|
0% {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes bs-notify-fadeOut {
|
||||||
|
0% {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
select.bs-select-hidden,
|
||||||
|
.bootstrap-select > select.bs-select-hidden,
|
||||||
|
select.selectpicker {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
.bootstrap-select {
|
||||||
|
width: 220px \0;
|
||||||
|
/*IE9 and below*/
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.bootstrap-select > .dropdown-toggle {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
text-align: right;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: -webkit-inline-box;
|
||||||
|
display: -webkit-inline-flex;
|
||||||
|
display: -ms-inline-flexbox;
|
||||||
|
display: inline-flex;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
-webkit-box-pack: justify;
|
||||||
|
-webkit-justify-content: space-between;
|
||||||
|
-ms-flex-pack: justify;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.bootstrap-select > .dropdown-toggle:after {
|
||||||
|
margin-top: -1px;
|
||||||
|
}
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder:hover,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder:focus,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder:active {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:hover,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:hover,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:hover,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:hover,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:hover,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:hover,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:focus,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:focus,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:focus,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:focus,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:focus,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:focus,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:active,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:active,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:active,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:active,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:active,
|
||||||
|
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:active {
|
||||||
|
color: rgba(255, 255, 255, 0.5);
|
||||||
|
}
|
||||||
|
.bootstrap-select > select {
|
||||||
|
position: absolute !important;
|
||||||
|
bottom: 0;
|
||||||
|
left: 50%;
|
||||||
|
display: block !important;
|
||||||
|
width: 0.5px !important;
|
||||||
|
height: 100% !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
opacity: 0 !important;
|
||||||
|
border: none;
|
||||||
|
z-index: 0 !important;
|
||||||
|
}
|
||||||
|
.bootstrap-select > select.mobile-device {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
display: block !important;
|
||||||
|
width: 100% !important;
|
||||||
|
z-index: 2 !important;
|
||||||
|
}
|
||||||
|
.has-error .bootstrap-select .dropdown-toggle,
|
||||||
|
.error .bootstrap-select .dropdown-toggle,
|
||||||
|
.bootstrap-select.is-invalid .dropdown-toggle,
|
||||||
|
.was-validated .bootstrap-select select:invalid + .dropdown-toggle {
|
||||||
|
border-color: #b94a48;
|
||||||
|
}
|
||||||
|
.bootstrap-select.is-valid .dropdown-toggle,
|
||||||
|
.was-validated .bootstrap-select select:valid + .dropdown-toggle {
|
||||||
|
border-color: #28a745;
|
||||||
|
}
|
||||||
|
.bootstrap-select.fit-width {
|
||||||
|
width: auto !important;
|
||||||
|
}
|
||||||
|
.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
|
||||||
|
width: 220px;
|
||||||
|
}
|
||||||
|
.bootstrap-select > select.mobile-device:focus + .dropdown-toggle,
|
||||||
|
.bootstrap-select .dropdown-toggle:focus {
|
||||||
|
outline: thin dotted #333333 !important;
|
||||||
|
outline: 5px auto -webkit-focus-ring-color !important;
|
||||||
|
outline-offset: -2px;
|
||||||
|
}
|
||||||
|
.bootstrap-select.form-control {
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: none;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
:not(.input-group) > .bootstrap-select.form-control:not([class*="col-"]) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.bootstrap-select.form-control.input-group-btn {
|
||||||
|
float: none;
|
||||||
|
z-index: auto;
|
||||||
|
}
|
||||||
|
.form-inline .bootstrap-select,
|
||||||
|
.form-inline .bootstrap-select.form-control:not([class*="col-"]) {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.bootstrap-select:not(.input-group-btn),
|
||||||
|
.bootstrap-select[class*="col-"] {
|
||||||
|
float: none;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
.bootstrap-select.dropdown-menu-right,
|
||||||
|
.bootstrap-select[class*="col-"].dropdown-menu-right,
|
||||||
|
.row .bootstrap-select[class*="col-"].dropdown-menu-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.form-inline .bootstrap-select,
|
||||||
|
.form-horizontal .bootstrap-select,
|
||||||
|
.form-group .bootstrap-select {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.form-group-lg .bootstrap-select.form-control,
|
||||||
|
.form-group-sm .bootstrap-select.form-control {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.form-group-lg .bootstrap-select.form-control .dropdown-toggle,
|
||||||
|
.form-group-sm .bootstrap-select.form-control .dropdown-toggle {
|
||||||
|
height: 100%;
|
||||||
|
font-size: inherit;
|
||||||
|
line-height: inherit;
|
||||||
|
border-radius: inherit;
|
||||||
|
}
|
||||||
|
.bootstrap-select.form-control-sm .dropdown-toggle,
|
||||||
|
.bootstrap-select.form-control-lg .dropdown-toggle {
|
||||||
|
font-size: inherit;
|
||||||
|
line-height: inherit;
|
||||||
|
border-radius: inherit;
|
||||||
|
}
|
||||||
|
.bootstrap-select.form-control-sm .dropdown-toggle {
|
||||||
|
padding: 0.25rem 0.5rem;
|
||||||
|
}
|
||||||
|
.bootstrap-select.form-control-lg .dropdown-toggle {
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
}
|
||||||
|
.form-inline .bootstrap-select .form-control {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.bootstrap-select.disabled,
|
||||||
|
.bootstrap-select > .disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
.bootstrap-select.disabled:focus,
|
||||||
|
.bootstrap-select > .disabled:focus {
|
||||||
|
outline: none !important;
|
||||||
|
}
|
||||||
|
.bootstrap-select.bs-container {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
.bootstrap-select.bs-container .dropdown-menu {
|
||||||
|
z-index: 1060;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-toggle .filter-option {
|
||||||
|
position: static;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
float: left;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-box-flex: 0;
|
||||||
|
-webkit-flex: 0 1 auto;
|
||||||
|
-ms-flex: 0 1 auto;
|
||||||
|
flex: 0 1 auto;
|
||||||
|
}
|
||||||
|
.bs3.bootstrap-select .dropdown-toggle .filter-option {
|
||||||
|
padding-right: inherit;
|
||||||
|
}
|
||||||
|
.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option {
|
||||||
|
position: absolute;
|
||||||
|
padding-top: inherit;
|
||||||
|
padding-bottom: inherit;
|
||||||
|
padding-left: inherit;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option .filter-option-inner {
|
||||||
|
padding-right: inherit;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-toggle .filter-option-inner-inner {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-toggle .filter-expand {
|
||||||
|
width: 0 !important;
|
||||||
|
float: left;
|
||||||
|
opacity: 0 !important;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-toggle .caret {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
right: 12px;
|
||||||
|
margin-top: -2px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.input-group .bootstrap-select.form-control .dropdown-toggle {
|
||||||
|
border-radius: inherit;
|
||||||
|
}
|
||||||
|
.bootstrap-select[class*="col-"] .dropdown-toggle {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu {
|
||||||
|
min-width: 100%;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu > .inner:focus {
|
||||||
|
outline: none !important;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu.inner {
|
||||||
|
position: static;
|
||||||
|
float: none;
|
||||||
|
border: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu li {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu li.active small {
|
||||||
|
color: rgba(255, 255, 255, 0.5) !important;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu li.disabled a {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu li a {
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu li a.opt {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 2.25em;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu li a span.check-mark {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu li a span.text {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu li small {
|
||||||
|
padding-left: 0.5em;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu .notify {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 5px;
|
||||||
|
width: 96%;
|
||||||
|
margin: 0 2%;
|
||||||
|
min-height: 26px;
|
||||||
|
padding: 3px 5px;
|
||||||
|
background: #f5f5f5;
|
||||||
|
border: 1px solid #e3e3e3;
|
||||||
|
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||||
|
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0.9;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.bootstrap-select .dropdown-menu .notify.fadeOut {
|
||||||
|
-webkit-animation: 300ms linear 750ms forwards bs-notify-fadeOut;
|
||||||
|
-o-animation: 300ms linear 750ms forwards bs-notify-fadeOut;
|
||||||
|
animation: 300ms linear 750ms forwards bs-notify-fadeOut;
|
||||||
|
}
|
||||||
|
.bootstrap-select .no-results {
|
||||||
|
padding: 3px;
|
||||||
|
background: #f5f5f5;
|
||||||
|
margin: 0 5px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.bootstrap-select.fit-width .dropdown-toggle .filter-option {
|
||||||
|
position: static;
|
||||||
|
display: inline;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner,
|
||||||
|
.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner-inner {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.bootstrap-select.fit-width .dropdown-toggle .bs-caret:before {
|
||||||
|
content: '\00a0';
|
||||||
|
}
|
||||||
|
.bootstrap-select.fit-width .dropdown-toggle .caret {
|
||||||
|
position: static;
|
||||||
|
top: auto;
|
||||||
|
margin-top: -1px;
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-tick .dropdown-menu .selected span.check-mark {
|
||||||
|
position: absolute;
|
||||||
|
display: inline-block;
|
||||||
|
right: 15px;
|
||||||
|
top: 5px;
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-tick .dropdown-menu li a span.text {
|
||||||
|
margin-right: 34px;
|
||||||
|
}
|
||||||
|
.bootstrap-select .bs-ok-default:after {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
width: 0.5em;
|
||||||
|
height: 1em;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 0 0.26em 0.26em 0;
|
||||||
|
-webkit-transform-style: preserve-3d;
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
-ms-transform: rotate(45deg);
|
||||||
|
-o-transform: rotate(45deg);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle,
|
||||||
|
.bootstrap-select.show-menu-arrow.show > .dropdown-toggle {
|
||||||
|
z-index: 1061;
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:before {
|
||||||
|
content: '';
|
||||||
|
border-left: 7px solid transparent;
|
||||||
|
border-right: 7px solid transparent;
|
||||||
|
border-bottom: 7px solid rgba(204, 204, 204, 0.2);
|
||||||
|
position: absolute;
|
||||||
|
bottom: -4px;
|
||||||
|
left: 9px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:after {
|
||||||
|
content: '';
|
||||||
|
border-left: 6px solid transparent;
|
||||||
|
border-right: 6px solid transparent;
|
||||||
|
border-bottom: 6px solid white;
|
||||||
|
position: absolute;
|
||||||
|
bottom: -4px;
|
||||||
|
left: 10px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:before {
|
||||||
|
bottom: auto;
|
||||||
|
top: -4px;
|
||||||
|
border-top: 7px solid rgba(204, 204, 204, 0.2);
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:after {
|
||||||
|
bottom: auto;
|
||||||
|
top: -4px;
|
||||||
|
border-top: 6px solid white;
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:before {
|
||||||
|
right: 12px;
|
||||||
|
left: auto;
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:after {
|
||||||
|
right: 13px;
|
||||||
|
left: auto;
|
||||||
|
}
|
||||||
|
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:before,
|
||||||
|
.bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:before,
|
||||||
|
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:after,
|
||||||
|
.bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:after {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.bs-searchbox,
|
||||||
|
.bs-actionsbox,
|
||||||
|
.bs-donebutton {
|
||||||
|
padding: 4px 8px;
|
||||||
|
}
|
||||||
|
.bs-actionsbox {
|
||||||
|
width: 100%;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.bs-actionsbox .btn-group button {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
.bs-donebutton {
|
||||||
|
float: left;
|
||||||
|
width: 100%;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.bs-donebutton .btn-group button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.bs-searchbox + .bs-actionsbox {
|
||||||
|
padding: 0 8px 4px;
|
||||||
|
}
|
||||||
|
.bs-searchbox .form-control {
|
||||||
|
margin-bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
float: none;
|
||||||
|
}
|
3247
alive-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js
vendored
Normal file
3247
alive-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
alive-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css
vendored
Normal file
6
alive-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
8
alive-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js
vendored
Normal file
8
alive-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
alive-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css
vendored
Normal file
6
alive-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
6
alive-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js
vendored
Normal file
6
alive-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,95 @@
|
||||||
|
/**
|
||||||
|
* @author: Alec Fenichel
|
||||||
|
* @webSite: https://fenichelar.com
|
||||||
|
* @update: zhixin wen <wenzhixin2010@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Utils = $.fn.bootstrapTable.utils
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
|
autoRefresh: false,
|
||||||
|
showAutoRefresh: true,
|
||||||
|
autoRefreshInterval: 60,
|
||||||
|
autoRefreshSilent: true,
|
||||||
|
autoRefreshStatus: true,
|
||||||
|
autoRefreshFunction: null
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults.icons, {
|
||||||
|
autoRefresh: {
|
||||||
|
bootstrap3: 'glyphicon-time icon-time',
|
||||||
|
bootstrap5: 'bi-clock',
|
||||||
|
materialize: 'access_time',
|
||||||
|
'bootstrap-table': 'icon-clock'
|
||||||
|
}[$.fn.bootstrapTable.theme] || 'fa-clock'
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.locales, {
|
||||||
|
formatAutoRefresh () {
|
||||||
|
return 'Auto Refresh'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales)
|
||||||
|
|
||||||
|
$.BootstrapTable = class extends $.BootstrapTable {
|
||||||
|
init (...args) {
|
||||||
|
super.init(...args)
|
||||||
|
|
||||||
|
if (this.options.autoRefresh && this.options.autoRefreshStatus) {
|
||||||
|
this.setupRefreshInterval()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initToolbar (...args) {
|
||||||
|
if (this.options.autoRefresh) {
|
||||||
|
this.buttons = Object.assign(this.buttons, {
|
||||||
|
autoRefresh: {
|
||||||
|
html: `
|
||||||
|
<button class="auto-refresh ${this.constants.buttonsClass}
|
||||||
|
${this.options.autoRefreshStatus ? ` ${this.constants.classes.buttonActive}` : ''}"
|
||||||
|
type="button" name="autoRefresh" title="${this.options.formatAutoRefresh()}">
|
||||||
|
${ this.options.showButtonIcons ? Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.autoRefresh) : ''}
|
||||||
|
${ this.options.showButtonText ? this.options.formatAutoRefresh() : ''}
|
||||||
|
</button>
|
||||||
|
`,
|
||||||
|
event: this.toggleAutoRefresh
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
super.initToolbar(...args)
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleAutoRefresh () {
|
||||||
|
if (this.options.autoRefresh) {
|
||||||
|
if (this.options.autoRefreshStatus) {
|
||||||
|
clearInterval(this.options.autoRefreshFunction)
|
||||||
|
this.$toolbar.find('>.columns .auto-refresh')
|
||||||
|
.removeClass(this.constants.classes.buttonActive)
|
||||||
|
} else {
|
||||||
|
this.setupRefreshInterval()
|
||||||
|
this.$toolbar.find('>.columns .auto-refresh')
|
||||||
|
.addClass(this.constants.classes.buttonActive)
|
||||||
|
}
|
||||||
|
this.options.autoRefreshStatus = !this.options.autoRefreshStatus
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
destroy () {
|
||||||
|
if (this.options.autoRefresh && this.options.autoRefreshStatus) {
|
||||||
|
clearInterval(this.options.autoRefreshFunction)
|
||||||
|
}
|
||||||
|
|
||||||
|
super.destroy()
|
||||||
|
}
|
||||||
|
|
||||||
|
setupRefreshInterval () {
|
||||||
|
this.options.autoRefreshFunction = setInterval(() => {
|
||||||
|
if (!this.options.autoRefresh || !this.options.autoRefreshStatus) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.refresh({ silent: this.options.autoRefreshSilent })
|
||||||
|
}, this.options.autoRefreshInterval * 1000)
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,405 @@
|
||||||
|
/**
|
||||||
|
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Utils = $.fn.bootstrapTable.utils
|
||||||
|
|
||||||
|
// Reasonable defaults
|
||||||
|
const PIXEL_STEP = 10
|
||||||
|
const LINE_HEIGHT = 40
|
||||||
|
const PAGE_HEIGHT = 800
|
||||||
|
|
||||||
|
function normalizeWheel (event) {
|
||||||
|
let sX = 0 // spinX
|
||||||
|
let sY = 0 // spinY
|
||||||
|
let pX = 0 // pixelX
|
||||||
|
let pY = 0 // pixelY
|
||||||
|
|
||||||
|
// Legacy
|
||||||
|
if ('detail' in event) { sY = event.detail }
|
||||||
|
if ('wheelDelta' in event) { sY = -event.wheelDelta / 120 }
|
||||||
|
if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120 }
|
||||||
|
if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120 }
|
||||||
|
|
||||||
|
// side scrolling on FF with DOMMouseScroll
|
||||||
|
if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
|
||||||
|
sX = sY
|
||||||
|
sY = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
pX = sX * PIXEL_STEP
|
||||||
|
pY = sY * PIXEL_STEP
|
||||||
|
|
||||||
|
if ('deltaY' in event) { pY = event.deltaY }
|
||||||
|
if ('deltaX' in event) { pX = event.deltaX }
|
||||||
|
|
||||||
|
if ((pX || pY) && event.deltaMode) {
|
||||||
|
if (event.deltaMode === 1) { // delta in LINE units
|
||||||
|
pX *= LINE_HEIGHT
|
||||||
|
pY *= LINE_HEIGHT
|
||||||
|
} else { // delta in PAGE units
|
||||||
|
pX *= PAGE_HEIGHT
|
||||||
|
pY *= PAGE_HEIGHT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall-back if spin cannot be determined
|
||||||
|
if (pX && !sX) { sX = (pX < 1) ? -1 : 1 }
|
||||||
|
if (pY && !sY) { sY = (pY < 1) ? -1 : 1 }
|
||||||
|
|
||||||
|
return {
|
||||||
|
spinX: sX,
|
||||||
|
spinY: sY,
|
||||||
|
pixelX: pX,
|
||||||
|
pixelY: pY
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
|
fixedColumns: false,
|
||||||
|
fixedNumber: 0,
|
||||||
|
fixedRightNumber: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
$.BootstrapTable = class extends $.BootstrapTable {
|
||||||
|
|
||||||
|
fixedColumnsSupported () {
|
||||||
|
return this.options.fixedColumns &&
|
||||||
|
!this.options.detailView &&
|
||||||
|
!this.options.cardView
|
||||||
|
}
|
||||||
|
|
||||||
|
initContainer () {
|
||||||
|
super.initContainer()
|
||||||
|
|
||||||
|
if (!this.fixedColumnsSupported()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.options.fixedNumber) {
|
||||||
|
this.$tableContainer.append('<div class="fixed-columns"></div>')
|
||||||
|
this.$fixedColumns = this.$tableContainer.find('.fixed-columns')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.options.fixedRightNumber) {
|
||||||
|
this.$tableContainer.append('<div class="fixed-columns-right"></div>')
|
||||||
|
this.$fixedColumnsRight = this.$tableContainer.find('.fixed-columns-right')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initBody (...args) {
|
||||||
|
super.initBody(...args)
|
||||||
|
|
||||||
|
if (this.$fixedColumns && this.$fixedColumns.length) {
|
||||||
|
this.$fixedColumns.toggle(this.fixedColumnsSupported())
|
||||||
|
}
|
||||||
|
if (this.$fixedColumnsRight && this.$fixedColumnsRight.length) {
|
||||||
|
this.$fixedColumnsRight.toggle(this.fixedColumnsSupported())
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.fixedColumnsSupported()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.options.showHeader && this.options.height) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.initFixedColumnsBody()
|
||||||
|
this.initFixedColumnsEvents()
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger (...args) {
|
||||||
|
super.trigger(...args)
|
||||||
|
|
||||||
|
if (!this.fixedColumnsSupported()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0] === 'post-header') {
|
||||||
|
this.initFixedColumnsHeader()
|
||||||
|
} else if (args[0] === 'scroll-body') {
|
||||||
|
if (this.needFixedColumns && this.options.fixedNumber) {
|
||||||
|
this.$fixedBody.scrollTop(this.$tableBody.scrollTop())
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedRightNumber) {
|
||||||
|
this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSelected () {
|
||||||
|
super.updateSelected()
|
||||||
|
|
||||||
|
if (!this.fixedColumnsSupported()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$tableBody.find('tr').each((i, el) => {
|
||||||
|
const $el = $(el)
|
||||||
|
const index = $el.data('index')
|
||||||
|
const classes = $el.attr('class')
|
||||||
|
|
||||||
|
const inputSelector = `[name="${this.options.selectItemName}"]`
|
||||||
|
const $input = $el.find(inputSelector)
|
||||||
|
|
||||||
|
if (typeof index === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateFixedBody = ($fixedHeader, $fixedBody) => {
|
||||||
|
const $tr = $fixedBody.find(`tr[data-index="${index}"]`)
|
||||||
|
|
||||||
|
$tr.attr('class', classes)
|
||||||
|
|
||||||
|
if ($input.length) {
|
||||||
|
$tr.find(inputSelector).prop('checked', $input.prop('checked'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.$selectAll.length) {
|
||||||
|
$fixedHeader.add($fixedBody)
|
||||||
|
.find('[name="btSelectAll"]')
|
||||||
|
.prop('checked', this.$selectAll.prop('checked'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.$fixedBody && this.options.fixedNumber) {
|
||||||
|
updateFixedBody(this.$fixedHeader, this.$fixedBody)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.$fixedBodyRight && this.options.fixedRightNumber) {
|
||||||
|
updateFixedBody(this.$fixedHeaderRight, this.$fixedBodyRight)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoading () {
|
||||||
|
super.hideLoading()
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedNumber) {
|
||||||
|
this.$fixedColumns.find('.fixed-table-loading').hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedRightNumber) {
|
||||||
|
this.$fixedColumnsRight.find('.fixed-table-loading').hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initFixedColumnsHeader () {
|
||||||
|
if (this.options.height) {
|
||||||
|
this.needFixedColumns = this.$tableHeader.outerWidth(true) < this.$tableHeader.find('table').outerWidth(true)
|
||||||
|
} else {
|
||||||
|
this.needFixedColumns = this.$tableBody.outerWidth(true) < this.$tableBody.find('table').outerWidth(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
const initFixedHeader = ($fixedColumns, isRight) => {
|
||||||
|
$fixedColumns.find('.fixed-table-header').remove()
|
||||||
|
$fixedColumns.append(this.$tableHeader.clone(true))
|
||||||
|
|
||||||
|
$fixedColumns.css({
|
||||||
|
width: this.getFixedColumnsWidth(isRight)
|
||||||
|
})
|
||||||
|
return $fixedColumns.find('.fixed-table-header')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedNumber) {
|
||||||
|
this.$fixedHeader = initFixedHeader(this.$fixedColumns)
|
||||||
|
this.$fixedHeader.css('margin-right', '')
|
||||||
|
} else if (this.$fixedColumns) {
|
||||||
|
this.$fixedColumns.html('').css('width', '')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedRightNumber) {
|
||||||
|
this.$fixedHeaderRight = initFixedHeader(this.$fixedColumnsRight, true)
|
||||||
|
this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find('table').width())
|
||||||
|
} else if (this.$fixedColumnsRight) {
|
||||||
|
this.$fixedColumnsRight.html('').css('width', '')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.initFixedColumnsBody()
|
||||||
|
this.initFixedColumnsEvents()
|
||||||
|
}
|
||||||
|
|
||||||
|
initFixedColumnsBody () {
|
||||||
|
const initFixedBody = ($fixedColumns, $fixedHeader) => {
|
||||||
|
$fixedColumns.find('.fixed-table-body').remove()
|
||||||
|
$fixedColumns.append(this.$tableBody.clone(true))
|
||||||
|
$fixedColumns.find('.fixed-table-body table').removeAttr('id')
|
||||||
|
|
||||||
|
const $fixedBody = $fixedColumns.find('.fixed-table-body')
|
||||||
|
|
||||||
|
const tableBody = this.$tableBody.get(0)
|
||||||
|
const scrollHeight = tableBody.scrollWidth > tableBody.clientWidth ?
|
||||||
|
Utils.getScrollBarWidth() : 0
|
||||||
|
const height = this.$tableContainer.outerHeight(true) - scrollHeight - 1
|
||||||
|
|
||||||
|
$fixedColumns.css({
|
||||||
|
height
|
||||||
|
})
|
||||||
|
|
||||||
|
$fixedBody.css({
|
||||||
|
height: height - $fixedHeader.height()
|
||||||
|
})
|
||||||
|
|
||||||
|
return $fixedBody
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedNumber) {
|
||||||
|
this.$fixedBody = initFixedBody(this.$fixedColumns, this.$fixedHeader)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedRightNumber) {
|
||||||
|
this.$fixedBodyRight = initFixedBody(this.$fixedColumnsRight, this.$fixedHeaderRight)
|
||||||
|
this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find('table').width())
|
||||||
|
this.$fixedBodyRight.css('overflow-y', this.options.height ? 'auto' : 'hidden')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getFixedColumnsWidth (isRight) {
|
||||||
|
let visibleFields = this.getVisibleFields()
|
||||||
|
let width = 0
|
||||||
|
let fixedNumber = this.options.fixedNumber
|
||||||
|
let marginRight = 0
|
||||||
|
|
||||||
|
if (isRight) {
|
||||||
|
visibleFields = visibleFields.reverse()
|
||||||
|
fixedNumber = this.options.fixedRightNumber
|
||||||
|
marginRight = parseInt(this.$tableHeader.css('margin-right'), 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < fixedNumber; i++) {
|
||||||
|
width += this.$header.find(`th[data-field="${visibleFields[i]}"]`).outerWidth(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
return width + marginRight + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
initFixedColumnsEvents () {
|
||||||
|
const toggleHover = (e, toggle) => {
|
||||||
|
const tr = `tr[data-index="${$(e.currentTarget).data('index')}"]`
|
||||||
|
let $trs = this.$tableBody.find(tr)
|
||||||
|
|
||||||
|
if (this.$fixedBody) {
|
||||||
|
$trs = $trs.add(this.$fixedBody.find(tr))
|
||||||
|
}
|
||||||
|
if (this.$fixedBodyRight) {
|
||||||
|
$trs = $trs.add(this.$fixedBodyRight.find(tr))
|
||||||
|
}
|
||||||
|
|
||||||
|
$trs.css('background-color', toggle ? $(e.currentTarget).css('background-color') : '')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$tableBody.find('tr').hover(e => {
|
||||||
|
toggleHover(e, true)
|
||||||
|
}, e => {
|
||||||
|
toggleHover(e, false)
|
||||||
|
})
|
||||||
|
|
||||||
|
const isFirefox = typeof navigator !== 'undefined' &&
|
||||||
|
navigator.userAgent.toLowerCase().indexOf('firefox') > -1
|
||||||
|
const mousewheel = isFirefox ? 'DOMMouseScroll' : 'mousewheel'
|
||||||
|
const updateScroll = (e, fixedBody) => {
|
||||||
|
const normalized = normalizeWheel(e)
|
||||||
|
const deltaY = Math.ceil(normalized.pixelY)
|
||||||
|
const top = this.$tableBody.scrollTop() + deltaY
|
||||||
|
|
||||||
|
if (
|
||||||
|
deltaY < 0 && top > 0 ||
|
||||||
|
deltaY > 0 && top < fixedBody.scrollHeight - fixedBody.clientHeight
|
||||||
|
) {
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$tableBody.scrollTop(top)
|
||||||
|
if (this.$fixedBody) {
|
||||||
|
this.$fixedBody.scrollTop(top)
|
||||||
|
}
|
||||||
|
if (this.$fixedBodyRight) {
|
||||||
|
this.$fixedBodyRight.scrollTop(top)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedNumber) {
|
||||||
|
this.$fixedBody.find('tr').hover(e => {
|
||||||
|
toggleHover(e, true)
|
||||||
|
}, e => {
|
||||||
|
toggleHover(e, false)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$fixedBody[0].addEventListener(mousewheel, e => {
|
||||||
|
updateScroll(e, this.$fixedBody[0])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedRightNumber) {
|
||||||
|
this.$fixedBodyRight.find('tr').hover(e => {
|
||||||
|
toggleHover(e, true)
|
||||||
|
}, e => {
|
||||||
|
toggleHover(e, false)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$fixedBodyRight.off('scroll').on('scroll', () => {
|
||||||
|
const top = this.$fixedBodyRight.scrollTop()
|
||||||
|
|
||||||
|
this.$tableBody.scrollTop(top)
|
||||||
|
if (this.$fixedBody) {
|
||||||
|
this.$fixedBody.scrollTop(top)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.options.filterControl) {
|
||||||
|
$(this.$fixedColumns).off('keyup change').on('keyup change', e => {
|
||||||
|
const $target = $(e.target)
|
||||||
|
const value = $target.val()
|
||||||
|
const field = $target.parents('th').data('field')
|
||||||
|
const $coreTh = this.$header.find(`th[data-field="${field}"]`)
|
||||||
|
|
||||||
|
if ($target.is('input')) {
|
||||||
|
$coreTh.find('input').val(value)
|
||||||
|
} else if ($target.is('select')) {
|
||||||
|
const $select = $coreTh.find('select')
|
||||||
|
|
||||||
|
$select.find('option[selected]').removeAttr('selected')
|
||||||
|
$select.find(`option[value="${value}"]`).attr('selected', true)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.triggerSearch()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderStickyHeader () {
|
||||||
|
if (!this.options.stickyHeader) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$stickyContainer = this.$container.find('.sticky-header-container')
|
||||||
|
super.renderStickyHeader()
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedNumber) {
|
||||||
|
this.$fixedColumns.css('z-index', 101)
|
||||||
|
.find('.sticky-header-container')
|
||||||
|
.css('right', '')
|
||||||
|
.width(this.$fixedColumns.outerWidth())
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.needFixedColumns && this.options.fixedRightNumber) {
|
||||||
|
const $stickyHeaderContainerRight = this.$fixedColumnsRight.find('.sticky-header-container')
|
||||||
|
|
||||||
|
this.$fixedColumnsRight.css('z-index', 101)
|
||||||
|
$stickyHeaderContainerRight.css('left', '')
|
||||||
|
.scrollLeft($stickyHeaderContainerRight.find('.table').outerWidth())
|
||||||
|
.width(this.$fixedColumnsRight.outerWidth())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
matchPositionX () {
|
||||||
|
if (!this.options.stickyHeader) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$stickyContainer.eq(0).scrollLeft(this.$tableBody.scrollLeft())
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,109 @@
|
||||||
|
/**
|
||||||
|
* @author: Dustin Utecht
|
||||||
|
* @github: https://github.com/UtechtDustin
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Utils = $.fn.bootstrapTable.utils
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
|
customView: false,
|
||||||
|
showCustomView: false,
|
||||||
|
showCustomViewButton: false
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults.icons, {
|
||||||
|
customView: {
|
||||||
|
bootstrap3: 'glyphicon glyphicon-eye-open',
|
||||||
|
bootstrap5: 'bi-eye',
|
||||||
|
bootstrap4: 'fa fa-eye',
|
||||||
|
semantic: 'fa fa-eye',
|
||||||
|
foundation: 'fa fa-eye',
|
||||||
|
bulma: 'fa fa-eye',
|
||||||
|
materialize: 'remove_red_eye'
|
||||||
|
}[$.fn.bootstrapTable.theme] || 'fa-eye'
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
|
onCustomViewPostBody () {
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
onCustomViewPreBody () {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.locales, {
|
||||||
|
formatToggleCustomView () {
|
||||||
|
return 'Toggle custom view'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales)
|
||||||
|
|
||||||
|
$.fn.bootstrapTable.methods.push('toggleCustomView')
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||||
|
'custom-view-post-body.bs.table': 'onCustomViewPostBody',
|
||||||
|
'custom-view-pre-body.bs.table': 'onCustomViewPreBody'
|
||||||
|
})
|
||||||
|
|
||||||
|
$.BootstrapTable = class extends $.BootstrapTable {
|
||||||
|
|
||||||
|
init () {
|
||||||
|
this.showCustomView = this.options.showCustomView
|
||||||
|
|
||||||
|
super.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
initToolbar (...args) {
|
||||||
|
if (this.options.customView && this.options.showCustomViewButton) {
|
||||||
|
this.buttons = Object.assign(this.buttons, {
|
||||||
|
customView: {
|
||||||
|
text: this.options.formatToggleCustomView(),
|
||||||
|
icon: this.options.icons.customView,
|
||||||
|
event: this.toggleCustomView,
|
||||||
|
attributes: {
|
||||||
|
'aria-label': this.options.formatToggleCustomView(),
|
||||||
|
title: this.options.formatToggleCustomView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
super.initToolbar(...args)
|
||||||
|
}
|
||||||
|
|
||||||
|
initBody () {
|
||||||
|
super.initBody()
|
||||||
|
|
||||||
|
if (!this.options.customView) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const $table = this.$el
|
||||||
|
const $customViewContainer = this.$container.find('.fixed-table-custom-view')
|
||||||
|
|
||||||
|
$table.hide()
|
||||||
|
$customViewContainer.hide()
|
||||||
|
if (!this.options.customView || !this.showCustomView) {
|
||||||
|
$table.show()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = this.getData().slice(this.pageFrom - 1, this.pageTo)
|
||||||
|
const value = Utils.calculateObjectValue(this, this.options.customView, [data], '')
|
||||||
|
|
||||||
|
this.trigger('custom-view-pre-body', data, value)
|
||||||
|
if ($customViewContainer.length === 1) {
|
||||||
|
$customViewContainer.show().html(value)
|
||||||
|
} else {
|
||||||
|
this.$tableBody.after(`<div class="fixed-table-custom-view">${value}</div>`)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.trigger('custom-view-post-body', data, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleCustomView () {
|
||||||
|
this.showCustomView = !this.showCustomView
|
||||||
|
this.initBody()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,663 @@
|
||||||
|
/*! X-editable - v1.5.1
|
||||||
|
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||||
|
* http://github.com/vitalets/x-editable
|
||||||
|
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||||
|
.editableform {
|
||||||
|
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||||
|
}
|
||||||
|
|
||||||
|
.editableform .control-group {
|
||||||
|
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||||
|
white-space: nowrap; /* prevent wrapping buttons on new line */
|
||||||
|
line-height: 20px; /* overwriting bootstrap line-height. See #133 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
BS3 width:1005 for inputs breaks editable form in popup
|
||||||
|
See: https://github.com/vitalets/x-editable/issues/393
|
||||||
|
*/
|
||||||
|
.editableform .form-control {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-buttons {
|
||||||
|
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||||
|
vertical-align: top;
|
||||||
|
margin-left: 7px;
|
||||||
|
/* inline-block emulation for IE7*/
|
||||||
|
zoom: 1;
|
||||||
|
*display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-buttons.editable-buttons-bottom {
|
||||||
|
display: block;
|
||||||
|
margin-top: 7px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-input {
|
||||||
|
vertical-align: top;
|
||||||
|
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||||
|
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
|
||||||
|
white-space: normal; /* reset white-space decalred in parent*/
|
||||||
|
/* display-inline emulation for IE7*/
|
||||||
|
zoom: 1;
|
||||||
|
*display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-buttons .editable-cancel {
|
||||||
|
margin-left: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*for jquery-ui buttons need set height to look more pretty*/
|
||||||
|
.editable-buttons button.ui-button-icon-only {
|
||||||
|
height: 24px;
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editableform-loading {
|
||||||
|
background: url('loading.gif') center center no-repeat;
|
||||||
|
height: 25px;
|
||||||
|
width: auto;
|
||||||
|
min-width: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-inline .editableform-loading {
|
||||||
|
background-position: left 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-error-block {
|
||||||
|
max-width: 300px;
|
||||||
|
margin: 5px 0 0 0;
|
||||||
|
width: auto;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*add padding for jquery ui*/
|
||||||
|
.editable-error-block.ui-state-error {
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-error {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- For specific types ---- */
|
||||||
|
|
||||||
|
.editableform .editable-date {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
|
||||||
|
.editable-inline .add-on .icon-th {
|
||||||
|
margin-top: 3px;
|
||||||
|
margin-left: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* checklist vertical alignment */
|
||||||
|
.editable-checklist label input[type="checkbox"],
|
||||||
|
.editable-checklist label span {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-checklist label {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set exact width of textarea to fit buttons toolbar */
|
||||||
|
.editable-wysihtml5 {
|
||||||
|
width: 566px;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clear button shown as link in date inputs */
|
||||||
|
.editable-clear {
|
||||||
|
clear: both;
|
||||||
|
font-size: 0.9em;
|
||||||
|
text-decoration: none;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IOS-style clear button for text inputs */
|
||||||
|
.editable-clear-x {
|
||||||
|
background: url('clear.png') center center no-repeat;
|
||||||
|
display: block;
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0.6;
|
||||||
|
z-index: 100;
|
||||||
|
|
||||||
|
top: 50%;
|
||||||
|
right: 6px;
|
||||||
|
margin-top: -6px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-clear-x:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-pre-wrapped {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
.editable-container.editable-popup {
|
||||||
|
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-container.popover {
|
||||||
|
width: auto; /* without this rule popover does not stretch */
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-container.editable-inline {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
width: auto;
|
||||||
|
/* inline-block emulation for IE7*/
|
||||||
|
zoom: 1;
|
||||||
|
*display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-container.ui-widget {
|
||||||
|
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
|
||||||
|
z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */
|
||||||
|
}
|
||||||
|
.editable-click,
|
||||||
|
a.editable-click,
|
||||||
|
a.editable-click:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
border-bottom: dashed 1px #0088cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-click.editable-disabled,
|
||||||
|
a.editable-click.editable-disabled,
|
||||||
|
a.editable-click.editable-disabled:hover {
|
||||||
|
color: #585858;
|
||||||
|
cursor: default;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-empty, .editable-empty:hover, .editable-empty:focus{
|
||||||
|
font-style: italic;
|
||||||
|
color: #DD1144;
|
||||||
|
/* border-bottom: none; */
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-unsaved {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-unsaved:after {
|
||||||
|
/* content: '*'*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.editable-bg-transition {
|
||||||
|
-webkit-transition: background-color 1400ms ease-out;
|
||||||
|
-moz-transition: background-color 1400ms ease-out;
|
||||||
|
-o-transition: background-color 1400ms ease-out;
|
||||||
|
-ms-transition: background-color 1400ms ease-out;
|
||||||
|
transition: background-color 1400ms ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*see https://github.com/vitalets/x-editable/issues/139 */
|
||||||
|
.form-horizontal .editable
|
||||||
|
{
|
||||||
|
padding-top: 5px;
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Datepicker for Bootstrap
|
||||||
|
*
|
||||||
|
* Copyright 2012 Stefan Petre
|
||||||
|
* Improvements by Andrew Rowls
|
||||||
|
* Licensed under the Apache License v2.0
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
.datepicker {
|
||||||
|
padding: 4px;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
-moz-border-radius: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
direction: ltr;
|
||||||
|
/*.dow {
|
||||||
|
border-top: 1px solid #ddd !important;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
.datepicker-inline {
|
||||||
|
width: 220px;
|
||||||
|
}
|
||||||
|
.datepicker.datepicker-rtl {
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
.datepicker.datepicker-rtl table tr td span {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.datepicker-dropdown {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.datepicker-dropdown:before {
|
||||||
|
content: '';
|
||||||
|
display: inline-block;
|
||||||
|
border-left: 7px solid transparent;
|
||||||
|
border-right: 7px solid transparent;
|
||||||
|
border-bottom: 7px solid #ccc;
|
||||||
|
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||||
|
position: absolute;
|
||||||
|
top: -7px;
|
||||||
|
left: 6px;
|
||||||
|
}
|
||||||
|
.datepicker-dropdown:after {
|
||||||
|
content: '';
|
||||||
|
display: inline-block;
|
||||||
|
border-left: 6px solid transparent;
|
||||||
|
border-right: 6px solid transparent;
|
||||||
|
border-bottom: 6px solid #ffffff;
|
||||||
|
position: absolute;
|
||||||
|
top: -6px;
|
||||||
|
left: 7px;
|
||||||
|
}
|
||||||
|
.datepicker > div {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.datepicker.days div.datepicker-days {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.datepicker.months div.datepicker-months {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.datepicker.years div.datepicker-years {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.datepicker table {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.datepicker td,
|
||||||
|
.datepicker th {
|
||||||
|
text-align: center;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
-moz-border-radius: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.table-striped .datepicker table tr td,
|
||||||
|
.table-striped .datepicker table tr th {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.day:hover {
|
||||||
|
background: #eeeeee;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.old,
|
||||||
|
.datepicker table tr td.new {
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.disabled,
|
||||||
|
.datepicker table tr td.disabled:hover {
|
||||||
|
background: none;
|
||||||
|
color: #999999;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.today,
|
||||||
|
.datepicker table tr td.today:hover,
|
||||||
|
.datepicker table tr td.today.disabled,
|
||||||
|
.datepicker table tr td.today.disabled:hover {
|
||||||
|
background-color: #fde19a;
|
||||||
|
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
|
||||||
|
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
|
||||||
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
|
||||||
|
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
|
||||||
|
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
|
||||||
|
background-image: linear-gradient(top, #fdd49a, #fdf59a);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
|
||||||
|
border-color: #fdf59a #fdf59a #fbed50;
|
||||||
|
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.today:hover,
|
||||||
|
.datepicker table tr td.today:hover:hover,
|
||||||
|
.datepicker table tr td.today.disabled:hover,
|
||||||
|
.datepicker table tr td.today.disabled:hover:hover,
|
||||||
|
.datepicker table tr td.today:active,
|
||||||
|
.datepicker table tr td.today:hover:active,
|
||||||
|
.datepicker table tr td.today.disabled:active,
|
||||||
|
.datepicker table tr td.today.disabled:hover:active,
|
||||||
|
.datepicker table tr td.today.active,
|
||||||
|
.datepicker table tr td.today:hover.active,
|
||||||
|
.datepicker table tr td.today.disabled.active,
|
||||||
|
.datepicker table tr td.today.disabled:hover.active,
|
||||||
|
.datepicker table tr td.today.disabled,
|
||||||
|
.datepicker table tr td.today:hover.disabled,
|
||||||
|
.datepicker table tr td.today.disabled.disabled,
|
||||||
|
.datepicker table tr td.today.disabled:hover.disabled,
|
||||||
|
.datepicker table tr td.today[disabled],
|
||||||
|
.datepicker table tr td.today:hover[disabled],
|
||||||
|
.datepicker table tr td.today.disabled[disabled],
|
||||||
|
.datepicker table tr td.today.disabled:hover[disabled] {
|
||||||
|
background-color: #fdf59a;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.today:active,
|
||||||
|
.datepicker table tr td.today:hover:active,
|
||||||
|
.datepicker table tr td.today.disabled:active,
|
||||||
|
.datepicker table tr td.today.disabled:hover:active,
|
||||||
|
.datepicker table tr td.today.active,
|
||||||
|
.datepicker table tr td.today:hover.active,
|
||||||
|
.datepicker table tr td.today.disabled.active,
|
||||||
|
.datepicker table tr td.today.disabled:hover.active {
|
||||||
|
background-color: #fbf069 \9;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.today:hover:hover {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.today.active:hover {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.range,
|
||||||
|
.datepicker table tr td.range:hover,
|
||||||
|
.datepicker table tr td.range.disabled,
|
||||||
|
.datepicker table tr td.range.disabled:hover {
|
||||||
|
background: #eeeeee;
|
||||||
|
-webkit-border-radius: 0;
|
||||||
|
-moz-border-radius: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.range.today,
|
||||||
|
.datepicker table tr td.range.today:hover,
|
||||||
|
.datepicker table tr td.range.today.disabled,
|
||||||
|
.datepicker table tr td.range.today.disabled:hover {
|
||||||
|
background-color: #f3d17a;
|
||||||
|
background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a);
|
||||||
|
background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a);
|
||||||
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a));
|
||||||
|
background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a);
|
||||||
|
background-image: -o-linear-gradient(top, #f3c17a, #f3e97a);
|
||||||
|
background-image: linear-gradient(top, #f3c17a, #f3e97a);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0);
|
||||||
|
border-color: #f3e97a #f3e97a #edde34;
|
||||||
|
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||||
|
-webkit-border-radius: 0;
|
||||||
|
-moz-border-radius: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.range.today:hover,
|
||||||
|
.datepicker table tr td.range.today:hover:hover,
|
||||||
|
.datepicker table tr td.range.today.disabled:hover,
|
||||||
|
.datepicker table tr td.range.today.disabled:hover:hover,
|
||||||
|
.datepicker table tr td.range.today:active,
|
||||||
|
.datepicker table tr td.range.today:hover:active,
|
||||||
|
.datepicker table tr td.range.today.disabled:active,
|
||||||
|
.datepicker table tr td.range.today.disabled:hover:active,
|
||||||
|
.datepicker table tr td.range.today.active,
|
||||||
|
.datepicker table tr td.range.today:hover.active,
|
||||||
|
.datepicker table tr td.range.today.disabled.active,
|
||||||
|
.datepicker table tr td.range.today.disabled:hover.active,
|
||||||
|
.datepicker table tr td.range.today.disabled,
|
||||||
|
.datepicker table tr td.range.today:hover.disabled,
|
||||||
|
.datepicker table tr td.range.today.disabled.disabled,
|
||||||
|
.datepicker table tr td.range.today.disabled:hover.disabled,
|
||||||
|
.datepicker table tr td.range.today[disabled],
|
||||||
|
.datepicker table tr td.range.today:hover[disabled],
|
||||||
|
.datepicker table tr td.range.today.disabled[disabled],
|
||||||
|
.datepicker table tr td.range.today.disabled:hover[disabled] {
|
||||||
|
background-color: #f3e97a;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.range.today:active,
|
||||||
|
.datepicker table tr td.range.today:hover:active,
|
||||||
|
.datepicker table tr td.range.today.disabled:active,
|
||||||
|
.datepicker table tr td.range.today.disabled:hover:active,
|
||||||
|
.datepicker table tr td.range.today.active,
|
||||||
|
.datepicker table tr td.range.today:hover.active,
|
||||||
|
.datepicker table tr td.range.today.disabled.active,
|
||||||
|
.datepicker table tr td.range.today.disabled:hover.active {
|
||||||
|
background-color: #efe24b \9;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.selected,
|
||||||
|
.datepicker table tr td.selected:hover,
|
||||||
|
.datepicker table tr td.selected.disabled,
|
||||||
|
.datepicker table tr td.selected.disabled:hover {
|
||||||
|
background-color: #9e9e9e;
|
||||||
|
background-image: -moz-linear-gradient(top, #b3b3b3, #808080);
|
||||||
|
background-image: -ms-linear-gradient(top, #b3b3b3, #808080);
|
||||||
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080));
|
||||||
|
background-image: -webkit-linear-gradient(top, #b3b3b3, #808080);
|
||||||
|
background-image: -o-linear-gradient(top, #b3b3b3, #808080);
|
||||||
|
background-image: linear-gradient(top, #b3b3b3, #808080);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0);
|
||||||
|
border-color: #808080 #808080 #595959;
|
||||||
|
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||||
|
color: #fff;
|
||||||
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
|
.datepicker table tr td.selected:hover,
|
||||||
|
.datepicker table tr td.selected:hover:hover,
|
||||||
|
.datepicker table tr td.selected.disabled:hover,
|
||||||
|
.datepicker table tr td.selected.disabled:hover:hover,
|
||||||
|
.datepicker table tr td.selected:active,
|
||||||
|
.datepicker table tr td.selected:hover:active,
|
||||||
|
.datepicker table tr td.selected.disabled:active,
|
||||||
|
.datepicker table tr td.selected.disabled:hover:active,
|
||||||
|
.datepicker table tr td.selected.active,
|
||||||
|
.datepicker table tr td.selected:hover.active,
|
||||||
|
.datepicker table tr td.selected.disabled.active,
|
||||||
|
.datepicker table tr td.selected.disabled:hover.active,
|
||||||
|
.datepicker table tr td.selected.disabled,
|
||||||
|
.datepicker table tr td.selected:hover.disabled,
|
||||||
|
.datepicker table tr td.selected.disabled.disabled,
|
||||||
|
.datepicker table tr td.selected.disabled:hover.disabled,
|
||||||
|
.datepicker table tr td.selected[disabled],
|
||||||
|
.datepicker table tr td.selected:hover[disabled],
|
||||||
|
.datepicker table tr td.selected.disabled[disabled],
|
||||||
|
.datepicker table tr td.selected.disabled:hover[disabled] {
|
||||||
|
background-color: #808080;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.selected:active,
|
||||||
|
.datepicker table tr td.selected:hover:active,
|
||||||
|
.datepicker table tr td.selected.disabled:active,
|
||||||
|
.datepicker table tr td.selected.disabled:hover:active,
|
||||||
|
.datepicker table tr td.selected.active,
|
||||||
|
.datepicker table tr td.selected:hover.active,
|
||||||
|
.datepicker table tr td.selected.disabled.active,
|
||||||
|
.datepicker table tr td.selected.disabled:hover.active {
|
||||||
|
background-color: #666666 \9;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.active,
|
||||||
|
.datepicker table tr td.active:hover,
|
||||||
|
.datepicker table tr td.active.disabled,
|
||||||
|
.datepicker table tr td.active.disabled:hover {
|
||||||
|
background-color: #006dcc;
|
||||||
|
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||||
|
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||||
|
border-color: #0044cc #0044cc #002a80;
|
||||||
|
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||||
|
color: #fff;
|
||||||
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
|
.datepicker table tr td.active:hover,
|
||||||
|
.datepicker table tr td.active:hover:hover,
|
||||||
|
.datepicker table tr td.active.disabled:hover,
|
||||||
|
.datepicker table tr td.active.disabled:hover:hover,
|
||||||
|
.datepicker table tr td.active:active,
|
||||||
|
.datepicker table tr td.active:hover:active,
|
||||||
|
.datepicker table tr td.active.disabled:active,
|
||||||
|
.datepicker table tr td.active.disabled:hover:active,
|
||||||
|
.datepicker table tr td.active.active,
|
||||||
|
.datepicker table tr td.active:hover.active,
|
||||||
|
.datepicker table tr td.active.disabled.active,
|
||||||
|
.datepicker table tr td.active.disabled:hover.active,
|
||||||
|
.datepicker table tr td.active.disabled,
|
||||||
|
.datepicker table tr td.active:hover.disabled,
|
||||||
|
.datepicker table tr td.active.disabled.disabled,
|
||||||
|
.datepicker table tr td.active.disabled:hover.disabled,
|
||||||
|
.datepicker table tr td.active[disabled],
|
||||||
|
.datepicker table tr td.active:hover[disabled],
|
||||||
|
.datepicker table tr td.active.disabled[disabled],
|
||||||
|
.datepicker table tr td.active.disabled:hover[disabled] {
|
||||||
|
background-color: #0044cc;
|
||||||
|
}
|
||||||
|
.datepicker table tr td.active:active,
|
||||||
|
.datepicker table tr td.active:hover:active,
|
||||||
|
.datepicker table tr td.active.disabled:active,
|
||||||
|
.datepicker table tr td.active.disabled:hover:active,
|
||||||
|
.datepicker table tr td.active.active,
|
||||||
|
.datepicker table tr td.active:hover.active,
|
||||||
|
.datepicker table tr td.active.disabled.active,
|
||||||
|
.datepicker table tr td.active.disabled:hover.active {
|
||||||
|
background-color: #003399 \9;
|
||||||
|
}
|
||||||
|
.datepicker table tr td span {
|
||||||
|
display: block;
|
||||||
|
width: 23%;
|
||||||
|
height: 54px;
|
||||||
|
line-height: 54px;
|
||||||
|
float: left;
|
||||||
|
margin: 1%;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
-moz-border-radius: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.datepicker table tr td span:hover {
|
||||||
|
background: #eeeeee;
|
||||||
|
}
|
||||||
|
.datepicker table tr td span.disabled,
|
||||||
|
.datepicker table tr td span.disabled:hover {
|
||||||
|
background: none;
|
||||||
|
color: #999999;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.datepicker table tr td span.active,
|
||||||
|
.datepicker table tr td span.active:hover,
|
||||||
|
.datepicker table tr td span.active.disabled,
|
||||||
|
.datepicker table tr td span.active.disabled:hover {
|
||||||
|
background-color: #006dcc;
|
||||||
|
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||||
|
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||||
|
border-color: #0044cc #0044cc #002a80;
|
||||||
|
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||||
|
color: #fff;
|
||||||
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
|
.datepicker table tr td span.active:hover,
|
||||||
|
.datepicker table tr td span.active:hover:hover,
|
||||||
|
.datepicker table tr td span.active.disabled:hover,
|
||||||
|
.datepicker table tr td span.active.disabled:hover:hover,
|
||||||
|
.datepicker table tr td span.active:active,
|
||||||
|
.datepicker table tr td span.active:hover:active,
|
||||||
|
.datepicker table tr td span.active.disabled:active,
|
||||||
|
.datepicker table tr td span.active.disabled:hover:active,
|
||||||
|
.datepicker table tr td span.active.active,
|
||||||
|
.datepicker table tr td span.active:hover.active,
|
||||||
|
.datepicker table tr td span.active.disabled.active,
|
||||||
|
.datepicker table tr td span.active.disabled:hover.active,
|
||||||
|
.datepicker table tr td span.active.disabled,
|
||||||
|
.datepicker table tr td span.active:hover.disabled,
|
||||||
|
.datepicker table tr td span.active.disabled.disabled,
|
||||||
|
.datepicker table tr td span.active.disabled:hover.disabled,
|
||||||
|
.datepicker table tr td span.active[disabled],
|
||||||
|
.datepicker table tr td span.active:hover[disabled],
|
||||||
|
.datepicker table tr td span.active.disabled[disabled],
|
||||||
|
.datepicker table tr td span.active.disabled:hover[disabled] {
|
||||||
|
background-color: #0044cc;
|
||||||
|
}
|
||||||
|
.datepicker table tr td span.active:active,
|
||||||
|
.datepicker table tr td span.active:hover:active,
|
||||||
|
.datepicker table tr td span.active.disabled:active,
|
||||||
|
.datepicker table tr td span.active.disabled:hover:active,
|
||||||
|
.datepicker table tr td span.active.active,
|
||||||
|
.datepicker table tr td span.active:hover.active,
|
||||||
|
.datepicker table tr td span.active.disabled.active,
|
||||||
|
.datepicker table tr td span.active.disabled:hover.active {
|
||||||
|
background-color: #003399 \9;
|
||||||
|
}
|
||||||
|
.datepicker table tr td span.old,
|
||||||
|
.datepicker table tr td span.new {
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
.datepicker th.datepicker-switch {
|
||||||
|
width: 145px;
|
||||||
|
}
|
||||||
|
.datepicker thead tr:first-child th,
|
||||||
|
.datepicker tfoot tr th {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.datepicker thead tr:first-child th:hover,
|
||||||
|
.datepicker tfoot tr th:hover {
|
||||||
|
background: #eeeeee;
|
||||||
|
}
|
||||||
|
.datepicker .cw {
|
||||||
|
font-size: 10px;
|
||||||
|
width: 12px;
|
||||||
|
padding: 0 2px 0 5px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.datepicker thead tr:first-child th.cw {
|
||||||
|
cursor: default;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
.input-append.date .add-on i,
|
||||||
|
.input-prepend.date .add-on i {
|
||||||
|
display: block;
|
||||||
|
cursor: pointer;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
.input-daterange input {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.input-daterange input:first-child {
|
||||||
|
-webkit-border-radius: 3px 0 0 3px;
|
||||||
|
-moz-border-radius: 3px 0 0 3px;
|
||||||
|
border-radius: 3px 0 0 3px;
|
||||||
|
}
|
||||||
|
.input-daterange input:last-child {
|
||||||
|
-webkit-border-radius: 0 3px 3px 0;
|
||||||
|
-moz-border-radius: 0 3px 3px 0;
|
||||||
|
border-radius: 0 3px 3px 0;
|
||||||
|
}
|
||||||
|
.input-daterange .add-on {
|
||||||
|
display: inline-block;
|
||||||
|
width: auto;
|
||||||
|
min-width: 16px;
|
||||||
|
height: 18px;
|
||||||
|
padding: 4px 5px;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 18px;
|
||||||
|
text-align: center;
|
||||||
|
text-shadow: 0 1px 0 #ffffff;
|
||||||
|
vertical-align: middle;
|
||||||
|
background-color: #eeeeee;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
margin-left: -5px;
|
||||||
|
margin-right: -5px;
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,187 @@
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
/**
|
||||||
|
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||||
|
* extensions: https://github.com/vitalets/x-editable
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Utils = $.fn.bootstrapTable.utils
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
|
editable: true,
|
||||||
|
onEditableInit () {
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
onEditableSave (field, row, rowIndex, oldValue, $el) {
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
onEditableShown (field, row, $el, editable) {
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
onEditableHidden (field, row, $el, reason) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.columnDefaults, {
|
||||||
|
alwaysUseFormatter: false
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||||
|
'editable-init.bs.table': 'onEditableInit',
|
||||||
|
'editable-save.bs.table': 'onEditableSave',
|
||||||
|
'editable-shown.bs.table': 'onEditableShown',
|
||||||
|
'editable-hidden.bs.table': 'onEditableHidden'
|
||||||
|
})
|
||||||
|
|
||||||
|
$.BootstrapTable = class extends $.BootstrapTable {
|
||||||
|
initTable () {
|
||||||
|
super.initTable()
|
||||||
|
|
||||||
|
if (!this.options.editable) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.editedCells = []
|
||||||
|
$.each(this.columns, (i, column) => {
|
||||||
|
if (!column.editable) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const editableOptions = {}
|
||||||
|
const editableDataMarkup = []
|
||||||
|
const editableDataPrefix = 'editable-'
|
||||||
|
const processDataOptions = (key, value) => {
|
||||||
|
// Replace camel case with dashes.
|
||||||
|
const dashKey = key.replace(/([A-Z])/g, $1 => `-${$1.toLowerCase()}`)
|
||||||
|
|
||||||
|
if (dashKey.indexOf(editableDataPrefix) === 0) {
|
||||||
|
editableOptions[dashKey.replace(editableDataPrefix, 'data-')] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each(this.options, processDataOptions)
|
||||||
|
|
||||||
|
column.formatter = column.formatter || (value => value)
|
||||||
|
column._formatter = column._formatter ? column._formatter : column.formatter
|
||||||
|
column.formatter = (value, row, index) => {
|
||||||
|
let result = Utils.calculateObjectValue(column, column._formatter, [value, row, index], value)
|
||||||
|
|
||||||
|
result = typeof result === 'undefined' || result === null ? this.options.undefinedText : result
|
||||||
|
if (this.options.uniqueId !== undefined && !column.alwaysUseFormatter) {
|
||||||
|
const uniqueId = Utils.getItemField(row, this.options.uniqueId, false)
|
||||||
|
|
||||||
|
if ($.inArray(column.field + uniqueId, this.editedCells) !== -1) {
|
||||||
|
result = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each(column, processDataOptions)
|
||||||
|
|
||||||
|
$.each(editableOptions, (key, value) => {
|
||||||
|
editableDataMarkup.push(` ${key}="${value}"`)
|
||||||
|
})
|
||||||
|
|
||||||
|
let noEditFormatter = false
|
||||||
|
const editableOpts = Utils.calculateObjectValue(column,
|
||||||
|
column.editable, [index, row], {})
|
||||||
|
|
||||||
|
if (editableOpts.hasOwnProperty('noEditFormatter')) {
|
||||||
|
noEditFormatter = editableOpts.noEditFormatter(value, row, index)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noEditFormatter === false) {
|
||||||
|
return `<a href="javascript:void(0)"
|
||||||
|
data-name="${column.field}"
|
||||||
|
data-pk="${row[this.options.idField]}"
|
||||||
|
data-value="${result}"
|
||||||
|
${editableDataMarkup.join('')}></a>`
|
||||||
|
}
|
||||||
|
return noEditFormatter
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
initBody (fixedScroll) {
|
||||||
|
super.initBody(fixedScroll)
|
||||||
|
|
||||||
|
if (!this.options.editable) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each(this.columns, (i, column) => {
|
||||||
|
if (!column.editable) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = this.getData({ escape: true })
|
||||||
|
const $field = this.$body.find(`a[data-name="${column.field}"]`)
|
||||||
|
|
||||||
|
$field.each((i, element) => {
|
||||||
|
const $element = $(element)
|
||||||
|
const $tr = $element.closest('tr')
|
||||||
|
const index = $tr.data('index')
|
||||||
|
const row = data[index]
|
||||||
|
|
||||||
|
const editableOpts = Utils.calculateObjectValue(column,
|
||||||
|
column.editable, [index, row, $element], {})
|
||||||
|
|
||||||
|
$element.editable(editableOpts)
|
||||||
|
})
|
||||||
|
|
||||||
|
$field.off('save').on('save', ({ currentTarget }, { submitValue }) => {
|
||||||
|
const $this = $(currentTarget)
|
||||||
|
const data = this.getData()
|
||||||
|
const rowIndex = $this.parents('tr[data-index]').data('index')
|
||||||
|
const row = data[rowIndex]
|
||||||
|
const oldValue = row[column.field]
|
||||||
|
|
||||||
|
if (this.options.uniqueId !== undefined && !column.alwaysUseFormatter) {
|
||||||
|
const uniqueId = Utils.getItemField(row, this.options.uniqueId, false)
|
||||||
|
|
||||||
|
if ($.inArray(column.field + uniqueId, this.editedCells) === -1) {
|
||||||
|
this.editedCells.push(column.field + uniqueId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
submitValue = Utils.escapeHTML(submitValue)
|
||||||
|
$this.data('value', submitValue)
|
||||||
|
row[column.field] = submitValue
|
||||||
|
this.trigger('editable-save', column.field, row, rowIndex, oldValue, $this)
|
||||||
|
this.initBody()
|
||||||
|
})
|
||||||
|
|
||||||
|
$field.off('shown').on('shown', ({ currentTarget }, editable) => {
|
||||||
|
const $this = $(currentTarget)
|
||||||
|
const data = this.getData()
|
||||||
|
const rowIndex = $this.parents('tr[data-index]').data('index')
|
||||||
|
const row = data[rowIndex]
|
||||||
|
|
||||||
|
this.trigger('editable-shown', column.field, row, $this, editable)
|
||||||
|
})
|
||||||
|
|
||||||
|
$field.off('hidden').on('hidden', ({ currentTarget }, reason) => {
|
||||||
|
const $this = $(currentTarget)
|
||||||
|
const data = this.getData()
|
||||||
|
const rowIndex = $this.parents('tr[data-index]').data('index')
|
||||||
|
const row = data[rowIndex]
|
||||||
|
|
||||||
|
this.trigger('editable-hidden', column.field, row, $this, reason)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.trigger('editable-init')
|
||||||
|
}
|
||||||
|
|
||||||
|
getData (params) {
|
||||||
|
const data = super.getData(params)
|
||||||
|
|
||||||
|
if (params && params.escape) {
|
||||||
|
for (const row of data) {
|
||||||
|
for (const [key, value] of Object.entries(row)) {
|
||||||
|
row[key] = Utils.unescapeHTML(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 244 B |
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -0,0 +1,337 @@
|
||||||
|
/**
|
||||||
|
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||||
|
* extensions: https://github.com/hhurz/tableExport.jquery.plugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Utils = $.fn.bootstrapTable.utils
|
||||||
|
|
||||||
|
const TYPE_NAME = {
|
||||||
|
json: 'JSON',
|
||||||
|
xml: 'XML',
|
||||||
|
png: 'PNG',
|
||||||
|
csv: 'CSV',
|
||||||
|
txt: 'TXT',
|
||||||
|
sql: 'SQL',
|
||||||
|
doc: 'MS-Word',
|
||||||
|
excel: 'MS-Excel',
|
||||||
|
xlsx: 'MS-Excel (OpenXML)',
|
||||||
|
powerpoint: 'MS-Powerpoint',
|
||||||
|
pdf: 'PDF'
|
||||||
|
}
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
|
showExport: false,
|
||||||
|
exportDataType: 'basic', // basic, all, selected
|
||||||
|
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
|
||||||
|
exportOptions: {
|
||||||
|
onCellHtmlData (cell, rowIndex, colIndex, htmlData) {
|
||||||
|
if (cell.is('th')) {
|
||||||
|
return cell.find('.th-inner').text()
|
||||||
|
}
|
||||||
|
|
||||||
|
return htmlData
|
||||||
|
}
|
||||||
|
},
|
||||||
|
exportFooter: false
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.columnDefaults, {
|
||||||
|
forceExport: false,
|
||||||
|
forceHide: false
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults.icons, {
|
||||||
|
export: {
|
||||||
|
bootstrap3: 'glyphicon-export icon-share',
|
||||||
|
bootstrap5: 'bi-download',
|
||||||
|
materialize: 'file_download',
|
||||||
|
'bootstrap-table': 'icon-download'
|
||||||
|
}[$.fn.bootstrapTable.theme] || 'fa-download'
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.locales, {
|
||||||
|
formatExport () {
|
||||||
|
return 'Export data'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales)
|
||||||
|
|
||||||
|
$.fn.bootstrapTable.methods.push('exportTable')
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
onExportSaved (exportedRows) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||||
|
'export-saved.bs.table': 'onExportSaved'
|
||||||
|
})
|
||||||
|
|
||||||
|
$.BootstrapTable = class extends $.BootstrapTable {
|
||||||
|
initToolbar (...args) {
|
||||||
|
const o = this.options
|
||||||
|
let exportTypes = o.exportTypes
|
||||||
|
|
||||||
|
this.showToolbar = this.showToolbar || o.showExport
|
||||||
|
|
||||||
|
if (this.options.showExport) {
|
||||||
|
|
||||||
|
if (typeof exportTypes === 'string') {
|
||||||
|
const types = exportTypes.slice(1, -1).replace(/ /g, '').split(',')
|
||||||
|
|
||||||
|
exportTypes = types.map(t => t.slice(1, -1))
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$export = this.$toolbar.find('>.columns div.export')
|
||||||
|
if (this.$export.length) {
|
||||||
|
this.updateExportButton()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.buttons = Object.assign(this.buttons, {
|
||||||
|
export: {
|
||||||
|
html:
|
||||||
|
(() => {
|
||||||
|
if (exportTypes.length === 1) {
|
||||||
|
return `
|
||||||
|
<div class="export ${this.constants.classes.buttonsDropdown}"
|
||||||
|
data-type="${exportTypes[0]}">
|
||||||
|
<button class="${this.constants.buttonsClass}"
|
||||||
|
aria-label="Export"
|
||||||
|
type="button"
|
||||||
|
title="${o.formatExport()}">
|
||||||
|
${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''}
|
||||||
|
${o.showButtonText ? o.formatExport() : ''}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
const html = []
|
||||||
|
|
||||||
|
html.push(`
|
||||||
|
<div class="export ${this.constants.classes.buttonsDropdown}">
|
||||||
|
<button class="${this.constants.buttonsClass} dropdown-toggle"
|
||||||
|
aria-label="Export"
|
||||||
|
${this.constants.dataToggle}="dropdown"
|
||||||
|
type="button"
|
||||||
|
title="${o.formatExport()}">
|
||||||
|
${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''}
|
||||||
|
${o.showButtonText ? o.formatExport() : ''}
|
||||||
|
${this.constants.html.dropdownCaret}
|
||||||
|
</button>
|
||||||
|
${this.constants.html.toolbarDropdown[0]}
|
||||||
|
`)
|
||||||
|
|
||||||
|
for (const type of exportTypes) {
|
||||||
|
if (TYPE_NAME.hasOwnProperty(type)) {
|
||||||
|
const $item = $(Utils.sprintf(this.constants.html.pageDropdownItem, '', TYPE_NAME[type]))
|
||||||
|
|
||||||
|
$item.attr('data-type', type)
|
||||||
|
html.push($item.prop('outerHTML'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
html.push(this.constants.html.toolbarDropdown[1], '</div>')
|
||||||
|
return html.join('')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
super.initToolbar(...args)
|
||||||
|
this.$export = this.$toolbar.find('>.columns div.export')
|
||||||
|
|
||||||
|
if (!this.options.showExport) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateExportButton()
|
||||||
|
let $exportButtons = this.$export.find('[data-type]')
|
||||||
|
|
||||||
|
if (exportTypes.length === 1) {
|
||||||
|
$exportButtons = this.$export.find('button')
|
||||||
|
}
|
||||||
|
|
||||||
|
$exportButtons.click(e => {
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
|
const type = $(e.currentTarget).data('type')
|
||||||
|
const exportOptions = {
|
||||||
|
type,
|
||||||
|
escape: false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.exportTable(exportOptions)
|
||||||
|
})
|
||||||
|
this.handleToolbar()
|
||||||
|
}
|
||||||
|
|
||||||
|
handleToolbar () {
|
||||||
|
if (!this.$export) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (super.handleToolbar) {
|
||||||
|
super.handleToolbar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exportTable (options) {
|
||||||
|
const o = this.options
|
||||||
|
const stateField = this.header.stateField
|
||||||
|
const isCardView = o.cardView
|
||||||
|
|
||||||
|
const doExport = callback => {
|
||||||
|
if (stateField) {
|
||||||
|
this.hideColumn(stateField)
|
||||||
|
}
|
||||||
|
if (isCardView) {
|
||||||
|
this.toggleView()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.columns.forEach(row => {
|
||||||
|
if (row.forceHide) {
|
||||||
|
this.hideColumn(row.field)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const data = this.getData()
|
||||||
|
|
||||||
|
if (o.detailView && o.detailViewIcon) {
|
||||||
|
const detailViewIndex = o.detailViewAlign === 'left' ? 0 : this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options)
|
||||||
|
|
||||||
|
o.exportOptions.ignoreColumn = [detailViewIndex].concat(o.exportOptions.ignoreColumn || [])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (o.exportFooter) {
|
||||||
|
const $footerRow = this.$tableFooter.find('tr').first()
|
||||||
|
const footerData = {}
|
||||||
|
const footerHtml = []
|
||||||
|
|
||||||
|
$.each($footerRow.children(), (index, footerCell) => {
|
||||||
|
const footerCellHtml = $(footerCell).children('.th-inner').first().html()
|
||||||
|
|
||||||
|
footerData[this.columns[index].field] = footerCellHtml === ' ' ? null : footerCellHtml
|
||||||
|
|
||||||
|
// grab footer cell text into cell index-based array
|
||||||
|
footerHtml.push(footerCellHtml)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$body.append(this.$body.children().last()[0].outerHTML)
|
||||||
|
const $lastTableRow = this.$body.children().last()
|
||||||
|
|
||||||
|
$.each($lastTableRow.children(), (index, lastTableRowCell) => {
|
||||||
|
$(lastTableRowCell).html(footerHtml[index])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const hiddenColumns = this.getHiddenColumns()
|
||||||
|
|
||||||
|
hiddenColumns.forEach(row => {
|
||||||
|
if (row.forceExport) {
|
||||||
|
this.showColumn(row.field)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (typeof o.exportOptions.fileName === 'function') {
|
||||||
|
options.fileName = o.exportOptions.fileName()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$el.tableExport($.extend({
|
||||||
|
onAfterSaveToFile: () => {
|
||||||
|
if (o.exportFooter) {
|
||||||
|
this.load(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stateField) {
|
||||||
|
this.showColumn(stateField)
|
||||||
|
}
|
||||||
|
if (isCardView) {
|
||||||
|
this.toggleView()
|
||||||
|
}
|
||||||
|
|
||||||
|
hiddenColumns.forEach(row => {
|
||||||
|
if (row.forceExport) {
|
||||||
|
this.hideColumn(row.field)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.columns.forEach(row => {
|
||||||
|
if (row.forceHide) {
|
||||||
|
this.showColumn(row.field)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (callback) callback()
|
||||||
|
}
|
||||||
|
}, o.exportOptions, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (o.exportDataType === 'all' && o.pagination) {
|
||||||
|
const eventName = o.sidePagination === 'server' ?
|
||||||
|
'post-body.bs.table' : 'page-change.bs.table'
|
||||||
|
const virtualScroll = this.options.virtualScroll
|
||||||
|
|
||||||
|
this.$el.one(eventName, () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
doExport(() => {
|
||||||
|
this.options.virtualScroll = virtualScroll
|
||||||
|
this.togglePagination()
|
||||||
|
})
|
||||||
|
}, 0)
|
||||||
|
})
|
||||||
|
this.options.virtualScroll = false
|
||||||
|
this.togglePagination()
|
||||||
|
this.trigger('export-saved', this.getData())
|
||||||
|
} else if (o.exportDataType === 'selected') {
|
||||||
|
let data = this.getData()
|
||||||
|
let selectedData = this.getSelections()
|
||||||
|
const pagination = o.pagination
|
||||||
|
|
||||||
|
if (!selectedData.length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (o.sidePagination === 'server') {
|
||||||
|
data = {
|
||||||
|
total: o.totalRows,
|
||||||
|
[this.options.dataField]: data
|
||||||
|
}
|
||||||
|
selectedData = {
|
||||||
|
total: selectedData.length,
|
||||||
|
[this.options.dataField]: selectedData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.load(selectedData)
|
||||||
|
if (pagination) {
|
||||||
|
this.togglePagination()
|
||||||
|
}
|
||||||
|
doExport(() => {
|
||||||
|
if (pagination) {
|
||||||
|
this.togglePagination()
|
||||||
|
}
|
||||||
|
this.load(data)
|
||||||
|
})
|
||||||
|
this.trigger('export-saved', selectedData)
|
||||||
|
} else {
|
||||||
|
doExport()
|
||||||
|
this.trigger('export-saved', this.getData(true))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSelected () {
|
||||||
|
super.updateSelected()
|
||||||
|
this.updateExportButton()
|
||||||
|
}
|
||||||
|
|
||||||
|
updateExportButton () {
|
||||||
|
if (this.options.exportDataType === 'selected') {
|
||||||
|
this.$export.find('> button')
|
||||||
|
.prop('disabled', !this.getSelections().length)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
tableExport.jquery.plugin
|
||||||
|
Version 1.10.24
|
||||||
|
Copyright (c) 2015-2021 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
|
||||||
|
Based on https://github.com/kayalshri/tableExport.jquery.plugin
|
||||||
|
Licensed under the MIT License
|
||||||
|
*/
|
||||||
|
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(d,k,y){d instanceof String&&(d=String(d));for(var C=d.length,v=0;v<C;v++){var R=d[v];if(k.call(y,R,v,d))return{i:v,v:R}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,k,y){d!=Array.prototype&&d!=Object.prototype&&(d[k]=y.value)};
|
||||||
|
$jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(d,k,y,C){if(k){y=$jscomp.global;d=d.split(".");for(C=0;C<d.length-1;C++){var v=d[C];v in y||(y[v]={});y=y[v]}d=d[d.length-1];C=y[d];k=k(C);k!=C&&null!=k&&$jscomp.defineProperty(y,d,{configurable:!0,writable:!0,value:k})}};
|
||||||
|
$jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,y){return $jscomp.findInternal(this,d,y).v}},"es6","es3");
|
||||||
|
(function(d){d.fn.tableExport=function(k){function y(b){var c=[];v(b,"thead").each(function(){c.push.apply(c,v(d(this),a.theadSelector).toArray())});return c}function C(b){var c=[];v(b,"tbody").each(function(){c.push.apply(c,v(d(this),a.tbodySelector).toArray())});a.tfootSelector.length&&v(b,"tfoot").each(function(){c.push.apply(c,v(d(this),a.tfootSelector).toArray())});return c}function v(b,a){var c=b[0].tagName,q=b.parents(c).length;return b.find(a).filter(function(){return q===d(this).closest(c).parents(c).length})}
|
||||||
|
function R(b){var a=[],e=0,q=0,f=0;d(b).find("thead").first().find("th").each(function(b,c){b=void 0!==d(c).attr("data-field");"undefined"!==typeof c.parentNode.rowIndex&&q!==c.parentNode.rowIndex&&(q=c.parentNode.rowIndex,e=f=0);var h=J(c);for(e+=h?h:1;f<e;)a[f]=b?d(c).attr("data-field"):f.toString(),f++});return a}function I(b){var a="undefined"!==typeof b[0].rowIndex,e=!1===a&&"undefined"!==typeof b[0].cellIndex,q=e||a?Ja(b):b.is(":visible"),f=b.attr("data-tableexport-display");e&&"none"!==f&&
|
||||||
|
"always"!==f&&(b=d(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,f=b.attr("data-tableexport-display"));a&&"none"!==f&&"always"!==f&&(f=b.closest("table").attr("data-tableexport-display"));return"none"!==f&&(!0===q||"always"===f)}function Ja(b){var a=[];V&&(a=K.filter(function(){var a=!1;this.nodeType===b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex===b[0].rowIndex?a=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex===b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&&
|
||||||
|
"undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex===b[0].parentNode.rowIndex&&(a=!0));return a}));return!1===V||0===a.length}function ta(b,c,e){var q=!1;I(b)?0<a.ignoreColumn.length&&(-1!==d.inArray(e,a.ignoreColumn)||-1!==d.inArray(e-c,a.ignoreColumn)||S.length>e&&"undefined"!==typeof S[e]&&-1!==d.inArray(S[e],a.ignoreColumn))&&(q=!0):q=!0;return q}function E(b,c,e,q,f){if("function"===typeof f){var h=!1;"function"===typeof a.onIgnoreRow&&(h=a.onIgnoreRow(d(b),e));if(!1===h&&
|
||||||
|
(0===a.ignoreRow.length||-1===d.inArray(e,a.ignoreRow)&&-1===d.inArray(e-q,a.ignoreRow))&&I(d(b))){b=v(d(b),c);var n=b.length,l=0,u=0;b.each(function(){var b=d(this),a=J(this),c=T(this),h;d.each(G,function(){if(e>this.s.r&&e<=this.e.r&&l>=this.s.c&&l<=this.e.c)for(h=0;h<=this.e.c-this.s.c;++h)n++,u++,f(null,e,l++)});if(c||a)a=a||1,G.push({s:{r:e,c:l},e:{r:e+(c||1)-1,c:l+a-1}});!1===ta(b,n,u++)&&f(this,e,l++);if(1<a)for(h=0;h<a-1;++h)u++,f(null,e,l++)});d.each(G,function(){if(e>=this.s.r&&e<=this.e.r&&
|
||||||
|
l>=this.s.c&&l<=this.e.c)for(ea=0;ea<=this.e.c-this.s.c;++ea)f(null,e,l++)})}}}function ua(b,a,e,d){if("undefined"!==typeof d.images&&(e=d.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect();var c=b.width/b.height,h=a.width/a.height,q=b.width,l=b.height,u=19.049976/25.4,g=0;h<=c?(l=Math.min(b.height,a.height),q=a.width*l/a.height):h>c&&(q=Math.min(b.width,a.width),l=a.height*q/a.width);q*=u;l*=u;l<b.height&&(g=(b.height-l)/2);try{d.doc.addImage(e.src,b.textPos.x,b.y+g,q,l)}catch(Pa){}b.textPos.x+=
|
||||||
|
q}}function va(b,c){if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return L(b.output());if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(q){ka(a.fileName+".pdf","data:application/pdf"+(c?"":";base64")+",",c?b.output("blob"):b.output())}}function wa(b,a,e){var c=0;"undefined"!==typeof e&&(c=e.colspan);if(0<=c){for(var f=b.width,d=b.textPos.x,
|
||||||
|
n=a.table.columns.indexOf(a.column),l=1;l<c;l++)f+=a.table.columns[n+l].width;1<c&&("right"===b.styles.halign?d=b.textPos.x+f-b.width:"center"===b.styles.halign&&(d=b.textPos.x+(f-b.width)/2));b.width=f;b.textPos.x=d;"undefined"!==typeof e&&1<e.rowspan&&(b.height*=e.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)e=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<e&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1}function xa(b,
|
||||||
|
a,e){"undefined"!==typeof b&&null!==b&&(b.hasAttribute("data-tableexport-canvas")?(a=(new Date).getTime(),d(b).attr("data-tableexport-canvas",a),e.images[a]={url:'[data-tableexport-canvas="'+a+'"]',src:null}):"undefined"!==a&&null!=a&&a.each(function(){if(d(this).is("img")){var a=ya(this.src);e.images[a]={url:this.src,src:this.src}}xa(b,d(this).children(),e)}))}function Ka(b,a){function c(b){if(b.url)if(b.src){var c=new Image;q=++f;c.crossOrigin="Anonymous";c.onerror=c.onload=function(){if(c.complete&&
|
||||||
|
(0===c.src.indexOf("data:image/")&&(c.width=b.width||c.width||0,c.height=b.height||c.height||0),c.width+c.height)){var e=document.createElement("canvas"),d=e.getContext("2d");e.width=c.width;e.height=c.height;d.drawImage(c,0,0);b.src=e.toDataURL("image/png")}--f||a(q)};c.src=b.url}else{var e=d(b.url);e.length&&(q=++f,html2canvas(e[0]).then(function(c){b.src=c.toDataURL("image/png");--f||a(q)}))}}var q=0,f=0;if("undefined"!==typeof b.images)for(var h in b.images)b.images.hasOwnProperty(h)&&c(b.images[h]);
|
||||||
|
(b=f)||(a(q),b=void 0);return b}function za(b,c,e){c.each(function(){if(d(this).is("div")){var c=fa(M(this,"background-color"),[255,255,255]),f=fa(M(this,"border-top-color"),[0,0,0]),h=ha(this,"border-top-width",a.jspdf.unit),n=this.getBoundingClientRect(),l=this.offsetLeft*e.wScaleFactor,u=this.offsetTop*e.hScaleFactor,g=n.width*e.wScaleFactor;n=n.height*e.hScaleFactor;e.doc.setDrawColor.apply(void 0,f);e.doc.setFillColor.apply(void 0,c);e.doc.setLineWidth(h);e.doc.rect(b.x+l,b.y+u,g,n,h?"FD":"F")}else d(this).is("img")&&
|
||||||
|
(c=ya(this.src),ua(b,this,c,e));za(b,d(this).children(),e)})}function Aa(b,c,e){if("function"===typeof e.onAutotableText)e.onAutotableText(e.doc,b,c);else{var q=b.textPos.x,f=b.textPos.y,h={halign:b.styles.halign,valign:b.styles.valign};if(c.length){for(c=c[0];c.previousSibling;)c=c.previousSibling;for(var n=!1,l=!1;c;){var u=c.innerText||c.textContent||"",g=u.length&&" "===u[0]?" ":"",k=1<u.length&&" "===u[u.length-1]?" ":"";!0!==a.preserve.leadingWS&&(u=g+la(u));!0!==a.preserve.trailingWS&&(u=ma(u)+
|
||||||
|
k);d(c).is("br")&&(q=b.textPos.x,f+=e.doc.internal.getFontSize());d(c).is("b")?n=!0:d(c).is("i")&&(l=!0);(n||l)&&e.doc.setFontType(n&&l?"bolditalic":n?"bold":"italic");if(g=e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize()){"linebreak"===b.styles.overflow&&q>b.textPos.x&&q+g>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(u.charAt(0))&&(k=u.charAt(0),g=e.doc.getStringUnitWidth(k)*e.doc.internal.getFontSize(),q+g<=b.textPos.x+b.width&&(e.doc.autoTableText(k,q,f,h),u=u.substring(1,u.length)),g=
|
||||||
|
e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize()),q=b.textPos.x,f+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;u.length&&q+g>b.textPos.x+b.width;)u=u.substring(0,u.length-1),g=e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize();e.doc.autoTableText(u,q,f,h);q+=g}if(n||l)d(c).is("b")?n=!1:d(c).is("i")&&(l=!1),e.doc.setFontType(n||l?n?"bold":"italic":"normal");c=c.nextSibling}b.textPos.x=q;b.textPos.y=f}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,h)}}
|
||||||
|
function W(b,a,e){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function la(b){return null==b?"":b.toString().replace(/^\s+/,"")}function ma(b){return null==b?"":b.toString().replace(/\s+$/,"")}function La(b){if(0===a.date.html.length)return!1;a.date.pattern.lastIndex=0;var c=a.date.pattern.exec(b);if(null==c)return!1;b=+c[a.date.match_y];if(0>b||8099<b)return!1;var e=1*c[a.date.match_m];c=1*c[a.date.match_d];if(!isFinite(c))return!1;
|
||||||
|
var d=new Date(b,e-1,c,0,0,0);return d.getFullYear()===b&&d.getMonth()===e-1&&d.getDate()===c?new Date(Date.UTC(b,e-1,c,0,0,0)):!1}function na(b){b=b||"0";""!==a.numbers.html.thousandsSeparator&&(b=W(b,a.numbers.html.thousandsSeparator,""));"."!==a.numbers.html.decimalMark&&(b=W(b,a.numbers.html.decimalMark,"."));return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Ma(b){-1<b.indexOf("%")?(b=na(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function D(b,c,e,q){var f="",h="text";
|
||||||
|
if(null!==b){var n=d(b);n.removeData("teUserDefText");if(n[0].hasAttribute("data-tableexport-canvas"))var l="";else if(n[0].hasAttribute("data-tableexport-value"))l=(l=n.attr("data-tableexport-value"))?l+"":"",n.data("teUserDefText",1);else if(l=n.html(),"function"===typeof a.onCellHtmlData)l=a.onCellHtmlData(n,c,e,l),n.data("teUserDefText",1);else if(""!==l){b=d.parseHTML(l);var g=0,k=0;l="";d.each(b,function(){if(d(this).is("input"))l+=n.find("input").eq(g++).val();else if(d(this).is("select"))l+=
|
||||||
|
n.find("select option:selected").eq(k++).text();else if(d(this).is("br"))l+="<br>";else{if("undefined"===typeof d(this).html())l+=d(this).text();else if(void 0===jQuery().bootstrapTable||!1===d(this).hasClass("fht-cell")&&!1===d(this).hasClass("filterControl")&&0===n.parents(".detail-view").length)l+=d(this).html();if(d(this).is("a")){var b=n.find("a").attr("href")||"";f="function"===typeof a.onCellHtmlHyperlink?f+a.onCellHtmlHyperlink(n,c,e,b,l):"href"===a.htmlHyperlink?f+b:f+l;l=""}}})}if(l&&""!==
|
||||||
|
l&&!0===a.htmlContent)f=d.trim(l);else if(l&&""!==l)if(""!==n.attr("data-tableexport-cellformat")){var m=l.replace(/\n/g,"\u2028").replace(/(<\s*br([^>]*)>)/gi,"\u2060"),p=d("<div/>").html(m).contents();b=!1;m="";d.each(p.text().split("\u2028"),function(b,c){0<b&&(m+=" ");!0!==a.preserve.leadingWS&&(c=la(c));m+=!0!==a.preserve.trailingWS?ma(c):c});d.each(m.split("\u2060"),function(b,c){0<b&&(f+="\n");!0!==a.preserve.leadingWS&&(c=la(c));!0!==a.preserve.trailingWS&&(c=ma(c));f+=c.replace(/\u00AD/g,
|
||||||
|
"")});f=f.replace(/\u00A0/g," ");if("json"===a.type||"excel"===a.type&&"xmlss"===a.mso.fileFormat||!1===a.numbers.output)b=na(f),!1!==b&&(h="number",f=Number(b));else if(a.numbers.html.decimalMark!==a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!==a.numbers.output.thousandsSeparator)if(b=na(f),!1!==b){p=(""+b.substr(0>b?1:0)).split(".");1===p.length&&(p[1]="");var t=3<p[0].length?p[0].length%3:0;h="number";f=(0>b?"-":"")+(a.numbers.output.thousandsSeparator?(t?p[0].substr(0,t)+a.numbers.output.thousandsSeparator:
|
||||||
|
"")+p[0].substr(t).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):p[0])+(p[1].length?a.numbers.output.decimalMark+p[1]:"")}}else f=l;!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(n,c,e,f,h),n.data("teUserDefText",1))}void 0!==q&&(q.type=h);return f}function Ba(b){return 0<b.length&&!0===a.preventInjection&&0<="=+-@".indexOf(b.charAt(0))?"'"+b:b}function Na(b,a,e){return a+"-"+e.toLowerCase()}function fa(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&&
|
||||||
|
(a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function Ca(b){var a=M(b,"text-align"),e=M(b,"font-weight"),d=M(b,"font-style"),f="";"start"===a&&(a="rtl"===M(b,"direction")?"right":"left");700<=e&&(f="bold");"italic"===d&&(f+=d);""===f&&(f="normal");a={style:{align:a,bcolor:fa(M(b,"background-color"),[255,255,255]),color:fa(M(b,"color"),[0,0,0]),fstyle:f},colspan:J(b),rowspan:T(b)};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function J(b){var a=
|
||||||
|
d(b).attr("data-tableexport-colspan");"undefined"===typeof a&&d(b).is("[colspan]")&&(a=d(b).attr("colspan"));return parseInt(a)||0}function T(b){var a=d(b).attr("data-tableexport-rowspan");"undefined"===typeof a&&d(b).is("[rowspan]")&&(a=d(b).attr("rowspan"));return parseInt(a)||0}function M(a,c){try{return window.getComputedStyle?(c=c.replace(/([a-z])([A-Z])/,Na),window.getComputedStyle(a,null).getPropertyValue(c)):a.currentStyle?a.currentStyle[c]:a.style[c]}catch(e){}return""}function ha(a,c,e){c=
|
||||||
|
M(a,c).match(/\d+/);if(null!==c){c=c[0];a=a.parentElement;var b=document.createElement("div");b.style.overflow="hidden";b.style.visibility="hidden";a.appendChild(b);b.style.width=100+e;e=100/b.offsetWidth;a.removeChild(b);return c*e}return 0}function Oa(a){for(var b=new ArrayBuffer(a.length),e=new Uint8Array(b),d=0;d!==a.length;++d)e[d]=a.charCodeAt(d)&255;return b}function oa(a){var b=a.c,e="";for(++b;b;b=Math.floor((b-1)/26))e=String.fromCharCode((b-1)%26+65)+e;return e+(""+(a.r+1))}function pa(a,
|
||||||
|
c){if("undefined"===typeof c||"number"===typeof c)return pa(a.s,a.e);"string"!==typeof a&&(a=oa(a));"string"!==typeof c&&(c=oa(c));return a===c?a:a+":"+c}function Da(a,c){var b=Number(a);if(isFinite(b))return b;var d=1;""!==c.thousandsSeparator&&(a=a.replace(new RegExp("([\\d])"+c.thousandsSeparator+"([\\d])","g"),"$1$2"));"."!==c.decimalMark&&(a=a.replace(new RegExp("([\\d])"+c.decimalMark+"([\\d])","g"),"$1.$2"));a=a.replace(/[$]/g,"").replace(/[%]/g,function(){d*=100;return""});if(isFinite(b=Number(a)))return b/
|
||||||
|
d;a=a.replace(/[(](.*)[)]/,function(a,b){d=-d;return b});return isFinite(b=Number(a))?b/d:b}function ya(a){var b=0,d;if(0===a.length)return b;var q=0;for(d=a.length;q<d;q++){var f=a.charCodeAt(q);b=(b<<5)-b+f;b|=0}return b}function N(b,c,d,q,f,h){var e=!0;"function"===typeof a.onBeforeSaveToFile&&(e=a.onBeforeSaveToFile(b,c,d,q,f),"boolean"!==typeof e&&(e=!0));if(e)try{if(Ea=new Blob([b],{type:d+";charset="+q}),saveAs(Ea,c,!1===h),"function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(b,c)}catch(l){ka(c,
|
||||||
|
"data:"+d+(q.length?";charset="+q:"")+(f.length?";"+f:"")+",",h?"\ufeff"+b:b)}}function ka(b,c,d){var e=window.navigator.userAgent;if(!1!==b&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([d]),b);else if(!1!==b&&(0<e.indexOf("MSIE ")||e.match(/Trident.*rv\:11\./))){if(c=document.createElement("iframe")){document.body.appendChild(c);c.setAttribute("style","display:none");c.contentDocument.open("txt/plain","replace");c.contentDocument.write(d);c.contentDocument.close();
|
||||||
|
c.contentWindow.focus();switch(b.substr(b.lastIndexOf(".")+1)){case "doc":case "json":case "png":case "pdf":case "xls":case "xlsx":b+=".txt"}c.contentDocument.execCommand("SaveAs",!0,b);document.body.removeChild(c)}}else{var f=document.createElement("a");if(f){var h=null;f.style.display="none";!1!==b?f.download=b:f.target="_blank";"object"===typeof d?(window.URL=window.URL||window.webkitURL,e=[],e.push(d),h=window.URL.createObjectURL(new Blob(e,{type:c})),f.href=h):0<=c.toLowerCase().indexOf("base64,")?
|
||||||
|
f.href=c+L(d):f.href=c+encodeURIComponent(d);document.body.appendChild(f);if(document.createEvent)null===ia&&(ia=document.createEvent("MouseEvents")),ia.initEvent("click",!0,!1),f.dispatchEvent(ia);else if(document.createEventObject)f.fireEvent("onclick");else if("function"===typeof f.onclick)f.onclick();setTimeout(function(){h&&window.URL.revokeObjectURL(h);document.body.removeChild(f);if("function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(d,b)},100)}}}function L(a){var b,d="",q=0;if("string"===
|
||||||
|
typeof a){a=a.replace(/\x0d\x0a/g,"\n");var f="";for(b=0;b<a.length;b++){var h=a.charCodeAt(b);128>h?f+=String.fromCharCode(h):(127<h&&2048>h?f+=String.fromCharCode(h>>6|192):(f+=String.fromCharCode(h>>12|224),f+=String.fromCharCode(h>>6&63|128)),f+=String.fromCharCode(h&63|128))}a=f}for(;q<a.length;){var n=a.charCodeAt(q++);f=a.charCodeAt(q++);b=a.charCodeAt(q++);h=n>>2;n=(n&3)<<4|f>>4;var l=(f&15)<<2|b>>6;var g=b&63;isNaN(f)?l=g=64:isNaN(b)&&(g=64);d=d+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)}return d}var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,date:{html:"dd/mm/yyyy"},displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,htmlHyperlink:"content",ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",
|
||||||
|
unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml",
|
||||||
|
onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:"",xslx:{formatId:{date:14,numbers:2}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,onTableExportBegin:null,onTableExportEnd:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageSize:"A4",pageOrientation:"portrait",
|
||||||
|
styles:{header:{background:"#34495E",color:"#FFFFFF",bold:!0,alignment:"center",fillColor:"#34495E"},alternateRow:{fillColor:"#f5f5f5"}},defaultStyle:{color:"#000000",fontSize:8,font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1,trailingWS:!1},preventInjection:!0,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},O={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,
|
||||||
|
595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,
|
||||||
|
161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},B=this,ia=null,r=[],w=[],p=0,t="",S=[],G=[],Ea,K=[],V=!1;d.extend(!0,a,k);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&&
|
||||||
|
(a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation);"undefined"!==typeof a.excelRTL&&"undefined"===a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&&
|
||||||
|
"undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";a.date.html=a.date.html||"";if(a.date.html.length){k=[];k.dd="(3[01]|[12][0-9]|0?[1-9])";k.mm="(1[012]|0?[1-9])";k.yyyy="((?:1[6-9]|2[0-2])\\d{2})";k.yy="(\\d{2})";var z=a.date.html.match(/[^a-zA-Z0-9]/)[0];z=a.date.html.toLowerCase().split(z);a.date.regex="^\\s*";a.date.regex+=k[z[0]];a.date.regex+="(.)";a.date.regex+=k[z[1]];a.date.regex+=
|
||||||
|
"\\2";a.date.regex+=k[z[2]];a.date.regex+="\\s*$";a.date.pattern=new RegExp(a.date.regex,"g");k=z.indexOf("dd")+1;a.date.match_d=k+(1<k?1:0);k=z.indexOf("mm")+1;a.date.match_m=k+(1<k?1:0);k=(0<=z.indexOf("yyyy")?z.indexOf("yyyy"):z.indexOf("yy"))+1;a.date.match_y=k+(1<k?1:0)}S=R(B);if("function"===typeof a.onTableExportBegin)a.onTableExportBegin();if("csv"===a.type||"tsv"===a.type||"txt"===a.type){var P="",Z=0;G=[];p=0;var qa=function(b,c,e){b.each(function(){t="";E(this,c,p,e+b.length,function(b,
|
||||||
|
c,d){var e=t,f="";if(null!==b)if(b=D(b,c,d),c=null===b||""===b?"":b.toString(),"tsv"===a.type)b instanceof Date&&b.toLocaleString(),f=W(c,"\t"," ");else if(b instanceof Date)f=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(f=Ba(c),f=W(f,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=f.indexOf(a.csvSeparator)||/[\r\n ]/g.test(f))f=a.csvEnclosure+f+a.csvEnclosure;t=e+(f+("tsv"===a.type?"\t":a.csvSeparator))});t=d.trim(t).substring(0,t.length-1);0<t.length&&(0<P.length&&(P+="\n"),P+=t);p++});
|
||||||
|
return b.length};Z+=qa(d(B).find("thead").first().find(a.theadSelector),"th,td",Z);v(d(B),"tbody").each(function(){Z+=qa(v(d(this),a.tbodySelector),"td,th",Z)});a.tfootSelector.length&&qa(d(B).find("tfoot").first().find(a.tfootSelector),"td,th",Z);P+="\n";if("string"===a.outputMode)return P;if("base64"===a.outputMode)return L(P);if("window"===a.outputMode){ka(!1,"data:text/"+("csv"===a.type?"csv":"plain")+";charset=utf-8,",P);return}N(P,a.fileName+"."+a.type,"text/"+("csv"===a.type?"csv":"plain"),
|
||||||
|
"utf-8","","csv"===a.type&&a.csvUseBOM)}else if("sql"===a.type){p=0;G=[];var A="INSERT INTO "+a.sql.tableEnclosure+a.tableName+a.sql.tableEnclosure+" (";r=y(d(B));d(r).each(function(){E(this,"th,td",p,r.length,function(b,c,d){b=D(b,c,d)||"";-1<b.indexOf(a.sql.columnEnclosure)&&(b=W(b.toString(),a.sql.columnEnclosure,a.sql.columnEnclosure+a.sql.columnEnclosure));A+=a.sql.columnEnclosure+b+a.sql.columnEnclosure+","});p++;A=d.trim(A).substring(0,A.length-1)});A+=") VALUES ";w=C(d(B));d(w).each(function(){t=
|
||||||
|
"";E(this,"td,th",p,r.length+w.length,function(a,c,d){a=D(a,c,d)||"";-1<a.indexOf("'")&&(a=W(a.toString(),"'","''"));t+="'"+a+"',"});3<t.length&&(A+="("+t,A=d.trim(A).substring(0,A.length-1),A+="),");p++});A=d.trim(A).substring(0,A.length-1);A+=";";if("string"===a.outputMode)return A;if("base64"===a.outputMode)return L(A);N(A,a.fileName+".sql","application/sql","utf-8","",!1)}else if("json"===a.type){var X=[];G=[];r=y(d(B));d(r).each(function(){var a=[];E(this,"th,td",p,r.length,function(b,d,g){a.push(D(b,
|
||||||
|
d,g))});X.push(a)});var ra=[];w=C(d(B));d(w).each(function(){var a={},c=0;E(this,"td,th",p,r.length+w.length,function(b,d,f){X.length?a[X[X.length-1][c]]=D(b,d,f):a[c]=D(b,d,f);c++});!1===d.isEmptyObject(a)&&ra.push(a);p++});k="head"===a.jsonScope?JSON.stringify(X):"data"===a.jsonScope?JSON.stringify(ra):JSON.stringify({header:X,data:ra});if("string"===a.outputMode)return k;if("base64"===a.outputMode)return L(k);N(k,a.fileName+".json","application/json","utf-8","base64",!1)}else if("xml"===a.type){p=
|
||||||
|
0;G=[];var Q='<?xml version="1.0" encoding="utf-8"?>';Q+="<tabledata><fields>";r=y(d(B));d(r).each(function(){E(this,"th,td",p,r.length,function(a,d,e){Q+="<field>"+D(a,d,e)+"</field>"});p++});Q+="</fields><data>";var Fa=1;w=C(d(B));d(w).each(function(){var a=1;t="";E(this,"td,th",p,r.length+w.length,function(b,d,g){t+="<column-"+a+">"+D(b,d,g)+"</column-"+a+">";a++});0<t.length&&"<column-1></column-1>"!==t&&(Q+='<row id="'+Fa+'">'+t+"</row>",Fa++);p++});Q+="</data></tabledata>";if("string"===a.outputMode)return Q;
|
||||||
|
if("base64"===a.outputMode)return L(Q);N(Q,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===a.type&&"xmlss"===a.mso.fileFormat){var sa=[],F=[];d(B).filter(function(){return I(d(this))}).each(function(){function b(a,b,c){var f=[];d(a).each(function(){var b=0,e=0;t="";E(this,"td,th",p,c+a.length,function(a,c,h){if(null!==a){var l="";c=D(a,c,h);h="String";if(!1!==jQuery.isNumeric(c))h="Number";else{var n=Ma(c);!1!==n&&(c=n,h="Number",l+=' ss:StyleID="pct1"')}"Number"!==h&&(c=
|
||||||
|
c.replace(/\n/g,"<br>"));n=J(a);a=T(a);d.each(f,function(){if(p>=this.s.r&&p<=this.e.r&&e>=this.s.c&&e<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)e++,b++});if(a||n)a=a||1,n=n||1,f.push({s:{r:p,c:e},e:{r:p+a-1,c:e+n-1}});1<n&&(l+=' ss:MergeAcross="'+(n-1)+'"',e+=n-1);1<a&&(l+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(l+=' ss:Index="'+(e+1)+'"',b=0);t+="<Cell"+l+'><Data ss:Type="'+h+'">'+d("<div />").text(c).html()+"</Data></Cell>\r";e++}});0<t.length&&(H+='<Row ss:AutoFitHeight="0">\r'+
|
||||||
|
t+"</Row>\r");p++});return a.length}var c=d(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(F.length+1):"undefined"!==typeof a.mso.worksheetName[F.length]&&(e=a.mso.worksheetName[F.length]);e.length||(e=c.find("caption").text()||"");e.length||(e="Table "+(F.length+1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));F.push(d("<div />").text(e).html());!1===a.exportHiddenCells&&(K=c.find("tr, th, td").filter(":hidden"),V=0<K.length);
|
||||||
|
p=0;S=R(this);H="<Table>\r";e=b(y(c),"th,td",0);b(C(c),"td,th",e);H+="</Table>\r";sa.push(H)});k={};z={};for(var m,aa,Y=0,ea=F.length;Y<ea;Y++)m=F[Y],aa=k[m],aa=k[m]=null==aa?1:aa+1,2===aa&&(F[z[m]]=F[z[m]].substring(0,29)+"-1"),1<k[m]?F[Y]=F[Y].substring(0,29)+"-"+k[m]:z[m]=Y;k='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+
|
||||||
|
(new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r';
|
||||||
|
for(z=0;z<sa.length;z++)k+='<Worksheet ss:Name="'+F[z]+'" ss:RightToLeft="'+(a.mso.rtl?"1":"0")+'">\r'+sa[z],k=a.mso.rtl?k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',k+="</Worksheet>\r";k+="</Workbook>\r";if("string"===a.outputMode)return k;if("base64"===a.outputMode)return L(k);N(k,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===
|
||||||
|
a.type&&"xlsx"===a.mso.fileFormat){var ba=[],Ga=XLSX.utils.book_new();d(B).filter(function(){return I(d(this))}).each(function(){for(var b=d(this),c={},e=this.getElementsByTagName("tr"),g={s:{r:0,c:0},e:{r:0,c:0}},f=[],h,n=[],l=0,u=0,k,m,p,t,r,w=XLSX.SSF.get_table();l<e.length&&1E7>u;++l)if(k=e[l],m=!1,"function"===typeof a.onIgnoreRow&&(m=a.onIgnoreRow(d(k),l)),!0!==m&&(0===a.ignoreRow.length||-1===d.inArray(l,a.ignoreRow)&&-1===d.inArray(l-e.length,a.ignoreRow))&&!1!==I(d(k))){var y=k.children,
|
||||||
|
B=0;for(k=0;k<y.length;++k)r=y[k],t=+J(r)||1,B+=t;var z=0;for(k=m=0;k<y.length;++k)if(r=y[k],t=+J(r)||1,h=k+z,!ta(d(r),B,h+(h<m?m-h:0))){z+=t-1;for(h=0;h<f.length;++h){var v=f[h];v.s.c==m&&v.s.r<=u&&u<=v.e.r&&(m=v.e.c+1,h=-1)}(0<(p=+T(r))||1<t)&&f.push({s:{r:u,c:m},e:{r:u+(p||1)-1,c:m+t-1}});var C={type:""};h=D(r,l,k+z,C);v={t:"s",v:h};var A="";if(""!==(d(r).attr("data-tableexport-cellformat")||"")){var x=parseInt(d(r).attr("data-tableexport-xlsxformatid")||0);0===x&&"function"===typeof a.mso.xslx.formatId.numbers&&
|
||||||
|
(x=a.mso.xslx.formatId.numbers(d(r),l,k+z));0===x&&"function"===typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date(d(r),l,k+z));if(49===x||"@"===x)A="s";else if("number"===C.type||0<x&&14>x||36<x&&41>x||48===x)A="n";else if("date"===C.type||13<x&&37>x||44<x&&48>x||56===x)A="d"}else A="s";if(null!=h)if(0===h.length)v.t="z";else if(0!==h.trim().length)if("s"===A)d(r).find("a").length&&(h="href"!==a.htmlHyperlink?h:"",v={f:'=HYPERLINK("'+d(r).find("a").attr("href")+(h.length?'","'+h:"")+'")'});
|
||||||
|
else if("function"===C.type)v={f:h};else if("TRUE"===h)v={t:"b",v:!0};else if("FALSE"===h)v={t:"b",v:!1};else if("n"===A||isFinite(Da(h,a.numbers.output))){if(r=Da(h,a.numbers.output),0===x&&"function"!==typeof a.mso.xslx.formatId.numbers&&(x=a.mso.xslx.formatId.numbers),isFinite(r)||isFinite(h))v={t:"n",v:isFinite(r)?r:h,z:"string"===typeof x?x:x in w?w[x]:"0.00"}}else if(!1!==(r=La(h))||"d"===A)0===x&&"function"!==typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date),v={t:"d",v:!1!==r?r:
|
||||||
|
h,z:"string"===typeof x?x:x in w?w[x]:"m/d/yy"};c[oa({c:m,r:u})]=v;g.e.c<m&&(g.e.c=m);m+=t}++u}f.length&&(c["!merges"]=f);n.length&&(c["!rows"]=n);g.e.r=u-1;c["!ref"]=pa(g);1E7<=u&&(c["!fullref"]=pa((g.e.r=e.length-l+u-1,g)));e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(ba.length+1):"undefined"!==typeof a.mso.worksheetName[ba.length]&&(e=a.mso.worksheetName[ba.length]);e.length||(e=b.find("caption").text()||"");e.length||(e="Table "+(ba.length+
|
||||||
|
1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));ba.push(e);XLSX.utils.book_append_sheet(Ga,c,e)});k=XLSX.write(Ga,{type:"binary",bookType:a.mso.fileFormat,bookSST:!1});N(Oa(k),a.fileName+"."+a.mso.fileFormat,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","UTF-8","",!1)}else if("excel"===a.type||"xls"===a.type||"word"===a.type||"doc"===a.type){k="excel"===a.type||"xls"===a.type?"excel":"word";z="excel"===k?"xls":"doc";m='xmlns:x="urn:schemas-microsoft-com:office:'+
|
||||||
|
k+'"';var H="",ca="";d(B).filter(function(){return I(d(this))}).each(function(){var b=d(this);""===ca&&(ca=a.mso.worksheetName||b.find("caption").text()||"Table",ca=d.trim(ca.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31)));!1===a.exportHiddenCells&&(K=b.find("tr, th, td").filter(":hidden"),V=0<K.length);p=0;G=[];S=R(this);H+="<table><thead>";r=y(b);d(r).each(function(){var b=d(this);t="";E(this,"th,td",p,r.length,function(d,c,f){if(null!==d){var e="";t+="<th";if(a.mso.styles.length){var n=document.defaultView.getComputedStyle(d,
|
||||||
|
null),l=document.defaultView.getComputedStyle(b[0],null),g;for(g in a.mso.styles){var k=n[a.mso.styles[g]];""===k&&(k=l[a.mso.styles[g]]);""!==k&&"0px none rgb(0, 0, 0)"!==k&&"rgba(0, 0, 0, 0)"!==k&&(e+=""===e?'style="':";",e+=a.mso.styles[g]+":"+k)}}""!==e&&(t+=" "+e+'"');e=J(d);0<e&&(t+=' colspan="'+e+'"');e=T(d);0<e&&(t+=' rowspan="'+e+'"');t+=">"+D(d,c,f)+"</th>"}});0<t.length&&(H+="<tr>"+t+"</tr>");p++});H+="</thead><tbody>";w=C(b);d(w).each(function(){var b=d(this);t="";E(this,"td,th",p,r.length+
|
||||||
|
w.length,function(c,g,f){if(null!==c){var e=D(c,g,f),n="",l=d(c).attr("data-tableexport-msonumberformat");"undefined"===typeof l&&"function"===typeof a.mso.onMsoNumberFormat&&(l=a.mso.onMsoNumberFormat(c,g,f));"undefined"!==typeof l&&""!==l&&(n="style=\"mso-number-format:'"+l+"'");if(a.mso.styles.length){g=document.defaultView.getComputedStyle(c,null);f=document.defaultView.getComputedStyle(b[0],null);for(var k in a.mso.styles)l=g[a.mso.styles[k]],""===l&&(l=f[a.mso.styles[k]]),""!==l&&"0px none rgb(0, 0, 0)"!==
|
||||||
|
l&&"rgba(0, 0, 0, 0)"!==l&&(n+=""===n?'style="':";",n+=a.mso.styles[k]+":"+l)}t+="<td";""!==n&&(t+=" "+n+'"');n=J(c);0<n&&(t+=' colspan="'+n+'"');c=T(c);0<c&&(t+=' rowspan="'+c+'"');"string"===typeof e&&""!==e&&(e=Ba(e),e=e.replace(/\n/g,"<br>"));t+=">"+e+"</td>"}});0<t.length&&(H+="<tr>"+t+"</tr>");p++});a.displayTableName&&(H+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+D(d("<p>"+a.tableName+"</p>"))+"</td></tr>");H+="</tbody></table>"});m='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+
|
||||||
|
m+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+k+'; charset=UTF-8">')+"<head>";"excel"===k&&(m+="\x3c!--[if gte mso 9]>",m+="<xml>",m+="<x:ExcelWorkbook>",m+="<x:ExcelWorksheets>",m+="<x:ExcelWorksheet>",m+="<x:Name>",m+=ca,m+="</x:Name>",m+="<x:WorksheetOptions>",m+="<x:DisplayGridlines/>",a.mso.rtl&&(m+="<x:DisplayRightToLeft/>"),m+="</x:WorksheetOptions>",m+="</x:ExcelWorksheet>",m+="</x:ExcelWorksheets>",m+="</x:ExcelWorkbook>",m+=
|
||||||
|
"</xml>",m+="<![endif]--\x3e");m+="<style>";m+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+a.mso.pageOrientation+"; }";m+="@page Section1 {size:"+O[a.mso.pageFormat][0]+"pt "+O[a.mso.pageFormat][1]+"pt";m+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";m+="div.Section1 {page:Section1;}";m+="@page Section2 {size:"+O[a.mso.pageFormat][1]+"pt "+O[a.mso.pageFormat][0]+"pt";m+=";mso-page-orientation:"+a.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";
|
||||||
|
m+="div.Section2 {page:Section2;}";m+="br {mso-data-placement:same-cell;}";m+="</style>";m+="</head>";m+="<body>";m+='<div class="Section'+("landscape"===a.mso.pageOrientation?"2":"1")+'">';m+=H;m+="</div>";m+="</body>";m+="</html>";if("string"===a.outputMode)return m;if("base64"===a.outputMode)return L(m);N(m,a.fileName+"."+z,"application/vnd.ms-"+k,"","base64",!1)}else if("png"===a.type)html2canvas(d(B)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),d=new ArrayBuffer(c.length),
|
||||||
|
g=new Uint8Array(d),f=0;f<c.length;f++)g[f]=c.charCodeAt(f);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return L(b);"window"===a.outputMode?window.open(b):N(d,a.fileName+".png","image/png","","",!1)});else if("pdf"===a.type)if(!0===a.pdfmake.enabled){var U={content:[]};d.extend(!0,U,a.pdfmake.docDefinition);G=[];d(B).filter(function(){return I(d(this))}).each(function(){var b=d(this),c=[],e=[];p=0;var g=function(a,b,c){var f=0;d(a).each(function(){var a=[];E(this,b,p,c,function(c,
|
||||||
|
d,f){if("undefined"!==typeof c&&null!==c){var e=J(c),h=T(c);c={text:D(c,d,f)||" "};if(1<e||1<h)c.colSpan=e||1,c.rowSpan=h||1}else c={text:" "};0<=b.indexOf("th")&&(c.style="header");a.push(c)});for(var d=a.length;d<c;d++)a.push("");a.length&&e.push(a);f<a.length&&(f=a.length);p++});return f};r=y(b);for(var f=g(r,"th,td",r.length),h=c.length;h<f;h++)c.push("*");w=C(b);f=g(w,"td",r.length+w.length);for(h=c.length;h<f;h++)c.push("*");U.content.push({table:{headerRows:r.length?r.length:null,widths:c,
|
||||||
|
body:e},layout:{layout:"noBorders",hLineStyle:function(a,b){return 0},vLineWidth:function(a,b){return 0},hLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},vLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},fillColor:function(b,c,d){return 0===b%2?a.pdfmake.docDefinition.styles.alternateRow.fillColor:
|
||||||
|
null}},pageBreak:U.content.length?"before":void 0})});"undefined"!==typeof pdfMake&&"undefined"!==typeof pdfMake.createPdf&&(pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}},pdfMake.vfs.hasOwnProperty("Mirza-Regular.ttf")?(U.defaultStyle.font="Mirza",d.extend(!0,pdfMake.fonts,{Mirza:{normal:"Mirza-Regular.ttf",bold:"Mirza-Bold.ttf",italics:"Mirza-Medium.ttf",bolditalics:"Mirza-SemiBold.ttf"}})):pdfMake.vfs.hasOwnProperty("gbsn00lp.ttf")?
|
||||||
|
(U.defaultStyle.font="gbsn00lp",d.extend(!0,pdfMake.fonts,{gbsn00lp:{normal:"gbsn00lp.ttf",bold:"gbsn00lp.ttf",italics:"gbsn00lp.ttf",bolditalics:"gbsn00lp.ttf"}})):pdfMake.vfs.hasOwnProperty("ZCOOLXiaoWei-Regular.ttf")&&(U.defaultStyle.font="ZCOOLXiaoWei",d.extend(!0,pdfMake.fonts,{ZCOOLXiaoWei:{normal:"ZCOOLXiaoWei-Regular.ttf",bold:"ZCOOLXiaoWei-Regular.ttf",italics:"ZCOOLXiaoWei-Regular.ttf",bolditalics:"ZCOOLXiaoWei-Regular.ttf"}})),d.extend(!0,pdfMake.fonts,a.pdfmake.fonts),pdfMake.createPdf(U).getBuffer(function(b){N(b,
|
||||||
|
a.fileName+".pdf","application/pdf","","",!1)}))}else if(!1===a.jspdf.autotable){k={dim:{w:ha(d(B).first().get(0),"width","mm"),h:ha(d(B).first().get(0),"height","mm")},pagesplit:!1};var Ha=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);Ha.addHTML(d(B).first(),a.jspdf.margins.left,a.jspdf.margins.top,k,function(){va(Ha,!1)})}else{var g=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var ja="",da="",Ia=0;d(B).each(function(){if(I(d(this))){var a=
|
||||||
|
ha(d(this).get(0),"width","pt");if(a>Ia){a>O.a0[0]&&(ja="a0",da="l");for(var c in O)O.hasOwnProperty(c)&&O[c][1]>a&&(ja=c,da="l",O[c][0]>a&&(da="p"));Ia=a}}});a.jspdf.format=""===ja?"a4":ja;a.jspdf.orientation=""===da?"w":da}if(null==g.doc&&(g.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),g.wScaleFactor=1,g.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(g.doc);!0===g.outputImages&&(g.images={});"undefined"!==typeof g.images&&(d(B).filter(function(){return I(d(this))}).each(function(){var b=
|
||||||
|
0;G=[];!1===a.exportHiddenCells&&(K=d(this).find("tr, th, td").filter(":hidden"),V=0<K.length);r=y(d(this));w=C(d(this));d(w).each(function(){E(this,"td,th",r.length+b,r.length+w.length,function(a){xa(a,d(a).children(),g)});b++})}),r=[],w=[]);Ka(g,function(){d(B).filter(function(){return I(d(this))}).each(function(){var b;p=0;G=[];!1===a.exportHiddenCells&&(K=d(this).find("tr, th, td").filter(":hidden"),V=0<K.length);S=R(this);g.columns=[];g.rows=[];g.teCells={};if("function"===typeof g.onTable&&
|
||||||
|
!1===g.onTable(d(this),a))return!0;a.jspdf.autotable.tableExport=null;var c=d.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=g;c.margin={};d.extend(!0,c.margin,a.jspdf.margins);c.tableExport=g;"function"!==typeof c.beforePageContent&&(c.beforePageContent=function(a){if(1===a.pageCount){var b=a.table.rows.concat(a.table.headerRow);d.each(b,function(){0<this.height&&(this.height+=(2-1.15)/2*this.styles.fontSize,a.table.height+=(2-1.15)/2*this.styles.fontSize)})}});"function"!==typeof c.createdHeaderCell&&
|
||||||
|
(c.createdHeaderCell=function(a,b){a.styles=d.extend({},b.row.styles);if("undefined"!==typeof g.columns[b.column.dataKey]){var e=g.columns[b.column.dataKey];if("undefined"!==typeof e.rect){a.contentWidth=e.rect.width;if("undefined"===typeof g.heightRatio||0===g.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;g.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height*
|
||||||
|
g.heightRatio;f>a.styles.rowHeight&&(a.styles.rowHeight=f)}a.styles.halign="inherit"===c.headerStyles.halign?"center":c.headerStyles.halign;a.styles.valign=c.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===c.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===c.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});
|
||||||
|
"function"!==typeof c.createdCell&&(c.createdCell=function(a,b){b=g.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===c.styles.halign?"center":c.styles.halign;a.styles.valign=c.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===c.styles.halign&&(a.styles.halign=b.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===c.styles.fontStyle&&
|
||||||
|
(a.styles.fontStyle=b.style.fstyle))});"function"!==typeof c.drawHeaderCell&&(c.drawHeaderCell=function(a,b){var c=g.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?wa(a,b,c):!1});"function"!==typeof c.drawCell&&(c.drawCell=function(a,b){var c=g.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof c&&c.isCanvas))wa(a,b,c)&&(g.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"===typeof c||"undefined"!==typeof c.hasUserDefText&&
|
||||||
|
!0===c.hasUserDefText||"undefined"===typeof c.elements||!c.elements.length?Aa(a,{},g):(b=a.height/c.rect.height,b>g.hScaleFactor&&(g.hScaleFactor=b),g.wScaleFactor=a.width/c.rect.width,b=a.textPos.y,za(a,c.elements,g),a.textPos.y=b,Aa(a,c.elements,g)));else{c=c.elements[0];var e=d(c).attr("data-tableexport-canvas"),f=c.getBoundingClientRect();a.width=f.width*g.wScaleFactor;a.height=f.height*g.hScaleFactor;b.row.height=a.height;ua(a,c,e,g)}return!1});g.headerrows=[];r=y(d(this));d(r).each(function(){b=
|
||||||
|
0;g.headerrows[p]=[];E(this,"th,td",p,r.length,function(a,c,d){var e=Ca(a);e.title=D(a,c,d);e.key=b++;e.rowIndex=p;g.headerrows[p].push(e)});p++});if(0<p)for(var e=p-1;0<=e;)d.each(g.headerrows[e],function(){var a=this;0<e&&null===this.rect&&(a=g.headerrows[e-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&g.columns.push(a)}),e=0<g.columns.length?-1:e-1;var k=0;w=[];w=C(d(this));d(w).each(function(){var a=[];b=0;E(this,"td,th",p,r.length+w.length,
|
||||||
|
function(c,e,f){if("undefined"===typeof g.columns[b]){var h={title:"",key:b,style:{hidden:!0}};g.columns.push(h)}a.push(D(c,e,f));"undefined"!==typeof c&&null!==c?(h=Ca(c),h.isCanvas=c.hasAttribute("data-tableexport-canvas"),h.elements=h.isCanvas?d(c):d(c).children(),"undefined"!==typeof d(c).data("teUserDefText")&&(h.hasUserDefText=!0)):(h=d.extend(!0,{},g.teCells[k+":"+(b-1)]),h.colspan=-1);g.teCells[k+":"+b++]=h});a.length&&(g.rows.push(a),k++);p++});if("function"===typeof g.onBeforeAutotable)g.onBeforeAutotable(d(this),
|
||||||
|
g.columns,g.rows,c);g.doc.autoTable(g.columns,g.rows,c);if("function"===typeof g.onAfterAutotable)g.onAfterAutotable(d(this),c);a.jspdf.autotable.startY=g.doc.autoTableEndPosY()+c.margin.top});va(g.doc,"undefined"!==typeof g.images&&!1===jQuery.isEmptyObject(g.images));"undefined"!==typeof g.headerrows&&(g.headerrows.length=0);"undefined"!==typeof g.columns&&(g.columns.length=0);"undefined"!==typeof g.rows&&(g.rows.length=0);delete g.doc;g.doc=null})}if("function"===typeof a.onTableExportEnd)a.onTableExportEnd();
|
||||||
|
return this}})(jQuery);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue